summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtftokenizer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'writerfilter/source/rtftok/rtftokenizer.cxx')
-rw-r--r--writerfilter/source/rtftok/rtftokenizer.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index 03d5d0d3e56a..0b39232cd983 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -182,7 +182,7 @@ void RTFTokenizer::popGroup() { m_nGroup--; }
RTFError RTFTokenizer::resolveKeyword()
{
char ch;
- OStringBuffer aBuf;
+ OStringBuffer aBuf(32);
bool bNeg = false;
bool bParam = false;
int nParam = 0;
@@ -202,6 +202,10 @@ RTFError RTFTokenizer::resolveKeyword()
while (rtl::isAsciiAlpha(static_cast<unsigned char>(ch)))
{
aBuf.append(ch);
+ if (aBuf.getLength() > 32)
+ // See RTF spec v1.9.1, page 7
+ // A control word's name cannot be longer than 32 letters.
+ throw io::BufferSizeExceededException();
Strm().ReadChar(ch);
if (Strm().eof())
{
@@ -209,10 +213,6 @@ RTFError RTFTokenizer::resolveKeyword()
break;
}
}
- if (aBuf.getLength() > 32)
- // See RTF spec v1.9.1, page 7
- // A control word's name cannot be longer than 32 letters.
- throw io::BufferSizeExceededException();
if (ch == '-')
{
='width: 0.0%;'/> -rw-r--r--sw/Library_vbaswobj.mk124
-rw-r--r--sw/Makefile38
-rw-r--r--sw/Module_sw.mk47
-rw-r--r--sw/Package_misc.mk30
-rw-r--r--sw/Package_uiconfig.mk261
-rw-r--r--sw/Package_xml.mk29
-rw-r--r--sw/inc/AnnotationWin.hxx83
-rw-r--r--sw/inc/EnhancedPDFExportHelper.hxx256
-rw-r--r--sw/inc/HandleAnchorNodeChg.hxx81
-rw-r--r--sw/inc/IDocumentChartDataProviderAccess.hxx69
-rw-r--r--sw/inc/IDocumentContentOperations.hxx203
-rwxr-xr-xsw/inc/IDocumentDeviceAccess.hxx145
-rw-r--r--sw/inc/IDocumentDrawModelAccess.hxx111
-rw-r--r--sw/inc/IDocumentExternalData.hxx69
-rw-r--r--sw/inc/IDocumentFieldsAccess.hxx191
-rw-r--r--sw/inc/IDocumentLayoutAccess.hxx82
-rw-r--r--sw/inc/IDocumentLineNumberAccess.hxx51
-rw-r--r--sw/inc/IDocumentLinksAdministration.hxx91
-rw-r--r--sw/inc/IDocumentListItems.hxx61
-rw-r--r--sw/inc/IDocumentListsAccess.hxx57
-rw-r--r--sw/inc/IDocumentMarkAccess.hxx251
-rw-r--r--sw/inc/IDocumentOutlineNodes.hxx57
-rw-r--r--sw/inc/IDocumentRedlineAccess.hxx259
-rw-r--r--sw/inc/IDocumentSettingAccess.hxx213
-rw-r--r--sw/inc/IDocumentState.hxx87
-rw-r--r--sw/inc/IDocumentStatistics.hxx60
-rw-r--r--sw/inc/IDocumentStylePoolAccess.hxx87
-rw-r--r--sw/inc/IDocumentTimerAccess.hxx60
-rw-r--r--sw/inc/IDocumentUndoRedo.hxx283
-rw-r--r--sw/inc/IGrammarContact.hxx87
-rw-r--r--sw/inc/IInterface.hxx67
-rw-r--r--sw/inc/IMark.hxx119
-rw-r--r--sw/inc/IShellCursorSupplier.hxx51
-rw-r--r--sw/inc/PostItMgr.hxx307
-rw-r--r--sw/inc/RefreshListenerContainer.hxx38
-rw-r--r--sw/inc/SidebarWin.hxx274
-rw-r--r--sw/inc/SidebarWindowsTypes.hxx53
-rw-r--r--sw/inc/SwAppletImpl.hxx79
-rw-r--r--sw/inc/SwCapObjType.hxx35
-rw-r--r--sw/inc/SwGetPoolIdFromName.hxx44
-rw-r--r--sw/inc/SwNodeNum.hxx118
-rw-r--r--sw/inc/SwNumberTree.hxx767
-rw-r--r--sw/inc/SwNumberTreeTypes.hxx39
-rw-r--r--sw/inc/SwRewriter.hxx56
-rw-r--r--sw/inc/SwSmartTagMgr.hxx65
-rw-r--r--sw/inc/SwStyleNameMapper.hxx204
-rw-r--r--sw/inc/SwUndoField.hxx93
-rw-r--r--sw/inc/SwXMLSectionList.hxx89
-rw-r--r--sw/inc/TextCursorHelper.hxx54
-rw-r--r--sw/inc/access.hrc75
-rw-r--r--sw/inc/accessibilityoptions.hxx53
-rw-r--r--sw/inc/accmap.hxx329
-rw-r--r--sw/inc/acmplwrd.hxx73
-rw-r--r--sw/inc/anchoreddrawobject.hxx223
-rw-r--r--sw/inc/anchoredobject.hxx642
-rw-r--r--sw/inc/authfld.hxx207
-rw-r--r--sw/inc/authratr.hxx54
-rw-r--r--sw/inc/bparr.hxx126
-rw-r--r--sw/inc/breakit.hxx122
-rw-r--r--sw/inc/calbck.hxx260
-rw-r--r--sw/inc/calc.hxx243
-rw-r--r--sw/inc/ccoll.hxx100
-rw-r--r--sw/inc/cellatr.hxx129
-rw-r--r--sw/inc/cellfml.hxx164
-rw-r--r--sw/inc/charatr.hxx178
-rw-r--r--sw/inc/charfmt.hxx61
-rw-r--r--sw/inc/chcmprse.hxx40
-rw-r--r--sw/inc/checkit.hxx54
-rw-r--r--sw/inc/chpfld.hxx103
-rw-r--r--sw/inc/chrdlg.hrc60
-rw-r--r--sw/inc/cmdid.h1316
-rw-r--r--sw/inc/colwd.hxx62
-rw-r--r--sw/inc/comcore.hrc123
-rw-r--r--sw/inc/crsrsh.hxx962
-rw-r--r--sw/inc/crsskip.hxx42
-rw-r--r--sw/inc/crstate.hxx217
-rw-r--r--sw/inc/cshtyp.hxx119
-rw-r--r--sw/inc/dbfld.hxx338
-rw-r--r--sw/inc/dbgoutsw.hxx127
-rw-r--r--sw/inc/dbmgr.hxx398
-rw-r--r--sw/inc/dbui.hrc126
-rw-r--r--sw/inc/dcontact.hxx549
-rw-r--r--sw/inc/ddefld.hxx118
-rw-r--r--sw/inc/dialog.hrc89
-rw-r--r--sw/inc/dlelstnr.hxx95
-rw-r--r--sw/inc/dobjfac.hxx47
-rw-r--r--sw/inc/doc.hxx2179
-rw-r--r--sw/inc/docary.hxx125
-rw-r--r--sw/inc/docfac.hxx48
-rw-r--r--sw/inc/dochdl.hrc54
-rw-r--r--sw/inc/docsh.hxx320
-rw-r--r--sw/inc/docstat.hxx52
-rw-r--r--sw/inc/docstyle.hxx245
-rw-r--r--sw/inc/docufld.hxx839
-rw-r--r--sw/inc/dpage.hxx64
-rw-r--r--sw/inc/drawdoc.hxx65
-rw-r--r--sw/inc/edglbldc.hxx77
-rw-r--r--sw/inc/edimp.hxx83
-rw-r--r--sw/inc/editsh.hxx974
-rw-r--r--sw/inc/envelp.hrc97
-rw-r--r--sw/inc/errhdl.hxx76
-rw-r--r--sw/inc/error.h50
-rw-r--r--sw/inc/expfld.hxx444
-rw-r--r--sw/inc/extinput.hxx59
-rw-r--r--sw/inc/fchrfmt.hxx84
-rw-r--r--sw/inc/fesh.hxx802
-rw-r--r--sw/inc/fldbas.hxx462
-rw-r--r--sw/inc/flddat.hxx148
-rw-r--r--sw/inc/flddropdown.hxx274
-rw-r--r--sw/inc/fldinit.hxx38
-rw-r--r--sw/inc/fldui.hrc292
-rw-r--r--sw/inc/fldupde.hxx39
-rw-r--r--sw/inc/flyenum.hxx55
-rw-r--r--sw/inc/flypos.hxx60
-rw-r--r--sw/inc/fmtanchr.hxx92
-rw-r--r--sw/inc/fmtautofmt.hxx75
-rw-r--r--sw/inc/fmtclbl.hxx54
-rw-r--r--sw/inc/fmtclds.hxx179
-rw-r--r--sw/inc/fmtcnct.hxx87
-rw-r--r--sw/inc/fmtcntnt.hxx66
-rw-r--r--sw/inc/fmtcol.hxx303
-rw-r--r--sw/inc/fmtcolfunc.hxx89
-rw-r--r--sw/inc/fmteiro.hxx60
-rw-r--r--sw/inc/fmtflcnt.hxx64
-rw-r--r--sw/inc/fmtfld.hxx125
-rw-r--r--sw/inc/fmtfollowtextflow.hxx66
-rw-r--r--sw/inc/fmtfordr.hxx72
-rw-r--r--sw/inc/fmtfsize.hxx113
-rw-r--r--sw/inc/fmtftn.hxx81
-rw-r--r--sw/inc/fmtftntx.hxx137
-rw-r--r--sw/inc/fmthdft.hxx117
-rw-r--r--sw/inc/fmtinfmt.hxx110
-rw-r--r--sw/inc/fmtline.hxx71
-rw-r--r--sw/inc/fmtlsplt.hxx58
-rwxr-xr-xsw/inc/fmtmeta.hxx228
-rw-r--r--sw/inc/fmtornt.hxx143
-rw-r--r--sw/inc/fmtpdsc.hxx104
-rw-r--r--sw/inc/fmtrfmrk.hxx64
-rw-r--r--sw/inc/fmtrowsplt.hxx58
-rw-r--r--sw/inc/fmtruby.hxx91
-rw-r--r--sw/inc/fmtsrnd.hxx93
-rw-r--r--sw/inc/fmtsrndenum.hxx41
-rw-r--r--sw/inc/fmtui.hrc89
-rw-r--r--sw/inc/fmturl.hxx92
-rw-r--r--sw/inc/fmtwrapinfluenceonobjpos.hxx77
-rw-r--r--sw/inc/format.hxx355
-rw-r--r--sw/inc/frmatr.hxx99
-rw-r--r--sw/inc/frmfmt.hxx329
-rw-r--r--sw/inc/ftnidx.hxx79
-rw-r--r--sw/inc/ftninfo.hxx116
-rw-r--r--sw/inc/globals.hrc290
-rw-r--r--sw/inc/globdoc.hxx53
-rw-r--r--sw/inc/grfatr.hxx370
-rw-r--r--sw/inc/helpid.h992
-rw-r--r--sw/inc/hfspacingitem.hxx59
-rw-r--r--sw/inc/hhcwrp.hxx121
-rw-r--r--sw/inc/hintids.hxx486
-rw-r--r--sw/inc/hints.hxx284
-rw-r--r--sw/inc/htmltbl.hxx491
-rw-r--r--sw/inc/index.hrc66
-rw-r--r--sw/inc/index.hxx217
-rw-r--r--sw/inc/inetfld.hxx110
-rw-r--r--sw/inc/init.hxx48
-rw-r--r--sw/inc/io.hxx176
-rw-r--r--sw/inc/iodetect.hxx127
-rw-r--r--sw/inc/istyleaccess.hxx69
-rw-r--r--sw/inc/itabenum.hxx54
-rw-r--r--sw/inc/lineinfo.hxx108
-rw-r--r--sw/inc/linkenum.hxx39
-rw-r--r--sw/inc/list.hxx74
-rw-r--r--sw/inc/listfunc.hxx38
-rw-r--r--sw/inc/mdiexp.hxx78
-rw-r--r--sw/inc/modcfg.hxx343
-rw-r--r--sw/inc/modeltoviewhelper.hxx111
-rw-r--r--sw/inc/ndarr.hxx347
-rw-r--r--sw/inc/ndgrf.hxx257
-rw-r--r--sw/inc/ndhints.hxx229
-rw-r--r--sw/inc/ndindex.hxx243
-rw-r--r--sw/inc/ndnotxt.hxx121
-rw-r--r--sw/inc/ndole.hxx170
-rw-r--r--sw/inc/ndtxt.hxx914
-rw-r--r--sw/inc/ndtyp.hxx69
-rw-r--r--sw/inc/newhdl.hxx73
-rw-r--r--sw/inc/node.hxx768
-rw-r--r--sw/inc/numrule.hxx368
-rw-r--r--sw/inc/pagedesc.hxx349
-rw-r--r--sw/inc/pageiter.hxx53
-rw-r--r--sw/inc/pagepreviewlayout.hxx621
-rw-r--r--sw/inc/pam.hxx280
-rw-r--r--sw/inc/paratr.hxx281
-rw-r--r--sw/inc/pausethreadstarting.hxx48
-rw-r--r--sw/inc/pch/precompiled_sw.cxx29
-rwxr-xr-xsw/inc/pch/precompiled_sw.hxx1002
-rw-r--r--sw/inc/poolfmt.awk86
-rw-r--r--sw/inc/poolfmt.hrc288
-rw-r--r--sw/inc/poolfmt.hxx443
-rw-r--r--sw/inc/postithelper.hxx159
-rw-r--r--sw/inc/printdata.hxx336
-rw-r--r--sw/inc/prtopt.hxx55
-rw-r--r--sw/inc/pvprtdat.hxx79
-rw-r--r--sw/inc/rcid.hrc271
-rw-r--r--sw/inc/redline.hxx314
-rw-r--r--sw/inc/redlnaut.hxx54
-rw-r--r--sw/inc/reffld.hxx164
-rw-r--r--sw/inc/ring.hxx53
-rw-r--r--sw/inc/rubylist.hxx54
-rw-r--r--sw/inc/section.hxx389
-rw-r--r--sw/inc/shellid.hxx73
-rw-r--r--sw/inc/shellio.hxx678
-rw-r--r--sw/inc/shellres.hxx120
-rw-r--r--sw/inc/sortopt.hxx69
-rw-r--r--sw/inc/splargs.hxx180
-rw-r--r--sw/inc/statstr.hrc54
-rw-r--r--sw/inc/stringhash.hxx104
-rw-r--r--sw/inc/sw_primitivetypes2d.hxx46
-rw-r--r--sw/inc/swabstdlg.hxx498
-rw-r--r--sw/inc/swacorr.hxx59
-rw-r--r--sw/inc/swatrset.hxx353
-rw-r--r--sw/inc/swbaslnk.hxx95
-rw-r--r--sw/inc/swcalwrp.hxx55
-rw-r--r--sw/inc/swcli.hxx60
-rw-r--r--sw/inc/swcommands.h434
-rw-r--r--sw/inc/swcrsr.hxx308
-rw-r--r--sw/inc/swdbdata.hxx49
-rw-r--r--sw/inc/swdbtoolsclient.hxx76
-rw-r--r--sw/inc/swddetbl.hxx63
-rw-r--r--sw/inc/swdll.hxx69
-rw-r--r--sw/inc/swdllapi.h13
-rw-r--r--sw/inc/swerror.h112
-rw-r--r--sw/inc/swevent.hxx129
-rw-r--r--sw/inc/swfltopt.hxx44
-rw-r--r--sw/inc/swgstr.hxx148
-rw-r--r--sw/inc/swhints.hxx36
-rwxr-xr-xsw/inc/switerator.hxx47
-rw-r--r--sw/inc/swmodule.hxx278
-rw-r--r--sw/inc/swrect.hxx364
-rw-r--r--sw/inc/swregion.hxx57
-rw-r--r--sw/inc/swserv.hxx93
-rw-r--r--sw/inc/swstyle.h41
-rw-r--r--sw/inc/swtable.hxx494
-rw-r--r--sw/inc/swtblfmt.hxx99
-rw-r--r--sw/inc/swtypes.hxx340
-rw-r--r--sw/inc/swundo.hxx186
-rw-r--r--sw/inc/swunodef.hxx36
-rw-r--r--sw/inc/swunohelper.hxx81
-rw-r--r--sw/inc/swurl.hxx46
-rw-r--r--sw/inc/swwait.hxx44
-rw-r--r--sw/inc/tabcol.hxx107
-rw-r--r--sw/inc/tblafmt.hxx270
-rw-r--r--sw/inc/tblenum.hxx79
-rw-r--r--sw/inc/tblsel.hxx230
-rw-r--r--sw/inc/tgrditem.hxx120
-rw-r--r--sw/inc/tox.hxx797
-rw-r--r--sw/inc/toxe.hxx125
-rw-r--r--sw/inc/toxinit.hxx37
-rw-r--r--sw/inc/toxwrap.hxx77
-rw-r--r--sw/inc/txatbase.hxx244
-rw-r--r--sw/inc/txatritr.hxx99
-rw-r--r--sw/inc/txtatr.hxx129
-rw-r--r--sw/inc/txtflcnt.hxx68
-rw-r--r--sw/inc/txtfld.hxx80
-rw-r--r--sw/inc/txtftn.hxx82
-rw-r--r--sw/inc/txtinet.hxx82
-rw-r--r--sw/inc/txtrfmrk.hxx61
-rw-r--r--sw/inc/txttxmrk.hxx66
-rw-r--r--sw/inc/undobj.hxx335
-rw-r--r--sw/inc/unoatxt.hxx306
-rw-r--r--sw/inc/unobaseclass.hxx174
-rw-r--r--sw/inc/unobookmark.hxx261
-rw-r--r--sw/inc/unochart.hxx432
-rw-r--r--sw/inc/unocoll.hxx581
-rw-r--r--sw/inc/unocore.hrc48
-rw-r--r--sw/inc/unocrsr.hxx115
-rw-r--r--sw/inc/unocrsrhelper.hxx218
-rw-r--r--sw/inc/unodraw.hxx353
-rw-r--r--sw/inc/unoevent.hxx118
-rw-r--r--sw/inc/unoevtlstnr.hxx58
-rw-r--r--sw/inc/unofield.hxx321
-rw-r--r--sw/inc/unoflatpara.hxx146
-rw-r--r--sw/inc/unofootnote.hxx229
-rw-r--r--sw/inc/unoframe.hxx370
-rw-r--r--sw/inc/unoidx.hxx375
-rw-r--r--sw/inc/unomailmerge.hxx206
-rw-r--r--sw/inc/unomap.hxx351
-rw-r--r--sw/inc/unomid.h157
-rw-r--r--sw/inc/unomod.hxx210
-rw-r--r--sw/inc/unoparaframeenum.hxx127
-rw-r--r--sw/inc/unoparagraph.hxx365
-rw-r--r--sw/inc/unoport.hxx322
-rw-r--r--sw/inc/unoprnms.hxx842
-rw-r--r--sw/inc/unoredline.hxx156
-rw-r--r--sw/inc/unoredlines.hxx105
-rw-r--r--sw/inc/unorefmark.hxx174
-rw-r--r--sw/inc/unosection.hxx255
-rw-r--r--sw/inc/unosett.hxx327
-rw-r--r--sw/inc/unosrch.hxx136
-rw-r--r--sw/inc/unostyle.hxx472
-rw-r--r--sw/inc/unotbl.hxx623
-rw-r--r--sw/inc/unotext.hxx346
-rw-r--r--sw/inc/unotextbodyhf.hxx210
-rw-r--r--sw/inc/unotextcursor.hxx347
-rw-r--r--sw/inc/unotextmarkup.hxx110
-rw-r--r--sw/inc/unotextrange.hxx338
-rw-r--r--sw/inc/unotxdoc.hxx611
-rw-r--r--sw/inc/usrfld.hxx134
-rw-r--r--sw/inc/viewopt.hxx615
-rw-r--r--sw/inc/viewsh.hxx645
-rw-r--r--sw/inc/viscrs.hxx223
-rw-r--r--sw/inc/wdocsh.hxx63
-rw-r--r--sw/prj/build.lst2
-rw-r--r--sw/prj/d.lst0
-rw-r--r--sw/prj/makefile.mk40
-rw-r--r--sw/qa/complex/accessibility/AccessibleRelationSet.java217
-rw-r--r--sw/qa/complex/accessibility/makefile.mk50
-rwxr-xr-xsw/qa/complex/checkColor/CheckChangeColor.java89
-rw-r--r--sw/qa/complex/checkColor/makefile.mk50
-rwxr-xr-xsw/qa/complex/indeterminateState/CheckIndeterminateState.java125
-rw-r--r--sw/qa/complex/writer/CheckBookmarks.java262
-rw-r--r--sw/qa/complex/writer/CheckCrossReferences.java291
-rw-r--r--sw/qa/complex/writer/CheckFlies.java222
-rwxr-xr-xsw/qa/complex/writer/CheckIndexedPropertyValues.java116
-rwxr-xr-xsw/qa/complex/writer/CheckNamedPropertyValues.java122
-rw-r--r--sw/qa/complex/writer/LoadSaveTest.java254
-rw-r--r--sw/qa/complex/writer/TestDocument.java40
-rwxr-xr-xsw/qa/complex/writer/TextPortionEnumerationTest.java4164
-rw-r--r--sw/qa/complex/writer/testdocuments/CheckCrossReferences.odtbin0 -> 11628 bytes-rw-r--r--sw/qa/complex/writer/testdocuments/CheckFlies.odtbin0 -> 65022 bytes-rwxr-xr-xsw/qa/complex/writer/testdocuments/TESTMETA.odtbin0 -> 8678 bytes-rw-r--r--sw/qa/complex/writer/testdocuments/TESTXMLID.odtbin0 -> 10879 bytes-rw-r--r--sw/qa/core/Test-BigPtrArray.cxx877
-rw-r--r--sw/qa/core/bigpointerarray-new.cxx110
-rw-r--r--sw/qa/core/bigpointerarray-new.hxx159
-rw-r--r--sw/qa/core/export.exp1
-rw-r--r--sw/qa/core/export.map34
-rw-r--r--sw/qa/core/performance-jobfile9
-rw-r--r--sw/qa/unoapi/Test.java52
-rw-r--r--sw/qa/unoapi/knownissues.xcl186
-rw-r--r--sw/qa/unoapi/makefile.mk48
-rw-r--r--sw/qa/unoapi/sw.sce94
-rw-r--r--sw/qa/unoapi/testdocuments/MailMerge.sxwbin0 -> 5391 bytes-rw-r--r--sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sdwbin0 -> 180736 bytes-rw-r--r--sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sxwbin0 -> 24763 bytes-rw-r--r--sw/qa/unoapi/testdocuments/XDocumentInsertable.sxwbin0 -> 4914 bytes-rw-r--r--sw/qa/unoapi/testdocuments/sForm.sxwbin0 -> 5568 bytes-rwxr-xr-xsw/sdi/_annotsh.sdi385
-rw-r--r--sw/sdi/_basesh.sdi525
-rw-r--r--sw/sdi/_beziers.sdi128
-rw-r--r--sw/sdi/_docsh.sdi131
-rw-r--r--sw/sdi/_drwbase.sdi139
-rw-r--r--sw/sdi/_formsh.sdi44
-rw-r--r--sw/sdi/_frmsh.sdi305
-rw-r--r--sw/sdi/_grfsh.sdi216
-rw-r--r--sw/sdi/_listsh.sdi111
-rw-r--r--sw/sdi/_mediash.sdi51
-rw-r--r--sw/sdi/_olesh.sdi35
-rw-r--r--sw/sdi/_tabsh.sdi409
-rw-r--r--sw/sdi/_textsh.sdi1610
-rw-r--r--sw/sdi/_viewsh.sdi784
-rwxr-xr-xsw/sdi/annotsh.sdi380
-rw-r--r--sw/sdi/basesh.sdi64
-rw-r--r--sw/sdi/beziersh.sdi135
-rw-r--r--sw/sdi/docsh.sdi83
-rw-r--r--sw/sdi/drawsh.sdi477
-rw-r--r--sw/sdi/drwbassh.sdi47
-rw-r--r--sw/sdi/drwtxtsh.sdi659
-rw-r--r--sw/sdi/formsh.sdi40
-rw-r--r--sw/sdi/frmsh.sdi56
-rw-r--r--sw/sdi/grfsh.sdi44
-rw-r--r--sw/sdi/listsh.sdi43
-rw-r--r--sw/sdi/mediash.sdi42
-rw-r--r--sw/sdi/olesh.sdi41
-rw-r--r--sw/sdi/swinterf.c249
-rw-r--r--sw/sdi/switems.sdi82
-rw-r--r--sw/sdi/swpatch.txt21
-rw-r--r--sw/sdi/swriter.sdi10268
-rw-r--r--sw/sdi/swslots.hrc33
-rw-r--r--sw/sdi/swslots.sdi125
-rw-r--r--sw/sdi/tabsh.sdi67
-rw-r--r--sw/sdi/textsh.sdi124
-rw-r--r--sw/sdi/viewsh.sdi326
-rw-r--r--sw/sdi/wbasesh.sdi44
-rw-r--r--sw/sdi/wbeziers.sdi38
-rw-r--r--sw/sdi/wdocsh.sdi60
-rw-r--r--sw/sdi/wdrwbase.sdi49
-rw-r--r--sw/sdi/wformsh.sdi40
-rw-r--r--sw/sdi/wfrmsh.sdi44
-rw-r--r--sw/sdi/wgrfsh.sdi43
-rw-r--r--sw/sdi/wlistsh.sdi41
-rw-r--r--sw/sdi/wolesh.sdi43
-rw-r--r--sw/sdi/wrtapp.sdi90
-rw-r--r--sw/sdi/wtabsh.sdi40
-rw-r--r--sw/sdi/wtextsh.sdi49
-rw-r--r--sw/sdi/wviewsh.sdi203
-rw-r--r--sw/source/core/SwNumberTree/SwNodeNum.cxx534
-rw-r--r--sw/source/core/SwNumberTree/SwNumberTree.cxx1409
-rw-r--r--sw/source/core/access/acccell.cxx375
-rw-r--r--sw/source/core/access/acccell.hxx137
-rw-r--r--sw/source/core/access/acccontext.cxx1604
-rw-r--r--sw/source/core/access/acccontext.hxx459
-rw-r--r--sw/source/core/access/accdoc.cxx515
-rw-r--r--sw/source/core/access/accdoc.hxx213
-rw-r--r--sw/source/core/access/accembedded.cxx97
-rw-r--r--sw/source/core/access/accembedded.hxx69
-rw-r--r--sw/source/core/access/accfootnote.cxx157
-rw-r--r--sw/source/core/access/accfootnote.hxx88
-rw-r--r--sw/source/core/access/accframe.cxx497
-rw-r--r--sw/source/core/access/accframe.hxx175
-rw-r--r--sw/source/core/access/accframebase.cxx279
-rw-r--r--sw/source/core/access/accframebase.hxx71
-rw-r--r--sw/source/core/access/accfrmobj.cxx428
-rw-r--r--sw/source/core/access/accfrmobj.hxx95
-rw-r--r--sw/source/core/access/accfrmobjmap.cxx168
-rw-r--r--sw/source/core/access/accfrmobjmap.hxx96
-rw-r--r--sw/source/core/access/accfrmobjslist.cxx173
-rw-r--r--sw/source/core/access/accfrmobjslist.hxx145
-rw-r--r--sw/source/core/access/accgraphic.cxx97
-rw-r--r--sw/source/core/access/accgraphic.hxx69
-rw-r--r--sw/source/core/access/accheaderfooter.cxx145
-rw-r--r--sw/source/core/access/accheaderfooter.hxx85
-rw-r--r--sw/source/core/access/acchyperlink.cxx190
-rw-r--r--sw/source/core/access/acchyperlink.hxx91
-rw-r--r--sw/source/core/access/acchypertextdata.cxx55
-rw-r--r--sw/source/core/access/acchypertextdata.hxx51
-rw-r--r--sw/source/core/access/accmap.cxx2878
-rw-r--r--sw/source/core/access/accnotextframe.cxx275
-rw-r--r--sw/source/core/access/accnotextframe.hxx110
-rw-r--r--sw/source/core/access/accpage.cxx200
-rw-r--r--sw/source/core/access/accpage.hxx99
-rw-r--r--sw/source/core/access/accpara.cxx2678
-rw-r--r--sw/source/core/access/accpara.hxx447
-rw-r--r--sw/source/core/access/accportions.cxx753
-rw-r--r--sw/source/core/access/accportions.hxx175
-rw-r--r--sw/source/core/access/accpreview.cxx104
-rw-r--r--sw/source/core/access/accpreview.hxx76
-rw-r--r--sw/source/core/access/accselectionhelper.cxx334
-rw-r--r--sw/source/core/access/accselectionhelper.hxx81
-rw-r--r--sw/source/core/access/acctable.cxx1804
-rw-r--r--sw/source/core/access/acctable.hxx331
-rw-r--r--sw/source/core/access/acctextframe.cxx278
-rw-r--r--sw/source/core/access/acctextframe.hxx114
-rw-r--r--sw/source/core/access/parachangetrackinginfo.cxx231
-rw-r--r--sw/source/core/access/parachangetrackinginfo.hxx59
-rw-r--r--sw/source/core/access/textmarkuphelper.cxx231
-rw-r--r--sw/source/core/access/textmarkuphelper.hxx87
-rw-r--r--sw/source/core/attr/calbck.cxx564
-rw-r--r--sw/source/core/attr/cellatr.cxx266
-rw-r--r--sw/source/core/attr/fmtfollowtextflow.cxx37
-rw-r--r--sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx166
-rw-r--r--sw/source/core/attr/format.cxx692
-rw-r--r--sw/source/core/attr/hints.cxx308
-rw-r--r--sw/source/core/attr/swatrset.cxx404
-rw-r--r--sw/source/core/bastyp/SwSmartTagMgr.cxx95
-rw-r--r--sw/source/core/bastyp/bparr.cxx580
-rw-r--r--sw/source/core/bastyp/breakit.cxx186
-rw-r--r--sw/source/core/bastyp/calc.cxx1826
-rw-r--r--sw/source/core/bastyp/checkit.cxx51
-rw-r--r--sw/source/core/bastyp/index.cxx593
-rw-r--r--sw/source/core/bastyp/init.cxx918
-rw-r--r--sw/source/core/bastyp/ring.cxx125
-rw-r--r--sw/source/core/bastyp/swcache.cxx656
-rw-r--r--sw/source/core/bastyp/swrect.cxx336
-rw-r--r--sw/source/core/bastyp/swregion.cxx254
-rw-r--r--sw/source/core/bastyp/swtypes.cxx134
-rw-r--r--sw/source/core/bastyp/tabcol.cxx142
-rw-r--r--sw/source/core/crsr/BlockCursor.cxx106
-rw-r--r--sw/source/core/crsr/BlockCursor.hxx36
-rw-r--r--sw/source/core/crsr/IBlockCursor.hxx95
-rw-r--r--sw/source/core/crsr/bookmrk.cxx348
-rw-r--r--sw/source/core/crsr/callnk.cxx225
-rw-r--r--sw/source/core/crsr/callnk.hxx57
-rw-r--r--sw/source/core/crsr/crbm.cxx260
-rw-r--r--sw/source/core/crsr/crossrefbookmark.cxx102
-rw-r--r--sw/source/core/crsr/crsrsh.cxx3512
-rw-r--r--sw/source/core/crsr/crstrvl.cxx2212
-rw-r--r--sw/source/core/crsr/crstrvl1.cxx105
-rw-r--r--sw/source/core/crsr/findattr.cxx1314
-rw-r--r--sw/source/core/crsr/findcoll.cxx122
-rw-r--r--sw/source/core/crsr/findfmt.cxx84
-rw-r--r--sw/source/core/crsr/findtxt.cxx715
-rw-r--r--sw/source/core/crsr/pam.cxx1246
-rw-r--r--sw/source/core/crsr/paminit.cxx131
-rwxr-xr-xsw/source/core/crsr/swcrsr.cxx2356
-rw-r--r--sw/source/core/crsr/trvlcol.cxx133
-rw-r--r--sw/source/core/crsr/trvlfnfl.cxx359
-rw-r--r--sw/source/core/crsr/trvlreg.cxx291
-rw-r--r--sw/source/core/crsr/trvltbl.cxx931
-rw-r--r--sw/source/core/crsr/unocrsr.cxx272
-rw-r--r--sw/source/core/crsr/viscrs.cxx1006
-rw-r--r--sw/source/core/doc/SwStyleNameMapper.cxx1142
-rw-r--r--sw/source/core/doc/acmplwrd.cxx474
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx1040
-rw-r--r--sw/source/core/doc/doc.cxx2776
-rw-r--r--sw/source/core/doc/docbasic.cxx276
-rw-r--r--sw/source/core/doc/docbm.cxx1746
-rw-r--r--sw/source/core/doc/docchart.cxx277
-rw-r--r--sw/source/core/doc/doccomp.cxx1883
-rw-r--r--sw/source/core/doc/doccorr.cxx358
-rw-r--r--sw/source/core/doc/docdde.cxx418
-rw-r--r--sw/source/core/doc/docdesc.cxx946
-rw-r--r--sw/source/core/doc/docdraw.cxx1103
-rw-r--r--sw/source/core/doc/docedt.cxx2839
-rw-r--r--sw/source/core/doc/docfld.cxx2824
-rw-r--r--sw/source/core/doc/docfly.cxx1021
-rw-r--r--sw/source/core/doc/docfmt.cxx2678
-rw-r--r--sw/source/core/doc/docftn.cxx531
-rw-r--r--sw/source/core/doc/docglbl.cxx855
-rw-r--r--sw/source/core/doc/docglos.cxx203
-rw-r--r--sw/source/core/doc/doclay.cxx2440
-rw-r--r--sw/source/core/doc/docnew.cxx1269
-rw-r--r--sw/source/core/doc/docnum.cxx2953
-rw-r--r--sw/source/core/doc/docredln.cxx3868
-rw-r--r--sw/source/core/doc/docruby.cxx361
-rw-r--r--sw/source/core/doc/docsort.cxx1036
-rw-r--r--sw/source/core/doc/docstat.cxx67
-rw-r--r--sw/source/core/doc/doctxm.cxx2441
-rw-r--r--sw/source/core/doc/docxforms.cxx123
-rw-r--r--sw/source/core/doc/extinput.cxx300
-rw-r--r--sw/source/core/doc/fmtcol.cxx716
-rw-r--r--sw/source/core/doc/ftnidx.cxx399
-rw-r--r--sw/source/core/doc/gctable.cxx451
-rw-r--r--sw/source/core/doc/htmltbl.cxx1897
-rw-r--r--sw/source/core/doc/lineinfo.cxx159
-rw-r--r--sw/source/core/doc/list.cxx303
-rw-r--r--sw/source/core/doc/notxtfrm.cxx1098
-rw-r--r--sw/source/core/doc/number.cxx1694
-rw-r--r--sw/source/core/doc/poolfmt.cxx2591
-rw-r--r--sw/source/core/doc/sortopt.cxx103
-rw-r--r--sw/source/core/doc/swserv.cxx371
-rw-r--r--sw/source/core/doc/swstylemanager.cxx173
-rw-r--r--sw/source/core/doc/swstylemanager.hxx38
-rwxr-xr-xsw/source/core/doc/tblafmt.cxx1106
-rw-r--r--sw/source/core/doc/tblcpy.cxx1099
-rw-r--r--sw/source/core/doc/tblrwcl.cxx4763
-rw-r--r--sw/source/core/doc/visiturl.cxx139
-rw-r--r--sw/source/core/docnode/cancellablejob.cxx40
-rw-r--r--sw/source/core/docnode/cancellablejob.hxx53
-rw-r--r--sw/source/core/docnode/finalthreadmanager.cxx549
-rw-r--r--sw/source/core/docnode/ndcopy.cxx1620
-rw-r--r--sw/source/core/docnode/ndindex.cxx168
-rw-r--r--sw/source/core/docnode/ndnotxt.cxx307
-rw-r--r--sw/source/core/docnode/ndnum.cxx225
-rw-r--r--sw/source/core/docnode/ndsect.cxx1483
-rw-r--r--sw/source/core/docnode/ndtbl.cxx4683
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx1597
-rw-r--r--sw/source/core/docnode/node.cxx2081
-rw-r--r--sw/source/core/docnode/node2lay.cxx472
-rw-r--r--sw/source/core/docnode/nodes.cxx2627
-rw-r--r--sw/source/core/docnode/observablethread.cxx97
-rw-r--r--sw/source/core/docnode/pausethreadstarting.cxx55
-rw-r--r--sw/source/core/docnode/retrievedinputstreamdata.cxx167
-rw-r--r--sw/source/core/docnode/retrieveinputstream.cxx86
-rw-r--r--sw/source/core/docnode/retrieveinputstreamconsumer.cxx72
-rw-r--r--sw/source/core/docnode/section.cxx1809
-rw-r--r--sw/source/core/docnode/swbaslnk.cxx503
-rw-r--r--sw/source/core/docnode/swthreadjoiner.cxx61
-rw-r--r--sw/source/core/docnode/swthreadmanager.cxx87
-rw-r--r--sw/source/core/docnode/threadlistener.cxx57
-rw-r--r--sw/source/core/docnode/threadmanager.cxx258
-rw-r--r--sw/source/core/draw/dcontact.cxx2793
-rw-r--r--sw/source/core/draw/dflyobj.cxx981
-rw-r--r--sw/source/core/draw/dobjfac.cxx57
-rw-r--r--sw/source/core/draw/dpage.cxx265
-rw-r--r--sw/source/core/draw/drawdoc.cxx240
-rw-r--r--sw/source/core/draw/dview.cxx1115
-rwxr-xr-xsw/source/core/edit/acorrect.cxx548
-rw-r--r--sw/source/core/edit/autofmt.cxx2798
-rw-r--r--sw/source/core/edit/edatmisc.cxx195
-rw-r--r--sw/source/core/edit/edattr.cxx646
-rw-r--r--sw/source/core/edit/eddel.cxx356
-rw-r--r--sw/source/core/edit/edfcol.cxx162
-rw-r--r--sw/source/core/edit/edfld.cxx564
-rw-r--r--sw/source/core/edit/edfldexp.cxx97
-rw-r--r--sw/source/core/edit/edfmt.cxx197
-rw-r--r--sw/source/core/edit/edglbldc.cxx410
-rw-r--r--sw/source/core/edit/edglss.cxx373
-rw-r--r--sw/source/core/edit/editsh.cxx1204
-rw-r--r--sw/source/core/edit/edlingu.cxx1974
-rw-r--r--sw/source/core/edit/ednumber.cxx833
-rw-r--r--sw/source/core/edit/edredln.cxx150
-rw-r--r--sw/source/core/edit/edsect.cxx455
-rw-r--r--sw/source/core/edit/edtab.cxx493
-rw-r--r--sw/source/core/edit/edtox.cxx487
-rw-r--r--sw/source/core/edit/edundo.cxx258
-rw-r--r--sw/source/core/edit/edws.cxx365
-rw-r--r--sw/source/core/except/dbgloop.cxx168
-rw-r--r--sw/source/core/except/errhdl.cxx136
-rw-r--r--sw/source/core/fields/authfld.cxx756
-rw-r--r--sw/source/core/fields/cellfml.cxx1216
-rw-r--r--sw/source/core/fields/chpfld.cxx309
-rw-r--r--sw/source/core/fields/dbfld.cxx1013
-rw-r--r--sw/source/core/fields/ddefld.cxx448
-rw-r--r--sw/source/core/fields/ddetbl.cxx197
-rw-r--r--sw/source/core/fields/docufld.cxx2720
-rw-r--r--sw/source/core/fields/expfld.cxx1301
-rw-r--r--sw/source/core/fields/fldbas.cxx808
-rw-r--r--sw/source/core/fields/flddat.cxx321
-rw-r--r--sw/source/core/fields/flddropdown.cxx284
-rw-r--r--sw/source/core/fields/fldlst.cxx230
-rw-r--r--sw/source/core/fields/macrofld.cxx261
-rw-r--r--sw/source/core/fields/postithelper.cxx222
-rw-r--r--sw/source/core/fields/reffld.cxx1072
-rw-r--r--sw/source/core/fields/scrptfld.cxx153
-rw-r--r--sw/source/core/fields/tblcalc.cxx249
-rwxr-xr-xsw/source/core/fields/textapi.cxx191
-rw-r--r--sw/source/core/fields/usrfld.cxx377
-rw-r--r--sw/source/core/frmedt/fecopy.cxx1554
-rw-r--r--sw/source/core/frmedt/fedesc.cxx293
-rw-r--r--sw/source/core/frmedt/fefly1.cxx2283
-rw-r--r--sw/source/core/frmedt/feflyole.cxx150
-rw-r--r--sw/source/core/frmedt/feshview.cxx3132
-rw-r--r--sw/source/core/frmedt/fetab.cxx2593
-rw-r--r--sw/source/core/frmedt/fews.cxx1396
-rw-r--r--sw/source/core/frmedt/tblsel.cxx2707
-rw-r--r--sw/source/core/graphic/grfatr.cxx366
-rw-r--r--sw/source/core/graphic/ndgrf.cxx1221
-rw-r--r--sw/source/core/inc/GetMetricVal.hxx54
-rw-r--r--sw/source/core/inc/MarkManager.hxx97
-rw-r--r--sw/source/core/inc/SwGrammarMarkUp.hxx74
-rw-r--r--sw/source/core/inc/SwPortionHandler.hxx101
-rw-r--r--sw/source/core/inc/SwUndoFmt.hxx253
-rw-r--r--sw/source/core/inc/SwUndoPageDesc.hxx93
-rw-r--r--sw/source/core/inc/SwUndoTOXChange.hxx49
-rw-r--r--sw/source/core/inc/SwXMLBlockExport.hxx73
-rw-r--r--sw/source/core/inc/SwXMLBlockImport.hxx89
-rw-r--r--sw/source/core/inc/SwXMLBlockListContext.hxx126
-rw-r--r--sw/source/core/inc/SwXMLTextBlocks.hxx111
-rw-r--r--sw/source/core/inc/SwXTextDefaults.hxx84
-rw-r--r--sw/source/core/inc/UndoAttribute.hxx288
-rw-r--r--sw/source/core/inc/UndoBookmark.hxx83
-rw-r--r--sw/source/core/inc/UndoCore.hxx266
-rw-r--r--sw/source/core/inc/UndoDelete.hxx115
-rw-r--r--sw/source/core/inc/UndoDraw.hxx150
-rw-r--r--sw/source/core/inc/UndoInsert.hxx235
-rw-r--r--sw/source/core/inc/UndoManager.hxx124
-rw-r--r--sw/source/core/inc/UndoNumbering.hxx154
-rw-r--r--sw/source/core/inc/UndoOverwrite.hxx105
-rw-r--r--sw/source/core/inc/UndoRedline.hxx145
-rw-r--r--sw/source/core/inc/UndoSection.hxx82
-rw-r--r--sw/source/core/inc/UndoSort.hxx97
-rw-r--r--sw/source/core/inc/UndoSplitMove.hxx96
-rw-r--r--sw/source/core/inc/UndoTable.hxx391
-rwxr-xr-xsw/source/core/inc/acorrect.hxx123
-rw-r--r--sw/source/core/inc/anchoredobjectposition.hxx496
-rw-r--r--sw/source/core/inc/ascharanchoredobjectposition.hxx171
-rw-r--r--sw/source/core/inc/attrhint.hxx44
-rw-r--r--sw/source/core/inc/blink.hxx89
-rw-r--r--sw/source/core/inc/bodyfrm.hxx49
-rw-r--r--sw/source/core/inc/bookmrk.hxx260
-rw-r--r--sw/source/core/inc/cellfrm.hxx72
-rw-r--r--sw/source/core/inc/cntfrm.hxx150
-rw-r--r--sw/source/core/inc/colfrm.hxx42
-rw-r--r--sw/source/core/inc/crossrefbookmark.hxx99
-rw-r--r--sw/source/core/inc/dbg_lay.hxx120
-rw-r--r--sw/source/core/inc/dbgloop.hxx77
-rw-r--r--sw/source/core/inc/dflyobj.hxx140
-rw-r--r--sw/source/core/inc/docfld.hxx193
-rw-r--r--sw/source/core/inc/docsort.hxx176
-rw-r--r--sw/source/core/inc/doctxm.hxx147
-rw-r--r--sw/source/core/inc/drawdev.hxx140
-rw-r--r--sw/source/core/inc/drawfont.hxx594
-rw-r--r--sw/source/core/inc/dview.hxx134
-rw-r--r--sw/source/core/inc/environmentofanchoredobject.hxx117
-rw-r--r--sw/source/core/inc/fieldhint.hxx44
-rw-r--r--sw/source/core/inc/finalthreadmanager.hxx105
-rw-r--r--sw/source/core/inc/flowfrm.hxx273
-rw-r--r--sw/source/core/inc/flyfrm.hxx297
-rw-r--r--sw/source/core/inc/flyfrms.hxx257
-rw-r--r--sw/source/core/inc/fntcache.hxx160
-rw-r--r--sw/source/core/inc/frame.hxx1302
-rw-r--r--sw/source/core/inc/frminf.hxx85
-rw-r--r--sw/source/core/inc/frmtool.hxx583
-rw-r--r--sw/source/core/inc/ftnboss.hxx137
-rw-r--r--sw/source/core/inc/ftnfrm.hxx150
-rw-r--r--sw/source/core/inc/hffrm.hxx66
-rw-r--r--sw/source/core/inc/ifinishedthreadlistener.hxx55
-rw-r--r--sw/source/core/inc/ithreadlistenerowner.hxx58
-rw-r--r--sw/source/core/inc/layact.hxx239
-rw-r--r--sw/source/core/inc/laycache.hxx77
-rw-r--r--sw/source/core/inc/layfrm.hxx210
-rw-r--r--sw/source/core/inc/layouter.hxx183
-rw-r--r--sw/source/core/inc/movedfwdfrmsbyobjpos.hxx70
-rw-r--r--sw/source/core/inc/mvsave.hxx213
-rw-r--r--sw/source/core/inc/node2lay.hxx81
-rw-r--r--sw/source/core/inc/noteurl.hxx76
-rw-r--r--sw/source/core/inc/notxtfrm.hxx79
-rw-r--r--sw/source/core/inc/objectformatter.hxx238
-rw-r--r--sw/source/core/inc/observablethread.hxx105
-rw-r--r--sw/source/core/inc/pagedeschint.hxx46
-rw-r--r--sw/source/core/inc/pagefrm.hxx542
-rw-r--r--sw/source/core/inc/pamtyp.hxx102
-rw-r--r--sw/source/core/inc/prevwpage.hxx63
-rw-r--r--sw/source/core/inc/ptqueue.hxx62
-rw-r--r--sw/source/core/inc/retrievedinputstreamdata.hxx111
-rw-r--r--sw/source/core/inc/retrieveinputstream.hxx68
-rw-r--r--sw/source/core/inc/retrieveinputstreamconsumer.hxx74
-rw-r--r--sw/source/core/inc/rolbck.hxx453
-rw-r--r--sw/source/core/inc/rootfrm.hxx377
-rw-r--r--sw/source/core/inc/rowfrm.hxx111
-rw-r--r--sw/source/core/inc/scriptinfo.hxx416
-rw-r--r--sw/source/core/inc/sectfrm.hxx150
-rw-r--r--sw/source/core/inc/setmapvirtdev.hxx71
-rw-r--r--sw/source/core/inc/sortedobjs.hxx108
-rw-r--r--sw/source/core/inc/sortedobjsimpl.hxx61
-rw-r--r--sw/source/core/inc/swblocks.hxx242
-rw-r--r--sw/source/core/inc/swcache.hxx302
-rw-r--r--sw/source/core/inc/swfntcch.hxx99
-rw-r--r--sw/source/core/inc/swfont.hxx899
-rw-r--r--sw/source/core/inc/swselectionlist.hxx97
-rw-r--r--sw/source/core/inc/swthreadjoiner.hxx51
-rw-r--r--sw/source/core/inc/swthreadmanager.hxx89
-rw-r--r--sw/source/core/inc/tabfrm.hxx235
-rw-r--r--sw/source/core/inc/tblrwcl.hxx228
-rwxr-xr-xsw/source/core/inc/textapi.hxx70
-rw-r--r--sw/source/core/inc/threadlistener.hxx62
-rw-r--r--sw/source/core/inc/threadmanager.hxx172
-rw-r--r--sw/source/core/inc/tocntntanchoredobjectposition.hxx103
-rw-r--r--sw/source/core/inc/tolayoutanchoredobjectposition.hxx66
-rw-r--r--sw/source/core/inc/toxhlp.hxx76
-rw-r--r--sw/source/core/inc/txmsrt.hxx294
-rw-r--r--sw/source/core/inc/txtfrm.hxx835
-rw-r--r--sw/source/core/inc/txttypes.hxx103
-rw-r--r--sw/source/core/inc/undoflystrattr.hxx56
-rw-r--r--sw/source/core/inc/unofldmid.h71
-rwxr-xr-xsw/source/core/inc/unometa.hxx368
-rw-r--r--sw/source/core/inc/viewimp.hxx365
-rw-r--r--sw/source/core/inc/visiturl.hxx49
-rw-r--r--sw/source/core/inc/wrong.hxx166
-rw-r--r--sw/source/core/layout/anchoreddrawobject.cxx906
-rw-r--r--sw/source/core/layout/anchoredobject.cxx1064
-rw-r--r--sw/source/core/layout/atrfrm.cxx3296
-rw-r--r--sw/source/core/layout/calcmove.cxx2115
-rw-r--r--sw/source/core/layout/colfrm.cxx485
-rw-r--r--sw/source/core/layout/dbg_lay.cxx869
-rw-r--r--sw/source/core/layout/findfrm.cxx1813
-rw-r--r--sw/source/core/layout/flowfrm.cxx2725
-rw-r--r--sw/source/core/layout/fly.cxx2970
-rw-r--r--sw/source/core/layout/flycnt.cxx1661
-rw-r--r--sw/source/core/layout/flyincnt.cxx361
-rw-r--r--sw/source/core/layout/flylay.cxx1392
-rw-r--r--sw/source/core/layout/flypos.cxx112
-rw-r--r--sw/source/core/layout/frmtool.cxx3606
-rw-r--r--sw/source/core/layout/ftnfrm.cxx3275
-rw-r--r--sw/source/core/layout/hffrm.cxx799
-rw-r--r--sw/source/core/layout/layact.cxx2621
-rw-r--r--sw/source/core/layout/laycache.cxx1398
-rw-r--r--sw/source/core/layout/layhelp.hxx232
-rw-r--r--sw/source/core/layout/layouter.cxx571
-rw-r--r--sw/source/core/layout/movedfwdfrmsbyobjpos.cxx106
-rw-r--r--sw/source/core/layout/newfrm.cxx688
-rw-r--r--sw/source/core/layout/objectformatter.cxx578
-rw-r--r--sw/source/core/layout/objectformatterlayfrm.cxx215
-rw-r--r--sw/source/core/layout/objectformatterlayfrm.hxx81
-rw-r--r--sw/source/core/layout/objectformattertxtfrm.cxx870
-rw-r--r--sw/source/core/layout/objectformattertxtfrm.hxx215
-rw-r--r--sw/source/core/layout/objstmpconsiderwrapinfl.cxx73
-rw-r--r--sw/source/core/layout/objstmpconsiderwrapinfl.hxx47
-rw-r--r--sw/source/core/layout/pagechg.cxx2517
-rw-r--r--sw/source/core/layout/pagedesc.cxx509
-rw-r--r--sw/source/core/layout/paintfrm.cxx6731
-rw-r--r--sw/source/core/layout/sectfrm.cxx2816
-rw-r--r--sw/source/core/layout/softpagebreak.cxx155
-rw-r--r--sw/source/core/layout/sortedobjs.cxx76
-rw-r--r--sw/source/core/layout/sortedobjsimpl.cxx313
-rw-r--r--sw/source/core/layout/ssfrm.cxx812
-rw-r--r--sw/source/core/layout/swselectionlist.cxx94
-rw-r--r--sw/source/core/layout/tabfrm.cxx5934
-rw-r--r--sw/source/core/layout/trvlfrm.cxx2661
-rw-r--r--sw/source/core/layout/unusedf.cxx91
-rw-r--r--sw/source/core/layout/virtoutp.cxx256
-rw-r--r--sw/source/core/layout/virtoutp.hxx74
-rw-r--r--sw/source/core/layout/wsfrm.cxx4038
-rw-r--r--sw/source/core/objectpositioning/anchoredobjectposition.cxx1150
-rw-r--r--sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx458
-rw-r--r--sw/source/core/objectpositioning/environmentofanchoredobject.cxx121
-rw-r--r--sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx1144
-rw-r--r--sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx255
-rw-r--r--sw/source/core/ole/ndole.cxx1017
-rw-r--r--sw/source/core/para/paratr.cxx288
-rw-r--r--sw/source/core/sw3io/sw3convert.cxx433
-rw-r--r--sw/source/core/sw3io/swacorr.cxx106
-rw-r--r--sw/source/core/swg/SwXMLBlockExport.cxx142
-rw-r--r--sw/source/core/swg/SwXMLBlockImport.cxx118
-rw-r--r--sw/source/core/swg/SwXMLBlockListContext.cxx250
-rw-r--r--sw/source/core/swg/SwXMLSectionList.cxx154
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks.cxx641
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks1.cxx741
-rw-r--r--sw/source/core/swg/swblocks.cxx818
-rw-r--r--sw/source/core/table/swnewtable.cxx2328
-rw-r--r--sw/source/core/table/swtable.cxx2846
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx2203
-rw-r--r--sw/source/core/text/SwGrammarMarkUp.cxx166
-rw-r--r--sw/source/core/text/atrhndl.hxx179
-rw-r--r--sw/source/core/text/atrstck.cxx956
-rw-r--r--sw/source/core/text/blink.cxx198
-rw-r--r--sw/source/core/text/frmcrsr.cxx1747
-rw-r--r--sw/source/core/text/frmform.cxx2183
-rw-r--r--sw/source/core/text/frminf.cxx377
-rw-r--r--sw/source/core/text/frmpaint.cxx750
-rw-r--r--sw/source/core/text/guess.cxx554
-rw-r--r--sw/source/core/text/guess.hxx73
-rw-r--r--sw/source/core/text/inftxt.cxx1979
-rw-r--r--sw/source/core/text/inftxt.hxx905
-rw-r--r--sw/source/core/text/itradj.cxx919
-rw-r--r--sw/source/core/text/itratr.cxx1072
-rw-r--r--sw/source/core/text/itratr.hxx131
-rw-r--r--sw/source/core/text/itrcrsr.cxx1886
-rw-r--r--sw/source/core/text/itrform2.cxx2133
-rw-r--r--sw/source/core/text/itrform2.hxx214
-rw-r--r--sw/source/core/text/itrpaint.cxx718
-rw-r--r--sw/source/core/text/itrpaint.hxx69
-rw-r--r--sw/source/core/text/itrtxt.cxx527
-rw-r--r--sw/source/core/text/itrtxt.hxx340
-rw-r--r--sw/source/core/text/noteurl.cxx87
-rw-r--r--sw/source/core/text/pordrop.hxx119
-rw-r--r--sw/source/core/text/porexp.cxx312
-rw-r--r--sw/source/core/text/porexp.hxx108
-rw-r--r--sw/source/core/text/porfld.cxx1385
-rw-r--r--sw/source/core/text/porfld.hxx274
-rw-r--r--sw/source/core/text/porfly.cxx455
-rw-r--r--sw/source/core/text/porfly.hxx108
-rw-r--r--sw/source/core/text/porftn.hxx130
-rw-r--r--sw/source/core/text/porglue.cxx318
-rw-r--r--sw/source/core/text/porglue.hxx134
-rw-r--r--sw/source/core/text/porhyph.hxx119
-rw-r--r--sw/source/core/text/porlay.cxx2455
-rw-r--r--sw/source/core/text/porlay.hxx427
-rw-r--r--sw/source/core/text/porlin.cxx426
-rw-r--r--sw/source/core/text/porlin.hxx251
-rw-r--r--sw/source/core/text/pormulti.cxx2415
-rw-r--r--sw/source/core/text/pormulti.hxx268
-rw-r--r--sw/source/core/text/porref.cxx115
-rw-r--r--sw/source/core/text/porref.hxx73
-rw-r--r--sw/source/core/text/porrst.cxx580
-rw-r--r--sw/source/core/text/porrst.hxx187
-rw-r--r--sw/source/core/text/portab.hxx157
-rw-r--r--sw/source/core/text/portox.cxx115
-rw-r--r--sw/source/core/text/portox.hxx75
-rw-r--r--sw/source/core/text/portxt.cxx881
-rw-r--r--sw/source/core/text/portxt.hxx117
-rw-r--r--sw/source/core/text/possiz.hxx84
-rw-r--r--sw/source/core/text/redlnitr.cxx505
-rw-r--r--sw/source/core/text/redlnitr.hxx123
-rw-r--r--sw/source/core/text/txtcache.cxx241
-rw-r--r--sw/source/core/text/txtcache.hxx76
-rw-r--r--sw/source/core/text/txtcfg.hxx54
-rw-r--r--sw/source/core/text/txtdrop.cxx1101
-rw-r--r--sw/source/core/text/txtfld.cxx596
-rw-r--r--sw/source/core/text/txtfly.cxx2431
-rw-r--r--sw/source/core/text/txtfly.hxx259
-rw-r--r--sw/source/core/text/txtfrm.cxx2817
-rw-r--r--sw/source/core/text/txtftn.cxx1700
-rw-r--r--sw/source/core/text/txthyph.cxx695
-rw-r--r--sw/source/core/text/txtinit.cxx101
-rw-r--r--sw/source/core/text/txtio.cxx948
-rw-r--r--sw/source/core/text/txtpaint.cxx137
-rw-r--r--sw/source/core/text/txtpaint.hxx191
-rw-r--r--sw/source/core/text/txttab.cxx682
-rw-r--r--sw/source/core/text/widorp.cxx574
-rw-r--r--sw/source/core/text/widorp.hxx95
-rw-r--r--sw/source/core/text/wrong.cxx644
-rw-r--r--sw/source/core/tox/tox.cxx962
-rw-r--r--sw/source/core/tox/toxhlp.cxx193
-rw-r--r--sw/source/core/tox/txmsrt.cxx953
-rw-r--r--sw/source/core/txtnode/SwGrammarContact.cxx203
-rw-r--r--sw/source/core/txtnode/atrfld.cxx429
-rw-r--r--sw/source/core/txtnode/atrflyin.cxx284
-rw-r--r--sw/source/core/txtnode/atrftn.cxx543
-rw-r--r--sw/source/core/txtnode/atrref.cxx103
-rw-r--r--sw/source/core/txtnode/atrtox.cxx96
-rw-r--r--sw/source/core/txtnode/chrfmt.cxx38
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx912
-rw-r--r--sw/source/core/txtnode/fntcache.cxx2739
-rw-r--r--sw/source/core/txtnode/fntcap.cxx855
-rw-r--r--sw/source/core/txtnode/modeltoviewhelper.cxx120
-rw-r--r--sw/source/core/txtnode/ndhints.cxx497
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx5084
-rw-r--r--sw/source/core/txtnode/swfntcch.cxx94
-rw-r--r--sw/source/core/txtnode/swfont.cxx1246
-rw-r--r--sw/source/core/txtnode/thints.cxx3071
-rw-r--r--sw/source/core/txtnode/txatbase.cxx84
-rw-r--r--sw/source/core/txtnode/txatritr.cxx246
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx351
-rwxr-xr-xsw/source/core/txtnode/txtedt.cxx2179
-rw-r--r--sw/source/core/undo/SwRewriter.cxx78
-rw-r--r--sw/source/core/undo/SwUndoField.cxx162
-rw-r--r--sw/source/core/undo/SwUndoFmt.cxx459
-rw-r--r--sw/source/core/undo/SwUndoPageDesc.cxx428
-rw-r--r--sw/source/core/undo/SwUndoTOXChange.cxx77
-rw-r--r--sw/source/core/undo/docundo.cxx581
-rw-r--r--sw/source/core/undo/rolbck.cxx1522
-rw-r--r--sw/source/core/undo/unattr.cxx1259
-rw-r--r--sw/source/core/undo/unbkmk.cxx104
-rw-r--r--sw/source/core/undo/undel.cxx996
-rw-r--r--sw/source/core/undo/undo.hrc185
-rw-r--r--sw/source/core/undo/undo.src657
-rw-r--r--sw/source/core/undo/undobj.cxx1339
-rw-r--r--sw/source/core/undo/undobj1.cxx727
-rw-r--r--sw/source/core/undo/undoflystrattr.cxx99
-rw-r--r--sw/source/core/undo/undraw.cxx606
-rw-r--r--sw/source/core/undo/unfmco.cxx124
-rw-r--r--sw/source/core/undo/unins.cxx1066
-rw-r--r--sw/source/core/undo/unmove.cxx355
-rw-r--r--sw/source/core/undo/unnum.cxx469
-rw-r--r--sw/source/core/undo/unoutl.cxx61
-rw-r--r--sw/source/core/undo/unovwr.cxx502
-rw-r--r--sw/source/core/undo/unredln.cxx538
-rw-r--r--sw/source/core/undo/unsect.cxx499
-rw-r--r--sw/source/core/undo/unsort.cxx279
-rw-r--r--sw/source/core/undo/unspnd.cxx204
-rw-r--r--sw/source/core/undo/untbl.cxx3298
-rw-r--r--sw/source/core/undo/untblk.cxx355
-rw-r--r--sw/source/core/unocore/SwXTextDefaults.cxx292
-rw-r--r--sw/source/core/unocore/TextCursorHelper.cxx61
-rw-r--r--sw/source/core/unocore/XMLRangeHelper.cxx412
-rw-r--r--sw/source/core/unocore/XMLRangeHelper.hxx78
-rw-r--r--sw/source/core/unocore/swunohelper.cxx291
-rw-r--r--sw/source/core/unocore/unobkm.cxx652
-rw-r--r--sw/source/core/unocore/unochart.cxx3092
-rw-r--r--sw/source/core/unocore/unocoll.cxx1775
-rw-r--r--sw/source/core/unocore/unocore.src64
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx1154
-rw-r--r--sw/source/core/unocore/unodraw.cxx2960
-rw-r--r--sw/source/core/unocore/unoevent.cxx333
-rw-r--r--sw/source/core/unocore/unoevtlstnr.cxx118
-rw-r--r--sw/source/core/unocore/unofield.cxx2822
-rw-r--r--sw/source/core/unocore/unoflatpara.cxx531
-rw-r--r--sw/source/core/unocore/unoframe.cxx3180
-rw-r--r--sw/source/core/unocore/unoftn.cxx714
-rw-r--r--sw/source/core/unocore/unoidx.cxx3439
-rw-r--r--sw/source/core/unocore/unomap.cxx3124
-rw-r--r--sw/source/core/unocore/unoobj.cxx3208
-rw-r--r--sw/source/core/unocore/unoobj2.cxx1997
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx1462
-rw-r--r--sw/source/core/unocore/unoport.cxx1072
-rw-r--r--sw/source/core/unocore/unoportenum.cxx1226
-rw-r--r--sw/source/core/unocore/unoprnms.cxx794
-rw-r--r--sw/source/core/unocore/unoredline.cxx724
-rw-r--r--sw/source/core/unocore/unoredlines.cxx196
-rw-r--r--sw/source/core/unocore/unorefmk.cxx1694
-rw-r--r--sw/source/core/unocore/unosect.cxx1917
-rw-r--r--sw/source/core/unocore/unosett.cxx2828
-rw-r--r--sw/source/core/unocore/unosrch.cxx822
-rw-r--r--sw/source/core/unocore/unostyle.cxx4535
-rw-r--r--sw/source/core/unocore/unotbl.cxx5004
-rw-r--r--sw/source/core/unocore/unotext.cxx2964
-rw-r--r--sw/source/core/unocore/unotextmarkup.cxx488
-rw-r--r--sw/source/core/view/pagepreviewlayout.cxx1547
-rw-r--r--sw/source/core/view/printdata.cxx542
-rw-r--r--sw/source/core/view/vdraw.cxx378
-rw-r--r--sw/source/core/view/viewimp.cxx620
-rw-r--r--sw/source/core/view/viewpg.cxx257
-rw-r--r--sw/source/core/view/viewsh.cxx2788
-rw-r--r--sw/source/core/view/vnew.cxx415
-rw-r--r--sw/source/core/view/vprint.cxx735
-rw-r--r--sw/source/filter/ascii/ascatr.cxx227
-rw-r--r--sw/source/filter/ascii/parasc.cxx527
-rw-r--r--sw/source/filter/ascii/wrtasc.cxx225
-rw-r--r--sw/source/filter/ascii/wrtasc.hxx52
-rw-r--r--sw/source/filter/basflt/docfact.cxx85
-rw-r--r--sw/source/filter/basflt/fltini.cxx1037
-rw-r--r--sw/source/filter/basflt/iodetect.cxx592
-rw-r--r--sw/source/filter/basflt/shellio.cxx1014
-rw-r--r--sw/source/filter/html/SwAppletImpl.cxx208
-rw-r--r--sw/source/filter/html/css1atr.cxx3858
-rw-r--r--sw/source/filter/html/css1kywd.cxx281
-rw-r--r--sw/source/filter/html/css1kywd.hxx291
-rw-r--r--sw/source/filter/html/htmlatr.cxx3494
-rw-r--r--sw/source/filter/html/htmlbas.cxx363
-rw-r--r--sw/source/filter/html/htmlcss1.cxx2477
-rw-r--r--sw/source/filter/html/htmlctxt.cxx752
-rw-r--r--sw/source/filter/html/htmldraw.cxx859
-rw-r--r--sw/source/filter/html/htmlfld.cxx670
-rw-r--r--sw/source/filter/html/htmlfld.hxx92
-rw-r--r--sw/source/filter/html/htmlfldw.cxx539
-rw-r--r--sw/source/filter/html/htmlfly.cxx1929
-rw-r--r--sw/source/filter/html/htmlfly.hxx137
-rw-r--r--sw/source/filter/html/htmlflyt.cxx516
-rw-r--r--sw/source/filter/html/htmlform.cxx2661
-rw-r--r--sw/source/filter/html/htmlform.hxx52
-rw-r--r--sw/source/filter/html/htmlforw.cxx1446
-rw-r--r--sw/source/filter/html/htmlftn.cxx621
-rw-r--r--sw/source/filter/html/htmlgrin.cxx1447
-rw-r--r--sw/source/filter/html/htmlnum.cxx987
-rw-r--r--sw/source/filter/html/htmlnum.hxx131
-rw-r--r--sw/source/filter/html/htmlplug.cxx1401
-rw-r--r--sw/source/filter/html/htmlsect.cxx860
-rw-r--r--sw/source/filter/html/htmltab.cxx5599
-rw-r--r--sw/source/filter/html/htmltabw.cxx1268
-rw-r--r--sw/source/filter/html/htmlvsh.hxx56
-rw-r--r--sw/source/filter/html/parcss1.cxx1426
-rw-r--r--sw/source/filter/html/parcss1.hxx307
-rw-r--r--sw/source/filter/html/svxcss1.cxx3311
-rw-r--r--sw/source/filter/html/svxcss1.hxx435
-rw-r--r--sw/source/filter/html/swcss1.hxx227
-rw-r--r--sw/source/filter/html/swhtml.cxx5523
-rw-r--r--sw/source/filter/html/swhtml.hxx1040
-rw-r--r--sw/source/filter/html/wrthtml.cxx1439
-rw-r--r--sw/source/filter/html/wrthtml.hxx603
-rw-r--r--sw/source/filter/inc/fltbase.hxx127
-rw-r--r--sw/source/filter/inc/fltglbls.hxx124
-rw-r--r--sw/source/filter/inc/fltini.hxx108
-rw-r--r--sw/source/filter/inc/fltshell.hxx629
-rw-r--r--sw/source/filter/inc/msfilter.hxx528
-rw-r--r--sw/source/filter/inc/rtf.hxx132
-rw-r--r--sw/source/filter/inc/wrt_fn.hxx66
-rw-r--r--sw/source/filter/inc/wrtswtbl.hxx334
-rw-r--r--sw/source/filter/inc/wwstyles.hxx221
-rw-r--r--sw/source/filter/rtf/rtffld.cxx1231
-rw-r--r--sw/source/filter/rtf/rtffly.cxx1652
-rw-r--r--sw/source/filter/rtf/rtfnum.cxx1127
-rw-r--r--sw/source/filter/rtf/rtftbl.cxx1034
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx4424
-rw-r--r--sw/source/filter/rtf/swparrtf.hxx478
-rw-r--r--sw/source/filter/writer/writer.cxx628
-rw-r--r--sw/source/filter/writer/wrt_fn.cxx131
-rw-r--r--sw/source/filter/writer/wrtswtbl.cxx919
-rw-r--r--sw/source/filter/ww1/fltshell.cxx2087
-rw-r--r--sw/source/filter/ww1/w1class.cxx1256
-rw-r--r--sw/source/filter/ww1/w1class.hxx1649
-rw-r--r--sw/source/filter/ww1/w1filter.cxx2063
-rw-r--r--sw/source/filter/ww1/w1par.cxx141
-rw-r--r--sw/source/filter/ww1/w1par.hxx45
-rw-r--r--sw/source/filter/ww1/w1sprm.cxx684
-rw-r--r--sw/source/filter/ww1/w1struct.hxx928
-rw-r--r--sw/source/filter/ww8/CREDITS3
-rw-r--r--sw/source/filter/ww8/README-rtf.txt227
-rw-r--r--sw/source/filter/ww8/WW8FFData.cxx176
-rw-r--r--sw/source/filter/ww8/WW8FFData.hxx116
-rw-r--r--sw/source/filter/ww8/WW8FibData.cxx62
-rw-r--r--sw/source/filter/ww8/WW8FibData.hxx51
-rw-r--r--sw/source/filter/ww8/WW8Sttbf.cxx119
-rw-r--r--sw/source/filter/ww8/WW8Sttbf.hxx145
-rw-r--r--sw/source/filter/ww8/WW8TableInfo.cxx1517
-rw-r--r--sw/source/filter/ww8/WW8TableInfo.hxx354
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx583
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3305
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx610
-rw-r--r--sw/source/filter/ww8/docxexport.cxx673
-rw-r--r--sw/source/filter/ww8/docxexport.hxx203
-rw-r--r--sw/source/filter/ww8/docxexportfilter.cxx182
-rw-r--r--sw/source/filter/ww8/docxexportfilter.hxx62
-rw-r--r--sw/source/filter/ww8/docxfootnotes.hxx99
-rw-r--r--sw/source/filter/ww8/dump/dump8.cxx171
-rw-r--r--sw/source/filter/ww8/dump/dump8a.cxx2746
-rw-r--r--sw/source/filter/ww8/dump/msvbasic.cxx536
-rw-r--r--sw/source/filter/ww8/dump/msvbasic.hxx102
-rw-r--r--sw/source/filter/ww8/dump/ww8darr.cxx546
-rw-r--r--sw/source/filter/ww8/dump/ww8darr.hxx43
-rw-r--r--sw/source/filter/ww8/dump/ww8dout.cxx419
-rw-r--r--sw/source/filter/ww8/dump/ww8dout.hxx86
-rw-r--r--sw/source/filter/ww8/dump/ww8scan.cxx6667
-rw-r--r--sw/source/filter/ww8/dump/ww8scan.hxx1488
-rw-r--r--sw/source/filter/ww8/dump/ww8struc.hxx815
-rw-r--r--sw/source/filter/ww8/escher.hxx189
-rw-r--r--sw/source/filter/ww8/fields.cxx152
-rw-r--r--sw/source/filter/ww8/fields.hxx157
-rw-r--r--sw/source/filter/ww8/hash_wrap.hxx124
-rw-r--r--sw/source/filter/ww8/needed_cast.hxx63
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx3447
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.hxx590
-rwxr-xr-xsw/source/filter/ww8/rtfexport.cxx1288
-rwxr-xr-xsw/source/filter/ww8/rtfexport.hxx212
-rw-r--r--sw/source/filter/ww8/rtfexportfilter.cxx188
-rw-r--r--sw/source/filter/ww8/rtfexportfilter.hxx85
-rw-r--r--sw/source/filter/ww8/rtfimportfilter.cxx137
-rw-r--r--sw/source/filter/ww8/rtfimportfilter.hxx75
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.cxx586
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.hxx115
-rw-r--r--sw/source/filter/ww8/sortedarray.hxx121
-rw-r--r--sw/source/filter/ww8/staticassert.hxx71
-rw-r--r--sw/source/filter/ww8/styles.cxx218
-rw-r--r--sw/source/filter/ww8/tracer.cxx209
-rw-r--r--sw/source/filter/ww8/tracer.hxx91
-rw-r--r--sw/source/filter/ww8/types.hxx58
-rw-r--r--sw/source/filter/ww8/typessw.hxx46
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx871
-rw-r--r--sw/source/filter/ww8/writerhelper.hxx988
-rw-r--r--sw/source/filter/ww8/writerwordglue.cxx1047
-rw-r--r--sw/source/filter/ww8/writerwordglue.hxx164
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx2831
-rwxr-xr-xsw/source/filter/ww8/wrtw8nds.cxx2862
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx959
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx2302
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx3887
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx1500
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx889
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx5314
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx454
-rw-r--r--sw/source/filter/ww8/ww8glsy.cxx272
-rw-r--r--sw/source/filter/ww8/ww8glsy.hxx92
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx3252
-rw-r--r--sw/source/filter/ww8/ww8graf.hxx108
-rw-r--r--sw/source/filter/ww8/ww8graf2.cxx823
-rw-r--r--sw/source/filter/ww8/ww8par.cxx5181
-rw-r--r--sw/source/filter/ww8/ww8par.hxx1639
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx4756
-rw-r--r--sw/source/filter/ww8/ww8par2.hxx295
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx2644
-rw-r--r--sw/source/filter/ww8/ww8par4.cxx581
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx3628
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx6214
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx7374
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx1784
-rw-r--r--sw/source/filter/ww8/ww8struc.hxx1059
-rw-r--r--sw/source/filter/xml/DocSettingNames.hxx26
-rw-r--r--sw/source/filter/xml/ForbiddenCharactersEnum.hxx41
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx776
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.hxx164
-rw-r--r--sw/source/filter/xml/swxml.cxx1143
-rw-r--r--sw/source/filter/xml/wrtxml.cxx701
-rw-r--r--sw/source/filter/xml/wrtxml.hxx105
-rw-r--r--sw/source/filter/xml/xmlbrsh.cxx258
-rw-r--r--sw/source/filter/xml/xmlbrshe.hxx56
-rw-r--r--sw/source/filter/xml/xmlbrshi.hxx86
-rw-r--r--sw/source/filter/xml/xmlexp.cxx997
-rw-r--r--sw/source/filter/xml/xmlexp.hxx190
-rw-r--r--sw/source/filter/xml/xmlexpit.cxx1048
-rw-r--r--sw/source/filter/xml/xmlexpit.hxx136
-rw-r--r--sw/source/filter/xml/xmlfmt.cxx1134
-rw-r--r--sw/source/filter/xml/xmlfmte.cxx363
-rw-r--r--sw/source/filter/xml/xmlfonte.cxx102
-rw-r--r--sw/source/filter/xml/xmlimp.cxx1745
-rw-r--r--sw/source/filter/xml/xmlimp.hxx231
-rw-r--r--sw/source/filter/xml/xmlimpit.cxx976
-rw-r--r--sw/source/filter/xml/xmlimpit.hxx110
-rw-r--r--sw/source/filter/xml/xmlitem.cxx90
-rw-r--r--sw/source/filter/xml/xmlitem.hxx80
-rw-r--r--sw/source/filter/xml/xmliteme.cxx256
-rw-r--r--sw/source/filter/xml/xmlitemi.cxx272
-rw-r--r--sw/source/filter/xml/xmlitemm.cxx296
-rw-r--r--sw/source/filter/xml/xmlithlp.cxx422
-rw-r--r--sw/source/filter/xml/xmlithlp.hxx101
-rw-r--r--sw/source/filter/xml/xmlitmap.hxx96
-rw-r--r--sw/source/filter/xml/xmlitmpr.cxx91
-rw-r--r--sw/source/filter/xml/xmlmeta.cxx200
-rw-r--r--sw/source/filter/xml/xmlscript.cxx65
-rw-r--r--sw/source/filter/xml/xmltble.cxx1250
-rw-r--r--sw/source/filter/xml/xmltbli.cxx2951
-rw-r--r--sw/source/filter/xml/xmltbli.hxx225
-rw-r--r--sw/source/filter/xml/xmltext.cxx107
-rw-r--r--sw/source/filter/xml/xmltexte.cxx767
-rw-r--r--sw/source/filter/xml/xmltexte.hxx88
-rw-r--r--sw/source/filter/xml/xmltexti.cxx1062
-rw-r--r--sw/source/filter/xml/xmltexti.hxx132
-rw-r--r--sw/source/ui/app/app.src665
-rw-r--r--sw/source/ui/app/appenv.cxx545
-rw-r--r--sw/source/ui/app/apphdl.cxx980
-rw-r--r--sw/source/ui/app/applab.cxx457
-rw-r--r--sw/source/ui/app/appopt.cxx646
-rw-r--r--sw/source/ui/app/docsh.cxx1391
-rw-r--r--sw/source/ui/app/docsh2.cxx1860
-rw-r--r--sw/source/ui/app/docshdrw.cxx84
-rw-r--r--sw/source/ui/app/docshini.cxx818
-rw-r--r--sw/source/ui/app/docst.cxx1312
-rw-r--r--sw/source/ui/app/docstyle.cxx2906
-rw-r--r--sw/source/ui/app/error.src214
-rw-r--r--sw/source/ui/app/mainwn.cxx165
-rw-r--r--sw/source/ui/app/mn.src1453
-rw-r--r--sw/source/ui/app/swdll.cxx156
-rw-r--r--sw/source/ui/app/swmodul1.cxx680
-rw-r--r--sw/source/ui/app/swmodule.cxx500
-rw-r--r--sw/source/ui/app/swwait.cxx75
-rw-r--r--sw/source/ui/cctrl/actctrl.cxx138
-rw-r--r--sw/source/ui/cctrl/popbox.cxx91
-rw-r--r--sw/source/ui/cctrl/swlbox.cxx231
-rw-r--r--sw/source/ui/chrdlg/break.cxx255
-rw-r--r--sw/source/ui/chrdlg/break.hrc41
-rw-r--r--sw/source/ui/chrdlg/ccoll.cxx236
-rw-r--r--sw/source/ui/chrdlg/ccoll.hrc50
-rw-r--r--sw/source/ui/chrdlg/ccoll.src165
-rw-r--r--sw/source/ui/chrdlg/chardlg.cxx407
-rw-r--r--sw/source/ui/chrdlg/chardlg.hrc86
-rw-r--r--sw/source/ui/chrdlg/chardlg.src272
-rw-r--r--sw/source/ui/chrdlg/chrdlg.src77
-rw-r--r--sw/source/ui/chrdlg/drpcps.cxx894
-rw-r--r--sw/source/ui/chrdlg/drpcps.hrc51
-rw-r--r--sw/source/ui/chrdlg/drpcps.src233
-rw-r--r--sw/source/ui/chrdlg/numpara.cxx366
-rw-r--r--sw/source/ui/chrdlg/numpara.hrc53
-rw-r--r--sw/source/ui/chrdlg/numpara.src237
-rw-r--r--sw/source/ui/chrdlg/paradlg.hrc71
-rw-r--r--sw/source/ui/chrdlg/paradlg.src165
-rw-r--r--sw/source/ui/chrdlg/pardlg.cxx269
-rw-r--r--sw/source/ui/chrdlg/swbreak.src178
-rw-r--r--sw/source/ui/chrdlg/swuiccoll.cxx361
-rw-r--r--sw/source/ui/chrdlg/tblnumfm.cxx76
-rw-r--r--sw/source/ui/config/barcfg.cxx152
-rw-r--r--sw/source/ui/config/caption.cxx182
-rw-r--r--sw/source/ui/config/cfgitems.cxx460
-rw-r--r--sw/source/ui/config/config.hrc67
-rw-r--r--sw/source/ui/config/dbconfig.cxx143
-rw-r--r--sw/source/ui/config/fontcfg.cxx359
-rw-r--r--sw/source/ui/config/mailconfigpage.cxx622
-rw-r--r--sw/source/ui/config/mailconfigpage.hrc83
-rw-r--r--sw/source/ui/config/mailconfigpage.src443
-rw-r--r--sw/source/ui/config/modcfg.cxx1392
-rw-r--r--sw/source/ui/config/optcomp.cxx628
-rw-r--r--sw/source/ui/config/optcomp.hrc56
-rw-r--r--sw/source/ui/config/optcomp.src143
-rw-r--r--sw/source/ui/config/optdlg.hrc208
-rw-r--r--sw/source/ui/config/optdlg.src1074
-rw-r--r--sw/source/ui/config/optload.cxx977
-rw-r--r--sw/source/ui/config/optload.hrc82
-rw-r--r--sw/source/ui/config/optload.src417
-rw-r--r--sw/source/ui/config/optpage.cxx2617
-rw-r--r--sw/source/ui/config/prtopt.cxx197
-rw-r--r--sw/source/ui/config/redlopt.hrc54
-rw-r--r--sw/source/ui/config/redlopt.src287
-rw-r--r--sw/source/ui/config/uinums.cxx673
-rw-r--r--sw/source/ui/config/usrpref.cxx663
-rw-r--r--sw/source/ui/config/viewopt.cxx645
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx752
-rw-r--r--sw/source/ui/dbui/addresslistdialog.hrc48
-rw-r--r--sw/source/ui/dbui/addresslistdialog.hxx122
-rw-r--r--sw/source/ui/dbui/addresslistdialog.src131
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.cxx835
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.hrc64
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.hxx130
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.src238
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.cxx274
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.hrc49
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.hxx99
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.src169
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx1945
-rw-r--r--sw/source/ui/dbui/dbinsdlg.hrc73
-rw-r--r--sw/source/ui/dbui/dbinsdlg.src330
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx3109
-rw-r--r--sw/source/ui/dbui/dbtablepreviewdialog.cxx144
-rw-r--r--sw/source/ui/dbui/dbtablepreviewdialog.hrc35
-rw-r--r--sw/source/ui/dbui/dbtablepreviewdialog.hxx60
-rw-r--r--sw/source/ui/dbui/dbtablepreviewdialog.src61
-rw-r--r--sw/source/ui/dbui/dbtree.cxx622
-rw-r--r--sw/source/ui/dbui/dbui.cxx151
-rw-r--r--sw/source/ui/dbui/dbui.src284
-rw-r--r--sw/source/ui/dbui/maildispatcher.cxx296
-rw-r--r--sw/source/ui/dbui/mailmergechildwindow.cxx796
-rw-r--r--sw/source/ui/dbui/mailmergechildwindow.hrc61
-rw-r--r--sw/source/ui/dbui/mailmergechildwindow.src279
-rw-r--r--sw/source/ui/dbui/mailmergehelper.cxx1047
-rw-r--r--sw/source/ui/dbui/mailmergewizard.cxx336
-rw-r--r--sw/source/ui/dbui/mailmergewizard.hrc37
-rw-r--r--sw/source/ui/dbui/mailmergewizard.src80
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx1846
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.hrc115
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.hxx332
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.src655
-rw-r--r--sw/source/ui/dbui/mmconfigitem.cxx1986
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.cxx224
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.hrc37
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.hxx74
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.src108
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.cxx619
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.hrc65
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.hxx176
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.src261
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.cxx816
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.hrc48
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.hxx114
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.src165
-rw-r--r--sw/source/ui/dbui/mmmergepage.cxx123
-rw-r--r--sw/source/ui/dbui/mmmergepage.hrc43
-rw-r--r--sw/source/ui/dbui/mmmergepage.hxx73
-rw-r--r--sw/source/ui/dbui/mmmergepage.src107
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx1440
-rw-r--r--sw/source/ui/dbui/mmoutputpage.hrc103
-rw-r--r--sw/source/ui/dbui/mmoutputpage.hxx242
-rw-r--r--sw/source/ui/dbui/mmoutputpage.src490
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.cxx113
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.hrc44
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.hxx67
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.src101
-rw-r--r--sw/source/ui/dbui/mmpreparemergepage.cxx204
-rw-r--r--sw/source/ui/dbui/mmpreparemergepage.hrc46
-rw-r--r--sw/source/ui/dbui/mmpreparemergepage.hxx77
-rw-r--r--sw/source/ui/dbui/mmpreparemergepage.src132
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.cxx223
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.hrc43
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.hxx79
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.src99
-rw-r--r--sw/source/ui/dbui/swdbtoolsclient.cxx248
-rw-r--r--sw/source/ui/dialog/SwSpellDialogChildWindow.cxx900
-rw-r--r--sw/source/ui/dialog/abstract.cxx92
-rw-r--r--sw/source/ui/dialog/abstract.hrc36
-rw-r--r--sw/source/ui/dialog/abstract.src155
-rw-r--r--sw/source/ui/dialog/addrdlg.cxx69
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx462
-rw-r--r--sw/source/ui/dialog/ascfldlg.hrc44
-rw-r--r--sw/source/ui/dialog/ascfldlg.src183
-rw-r--r--sw/source/ui/dialog/dialog.src62
-rw-r--r--sw/source/ui/dialog/docstdlg.cxx195
-rw-r--r--sw/source/ui/dialog/docstdlg.hrc47
-rw-r--r--sw/source/ui/dialog/docstdlg.src184
-rw-r--r--sw/source/ui/dialog/macassgn.cxx163
-rw-r--r--sw/source/ui/dialog/regionsw.cxx264
-rw-r--r--sw/source/ui/dialog/regionsw.hrc116
-rw-r--r--sw/source/ui/dialog/regionsw.src899
-rw-r--r--sw/source/ui/dialog/swabstdlg.cxx52
-rw-r--r--sw/source/ui/dialog/swdialmgr.cxx54
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx1742
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx584
-rw-r--r--sw/source/ui/dialog/swuiexp.cxx55
-rw-r--r--sw/source/ui/dialog/swwrtshitem.cxx51
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx2467
-rw-r--r--sw/source/ui/dialog/wordcountdialog.cxx99
-rw-r--r--sw/source/ui/dialog/wordcountdialog.hrc43
-rw-r--r--sw/source/ui/dialog/wordcountdialog.src115
-rw-r--r--sw/source/ui/dochdl/dochdl.src76
-rwxr-xr-xsw/source/ui/dochdl/gloshdl.cxx898
-rw-r--r--sw/source/ui/dochdl/selglos.cxx77
-rw-r--r--sw/source/ui/dochdl/selglos.hrc31
-rw-r--r--sw/source/ui/dochdl/selglos.src112
-rw-r--r--sw/source/ui/dochdl/swdtflvr.cxx3853
-rw-r--r--sw/source/ui/docvw/AnchorOverlayObject.cxx467
-rw-r--r--sw/source/ui/docvw/AnchorOverlayObject.hxx143
-rw-r--r--sw/source/ui/docvw/AnnotationMenuButton.cxx215
-rw-r--r--sw/source/ui/docvw/AnnotationMenuButton.hxx63
-rw-r--r--sw/source/ui/docvw/AnnotationWin.cxx296
-rw-r--r--sw/source/ui/docvw/PostItMgr.cxx2045
-rw-r--r--sw/source/ui/docvw/ShadowOverlayObject.cxx268
-rw-r--r--sw/source/ui/docvw/ShadowOverlayObject.hxx80
-rw-r--r--sw/source/ui/docvw/SidebarTxtControl.cxx427
-rw-r--r--sw/source/ui/docvw/SidebarTxtControl.hxx87
-rw-r--r--sw/source/ui/docvw/SidebarTxtControlAcc.cxx317
-rw-r--r--sw/source/ui/docvw/SidebarTxtControlAcc.hxx56
-rw-r--r--sw/source/ui/docvw/SidebarWin.cxx1392
-rw-r--r--sw/source/ui/docvw/SidebarWinAcc.cxx162
-rw-r--r--sw/source/ui/docvw/SidebarWinAcc.hxx67
-rw-r--r--sw/source/ui/docvw/access.src121
-rw-r--r--sw/source/ui/docvw/annotation.hrc54
-rw-r--r--sw/source/ui/docvw/annotation.src68
-rw-r--r--sw/source/ui/docvw/docvw.hrc93
-rw-r--r--sw/source/ui/docvw/docvw.src296
-rw-r--r--sw/source/ui/docvw/edtdd.cxx527
-rw-r--r--sw/source/ui/docvw/edtwin.cxx5803
-rw-r--r--sw/source/ui/docvw/edtwin2.cxx592
-rw-r--r--sw/source/ui/docvw/edtwin3.cxx216
-rw-r--r--sw/source/ui/docvw/frmsidebarwincontainer.cxx216
-rw-r--r--sw/source/ui/docvw/frmsidebarwincontainer.hxx73
-rw-r--r--sw/source/ui/docvw/romenu.cxx523
-rw-r--r--sw/source/ui/docvw/romenu.hxx75
-rw-r--r--sw/source/ui/docvw/srcedtw.cxx1099
-rw-r--r--sw/source/ui/envelp/envelp.src87
-rw-r--r--sw/source/ui/envelp/envfmt.cxx635
-rw-r--r--sw/source/ui/envelp/envfmt.hrc82
-rw-r--r--sw/source/ui/envelp/envfmt.hxx112
-rw-r--r--sw/source/ui/envelp/envfmt.src324
-rw-r--r--sw/source/ui/envelp/envimg.cxx381
-rw-r--r--sw/source/ui/envelp/envlop.hrc65
-rw-r--r--sw/source/ui/envelp/envlop.src213
-rw-r--r--sw/source/ui/envelp/envlop1.cxx441
-rw-r--r--sw/source/ui/envelp/envprt.cxx259
-rw-r--r--sw/source/ui/envelp/envprt.hrc96
-rw-r--r--sw/source/ui/envelp/envprt.hxx93
-rw-r--r--sw/source/ui/envelp/envprt.src297
-rw-r--r--sw/source/ui/envelp/label.hrc128
-rw-r--r--sw/source/ui/envelp/label.src758
-rw-r--r--sw/source/ui/envelp/label1.cxx1111
-rw-r--r--sw/source/ui/envelp/labelcfg.cxx302
-rw-r--r--sw/source/ui/envelp/labelexp.cxx281
-rw-r--r--sw/source/ui/envelp/labfmt.cxx712
-rw-r--r--sw/source/ui/envelp/labfmt.hrc89
-rw-r--r--sw/source/ui/envelp/labfmt.hxx175
-rw-r--r--sw/source/ui/envelp/labfmt.src370
-rw-r--r--sw/source/ui/envelp/labimg.cxx482
-rw-r--r--sw/source/ui/envelp/labimp.hxx118
-rw-r--r--sw/source/ui/envelp/labprt.cxx242
-rw-r--r--sw/source/ui/envelp/labprt.hrc59
-rw-r--r--sw/source/ui/envelp/labprt.hxx86
-rw-r--r--sw/source/ui/envelp/labprt.src157
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx938
-rw-r--r--sw/source/ui/envelp/mailmrge.hrc92
-rw-r--r--sw/source/ui/envelp/mailmrge.src455
-rw-r--r--sw/source/ui/envelp/swuilabimp.hxx253
-rw-r--r--sw/source/ui/envelp/syncbtn.cxx112
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.cxx139
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.hrc37
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.src125
-rw-r--r--sw/source/ui/fldui/FldRefTreeListBox.cxx81
-rw-r--r--sw/source/ui/fldui/FldRefTreeListBox.hxx44
-rw-r--r--sw/source/ui/fldui/changedb.cxx363
-rw-r--r--sw/source/ui/fldui/changedb.hrc62
-rw-r--r--sw/source/ui/fldui/changedb.src130
-rw-r--r--sw/source/ui/fldui/flddb.cxx583
-rw-r--r--sw/source/ui/fldui/flddb.hxx106
-rw-r--r--sw/source/ui/fldui/flddb.src206
-rw-r--r--sw/source/ui/fldui/flddinf.cxx537
-rw-r--r--sw/source/ui/fldui/flddinf.hxx89
-rw-r--r--sw/source/ui/fldui/flddinf.src141
-rw-r--r--sw/source/ui/fldui/flddok.cxx731
-rw-r--r--sw/source/ui/fldui/flddok.hxx95
-rw-r--r--sw/source/ui/fldui/flddok.src203
-rw-r--r--sw/source/ui/fldui/fldedt.cxx422
-rw-r--r--sw/source/ui/fldui/fldfunc.cxx758
-rw-r--r--sw/source/ui/fldui/fldfunc.hxx113
-rw-r--r--sw/source/ui/fldui/fldfunc.src284
-rw-r--r--sw/source/ui/fldui/fldmgr.cxx1793
-rw-r--r--sw/source/ui/fldui/fldpage.cxx419
-rw-r--r--sw/source/ui/fldui/fldpage.hxx107
-rw-r--r--sw/source/ui/fldui/fldref.cxx1073
-rw-r--r--sw/source/ui/fldui/fldref.hxx114
-rw-r--r--sw/source/ui/fldui/fldref.src150
-rw-r--r--sw/source/ui/fldui/fldtdlg.cxx386
-rw-r--r--sw/source/ui/fldui/fldtdlg.hrc171
-rw-r--r--sw/source/ui/fldui/fldtdlg.src118
-rw-r--r--sw/source/ui/fldui/fldui.src684
-rw-r--r--sw/source/ui/fldui/fldvar.cxx1383
-rw-r--r--sw/source/ui/fldui/fldvar.hxx126
-rw-r--r--sw/source/ui/fldui/fldvar.src245
-rw-r--r--sw/source/ui/fldui/fldwrap.cxx212
-rw-r--r--sw/source/ui/fldui/inpdlg.cxx201
-rw-r--r--sw/source/ui/fldui/inpdlg.hrc34
-rw-r--r--sw/source/ui/fldui/inpdlg.src134
-rw-r--r--sw/source/ui/fldui/javaedit.cxx366
-rw-r--r--sw/source/ui/fldui/javaedit.hrc51
-rw-r--r--sw/source/ui/fldui/javaedit.src181
-rw-r--r--sw/source/ui/fldui/xfldui.cxx184
-rw-r--r--sw/source/ui/fmtui/tmpdlg.cxx647
-rw-r--r--sw/source/ui/fmtui/tmpdlg.src380
-rw-r--r--sw/source/ui/frmdlg/colex.cxx610
-rw-r--r--sw/source/ui/frmdlg/colmgr.cxx191
-rw-r--r--sw/source/ui/frmdlg/column.cxx1498
-rw-r--r--sw/source/ui/frmdlg/column.hrc86
-rw-r--r--sw/source/ui/frmdlg/column.src431
-rw-r--r--sw/source/ui/frmdlg/cption.cxx652
-rw-r--r--sw/source/ui/frmdlg/cption.hrc78
-rw-r--r--sw/source/ui/frmdlg/cption.src342
-rw-r--r--sw/source/ui/frmdlg/frmdlg.cxx221
-rw-r--r--sw/source/ui/frmdlg/frmmgr.cxx629
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx3345
-rw-r--r--sw/source/ui/frmdlg/frmpage.hrc146
-rw-r--r--sw/source/ui/frmdlg/frmpage.src884
-rw-r--r--sw/source/ui/frmdlg/frmui.src133
-rw-r--r--sw/source/ui/frmdlg/pattern.cxx75
-rw-r--r--sw/source/ui/frmdlg/pattern.hrc46
-rw-r--r--sw/source/ui/frmdlg/uiborder.cxx79
-rw-r--r--sw/source/ui/frmdlg/wrap.cxx785
-rw-r--r--sw/source/ui/frmdlg/wrap.hrc66
-rw-r--r--sw/source/ui/frmdlg/wrap.src271
-rw-r--r--sw/source/ui/globdoc/globdoc.cxx91
-rw-r--r--sw/source/ui/globdoc/globdoc.src45
-rw-r--r--sw/source/ui/inc/DropDownFieldDialog.hxx71
-rw-r--r--sw/source/ui/inc/SidebarWindowsConsts.hxx41
-rw-r--r--sw/source/ui/inc/SwSpellDialogChildWindow.hxx76
-rw-r--r--sw/source/ui/inc/SwXFilterOptions.hxx113
-rw-r--r--sw/source/ui/inc/abstract.hxx73
-rw-r--r--sw/source/ui/inc/actctrl.hxx98
-rw-r--r--sw/source/ui/inc/addrdlg.hxx44
-rwxr-xr-xsw/source/ui/inc/annotsh.hxx78
-rw-r--r--sw/source/ui/inc/app.hrc183
-rw-r--r--sw/source/ui/inc/ascfldlg.hxx78
-rw-r--r--sw/source/ui/inc/autoedit.hxx50
-rw-r--r--sw/source/ui/inc/barcfg.hxx47
-rw-r--r--sw/source/ui/inc/basesh.hxx127
-rw-r--r--sw/source/ui/inc/beziersh.hxx44
-rw-r--r--sw/source/ui/inc/bmpwin.hxx69
-rw-r--r--sw/source/ui/inc/bookctrl.hxx57
-rw-r--r--sw/source/ui/inc/bookmark.hxx88
-rw-r--r--sw/source/ui/inc/break.hxx92
-rw-r--r--sw/source/ui/inc/caption.hxx118
-rw-r--r--sw/source/ui/inc/cfgdesc.hxx69
-rw-r--r--sw/source/ui/inc/cfgid.h40
-rw-r--r--sw/source/ui/inc/cfgitems.hxx242
-rw-r--r--sw/source/ui/inc/changedb.hxx92
-rw-r--r--sw/source/ui/inc/chartins.hxx35
-rw-r--r--sw/source/ui/inc/chldwrap.hxx55
-rw-r--r--sw/source/ui/inc/chrdlg.hxx119
-rw-r--r--sw/source/ui/inc/cnttab.hxx90
-rw-r--r--sw/source/ui/inc/colex.hxx118
-rw-r--r--sw/source/ui/inc/colmgr.hxx131
-rw-r--r--sw/source/ui/inc/column.hxx227
-rw-r--r--sw/source/ui/inc/conarc.hxx57
-rw-r--r--sw/source/ui/inc/concustomshape.hxx72
-rw-r--r--sw/source/ui/inc/condedit.hxx72
-rw-r--r--sw/source/ui/inc/conform.hxx47
-rw-r--r--sw/source/ui/inc/conpoly.hxx55
-rw-r--r--sw/source/ui/inc/conrect.hxx60
-rw-r--r--sw/source/ui/inc/content.hxx225
-rw-r--r--sw/source/ui/inc/conttree.hxx334
-rw-r--r--sw/source/ui/inc/convert.hxx91
-rw-r--r--sw/source/ui/inc/cption.hxx137
-rw-r--r--sw/source/ui/inc/dbconfig.hxx54
-rw-r--r--sw/source/ui/inc/dbinsdlg.hxx188
-rw-r--r--sw/source/ui/inc/dbtree.hxx86
-rw-r--r--sw/source/ui/inc/dbui.hxx86
-rw-r--r--sw/source/ui/inc/dialmgr.hxx48
-rw-r--r--sw/source/ui/inc/docfnote.hxx50
-rw-r--r--sw/source/ui/inc/docstdlg.hxx84
-rw-r--r--sw/source/ui/inc/drawbase.hxx90
-rw-r--r--sw/source/ui/inc/drawsh.hxx52
-rw-r--r--sw/source/ui/inc/drformsh.hxx47
-rw-r--r--sw/source/ui/inc/drpcps.hxx125
-rw-r--r--sw/source/ui/inc/drwbassh.hxx64
-rw-r--r--sw/source/ui/inc/drwtxtsh.hxx86
-rw-r--r--sw/source/ui/inc/dselect.hxx52
-rw-r--r--sw/source/ui/inc/edtwin.hxx307
-rw-r--r--sw/source/ui/inc/envimg.hxx100
-rw-r--r--sw/source/ui/inc/envlop.hxx149
-rw-r--r--sw/source/ui/inc/fldedt.hxx66
-rw-r--r--sw/source/ui/inc/fldmgr.hxx234
-rw-r--r--sw/source/ui/inc/fldtdlg.hxx68
-rw-r--r--sw/source/ui/inc/fldwrap.hxx63
-rw-r--r--sw/source/ui/inc/fontcfg.hxx120
-rw-r--r--sw/source/ui/inc/formatclipboard.hxx69
-rw-r--r--sw/source/ui/inc/formedt.hxx108
-rw-r--r--sw/source/ui/inc/frmdlg.hxx67
-rw-r--r--sw/source/ui/inc/frmmgr.hxx196
-rw-r--r--sw/source/ui/inc/frmpage.hxx342
-rw-r--r--sw/source/ui/inc/frmsh.hxx50
-rw-r--r--sw/source/ui/inc/frmui.hrc144
-rw-r--r--sw/source/ui/inc/globals.h37
-rw-r--r--sw/source/ui/inc/globdoc.hrc64
-rw-r--r--sw/source/ui/inc/glosbib.hxx120
-rw-r--r--sw/source/ui/inc/glosdoc.hxx148
-rw-r--r--sw/source/ui/inc/gloshdl.hxx110
-rw-r--r--sw/source/ui/inc/gloslst.hxx89
-rw-r--r--sw/source/ui/inc/glossary.hxx197
-rw-r--r--sw/source/ui/inc/glshell.hxx114
-rw-r--r--sw/source/ui/inc/grfsh.hxx44
-rw-r--r--sw/source/ui/inc/hidfunc.h350
-rw-r--r--sw/source/ui/inc/hyp.hxx67
-rw-r--r--sw/source/ui/inc/idxmrk.hxx73
-rw-r--r--sw/source/ui/inc/imaildsplistener.hxx77
-rw-r--r--sw/source/ui/inc/initui.hxx79
-rw-r--r--sw/source/ui/inc/inpdlg.hxx78
-rw-r--r--sw/source/ui/inc/inputwin.hxx133
-rw-r--r--sw/source/ui/inc/insfnote.hxx97
-rw-r--r--sw/source/ui/inc/insrule.hxx66
-rw-r--r--sw/source/ui/inc/instable.hxx100
-rw-r--r--sw/source/ui/inc/javaedit.hxx118
-rw-r--r--sw/source/ui/inc/label.hxx99
-rw-r--r--sw/source/ui/inc/labelcfg.hxx59
-rw-r--r--sw/source/ui/inc/labimg.hxx131
-rwxr-xr-xsw/source/ui/inc/langhelper.hxx68
-rw-r--r--sw/source/ui/inc/linenum.hxx110
-rw-r--r--sw/source/ui/inc/listsh.hxx44
-rw-r--r--sw/source/ui/inc/macassgn.hxx54
-rw-r--r--sw/source/ui/inc/mailconfigpage.hxx110
-rw-r--r--sw/source/ui/inc/maildispatcher.hxx168
-rw-r--r--sw/source/ui/inc/mailmergechildwindow.hxx66
-rw-r--r--sw/source/ui/inc/mailmergehelper.hxx349
-rw-r--r--sw/source/ui/inc/mailmergewizard.hxx103
-rw-r--r--sw/source/ui/inc/mailmrge.hxx204
-rw-r--r--sw/source/ui/inc/mediash.hxx43
-rw-r--r--sw/source/ui/inc/mergetbl.hxx59
-rw-r--r--sw/source/ui/inc/misc.hrc106
-rw-r--r--sw/source/ui/inc/mmconfigitem.hxx279
-rw-r--r--sw/source/ui/inc/multmrk.hxx77
-rw-r--r--sw/source/ui/inc/navicfg.hxx119
-rw-r--r--sw/source/ui/inc/navicont.hxx61
-rw-r--r--sw/source/ui/inc/navipi.hxx198
-rw-r--r--sw/source/ui/inc/num.hxx205
-rw-r--r--sw/source/ui/inc/numberingtypelistbox.hxx58
-rw-r--r--sw/source/ui/inc/numfmtlb.hxx87
-rw-r--r--sw/source/ui/inc/numpara.hxx98
-rw-r--r--sw/source/ui/inc/numprevw.hxx71
-rw-r--r--sw/source/ui/inc/olesh.hxx48
-rw-r--r--sw/source/ui/inc/olmenu.hxx91
-rw-r--r--sw/source/ui/inc/optcomp.hxx87
-rw-r--r--sw/source/ui/inc/optload.hxx213
-rw-r--r--sw/source/ui/inc/optpage.hxx509
-rw-r--r--sw/source/ui/inc/outline.hxx166
-rw-r--r--sw/source/ui/inc/pardlg.hxx39
-rw-r--r--sw/source/ui/inc/pattern.hxx44
-rw-r--r--sw/source/ui/inc/pgfnote.hxx93
-rw-r--r--sw/source/ui/inc/pggrid.hxx113
-rw-r--r--sw/source/ui/inc/popbox.hxx67
-rw-r--r--sw/source/ui/inc/popup.hrc58
-rw-r--r--sw/source/ui/inc/prcntfld.hxx99
-rw-r--r--sw/source/ui/inc/pview.hxx336
-rw-r--r--sw/source/ui/inc/redlndlg.hxx189
-rw-r--r--sw/source/ui/inc/regionsw.hxx336
-rw-r--r--sw/source/ui/inc/ribbar.hrc132
-rw-r--r--sw/source/ui/inc/rowht.hxx67
-rw-r--r--sw/source/ui/inc/scroll.hxx71
-rw-r--r--sw/source/ui/inc/selglos.hxx74
-rw-r--r--sw/source/ui/inc/sharedconnection.hxx36
-rw-r--r--sw/source/ui/inc/shdwcrsr.hxx67
-rw-r--r--sw/source/ui/inc/shells.hrc112
-rw-r--r--sw/source/ui/inc/split.hxx76
-rw-r--r--sw/source/ui/inc/splittbl.hxx61
-rw-r--r--sw/source/ui/inc/srcedtw.hxx164
-rw-r--r--sw/source/ui/inc/srcview.hxx126
-rw-r--r--sw/source/ui/inc/srtdlg.hxx118
-rw-r--r--sw/source/ui/inc/stmenu.hxx85
-rw-r--r--sw/source/ui/inc/swcont.hxx113
-rw-r--r--sw/source/ui/inc/swdtflvr.hxx222
-rw-r--r--sw/source/ui/inc/swlbox.hxx124
-rw-r--r--sw/source/ui/inc/swmodalredlineacceptdlg.hxx48
-rw-r--r--sw/source/ui/inc/swrenamexnameddlg.hxx87
-rw-r--r--sw/source/ui/inc/swtablerep.hxx94
-rw-r--r--sw/source/ui/inc/swuiccoll.hxx89
-rw-r--r--sw/source/ui/inc/swuicnttab.hxx539
-rw-r--r--sw/source/ui/inc/swuiidxmrk.hxx295
-rw-r--r--sw/source/ui/inc/swuipardlg.hxx51
-rw-r--r--sw/source/ui/inc/swvset.hxx41
-rw-r--r--sw/source/ui/inc/swwrtshitem.hxx52
-rw-r--r--sw/source/ui/inc/syncbtn.hxx71
-rw-r--r--sw/source/ui/inc/table.hrc50
-rw-r--r--sw/source/ui/inc/tabledlg.hxx55
-rw-r--r--sw/source/ui/inc/tablemgr.hxx95
-rw-r--r--sw/source/ui/inc/tabsh.hxx58
-rw-r--r--sw/source/ui/inc/tautofmt.hxx118
-rw-r--r--sw/source/ui/inc/tblctrl.hxx57
-rw-r--r--sw/source/ui/inc/tblnumfm.hxx44
-rw-r--r--sw/source/ui/inc/tbxanchr.hxx49
-rw-r--r--sw/source/ui/inc/textcontrolcombo.hxx66
-rw-r--r--sw/source/ui/inc/textsh.hxx90
-rw-r--r--sw/source/ui/inc/tmpdlg.hxx66
-rw-r--r--sw/source/ui/inc/tmplctrl.hxx58
-rw-r--r--sw/source/ui/inc/toolbox.hrc563
-rw-r--r--sw/source/ui/inc/toxmgr.hxx324
-rw-r--r--sw/source/ui/inc/uiborder.hxx49
-rw-r--r--sw/source/ui/inc/uiitems.hxx116
-rw-r--r--sw/source/ui/inc/uinums.hxx136
-rw-r--r--sw/source/ui/inc/uitool.hxx92
-rw-r--r--sw/source/ui/inc/uivwimp.hxx188
-rw-r--r--sw/source/ui/inc/unodispatch.hxx134
-rw-r--r--sw/source/ui/inc/unotools.hxx135
-rw-r--r--sw/source/ui/inc/unotxvw.hxx274
-rw-r--r--sw/source/ui/inc/usrpref.hxx286
-rw-r--r--sw/source/ui/inc/utlui.hrc194
-rw-r--r--sw/source/ui/inc/view.hxx696
-rw-r--r--sw/source/ui/inc/viewlayoutctrl.hxx56
-rw-r--r--sw/source/ui/inc/web.hrc74
-rw-r--r--sw/source/ui/inc/wformsh.hxx45
-rw-r--r--sw/source/ui/inc/wfrmsh.hxx48
-rw-r--r--sw/source/ui/inc/wgrfsh.hxx45
-rw-r--r--sw/source/ui/inc/wlistsh.hxx42
-rw-r--r--sw/source/ui/inc/wolesh.hxx48
-rw-r--r--sw/source/ui/inc/wordcountdialog.hxx65
-rw-r--r--sw/source/ui/inc/workctrl.hxx225
-rw-r--r--sw/source/ui/inc/wrap.hxx151
-rw-r--r--sw/source/ui/inc/wrtsh.hxx652
-rw-r--r--sw/source/ui/inc/wtabsh.hxx42
-rw-r--r--sw/source/ui/inc/wtextsh.hxx48
-rw-r--r--sw/source/ui/inc/wview.hxx51
-rw-r--r--sw/source/ui/inc/zoomctrl.hxx52
-rw-r--r--sw/source/ui/index/cntex.cxx516
-rw-r--r--sw/source/ui/index/cnttab.cxx4553
-rw-r--r--sw/source/ui/index/cnttab.hrc285
-rwxr-xr-xsw/source/ui/index/cnttab.src1356
-rw-r--r--sw/source/ui/index/idxmrk.cxx153
-rw-r--r--sw/source/ui/index/idxmrk.hrc108
-rw-r--r--sw/source/ui/index/idxmrk.src636
-rw-r--r--sw/source/ui/index/multmrk.cxx98
-rw-r--r--sw/source/ui/index/multmrk.hrc34
-rw-r--r--sw/source/ui/index/multmrk.src119
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx1949
-rw-r--r--sw/source/ui/index/toxmgr.cxx529
-rw-r--r--sw/source/ui/lingu/cvdata.mac19
-rwxr-xr-xsw/source/ui/lingu/hhcwrp.cxx818
-rw-r--r--sw/source/ui/lingu/hyp.cxx176
-rw-r--r--sw/source/ui/lingu/olmenu.cxx937
-rw-r--r--sw/source/ui/lingu/olmenu.hrc97
-rw-r--r--sw/source/ui/lingu/olmenu.src137
-rw-r--r--sw/source/ui/lingu/sdrhhcwrap.cxx200
-rw-r--r--sw/source/ui/lingu/sdrhhcwrap.hxx68
-rw-r--r--sw/source/ui/misc/autocorr.src29
-rw-r--r--sw/source/ui/misc/bookmark.cxx303
-rw-r--r--sw/source/ui/misc/bookmark.hrc34
-rw-r--r--sw/source/ui/misc/bookmark.src118
-rw-r--r--sw/source/ui/misc/docfnote.cxx503
-rw-r--r--sw/source/ui/misc/docfnote.hrc60
-rw-r--r--sw/source/ui/misc/docfnote.src563
-rw-r--r--sw/source/ui/misc/glosbib.cxx579
-rw-r--r--sw/source/ui/misc/glosbib.hrc41
-rw-r--r--sw/source/ui/misc/glosbib.src183
-rw-r--r--sw/source/ui/misc/glosdoc.cxx806
-rw-r--r--sw/source/ui/misc/glossary.cxx1310
-rw-r--r--sw/source/ui/misc/glossary.hrc91
-rw-r--r--sw/source/ui/misc/glossary.src484
-rw-r--r--sw/source/ui/misc/glshell.cxx349
-rw-r--r--sw/source/ui/misc/impfnote.hxx120
-rw-r--r--sw/source/ui/misc/insfnote.cxx357
-rw-r--r--sw/source/ui/misc/insfnote.hrc45
-rw-r--r--sw/source/ui/misc/insfnote.src182
-rw-r--r--sw/source/ui/misc/insrule.cxx226
-rw-r--r--sw/source/ui/misc/insrule.hrc35
-rw-r--r--sw/source/ui/misc/insrule.src114
-rw-r--r--sw/source/ui/misc/linenum.cxx346
-rw-r--r--sw/source/ui/misc/linenum.hrc50
-rw-r--r--sw/source/ui/misc/linenum.src279
-rw-r--r--sw/source/ui/misc/num.cxx1176
-rw-r--r--sw/source/ui/misc/num.hrc55
-rw-r--r--sw/source/ui/misc/num.src374
-rw-r--r--sw/source/ui/misc/numberingtypelistbox.cxx177
-rw-r--r--sw/source/ui/misc/numberingtypelistbox.src98
-rw-r--r--sw/source/ui/misc/outline.cxx1348
-rw-r--r--sw/source/ui/misc/outline.hrc98
-rw-r--r--sw/source/ui/misc/outline.src383
-rw-r--r--sw/source/ui/misc/pgfnote.cxx373
-rw-r--r--sw/source/ui/misc/pgfnote.hrc44
-rw-r--r--sw/source/ui/misc/pgfnote.src200
-rw-r--r--sw/source/ui/misc/pggrid.cxx521
-rw-r--r--sw/source/ui/misc/pggrid.hrc52
-rw-r--r--sw/source/ui/misc/pggrid.src244
-rw-r--r--sw/source/ui/misc/redlndlg.cxx1405
-rw-r--r--sw/source/ui/misc/redlndlg.hrc38
-rw-r--r--sw/source/ui/misc/redlndlg.src148
-rw-r--r--sw/source/ui/misc/srtdlg.cxx532
-rw-r--r--sw/source/ui/misc/srtdlg.hrc65
-rw-r--r--sw/source/ui/misc/srtdlg.src407
-rw-r--r--sw/source/ui/misc/swmodalredlineacceptdlg.cxx147
-rw-r--r--sw/source/ui/ribbar/conarc.cxx161
-rw-r--r--sw/source/ui/ribbar/concustomshape.cxx252
-rw-r--r--sw/source/ui/ribbar/conform.cxx144
-rw-r--r--sw/source/ui/ribbar/conpoly.cxx163
-rw-r--r--sw/source/ui/ribbar/conrect.cxx229
-rw-r--r--sw/source/ui/ribbar/drawbase.cxx740
-rw-r--r--sw/source/ui/ribbar/dselect.cxx102
-rwxr-xr-xsw/source/ui/ribbar/inputwin.cxx678
-rw-r--r--sw/source/ui/ribbar/inputwin.hrc84
-rw-r--r--sw/source/ui/ribbar/inputwin.src345
-rw-r--r--sw/source/ui/ribbar/tblctrl.cxx93
-rw-r--r--sw/source/ui/ribbar/tblctrl.hrc35
-rw-r--r--sw/source/ui/ribbar/tbxanchr.cxx166
-rw-r--r--sw/source/ui/ribbar/tbxanchr.src107
-rw-r--r--sw/source/ui/ribbar/workctrl.cxx943
-rw-r--r--sw/source/ui/ribbar/workctrl.hrc88
-rw-r--r--sw/source/ui/ribbar/workctrl.src467
-rwxr-xr-xsw/source/ui/shells/annotsh.cxx1682
-rw-r--r--sw/source/ui/shells/basesh.cxx2934
-rw-r--r--sw/source/ui/shells/beziersh.cxx356
-rw-r--r--sw/source/ui/shells/drawdlg.cxx259
-rw-r--r--sw/source/ui/shells/drawsh.cxx497
-rw-r--r--sw/source/ui/shells/drformsh.cxx276
-rw-r--r--sw/source/ui/shells/drwbassh.cxx1000
-rw-r--r--sw/source/ui/shells/drwtxtex.cxx1012
-rw-r--r--sw/source/ui/shells/drwtxtsh.cxx912
-rw-r--r--sw/source/ui/shells/frmsh.cxx1155
-rw-r--r--sw/source/ui/shells/grfsh.cxx707
-rw-r--r--sw/source/ui/shells/grfshex.cxx150
-rwxr-xr-xsw/source/ui/shells/langhelper.cxx610
-rw-r--r--sw/source/ui/shells/listsh.cxx295
-rw-r--r--sw/source/ui/shells/mediash.cxx222
-rw-r--r--sw/source/ui/shells/olesh.cxx80
-rw-r--r--sw/source/ui/shells/shells.src305
-rw-r--r--sw/source/ui/shells/slotadd.cxx150
-rw-r--r--sw/source/ui/shells/tabsh.cxx1598
-rw-r--r--sw/source/ui/shells/textdrw.cxx143
-rw-r--r--sw/source/ui/shells/textfld.cxx894
-rw-r--r--sw/source/ui/shells/textglos.cxx145
-rw-r--r--sw/source/ui/shells/textidx.cxx261
-rwxr-xr-xsw/source/ui/shells/textsh.cxx1222
-rw-r--r--sw/source/ui/shells/textsh1.cxx1790
-rw-r--r--sw/source/ui/shells/textsh2.cxx312
-rw-r--r--sw/source/ui/shells/txtattr.cxx847
-rw-r--r--sw/source/ui/shells/txtcrsr.cxx370
-rw-r--r--sw/source/ui/shells/txtnum.cxx251
-rw-r--r--sw/source/ui/smartmenu/stmenu.cxx186
-rw-r--r--sw/source/ui/smartmenu/stmenu.hrc41
-rw-r--r--sw/source/ui/smartmenu/stmenu.src44
-rw-r--r--sw/source/ui/table/chartins.cxx285
-rw-r--r--sw/source/ui/table/chartins.hrc47
-rw-r--r--sw/source/ui/table/chartins.src130
-rw-r--r--sw/source/ui/table/colwd.cxx123
-rw-r--r--sw/source/ui/table/colwd.hrc36
-rw-r--r--sw/source/ui/table/colwd.src146
-rw-r--r--sw/source/ui/table/convert.cxx281
-rw-r--r--sw/source/ui/table/convert.hrc50
-rw-r--r--sw/source/ui/table/convert.src203
-rw-r--r--sw/source/ui/table/instable.cxx253
-rw-r--r--sw/source/ui/table/instable.hrc49
-rw-r--r--sw/source/ui/table/instable.src199
-rw-r--r--sw/source/ui/table/mergetbl.cxx66
-rw-r--r--sw/source/ui/table/mergetbl.hrc32
-rw-r--r--sw/source/ui/table/mergetbl.src118
-rw-r--r--sw/source/ui/table/rowht.cxx120
-rw-r--r--sw/source/ui/table/rowht.hrc34
-rw-r--r--sw/source/ui/table/rowht.src123
-rw-r--r--sw/source/ui/table/splittbl.cxx79
-rw-r--r--sw/source/ui/table/splittbl.hrc34
-rw-r--r--sw/source/ui/table/splittbl.src129
-rw-r--r--sw/source/ui/table/swtablerep.cxx241
-rw-r--r--sw/source/ui/table/table.src59
-rw-r--r--sw/source/ui/table/tabledlg.cxx2007
-rw-r--r--sw/source/ui/table/tabledlg.hrc111
-rw-r--r--sw/source/ui/table/tabledlg.src788
-rw-r--r--sw/source/ui/table/tablemgr.cxx382
-rw-r--r--sw/source/ui/table/tablepg.hxx238
-rw-r--r--sw/source/ui/table/tautofmt.cxx1057
-rw-r--r--sw/source/ui/table/tautofmt.hrc78
-rw-r--r--sw/source/ui/table/tautofmt.src307
-rw-r--r--sw/source/ui/uiview/formatclipboard.cxx617
-rw-r--r--sw/source/ui/uiview/pview.cxx2193
-rw-r--r--sw/source/ui/uiview/pview.hrc72
-rw-r--r--sw/source/ui/uiview/pview.src111
-rw-r--r--sw/source/ui/uiview/scroll.cxx160
-rw-r--r--sw/source/ui/uiview/srcview.cxx955
-rw-r--r--sw/source/ui/uiview/swcli.cxx187
-rw-r--r--sw/source/ui/uiview/uivwimp.cxx345
-rw-r--r--sw/source/ui/uiview/view.cxx1920
-rwxr-xr-xsw/source/ui/uiview/view.hrc90
-rw-r--r--sw/source/ui/uiview/view.src222
-rw-r--r--sw/source/ui/uiview/view0.cxx626
-rw-r--r--sw/source/ui/uiview/view1.cxx219
-rw-r--r--sw/source/ui/uiview/view2.cxx2456
-rw-r--r--sw/source/ui/uiview/viewcoll.cxx98
-rw-r--r--sw/source/ui/uiview/viewdlg.cxx98
-rw-r--r--sw/source/ui/uiview/viewdlg2.cxx241
-rw-r--r--sw/source/ui/uiview/viewdraw.cxx849
-rw-r--r--sw/source/ui/uiview/viewfunc.hxx66
-rwxr-xr-xsw/source/ui/uiview/viewling.cxx1005
-rw-r--r--sw/source/ui/uiview/viewmdi.cxx754
-rw-r--r--sw/source/ui/uiview/viewport.cxx1384
-rw-r--r--sw/source/ui/uiview/viewprt.cxx333
-rw-r--r--sw/source/ui/uiview/viewsrch.cxx808
-rw-r--r--sw/source/ui/uiview/viewstat.cxx523
-rw-r--r--sw/source/ui/uiview/viewtab.cxx1865
-rw-r--r--sw/source/ui/uno/RefreshListenerContainer.cxx58
-rw-r--r--sw/source/ui/uno/SwXDocumentSettings.cxx1076
-rw-r--r--sw/source/ui/uno/SwXDocumentSettings.hxx109
-rw-r--r--sw/source/ui/uno/SwXFilterOptions.cxx217
-rw-r--r--sw/source/ui/uno/detreg.cxx85
-rw-r--r--sw/source/ui/uno/dlelstnr.cxx204
-rw-r--r--sw/source/ui/uno/swdet2.cxx122
-rw-r--r--sw/source/ui/uno/swdetect.cxx488
-rw-r--r--sw/source/ui/uno/swdetect.hxx95
-rw-r--r--sw/source/ui/uno/unoatxt.cxx1308
-rw-r--r--sw/source/ui/uno/unodefaults.cxx72
-rw-r--r--sw/source/ui/uno/unodefaults.hxx48
-rw-r--r--sw/source/ui/uno/unodispatch.cxx448
-rw-r--r--sw/source/ui/uno/unodoc.cxx128
-rw-r--r--sw/source/ui/uno/unofreg.cxx383
-rw-r--r--sw/source/ui/uno/unomailmerge.cxx1253
-rw-r--r--sw/source/ui/uno/unomod.cxx1048
-rw-r--r--sw/source/ui/uno/unomodule.cxx172
-rw-r--r--sw/source/ui/uno/unomodule.hxx98
-rwxr-xr-xsw/source/ui/uno/unotxdoc.cxx4215
-rwxr-xr-xsw/source/ui/uno/unotxvw.cxx2207
-rw-r--r--sw/source/ui/utlui/attrdesc.cxx1350
-rw-r--r--sw/source/ui/utlui/attrdesc.hrc123
-rw-r--r--sw/source/ui/utlui/attrdesc.src384
-rw-r--r--sw/source/ui/utlui/bookctrl.cxx164
-rw-r--r--sw/source/ui/utlui/condedit.cxx108
-rw-r--r--sw/source/ui/utlui/content.cxx3250
-rw-r--r--sw/source/ui/utlui/glbltree.cxx1523
-rw-r--r--sw/source/ui/utlui/gloslst.cxx514
-rw-r--r--sw/source/ui/utlui/gloslst.hrc38
-rw-r--r--sw/source/ui/utlui/gloslst.src109
-rw-r--r--sw/source/ui/utlui/initui.cxx307
-rw-r--r--sw/source/ui/utlui/initui.hrc66
-rw-r--r--sw/source/ui/utlui/initui.src519
-rw-r--r--sw/source/ui/utlui/navicfg.cxx141
-rw-r--r--sw/source/ui/utlui/navipi.cxx1560
-rw-r--r--sw/source/ui/utlui/navipi.hrc90
-rw-r--r--sw/source/ui/utlui/navipi.src549
-rw-r--r--sw/source/ui/utlui/numfmtlb.cxx549
-rw-r--r--sw/source/ui/utlui/poolfmt.src766
-rw-r--r--sw/source/ui/utlui/prcntfld.cxx370
-rw-r--r--sw/source/ui/utlui/shdwcrsr.cxx135
-rw-r--r--sw/source/ui/utlui/swrenamexnameddlg.cxx143
-rw-r--r--sw/source/ui/utlui/textcontrolcombo.cxx113
-rw-r--r--sw/source/ui/utlui/tmplctrl.cxx174
-rw-r--r--sw/source/ui/utlui/uiitems.cxx324
-rw-r--r--sw/source/ui/utlui/uitool.cxx775
-rw-r--r--sw/source/ui/utlui/unotools.cxx522
-rw-r--r--sw/source/ui/utlui/unotools.hrc41
-rw-r--r--sw/source/ui/utlui/unotools.src131
-rw-r--r--sw/source/ui/utlui/utlui.src478
-rw-r--r--sw/source/ui/utlui/viewlayoutctrl.cxx209
-rw-r--r--sw/source/ui/utlui/zoomctrl.cxx99
-rw-r--r--sw/source/ui/vba/service.cxx80
-rw-r--r--sw/source/ui/vba/vbaaddin.cxx104
-rw-r--r--sw/source/ui/vba/vbaaddin.hxx59
-rw-r--r--sw/source/ui/vba/vbaaddins.cxx107
-rw-r--r--sw/source/ui/vba/vbaaddins.hxx52
-rw-r--r--sw/source/ui/vba/vbaapplication.cxx203
-rw-r--r--sw/source/ui/vba/vbaapplication.hxx74
-rw-r--r--sw/source/ui/vba/vbaautotextentry.cxx126
-rw-r--r--sw/source/ui/vba/vbaautotextentry.hxx80
-rw-r--r--sw/source/ui/vba/vbabookmark.cxx109
-rw-r--r--sw/source/ui/vba/vbabookmark.hxx65
-rw-r--r--sw/source/ui/vba/vbabookmarks.cxx236
-rw-r--r--sw/source/ui/vba/vbabookmarks.hxx75
-rw-r--r--sw/source/ui/vba/vbaborders.cxx378
-rw-r--r--sw/source/ui/vba/vbaborders.hxx63
-rw-r--r--sw/source/ui/vba/vbadialog.cxx78
-rw-r--r--sw/source/ui/vba/vbadialog.hxx50
-rw-r--r--sw/source/ui/vba/vbadialogs.cxx61
-rw-r--r--sw/source/ui/vba/vbadialogs.hxx53
-rw-r--r--sw/source/ui/vba/vbadocument.cxx381
-rw-r--r--sw/source/ui/vba/vbadocument.hxx80
-rw-r--r--sw/source/ui/vba/vbadocumentproperties.cxx764
-rw-r--r--sw/source/ui/vba/vbadocumentproperties.hxx67
-rw-r--r--sw/source/ui/vba/vbadocuments.cxx178
-rw-r--r--sw/source/ui/vba/vbadocuments.hxx61
-rwxr-xr-xsw/source/ui/vba/vbaeventshelper.cxx103
-rwxr-xr-xsw/source/ui/vba/vbaeventshelper.hxx53
-rw-r--r--sw/source/ui/vba/vbafield.cxx478
-rw-r--r--sw/source/ui/vba/vbafield.hxx77
-rw-r--r--sw/source/ui/vba/vbafind.cxx428
-rw-r--r--sw/source/ui/vba/vbafind.hxx103
-rw-r--r--sw/source/ui/vba/vbafont.cxx216
-rw-r--r--sw/source/ui/vba/vbafont.hxx31
-rw-r--r--sw/source/ui/vba/vbaglobals.cxx193
-rw-r--r--sw/source/ui/vba/vbaglobals.hxx80
-rw-r--r--sw/source/ui/vba/vbaheaderfooter.cxx111
-rw-r--r--sw/source/ui/vba/vbaheaderfooter.hxx60
-rw-r--r--sw/source/ui/vba/vbaheaderfooterhelper.cxx176
-rw-r--r--sw/source/ui/vba/vbaheaderfooterhelper.hxx51
-rw-r--r--sw/source/ui/vba/vbainformationhelper.cxx71
-rw-r--r--sw/source/ui/vba/vbainformationhelper.hxx43
-rw-r--r--sw/source/ui/vba/vbaoptions.cxx284
-rw-r--r--sw/source/ui/vba/vbaoptions.hxx87
-rw-r--r--sw/source/ui/vba/vbapagesetup.cxx272
-rw-r--r--sw/source/ui/vba/vbapagesetup.hxx67
-rw-r--r--sw/source/ui/vba/vbapalette.cxx75
-rw-r--r--sw/source/ui/vba/vbapalette.hxx15
-rw-r--r--sw/source/ui/vba/vbapane.cxx76
-rw-r--r--sw/source/ui/vba/vbapane.hxx54
-rw-r--r--sw/source/ui/vba/vbapanes.cxx124
-rw-r--r--sw/source/ui/vba/vbapanes.hxx57
-rw-r--r--sw/source/ui/vba/vbaparagraph.cxx174
-rw-r--r--sw/source/ui/vba/vbaparagraph.hxx81
-rw-r--r--sw/source/ui/vba/vbaparagraphformat.cxx573
-rw-r--r--sw/source/ui/vba/vbaparagraphformat.hxx95
-rw-r--r--sw/source/ui/vba/vbarange.cxx345
-rw-r--r--sw/source/ui/vba/vbarange.hxx92
-rw-r--r--sw/source/ui/vba/vbarangehelper.cxx171
-rw-r--r--sw/source/ui/vba/vbarangehelper.hxx43
-rw-r--r--sw/source/ui/vba/vbareplacement.cxx71
-rw-r--r--sw/source/ui/vba/vbareplacement.hxx54
-rw-r--r--sw/source/ui/vba/vbasection.cxx87
-rw-r--r--sw/source/ui/vba/vbasection.hxx59
-rw-r--r--sw/source/ui/vba/vbasections.cxx186
-rw-r--r--sw/source/ui/vba/vbasections.hxx59
-rw-r--r--sw/source/ui/vba/vbaselection.cxx679
-rw-r--r--sw/source/ui/vba/vbaselection.hxx105
-rw-r--r--sw/source/ui/vba/vbastyle.cxx149
-rw-r--r--sw/source/ui/vba/vbastyle.hxx67
-rw-r--r--sw/source/ui/vba/vbastyles.cxx377
-rw-r--r--sw/source/ui/vba/vbastyles.hxx51
-rw-r--r--sw/source/ui/vba/vbasystem.cxx187
-rw-r--r--sw/source/ui/vba/vbasystem.hxx71
-rw-r--r--sw/source/ui/vba/vbatable.cxx97
-rw-r--r--sw/source/ui/vba/vbatable.hxx28
-rw-r--r--sw/source/ui/vba/vbatables.cxx131
-rw-r--r--sw/source/ui/vba/vbatables.hxx28
-rw-r--r--sw/source/ui/vba/vbatemplate.cxx103
-rw-r--r--sw/source/ui/vba/vbatemplate.hxx52
-rw-r--r--sw/source/ui/vba/vbavariable.cxx105
-rw-r--r--sw/source/ui/vba/vbavariable.hxx59
-rw-r--r--sw/source/ui/vba/vbavariables.cxx102
-rw-r--r--sw/source/ui/vba/vbavariables.hxx61
-rw-r--r--sw/source/ui/vba/vbaview.cxx422
-rw-r--r--sw/source/ui/vba/vbaview.hxx68
-rw-r--r--sw/source/ui/vba/vbawindow.cxx108
-rw-r--r--sw/source/ui/vba/vbawindow.hxx57
-rw-r--r--sw/source/ui/vba/vbawrapformat.cxx252
-rw-r--r--sw/source/ui/vba/vbawrapformat.hxx69
-rw-r--r--sw/source/ui/vba/wordvbahelper.cxx94
-rw-r--r--sw/source/ui/vba/wordvbahelper.hxx54
-rw-r--r--sw/source/ui/web/wdocsh.cxx114
-rw-r--r--sw/source/ui/web/web.src83
-rw-r--r--sw/source/ui/web/wformsh.cxx71
-rw-r--r--sw/source/ui/web/wfrmsh.cxx95
-rw-r--r--sw/source/ui/web/wgrfsh.cxx74
-rw-r--r--sw/source/ui/web/wlistsh.cxx67
-rw-r--r--sw/source/ui/web/wolesh.cxx68
-rw-r--r--sw/source/ui/web/wtabsh.cxx76
-rw-r--r--sw/source/ui/web/wtextsh.cxx99
-rw-r--r--sw/source/ui/web/wview.cxx330
-rw-r--r--sw/source/ui/wrtsh/delete.cxx570
-rw-r--r--sw/source/ui/wrtsh/move.cxx691
-rw-r--r--sw/source/ui/wrtsh/select.cxx1072
-rw-r--r--sw/source/ui/wrtsh/wrtsh.hrc48
-rw-r--r--sw/source/ui/wrtsh/wrtsh.src52
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx1912
-rw-r--r--sw/source/ui/wrtsh/wrtsh2.cxx498
-rw-r--r--sw/source/ui/wrtsh/wrtsh3.cxx247
-rw-r--r--sw/source/ui/wrtsh/wrtsh4.cxx300
-rw-r--r--sw/source/ui/wrtsh/wrtundo.cxx179
-rw-r--r--sw/uiconfig/layout/delzip1
-rw-r--r--sw/uiconfig/layout/layout.mk33
-rw-r--r--sw/uiconfig/layout/wordcount.xml50
-rwxr-xr-xsw/uiconfig/sglobal/menubar/menubar.xml459
-rw-r--r--sw/uiconfig/sglobal/statusbar/statusbar.xml15
-rw-r--r--sw/uiconfig/sglobal/toolbar/alignmentbar.xml11
-rw-r--r--sw/uiconfig/sglobal/toolbar/arrowshapes.xml34
-rw-r--r--sw/uiconfig/sglobal/toolbar/basicshapes.xml29
-rw-r--r--sw/uiconfig/sglobal/toolbar/bezierobjectbar.xml20
-rw-r--r--sw/uiconfig/sglobal/toolbar/calloutshapes.xml11
-rw-r--r--sw/uiconfig/sglobal/toolbar/colorbar.xml15
-rw-r--r--sw/uiconfig/sglobal/toolbar/drawbar.xml34
-rw-r--r--sw/uiconfig/sglobal/toolbar/drawingobjectbar.xml40
-rw-r--r--sw/uiconfig/sglobal/toolbar/drawtextobjectbar.xml34
-rw-r--r--sw/uiconfig/sglobal/toolbar/extrusionobjectbar.xml16
-rw-r--r--sw/uiconfig/sglobal/toolbar/findbar.xml8
-rw-r--r--sw/uiconfig/sglobal/toolbar/flowchartshapes.xml36
-rw-r--r--sw/uiconfig/sglobal/toolbar/fontworkobjectbar.xml11
-rw-r--r--sw/uiconfig/sglobal/toolbar/fontworkshapetype.xml38
-rw-r--r--sw/uiconfig/sglobal/toolbar/formcontrols.xml26
-rw-r--r--sw/uiconfig/sglobal/toolbar/formdesign.xml31
-rw-r--r--sw/uiconfig/sglobal/toolbar/formsfilterbar.xml8
-rw-r--r--sw/uiconfig/sglobal/toolbar/formsnavigationbar.xml32
-rw-r--r--sw/uiconfig/sglobal/toolbar/formtextobjectbar.xml28
-rw-r--r--sw/uiconfig/sglobal/toolbar/frameobjectbar.xml34
-rw-r--r--sw/uiconfig/sglobal/toolbar/fullscreenbar.xml5
-rw-r--r--sw/uiconfig/sglobal/toolbar/graffilterbar.xml17
-rw-r--r--sw/uiconfig/sglobal/toolbar/graphicobjectbar.xml18
-rw-r--r--sw/uiconfig/sglobal/toolbar/insertbar.xml30
-rw-r--r--sw/uiconfig/sglobal/toolbar/insertobjectbar.xml7
-rw-r--r--sw/uiconfig/sglobal/toolbar/mediaobjectbar.xml7
-rw-r--r--sw/uiconfig/sglobal/toolbar/moreformcontrols.xml23
-rw-r--r--sw/uiconfig/sglobal/toolbar/numobjectbar.xml23
-rw-r--r--sw/uiconfig/sglobal/toolbar/oleobjectbar.xml30
-rw-r--r--sw/uiconfig/sglobal/toolbar/optimizetablebar.xml8
-rw-r--r--sw/uiconfig/sglobal/toolbar/previewobjectbar.xml24
-rw-r--r--sw/uiconfig/sglobal/toolbar/standardbar.xml42
-rw-r--r--sw/uiconfig/sglobal/toolbar/starshapes.xml17
-rw-r--r--sw/uiconfig/sglobal/toolbar/symbolshapes.xml24
-rw-r--r--sw/uiconfig/sglobal/toolbar/tableobjectbar.xml35
-rw-r--r--sw/uiconfig/sglobal/toolbar/textobjectbar.xml44
-rw-r--r--sw/uiconfig/sglobal/toolbar/toolbar.xml13
-rw-r--r--sw/uiconfig/sglobal/toolbar/viewerbar.xml18
-rwxr-xr-xsw/uiconfig/sweb/menubar/menubar.xml388
-rw-r--r--sw/uiconfig/sweb/statusbar/statusbar.xml14
-rw-r--r--sw/uiconfig/sweb/toolbar/arrowshapes.xml34
-rw-r--r--sw/uiconfig/sweb/toolbar/basicshapes.xml29
-rw-r--r--sw/uiconfig/sweb/toolbar/bezierobjectbar.xml20
-rw-r--r--sw/uiconfig/sweb/toolbar/calloutshapes.xml11
-rw-r--r--sw/uiconfig/sweb/toolbar/colorbar.xml17
-rw-r--r--sw/uiconfig/sweb/toolbar/drawingobjectbar.xml39
-rw-r--r--sw/uiconfig/sweb/toolbar/drawtextobjectbar.xml34
-rw-r--r--sw/uiconfig/sweb/toolbar/extrusionobjectbar.xml16
-rw-r--r--sw/uiconfig/sweb/toolbar/findbar.xml8
-rw-r--r--sw/uiconfig/sweb/toolbar/flowchartshapes.xml36
-rw-r--r--sw/uiconfig/sweb/toolbar/fontworkobjectbar.xml11
-rw-r--r--sw/uiconfig/sweb/toolbar/fontworkshapetype.xml38
-rw-r--r--sw/uiconfig/sweb/toolbar/formcontrols.xml25
-rw-r--r--sw/uiconfig/sweb/toolbar/formdesign.xml31
-rw-r--r--sw/uiconfig/sweb/toolbar/formsfilterbar.xml8
-rw-r--r--sw/uiconfig/sweb/toolbar/formsnavigationbar.xml32
-rw-r--r--sw/uiconfig/sweb/toolbar/formtextobjectbar.xml28
-rw-r--r--sw/uiconfig/sweb/toolbar/frameobjectbar.xml34
-rw-r--r--sw/uiconfig/sweb/toolbar/fullscreenbar.xml5
-rw-r--r--sw/uiconfig/sweb/toolbar/graffilterbar.xml17
-rw-r--r--sw/uiconfig/sweb/toolbar/graphicobjectbar.xml26
-rw-r--r--sw/uiconfig/sweb/toolbar/insertbar.xml25
-rw-r--r--sw/uiconfig/sweb/toolbar/mediaobjectbar.xml7
-rw-r--r--sw/uiconfig/sweb/toolbar/numobjectbar.xml23
-rw-r--r--sw/uiconfig/sweb/toolbar/oleobjectbar.xml30
-rw-r--r--sw/uiconfig/sweb/toolbar/optimizetablebar.xml8
-rw-r--r--sw/uiconfig/sweb/toolbar/previewobjectbar.xml24
-rw-r--r--sw/uiconfig/sweb/toolbar/standardbar.xml45
-rw-r--r--sw/uiconfig/sweb/toolbar/starshapes.xml17
-rw-r--r--sw/uiconfig/sweb/toolbar/symbolshapes.xml24
-rw-r--r--sw/uiconfig/sweb/toolbar/tableobjectbar.xml35
-rw-r--r--sw/uiconfig/sweb/toolbar/textobjectbar.xml44
-rw-r--r--sw/uiconfig/sweb/toolbar/toolbar.xml11
-rw-r--r--sw/uiconfig/sweb/toolbar/viewerbar.xml18
-rwxr-xr-xsw/uiconfig/swform/menubar/menubar.xml454
-rw-r--r--sw/uiconfig/swform/statusbar/statusbar.xml14
-rw-r--r--sw/uiconfig/swform/toolbar/alignmentbar.xml11
-rw-r--r--sw/uiconfig/swform/toolbar/arrowshapes.xml34
-rw-r--r--sw/uiconfig/swform/toolbar/basicshapes.xml29
-rw-r--r--sw/uiconfig/swform/toolbar/bezierobjectbar.xml20
-rw-r--r--sw/uiconfig/swform/toolbar/calloutshapes.xml11
-rw-r--r--sw/uiconfig/swform/toolbar/colorbar.xml15
-rw-r--r--sw/uiconfig/swform/toolbar/drawbar.xml34
-rw-r--r--sw/uiconfig/swform/toolbar/drawingobjectbar.xml40
-rw-r--r--sw/uiconfig/swform/toolbar/drawtextobjectbar.xml34
-rw-r--r--sw/uiconfig/swform/toolbar/extrusionobjectbar.xml16
-rw-r--r--sw/uiconfig/swform/toolbar/flowchartshapes.xml36
-rw-r--r--sw/uiconfig/swform/toolbar/fontworkobjectbar.xml11
-rw-r--r--sw/uiconfig/swform/toolbar/fontworkshapetype.xml38
-rw-r--r--sw/uiconfig/swform/toolbar/formcontrols.xml26
-rw-r--r--sw/uiconfig/swform/toolbar/formdesign.xml33
-rw-r--r--sw/uiconfig/swform/toolbar/formsfilterbar.xml8
-rw-r--r--sw/uiconfig/swform/toolbar/formsnavigationbar.xml33
-rw-r--r--sw/uiconfig/swform/toolbar/formtextobjectbar.xml28
-rw-r--r--sw/uiconfig/swform/toolbar/frameobjectbar.xml34
-rw-r--r--sw/uiconfig/swform/toolbar/fullscreenbar.xml5
-rw-r--r--sw/uiconfig/swform/toolbar/graffilterbar.xml17
-rw-r--r--sw/uiconfig/swform/toolbar/graphicobjectbar.xml18
-rw-r--r--sw/uiconfig/swform/toolbar/insertbar.xml29
-rw-r--r--sw/uiconfig/swform/toolbar/insertobjectbar.xml7
-rw-r--r--sw/uiconfig/swform/toolbar/mediaobjectbar.xml7
-rw-r--r--sw/uiconfig/swform/toolbar/moreformcontrols.xml23
-rw-r--r--sw/uiconfig/swform/toolbar/numobjectbar.xml23
-rw-r--r--sw/uiconfig/swform/toolbar/oleobjectbar.xml30
-rw-r--r--sw/uiconfig/swform/toolbar/optimizetablebar.xml8
-rw-r--r--sw/uiconfig/swform/toolbar/previewobjectbar.xml24
-rw-r--r--sw/uiconfig/swform/toolbar/standardbar.xml42
-rw-r--r--sw/uiconfig/swform/toolbar/starshapes.xml17
-rw-r--r--sw/uiconfig/swform/toolbar/symbolshapes.xml24
-rw-r--r--sw/uiconfig/swform/toolbar/tableobjectbar.xml35
-rw-r--r--sw/uiconfig/swform/toolbar/textobjectbar.xml44
-rw-r--r--sw/uiconfig/swform/toolbar/toolbar.xml13
-rw-r--r--sw/uiconfig/swform/toolbar/viewerbar.xml18
-rwxr-xr-xsw/uiconfig/swreport/menubar/menubar.xml454
-rw-r--r--sw/uiconfig/swreport/statusbar/statusbar.xml14
-rw-r--r--sw/uiconfig/swreport/toolbar/alignmentbar.xml11
-rw-r--r--sw/uiconfig/swreport/toolbar/arrowshapes.xml34
-rw-r--r--sw/uiconfig/swreport/toolbar/basicshapes.xml29
-rw-r--r--sw/uiconfig/swreport/toolbar/bezierobjectbar.xml20
-rw-r--r--sw/uiconfig/swreport/toolbar/calloutshapes.xml11
-rw-r--r--sw/uiconfig/swreport/toolbar/colorbar.xml15
-rw-r--r--sw/uiconfig/swreport/toolbar/drawbar.xml34
-rw-r--r--sw/uiconfig/swreport/toolbar/drawingobjectbar.xml40
-rw-r--r--sw/uiconfig/swreport/toolbar/drawtextobjectbar.xml34
-rw-r--r--sw/uiconfig/swreport/toolbar/extrusionobjectbar.xml16
-rw-r--r--sw/uiconfig/swreport/toolbar/flowchartshapes.xml36
-rw-r--r--sw/uiconfig/swreport/toolbar/fontworkobjectbar.xml11
-rw-r--r--sw/uiconfig/swreport/toolbar/fontworkshapetype.xml38
-rw-r--r--sw/uiconfig/swreport/toolbar/formcontrols.xml26
-rw-r--r--sw/uiconfig/swreport/toolbar/formdesign.xml34
-rw-r--r--sw/uiconfig/swreport/toolbar/formsfilterbar.xml8
-rw-r--r--sw/uiconfig/swreport/toolbar/formsnavigationbar.xml32
-rw-r--r--sw/uiconfig/swreport/toolbar/formtextobjectbar.xml28
-rw-r--r--sw/uiconfig/swreport/toolbar/frameobjectbar.xml34
-rw-r--r--sw/uiconfig/swreport/toolbar/fullscreenbar.xml5
-rw-r--r--sw/uiconfig/swreport/toolbar/graffilterbar.xml17
-rw-r--r--sw/uiconfig/swreport/toolbar/graphicobjectbar.xml18
-rw-r--r--sw/uiconfig/swreport/toolbar/insertbar.xml29
-rw-r--r--sw/uiconfig/swreport/toolbar/insertobjectbar.xml7
-rw-r--r--sw/uiconfig/swreport/toolbar/mediaobjectbar.xml7
-rw-r--r--sw/uiconfig/swreport/toolbar/moreformcontrols.xml23
-rw-r--r--sw/uiconfig/swreport/toolbar/numobjectbar.xml23
-rw-r--r--sw/uiconfig/swreport/toolbar/oleobjectbar.xml30
-rw-r--r--sw/uiconfig/swreport/toolbar/optimizetablebar.xml8
-rw-r--r--sw/uiconfig/swreport/toolbar/previewobjectbar.xml24
-rw-r--r--sw/uiconfig/swreport/toolbar/standardbar.xml42
-rw-r--r--sw/uiconfig/swreport/toolbar/starshapes.xml17
-rw-r--r--sw/uiconfig/swreport/toolbar/symbolshapes.xml24
-rw-r--r--sw/uiconfig/swreport/toolbar/tableobjectbar.xml35
-rw-r--r--sw/uiconfig/swreport/toolbar/textobjectbar.xml44
-rw-r--r--sw/uiconfig/swreport/toolbar/toolbar.xml13
-rw-r--r--sw/uiconfig/swreport/toolbar/viewerbar.xml18
-rwxr-xr-xsw/uiconfig/swriter/menubar/menubar.xml462
-rw-r--r--sw/uiconfig/swriter/statusbar/statusbar.xml15
-rw-r--r--sw/uiconfig/swriter/toolbar/alignmentbar.xml11
-rw-r--r--sw/uiconfig/swriter/toolbar/arrowshapes.xml34
-rw-r--r--sw/uiconfig/swriter/toolbar/basicshapes.xml29
-rw-r--r--sw/uiconfig/swriter/toolbar/bezierobjectbar.xml20
-rw-r--r--sw/uiconfig/swriter/toolbar/calloutshapes.xml11
-rw-r--r--sw/uiconfig/swriter/toolbar/colorbar.xml15
-rw-r--r--sw/uiconfig/swriter/toolbar/drawbar.xml34
-rw-r--r--sw/uiconfig/swriter/toolbar/drawingobjectbar.xml40
-rw-r--r--sw/uiconfig/swriter/toolbar/drawtextobjectbar.xml34
-rw-r--r--sw/uiconfig/swriter/toolbar/extrusionobjectbar.xml16
-rw-r--r--sw/uiconfig/swriter/toolbar/findbar.xml8
-rw-r--r--sw/uiconfig/swriter/toolbar/flowchartshapes.xml36
-rw-r--r--sw/uiconfig/swriter/toolbar/fontworkobjectbar.xml11
-rw-r--r--sw/uiconfig/swriter/toolbar/fontworkshapetype.xml38
-rw-r--r--sw/uiconfig/swriter/toolbar/formcontrols.xml26
-rw-r--r--sw/uiconfig/swriter/toolbar/formdesign.xml33
-rw-r--r--sw/uiconfig/swriter/toolbar/formsfilterbar.xml8
-rw-r--r--sw/uiconfig/swriter/toolbar/formsnavigationbar.xml33
-rw-r--r--sw/uiconfig/swriter/toolbar/formtextobjectbar.xml28
-rw-r--r--sw/uiconfig/swriter/toolbar/frameobjectbar.xml34
-rw-r--r--sw/uiconfig/swriter/toolbar/fullscreenbar.xml5
-rw-r--r--sw/uiconfig/swriter/toolbar/graffilterbar.xml17
-rw-r--r--sw/uiconfig/swriter/toolbar/graphicobjectbar.xml18
-rw-r--r--sw/uiconfig/swriter/toolbar/insertbar.xml31
-rw-r--r--sw/uiconfig/swriter/toolbar/mediaobjectbar.xml7
-rw-r--r--sw/uiconfig/swriter/toolbar/moreformcontrols.xml23
-rw-r--r--sw/uiconfig/swriter/toolbar/numobjectbar.xml23
-rw-r--r--sw/uiconfig/swriter/toolbar/oleobjectbar.xml30
-rw-r--r--sw/uiconfig/swriter/toolbar/optimizetablebar.xml8
-rw-r--r--sw/uiconfig/swriter/toolbar/previewobjectbar.xml24
-rw-r--r--sw/uiconfig/swriter/toolbar/standardbar.xml42
-rw-r--r--sw/uiconfig/swriter/toolbar/starshapes.xml17
-rw-r--r--sw/uiconfig/swriter/toolbar/symbolshapes.xml24
-rw-r--r--sw/uiconfig/swriter/toolbar/tableobjectbar.xml35
-rw-r--r--sw/uiconfig/swriter/toolbar/textobjectbar.xml44
-rw-r--r--sw/uiconfig/swriter/toolbar/toolbar.xml13
-rw-r--r--sw/uiconfig/swriter/toolbar/viewerbar.xml18
-rwxr-xr-xsw/uiconfig/swxform/menubar/menubar.xml455
-rw-r--r--sw/uiconfig/swxform/statusbar/statusbar.xml15
-rw-r--r--sw/uiconfig/swxform/toolbar/alignmentbar.xml11
-rw-r--r--sw/uiconfig/swxform/toolbar/arrowshapes.xml34
-rw-r--r--sw/uiconfig/swxform/toolbar/basicshapes.xml29
-rw-r--r--sw/uiconfig/swxform/toolbar/bezierobjectbar.xml20
-rw-r--r--sw/uiconfig/swxform/toolbar/calloutshapes.xml11
-rw-r--r--sw/uiconfig/swxform/toolbar/colorbar.xml15
-rw-r--r--sw/uiconfig/swxform/toolbar/drawbar.xml34
-rw-r--r--sw/uiconfig/swxform/toolbar/drawingobjectbar.xml40
-rw-r--r--sw/uiconfig/swxform/toolbar/drawtextobjectbar.xml34
-rw-r--r--sw/uiconfig/swxform/toolbar/extrusionobjectbar.xml16
-rw-r--r--sw/uiconfig/swxform/toolbar/findbar.xml8
-rw-r--r--sw/uiconfig/swxform/toolbar/flowchartshapes.xml36
-rw-r--r--sw/uiconfig/swxform/toolbar/fontworkobjectbar.xml11
-rw-r--r--sw/uiconfig/swxform/toolbar/fontworkshapetype.xml38
-rw-r--r--sw/uiconfig/swxform/toolbar/formcontrols.xml23
-rw-r--r--sw/uiconfig/swxform/toolbar/formdesign.xml33
-rw-r--r--sw/uiconfig/swxform/toolbar/formsfilterbar.xml8
-rw-r--r--sw/uiconfig/swxform/toolbar/formsnavigationbar.xml33
-rw-r--r--sw/uiconfig/swxform/toolbar/formtextobjectbar.xml28
-rw-r--r--sw/uiconfig/swxform/toolbar/frameobjectbar.xml34
-rw-r--r--sw/uiconfig/swxform/toolbar/fullscreenbar.xml5
-rw-r--r--sw/uiconfig/swxform/toolbar/graffilterbar.xml17
-rw-r--r--sw/uiconfig/swxform/toolbar/graphicobjectbar.xml18
-rw-r--r--sw/uiconfig/swxform/toolbar/insertbar.xml29
-rw-r--r--sw/uiconfig/swxform/toolbar/insertobjectbar.xml7
-rw-r--r--sw/uiconfig/swxform/toolbar/mediaobjectbar.xml7
-rw-r--r--sw/uiconfig/swxform/toolbar/moreformcontrols.xml12
-rw-r--r--sw/uiconfig/swxform/toolbar/numobjectbar.xml23
-rw-r--r--sw/uiconfig/swxform/toolbar/oleobjectbar.xml30
-rw-r--r--sw/uiconfig/swxform/toolbar/optimizetablebar.xml8
-rw-r--r--sw/uiconfig/swxform/toolbar/previewobjectbar.xml24
-rw-r--r--sw/uiconfig/swxform/toolbar/standardbar.xml42
-rw-r--r--sw/uiconfig/swxform/toolbar/starshapes.xml17
-rw-r--r--sw/uiconfig/swxform/toolbar/symbolshapes.xml24
-rw-r--r--sw/uiconfig/swxform/toolbar/tableobjectbar.xml35
-rw-r--r--sw/uiconfig/swxform/toolbar/textobjectbar.xml44
-rw-r--r--sw/uiconfig/swxform/toolbar/toolbar.xml13
-rw-r--r--sw/uiconfig/swxform/toolbar/viewerbar.xml18
-rw-r--r--sw/util/hidother.hrc31
-rw-r--r--sw/util/hidother.src374
-rw-r--r--sw/util/msword.component37
-rw-r--r--sw/util/sw.component104
-rw-r--r--sw/util/swd.component36
-rw-r--r--sw/util/vbaswobj.component43
-rw-r--r--sw/xml/writer.xml1244
2223 files changed, 968507 insertions, 0 deletions
diff --git a/sw/AllLangResTarget_sw.mk b/sw/AllLangResTarget_sw.mk
new file mode 100644
index 000000000000..271e7577e6c7
--- /dev/null
+++ b/sw/AllLangResTarget_sw.mk
@@ -0,0 +1,185 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_AllLangResTarget_AllLangResTarget,sw))
+
+$(eval $(call gb_AllLangResTarget_add_srs,sw,\
+ sw/res \
+))
+
+$(eval $(call gb_SrsTarget_SrsTarget,sw/res))
+
+$(eval $(call gb_SrsTarget_set_include,sw/res,\
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+ -I$(WORKDIR)/inc/sw \
+ -I$(SRCDIR)/sw/inc \
+ -I$(SRCDIR)/sw/source/core/undo \
+ -I$(SRCDIR)/sw/source/core/unocore \
+ -I$(SRCDIR)/sw/source/ui/chrdlg \
+ -I$(SRCDIR)/sw/source/ui/config \
+ -I$(SRCDIR)/sw/source/ui/dbui \
+ -I$(SRCDIR)/sw/source/ui/dialog \
+ -I$(SRCDIR)/sw/source/ui/docvw \
+ -I$(SRCDIR)/sw/source/ui/envelp \
+ -I$(SRCDIR)/sw/source/ui/fldui \
+ -I$(SRCDIR)/sw/source/ui/fmtui \
+ -I$(SRCDIR)/sw/source/ui/frmdlg \
+ -I$(SRCDIR)/sw/source/ui/globdoc \
+ -I$(SRCDIR)/sw/source/ui/inc \
+ -I$(SRCDIR)/sw/source/ui/index \
+ -I$(SRCDIR)/sw/source/ui/lingu \
+ -I$(SRCDIR)/sw/source/ui/misc \
+ -I$(SRCDIR)/sw/source/ui/ribbar \
+ -I$(SRCDIR)/sw/source/ui/shells \
+ -I$(SRCDIR)/sw/source/ui/smartmenu \
+ -I$(SRCDIR)/sw/source/ui/table \
+ -I$(SRCDIR)/sw/source/ui/uiview \
+ -I$(SRCDIR)/sw/source/ui/utlui \
+ -I$(SRCDIR)/sw/source/ui/web \
+ -I$(SRCDIR)/sw/source/ui/wrtsh \
+))
+
+$(eval $(call gb_SrsTarget_add_files,sw/res,\
+ sw/source/core/undo/undo.src \
+ sw/source/core/unocore/unocore.src \
+ sw/source/ui/app/app.src \
+ sw/source/ui/app/error.src \
+ sw/source/ui/app/mn.src \
+ sw/source/ui/chrdlg/ccoll.src \
+ sw/source/ui/chrdlg/chardlg.src \
+ sw/source/ui/chrdlg/chrdlg.src \
+ sw/source/ui/chrdlg/drpcps.src \
+ sw/source/ui/chrdlg/numpara.src \
+ sw/source/ui/chrdlg/paradlg.src \
+ sw/source/ui/chrdlg/swbreak.src \
+ sw/source/ui/config/mailconfigpage.src \
+ sw/source/ui/config/optcomp.src \
+ sw/source/ui/config/optdlg.src \
+ sw/source/ui/config/optload.src \
+ sw/source/ui/config/redlopt.src \
+ sw/source/ui/dbui/addresslistdialog.src \
+ sw/source/ui/dbui/createaddresslistdialog.src \
+ sw/source/ui/dbui/customizeaddresslistdialog.src \
+ sw/source/ui/dbui/dbinsdlg.src \
+ sw/source/ui/dbui/dbtablepreviewdialog.src \
+ sw/source/ui/dbui/dbui.src \
+ sw/source/ui/dbui/mailmergechildwindow.src \
+ sw/source/ui/dbui/mailmergewizard.src \
+ sw/source/ui/dbui/mmaddressblockpage.src \
+ sw/source/ui/dbui/mmdocselectpage.src \
+ sw/source/ui/dbui/mmgreetingspage.src \
+ sw/source/ui/dbui/mmlayoutpage.src \
+ sw/source/ui/dbui/mmmergepage.src \
+ sw/source/ui/dbui/mmoutputpage.src \
+ sw/source/ui/dbui/mmoutputtypepage.src \
+ sw/source/ui/dbui/mmpreparemergepage.src \
+ sw/source/ui/dbui/selectdbtabledialog.src \
+ sw/source/ui/dialog/abstract.src \
+ sw/source/ui/dialog/ascfldlg.src \
+ sw/source/ui/dialog/dialog.src \
+ sw/source/ui/dialog/docstdlg.src \
+ sw/source/ui/dialog/regionsw.src \
+ sw/source/ui/dialog/wordcountdialog.src \
+ sw/source/ui/dochdl/dochdl.src \
+ sw/source/ui/dochdl/selglos.src \
+ sw/source/ui/docvw/annotation.src \
+ sw/source/ui/docvw/access.src \
+ sw/source/ui/docvw/docvw.src \
+ sw/source/ui/envelp/envelp.src \
+ sw/source/ui/envelp/envfmt.src \
+ sw/source/ui/envelp/envlop.src \
+ sw/source/ui/envelp/envprt.src \
+ sw/source/ui/envelp/label.src \
+ sw/source/ui/envelp/labfmt.src \
+ sw/source/ui/envelp/labprt.src \
+ sw/source/ui/envelp/mailmrge.src \
+ sw/source/ui/fldui/DropDownFieldDialog.src \
+ sw/source/ui/fldui/changedb.src \
+ sw/source/ui/fldui/flddb.src \
+ sw/source/ui/fldui/flddinf.src \
+ sw/source/ui/fldui/flddok.src \
+ sw/source/ui/fldui/fldfunc.src \
+ sw/source/ui/fldui/fldref.src \
+ sw/source/ui/fldui/fldtdlg.src \
+ sw/source/ui/fldui/fldui.src \
+ sw/source/ui/fldui/fldvar.src \
+ sw/source/ui/fldui/inpdlg.src \
+ sw/source/ui/fldui/javaedit.src \
+ sw/source/ui/fmtui/tmpdlg.src \
+ sw/source/ui/frmdlg/column.src \
+ sw/source/ui/frmdlg/cption.src \
+ sw/source/ui/frmdlg/frmpage.src \
+ sw/source/ui/frmdlg/frmui.src \
+ sw/source/ui/frmdlg/wrap.src \
+ sw/source/ui/globdoc/globdoc.src \
+ sw/source/ui/index/cnttab.src \
+ sw/source/ui/index/idxmrk.src \
+ sw/source/ui/index/multmrk.src \
+ sw/source/ui/lingu/olmenu.src \
+ sw/source/ui/misc/autocorr.src \
+ sw/source/ui/misc/bookmark.src \
+ sw/source/ui/misc/docfnote.src \
+ sw/source/ui/misc/glosbib.src \
+ sw/source/ui/misc/glossary.src \
+ sw/source/ui/misc/insfnote.src \
+ sw/source/ui/misc/insrule.src \
+ sw/source/ui/misc/linenum.src \
+ sw/source/ui/misc/num.src \
+ sw/source/ui/misc/numberingtypelistbox.src \
+ sw/source/ui/misc/outline.src \
+ sw/source/ui/misc/pgfnote.src \
+ sw/source/ui/misc/pggrid.src \
+ sw/source/ui/misc/redlndlg.src \
+ sw/source/ui/misc/srtdlg.src \
+ sw/source/ui/ribbar/inputwin.src \
+ sw/source/ui/ribbar/tbxanchr.src \
+ sw/source/ui/ribbar/workctrl.src \
+ sw/source/ui/shells/shells.src \
+ sw/source/ui/smartmenu/stmenu.src \
+ sw/source/ui/table/chartins.src \
+ sw/source/ui/table/colwd.src \
+ sw/source/ui/table/convert.src \
+ sw/source/ui/table/instable.src \
+ sw/source/ui/table/mergetbl.src \
+ sw/source/ui/table/rowht.src \
+ sw/source/ui/table/splittbl.src \
+ sw/source/ui/table/table.src \
+ sw/source/ui/table/tabledlg.src \
+ sw/source/ui/table/tautofmt.src \
+ sw/source/ui/uiview/pview.src \
+ sw/source/ui/uiview/view.src \
+ sw/source/ui/utlui/attrdesc.src \
+ sw/source/ui/utlui/gloslst.src \
+ sw/source/ui/utlui/initui.src \
+ sw/source/ui/utlui/navipi.src \
+ sw/source/ui/utlui/poolfmt.src \
+ sw/source/ui/utlui/unotools.src \
+ sw/source/ui/utlui/utlui.src \
+ sw/source/ui/web/web.src \
+ sw/source/ui/wrtsh/wrtsh.src \
+))
diff --git a/sw/JunitTest_sw_complex.mk b/sw/JunitTest_sw_complex.mk
new file mode 100755
index 000000000000..df81b22f712d
--- /dev/null
+++ b/sw/JunitTest_sw_complex.mk
@@ -0,0 +1,70 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_JunitTest_JunitTest,sw_complex))
+
+$(eval $(call gb_JunitTest_set_defs,sw_complex,\
+ $$(DEFS) \
+ -Dorg.openoffice.test.arg.tdoc=$(SRCDIR)/sw/qa/complex/writer/testdocuments \
+))
+
+$(eval $(call gb_JunitTest_add_sourcefiles,sw_complex,\
+ sw/qa/complex/checkColor/CheckChangeColor \
+ sw/qa/complex/indeterminateState/CheckIndeterminateState \
+ sw/qa/complex/writer/CheckCrossReferences \
+ sw/qa/complex/writer/LoadSaveTest \
+ sw/qa/complex/writer/CheckNamedPropertyValues \
+ sw/qa/complex/writer/CheckIndexedPropertyValues \
+ sw/qa/complex/writer/TestDocument \
+ sw/qa/complex/writer/CheckBookmarks \
+ sw/qa/complex/writer/CheckFlies \
+ sw/qa/complex/writer/TextPortionEnumerationTest \
+ sw/qa/complex/accessibility/AccessibleRelationSet \
+))
+
+$(eval $(call gb_JunitTest_add_jars,sw_complex,\
+ $(OUTDIR)/bin/OOoRunner.jar \
+ $(OUTDIR)/bin/ridl.jar \
+ $(OUTDIR)/bin/test.jar \
+ $(OUTDIR)/bin/unoil.jar \
+ $(OUTDIR)/bin/jurt.jar \
+))
+
+$(eval $(call gb_JunitTest_add_classes,sw_complex,\
+ complex.accessibility.AccessibleRelationSet \
+ complex.checkColor.CheckChangeColor \
+ complex.writer.CheckCrossReferences \
+ complex.writer.CheckFlies \
+ complex.writer.CheckIndexedPropertyValues \
+ complex.writer.CheckNamedPropertyValues \
+ complex.writer.TextPortionEnumerationTest \
+))
+
+# currently fails (should run again in os146) (except on windows)
+# complex.writer.CheckBookmarks \
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/JunitTest_sw_unoapi.mk b/sw/JunitTest_sw_unoapi.mk
new file mode 100755
index 000000000000..d41ebcd2e839
--- /dev/null
+++ b/sw/JunitTest_sw_unoapi.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_JunitTest_JunitTest,sw_unoapi))
+
+$(eval $(call gb_JunitTest_set_defs,sw_unoapi,\
+ $$(DEFS) \
+ -Dorg.openoffice.test.arg.sce=$(SRCDIR)/sw/qa/unoapi/sw.sce \
+ -Dorg.openoffice.test.arg.xcl=$(SRCDIR)/sw/qa/unoapi/knownissues.xcl \
+ -Dorg.openoffice.test.arg.tdoc=$(SRCDIR)/sw/qa/unoapi/testdocuments \
+))
+
+$(eval $(call gb_JunitTest_add_jars,sw_unoapi,\
+ $(OUTDIR)/bin/OOoRunner.jar \
+ $(OUTDIR)/bin/ridl.jar \
+ $(OUTDIR)/bin/test.jar \
+ $(OUTDIR)/bin/unoil.jar \
+ $(OUTDIR)/bin/jurt.jar \
+))
+
+$(eval $(call gb_JunitTest_add_sourcefiles,sw_unoapi,\
+ sw/qa/unoapi/Test \
+))
+
+$(eval $(call gb_JunitTest_add_classes,sw_unoapi,\
+ org.openoffice.sw.qa.unoapi.Test \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Library_msword.mk b/sw/Library_msword.mk
new file mode 100644
index 000000000000..530fa53908b7
--- /dev/null
+++ b/sw/Library_msword.mk
@@ -0,0 +1,116 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,msword))
+
+$(eval $(call gb_Library_set_componentfile,msword,sw/util/msword))
+
+$(eval $(call gb_Library_set_include,msword,\
+ -I$(SRCDIR)/sw/source/core/inc \
+ -I$(SRCDIR)/sw/source/ui/inc \
+ -I$(SRCDIR)/sw/source/filter/inc \
+ -I$(SRCDIR)/sw/inc/pch \
+ -I$(SRCDIR)/sw/inc \
+ -I$(WORKDIR)/inc/sw/sdi \
+ -I$(WORKDIR)/Misc/sw/ \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+ -I$(OUTDIR)/inc/sw \
+))
+
+$(eval $(call gb_Library_set_defs,msword,\
+ $$(DEFS) \
+))
+
+$(eval $(call gb_Library_add_linked_libs,msword,\
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ editeng \
+ i18nisolang1 \
+ i18nutil \
+ icuuc \
+ msfilter \
+ sal \
+ sfx \
+ sot \
+ stl \
+ svl \
+ svt \
+ svx \
+ svx \
+ svxcore \
+ sw \
+ tk \
+ tl \
+ ucbhelper \
+ utl \
+ vcl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,msword,\
+ sw/source/filter/rtf/rtffld \
+ sw/source/filter/rtf/rtffly \
+ sw/source/filter/rtf/rtfnum \
+ sw/source/filter/rtf/rtftbl \
+ sw/source/filter/rtf/swparrtf \
+ sw/source/filter/ww8/rtfattributeoutput \
+ sw/source/filter/ww8/rtfexport \
+ sw/source/filter/ww8/rtfexportfilter \
+ sw/source/filter/ww8/rtfimportfilter \
+ sw/source/filter/ww8/rtfsdrexport \
+ sw/source/filter/ww8/WW8FFData \
+ sw/source/filter/ww8/WW8FibData \
+ sw/source/filter/ww8/WW8Sttbf \
+ sw/source/filter/ww8/WW8TableInfo \
+ sw/source/filter/ww8/fields \
+ sw/source/filter/ww8/styles \
+ sw/source/filter/ww8/tracer \
+ sw/source/filter/ww8/writerhelper \
+ sw/source/filter/ww8/writerwordglue \
+ sw/source/filter/ww8/wrtw8esh \
+ sw/source/filter/ww8/wrtw8nds \
+ sw/source/filter/ww8/wrtw8num \
+ sw/source/filter/ww8/wrtw8sty \
+ sw/source/filter/ww8/wrtww8 \
+ sw/source/filter/ww8/wrtww8gr \
+ sw/source/filter/ww8/ww8atr \
+ sw/source/filter/ww8/ww8glsy \
+ sw/source/filter/ww8/ww8graf \
+ sw/source/filter/ww8/ww8graf2 \
+ sw/source/filter/ww8/ww8par \
+ sw/source/filter/ww8/ww8par2 \
+ sw/source/filter/ww8/ww8par3 \
+ sw/source/filter/ww8/ww8par4 \
+ sw/source/filter/ww8/ww8par5 \
+ sw/source/filter/ww8/ww8par6 \
+ sw/source/filter/ww8/ww8scan \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
new file mode 100644
index 000000000000..d097896087ba
--- /dev/null
+++ b/sw/Library_sw.mk
@@ -0,0 +1,738 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,sw))
+
+$(eval $(call gb_Library_add_sdi_headers,sw,sw/sdi/swslots))
+
+$(eval $(call gb_Library_add_precompiled_header,sw,$(SRCDIR)/sw/inc/pch/precompiled_sw))
+
+$(eval $(call gb_Library_set_componentfile,sw,sw/util/sw))
+
+$(eval $(call gb_Library_set_include,sw,\
+ -I$(SRCDIR)/sw/source/core/inc \
+ -I$(SRCDIR)/sw/source/filter/inc \
+ -I$(SRCDIR)/sw/source/ui/inc \
+ -I$(SRCDIR)/sw/inc/pch \
+ -I$(SRCDIR)/sw/inc \
+ -I$(WORKDIR)/SdiTarget/sw/sdi \
+ -I$(WORKDIR)/Misc/sw/ \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+ -I$(OUTDIR)/inc \
+))
+
+$(eval $(call gb_Library_set_defs,sw,\
+ $$(DEFS) \
+ -DSW_DLLIMPLEMENTATION \
+))
+
+$(eval $(call gb_Library_add_linked_libs,sw,\
+ avmedia \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ editeng \
+ i18nisolang1 \
+ i18nutil \
+ icuuc \
+ lng \
+ sal \
+ salhelper \
+ sb \
+ sfx \
+ sot \
+ stl \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ tk \
+ tl \
+ ucbhelper \
+ utl \
+ vbahelper \
+ vcl \
+ vos3 \
+ xo \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,sw,\
+ sw/source/core/SwNumberTree/SwNodeNum \
+ sw/source/core/SwNumberTree/SwNumberTree \
+ sw/source/core/access/acccell \
+ sw/source/core/access/acccontext \
+ sw/source/core/access/accdoc \
+ sw/source/core/access/accembedded \
+ sw/source/core/access/accfootnote \
+ sw/source/core/access/accframe \
+ sw/source/core/access/accframebase\
+ sw/source/core/access/accfrmobj \
+ sw/source/core/access/accfrmobjmap \
+ sw/source/core/access/accfrmobjslist \
+ sw/source/core/access/accgraphic \
+ sw/source/core/access/accheaderfooter \
+ sw/source/core/access/acchyperlink \
+ sw/source/core/access/acchypertextdata \
+ sw/source/core/access/accmap \
+ sw/source/core/access/accnotextframe \
+ sw/source/core/access/accpage \
+ sw/source/core/access/accpara \
+ sw/source/core/access/accportions \
+ sw/source/core/access/accpreview \
+ sw/source/core/access/accselectionhelper \
+ sw/source/core/access/acctable \
+ sw/source/core/access/acctextframe \
+ sw/source/core/access/parachangetrackinginfo \
+ sw/source/core/access/textmarkuphelper \
+ sw/source/core/attr/calbck \
+ sw/source/core/attr/cellatr \
+ sw/source/core/attr/fmtfollowtextflow \
+ sw/source/core/attr/fmtwrapinfluenceonobjpos \
+ sw/source/core/attr/format \
+ sw/source/core/attr/hints \
+ sw/source/core/attr/swatrset \
+ sw/source/core/bastyp/SwSmartTagMgr \
+ sw/source/core/bastyp/bparr \
+ sw/source/core/bastyp/breakit \
+ sw/source/core/bastyp/calc \
+ sw/source/core/bastyp/checkit \
+ sw/source/core/bastyp/index \
+ sw/source/core/bastyp/init \
+ sw/source/core/bastyp/ring \
+ sw/source/core/bastyp/swcache \
+ sw/source/core/bastyp/swrect \
+ sw/source/core/bastyp/swregion \
+ sw/source/core/bastyp/swtypes \
+ sw/source/core/bastyp/tabcol \
+ sw/source/core/crsr/BlockCursor \
+ sw/source/core/crsr/bookmrk \
+ sw/source/core/crsr/callnk \
+ sw/source/core/crsr/crbm \
+ sw/source/core/crsr/crossrefbookmark \
+ sw/source/core/crsr/crsrsh \
+ sw/source/core/crsr/crstrvl \
+ sw/source/core/crsr/crstrvl1 \
+ sw/source/core/crsr/findattr \
+ sw/source/core/crsr/findcoll \
+ sw/source/core/crsr/findfmt \
+ sw/source/core/crsr/findtxt \
+ sw/source/core/crsr/pam \
+ sw/source/core/crsr/paminit \
+ sw/source/core/crsr/swcrsr \
+ sw/source/core/crsr/trvlcol \
+ sw/source/core/crsr/trvlfnfl \
+ sw/source/core/crsr/trvlreg \
+ sw/source/core/crsr/trvltbl \
+ sw/source/core/crsr/unocrsr \
+ sw/source/core/crsr/viscrs \
+ sw/source/core/doc/SwStyleNameMapper \
+ sw/source/core/doc/acmplwrd \
+ sw/source/core/doc/dbgoutsw \
+ sw/source/core/doc/doc \
+ sw/source/core/doc/docbasic \
+ sw/source/core/doc/docbm \
+ sw/source/core/doc/docchart \
+ sw/source/core/doc/doccomp \
+ sw/source/core/doc/doccorr \
+ sw/source/core/doc/docdde \
+ sw/source/core/doc/docdesc \
+ sw/source/core/doc/docdraw \
+ sw/source/core/doc/docedt \
+ sw/source/core/doc/docfld \
+ sw/source/core/doc/docfly \
+ sw/source/core/doc/docfmt \
+ sw/source/core/doc/docftn \
+ sw/source/core/doc/docglbl \
+ sw/source/core/doc/docglos \
+ sw/source/core/doc/doclay \
+ sw/source/core/doc/docnew \
+ sw/source/core/doc/docnum \
+ sw/source/core/doc/docredln \
+ sw/source/core/doc/docruby \
+ sw/source/core/doc/docsort \
+ sw/source/core/doc/docstat \
+ sw/source/core/doc/doctxm \
+ sw/source/core/doc/docxforms \
+ sw/source/core/doc/extinput \
+ sw/source/core/doc/fmtcol \
+ sw/source/core/doc/ftnidx \
+ sw/source/core/doc/gctable \
+ sw/source/core/doc/htmltbl \
+ sw/source/core/doc/lineinfo \
+ sw/source/core/doc/list \
+ sw/source/core/doc/notxtfrm \
+ sw/source/core/doc/number \
+ sw/source/core/doc/poolfmt \
+ sw/source/core/doc/sortopt \
+ sw/source/core/doc/swserv \
+ sw/source/core/doc/swstylemanager \
+ sw/source/core/doc/tblafmt \
+ sw/source/core/doc/tblcpy \
+ sw/source/core/doc/tblrwcl \
+ sw/source/core/doc/visiturl \
+ sw/source/core/docnode/cancellablejob \
+ sw/source/core/docnode/finalthreadmanager \
+ sw/source/core/docnode/ndcopy \
+ sw/source/core/docnode/ndindex \
+ sw/source/core/docnode/ndnotxt \
+ sw/source/core/docnode/ndnum \
+ sw/source/core/docnode/ndsect \
+ sw/source/core/docnode/ndtbl \
+ sw/source/core/docnode/ndtbl1 \
+ sw/source/core/docnode/node \
+ sw/source/core/docnode/node2lay \
+ sw/source/core/docnode/nodes \
+ sw/source/core/docnode/observablethread \
+ sw/source/core/docnode/pausethreadstarting \
+ sw/source/core/docnode/retrievedinputstreamdata \
+ sw/source/core/docnode/retrieveinputstream \
+ sw/source/core/docnode/retrieveinputstreamconsumer \
+ sw/source/core/docnode/section \
+ sw/source/core/docnode/swbaslnk \
+ sw/source/core/docnode/swthreadjoiner \
+ sw/source/core/docnode/swthreadmanager \
+ sw/source/core/docnode/threadlistener \
+ sw/source/core/docnode/threadmanager \
+ sw/source/core/draw/dcontact \
+ sw/source/core/draw/dflyobj \
+ sw/source/core/draw/dobjfac \
+ sw/source/core/draw/dpage \
+ sw/source/core/draw/drawdoc \
+ sw/source/core/draw/dview \
+ sw/source/core/edit/acorrect \
+ sw/source/core/edit/autofmt \
+ sw/source/core/edit/edatmisc \
+ sw/source/core/edit/edattr \
+ sw/source/core/edit/eddel \
+ sw/source/core/edit/edfcol \
+ sw/source/core/edit/edfld \
+ sw/source/core/edit/edfldexp \
+ sw/source/core/edit/edfmt \
+ sw/source/core/edit/edglbldc \
+ sw/source/core/edit/edglss \
+ sw/source/core/edit/editsh \
+ sw/source/core/edit/edlingu \
+ sw/source/core/edit/ednumber \
+ sw/source/core/edit/edredln \
+ sw/source/core/edit/edsect \
+ sw/source/core/edit/edtab \
+ sw/source/core/edit/edtox \
+ sw/source/core/edit/edundo \
+ sw/source/core/edit/edws \
+ sw/source/core/except/dbgloop \
+ sw/source/core/except/errhdl \
+ sw/source/core/fields/authfld \
+ sw/source/core/fields/cellfml \
+ sw/source/core/fields/chpfld \
+ sw/source/core/fields/dbfld \
+ sw/source/core/fields/ddefld \
+ sw/source/core/fields/ddetbl \
+ sw/source/core/fields/docufld \
+ sw/source/core/fields/expfld \
+ sw/source/core/fields/fldbas \
+ sw/source/core/fields/flddat \
+ sw/source/core/fields/flddropdown \
+ sw/source/core/fields/fldlst \
+ sw/source/core/fields/macrofld \
+ sw/source/core/fields/postithelper \
+ sw/source/core/fields/reffld \
+ sw/source/core/fields/scrptfld \
+ sw/source/core/fields/tblcalc \
+ sw/source/core/fields/textapi \
+ sw/source/core/fields/usrfld \
+ sw/source/core/frmedt/fecopy \
+ sw/source/core/frmedt/fedesc \
+ sw/source/core/frmedt/fefly1 \
+ sw/source/core/frmedt/feflyole \
+ sw/source/core/frmedt/feshview \
+ sw/source/core/frmedt/fetab \
+ sw/source/core/frmedt/fews \
+ sw/source/core/frmedt/tblsel \
+ sw/source/core/graphic/grfatr \
+ sw/source/core/graphic/ndgrf \
+ sw/source/core/layout/anchoreddrawobject \
+ sw/source/core/layout/anchoredobject \
+ sw/source/core/layout/atrfrm \
+ sw/source/core/layout/calcmove \
+ sw/source/core/layout/colfrm \
+ sw/source/core/layout/dbg_lay \
+ sw/source/core/layout/findfrm \
+ sw/source/core/layout/flowfrm \
+ sw/source/core/layout/fly \
+ sw/source/core/layout/flycnt \
+ sw/source/core/layout/flyincnt \
+ sw/source/core/layout/flylay \
+ sw/source/core/layout/flypos \
+ sw/source/core/layout/frmtool \
+ sw/source/core/layout/ftnfrm \
+ sw/source/core/layout/hffrm \
+ sw/source/core/layout/layact \
+ sw/source/core/layout/laycache \
+ sw/source/core/layout/layouter \
+ sw/source/core/layout/movedfwdfrmsbyobjpos \
+ sw/source/core/layout/newfrm \
+ sw/source/core/layout/objectformatter \
+ sw/source/core/layout/objectformatterlayfrm \
+ sw/source/core/layout/objectformattertxtfrm \
+ sw/source/core/layout/objstmpconsiderwrapinfl \
+ sw/source/core/layout/pagechg \
+ sw/source/core/layout/pagedesc \
+ sw/source/core/layout/paintfrm \
+ sw/source/core/layout/sectfrm \
+ sw/source/core/layout/softpagebreak \
+ sw/source/core/layout/sortedobjs \
+ sw/source/core/layout/sortedobjsimpl \
+ sw/source/core/layout/ssfrm \
+ sw/source/core/layout/swselectionlist \
+ sw/source/core/layout/tabfrm \
+ sw/source/core/layout/trvlfrm \
+ sw/source/core/layout/unusedf \
+ sw/source/core/layout/virtoutp \
+ sw/source/core/layout/wsfrm \
+ sw/source/core/objectpositioning/anchoredobjectposition \
+ sw/source/core/objectpositioning/ascharanchoredobjectposition \
+ sw/source/core/objectpositioning/environmentofanchoredobject \
+ sw/source/core/objectpositioning/tocntntanchoredobjectposition \
+ sw/source/core/objectpositioning/tolayoutanchoredobjectposition \
+ sw/source/core/ole/ndole \
+ sw/source/core/para/paratr \
+ sw/source/core/sw3io/sw3convert \
+ sw/source/core/sw3io/swacorr \
+ sw/source/core/swg/SwXMLBlockExport \
+ sw/source/core/swg/SwXMLBlockImport \
+ sw/source/core/swg/SwXMLBlockListContext \
+ sw/source/core/swg/SwXMLSectionList \
+ sw/source/core/swg/SwXMLTextBlocks \
+ sw/source/core/swg/SwXMLTextBlocks1 \
+ sw/source/core/swg/swblocks \
+ sw/source/core/table/swnewtable \
+ sw/source/core/table/swtable \
+ sw/source/core/text/EnhancedPDFExportHelper \
+ sw/source/core/text/SwGrammarMarkUp \
+ sw/source/core/text/atrstck \
+ sw/source/core/text/blink \
+ sw/source/core/text/frmcrsr \
+ sw/source/core/text/frmform \
+ sw/source/core/text/frminf \
+ sw/source/core/text/frmpaint \
+ sw/source/core/text/guess \
+ sw/source/core/text/inftxt \
+ sw/source/core/text/itradj \
+ sw/source/core/text/itratr \
+ sw/source/core/text/itrcrsr \
+ sw/source/core/text/itrform2 \
+ sw/source/core/text/itrpaint \
+ sw/source/core/text/itrtxt \
+ sw/source/core/text/noteurl \
+ sw/source/core/text/porexp \
+ sw/source/core/text/porfld \
+ sw/source/core/text/porfly \
+ sw/source/core/text/porglue \
+ sw/source/core/text/porlay \
+ sw/source/core/text/porlin \
+ sw/source/core/text/pormulti \
+ sw/source/core/text/porref \
+ sw/source/core/text/porrst \
+ sw/source/core/text/portox \
+ sw/source/core/text/portxt \
+ sw/source/core/text/redlnitr \
+ sw/source/core/text/txtcache \
+ sw/source/core/text/txtdrop \
+ sw/source/core/text/txtfld \
+ sw/source/core/text/txtfly \
+ sw/source/core/text/txtfrm \
+ sw/source/core/text/txtftn \
+ sw/source/core/text/txthyph \
+ sw/source/core/text/txtinit \
+ sw/source/core/text/txtio \
+ sw/source/core/text/txtpaint \
+ sw/source/core/text/txttab \
+ sw/source/core/text/widorp \
+ sw/source/core/text/wrong \
+ sw/source/core/tox/tox \
+ sw/source/core/tox/toxhlp \
+ sw/source/core/tox/txmsrt \
+ sw/source/core/txtnode/SwGrammarContact \
+ sw/source/core/txtnode/atrfld \
+ sw/source/core/txtnode/atrflyin \
+ sw/source/core/txtnode/atrftn \
+ sw/source/core/txtnode/atrref \
+ sw/source/core/txtnode/atrtox \
+ sw/source/core/txtnode/chrfmt \
+ sw/source/core/txtnode/fmtatr2 \
+ sw/source/core/txtnode/fntcache \
+ sw/source/core/txtnode/fntcap \
+ sw/source/core/txtnode/modeltoviewhelper \
+ sw/source/core/txtnode/ndhints \
+ sw/source/core/txtnode/ndtxt \
+ sw/source/core/txtnode/swfntcch \
+ sw/source/core/txtnode/swfont \
+ sw/source/core/txtnode/thints \
+ sw/source/core/txtnode/txatbase \
+ sw/source/core/txtnode/txatritr \
+ sw/source/core/txtnode/txtatr2 \
+ sw/source/core/txtnode/txtedt \
+ sw/source/core/undo/SwRewriter \
+ sw/source/core/undo/SwUndoField \
+ sw/source/core/undo/SwUndoFmt \
+ sw/source/core/undo/SwUndoPageDesc \
+ sw/source/core/undo/SwUndoTOXChange \
+ sw/source/core/undo/docundo \
+ sw/source/core/undo/rolbck \
+ sw/source/core/undo/unattr \
+ sw/source/core/undo/unbkmk \
+ sw/source/core/undo/undel \
+ sw/source/core/undo/undobj \
+ sw/source/core/undo/undobj1 \
+ sw/source/core/undo/undoflystrattr \
+ sw/source/core/undo/undraw \
+ sw/source/core/undo/unfmco \
+ sw/source/core/undo/unins \
+ sw/source/core/undo/unmove \
+ sw/source/core/undo/unnum \
+ sw/source/core/undo/unoutl \
+ sw/source/core/undo/unovwr \
+ sw/source/core/undo/unredln \
+ sw/source/core/undo/unsect \
+ sw/source/core/undo/unsort \
+ sw/source/core/undo/unspnd \
+ sw/source/core/undo/untbl \
+ sw/source/core/undo/untblk \
+ sw/source/core/unocore/SwXTextDefaults \
+ sw/source/core/unocore/TextCursorHelper \
+ sw/source/core/unocore/XMLRangeHelper \
+ sw/source/core/unocore/swunohelper \
+ sw/source/core/unocore/unobkm \
+ sw/source/core/unocore/unochart \
+ sw/source/core/unocore/unocoll \
+ sw/source/core/unocore/unocrsrhelper \
+ sw/source/core/unocore/unodraw \
+ sw/source/core/unocore/unoevent \
+ sw/source/core/unocore/unoevtlstnr \
+ sw/source/core/unocore/unofield \
+ sw/source/core/unocore/unoflatpara \
+ sw/source/core/unocore/unoframe \
+ sw/source/core/unocore/unoftn \
+ sw/source/core/unocore/unoidx \
+ sw/source/core/unocore/unomap \
+ sw/source/core/unocore/unoobj \
+ sw/source/core/unocore/unoobj2 \
+ sw/source/core/unocore/unoparagraph \
+ sw/source/core/unocore/unoport \
+ sw/source/core/unocore/unoportenum \
+ sw/source/core/unocore/unoprnms \
+ sw/source/core/unocore/unoredline \
+ sw/source/core/unocore/unoredlines \
+ sw/source/core/unocore/unorefmk \
+ sw/source/core/unocore/unosect \
+ sw/source/core/unocore/unosett \
+ sw/source/core/unocore/unosrch \
+ sw/source/core/unocore/unostyle \
+ sw/source/core/unocore/unotbl \
+ sw/source/core/unocore/unotext \
+ sw/source/core/unocore/unotextmarkup \
+ sw/source/core/view/pagepreviewlayout \
+ sw/source/core/view/printdata \
+ sw/source/core/view/vdraw \
+ sw/source/core/view/viewimp \
+ sw/source/core/view/viewpg \
+ sw/source/core/view/viewsh \
+ sw/source/core/view/vnew \
+ sw/source/core/view/vprint \
+ sw/source/filter/ascii/ascatr \
+ sw/source/filter/ascii/parasc \
+ sw/source/filter/ascii/wrtasc \
+ sw/source/filter/basflt/docfact \
+ sw/source/filter/basflt/fltini \
+ sw/source/filter/basflt/iodetect \
+ sw/source/filter/basflt/shellio \
+ sw/source/filter/html/SwAppletImpl \
+ sw/source/filter/html/css1atr \
+ sw/source/filter/html/css1kywd \
+ sw/source/filter/html/htmlatr \
+ sw/source/filter/html/htmlbas \
+ sw/source/filter/html/htmlcss1 \
+ sw/source/filter/html/htmlctxt \
+ sw/source/filter/html/htmldraw \
+ sw/source/filter/html/htmlfld \
+ sw/source/filter/html/htmlfldw \
+ sw/source/filter/html/htmlfly \
+ sw/source/filter/html/htmlflyt \
+ sw/source/filter/html/htmlform \
+ sw/source/filter/html/htmlforw \
+ sw/source/filter/html/htmlftn \
+ sw/source/filter/html/htmlgrin \
+ sw/source/filter/html/htmlnum \
+ sw/source/filter/html/htmlplug \
+ sw/source/filter/html/htmlsect \
+ sw/source/filter/html/htmltab \
+ sw/source/filter/html/htmltabw \
+ sw/source/filter/html/parcss1 \
+ sw/source/filter/html/svxcss1 \
+ sw/source/filter/html/swhtml \
+ sw/source/filter/html/wrthtml \
+ sw/source/filter/writer/writer \
+ sw/source/filter/writer/wrt_fn \
+ sw/source/filter/writer/wrtswtbl \
+ sw/source/filter/ww1/fltshell \
+ sw/source/filter/ww1/w1class \
+ sw/source/filter/ww1/w1filter \
+ sw/source/filter/ww1/w1par \
+ sw/source/filter/ww1/w1sprm \
+ sw/source/filter/xml/XMLRedlineImportHelper \
+ sw/source/filter/xml/swxml \
+ sw/source/filter/xml/wrtxml \
+ sw/source/filter/xml/xmlbrsh \
+ sw/source/filter/xml/xmlexp \
+ sw/source/filter/xml/xmlexpit \
+ sw/source/filter/xml/xmlfmt \
+ sw/source/filter/xml/xmlfmte \
+ sw/source/filter/xml/xmlfonte \
+ sw/source/filter/xml/xmlimp \
+ sw/source/filter/xml/xmlimpit \
+ sw/source/filter/xml/xmlitem \
+ sw/source/filter/xml/xmliteme \
+ sw/source/filter/xml/xmlitemi \
+ sw/source/filter/xml/xmlitemm \
+ sw/source/filter/xml/xmlithlp \
+ sw/source/filter/xml/xmlitmpr \
+ sw/source/filter/xml/xmlmeta \
+ sw/source/filter/xml/xmlscript \
+ sw/source/filter/xml/xmltble \
+ sw/source/filter/xml/xmltbli \
+ sw/source/filter/xml/xmltext \
+ sw/source/filter/xml/xmltexte \
+ sw/source/filter/xml/xmltexti \
+ sw/source/ui/app/appenv \
+ sw/source/ui/app/apphdl \
+ sw/source/ui/app/applab \
+ sw/source/ui/app/appopt \
+ sw/source/ui/app/docsh \
+ sw/source/ui/app/docsh2 \
+ sw/source/ui/app/docshdrw \
+ sw/source/ui/app/docshini \
+ sw/source/ui/app/docst \
+ sw/source/ui/app/docstyle \
+ sw/source/ui/app/mainwn \
+ sw/source/ui/app/swdll \
+ sw/source/ui/app/swmodul1 \
+ sw/source/ui/app/swmodule \
+ sw/source/ui/app/swwait \
+ sw/source/ui/cctrl/actctrl \
+ sw/source/ui/cctrl/popbox \
+ sw/source/ui/cctrl/swlbox \
+ sw/source/ui/chrdlg/ccoll \
+ sw/source/ui/config/barcfg \
+ sw/source/ui/config/caption \
+ sw/source/ui/config/cfgitems \
+ sw/source/ui/config/dbconfig \
+ sw/source/ui/config/fontcfg \
+ sw/source/ui/config/modcfg \
+ sw/source/ui/config/prtopt \
+ sw/source/ui/config/uinums \
+ sw/source/ui/config/usrpref \
+ sw/source/ui/config/viewopt \
+ sw/source/ui/dbui/dbmgr \
+ sw/source/ui/dbui/dbtree \
+ sw/source/ui/dbui/dbui \
+ sw/source/ui/dbui/maildispatcher \
+ sw/source/ui/dbui/mailmergechildwindow \
+ sw/source/ui/dbui/mailmergehelper \
+ sw/source/ui/dbui/mmconfigitem \
+ sw/source/ui/dbui/swdbtoolsclient \
+ sw/source/ui/dialog/SwSpellDialogChildWindow \
+ sw/source/ui/dialog/regionsw \
+ sw/source/ui/dialog/swabstdlg \
+ sw/source/ui/dialog/swwrtshitem \
+ sw/source/ui/dochdl/gloshdl \
+ sw/source/ui/dochdl/swdtflvr \
+ sw/source/ui/docvw/AnchorOverlayObject \
+ sw/source/ui/docvw/AnnotationMenuButton \
+ sw/source/ui/docvw/AnnotationWin \
+ sw/source/ui/docvw/PostItMgr \
+ sw/source/ui/docvw/ShadowOverlayObject \
+ sw/source/ui/docvw/SidebarTxtControl \
+ sw/source/ui/docvw/SidebarTxtControlAcc \
+ sw/source/ui/docvw/SidebarWin \
+ sw/source/ui/docvw/SidebarWinAcc \
+ sw/source/ui/docvw/edtdd \
+ sw/source/ui/docvw/edtwin \
+ sw/source/ui/docvw/edtwin2 \
+ sw/source/ui/docvw/edtwin3 \
+ sw/source/ui/docvw/frmsidebarwincontainer \
+ sw/source/ui/docvw/romenu \
+ sw/source/ui/docvw/srcedtw \
+ sw/source/ui/envelp/envimg \
+ sw/source/ui/envelp/labelcfg \
+ sw/source/ui/envelp/labimg \
+ sw/source/ui/envelp/syncbtn \
+ sw/source/ui/fldui/fldmgr \
+ sw/source/ui/fldui/fldwrap \
+ sw/source/ui/fldui/xfldui \
+ sw/source/ui/frmdlg/colex \
+ sw/source/ui/frmdlg/colmgr \
+ sw/source/ui/frmdlg/frmmgr \
+ sw/source/ui/globdoc/globdoc \
+ sw/source/ui/index/idxmrk \
+ sw/source/ui/index/toxmgr \
+ sw/source/ui/lingu/hhcwrp \
+ sw/source/ui/lingu/hyp \
+ sw/source/ui/lingu/olmenu \
+ sw/source/ui/lingu/sdrhhcwrap \
+ sw/source/ui/misc/glosdoc \
+ sw/source/ui/misc/glshell \
+ sw/source/ui/misc/numberingtypelistbox \
+ sw/source/ui/misc/redlndlg \
+ sw/source/ui/ribbar/conarc \
+ sw/source/ui/ribbar/concustomshape \
+ sw/source/ui/ribbar/conform \
+ sw/source/ui/ribbar/conpoly \
+ sw/source/ui/ribbar/conrect \
+ sw/source/ui/ribbar/drawbase \
+ sw/source/ui/ribbar/dselect \
+ sw/source/ui/ribbar/inputwin \
+ sw/source/ui/ribbar/tblctrl \
+ sw/source/ui/ribbar/tbxanchr \
+ sw/source/ui/ribbar/workctrl \
+ sw/source/ui/shells/annotsh \
+ sw/source/ui/shells/basesh \
+ sw/source/ui/shells/beziersh \
+ sw/source/ui/shells/drawdlg \
+ sw/source/ui/shells/drawsh \
+ sw/source/ui/shells/drformsh \
+ sw/source/ui/shells/drwbassh \
+ sw/source/ui/shells/drwtxtex \
+ sw/source/ui/shells/drwtxtsh \
+ sw/source/ui/shells/frmsh \
+ sw/source/ui/shells/grfsh \
+ sw/source/ui/shells/grfshex \
+ sw/source/ui/shells/langhelper \
+ sw/source/ui/shells/listsh \
+ sw/source/ui/shells/mediash \
+ sw/source/ui/shells/olesh \
+ sw/source/ui/shells/slotadd \
+ sw/source/ui/shells/tabsh \
+ sw/source/ui/shells/textdrw \
+ sw/source/ui/shells/textfld \
+ sw/source/ui/shells/textglos \
+ sw/source/ui/shells/textidx \
+ sw/source/ui/shells/textsh \
+ sw/source/ui/shells/textsh1 \
+ sw/source/ui/shells/textsh2 \
+ sw/source/ui/shells/txtattr \
+ sw/source/ui/shells/txtcrsr \
+ sw/source/ui/shells/txtnum \
+ sw/source/ui/smartmenu/stmenu \
+ sw/source/ui/table/chartins \
+ sw/source/ui/table/swtablerep \
+ sw/source/ui/table/tablemgr \
+ sw/source/ui/uiview/formatclipboard \
+ sw/source/ui/uiview/pview \
+ sw/source/ui/uiview/scroll \
+ sw/source/ui/uiview/srcview \
+ sw/source/ui/uiview/swcli \
+ sw/source/ui/uiview/uivwimp \
+ sw/source/ui/uiview/view \
+ sw/source/ui/uiview/view0 \
+ sw/source/ui/uiview/view1 \
+ sw/source/ui/uiview/view2 \
+ sw/source/ui/uiview/viewcoll \
+ sw/source/ui/uiview/viewdlg \
+ sw/source/ui/uiview/viewdlg2 \
+ sw/source/ui/uiview/viewdraw \
+ sw/source/ui/uiview/viewling \
+ sw/source/ui/uiview/viewmdi \
+ sw/source/ui/uiview/viewport \
+ sw/source/ui/uiview/viewprt \
+ sw/source/ui/uiview/viewsrch \
+ sw/source/ui/uiview/viewstat \
+ sw/source/ui/uiview/viewtab \
+ sw/source/ui/uno/RefreshListenerContainer \
+ sw/source/ui/uno/SwXDocumentSettings \
+ sw/source/ui/uno/SwXFilterOptions \
+ sw/source/ui/uno/dlelstnr \
+ sw/source/ui/uno/unoatxt \
+ sw/source/ui/uno/unodefaults \
+ sw/source/ui/uno/unodispatch \
+ sw/source/ui/uno/unodoc \
+ sw/source/ui/uno/unofreg \
+ sw/source/ui/uno/unomailmerge \
+ sw/source/ui/uno/unomod \
+ sw/source/ui/uno/unomodule \
+ sw/source/ui/uno/unotxdoc \
+ sw/source/ui/uno/unotxvw \
+ sw/source/ui/utlui/attrdesc \
+ sw/source/ui/utlui/bookctrl \
+ sw/source/ui/utlui/condedit \
+ sw/source/ui/utlui/content \
+ sw/source/ui/utlui/glbltree \
+ sw/source/ui/utlui/gloslst \
+ sw/source/ui/utlui/initui \
+ sw/source/ui/utlui/navicfg \
+ sw/source/ui/utlui/navipi \
+ sw/source/ui/utlui/numfmtlb \
+ sw/source/ui/utlui/prcntfld \
+ sw/source/ui/utlui/shdwcrsr \
+ sw/source/ui/utlui/textcontrolcombo \
+ sw/source/ui/utlui/tmplctrl \
+ sw/source/ui/utlui/uiitems \
+ sw/source/ui/utlui/uitool \
+ sw/source/ui/utlui/unotools \
+ sw/source/ui/utlui/viewlayoutctrl \
+ sw/source/ui/utlui/zoomctrl \
+ sw/source/ui/web/wdocsh \
+ sw/source/ui/web/wformsh \
+ sw/source/ui/web/wfrmsh \
+ sw/source/ui/web/wgrfsh \
+ sw/source/ui/web/wlistsh \
+ sw/source/ui/web/wolesh \
+ sw/source/ui/web/wtabsh \
+ sw/source/ui/web/wtextsh \
+ sw/source/ui/web/wview \
+ sw/source/ui/wrtsh/delete \
+ sw/source/ui/wrtsh/move \
+ sw/source/ui/wrtsh/select \
+ sw/source/ui/wrtsh/wrtsh1 \
+ sw/source/ui/wrtsh/wrtsh2 \
+ sw/source/ui/wrtsh/wrtsh3 \
+ sw/source/ui/wrtsh/wrtsh4 \
+ sw/source/ui/wrtsh/wrtundo \
+))
+
+$(eval $(call gb_SdiTarget_SdiTarget,sw/sdi/swslots,sw/sdi/swriter))
+
+$(eval $(call gb_SdiTarget_set_include,sw/sdi/swslots,\
+ -I$(SRCDIR)/sw/inc \
+ -I$(SRCDIR)/sw/sdi \
+ $$(INCLUDE) \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Library_swd.mk b/sw/Library_swd.mk
new file mode 100644
index 000000000000..a0dcfaf29c3a
--- /dev/null
+++ b/sw/Library_swd.mk
@@ -0,0 +1,72 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,swd))
+
+$(eval $(call gb_Library_set_componentfile,swd,sw/util/swd))
+
+$(eval $(call gb_Library_set_include,swd,\
+ $$(INCLUDE) \
+ -I$(WORKDIR)/inc/sw/sdi \
+ -I$(WORKDIR)/inc/sw \
+ -I$(SRCDIR)/sw/inc \
+ -I$(SRCDIR)/sw/inc/pch \
+ -I$(SRCDIR)/sw/source/core/inc \
+ -I$(SRCDIR)/sw/source/filter/inc \
+ -I$(SRCDIR)/sw/source/ui/inc \
+ -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Library_set_defs,swd,\
+ $$(DEFS) \
+))
+
+$(eval $(call gb_Library_add_linked_libs,swd,\
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ sfx \
+ sot \
+ svl \
+ svt \
+ tl \
+ ucbhelper \
+ utl \
+ vcl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,swd,\
+ sw/source/core/except/errhdl \
+ sw/source/filter/basflt/iodetect \
+ sw/source/ui/uno/detreg \
+ sw/source/ui/uno/swdet2 \
+ sw/source/ui/uno/swdetect \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
new file mode 100644
index 000000000000..f7b3f529c80f
--- /dev/null
+++ b/sw/Library_swui.mk
@@ -0,0 +1,168 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,swui))
+
+$(eval $(call gb_Library_set_include,swui,\
+ -I$(SRCDIR)/sw/inc \
+ -I$(SRCDIR)/sw/inc/pch \
+ -I$(SRCDIR)/sw/source/core/inc \
+ -I$(SRCDIR)/sw/source/filter/inc \
+ -I$(SRCDIR)/sw/source/ui/inc \
+ -I$(WORKDIR)/SdiTarget/sw/sdi \
+ -I$(WORKDIR)/Misc/sw \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Library_set_defs,swui,\
+ $$(DEFS) \
+))
+
+$(eval $(call gb_Library_add_linked_libs,swui,\
+ comphelper \
+ cppu \
+ cppuhelper \
+ editeng \
+ i18nisolang1 \
+ msfilter \
+ sal \
+ sfx \
+ sot \
+ stl \
+ svl \
+ svt \
+ svx \
+ svx \
+ svxcore \
+ sw \
+ tk \
+ tl \
+ ucbhelper \
+ utl \
+ vcl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,swui,\
+ sw/source/core/undo/SwRewriter \
+ sw/source/ui/chrdlg/break \
+ sw/source/ui/chrdlg/chardlg \
+ sw/source/ui/chrdlg/drpcps \
+ sw/source/ui/chrdlg/numpara \
+ sw/source/ui/chrdlg/pardlg \
+ sw/source/ui/chrdlg/swuiccoll \
+ sw/source/ui/chrdlg/tblnumfm \
+ sw/source/ui/config/mailconfigpage \
+ sw/source/ui/config/optcomp \
+ sw/source/ui/config/optload \
+ sw/source/ui/config/optpage \
+ sw/source/ui/dbui/addresslistdialog \
+ sw/source/ui/dbui/createaddresslistdialog \
+ sw/source/ui/dbui/customizeaddresslistdialog \
+ sw/source/ui/dbui/dbinsdlg \
+ sw/source/ui/dbui/dbtablepreviewdialog \
+ sw/source/ui/dbui/mailmergewizard \
+ sw/source/ui/dbui/mmaddressblockpage \
+ sw/source/ui/dbui/mmdocselectpage \
+ sw/source/ui/dbui/mmgreetingspage \
+ sw/source/ui/dbui/mmlayoutpage \
+ sw/source/ui/dbui/mmmergepage \
+ sw/source/ui/dbui/mmoutputpage \
+ sw/source/ui/dbui/mmoutputtypepage \
+ sw/source/ui/dbui/mmpreparemergepage \
+ sw/source/ui/dbui/selectdbtabledialog \
+ sw/source/ui/dialog/abstract \
+ sw/source/ui/dialog/addrdlg \
+ sw/source/ui/dialog/ascfldlg \
+ sw/source/ui/dialog/docstdlg \
+ sw/source/ui/dialog/macassgn \
+ sw/source/ui/dialog/swdialmgr \
+ sw/source/ui/dialog/swdlgfact \
+ sw/source/ui/dialog/swuiexp \
+ sw/source/ui/dialog/uiregionsw \
+ sw/source/ui/dialog/wordcountdialog \
+ sw/source/ui/dochdl/selglos \
+ sw/source/ui/envelp/envfmt \
+ sw/source/ui/envelp/envlop1 \
+ sw/source/ui/envelp/envprt \
+ sw/source/ui/envelp/label1 \
+ sw/source/ui/envelp/labelexp \
+ sw/source/ui/envelp/labfmt \
+ sw/source/ui/envelp/labprt \
+ sw/source/ui/envelp/mailmrge \
+ sw/source/ui/fldui/DropDownFieldDialog \
+ sw/source/ui/fldui/FldRefTreeListBox \
+ sw/source/ui/fldui/changedb \
+ sw/source/ui/fldui/flddb \
+ sw/source/ui/fldui/flddinf \
+ sw/source/ui/fldui/flddok \
+ sw/source/ui/fldui/fldedt \
+ sw/source/ui/fldui/fldfunc \
+ sw/source/ui/fldui/fldpage \
+ sw/source/ui/fldui/fldref \
+ sw/source/ui/fldui/fldtdlg \
+ sw/source/ui/fldui/fldvar \
+ sw/source/ui/fldui/inpdlg \
+ sw/source/ui/fldui/javaedit \
+ sw/source/ui/fmtui/tmpdlg \
+ sw/source/ui/frmdlg/column \
+ sw/source/ui/frmdlg/cption \
+ sw/source/ui/frmdlg/frmdlg \
+ sw/source/ui/frmdlg/frmpage \
+ sw/source/ui/frmdlg/pattern \
+ sw/source/ui/frmdlg/uiborder \
+ sw/source/ui/frmdlg/wrap \
+ sw/source/ui/index/cntex \
+ sw/source/ui/index/cnttab \
+ sw/source/ui/index/multmrk \
+ sw/source/ui/index/swuiidxmrk \
+ sw/source/ui/misc/bookmark \
+ sw/source/ui/misc/docfnote \
+ sw/source/ui/misc/glosbib \
+ sw/source/ui/misc/glossary \
+ sw/source/ui/misc/insfnote \
+ sw/source/ui/misc/insrule \
+ sw/source/ui/misc/linenum \
+ sw/source/ui/misc/num \
+ sw/source/ui/misc/outline \
+ sw/source/ui/misc/pgfnote \
+ sw/source/ui/misc/pggrid \
+ sw/source/ui/misc/srtdlg \
+ sw/source/ui/misc/swmodalredlineacceptdlg \
+ sw/source/ui/table/colwd \
+ sw/source/ui/table/convert \
+ sw/source/ui/table/instable \
+ sw/source/ui/table/mergetbl \
+ sw/source/ui/table/rowht \
+ sw/source/ui/table/splittbl \
+ sw/source/ui/table/tabledlg \
+ sw/source/ui/table/tautofmt \
+ sw/source/ui/utlui/swrenamexnameddlg \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Library_vbaswobj.mk b/sw/Library_vbaswobj.mk
new file mode 100644
index 000000000000..140dd38d623d
--- /dev/null
+++ b/sw/Library_vbaswobj.mk
@@ -0,0 +1,124 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,vbaswobj))
+
+$(eval $(call gb_Library_set_componentfile,vbaswobj,sw/util/vbaswobj))
+
+$(eval $(call gb_Library_set_include,vbaswobj,\
+ -I$(SRCDIR)/sw/source/core/inc \
+ -I$(SRCDIR)/sw/source/filter/inc \
+ -I$(SRCDIR)/sw/source/ui/inc \
+ -I$(SRCDIR)/sw/inc/pch \
+ -I$(SRCDIR)/sw/inc \
+ -I$(WORKDIR)/Misc/sw/ \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+ -I$(OUTDIR)/inc/ \
+))
+
+$(eval $(call gb_Library_add_linked_libs,vbaswobj,\
+ comphelper \
+ cppu \
+ cppuhelper \
+ editeng \
+ i18nisolang1 \
+ sal \
+ sb \
+ sfx \
+ stl \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ sw \
+ tk \
+ tl \
+ utl \
+ vbahelper \
+ vcl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,vbaswobj,\
+ sw/source/ui/vba/service \
+ sw/source/ui/vba/vbadocument \
+ sw/source/ui/vba/vbasections \
+ sw/source/ui/vba/vbadialog \
+ sw/source/ui/vba/vbawrapformat \
+ sw/source/ui/vba/vbafont \
+ sw/source/ui/vba/vbaheaderfooterhelper \
+ sw/source/ui/vba/vbarangehelper \
+ sw/source/ui/vba/vbaaddin \
+ sw/source/ui/vba/vbaautotextentry \
+ sw/source/ui/vba/vbarange \
+ sw/source/ui/vba/vbadocumentproperties \
+ sw/source/ui/vba/vbaeventshelper \
+ sw/source/ui/vba/vbastyle \
+ sw/source/ui/vba/vbapane \
+ sw/source/ui/vba/vbaglobals \
+ sw/source/ui/vba/vbatemplate \
+ sw/source/ui/vba/vbaaddins \
+ sw/source/ui/vba/vbaview \
+ sw/source/ui/vba/vbaheaderfooter \
+ sw/source/ui/vba/vbabookmarks \
+ sw/source/ui/vba/vbaoptions \
+ sw/source/ui/vba/vbadialogs \
+ sw/source/ui/vba/vbapalette \
+ sw/source/ui/vba/vbaparagraph \
+ sw/source/ui/vba/vbafind \
+ sw/source/ui/vba/vbasection \
+ sw/source/ui/vba/vbabookmark \
+ sw/source/ui/vba/vbaapplication \
+ sw/source/ui/vba/vbawindow \
+ sw/source/ui/vba/vbareplacement \
+ sw/source/ui/vba/vbatable \
+ sw/source/ui/vba/vbaselection \
+ sw/source/ui/vba/vbasystem \
+ sw/source/ui/vba/vbainformationhelper \
+ sw/source/ui/vba/vbapagesetup \
+ sw/source/ui/vba/vbafield \
+ sw/source/ui/vba/vbatables \
+ sw/source/ui/vba/vbavariable \
+ sw/source/ui/vba/vbadocuments \
+ sw/source/ui/vba/vbaparagraphformat \
+ sw/source/ui/vba/vbaborders \
+ sw/source/ui/vba/vbavariables \
+ sw/source/ui/vba/vbastyles \
+ sw/source/ui/vba/vbapanes \
+ sw/source/ui/vba/wordvbahelper \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Library_set_ldflags,vbaswobj,\
+ $$(LDFLAGS) \
+ -Wl$(COMMA)-O1 \
+ -Wl$(COMMA)-z$(COMMA)noexecstack \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Makefile b/sw/Makefile
new file mode 100644
index 000000000000..a79aff831024
--- /dev/null
+++ b/sw/Makefile
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+ifeq ($(strip $(SOLARENV)),)
+$(error No environment set!)
+endif
+
+gb_PARTIALBUILD := T
+GBUILDDIR := $(SOLARENV)/gbuild
+include $(GBUILDDIR)/gbuild.mk
+
+$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk)))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
new file mode 100644
index 000000000000..c6257e22fc93
--- /dev/null
+++ b/sw/Module_sw.mk
@@ -0,0 +1,47 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Module_Module,sw))
+
+$(eval $(call gb_Module_add_targets,sw,\
+ AllLangResTarget_sw \
+ Library_msword \
+ Library_sw \
+ Library_swd \
+ Library_swui \
+ Library_vbaswobj \
+ Package_misc \
+ Package_uiconfig \
+ Package_xml \
+))
+
+$(eval $(call gb_Module_add_subsequentcheck_targets,sw,\
+ JunitTest_sw_complex \
+ JunitTest_sw_unoapi \
+))
+
+# vim: set noet ts=4 sw=4:
diff --git a/sw/Package_misc.mk b/sw/Package_misc.mk
new file mode 100644
index 000000000000..60f721be4322
--- /dev/null
+++ b/sw/Package_misc.mk
@@ -0,0 +1,30 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,sw_misc,$(SRCDIR)/sw/misc))
+# TODO:
+#COPY sw/unxlngx6.pro/misc/swslots_sid.hid unxlngx6.pro/bin/hid/swslots_sid.hid
diff --git a/sw/Package_uiconfig.mk b/sw/Package_uiconfig.mk
new file mode 100644
index 000000000000..2cad9784eb92
--- /dev/null
+++ b/sw/Package_uiconfig.mk
@@ -0,0 +1,261 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,sw_uiconfig,$(SRCDIR)/sw/uiconfig))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/menubar/menubar.xml,sglobal/menubar/menubar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/statusbar/statusbar.xml,sglobal/statusbar/statusbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/alignmentbar.xml,sglobal/toolbar/alignmentbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/arrowshapes.xml,sglobal/toolbar/arrowshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/basicshapes.xml,sglobal/toolbar/basicshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/bezierobjectbar.xml,sglobal/toolbar/bezierobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/calloutshapes.xml,sglobal/toolbar/calloutshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/colorbar.xml,sglobal/toolbar/colorbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/drawbar.xml,sglobal/toolbar/drawbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/drawingobjectbar.xml,sglobal/toolbar/drawingobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/drawtextobjectbar.xml,sglobal/toolbar/drawtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/extrusionobjectbar.xml,sglobal/toolbar/extrusionobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/findbar.xml,sglobal/toolbar/findbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/flowchartshapes.xml,sglobal/toolbar/flowchartshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/fontworkobjectbar.xml,sglobal/toolbar/fontworkobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/fontworkshapetype.xml,sglobal/toolbar/fontworkshapetype.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/formcontrols.xml,sglobal/toolbar/formcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/formdesign.xml,sglobal/toolbar/formdesign.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/formsfilterbar.xml,sglobal/toolbar/formsfilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/formsnavigationbar.xml,sglobal/toolbar/formsnavigationbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/formtextobjectbar.xml,sglobal/toolbar/formtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/frameobjectbar.xml,sglobal/toolbar/frameobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/fullscreenbar.xml,sglobal/toolbar/fullscreenbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/graffilterbar.xml,sglobal/toolbar/graffilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/graphicobjectbar.xml,sglobal/toolbar/graphicobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/insertbar.xml,sglobal/toolbar/insertbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/insertobjectbar.xml,sglobal/toolbar/insertobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/mediaobjectbar.xml,sglobal/toolbar/mediaobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/moreformcontrols.xml,sglobal/toolbar/moreformcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/numobjectbar.xml,sglobal/toolbar/numobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/oleobjectbar.xml,sglobal/toolbar/oleobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/optimizetablebar.xml,sglobal/toolbar/optimizetablebar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/previewobjectbar.xml,sglobal/toolbar/previewobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/standardbar.xml,sglobal/toolbar/standardbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/starshapes.xml,sglobal/toolbar/starshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/symbolshapes.xml,sglobal/toolbar/symbolshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/tableobjectbar.xml,sglobal/toolbar/tableobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/textobjectbar.xml,sglobal/toolbar/textobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/toolbar.xml,sglobal/toolbar/toolbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/toolbar/viewerbar.xml,sglobal/toolbar/viewerbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/menubar/menubar.xml,sweb/menubar/menubar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/statusbar/statusbar.xml,sweb/statusbar/statusbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/arrowshapes.xml,sweb/toolbar/arrowshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/basicshapes.xml,sweb/toolbar/basicshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/bezierobjectbar.xml,sweb/toolbar/bezierobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/calloutshapes.xml,sweb/toolbar/calloutshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/colorbar.xml,sweb/toolbar/colorbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/drawingobjectbar.xml,sweb/toolbar/drawingobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/drawtextobjectbar.xml,sweb/toolbar/drawtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/extrusionobjectbar.xml,sweb/toolbar/extrusionobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/findbar.xml,sweb/toolbar/findbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/flowchartshapes.xml,sweb/toolbar/flowchartshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/fontworkobjectbar.xml,sweb/toolbar/fontworkobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/fontworkshapetype.xml,sweb/toolbar/fontworkshapetype.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/formcontrols.xml,sweb/toolbar/formcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/formdesign.xml,sweb/toolbar/formdesign.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/formsfilterbar.xml,sweb/toolbar/formsfilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/formsnavigationbar.xml,sweb/toolbar/formsnavigationbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/formtextobjectbar.xml,sweb/toolbar/formtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/frameobjectbar.xml,sweb/toolbar/frameobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/fullscreenbar.xml,sweb/toolbar/fullscreenbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/graffilterbar.xml,sweb/toolbar/graffilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/graphicobjectbar.xml,sweb/toolbar/graphicobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/insertbar.xml,sweb/toolbar/insertbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/mediaobjectbar.xml,sweb/toolbar/mediaobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/numobjectbar.xml,sweb/toolbar/numobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/oleobjectbar.xml,sweb/toolbar/oleobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/optimizetablebar.xml,sweb/toolbar/optimizetablebar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/previewobjectbar.xml,sweb/toolbar/previewobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/standardbar.xml,sweb/toolbar/standardbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/starshapes.xml,sweb/toolbar/starshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/symbolshapes.xml,sweb/toolbar/symbolshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/tableobjectbar.xml,sweb/toolbar/tableobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/textobjectbar.xml,sweb/toolbar/textobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/toolbar.xml,sweb/toolbar/toolbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sweb/toolbar/viewerbar.xml,sweb/toolbar/viewerbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/menubar/menubar.xml,swform/menubar/menubar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/statusbar/statusbar.xml,swform/statusbar/statusbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/alignmentbar.xml,swform/toolbar/alignmentbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/arrowshapes.xml,swform/toolbar/arrowshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/basicshapes.xml,swform/toolbar/basicshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/bezierobjectbar.xml,swform/toolbar/bezierobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/calloutshapes.xml,swform/toolbar/calloutshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/colorbar.xml,swform/toolbar/colorbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/drawbar.xml,swform/toolbar/drawbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/drawingobjectbar.xml,swform/toolbar/drawingobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/drawtextobjectbar.xml,swform/toolbar/drawtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/extrusionobjectbar.xml,swform/toolbar/extrusionobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/flowchartshapes.xml,swform/toolbar/flowchartshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/fontworkobjectbar.xml,swform/toolbar/fontworkobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/fontworkshapetype.xml,swform/toolbar/fontworkshapetype.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/formcontrols.xml,swform/toolbar/formcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/formdesign.xml,swform/toolbar/formdesign.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/formsfilterbar.xml,swform/toolbar/formsfilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/formsnavigationbar.xml,swform/toolbar/formsnavigationbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/formtextobjectbar.xml,swform/toolbar/formtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/frameobjectbar.xml,swform/toolbar/frameobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/fullscreenbar.xml,swform/toolbar/fullscreenbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/graffilterbar.xml,swform/toolbar/graffilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/graphicobjectbar.xml,swform/toolbar/graphicobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/insertbar.xml,swform/toolbar/insertbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/insertobjectbar.xml,swform/toolbar/insertobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/mediaobjectbar.xml,swform/toolbar/mediaobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/moreformcontrols.xml,swform/toolbar/moreformcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/numobjectbar.xml,swform/toolbar/numobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/oleobjectbar.xml,swform/toolbar/oleobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/optimizetablebar.xml,swform/toolbar/optimizetablebar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/previewobjectbar.xml,swform/toolbar/previewobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/standardbar.xml,swform/toolbar/standardbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/starshapes.xml,swform/toolbar/starshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/symbolshapes.xml,swform/toolbar/symbolshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/tableobjectbar.xml,swform/toolbar/tableobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/textobjectbar.xml,swform/toolbar/textobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/toolbar.xml,swform/toolbar/toolbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swform/toolbar/viewerbar.xml,swform/toolbar/viewerbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/menubar/menubar.xml,swreport/menubar/menubar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/statusbar/statusbar.xml,swreport/statusbar/statusbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/alignmentbar.xml,swreport/toolbar/alignmentbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/arrowshapes.xml,swreport/toolbar/arrowshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/basicshapes.xml,swreport/toolbar/basicshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/bezierobjectbar.xml,swreport/toolbar/bezierobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/calloutshapes.xml,swreport/toolbar/calloutshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/colorbar.xml,swreport/toolbar/colorbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/drawbar.xml,swreport/toolbar/drawbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/drawingobjectbar.xml,swreport/toolbar/drawingobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/drawtextobjectbar.xml,swreport/toolbar/drawtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/extrusionobjectbar.xml,swreport/toolbar/extrusionobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/flowchartshapes.xml,swreport/toolbar/flowchartshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/fontworkobjectbar.xml,swreport/toolbar/fontworkobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/fontworkshapetype.xml,swreport/toolbar/fontworkshapetype.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/formcontrols.xml,swreport/toolbar/formcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/formdesign.xml,swreport/toolbar/formdesign.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/formsfilterbar.xml,swreport/toolbar/formsfilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/formsnavigationbar.xml,swreport/toolbar/formsnavigationbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/formtextobjectbar.xml,swreport/toolbar/formtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/frameobjectbar.xml,swreport/toolbar/frameobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/fullscreenbar.xml,swreport/toolbar/fullscreenbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/graffilterbar.xml,swreport/toolbar/graffilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/graphicobjectbar.xml,swreport/toolbar/graphicobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/insertbar.xml,swreport/toolbar/insertbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/insertobjectbar.xml,swreport/toolbar/insertobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/mediaobjectbar.xml,swreport/toolbar/mediaobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/moreformcontrols.xml,swreport/toolbar/moreformcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/numobjectbar.xml,swreport/toolbar/numobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/oleobjectbar.xml,swreport/toolbar/oleobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/optimizetablebar.xml,swreport/toolbar/optimizetablebar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/previewobjectbar.xml,swreport/toolbar/previewobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/standardbar.xml,swreport/toolbar/standardbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/starshapes.xml,swreport/toolbar/starshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/symbolshapes.xml,swreport/toolbar/symbolshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/tableobjectbar.xml,swreport/toolbar/tableobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/textobjectbar.xml,swreport/toolbar/textobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/toolbar.xml,swreport/toolbar/toolbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swreport/toolbar/viewerbar.xml,swreport/toolbar/viewerbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/menubar/menubar.xml,swriter/menubar/menubar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/statusbar/statusbar.xml,swriter/statusbar/statusbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/alignmentbar.xml,swriter/toolbar/alignmentbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/arrowshapes.xml,swriter/toolbar/arrowshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/basicshapes.xml,swriter/toolbar/basicshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/bezierobjectbar.xml,swriter/toolbar/bezierobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/calloutshapes.xml,swriter/toolbar/calloutshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/colorbar.xml,swriter/toolbar/colorbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/drawbar.xml,swriter/toolbar/drawbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/drawingobjectbar.xml,swriter/toolbar/drawingobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/drawtextobjectbar.xml,swriter/toolbar/drawtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/extrusionobjectbar.xml,swriter/toolbar/extrusionobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/findbar.xml,swriter/toolbar/findbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/flowchartshapes.xml,swriter/toolbar/flowchartshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/fontworkobjectbar.xml,swriter/toolbar/fontworkobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/fontworkshapetype.xml,swriter/toolbar/fontworkshapetype.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/formcontrols.xml,swriter/toolbar/formcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/formdesign.xml,swriter/toolbar/formdesign.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/formsfilterbar.xml,swriter/toolbar/formsfilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/formsnavigationbar.xml,swriter/toolbar/formsnavigationbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/formtextobjectbar.xml,swriter/toolbar/formtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/frameobjectbar.xml,swriter/toolbar/frameobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/fullscreenbar.xml,swriter/toolbar/fullscreenbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/graffilterbar.xml,swriter/toolbar/graffilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/graphicobjectbar.xml,swriter/toolbar/graphicobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/insertbar.xml,swriter/toolbar/insertbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/mediaobjectbar.xml,swriter/toolbar/mediaobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/moreformcontrols.xml,swriter/toolbar/moreformcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/numobjectbar.xml,swriter/toolbar/numobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/oleobjectbar.xml,swriter/toolbar/oleobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/optimizetablebar.xml,swriter/toolbar/optimizetablebar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/previewobjectbar.xml,swriter/toolbar/previewobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/standardbar.xml,swriter/toolbar/standardbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/starshapes.xml,swriter/toolbar/starshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/symbolshapes.xml,swriter/toolbar/symbolshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/tableobjectbar.xml,swriter/toolbar/tableobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/textobjectbar.xml,swriter/toolbar/textobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/toolbar.xml,swriter/toolbar/toolbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/toolbar/viewerbar.xml,swriter/toolbar/viewerbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/menubar/menubar.xml,swxform/menubar/menubar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/statusbar/statusbar.xml,swxform/statusbar/statusbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/alignmentbar.xml,swxform/toolbar/alignmentbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/arrowshapes.xml,swxform/toolbar/arrowshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/basicshapes.xml,swxform/toolbar/basicshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/bezierobjectbar.xml,swxform/toolbar/bezierobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/calloutshapes.xml,swxform/toolbar/calloutshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/colorbar.xml,swxform/toolbar/colorbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/drawbar.xml,swxform/toolbar/drawbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/drawingobjectbar.xml,swxform/toolbar/drawingobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/drawtextobjectbar.xml,swxform/toolbar/drawtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/extrusionobjectbar.xml,swxform/toolbar/extrusionobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/findbar.xml,swxform/toolbar/findbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/flowchartshapes.xml,swxform/toolbar/flowchartshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/fontworkobjectbar.xml,swxform/toolbar/fontworkobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/fontworkshapetype.xml,swxform/toolbar/fontworkshapetype.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/formcontrols.xml,swxform/toolbar/formcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/formdesign.xml,swxform/toolbar/formdesign.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/formsfilterbar.xml,swxform/toolbar/formsfilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/formsnavigationbar.xml,swxform/toolbar/formsnavigationbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/formtextobjectbar.xml,swxform/toolbar/formtextobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/frameobjectbar.xml,swxform/toolbar/frameobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/fullscreenbar.xml,swxform/toolbar/fullscreenbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/graffilterbar.xml,swxform/toolbar/graffilterbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/graphicobjectbar.xml,swxform/toolbar/graphicobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/insertbar.xml,swxform/toolbar/insertbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/insertobjectbar.xml,swxform/toolbar/insertobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/mediaobjectbar.xml,swxform/toolbar/mediaobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/moreformcontrols.xml,swxform/toolbar/moreformcontrols.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/numobjectbar.xml,swxform/toolbar/numobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/oleobjectbar.xml,swxform/toolbar/oleobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/optimizetablebar.xml,swxform/toolbar/optimizetablebar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/previewobjectbar.xml,swxform/toolbar/previewobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/standardbar.xml,swxform/toolbar/standardbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/starshapes.xml,swxform/toolbar/starshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/symbolshapes.xml,swxform/toolbar/symbolshapes.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/tableobjectbar.xml,swxform/toolbar/tableobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/textobjectbar.xml,swxform/toolbar/textobjectbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/toolbar.xml,swxform/toolbar/toolbar.xml))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swxform/toolbar/viewerbar.xml,swxform/toolbar/viewerbar.xml))
diff --git a/sw/Package_xml.mk b/sw/Package_xml.mk
new file mode 100644
index 000000000000..dee52fdd97f3
--- /dev/null
+++ b/sw/Package_xml.mk
@@ -0,0 +1,29 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,sw_xml,$(SRCDIR)/sw/xml))
+$(eval $(call gb_Package_add_file,sw_xml,xml/writer.xml,writer.xml))
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
new file mode 100644
index 000000000000..ef39ad6e4c8f
--- /dev/null
+++ b/sw/inc/AnnotationWin.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * 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 _ANNOTATIONWIN_HXX
+#define _ANNOTATIONWIN_HXX
+
+#include <SidebarWin.hxx>
+
+class PopupMenu;
+class OutlinerParaObject;
+
+namespace sw { namespace annotation {
+
+class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
+{
+ public:
+ SwAnnotationWin( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits,
+ SwSidebarItem& rSidebarItem,
+ SwFmtFld* aField );
+ virtual ~SwAnnotationWin();
+
+ virtual void UpdateData();
+ virtual void SetPostItText();
+ virtual void Delete();
+ virtual void GotoPos();
+
+ virtual String GetAuthor();
+ virtual Date GetDate();
+ virtual Time GetTime();
+
+ virtual sal_uInt32 MoveCaret();
+
+ virtual bool CalcFollow();
+ void InitAnswer(OutlinerParaObject* pText);
+
+ virtual bool IsProtected();
+
+ protected:
+ virtual MenuButton* CreateMenuButton();
+
+ private:
+ virtual SvxLanguageItem GetLanguage(void);
+ sal_uInt32 CountFollowing();
+
+ SwFmtFld* mpFmtFld;
+ SwPostItField* mpFld;
+ PopupMenu* mpButtonPopup;
+
+};
+
+} } // end of namespace sw::annotation
+#endif
diff --git a/sw/inc/EnhancedPDFExportHelper.hxx b/sw/inc/EnhancedPDFExportHelper.hxx
new file mode 100644
index 000000000000..209fea22da72
--- /dev/null
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ENHANCEDPDFEXPORTHELPER_HXX
+#define _ENHANCEDPDFEXPORTHELPER_HXX
+
+#include <vcl/pdfextoutdevdata.hxx>
+#include <i18npool/lang.h>
+#include <swrect.hxx>
+#include <swtypes.hxx>
+
+#include <map>
+#include <vector>
+#include <set>
+
+namespace vcl
+{
+ class PDFExtOutDevData;
+}
+class OutputDevice;
+class SwFrm;
+class SwLinePortion;
+class SwTxtPainter;
+class SwEditShell;
+namespace rtl
+{
+ class OUString;
+}
+class MultiSelection;
+class SwTxtNode;
+class SwNumRule;
+class SwTable;
+class SwNumberTreeNode;
+class String;
+class SvxLanguageItem;
+
+
+/*
+ * Mapping of OOo elements to tagged pdf elements:
+ *
+ * OOo element tagged pdf element
+ * ----------- ------------------
+ *
+ * Grouping elements:
+ *
+ * SwRootFrm Document
+ * Part
+ * Art
+ * SwSection Sect
+ * SwFtnContFrm and SwFlyFrm Div
+ * SwFmt "Quotations" BlockQuote
+ * SwFmt "Caption" Caption
+ * SwSection (TOC) TOC
+ * SwTxtNode in TOC TOCI
+ * SwSection (Index) Index
+ *
+ * Block-Level Structure Elements:
+ *
+ * SwTxtNode P
+ * SwFmt "Heading" H
+ * SwTxtNode with Outline H1 - H6
+ * SwTxtNode with NumRule L, LI, LBody
+ * SwTable Table
+ * SwRowFrm TR
+ * SwCellFrm in Headline row or
+ * SwFtm "Table Heading" TH
+ * SwCellFrm TD
+ *
+ * Inline-Level Structure Elements:
+ *
+ * SwTxtPortion Span
+ * SwFmt "Quotation" Quote
+ * SwFtnFrm Note
+ * Form
+ * Reference
+ * SwFldPortion (AuthorityField) BibEntry
+ * SwFmt "Source Text" Code
+ * SwFtnPortion, SwFldPortion (RefField) Link
+ *
+ * Illustration elements:
+ *
+ * SwFlyFrm with SwNoTxtFrm Figure
+ * SwFlyFrm with Math OLE Object Formula
+ *
+ */
+
+struct Num_Info
+{
+ const SwFrm& mrFrm;
+ Num_Info( const SwFrm& rFrm ) : mrFrm( rFrm ) {};
+};
+
+struct Frm_Info
+{
+ const SwFrm& mrFrm;
+ Frm_Info( const SwFrm& rFrm ) : mrFrm( rFrm ) {};
+};
+
+struct Por_Info
+{
+ const SwLinePortion& mrPor;
+ const SwTxtPainter& mrTxtPainter;
+ Por_Info( const SwLinePortion& rPor, const SwTxtPainter& rTxtPainer )
+ : mrPor( rPor ), mrTxtPainter( rTxtPainer ) {};
+};
+
+struct lt_TableColumn
+{
+ bool operator()( long nVal1, long nVal2 ) const
+ {
+ return nVal1 + ( MINLAY - 1 ) < nVal2;
+ }
+};
+
+/*************************************************************************
+ * class SwTaggedPDFHelper
+ * Analyses a given frame during painting and generates the appropriate
+ * structure elements.
+ *************************************************************************/
+
+class SwTaggedPDFHelper
+{
+ private:
+
+ // This will be incremented for each BeginTag() call.
+ // It denotes the number of tags to close during EndStructureElements();
+ sal_uInt8 nEndStructureElement;
+
+ // If an already existing tag is reopened for follows of flow frames,
+ // this value stores the tag id which has to be restored.
+ sal_Int32 nRestoreCurrentTag;
+
+ vcl::PDFExtOutDevData* mpPDFExtOutDevData;
+
+ const Num_Info* mpNumInfo;
+ const Frm_Info* mpFrmInfo;
+ const Por_Info* mpPorInfo;
+
+ void BeginTag( vcl::PDFWriter::StructElement aTagRole, const String& rTagName );
+ void EndTag();
+
+ void SetAttributes( vcl::PDFWriter::StructElement eType );
+
+ // These functions are called by the c'tor, d'tor
+ void BeginNumberedListStructureElements();
+ void BeginBlockStructureElements();
+ void BeginInlineStructureElements();
+ void EndStructureElements();
+
+ bool CheckReopenTag();
+ bool CheckRestoreTag() const;
+
+ public:
+
+ // pFrmInfo != 0 => BeginBlockStructureElement
+ // pPorInfo != 0 => BeginInlineStructureElement
+ // pFrmInfo, pPorInfo = 0 => BeginNonStructureElement
+ SwTaggedPDFHelper( const Num_Info* pNumInfo, const Frm_Info* pFrmInfo, const Por_Info* pPorInfo,
+ OutputDevice& rOut );
+ ~SwTaggedPDFHelper();
+
+ static bool IsExportTaggedPDF( const OutputDevice& rOut );
+};
+
+/*************************************************************************
+ * class SwEnhancedPDFExportHelper
+ * Analyses the document structure and export Notes, Hyperlinks, References,
+ * and Outline. Link ids created during pdf export are stored in
+ * aReferenceIdMap and aHyperlinkIdMap, in order to use them during
+ * tagged pdf output. Therefore the SwEnhancedPDFExportHelper is used
+ * before painting. Unfortunately links from the EditEngine into the
+ * Writer document require to be exported after they have been painted.
+ * Therefore SwEnhancedPDFExportHelper also has to be used after the
+ * painting process, the parameter bEditEngineOnly indicated that only
+ * the bookmarks from the EditEngine have to be processed.
+ *************************************************************************/
+
+typedef std::set< long, lt_TableColumn > TableColumnsMapEntry;
+typedef std::pair< SwRect, sal_Int32 > IdMapEntry;
+typedef std::vector< IdMapEntry > LinkIdMap;
+typedef std::map< const SwTable*, TableColumnsMapEntry > TableColumnsMap;
+typedef std::map< const SwNumberTreeNode*, sal_Int32 > NumListIdMap;
+typedef std::map< const SwNumberTreeNode*, sal_Int32 > NumListBodyIdMap;
+typedef std::map< const void*, sal_Int32 > FrmTagIdMap;
+
+class SwEnhancedPDFExportHelper
+{
+ private:
+
+ SwEditShell& mrSh;
+ OutputDevice& mrOut;
+
+ MultiSelection* pPageRange;
+
+ bool mbSkipEmptyPages;
+ bool mbEditEngineOnly;
+
+ static TableColumnsMap aTableColumnsMap;
+ static LinkIdMap aLinkIdMap;
+ static NumListIdMap aNumListIdMap;
+ static NumListBodyIdMap aNumListBodyIdMap;
+ static FrmTagIdMap aFrmTagIdMap;
+
+ static LanguageType eLanguageDefault;
+
+ void EnhancedPDFExport();
+ sal_Int32 CalcOutputPageNum( const SwRect& rRect ) const;
+
+ void MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rPDFExtOutDevData,
+ const SwTxtNode& rTNd, const SwRect& rLinkRect,
+ sal_Int32 nDestId, const String& rURL, bool bIntern ) const;
+
+ public:
+
+ SwEnhancedPDFExportHelper( SwEditShell& rSh,
+ OutputDevice& rOut,
+ const rtl::OUString& rPageRange,
+ bool bSkipEmptyPages,
+ bool bEditEngineOnly );
+
+ ~SwEnhancedPDFExportHelper();
+
+ static TableColumnsMap& GetTableColumnsMap() {return aTableColumnsMap; }
+ static LinkIdMap& GetLinkIdMap() { return aLinkIdMap; }
+ static NumListIdMap& GetNumListIdMap() {return aNumListIdMap; }
+ static NumListBodyIdMap& GetNumListBodyIdMap() {return aNumListBodyIdMap; }
+ static FrmTagIdMap& GetFrmTagIdMap() { return aFrmTagIdMap; }
+
+ static LanguageType GetDefaultLanguage() {return eLanguageDefault; }
+};
+
+#endif
diff --git a/sw/inc/HandleAnchorNodeChg.hxx b/sw/inc/HandleAnchorNodeChg.hxx
new file mode 100644
index 000000000000..910ae4405f4b
--- /dev/null
+++ b/sw/inc/HandleAnchorNodeChg.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _HANDLEANCHORNODECHG_HXX
+#define _HANDLEANCHORNODECHG_HXX
+
+class SwFlyFrmFmt;
+class SwFmtAnchor;
+class SwFlyFrm;
+
+// OD 2006-02-28 #125892#
+// helper class to track change of anchor node of at-paragraph respectively
+// at-character anchored fly frames
+// if such a change happens, it has to be checked, if the count of the anchor
+// frames also change. if yes, a re-creation of the fly frames is needed:
+// - deletion of existing fly frames before the intrinsic anchor node changes
+// - creation of new fly frames after the intrinsic anchor node change.
+class SwHandleAnchorNodeChg
+{
+public:
+ /** checks, if re-creation of fly frames for an anchor node change at the
+ given fly frame format is necessary, and performs the first part.
+
+ @author OD
+
+ @param _rFlyFrmFmt
+ reference to the fly frame format instance, which is handled.
+
+ @param _rNewAnchorFmt
+ new anchor attribute, which will be applied at the given fly frame format
+
+ @param _pKeepThisFlyFrm
+ optional parameter - pointer to a fly frame of the given fly frame format,
+ which isn't deleted, if re-creation of fly frames is necessary.
+ */
+ SwHandleAnchorNodeChg( SwFlyFrmFmt& _rFlyFrmFmt,
+ const SwFmtAnchor& _rNewAnchorFmt,
+ SwFlyFrm* _pKeepThisFlyFrm = 0L );
+
+ /** calls <SwFlyFrmFmt::MakeFrms>, if re-creation of fly frames is necessary.
+
+ @author OD
+ */
+ ~SwHandleAnchorNodeChg();
+
+private:
+ // fly frame format, which is tracked for a anchor node change.
+ SwFlyFrmFmt& mrFlyFrmFmt;
+ // internal flag, which indicates that the certain anchor node change occurs
+ // and that re-creation of fly frames is necessary.
+ bool mbAnchorNodeChanged;
+
+ // no copy-constructor
+ SwHandleAnchorNodeChg( const SwHandleAnchorNodeChg& );
+ // no assignment-operator
+ void operator=( const SwHandleAnchorNodeChg );
+};
+#endif
diff --git a/sw/inc/IDocumentChartDataProviderAccess.hxx b/sw/inc/IDocumentChartDataProviderAccess.hxx
new file mode 100644
index 000000000000..46fa17feaa2e
--- /dev/null
+++ b/sw/inc/IDocumentChartDataProviderAccess.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTCHARTDATAPROVIDER_HXX_INCLUDED
+ #define IDOCUMENTCHARTDATAPROVIDER_HXX_INCLUDED
+
+#include "com/sun/star/uno/Reference.hxx"
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XModel;
+}}}}
+
+class SwTable;
+class SwChartDataProvider;
+class SwChartLockController_Helper;
+
+
+ /** Give access to the data-provider for chart
+ */
+ class IDocumentChartDataProviderAccess
+ {
+ public:
+
+ /**
+ returns or creates the data-provider for chart
+ */
+ virtual SwChartDataProvider * GetChartDataProvider( bool bCreate = false ) const = 0;
+
+ /**
+ calls createInternalDataProvider for all charts using the specified table
+ */
+ virtual void CreateChartInternalDataProviders( const SwTable *pTable ) = 0;
+
+ /**
+ returns chart controller helper that is used to lock/unlock all
+ charts when relevant parts of tables are changed
+ */
+ virtual SwChartLockController_Helper & GetChartControllerHelper() = 0;
+
+ protected:
+ virtual ~IDocumentChartDataProviderAccess() {};
+ };
+
+ #endif // IDOCUMENTCHARTDATAPROVIDER_HXX_INCLUDED
+
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
new file mode 100644
index 000000000000..3b2c5deaa556
--- /dev/null
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
+ #define IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
+
+ #ifndef _SAL_TYPES_H_
+ #include <sal/types.h>
+ #endif
+
+ class SwPaM;
+ struct SwPosition;
+ class SwNode;
+ class SwNodeRange;
+ class String;
+ class Graphic;
+ class SfxItemSet;
+ class SfxPoolItem;
+ class GraphicObject;
+ class SdrObject;
+ class SwFrmFmt;
+ class SwDrawFrmFmt;
+ class SwFlyFrmFmt;
+ class SwNodeIndex;
+
+ namespace utl { class TransliterationWrapper; }
+ namespace svt { class EmbeddedObjectRef; }
+
+ /** Text operation/manipulation interface
+ */
+ class IDocumentContentOperations
+ {
+ public:
+ enum SwMoveFlags
+ {
+ DOC_MOVEDEFAULT = 0x00,
+ DOC_MOVEALLFLYS = 0x01,
+ DOC_CREATEUNDOOBJ = 0x02,
+ DOC_MOVEREDLINES = 0x04,
+ DOC_NO_DELFRMS = 0x08
+ };
+
+ // constants for inserting text
+ enum InsertFlags
+ { INS_DEFAULT = 0x00 // no extras
+ , INS_EMPTYEXPAND = 0x01 // expand empty hints at insert position
+ , INS_NOHINTEXPAND = 0x02 // do not expand any hints at insert pos
+ , INS_FORCEHINTEXPAND = 0x04 // expand all hints at insert position
+ };
+
+ public:
+ /** Kopieren eines Bereiches im oder in ein anderes Dokument !
+ Die Position kann auch im Bereich liegen !!
+ */
+ virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll ) const = 0;
+
+ /** Loesche die Section, in der der Node steht.
+ */
+ virtual void DeleteSection(SwNode* pNode) = 0;
+
+ /** loeschen eines BereichesSwFlyFrmFmt
+ */
+ virtual bool DeleteRange(SwPaM&) = 0;
+
+ /** loeschen gesamter Absaetze
+ */
+ virtual bool DelFullPara(SwPaM&) = 0;
+
+ /** complete delete of a given PaM
+
+ OD 2009-08-20 #i100466#
+ Add optional parameter <bForceJoinNext>, default value <false>
+ Needed for hiding of deletion redlines
+ */
+ virtual bool DeleteAndJoin( SwPaM&,
+ const bool bForceJoinNext = false ) = 0;
+
+ /** verschieben eines Bereiches
+ */
+ virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0;
+
+ /** verschieben ganzer Nodes
+ */
+ virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0;
+
+ /** verschieben eines Bereiches
+ */
+ virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags) = 0;
+
+ /** Ueberschreiben eines Strings in einem bestehenden Textnode.
+ */
+ virtual bool Overwrite(const SwPaM &rRg, const String& rStr) = 0;
+
+ /** Insert string into existing text node at position rRg.Point().
+ */
+ virtual bool InsertString(const SwPaM &rRg, const String&,
+ const enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) = 0;
+
+ /** change text to Upper/Lower/Hiragana/Katagana/...
+ */
+ virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0;
+
+ /** Einfuegen einer Grafik, Formel. Die XXXX werden kopiert.
+ */
+ virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic,
+ const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
+
+ /**
+ */
+ virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
+
+ /** austauschen einer Grafik (mit Undo)
+ */
+ virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) = 0;
+
+ /** Einfuegen eines DrawObjectes. Das Object muss bereits im DrawModel
+ angemeldet sein.
+ */
+ virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*) = 0;
+
+ /** Einfuegen von OLE-Objecten.
+ */
+ virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
+
+ virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
+
+ /** Aufspalten eines Nodes an rPos (nur fuer den TxtNode implementiert)
+ */
+ virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0;
+
+ /**
+ */
+ virtual bool AppendTxtNode(SwPosition& rPos) = 0;
+
+ /** Ersetz einen selektierten Bereich in einem TextNode mit dem
+ String. Ist fuers Suchen&Ersetzen gedacht.
+ bRegExpRplc - ersetze Tabs (\\t) und setze den gefundenen String
+ ein ( nicht \& )
+ z.B.: Fnd: "zzz", Repl: "xx\t\\t..&..\&"
+ --> "xx\t<Tab>..zzz..&"
+ */
+ virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr,
+ const bool bRegExReplace) = 0;
+
+ /** Einfuegen eines Attributs. Erstreckt sich rRg ueber
+ mehrere Nodes, wird das Attribut aufgespaltet, sofern
+ dieses Sinn macht. Nodes, in denen dieses Attribut keinen
+ Sinn macht, werden ignoriert. In vollstaendig in der
+ Selektion eingeschlossenen Nodes wird das Attribut zu
+ harter Formatierung, in den anderen (Text-)Nodes wird das
+ Attribut in das Attributearray eingefuegt. Bei einem
+ Zeichenattribut wird ein "leerer" Hint eingefuegt,
+ wenn keine Selektion
+ vorliegt; andernfalls wird das Attribut als harte
+ Formatierung dem durch rRg.Start() bezeichneten Node
+ hinzugefuegt. Wenn das Attribut nicht eingefuegt werden
+ konnte, liefert die Methode sal_False.
+ */
+ virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
+ const sal_uInt16 nFlags) = 0;
+
+ /**
+ */
+ virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
+ const sal_uInt16 nFlags) = 0;
+
+ /** Removes any leading white space from the paragraph
+ */
+ virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0;
+
+ protected:
+ virtual ~IDocumentContentOperations() {};
+};
+
+#endif // IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
+
diff --git a/sw/inc/IDocumentDeviceAccess.hxx b/sw/inc/IDocumentDeviceAccess.hxx
new file mode 100755
index 000000000000..42923a2fadf4
--- /dev/null
+++ b/sw/inc/IDocumentDeviceAccess.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTDEVICEACCESS_HXX_INCLUDED
+ #define IDOCUMENTDEVICEACCESS_HXX_INCLUDED
+
+ class SfxPrinter;
+ class JobSetup;
+ class SwPrintData;
+ class VirtualDevice;
+ class OutputDevice;
+
+ /** Provides access to the formatting devices of a document
+ */
+ class IDocumentDeviceAccess
+ {
+ public:
+
+ /** Return the printer set at the document.
+
+ @param bCreate
+ [in] if set, a printer will be created if not already done.
+
+ @returns
+ the printer set at the document.
+ */
+ virtual SfxPrinter* getPrinter(/*[in]*/ bool bCreate ) const = 0;
+
+ /** Set the printer at the document.
+
+ @param pP
+ [in] the new printer or 0.
+
+ @param bDeleteOld
+ [in] if set, the old printer will be deleted.
+
+ @param bCallPrtDataChanged
+ [in] if set, triggers all necessary invalidations.
+
+ @returns
+ the printer set at the document.
+ */
+ virtual void setPrinter(/*[in]*/ SfxPrinter* pP,/*[in]*/ bool bDeleteOld,/*[in]*/ bool bCallPrtDataChanged ) = 0;
+
+ /** Return the virtual device set at the document.
+
+ @param bCreate
+ [in] if set, a virtual device will be created if not already done.
+
+ @returns
+ the virtual device set at the document.
+ */
+ virtual VirtualDevice* getVirtualDevice(/*[in]*/ bool bCreate ) const = 0;
+
+ /** Sets the current virtual device
+
+ @param pVd
+ [in] the new virtual device.
+
+ @param bDeleteOld
+ [in] if set, the old virtual device will be deleted.
+
+ @param bCallVirDevDataChanged
+ [in] if set, triggers all necessary invalidations.
+ */
+ virtual void setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*/ bool bDeleteOld, /*[in]*/ bool bCallVirDevDataChanged ) = 0;
+
+ /** Returns the current reference device
+
+ @param bCreate
+ [in] if set, the reference device will be created if not already done.
+
+ @returns
+ the current reference device
+ */
+ virtual OutputDevice* getReferenceDevice(/*[in]*/ bool bCreate ) const = 0;
+
+ /** Sets the type of the reference device used for formatting the document
+
+ @param bNewVirtual
+ [in] if set, the reference device will be a virtual device, otherwise
+ the printer is used for formatting the document
+
+ @param bNewHiRes
+ [in] if set, the virtual device will be the HiRes virtual device
+ */
+ virtual void setReferenceDeviceType(/*[in]*/ bool bNewVirtual, /*[in]*/ bool bNewHiRes ) = 0;
+
+ /** Returns the Jobsetup
+
+ @returns
+ the current Jobsetup
+ */
+ virtual const JobSetup* getJobsetup() const = 0;
+
+ /** Sets the Jobsetup
+
+ @param rJobSetup
+ [in] the new Jobsetup.
+ */
+ virtual void setJobsetup(/*[in]*/ const JobSetup& rJobSetup ) = 0;
+
+ /** Returns the PrintData
+
+ @returns
+ the current PrintData
+ */
+ virtual const SwPrintData & getPrintData() const = 0;
+
+ /** Sets the PrintData
+
+ @param rPrtData
+ [in] the new PrintData.
+ */
+ virtual void setPrintData(/*[in]*/ const SwPrintData& rPrtData) = 0;
+
+ protected:
+ virtual ~IDocumentDeviceAccess() {};
+ };
+
+ #endif // IDOCUMENTDEVICEACCESS_HXX_INCLUDED
diff --git a/sw/inc/IDocumentDrawModelAccess.hxx b/sw/inc/IDocumentDrawModelAccess.hxx
new file mode 100644
index 000000000000..916554b69770
--- /dev/null
+++ b/sw/inc/IDocumentDrawModelAccess.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef IDOCUMENTDRAWMODEL_HXX_INCLUDED
+#define IDOCUMENTDRAWMODEL_HXX_INCLUDED
+
+#include <svx/svdtypes.hxx>
+
+class SdrModel;
+class SdrPageView;
+
+/** IDocumentDrawModelAccess
+ */
+class IDocumentDrawModelAccess
+{
+public:
+
+ /** Draw Model and id accessors
+ */
+ virtual const SdrModel* GetDrawModel() const = 0;
+ virtual SdrModel* GetDrawModel() = 0;
+ virtual SdrModel* _MakeDrawModel() = 0;
+ virtual SdrModel* GetOrCreateDrawModel() = 0;
+ virtual SdrLayerID GetHeavenId() const = 0;
+ virtual SdrLayerID GetHellId() const = 0;
+ virtual SdrLayerID GetControlsId() const = 0;
+ virtual SdrLayerID GetInvisibleHeavenId() const = 0;
+ virtual SdrLayerID GetInvisibleHellId() const = 0;
+ virtual SdrLayerID GetInvisibleControlsId() const = 0;
+
+ /** method to notify drawing page view about the invisible layers
+ OD 26.06.2003 #108784#
+ @author OD
+ */
+ virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView ) = 0;
+
+ /** method to determine, if a layer ID belongs to the visible ones.
+ OD 25.06.2003 #108784#
+ Note: If given layer ID is unknown, method asserts and returns <false>.
+ @author OD
+
+ @param _nLayerId
+ input parameter - layer ID, which has to be checked, if it belongs to
+ the visible ones.
+
+ @return bool, indicating, if given layer ID belongs to the visible ones.
+ */
+ virtual bool IsVisibleLayerId( const SdrLayerID& _nLayerId ) const = 0;
+
+ /** method to determine, if the corresponding visible layer ID for a invisible one.
+
+ OD 25.06.2003 #108784#
+ Note: If given layer ID is a visible one, method returns given layer ID.
+ Note: If given layer ID is unknown, method returns given layer ID.
+
+ @author OD
+
+ @param _nInvisibleLayerId
+ input parameter - invisible layer ID for which the corresponding
+ visible one has to be returned.
+
+ @return sal_Int8, visible layer ID corresponding to given layer ID
+ */
+ virtual SdrLayerID GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId ) = 0;
+
+ /** method to determine, if the corresponding invisible layer ID for a visible one.
+
+ OD 25.06.2003 #108784#
+ Note: If given layer ID is a invisible one, method returns given layer ID.
+ Note: If given layer ID is unknown, method returns given layer ID.
+
+ @author OD
+
+ @param _nVisibleLayerId
+ input parameter - visible layer ID for which the corresponding
+ invisible one has to be returned.
+
+ @return sal_Int8, invisible layer ID corresponding to given layer ID
+ */
+ virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId ) = 0;
+
+protected:
+
+ virtual ~IDocumentDrawModelAccess() {};
+};
+
+#endif
diff --git a/sw/inc/IDocumentExternalData.hxx b/sw/inc/IDocumentExternalData.hxx
new file mode 100644
index 000000000000..51051e4fa020
--- /dev/null
+++ b/sw/inc/IDocumentExternalData.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 INCLUDED_I_DOCUMENT_EXTERNAL_DATA_HXX
+#define INCLUDED_I_DOCUMENT_EXTERNAL_DATA_HXX
+
+#include <hash_map>
+#include <boost/shared_ptr.hpp>
+
+namespace sw
+{
+enum tExternalDataType { FIB, STTBF_ASSOC };
+
+struct ExternalDataTypeHash
+{
+ size_t operator()(tExternalDataType eType) const { return eType; }
+};
+
+class ExternalData
+{
+public:
+ ExternalData() {}
+ virtual ~ExternalData() {}
+};
+
+typedef ::boost::shared_ptr<ExternalData> tExternalDataPointer;
+}
+
+
+class IDocumentExternalData
+{
+protected:
+ typedef ::std::hash_map<sw::tExternalDataType, sw::tExternalDataPointer, sw::ExternalDataTypeHash>
+ tExternalData;
+
+ tExternalData m_externalData;
+
+ virtual ~IDocumentExternalData() {};
+
+public:
+ virtual void setExternalData(sw::tExternalDataType eType,
+ sw::tExternalDataPointer pPayload) = 0;
+ virtual sw::tExternalDataPointer getExternalData(sw::tExternalDataType eType) = 0;
+};
+
+#endif //INCLUDED_I_DOCUMENT_EXTERNAL_DATA_HXX
diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx
new file mode 100644
index 000000000000..be17fb7636f5
--- /dev/null
+++ b/sw/inc/IDocumentFieldsAccess.hxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTFIELDSACCESS_HXX_INCLUDED
+#define IDOCUMENTFIELDSACCESS_HXX_INCLUDED
+
+#include <sal/types.h>
+#include <tools/solar.h>
+
+class SwFldTypes;
+class SwFieldType;
+class SfxPoolItem;
+struct SwPosition;
+class SwDocUpdtFld;
+class SwCalc;
+class SwTxtFld;
+class SwField;
+class SwMsgPoolItem;
+class DateTime;
+class _SetGetExpFld;
+struct SwHash;
+class String;
+class SwNode;
+
+namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
+
+ /** Document fields related interfaces
+ */
+ class IDocumentFieldsAccess
+ {
+ public:
+ /**
+ */
+ virtual const SwFldTypes *GetFldTypes() const = 0;
+
+ /**
+ */
+ virtual SwFieldType *InsertFldType(const SwFieldType &) = 0;
+
+ /**
+ */
+ virtual SwFieldType *GetSysFldType( const sal_uInt16 eWhich ) const = 0;
+
+ /**
+ */
+ virtual SwFieldType* GetFldType(sal_uInt16 nResId, const String& rName, bool bDbFieldMatching) const = 0;
+
+ /**
+ */
+ virtual void RemoveFldType(sal_uInt16 nFld) = 0;
+
+ /**
+ */
+ virtual void UpdateFlds( SfxPoolItem* pNewHt, bool bCloseDB) = 0;
+
+ /**
+ */
+ virtual void InsDeletedFldType(SwFieldType &) = 0;
+
+ // #111840#
+ /**
+ Puts a value into a field at a certain position.
+
+ A missing field at the given position leads to a failure.
+
+ @param rPosition position of the field
+ @param rVal the value
+ @param nMId
+
+ @retval sal_True putting of value was successful
+ @retval sal_False else
+ */
+ virtual bool PutValueToField(const SwPosition & rPos, const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich) = 0;
+
+ // rufe das Update der Expression Felder auf; alle Ausdruecke werden
+ // neu berechnet.
+ // #111840#
+
+ /** Updates a field.
+
+ @param rDstFmtFld field to update
+ @param rSrcFld field containing the new values
+ @param pMsgHnt
+ @param bUpdateTblFlds TRUE: update table fields, too.
+
+ @retval sal_True update was successful
+ @retval sal_False else
+ */
+ virtual bool UpdateFld(SwTxtFld * rDstFmtFld, SwField & rSrcFld, SwMsgPoolItem * pMsgHnt, bool bUpdateTblFlds) = 0;
+
+ /**
+ */
+ virtual void UpdateRefFlds(SfxPoolItem* pHt) = 0;
+
+ /**
+ */
+ virtual void UpdateTblFlds(SfxPoolItem* pHt) = 0;
+
+ /**
+ */
+ virtual void UpdateExpFlds(SwTxtFld* pFld, bool bUpdateRefFlds) = 0;
+
+ /**
+ */
+ virtual void UpdateUsrFlds() = 0;
+
+ /**
+ */
+ virtual void UpdatePageFlds(SfxPoolItem*) = 0;
+
+ /**
+ */
+ virtual void LockExpFlds() = 0;
+
+ /**
+ */
+ virtual void UnlockExpFlds() = 0;
+
+ /**
+ */
+ virtual bool IsExpFldsLocked() const = 0;
+
+
+ virtual SwDocUpdtFld& GetUpdtFlds() const = 0;
+
+ /* @@@MAINTAINABILITY-HORROR@@@
+ SwNode (see parameter pChk) is (?) part of the private
+ data structure of SwDoc and should not be exposed
+ */
+ virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen) = 0;
+
+ /**
+ */
+ virtual void SetFixFields(bool bOnlyTimeDate, const DateTime* pNewDateTime) = 0;
+
+ // Setze im Calculator alle SetExpresion Felder, die bis zur
+ // angegebenen Position (Node [ + ::com::sun::star::ucb::Content]) gueltig sind. Es kann
+ // eine erzeugte Liste aller Felder mit uebergegeben werden.
+ // (ist die Adresse != 0, und der Pointer == 0 wird eine neue
+ // Liste returnt.)
+ virtual void FldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt) = 0;
+
+ /**
+ */
+ virtual void FldsToCalc(SwCalc& rCalc, const _SetGetExpFld& rToThisFld) = 0;
+
+ /**
+ */
+ virtual void FldsToExpand(SwHash**& ppTbl, sal_uInt16& rTblSize, const _SetGetExpFld& rToThisFld) = 0;
+
+ /**
+ */
+ virtual bool IsNewFldLst() const = 0;
+
+ /**
+ */
+ virtual void SetNewFldLst( bool bFlag) = 0;
+
+ /**
+ */
+ virtual void InsDelFldInFldLst(bool bIns, const SwTxtFld& rFld) = 0;
+
+protected:
+ virtual ~IDocumentFieldsAccess() {};
+ };
+
+ #endif // IDOCUMENTLINKSADMINISTRATION_HXX_INCLUDED
diff --git a/sw/inc/IDocumentLayoutAccess.hxx b/sw/inc/IDocumentLayoutAccess.hxx
new file mode 100644
index 000000000000..ee04ec055f1a
--- /dev/null
+++ b/sw/inc/IDocumentLayoutAccess.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTLAYOUTACCESS_HXX_INCLUDED
+#define IDOCUMENTLAYOUTACCESS_HXX_INCLUDED
+
+#include <swtypes.hxx>
+
+class ViewShell;
+class SwRootFrm;
+class SwFrmFmt;
+class SfxItemSet;
+class SwLayouter;
+class SwFmtAnchor;
+
+/** Provides access to the layout of a document.
+*/
+class IDocumentLayoutAccess
+{
+public:
+
+ /** Returns the layout set at the document.
+ */
+ virtual const ViewShell* GetCurrentViewShell() const = 0;
+ virtual ViewShell* GetCurrentViewShell() = 0; //swmod 071107//swmod 071225
+ virtual const SwRootFrm* GetCurrentLayout() const = 0;
+ virtual SwRootFrm* GetCurrentLayout() = 0; //swmod 080218
+ virtual bool HasLayout() const = 0;
+
+ /** !!!The old layout must be deleted!!!
+ */
+ virtual void SetCurrentViewShell( ViewShell* pNew ) = 0; //swmod 071107//swmod 071225
+
+ /**
+ */
+ virtual SwFrmFmt* MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) = 0;
+
+ /**
+ */
+ virtual SwLayouter* GetLayouter() = 0;
+ virtual const SwLayouter* GetLayouter() const = 0;
+ virtual void SetLayouter( SwLayouter* pNew ) = 0;
+
+ /**
+ */
+ virtual void DelLayoutFmt( SwFrmFmt *pFmt ) = 0;
+
+ /**
+ */
+ virtual SwFrmFmt* CopyLayoutFmt( const SwFrmFmt& rSrc, const SwFmtAnchor& rNewAnchor,
+ bool bSetTxtFlyAtt, bool bMakeFrms ) = 0;
+
+protected:
+
+ virtual ~IDocumentLayoutAccess() {};
+ };
+
+ #endif // IDOCUMENTLAYOUTACCESS_HXX_INCLUDED
diff --git a/sw/inc/IDocumentLineNumberAccess.hxx b/sw/inc/IDocumentLineNumberAccess.hxx
new file mode 100644
index 000000000000..77c4c9e02307
--- /dev/null
+++ b/sw/inc/IDocumentLineNumberAccess.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTLINENUMBERACCESS_HXX_INCLUDED
+ #define IDOCUMENTLINENUMBERACCESS_HXX_INCLUDED
+
+ #ifndef _SAL_TYPES_H_
+ #include <sal/types.h>
+ #endif
+
+class SwLineNumberInfo;
+
+ /** Access to the line number information
+ */
+ class IDocumentLineNumberAccess
+ {
+ public:
+
+ virtual const SwLineNumberInfo& GetLineNumberInfo() const = 0;
+ virtual void SetLineNumberInfo(const SwLineNumberInfo& rInfo) = 0;
+
+ protected:
+ virtual ~IDocumentLineNumberAccess() {};
+};
+
+#endif // IDOCUMENTLINENUMBERACCESS_HXX_INCLUDED
+
diff --git a/sw/inc/IDocumentLinksAdministration.hxx b/sw/inc/IDocumentLinksAdministration.hxx
new file mode 100644
index 000000000000..44fd8c148044
--- /dev/null
+++ b/sw/inc/IDocumentLinksAdministration.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef IDOCUMENTLINKSADMINISTRATION_HXX_INCLUDED
+#define IDOCUMENTLINKSADMINISTRATION_HXX_INCLUDED
+
+#include <tools/solar.h>
+
+class String;
+namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
+namespace sfx2 { class SvLinkSource; class LinkManager; }
+
+ /** Document links administration interface
+ */
+ class IDocumentLinksAdministration
+ {
+ public:
+ /** Links un-/sichtbar in LinkManager einfuegen (gelinkte Bereiche)
+ */
+ virtual bool IsVisibleLinks() const = 0;
+
+ /**
+ */
+ virtual void SetVisibleLinks(bool bFlag) = 0;
+
+ /**
+ */
+ virtual sfx2::LinkManager& GetLinkManager() = 0;
+
+ /**
+ */
+ virtual const sfx2::LinkManager& GetLinkManager() const = 0;
+
+ /** FME 2005-02-25 #i42634# Moved common code of SwReader::Read() and
+ SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks():
+ */
+ virtual void UpdateLinks(sal_Bool bUI) = 0;
+
+ /** SS fuers Linken von Dokumentteilen
+ */
+ virtual bool GetData(const String& rItem, const String& rMimeType, ::com::sun::star::uno::Any& rValue) const = 0;
+
+ /**
+ */
+ virtual bool SetData(const String& rItem, const String& rMimeType, const ::com::sun::star::uno::Any& rValue) = 0;
+
+ /**
+ */
+ virtual ::sfx2::SvLinkSource* CreateLinkSource(const String& rItem) = 0;
+
+ /** embedded alle lokalen Links (Bereiche/Grafiken)
+ */
+ virtual bool EmbedAllLinks() = 0;
+
+ /**
+ */
+ virtual void SetLinksUpdated(const bool bNewLinksUpdated) = 0;
+
+ /**
+ */
+ virtual bool LinksUpdated() const = 0;
+
+protected:
+ virtual ~IDocumentLinksAdministration() {};
+ };
+
+ #endif // IDOCUMENTLINKSADMINISTRATION_HXX_INCLUDED
diff --git a/sw/inc/IDocumentListItems.hxx b/sw/inc/IDocumentListItems.hxx
new file mode 100644
index 000000000000..0232fc86f104
--- /dev/null
+++ b/sw/inc/IDocumentListItems.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef IDOCUMENTLISTITEMS_HXX_INCLUDED
+#define IDOCUMENTLISTITEMS_HXX_INCLUDED
+
+#include <vector>
+#include <tools/string.hxx>
+class SwNodeNum;
+
+/** Provides numbered items of a document.
+*/
+class IDocumentListItems
+{
+public:
+ typedef ::std::vector< const SwNodeNum* > tSortedNodeNumList;
+
+ virtual void addListItem( const SwNodeNum& rNodeNum ) = 0;
+ virtual void removeListItem( const SwNodeNum& rNodeNum ) = 0;
+
+ virtual String getListItemText( const SwNodeNum& rNodeNum,
+ const bool bWithNumber = true,
+ const bool bWithSpacesForLevel = false ) const = 0;
+
+ /** get vector of all list items
+ */
+ virtual void getListItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const = 0;
+
+ /** get vector of all list items, which are numbered
+ */
+ virtual void getNumItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const = 0;
+
+protected:
+ virtual ~IDocumentListItems() {};
+};
+
+ #endif // IDOCUMENTLISTITEMS_HXX_INCLUDED
diff --git a/sw/inc/IDocumentListsAccess.hxx b/sw/inc/IDocumentListsAccess.hxx
new file mode 100644
index 000000000000..e811496edc56
--- /dev/null
+++ b/sw/inc/IDocumentListsAccess.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef IDOCUMENTLISTSACCESS_HXX_INCLUDED
+#define IDOCUMENTLISTSACCESS_HXX_INCLUDED
+
+#include <tools/string.hxx>
+
+class SwList;
+
+/** Provides access to the lists of a document.
+*/
+class IDocumentListsAccess
+{
+ public:
+ virtual SwList* createList( String sListId,
+ const String sDefaultListStyleName ) = 0;
+ virtual void deleteList( const String sListId ) = 0;
+ virtual SwList* getListByName( const String sListId ) const = 0;
+
+ virtual SwList* createListForListStyle( const String sListStyleName ) = 0;
+ virtual SwList* getListForListStyle( const String sListStyleName ) const = 0;
+ virtual void deleteListForListStyle( const String sListStyleName ) = 0;
+ // --> OD 2008-07-08 #i91400#
+ virtual void trackChangeOfListStyleName( const String sListStyleName,
+ const String sNewListStyleName ) = 0;
+ // <--
+
+ protected:
+ virtual ~IDocumentListsAccess() {};
+};
+
+#endif // IDOCUMENTLISTSACCESS_HXX_INCLUDED
diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
new file mode 100644
index 000000000000..55fc0901a7e0
--- /dev/null
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTMARKACCESS_HXX_INCLUDED
+#define IDOCUMENTMARKACCESS_HXX_INCLUDED
+
+#include <sal/types.h>
+#include <IMark.hxx>
+#include <boost/shared_ptr.hpp>
+
+class SwPaM;
+class KeyCode;
+class String;
+struct SwPosition;
+class SwTxtNode;
+
+namespace sw { namespace mark {
+ class SaveBookmark; // FIXME: Ugly: SaveBookmark is a core-internal class, and should not be used in the interface
+}}
+
+/** Provides access to the marks of a document.
+*/
+class IDocumentMarkAccess
+{
+ public:
+ enum MarkType
+ {
+ UNO_BOOKMARK,
+ DDE_BOOKMARK,
+ BOOKMARK,
+ CROSSREF_HEADING_BOOKMARK,
+ CROSSREF_NUMITEM_BOOKMARK,
+ TEXT_FIELDMARK,
+ CHECKBOX_FIELDMARK,
+ NAVIGATOR_REMINDER
+ };
+
+ typedef ::boost::shared_ptr< ::sw::mark::IMark> pMark_t;
+ typedef ::std::vector< pMark_t > container_t;
+ typedef container_t::iterator iterator_t;
+ typedef container_t::const_iterator const_iterator_t;
+ typedef container_t::const_reverse_iterator const_reverse_iterator_t;
+
+ /** Generates a new mark in the document for a certain selection.
+
+ @param rPaM
+ [in] the selection being marked.
+
+ @param rProposedName
+ [in] the proposed name of the new mark.
+
+ @param eMark
+ [in] the type of the new mark.
+
+ @returns
+ a pointer to the new mark (name might have changed).
+ */
+ virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM,
+ const ::rtl::OUString& rProposedName,
+ MarkType eMark) =0;
+
+ virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM,
+ const rtl::OUString& rName,
+ const rtl::OUString& rType) = 0;
+ virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM,
+ const rtl::OUString& rName,
+ const rtl::OUString& rType) = 0;
+
+ /** Returns a mark in the document for a paragraph.
+ If there is none, a mark will be created.
+
+ @param rTxtNode
+ [in] the paragraph being marked (a selection over the paragraph is marked)
+
+ @param eMark
+ [in] the type of the new mark.
+
+ @returns
+ a pointer to the new mark (name might have changed).
+ */
+ virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode,
+ MarkType eMark) =0;
+
+ /** Moves an existing mark to a new selection and performs needed updates.
+ @param io_pMark
+ [in/out] the mark to be moved
+
+ @param rPaM
+ [in] new selection to be marked
+ */
+
+ virtual void repositionMark(::sw::mark::IMark* io_pMark,
+ const SwPaM& rPaM) =0;
+
+ /** Renames an existing Mark, if possible.
+ @param io_pMark
+ [in/out] the mark to be renamed
+
+ @param rNewName
+ [in] new name for the mark
+
+ @returns false, if renaming failed (because the name is already in use)
+ */
+ virtual bool renameMark(::sw::mark::IMark* io_pMark,
+ const ::rtl::OUString& rNewName) =0;
+
+ /** Corrects marks (absolute)
+ This method ignores the previous position of the mark in the paragraph
+
+ @param rOldNode
+ [in] the node from which nodes should be moved
+
+ @param rNewPos
+ [in] new position to which marks will be moved, if nOffset == 0
+
+ @param nOffset
+ [in] the offset by which the mark gets positioned of rNewPos
+ */
+ virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode,
+ const SwPosition& rNewPos,
+ const xub_StrLen nOffset) =0;
+
+ /** Corrects marks (relative)
+ This method uses the previous position of the mark in the paragraph as offset
+
+ @param rOldNode
+ [in] the node from which nodes should be moved
+
+ @param rNewPos
+ [in] new position to which marks from the start of the paragraph will be
+ moved, if nOffset == 0
+
+ @param nOffset
+ [in] the offset by which the mark gets positioned of rNewPos in addition to
+ its old position in the paragraph
+ */
+ virtual void correctMarksRelative(const SwNodeIndex& rOldNode,
+ const SwPosition& rNewPos,
+ const xub_StrLen nOffset) =0;
+
+ /** Deletes marks in a range
+ */
+ virtual void deleteMarks(
+ const SwNodeIndex& rStt,
+ const SwNodeIndex& rEnd,
+ ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, // Ugly: SaveBookmark is core-internal
+ const SwIndex* pSttIdx,
+ const SwIndex* pEndIdx) =0;
+
+ /** Deletes a mark.
+
+ @param ppMark
+ [in] an iterator pointing to the Mark to be deleted.
+ */
+ virtual void deleteMark(const IDocumentMarkAccess::const_iterator_t ppMark) =0;
+
+ /** Deletes a mark.
+
+ @param ppMark
+ [in] the name of the mark to be deleted.
+ */
+ virtual void deleteMark(const ::sw::mark::IMark* const pMark) =0;
+
+ /** Clear (deletes) all marks.
+ */
+ virtual void clearAllMarks() =0;
+
+ /** returns a STL-like random access iterator to the begin of the sequence of marks.
+ */
+ virtual const_iterator_t getMarksBegin() const =0;
+
+ /** returns a STL-like random access iterator to the end of the sequence of marks.
+ */
+ virtual const_iterator_t getMarksEnd() const =0;
+
+ /** returns the number of marks.
+ */
+ virtual sal_Int32 getMarksCount() const =0;
+
+ /** Finds a mark by name.
+
+ @param rName
+ [in] the name of the mark to find.
+
+ @returns
+ an iterator pointing to the mark, or pointing to getMarksEnd() if nothing was found.
+ */
+ virtual const_iterator_t findMark(const ::rtl::OUString& rMark) const =0;
+
+
+ // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, CROSSREF_HEADING_BOOKMARK)
+
+ /** returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
+ */
+ virtual const_iterator_t getBookmarksBegin() const =0;
+
+ /** returns a STL-like random access iterator to the end of the sequence of IBookmarks.
+ */
+ virtual const_iterator_t getBookmarksEnd() const =0;
+
+ /** returns the number of IBookmarks.
+ */
+ virtual sal_Int32 getBookmarksCount() const =0;
+
+ /** Finds a bookmark by name.
+
+ @param rName
+ [in] the name of the bookmark to find.
+
+ @returns
+ an iterator pointing to the bookmark, or getBookmarksEnd() if nothing was found.
+ */
+ virtual const_iterator_t findBookmark(const ::rtl::OUString& rMark) const =0;
+
+
+ // Fieldmarks
+ virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& pos) const =0;
+ virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos) const =0;
+ virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos) const =0;
+
+ // Returns the MarkType used to create the mark
+ static MarkType SAL_DLLPUBLIC_EXPORT GetType(const ::sw::mark::IMark& rMark);
+ protected:
+ virtual ~IDocumentMarkAccess() {};
+};
+
+#endif // IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED
diff --git a/sw/inc/IDocumentOutlineNodes.hxx b/sw/inc/IDocumentOutlineNodes.hxx
new file mode 100644
index 000000000000..88a8148a2a52
--- /dev/null
+++ b/sw/inc/IDocumentOutlineNodes.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef IDOCUMENTOUTLINENODES_HXX_INCLUDED
+#define IDOCUMENTOUTLINENODES_HXX_INCLUDED
+
+#include <sal/types.h>
+#include <tools/string.hxx>
+#include <vector>
+class SwTxtNode;
+
+/** Provides outline nodes of a document.
+*/
+class IDocumentOutlineNodes
+{
+public:
+ typedef ::std::vector< const SwTxtNode* > tSortedOutlineNodeList;
+
+ virtual sal_Int32 getOutlineNodesCount() const = 0;
+
+ virtual int getOutlineLevel( const sal_Int32 nIdx ) const = 0;
+ virtual String getOutlineText( const sal_Int32 nIdx,
+ const bool bWithNumber = true,
+ const bool bWithSpacesForLevel = false ) const = 0;
+ virtual SwTxtNode* getOutlineNode( const sal_Int32 nIdx ) const = 0;
+
+ virtual void getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const = 0;
+
+protected:
+ virtual ~IDocumentOutlineNodes() {};
+};
+
+ #endif // IDOCUMENTOUTLINENODES_HXX_INCLUDED
diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx
new file mode 100644
index 000000000000..97570f0d0461
--- /dev/null
+++ b/sw/inc/IDocumentRedlineAccess.hxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTREDLINE_HXX_INCLUDED
+ #define IDOCUMENTREDLINE_HXX_INCLUDED
+
+ #ifndef _SAL_TYPES_H_
+ #include <sal/types.h>
+ #endif
+ #ifndef _SOLAR_H
+ #include <tools/solar.h>
+ #endif
+
+ #include <limits.h> // USHRT_MAX
+
+ #ifndef _COM_SUN_STAR_SEQUENCE_HXX_
+ #include <com/sun/star/uno/Sequence.hxx>
+ #endif
+
+ class SwRedline;
+ class SwRedlineTbl;
+ class SwPaM;
+ struct SwPosition;
+ class SwStartNode;
+ class SwNode;
+ class String;
+
+typedef sal_uInt16 RedlineMode_t;
+namespace nsRedlineMode_t
+{
+ const RedlineMode_t REDLINE_NONE = 0; // no RedlineMode
+ const RedlineMode_t REDLINE_ON = 0x01;// RedlineMode on
+ const RedlineMode_t REDLINE_IGNORE = 0x02;// ignore Redlines
+ const RedlineMode_t REDLINE_SHOW_INSERT = 0x10;// show all inserts
+ const RedlineMode_t REDLINE_SHOW_DELETE = 0x20;// show all delets
+ const RedlineMode_t REDLINE_SHOW_MASK = REDLINE_SHOW_INSERT | REDLINE_SHOW_DELETE;
+
+ // fuer die interne Verwaltung:
+ // die originalen Redlines inclusive des Contents entfernen
+ // (ClipBoard/Textbausteine)
+ const RedlineMode_t REDLINE_DELETE_REDLINES = 0x100;
+ // beim Loeschen innerhalb ein RedlineObjectes, waehrend des Appends,
+ // das DeleteRedline ignorieren
+ const RedlineMode_t REDLINE_IGNOREDELETE_REDLINES = 0x200;
+ // don't combine any readlines. This flags is may only used in the Undo.
+ const RedlineMode_t REDLINE_DONTCOMBINE_REDLINES = 0x400;
+}
+
+typedef sal_uInt16 RedlineType_t;
+namespace nsRedlineType_t
+{
+ // die RedlineTypen gehen von 0 bis 127
+ const RedlineType_t REDLINE_INSERT = 0x0;// Inhalt wurde eingefuegt
+ const RedlineType_t REDLINE_DELETE = 0x1;// Inhalt wurde geloescht
+ const RedlineType_t REDLINE_FORMAT = 0x2;// Attributierung wurde angewendet
+ const RedlineType_t REDLINE_TABLE = 0x3;// TabellenStruktur wurde veraendert
+ const RedlineType_t REDLINE_FMTCOLL = 0x4;// FormatVorlage wurde veraendert (Autoformat!)
+
+ // ab 128 koennen Flags hineinverodert werden
+ const RedlineType_t REDLINE_NO_FLAG_MASK = 0x7F;
+ //const RedlineType_t REDLINE_FLAG_MASK = 0xFF80;
+ const RedlineType_t REDLINE_FORM_AUTOFMT = 0x80;// kann als Flag im RedlineType stehen
+}
+
+/** IDocumentRedlineAccess
+*/
+class IDocumentRedlineAccess
+{
+ // Static helper functions
+public:
+ static bool IsShowChanges(const sal_uInt16 eM)
+ { return (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
+
+ static bool IsHideChanges(const sal_uInt16 eM)
+ { return nsRedlineMode_t::REDLINE_SHOW_INSERT == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
+
+ static bool IsShowOriginal(const sal_uInt16 eM)
+ { return nsRedlineMode_t::REDLINE_SHOW_DELETE == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
+
+ static bool IsRedlineOn(const sal_uInt16 eM)
+ { return nsRedlineMode_t::REDLINE_ON == (eM & (nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE )); }
+
+public:
+
+ /*************************************************
+ Query
+ *************************************************/
+
+ /** Query the currently set redline mode
+
+ @returns
+ the currently set redline mode
+ */
+ virtual RedlineMode_t GetRedlineMode() const = 0;
+
+ /** Set a new redline mode.
+
+ @param eMode
+ [in] the new redline mode.
+ */
+ virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode) = 0;
+
+ /** Set a new redline mode.
+
+ @param eMode
+ [in] the new redline mode.
+ */
+ virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode) = 0;
+
+ /** Query if redlining is on.
+
+ @returns
+ <TRUE/> if redlining is on <FALSE/> otherwise
+ */
+ virtual bool IsRedlineOn() const = 0;
+
+ /**
+ */
+ virtual bool IsIgnoreRedline() const = 0;
+
+ /**
+ */
+ virtual const SwRedlineTbl& GetRedlineTbl() const = 0;
+
+
+ /*
+ */
+ virtual bool IsInRedlines(const SwNode& rNode) const = 0;
+
+ /***************************************************
+ Manipulation
+ ***************************************************/
+
+ /** Append a new redline
+
+ @param pPtr
+
+ @param bCallDelete
+
+ @returns
+ */
+ virtual bool AppendRedline(/*[in]*/SwRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
+
+ /**
+ */
+ virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
+
+ /**
+ */
+ virtual bool DeleteRedline(
+ /*[in]*/const SwPaM& rPam,
+ /*[in]*/bool bSaveInUndo,
+ /*[in]*/sal_uInt16 nDelType) = 0;
+
+ /**
+ */
+ virtual bool DeleteRedline(
+ /*[in]*/const SwStartNode& rSection,
+ /*[in]*/bool bSaveInUndo,
+ /*[in]*/sal_uInt16 nDelType) = 0;
+
+ /**
+ */
+ virtual sal_uInt16 GetRedlinePos(
+ /*[in]*/const SwNode& rNode,
+ /*[in]*/sal_uInt16 nType) const = 0;
+
+ virtual void CompressRedlines() = 0;
+
+ /**
+ */
+ virtual const SwRedline* GetRedline(
+ /*[in]*/const SwPosition& rPos,
+ /*[in]*/sal_uInt16* pFndPos) const = 0;
+
+ /**
+ */
+ virtual bool IsRedlineMove() const = 0;
+
+ /**
+ */
+ virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0;
+
+ /**
+ */
+ virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0;
+
+ /**
+ */
+ virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
+
+ /**
+ */
+ virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0;
+
+ /**
+ */
+ virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
+
+ /**
+ */
+ virtual const SwRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0;
+
+ /**
+ */
+ virtual const SwRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0;
+
+ // alle Redline invalidieren, die Darstellung hat sich geaendert
+ virtual void UpdateRedlineAttr() = 0;
+
+ // legt gegebenenfalls einen neuen Author an
+ virtual sal_uInt16 GetRedlineAuthor() = 0;
+
+ // fuer die Reader usw. - neuen Author in die Tabelle eintragen
+ virtual sal_uInt16 InsertRedlineAuthor(const String& rAuthor) = 0;
+
+ // Kommentar am Redline an der Position setzen
+ virtual bool SetRedlineComment(
+ /*[in]*/const SwPaM& rPam,
+ /*[in]*/const String& rComment) = 0;
+
+ /**
+ */
+ virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0;
+
+ /**
+ */
+ virtual void SetRedlinePassword(
+ /*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword) = 0;
+
+ protected:
+ virtual ~IDocumentRedlineAccess() {};
+ };
+
+ #endif
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
new file mode 100644
index 000000000000..214b9769ed32
--- /dev/null
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTSETTINGACCESS_HXX_INCLUDED
+#define IDOCUMENTSETTINGACCESS_HXX_INCLUDED
+
+#include <tools/solar.h>
+#ifndef _VOS_REF_HXX
+#include <vos/ref.hxx>
+#endif
+#include <chcmprse.hxx>
+#include <fldupde.hxx>
+
+class SvxForbiddenCharactersTable;
+namespace com { namespace sun { namespace star { namespace i18n { struct ForbiddenCharacters; } } } }
+
+ /** Provides access to settings of a document
+ */
+ class IDocumentSettingAccess
+ {
+ public:
+ enum DocumentSettingId
+ {
+ // COMPATIBILITY FLAGS START
+ PARA_SPACE_MAX,
+ PARA_SPACE_MAX_AT_PAGES,
+
+ TAB_COMPAT,
+
+ ADD_FLY_OFFSETS,
+
+ OLD_NUMBERING,
+
+ ADD_EXT_LEADING,
+ USE_VIRTUAL_DEVICE,
+ USE_HIRES_VIRTUAL_DEVICE,
+ OLD_LINE_SPACING,
+ ADD_PARA_SPACING_TO_TABLE_CELLS,
+ USE_FORMER_OBJECT_POS,
+ USE_FORMER_TEXT_WRAPPING,
+ CONSIDER_WRAP_ON_OBJECT_POSITION,
+
+ IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
+ DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
+ DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
+ OUTLINE_LEVEL_YIELDS_OUTLINE_RULE,
+
+ DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
+ TABLE_ROW_KEEP,
+ IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION,
+ CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME,
+
+ UNIX_FORCE_ZERO_EXT_LEADING,
+ USE_OLD_PRINTER_METRICS,
+ TABS_RELATIVE_TO_INDENT,
+ PROTECT_FORM,
+ // --> OD 2008-06-05 #i89181#
+ TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
+ // <--
+ // COMPATIBILITY FLAGS END
+
+ BROWSE_MODE,
+ HTML_MODE,
+ GLOBAL_DOCUMENT,
+ GLOBAL_DOCUMENT_SAVE_LINKS,
+ LABEL_DOCUMENT,
+ PURGE_OLE,
+ KERN_ASIAN_PUNCTUATION,
+ MATH_BASELINE_ALIGNMENT
+ };
+
+ public:
+ /** Return the specified document setting.
+
+ @param id
+ [in] the identifier of the document setting to be returned.
+ See above for a list of valid document setting identifiers.
+
+ @returns
+ the value of the requested document setting.
+ */
+ virtual bool get(/*[in]*/ DocumentSettingId id) const = 0;
+
+ /** Set the specified document setting.
+
+ @param id
+ [in] the identifier of the document setting to be set.
+ See above for a list of valid document setting identifiers.
+
+ @param value
+ [in] the new value of the specified document setting.
+ */
+ virtual void set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) = 0;
+
+ /** Return the forbidden characters.
+
+ @param nLang
+ [in] the language for which the forbidden character list is returned.
+
+ @param bLocaleData
+ [in] if set and there is no user defined forbidden character list for
+ language lang, the default list for language lang will be returned.
+
+ @returns
+ a list of forbidden characters.
+ */
+ virtual const com::sun::star::i18n::ForbiddenCharacters*
+ getForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ bool bLocaleData ) const = 0;
+
+ /** Set the forbidden characters.
+
+ @param nLang
+ [in] the language for which the forbidden character list should be set.
+
+ @param rForbiddenCharacters
+ [in] the new list of forbidden characters for language lang.
+ */
+ virtual void setForbiddenCharacters(/*[in]*/ sal_uInt16 nLang,
+ /*[in]*/ const com::sun::star::i18n::ForbiddenCharacters& rForbiddenCharacters ) = 0;
+
+ /** Get the forbidden character table and creates one if necessary.
+
+ @returns
+ the forbidden characters table.
+ */
+ virtual vos::ORef<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() = 0;
+
+ /** Get the forbidden character table.
+
+ @returns
+ the forbidden characters table.
+ */
+ virtual const vos::ORef<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() const = 0;
+
+ /** Get the current link update mode.
+
+ @param bGlobalSettings
+ [in] if set, the link update mode is obtained from the module,
+ if it is set to GLOBALSETTING
+
+ @returns
+ the current link update mode.
+ */
+ virtual sal_uInt16 getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const = 0;
+
+ /** Set the current link update mode.
+
+ @param nMode
+ [in] the new link update mode.
+ */
+ virtual void setLinkUpdateMode( /*[in]*/ sal_uInt16 nMode ) = 0;
+
+ /** Get the current field update mode.
+
+ @param bGlobalSettings
+ [in] if set, the field update mode is obtained from the module,
+ if it is set to GLOBALSETTING
+
+ @returns
+ the current field update mode.
+ */
+ virtual SwFldUpdateFlags getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const = 0;
+
+ /** Set the current field update mode.
+
+ @param nMode
+ [in] the new field update mode.
+ */
+ virtual void setFieldUpdateFlags( /*[in]*/ SwFldUpdateFlags nMode ) = 0;
+
+ /** Get the character compression type for Asian characters.
+
+ @returns
+ the current character compression mode.
+ */
+ virtual SwCharCompressType getCharacterCompressionType() const = 0;
+
+ /** Set the character compression type for Asian characters.
+
+ @param nMode
+ [in] the new character compression type.
+ */
+ virtual void setCharacterCompressionType( /*[in]*/SwCharCompressType nType ) = 0;
+
+protected:
+ virtual ~IDocumentSettingAccess() {};
+ };
+
+#endif // IDOCUMENTSETTINGACCESS_HXX_INCLUDED
diff --git a/sw/inc/IDocumentState.hxx b/sw/inc/IDocumentState.hxx
new file mode 100644
index 000000000000..6362f6213290
--- /dev/null
+++ b/sw/inc/IDocumentState.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTSTATE_HXX_INCLUDED
+ #define IDOCUMENTSTATE_HXX_INCLUDED
+
+ #include <tools/solar.h>
+
+ /** Get information about the current document state
+ */
+ class IDocumentState
+ {
+ public:
+ /** Bei Formataenderungen muss das zu Fuss gerufen werden!
+ */
+ virtual void SetModified() = 0;
+
+ /**
+ */
+ virtual void ResetModified() = 0;
+
+ /** Dokumentaenderungen?
+ */
+ virtual bool IsModified() const = 0;
+
+ /** Zustaende ueber Ladezustand
+ frueher DocInfo
+ */
+ virtual bool IsLoaded() const = 0;
+
+ /**
+ */
+ virtual bool IsUpdateExpFld() const = 0;
+
+ /**
+ */
+ virtual bool IsNewDoc() const = 0;
+
+ /**
+ */
+ virtual bool IsPageNums() const = 0;
+
+ /**
+ */
+ virtual void SetPageNums(bool b) = 0;
+
+ /**
+ */
+ virtual void SetNewDoc(bool b) = 0;
+
+ /**
+ */
+ virtual void SetUpdateExpFldStat(bool b) = 0;
+
+ /**
+ */
+ virtual void SetLoaded(bool b = sal_True) = 0;
+
+ protected:
+ virtual ~IDocumentState() {};
+ };
+
+ #endif // IDOCUMENTSTATE_HXX_INCLUDED
diff --git a/sw/inc/IDocumentStatistics.hxx b/sw/inc/IDocumentStatistics.hxx
new file mode 100644
index 000000000000..25c2d54d71e9
--- /dev/null
+++ b/sw/inc/IDocumentStatistics.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ #ifndef IDOCUMENTSTATISTICS_HXX_INCLUDED
+ #define IDOCUMENTSTATISTICS_HXX_INCLUDED
+
+ struct SwDocStat;
+
+ /** Document statistics information
+ */
+ class IDocumentStatistics
+ {
+ public:
+
+ /** die DocInfo hat siche geaendert (Notify ueber die DocShell)
+ stosse die entsp. Felder zum Updaten an.
+ */
+ virtual void DocInfoChgd() = 0;
+
+ /** Dokument - Statistics
+ */
+ virtual const SwDocStat &GetDocStat() const = 0;
+
+ /**
+ */
+ virtual void SetDocStat(const SwDocStat& rStat) = 0;
+
+ /**
+ */
+ virtual void UpdateDocStat(SwDocStat& rStat) = 0;
+
+protected:
+ virtual ~IDocumentStatistics() {};
+ };
+
+ #endif // IDOCUMENTSTATISTICS_HXX_INCLUDED
diff --git a/sw/inc/IDocumentStylePoolAccess.hxx b/sw/inc/IDocumentStylePoolAccess.hxx
new file mode 100644
index 000000000000..743b0d3304e4
--- /dev/null
+++ b/sw/inc/IDocumentStylePoolAccess.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTSTYLEPOOLACCESS_HXX_INCLUDED
+ #define IDOCUMENTSTYLEPOOLACCESS_HXX_INCLUDED
+
+ #ifndef _SAL_TYPES_H_
+ #include <sal/types.h>
+ #endif
+
+ class SwTxtFmtColl;
+ class SwCharFmt;
+ class SwFmt;
+ class SwFrmFmt;
+ class String;
+ class SwNumRule;
+ class SwPageDesc;
+
+ /** Access to the style pool
+ */
+ class IDocumentStylePoolAccess
+ {
+ public:
+
+ /** Gebe die "Auto-Collection" mit der Id zurueck. Existiert
+ sie noch nicht, dann erzuege sie
+ Ist der String-Pointer definiert, dann erfrage nur die
+ Beschreibung der Attribute, !! es legt keine Vorlage an !!
+ */
+ virtual SwTxtFmtColl* GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage = true ) = 0;
+
+ /** return das geforderte automatische Format - Basis-Klasse !
+ */
+ virtual SwFmt* GetFmtFromPool( sal_uInt16 nId ) = 0;
+
+ /** returne das geforderte automatische Format
+ */
+ virtual SwFrmFmt* GetFrmFmtFromPool( sal_uInt16 nId ) = 0;
+
+ /**
+ */
+ virtual SwCharFmt* GetCharFmtFromPool( sal_uInt16 nId ) = 0;
+
+ /** returne die geforderte automatische Seiten-Vorlage
+ */
+ virtual SwPageDesc* GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage = true ) = 0;
+
+ /**
+ */
+ virtual SwNumRule* GetNumRuleFromPool( sal_uInt16 nId ) = 0;
+
+ /** pruefe, ob diese "Auto-Collection" in Dokument schon/noch benutzt wird
+ */
+ virtual bool IsPoolTxtCollUsed( sal_uInt16 nId ) const = 0;
+ virtual bool IsPoolFmtUsed( sal_uInt16 nId ) const = 0;
+ virtual bool IsPoolPageDescUsed( sal_uInt16 nId ) const = 0;
+
+ protected:
+ virtual ~IDocumentStylePoolAccess() {};
+};
+
+#endif // IDOCUMENTSTYLEPOOLACCESS_HXX_INCLUDED
+
diff --git a/sw/inc/IDocumentTimerAccess.hxx b/sw/inc/IDocumentTimerAccess.hxx
new file mode 100644
index 000000000000..f0d69e942af3
--- /dev/null
+++ b/sw/inc/IDocumentTimerAccess.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ #ifndef IDOCUMENTTIMERACCESS_HXX_INCLUDED
+ #define IDOCUMENTTIMERACCESS_HXX_INCLUDED
+
+ /** Get information about the current document state
+ */
+ class IDocumentTimerAccess
+ {
+ public:
+ /**
+ Set modus to start, i.e. start timer if block count == 0
+ */
+ virtual void StartIdling() = 0;
+
+ /**
+ Set modus to stopped, i.e. stop timer if running
+ */
+ virtual void StopIdling() = 0;
+
+ /**
+ Increment block count, stop timer if running
+ */
+ virtual void BlockIdling() = 0;
+
+ /**
+ Decrement block count, start timer if block count == 0 AND modus == start
+ */
+ virtual void UnblockIdling() = 0;
+
+ protected:
+ virtual ~IDocumentTimerAccess() {};
+ };
+
+ #endif // IDOCUMENTTIMERACCESS_HXX_INCLUDED
diff --git a/sw/inc/IDocumentUndoRedo.hxx b/sw/inc/IDocumentUndoRedo.hxx
new file mode 100644
index 000000000000..0d78d3b361c9
--- /dev/null
+++ b/sw/inc/IDocumentUndoRedo.hxx
@@ -0,0 +1,283 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IDOCUMENTUNDOREDO_HXX_INCLUDED
+#define IDOCUMENTUNDOREDO_HXX_INCLUDED
+
+#include <sal/types.h>
+
+#include <swundo.hxx>
+
+
+class SwRewriter;
+class SwNodes;
+class SwUndo;
+
+namespace sw {
+ class RepeatContext;
+}
+
+
+
+/** IDocumentUndoRedo
+*/
+class IDocumentUndoRedo
+{
+public:
+
+ /** Enable/Disable Undo.
+ */
+ virtual void DoUndo(bool const bDoUndo) = 0;
+
+ /** Is Undo enabled?
+ */
+ virtual bool DoesUndo() const = 0;
+
+ /** Enable/Disable Group Undo.
+ This determines whether successive Insert/Delete/Overwrite
+ actions are combined.
+ */
+ virtual void DoGroupUndo(bool const bDoUndo) = 0;
+
+ /** Is Group Undo enabled?
+ */
+ virtual bool DoesGroupUndo() const = 0;
+
+ /** Enable/Disable Undo for Drawing objects.
+ */
+ virtual void DoDrawUndo(bool const bDoUndo) = 0;
+
+ /** Is Undo for Drawing objects enabled?
+ for Draw-Undo: writer wants to handle actions on Flys on its own.
+ */
+ virtual bool DoesDrawUndo() const = 0;
+
+ /** Set the position at which the document is in the "unmodified" state
+ to the current position in the Undo stack.
+ */
+ virtual void SetUndoNoModifiedPosition() = 0;
+
+ /** Prevent updates to the "unmodified" state position
+ via SetUndoNoResetModified().
+ */
+ virtual void LockUndoNoModifiedPosition() = 0;
+
+ /** Allow updates to the "unmodified" state position
+ via SetUndoNoResetModified().
+ */
+ virtual void UnLockUndoNoModifiedPosition() = 0;
+
+ /** Disable (re)setting the document modified flag on Undo/Redo.
+ */
+ virtual void SetUndoNoResetModified() = 0;
+
+ /** Is setting the document modified flag on Undo/Redo disabled?
+ */
+ virtual bool IsUndoNoResetModified() const = 0;
+
+ /** Execute Undo.
+
+ @return true if executing the last Undo action was successful.
+ */
+ virtual sal_Bool Undo() = 0;
+
+ /** Opens undo block.
+
+ @remark StartUndo() and EndUndo() do nothing if !DoesUndo().
+
+ @param nUndoId undo ID for the list action
+ @param pRewriter rewriter for comments @see SwUndo::GetComment
+
+ If the given nUndoId is equal to zero an undo object with ID
+ UNDO_START will be generated.
+
+ @return the undo ID of the created object
+ */
+ virtual SwUndoId StartUndo(SwUndoId const eUndoId,
+ SwRewriter const*const pRewriter) = 0;
+
+ /**
+ Closes undo block.
+
+ @remark StartUndo() and EndUndo() do nothing if !DoesUndo().
+
+ @param nUndoId undo ID for the list action
+ @param pRewriter rewriter for comments @see SwUndo::GetComment
+
+ If the given nUndoId is not UNDO_EMPTY or UNDO_END, the comment of
+ the resulting list action will be set via the nUndoId, applying the
+ given pRewriter (if not 0). Otherwise the comment of the resulting
+ list action is unchanged if it has an UndoId that is not UNDO_START
+ set by StartUndo, and in case the UndoId is UNDO_START the comment
+ of the list action defaults to the comment of the last action
+ contained in the list action.
+ */
+ virtual SwUndoId EndUndo(SwUndoId const eUndoId,
+ SwRewriter const*const pRewriter) = 0;
+
+ /** <- #111827#
+ Delete all Undo actions.
+ Of course Undo will be disabled during deletion.
+ */
+ virtual void DelAllUndoObj() = 0;
+
+ /** Get Id and comment of last Undo action.
+ @param o_pStr if not 0, receives comment of last Undo action.
+ @param o_pId if not 0, receives Id of last Undo action.
+ @return true if there is a Undo action, false if none
+ */
+ virtual bool GetLastUndoInfo(::rtl::OUString *const o_pStr,
+ SwUndoId *const o_pId) const = 0;
+
+ /** Get comments of Undo actions.
+ @return comments of all top-level Undo actions.
+ */
+ virtual SwUndoComments_t GetUndoComments() const = 0;
+
+ /** Execute Redo.
+
+ @return true if executing the first Redo action was successful.
+ */
+ virtual sal_Bool Redo() = 0;
+
+ /** Get comment of first Redo action.
+ @param o_pStr if not 0, receives comment of first Redo action.
+ @return true if there is a Redo action, false if none
+ */
+ virtual bool GetFirstRedoInfo(::rtl::OUString *const o_pStr) const = 0;
+
+ /** Get comments of Redo actions.
+ @return comments of all top-level Redo actions.
+ */
+ virtual SwUndoComments_t GetRedoComments() const = 0;
+
+ /** Repeat the last Undo action.
+ @return true if repeating the last Undo Redo action was attempted.
+ */
+ virtual bool Repeat(::sw::RepeatContext & rContext,
+ sal_uInt16 const nRepeatCnt) = 0;
+
+ /** Get Id and comment of last Undo action, if it is Repeat capable.
+ @param o_pStr if not 0, receives comment of last Undo action
+ if it is Repeat capable.
+ @return Id of last Undo action if it is Repeat capable,
+ or UNDO_EMPTY if there is none or it is not Repeat capable.
+ */
+ virtual SwUndoId GetRepeatInfo(::rtl::OUString *const o_pStr) const = 0;
+
+ /** Add new Undo action.
+ Takes over ownership of pUndo.
+ @remark calls ClearRedo(), except for UNDO_START/UNDO_END.
+ @remark does nothing if !DoesUndo().
+ */
+ virtual void AppendUndo(SwUndo *const pUndo) = 0;
+
+ /** Delete all Redo actions.
+ */
+ virtual void ClearRedo() = 0;
+
+ /* Is the given nodes array the Undo nodes array?
+ */
+ virtual bool IsUndoNodes(SwNodes const& rNodes) const = 0;
+
+protected:
+ virtual ~IDocumentUndoRedo() {};
+};
+
+
+namespace sw {
+
+class UndoGuard
+{
+public:
+
+ UndoGuard(IDocumentUndoRedo & rUndoRedo)
+ : m_rUndoRedo(rUndoRedo)
+ , m_bUndoWasEnabled(rUndoRedo.DoesUndo())
+ {
+ m_rUndoRedo.DoUndo(false);
+ }
+ ~UndoGuard()
+ {
+ m_rUndoRedo.DoUndo(m_bUndoWasEnabled);
+ }
+
+ bool UndoWasEnabled() const
+ {
+ return m_bUndoWasEnabled;
+ }
+
+private:
+ IDocumentUndoRedo & m_rUndoRedo;
+ bool const m_bUndoWasEnabled;
+};
+
+class GroupUndoGuard
+{
+public:
+
+ GroupUndoGuard(IDocumentUndoRedo & rUndoRedo)
+ : m_rUndoRedo(rUndoRedo)
+ , m_bGroupUndoWasEnabled(rUndoRedo.DoesGroupUndo())
+ {
+ m_rUndoRedo.DoGroupUndo(false);
+ }
+ ~GroupUndoGuard()
+ {
+ m_rUndoRedo.DoGroupUndo(m_bGroupUndoWasEnabled);
+ }
+
+private:
+ IDocumentUndoRedo & m_rUndoRedo;
+ bool const m_bGroupUndoWasEnabled;
+};
+
+class DrawUndoGuard
+{
+public:
+
+ DrawUndoGuard(IDocumentUndoRedo & rUndoRedo)
+ : m_rUndoRedo(rUndoRedo)
+ , m_bDrawUndoWasEnabled(rUndoRedo.DoesDrawUndo())
+ {
+ m_rUndoRedo.DoDrawUndo(false);
+ }
+ ~DrawUndoGuard()
+ {
+ m_rUndoRedo.DoDrawUndo(m_bDrawUndoWasEnabled);
+ }
+
+private:
+ IDocumentUndoRedo & m_rUndoRedo;
+ bool const m_bDrawUndoWasEnabled;
+};
+
+
+} // namespace sw
+
+#endif
+
diff --git a/sw/inc/IGrammarContact.hxx b/sw/inc/IGrammarContact.hxx
new file mode 100644
index 000000000000..44c54b55fe9f
--- /dev/null
+++ b/sw/inc/IGrammarContact.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IGRAMMARCONTACT_HXX_INCLUDED
+#define IGRAMMARCONTACT_HXX_INCLUDED
+
+struct SwPosition;
+class SwTxtNode;
+class SwGrammarMarkUp;
+class SwDoc;
+
+/** Organizer of the contact between SwTxtNodes and grammar checker
+*/
+class IGrammarContact
+{
+public:
+
+ /** Update cursor position reacts to a change of the current input cursor
+ As long as the cursor in inside a paragraph, the grammar checking does
+ not show new grammar faults. When the cursor leaves the paragraph, these
+ faults are shown.
+ @returns void
+ */
+ virtual void updateCursorPosition( const SwPosition& rNewPos ) = 0;
+
+ /** getGrammarCheck checks if the given text node is blocked by the current cursor
+ if not, the normal markup list is returned
+ if blocked, it will return a markup list "proxy"
+ @returns a markup list (grammar) for the given SwTxtNode
+ */
+ virtual SwGrammarMarkUp* getGrammarCheck( SwTxtNode& rTxtNode, bool bCreate ) = 0;
+
+ /** finishGrammarCheck() has to be called if a grammar checking has been completed
+ for a text node. If this text node has not been hided by the current proxy list
+ it will be repainted. Otherwise the proxy list replaces the old list and the
+ repaint will be triggered by a timer
+ @returns void
+ */
+ virtual void finishGrammarCheck( SwTxtNode& rTxtNode ) = 0;
+
+public:
+ virtual ~IGrammarContact() {}
+};
+
+/** Factory for a grammar contact
+@returns a new created grammar contact object
+*/
+IGrammarContact* createGrammarContact();
+
+/* Helper functions */
+
+/** getGrammarContact() delivers the grammar contact of the document (for a given textnode)
+@returns grammar contact
+*/
+IGrammarContact* getGrammarContact( const SwTxtNode& );
+
+/** finishGrammarCheck() calls the same function of the grammar contact of the document (for a given textnode)
+@returns void
+*/
+void finishGrammarCheck( SwTxtNode& );
+
+#endif // IGRAMMARCONTACT_HXX_INCLUDED
+
diff --git a/sw/inc/IInterface.hxx b/sw/inc/IInterface.hxx
new file mode 100644
index 000000000000..52b691c4aa85
--- /dev/null
+++ b/sw/inc/IInterface.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ #ifndef IINTERFACE_HXX_INCLUDED
+ #define IINTERFACE_HXX_INCLUDED
+
+ #include <sal/types.h>
+
+ /** The base interface
+ */
+ class IInterface
+ {
+ public:
+
+ /** Aquire a reference to an instance. A caller shall release
+ the instance by calling 'release' when it is no longer needed.
+ 'acquire' and 'release' calls need to be balanced.
+
+ @returns
+ the current reference count of the instance for debugging purposes.
+ */
+ virtual sal_Int32 acquire() = 0;
+
+ /** Releases a reference to an instance. A caller has to call
+ 'release' when a before aquired reference to an instance
+ is no longer needed. 'acquire' and 'release' calls need to
+ be balanced.
+
+ @returns
+ the current reference count of the instance for debugging purposes.
+ */
+ virtual sal_Int32 release() = 0;
+
+ /** Returns the current reference count. This method should be used for
+ debugging purposes. Using it otherwise is a signal of a design flaw.
+ */
+ virtual sal_Int32 getReferenceCount() const = 0;
+
+protected:
+ virtual ~IInterface() {};
+ };
+
+ #endif // IDOCUMENT_HXX_INCLUDED
diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx
new file mode 100644
index 000000000000..6a46ae01d49e
--- /dev/null
+++ b/sw/inc/IMark.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _IMARK_HXX
+#define _IMARK_HXX
+
+#include <vcl/keycod.hxx>
+#include <calbck.hxx>
+#include <pam.hxx>
+#include <boost/operators.hpp>
+#include <map>
+
+#ifndef SW_DECL_SWSERVEROBJECT_DEFINED
+#define SW_DECL_SWSERVEROBJECT_DEFINED
+SV_DECL_REF( SwServerObject )
+#endif
+
+
+struct SwPosition;
+
+namespace sw { namespace mark
+{
+ class IMark
+ : virtual public SwModify // inherited as interface
+ , public ::boost::totally_ordered<IMark>
+ {
+ public:
+ //getters
+ virtual const SwPosition& GetMarkPos() const =0;
+ // GetOtherMarkPos() is only guaranteed to return a valid
+ // reference if IsExpanded() returned true
+ virtual const SwPosition& GetOtherMarkPos() const =0;
+ virtual const SwPosition& GetMarkStart() const =0;
+ virtual const SwPosition& GetMarkEnd() const =0;
+ virtual const ::rtl::OUString& GetName() const =0;
+ virtual bool IsExpanded() const =0;
+ virtual bool IsCoveringPosition(const SwPosition& rPos) const =0;
+
+ //setters
+ // not available in IMark
+ // inside core, you can cast to MarkBase and use its setters,
+ // make sure to update the sortings in Markmanager in this case
+
+ //operators and comparisons (non-virtual)
+ bool operator<(const IMark& rOther) const
+ { return GetMarkStart() < rOther.GetMarkStart(); }
+ bool operator==(const IMark& rOther) const
+ { return GetMarkStart() == rOther.GetMarkStart(); }
+ bool StartsBefore(const SwPosition& rPos) const
+ { return GetMarkStart() < rPos; }
+ bool StartsAfter(const SwPosition& rPos) const
+ { return GetMarkStart() > rPos; }
+ bool EndsBefore(const SwPosition& rPos) const
+ { return GetMarkEnd() < rPos; }
+ bool EndsAfter(const SwPosition& rPos) const
+ { return GetMarkEnd() > rPos; }
+
+ virtual rtl::OUString ToString( ) const =0;
+ };
+
+ class IBookmark
+ : virtual public IMark
+ {
+ public:
+ virtual const ::rtl::OUString& GetShortName() const =0;
+ virtual const KeyCode& GetKeyCode() const =0;
+ virtual void SetShortName(const ::rtl::OUString&) =0;
+ virtual void SetKeyCode(const KeyCode&) =0;
+ };
+
+ class IFieldmark
+ : virtual public IMark
+ {
+ public:
+ typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any> parameter_map_t;
+ //getters
+ virtual ::rtl::OUString GetFieldname() const =0;
+ virtual ::rtl::OUString GetFieldHelptext() const =0;
+ virtual parameter_map_t* GetParameters() =0;
+ virtual const parameter_map_t* GetParameters() const =0;
+
+ //setters
+ virtual void SetFieldname(const ::rtl::OUString& rFieldname) =0;
+ virtual void SetFieldHelptext(const ::rtl::OUString& rFieldHelptext) =0;
+ virtual void Invalidate() = 0;
+ };
+
+ class ICheckboxFieldmark
+ : virtual public IFieldmark
+ {
+ public:
+ virtual bool IsChecked() const =0;
+ virtual void SetChecked(bool checked) =0;
+ };
+}}
+#endif
diff --git a/sw/inc/IShellCursorSupplier.hxx b/sw/inc/IShellCursorSupplier.hxx
new file mode 100644
index 000000000000..a160f43d40dd
--- /dev/null
+++ b/sw/inc/IShellCursorSupplier.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 ISHELLCURSORSUPPLIER_HXX
+#define ISHELLCURSORSUPPLIER_HXX
+
+
+class SwPaM;
+
+
+namespace sw {
+
+/** The Undo actions need to create new Shell cursors.
+ Just creating new SwPaMs in the Undo actions is not sufficient,
+ because only Shell cursors are corrected by doccorr.cxx.
+ */
+class IShellCursorSupplier
+{
+public:
+ virtual ~IShellCursorSupplier() { }
+ virtual SwPaM & CreateNewShellCursor() = 0;
+ virtual SwPaM & GetCurrentShellCursor() = 0;
+};
+
+} // namespace sw
+
+#endif // ISHELLCURSORSUPPLIER_HXX
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
new file mode 100644
index 000000000000..17000a4657c7
--- /dev/null
+++ b/sw/inc/PostItMgr.hxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _POSTITMGR_HXX
+#define _POSTITMGR_HXX
+
+#include <list>
+#include <vector>
+#include <editeng/outlobj.hxx>
+#include <tools/string.hxx>
+#include <tools/link.hxx>
+#include <tools/debug.hxx>
+#include <swrect.hxx>
+#include <unotools/configitem.hxx>
+#include <unotools/options.hxx>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <SidebarWindowsTypes.hxx>
+#include <svl/lstner.hxx>
+
+class SwWrtShell;
+class SwDoc;
+class SwView;
+class SwPostItField;
+class SwFmtFld;
+class SwField;
+class SfxBroadcaster;
+class SfxHint;
+class SwEditWin;
+class Color;
+class SvxSearchItem;
+class SvxLanguageItem;
+namespace sw { namespace annotation {
+ class SwAnnotationWin;
+}}
+namespace sw { namespace sidebarwindows {
+ class SwSidebarWin;
+ class SwFrmSidebarWinContainer;
+}}
+class SwSidebarItem;
+class SwFrm;
+class Window;
+
+#define SORT_POS 1
+#define SORT_AUTHOR 2
+#define SORT_DATE 3
+
+#define COL_NOTES_SIDEPANE_ARROW_ENABLED RGB_COLORDATA(0,0,0)
+#define COL_NOTES_SIDEPANE_ARROW_DISABLED RGB_COLORDATA(172,168,153)
+
+typedef std::list<SwSidebarItem*> SwSidebarItem_list;
+typedef std::list<SwSidebarItem*>::iterator SwSidebarItem_iterator;
+
+
+struct SwPostItPageItem
+{
+ bool bScrollbar;
+ sw::sidebarwindows::SidebarPosition eSidebarPosition;
+ long lOffset;
+ SwRect mPageRect;
+ SwSidebarItem_list* mList;
+ SwPostItPageItem(): bScrollbar(false),lOffset(0)
+ {
+ mList = new SwSidebarItem_list;
+ }
+ ~SwPostItPageItem()
+ {
+ mList->clear();
+ delete mList;
+ }
+
+};
+
+struct FieldShadowState
+{
+ const SwPostItField* mpShadowFld;
+ bool bCursor;
+ bool bMouse;
+ FieldShadowState(): mpShadowFld(0),bCursor(false),bMouse(false)
+ {
+ }
+};
+
+class SwNoteProps: public utl::ConfigItem
+{
+ private:
+ bool bIsShowAnchor;
+ public:
+ SwNoteProps()
+ : ConfigItem(::rtl::OUString::createFromAscii("Office.Writer/Notes"))
+ , bIsShowAnchor(false)
+ {
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames = GetPropertyNames();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aValues = GetProperties(rNames);
+ const ::com::sun::star::uno::Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
+ if (aValues.getLength())
+ pValues[0]>>=bIsShowAnchor;
+ }
+
+ bool IsShowAnchor()
+ {
+ return bIsShowAnchor;
+ }
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetPropertyNames()
+ {
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames;
+ if(!aNames.getLength())
+ {
+ static const char* aPropNames[] =
+ {
+ "ShowAnkor"
+ };
+ const int nCount = sizeof(aPropNames)/sizeof(const char*);
+ aNames.realloc(nCount);
+ ::rtl::OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = ::rtl::OUString::createFromAscii(aPropNames[i]);
+ }
+ return aNames;
+ }
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+};
+
+class SwPostItMgr: public SfxListener
+{
+ private:
+ SwView* mpView;
+ SwWrtShell* mpWrtShell;
+ SwEditWin* mpEditWin;
+ std::list< SwSidebarItem*> mvPostItFlds;
+ std::vector<SwPostItPageItem*> mPages;
+ sal_uLong mnEventId;
+ bool mbWaitingForCalcRects;
+ sw::sidebarwindows::SwSidebarWin* mpActivePostIt;
+ bool mbLayout;
+ long mbLayoutHeight;
+ long mbLayouting;
+ bool mbReadOnly;
+ bool mbDeleteNote;
+ FieldShadowState mShadowState;
+ OutlinerParaObject* mpAnswer;
+ bool mbIsShowAnchor;
+
+ // data structure to collect the <SwSidebarWin> instances for certain <SwFrm> instances.
+ sw::sidebarwindows::SwFrmSidebarWinContainer* mpFrmSidebarWinContainer;
+
+ typedef std::list<sw::sidebarwindows::SwSidebarWin*>::iterator SwSidebarWin_iterator;
+
+ void AddPostIts(bool bCheckExistance = true,bool bFocus = true);
+ //void AddRedlineComments(bool bCheckExistance, bool bFocus);
+ void RemoveSidebarWin();
+ void PreparePageContainer();
+ void Scroll(const long lScroll,const unsigned long aPage );
+ void AutoScroll(const sw::sidebarwindows::SwSidebarWin* pPostIt,const unsigned long aPage );
+ bool ScrollbarHit(const unsigned long aPage,const Point &aPoint);
+ bool LayoutByPage( std::list<sw::sidebarwindows::SwSidebarWin*> &aVisiblePostItList,
+ const Rectangle aBorder,
+ long lNeededHeight);
+ void CheckForRemovedPostIts();
+ bool ArrowEnabled(sal_uInt16 aDirection,unsigned long aPage) const;
+ bool BorderOverPageBorder(unsigned long aPage) const;
+ bool HasScrollbars() const;
+ void Focus(SfxBroadcaster& rBC);
+
+ sal_Int32 GetInitialAnchorDistance() const;
+ sal_Int32 GetScrollSize() const;
+ sal_Int32 GetSpaceBetween() const;
+ void SetReadOnlyState();
+ DECL_LINK( CalcHdl, void*);
+
+ sw::sidebarwindows::SwSidebarWin* GetSidebarWin(const SfxBroadcaster* pBroadcaster) const;
+
+ void InsertItem( SfxBroadcaster* pItem, bool bCheckExistance, bool bFocus);
+ void RemoveItem( SfxBroadcaster* pBroadcast );
+
+ void Sort(const short aType);
+
+ public:
+ SwPostItMgr(SwView* aDoc);
+ ~SwPostItMgr();
+
+ typedef std::list< SwSidebarItem* >::const_iterator const_iterator;
+ const_iterator begin() const { return mvPostItFlds.begin(); }
+ const_iterator end() const { return mvPostItFlds.end(); }
+
+ void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ void LayoutPostIts();
+ bool CalcRects();
+
+ void MakeVisible( const sw::sidebarwindows::SwSidebarWin* pPostIt,
+ long aPage = -1);
+
+ bool ShowScrollbar(const unsigned long aPage) const;
+ bool HasNotes() const ;
+ bool ShowNotes() const;
+ bool IsShowAnchor() { return mbIsShowAnchor;}
+ unsigned long GetSidebarWidth(bool bPx = false) const;
+ unsigned long GetSidebarBorderWidth(bool bPx = false) const;
+ unsigned long GetNoteWidth();
+
+ void PrepareView(bool bIgnoreCount = false);
+
+ void CorrectPositions();
+
+ void SetLayout() { mbLayout = true; };
+ void Delete(String aAuthor);
+ void Delete();
+
+#if 0
+ void Hide( SwPostItField* pPostItField );
+#endif
+ void Hide( const String& rAuthor );
+ void Hide();
+ void Show();
+
+ void Rescale();
+
+ Rectangle GetBottomScrollRect(const unsigned long aPage) const;
+ Rectangle GetTopScrollRect(const unsigned long aPage) const;
+
+ bool IsHit(const Point &aPointPixel);
+ Color GetArrowColor(sal_uInt16 aDirection,unsigned long aPage) const;
+
+ sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pFld) const;
+
+ sw::sidebarwindows::SwSidebarWin* GetNextPostIt( sal_uInt16 aDirection,
+ sw::sidebarwindows::SwSidebarWin* aPostIt);
+ long GetNextBorder();
+
+ sw::sidebarwindows::SwSidebarWin* GetActiveSidebarWin() { return mpActivePostIt; }
+ void SetActiveSidebarWin( sw::sidebarwindows::SwSidebarWin* p);
+ bool HasActiveSidebarWin() const;
+ bool HasActiveAnnotationWin() const;
+ void GrabFocusOnActiveSidebarWin();
+ void UpdateDataOnActiveSidebarWin();
+ void DeleteActiveSidebarWin();
+ void HideActiveSidebarWin();
+ void ToggleInsModeOnActiveSidebarWin();
+
+ sal_Int32 GetMinimumSizeWithMeta() const;
+ sal_Int32 GetSidebarScrollerHeight() const;
+
+ void SetShadowState(const SwPostItField* pFld,bool bCursor = true);
+
+ void SetSpellChecking();
+
+ Color GetColorDark(sal_uInt16 aAuthorIndex);
+ Color GetColorLight(sal_uInt16 aAuthorIndex);
+ Color GetColorAnchor(sal_uInt16 aAuthorIndex);
+
+
+ void RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;}
+ OutlinerParaObject* IsAnswer() {return mpAnswer;}
+ void CheckMetaText();
+ void StartSpelling();
+
+ sal_uInt16 Replace(SvxSearchItem* pItem);
+ sal_uInt16 SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
+ sal_uInt16 FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
+
+ void AssureStdModeAtShell();
+
+ void ConnectSidebarWinToFrm( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+ void DisconnectSidebarWinFromFrm( const SwFrm& rFrm,
+ sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+ bool HasFrmConnectedSidebarWins( const SwFrm& rFrm );
+ Window* GetSidebarWinForFrmByIndex( const SwFrm& rFrm,
+ const sal_Int32 nIndex );
+ void GetAllSidebarWinForFrm( const SwFrm& rFrm,
+ std::vector< Window* >* pChildren );
+};
+
+#endif
+
+
+
+
diff --git a/sw/inc/RefreshListenerContainer.hxx b/sw/inc/RefreshListenerContainer.hxx
new file mode 100644
index 000000000000..8860787a8abf
--- /dev/null
+++ b/sw/inc/RefreshListenerContainer.hxx
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _REFRESH_LISTENER_CONTAINER_HXX_
+#define _REFRESH_LISTENER_CONTAINER_HXX_
+
+#include <unoevtlstnr.hxx>
+
+class SwRefreshListenerContainer : public SwEventListenerContainer
+{
+public:
+ SwRefreshListenerContainer( ::com::sun::star::uno::XInterface* pxParent);
+ void Refreshed();
+};
+#endif
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
new file mode 100644
index 000000000000..00649f211f51
--- /dev/null
+++ b/sw/inc/SidebarWin.hxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SIDEBARWIN_HXX
+#define _SIDEBARWIN_HXX
+
+#include <postithelper.hxx>
+#include <SidebarWindowsTypes.hxx>
+
+#include <vcl/window.hxx>
+#include <swrect.hxx>
+
+#include <tools/datetime.hxx>
+#include <tools/date.hxx>
+
+#include <vcl/lineinfo.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <editeng/editstat.hxx>
+
+class SwPostItMgr;
+class SwPostItField;
+class OutlinerView;
+class Outliner;
+class ScrollBar;
+class SwEditWin;
+class SwView;
+class Edit;
+class MenuButton;
+//class SwRedline;
+class SwFrm;
+
+
+namespace sw { namespace sidebarwindows {
+
+class SidebarTxtControl;
+class AnchorOverlayObject;
+class ShadowOverlayObject;
+
+typedef sal_Int64 SwPostItBits;
+
+#define PB_Preview ((SwPostItBits)0x00000001)
+
+
+class SwSidebarWin : public Window
+{
+ public:
+ SwSidebarWin( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits,
+ SwSidebarItem& rSidebarItem );
+ virtual ~SwSidebarWin();
+
+ void SetSize( const Size& rNewSize );
+ void SetPosSizePixelRect( long nX,
+ long nY,
+ long nWidth,
+ long nHeight,
+ const SwRect &aRect,
+ const long PageBorder);
+ void SetPosAndSize();
+ void TranslateTopPosition(const long aAmount);
+ virtual void CheckMetaText();
+
+ inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
+ SwEditWin* EditWin();
+
+ inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
+ bool HasScrollbar() const;
+ bool IsScrollbarVisible() const;
+ inline ScrollBar* Scrollbar() { return mpVScrollbar; }
+ inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
+ inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
+
+ long GetPostItTextHeight();
+
+ void SwitchToPostIt(sal_uInt16 aDirection);
+ virtual void SwitchToFieldPos();
+
+ virtual sal_uInt32 MoveCaret() = 0;
+
+ virtual void UpdateData() = 0;
+ virtual void SetPostItText() = 0;
+ virtual void Delete();
+ virtual void GotoPos() = 0;
+
+ virtual String GetAuthor() = 0;
+ virtual Date GetDate() = 0;
+ virtual Time GetTime() = 0;
+
+ void ExecuteCommand(sal_uInt16 nSlot);
+ void InitControls();
+ void HidePostIt();
+ void DoResize();
+ void ResizeIfNeccessary(long aOldHeight, long aNewHeight);
+ void SetScrollbar();
+
+ void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
+ const Point VirtualPos() { return mPosSize.TopLeft(); }
+ const Size VirtualSize() { return mPosSize.GetSize(); }
+
+ void ShowAnchorOnly(const Point &aPoint);
+ void ShowNote();
+ void HideNote();
+
+ void ResetAttributes();
+
+ void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
+ void SetReadonly(sal_Bool bSet);
+ sal_Bool IsReadOnly() { return mbReadonly;}
+ bool IsPreview() { return nFlags & PB_Preview;}
+
+ void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
+ const Color& ColorAnchor() { return mColorAnchor; }
+ const Color& ColorDark() { return mColorDark; }
+ const Color& ColorLight() { return mColorLight; }
+ void Rescale();
+
+ void SetViewState(::sw::sidebarwindows::ViewState bViewState);
+
+ bool IsFollow() { return mbIsFollow; }
+ void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
+ virtual bool CalcFollow() = 0;
+
+#if 0
+#endif
+
+ sal_Int32 GetMetaHeight();
+ sal_Int32 GetMinimumSizeWithMeta();
+ sal_Int32 GetMinimumSizeWithoutMeta();
+ sal_Int32 GetMetaButtonAreaWidth();
+ sal_Int32 GetScrollbarWidth();
+
+ void SetSpellChecking();
+
+ void ToggleInsMode();
+
+ virtual void ActivatePostIt();
+ virtual void DeactivatePostIt();
+
+ void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
+ const Color& aColor);
+ SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
+ Color GetChangeColor() { return mChangeColor; }
+
+ virtual bool IsProtected() {return mbReadonly;};
+
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+ inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
+
+ void SetLanguage(const SvxLanguageItem aNewItem);
+
+ void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ protected:
+ virtual void DataChanged( const DataChangedEvent& aEvent);
+ virtual void LoseFocus();
+ virtual void Paint( const Rectangle& rRect);
+ virtual void GetFocus();
+ virtual MenuButton* CreateMenuButton() = 0;
+
+ void SetSizePixel( const Size& rNewSize );
+ SfxItemSet DefaultItem();
+
+ DECL_LINK(ModifyHdl, void*);
+ DECL_LINK(ScrollHdl, ScrollBar*);
+ DECL_LINK(DeleteHdl, void*);
+
+ inline SwView& DocView() { return mrView;}
+ inline SwPostItMgr& Mgr() { return mrMgr; }
+ inline Outliner* Engine() { return mpOutliner;}
+
+ private:
+ SwSidebarWin* GetTopReplyNote();
+
+ virtual SvxLanguageItem GetLanguage(void);
+
+ SwPostItMgr& mrMgr;
+ SwView& mrView;
+ const SwPostItBits nFlags;
+
+ sal_uLong mnEventId;
+
+ OutlinerView* mpOutlinerView;
+ Outliner* mpOutliner;
+
+ sw::sidebarwindows::SidebarTxtControl* mpSidebarTxtControl;
+ ScrollBar* mpVScrollbar;
+ Edit* mpMetadataAuthor;
+ Edit* mpMetadataDate;
+ MenuButton* mpMenuButton;
+
+ sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
+ sw::sidebarwindows::ShadowOverlayObject* mpShadow;
+
+ Color mColorAnchor;
+ Color mColorDark;
+ Color mColorLight;
+ Color mChangeColor;
+
+ sw::sidebarwindows::SidebarPosition meSidebarPosition;
+
+ Rectangle mPosSize;
+ SwRect mAnchorRect;
+ long mPageBorder;
+
+ bool mbMouseOver;
+ SwPostItHelper::SwLayoutStatus mLayoutStatus;
+
+ bool mbReadonly;
+ bool mbIsFollow;
+
+ SwSidebarItem& mrSidebarItem;
+ const SwFrm* mpAnchorFrm;
+};
+
+} } // eof namespace sw::sidebarwindows
+
+
+// implementation for change tracking comments, fully functional, but not yet used
+/*
+class SwRedComment : public SwSidebarWin
+{
+ private:
+ SwRedline* pRedline;
+
+ protected:
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ public:
+ SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed);
+ virtual ~SwRedComment() {};
+
+ virtual void UpdateData();
+ virtual void SetPostItText();
+ virtual void Delete();
+ virtual void GotoPos();
+ virtual void SetPopup();
+ virtual void ActivatePostIt();
+ virtual void DeactivatePostIt();
+
+ virtual String GetAuthor();
+ virtual Date GetDate();
+ virtual Time GetTime();
+
+ virtual bool IsProtected();
+};
+*/
+
+#endif
diff --git a/sw/inc/SidebarWindowsTypes.hxx b/sw/inc/SidebarWindowsTypes.hxx
new file mode 100644
index 000000000000..8b86f87edf87
--- /dev/null
+++ b/sw/inc/SidebarWindowsTypes.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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 _SIDEBARWINDOWSTYPES_HXX
+#define _SIDEBARWINDOWSTYPES_HXX
+
+namespace sw { namespace sidebarwindows {
+
+enum ViewState
+{
+ VS_NORMAL,
+ VS_VIEW,
+ VS_EDIT
+};
+
+enum SidebarPosition
+{
+ SIDEBAR_LEFT, // sidebar on left side
+ SIDEBAR_RIGHT, // sidebar on right side
+ SIDEBAR_NONE // sidebar on neither side
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/inc/SwAppletImpl.hxx b/sw/inc/SwAppletImpl.hxx
new file mode 100644
index 000000000000..0ad636adf67f
--- /dev/null
+++ b/sw/inc/SwAppletImpl.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW_APPLET_IMPL_HXX
+#define _SW_APPLET_IMPL_HXX
+
+#define SWHTML_OPTTYPE_IGNORE 0
+#define SWHTML_OPTTYPE_TAG 1
+#define SWHTML_OPTTYPE_PARAM 2
+#define SWHTML_OPTTYPE_SIZE 3
+
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+
+
+#include <tools/string.hxx>
+#include <sfx2/frmhtml.hxx>
+#include <sfx2/frmhtmlw.hxx>
+#ifndef _WRKWIN_HXX //autogen
+#include <vcl/wrkwin.hxx>
+#endif
+#include <sot/storage.hxx>
+#include <svl/itemset.hxx>
+
+#include <svl/ownlist.hxx>
+
+class SfxItemSet;
+
+#define OOO_STRING_SW_HTML_O_Hidden "HIDDEN"
+
+class SwApplet_Impl
+{
+ com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > xApplet;
+ SvCommandList aCommandList; // und die szugehorige Command-List
+ SfxItemSet aItemSet;
+ String sAlt;
+
+public:
+ static sal_uInt16 GetOptionType( const String& rName, sal_Bool bApplet );
+ SwApplet_Impl( SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
+ SwApplet_Impl( SfxItemSet& rSet ): aItemSet ( rSet) {}
+ ~SwApplet_Impl();
+ void CreateApplet( const String& rCode, const String& rName,
+ sal_Bool bMayScript, const String& rCodeBase,
+ const String& rBaseURL );
+#ifdef SOLAR_JAVA
+ sal_Bool CreateApplet( const String& rBaseURL );
+ void AppendParam( const String& rName, const String& rValue );
+#endif
+ void FinishApplet();
+ com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetApplet() { return xApplet; }
+ SfxItemSet& GetItemSet() { return aItemSet; }
+ const String& GetAltText() { return sAlt; }
+ void SetAltText( const String& rAlt ) {sAlt = rAlt;}
+};
+#endif
diff --git a/sw/inc/SwCapObjType.hxx b/sw/inc/SwCapObjType.hxx
new file mode 100644
index 000000000000..b256b51c6a53
--- /dev/null
+++ b/sw/inc/SwCapObjType.hxx
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWCAPOBJTYPE_HXX
+#define _SWCAPOBJTYPE_HXX
+
+enum SwCapObjType
+{
+ FRAME_CAP, GRAPHIC_CAP, TABLE_CAP, OLE_CAP
+};
+
+#endif
diff --git a/sw/inc/SwGetPoolIdFromName.hxx b/sw/inc/SwGetPoolIdFromName.hxx
new file mode 100644
index 000000000000..1bb40de8ba91
--- /dev/null
+++ b/sw/inc/SwGetPoolIdFromName.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _GETPOOLIDFROMNAMEENUM_HXX
+#define _GETPOOLIDFROMNAMEENUM_HXX
+
+/* When using the NameMapper to translate pool ids to UI or programmatic
+ * names, this enum is used to define which family is required */
+
+typedef sal_uInt16 SwGetPoolIdFromName;
+
+namespace nsSwGetPoolIdFromName
+{
+ const SwGetPoolIdFromName GET_POOLID_TXTCOLL = 0x01;
+ const SwGetPoolIdFromName GET_POOLID_CHRFMT = 0x02;
+ const SwGetPoolIdFromName GET_POOLID_FRMFMT = 0x04;
+ const SwGetPoolIdFromName GET_POOLID_PAGEDESC = 0x08;
+ const SwGetPoolIdFromName GET_POOLID_NUMRULE = 0x10;
+}
+
+#endif
diff --git a/sw/inc/SwNodeNum.hxx b/sw/inc/SwNodeNum.hxx
new file mode 100644
index 000000000000..56fef5d0a558
--- /dev/null
+++ b/sw/inc/SwNodeNum.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW_NODE_NUM_HXX
+#define _SW_NODE_NUM_HXX
+
+#include <SwNumberTree.hxx>
+
+class SwTxtNode;
+struct SwPosition;
+class SwNumRule;
+class SwNumFmt;
+
+class SW_DLLPUBLIC SwNodeNum : public SwNumberTreeNode
+{
+public:
+ // --> OD 2008-02-19 #refactorlists#
+ explicit SwNodeNum( SwTxtNode* pTxtNode );
+ explicit SwNodeNum( SwNumRule* pNumRule );
+ // <--
+ virtual ~SwNodeNum();
+
+ SwNumRule* GetNumRule() const;
+ void ChangeNumRule( SwNumRule& rNumRule );
+ SwTxtNode* GetTxtNode() const;
+
+ virtual bool IsNotificationEnabled() const;
+
+ virtual bool IsContinuous() const;
+
+ virtual bool IsCounted() const;
+
+ virtual bool LessThan(const SwNumberTreeNode & rNode) const;
+
+ virtual bool IsRestart() const;
+
+ virtual SwNumberTree::tSwNumTreeNumber GetStartValue() const;
+
+// String ToString() const;
+
+ SwPosition GetPosition() const;
+
+ // --> OD 2006-03-07 #131436#
+ // The number tree root node is deleted, when the corresponding numbering
+ // rule is deleted. In this situation the number tree should be empty -
+ // still registered text nodes aren't allowed. But it is possible, that
+ // text nodes of the undo nodes array are still registered. These will be
+ // unregistered.
+ // Text nodes of the document nodes array aren't allowed to be registered
+ // in this situation - this will be asserted.
+ static void HandleNumberTreeRootNodeDelete( SwNodeNum& rNodeNum );
+ // <--
+
+ /** determines the <SwNodeNum> instance, which is preceding the given text node
+
+ OD 2007-09-06 #i81002#
+
+ @author OD
+ */
+ const SwNodeNum* GetPrecedingNodeNumOf( const SwTxtNode& rTxtNode ) const;
+
+protected:
+ virtual SwNumberTreeNode * Create() const;
+
+ // --> OD 2006-04-26 #i64010#
+ virtual bool HasCountedChildren() const;
+ virtual bool IsCountedForNumbering() const;
+ // <--
+
+ // --> OD 2008-02-19 #refactorlists#
+ // method called before this tree node has been added to the list tree
+ virtual void PreAdd();
+ // method called at a child after this child has been removed from the list tree
+ virtual void PostRemove();
+ // <--
+private:
+ SwTxtNode * mpTxtNode;
+ SwNumRule * mpNumRule;
+
+ // --> OD 2006-03-07 #131436#
+ static void _UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum );
+ // <--
+
+ SwNodeNum( const SwNodeNum& ); // no copy constructor
+ SwNodeNum& operator=( const SwNodeNum& ); // no assignment operator
+
+ virtual bool IsCountPhantoms() const;
+
+ virtual bool IsNotifiable() const;
+
+ virtual void NotifyNode();
+};
+
+#endif // _SW_NODE_NUM_HXX
diff --git a/sw/inc/SwNumberTree.hxx b/sw/inc/SwNumberTree.hxx
new file mode 100644
index 000000000000..58c5f38a5696
--- /dev/null
+++ b/sw/inc/SwNumberTree.hxx
@@ -0,0 +1,767 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW_NUMBER_TREE_HXX
+#define _SW_NUMBER_TREE_HXX
+
+#include <set>
+#include <vector>
+#include <tools/string.hxx>
+#include <swdllapi.h>
+#include <SwNumberTreeTypes.hxx>
+
+class SwNumberTreeNode;
+
+bool SwNumberTreeNodeLessThan (const SwNumberTreeNode * pA,
+ const SwNumberTreeNode * pB);
+
+struct compSwNumberTreeNodeLessThan
+{
+ bool operator()(const SwNumberTreeNode * pA,
+ const SwNumberTreeNode * pB) const
+ { return SwNumberTreeNodeLessThan(pA, pB); }
+};
+
+/**
+ A tree of numbered nodes.
+
+ Simple example:
+
+ <pre>
+ 1. kshdkjfs
+ 1.1. lskjf
+ 2. sdfjlksaf
+ 3. fkaslk
+ 3.1. lfjlaskf
+ 3.2. jaslkjflsf
+ 3.2.1. hkljhkjhk
+
+ + R
+ + 1 kshdkjfs
+ | + 1 lskjf
+ + 2 sdfjlksaf
+ + 3 fkaslk
+ + 1 lfjlaskf
+ + 2 jaslkjflsf
+ + 1 hkljhkjhk
+ </pre>
+
+ The root contains the nodes of the first level. Each node A of the
+ first level contains those nodes of the second level that have the
+ same first level number as A and so on for the subsidiary levels.
+
+ The numbering label of a node A is resolved by concatenating the
+ numbers of the nodes on the path from the root to A.
+
+ ------------------------------------------
+
+ Phantoms
+
+ A phantom is an auxiliary node that is used to emulate numberings
+ starting with nodes not at top level. The phantom contains the
+ number for the level but is not considered part of the numbering.
+
+ Constraint 1: A phantom is always the first child node.
+ Constraint 2: At each node there is at most one child that is a phantom.
+ Constraint 3: A phantom is the smallest of all numbering nodes.
+
+ Uncounted Phantoms
+
+ 0.1. dljflskjlasf
+ 5. dsfkas
+ 5.1.
+
+ + R (nStart = 5)
+ + 0 (phantom, not counted)
+ | + 1 dljflskjlasf
+ + 5 dsfkas
+ + 1
+
+ The phantom gets numbered with 0. The first non-phantom node gets
+ numbered with the start value.
+
+ -----------------------------------------
+
+ Counted Phantoms
+
+ 5.1. lgkjjgklg
+ 6. lkjfalskjflsaf
+ 6.1. ljdflaksjflkjasflkjsf
+
+ + R (nStart = 5)
+ + 5 (phantom, counted)
+ | + 1 lgkjjgklg
+ + 6 lkjfalskjflsaf
+ + 1 ljdflaksjflkjasflkjsf
+
+ The phantom gets numbered with the start value.
+*/
+class SW_DLLPUBLIC SwNumberTreeNode
+{
+protected:
+ typedef std::set<SwNumberTreeNode *, compSwNumberTreeNodeLessThan>
+ tSwNumberTreeChildren;
+
+public:
+ SwNumberTreeNode();
+
+ virtual ~SwNumberTreeNode();
+
+ /**
+ Add a child.
+
+ @param pChild child to add
+ @param nDepth depth in which to add the child
+ */
+ void AddChild( SwNumberTreeNode* pChild,
+ const int nDepth = 0 );
+
+ /**
+ Remove a child.
+
+ OD 2008-02-19 #refactorlists# - no longer virtual
+
+ @param pChild child to be removed
+ */
+ void RemoveChild( SwNumberTreeNode* pChild );
+
+ /**
+ Remove this child from the tree.
+ */
+ void RemoveMe();
+
+ /**
+ Returns the parent of this node.
+
+ @return the parent
+ */
+ inline SwNumberTreeNode* GetParent() const
+ {
+ return mpParent;
+ }
+
+ /**
+ Returns number of this node.
+
+ @param bValidate validate the number?
+
+ @return number of this node
+ */
+ SwNumberTree::tSwNumTreeNumber GetNumber( bool bValidate = true ) const;
+
+ // --> OD 2008-11-26 #158694#
+ bool IsContinueingPreviousSubTree() const;
+ // <--
+
+ /**
+ Returns level numbers of this node.
+
+ @return level numbers of this node
+ */
+ SwNumberTree::tNumberVector GetNumberVector() const;
+
+ /**
+ Return if numbering is restartet at this node.
+ */
+ virtual bool IsRestart() const = 0;
+
+ /**
+ Return start value.
+
+ @return start value
+ */
+ virtual SwNumberTree::tSwNumTreeNumber GetStartValue() const = 0;
+
+ /**
+ Return if this node is counted.
+
+ @retval true this node is counted
+ @retval false this node is NOT counted
+ */
+ virtual bool IsCounted() const;
+
+ /**
+ Return if this node is counted continuous.
+
+ @retval true This node is counted continuous.
+ @retval false else
+ */
+ virtual bool IsContinuous() const = 0;
+
+ /**
+ Return if a node is first non-phantom child of this node.
+
+ @param pNode the node to check
+
+ @retval true pNode is first child of this node
+ @retval false else
+ */
+ virtual bool IsFirst(const SwNumberTreeNode * pNode) const;
+
+ /**
+ Return if this node if the first non-phantom node in the tree.
+
+ @retval true this node is the first non-phantom node in the tree
+ @retval false else
+ */
+ virtual bool IsFirst() const;
+
+ /**
+ Return if this node is a phantom.
+
+ @retval true this node is a phantom
+ @retval false this node is NOT a phantom
+ */
+ bool IsPhantom() const;
+
+ /** set level of this node
+
+ OD 2008-03-13 #refactorlists#
+ precondition: node is already member of a list tree
+
+ @author OD
+ */
+ void SetLevelInListTree( const int nLevel );
+
+ /**
+ Return level of this node.
+
+ The level of this node is the length of the path from the root
+ to this node.
+
+ @return the level of this node
+ */
+ int GetLevelInListTree() const;
+
+ /**
+ Returns if this node is less than another node.
+
+ @param rTreeNode node to compare with
+
+ @attention A phantom node is considered the least element with
+ respect to lessThan.
+
+ @retval true this node is less than rTreeNode
+ @retval false else
+ */
+ virtual bool LessThan(const SwNumberTreeNode & rTreeNode) const;
+
+ /**
+ Invalidate this node and all its descendants.
+
+ All iterators holding the last valid node in the according list
+ of childs are set to the end of this list, thereby stating all
+ children in the list are invalid.
+ OD 2007-10-26 #i83479# - made public
+ */
+ void InvalidateTree() const;
+
+ /**
+ Notifies all invalid children of this node.
+ OD 2007-10-26 #i83479# - made public
+ */
+ void NotifyInvalidChildren();
+
+ /**
+ Notifies the node.
+
+ Calls Invalidate(this) on parent.
+ */
+ void InvalidateMe();
+
+ /**
+ Validate the tree.
+
+ Validates all nodes in this subtree.
+ */
+ void ValidateTree();
+
+ /**
+ Validates this node.
+
+ Calls Validate(this) on parent.
+ */
+ void ValidateMe();
+
+ /**
+ Notifies all invalid siblings of this node.
+ */
+ void NotifyInvalidSiblings();
+
+ /** notification of all nodes in the list tree on certain list level
+
+ OD 2008-04-17 #refactorlists#
+ */
+ void NotifyNodesOnListLevel( const int nListLevel );
+
+ /** Invalidation and notification of complete numbering tree
+
+ OD 2006-04-26 #i64010#
+ Usage: on <IsCounted()> state change its needed to invalidate the
+ complete numbering tree due to wide influence of this change.
+ */
+ inline void InvalidateAndNotifyTree()
+ {
+ if ( GetRoot() )
+ {
+ GetRoot()->InvalidateTree();
+ GetRoot()->Notify();
+ }
+ }
+
+ /**
+ Returns the greatest descendant of the root that is smaller than
+ this node, aka the predecessor of this node.
+
+ @return the predecessor
+ */
+ SwNumberTreeNode* GetPred( bool bSibling = false ) const;
+
+ /** determines the node, which is preceding the node
+
+ OD 2007-09-06 #i81002#
+ The search for the preceding node is performed for the tree below the
+ <this> node. To search the complete tree, the method has been called for
+ the root of the tree.
+
+ @author OD
+ */
+ const SwNumberTreeNode* GetPrecedingNodeOf( const SwNumberTreeNode& rNode ) const;
+
+// /**
+// Returns a string representation of this node.
+
+// @return the string representation of this node
+// */
+// virtual String ToString() const = 0;
+
+// /**
+// Print this subtree.
+
+// @param o output stream to direct output to
+// @param rIndent additional indent for the children of this node
+// @param rMyIndent indent to use for this node
+// @param nDepth number of levels to print (-1 means all levels)
+
+// @return output stream after output of this subtree
+// */
+// String print(const String & rIndent = String(" ",
+// RTL_TEXTENCODING_ASCII_US),
+// const String & rMyIndent = String(" ",
+// RTL_TEXTENCODING_ASCII_US),
+// int nDepth = -1) const;
+
+#ifdef DBG_UTIL
+ static unsigned long GetInstances();
+ unsigned long GetSerial();
+#endif
+
+#ifdef __SW_NUMBER_TREE_SANITY_CHECK
+ /**
+ Sanity check.
+
+ @param bRecursive descend to children
+
+ @retval true the structure of this node is sane
+ @retval false else
+ */
+ bool IsSane(bool bRecursive) const;
+#endif // __SW_NUMBER_TREE_SANITY_CHECK
+
+protected:
+ /**
+ the children
+ */
+ tSwNumberTreeChildren mChildren;
+
+ /**
+ Returns the root node of the tree this node is part of.
+
+ Important note: method call <GetRoot()->GetRoot()> returns NULL.
+
+ @return the root
+ */
+ SwNumberTreeNode* GetRoot() const;
+
+ /**
+ Return if the notification is not disabled on global conditions
+
+ @retval true Notification enabled in general.
+ @retval false else
+ */
+ virtual bool IsNotificationEnabled() const = 0;
+
+ /**
+ Returns how many children this node has got.
+
+ @return number of children
+ */
+ tSwNumberTreeChildren::size_type GetChildCount() const;
+
+ // --> OD 2006-04-26 #i64010# - made pure virtual
+ virtual bool HasCountedChildren() const = 0;
+ // <--
+
+ // --> OD 2006-04-26 #i64010#
+ virtual bool IsCountedForNumbering() const = 0;
+ // <--
+
+ // --> OD 2008-02-19 #refactorlists#
+ // method called before this tree node has been added to the list tree
+ virtual void PreAdd() = 0;
+ // method called after this tree node has been removed from the list tree
+ virtual void PostRemove() = 0;
+ // <--
+
+#ifdef __SW_NUMBER_TREE_SANITY_CHECK
+ /**
+ Sanity check with loop detection.
+
+ @param bRecursive descend to children
+ @param rParents vector for recording path
+
+ @retval true this node is sane
+ @retval false else */
+ virtual bool IsSane
+ (bool bRecursive, std::vector<const SwNumberTreeNode *> rParents) const;
+#endif // __SW_NUMBER_TREE_SANITY_CHECK
+
+ /**
+ the parent node
+ */
+ SwNumberTreeNode * mpParent;
+
+ /**
+ the number of the node
+ */
+ mutable SwNumberTree::tSwNumTreeNumber mnNumber;
+
+ // --> OD 2008-11-26 #158694#
+ // boolean indicating, that a node of a not counted parent node is continueing
+ // the numbering of parent's previous node sub tree.
+ // Example:
+ // 1. kshdkjfs
+ // 1.1. lskjf
+ // sdfjlksaf <-- not counted parent node
+ // 1.2. lfjlaskf <-- <mbContinueingPreviousSubTree = true>
+ mutable bool mbContinueingPreviousSubTree;
+ // <--
+
+ /**
+ true this node is a phantom
+ false this node is NOT a phantom
+ */
+ bool mbPhantom;
+
+ /**
+ Iterator to the last valid element. All children that are less
+ than or equal to the referenced child are valid. All children
+ greater than the referenced child are invalid.
+ */
+ mutable tSwNumberTreeChildren::iterator mItLastValid;
+
+#ifdef DBG_UTIL
+ /**
+ Counter for the number of created instances.
+ */
+ static unsigned long nInstances;
+
+ /**
+ Serial number.
+ */
+ unsigned long mnSerial;
+#endif
+
+ SwNumberTreeNode(const SwNumberTreeNode& );
+ SwNumberTreeNode& operator=( const SwNumberTreeNode& );
+
+ /**
+ Calls _GetNumberVector on parent and adds number of this node
+ at the end.
+
+ @param rVector return value
+ @param bValidate validate the number?
+ */
+ void _GetNumberVector( SwNumberTree::tNumberVector& rVector,
+ bool bValidate = true ) const;
+
+ /**
+ Invalidates a child.
+
+ Calls SetLastValid for the preceeding sibling of the child and
+ notifies all invalid children.
+
+ @param pChild the child to invalidate
+ */
+ void Invalidate( SwNumberTreeNode * pChild );
+
+ /** Invalidation of all children
+
+ OD 2005-10-19 #126009#
+ Usage: on <IsCounted()> state change the children have to be invalidated
+ */
+ inline void InvalidateChildren()
+ {
+ SetLastValid( mChildren.end() );
+ }
+
+ /** Invalidation of parent node, if its not counted.
+
+ OD 2005-10-19 #126009#
+ Usage: on <IsCounted()> state change the parent have to be invalidated
+ */
+ inline void InvalidateNotCountedParent()
+ {
+ if ( GetParent() && !GetParent()->IsCountedForNumbering() )
+ {
+ GetParent()->InvalidateMe();
+ }
+ }
+
+ /**
+ Set the last valid child of this node.
+
+ @param aItLastValid iterator pointing to the new last valid child
+ @param bValidating - true always set the last valid node to
+ aItLastValid
+ - false only set if aItLastValid is preceeding
+ the current last valid node
+ */
+ void SetLastValid(tSwNumberTreeChildren::iterator aItLastValid,
+ bool bValidating = false) const;
+
+ /**
+ Set this node as last valid child of its parent.
+
+ @param bValidation see aboce
+ */
+ void SetLastValid(bool bValidating) const;
+
+ /**
+ Return if this node is notifiable.
+
+ @attention If a not is not notifiable a notify request is *not*
+ forwarded to its descendants.
+
+ @retval true This node is notifiable.
+ @retval false else
+ */
+ virtual bool IsNotifiable() const = 0;
+
+ /**
+ Notifies the node.
+
+ Called when the number of the node got invalid.
+ */
+ virtual void NotifyNode() = 0;
+
+ /**
+ Notifies this node (NotifyNode) and all descendants.
+ */
+ void Notify();
+
+ /** Notification of parent node siblings, if its not counted.
+
+ OD 2005-10-19 #126009#
+ Usage: on <IsCounted()> state change the parent node and its siblings
+ have to be notified.
+ */
+ inline void NotifyNotCountedParentSiblings()
+ {
+ if ( GetParent() && !GetParent()->IsCountedForNumbering() )
+ {
+ GetParent()->NotifyInvalidSiblings();
+ }
+ }
+
+ /** notification of children nodes on certain depth
+
+ OD 2008-04-17 #refactorlists#
+
+ @author OD
+ */
+ void NotifyChildrenOnDepth( const int nDepth );
+
+ /**
+ Returns if a child A this node is valid.
+
+ A is valid if aItLastValid in parent refers to a node
+ greater than of equal to A.
+
+ @param pChild child to be tested
+
+ @retval true this node is valid
+ @retval false this node is NOT valid
+ */
+ bool IsValid(const SwNumberTreeNode * pChild) const;
+
+ /**
+ Returns if this node is valid.
+
+ @retval true this node is valid
+ @retval false else
+ */
+ bool IsValid() const;
+
+ /**
+ Validates a child.
+
+ @param pNode child to be validated
+
+ @attention All invalid children preceding pNode are validated, too.
+ */
+ void Validate(const SwNumberTreeNode * pNode) const;
+
+ /**
+ Validates a child using hierarchical numbering.
+
+ @param pNode child to be validated
+
+ @attention All invalid children preceding pNode are validated, too.
+ */
+ void ValidateHierarchical(const SwNumberTreeNode * pNode) const;
+
+ /**
+ Validates a child using continuous numbering.
+
+ @param pNode child to be validated
+
+ @attention All invalid children preceding pNode are validated, too.
+ */
+ void ValidateContinuous(const SwNumberTreeNode * pNode) const;
+
+ /**
+ Creates a new node of the same class.
+
+ @return the new node
+ */
+ virtual SwNumberTreeNode * Create() const = 0;
+
+ /**
+ Creates a phantom.
+
+ @return the created phantom
+ */
+ SwNumberTreeNode * CreatePhantom();
+
+ /**
+ Set if this node is a phantom.
+
+ @param bPhantom - true this node is a phantom
+ - false this node is a phantom
+ */
+ void SetPhantom(bool bPhantom = true);
+
+ /**
+ Return if phantoms are counted.
+
+ OD 2008-02-19 #refactorlists# - pure virtual now
+
+ @retval true phantoms are counted
+ @retval false else
+ */
+ virtual bool IsCountPhantoms() const = 0;
+
+ /**
+ Return if all descendants of this node are phantoms.
+
+ @retval true all descendants are phantoms
+ @retval false else
+ */
+ bool HasOnlyPhantoms() const;
+
+ // --> OD 2005-10-27 #126009#
+ bool HasPhantomCountedParent() const;
+ // <--
+
+ /**
+ HB, OD : return node, if it isn't a phantom, otherwise return first
+ non-phantom descendant.
+ Returns the first child of this node that is NOT a phantom.
+
+ @return the first non phantom child
+ */
+ SwNumberTreeNode* GetFirstNonPhantomChild();
+
+ /**
+ Removes recursively phantoms that have no children.
+
+ The resulting tree has no phantoms that either have no children or
+ whose descendancy consist entirely of phantoms.
+ */
+ void ClearObsoletePhantoms();
+
+ tSwNumberTreeChildren::iterator GetIterator(const SwNumberTreeNode * pChild) const;
+
+ /**
+ Moves all children to a given destination node.
+
+ @param pDest the destination node
+ */
+ void MoveChildren(SwNumberTreeNode * pDest);
+
+ /** Moves all children of this node that are greater than a given node
+ to the destination node.
+
+ OD 2005-10-14 #125991#
+ distinguish between node for comparing, whose children are greater,
+ and the destination node.
+
+ @param _rCompareNode
+ input parameter - reference to the node, which is used to determine
+ the greater children
+
+ @param _rDestNode
+ input parameter - reference to the node, which is the destination for
+ the greater children
+ */
+ void MoveGreaterChildren( SwNumberTreeNode& _rCompareNode,
+ SwNumberTreeNode& _rDestNode );
+
+ /**
+ Returns the last descendant of a node, if it has children.
+
+ @return last descendant of the node
+ */
+ SwNumberTreeNode* GetLastDescendant() const;
+
+};
+
+/**
+ Functor. Checks if a certain node is less than the functor's member.
+ */
+struct SwNumberTreeNodeIsLessThan
+{
+ const SwNumberTreeNode * pNode;
+
+ SwNumberTreeNodeIsLessThan(const SwNumberTreeNode * _pNode)
+ : pNode(_pNode) {}
+
+ bool operator()(const SwNumberTreeNode * _pNode) const
+ { return SwNumberTreeNodeLessThan(_pNode, pNode); }
+};
+#endif // _SW_NUMBER_TREE_HXX
diff --git a/sw/inc/SwNumberTreeTypes.hxx b/sw/inc/SwNumberTreeTypes.hxx
new file mode 100644
index 000000000000..39e5acd776cc
--- /dev/null
+++ b/sw/inc/SwNumberTreeTypes.hxx
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW_NUMBER_TREE_TYPES_HXX
+#define _SW_NUMBER_TREE_TYPES_HXX
+
+#include <vector>
+
+namespace SwNumberTree
+{
+ typedef long tSwNumTreeNumber;
+ typedef std::vector<tSwNumTreeNumber> tNumberVector;
+}
+
+#endif // _SW_NUMBER_TREE_TYPES_HXX
diff --git a/sw/inc/SwRewriter.hxx b/sw/inc/SwRewriter.hxx
new file mode 100644
index 000000000000..5c98db3807ab
--- /dev/null
+++ b/sw/inc/SwRewriter.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW_REWRITER_HXX
+#define _SW_REWRITER_HXX
+
+#include <vector>
+#include <tools/string.hxx>
+
+
+String const UNDO_ARG1("$1", RTL_TEXTENCODING_ASCII_US);
+String const UNDO_ARG2("$2", RTL_TEXTENCODING_ASCII_US);
+String const UNDO_ARG3("$3", RTL_TEXTENCODING_ASCII_US);
+
+
+typedef std::pair<String, String> SwRewriteRule;
+
+class SwRewriter
+{
+ std::vector<SwRewriteRule> mRules;
+
+public:
+ SwRewriter();
+ SwRewriter(const SwRewriter & rSrc);
+ ~SwRewriter();
+
+ void AddRule(const String & rWhat, const String & rWith);
+
+ String Apply(const String & rStr) const;
+};
+
+#endif // _SW_REWRITER_HXX
diff --git a/sw/inc/SwSmartTagMgr.hxx b/sw/inc/SwSmartTagMgr.hxx
new file mode 100644
index 000000000000..1a2ecb9c9fd6
--- /dev/null
+++ b/sw/inc/SwSmartTagMgr.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWSMARTTAGMGR_HXX
+#define _SWSMARTTAGMGR_HXX
+
+#include <svx/SmartTagMgr.hxx>
+
+
+/*************************************************************************
+ * class SwSmartTagMgr
+ *
+ * Wrapper for the svx SmartTagMgr
+ *************************************************************************/
+
+class SwSmartTagMgr : public SmartTagMgr
+{
+private:
+ static SwSmartTagMgr* mpTheSwSmartTagMgr;
+
+ SwSmartTagMgr( const rtl::OUString& rModuleName );
+ virtual ~SwSmartTagMgr();
+
+public:
+ static SwSmartTagMgr& Get();
+
+ // ::com::sun::star::util::XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::util::XChangesListener
+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/*
+namespace SwSmartTagMgr
+{
+ SmartTagMgr& Get();
+}
+*/
+
+#endif
diff --git a/sw/inc/SwStyleNameMapper.hxx b/sw/inc/SwStyleNameMapper.hxx
new file mode 100644
index 000000000000..688b066bc75a
--- /dev/null
+++ b/sw/inc/SwStyleNameMapper.hxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWSTYLENAMEMAPPER_HXX
+#define _SWSTYLENAMEMAPPER_HXX
+
+#include <sal/types.h>
+#include <tools/string.hxx>
+#include <SwGetPoolIdFromName.hxx>
+#include "swdllapi.h"
+
+#ifndef INCLUDED_HASH_MAP
+#include <hash_map>
+#define INCLUDED_HASH_MAP
+#endif
+#include <stringhash.hxx>
+
+/* This class holds all data about the names of styles used in the user
+ * interface (UI names...these are localised into different languages).
+ * These UI names are loaded from the resource files on demand.
+ *
+ * It also holds all information about the 'Programmatic' names of styles
+ * which remain static (and are hardcoded in the corresponding cxx file)
+ * for all languages.
+ *
+ * This class also provides static functions which can be used for the
+ * following conversions:
+ *
+ * 1. Programmatic Name -> UI Name
+ * 2. Programmatic Name -> Pool ID
+ * 3. UI Name -> Programmatic Name
+ * 4. UI Name -> Pool ID
+ * 5. Pool ID -> UI Name
+ * 6. Pool ID -> Programmatic Name
+ *
+ * The relationship of these tables to the style families is as follows:
+ *
+ * 1. Paragraph contains the Text, Lists, Extra, Register, Doc and HTML
+ * name arrays.
+ * 2. Character contains the ChrFmt and HTMLChrFmt name arrays.
+ * 3. Page contains the PageDesc name array.
+ * 4. Frame contains the FrmFmt name array.
+ * 5. Numbering Rule contains the NumRule name array.
+ */
+
+/*
+ * There is a further complication that came to light later. If someone enters
+ * a user-defined style name which is the same as a programmatic name, this
+ * name clash must be handled.
+ *
+ * Therefore, when there is a danger of a nameclash, the boolean bDisambiguate
+ * must be set to true in the SwStyleNameMapper call (it defaults to false).
+ * This will cause the following to happen:
+ *
+ * If the UI style name either equals a programmatic name or already ends
+ * with " (user)", then it must append " (user)" to the end.
+ *
+ * When a programmatic name is being converted to a UI name, if it ends in
+ * " (user)", we simply remove it.
+ */
+
+class SvStringsDtor;
+class String;
+struct SwTableEntry;
+
+
+typedef ::std::hash_map < const String*, sal_uInt16, StringHash, StringEq > NameToIdHash;
+
+class SwStyleNameMapper
+{
+ friend void _InitCore();
+ friend void _FinitCore();
+
+protected:
+ // UI Name tables
+ static SvStringsDtor *pTextUINameArray,
+ *pListsUINameArray,
+ *pExtraUINameArray,
+ *pRegisterUINameArray,
+ *pDocUINameArray,
+ *pHTMLUINameArray,
+ *pFrmFmtUINameArray,
+ *pChrFmtUINameArray,
+ *pHTMLChrFmtUINameArray,
+ *pPageDescUINameArray,
+ *pNumRuleUINameArray,
+ // Programmatic Name tables
+ *pTextProgNameArray,
+ *pListsProgNameArray,
+ *pExtraProgNameArray,
+ *pRegisterProgNameArray,
+ *pDocProgNameArray,
+ *pHTMLProgNameArray,
+ *pFrmFmtProgNameArray,
+ *pChrFmtProgNameArray,
+ *pHTMLChrFmtProgNameArray,
+ *pPageDescProgNameArray,
+ *pNumRuleProgNameArray;
+
+ static NameToIdHash *pParaUIMap,
+ *pCharUIMap,
+ *pPageUIMap,
+ *pFrameUIMap,
+ *pNumRuleUIMap,
+
+ *pParaProgMap,
+ *pCharProgMap,
+ *pPageProgMap,
+ *pFrameProgMap,
+ *pNumRuleProgMap;
+
+ static SvStringsDtor* NewUINameArray( SvStringsDtor*&,
+ sal_uInt16 nStt,
+ sal_uInt16 nEnd );
+
+ static SvStringsDtor* NewProgNameArray( SvStringsDtor*&,
+ const SwTableEntry *pTable,
+ sal_uInt8 nCount);
+
+ static void fillNameFromId ( sal_uInt16 nId, String &rName, sal_Bool bProgName );
+ static const String& getNameFromId ( sal_uInt16 nId, const String &rName, sal_Bool bProgName );
+ static const NameToIdHash& getHashTable ( SwGetPoolIdFromName, sal_Bool bProgName );
+ static sal_Bool SuffixIsUser ( const String & rString );
+ static void CheckSuffixAndDelete ( String & rString );
+
+public:
+ // This gets the UI Name from the programmatic name
+ static const String& GetUIName ( const String& rName, SwGetPoolIdFromName );
+ static void FillUIName ( const String& rName, String& rFillName, SwGetPoolIdFromName, sal_Bool bDisambiguate = sal_False );
+
+ // Get the programmatic Name from the UI name
+ static const String& GetProgName ( const String& rName, SwGetPoolIdFromName );
+ static void FillProgName ( const String& rName, String& rFillName, SwGetPoolIdFromName, sal_Bool bDisambiguate = sal_False );
+
+ // This gets the UI Name from the Pool ID
+ SW_DLLPUBLIC static void FillUIName ( sal_uInt16 nId, String& rFillName );
+ SW_DLLPUBLIC static const String& GetUIName ( sal_uInt16 nId, const String& rName );
+
+ // This gets the programmatic Name from the Pool ID
+ static void FillProgName( sal_uInt16 nId, String& rFillName );
+ SW_DLLPUBLIC static const String& GetProgName ( sal_uInt16 nId, const String& rName );
+
+ // This gets the PoolId from the UI Name
+ SW_DLLPUBLIC static sal_uInt16 GetPoolIdFromUIName( const String& rName, SwGetPoolIdFromName );
+
+ // Get the Pool ID from the programmatic name
+ static sal_uInt16 GetPoolIdFromProgName( const String& rName, SwGetPoolIdFromName );
+
+ // used to convert the 4 special ExtraProg/UINames for
+ // RES_POOLCOLL_LABEL_DRAWING, RES_POOLCOLL_LABEL_ABB,
+ // RES_POOLCOLL_LABEL_TABLE, RES_POOLCOLL_LABEL_FRAME
+ // forth and back.
+ // Non-matching names remain unchanged.
+ SW_DLLPUBLIC static const String GetSpecialExtraProgName( const String& rExtraUIName );
+ static const String GetSpecialExtraUIName( const String& rExtraProgName );
+
+ static const SvStringsDtor& GetTextUINameArray();
+ static const SvStringsDtor& GetListsUINameArray();
+ static const SvStringsDtor& GetExtraUINameArray();
+ static const SvStringsDtor& GetRegisterUINameArray();
+ static const SvStringsDtor& GetDocUINameArray();
+ static const SvStringsDtor& GetHTMLUINameArray();
+ static const SvStringsDtor& GetFrmFmtUINameArray();
+ static const SvStringsDtor& GetChrFmtUINameArray();
+ static const SvStringsDtor& GetHTMLChrFmtUINameArray();
+ static const SvStringsDtor& GetPageDescUINameArray();
+ static const SvStringsDtor& GetNumRuleUINameArray();
+
+ static const SvStringsDtor& GetTextProgNameArray();
+ static const SvStringsDtor& GetListsProgNameArray();
+ static const SvStringsDtor& GetExtraProgNameArray();
+ static const SvStringsDtor& GetRegisterProgNameArray();
+ static const SvStringsDtor& GetDocProgNameArray();
+ static const SvStringsDtor& GetHTMLProgNameArray();
+ static const SvStringsDtor& GetFrmFmtProgNameArray();
+ static const SvStringsDtor& GetChrFmtProgNameArray();
+ static const SvStringsDtor& GetHTMLChrFmtProgNameArray();
+ static const SvStringsDtor& GetPageDescProgNameArray();
+ static const SvStringsDtor& GetNumRuleProgNameArray();
+};
+#endif // _NAME_MAPPER_HXX
diff --git a/sw/inc/SwUndoField.hxx b/sw/inc/SwUndoField.hxx
new file mode 100644
index 000000000000..2f78cab966de
--- /dev/null
+++ b/sw/inc/SwUndoField.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_UNDO_FIELD_HXX
+#define SW_UNDO_FIELD_HXX
+
+#include <undobj.hxx>
+
+#include <com/sun/star/uno/Any.h>
+
+
+class SwDoc;
+class SwField;
+class SwMsgPoolItem;
+
+class SwUndoField : public SwUndo
+{
+ sal_uLong nNodeIndex;
+ xub_StrLen nOffset;
+
+protected:
+ SwDoc * pDoc;
+ SwPosition GetPosition();
+
+public:
+ SwUndoField(const SwPosition & rPos, SwUndoId nId = UNDO_FIELD );
+ virtual ~SwUndoField();
+};
+
+class SwUndoFieldFromDoc : public SwUndoField
+{
+ SwField * pOldField, * pNewField;
+ SwMsgPoolItem * pHnt;
+ sal_Bool bUpdate;
+
+ void DoImpl();
+
+public:
+ SwUndoFieldFromDoc(const SwPosition & rPos, const SwField & aOldField,
+ const SwField & aNewField,
+ SwMsgPoolItem * pHnt, sal_Bool bUpdate,
+ SwUndoId nId = UNDO_FIELD );
+
+ virtual ~SwUndoFieldFromDoc();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+};
+
+class SwUndoFieldFromAPI : public SwUndoField
+{
+ com::sun::star::uno::Any aOldVal, aNewVal;
+ sal_uInt16 nWhich;
+
+ void DoImpl();
+
+public:
+ SwUndoFieldFromAPI(const SwPosition & rPos,
+ const com::sun::star::uno::Any & rOldVal,
+ const com::sun::star::uno::Any & rNewVal,
+ sal_uInt16 nWhich);
+ virtual ~SwUndoFieldFromAPI();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+};
+
+#endif // SW_UNDO_FIELD_HXX
diff --git a/sw/inc/SwXMLSectionList.hxx b/sw/inc/SwXMLSectionList.hxx
new file mode 100644
index 000000000000..ea3aff8b2ebd
--- /dev/null
+++ b/sw/inc/SwXMLSectionList.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_XMLSECTIONLIST_HXX
+#define _SW_XMLSECTIONLIST_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+
+class SvStrings;
+
+class SwXMLSectionList : public SvXMLImport
+{
+protected:
+ // This method is called after the namespace map has been updated, but
+ // before a context for the current element has been pushed.
+ virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+public:
+ SvStrings & rSectionList;
+
+ // #110680#
+ SwXMLSectionList(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ SvStrings & rNewSectionList );
+
+ virtual ~SwXMLSectionList ( )
+ throw();
+};
+
+class SvXMLSectionListContext : public SvXMLImportContext
+{
+private:
+ SwXMLSectionList & rLocalRef;
+public:
+ SvXMLSectionListContext ( SwXMLSectionList& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+ ~SvXMLSectionListContext ( void );
+};
+
+class SvXMLIgnoreSectionListContext : public SvXMLImportContext
+{
+private:
+ SwXMLSectionList & rLocalRef;
+public:
+ SvXMLIgnoreSectionListContext ( SwXMLSectionList& rImport,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+ ~SvXMLIgnoreSectionListContext ( void );
+};
+#endif
diff --git a/sw/inc/TextCursorHelper.hxx b/sw/inc/TextCursorHelper.hxx
new file mode 100644
index 000000000000..cd7e185f3c4c
--- /dev/null
+++ b/sw/inc/TextCursorHelper.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_TEXTCURSORHELPER_HXX
+#define _SW_TEXTCURSORHELPER_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+class SwDoc;
+class SwPaM;
+
+class OTextCursorHelper : public ::cppu::ImplHelper1< ::com::sun::star::lang::XUnoTunnel>
+{
+public:
+
+ OTextCursorHelper(){}
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ virtual const SwPaM* GetPaM() const = 0;
+ virtual SwPaM* GetPaM() = 0;
+ virtual const SwDoc* GetDoc() const = 0;
+ virtual SwDoc* GetDoc() = 0;
+};
+
+#endif // _SW_TEXTCURSORHELPER_HXX
+
+
diff --git a/sw/inc/access.hrc b/sw/inc/access.hrc
new file mode 100644
index 000000000000..b33b19b814c7
--- /dev/null
+++ b/sw/inc/access.hrc
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ACCESS_HRC
+#define _ACCESS_HRC
+
+#include "rcid.hrc"
+
+#define STR_ACCESS_DOC_NAME (RC_ACCESS_BEGIN + 1)
+#define STR_ACCESS_DOC_DESC (RC_ACCESS_BEGIN + 2)
+#define STR_ACCESS_HEADING_WITH_NUM_DESC (RC_ACCESS_BEGIN + 3)
+#define STR_ACCESS_HEADER_NAME (RC_ACCESS_BEGIN + 4)
+#define STR_ACCESS_HEADER_DESC (RC_ACCESS_BEGIN + 5)
+#define STR_ACCESS_FOOTER_NAME (RC_ACCESS_BEGIN + 6)
+#define STR_ACCESS_FOOTER_DESC (RC_ACCESS_BEGIN + 7)
+#define STR_ACCESS_FOOTNOTE_NAME (RC_ACCESS_BEGIN + 8)
+#define STR_ACCESS_FOOTNOTE_DESC (RC_ACCESS_BEGIN + 9)
+#define STR_ACCESS_ENDNOTE_NAME (RC_ACCESS_BEGIN + 10)
+#define STR_ACCESS_ENDNOTE_DESC (RC_ACCESS_BEGIN + 11)
+#define STR_ACCESS_REPLACEMENT_POSTIT (RC_ACCESS_BEGIN + 12)
+#define STR_ACCESS_REPLACEMENT_FRAME (RC_ACCESS_BEGIN + 13)
+#define STR_ACCESS_REPLACEMENT_BULLET_GRAPHICS (RC_ACCESS_BEGIN + 14)
+#define STR_ACCESS_TABLE_DESC (RC_ACCESS_BEGIN + 15)
+#define STR_ACCESS_PAGE_NAME (RC_ACCESS_BEGIN + 16)
+#define STR_ACCESS_PAGE_DESC (RC_ACCESS_BEGIN + 17)
+#define STR_ACCESS_ANNOTATION_AUTHOR_NAME (RC_ACCESS_BEGIN + 18)
+#define STR_ACCESS_ANNOTATION_DATE_NAME (RC_ACCESS_BEGIN + 19)
+#define STR_ACCESS_ANNOTATION_BUTTON_NAME (RC_ACCESS_BEGIN + 20)
+#define STR_ACCESS_ANNOTATION_BUTTON_DESC (RC_ACCESS_BEGIN + 21)
+
+//IAccessibility2 Implementation 2009-----
+#define STR_ACCESS_PREVIEW_DOC_NAME (RC_ACCESS_BEGIN + 22)
+//#define STR_ACCESS_PREVIEW_DOC_DESC (RC_ACCESS_BEGIN + 23)
+#define STR_ACCESS_PREVIEW_DOC_SUFFIX (RC_ACCESS_BEGIN + 24)
+#define STR_ACCESS_DOC_WORDPROCESSING (RC_ACCESS_BEGIN + 25)
+#define STR_ACCESS_DOC_WORDPROCESSING_READONLY (RC_ACCESS_BEGIN + 26)
+#define STR_ACCESS_COLUMN_WIDTH (RC_ACCESS_BEGIN + 27)
+#define STR_ACCESS_PAGESETUP_SPACING (RC_ACCESS_BEGIN + 28)
+#define STR_ACCESS_SW_CATEGORY (RC_ACCESS_BEGIN + 29)
+#define STR_ACCESS_TL_GLOBAL (RC_ACCESS_BEGIN + 30)
+#define STR_ACCESS_TL_CONTENT (RC_ACCESS_BEGIN + 31)
+//-----IAccessibility2 Implementation 2009
+
+#define ACCESS_ACT_END STR_ACCESS_TL_CONTENT
+
+#if ACCESS_ACT_END > RC_ACCESS_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+
+#endif
diff --git a/sw/inc/accessibilityoptions.hxx b/sw/inc/accessibilityoptions.hxx
new file mode 100644
index 000000000000..08256b4c5e79
--- /dev/null
+++ b/sw/inc/accessibilityoptions.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCESSIBILITYOPTIONS_HXX
+#define _ACCESSIBILITYOPTIONS_HXX
+
+#include <tools/solar.h>
+
+struct SwAccessibilityOptions
+{
+ sal_Bool bIsAlwaysAutoColor :1;
+ sal_Bool bIsStopAnimatedText :1;
+ sal_Bool bIsStopAnimatedGraphics :1;
+
+ SwAccessibilityOptions() :
+ bIsAlwaysAutoColor(sal_False),
+ bIsStopAnimatedText(sal_False),
+ bIsStopAnimatedGraphics(sal_False) {}
+
+ inline sal_Bool IsAlwaysAutoColor() const { return bIsAlwaysAutoColor; }
+ inline void SetAlwaysAutoColor( sal_Bool b ) { bIsAlwaysAutoColor = b; }
+
+ inline sal_Bool IsStopAnimatedGraphics() const { return bIsStopAnimatedText;}
+ inline void SetStopAnimatedGraphics( sal_Bool b ) { bIsStopAnimatedText = b; }
+
+ inline sal_Bool IsStopAnimatedText() const { return bIsStopAnimatedGraphics; }
+ inline void SetStopAnimatedText( sal_Bool b ) { bIsStopAnimatedGraphics = b;}
+};
+#endif
+
diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
new file mode 100644
index 000000000000..01c4593fe636
--- /dev/null
+++ b/sw/inc/accmap.hxx
@@ -0,0 +1,329 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCMAP_HXX
+#define _ACCMAP_HXX
+
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <vos/ref.hxx>
+#include <vos/mutex.hxx>
+#include <svx/IAccessibleViewForwarder.hxx>
+#include <svx/IAccessibleParent.hxx>
+#include <tools/debug.hxx>
+#include <tools/fract.hxx>
+
+#include <vector>
+
+class ViewShell;
+class Rectangle;
+class SwFrm;
+class SwTxtFrm;
+class SwPageFrm;
+class SwAccessibleContext;
+class SwAccessibleContextMap_Impl;
+class SwAccessibleEventList_Impl;
+class SwAccessibleEventMap_Impl;
+class SwShapeList_Impl;
+class SdrObject;
+namespace accessibility {
+ class AccessibleShape;
+}
+class SwAccessibleShapeMap_Impl;
+struct SwAccessibleEvent_Impl;
+class SwAccessibleSelectedParas_Impl;
+class SwRect;
+class MapMode;
+class SwAccPreviewData;
+struct PrevwPage;
+class Window;
+
+// real states for events
+#define ACC_STATE_EDITABLE 0x01
+#define ACC_STATE_OPAQUE 0x02
+
+// pseudo states for events
+// --> OD 2009-01-07 #i88069# - pseudo state for event TEXT_ATTRIBUTE_CHANGED
+#define ACC_STATE_TEXT_ATTRIBUTE_CHANGED 0x0200
+// <--
+// --> OD 2005-12-12 #i27301# - pseudo state for event TEXT_SELECTION_CHANGED
+#define ACC_STATE_TEXT_SELECTION_CHANGED 0x0100
+// <--
+#define ACC_STATE_CARET 0x80
+#define ACC_STATE_RELATION_FROM 0x40
+#define ACC_STATE_RELATION_TO 0x20
+
+#define ACC_STATE_RELATION_MASK 0x60
+
+#define ACC_STATE_MASK 0x1F
+
+// --> OD 2005-12-12 #i27301# - introduce type definition of states
+typedef sal_uInt16 tAccessibleStates;
+// <--
+
+class SwAccessibleMap : public accessibility::IAccessibleViewForwarder,
+ public accessibility::IAccessibleParent
+{
+ mutable ::vos::OMutex maMutex;
+ ::vos::OMutex maEventMutex;
+ SwAccessibleContextMap_Impl *mpFrmMap;
+ SwAccessibleShapeMap_Impl *mpShapeMap;
+ SwShapeList_Impl *mpShapes;
+ SwAccessibleEventList_Impl *mpEvents;
+ SwAccessibleEventMap_Impl *mpEventMap;
+ // --> OD 2005-12-13 #i27301# - data structure to keep information about
+ // accessible paragraph, which have a selection.
+ SwAccessibleSelectedParas_Impl* mpSelectedParas;
+ // <--
+ ViewShell *mpVSh;
+ /// for page preview: store preview data, VisArea, and mapping of
+ /// preview-to-display coordinates
+ SwAccPreviewData* mpPreview;
+
+ ::com::sun::star::uno::WeakReference < ::com::sun::star::accessibility::XAccessible > mxCursorContext;
+
+ sal_Int32 mnPara;
+ sal_Int32 mnFootnote;
+ sal_Int32 mnEndnote;
+
+
+ sal_Bool mbShapeSelected;
+
+ void FireEvent( const SwAccessibleEvent_Impl& rEvent );
+
+ void AppendEvent( const SwAccessibleEvent_Impl& rEvent );
+
+ void InvalidateCursorPosition(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rAcc );
+ void DoInvalidateShapeSelection();
+ void DoInvalidateShapeFocus();
+ void InvalidateShapeSelection();
+
+ void _InvalidateRelationSet( const SwFrm* pFrm, sal_Bool bFrom );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ _GetDocumentView( sal_Bool bPagePreview );
+
+ /** method to build up a new data structure of the accessible pararaphs,
+ which have a selection
+
+ OD 2005-12-13 #i27301#
+ Important note: method has to used inside a mutual exclusive section
+
+ @author OD
+ */
+ SwAccessibleSelectedParas_Impl* _BuildSelectedParas();
+
+public:
+
+ SwAccessibleMap( ViewShell *pSh );
+ ~SwAccessibleMap();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> GetDocumentView();
+
+ // OD 15.01.2003 #103492# - complete re-factoring of method due to new
+ // page/print preview functionality.
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> GetDocumentPreview(
+ const std::vector<PrevwPage*>& _rPrevwPages,
+ const Fraction& _rScale,
+ const SwPageFrm* _pSelectedPageFrm,
+ const Size& _rPrevwWinSize );
+
+ ::vos::ORef < SwAccessibleContext > GetContextImpl(
+ const SwFrm *pFrm,
+ sal_Bool bCreate = sal_True );
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> GetContext(
+ const SwFrm *pFrm,
+ sal_Bool bCreate = sal_True );
+
+ ::vos::ORef < ::accessibility::AccessibleShape > GetContextImpl(
+ const SdrObject *pObj,
+ SwAccessibleContext *pParentImpl,
+ sal_Bool bCreate = sal_True );
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> GetContext(
+ const SdrObject *pObj,
+ SwAccessibleContext *pParentImpl,
+ sal_Bool bCreate = sal_True );
+
+ inline ViewShell* GetShell() const
+ {
+ return mpVSh;
+ }
+
+ const SwRect& GetVisArea() const;
+
+ /** get size of a dedicated preview page
+
+ OD 15.01.2003 #103492#
+ complete re-factoring of previous method due to new page/print preview
+ functionality.
+
+ @author OD
+
+ @param _nPrevwPageNum
+ input parameter - physical page number of page visible in the page preview
+
+ @return an object of class <Size>
+ */
+ Size GetPreViewPageSize( sal_uInt16 _nPrevwPageNum ) const;
+
+ void RemoveContext( const SwFrm *pFrm );
+ void RemoveContext( const SdrObject *pObj );
+
+ // Dispose frame and its children if bRecursive is set
+ void Dispose( const SwFrm* pFrm,
+ const SdrObject* pObj,
+ Window* pWindow,
+ sal_Bool bRecursive = sal_False );
+
+ void InvalidatePosOrSize( const SwFrm* pFrm,
+ const SdrObject* pObj,
+ Window* pWindow,
+ const SwRect& rOldFrm );
+
+ void InvalidateContent( const SwFrm *pFrm );
+
+ // --> OD 2009-01-06 #i88069#
+ void InvalidateAttr( const SwTxtFrm& rTxtFrm );
+ // <--
+
+ void InvalidateCursorPosition( const SwFrm *pFrm );
+ void InvalidateFocus();
+
+ void SetCursorContext(
+ const ::vos::ORef < SwAccessibleContext >& rCursorContext );
+
+ // Invalidate state of whole tree. If an action is open, this call
+ // is processed when the last action ends.
+ // --> OD 2005-12-12 #i27301# - use new type definition for <_nStates>
+ void InvalidateStates( tAccessibleStates _nStates,
+ const SwFrm* _pFrm = 0 );
+
+ void InvalidateRelationSet( const SwFrm* pMaster, const SwFrm* pFollow );
+
+ /** invalidation CONTENT_FLOWS_FROM/_TO relation of a paragraph
+
+ OD 2005-12-01 #i27138#
+
+ @author OD
+
+ @param _rTxtFrm
+ input parameter - reference to paragraph, whose CONTENT_FLOWS_FROM/_TO
+ has to be invalidated.
+
+ @param _bFrom
+ input parameter - boolean indicating, if relation CONTENT_FLOWS_FROM
+ (value <true>) or CONTENT_FLOWS_TO (value <false>) has to be invalidated.
+ */
+ void InvalidateParaFlowRelation( const SwTxtFrm& _rTxtFrm,
+ const bool _bFrom );
+
+ /** invalidation of text selection of a paragraph
+
+ OD 2005-12-12 #i27301#
+
+ @author OD
+ */
+ void InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm );
+
+ /** invalidation of text selection of all paragraphs
+
+ OD 2005-12-13 #i27301#
+
+ @author OD
+ */
+ void InvalidateTextSelectionOfAllParas();
+
+ sal_Int32 GetChildIndex( const SwFrm& rParentFrm,
+ Window& rChild ) const;
+
+ // update preview data (and fire events if necessary)
+ // OD 15.01.2003 #103492# - complete re-factoring of method due to new
+ // page/print preview functionality.
+ void UpdatePreview( const std::vector<PrevwPage*>& _rPrevwPages,
+ const Fraction& _rScale,
+ const SwPageFrm* _pSelectedPageFrm,
+ const Size& _rPrevwWinSize );
+
+ void InvalidatePreViewSelection( sal_uInt16 nSelPage );
+ sal_Bool IsPageSelected( const SwPageFrm *pPageFrm ) const;
+
+ void FireEvents();
+
+
+ // IAccessibleViewForwarder
+
+ virtual sal_Bool IsValid() const;
+ virtual Rectangle GetVisibleArea() const;
+ virtual Point LogicToPixel (const Point& rPoint) const;
+ virtual Size LogicToPixel (const Size& rSize) const;
+ virtual Point PixelToLogic (const Point& rPoint) const;
+ virtual Size PixelToLogic (const Size& rSize) const;
+
+ // IAccessibleParent
+ virtual sal_Bool ReplaceChild (
+ ::accessibility::AccessibleShape* pCurrentChild,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rxShape,
+ const long _nIndex,
+ const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
+ ) throw (::com::sun::star::uno::RuntimeException);
+
+ // additional Core/Pixel conversions for internal use; also works
+ // for preview
+ Point PixelToCore (const Point& rPoint) const;
+ Rectangle CoreToPixel (const Rectangle& rRect) const;
+
+private:
+ /** get mapping mode for LogicToPixel and PixelToLogic conversions
+
+ OD 15.01.2003 #103492#
+ Replacement method <PreviewAdjust(..)> by new method <GetMapMode>.
+ Method returns mapping mode of current output device and adjusts it,
+ if the shell is in page/print preview.
+ Necessary, because <PreviewAdjust(..)> changes mapping mode at current
+ output device for mapping logic document positions to page preview window
+ positions and vice versa and doesn't take care to recover its changes.
+
+ @author OD
+
+ @param _rPoint
+ input parameter - constant reference to point to determine the mapping
+ mode adjustments for page/print preview.
+
+ @param _orMapMode
+ output parameter - reference to the mapping mode, which is determined
+ by the method
+ */
+ void GetMapMode( const Point& _rPoint,
+ MapMode& _orMapMode ) const;
+};
+#endif
diff --git a/sw/inc/acmplwrd.hxx b/sw/inc/acmplwrd.hxx
new file mode 100644
index 000000000000..af0cb98e4e6f
--- /dev/null
+++ b/sw/inc/acmplwrd.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ACMPLWRD_HXX
+#define _ACMPLWRD_HXX
+
+
+#define _SVSTDARR_STRINGSISORTDTOR
+#include <svl/svstdarr.hxx>
+
+class SwDoc;
+class SwAutoCompleteWord_Impl;
+class SwAutoCompleteClient;
+
+class SwAutoCompleteWord
+{
+ friend class SwAutoCompleteClient;
+
+ SvStringsISortDtor aWordLst; // contains extended strings carrying source information
+ SvPtrarr aLRULst;
+
+ SwAutoCompleteWord_Impl* pImpl;
+ sal_uInt16 nMaxCount, nMinWrdLen;
+ sal_Bool bLockWordLst;
+
+ void DocumentDying(const SwDoc& rDoc);
+public:
+ SwAutoCompleteWord( sal_uInt16 nWords = 500, sal_uInt16 nMWrdLen = 10 );
+ ~SwAutoCompleteWord();
+
+ sal_Bool InsertWord( const String& rWord, SwDoc& rDoc );
+
+ sal_Bool GetRange( const String& rWord, sal_uInt16& rStt, sal_uInt16& rEnd ) const;
+
+ const String& operator[]( sal_uInt16 n ) const { return *aWordLst[ n ]; }
+
+ sal_Bool IsLockWordLstLocked() const { return bLockWordLst; }
+ void SetLockWordLstLocked( sal_Bool bFlag ) { bLockWordLst = bFlag; }
+
+ void SetMaxCount( sal_uInt16 n );
+
+ sal_uInt16 GetMinWordLen() const { return nMinWrdLen; }
+ void SetMinWordLen( sal_uInt16 n );
+
+ const SvStringsISortDtor& GetWordList() const { return aWordLst; }
+ void CheckChangedList( const SvStringsISortDtor& rNewLst );
+};
+
+
+#endif
diff --git a/sw/inc/anchoreddrawobject.hxx b/sw/inc/anchoreddrawobject.hxx
new file mode 100644
index 000000000000..11b637957f8e
--- /dev/null
+++ b/sw/inc/anchoreddrawobject.hxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ANCHOREDDRAWOBJECT_HXX
+#define _ANCHOREDDRAWOBJECT_HXX
+
+#include <anchoredobject.hxx>
+#include <tools/gen.hxx>
+
+/** class for the positioning of drawing objects
+
+ OD 2004-03-25 #i26791#
+
+ @author OD
+*/
+class SW_DLLPUBLIC SwAnchoredDrawObject : public SwAnchoredObject
+{
+ private:
+ // boolean, indicating that the object position has been invalidated
+ // and that a positioning has to be performed.
+ bool mbValidPos;
+
+ // rectangle, keeping the last object rectangle after the postioning
+ // --> OD 2004-09-29 #i34748# - change <maLastObjRect> to a pointer
+ Rectangle* mpLastObjRect;
+
+ // boolean, indicating that anchored drawing object hasn't been attached
+ // to a anchor frame yet. Once, it is attached to a anchor frame the
+ // boolean changes its state.
+ bool mbNotYetAttachedToAnchorFrame;
+
+ // --> OD 2004-08-09 #i28749# - boolean, indicating that anchored
+ // drawing object hasn't been positioned yet. Once, it's positioned the
+ // boolean changes its state.
+ bool mbNotYetPositioned;
+
+ // --> OD 2006-03-17 #i62875#
+ // boolean, indicating that after change of layout direction the
+ // anchored drawing object has to be captured on the page, if it exceeds
+ // the left or right page margin.
+ // Needed for compatibility option <DoNotCaptureDrawObjsOnPage>
+ bool mbCaptureAfterLayoutDirChange;
+ // <--
+
+ /** method for the intrinsic positioning of a at-paragraph|at-character
+ anchored drawing object
+
+ OD 2004-08-12 #i32795# - helper method for method <MakeObjPos>
+
+ @author OD
+ */
+ void _MakeObjPosAnchoredAtPara();
+
+ /** method for the intrinsic positioning of a at-page|at-frame anchored
+ drawing object
+
+ OD 2004-08-12 #i32795# - helper method for method <MakeObjPos>
+
+ @author OD
+ */
+ void _MakeObjPosAnchoredAtLayout();
+
+ /** method to set positioning attributes (not for as-character anchored)
+
+ OD 2004-10-20 #i35798#
+ During load the positioning attributes aren't set.
+ Thus, the positioning attributes are set by the current object geometry.
+ This method is also used for the conversion for drawing objects
+ (not anchored as-character) imported from OpenOffice.org file format
+ once and directly before the first positioning.
+
+ @author OD
+ */
+ void _SetPositioningAttr();
+
+ /** method to set internal anchor position of <SdrObject> instance
+ of the drawing object
+
+ For drawing objects the internal anchor position of the <SdrObject>
+ instance has to be set.
+ Note: This adjustment is not be done for as-character anchored
+ drawing object - the positioning code takes care of this.
+ OD 2004-07-29 #i31698# - API for drawing objects in Writer has
+ been adjusted. Thus, this method will only set the internal anchor
+ position of the <SdrObject> instance to the anchor position given
+ by its anchor frame.
+
+ @author OD
+ */
+ void _SetDrawObjAnchor();
+
+ /** method to invalidate the given page frame
+
+ OD 2004-07-02 #i28701#
+
+ @author OD
+ */
+ void _InvalidatePage( SwPageFrm* _pPageFrm );
+
+ protected:
+ virtual void ObjectAttachedToAnchorFrame();
+
+ /** method to assure that anchored object is registered at the correct
+ page frame
+
+ OD 2004-07-02 #i28701#
+
+ @author OD
+ */
+ virtual void RegisterAtCorrectPage();
+
+ // --> OD 2006-08-10 #i68520#
+ virtual bool _SetObjTop( const SwTwips _nTop);
+ virtual bool _SetObjLeft( const SwTwips _nLeft);
+ // <--
+
+ // --> OD 2006-10-05 #i70122#
+ virtual const SwRect GetObjBoundRect() const;
+ // <--
+ public:
+ TYPEINFO();
+
+ SwAnchoredDrawObject();
+ virtual ~SwAnchoredDrawObject();
+
+ // declaration of pure virtual methods of base class <SwAnchoredObject>
+ virtual void MakeObjPos();
+ virtual void InvalidateObjPos();
+ inline bool IsValidPos() const
+ {
+ return mbValidPos;
+ }
+
+ // accessors to the format
+ virtual SwFrmFmt& GetFrmFmt();
+ virtual const SwFrmFmt& GetFrmFmt() const;
+
+ // accessors to the object area and its position
+ virtual const SwRect GetObjRect() const;
+ // --> OD 2004-09-29 #i34748# - change return type to a pointer.
+ // Return value can be NULL.
+ const Rectangle* GetLastObjRect() const;
+ // <--
+ // --> OD 2004-09-29 #i34748# - change method
+ void SetLastObjRect( const Rectangle& _rNewObjRect );
+ // <--
+
+ /** adjust positioning and alignment attributes for new anchor frame
+
+ OD 2004-04-21
+ Set horizontal and vertical position/alignment to manual position
+ relative to anchor frame area using the anchor position of the
+ new anchor frame and the current absolute drawing object position.
+ Note: For correct Undo/Redo method should only be called inside a
+ Undo-/Redo-action.
+ OD 2004-08-24 #i33313# - add second optional parameter <_pNewObjRect>
+
+ @author OD
+
+ @param <_pNewAnchorFrm>
+ input parameter - new anchor frame for the anchored object.
+
+ @param <_pNewObjRect>
+ optional input parameter - proposed new object rectangle. If not
+ provided the current object rectangle is taken.
+ */
+ void AdjustPositioningAttr( const SwFrm* _pNewAnchorFrm,
+ const SwRect* _pNewObjRect = 0L );
+
+ /** method to notify background of drawing object
+
+ OD 2004-06-30 #i28701#
+
+ @author OD
+ */
+ virtual void NotifyBackground( SwPageFrm* _pPageFrm,
+ const SwRect& _rRect,
+ PrepareHint _eHint );
+
+ // --> OD 2005-08-16 #i53320#
+ inline bool NotYetPositioned() const
+ {
+ return mbNotYetPositioned;
+ }
+ // <--
+
+ // --> OD 2006-03-17 #i62875#
+ // change of layout direction needs to be tracked
+ // for setting <mbCaptureAfterLayoutDirChange>.
+ virtual void UpdateLayoutDir();
+ // <--
+ // --> OD 2006-03-17 #i62875#
+ bool IsOutsidePage() const;
+ // <--
+
+ // new Loop control
+ void ValidateThis() { mbValidPos = true; }
+};
+
+#endif
diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx
new file mode 100644
index 000000000000..c9f53e51f069
--- /dev/null
+++ b/sw/inc/anchoredobject.hxx
@@ -0,0 +1,642 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ANCHOREDOBJECT_HXX
+#define _ANCHOREDOBJECT_HXX
+
+#include <tools/rtti.hxx>
+#include <swtypes.hxx>
+#include <swrect.hxx>
+
+class SdrObject;
+class SwFrm;
+class SwLayoutFrm;
+// --> OD 2004-07-14 #117380#
+class SwTxtFrm;
+// <--
+// --> OD 2004-06-30 #i28701#
+class SwPageFrm;
+class SwObjPositioningInProgress;
+// <--
+class SwFrmFmt;
+class SwFmtAnchor;
+
+/** wrapper class for the positioning of Writer fly frames and drawing objects
+
+ OD 2004-03-22 #i26791#
+ Purpose of this class is to provide a unified interface for the positioning
+ of Writer fly frames (derived classes of <SwFlyFrm>) and of drawing objects
+ (derived classes of <SwDrawFrm>).
+
+ @author OD
+*/
+class SW_DLLPUBLIC SwAnchoredObject
+{
+ private:
+ // drawing object representing the anchored object in the drawing layer
+ SdrObject* mpDrawObj;
+ // frame the object is anchored at
+ SwFrm* mpAnchorFrm;
+ // --> OD 2004-06-30 #i28701# - page frame the object is registered at
+ // note: no page frame for as-character anchored objects
+ SwPageFrm* mpPageFrm;
+ // <--
+ // current relative position (relative to anchor position of anchor frame)
+ Point maRelPos;
+
+ // for to-character anchored objects:
+ // Last known anchor character retangle.
+ // Used to decide, if invalidation has to been performed, if anchor position
+ // has changed, and used to position object.
+ SwRect maLastCharRect;
+
+ // for to-character anchored objects:
+ // Last known top of line, in which the anchor character is in.
+ // Used to decide, if invalidation has to been performed, if anchor position
+ // has changed, and used to position object.
+ SwTwips mnLastTopOfLine;
+
+ // for to-paragraph and to-character anchored objects:
+ // Layout frame vertical position is orient at - typically its the upper
+ // of the anchor frame, but it could also by the upper of a follow or
+ // a following layout frame in the text flow.
+ const SwLayoutFrm* mpVertPosOrientFrm;
+
+ // --> OD 2004-06-30 #i28701# - boolean, indicating that the object
+ // positioning algorithm is in progress.
+ bool mbPositioningInProgress;
+ // <--
+
+ // --> OD 2004-06-29 #i28701# - Booleans needed for the layout process.
+ // Values only of relevance for to-paragraph and to-character anchored
+ // floating screen object, for whose the 'straight-forward positioning
+ // process are applied
+ // Otherwise value of <mbConsiderForTextWrap> is treated as <true>,
+ // value of <mbPositionLocked> is treated as <false> and
+ // value of <mbRestartLayoutProcess> is treated as <false>.
+ // --> OD 2004-10-22 #i35911# - add boolean <mbClearEnvironment>
+ // Indicates that due to its position and wrapping style its layout
+ // environment is cleared - all content is moved forward.
+ // Treated as <false>, if not the 'straight-forward positioning process"
+ // is applied.
+ bool mbConsiderForTextWrap;
+ bool mbPositionLocked;
+ // --> OD 2005-01-10 #i40147# - boolean needed to keep position of
+ // anchored object locked due to special object positioning for sections.
+ bool mbKeepPositionLockedForSection;
+ // <--
+ bool mbRestartLayoutProcess;
+ bool mbClearedEnvironment;
+ // <--
+
+ // --> OD 2004-08-25 #i3317# - boolean, indicating that temporarly
+ // the wrapping style influence of the anchored object has to be
+ // considered during its positioning.
+ // This boolean is used, if compatibility option 'Consider wrapping style
+ // influence on object positioning' is OFF and a positioning loop is
+ // detected in method <SwFlyAtCntFrm::MakeAll()> or method
+ // <SwAnchoredDrawObject::_MakeObjPosAnchoredAtPara()>.
+ // The boolean is reset to <false>, when the layout process for a
+ // page frame starts - see class <NotifyLayoutOfPageInProgress>.
+ bool mbTmpConsiderWrapInfluence;
+ // <--
+
+ // --> OD 2006-06-21 #i68520#
+ mutable SwRect maObjRectWithSpaces;
+ mutable bool mbObjRectWithSpacesValid;
+ mutable SwRect maLastObjRect;
+ // <--
+
+ /** method to indicate, that positioning of anchored object is in progress
+
+ note: method is implemented empty
+
+ @author OD
+ */
+ friend class SwObjPositioningInProgress;
+ inline void SetPositioningInProgress( const bool _bPosInProgress )
+ {
+ mbPositioningInProgress = _bPosInProgress;
+ }
+
+
+ /** check anchor character rectangle
+
+ OD 2004-03-25 #i26791#
+ helper method for method <CheckCharRectAndTopOfLine()>
+ For to-character anchored Writer fly frames the member <maLastCharRect>
+ is updated. This is checked for change and depending on the applied
+ positioning, it's decided, if the Writer fly frame has to be invalidated.
+ OD 2004-07-14 #117380#
+ improvement - add second parameter <_rAnchorCharFrm>
+
+ @author OD
+
+ @param _rAnch
+ input parameter - reference to anchor position
+
+ @param _rAnchorCharFrm
+ input parameter - reference to the text frame containing the anchor
+ character.
+ */
+ void _CheckCharRect( const SwFmtAnchor& _rAnch,
+ const SwTxtFrm& _rAnchorCharFrm );
+
+ /** check top of line
+
+ OD 2004-03-25 #i26791#
+ helper method for method <CheckCharRectAndTopOfLine()>
+ For to-character anchored Writer fly frames the member <mnLastTopOfLine>
+ is updated. This is checked for change and depending on the applied
+ positioning, it's decided, if the Writer fly frame has to be invalidated.
+ OD 2004-07-14 #117380#
+ improvement - add second parameter <_rAnchorCharFrm>
+
+ @author OD
+
+ @param _rAnch
+ input parameter - reference to anchor position
+
+ @param _rAnchorCharFrm
+ input parameter - reference to the text frame containing the anchor
+ character.
+ */
+ void _CheckTopOfLine( const SwFmtAnchor& _rAnch,
+ const SwTxtFrm& _rAnchorCharFrm );
+
+ // --> OD 2005-03-30 #120729# - needed for the hotfix
+ // method <lcl_HideObj(..)> sets needed data structure values for the
+ // object positioning
+ friend bool lcl_HideObj( const SwTxtFrm& _rFrm,
+ const RndStdIds _eAnchorType,
+ const xub_StrLen _nObjAnchorPos,
+ SwAnchoredObject* _pAnchoredObj );
+ // <--
+ protected:
+ SwAnchoredObject();
+
+ void SetVertPosOrientFrm( const SwLayoutFrm& _rVertPosOrientFrm );
+
+ /** method to assure that anchored object is registered at the correct
+ page frame
+
+ OD 2004-07-02 #i28701#
+
+ @author OD
+ */
+ virtual void RegisterAtCorrectPage() = 0;
+
+ /** method to indicate, that anchored object is attached to a anchor frame
+
+ @author OD
+ */
+ virtual void ObjectAttachedToAnchorFrame();
+
+ /** method to determine, if other anchored objects, also attached at
+ to the anchor frame, have to consider its wrap influence.
+
+ // --> OD 2005-02-22 #i43255#
+
+ @author OD
+ */
+ bool ConsiderObjWrapInfluenceOfOtherObjs() const;
+
+ /** method to apply temporary consideration of wrapping style influence
+ to the anchored objects, which are anchored at the same anchor frame
+
+ OD 2006-07-24 #b6449874#
+
+ @author OD
+ */
+ void SetTmpConsiderWrapInfluenceOfOtherObjs( const bool bTmpConsiderWrapInfluence );
+
+ // --> OD 2006-08-10 #i68520#
+ virtual bool _SetObjTop( const SwTwips _nTop) = 0;
+ virtual bool _SetObjLeft( const SwTwips _nLeft) = 0;
+ // <--
+
+ // --> OD 2006-10-05 #i70122#
+ virtual const SwRect GetObjBoundRect() const = 0;
+ // <--
+ public:
+ TYPEINFO();
+
+ virtual ~SwAnchoredObject();
+
+ // accessors to member <mpDrawObj>
+ void SetDrawObj( SdrObject& _rDrawObj );
+ const SdrObject* GetDrawObj() const;
+ SdrObject* DrawObj();
+
+ // accessors to member <mpAnchorFrm>
+ const SwFrm* GetAnchorFrm() const;
+ SwFrm* AnchorFrm();
+ void ChgAnchorFrm( SwFrm* _pNewAnchorFrm );
+ /** determine anchor frame containing the anchor position
+
+ OD 2004-10-08 #i26945#
+ the anchor frame, which is determined, is <mpAnchorFrm>
+ for an at-page, at-frame or at-paragraph anchored object
+ and the anchor character frame for an at-character and as-character
+ anchored object.
+
+ @author OD
+ */
+ SwFrm* GetAnchorFrmContainingAnchPos();
+
+ // --> OD 2004-06-30 #i28701# - accessors to member <mpPageFrm>
+ SwPageFrm* GetPageFrm();
+ const SwPageFrm* GetPageFrm() const;
+ void SetPageFrm( SwPageFrm* _pNewPageFrm );
+ // <--
+
+ /** method to determine the page frame, on which the 'anchor' of
+ the given anchored object is.
+
+ OD 2004-07-02 #i28701#
+ OD 2004-09-23 #i33751#, #i34060#
+ Adjust meaning of method and thus its name: If the anchored object
+ or its anchor isn't correctly inserted in the layout, no page frame
+ can be found. Thus, the return type changed to be a pointer and can
+ be NULL.
+
+ @author OD
+
+ @param _rAnchoredObj
+ input parameter - anchored object, for which the page frame of its
+ 'anchor' has to be determined.
+
+ @return SwPageFrm&
+ page frame, the 'anchor' of the given anchored object is on
+ */
+ SwPageFrm* FindPageFrmOfAnchor();
+
+ /** get frame, which contains the anchor character, if the object
+ is anchored at-character or as-character.
+
+ OD 2004-10-04 #i26945#
+
+ @author OD
+
+ @return SwTxtFrm*
+ text frame containing the anchor character. It's NULL, if the object
+ isn't anchored at-character resp. as-character.
+ */
+ SwTxtFrm* FindAnchorCharFrm();
+
+ // accessors to data of position calculation:
+ // frame vertical position is orient at
+ inline const SwLayoutFrm* GetVertPosOrientFrm() const
+ {
+ return mpVertPosOrientFrm;
+ }
+ // --> OD 2004-11-29 #115759# - method to clear member <mpVertPosOrientFrm>
+ inline void ClearVertPosOrientFrm()
+ {
+ mpVertPosOrientFrm = 0L;
+ }
+ // <--
+
+ /** check anchor character rectangle and top of line
+
+ OD 2004-03-25 #i26791#
+ For to-character anchored Writer fly frames the members <maLastCharRect>
+ and <maLastTopOfLine> are updated. These are checked for change and
+ depending on the applied positioning, it's decided, if the Writer fly
+ frame has to be invalidated.
+ OD 2004-07-15 #117380#
+ add parameter <_bCheckForParaPorInf>, default value <true>
+
+ @author OD
+
+ @param _bCheckForParaPorInf
+ input parameter - boolean indicating, if check on paragraph portion
+ information has to be done.
+ */
+ void CheckCharRectAndTopOfLine( const bool _bCheckForParaPorInf = true );
+
+ // accessors to member <maLastCharRect>
+ const SwRect& GetLastCharRect() const;
+ SwTwips GetRelCharX( const SwFrm* pFrm ) const;
+ SwTwips GetRelCharY( const SwFrm* pFrm ) const;
+ void AddLastCharY( long nDiff );
+ void ResetLastCharRectHeight();
+
+ // accessor to member <nmLastTopOfLine>
+ SwTwips GetLastTopOfLine() const;
+ // OD 2004-05-18 #i28701# - follow-up of #i22341#
+ void AddLastTopOfLineY( SwTwips _nDiff );
+
+ /** reset members <maLastCharRect> and <mnLastTopOfLine>
+
+ OD 2004-06-29 #i27801#
+
+ @author OD
+ */
+ void ClearCharRectAndTopOfLine();
+
+ /** method to determine position for the object and set the position
+ at the object
+
+ @author OD
+ */
+ virtual void MakeObjPos() = 0;
+
+ /** is positioning of anchored object in progress
+
+ @author OD
+ */
+ inline bool IsPositioningInProgress() const
+ {
+ return mbPositioningInProgress;
+ }
+
+ /** method to determine, if invalidation of position is allowed
+
+ OD 2004-07-01 #i28701#
+
+ @author OD
+ */
+ bool InvalidationOfPosAllowed() const;
+
+ /** method to invalidate position of the anchored object
+
+ @author OD
+ */
+ virtual void InvalidateObjPos() = 0;
+
+ /** method to perform necessary invalidations for the positioning of
+ objects, for whose the wrapping style influence has to be considered
+ on the object positioning.
+
+ OD 2004-06-30 #i28701#
+
+ @author OD
+ */
+ void InvalidateObjPosForConsiderWrapInfluence( const bool _bNotifyBackgrd );
+
+ /** method to trigger notification of 'background'
+
+ OD 2004-07-01 #i28701#
+
+ @author OD
+ */
+ virtual void NotifyBackground( SwPageFrm* _pPageFrm,
+ const SwRect& _rRect,
+ PrepareHint _eHint ) = 0;
+
+ // accessors to the current relative position (relative to anchor
+ // position of anchor frame)
+ const Point GetCurrRelPos() const;
+ void SetCurrRelPos( Point _aRelPos );
+
+ // accessors to the format
+ virtual SwFrmFmt& GetFrmFmt() = 0;
+ virtual const SwFrmFmt& GetFrmFmt() const = 0;
+
+ // accessors to the object area and its position
+ virtual const SwRect GetObjRect() const = 0;
+ // --> OD 2006-08-10 #i68520#
+ void SetObjTop( const SwTwips _nTop);
+ void SetObjLeft( const SwTwips _nLeft);
+ // <--
+
+ /** method update layout direction the layout direction, the anchored
+ object is assigned to
+
+ OD 2004-07-27 #i31698#
+ method has typically to be called, if the anchored object gets its
+ anchor frame assigned and if the anchor frame changes its layout direction
+ OD 2006-03-17 #i62875#
+ made virtual, because it's needed to be overloaded by <SwAnchoredDrawObject>
+
+ @author OD
+ */
+ virtual void UpdateLayoutDir();
+
+ /** method to determine object area inclusive its spacing
+
+ OD 2004-06-30 #i28701#
+ OD 2006-08-10 #i68520# - return constant reference
+
+ @author OD
+ */
+ const SwRect& GetObjRectWithSpaces() const;
+
+ // --> OD 2006-08-10 #i68520#
+ inline void InvalidateObjRectWithSpaces() const
+ {
+ mbObjRectWithSpacesValid = false;
+ }
+ // <--
+
+ /** method to determine, if wrapping style influence of the anchored
+ object has to be considered on the object positioning
+
+ OD 2004-06-30 #i28701#
+ Note: result of this method also decides, if the boolean for the
+ layout process are of relevance.
+
+ @author OD
+ */
+ bool ConsiderObjWrapInfluenceOnObjPos() const;
+
+ // --> OD 2004-06-29 #i28701# - accessors to booleans for layout process
+ bool ConsiderForTextWrap() const;
+ void SetConsiderForTextWrap( const bool _bConsiderForTextWrap );
+ bool PositionLocked() const;
+ inline void LockPosition()
+ {
+ mbPositionLocked = true;
+ }
+ inline void UnlockPosition()
+ {
+ if ( !mbKeepPositionLockedForSection )
+ {
+ mbPositionLocked = false;
+ }
+ }
+ // --> OD 2005-01-10 #i40147#
+ inline void SetKeepPosLocked( const bool _bKeepPosLocked )
+ {
+ mbKeepPositionLockedForSection = _bKeepPosLocked;
+ }
+ // <--
+ bool RestartLayoutProcess() const;
+ void SetRestartLayoutProcess( const bool _bRestartLayoutProcess );
+ // --> OD 2004-10-22 #i35911# - accessors for <mbClearedEnvironment>
+ bool ClearedEnvironment() const;
+ void SetClearedEnvironment( const bool _bClearedEnvironment );
+ // <--
+ // --> OD 2005-03-03 #i43913# - reset booleans for layout process
+ inline void ResetLayoutProcessBools()
+ {
+ mbPositioningInProgress = false;
+ mbConsiderForTextWrap = false;
+ mbPositionLocked = false;
+ mbKeepPositionLockedForSection = false;
+ mbRestartLayoutProcess = false;
+ mbClearedEnvironment = false;
+ mbTmpConsiderWrapInfluence = false;
+ }
+ // <--
+
+ /** method to determine, if due to anchored object size and wrapping
+ style, its layout environment is cleared.
+
+ OD 2004-10-22 #i35911#
+
+ @author OD
+ */
+ bool HasClearedEnvironment() const;
+
+ /** method to update anchored object in the <SwSortedObjs> lists
+
+ OD 2004-07-01 #i28701#
+ Method is not proposed to be called during a layout process is
+ running. It has been used on the change of the anchored object
+ attributes, which belongs the sort criteria of <SwSortedObjs>.
+ If document compatibility option 'Consider wrapping style influence
+ on object positioning' is ON, additionally all anchored objects
+ at the anchor frame and all following anchored objects on the page
+ frame are invalidated.
+
+ @author OD
+ */
+ void UpdateObjInSortedList();
+
+ /** method to determine, if a format on the anchored object is possible
+
+ OD 2004-07-23 #i28701#
+ A format isn't possible, if anchored object is in an invisible layer.
+ Note: method is virtual to refine the conditions for the sub-classes.
+
+ @author OD
+ */
+ virtual bool IsFormatPossible() const;
+
+ // --> OD 2004-08-25 #i3317# - accessors to member <mbTmpConsiderWrapInfluence>
+ void SetTmpConsiderWrapInfluence( const bool _bTmpConsiderWrapInfluence );
+ bool IsTmpConsiderWrapInfluence() const;
+ // <--
+
+ /** method to determine, if the anchored object is overlapping with a
+ previous column
+
+ OD 2004-08-25 #i3317#
+ overlapping with a previous column means, that the object overlaps
+ with a column, which is a previous one of the column its anchor
+ frame is in.
+ Only applied for at-paragraph and at-character anchored objects.
+
+ @author OD
+ */
+ bool OverlapsPrevColumn() const;
+
+ /** method to determine position of anchored object relative to
+ anchor frame
+
+ OD 2005-01-06 #i30669#
+ Usage: Needed layout information for WW8 export
+
+ @author OD
+
+ @return Point - determined relative position
+ */
+ Point GetRelPosToAnchorFrm() const;
+
+ /** method to determine position of anchored object relative to
+ page frame
+
+ OD 2005-01-06 #i30669#
+ Usage: Needed layout information for WW8 export
+ OD 2005-01-27 #i33818# - add parameters <_bFollowTextFlow> and
+ <_obRelToTableCell>
+ If <_bFollowTextFlow> is set and object is anchored inside table,
+ the position relative to the table cell is determined. Output
+ parameter <_obRelToTableCell> reflects this situation
+
+ @author OD
+
+ @param _bFollowTextFlow
+ input parameter - boolean indicating, if the anchored object has to
+ follow the text flow.
+
+ @param _obRelToTableCell
+ output parameter - boolean indicating, the determine position is
+ relative to the table cell
+
+ @return Point - determined relative position
+ */
+ Point GetRelPosToPageFrm( const bool _bFollowTextFlow,
+ bool& _obRelToTableCell ) const;
+
+ /** method to determine position of anchored object relative to
+ anchor character
+
+ OD 2005-01-06 #i30669#
+ Usage: Needed layout information for WW8 export
+
+ @author OD
+
+ @return Point - determined relative position
+ */
+ Point GetRelPosToChar() const;
+
+ /** method to determine position of anchored object relative to
+ top of line
+
+ OD 2005-01-06 #i30669#
+ Usage: Needed layout information for WW8 export
+
+ @author OD
+
+ @return Point - determined relative position
+ */
+ Point GetRelPosToLine() const;
+};
+
+// ============================================================================
+// OD 2004-04-13 #i26791#, #i28701#
+// helper class for notify that positioning of an anchored object is in progress
+// ============================================================================
+class SwObjPositioningInProgress
+{
+ private:
+ SwAnchoredObject* mpAnchoredObj;
+ // --> OD 2005-08-09 #i52904# - introduce boolean indicating old state
+ // of anchored object regarding positioning in progress in order to
+ // consider nested usage of class <SwObjPositioningInProgress>
+ bool mbOldObjPositioningInProgress;
+ // <--
+
+ public:
+ SwObjPositioningInProgress( SdrObject& _rSdrObj );
+ SwObjPositioningInProgress( SwAnchoredObject& _rAnchoredObj );
+ ~SwObjPositioningInProgress();
+};
+
+#endif
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
new file mode 100644
index 000000000000..67ca9eb2b02f
--- /dev/null
+++ b/sw/inc/authfld.hxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_AUTHFLD_HXX
+#define SW_AUTHFLD_HXX
+
+#include "swdllapi.h"
+#include <fldbas.hxx>
+#include <toxe.hxx>
+
+#define _SVSTDARR_LONGS
+#include <svl/svstdarr.hxx>
+
+class SwAuthDataArr;
+/* -----------------21.09.99 13:32-------------------
+
+ --------------------------------------------------*/
+class SwAuthEntry
+{
+ String aAuthFields[AUTH_FIELD_END];
+ sal_uInt16 nRefCount;
+public:
+ SwAuthEntry() : nRefCount(0){}
+ SwAuthEntry( const SwAuthEntry& rCopy );
+ sal_Bool operator==(const SwAuthEntry& rComp);
+
+ inline const String& GetAuthorField(ToxAuthorityField ePos)const;
+ inline void SetAuthorField(ToxAuthorityField ePos,
+ const String& rField);
+
+ void AddRef() { ++nRefCount; }
+ void RemoveRef() { --nRefCount; }
+ sal_uInt16 GetRefCount() { return nRefCount; }
+};
+/* -----------------20.10.99 16:49-------------------
+
+ --------------------------------------------------*/
+struct SwTOXSortKey
+{
+ ToxAuthorityField eField;
+ sal_Bool bSortAscending;
+ SwTOXSortKey() :
+ eField(AUTH_FIELD_END),
+ bSortAscending(sal_True){}
+};
+
+/* -----------------14.09.99 16:15-------------------
+
+ --------------------------------------------------*/
+class SwAuthorityField;
+class SortKeyArr;
+
+class SW_DLLPUBLIC SwAuthorityFieldType : public SwFieldType
+{
+ SwDoc* m_pDoc;
+ SwAuthDataArr* m_pDataArr;
+ SvLongs* m_pSequArr;
+ SortKeyArr* m_pSortKeyArr;
+ sal_Unicode m_cPrefix;
+ sal_Unicode m_cSuffix;
+ sal_Bool m_bIsSequence :1;
+ sal_Bool m_bSortByDocument :1;
+ LanguageType m_eLanguage;
+ String m_sSortAlgorithm;
+
+ // @@@ private copy assignment, but public copy ctor? @@@
+ const SwAuthorityFieldType& operator=( const SwAuthorityFieldType& );
+
+protected:
+virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
+
+public:
+ SwAuthorityFieldType(SwDoc* pDoc);
+ SwAuthorityFieldType( const SwAuthorityFieldType& );
+ ~SwAuthorityFieldType();
+
+ virtual SwFieldType* Copy() const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId );
+
+ inline void SetDoc(SwDoc* pNewDoc) { m_pDoc = pNewDoc; }
+ SwDoc* GetDoc(){ return m_pDoc; }
+ void RemoveField(long nHandle);
+ long AddField(const String& rFieldContents);
+ sal_Bool AddField(long nHandle);
+ void DelSequenceArray()
+ {
+ m_pSequArr->Remove(0, m_pSequArr->Count());
+ }
+
+ const SwAuthEntry* GetEntryByHandle(long nHandle) const;
+
+ void GetAllEntryIdentifiers( SvStringsDtor& rToFill )const;
+ const SwAuthEntry* GetEntryByIdentifier(const String& rIdentifier)const;
+
+ bool ChangeEntryContent(const SwAuthEntry* pNewEntry);
+ // import interface
+ sal_uInt16 AppendField(const SwAuthEntry& rInsert);
+ long GetHandle(sal_uInt16 nPos);
+
+ sal_uInt16 GetSequencePos(long nHandle);
+
+ sal_Bool IsSequence() const {return m_bIsSequence;}
+ void SetSequence(sal_Bool bSet)
+ {
+ DelSequenceArray();
+ m_bIsSequence = bSet;
+ }
+
+ void SetPreSuffix( sal_Unicode cPre, sal_Unicode cSuf)
+ {
+ m_cPrefix = cPre;
+ m_cSuffix = cSuf;
+ }
+ sal_Unicode GetPrefix() const { return m_cPrefix;}
+ sal_Unicode GetSuffix() const { return m_cSuffix;}
+
+ sal_Bool IsSortByDocument() const {return m_bSortByDocument;}
+ void SetSortByDocument(sal_Bool bSet)
+ {
+ DelSequenceArray();
+ m_bSortByDocument = bSet;
+ }
+
+ sal_uInt16 GetSortKeyCount() const ;
+ const SwTOXSortKey* GetSortKey(sal_uInt16 nIdx) const ;
+ void SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey nKeys[]);
+
+ //initui.cxx
+ static const String& GetAuthFieldName(ToxAuthorityField eType);
+ static const String& GetAuthTypeName(ToxAuthorityType eType);
+
+ LanguageType GetLanguage() const {return m_eLanguage;}
+ void SetLanguage(LanguageType nLang) {m_eLanguage = nLang;}
+
+ const String& GetSortAlgorithm()const {return m_sSortAlgorithm;}
+ void SetSortAlgorithm(const String& rSet) {m_sSortAlgorithm = rSet;}
+
+};
+/* -----------------14.09.99 16:15-------------------
+
+ --------------------------------------------------*/
+class SwAuthorityField : public SwField
+{
+ long m_nHandle;
+ mutable long m_nTempSequencePos;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ SwAuthorityField(SwAuthorityFieldType* pType, const String& rFieldContents);
+ SwAuthorityField(SwAuthorityFieldType* pType, long nHandle);
+ ~SwAuthorityField();
+
+ const String& GetFieldText(ToxAuthorityField eField) const;
+
+ virtual void SetPar1(const String& rStr);
+ virtual SwFieldType* ChgTyp( SwFieldType* );
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId );
+
+ long GetHandle() const { return m_nHandle; }
+
+ virtual String GetDescription() const;
+};
+
+// --- inlines -----------------------------------------------------------
+inline const String& SwAuthEntry::GetAuthorField(ToxAuthorityField ePos)const
+{
+ DBG_ASSERT(AUTH_FIELD_END > ePos, "wrong index");
+ return aAuthFields[ePos];
+}
+inline void SwAuthEntry::SetAuthorField(ToxAuthorityField ePos, const String& rField)
+{
+ DBG_ASSERT(AUTH_FIELD_END > ePos, "wrong index");
+ if(AUTH_FIELD_END > ePos)
+ aAuthFields[ePos] = rField;
+}
+
+#endif
+
diff --git a/sw/inc/authratr.hxx b/sw/inc/authratr.hxx
new file mode 100644
index 000000000000..06ffbe633ac2
--- /dev/null
+++ b/sw/inc/authratr.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _AUTHRATR_HXX
+#define _AUTHRATR_HXX
+
+#include <tools/solar.h>
+#include <tools/color.hxx>
+#include "swdllapi.h"
+
+#define COL_NONE TRGB_COLORDATA( 0x80, 0xFF, 0xFF, 0xFF )
+
+class SW_DLLPUBLIC AuthorCharAttr
+{
+public:
+ sal_uInt16 nItemId;
+ sal_uInt16 nAttr;
+ ColorData nColor;
+
+ AuthorCharAttr();
+
+ inline sal_Bool operator == ( const AuthorCharAttr& rAttr ) const
+ {
+ return nItemId == rAttr.nItemId && nAttr == rAttr.nAttr &&
+ nColor == rAttr.nColor;
+ }
+};
+
+
+#endif
diff --git a/sw/inc/bparr.hxx b/sw/inc/bparr.hxx
new file mode 100644
index 000000000000..731dddd2e3fe
--- /dev/null
+++ b/sw/inc/bparr.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _BPARR_HXX
+#define _BPARR_HXX
+
+#include <tools/solar.h>
+#include <tools/debug.hxx>
+#include <swdllapi.h>
+
+struct BlockInfo;
+class BigPtrArray;
+
+class BigPtrEntry
+{
+ friend class BigPtrArray;
+ BlockInfo* pBlock;
+ sal_uInt16 nOffset;
+public:
+ virtual ~BigPtrEntry() {}
+protected:
+ BigPtrEntry() : pBlock(0), nOffset(0) {}
+
+ inline sal_uLong GetPos() const;
+ inline BigPtrArray& GetArray() const;
+};
+typedef BigPtrEntry* ElementPtr;
+
+
+typedef sal_Bool (*FnForEach)( const ElementPtr&, void* pArgs );
+
+// 1000 Eintrge pro Block = etwas weniger als 4K
+#define MAXENTRY 1000
+
+
+// Anzahl Eintraege, die bei der Kompression frei bleiben duerfen
+// dieser Wert ist fuer den Worst Case, da wir MAXBLOCK mit ca 25%
+// Overhead definiert haben, reichen 80% = 800 Eintraege vollkommen aus
+// Will mann voellige Kompression haben, muss eben 100 angegeben werden.
+
+#define COMPRESSLVL 80
+
+struct BlockInfo { // Block-Info:
+ BigPtrArray* pBigArr; // in diesem Array steht der Block
+ ElementPtr* pData; // Datenblock
+ sal_uLong nStart, nEnd; // Start- und EndIndex
+ sal_uInt16 nElem; // Anzahl Elemente
+};
+
+class SW_DLLPUBLIC BigPtrArray
+{
+ BlockInfo** ppInf; // Block-Infos
+ sal_uLong nSize; // Anzahl Elemente
+ sal_uInt16 nMaxBlock; // akt. max Anzahl Bloecke
+ sal_uInt16 nBlock; // Anzahl Bloecke
+ sal_uInt16 nCur; // letzter Block
+
+ sal_uInt16 Index2Block( sal_uLong ) const; // Blocksuche
+ BlockInfo* InsBlock( sal_uInt16 ); // Block einfuegen
+ void BlockDel( sal_uInt16 ); // es wurden Bloecke geloescht
+ void UpdIndex( sal_uInt16 ); // Indexe neu berechnen
+
+protected:
+ // fuelle alle Bloecke auf.
+ // Der short gibt in Prozent an, wie voll die Bloecke werden sollen.
+ // Der ReturnWert besagt, das irgendetwas "getan" wurde
+ sal_uInt16 Compress( short = COMPRESSLVL );
+
+public:
+ BigPtrArray();
+ ~BigPtrArray();
+
+ sal_uLong Count() const { return nSize; }
+
+ void Insert( const ElementPtr& r, sal_uLong pos );
+ void Remove( sal_uLong pos, sal_uLong n = 1 );
+ void Move( sal_uLong from, sal_uLong to );
+ void Replace( sal_uLong pos, const ElementPtr& r);
+
+ ElementPtr operator[]( sal_uLong ) const;
+ void ForEach( FnForEach fn, void* pArgs = NULL )
+ {
+ ForEach( 0, nSize, fn, pArgs );
+ }
+ void ForEach( sal_uLong nStart, sal_uLong nEnd, FnForEach fn, void* pArgs = NULL );
+};
+
+
+
+inline sal_uLong BigPtrEntry::GetPos() const
+{
+ DBG_ASSERT( this == pBlock->pData[ nOffset ], "Element nicht im Block" );
+ return pBlock->nStart + nOffset;
+}
+
+inline BigPtrArray& BigPtrEntry::GetArray() const
+{
+ return *pBlock->pBigArr;
+}
+
+
+#endif
diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx
new file mode 100644
index 000000000000..9427b4d26c6e
--- /dev/null
+++ b/sw/inc/breakit.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _BREAKIT_HXX
+#define _BREAKIT_HXX
+
+#include <tools/solar.h>
+#include <i18npool/lang.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/XScriptTypeDetector.hpp>
+#include <com/sun/star/i18n/ForbiddenCharacters.hdl>
+#include <swdllapi.h>
+
+class String;
+
+/*************************************************************************
+ * class SwBreakIt
+ *************************************************************************/
+
+
+class SW_DLLPUBLIC SwBreakIt
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF;
+ mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xBreak;
+ com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > xCTLDetect;
+
+
+ com::sun::star::lang::Locale * m_pLocale;
+ com::sun::star::i18n::ForbiddenCharacters * m_pForbidden;
+
+ LanguageType aLast; // language of the current locale
+ LanguageType aForbiddenLang; // language of the current forbiddenChar struct
+
+ void _GetLocale( const LanguageType aLang );
+ void _GetForbidden( const LanguageType aLang );
+
+ void createBreakIterator() const;
+ void createScriptTypeDetector();
+
+ // forbidden and not implemented.
+ SwBreakIt();
+ SwBreakIt( const SwBreakIt &);
+ SwBreakIt & operator= ( const SwBreakIt &);
+
+ // private (see @ _Create, _Delete).
+ explicit SwBreakIt(
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rxMSF);
+ ~SwBreakIt();
+
+public:
+ // private (see @ source/core/bastyp/init.cxx).
+ static void _Create(
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rxMSF);
+ static void _Delete();
+
+public:
+ static SwBreakIt * Get();
+
+ com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > GetBreakIter()
+ {
+ createBreakIterator();
+ return xBreak;
+ }
+
+ com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > GetScriptTypeDetector()
+ {
+ createScriptTypeDetector();
+ return xCTLDetect;
+ }
+
+ const com::sun::star::lang::Locale& GetLocale( const LanguageType aLang )
+ {
+ if( !m_pLocale || aLast != aLang )
+ _GetLocale( aLang );
+ return *m_pLocale;
+ }
+
+ const com::sun::star::i18n::ForbiddenCharacters& GetForbidden( const LanguageType aLang )
+ {
+ if( !m_pForbidden || aForbiddenLang != aLang )
+ _GetForbidden( aLang );
+ return *m_pForbidden;
+ }
+
+ sal_uInt16 GetRealScriptOfText( const String& rTxt, xub_StrLen nPos ) const;
+ sal_uInt16 GetAllScriptsOfText( const String& rTxt ) const;
+};
+
+#define SW_BREAKITER() SwBreakIt::Get()
+#define SW_XBREAKITER() SW_BREAKITER()->GetBreakIter()
+
+// @@@ backward compatibility @@@
+SW_DLLPUBLIC extern SwBreakIt* pBreakIt;
+
+#endif
+
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
new file mode 100644
index 000000000000..f34ea4d9995e
--- /dev/null
+++ b/sw/inc/calbck.hxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CALBCK_HXX
+#define _CALBCK_HXX
+
+#include <tools/rtti.hxx>
+#include "swdllapi.h"
+#include <boost/noncopyable.hpp>
+
+class SwModify;
+class SwClientIter;
+class SfxPoolItem;
+class SfxHint;
+
+/*
+ SwModify and SwClient cooperate in propagating attribute changes.
+ If an attribute changes, the change is notified to all dependent
+ formats and other interested objects, e.g. Nodes. The clients will detect
+ if the change affects them. It could be that the changed attribute is
+ overruled in the receiving object so that its change does not become
+ effective or that the receiver is not interested in the particular attribute
+ in general (though probably in other attributes of the SwModify object they
+ are registered in).
+ As SwModify objects are derived from SwClient, they can create a chain of SwClient
+ objects where changes can get propagated through.
+ Each SwClient can be registered at only one SwModify object, while each SwModify
+ object is connected to a list of SwClient objects. If an object derived from SwClient
+ wants to get notifications from more than one SwModify object, it must create additional
+ SwClient objects. The SwDepend class allows to handle their notifications in the same
+ notification callback as it forwards the Modify() calls it receives to a "master"
+ SwClient implementation.
+ The SwClientIter class allows to iterate over the SwClient objects registered at an
+ SwModify. For historical reasons its ability to use TypeInfo to restrict this iteration
+ to objects of a particular type created a lot of code that misuses SwClient-SwModify
+ relationships that basically should be used only for Modify() callbacks.
+ This is still subject to refactoring.
+ Until this gets resolved, new SwClientIter base code should be reduced to the absolute
+ minimum and it also should be wrapped by SwIterator templates that prevent that the
+ code gets polluted by pointer casts (see switerator.hxx).
+ */
+
+// ----------
+// SwClient
+// ----------
+
+class SW_DLLPUBLIC SwClient : ::boost::noncopyable
+{
+ // avoids making the details of the linked list and the callback method public
+ friend class SwModify;
+ friend class SwClientIter;
+
+ SwClient *pLeft, *pRight; // double-linked list of other clients
+ SwModify *pRegisteredIn; // event source
+
+ // in general clients should not be removed when their SwModify sends out Modify()
+ // notifications; in some rare cases this is necessary, but only the concrete SwClient
+ // sub class will know that; this flag allows to make that known
+ bool mbIsAllowedToBeRemovedInModifyCall;
+
+ // callbacks received from SwModify (friend class - so these methods can be private)
+ // should be called only from SwModify the client is registered in
+ // mba: IMHO these methods should be pure virtual
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+ virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint );
+
+protected:
+ // single argument ctors shall be explicit.
+ explicit SwClient(SwModify *pToRegisterIn);
+
+ // write access to pRegisteredIn shall be granted only to the object itself (protected access)
+ SwModify* GetRegisteredInNonConst() const { return pRegisteredIn; }
+ void SetIsAllowedToBeRemovedInModifyCall( bool bSet ) { mbIsAllowedToBeRemovedInModifyCall = bSet; }
+
+public:
+
+ inline SwClient();
+ virtual ~SwClient();
+
+ // in case an SwModify object is destroyed that itself is registered in another SwModify,
+ // its SwClient objects can decide to get registered to the latter instead by calling this method
+ void CheckRegistration( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue );
+
+ // controlled access to Modify method
+ // mba: this is still considered a hack and it should be fixed; the name makes grep-ing easier
+ void ModifyNotification( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue ) { Modify ( pOldValue, pNewValue ); }
+ void SwClientNotifyCall( const SwModify& rModify, const SfxHint& rHint ) { SwClientNotify( rModify, rHint ); }
+
+ const SwModify* GetRegisteredIn() const { return pRegisteredIn; }
+ bool IsLast() const { return !pLeft && !pRight; }
+
+ // needed for class SwClientIter
+ TYPEINFO();
+
+ // get information about attribute
+ virtual sal_Bool GetInfo( SfxPoolItem& ) const;
+};
+
+inline SwClient::SwClient() :
+ pLeft(0), pRight(0), pRegisteredIn(0), mbIsAllowedToBeRemovedInModifyCall(false)
+{}
+
+// ----------
+// SwModify
+// ----------
+
+class SW_DLLPUBLIC SwModify: public SwClient
+{
+// friend class SwClientIter;
+
+ SwClient* pRoot; // the start of the linked list of clients
+ sal_Bool bModifyLocked : 1; // don't broadcast changes now
+ sal_Bool bLockClientList : 1; // may be set when this instance notifies its clients
+ sal_Bool bInDocDTOR : 1; // workaround for problems when a lot of objects are destroyed
+ sal_Bool bInCache : 1;
+ sal_Bool bInSwFntCache : 1;
+
+ // mba: IMHO this method should be pure virtual
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwModify();
+
+ // broadcasting: send notifications to all clients
+ void NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue );
+
+ // the same, but without setting bModifyLocked or checking for any of the flags
+ // mba: it would be interesting to know why this is necessary
+ // also allows to limit callback to certain type (HACK)
+ void ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, TypeId nType = TYPE(SwClient) );
+
+ // a more universal broadcasting mechanism
+ void CallSwClientNotify( const SfxHint& rHint ) const;
+
+ // single argument ctors shall be explicit.
+ explicit SwModify( SwModify *pToRegisterIn );
+ virtual ~SwModify();
+
+ void Add(SwClient *pDepend);
+ SwClient* Remove(SwClient *pDepend);
+ const SwClient* GetDepends() const { return pRoot; }
+
+ // get information about attribute
+ virtual sal_Bool GetInfo( SfxPoolItem& ) const;
+
+ void LockModify() { bModifyLocked = sal_True; }
+ void UnlockModify() { bModifyLocked = sal_False; }
+ void SetInCache( sal_Bool bNew ) { bInCache = bNew; }
+ void SetInSwFntCache( sal_Bool bNew ) { bInSwFntCache = bNew; }
+ void SetInDocDTOR() { bInDocDTOR = sal_True; }
+ sal_Bool IsModifyLocked() const { return bModifyLocked; }
+ sal_Bool IsInDocDTOR() const { return bInDocDTOR; }
+ sal_Bool IsInCache() const { return bInCache; }
+ sal_Bool IsInSwFntCache() const { return bInSwFntCache; }
+
+ void CheckCaching( const sal_uInt16 nWhich );
+ bool IsLastDepend() { return pRoot && pRoot->IsLast(); }
+ int GetClientCount() const;
+};
+
+// ----------
+// SwDepend
+// ----------
+
+/*
+ * Helper class for objects that need to depend on more than one SwClient
+ */
+class SW_DLLPUBLIC SwDepend: public SwClient
+{
+ SwClient *pToTell;
+
+public:
+ SwDepend() : pToTell(0) {}
+ SwDepend(SwClient *pTellHim, SwModify *pDepend);
+
+ SwClient* GetToTell() { return pToTell; }
+
+ virtual sal_Bool GetInfo( SfxPoolItem & ) const;
+
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNewValue );
+ virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint );
+};
+
+
+class SwClientIter
+{
+ friend SwClient* SwModify::Remove(SwClient *); // for pointer adjustments
+ friend void SwModify::Add(SwClient *pDepend); // for pointer adjustments
+
+ const SwModify& rRoot;
+
+ // the current object in an iteration
+ SwClient* pAct;
+
+ // in case the current object is already removed, the next object in the list
+ // is marked down to become the current object in the next step
+ // this is necessary because iteration requires access to members of the current object
+ SwClient* pDelNext;
+
+ // SwClientIter objects are tracked in linked list so that they can react
+ // when the current (pAct) or marked down (pDelNext) SwClient is removed
+ // from its SwModify
+ SwClientIter *pNxtIter;
+
+ // iterator can be limited to return only SwClient objects of a certain type
+ TypeId aSrchId;
+
+public:
+ SW_DLLPUBLIC SwClientIter( const SwModify& );
+ SW_DLLPUBLIC ~SwClientIter();
+
+ const SwModify& GetModify() const { return rRoot; }
+
+ SwClient* operator++(int);
+ SwClient* GoStart();
+ SwClient* GoEnd();
+
+ // returns the current SwClient object;
+ // in case this was already removed, the object marked down to become
+ // the next current one is returned
+ SwClient* operator()() const
+ { return pDelNext == pAct ? pAct : pDelNext; }
+
+ // return "true" if an object was removed from a client chain in iteration
+ // adding objects to a client chain in iteration is forbidden
+ // SwModify::Add() asserts this
+ bool IsChanged() const { return pDelNext != pAct; }
+
+ SW_DLLPUBLIC SwClient* First( TypeId nType );
+ SW_DLLPUBLIC SwClient* Next();
+ SW_DLLPUBLIC SwClient* Last( TypeId nType );
+ SW_DLLPUBLIC SwClient* Previous();
+};
+
+#endif
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
new file mode 100644
index 000000000000..996f6edb2b2a
--- /dev/null
+++ b/sw/inc/calc.hxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CALC_HXX
+#define _CALC_HXX
+
+#include <svl/svarray.hxx>
+#include <unotools/syslocale.hxx>
+
+#ifndef __SBX_SBXVALUE //autogen
+#include <basic/sbxvar.hxx>
+#endif
+#include "swdllapi.h"
+
+class CharClass;
+class LocaleDataWrapper;
+class SwFieldType;
+class SwDoc;
+
+#define TBLSZ 47 // sollte Primzahl sein, wegen HashTable
+
+const sal_Unicode cListDelim = '|';
+
+/******************************************************************************
+ * Calculate Operations
+ ******************************************************************************/
+enum SwCalcOper
+{
+ CALC_NAME, CALC_NUMBER, CALC_ENDCALC,
+ CALC_PLUS='+', CALC_MINUS='-', CALC_MUL='*',
+ CALC_DIV='/', CALC_PRINT=';', CALC_ASSIGN='=',
+ CALC_LP='(', CALC_RP=')', CALC_PHD='%',
+ CALC_POW='^',
+ CALC_LISTOP = cListDelim,
+ CALC_NOT=256, CALC_AND=257, CALC_OR=258,
+ CALC_XOR=259, CALC_EQ=260, CALC_NEQ=261,
+ CALC_LEQ=262, CALC_GEQ=263, CALC_LES=264,
+ CALC_GRE=265, CALC_SUM=266, CALC_MEAN=267,
+ CALC_SQRT=268, CALC_MIN=269, CALC_MIN_IN=270,
+ CALC_MAX=271, CALC_MAX_IN=272, CALC_SIN=273,
+ CALC_COS=274, CALC_TAN=275, CALC_ASIN=276,
+ CALC_ACOS=278, CALC_ATAN=279, CALC_TDIF=280,
+ CALC_ROUND=281, CALC_DATE=282, CALC_MONTH=283,
+ CALC_DAY=284
+};
+
+//-- Calculate Operations Strings -----------------------------------------
+
+extern const sal_Char __FAR_DATA sCalc_Add[];
+extern const sal_Char __FAR_DATA sCalc_Sub[];
+extern const sal_Char __FAR_DATA sCalc_Mul[];
+extern const sal_Char __FAR_DATA sCalc_Div[];
+extern const sal_Char __FAR_DATA sCalc_Phd[];
+extern const sal_Char __FAR_DATA sCalc_Sqrt[];
+extern const sal_Char __FAR_DATA sCalc_Pow[];
+extern const sal_Char __FAR_DATA sCalc_Or[];
+extern const sal_Char __FAR_DATA sCalc_Xor[];
+extern const sal_Char __FAR_DATA sCalc_And[];
+extern const sal_Char __FAR_DATA sCalc_Not[];
+extern const sal_Char __FAR_DATA sCalc_Eq[];
+extern const sal_Char __FAR_DATA sCalc_Neq[];
+extern const sal_Char __FAR_DATA sCalc_Leq[];
+extern const sal_Char __FAR_DATA sCalc_Geq[];
+extern const sal_Char __FAR_DATA sCalc_L[];
+extern const sal_Char __FAR_DATA sCalc_G[];
+extern const sal_Char __FAR_DATA sCalc_Sum[];
+extern const sal_Char __FAR_DATA sCalc_Mean[];
+extern const sal_Char __FAR_DATA sCalc_Min[];
+extern const sal_Char __FAR_DATA sCalc_Max[];
+extern const sal_Char __FAR_DATA sCalc_Sin[];
+extern const sal_Char __FAR_DATA sCalc_Cos[];
+extern const sal_Char __FAR_DATA sCalc_Tan[];
+extern const sal_Char __FAR_DATA sCalc_Asin[];
+extern const sal_Char __FAR_DATA sCalc_Acos[];
+extern const sal_Char __FAR_DATA sCalc_Atan[];
+extern const sal_Char __FAR_DATA sCalc_Tdif[];
+extern const sal_Char __FAR_DATA sCalc_Round[];
+extern const sal_Char __FAR_DATA sCalc_Date[];
+
+/******************************************************************************
+ * Calculate ErrorCodes
+ ******************************************************************************/
+enum SwCalcError
+{
+ CALC_NOERR=0,
+ CALC_SYNTAX, // Syntax Fehler
+ CALC_ZERODIV, // Division durch Null
+ CALC_BRACK, // Fehlerhafte Klammerung
+ CALC_POWERR, // Ueberlauf in Quadratfunktion
+ CALC_VARNFND, // Variable wurde nicht gefunden
+ CALC_OVERFLOW, // Ueberlauf
+ CALC_WRONGTIME // falsches Zeitformat
+};
+
+class SwSbxValue : public SbxValue
+{
+ bool bVoid;
+public:
+ //JP 03.02.99: immer auf eine Zahl defaulten, damit auch gerechnet wird.
+ // Ansonsten wird daraus ein SbxEMPTY und damit ist nichts
+ // anzufangen.
+ SwSbxValue( long n = 0 ) : bVoid(false) { PutLong( n ); }
+ SwSbxValue( const double& rD ) : bVoid(false) { PutDouble( rD ); }
+ SwSbxValue( const SwSbxValue& rVal ) :
+ SvRefBase( rVal ),
+ SbxValue( rVal ),
+ bVoid(rVal.bVoid)
+ {}
+ virtual ~SwSbxValue();
+
+
+ // Strings sonderbehandeln
+ sal_Bool GetBool() const;
+ // Strings sonderbehandeln BOOLs sonderbehandeln
+ double GetDouble() const;
+ SwSbxValue& MakeDouble();
+
+ bool IsVoidValue() {return bVoid;}
+ void SetVoidValue(bool bSet) {bVoid = bSet;}
+};
+
+/******************************************************************************
+ * Calculate HashTables fuer VarTable und Operations
+ ******************************************************************************/
+struct SwHash
+{
+ SwHash( const String& rStr );
+ virtual ~SwHash();
+ String aStr;
+ SwHash *pNext;
+};
+
+struct SwCalcExp : public SwHash
+{
+ SwSbxValue nValue;
+ const SwFieldType* pFldType;
+
+ SwCalcExp( const String& rStr, const SwSbxValue& rVal,
+ const SwFieldType* pFldType = 0 );
+};
+
+SwHash* Find( const String& rSrch, SwHash** ppTable,
+ sal_uInt16 nTblSize, sal_uInt16* pPos = 0 );
+
+void DeleteHashTable( SwHash** ppTable, sal_uInt16 nTblSize );
+
+// falls _CalcOp != 0, dann ist das ein gueltiger Operator
+struct _CalcOp;
+_CalcOp* FindOperator( const String& rSearch );
+
+/******************************************************************************
+ * class SwCalc
+ ******************************************************************************/
+class SwCalc
+{
+ SwHash* VarTable[ TBLSZ ];
+ String aVarName, sCurrSym;
+ String sCommand;
+ SvPtrarr aRekurStk;
+ SwSbxValue nLastLeft;
+ SwSbxValue nNumberValue;
+ SwCalcExp aErrExpr;
+ xub_StrLen nCommandPos;
+
+ SwDoc& rDoc;
+ SvtSysLocale m_aSysLocale;
+ const LocaleDataWrapper* pLclData;
+ CharClass* pCharClass;
+
+ sal_uInt16 nListPor;
+ SwCalcOper eCurrOper;
+ SwCalcOper eCurrListOper;
+ SwCalcError eError;
+
+
+ SwCalcOper GetToken();
+ SwSbxValue Expr();
+ SwSbxValue Term();
+ SwSbxValue Prim();
+
+ sal_Bool ParseTime( sal_uInt16*, sal_uInt16*, sal_uInt16* );
+
+ String GetColumnName( const String& rName );
+ String GetDBName( const String& rName );
+
+ // dont call this methods
+ SwCalc( const SwCalc& );
+ SwCalc& operator=( const SwCalc& );
+
+public:
+ SwCalc( SwDoc& rD );
+ ~SwCalc();
+
+ SwSbxValue Calculate( const String &rStr );
+ String GetStrResult( const SwSbxValue& rValue, sal_Bool bRound = sal_True );
+ String GetStrResult( double, sal_Bool bRound = sal_True );
+
+ SwCalcExp* VarInsert( const String& r );
+ SwCalcExp* VarLook( const String &rStr, sal_uInt16 ins = 0 );
+ void VarChange( const String& rStr, const SwSbxValue& rValue );
+ void VarChange( const String& rStr, double );
+ SwHash** GetVarTable() { return VarTable; }
+
+ sal_Bool Push( const VoidPtr pPtr );
+ void Pop( const VoidPtr pPtr );
+
+ void SetCalcError( SwCalcError eErr ) { eError = eErr; }
+ sal_Bool IsCalcError() const { return 0 != eError; }
+
+ static bool Str2Double( const String& rStr, xub_StrLen& rPos,
+ double& rVal,
+ LocaleDataWrapper const*const pData = 0 );
+ static bool Str2Double( const String& rStr, xub_StrLen& rPos,
+ double& rVal, SwDoc *const pDoc );
+
+ SW_DLLPUBLIC static sal_Bool IsValidVarName( const String& rStr,
+ String* pValidName = 0 );
+};
+
+#endif
diff --git a/sw/inc/ccoll.hxx b/sw/inc/ccoll.hxx
new file mode 100644
index 000000000000..8e99f943360f
--- /dev/null
+++ b/sw/inc/ccoll.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CCOLL_HXX
+#define _CCOLL_HXX
+
+#include <svl/poolitem.hxx>
+#include <tools/string.hxx>
+#include <sfx2/tabdlg.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <svtools/svtabbx.hxx>
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <tools/resary.hxx>
+#include "swdllapi.h"
+#include "cmdid.h"
+
+#include <rtl/string.hxx>
+
+//***********************************************************
+
+struct CollName {
+// const char* pStr;
+ sal_uLong nCnd;
+ sal_uLong nSubCond;
+ };
+
+//***********************************************************
+
+#define COND_COMMAND_COUNT 28
+
+struct CommandStruct
+{
+ sal_uLong nCnd;
+ sal_uLong nSubCond;
+};
+
+//***********************************************************
+
+sal_Int16 GetCommandContextIndex( const rtl::OUString &rContextName );
+rtl::OUString GetCommandContextByIndex( sal_Int16 nIndex );
+
+//***********************************************************
+
+class SW_DLLPUBLIC SwCondCollItem : public SfxPoolItem
+{
+ static CommandStruct aCmds[COND_COMMAND_COUNT];
+
+ String sStyles[COND_COMMAND_COUNT];
+
+public:
+ SwCondCollItem(sal_uInt16 nWhich = FN_COND_COLL);
+ ~SwCondCollItem();
+
+ TYPEINFO();
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ static const CommandStruct* GetCmds();
+
+ const String& GetStyle(sal_uInt16 nPos) const;
+ void SetStyle( const String* pStyle, sal_uInt16 nPos);
+
+};
+
+#endif
+
diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx
new file mode 100644
index 000000000000..30f5f3bdc925
--- /dev/null
+++ b/sw/inc/cellatr.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CELLATR_HXX
+#define _CELLATR_HXX
+
+#include <svl/intitem.hxx>
+#include <svl/zforlist.hxx>
+#include "swdllapi.h"
+#include "format.hxx"
+#include "cellfml.hxx"
+
+class SW_DLLPUBLIC SwTblBoxNumFormat : public SfxUInt32Item
+{
+ sal_Bool bAuto; // automatisch vergebenes Flag
+public:
+ SwTblBoxNumFormat( sal_uInt32 nFormat = NUMBERFORMAT_TEXT,
+ sal_Bool bAuto = sal_False );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ inline SwTblBoxNumFormat& operator=( const SwTblBoxNumFormat& rAttr )
+ {
+ SetValue( rAttr.GetValue() );
+ SetAutoFlag( rAttr.GetAutoFlag() );
+ return *this;
+ }
+
+ sal_Bool GetAutoFlag() const { return bAuto; }
+ void SetAutoFlag( sal_Bool bFlag = sal_True ) { bAuto = bFlag; }
+};
+
+class SwTblBoxFormula : public SfxPoolItem, public SwTableFormula
+{
+ SwModify* pDefinedIn; // Modify-Object, in dem die Formel steht
+ // kann nur TablenBoxFormat sein
+
+public:
+ SwTblBoxFormula( const String& rFormula );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ // erfrage und setze den Modify-Pointer
+ inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
+ inline void ChgDefinedIn( const SwModify* pNew )
+ { pDefinedIn = (SwModify*)pNew; }
+ // suche den Node, in dem die Formel steht:
+ // BoxAttribut -> BoxStartNode
+ virtual const SwNode* GetNodeOfFormula() const;
+
+ SwTableBox* GetTableBox();
+ const SwTableBox* GetTableBox() const
+ { return ((SwTblBoxFormula*)this)->GetTableBox(); }
+
+ // Status aendern
+ void ChangeState( const SfxPoolItem* pItem );
+ // berechne die Formel
+ void Calc( SwTblCalcPara& rCalcPara, double& rValue );
+};
+
+class SW_DLLPUBLIC SwTblBoxValue : public SfxPoolItem
+{
+ double nValue;
+public:
+ SwTblBoxValue();
+ SwTblBoxValue( const double aVal );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ inline SwTblBoxValue& operator=( const SwTblBoxValue& rCmp )
+ {
+ nValue = rCmp.nValue;
+ return *this;
+ }
+
+ double GetValue() const { return nValue; }
+};
+
+
+
+//***************************************************************************
+
+inline const SwTblBoxNumFormat &SwAttrSet::GetTblBoxNumFmt(sal_Bool bInP) const
+ { return (const SwTblBoxNumFormat&)Get( RES_BOXATR_FORMAT,bInP); }
+inline const SwTblBoxFormula &SwAttrSet::GetTblBoxFormula(sal_Bool bInP) const
+ { return (const SwTblBoxFormula&)Get( RES_BOXATR_FORMULA,bInP); }
+inline const SwTblBoxValue &SwAttrSet::GetTblBoxValue(sal_Bool bInP) const
+ { return (const SwTblBoxValue&)Get( RES_BOXATR_VALUE, bInP); }
+
+//***************************************************************************
+
+inline const SwTblBoxNumFormat &SwFmt::GetTblBoxNumFmt(sal_Bool bInP) const
+ { return aSet.GetTblBoxNumFmt(bInP); }
+inline const SwTblBoxFormula &SwFmt::GetTblBoxFormula(sal_Bool bInP) const
+ { return aSet.GetTblBoxFormula(bInP); }
+inline const SwTblBoxValue &SwFmt::GetTblBoxValue(sal_Bool bInP) const
+ { return aSet.GetTblBoxValue(bInP); }
+
+#endif
diff --git a/sw/inc/cellfml.hxx b/sw/inc/cellfml.hxx
new file mode 100644
index 000000000000..169058938f56
--- /dev/null
+++ b/sw/inc/cellfml.hxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CELLFML_HXX
+#define _CELLFML_HXX
+
+#include <tools/string.hxx>
+
+class SwTable;
+class SwNode;
+class SwTableSortBoxes;
+class SwSelBoxes;
+class SwCalc;
+class SwTableBox;
+class SwTableFmlUpdate;
+class SwDoc;
+class String;
+
+class SwTblCalcPara
+{
+ const SwTableBox* pLastTblBox;
+ sal_uInt16 nStackCnt, nMaxSize;
+
+public:
+ SwTableSortBoxes *pBoxStk; // Stack fuers erkennen von Rekursionen !
+ SwCalc& rCalc; // akt. Calculator
+ const SwTable* pTbl; // akt. Tabelle
+
+ SwTblCalcPara( SwCalc& rCalculator, const SwTable& rTable );
+ ~SwTblCalcPara();
+
+ sal_Bool CalcWithStackOverflow();
+ sal_Bool IsStackOverFlow() const { return nMaxSize == nStackCnt; }
+ sal_Bool IncStackCnt() { return nMaxSize == ++nStackCnt; }
+ void DecStackCnt() { if( nStackCnt ) --nStackCnt; }
+ void SetLastTblBox( const SwTableBox* pBox ) { pLastTblBox = pBox; }
+};
+
+
+
+class SwTableFormula
+{
+typedef void (SwTableFormula:: *FnScanFormel)( const SwTable&, String&,
+ String&, String*, void* ) const;
+
+ void BoxNmsToPtr( const SwTable&, String&, String&, String* = 0,
+ void* pPara = 0 ) const;
+ void PtrToBoxNms( const SwTable&, String&, String&, String* = 0,
+ void* pPara = 0 ) const;
+ void RelNmsToBoxNms( const SwTable&, String&, String&, String* = 0,
+ void* pPara = 0 ) const;
+ void RelBoxNmsToPtr( const SwTable&, String&, String&, String* = 0,
+ void* pPara = 0 ) const;
+ void BoxNmsToRelNm( const SwTable&, String&, String&, String* = 0,
+ void* pPara = 0 ) const;
+ void _MakeFormel( const SwTable&, String&, String&, String* = 0,
+ void* pPara = 0 ) const;
+ void _GetFmlBoxes( const SwTable&, String&, String&, String* = 0,
+ void* pPara = 0 ) const;
+ void _HasValidBoxes( const SwTable&, String&, String&, String* = 0,
+ void* pPara = 0 ) const;
+ void _SplitMergeBoxNm( const SwTable&, String&, String&, String* = 0,
+ void* pPara = 0 ) const;
+
+ void GetBoxes( const SwTableBox& rStt, const SwTableBox& rEnd,
+ SwSelBoxes& rBoxes ) const;
+ String ScanString( FnScanFormel fnFormel, const SwTable& rTbl,
+ void* = 0 ) const;
+
+ const SwTable* FindTable( SwDoc& rDoc, const String& rNm ) const;
+
+protected:
+ enum NameType { EXTRNL_NAME, INTRNL_NAME, REL_NAME };
+
+ String sFormel; // akt. Formel
+ NameType eNmType; // akt. Darstellungs Art
+ sal_Bool bValidValue; // sal_True: Formel neu berechnen
+
+ // suche den Node, in dem die Formel steht:
+ // TextFeld -> TextNode,
+ // BoxAttribut -> BoxStartNode
+ // !!! MUSS VON JEDER ABLEITUNG UEBERLADEN WERDEN !!!
+ virtual const SwNode* GetNodeOfFormula() const = 0;
+
+ SwTableFormula( const String& rFormel );
+
+ String MakeFormel( SwTblCalcPara& rCalcPara ) const
+ {
+ return ScanString( &SwTableFormula::_MakeFormel,
+ *rCalcPara.pTbl, &rCalcPara );
+ }
+
+ static sal_uInt16 GetLnPosInTbl( const SwTable& rTbl, const SwTableBox* pBox );
+
+public:
+
+ SwTableFormula( const SwTableFormula& rCpy ) { *this = rCpy; }
+ virtual ~SwTableFormula();
+ SwTableFormula& operator=( const SwTableFormula& rCpy )
+ {
+ sFormel = rCpy.sFormel;
+ eNmType = rCpy.eNmType;
+ bValidValue = rCpy.bValidValue;
+ return *this;
+ }
+
+ // erzeuge aus der internen (fuer CORE) die externe (fuer UI) Formel
+ void PtrToBoxNm( const SwTable* pTbl );
+ // erzeuge aus der externen (fuer UI) die interne (fuer CORE) Formel
+ void BoxNmToPtr( const SwTable* pTbl );
+ // erzeuge aus der externen/internen Formel die relative Formel
+ void ToRelBoxNm( const SwTable* pTbl );
+ // wird vorm/nach dem mergen/splitten von Tabellen rerufen
+ void ToSplitMergeBoxNm( SwTableFmlUpdate& rTblUpd );
+
+ // ist gerade eine intern Darstellung aktiv
+ sal_Bool IsIntrnlName() const { return eNmType == INTRNL_NAME; }
+ // erfrage die akt. Darstellung der Formel
+ NameType GetNameType() const { return eNmType; }
+
+ // erfrage/setze das Flag, ob der akt. Wert gueltig ist
+ sal_Bool IsValid() const { return bValidValue; }
+ inline void ChgValid( sal_Bool bNew ) { bValidValue = bNew; }
+
+ const String& GetFormula() const { return sFormel; }
+ void SetFormula( const String& rNew )
+ {
+ sFormel = rNew;
+ bValidValue = sal_False;
+ eNmType = EXTRNL_NAME;
+ }
+
+ sal_uInt16 GetBoxesOfFormula( const SwTable& rTbl, SwSelBoxes& rBoxes );
+ // sind alle Boxen gueltig, auf die sich die Formel bezieht?
+ sal_Bool HasValidBoxes() const;
+};
+
+
+
+#endif
diff --git a/sw/inc/charatr.hxx b/sw/inc/charatr.hxx
new file mode 100644
index 000000000000..ba0040797a74
--- /dev/null
+++ b/sw/inc/charatr.hxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CHARATR_HXX
+#define _CHARATR_HXX
+
+#include <format.hxx>
+#include <hintids.hxx> // fuer die WhichIds
+
+
+/******************************************************************************
+ * Implementierung der Charakter-Attribut Methoden vom SwAttrSet
+ * AMA 12.10.94: Umstellung auf SvxItems.
+ ******************************************************************************/
+
+inline const SvxPostureItem &SwAttrSet::GetPosture(sal_Bool bInP) const
+ { return (const SvxPostureItem&)Get( RES_CHRATR_POSTURE,bInP); }
+inline const SvxPostureItem &SwAttrSet::GetCJKPosture(sal_Bool bInP) const
+ { return (const SvxPostureItem&)Get( RES_CHRATR_CJK_POSTURE,bInP); }
+inline const SvxPostureItem &SwAttrSet::GetCTLPosture(sal_Bool bInP) const
+ { return (const SvxPostureItem&)Get( RES_CHRATR_CTL_POSTURE,bInP); }
+inline const SvxWeightItem &SwAttrSet::GetWeight(sal_Bool bInP) const
+ { return (const SvxWeightItem&)Get( RES_CHRATR_WEIGHT,bInP); }
+inline const SvxWeightItem &SwAttrSet::GetCJKWeight(sal_Bool bInP) const
+ { return (const SvxWeightItem&)Get( RES_CHRATR_CJK_WEIGHT,bInP); }
+inline const SvxWeightItem &SwAttrSet::GetCTLWeight(sal_Bool bInP) const
+ { return (const SvxWeightItem&)Get( RES_CHRATR_CTL_WEIGHT,bInP); }
+inline const SvxShadowedItem &SwAttrSet::GetShadowed(sal_Bool bInP) const
+ { return (const SvxShadowedItem&)Get( RES_CHRATR_SHADOWED,bInP); }
+inline const SvxAutoKernItem &SwAttrSet::GetAutoKern(sal_Bool bInP) const
+ { return (const SvxAutoKernItem&)Get( RES_CHRATR_AUTOKERN,bInP); }
+inline const SvxWordLineModeItem &SwAttrSet::GetWordLineMode(sal_Bool bInP) const
+ { return (const SvxWordLineModeItem&)Get( RES_CHRATR_WORDLINEMODE,bInP); }
+inline const SvxContourItem &SwAttrSet::GetContour(sal_Bool bInP) const
+ { return (const SvxContourItem&)Get( RES_CHRATR_CONTOUR,bInP); }
+inline const SvxKerningItem &SwAttrSet::GetKerning(sal_Bool bInP) const
+ { return (const SvxKerningItem&)Get( RES_CHRATR_KERNING,bInP); }
+inline const SvxUnderlineItem &SwAttrSet::GetUnderline(sal_Bool bInP) const
+ { return (const SvxUnderlineItem&)Get( RES_CHRATR_UNDERLINE,bInP); }
+inline const SvxOverlineItem &SwAttrSet::GetOverline(sal_Bool bInP) const
+ { return (const SvxOverlineItem&)Get( RES_CHRATR_OVERLINE,bInP); }
+inline const SvxCrossedOutItem &SwAttrSet::GetCrossedOut(sal_Bool bInP) const
+ { return (const SvxCrossedOutItem&)Get( RES_CHRATR_CROSSEDOUT,bInP); }
+inline const SvxFontHeightItem &SwAttrSet::GetSize(sal_Bool bInP) const
+ { return (const SvxFontHeightItem&)Get( RES_CHRATR_FONTSIZE,bInP); }
+inline const SvxFontHeightItem &SwAttrSet::GetCJKSize(sal_Bool bInP) const
+ { return (const SvxFontHeightItem&)Get( RES_CHRATR_CJK_FONTSIZE,bInP); }
+inline const SvxFontHeightItem &SwAttrSet::GetCTLSize(sal_Bool bInP) const
+ { return (const SvxFontHeightItem&)Get( RES_CHRATR_CTL_FONTSIZE,bInP); }
+inline const SvxPropSizeItem &SwAttrSet::GetPropSize(sal_Bool bInP) const
+ { return (const SvxPropSizeItem&)Get( RES_CHRATR_PROPORTIONALFONTSIZE,bInP); }
+inline const SvxFontItem &SwAttrSet::GetFont(sal_Bool bInP) const
+ { return (const SvxFontItem&)Get( RES_CHRATR_FONT,bInP); }
+inline const SvxFontItem &SwAttrSet::GetCJKFont(sal_Bool bInP) const
+ { return (const SvxFontItem&)Get( RES_CHRATR_CJK_FONT,bInP); }
+inline const SvxFontItem &SwAttrSet::GetCTLFont(sal_Bool bInP) const
+ { return (const SvxFontItem&)Get( RES_CHRATR_CTL_FONT,bInP); }
+inline const SvxColorItem &SwAttrSet::GetColor(sal_Bool bInP) const
+ { return (const SvxColorItem&)Get( RES_CHRATR_COLOR,bInP); }
+inline const SvxCharSetColorItem &SwAttrSet::GetCharSetColor(sal_Bool bInP) const
+ { return (const SvxCharSetColorItem&)Get( RES_CHRATR_CHARSETCOLOR,bInP); }
+inline const SvxLanguageItem &SwAttrSet::GetLanguage(sal_Bool bInP) const
+ { return (const SvxLanguageItem&)Get( RES_CHRATR_LANGUAGE,bInP); }
+inline const SvxLanguageItem &SwAttrSet::GetCJKLanguage(sal_Bool bInP) const
+ { return (const SvxLanguageItem&)Get( RES_CHRATR_CJK_LANGUAGE,bInP); }
+inline const SvxLanguageItem &SwAttrSet::GetCTLLanguage(sal_Bool bInP) const
+ { return (const SvxLanguageItem&)Get( RES_CHRATR_CTL_LANGUAGE,bInP); }
+inline const SvxEscapementItem &SwAttrSet::GetEscapement(sal_Bool bInP) const
+ { return (const SvxEscapementItem&)Get( RES_CHRATR_ESCAPEMENT,bInP); }
+inline const SvxCaseMapItem &SwAttrSet::GetCaseMap(sal_Bool bInP) const
+ { return (const SvxCaseMapItem&)Get( RES_CHRATR_CASEMAP,bInP); }
+inline const SvxNoHyphenItem &SwAttrSet::GetNoHyphenHere(sal_Bool bInP) const
+ { return (const SvxNoHyphenItem&)Get( RES_CHRATR_NOHYPHEN,bInP); }
+inline const SvxBlinkItem &SwAttrSet::GetBlink(sal_Bool bInP) const
+ { return (const SvxBlinkItem&)Get( RES_CHRATR_BLINK,bInP); }
+inline const SvxBrushItem &SwAttrSet::GetChrBackground( sal_Bool bInP ) const
+ { return (const SvxBrushItem&)Get( RES_CHRATR_BACKGROUND, bInP ); }
+inline const SvxEmphasisMarkItem &SwAttrSet::GetEmphasisMark( sal_Bool bInP ) const
+ { return (const SvxEmphasisMarkItem&)Get( RES_CHRATR_EMPHASIS_MARK, bInP ); }
+inline const SvxTwoLinesItem &SwAttrSet::Get2Lines( sal_Bool bInP ) const
+ { return (const SvxTwoLinesItem&)Get( RES_CHRATR_TWO_LINES, bInP ); }
+inline const SvxCharScaleWidthItem &SwAttrSet::GetCharScaleW( sal_Bool bInP ) const
+ { return (const SvxCharScaleWidthItem&)Get( RES_CHRATR_SCALEW, bInP ); }
+inline const SvxCharRotateItem &SwAttrSet::GetCharRotate( sal_Bool bInP ) const
+ { return (const SvxCharRotateItem&)Get( RES_CHRATR_ROTATE, bInP ); }
+inline const SvxCharReliefItem &SwAttrSet::GetCharRelief( sal_Bool bInP ) const
+ { return (const SvxCharReliefItem&)Get( RES_CHRATR_RELIEF, bInP ); }
+inline const SvxCharHiddenItem &SwAttrSet::GetCharHidden( sal_Bool bInP ) const
+ { return (const SvxCharHiddenItem&)Get( RES_CHRATR_HIDDEN, bInP ); }
+
+/******************************************************************************
+ * Implementierung der Charakter-Attribut Methoden vom SwFmt
+ * AMA: 12.10.94: Umstellung auf SvxItems.
+ ******************************************************************************/
+
+inline const SvxPostureItem &SwFmt::GetPosture(sal_Bool bInP) const
+ { return aSet.GetPosture(bInP); }
+inline const SvxWeightItem &SwFmt::GetWeight(sal_Bool bInP) const
+ { return aSet.GetWeight(bInP); }
+inline const SvxShadowedItem &SwFmt::GetShadowed(sal_Bool bInP) const
+ { return aSet.GetShadowed(bInP); }
+inline const SvxAutoKernItem &SwFmt::GetAutoKern(sal_Bool bInP) const
+ { return aSet.GetAutoKern(bInP); }
+inline const SvxWordLineModeItem &SwFmt::GetWordLineMode(sal_Bool bInP) const
+ { return aSet.GetWordLineMode(bInP); }
+inline const SvxContourItem &SwFmt::GetContour(sal_Bool bInP) const
+ { return aSet.GetContour(bInP); }
+inline const SvxKerningItem &SwFmt::GetKerning(sal_Bool bInP) const
+ { return aSet.GetKerning(bInP); }
+inline const SvxUnderlineItem &SwFmt::GetUnderline(sal_Bool bInP) const
+ { return aSet.GetUnderline(bInP); }
+inline const SvxOverlineItem &SwFmt::GetOverline(sal_Bool bInP) const
+ { return aSet.GetOverline(bInP); }
+inline const SvxCrossedOutItem &SwFmt::GetCrossedOut(sal_Bool bInP) const
+ { return aSet.GetCrossedOut(bInP); }
+inline const SvxFontHeightItem &SwFmt::GetSize(sal_Bool bInP) const
+ { return aSet.GetSize(bInP); }
+inline const SvxPropSizeItem &SwFmt::GetPropSize(sal_Bool bInP) const
+ { return aSet.GetPropSize(bInP); }
+inline const SvxFontItem &SwFmt::GetFont(sal_Bool bInP) const
+ { return aSet.GetFont(bInP); }
+inline const SvxFontItem &SwFmt::GetCJKFont(sal_Bool bInP) const
+ { return aSet.GetCJKFont(bInP); }
+inline const SvxFontItem &SwFmt::GetCTLFont(sal_Bool bInP) const
+ { return aSet.GetCTLFont(bInP); }
+inline const SvxColorItem &SwFmt::GetColor(sal_Bool bInP) const
+ { return aSet.GetColor(bInP); }
+ inline const SvxCharSetColorItem &SwFmt::GetCharSetColor(sal_Bool bInP) const
+ { return aSet.GetCharSetColor(bInP); }
+inline const SvxLanguageItem &SwFmt::GetLanguage(sal_Bool bInP) const
+ { return aSet.GetLanguage(bInP); }
+inline const SvxEscapementItem &SwFmt::GetEscapement(sal_Bool bInP) const
+ { return aSet.GetEscapement(bInP); }
+inline const SvxCaseMapItem &SwFmt::GetCaseMap(sal_Bool bInP) const
+ { return aSet.GetCaseMap(bInP); }
+inline const SvxNoHyphenItem &SwFmt::GetNoHyphenHere(sal_Bool bInP) const
+ { return aSet.GetNoHyphenHere(bInP); }
+inline const SvxBlinkItem &SwFmt::GetBlink(sal_Bool bInP) const
+ { return aSet.GetBlink(bInP); }
+inline const SvxBrushItem &SwFmt::GetChrBackground(sal_Bool bInP) const
+ { return aSet.GetChrBackground(bInP); }
+inline const SvxEmphasisMarkItem &SwFmt::GetEmphasisMark( sal_Bool bInP ) const
+ { return aSet.GetEmphasisMark(bInP); }
+inline const SvxTwoLinesItem &SwFmt::Get2Lines( sal_Bool bInP ) const
+ { return aSet.Get2Lines(bInP); }
+inline const SvxCharScaleWidthItem &SwFmt::GetCharScaleW( sal_Bool bInP ) const
+ { return aSet.GetCharScaleW(bInP); }
+inline const SvxCharRotateItem &SwFmt::GetCharRotate( sal_Bool bInP ) const
+ { return aSet.GetCharRotate(bInP); }
+inline const SvxCharReliefItem &SwFmt::GetCharRelief( sal_Bool bInP ) const
+ { return aSet.GetCharRelief(bInP); }
+inline const SvxCharHiddenItem &SwFmt::GetCharHidden( sal_Bool bInP ) const
+ { return aSet.GetCharHidden(bInP); }
+
+#endif
diff --git a/sw/inc/charfmt.hxx b/sw/inc/charfmt.hxx
new file mode 100644
index 000000000000..3b018fcff186
--- /dev/null
+++ b/sw/inc/charfmt.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHARFMT_HXX
+#define _CHARFMT_HXX
+
+#include <format.hxx>
+
+class SwCharFmt : public SwFmt
+{
+ friend class SwDoc;
+ friend class SwTxtFmtColl;
+
+ SwCharFmt( SwAttrPool& rPool, const sal_Char* pFmtName,
+ SwCharFmt *pDerivedFrom )
+ : SwFmt( rPool, pFmtName, aCharFmtSetRange, pDerivedFrom, RES_CHRFMT )
+ {}
+ SwCharFmt( SwAttrPool& rPool, const String &rFmtName,
+ SwCharFmt *pDerivedFrom )
+ : SwFmt( rPool, rFmtName, aCharFmtSetRange, pDerivedFrom, RES_CHRFMT )
+ {}
+
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+};
+
+namespace CharFmt
+{
+ extern const SfxItemSet* GetItemSet( const SfxPoolItem& rAttr );
+ extern const SfxPoolItem* GetItem( const SwTxtAttr& rAttr, sal_uInt16 nWhich );
+ extern sal_Bool IsItemIncluded( const sal_uInt16 nWhich, const SwTxtAttr *pAttr );
+}
+
+#endif
+
+
+
diff --git a/sw/inc/chcmprse.hxx b/sw/inc/chcmprse.hxx
new file mode 100644
index 000000000000..04a87435eadb
--- /dev/null
+++ b/sw/inc/chcmprse.hxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CHCMPRSE_HXX
+#define _CHCMPRSE_HXX
+
+enum SwCharCompressType{ CHARCOMPRESS_NONE,
+ CHARCOMPRESS_PUNCTUATION,
+ CHARCOMPRESS_PUNCTUATION_KANA };
+
+
+#endif
+
+
+
+
diff --git a/sw/inc/checkit.hxx b/sw/inc/checkit.hxx
new file mode 100644
index 000000000000..ed6293dcd787
--- /dev/null
+++ b/sw/inc/checkit.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CHECKIT_HXX
+#define _CHECKIT_HXX
+
+#include <com/sun/star/uno/Reference.h>
+
+#ifndef _COM_SUN_STAR_I18N_XEXTENDEDINPUTSEQUENCECHECKER_HDL_
+#include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
+#endif
+
+/*************************************************************************
+ * class SwCheckIt
+ *
+ * Wrapper for the XInputSequenceChecker
+ *************************************************************************/
+
+class SwCheckIt
+{
+public:
+ com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedInputSequenceChecker > xCheck;
+
+ SwCheckIt();
+};
+
+extern SwCheckIt* pCheckIt;
+
+#endif
+
diff --git a/sw/inc/chpfld.hxx b/sw/inc/chpfld.hxx
new file mode 100644
index 000000000000..195b76f163d1
--- /dev/null
+++ b/sw/inc/chpfld.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_CHPFLD_HXX
+#define SW_CHPFLD_HXX
+
+#include "fldbas.hxx"
+
+
+class SwFrm;
+class SwCntntNode;
+class SwTxtNode;
+
+
+enum SwChapterFormat
+{
+ CF_BEGIN,
+ CF_NUMBER = CF_BEGIN, // nur die Kapitelnummer
+ CF_TITLE, // nur die "Ueberschrift"
+ CF_NUM_TITLE, // Kapitelnummer und "Ueberschrift"
+ CF_NUMBER_NOPREPST, // nur die Kapitelnummer ohne Post/Prefix
+ CF_NUM_NOPREPST_TITLE, // Kapitelnummer ohne Post/Prefix und "Ueberschrift"
+ CF_END
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Kapitel
+ --------------------------------------------------------------------*/
+
+class SwChapterFieldType : public SwFieldType
+{
+public:
+ SwChapterFieldType();
+
+ virtual SwFieldType* Copy() const;
+
+};
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Kapitelnummer
+ --------------------------------------------------------------------*/
+class SW_DLLPUBLIC SwChapterField : public SwField
+{
+ friend class SwChapterFieldType;
+ sal_uInt8 nLevel;
+ String sTitle, sNumber, sPre, sPost;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ SwChapterField(SwChapterFieldType*, sal_uInt32 nFmt = 0);
+
+ // --> OD 2008-02-14 #i53420#
+// void ChangeExpansion( const SwFrm*,
+// const SwTxtNode*,
+// sal_Bool bSrchNum = sal_False);
+ void ChangeExpansion( const SwFrm*,
+ const SwCntntNode*,
+ sal_Bool bSrchNum = sal_False);
+ // <--
+ void ChangeExpansion(const SwTxtNode &rNd, sal_Bool bSrchNum);
+
+ inline sal_uInt8 GetLevel() const;
+ inline void SetLevel(sal_uInt8);
+
+ inline const String& GetNumber() const;
+ inline const String& GetTitle() const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+inline sal_uInt8 SwChapterField::GetLevel() const { return nLevel; }
+inline void SwChapterField::SetLevel(sal_uInt8 nLev) { nLevel = nLev; }
+inline const String& SwChapterField::GetNumber() const { return sNumber; }
+inline const String& SwChapterField::GetTitle() const { return sTitle; }
+
+#endif // SW_CHPFLD_HXX
diff --git a/sw/inc/chrdlg.hrc b/sw/inc/chrdlg.hrc
new file mode 100644
index 000000000000..447229eb8965
--- /dev/null
+++ b/sw/inc/chrdlg.hrc
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHRDLG_HRC
+#define _CHRDLG_HRC
+
+#include "rcid.hrc"
+
+#define DLG_CHAR (RC_CHRDLG_BEGIN + 1)
+#define DLG_PARA (RC_CHRDLG_BEGIN + 2)
+#define DLG_PAGE (RC_CHRDLG_BEGIN + 3)
+#define DLG_BREAK (RC_CHRDLG_BEGIN + 5)
+#define DLG_PAGENUM (RC_CHRDLG_BEGIN + 6)
+#define DLG_HEADER_FOOTER (RC_CHRDLG_BEGIN + 7)
+#define DLG_DROPCAPS (RC_CHRDLG_BEGIN + 8)
+#define DLG_DRAWCHAR (RC_CHRDLG_BEGIN + 9)
+#define DLG_DRAWPARA (RC_CHRDLG_BEGIN + 10)
+
+// Tabpages -> jetzt in globals.hrc
+
+#define STR_TEXTCOLL_HEADER (RC_CHRDLG_BEGIN + 2)
+#define STR_PAGEFMT_HEADER (RC_CHRDLG_BEGIN + 4)
+#define SW_STR_NONE (RC_CHRDLG_BEGIN + 5)
+//#define STR_NUMFMT (RC_CHRDLG_BEGIN + 6)
+
+#define MSG_ILLEGAL_PAGENUM (RC_CHRDLG_BEGIN + 1)
+
+#define CHRDLG_ACT_END DLG_DRAWPARA
+
+#if CHRDLG_ACT_END > RC_CHRDLG_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#define DLG_SWDROPCAPS (RC_CHRDLG_BEGIN + 11)
+
+#endif
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
new file mode 100644
index 000000000000..c07652eed352
--- /dev/null
+++ b/sw/inc/cmdid.h
@@ -0,0 +1,1316 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/******************************************************************************
+Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr
+ erlaubt, da es von swicli.c included wird!
+******************************************************************************/
+
+#ifndef INCLUDED_SW_CMDID_H
+#define INCLUDED_SW_CMDID_H
+
+#include <sfx2/sfx.hrc>
+
+#ifndef SW_UNOMID_H
+#include <unomid.h>
+#endif
+
+/* Flags die mittels des Disable-Features in den Slot-Definitionen ausgenutzt
+ * werden */
+#define SW_DISABLE_ON_PROTECTED_CURSOR 0x00000001
+#define SW_DISABLE_ON_MAILBOX_EDITOR 0x00000002
+
+
+#define FN_FILE SID_SW_START
+#define FN_EDIT (SID_SW_START + 100)
+#define FN_VIEW (SID_SW_START + 200)
+#define FN_INSERT (SID_SW_START + 300)
+#define FN_FORMAT (SID_SW_START + 400)
+#define FN_EXTRA (SID_SW_START + 600)
+#define FN_WINDOW (SID_SW_START + 700)
+#define FN_HELP (SID_SW_START + 800)
+#define FN_SELECTION (SID_SW_START + 900)
+#define FN_QUERY (SID_SW_START + 1000)
+#define FN_ENVELP (SID_SW_START + 1050)
+#define FN_PARAM (SID_SW_START + 1100)
+#define FN_STAT (SID_SW_START + 1180)
+#define FN_PRNOPT (SID_SW_START + 1200)
+#define FN_PGPREVIEW (SID_SW_START + 1250)
+#define FN_FRAME (SID_SW_START + 1300)
+#define FN_INSERT2 (SID_SW_START + 1400)
+#define FN_FORMAT2 (SID_SW_START + 1600)
+#define FN_EDIT2 (SID_SW_START + 1800)
+#define FN_QUERY2 (SID_SW_START + 2000)
+#define FN_EXTRA2 (SID_SW_START + 2200)
+#define FN_PARAM2 (SID_SW_START + 2400)
+#define FN_NOTES (SID_SW_START + 2500)
+
+ /* More accurately, this range should be from FN_EXTRA2 to FN_PARAM2-1, but
+ * FN_NUMBER_NEWSTART comes from FN_FORMAT2, and FN_PARAM_LINK_DISPLAY_NAME
+ * comes from FN_PARAM2 so we need to include FORMAT2,
+ * EDIT2 and QUERY2 and PARAM2 in the range...hopefully this will be fixed
+ * soon */
+
+#define FN_UNO_RANGE_BEGIN FN_FORMAT2
+#define FN_UNO_RANGE_END (FN_PARAM2 + 199)
+
+
+#define HELP_OFFSET 1100
+#define CMD_STR_OFFSET 2200
+#define CMD_STR_OFFSET_MULTILANG 3300
+#define CMDID_END 5500
+
+/*--------------------------------------------------------------------
+ Bereich: Datei
+ --------------------------------------------------------------------*/
+#define FN_CLOSE_FILE (FN_FILE + 1 ) /* Schliessen */
+#define FN_LAUNCH_REGISTRY (FN_FILE + 2 ) /* Ablage */
+
+
+#define FN_NEW_GLOBAL_DOC (FN_FILE + 4 ) /* Globaldokument erzeugen */
+#define FN_NEW_FILE (FN_FILE + 5 ) /* Neu */
+#define FN_NEW_FILE_DLG (FN_FILE + 6 ) /* Neu Dialog */
+#define FN_OPEN_FILE (FN_FILE + 7 ) /* Oeffnen */
+#define FN_EDIT_FILE (FN_FILE + 8 ) /* Oeffnen oder ToTop */
+
+#define FN_INETFILE (FN_FILE + 9 ) /* Internet File-Dialog */
+
+#define FN_PRINT_FILE (FN_FILE + 10) /* Drucken */
+#define FN_PRINT_FILE_OPTIONS (FN_FILE + 11) /* Drucken Optionen */
+#define FN_SAVE_FILE_AS (FN_FILE + 12) /* Speichern unter */
+#define FN_SAVE_FILE (FN_FILE + 13) /* Speichern */
+#define FN_SETUP_PRINTER (FN_FILE + 14) /* Druckereinstellung */
+#define FN_SETUP_PRINTER_DLG (FN_FILE + 15) /* Druckereinstellung */
+#define FN_SHOW_PREVIEW (FN_FILE + 16) /* Druckbild */
+#define FN_EXIT (FN_FILE + 17) /* Writer beenden */
+#define FN_PRINT_CFG_DLG (FN_FILE + 18) /* Optionen Drucken */
+
+
+
+#define FN_SAVE_ALL (FN_FILE + 23) /* Alle Files speichern */
+#define FN_NEW_FILE_DEFAULT (FN_FILE + 24) /* Neue Datei mit Standardvorlage */
+#define FN_PRINT_FILE_DEFAULT (FN_FILE + 25) /* Drucken mit Defaults */
+#define FN_LAUNCH_EQ_EDITOR (FN_FILE + 26) /* Formel Editor */
+#define FN_CHANGE_PRINTER (FN_FILE + 27) /* Drucker einstellen */
+#define FN_FAX_END (FN_FILE + 29) /* Faxen fertig, Id fuer PostMessage */
+
+#define FN_SELECT_DATABASE (FN_FILE + 30) /* Selektion Datenbank */
+#define FN_DOC_INFO_DLG (FN_FILE + 31) /* Dokumentinfo */
+#define FN_DOC_MGR_DLG (FN_FILE + 32) /* Dokument-Manager */
+
+#define FN_GET_DOCSTAT (FN_FILE + 33) /* Dokumentstatistik einzeln auslesen */
+
+
+#define FN_SAVE_SELECTION (FN_FILE + 35) /* Selektion speichern */
+
+#define FN_OUTLINE_TO_IMPRESS (FN_FILE + 36) /* Outline zu StarImpress senden */
+#define FN_OUTLINE_TO_CLIPBOARD (FN_FILE + 37) /* Outline in das Clipboad copieren */
+
+#define FN_NEW_HTML_DOC (FN_FILE + 40 ) /* HTML-Dokument "erzeugen" */
+
+#define FN_APP_START (FN_FILE + 98) /* fuer Makro bei App.Start */
+#define FN_APP_END (FN_FILE + 99) /* fuer Makro bei App.Ende */
+
+/*--------------------------------------------------------------------
+ Bereich: Bearbeiten
+ --------------------------------------------------------------------*/
+#define FN_CLEAR (FN_EDIT + 1 ) /* Loeschen */
+#define FN_COPY (FN_EDIT + 2 ) /* Kopieren */
+#define FN_CUT (FN_EDIT + 3 ) /* Ausschneiden */
+#define FN_EDIT_FIELD (FN_EDIT + 4 ) /* Textbefehl bearbeiten */
+#define FN_EDIT_FIELD_DLG (FN_EDIT + 5 ) /* Textbefehl bearbeiten */
+#define FN_EDIT_FILE_INFO (FN_EDIT + 6 ) /* Dokumentinfo */
+#define FN_EDIT_FILE_INFO_DLG (FN_EDIT + 7 ) /* Dokumentinfo Dialog */
+#define FN_EDIT_LINK (FN_EDIT + 8 ) /* Verknuepfungen */
+#define FN_EDIT_LINK_DLG (FN_EDIT + 9 ) /* Verknuepfungen */
+#define FN_GOTO (FN_EDIT + 11) /* Gehe zu */
+
+#define FN_PASTE (FN_EDIT + 13) /* Einfuegen */
+#define FN_PASTESPECIAL_DLG (FN_EDIT + 15) /* Verknuepfung einfuegen */
+#define FN_NUMBER_BULLETS (FN_EDIT + 21) /* Bullets */
+#define FN_REPEAT (FN_EDIT + 22) /* Letzten Befehl wiederholen */
+#define FN_EDIT_IDX_ENTRY_DLG (FN_EDIT + 23) /* Index-Entry bearbeiten */
+#define FN_UPDATE_FIELDS (FN_EDIT + 26) /* Feldinhalte erneuern */
+#define FN_EXECUTE_MACROFIELD (FN_EDIT + 27) /* Macrofeld ausfuehren */
+#define FN_EDIT_FORMULA (FN_EDIT + 28) /* Formel in RibbonBar bearbeiten */
+#define FN_CALC_TABLE (FN_EDIT + 29) /* Tabelle durchrechnen */
+
+/*--------------------------------------------------------------------
+ Bereich: Bullets
+ --------------------------------------------------------------------*/
+#define FN_NUM_BULLET_DOWN (FN_EDIT + 30) /* Runterstufen */
+#define FN_NUM_BULLET_UP (FN_EDIT + 31) /* Raufstufen */
+#define FN_NUM_BULLET_PREV (FN_EDIT + 32) /* zum vorigen Eintrag */
+#define FN_NUM_BULLET_NEXT (FN_EDIT + 33) /* zum naechsten Eintrag */
+#define FN_NUM_BULLET_MOVEUP (FN_EDIT + 34) /* nach oben schieben */
+#define FN_NUM_BULLET_MOVEDOWN (FN_EDIT + 35) /* nach unten schieben */
+#define FN_NUM_BULLET_NONUM (FN_EDIT + 36) /* Eintrag ohne Nummer */
+#ifndef FN_NUM_BULLET_OFF //in SVX already
+#define FN_NUM_BULLET_OFF (FN_EDIT + 37) /* Numerierung aus */
+#endif
+
+
+// schon im SVX
+//#define FN_NUM_BULLET_ON (FN_EDIT + 38) /* Numerierung mit Bullets an */
+
+#define FN_NUM_BULLET_OUTLINE_DOWN (FN_EDIT + 39) /* Runterstufen mit Unterpunkten */
+#define FN_NUM_BULLET_OUTLINE_UP (FN_EDIT + 40) /* Raufstufen mit Unterpunkten */
+#define FN_NUM_BULLET_OUTLINE_MOVEUP (FN_EDIT + 41) /* nach oben schieben mit Unterpunkten */
+#define FN_NUM_BULLET_OUTLINE_MOVEDOWN (FN_EDIT + 42) /* nach unten schieben mit Unterpunkten */
+#define FN_UPDATE_INPUTFIELDS (FN_EDIT + 43) /* Eingabefelder updaten */
+// schon im SVX
+//#define FN_NUM_NUMBERING_ON (FN_EDIT + 44) /* Numerierung an */
+
+#define FN_NUM_OR_NONUM (FN_EDIT + 46) /* Nummer ein-/aus */
+
+#define FN_GOTO_NEXT_INPUTFLD (FN_EDIT + 47) /* zum naechsten EingabeFeld */
+#define FN_GOTO_PREV_INPUTFLD (FN_EDIT + 48) /* zum vorherigen EingabeFeld */
+
+#define FN_REPEAT_SEARCH (FN_EDIT + 50) /* Suche wiederholen */
+#define FN_REPEAT_REPLACE (FN_EDIT + 51) /* Ersetzen wiederholen */
+#define FN_UPDATE_GRAFIC (FN_EDIT + 53) /* Grafik aendern */
+#define FN_SETTAB_ATCURPOS (FN_EDIT + 54) /* Tab an der aktuellen Pos setzen */
+#define FN_SET_LR_IND_ATCURPOS (FN_EDIT + 55) /* EZE und LR setzen */
+#define FN_FRMCNT_TO_BODY (FN_EDIT + 56) /* Rahmeninhalt zu Text */
+#define FN_UPDATE_TOXBASE (FN_EDIT + 57) /* Naechstes Verzeichnis erneuern */
+
+#define FN_REPAGINATE (FN_EDIT + 61) /* Neuformatierung erzwingen */
+#define FN_EDIT_FOOTNOTE (FN_EDIT + 62) /* Fussnote bearbeiten */
+
+#define FN_EDIT_REGION (FN_EDIT + 65) /* Bereiche bearbeiten */
+#define FN_GOTO_REFERENCE (FN_EDIT + 66) /* Von der Refmark zur Referenz */
+
+// schon im Svx definiert
+#define FN_NEXT_BOOKMARK (FN_EDIT + 68) /* */
+#define FN_PREV_BOOKMARK (FN_EDIT + 69) /* */
+
+/*Navigator ToolBoxen*/
+#define FN_SELECT_BOOKMARK (FN_EDIT + 70) /**/
+#define FN_ITEM_DOWN (FN_EDIT + 71) /**/
+#define FN_ITEM_LEFT (FN_EDIT + 72) /**/
+#define FN_ITEM_RIGHT (FN_EDIT + 73) /**/
+#define FN_ITEM_UP (FN_EDIT + 74) /**/
+#define FN_DOWN (FN_EDIT + 75) /**/
+
+#define FN_SELECT_FOOTER (FN_EDIT + 77) /**/
+#define FN_SELECT_FRAME (FN_EDIT + 78) /**/
+#define FN_SELECT_HEADER (FN_EDIT + 79) /**/
+#define FN_PAGENUMBER (FN_EDIT + 80) /**/
+#define FN_SELECT_AUTO_BOOKMARK (FN_EDIT + 81) /**/
+#define FN_SELECT_FOOTNOTE (FN_EDIT + 82) /**/
+#define FN_SELECT_SET_AUTO_BOOKMARK (FN_EDIT + 83) /**/
+#define FN_SELECT_TABLE (FN_EDIT + 84) /**/
+#define FN_SELECT_INDEX (FN_EDIT + 85) /**/
+#define FN_UP (FN_EDIT + 86) /**/
+
+
+//#define FN_DELETE_REGION (FN_EDIT + 89) /* Bereiche loeschen */
+
+
+#define FN_SELECT_PARA (FN_EDIT + 97) /* Absatz selektieren */
+
+#define FN_SELECT_CONTENT (FN_EDIT + 99) /* Navigator - Inhaltstyp */
+
+
+
+
+//#define FN_REDLINE_PROTECT (FN_EDIT2 + 23) /* Redlining password */ ->moved to SVX
+#define FN_UPDATE_ALL_LINKS (FN_EDIT2 + 24) /* alle Links updaten */
+
+//#define FN_REDLINE_ON (FN_EDIT2 + 25) /* Redlining anschalten */ -> moved to SVX
+#define FN_REDLINE_SHOW (FN_EDIT2 + 26) /* Redlining anzeigen */
+#define FN_REDLINE_COMMENT (FN_EDIT2 + 27) /* Redlining kommentieren */
+
+#define FN_UPDATE_ALL (FN_EDIT2 + 28) /* FN_UPDATE_ALL_LINKS,
+ FN_UPDATE_FIELDS,
+ FN_UPDATE_TOX,
+ CalcLayout */
+
+#define FN_REDLINE_ACCEPT (FN_EDIT2 + 29) /* Redlining annehmen/ablehnen */
+#define FN_ATTR_COLUMNS (FN_EDIT2 + 31) /* SlotId fuer SwFmtCol */
+#define FN_EDIT_CURRENT_TOX (FN_EDIT2 + 32) /* edit current index */
+#define FN_EDIT_AUTH_ENTRY_DLG (FN_EDIT2 + 33) /* edit authorities entry*/
+#define FN_UPDATE_CHARTS (FN_EDIT2 + 34) /* update all charts */
+
+#define FN_EDIT_HYPERLINK (FN_EDIT2 + 35) /* edit hyperlink */
+#define FN_NUM_CONTINUE (FN_EDIT2 + 36) /* continue previous numbering */
+#define FN_REDLINE_ACCEPT_DIRECT (FN_EDIT2 + 37) /* accept redline at current position*/
+#define FN_REDLINE_REJECT_DIRECT (FN_EDIT2 + 38) /* reject redline at current position*/
+#define FN_REMOVE_HYPERLINK (FN_EDIT2 + 39) /* remove hyperlink attribute */
+#define FN_COPY_HYPERLINK_LOCATION (FN_EDIT2 + 40) /* copy hyperlink URL to clipboard */
+
+/*--------------------------------------------------------------------
+ Bereich: Bearbeiten
+ --------------------------------------------------------------------*/
+
+#define FN_REFRESH_VIEW (FN_VIEW + 1) /* Refresh/Redraw */
+#define FN_SHOW_OUTLINE_VIEW (FN_VIEW + 2) /* Gliederungsansicht */
+
+#define FN_DRAW_WRAP_DLG (FN_VIEW + 3) /* Draw Umlauf-Dlg */
+
+#define FN_RULER (FN_VIEW + 11) /* Horizontales Lineal */
+
+#define FN_VIEW_GRAPHIC (FN_VIEW + 13) /* Grafiken anzeigen */
+#define FN_VIEW_BOUNDS (FN_VIEW + 14) /* Begrenzungen */
+#define FN_VIEW_FIELDS (FN_VIEW + 15) /* Textbefehle */
+#define FN_VLINEAL (FN_VIEW + 16) /* Vertikales Lineal */
+#define FN_VSCROLLBAR (FN_VIEW + 17) /* Vertikaler Scrollbar */
+#define FN_HSCROLLBAR (FN_VIEW + 18) /* Horizontaler Scrollbar */
+#define FN_TOOLBOX_TOGGLE (FN_VIEW + 19) /* Toolboxinhalte umschalten */
+#define FN_VIEWOPTIONS_ON (FN_VIEW + 20) /* Gruppe Viewoptions an */
+#define FN_VIEWOPTIONS_OFF (FN_VIEW + 21) /* Gruppe Viewoptions aus */
+#define FN_CONTROLS_ON (FN_VIEW + 22) /* Gruppe Bedienelemte an */
+#define FN_CONTROLS_OFF (FN_VIEW + 23) /* Gruppe Bedienelemte aus */
+
+#define FN_VIEW_META_CHARS (FN_VIEW + 24) /* Sonderzeichen anzeigen */
+#define FN_VIEW_MARKS (FN_VIEW + 25) /* Markierungen anzeigen */
+#define FN_VIEW_FIELDNAME (FN_VIEW + 26) /* Feldname anzeigen */
+#define FN_VIEW_TABLEGRID (FN_VIEW + 27) /* Tabellenbegrenzungen anzeigen */
+
+#define FN_SET_PAGE (FN_VIEW + 29) /* Seitenvorlage am Absatz setzen */
+
+#define FN_TOOLBOX_SWITCH (FN_VIEW + 30) /* Auf Textshell umschalten */
+
+
+//noch mehr Navigator
+#define FN_CONTENT_LB (FN_VIEW + 32) /**/
+#define FN_SHOW_CONTENT_BOX (FN_VIEW + 33) /**/
+#define FN_SHOW_ROOT (FN_VIEW + 34) /**/
+#define FN_DROP_REGION (FN_VIEW + 35) /**/
+#define FN_OUTLINE_LEVEL (FN_VIEW + 36) /**/
+
+#define FN_PRINT_LAYOUT (FN_VIEW + 37) /* invertierter BrowseMode */
+
+#define FN_DROP_REGION_LINK (FN_VIEW + 38) /**/
+#define FN_DROP_REGION_COPY (FN_VIEW + 39) /**/
+
+#define FN_SCROLL_NAVIGATION (FN_VIEW + 40) /* Navigationscontroller am Scrollbar*/
+#define FN_SCROLL_NEXT_PREV (FN_VIEW + 41) /* arbeitet den MoveType ab */
+
+#define FN_VIEW_HIDDEN_PARA (FN_VIEW + 42) /* Versteckte Absaetze */
+#define FN_VIEW_SMOOTH_SCROLL (FN_VIEW + 43)
+
+#define FN_GLOBAL_SWITCH (FN_VIEW + 44) /* umschalten zw. Global und Inhalt*/
+#define FN_GLOBAL_EDIT (FN_VIEW + 45) /* bearbeiten */
+#define FN_GLOBAL_UPDATE (FN_VIEW + 46) /* aktualisieren */
+#define FN_GLOBAL_OPEN (FN_VIEW + 47) /* oeffnen */
+#define FN_GLOBAL_SAVE_CONTENT (FN_VIEW + 48) /* Inhalt der Verknuepfung mitspeichern */
+#define FN_CREATE_NAVIGATION (FN_VIEW + 49) /* Navigations-Controller erzeugen */
+#define FN_PREVIEW_ZOOM (FN_VIEW + 51) /* der Tabellencontroller fuer den Zoom */
+
+#define FN_SET_MODOPT_TBLNUMFMT (FN_VIEW + 52) /* Zahlenerkennung in Tabellen */
+#define FN_HSCROLL_METRIC (FN_VIEW + 53) /* Metric horizontal scrollbar */
+#define FN_VSCROLL_METRIC (FN_VIEW + 54) /* Metric vertical scrollbar */
+#define FN_VIEW_NOTES (FN_VIEW + 55)
+
+/*--------------------------------------------------------------------
+ Bereich: Einfuegen
+ --------------------------------------------------------------------*/
+// schon im Svx definiert
+#define FN_INSERT_BOOKMARK (FN_INSERT + 2 ) /* Sprungmarke einfuegen */
+
+// schon im SVX unter der gleichen Id
+//#define FN_INSERT_BREAK (FN_INSERT + 3 ) /* Umbruch */
+
+#define FN_INSERT_BREAK_DLG (FN_INSERT + 4 ) /* Umbruch */
+#define FN_INSERT_COLUMN_BREAK (FN_INSERT + 5 ) /* Spaltenumbruch */
+#define FN_INSERT_DATE_TIME (FN_INSERT + 6 ) /* Datum/Uhrzeit */
+#define FN_INSERT_FIELD (FN_INSERT + 8 ) /* Textbefehl */
+#define FN_CHANGE_DBFIELD (FN_INSERT + 9 ) /* Datenbankfeld aendern */
+
+#define FN_INSERT_CAPTION (FN_INSERT + 10) /* Beschriftung */
+#define FN_INSERT_DBFIELD (FN_INSERT + 11) /* Insert database field - for recording */
+#define FN_INSERT_FOOTNOTE_DLG (FN_INSERT + 12) /* Dialog Fussnote */
+
+#define FN_INSERT_REF_FIELD (FN_INSERT + 13) /* Refernzfeld einfuegen */
+
+#define FN_INSERT_HYPERLINK (FN_INSERT + 14) /* Zeichendialog/HyperlinkPage*/
+
+#define FN_INSERT_INDEX (FN_INSERT + 16) /* Stichworteintrag */
+#define FN_INSERT_INDEX_DLG (FN_INSERT + 17) /* Stichworteintrag */
+#define FN_INSERT_LINEBREAK (FN_INSERT + 18) /* Zeilenumbruch */
+#define FN_INSERT_FIELD_DATA_ONLY (FN_INSERT + 19) /* field dialog for mail merge*/
+#define FN_INSERT_OBJECT (FN_INSERT + 21) /* Object */
+#define FN_INSERT_OBJECT_DLG (FN_INSERT + 22) /* Object */
+#define FN_INSERT_PAGEBREAK (FN_INSERT + 23) /* Seitenumbruch */
+#define FN_INSERT_PAGENO (FN_INSERT + 24) /* Seitennummer */
+#define FN_INSERT_PARAGRAPH (FN_INSERT + 25) /* Absatz */
+#define FN_INSERT_RECORD (FN_INSERT + 26) /* Datensatz einfuegen */
+#define FN_MERGE_RECORD (FN_INSERT + 27) /* Datensatz mischen */
+#define FN_INSERT_SYMBOL (FN_INSERT + 28) /* Sonderzeichen */
+#define FN_POSTIT (FN_INSERT + 29) /* PostIt einfuegen/bearbeiten */
+#define FN_INSERT_TABLE (FN_INSERT + 30) /* Tabelle */
+#define FN_INSERT_STRING (FN_INSERT+31)
+#define FN_INSERT_COLS (FN_INSERT + 32) /* Spalten einfuegen */
+#define FN_INSERT_FRAME_INTERACT (FN_INSERT + 33) /* Rahmen einfuegen aktiv */
+#define FN_INSERT_FRAME (FN_INSERT + 34) /* Rahmen einfuegen */
+
+#define FN_INSERT_IDX_ENTRY_DLG (FN_INSERT + 35) /* Verzeichniseintrag einfuegen */
+#define FN_INSERT_FRAME_INTERACT_NOCOL (FN_INSERT + 36) /*insert interactive non column frame*/
+
+//#define FN_INSERT_SOFT_HYPHEN (FN_INSERT + 43) /* weicher Trenner */
+//#define FN_INSERT_HARD_SPACE (FN_INSERT + 44) /* hartes Space */
+
+
+#define FN_TOOL_GROUP (FN_INSERT + 47) /* Objekte gruppieren */
+#define FN_TOOL_UNGROUP (FN_INSERT + 48) /* Gruppierng aufheben */
+
+#define FN_TOOL_ANKER (FN_INSERT + 49) /* Draw-Objekt umankern */
+#define FN_TOOL_ANKER_PAGE (FN_INSERT + 50) /* Draw-Objekt an Seite verankern */
+#define FN_TOOL_ANKER_PARAGRAPH (FN_INSERT + 51) /* Draw-Objekt am Absatz verankern */
+#define FN_TOOL_HIERARCHIE (FN_INSERT + 52) /* Hierarchie aendern */
+
+#define FN_MAILMERGE_WIZARD (FN_INSERT + 64) /* mail merge wizard */
+#define FN_QRY_OPEN_TABLE (FN_INSERT + 65) /* Datenbank oeffnen (Basic) */
+#define FN_TOOL_ANKER_FRAME (FN_INSERT + 66) /* Draw-Objekt am Rahmen verankern */
+#define FN_QRY_MERGE (FN_INSERT + 67) /* Datensatz einfuegen (Serienbrief) */
+#define FN_MAILMERGE_CHILDWINDOW (FN_INSERT + 68) /* back-to-mail-merge-wizard child window*/
+#define FN_INSERT_SMA (FN_INSERT + 69) /* Einfuegen StarMath */
+
+#define FN_QRY_GET_COLUMN_NAME (FN_INSERT + 70) /* Anzahl der Spalten (Basic) */
+#define FN_QRY_GET_COLUMN_TYPE (FN_INSERT + 71) /* Type des Datenbankfeldes ermitteln (Basic) */
+#define FN_QRY_GET_COLUMN_TEXT (FN_INSERT + 72) /* Inhalt des aktuellen Datensatzes (Basic) */
+#define FN_QRY_DEL_DEFINED_DB (FN_INSERT + 75) /* Datenbankdefinition loeschen (Basic) */
+
+#define FN_DRAWTEXT_ATTR_DLG (FN_INSERT + 76) /* DrawText positionieren */
+
+#define FN_QRY_APPEND_RECORD (FN_INSERT + 77) /* Neuen Datensatz anhaengen */
+#define FN_QRY_UPDATE_RECORD (FN_INSERT + 78) /* Datensatzspalte aendern */
+#define FN_QRY_DELETE_RECORD (FN_INSERT + 79) /* Datensatz loeschen */
+#define FN_QRY_GET_PHYS_RECORD_ID (FN_INSERT + 80) /* Physikalische (absolute) Datensatznummer erfragen (Basic) */
+
+#define FN_TOOL_ANKER_CHAR (FN_INSERT + 84) /* DrawObject zeichengebunden */
+//#define FN_INSERT_HARDHYPHEN (FN_INSERT + 85) /* Bindestrich ohne Umbruch*/
+
+#define FN_QRY_INSERT (FN_INSERT + 86) /* Datensatz-Selektion in Text einfuegen */
+#define FN_QRY_MERGE_FIELD (FN_INSERT + 87) /* Datensatz-Selektion in Felder einfuegen */
+#define FN_QRY_INSERT_FIELD (FN_INSERT + 88) /* Datenbankfeld einfuegen */
+
+#define FN_INSERT_CTRL (FN_INSERT + 89) /* Werkzeugleistencontroller Einfuegen*/
+#define FN_INSERT_OBJ_CTRL (FN_INSERT + 90) /* Werkzeugleistencontroller Einfuegen/Objekt*/
+#define FN_INSERT_FIELD_CTRL (FN_INSERT + 91) /* Werkzeugleistencontroller Einfuegen/Feldbefehle*/
+
+#define FN_INSERT_FLD_DATE (FN_INSERT + 92)
+#define FN_INSERT_FLD_TIME (FN_INSERT + 93)
+#define FN_INSERT_FLD_PGNUMBER (FN_INSERT + 94)
+#define FN_INSERT_FLD_PGCOUNT (FN_INSERT + 95)
+#define FN_INSERT_FLD_TOPIC (FN_INSERT + 96)
+#define FN_INSERT_FLD_TITLE (FN_INSERT + 97)
+#define FN_INSERT_FLD_AUTHOR (FN_INSERT + 98)
+#define FN_INSERT_FOOTNOTE (FN_INSERT + 99)
+
+/*--------------------------------------------------------------------
+ Bereich: Einfuegen (2.Teil)
+ --------------------------------------------------------------------*/
+
+#define FN_QRY_GET_ALL_DBNAME (FN_INSERT2 + 1) /* Alle konfigurierten Datenabanknamen ermitteln */
+#define FN_QRY_GET_DBNAME_COUNT (FN_INSERT2 + 2) /* Anzahl aller konfigurierten Datenabanknamen */
+#define FN_QRY_GET_TABLE_NAME (FN_INSERT2 + 3) /* Tabellenname einer Datenbank ermitteln */
+#define FN_QRY_GET_TABLE_COUNT (FN_INSERT2 + 4) /* Anzahl aller Tabellen einer Datenbank ermitteln */
+#define FN_MAILMERGE_SENDMAIL_CHILDWINDOW (FN_INSERT2 + 5) /* child window provided by mailmerge */
+
+
+#define FN_SBA_BRW_UPDATE (FN_INSERT2 + 7) /* Datensaetze in Felder einfuegen */
+#define FN_SBA_BRW_INSERT (FN_INSERT2 + 8) /* Datensaetze in Text einfuegen */
+#define FN_SBA_BRW_MERGE (FN_INSERT2 + 9) /* Serienbriefdruck */
+#define FN_JAVAEDIT (FN_INSERT2 + 10) /* Scriptfeld bearbeiten */
+#define FN_INSERT_HRULER (FN_INSERT2 + 11) /* horiz. Grafiklinie einfuegen */
+#define FN_TOOL_ANKER_AT_CHAR (FN_INSERT2 + 12) /* Object zeichengebunden */
+
+#define FN_INSERT_PAGEHEADER (FN_INSERT2 + 13) /* Standard Kopfzeile einfuegen */
+#define FN_INSERT_PAGEFOOTER (FN_INSERT2 + 14) /* Standard Fusszeile einfuegen */
+
+#define FN_INSERT_ENDNOTE (FN_INSERT2 + 18) /* Endnote einfuegen*/
+#define FN_INSERT_REGION (FN_INSERT2 + 19) /* Insert section */
+
+#define FN_INSERT_MULTI_TOX (FN_INSERT2 + 20) /* insert any TOX */
+#define FN_INSERT_AUTH_ENTRY_DLG (FN_INSERT2 + 21) /* insert entry for table of authorities*/
+
+/*--------------------------------------------------------------------
+ Bereich: Format
+ --------------------------------------------------------------------*/
+
+#define FN_AUTOFORMAT_APPLY (FN_FORMAT + 1 ) /* Autoformat-Optionen anwenden */
+#define FN_AUTOFORMAT_AUTO (FN_FORMAT + 2 ) /* Autoformat waehrend der Eingabe */
+#define FN_GROW_FONT_SIZE (FN_FORMAT + 3 ) /* Groesse */
+#define FN_SHRINK_FONT_SIZE (FN_FORMAT + 4 ) /* Groesse */
+#define FN_UNDERLINE_DOUBLE (FN_FORMAT + 5 ) /* Doppelt unterstreichen */
+#define FN_AUTOFORMAT_REDLINE_APPLY (FN_FORMAT + 6 ) /* Autoformat mit Redlining anwenden */
+#define FN_SET_SUPER_SCRIPT (FN_FORMAT + 11) /* Hochstellung */
+#define FN_SET_SUB_SCRIPT (FN_FORMAT + 12) /* Tiefstellung */
+
+#define FN_SET_CASEMAP (FN_FORMAT + 14) /* CaseMap */
+#define FN_SET_LANGUAGE (FN_FORMAT + 15) /* Sprache */
+#define FN_SET_KERNING (FN_FORMAT + 16) /* Kerning */
+
+#define FN_INDENT_TO_TABSTOP (FN_FORMAT + 17) /* Einrueckung auf die naechste Tabpostion */
+//schon in svxids.hrc
+//#define FN_SET_JUSTIFY_PARA (FN_FORMAT + 21) /* Ausrichtung Absatz */
+#define FN_FLIP_HORZ_GRAFIC (FN_FORMAT + 25) /* Spiegeln horizontal */
+#define FN_FLIP_VERT_GRAFIC (FN_FORMAT + 26) /* Spiegeln vertikal */
+#define FN_SET_LINE_SPACE (FN_FORMAT + 27) /* Zeilenabstand parametrisiert */
+#define FN_SET_ADJUST (FN_FORMAT + 28) /* Ausrichtung parametrisiert */
+#define FN_SET_LRMARGIN (FN_FORMAT + 29) /* linker/rechter Rand */
+#define FN_SET_ULMARGIN (FN_FORMAT + 30) /* oberer/unterer Rand */
+#define FN_UNINDENT_TO_TABSTOP (FN_FORMAT + 31) /* Einrueckung auf die vorgige Tabpostion */
+
+#define FN_SET_HYPHEN_ZONE (FN_FORMAT + 32) /* Silbentrennung */
+#define FN_SET_KEEP_TOGETHER (FN_FORMAT + 34) /* nicht trennen */
+#define FN_SET_KEEP_WITH_NEXT (FN_FORMAT + 35) /* mit folgendem zus. */
+#define FN_SET_WIDOW (FN_FORMAT + 36) /* Widows */
+#define FN_SET_ORPHAN (FN_FORMAT + 37) /* Orphans */
+
+
+#define FN_REGISTER_COLLECTION (FN_FORMAT + 43) /* Referenzvorlage an der Seite */
+#define FN_REGISTER_MODE (FN_FORMAT + 44) /* Registermodus an/aus */
+#define FN_NUM_FORMAT_TABLE_DLG (FN_FORMAT + 45) /* Zahlenformat in Tabelle */
+#define FN_FORMAT_BORDER_DLG (FN_FORMAT + 48) /* Umrandung */
+#define FN_FORMAT_PAGE_COLUMN_DLG (FN_FORMAT + 49) /* Spalten pro Seite */
+#define FN_FORMAT_BACKGROUND_DLG (FN_FORMAT + 50) /* Hintergrund */
+#define FN_FORMAT_PAGE (FN_FORMAT + 51) /* Seite */
+#define FN_FORMAT_PAGE_DLG (FN_FORMAT + 52) /* Seite */
+#define FN_FORMAT_COLUMN (FN_FORMAT + 53) /* Spalten */
+#define FN_FORMAT_DROPCAPS (FN_FORMAT + 54) /* Initialien */
+#define FN_FORMAT_FRAME (FN_FORMAT + 55) /* Rahmen */
+#define FN_FORMAT_FRAME_DLG (FN_FORMAT + 56) /* Rahmen */
+#define FN_FORMAT_GRAFIC (FN_FORMAT + 57) /* Grafik */
+#define FN_FORMAT_GRAFIC_DLG (FN_FORMAT + 58) /* Grafik */
+#define FN_FORMAT_TABLE (FN_FORMAT + 59) /* Tabelle */
+#define FN_FORMAT_TABLE_DLG (FN_FORMAT + 60) /* Tabelle */
+#define FN_FORMAT_OLE_DLG (FN_FORMAT + 61) /* OLE bearbeiten */
+
+#define FN_NEW_STYLE_BY_EXAMPLE (FN_FORMAT + 62) /* Vorlage erzeugen by Example */
+#define FN_UPDATE_STYLE_BY_EXAMPLE (FN_FORMAT + 63) /* Vorlage aktualisieren */
+#define FN_STYLE_SHEET_FRAME_DLG (FN_FORMAT + 64) /* Rahmenvorlage */
+#define FN_STYLE_SHEET_DOC_DLG (FN_FORMAT + 65) /* Dokumentvorlage */
+#define FN_STYLE_SHEET_GRAFIK_DLG (FN_FORMAT + 66) /* Dokumentvorlage */
+#define FN_FORMAT_FOOTNOTE (FN_FORMAT + 67) /* Fussnoten */
+#define FN_FORMAT_FOOTNOTE_DLG (FN_FORMAT + 68) /* Fussnoten-Dialog */
+
+// schon im Svx definiert
+//#define FN_FORMAT_RESET (FN_FORMAT + 69) /* Format zuruecksetzen */
+
+#define FN_FRAME_TO_TOP (FN_FORMAT + 70) /* Rahmen nach oben */
+#define FN_FRAME_TO_BOTTOM (FN_FORMAT + 71) /* Rahmen nach unten */
+
+#define FN_FRAME_NOWRAP (FN_FORMAT + 72) /* Rahmen kein Umlauf */
+#define FN_FRAME_WRAP (FN_FORMAT + 73) /* Rahmen Umlauf */
+#define FN_FRAME_WRAPTHRU (FN_FORMAT + 74) /* Rahmen Durchlauf */
+
+#define FN_FRAME_ALIGN_HORZ_LEFT (FN_FORMAT + 75) /* Rahmen horz. links */
+#define FN_FRAME_ALIGN_HORZ_RIGHT (FN_FORMAT + 76) /* Rahmen horz. rechts */
+#define FN_FRAME_ALIGN_HORZ_CENTER (FN_FORMAT + 77) /* Rahmen horz. zentriert */
+#define FN_FRAME_ALIGN_VERT_TOP (FN_FORMAT + 78) /* Rahmen vert. oben */
+#define FN_FRAME_ALIGN_VERT_BOTTOM (FN_FORMAT + 79) /* Rahmen vert. unten */
+#define FN_FRAME_ALIGN_VERT_CENTER (FN_FORMAT + 80) /* Rahmen vert. zentriert */
+
+#define FN_SET_FRM_POSITION (FN_FORMAT + 82)/* Rahmenposition -- " -- */
+#define FN_SET_FRM_OPTIONS (FN_FORMAT + 86)/* Rahmenoptionen -- " -- */
+
+#define FN_SET_PAGE_STYLE (FN_FORMAT + 93) /* Anwenden Seitenv. */
+
+
+#define FN_TABLE_REP (FN_FORMAT + 99) /* TableRepresentation */
+#define FN_CONVERT_TEXT_TABLE (FN_FORMAT + 100) /* Konvertierung Text <-> Tabelle */
+#define FN_TABLE_INSERT_ROW (FN_FORMAT + 101) /* Tabelle: Zeile einfuegen */
+#define FN_TABLE_INSERT_COL (FN_FORMAT + 102) /* Tabelle: Spalte einfuegen */
+#define FN_TABLE_DELETE_ROW (FN_FORMAT + 103) /* Tabelle: Zeile loeschen */
+#define FN_TABLE_DELETE_COL (FN_FORMAT + 104) /* Tabelle: Spalte loeschen */
+#define FN_TABLE_SPLIT_CELLS (FN_FORMAT + 105) /* Tabelle: Zellen teilen */
+#define FN_TABLE_MERGE_CELLS (FN_FORMAT + 106) /* Tabelle: Zellen verbinden */
+#define FN_TABLE_SET_ROW_HEIGHT (FN_FORMAT + 107) /* Tabelle: Zeilenhoehe setzen */
+#define FN_TABLE_SET_COL_WIDTH (FN_FORMAT + 108) /* Tabelle: Spaltenbreite setzen */
+#define FN_TABLE_SET_ULSPACE (FN_FORMAT + 109) /* Tabelle: oberen / unteren Abstand einstellen */
+#define FN_OPTIMIZE_TABLE (FN_FORMAT + 110) /* ToolBoxItem fuer Optimierung in Tabellen */
+#define FN_TABLE_SET_SHADOW (FN_FORMAT + 111) /* Tabelle: Schatten einstellen */
+#define FN_TABLE_GOTO_CELL (FN_FORMAT + 112) /* Tabelle: Zelle anspringen */
+#define FN_TABLE_SELECT_ROW (FN_FORMAT + 113) /* Tabelle: Zeile selektieren */
+#define FN_TABLE_SELECT_COL (FN_FORMAT + 114) /* Tabelle: Spalte selektieren */
+#define FN_TABLE_SELECT_ALL (FN_FORMAT + 115) /* Tabelle: Tabelle selektieren */
+#define FN_TABLE_SET_READ_ONLY (FN_FORMAT + 116) /* Tabelle: Tabelle schuetzen */
+#define FN_TABLE_SET_READ_ONLY_CELLS (FN_FORMAT + 117) /* Tabelle: Tabellezellen schuetzen */
+#define FN_TABLE_UNSET_READ_ONLY_CELLS (FN_FORMAT + 119) /* Tabelle: Tabellezellen schuetzen aufheben */
+#define FN_TABLE_HEADLINE_REPEAT (FN_FORMAT + 120) /* also used in SwXTextTable*/
+#define FN_TABLE_ADJUST_CELLS (FN_FORMAT + 121) /* Tabelle: Zellen anpassen */
+
+#define FN_FRAME_UP (FN_FORMAT + 122) /* Rahmen um eine Ebene nach oben */
+#define FN_FRAME_DOWN (FN_FORMAT + 123) /* Rahmen um eine Ebene nach unten */
+
+#define FN_TABLE_INSERT_CHART (FN_FORMAT + 124)
+
+#define FN_SET_FRM_LRSPACE (FN_FORMAT + 125) /* Rahmen Seitenabstand */
+#define FN_SET_FRM_ULSPACE (FN_FORMAT + 126) /* Rahmen Kopf-/Fussabstand */
+#define FN_TABLE_SET_LRSPACE (FN_FORMAT + 127) /* Tabelle: linker / rechter Abstand einstellen */
+#define FN_TABLE_OPTIMAL_HEIGHT (FN_FORMAT + 128) /* Zellenhoehe optimal*/
+#define FN_TABLE_DELETE_TABLE (FN_FORMAT + 129) /* remove current table*/
+#define FN_TABLE_SELECT_CELL (FN_FORMAT + 130) /* selects the current table cell */
+#define FN_CONVERT_TEXT_TO_TABLE (FN_FORMAT + 131) /* convert selected text to table */
+#define FN_CONVERT_TABLE_TO_TEXT (FN_FORMAT + 132) /* convert a table to text */
+#define FN_TABLE_SORT_DIALOG (FN_FORMAT + 133) /* sorting in tables*/
+/*--------------------------------------------------------------------
+ Bereich: Seitenvorlage
+ --------------------------------------------------------------------*/
+
+#define FN_NEW_PAGE_STYLE (FN_FORMAT + 129) /* Anlegen Seitenvorlage */
+#define FN_PAGE_STYLE_SET_LR_MARGIN (FN_FORMAT + 130) /* linker / rechter Rand */
+#define FN_PAGE_STYLE_SET_UL_MARGIN (FN_FORMAT + 131) /* oberer / unterer Rand */
+#define FN_PAGE_STYLE_SET_PAGE (FN_FORMAT + 134) /* linke, rechte... */
+#define FN_PAGE_STYLE_SET_PAPER_SIZE (FN_FORMAT + 135) /* Papiergroesse */
+#define FN_PAGE_STYLE_SET_PAPER_BIN (FN_FORMAT + 136) /* Druckerschacht */
+#define FN_PAGE_STYLE_SET_NUMBER_FORMAT (FN_FORMAT + 137) /* Numerierungsart */
+#define FN_PAGE_STYLE_SET_COLS (FN_FORMAT + 138) /* Spaltenanzahl */
+
+
+/* OS: Diese Ids werden nur noch fuer die Hilfe benoetigt und sind fuer den
+ Dialog durch die Ids ohne _DLG ersetzt*/
+#define FN_TABLE_INSERT_COL_DLG (FN_FORMAT + 142) /* Tabelle: Dlg. Spalte einfuegen */
+#define FN_TABLE_INSERT_ROW_DLG (FN_FORMAT + 143) /* Tabelle: Dlg. Zeile einfuegen */
+
+#define FN_GOTO_NEXT_CELL (FN_FORMAT + 145) /* Table: go to next cell */
+#define FN_GOTO_PREV_CELL (FN_FORMAT + 146) /* Table: go to previous cell */
+
+
+#define FN_TABLE_HEADLINE_COUNT (FN_FORMAT + 147) /* number of repeated headlines of tables */
+//hier geht's weiter !
+/*--------------------------------------------------------------------
+ Bereich: Ribbon
+ --------------------------------------------------------------------*/
+
+#define FN_SET_BACKGROUND_COLOR (FN_FORMAT + 150) /* Hintergrundfarbe */
+
+#define FN_SET_BORDER_POS (FN_FORMAT + 152) /* Position Umrandung */
+#define FN_SET_BORDER_LINES (FN_FORMAT + 153) /* Linienart Umrandung */
+#define FN_SET_BORDER_COLOR (FN_FORMAT + 154) /* Farbe Umrandung */
+
+#define FN_FORMULA_CALC (FN_FORMAT + 156) /* Formelauswahl */
+#define FN_FORMULA_CANCEL (FN_FORMAT + 157) /* Formel nicht uebernehmen */
+#define FN_FORMULA_APPLY (FN_FORMAT + 158) /* Formel uebernehmen */
+
+#define FN_TABLE_UNSET_READ_ONLY (FN_FORMAT + 159) /* Zellenschutz fuer Tab. aufheben */
+
+#define FN_FORMULA_POSITION (FN_FORMAT + 160) /* Positionsanzeige */
+#define FN_FORMULA_EDIT (FN_FORMAT + 161) /* Editfeld */
+
+
+#define FN_FRAME_WRAP_IDEAL (FN_FORMAT + 163) /* Rahmen Idealer Umlauf */
+#define FN_FRAME_WRAPTHRU_TRANSP (FN_FORMAT + 164) /* Rahmen Transparenter Durchlauf */
+
+#define FN_FRAME_ALIGN_VERT_ROW_TOP (FN_FORMAT + 165) /* Rahmen vert. Zeile oben */
+#define FN_FRAME_ALIGN_VERT_ROW_BOTTOM (FN_FORMAT + 166) /* Rahmen vert. Zeile unten */
+#define FN_FRAME_ALIGN_VERT_ROW_CENTER (FN_FORMAT + 167) /* Rahmen vert. Zeile zentriert */
+
+#define FN_FRAME_ALIGN_VERT_CHAR_TOP (FN_FORMAT + 168) /* Rahmen vert. Zeichen oben */
+#define FN_FRAME_ALIGN_VERT_CHAR_BOTTOM (FN_FORMAT + 169) /* Rahmen vert. Zeichen unten */
+#define FN_FRAME_ALIGN_VERT_CHAR_CENTER (FN_FORMAT + 170) /* Rahmen vert. Zeichen zentriert */
+
+#define FN_TABLE_SET_DEF_BORDER (FN_FORMAT + 171) /* vordefinierte Umrandungen setzen */
+
+#define FN_FRAME_WRAP_LEFT (FN_FORMAT + 172) /* Rahmen Umlauf links */
+#define FN_FRAME_WRAP_RIGHT (FN_FORMAT + 173) /* Rahmen Umlauf links */
+
+#define FN_TABLE_SET_ROW_AUTOHEIGHT (FN_FORMAT + 174) /* Tabelle: Minimale automatische Zeilenhoehe setzen */
+
+
+#define FN_WRAP_ANCHOR_ONLY (FN_FORMAT + 181) /* Umlauf nur fuer ersten Absatz */
+
+#define FN_TABLE_BALANCE_CELLS (FN_FORMAT + 182) /* Spalten gleichmaessig verteilen */
+#define FN_TABLE_BALANCE_ROWS (FN_FORMAT + 183) /* Zeilen gleichmaessig verteilen */
+
+#define FN_FRAME_WRAP_CONTOUR (FN_FORMAT + 184) /* Rahmen Kunturumlauf */
+
+#define FN_TABLE_VERT_NONE (FN_FORMAT + 185) /* vertikale Ausrichtung in Tabellenzellen */
+#define FN_TABLE_VERT_CENTER (FN_FORMAT + 186) /* -"- */
+#define FN_TABLE_VERT_BOTTOM (FN_FORMAT + 187) /* -"- */
+#define FN_TABLE_SET_VERT_ALIGN (FN_FORMAT + 188) /* -"- */
+#define FN_TABLE_MODE_FIX (FN_FORMAT + 189) /* Tabellenmodus */
+#define FN_TABLE_MODE_FIX_PROP (FN_FORMAT + 190) /* -"- */
+#define FN_TABLE_MODE_VARIABLE (FN_FORMAT + 191) /* -"- */
+#define FN_TABLE_BOX_TEXTDIRECTION (FN_FORMAT + 192) /* text direction of table cells */
+
+#define FN_TABLE_AUTOSUM (FN_FORMAT + 195) /* Autosumme*/
+#define FN_SET_CONTROL_HANDLER (FN_FORMAT + 199) /* Macro setzen */
+
+#define FN_IS_IMAGE (FN_FORMAT2 + 6) /* Numerierung : mit Grafik?*/
+
+#define FN_GOTO_NEXT_REGION (FN_FORMAT2 + 9) /* Naechsten Bereich anspringen */
+#define FN_GOTO_PREV_REGION (FN_FORMAT2 + 10) /* Vorherigen " */
+
+#define FN_GET_SBXCONTROL (FN_FORMAT2 + 11) /* SbxObject rausreichen */
+#define FN_ABSTRACT_NEWDOC (FN_FORMAT2 + 12) /* Abstract in neuem Doc */
+#define FN_ABSTRACT_STARIMPRESS (FN_FORMAT2 + 13) /* Abstract an StarImpress */
+/* OD 2006-03-09 #i51726# - all drawing objects can be named now. */
+#define FN_NAME_SHAPE (FN_FORMAT2 + 14) /* Name shapes */
+
+// #i68101#
+#define FN_TITLE_DESCRIPTION_SHAPE (FN_FORMAT2 + 15) /* shape title and description */
+
+#define FN_NUMBER_FORMAT (FN_FORMAT2 + 120) /* Boxen/NumberFormatter eistellen */
+#define FN_NUMBER_STANDARD (FN_FORMAT2 + 121)
+#define FN_NUMBER_TWODEC (FN_FORMAT2 + 123)
+#define FN_NUMBER_SCIENTIFIC (FN_FORMAT2 + 124)
+#define FN_NUMBER_DATE (FN_FORMAT2 + 125)
+#define FN_NUMBER_TIME (FN_FORMAT2 + 126)
+#define FN_NUMBER_CURRENCY (FN_FORMAT2 + 127)
+#define FN_NUMBER_PERCENT (FN_FORMAT2 + 128)
+
+
+
+#define FN_FRAME_CHAIN (FN_FORMAT2 + 136)
+#define FN_FRAME_UNCHAIN (FN_FORMAT2 + 137)
+
+#define FN_NUMBER_NEWSTART (FN_FORMAT2 + 138)
+#define FN_NUMBER_NEWSTART_AT (FN_FORMAT2 + 139)
+
+#define FN_FRAME_MIRROR_ON_EVEN_PAGES (FN_FORMAT2 + 140)
+#define FN_GRAPHIC_MIRROR_ON_EVEN_PAGES (FN_FORMAT2 + 141)
+
+#define FN_TABLE_SPLIT_TABLE (FN_FORMAT2 + 142)
+#define FN_SYNC_LABELS (FN_FORMAT2 + 143)
+
+#define FN_FORMAT_LINENUMBER (FN_FORMAT2 + 144)
+
+#define FN_TABLE_RELATIVE_WIDTH (FN_FORMAT2 + 147) /* Tabelle: relative Breite - UNO */
+#define FN_TABLE_WIDTH (FN_FORMAT2 + 148) /* Tabelle: Breite - UNO */
+#define FN_TABLE_IS_RELATIVE_WIDTH (FN_FORMAT2 + 149) /* Tabelle: ist Breite relativ?- UNO */
+
+#define FN_INC_INDENT_OFFSET (FN_FORMAT2 + 150)
+#define FN_DEC_INDENT_OFFSET (FN_FORMAT2 + 151)
+
+#define FN_TABLE_MERGE_TABLE (FN_FORMAT2 + 152)
+#define FN_TABLE_ROW_SPLIT (FN_FORMAT2 + 153)
+
+#define FN_FORMAT_APPLY_HEAD1 (FN_FORMAT2 + 154)
+#define FN_FORMAT_APPLY_HEAD2 (FN_FORMAT2 + 155)
+#define FN_FORMAT_APPLY_HEAD3 (FN_FORMAT2 + 156)
+#define FN_FORMAT_APPLY_DEFAULT (FN_FORMAT2 + 157)
+#define FN_FORMAT_APPLY_TEXTBODY (FN_FORMAT2 + 158)
+#define FN_REMOVE_DIRECT_CHAR_FORMATS (FN_FORMAT2 + 159)
+
+#define FN_SAVE_GRAPHIC (FN_FORMAT2 + 160)
+
+/*--------------------------------------------------------------------
+ Bereich: Extras
+ --------------------------------------------------------------------*/
+
+#define FN_LINE_NUMBERING_DLG (FN_EXTRA + 2 ) /* Zeilennumerierung */
+#define FN_HYPHENATE_OPT_DLG (FN_EXTRA + 5 ) /* Silbentrennung */
+#define FN_ADD_UNKNOWN (FN_EXTRA + 6 ) /* Woerter lernen */
+#define FN_DICTIONARY_DLG (FN_EXTRA + 8 ) /* Woerterbuecher */
+#define FN_NUMBERING (FN_EXTRA + 9 ) /* Nummerierung/Bullets */
+#define FN_NUMBERING_DLG (FN_EXTRA + 10) /* Nummerierung/Bullets */
+#define FN_NUMBERING_OUTLINE (FN_EXTRA + 11) /* Gliederungsnumerierung */
+#define FN_NUMBERING_OUTLINE_DLG (FN_EXTRA + 12) /* Gliederungsnumerierung */
+#define FN_SORTING_DLG (FN_EXTRA + 14) /* Sortieren */
+#define FN_CALCULATE (FN_EXTRA + 15) /* Berechnen */
+#define FN_GENERATE_TOC_DLG (FN_EXTRA + 16) /* Inhaltsverzeichnis */
+#define FN_GENERATE_INDEX_DLG (FN_EXTRA + 17) /* Stichwortverzeichnis */
+#define FN_GENERATE_DIR_DLG (FN_EXTRA + 18) /* Verzeichnis */
+#define FN_GLOSSARY_DLG (FN_EXTRA + 20) /* Textbausteine */
+#define FN_MACRO_CHOOSER (FN_EXTRA + 21) /* Makro aufnehmen */
+
+
+#define FN_PLAY_MACRO (FN_EXTRA + 23) /* Makro abspielen */
+#define FN_LAUNCH_BASIC (FN_EXTRA + 25) /* Makro abspielen */
+#define FN_EXPAND_GLOSSARY (FN_EXTRA + 28) /* Textbausteine expandieren */
+#define FN_CONFIG_TOOLBOX (FN_EXTRA + 29) /* Konfiguration Toolbox */
+#define FN_CONFIG_MENU (FN_EXTRA + 30) /* Konfiguration Menu */
+#define FN_CONFIG_KEY (FN_EXTRA + 31) /* Konfiguration Tastatur */
+#define FN_CHANGE_PAGENUM (FN_EXTRA + 34) /* Seitennummer aendern */
+
+#define FN_MACRO_POPUP (FN_EXTRA + 37) /* Alle Macrofunktionen */
+#define FN_BULLET (FN_EXTRA + 38) /* Bullet-Liste */
+
+
+// Bereich: Gloassaries
+
+// schon im Svx definiert
+
+//#define FN_GET_GLOSSARY_GROUP_COUNT (FN_EXTRA + 42) /* Anzahl der Bausteingruppen */
+
+#define FN_AUTO_CORRECT (FN_EXTRA + 49 ) /* Autocorrect aus Basic */
+
+
+#define FN_UPDATE_TOX (FN_EXTRA + 53) /* alle Verzeichnisse aktualisieren */
+#define FN_UPDATE_CUR_TOX (FN_EXTRA + 54) /* aktuelles Verzeichnisse aktualisieren */
+#define FN_REMOVE_CUR_TOX (FN_EXTRA + 55) /* remove the current TOX*/
+
+#define FN_NAVIGATION_PI_GOTO_PAGE (FN_EXTRA + 59 ) /* Seitenanwahl aus Navi-PI */
+
+
+#define FN_LETTER_WIZZARD (FN_EXTRA + 60 )
+#define FN_FAX_WIZZARD (FN_EXTRA + 61 )
+#define FN_MEMO_WIZZARD (FN_EXTRA + 62 )
+#define FN_AGENDA_WIZZARD (FN_EXTRA + 63 )
+
+#define FN_SET_BASIC_METRIC (FN_EXTRA + 80) /* Defaultmetrik Basic setzen */
+
+#define FN_RESERVED_9 (FN_EXTRA + 86) /* Platzhalter */
+#define FN_RESERVED_8 (FN_EXTRA + 87) /* Platzhalter */
+#define FN_RESERVED_7 (FN_EXTRA + 88) /* Platzhalter */
+#define FN_RESERVED_6 (FN_EXTRA + 89) /* Platzhalter */
+#define FN_RESERVED_5 (FN_EXTRA + 90) /* Platzhalter */
+#define FN_RESERVED_4 (FN_EXTRA + 91) /* Platzhalter */
+#define FN_RESERVED_3 (FN_EXTRA + 92) /* Platzhalter */
+#define FN_RESERVED_2 (FN_EXTRA + 93) /* Platzhalter */
+#define FN_RESERVED_1 (FN_EXTRA + 94) /* Platzhalter */
+
+#define FN_COLLECTION_GROUP_CNT (FN_EXTRA + 96)
+#define FN_COLLECTION_GROUP_IDX (FN_EXTRA + 97)
+#define FN_COLL_TYPE (FN_EXTRA + 98) /* Typ fuer GlobalDoc-Collection*/
+#define FN_COLL_ADD (FN_EXTRA + 99)
+
+#define FN_COLL_TITLE (FN_EXTRA2 + 1) /* Bereichsname oder Index-Title */
+#define FN_SHADOWCURSOR (FN_EXTRA2 + 4) /* Shadow Cursor ein/ausschalten */
+
+
+#define FN_VIEW_IN_FRAME (FN_EXTRA2 + 8) /* die View befindet sich in einem FrameDoc*/
+
+#define FN_UNO_PARA_STYLE (FN_EXTRA2 + 9) // jetzt kommen diverse UNO-Ids fuer die
+#define FN_UNO_PAGE_STYLE (FN_EXTRA2 + 10) // PropertyMap
+
+#define FN_UNO_FRAME_STYLE_NAME (FN_EXTRA2 + 12)
+#define FN_UNO_NUM_START_VALUE (FN_EXTRA2 + 13)
+#define FN_UNO_NUM_LEVEL (FN_EXTRA2 + 14)
+#define FN_UNO_NUM_RULES (FN_EXTRA2 + 15)
+#define FN_UNO_DOCUMENT_INDEX_MARK (FN_EXTRA2 + 16)
+#define FN_UNO_DOCUMENT_INDEX (FN_EXTRA2 + 17)
+#define FN_UNO_TEXT_FIELD (FN_EXTRA2 + 18)
+#define FN_UNO_TEXT_TABLE (FN_EXTRA2 + 19)
+#define FN_UNO_CELL (FN_EXTRA2 + 20)
+#define FN_UNO_TEXT_FRAME (FN_EXTRA2 + 21)
+#define FN_UNO_REFERENCE_MARK (FN_EXTRA2 + 22)
+#define FN_UNO_TEXT_SECTION (FN_EXTRA2 + 23)
+#define FN_UNO_FOOTNOTE (FN_EXTRA2 + 24)
+#define FN_UNO_ENDNOTE (FN_EXTRA2 + 25)
+#define FN_UNO_RANGE_COL_LABEL (FN_EXTRA2 + 26)
+#define FN_UNO_RANGE_ROW_LABEL (FN_EXTRA2 + 27)
+#define FN_UNO_TABLE_COLUMS (FN_EXTRA2 + 28)
+#define FN_UNO_TABLE_BORDER (FN_EXTRA2 + 29)
+#define FN_UNO_TABLE_COLUMN_SEPARATORS (FN_EXTRA2 + 30)
+#define FN_UNO_TABLE_COLUMN_RELATIVE_SUM (FN_EXTRA2 + 31)
+#define FN_UNO_TABLE_CELL_BACKGROUND (FN_EXTRA2 + 32)
+#define FN_UNO_ROW_HEIGHT (FN_EXTRA2 + 33)
+#define FN_UNO_ROW_AUTO_HEIGHT (FN_EXTRA2 + 34)
+#define FN_UNO_HEADER (FN_EXTRA2 + 35)
+#define FN_UNO_HEADER_LEFT (FN_EXTRA2 + 36)
+#define FN_UNO_HEADER_RIGHT (FN_EXTRA2 + 37)
+#define FN_UNO_FOOTER (FN_EXTRA2 + 38)
+#define FN_UNO_FOOTER_LEFT (FN_EXTRA2 + 39)
+#define FN_UNO_FOOTER_RIGHT (FN_EXTRA2 + 40)
+#define FN_UNO_HEADER_BACKGROUND (FN_EXTRA2 + 41)
+#define FN_UNO_HEADER_BOX (FN_EXTRA2 + 42)
+#define FN_UNO_HEADER_LR_SPACE (FN_EXTRA2 + 43)
+#define FN_UNO_HEADER_SHADOW (FN_EXTRA2 + 44)
+#define FN_UNO_FOOTER_BACKGROUND (FN_EXTRA2 + 45)
+#define FN_UNO_FOOTER_BOX (FN_EXTRA2 + 46)
+#define FN_UNO_FOOTER_LR_SPACE (FN_EXTRA2 + 47)
+#define FN_UNO_FOOTER_SHADOW (FN_EXTRA2 + 48)
+#define FN_UNO_HEADER_BODY_DISTANCE (FN_EXTRA2 + 49)
+#define FN_UNO_HEADER_IS_DYNAMIC_DISTANCE (FN_EXTRA2 + 50)
+#define FN_UNO_FOOTER_BODY_DISTANCE (FN_EXTRA2 + 51)
+#define FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE (FN_EXTRA2 + 52)
+#define FN_UNO_HEADER_SHARE_CONTENT (FN_EXTRA2 + 53)
+#define FN_UNO_FOOTER_SHARE_CONTENT (FN_EXTRA2 + 54)
+#define FN_UNO_HEADER_HEIGHT (FN_EXTRA2 + 55)
+#define FN_UNO_FOOTER_HEIGHT (FN_EXTRA2 + 56)
+#define FN_UNO_HEADER_ON (FN_EXTRA2 + 57)
+#define FN_UNO_FOOTER_ON (FN_EXTRA2 + 58)
+#define FN_UNO_FOLLOW_STYLE (FN_EXTRA2 + 59)
+
+#define FN_API_CALL (FN_EXTRA2 + 60)
+
+#define FN_UNO_IS_PHYSICAL (FN_EXTRA2 + 61)
+#define FN_UNO_IS_AUTO_UPDATE (FN_EXTRA2 + 62)
+#define FN_UNO_DISPLAY_NAME (FN_EXTRA2 + 63)
+
+#define FN_UNO_WRAP (FN_EXTRA2 + 64)
+#define FN_UNO_ANCHOR_TYPES (FN_EXTRA2 + 65)
+#define FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL (FN_EXTRA2 + 66)
+#define FN_UNO_PARA_CONDITIONAL_STYLE_NAME (FN_EXTRA2 + 67)
+
+#define FN_UNO_CATEGORY (FN_EXTRA2 + 68)
+#define FN_UNO_IS_NUMBER (FN_EXTRA2 + 69)
+#define FN_UNO_TEXT_WRAP (FN_EXTRA2 + 70)
+#define FN_UNO_ANCHOR_TYPE (FN_EXTRA2 + 71)
+#define FN_SKIP_HIDDEN_TEXT (FN_EXTRA2 + 72)
+#define FN_SKIP_PROTECTED_TEXT (FN_EXTRA2 + 73)
+#define FN_UNO_Z_ORDER (FN_EXTRA2 + 74)
+#define FN_UNO_REDLINE_NODE_START (FN_EXTRA2 + 75)
+#define FN_UNO_REDLINE_NODE_END (FN_EXTRA2 + 76)
+#define FN_UNO_TEXT_PORTION_TYPE (FN_EXTRA2 + 77)
+#define FN_UNO_CONTROL_CHARACTER (FN_EXTRA2 + 78)
+#define FN_UNO_BOOKMARK (FN_EXTRA2 + 79)
+#define FN_UNO_IS_COLLAPSED (FN_EXTRA2 + 80)
+#define FN_UNO_IS_START (FN_EXTRA2 + 81)
+#define FN_UNO_IS_AUTOMATIC_CONTOUR (FN_EXTRA2 + 82)
+#define FN_UNO_IS_PIXEL_CONTOUR (FN_EXTRA2 + 83)
+#define FN_UNO_ALTERNATIVE_TEXT (FN_EXTRA2 + 84)
+#define FN_UNO_ACTUAL_SIZE (FN_EXTRA2 + 85)
+#define FN_UNO_GRAPHIC_U_R_L (FN_EXTRA2 + 86)
+#define FN_UNO_GRAPHIC_FILTER (FN_EXTRA2 + 87)
+#define FN_UNO_CELL_NAME (FN_EXTRA2 + 88)
+#define FN_INSERT_GLOSSARY (FN_EXTRA2 + 89)
+#define FN_NEW_GLOSSARY (FN_EXTRA2 + 90)
+#define FN_SET_ACT_GLOSSARY (FN_EXTRA2 + 91)
+
+#define FN_UNO_HEADER_EAT_SPACING (FN_EXTRA2 + 92)
+#define FN_UNO_FOOTER_EAT_SPACING (FN_EXTRA2 + 93)
+#define FN_UNO_CHARFMT_SEQUENCE (FN_EXTRA2 + 94)
+#define FN_UNO_CLSID (FN_EXTRA2 + 95)
+#define FN_UNO_MODEL (FN_EXTRA2 + 96)
+#define FN_UNO_COMPONENT (FN_EXTRA2 + 97)
+#define FN_WORDCOUNT_DIALOG (FN_EXTRA2 + 98)
+
+//#define FN_UNO_DEFAULT_OUTLINE_LEVEL (FN_EXTRA2 + 99)//#outline level,removed by zahojianwei
+
+#define FN_XFORMS_DESIGN_MODE (FN_EXTRA2 + 100)
+
+#define FN_UNO_PARA_STYLE_CONDITIONS (FN_EXTRA2 + 101)
+#define FN_UNO_GRAPHIC (FN_EXTRA2 + 102)
+
+#define FN_UNO_REPLACEMENT_GRAPHIC_URL (FN_EXTRA2 + 102)
+#define FN_UNO_CELL_ROW_SPAN (FN_EXTRA2 + 103)
+#define FN_UNO_TABLE_BORDER_DISTANCES (FN_EXTRA2 + 104)
+#define FN_SPELL_GRAMMAR_DIALOG (FN_EXTRA2 + 105)
+#define FN_UNO_STREAM_NAME (FN_EXTRA2 + 106)
+// --> OD 2008-07-14 #i91601#
+#define FN_UNO_LIST_ID (FN_EXTRA2 + 107)
+// <--
+#define FN_UNO_REPLACEMENT_GRAPHIC (FN_EXTRA2 + 108)
+
+#define FN_UNO_PARA_CONT_PREV_SUBTREE (FN_EXTRA2 + 109)
+#define FN_UNO_PARA_NUM_STRING (FN_EXTRA2 + 110)
+#define FN_UNO_TABLE_NAME (FN_EXTRA2 + 111)
+#define FN_UNO_META (FN_EXTRA2 + 112)
+#define FN_UNO_NESTED_TEXT_CONTENT (FN_EXTRA2 + 113)
+
+// #i972: bool items to be passed to SwFrmPage for evaluation
+#define FN_OLE_IS_MATH (FN_EXTRA2 + 114)
+#define FN_MATH_BASELINE_ALIGNMENT (FN_EXTRA2 + 115)
+
+#define FN_EMBEDDED_OBJECT (FN_EXTRA2 + 116)
+
+/*--------------------------------------------------------------------
+ Bereich: Hilfe
+ --------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------
+ Bereich: Traveling & Selektion
+ --------------------------------------------------------------------*/
+
+#define FN_CHAR_LEFT (FN_SELECTION + 1 ) /* */
+#define FN_CHAR_RIGHT (FN_SELECTION + 2 ) /* */
+#define FN_LINE_UP (FN_SELECTION + 3 ) /* */
+#define FN_LINE_DOWN (FN_SELECTION + 4 ) /* */
+#define FN_START_OF_LINE (FN_SELECTION + 5 ) /* StartOfLine */
+#define FN_END_OF_LINE (FN_SELECTION + 6 ) /* EndOfLine */
+#define FN_START_OF_DOCUMENT (FN_SELECTION + 7 ) /* StartOfDocument */
+//schon in svxids.hrc
+//#define FN_END_OF_DOCUMENT (FN_SELECTION + 8 ) /* EndOfDocument */
+#define FN_START_OF_NEXT_PAGE (FN_SELECTION + 9 ) /* StartOfNextPage ??? */
+#define FN_END_OF_NEXT_PAGE (FN_SELECTION + 10) /* ??? */
+#define FN_START_OF_PREV_PAGE (FN_SELECTION + 11) /* StartOfPrevPage ??? */
+#define FN_END_OF_PREV_PAGE (FN_SELECTION + 12) /* ??? */
+#define FN_START_OF_PAGE (FN_SELECTION + 13) /* StartOfPage */
+#define FN_END_OF_PAGE (FN_SELECTION + 14) /* EndOfPage */
+#define FN_START_OF_WINDOW (FN_SELECTION + 15) /* StartOfWindow */
+#define FN_END_OF_WINDOW (FN_SELECTION + 16) /* EndOfWindow */
+#define FN_START_OF_COLUMN (FN_SELECTION + 17) /* StartOfColumn */
+#define FN_END_OF_COLUMN (FN_SELECTION + 18) /* EndOfColumn */
+#define FN_START_OF_PARA (FN_SELECTION + 19) /* StartOfPara */
+#define FN_END_OF_PARA (FN_SELECTION + 20) /* EndOfPara */
+#define FN_NEXT_WORD (FN_SELECTION + 21) /* NextWord */
+#define FN_PREV_WORD (FN_SELECTION + 22) /* PrevWord */
+#define FN_NEXT_SENT (FN_SELECTION + 23) /* NextSentence */
+#define FN_PREV_SENT (FN_SELECTION + 24) /* PrevSentence */
+#define FN_DELETE (FN_SELECTION + 25) /* Delete */
+#define FN_BACKSPACE (FN_SELECTION + 26) /* Backspace */
+#define FN_DELETE_SENT (FN_SELECTION + 27) /* DeleteToEndOfSentence */
+#define FN_DELETE_BACK_SENT (FN_SELECTION + 28) /* DeleteToStartOfSentence */
+#define FN_DELETE_WORD (FN_SELECTION + 29) /* DeleteToEndOfWord */
+#define FN_DELETE_BACK_WORD (FN_SELECTION + 30) /* DeleteToStartOfWord */
+#define FN_DELETE_LINE (FN_SELECTION + 31) /* DeleteToEndOfLine */
+#define FN_DELETE_BACK_LINE (FN_SELECTION + 32) /* DeleteToStartOfLine */
+#define FN_DELETE_PARA (FN_SELECTION + 33) /* DeleteToEndOfPara */
+#define FN_DELETE_BACK_PARA (FN_SELECTION + 34) /* DeleteToStartOfPara */
+#define FN_DELETE_WHOLE_LINE (FN_SELECTION + 35) /* DeleteLine ??? */
+#define FN_SET_INS_MODE (FN_SELECTION + 36) /* Einfuegemodus / Overwrite */
+#define FN_PAGEUP (FN_SELECTION + 37) /* PageUpWithCursor */
+#define FN_PAGEDOWN (FN_SELECTION + 38) /* PageDownWithCursor */
+#define FN_SET_ADD_MODE (FN_SELECTION + 39) /* Selektionsmodus */
+#define FN_SET_EXT_MODE (FN_SELECTION + 40) /* Selektionsmodus */
+#define FN_ESCAPE (FN_SELECTION + 41) /* Normal */
+#define FN_SHIFT_BACKSPACE (FN_SELECTION + 42) /* wie Backspace */
+#define FN_SELECT_WORD (FN_SELECTION + 43) /* Wort selektieren */
+
+#define FN_GOTO_NEXT_OBJ (FN_SELECTION + 44) /* N�chstes Objekt anspringen */
+#define FN_GOTO_PREV_OBJ (FN_SELECTION + 45) /* Vorhergehendes Objekt anspringen */
+
+#define FN_START_TABLE (FN_SELECTION + 47) /* an den Anfang der Tabelle */
+#define FN_END_TABLE (FN_SELECTION + 48) /* an das Ende der Tabelle */
+#define FN_NEXT_TABLE (FN_SELECTION + 49) /* zur vorhergehenden Tabelle */
+#define FN_PREV_TABLE (FN_SELECTION + 50) /* zur naechsten Tabelle */
+
+#define FN_START_OF_NEXT_COLUMN (FN_SELECTION + 51) /* zum Anfang der naechsten Spalte */
+#define FN_END_OF_NEXT_COLUMN (FN_SELECTION + 52) /* zum Ende der naechsten Spalte */
+#define FN_START_OF_PREV_COLUMN (FN_SELECTION + 53) /* zum Anfang der vorhergehenden Spalte */
+#define FN_END_OF_PREV_COLUMN (FN_SELECTION + 54) /* zum Ende der vorhergehenden Spalte */
+
+#define FN_FOOTNOTE_TO_ANCHOR (FN_SELECTION + 55) /* aus der Fussnote zum Anchor */
+#define FN_NEXT_FOOTNOTE (FN_SELECTION + 56) /* zur naechsten Fussnote */
+#define FN_PREV_FOOTNOTE (FN_SELECTION + 57) /* zur vorhergehenden Fussnote */
+
+#define FN_CNTNT_TO_NEXT_FRAME (FN_SELECTION + 58) /* aus dem Inhalt zum naechsten Rahmen */
+#define FN_FRAME_TO_ANCHOR (FN_SELECTION + 59) /* vom Rahmen zum Anker */
+
+#define FN_TO_HEADER (FN_SELECTION + 60) /* Toggle zwischen Content und Kopfzeile */
+#define FN_TO_FOOTER (FN_SELECTION + 61) /* Toggle zwischen Content und Fusszeile */
+
+#define FN_IDX_MARK_TO_IDX (FN_SELECTION + 62) /* von der Verzeichnismarkierung zum Verzeichnis */
+
+#define FN_TO_FOOTNOTE_AREA (FN_SELECTION + 63) /* jump into the appropriate footnote area */
+
+#define FN_SET_BLOCK_MODE (FN_SELECTION + 64) /* selection mode: block */
+
+
+
+#define FN_PREV_PARA (FN_SELECTION + 74)
+#define FN_NEXT_PARA (FN_SELECTION + 75)
+
+#define FN_GOTO_NEXT_MARK (FN_SELECTION + 76) /* N�chsten Platzhalter anspringen */
+#define FN_GOTO_PREV_MARK (FN_SELECTION + 77) /* Vorhergehenden Platzhalter anspringen */
+
+// schon im SVX unter der gleichen Id
+//#define FN_START_DOC_DIRECT (FN_SELECTION + 78) /* Direkt zum Dokanfang springen */
+//#define FN_END_DOC_DIRECT (FN_SELECTION + 79) /* Direkt zum Dokanfang springen */
+
+#define FN_NEXT_TOXMARK (FN_SELECTION + 83) /* zur naechsten Verz. Markierung */
+#define FN_PREV_TOXMARK (FN_SELECTION + 84) /* zur vorherigen Verz. Markierung */
+#define FN_NEXT_TBLFML (FN_SELECTION + 85) /* zur naechsten Tabellenformel */
+#define FN_PREV_TBLFML (FN_SELECTION + 86) /* zur vorherigen Tabellenformel */
+#define FN_NEXT_TBLFML_ERR (FN_SELECTION + 87) /* zur naechsten fehl. Tabellenformel */
+#define FN_PREV_TBLFML_ERR (FN_SELECTION + 88) /* zur vorherigen fehl. Tabellenformel */
+
+#define FN_READONLY_SELECTION_MODE (FN_SELECTION + 89) /* switches text selection mode in readonly documents*/
+#define FN_SELECTION_MODE_DEFAULT (FN_SELECTION + 90) /* use default selection mode - not block mode */
+#define FN_SELECTION_MODE_BLOCK (FN_SELECTION + 91) /* switch on block selection */
+
+/*--------------------------------------------------------------------
+ QUERY-Block
+ --------------------------------------------------------------------*/
+
+
+
+#define FN_IS_MODIFIED (FN_QUERY +16) /* Dokument geaendert? */
+#define FN_RESET_MODIFIED (FN_QUERY +17) /* Geaendert-Flag zuruecksetzen */
+
+#define FN_GET_DOC_INFO (FN_QUERY +22) /* Wert Dokumentinfo erfragen */
+#define FN_GET_ERRNO (FN_QUERY +26) /* Error-Nummer abfragen */
+#define FN_GET_DOCMAN_PATH (FN_QUERY +27) /* Pfad zu einer Gruppe im Docmgr erfragen */
+
+#define FN_TXTATR_INET (FN_QUERY +29) /* INet-Attribut */
+#define FN_EXECUTE_DRAG (FN_QUERY +30) /* D&D starten */
+
+#define FN_GET_PRINT_AREA (FN_QUERY +32) /* Attribut fuer druckbaren Seitenbereich besorgen */
+
+
+
+// #define FN_IS_START_OF_PAGE (FN_QUERY +40) /**/
+// #define FN_IS_END_OF_PAGE (FN_QUERY +41) /**/
+
+#define FN_GET_PARAGRAPH (FN_QUERY +48) /* Paragraph-Object von der Textshell
+ an die View weiterreichen*/
+// hier ist Schluss!!!
+
+#define FN_DB_FORM_LETTER (FN_QUERY2 + 0) /* form letter */
+#define FN_DB_INSERT_CONTENT (FN_QUERY2 + 1) /* merge data into fields*/
+#define FN_DB_INSERT_COLUMNS (FN_QUERY2 + 2) /* insert data into text/table/as fields*/
+#define FN_DB_CONNECTION_ANY (FN_QUERY2 + 3)
+#define FN_DB_COLUMN_ANY (FN_QUERY2 + 4)
+#define FN_DB_DATA_SOURCE_ANY (FN_QUERY2 + 5)
+#define FN_DB_DATA_COMMAND_ANY (FN_QUERY2 + 6)
+#define FN_DB_DATA_COMMAND_TYPE_ANY (FN_QUERY2 + 7)
+#define FN_DB_DATA_COLUMN_NAME_ANY (FN_QUERY2 + 8)
+#define FN_DB_DATA_SELECTION_ANY (FN_QUERY2 + 9)
+#define FN_DB_DATA_CURSOR_ANY (FN_QUERY2 + 10)
+
+/*--------------------------------------------------------------------
+ Bereich: Envelope
+ --------------------------------------------------------------------*/
+
+#define FN_ENVELOP (FN_ENVELP )
+
+
+#define FN_DELETE_NOTE_AUTHOR (FN_NOTES+1)
+#define FN_DELETE_ALL_NOTES (FN_NOTES+2)
+#define FN_HIDE_NOTE (FN_NOTES+3)
+#define FN_HIDE_NOTE_AUTHOR (FN_NOTES+4)
+#define FN_HIDE_ALL_NOTES (FN_NOTES+5)
+
+#define FN_DELETE_COMMENT (FN_NOTES+6)
+#define FN_REPLY (FN_NOTES+7)
+
+
+/*--------------------------------------------------------------------
+ Bereich: Parameter
+ --------------------------------------------------------------------*/
+
+#define FN_PARAM_TABLE_COLS (FN_PARAM)
+#define FN_PARAM_TABLE_ROWS (FN_PARAM+1)
+#define FN_PARAM_MOVE_COUNT (FN_PARAM+2)
+#define FN_PARAM_MOVE_SELECTION (FN_PARAM+3)
+
+#define FN_PARAM_SEARCH_WORDONLY (FN_PARAM+5)
+#define FN_PARAM_SEARCH_EXACT (FN_PARAM+6)
+#define FN_PARAM_SEARCH_REGEXP (FN_PARAM+7)
+#define FN_PARAM_SEARCH_BACKWARDS (FN_PARAM+8)
+#define FN_PARAM_SEARCH_FINDALL (FN_PARAM+9)
+#define FN_PARAM_SEARCH_SELECTION (FN_PARAM+10)
+#define FN_PARAM_SEARCH_TEXT (FN_PARAM+11)
+#define FN_PARAM_SEARCH_TEXTREPLACE (FN_PARAM+12)
+
+#define FN_PARAM_PARADLGLIMITS (FN_PARAM+15)
+#define FN_PARAM_FRMMODE (FN_PARAM+16)
+
+#define FN_PARAM_ADDPRINTER (FN_PARAM+18)
+#define FN_PARAM_GRID (FN_PARAM+19)
+#define FN_PARAM_DOCDISP (FN_PARAM+20)
+#define FN_PARAM_ELEM (FN_PARAM+21)
+#define FN_PARAM_SWTEST (FN_PARAM+22)
+
+#define FN_PARAM_FTN_INFO (FN_PARAM+23)
+
+#define FN_PARAM_REGION_NAME (FN_PARAM+24)
+#define FN_PARAM_REGION_CONDITION (FN_PARAM+25)
+#define FN_PARAM_REGION_HIDDEN (FN_PARAM+26)
+#define FN_PARAM_REGION_PROTECT (FN_PARAM+27)
+#define FN_PARAM_REGION_EDIT_IN_READONLY (FN_PARAM+28)
+
+#define FN_PARAM_INSERT_AFTER (FN_PARAM+29)
+//#define FN_PARAM_FILTER (FN_PARAM+30) already defined in svx/svxids.hrc
+#define FN_PARAM_INDEX_NAME (FN_PARAM+31)
+#define FN_PARAM_INDEX_OPTIONS (FN_PARAM+32)
+#define FN_PARAM_INDEX_FORMAT (FN_PARAM+33)
+#define FN_PARAM_INDEX_LEVEL (FN_PARAM+34)
+#define FN_PARAM_INDEX_TEMPLATE (FN_PARAM+35)
+#define FN_PARAM_INDEX_ALTSTR (FN_PARAM+36)
+#define FN_PARAM_INDEX_PRIMKEY (FN_PARAM+37)
+#define FN_PARAM_INDEX_SECKEY (FN_PARAM+38)
+#define FN_PARAM_WIDTH (FN_PARAM+39)
+#define FN_PARAM_LOCATION (FN_PARAM+40)
+#define FN_PARAM_DIR (FN_PARAM+41)
+#define FN_PARAM_COUNT (FN_PARAM+42)
+#define FN_PARAM_COLOR (FN_PARAM+43)
+
+#define FN_PARAM_TABLE_NAME (FN_PARAM+44)
+#define FN_PARAM_TABLE_WIDTH (FN_PARAM+45)
+#define FN_PARAM_TABLE_ULSPACE (FN_PARAM+46)
+#define FN_PARAM_TABLE_LRSPACE (FN_PARAM+47)
+#define FN_PARAM_TABLE_SHADOW (FN_PARAM+48)
+#define FN_PARAM_TABLE_ALIGN (FN_PARAM+49)
+#define FN_PARAM_TABLE_HEADLINE (FN_PARAM+50)
+#define FN_PARAM_TABLE_SPACE (FN_PARAM+51)
+#define FN_PARAM_TABLE_COLUMNS (FN_PARAM+52)
+
+#define FN_PARAM_GRF_CONNECT (FN_PARAM+53)
+#define FN_PARAM_FIELD_TYPE (FN_PARAM+54)
+//already defined in svxids.hrc: #define FN_PARAM_FIELD_CONTENT (FN_PARAM+55)
+#define FN_PARAM_FIELD_SUBTYPE (FN_PARAM+56)
+#define FN_PARAM_FIELD_FORMAT (FN_PARAM+57)
+
+
+#define FN_PARAM_EVENT (FN_PARAM+68)
+#define FN_PARAM_URL (FN_PARAM+69)
+#define FN_PARAM_GRF_REALSIZE (FN_PARAM+70)
+#define FN_PARAM_GRF_DIALOG (FN_PARAM+71)
+#define FN_PARAM_GRF_CLIENTMAP (FN_PARAM+74) /* ClientMap */
+#define FN_PARAM_GRF_SERVERMAP (FN_PARAM+75) /* ServerMap */
+#define FN_PARAM_GRF_TARGETFRAME (FN_PARAM+76) /* TargetFrame */
+#define FN_INET_FIELD_MACRO (FN_PARAM+77) /* Id fuer URL-Feld-Macros*/
+
+#define FN_PARAM_PRINTER (FN_PARAM+78) /* Drucker* */
+#define FN_PARAM_STDFONTS (FN_PARAM+79) /* ConfigItem Standardfonts */
+
+#define FN_PARAM_WRTSHELL (FN_PARAM2) /* SwWrtShell */
+
+#define FN_COND_COLL (FN_PARAM2+1) /* Item fuer bed. Vorlagen */
+#define FN_PARAM_SELECTION (FN_PARAM2+2) /* selektiertes Wort fuer Format/Zeichen/Hyperlink */
+
+#define FN_PARAM_ACT_NUMBER (FN_PARAM2+3) /* PointerItem die aktuelle NumRule */
+#define FN_PARAM_CHILD_LEVELS (FN_PARAM2+4) /* Werden Child-Levels benutzt ?*/
+
+#define FN_PARAM_NUM_PRESET (FN_PARAM2+5) /* vorgewaehlte Numerierung*/
+
+#define FN_PARAM_HEIGHT (FN_PARAM2+6) /* Param fuer Hoehe */
+#define FN_PARAM_DIST (FN_PARAM2+7) /* und Breite, wg. metrischer Umwandlung */
+
+#define FN_PARAM_SHADOWCURSOR (FN_PARAM2+8) /* Fuer ShadowCursor Optionen */
+
+#define FN_PARAM_ACT_NUMLEVEL (FN_PARAM2+9) /* sal_uInt8-Item mit aktuellen NumLevel */
+
+#define FN_PARAM_9 (FN_PARAM2+10)
+#define FN_PARAM_10 (FN_PARAM2+11)
+
+#define FN_TEXT_RANGE (FN_PARAM2+12) /* TextRange Property*/
+
+#define FN_PARAM_CRSR_IN_PROTECTED (FN_PARAM2+13) /* Cursor in geschuetzten Bereichen*/
+#define FN_PARAM_TOX_TYPE (FN_PARAM2+14) /* TOX type in tox dialog*/
+#define FN_PARAM_LINK_DISPLAY_NAME (FN_PARAM2+15) /* LinkDisplayName property*/
+#define FN_PARAM_NUM_LEVEL (FN_PARAM2+16) /* rtf filter*/
+#define FN_PARAM_COUNTOUR_PP (FN_PARAM2+17) /* contour PolyPolygon*/
+
+#define FN_ANCHOR_POSITION (FN_PARAM2+18) /* AnchorPosition property */
+#define FN_DROP_TEXT (FN_PARAM2+18) /* text set in drop caps tab page - for recording */
+#define FN_DROP_CHAR_STYLE_NAME (FN_PARAM2+19) /* character style of drop caps - for recording */
+#define FN_PARAM_CHAIN_PREVIOUS (FN_PARAM2+20) /* Name of frame to be added as chain successor */
+#define FN_PARAM_CHAIN_NEXT (FN_PARAM2+21) /* Name of frame to be added as chain predecessor */
+#define FN_PARAM_DATABASE_PROPERTIES (FN_PARAM2+22) /* transport a Sequence<PropertyValue> containing database properties*/
+// --> OD 2004-08-06 #i28749#
+// com::sun::star::text::Shape::TransformationInHoriL2R property
+#define FN_SHAPE_TRANSFORMATION_IN_HORI_L2R (FN_PARAM2+23)
+// com::sun::star::text::Shape::PositionLayoutDir property
+#define FN_SHAPE_POSITION_LAYOUT_DIR (FN_PARAM2+24)
+// <--
+// --> OD 2004-10-28 #i36248#
+#define FN_SHAPE_STARTPOSITION_IN_HORI_L2R (FN_PARAM2+25)
+#define FN_SHAPE_ENDPOSITION_IN_HORI_L2R (FN_PARAM2+26)
+
+// <--
+/*--------------------------------------------------------------------
+ Bereich: Druckoptionen
+ --------------------------------------------------------------------*/
+
+#define FN_PRNOPT_GRAPHIC (FN_PRNOPT + 1)
+#define FN_PRNOPT_TABLE (FN_PRNOPT + 2)
+#define FN_PRNOPT_LEFT_PAGE (FN_PRNOPT + 3)
+#define FN_PRNOPT_RIGHT_PAGE (FN_PRNOPT + 4)
+#define FN_PRNOPT_REVERSE (FN_PRNOPT + 5)
+#define FN_PRNOPT_PAPER_FROM_SETUP (FN_PRNOPT + 6)
+#define FN_PRNOPT_POSTITS (FN_PRNOPT + 8)
+
+#define FN_PRNOPT_BEGIN FN_PRNOPT_GRAPHIC
+#define FN_PRNOPT_END FN_PRNOPT_POSTITS
+
+/*--------------------------------------------------------------------
+ Beschreibung: Status : nicht mehr als 19!
+ --------------------------------------------------------------------*/
+
+#define FN_STAT_PAGE (FN_STAT + 1)
+#define FN_STAT_TEMPLATE (FN_STAT + 2)
+#define FN_STAT_ZOOM (FN_STAT + 3)
+#define FN_STAT_INSOVER (FN_STAT + 4)
+#define FN_STAT_SELMODE (FN_STAT + 5)
+#define FN_STAT_CONTEXT (FN_STAT + 7)
+#define FN_STAT_BOOKMARK (FN_STAT + 8) /* Fuer Popup Bookmarks*/
+
+/*--------------------------------------------------------------------
+ Bereich: Seitenvorschau
+ --------------------------------------------------------------------*/
+
+#define FN_SHOW_TWO_PAGES (FN_PGPREVIEW + 1)
+//already in svx/svxids.hrc
+#ifndef FN_SHOW_MULTIPLE_PAGES
+#define FN_SHOW_MULTIPLE_PAGES (FN_PGPREVIEW + 2)
+#endif
+#define FN_PRINT_PAGEPREVIEW (FN_PGPREVIEW + 3)
+#define FN_CLOSE_PAGEPREVIEW (FN_PGPREVIEW + 4)
+#define FN_SHOW_BOOKVIEW (FN_PGPREVIEW + 5)
+
+/*--------------------------------------------------------------------
+ Bereich: Rahmenattribute
+ --------------------------------------------------------------------*/
+
+#define FN_OPAQUE (FN_FRAME + 1)
+#define FN_SET_PROTECT (FN_FRAME + 2)
+#define FN_SURROUND (FN_FRAME + 3)
+#define FN_VERT_ORIENT (FN_FRAME + 4)
+#define FN_HORI_ORIENT (FN_FRAME + 5)
+#define FN_SET_FRM_NAME (FN_FRAME + 6)
+#define FN_KEEP_ASPECT_RATIO (FN_FRAME + 7)
+#define FN_GRF_KEEP_ZOOM (FN_FRAME + 8)
+
+#define FN_IID_COL1 (FN_FRAME + 13)
+#define FN_IID_COL2 (FN_FRAME + 14)
+#define FN_IID_COL3 (FN_FRAME + 15)
+#define FN_IID_COLLEFT (FN_FRAME + 16)
+#define FN_IID_COLRIGHT (FN_FRAME + 17)
+
+#define FN_SET_FRM_ALT_NAME (FN_FRAME + 18)
+// --> OD 2009-07-13 #i73249#
+#define FN_UNO_TITLE (FN_FRAME + 19)
+#define FN_UNO_DESCRIPTION (FN_FRAME + 20)
+// <--
+
+
+//Member-Ids fuer Fill/SetVariable an Items
+#define MID_STYLE 0xe0
+#define MID_PWIDTH 0xe1
+#define MID_ADJUST 0xe2
+#define MID_TDIST 0xe3
+#define MID_BDIST 0xe4
+#define MID_LINES 0xe5
+#define MID_CHARS 0xe6
+#define MID_DIST 0xe7
+
+#define MID_1 0xe8
+#define MID_2 0xe9
+#define MID_3 0xea
+#define MID_4 0xeb
+#define MID_5 0xec
+#define MID_6 0xed
+#define MID_7 0xee
+#define MID_8 0xef
+#define MID_9 0xf0
+#define MID_A 0xf1
+#define MID_B 0xf2
+#define MID_C 0xf3
+#define MID_D 0xf4
+#define MID_E 0xf5
+#define MID_F 0xf6
+#define MID_10 0xf7
+#define MID_11 0xf8
+#define MID_12 0xf9
+#define MID_13 0xfa
+
+#ifndef SID_SW_DOCMAN_PATH
+#define SID_SW_DOCMAN_PATH (SID_OFASLOTS_START + 6)
+#endif
+
+// defines fuer Event-Zuweisung per Macro
+#define MAC_EVENT_MOUSEOVER 0x01 //
+#define MAC_EVENT_MOUSECLICK 0x02 // Hyperlink ausloesen
+#define MAC_EVENT_MOUSEOUT 0x03 //
+#define MAC_EVENT_OBJECT_SELECT 0x04 // Obj. selektieren
+#define MAC_EVENT_KEYINPUT_ALPHA 0x05 //
+#define MAC_EVENT_KEYINPUT_NOALPHA 0x06 //
+#define MAC_EVENT_FRM_RESIZE 0x07 //
+#define MAC_EVENT_FRM_MOVE 0x08 //
+#define MAC_EVENT_IMAGE_LOAD 0x09 //
+#define MAC_EVENT_IMAGE_ABORT 0x0a //
+#define MAC_EVENT_IMAGE_ERROR 0x0b //
+
+#endif /* INCLUDED_SW_CMDID_H */
diff --git a/sw/inc/colwd.hxx b/sw/inc/colwd.hxx
new file mode 100644
index 000000000000..54df3b1b9f24
--- /dev/null
+++ b/sw/inc/colwd.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _COLWD_HXX
+#define _COLWD_HXX
+
+
+#include <svx/stddlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+
+
+class SwTableFUNC;
+
+class SwTableWidthDlg : public SvxStandardDialog
+{
+ FixedLine aWidthFL;
+ FixedText aColFT;
+ NumericField aColEdit;
+ FixedText aWidthFT;
+ MetricField aWidthEdit;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+ SwTableFUNC &rFnc;
+
+protected:
+ virtual void Apply();
+ DECL_LINK( LoseFocusHdl, Edit* pEdt=0 );
+
+public:
+ SwTableWidthDlg(Window *pParent, SwTableFUNC &rFnc );
+};
+
+#endif
diff --git a/sw/inc/comcore.hrc b/sw/inc/comcore.hrc
new file mode 100644
index 000000000000..981c89ef37db
--- /dev/null
+++ b/sw/inc/comcore.hrc
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _COMCORE_HRC
+#define _COMCORE_HRC
+
+#include "rcid.hrc"
+
+// ---------------
+// die Strings
+// ---------------
+
+#define STR_COMCORE_READERROR (RC_COMCORE_BEGIN + 0)
+#define MSG_COMCORE_ASKSEARCH (RC_COMCORE_BEGIN + 1)
+#define STR_TABLE_DEFNAME (RC_COMCORE_BEGIN + 2)
+#define STR_GRAPHIC_DEFNAME (RC_COMCORE_BEGIN + 3)
+#define STR_OBJECT_DEFNAME (RC_COMCORE_BEGIN + 4)
+#define STR_FRAME_DEFNAME (RC_COMCORE_BEGIN + 5)
+#define STR_REGION_DEFNAME (RC_COMCORE_BEGIN + 6)
+#define STR_COMCORE_CANT_SHOW (RC_COMCORE_BEGIN + 7)
+#define RID_GRAPHIC_REPLACEBMP (RC_COMCORE_BEGIN + 8)
+#define RID_GRAPHIC_ERRORBMP (RC_COMCORE_BEGIN + 9)
+#define STR_NUMRULE_DEFNAME (RC_COMCORE_BEGIN + 10)
+#define STR_EMPTYPAGE (RC_COMCORE_BEGIN + 11)
+#define RID_SHELLRES_AUTOFMTSTRS (RC_COMCORE_BEGIN + 12)
+#define STR_MULT_INTERACT_HYPH_WARN (RC_COMCORE_BEGIN + 13)
+#define STR_MULT_INTERACT_SPELL_WARN (RC_COMCORE_BEGIN + 14)
+#define STR_SPELL_TITLE (RC_COMCORE_BEGIN + 15)
+#define STR_HYPH_TITLE (RC_COMCORE_BEGIN + 16)
+#define MSG_DISABLE_UNDO_QUESTION (RC_COMCORE_BEGIN + 17)
+#define MSG_DISABLE_READLINE_QUESTION (RC_COMCORE_BEGIN + 18)
+// -> #111827#
+#define STR_REDLINE_INSERT (RC_COMCORE_BEGIN + 19)
+#define STR_REDLINE_DELETE (RC_COMCORE_BEGIN + 20)
+#define STR_REDLINE_FORMAT (RC_COMCORE_BEGIN + 21)
+#define STR_REDLINE_TABLE (RC_COMCORE_BEGIN + 22)
+#define STR_REDLINE_FMTCOLL (RC_COMCORE_BEGIN + 23)
+#define STR_CLIPBOARD (RC_COMCORE_BEGIN + 24)
+#define STR_START_QUOTE (RC_COMCORE_BEGIN + 25)
+#define STR_END_QUOTE (RC_COMCORE_BEGIN + 26)
+#define STR_LDOTS (RC_COMCORE_BEGIN + 27)
+#define STR_YIELDS (RC_COMCORE_BEGIN + 28)
+#define STR_PARAGRAPHS (RC_COMCORE_BEGIN + 29)
+#define STR_MULTISEL (RC_COMCORE_BEGIN + 30)
+#define STR_REDLINE_MULTIPLE (RC_COMCORE_BEGIN + 31)
+#define STR_N_REDLINES (RC_COMCORE_BEGIN + 32)
+#define STR_FIELD (RC_COMCORE_BEGIN + 33)
+// <- #111827#
+// -> #115575#
+#define STR_FRAME (RC_COMCORE_BEGIN + 34)
+#define STR_OLE (RC_COMCORE_BEGIN + 35)
+#define STR_MATH_FORMULA (RC_COMCORE_BEGIN + 36)
+#define STR_CHART (RC_COMCORE_BEGIN + 37)
+#define STR_NOTE (RC_COMCORE_BEGIN + 38)
+#define STR_REFERENCE (RC_COMCORE_BEGIN + 39)
+#define STR_SCRIPT (RC_COMCORE_BEGIN + 40)
+#define STR_AUTHORITY_ENTRY (RC_COMCORE_BEGIN + 41)
+#define STR_SPECIALCHAR (RC_COMCORE_BEGIN + 42)
+#define STR_FOOTNOTE (RC_COMCORE_BEGIN + 43)
+#define STR_GRAPHIC (RC_COMCORE_BEGIN + 44)
+#define STR_DRAWING_OBJECTS (RC_COMCORE_BEGIN + 45)
+#define STR_TABLE_NAME (RC_COMCORE_BEGIN + 46)
+#define STR_PARAGRAPH_UNDO (RC_COMCORE_BEGIN + 47)
+// <- #115575#
+// -> PB #146850#
+#define RID_GRAPHIC_REPLACEBMP_HC (RC_COMCORE_BEGIN + 48)
+#define RID_GRAPHIC_ERRORBMP_HC (RC_COMCORE_BEGIN + 49)
+// <- #146850#
+
+// defines fuer die Autoformat Redline Kommentare
+#define STR_AUTOFMTREDL_DEL_EMPTY_PARA 0
+#define STR_AUTOFMTREDL_USE_REPLACE 1
+#define STR_AUTOFMTREDL_CPTL_STT_WORD 2
+#define STR_AUTOFMTREDL_CPTL_STT_SENT 3
+#define STR_AUTOFMTREDL_TYPO 4
+#define STR_AUTOFMTREDL_USER_STYLE 5
+#define STR_AUTOFMTREDL_BULLET 6
+#define STR_AUTOFMTREDL_UNDER 7
+#define STR_AUTOFMTREDL_BOLD 8
+#define STR_AUTOFMTREDL_FRACTION 9
+#define STR_AUTOFMTREDL_DETECT_URL 10
+#define STR_AUTOFMTREDL_DASH 11
+#define STR_AUTOFMTREDL_ORDINAL 12
+#define STR_AUTOFMTREDL_RIGHT_MARGIN 13
+#define STR_AUTOFMTREDL_SET_TMPL_TEXT 14
+#define STR_AUTOFMTREDL_SET_TMPL_INDENT 15
+#define STR_AUTOFMTREDL_SET_TMPL_NEG_INDENT 16
+#define STR_AUTOFMTREDL_SET_TMPL_TEXT_INDENT 17
+#define STR_AUTOFMTREDL_SET_TMPL_HEADLINE 18
+#define STR_AUTOFMTREDL_SET_NUMBULET 19
+#define STR_AUTOFMTREDL_DEL_MORELINES 20
+#define STR_AUTOFMTREDL_NON_BREAK_SPACE 21
+// !!!!!!!!!!!!!!!!!!!!!!!!!! das Ende immer richtig setzen !!!!!!!!!!!!
+#define STR_AUTOFMTREDL_END 22
+
+
+#endif
+
+
+
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
new file mode 100644
index 000000000000..6dbb2fbc3fe7
--- /dev/null
+++ b/sw/inc/crsrsh.hxx
@@ -0,0 +1,962 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_CRSRSH_HXX
+#define SW_CRSRSH_HXX
+
+#include <com/sun/star/i18n/WordType.hpp>
+
+#include <tools/string.hxx>
+#include <tools/link.hxx>
+#include <tools/rtti.hxx>
+
+#include <IShellCursorSupplier.hxx>
+#include "swdllapi.h"
+#include <swtypes.hxx> // fuer SWPOSDOC
+#include <viewsh.hxx> // fuer ViewShell
+#include <calbck.hxx> // fuer SwClient
+#include <cshtyp.hxx> // fuer die CursorShell Typen
+#include <crstate.hxx> // fuer die CursorMove-Staties
+#include <toxe.hxx> // SwTOXSearchDir
+#include <tblsel.hxx> //SwTblSearchType
+#include <viscrs.hxx>
+#include <node.hxx>
+#include <tblsel.hxx>
+#include <IDocumentMarkAccess.hxx>
+
+
+// einige Forward Deklarationen
+
+class KeyCode;
+class SfxItemSet;
+class SfxPoolItem;
+class SwCntntFrm;
+class SwCrsrShell;
+class SwCursor;
+class SwField;
+class SwFieldType;
+class SwFmt;
+class SwFmtFld;
+class SwNodeIndex;
+class SwPaM;
+class SwShellCrsr;
+class SwShellTableCrsr;
+class SwTableNode;
+class SwTxtFmtColl;
+class SwVisCrsr;
+class SwTxtINetFmt;
+class SwFmtINetFmt;
+class SwTxtAttr;
+class SwTableBox;
+class SwCellFrms;
+class SwTOXMark;
+class SwRedline;
+class IBlockCursor;
+class SwCntntNode; // #i23726#
+// --> OD 2008-06-19 #i90516#
+class SwPostItField;
+// <--
+struct SwPosition;
+
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace text {
+ class XTextRange;
+}}}}
+
+namespace com { namespace sun { namespace star { namespace container {
+ class XStringKeyMap;
+}}}}
+
+// enum und struktur, um ueber die Doc-Position Informationen zu erfragen
+
+struct SwContentAtPos
+{
+ enum IsAttrAtPos
+ {
+ SW_NOTHING = 0x0000,
+ SW_FIELD = 0x0001,
+ SW_CLICKFIELD = 0x0002,
+ SW_FTN = 0x0004,
+ SW_INETATTR = 0x0008,
+ SW_TABLEBOXFML = 0x0010,
+ SW_REDLINE = 0x0020,
+ SW_OUTLINE = 0x0040,
+ SW_TOXMARK = 0x0080,
+ SW_REFMARK = 0x0100,
+ SW_NUMLABEL = 0x0200, // #i23726#
+ SW_CONTENT_CHECK = 0x0400, // --> FME 2005-05-13 #i43742# <--
+ SW_SMARTTAG = 0x0800,
+ SW_FORMCTRL = 0x1000
+#ifndef PRODUCT
+ ,SW_CURR_ATTRS = 0x4000 // nur zum Debuggen
+ ,SW_TABLEBOXVALUE = 0x8000 // nur zum Debuggen
+#endif
+ } eCntntAtPos;
+
+ union {
+ const SwField* pFld;
+ const SfxPoolItem* pAttr;
+ const SwRedline* pRedl;
+ SwCntntNode * pNode; // #i23726#
+ const sw::mark::IFieldmark* pFldmark;
+ } aFnd;
+
+ int nDist; // #i23726#
+
+ String sStr;
+ const SwTxtAttr* pFndTxtAttr;
+
+ SwContentAtPos( int eGetAtPos = 0xffff )
+ : eCntntAtPos( (IsAttrAtPos)eGetAtPos )
+ {
+ aFnd.pFld = 0;
+ pFndTxtAttr = 0;
+ nDist = 0; // #i23726#
+ }
+
+ // befindet sich der Node in einem geschuetzten Bereich?
+ sal_Bool IsInProtectSect() const;
+ bool IsInRTLText()const;
+};
+
+// ReturnWerte von SetCrsr (werden verodert)
+const int CRSR_POSOLD = 0x01, // Cursor bleibt an alter Doc-Position
+ CRSR_POSCHG = 0x02; // Position vom Layout veraendert
+
+// Helperfunction to resolve backward references in regular expressions
+
+String *ReplaceBackReferences( const com::sun::star::util::SearchOptions& rSearchOpt, SwPaM* pPam );
+
+// die Cursor - Shell
+class SW_DLLPUBLIC SwCrsrShell
+ : public ViewShell
+ , public SwModify
+ , public ::sw::IShellCursorSupplier
+{
+ friend class SwCallLink;
+ friend class SwVisCrsr;
+ friend class SwSelPaintRects;
+ friend class SwChgLinkFlag;
+
+ //Braucht den Crsr als IntrnlCrsr.
+ friend sal_Bool GetAutoSumSel( const SwCrsrShell&, SwCellFrms& );
+
+public: // public, damit defaultet werden kann !!
+
+ /* ein enum fuer den Aufruf von UpdateCrsr */
+ enum CrsrFlag {
+ UPDOWN = (1 << 0), // Up/Down auf Spalte halten
+ SCROLLWIN = (1 << 1), // Window Scrollen
+ CHKRANGE = (1 << 2), // ueberpruefen von ueberlappenden PaM's
+ NOCALRECT = (1 << 3), // CharRect nicht neu berechnen
+ READONLY = (1 << 4) // Sichtbar machen trotz Readonly
+ };
+
+private:
+
+ SwRect aCharRect; // Char-SRectangle auf dem der Cursor steht
+ Point aCrsrHeight; // Hohe&Offset von sichtbaren Cursor
+ Point aOldRBPos; // Right/Bottom von letzter VisArea
+ // (wird im Invalidate vom Cursor benutzt)
+
+
+ // um event. Macro was anhaengt auszufuehren.
+ Link aFlyMacroLnk; // Link will be called, if the Crsr is set
+ // into a fly. A macro can be then becalled
+ Link aChgLnk; // link will be called by every attribut/
+ // format changes at cursor position.
+ Link aGrfArrivedLnk; // Link calls to UI if a grafik is arrived
+
+
+ SwShellCrsr* pCurCrsr; // der aktuelle Cursor
+ SwShellCrsr* pCrsrStk; // Stack fuer den Cursor
+ SwVisCrsr *pVisCrsr; // der Sichtbare-Cursor
+
+ IBlockCursor *pBlockCrsr; // interface of cursor for block (=rectangular) selection
+
+ SwShellTableCrsr* pTblCrsr; // Tabellen-Crsr; nur in Tabellen, wenn
+ // die Selection ueber 2 Spalten liegt
+
+ SwNodeIndex* pBoxIdx; // fuers erkennen der veraenderten
+ SwTableBox* pBoxPtr; // Tabellen-Zelle
+
+ long nUpDownX; // versuche den Cursor bei Up/Down immer in
+ // der gleichen Spalte zu bewegen
+ long nLeftFrmPos;
+ sal_uLong nAktNode; // save CursorPos at Start-Action
+ xub_StrLen nAktCntnt;
+ sal_uInt16 nAktNdTyp;
+ bool bAktSelection;
+
+ /*
+ * Mit den Methoden SttCrsrMove und EndCrsrMove wird dieser Zaehler
+ * Inc-/Decrementiert. Solange der Zaehler ungleich 0 ist, erfolgt
+ * auf den akt. Cursor kein Update. Dadurch koennen "komplizierte"
+ * Cursorbewegungen (ueber Find()) realisiert werden.
+ */
+ sal_uInt16 nCrsrMove;
+ sal_uInt16 nBasicActionCnt; // Actions, die vom Basic geklammert wurden
+ CrsrMoveState eMvState; // Status fuers Crsr-Travelling - GetCrsrOfst
+
+ // --> OD 2008-04-02 #refactorlists#
+ String sMarkedListId;
+ int nMarkedListLevel;
+ // <--
+
+ sal_Bool bHasFocus : 1; // Shell ist in einem Window "aktiv"
+ sal_Bool bSVCrsrVis : 1; // SV-Cursor Un-/Sichtbar
+ sal_Bool bChgCallFlag : 1; // Attributaenderung innerhalb von
+ // Start- und EndAction
+ sal_Bool bVisPortChgd : 1; // befindet sich im VisPortChg-Aufruf
+ // (wird im Invalidate vom Cursor benutzt)
+
+ sal_Bool bCallChgLnk : 1; // Flag fuer abgeleitete Klassen:
+ // sal_True -> ChgLnk callen
+ // Zugriff nur ueber SwChgLinkFlag
+ sal_Bool bAllProtect : 1; // Flag fuer Bereiche
+ // sal_True -> alles geschuetzt / versteckt
+ sal_Bool bInCMvVisportChgd : 1; // Flag fuer CrsrMoves
+ // sal_True -> die Sicht wurde verschoben
+ sal_Bool bGCAttr : 1; // sal_True -> es existieren nichtaufgespannte Attr.
+ sal_Bool bIgnoreReadonly : 1; // sal_True -> Beim naechsten EndAction trotz
+ // Readonly den Crsr sichtbar machen.
+ sal_Bool bSelTblCells : 1; // sal_True -> Zellen uebers InputWin selektieren
+ sal_Bool bAutoUpdateCells : 1; // sal_True -> Zellen werden autoformatiert
+ sal_Bool bBasicHideCrsr : 1; // sal_True -> HideCrsr vom Basic
+ sal_Bool bSetCrsrInReadOnly : 1;// sal_True -> Cursor darf in ReadOnly-Bereiche
+ sal_Bool bOverwriteCrsr : 1; // sal_True -> show Overwrite Crsr
+
+ // OD 11.02.2003 #100556# - flag to allow/avoid execution of marcos (default: true)
+ bool mbMacroExecAllowed : 1;
+
+ SW_DLLPRIVATE void UpdateCrsr( sal_uInt16 eFlags
+ =SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE,
+ sal_Bool bIdleEnd = sal_False );
+
+ SW_DLLPRIVATE void _ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing );
+
+ // -> #i27615#
+
+ /** Mark a certain list level of a certain list
+
+ OD 2008-04-02 #refactorlists#
+ levels of a certain lists are marked now
+
+ @param sListId list Id of the list whose level is marked
+ @param nLevel to be marked list level
+
+ An empty sListId denotes that no level of a list is marked.
+ */
+ SW_DLLPRIVATE void MarkListLevel( const String& sListId,
+ const int nLevel );
+ // <- #i27615#
+
+ // private method(s) accessed from public inline method(s) must be exported.
+ sal_Bool LeftRight( sal_Bool, sal_uInt16, sal_uInt16, sal_Bool );
+ SW_DLLPRIVATE sal_Bool UpDown( sal_Bool, sal_uInt16 );
+ SW_DLLPRIVATE sal_Bool LRMargin( sal_Bool, sal_Bool bAPI = sal_False );
+ SW_DLLPRIVATE sal_Bool IsAtLRMargin( sal_Bool, sal_Bool bAPI = sal_False ) const;
+
+ SW_DLLPRIVATE short GetTextDirection( const Point* pPt = 0 ) const;
+
+typedef sal_Bool (SwCursor:: *FNCrsr)();
+ SW_DLLPRIVATE sal_Bool CallCrsrFN( FNCrsr );
+
+ SW_DLLPRIVATE const SwRedline* _GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect );
+
+protected:
+
+ inline SwMoveFnCollection* MakeFindRange( sal_uInt16, sal_uInt16, SwPaM* ) const;
+
+ /*
+ * Compare-Methode for the StackCursor and the current Cursor.
+ * The Methods return -1, 0, 1 for lower, equal, greater. The enum
+ * CrsrCompareType says which position is compared.
+ */
+ enum CrsrCompareType {
+ StackPtStackMk,
+ StackPtCurrPt,
+ StackPtCurrMk,
+ StackMkCurrPt,
+ StackMkCurrMk,
+ CurrPtCurrMk
+ };
+ int CompareCursor( CrsrCompareType eType ) const;
+
+ // Setzt alle PaMs in OldNode auf NewPos + Offset
+ void PaMCorrAbs(const SwNodeIndex &rOldNode, const SwPosition &rNewPos,
+ const xub_StrLen nOffset = 0 );
+
+ // --> FME 2004-07-30 #i32329# Enhanced table selection
+ sal_Bool _SelTblRowOrCol( bool bRow, bool bRowSimple = false );
+ // <--
+
+ // --> FME 2005-01-31 #i41424# Only update the marked number levels if necessary
+ bool SetInFrontOfLabel( sal_Bool bNew );
+ // <--
+
+ void RefreshBlockCursor();
+
+ /** Updates the marked list level according to the cursor.
+ */
+ SW_DLLPRIVATE void UpdateMarkedListLevel();
+
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ TYPEINFO();
+ SwCrsrShell( SwDoc& rDoc, Window *pWin, const SwViewOption *pOpt = 0 );
+ // verkleideter Copy-Constructor
+ SwCrsrShell( SwCrsrShell& rShell, Window *pWin );
+ virtual ~SwCrsrShell();
+
+ // IShellCursorSupplier
+ virtual SwPaM & CreateNewShellCursor();
+ virtual SwPaM & GetCurrentShellCursor();
+
+ // neuen Cusror erzeugen und den alten anhaengen
+ SwPaM * CreateCrsr();
+ // loesche den aktuellen Cursor und der folgende wird zum Aktuellen
+ sal_Bool DestroyCrsr();
+ // TableCursor in normale Cursor verwandeln, Tablemode aufheben
+ void TblCrsrToCursor();
+ // enter block mode, change normal cursor into block cursor
+ void CrsrToBlockCrsr();
+ // leave block mode, change block cursor into normal cursor
+ void BlockCrsrToCrsr();
+
+ // SelAll() selects the document body content
+ // if ExtendedSelect() is called afterwards, the whole nodes array is selected
+ // only for usage in special cases allowed!
+ void ExtendedSelectAll();
+
+ SwPaM* GetCrsr( sal_Bool bMakeTblCrsr = sal_True ) const;
+ inline SwCursor* GetSwCrsr( sal_Bool bMakeTblCrsr = sal_True ) const;
+ // nur den akt. Cursor returnen
+ SwShellCrsr* _GetCrsr() { return pCurCrsr; }
+ const SwShellCrsr* _GetCrsr() const { return pCurCrsr; }
+
+ // uebergebenen Cursor anzeigen - fuer UNO
+ void SetSelection(const SwPaM& rCrsr);
+
+ // alle Cursor aus den ContentNodes entfernen und auf 0 setzen.
+ // Wurde aus der FEShell hierher verschoben.
+ void ParkCrsr( const SwNodeIndex &rIdx );
+
+ // gebe den akt. Cursor-Stack zurueck.
+ // ( Wird in der EditShell beim Loeschen von Inhalten benoetigt! )
+ inline SwPaM* GetStkCrsr() const;
+
+ // Start der Klammerung, SV-Cursor und selektierte Bereiche hiden
+ void StartAction();
+ // Ende der Klammerung, SV-Cursor und selektierte Bereiche anzeigen
+ void EndAction( const sal_Bool bIdleEnd = sal_False );
+
+ // Basiscursortravelling
+ long GetUpDownX() const { return nUpDownX; }
+
+ sal_Bool Left( sal_uInt16 nCnt, sal_uInt16 nMode, sal_Bool bAllowVisual = sal_False )
+ { return LeftRight( sal_True, nCnt, nMode, bAllowVisual ); }
+ sal_Bool Right( sal_uInt16 nCnt, sal_uInt16 nMode, sal_Bool bAllowVisual = sal_False )
+ { return LeftRight( sal_False, nCnt, nMode, bAllowVisual ); }
+ sal_Bool Up( sal_uInt16 nCnt = 1 ) { return UpDown( sal_True, nCnt ); }
+ sal_Bool Down( sal_uInt16 nCnt = 1 ) { return UpDown( sal_False, nCnt ); }
+ sal_Bool LeftMargin() { return LRMargin( sal_True ); }
+ sal_Bool RightMargin(sal_Bool bAPI = sal_False) { return LRMargin( sal_False, bAPI ); }
+ sal_Bool SttEndDoc( sal_Bool bStt );
+
+ sal_Bool MovePage( SwWhichPage, SwPosPage );
+ sal_Bool MovePara( SwWhichPara, SwPosPara );
+ sal_Bool MoveSection( SwWhichSection, SwPosSection );
+ sal_Bool MoveTable( SwWhichTable, SwPosTable );
+ sal_Bool MoveColumn( SwWhichColumn, SwPosColumn );
+ sal_Bool MoveRegion( SwWhichRegion, SwPosRegion );
+
+ // die Suchfunktionen
+ sal_uLong Find( const com::sun::star::util::SearchOptions& rSearchOpt,
+ sal_Bool bSearchInNotes,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ sal_Bool& bCancel,
+ FindRanges eRng, int bReplace = sal_False );
+
+ sal_uLong Find( const SwTxtFmtColl& rFmtColl,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ sal_Bool& bCancel,
+ FindRanges eRng, const SwTxtFmtColl* pReplFmt = 0 );
+
+ sal_uLong Find( const SfxItemSet& rSet, sal_Bool bNoCollections,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ sal_Bool& bCancel,
+ FindRanges eRng,
+ const com::sun::star::util::SearchOptions* pSearchOpt = 0,
+ const SfxItemSet* rReplSet = 0 );
+
+ // Positionieren des Cursors
+ // returnt
+ // CRSR_POSCHG: wenn der ob der SPoint vom Layout korrigiert wurde.
+ // CRSR_POSOLD: wenn der Crsr nicht veraendert wurde
+ int SetCrsr( const Point &rPt, sal_Bool bOnlyText = sal_False, bool bBlock = true );
+
+
+ /*
+ * Benachrichtung, dass der sichtbare Bereich sich geaendert
+ * hat. aVisArea wird neu gesetzt, anschliessend wird
+ * gescrollt. Das uebergebene Rectangle liegt auf
+ * Pixelgrenzen, um Pixelfehler beim Scrollen zu vermeiden.
+ */
+ virtual void VisPortChgd( const SwRect & );
+
+ /*
+ * Virtuelle PaintMethode, damit die Selection nach dem Paint wieder
+ * sichtbar wird.
+ */
+ void Paint( const Rectangle & rRect );
+
+ // Bereiche
+ inline void SetMark();
+ inline sal_Bool HasMark();
+
+ void ClearMark();
+
+ /**
+ Ensure point and mark of the current PaM are in a specific order.
+
+ @param bPointFirst TRUE: If the point is behind the mark then
+ swap the PaM. FALSE: If the mark is behind the point then swap
+ the PaM.
+ */
+ void NormalizePam(sal_Bool bPointFirst = sal_True);
+
+ void SwapPam();
+ sal_Bool ChgCurrPam( const Point & rPt,
+ sal_Bool bTstOnly = sal_True, //Nur testen, nicht setzen
+ sal_Bool bTstHit = sal_False ); //Nur genaue Treffer
+ void KillPams();
+
+ // erzeuge eine Kopie vom Cursor und speicher diese im Stack
+ void Push();
+ /*
+ * Loescht einen Cursor (gesteuert durch bOldCrsr)
+ * - vom Stack oder ( bOldCrsr = sal_True )
+ * - den aktuellen und der auf dem Stack stehende wird zum aktuellen
+ *
+ * Return: es war auf dem Stack noch einer vorhanden
+ */
+ sal_Bool Pop( sal_Bool bOldCrsr = sal_True );
+ /*
+ * Verbinde zwei Cursor miteinander.
+ * Loesche vom Stack den obersten und setzen dessen Mark im Aktuellen.
+ */
+ void Combine();
+
+#if !defined(DBG_UTIL)
+ void SttCrsrMove() { ++nCrsrMove; StartAction(); }
+ void EndCrsrMove( const sal_Bool bIdleEnd = sal_False )
+ { EndAction( bIdleEnd ); --nCrsrMove; }
+#else
+ void SttCrsrMove();
+ void EndCrsrMove( const sal_Bool bIdleEnd = sal_False );
+#endif
+
+ /*
+ * Beim Abgeben des Focuses werden die selektierten Bereiche nicht mehr
+ * angezeigt; andererseits beim Erhalten des Focuses, werden alle selek-
+ * tierten Bereiche wieder angezeigt. (Bereiche muessen neu berechnet
+ * werden!)
+ */
+ sal_Bool HasShFcs() const { return bHasFocus; }
+ void ShLooseFcs();
+ void ShGetFcs( sal_Bool bUpdate = sal_True );
+
+ // Methoden zum Anzeigen bzw. Verstecken des sichtbaren Text-Cursors
+ void ShowCrsr();
+ void HideCrsr();
+ // Methoden zum Anzeigen bzw. Verstecken der selektierten Bereiche mit
+ // dem sichtbaren Cursor
+ void ShowCrsrs( sal_Bool bCrsrVis );
+ void HideCrsrs();
+
+ sal_Bool IsOverwriteCrsr() const { return bOverwriteCrsr; }
+ void SetOverwriteCrsr( sal_Bool bFlag ) { bOverwriteCrsr = bFlag; }
+
+ // gebe den aktuellen Frame, in dem der Cursor steht, zurueck
+ SwCntntFrm *GetCurrFrm( const sal_Bool bCalcFrm = sal_True ) const;
+
+ //sal_True wenn der Crsr wenn der Crsr wegen Readonly gehidet ist,
+ //sal_False wenn der arbeitet (trotz Readonly).
+ sal_Bool IsCrsrReadonly() const;
+ // Cursor steht in etwas geschuetztem oder in die Selektion umspannt
+ // etwas geschuetztes.
+ sal_Bool HasReadonlySel() const;
+ // darf der Cursor in ReadOnlyBereiche?
+ sal_Bool IsReadOnlyAvailable() const { return bSetCrsrInReadOnly; }
+ void SetReadOnlyAvailable( sal_Bool bFlag );
+ sal_Bool IsOverReadOnlyPos( const Point& rPt ) const;
+
+ // Methoden fuer aFlyMacroLnk
+ void SetFlyMacroLnk( const Link& rLnk ) { aFlyMacroLnk = rLnk; }
+ const Link& GetFlyMacroLnk() const { return aFlyMacroLnk; }
+
+ // Methoden geben/aendern den Link fuer die Attribut/Format-Aenderungen
+ void SetChgLnk( const Link &rLnk ) { aChgLnk = rLnk; }
+ const Link& GetChgLnk() const { return aChgLnk; }
+
+ // Methoden geben/aendern den Link fuers "Grafik vollstaendig geladen"
+ void SetGrfArrivedLnk( const Link &rLnk ) { aGrfArrivedLnk = rLnk; }
+ const Link& GetGrfArrivedLnk() const { return aGrfArrivedLnk; }
+
+ //ChgLink callen, innerhalb einer Action wird der Ruf verzoegert.
+ void CallChgLnk();
+
+ // Abfrage, ob der aktuelle Cursor eine Selektion aufspannt,
+ // also, ob Mark gesetzt und SPoint und Mark unterschiedlich sind.
+ sal_Bool HasSelection() const;
+
+ // Abfrage, ob ueberhaupt eine Selektion existiert, sprich der akt. Cursor
+ // aufgespannt oder nicht der einzigste ist.
+ inline sal_Bool IsSelection() const;
+ // returns if multiple cursors are available
+ inline sal_Bool IsMultiSelection() const;
+
+ // Abfrage, ob ein kompletter Absatz selektiert wurde
+ sal_Bool IsSelFullPara() const;
+ // Abfrage, ob die Selektion in einem Absatz ist
+ inline sal_Bool IsSelOnePara() const;
+
+ //Sollte fuer das Clipboard der WaitPtr geschaltet werden.
+ sal_Bool ShouldWait() const;
+
+ /*
+ * liefert das SRectangle, auf dem der Cursor steht.
+ */
+ const SwRect &GetCharRect() const { return aCharRect; }
+ /*
+ * liefert zurueck, ob der Cursor sich ganz oder teilweise im
+ * sichtbaren Bereich befindet.
+ */
+ sal_Bool IsCrsrVisible() const { return VisArea().IsOver( GetCharRect() ); }
+
+ // gebe die aktuelle Seitennummer zurueck:
+ // sal_True: in der der Cursor steht
+ // sal_False: die am oberen Rand sichtbar ist
+ void GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum,
+ sal_Bool bAtCrsrPos = sal_True, const sal_Bool bCalcFrm = sal_True );
+ // bestimme in welche Richtung "leere Seiten" behandelt werden!
+ // (wird benutzt im PhyPage.. )
+ sal_uInt16 GetNextPrevPageNum( sal_Bool bNext = sal_True );
+
+ // setze den Cursor auf die Seite "nPage" an den Anfang
+ sal_Bool GotoPage( sal_uInt16 nPage );
+
+ // gebe alle Dokumentseiten zurueck
+ sal_uInt16 GetPageCnt();
+
+ // Gehe zur naechsten Selection
+ sal_Bool GoNextCrsr();
+ // gehe zur vorherigen Selection
+ sal_Bool GoPrevCrsr();
+
+ // at CurCrsr.SPoint
+ ::sw::mark::IMark* SetBookmark(
+ const KeyCode&,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rShortName,
+ IDocumentMarkAccess::MarkType eMark = IDocumentMarkAccess::BOOKMARK);
+ bool GotoMark( const ::sw::mark::IMark* const pMark ); // sets CurCrsr.SPoint
+ bool GotoMark( const ::sw::mark::IMark* const pMark, bool bAtStart );
+ bool GoNextBookmark(); // true, if there was one
+ bool GoPrevBookmark();
+
+ bool IsFormProtected();
+ ::sw::mark::IFieldmark* GetCurrentFieldmark();
+ ::sw::mark::IFieldmark* GetFieldmarkAfter();
+ ::sw::mark::IFieldmark* GetFieldmarkBefore();
+ bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark );
+
+ // aktualisiere den Crsrs, d.H. setze ihn wieder in den Content.
+ // Das sollte nur aufgerufen werden, wenn der Cursor z.B. beim
+ // Loeschen von Rahmen irgendwohin gesetzt wurde. Die Position
+ // ergibt sich aus seiner aktuellen Position im Layout !!
+ void UpdateCrsrPos();
+
+ // returne den am akt. Cursor selektierten Text. Dieser wird mit
+ // Felder etc. aufgefuellt!!
+ String GetSelTxt() const;
+ // gebe nur den Text ab der akt. Cursor Position zurueck (bis zum NodeEnde)
+ String GetText() const;
+
+ // pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen
+ inline const SwTableNode* IsCrsrInTbl( sal_Bool bIsPtInTbl = sal_True ) const;
+ // erfrage die Document - Layout - Position vom akt. Crsr
+ inline Point& GetCrsrDocPos( sal_Bool bPoint = sal_True ) const;
+ inline sal_Bool IsCrsrPtAtEnd() const;
+
+ inline const SwPaM* GetTblCrs() const;
+ inline SwPaM* GetTblCrs();
+
+ sal_Bool IsTblComplex() const;
+ sal_Bool IsTblComplexForChart();
+ // erfrage die akt. TabellenSelektion als Text
+ String GetBoxNms() const;
+
+ // setze Crsr in die naechsten/vorherigen Celle
+ sal_Bool GoNextCell( sal_Bool bAppendLine = sal_True );
+ sal_Bool GoPrevCell();
+ // gehe zu dieser Box (wenn vorhanden und in Tabelle!)
+ sal_Bool GotoTable( const String& rName );
+
+ // select a table row, column or box (based on the current cursor)
+ sal_Bool SelTblRow() { return _SelTblRowOrCol( true ); }
+ sal_Bool SelTblCol() { return _SelTblRowOrCol( false ); }
+ sal_Bool SelTblBox();
+ // --> FME 2004-07-30 #i32329# Enhanced table selection
+ sal_Bool SelTbl();
+ // <--
+
+ // zum naechsten/vorhergehenden Punkt auf gleicher Ebene
+ sal_Bool GotoNextNum();
+ sal_Bool GotoPrevNum();
+
+ // zu diesem Gliederungspunkt
+ sal_Bool GotoOutline( const String& rName );
+ // zum naechsten/vorhergehenden oder angegebenen OultineNode
+ void GotoOutline( sal_uInt16 nIdx );
+ // suche die "Outline-Position" im Nodes-Array vom akt. Kaiptel
+ sal_uInt16 GetOutlinePos( sal_uInt8 nLevel = UCHAR_MAX );
+ // selektiere den angeben Bereich von OutlineNodes. Optional
+ // inclusive der Childs. Die sal_uInt16 sind die Positionen im
+ // OutlineNds-Array!! (EditShell)
+ sal_Bool MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos,
+ sal_Bool bWithChilds = sal_False );
+
+ sal_Bool GotoNextOutline(); // naechster Node mit Outline-Num.
+ sal_Bool GotoPrevOutline(); // vorheriger Node mit Outline-Num.
+
+ /** Delivers the current shell cursor
+
+ Some operations have to run on the current cursor ring,
+ some on the pTblCrsr (if exist) or the current cursor ring and
+ some on the pTblCrsr or pBlockCrsr or the current cursor ring.
+ This small function checks the existence and delivers the wished cursor.
+
+ @param bBlock [bool]
+ if the block cursor is of interest or not
+
+ @return pTblCrsr if exist,
+ pBlockCrsr if exist and of interest (param bBlock)
+ otherwise pCurCrsr
+ */
+ SwShellCrsr* getShellCrsr( bool bBlock );
+ const SwShellCrsr* getShellCrsr( bool bBlock ) const
+ { return (const_cast<SwCrsrShell*>(this))->getShellCrsr( bBlock ); }
+
+ FASTBOOL IsBlockMode() const { return 0 != pBlockCrsr; }
+ const IBlockCursor* GetBlockCrsr() const { return pBlockCrsr; }
+ IBlockCursor* GetBlockCrsr() { return pBlockCrsr; }
+
+ // ist der Crsr in einer Tabelle und ist die Selection ueber
+ // zwei Spalten
+ sal_Bool IsTableMode() const { return 0 != pTblCrsr; }
+
+ // erfrage den Tabellen Crsr; ausserhalb von Tabellen immer 0
+ const SwShellTableCrsr* GetTableCrsr() const { return pTblCrsr; }
+ SwShellTableCrsr* GetTableCrsr() { return pTblCrsr; }
+ sal_uInt16 UpdateTblSelBoxes();
+
+ sal_Bool GotoFtnTxt(); // springe aus dem Content zur Fussnote
+ sal_Bool GotoFtnAnchor(); // springe aus der Fussnote zum Anker
+ sal_Bool GotoPrevFtnAnchor();
+ sal_Bool GotoNextFtnAnchor();
+
+ sal_Bool GotoFlyAnchor(); // springe aus dem Rahmen zum Anker
+ sal_Bool GotoHeaderTxt(); // springe aus dem Content zum Header
+ sal_Bool GotoFooterTxt(); // springe aus dem Content zum Footer
+ // springe in den Header/Footer des angegebenen oder akt. PageDesc
+ sal_Bool SetCrsrInHdFt( sal_uInt16 nDescNo = USHRT_MAX,
+ sal_Bool bInHeader = sal_True );
+ // is point of cursor in header/footer. pbInHeader return sal_True if it is
+ // in a headerframe otherwise in a footerframe
+ sal_Bool IsInHeaderFooter( sal_Bool* pbInHeader = 0 ) const;
+
+ // springe zum naechsten Verzeichnis [mit dem Namen]
+ sal_Bool GotoNextTOXBase( const String* = 0 );
+ // springe zum vorherigen Verzeichnis [mit dem Namen]
+ sal_Bool GotoPrevTOXBase( const String* = 0 );
+ sal_Bool GotoTOXMarkBase(); // springe zum Verzeichnis vom TOXMark
+ // springe zum naechsten (vorherigen) Verzeichniseintrag
+ sal_Bool GotoNxtPrvTOXMark( sal_Bool bNext = sal_True );
+ // Zur naechsten/ vorherigen Verzeichnismarke dieses Typs traveln
+ const SwTOXMark& GotoTOXMark( const SwTOXMark& rStart, SwTOXSearch eDir );
+
+ // springe zum naechsten (vorherigen) Tabellenformel
+ // optional auch nur zu kaputten Formeln springen
+ sal_Bool GotoNxtPrvTblFormula( sal_Bool bNext = sal_True,
+ sal_Bool bOnlyErrors = sal_False );
+ // jump to the next / previous hyperlink - inside text and also
+ // on graphics
+ sal_Bool SelectNxtPrvHyperlink( sal_Bool bNext = sal_True );
+
+ // springe zu dieser Refmark
+ sal_Bool GotoRefMark( const String& rRefMark, sal_uInt16 nSubType = 0,
+ sal_uInt16 nSeqNo = 0 );
+
+ // hole vom Start/Ende der akt. Selection das nte Zeichen
+ sal_Unicode GetChar( sal_Bool bEnd = sal_True, long nOffset = 0 );
+ // erweiter die akt. Selection am Anfang/Ende um n Zeichen
+ sal_Bool ExtendSelection( sal_Bool bEnd = sal_True, xub_StrLen nCount = 1 );
+ // setze nur den sichtbaren Cursor an die angegebene Dokument-Pos.
+ // returnt sal_False: wenn der ob der SPoint vom Layout korrigiert wurde.
+ // (wird zum Anzeigen von Drag&Drop/Copy-Cursor benoetigt)
+ sal_Bool SetVisCrsr( const Point &rPt );
+ inline void UnSetVisCrsr();
+
+ // springe zum nachsten/vorherigen Feld des entsprechenden Types
+ sal_Bool MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
+ sal_uInt16 nSubType = USHRT_MAX,
+ sal_uInt16 nResType = USHRT_MAX );
+ // springe genau zu diesem Feld
+ sal_Bool GotoFld( const SwFmtFld& rFld );
+
+ // returne die Anzahl der Cursor im Ring (Flag besagt ob man nur
+ // aufgepspannte haben will - sprich etwas selektiert ist (Basic))
+ sal_uInt16 GetCrsrCnt( sal_Bool bAll = sal_True ) const;
+
+ // Char Travelling - Methoden (in crstrvl1.cxx)
+ sal_Bool GoStartWord();
+ sal_Bool GoEndWord();
+ sal_Bool GoNextWord();
+ sal_Bool GoPrevWord();
+ sal_Bool GoNextSentence();
+ sal_Bool GoPrevSentence();
+ sal_Bool GoStartSentence();
+ sal_Bool GoEndSentence();
+ sal_Bool SelectWord( const Point* pPt = 0 );
+ sal_Bool ExpandToSentenceBorders();
+
+ // Position vom akt. Cursor erfragen
+ sal_Bool IsStartWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES )const;
+ sal_Bool IsEndWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const;
+ sal_Bool IsInWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const;
+ sal_Bool IsStartSentence() const;
+ sal_Bool IsEndSentence() const;
+ sal_Bool IsSttPara() const;
+ sal_Bool IsEndPara() const;
+ sal_Bool IsStartOfDoc() const;
+ sal_Bool IsEndOfDoc() const;
+ sal_Bool IsInFrontOfLabel() const;
+ sal_Bool IsAtLeftMargin() const { return IsAtLRMargin( sal_True ); }
+ sal_Bool IsAtRightMargin(sal_Bool bAPI = sal_False) const { return IsAtLRMargin( sal_False, bAPI ); }
+
+ // loesche alle erzeugten Crsr, setze den Tabellen-Crsr und den letzten
+ // Cursor auf seinen TextNode (oder StartNode?).
+ // Beim naechsten ::GetCrsr werden sie wieder alle erzeugt.
+ // Wird fuers Drag&Drop/ClipBorad-Paste in Tabellen benoetigt.
+ sal_Bool ParkTblCrsr();
+
+ // gibt es nicht aufgespannte Attribute?
+ sal_Bool IsGCAttr() const { return bGCAttr; }
+ void ClearGCAttr() { bGCAttr = sal_False; }
+ void UpdateAttr() { bGCAttr = sal_True; }
+
+ // ist das gesamte Dokument geschuetzt/versteckt?? (fuer UI,..)
+ sal_Bool IsAllProtect() const { return bAllProtect; }
+
+#ifdef SW_CRSR_TIMER
+ // setze das Flag am VisCrsr, ob dieser ueber Timer getriggert (sal_True)
+ // oder direkt (sal_False) angezeigt wird. (default ist Timer getriggert)
+ sal_Bool ChgCrsrTimerFlag( sal_Bool bTimerOn = sal_True );
+#endif
+
+ sal_Bool BasicActionPend() const { return nBasicActionCnt != nStartAction; }
+
+ // springe zum benannten Bereich
+ sal_Bool GotoRegion( const String& rName );
+
+ // zeige die aktuelle Selektion an
+ virtual void MakeSelVisible();
+
+ // setzte den Cursor auf einen NICHT geschuetzten/versteckten Node
+ sal_Bool FindValidCntntNode( sal_Bool bOnlyText = sal_False );
+
+ sal_Bool GetContentAtPos( const Point& rPt,
+ SwContentAtPos& rCntntAtPos,
+ sal_Bool bSetCrsr = sal_False,
+ SwRect* pFldRect = 0 );
+
+ // --> OD 2008-06-19 #i90516#
+ const SwPostItField* GetPostItFieldAtCursor() const;
+ // <--
+
+ // get smart tags at point position
+ void GetSmartTagTerm( const Point& rPt,
+ SwRect& rSelectRect,
+ ::com::sun::star::uno::Sequence< rtl::OUString >& rSmartTagTypes,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > >& rStringKeyMaps,
+ ::com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rRange );
+
+ // get smart tags at current cursor position
+ void GetSmartTagTerm( ::com::sun::star::uno::Sequence< rtl::OUString >& rSmartTagTypes,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > >& rStringKeyMaps,
+ ::com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rRange ) const;
+
+ sal_Bool IsPageAtPos( const Point &rPt ) const;
+
+ // Attribut selelktieren
+ sal_Bool SelectTxtAttr( sal_uInt16 nWhich, sal_Bool bExpand, const SwTxtAttr* pAttr = 0 );
+ sal_Bool GotoINetAttr( const SwTxtINetFmt& rAttr );
+ const SwFmtINetFmt* FindINetAttr( const String& rName ) const;
+
+ sal_Bool CheckTblBoxCntnt( const SwPosition* pPos = 0 );
+ void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
+ void ClearTblBoxCntnt();
+ sal_Bool EndAllTblBoxEdit();
+
+ // wird gerufen, wenn eine Tabellenselektion im UpdateCrsr erzeugt wird,
+ // ohne das die UI davon etaws weiss
+ virtual void NewCoreSelection();
+
+ void SetSelTblCells( sal_Bool bFlag ) { bSelTblCells = bFlag; }
+ sal_Bool IsSelTblCells() const { return bSelTblCells; }
+
+ sal_Bool IsAutoUpdateCells() const { return bAutoUpdateCells; }
+ void SetAutoUpdateCells( sal_Bool bFlag ) { bAutoUpdateCells = bFlag; }
+
+ sal_Bool GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode,
+ SwRect& rRect, short& rOrient );
+ sal_Bool SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode );
+
+ const SwRedline* SelNextRedline();
+ const SwRedline* SelPrevRedline();
+ const SwRedline* GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect = sal_False );
+
+ // is cursor or the point in/over a vertical formatted text?
+ sal_Bool IsInVerticalText( const Point* pPt = 0 ) const;
+ // is cursor or the point in/over a right to left formatted text?
+ sal_Bool IsInRightToLeftText( const Point* pPt = 0 ) const;
+
+ // If the current cursor position is inside a hidden range, the hidden range
+ // is selected and true is returned:
+ bool SelectHiddenRange();
+
+ // remove all invalid cursors
+ void ClearUpCrsrs();
+
+ // OD 11.02.2003 #100556# - set/get flag to allow/avoid execution of macros
+ inline void SetMacroExecAllowed( const bool _bMacroExecAllowed )
+ {
+ mbMacroExecAllowed = _bMacroExecAllowed;
+ }
+ inline bool IsMacroExecAllowed()
+ {
+ return mbMacroExecAllowed;
+ }
+
+ // #111827#
+ /**
+ Returns textual description of the current selection.
+
+ - If the current selection is a multi-selection the result is
+ STR_MULTISEL.
+ - Else the result is the text of the selection.
+
+ @return the textual description of the current selection
+ */
+ String GetCrsrDescr() const;
+
+ SwRect GetRectOfCurrentChar();
+};
+
+
+// Cursor Inlines:
+inline SwMoveFnCollection* SwCrsrShell::MakeFindRange(
+ sal_uInt16 nStt, sal_uInt16 nEnd, SwPaM* pPam ) const
+{
+ return pCurCrsr->MakeFindRange( (SwDocPositions)nStt, (SwDocPositions)nEnd, pPam );
+}
+
+inline SwCursor* SwCrsrShell::GetSwCrsr( sal_Bool bMakeTblCrsr ) const
+{
+ return (SwCursor*)GetCrsr( bMakeTblCrsr );
+}
+
+inline SwPaM* SwCrsrShell::GetStkCrsr() const { return pCrsrStk; }
+
+inline void SwCrsrShell::SetMark() { pCurCrsr->SetMark(); }
+
+inline sal_Bool SwCrsrShell::HasMark() { return( pCurCrsr->HasMark() ); }
+
+inline sal_Bool SwCrsrShell::IsSelection() const
+{
+ return IsTableMode() || pCurCrsr->HasMark() ||
+ pCurCrsr->GetNext() != pCurCrsr;
+}
+inline sal_Bool SwCrsrShell::IsMultiSelection() const
+{
+ return pCurCrsr->GetNext() != pCurCrsr;
+}
+
+inline sal_Bool SwCrsrShell::IsSelOnePara() const
+{
+ return pCurCrsr == pCurCrsr->GetNext() &&
+ pCurCrsr->GetPoint()->nNode == pCurCrsr->GetMark()->nNode;
+}
+
+inline const SwTableNode* SwCrsrShell::IsCrsrInTbl( sal_Bool bIsPtInTbl ) const
+{
+ return pCurCrsr->GetNode( bIsPtInTbl )->FindTableNode();
+}
+
+inline sal_Bool SwCrsrShell::IsCrsrPtAtEnd() const
+{
+ return pCurCrsr->End() == pCurCrsr->GetPoint();
+}
+
+inline Point& SwCrsrShell::GetCrsrDocPos( sal_Bool bPoint ) const
+{
+ return bPoint ? pCurCrsr->GetPtPos() : pCurCrsr->GetMkPos();
+}
+
+inline const SwPaM* SwCrsrShell::GetTblCrs() const
+{
+ return pTblCrsr;
+}
+
+inline SwPaM* SwCrsrShell::GetTblCrs()
+{
+ return pTblCrsr;
+}
+
+inline void SwCrsrShell::UnSetVisCrsr()
+{
+ pVisCrsr->Hide();
+ pVisCrsr->SetDragCrsr( sal_False );
+}
+
+#endif // _CRSRSH_HXX
diff --git a/sw/inc/crsskip.hxx b/sw/inc/crsskip.hxx
new file mode 100644
index 000000000000..c89d871c9940
--- /dev/null
+++ b/sw/inc/crsskip.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CRSSKIP_HXX
+#define _CRSSKIP_HXX
+
+#include <tools/solar.h>
+
+
+// define for cursor travelling normally in western text cells and chars do
+// the same, but in complex text cell skip over legatures and char skip
+// into it.
+// These defines exist only to cut off the dependicies to I18N project.
+const sal_uInt16 CRSR_SKIP_CHARS = 0;
+const sal_uInt16 CRSR_SKIP_CELLS = 1;
+const sal_uInt16 CRSR_SKIP_HIDDEN = 2;
+
+#endif
diff --git a/sw/inc/crstate.hxx b/sw/inc/crstate.hxx
new file mode 100644
index 000000000000..cf2e55118ab7
--- /dev/null
+++ b/sw/inc/crstate.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CRSTATE_HXX
+#define _CRSTATE_HXX
+
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <tools/gen.hxx>
+#include <swtypes.hxx>
+#include <swrect.hxx>
+
+
+enum SwFillMode
+{
+ FILL_TAB, // default, Auffuellen mit Tabulatoren
+ FILL_SPACE, // ... mit Tabulatoren und Spaces
+ FILL_MARGIN, // nur links, zentriert, rechts Ausrichten
+ FILL_INDENT // durch linken Absatzeinzug
+};
+
+struct SwFillCrsrPos
+{
+ SwRect aCrsr; // Position und Groesse des Shadowcursors
+ sal_uInt16 nParaCnt; // Anzahl der einzufuegenden Absaetze
+ sal_uInt16 nTabCnt; // Anzahl der Tabs bzw. Groesse des Einzugs
+ sal_uInt16 nSpaceCnt; // Anzahl der einzufuegenden Leerzeichen
+ sal_uInt16 nColumnCnt; // Anzahl der notwendigen Spaltenumbrueche
+ sal_Int16 eOrient; // Absatzausrichtung
+ SwFillMode eMode; // Gewuenschte Auffuellregel
+ SwFillCrsrPos( SwFillMode eMd = FILL_TAB ) :
+ nParaCnt( 0 ), nTabCnt( 0 ), nSpaceCnt( 0 ), nColumnCnt( 0 ),
+ eOrient( com::sun::star::text::HoriOrientation::NONE ), eMode( eMd )
+ {}
+};
+
+// Multiportion types: two lines, bidirectional, 270 degrees rotation,
+// ruby portion and 90 degrees rotation
+#define MT_TWOLINE 0
+#define MT_BIDI 1
+#define MT_ROT_270 3
+#define MT_RUBY 4
+#define MT_ROT_90 7
+
+struct Sw2LinesPos
+{
+ SwRect aLine; // Position and size of the line
+ SwRect aPortion; // Position and size of the multi portion
+ SwRect aPortion2; // needed for nested multi portions
+ sal_uInt8 nMultiType; // Multiportion type
+};
+
+/**
+ * SwSpecialPos. This structure is used to pass some additional information
+ * during the call of SwTxtFrm::GetCharRect(). An SwSpecialPos defines a position
+ * inside a portion which does not have a representation in the core string or
+ * which is only represented by one position, e.g., field portions,
+ * number portions, ergo sum and quo vadis portions.
+ *
+ * nCharOfst - The offset inside the special portion. Fields and its
+ * follow fields are treated as one long special portion.
+ * nLineOfst - The number of lines between the beginning of the special
+ * portion and nCharOfst. A line offset required to be
+ * nCharOfst relative to the beginning of the line.
+ * nExtendRange - Setting this identifies portions which are in front or
+ * behind the core string (number portion, quo vadis)
+ *
+ * Examples 1)
+ *
+ * Get the position of the second character inside a number portion:
+ * nCharOfst = 2; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_BEFORE;
+ * Call SwTxtFrm:::GetCharRect with core string position 0.
+ *
+ * Example 2)
+ *
+ * Field A - Length = 5
+ * Follow field B - Length = 9
+ * Get the position of the third character in follow field B, core position
+ * of field A is 33.
+ * nCharOfst = 7; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_NONE;
+ * Call SwTxtFrm:::GetCharRect with core string position 33.
+ */
+
+#define SP_EXTEND_RANGE_NONE 0
+#define SP_EXTEND_RANGE_BEFORE 1
+#define SP_EXTEND_RANGE_BEHIND 2
+
+struct SwSpecialPos
+{
+ xub_StrLen nCharOfst;
+ sal_uInt16 nLineOfst;
+ sal_uInt8 nExtendRange;
+
+ // #i27615#
+ SwSpecialPos() : nCharOfst(0), nLineOfst(0),
+ nExtendRange(SP_EXTEND_RANGE_NONE)
+ {}
+};
+
+// CrsrTravelling-Staties (fuer GetCrsrOfst)
+enum CrsrMoveState
+{
+ MV_NONE, // default
+ MV_UPDOWN, // Crsr Up/Down
+ MV_RIGHTMARGIN, // an rechten Rand
+ MV_LEFTMARGIN, // an linken Rand
+ MV_SETONLYTEXT, // mit dem Cursr nur im Text bleiben
+ MV_TBLSEL // nicht in wiederholte Headlines
+};
+
+// struct fuer spaetere Erweiterungen
+struct SwCrsrMoveState
+{
+ SwFillCrsrPos *pFill; // fuer das automatische Auffuellen mit Tabs etc.
+ Sw2LinesPos *p2Lines; // for selections inside/around 2line portions
+ SwSpecialPos* pSpecialPos; // for positions inside fields
+ Point aRealHeight; // enthaelt dann die Position/Hoehe des Cursors
+ CrsrMoveState eState;
+ sal_uInt8 nCursorBidiLevel;
+ sal_Bool bStop :1;
+ sal_Bool bRealHeight :1; // Soll die reale Hoehe berechnet werden?
+ sal_Bool bFieldInfo :1; // Sollen Felder erkannt werden?
+ sal_Bool bPosCorr :1; // Point musste korrigiert werden
+ sal_Bool bFtnNoInfo :1; // Fussnotennumerierung erkannt
+ sal_Bool bExactOnly :1; // GetCrsrOfst nur nach Exakten Treffern
+ // suchen lassen, sprich niemals in das
+ // GetCntntPos laufen.
+ sal_Bool bFillRet :1; // wird nur im FillModus temp. genutzt
+ sal_Bool bSetInReadOnly :1; // ReadOnlyBereiche duerfen betreten werden
+ sal_Bool bRealWidth :1; // Calculation of the width required
+ sal_Bool b2Lines :1; // Check 2line portions and fill p2Lines
+ sal_Bool bNoScroll :1; // No scrolling of undersized textframes
+ sal_Bool bPosMatchesBounds :1; // GetCrsrOfst should not return the next
+ // position if screen position is inside second
+ // have of bound rect
+
+ sal_Bool bCntntCheck :1; // --> FME 2005-05-13 #i43742# Cursor position over content? <--
+
+ // #i27615#
+ /**
+ cursor in front of label
+ */
+ sal_Bool bInFrontOfLabel :1;
+ sal_Bool bInNumPortion :1; // point is in number portion #i23726#
+ int nInNumPostionOffset; // distance from number portion's start
+
+ SwCrsrMoveState( CrsrMoveState eSt = MV_NONE ) :
+ pFill( NULL ),
+ p2Lines( NULL ),
+ pSpecialPos( NULL ),
+ eState( eSt ),
+ nCursorBidiLevel( 0 ),
+ bStop( sal_False ),
+ bRealHeight( sal_False ),
+ bFieldInfo( sal_False ),
+ bPosCorr( sal_False ),
+ bFtnNoInfo( sal_False ),
+ bExactOnly( sal_False ),
+ bSetInReadOnly( sal_False ),
+ bRealWidth( sal_False ),
+ b2Lines( sal_False ),
+ bNoScroll( sal_False ),
+ bPosMatchesBounds( sal_False ),
+ bCntntCheck( sal_False ), // --> FME 2005-05-13 #i43742# <--
+ bInFrontOfLabel( sal_False ), // #i27615#
+ bInNumPortion(sal_False), // #i26726#
+ nInNumPostionOffset(0) // #i26726#
+ {}
+ SwCrsrMoveState( SwFillCrsrPos *pInitFill ) :
+ pFill( pInitFill ),
+ pSpecialPos( NULL ),
+ eState( MV_SETONLYTEXT ),
+ nCursorBidiLevel( 0 ),
+ bStop( sal_False ),
+ bRealHeight( sal_False ),
+ bFieldInfo( sal_False ),
+ bPosCorr( sal_False ),
+ bFtnNoInfo( sal_False ),
+ bExactOnly( sal_False ),
+ bSetInReadOnly( sal_False ),
+ bRealWidth( sal_False ),
+ b2Lines( sal_False ),
+ bNoScroll( sal_False ),
+ bPosMatchesBounds( sal_False ),
+ bCntntCheck( sal_False ), // --> FME 2005-05-13 #i43742# <--
+ bInFrontOfLabel( sal_False ), // #i27615#
+ bInNumPortion(sal_False), // #i23726#
+ nInNumPostionOffset(0) // #i23726#
+ {}
+};
+
+
+#endif
+
+
diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx
new file mode 100644
index 000000000000..b015337b4085
--- /dev/null
+++ b/sw/inc/cshtyp.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CSHTYP_HXX
+#define _CSHTYP_HXX
+
+#include <tools/solar.h>
+#include "swdllapi.h"
+
+class SwPaM;
+class SwCntntFrm;
+class SwLayoutFrm;
+
+// eine Struktur fuer den SwPaM. In dieser stehen die Methoden-Pointer
+// fuer das richtungsabhaengige Bewegen des Cursors.
+struct SwMoveFnCollection;
+typedef SwMoveFnCollection* SwMoveFn;
+
+
+// Type-Definition fuer die CrsrShell
+// Richtungsparameter fuer MovePage ( wird in SwCntntFrm initialisiert )
+typedef SwLayoutFrm * (*SwWhichPage)( const SwLayoutFrm * );
+typedef SwCntntFrm * (*SwPosPage)( const SwLayoutFrm * );
+extern SwWhichPage fnPagePrev, fnPageCurr, fnPageNext;
+extern SwPosPage fnPageStart, fnPageEnd;
+
+// Richtungsparameter fuer MovePara ( wird in SwPaM initialisiert )
+typedef SwMoveFnCollection* SwPosPara;
+typedef sal_Bool (*SwWhichPara)( SwPaM&, SwPosPara );
+extern SwWhichPara fnParaPrev, fnParaCurr, fnParaNext;
+extern SwPosPara fnParaStart, fnParaEnd;
+
+// Richtungsparameter fuer MoveSection
+typedef SwMoveFnCollection* SwPosSection;
+typedef sal_Bool (*SwWhichSection)( SwPaM&, SwPosSection );
+extern SwWhichSection fnSectionPrev, fnSectionCurr, fnSectionNext;
+extern SwPosSection fnSectionStart, fnSectionEnd;
+
+// Richtungsparameter fuer MoveTable
+typedef SwMoveFnCollection* SwPosTable;
+typedef sal_Bool (*SwWhichTable)( SwPaM&, SwPosTable, sal_Bool bInReadOnly );
+extern SwWhichTable fnTablePrev, fnTableCurr, fnTableNext;
+extern SwPosTable fnTableStart, fnTableEnd;
+
+// Richtungsparameter fuer MoveColumn
+typedef SwLayoutFrm * (*SwWhichColumn)( const SwLayoutFrm * );
+typedef SwCntntFrm * (*SwPosColumn)( const SwLayoutFrm * );
+extern SwWhichColumn fnColumnPrev, fnColumnCurr, fnColumnNext;
+extern SwPosColumn fnColumnStart, fnColumnEnd;
+
+// Richtungsparameter fuer MoveRegion (Bereiche!)
+typedef SwMoveFnCollection* SwPosRegion;
+typedef sal_Bool (*SwWhichRegion)( SwPaM&, SwPosRegion, sal_Bool bInReadOnly );
+extern SwWhichRegion fnRegionPrev, fnRegionCurr, fnRegionNext, fnRegionCurrAndSkip;
+extern SwPosRegion fnRegionStart, fnRegionEnd;
+
+
+
+/*
+ * folgende Kombinationen sind erlaubt:
+ * - suche einen im Body: -> FND_IN_BODY
+ * - suche alle im Body: -> FND_IN_BODYONLY | FND_IN_SELALL
+ * - suche in Selectionen: einen / alle -> FND_IN_SEL [ | FND_IN_SELALL ]
+ * - suche im nicht Body: einen / alle -> FND_IN_OTHER [ | FND_IN_SELALL ]
+ * - suche ueberall alle: -> FND_IN_SELALL
+ */
+enum FindRanges
+{
+ FND_IN_BODY = 0x00, // suche "eins" mur im Body-Text
+ FND_IN_OTHER = 0x02, // suche "alles" in Footer/Header/Fly...
+ FND_IN_SEL = 0x04, // suche in Selectionen
+ FND_IN_BODYONLY = 0x08, // suche nur im Body - nur in Verbindung mit
+ // FND_IN_SELALL !!!
+ FND_IN_SELALL = 0x01 // - alle ( nur im nicht Body und Selectionen)
+};
+
+
+enum SwDocPositions
+{
+ DOCPOS_START,
+ DOCPOS_CURR,
+ DOCPOS_END,
+ DOCPOS_OTHERSTART,
+ DOCPOS_OTHEREND
+};
+
+SW_DLLPUBLIC SwWhichPara GetfnParaCurr();
+SW_DLLPUBLIC SwPosPara GetfnParaStart();
+SW_DLLPUBLIC SwPosPara GetfnParaEnd();
+
+SW_DLLPUBLIC SwWhichTable GetfnTablePrev();
+SW_DLLPUBLIC SwWhichTable GetfnTableCurr();
+SW_DLLPUBLIC SwPosTable GetfnTableStart();
+SW_DLLPUBLIC SwPosTable GetfnTableEnd();
+
+#endif // _CSHTYP_HXX
diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx
new file mode 100644
index 000000000000..135553da1b64
--- /dev/null
+++ b/sw/inc/dbfld.hxx
@@ -0,0 +1,338 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_DBFLD_HXX
+#define SW_DBFLD_HXX
+
+#include "swdllapi.h"
+#include "fldbas.hxx"
+#include "swdbdata.hxx"
+
+class SwDoc;
+class SwTxtFld;
+class SwFrm;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbankfeld
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDBFieldType : public SwValueFieldType
+{
+ SwDBData aDBData; //
+ String sName; // only used in ::GetName() !
+ String sColumn;
+ long nRefCnt;
+
+public:
+
+ SwDBFieldType(SwDoc* pDocPtr, const String& rColumnName, const SwDBData& rDBData);
+ ~SwDBFieldType();
+
+ virtual const String& GetName() const;
+ virtual SwFieldType* Copy() const;
+
+ inline void AddRef() { nRefCnt++; }
+ void ReleaseRef();
+
+ const String& GetColumnName() const {return sColumn;}
+ const SwDBData& GetDBData() const {return aDBData;}
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ von SwFields abgeleitete Klassen. Sie ueberlagern die Expand-Funktion.
+ Der Inhalt wird entsprechend dem Format, soweit vorhanden, formatiert.
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDBField : public SwValueField
+{
+ String aContent;
+ String sFieldCode; // contains Word's field code
+ sal_uInt16 nSubType;
+ sal_Bool bIsInBodyTxt : 1;
+ sal_Bool bValidValue : 1;
+ sal_Bool bInitialized : 1;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ SwDBField(SwDBFieldType*, sal_uLong nFmt = 0);
+ virtual ~SwDBField();
+
+ virtual SwFieldType* ChgTyp( SwFieldType* );
+
+ // Der aktuelle Text
+ inline void SetExpansion(const String& rStr);
+
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16 nType);
+
+ virtual String GetFieldName() const;
+
+ // fuer Berechnungen in Ausdruecken
+ void ChgValue( double d, sal_Bool bVal );
+
+ // Evaluierung ueber den DBMgr String rauspulen
+ void Evaluate();
+
+ // Evaluierung fuer Kopf und Fusszeilen
+ void ChangeExpansion( const SwFrm*, const SwTxtFld* );
+ void InitContent();
+ void InitContent(const String& rExpansion);
+
+ inline void ChgBodyTxtFlag( sal_Bool bIsInBody );
+
+ inline sal_Bool IsInitialized() const { return bInitialized; }
+ inline void ClearInitialized() { bInitialized = sal_False; }
+ inline void SetInitialized() { bInitialized = sal_True; }
+
+ // Name erfragen
+ virtual const String& GetPar1() const;
+
+ // access to the command string
+ const String& GetFieldCode() const
+ { return sFieldCode;}
+ void SetFieldCode(const String& rStr)
+ { sFieldCode = rStr; }
+
+ // DBName
+ inline const SwDBData& GetDBData() const { return ((SwDBFieldType*)GetTyp())->GetDBData(); }
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+inline void SwDBField::SetExpansion(const String& rStr)
+ { aContent = rStr; }
+
+// wird von UpdateExpFlds gesetzt (dort ist die Node-Position bekannt)
+inline void SwDBField::ChgBodyTxtFlag( sal_Bool bIsInBody )
+ { bIsInBodyTxt = bIsInBody; }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Basisklasse fuer alle weiteren Datenbankfelder
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDBNameInfField : public SwField
+{
+ SwDBData aDBData;
+ sal_uInt16 nSubType;
+
+protected:
+ const SwDBData& GetDBData() const {return aDBData;}
+ SwDBData& GetDBData() {return aDBData;}
+
+ SwDBNameInfField(SwFieldType* pTyp, const SwDBData& rDBData, sal_uLong nFmt = 0);
+
+public:
+ // DBName
+ inline const SwDBData& GetRealDBData() { return aDBData; }
+
+ SwDBData GetDBData(SwDoc* pDoc);
+ void SetDBData(const SwDBData& rDBData); // #111840#
+
+ virtual String GetFieldName() const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16 nType);
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbankfeld Naechster Satz
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDBNextSetFieldType : public SwFieldType
+{
+public:
+ SwDBNextSetFieldType();
+
+ virtual SwFieldType* Copy() const;
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Naechsten Datensatz mit Bedingung
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDBNextSetField : public SwDBNameInfField
+{
+ String aCond;
+ sal_Bool bCondValid;
+
+public:
+ SwDBNextSetField( SwDBNextSetFieldType*,
+ const String& rCond, const String& rDummy, const SwDBData& rDBData);
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ void Evaluate(SwDoc*);
+ inline void SetCondValid(sal_Bool bCond);
+ inline sal_Bool IsCondValid() const;
+
+ // Condition
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+inline sal_Bool SwDBNextSetField::IsCondValid() const
+ { return bCondValid; }
+
+inline void SwDBNextSetField::SetCondValid(sal_Bool bCond)
+ { bCondValid = bCond; }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbankfeld Naechster Satz
+ --------------------------------------------------------------------*/
+
+class SwDBNumSetFieldType : public SwFieldType
+{
+public:
+ SwDBNumSetFieldType();
+
+ virtual SwFieldType* Copy() const;
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datensatz mit Nummer xxx
+ Die Nummer steht in nFormat
+ ! kleiner Missbrauch
+ --------------------------------------------------------------------*/
+
+class SwDBNumSetField : public SwDBNameInfField
+{
+ String aCond;
+ String aPar2;
+ sal_Bool bCondValid;
+
+public:
+ SwDBNumSetField(SwDBNumSetFieldType*, const String& rCond, const String& rDBNum, const SwDBData& rDBData);
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ inline sal_Bool IsCondValid() const;
+ inline void SetCondValid(sal_Bool bCond);
+ void Evaluate(SwDoc*);
+
+ // Condition
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+
+ // Datensatznummer
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+
+ // Die Datensatznummer steht in nFormat !!
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+inline sal_Bool SwDBNumSetField::IsCondValid() const
+ { return bCondValid; }
+
+inline void SwDBNumSetField::SetCondValid(sal_Bool bCond)
+ { bCondValid = bCond; }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbankname
+ --------------------------------------------------------------------*/
+
+class SwDBNameFieldType : public SwFieldType
+{
+ SwDoc *pDoc;
+public:
+ SwDBNameFieldType(SwDoc*);
+
+ String Expand(sal_uLong) const;
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbankfeld
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDBNameField : public SwDBNameInfField
+{
+public:
+ SwDBNameField(SwDBNameFieldType*, const SwDBData& rDBData, sal_uLong nFmt = 0);
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datensatznummer
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDBSetNumberFieldType : public SwFieldType
+{
+public:
+ SwDBSetNumberFieldType();
+
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbankfeld
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDBSetNumberField : public SwDBNameInfField
+{
+ long nNumber;
+
+public:
+ SwDBSetNumberField(SwDBSetNumberFieldType*, const SwDBData& rDBData, sal_uLong nFmt = 0);
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+ void Evaluate(SwDoc*);
+
+ inline long GetSetNumber() const;
+ inline void SetSetNumber(long nNum);
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+inline long SwDBSetNumberField::GetSetNumber() const
+ { return nNumber; }
+
+inline void SwDBSetNumberField::SetSetNumber(long nNum)
+ { nNumber = nNum; }
+
+
+#endif // SW_DBFLD_HXX
diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx
new file mode 100644
index 000000000000..1a33f41f69d3
--- /dev/null
+++ b/sw/inc/dbgoutsw.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 __DBGOUTSW_HXX
+#define __DBGOUTSW_HXX
+
+#ifdef DEBUG
+
+#include <hash_map>
+#include <tox.hxx>
+class String;
+
+namespace rtl
+{
+class OUString;
+}
+class SwNode;
+class SwTxtAttr;
+class SwpHints;
+class SfxPoolItem;
+class SfxItemSet;
+struct SwPosition;
+class SwPaM;
+class SwNodeNum;
+class SwUndo;
+class SwRect;
+class SwFrmFmt;
+class SwFrmFmts;
+class SwNodes;
+class SwRewriter;
+class SwNumRuleTbl;
+class SwNumRule;
+class SwOutlineNodes;
+class SwTxtFmtColl;
+class SwNodeRange;
+
+#define DBG_OUT_HERE printf("%s(%d):", __FILE__, __LINE__)
+#define DBG_OUT_HERE_FN printf("%s(%d) %s:", __FILE__, __LINE__, __FUNCTION__)
+#define DBG_OUT_HERE_LN printf("%s(%d)\n", __FILE__, __LINE__)
+#define DBG_OUT_HERE_FN_LN printf("%s(%d) %s\n", __FILE__, __LINE__, __FUNCTION__)
+#define DBG_OUT(x) printf("%s\n", dbg_out(x))
+#define DBG_OUT_LN(x) printf("%s(%d): %s\n", __FILE__, __LINE__, dbg_out(x))
+#define DBG_OUT_FN_LN(x) printf("%s: %s\n", __FUNCTION__, dbg_out(x))
+
+extern bool bDbgOutStdErr;
+extern bool bDbgOutPrintAttrSet;
+
+SW_DLLPUBLIC const char * dbg_out(const void * pVoid);
+SW_DLLPUBLIC const char * dbg_out(const String & aStr);
+SW_DLLPUBLIC const char * dbg_out(const ::rtl::OUString & aStr);
+SW_DLLPUBLIC const char * dbg_out(const SwRect & rRect);
+SW_DLLPUBLIC const char * dbg_out(const SwFrmFmt & rFrmFmt);
+SW_DLLPUBLIC const char * dbg_out(const SwNode & rNode);
+SW_DLLPUBLIC const char * dbg_out(const SwTxtAttr & rAttr);
+SW_DLLPUBLIC const char * dbg_out(const SwpHints &rHints);
+SW_DLLPUBLIC const char * dbg_out(const SfxPoolItem & rItem);
+SW_DLLPUBLIC const char * dbg_out(const SfxPoolItem * pItem);
+SW_DLLPUBLIC const char * dbg_out(const SfxItemSet & rSet);
+SW_DLLPUBLIC const char * dbg_out(SwNodes & rNodes);
+// const char * dbg_out(SwOutlineNodes & rNodes);
+SW_DLLPUBLIC const char * dbg_out(const SwPosition & rPos);
+SW_DLLPUBLIC const char * dbg_out(const SwPaM & rPam);
+SW_DLLPUBLIC const char * dbg_out(const SwNodeNum & rNum);
+SW_DLLPUBLIC const char * dbg_out(const SwUndo & rUndo);
+SW_DLLPUBLIC const char * dbg_out(const SwRewriter & rRewriter);
+SW_DLLPUBLIC const char * dbg_out(const SwNumRule & rRule);
+SW_DLLPUBLIC const char * dbg_out(const SwTxtFmtColl & rFmt);
+SW_DLLPUBLIC const char * dbg_out(const SwFrmFmts & rFrmFmts);
+SW_DLLPUBLIC const char * dbg_out(const SwNumRuleTbl & rTbl);
+SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange);
+
+template<typename tKey, typename tMember, typename fHashFunction>
+String lcl_dbg_out(const std::hash_map<tKey, tMember, fHashFunction> & rMap)
+{
+ String aResult("[", RTL_TEXTENCODING_ASCII_US);
+
+ typename std::hash_map<tKey, tMember, fHashFunction>::const_iterator aIt;
+
+ for (aIt = rMap.begin(); aIt != rMap.end(); aIt++)
+ {
+ if (aIt != rMap.begin())
+ aResult += String(", ", RTL_TEXTENCODING_ASCII_US);
+
+ aResult += aIt->first;
+
+ char sBuffer[256];
+ sprintf(sBuffer, "(%p)", aIt->second);
+ aResult += String(sBuffer, RTL_TEXTENCODING_ASCII_US);
+ }
+
+ aResult += String("]", RTL_TEXTENCODING_ASCII_US);
+
+ return aResult;
+}
+
+template<typename tKey, typename tMember, typename fHashFunction>
+const char * dbg_out(const std::hash_map<tKey, tMember, fHashFunction> & rMap)
+{
+ return dbg_out(lcl_dbg_out(rMap));
+}
+SW_DLLPUBLIC const char * dbg_out(const SwFormToken & rToken);
+SW_DLLPUBLIC const char * dbg_out(const SwFormTokens & rTokens);
+#endif // DEBUG
+#endif // __DBGOUTSW_HXX
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
new file mode 100644
index 000000000000..bc017ddbec5b
--- /dev/null
+++ b/sw/inc/dbmgr.hxx
@@ -0,0 +1,398 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWDBMGR_HXX
+#define _SWDBMGR_HXX
+
+
+#include <tools/string.hxx>
+#include <tools/link.hxx>
+#include <svl/svarray.hxx>
+#include <com/sun/star/util/Date.hpp>
+#include "swdllapi.h"
+#include <swdbdata.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+namespace com{namespace sun{namespace star{
+ namespace sdbc{
+ class XConnection;
+ class XStatement;
+ class XDataSource;
+ class XResultSet;
+ }
+ namespace beans{
+
+ class XPropertySet;
+ struct PropertyValue;
+ }
+ namespace sdbcx{
+ class XColumnsSupplier;
+ }
+ namespace util{
+ class XNumberFormatter;
+ }
+ namespace mail{
+ class XSmtpService;
+ }
+}}}
+namespace svx {
+ class ODataAccessDescriptor;
+}
+
+struct SwDBFormatData
+{
+ com::sun::star::util::Date aNullDate;
+ com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatter> xFormatter;
+ com::sun::star::lang::Locale aLocale;
+};
+
+class SwView;
+class SwWrtShell;
+class SfxProgress;
+class ListBox;
+class Button;
+class SvNumberFormatter;
+class SwDbtoolsClient;
+class SwXMailMerge;
+class SwMailMergeConfigItem;
+
+// -----------------------------------------------------------------------
+
+enum DBMgrOptions
+{
+ DBMGR_MERGE, // Datensaetze in Felder
+ DBMGR_INSERT, // Datensaetze in Text
+ DBMGR_MERGE_MAILMERGE, // Serienbriefe drucken
+ DBMGR_MERGE_MAILING, // Serienbriefe als email versenden
+ DBMGR_MERGE_MAILFILES, // Serienbriefe als Datei(en) speichern
+ DBMGR_MERGE_DOCUMENTS, // Print merged documents
+ DBMGR_MERGE_SINGLE_FILE // save merge as single file
+};
+
+// -----------------------------------------------------------------------
+
+/*--------------------------------------------------------------------
+ Beschreibung: (neue) Logische Datenbanken verwalten
+ --------------------------------------------------------------------*/
+#define SW_DB_SELECT_UNKNOWN 0
+#define SW_DB_SELECT_TABLE 1
+#define SW_DB_SELECT_QUERY 2
+
+struct SwDSParam : public SwDBData
+{
+ com::sun::star::util::Date aNullDate;
+
+ ::com::sun::star::uno::Reference<com::sun::star::util::XNumberFormatter> xFormatter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement> xStatement;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> xResultSet;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSelection;
+ sal_Bool bScrollable;
+ sal_Bool bEndOfDB;
+ sal_Bool bAfterSelection;
+ long nSelectionIndex;
+
+ SwDSParam(const SwDBData& rData) :
+ SwDBData(rData),
+ bScrollable(sal_False),
+ bEndOfDB(sal_False),
+ bAfterSelection(sal_False),
+ nSelectionIndex(0)
+ {}
+
+ SwDSParam(const SwDBData& rData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& xResSet,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection) :
+ SwDBData(rData),
+ xResultSet(xResSet),
+ aSelection(rSelection),
+ bScrollable(sal_True),
+ bEndOfDB(sal_False),
+ bAfterSelection(sal_False),
+ nSelectionIndex(0)
+ {}
+
+ void CheckEndOfDB()
+ {
+ if(bEndOfDB)
+ bAfterSelection = sal_True;
+ }
+};
+typedef SwDSParam* SwDSParamPtr;
+SV_DECL_PTRARR_DEL(SwDSParamArr, SwDSParamPtr, 0, 5)
+
+struct SwMergeDescriptor
+{
+ sal_uInt16 nMergeType;
+ SwWrtShell& rSh;
+ const ::svx::ODataAccessDescriptor& rDescriptor;
+ String sSaveToFilter; //export filter to save resulting files
+ String sSaveToFilterOptions; //
+ com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSaveToFilterData;
+
+ String sSubject;
+ String sAddressFromColumn;
+ String sMailBody;
+ String sAttachmentName;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aCopiesTo;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aBlindCopiesTo;
+
+ ::com::sun::star::uno::Reference< com::sun::star::mail::XSmtpService > xSmtpServer;
+
+ sal_Bool bSendAsHTML;
+ sal_Bool bSendAsAttachment;
+
+ sal_Bool bPrintAsync;
+ sal_Bool bCreateSingleFile;
+
+ SwMailMergeConfigItem* pMailMergeConfigItem;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aPrintOptions;
+
+ SwMergeDescriptor( sal_uInt16 nType, SwWrtShell& rShell, ::svx::ODataAccessDescriptor& rDesc ) :
+ nMergeType(nType),
+ rSh(rShell),
+ rDescriptor(rDesc),
+ bSendAsHTML( sal_True ),
+ bSendAsAttachment( sal_False ),
+ bPrintAsync( sal_False ),
+ bCreateSingleFile( sal_False ),
+ pMailMergeConfigItem(0)
+ {}
+
+};
+
+struct SwNewDBMgr_Impl;
+class SwConnectionDisposedListener_Impl;
+class AbstractMailMergeDlg;
+
+class SW_DLLPUBLIC SwNewDBMgr
+{
+friend class SwConnectionDisposedListener_Impl;
+
+ static SwDbtoolsClient* pDbtoolsClient;
+
+ String sEMailAddrFld; // Mailing: Spaltenname der E-Mail Adresse
+ String sSubject; // Mailing: Subject
+ String sAttached; // Mailing: Attachte Files
+ sal_uInt16 nMergeType;
+ sal_Bool bInitDBFields : 1; // sal_True: Datenbank an Feldern beim Mergen
+ sal_Bool bSingleJobs : 1; // Einzelne Druckjobs bei Aufruf aus Basic
+ sal_Bool bCancel : 1; // Serienbrief-Save abgebrochen
+
+ sal_Bool bInMerge : 1; //merge process active
+ sal_Bool bMergeSilent : 1; // suppress display of dialogs/boxes (used when called over API)
+ sal_Bool bMergeLock : 1; // prevent update of database fields while document is
+ // actually printed at the ViewShell
+ SwDSParamArr aDataSourceParams;
+ SwNewDBMgr_Impl* pImpl;
+ const SwXMailMerge* pMergeEvtSrc; // != 0 if mail merge events are to be send
+
+ SW_DLLPRIVATE SwDSParam* FindDSData(const SwDBData& rData, sal_Bool bCreate);
+ SW_DLLPRIVATE SwDSParam* FindDSConnection(const ::rtl::OUString& rSource, sal_Bool bCreate);
+
+
+ SW_DLLPRIVATE DECL_LINK( PrtCancelHdl, Button * );
+
+ // Datensaetze als Text ins Dokument einfuegen
+ SW_DLLPRIVATE void ImportFromConnection( SwWrtShell* pSh);
+
+ // Einzelnen Datensatz als Text ins Dokument einfuegen
+ SW_DLLPRIVATE void ImportDBEntry(SwWrtShell* pSh);
+
+ // merge to file _and_ merge to e-Mail
+ SW_DLLPRIVATE sal_Bool MergeMailFiles(SwWrtShell* pSh,
+ const SwMergeDescriptor& rMergeDescriptor );
+ SW_DLLPRIVATE sal_Bool ToNextRecord(SwDSParam* pParam);
+
+public:
+ SwNewDBMgr();
+ ~SwNewDBMgr();
+
+ // Art des aktellen Mergens. Siehe DBMgrOptions-enum
+ inline sal_uInt16 GetMergeType() const { return nMergeType; }
+ inline void SetMergeType( sal_uInt16 nTyp ) { nMergeType = nTyp; }
+
+ // MailMergeEvent source
+ const SwXMailMerge * GetMailMergeEvtSrc() const { return pMergeEvtSrc; }
+ void SetMailMergeEvtSrc( const SwXMailMerge *pSrc ) { pMergeEvtSrc = pSrc; }
+
+ inline sal_Bool IsMergeSilent() const { return bMergeSilent != 0; }
+ inline void SetMergeSilent( sal_Bool bVal ) { bMergeSilent = bVal; }
+
+ // Mischen von Datensaetzen in Felder
+ sal_Bool MergeNew( const SwMergeDescriptor& rMergeDesc );
+ sal_Bool Merge(SwWrtShell* pSh);
+
+ // Datenbankfelder mit fehlendem Datenbankname initialisieren
+ inline sal_Bool IsInitDBFields() const { return bInitDBFields; }
+ inline void SetInitDBFields(sal_Bool b) { bInitDBFields = b; }
+
+ // Serienbriefe einzelnd oder alle zusammen drucken/speichern
+ inline sal_Bool IsSingleJobs() const { return bSingleJobs; }
+ inline void SetSingleJobs(sal_Bool b) { bSingleJobs = b; }
+
+ // Mailing
+ // email-Daten setzen
+ inline void SetEMailColumn(const String& sColName) { sEMailAddrFld = sColName; }
+ inline void SetSubject(const String& sSbj) { sSubject = sSbj; }
+ inline void SetAttachment(const String& sAtt) { sAttached = sAtt; }
+
+
+ // Listbox mit allen Tabellennamen einer Datenbank fuellen
+ sal_Bool GetTableNames(ListBox* pListBox, const String& rDBName );
+
+ // Listbox mit allen Spaltennamen einer Datenbanktabelle fuellen
+ sal_Bool GetColumnNames(ListBox* pListBox,
+ const String& rDBName, const String& rTableName, sal_Bool bAppend = sal_False);
+ sal_Bool GetColumnNames(ListBox* pListBox,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
+ const String& rTableName, sal_Bool bAppend = sal_False);
+
+ sal_uLong GetColumnFmt( ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> xSource,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xColumn,
+ SvNumberFormatter* pNFmtr,
+ long nLanguage );
+
+ sal_uLong GetColumnFmt( const String& rDBName,
+ const String& rTableName,
+ const String& rColNm,
+ SvNumberFormatter* pNFmtr,
+ long nLanguage );
+ sal_Int32 GetColumnType( const String& rDBName,
+ const String& rTableName,
+ const String& rColNm );
+
+ inline sal_Bool IsInMerge() const { return bInMerge; }
+ void EndMerge();
+
+ void ExecuteFormLetter(SwWrtShell& rSh,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rProperties,
+ sal_Bool bWithDataSourceBrowser = sal_False);
+
+ void InsertText(SwWrtShell& rSh,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rProperties);
+
+ // check if a data source is open
+ sal_Bool IsDataSourceOpen(const String& rDataSource,
+ const String& rTableOrQuery, sal_Bool bMergeOnly);
+
+ // open the source while fields are updated - for the calculator only!
+ sal_Bool OpenDataSource(const String& rDataSource, const String& rTableOrQuery,
+ sal_Int32 nCommandType = -1, bool bCreate = false);
+ sal_uInt32 GetSelectedRecordId(const String& rDataSource, const String& rTableOrQuery, sal_Int32 nCommandType = -1);
+ sal_Bool GetColumnCnt(const String& rSourceName, const String& rTableName,
+ const String& rColumnName, sal_uInt32 nAbsRecordId, long nLanguage,
+ String& rResult, double* pNumber);
+ //create and store or find an already stored connection to a data source for use
+ //in SwFldMgr and SwDBTreeList
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>
+ RegisterConnection(::rtl::OUString& rSource);
+
+ const SwDSParam* CreateDSData(const SwDBData& rData)
+ {return FindDSData(rData, sal_True);}
+ const SwDSParamArr& GetDSParamArray() const {return aDataSourceParams;}
+
+
+ //close all data sources - after fields were updated
+ void CloseAll(sal_Bool bIncludingMerge = sal_True);
+
+ sal_Bool GetMergeColumnCnt(const String& rColumnName, sal_uInt16 nLanguage,
+ String &rResult, double *pNumber, sal_uInt32 *pFormat);
+ sal_Bool ToNextMergeRecord();
+ sal_Bool ToNextRecord(const String& rDataSource, const String& rTableOrQuery, sal_Int32 nCommandType = -1);
+
+ sal_Bool ExistsNextRecord()const;
+ sal_uInt32 GetSelectedRecordId();
+ sal_Bool ToRecordId(sal_Int32 nSet);
+
+ const SwDBData& GetAddressDBName();
+
+ static String GetDBField(
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xColumnProp,
+ const SwDBFormatData& rDBFormatData,
+ double *pNumber = NULL);
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>
+ GetConnection(const String& rDataSource,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rxSource);
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier>
+ GetColumnSupplier(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>,
+ const String& rTableOrQuery,
+ sal_uInt8 eTableOrQuery = SW_DB_SELECT_UNKNOWN);
+
+ static ::com::sun::star::uno::Sequence<rtl::OUString> GetExistingDatabaseNames();
+
+ /**
+ Loads a data source from file and registers it. Returns the registered name.
+ */
+ static String LoadAndRegisterDataSource();
+
+ static SwDbtoolsClient& GetDbtoolsClient();
+ // has to be called from _FinitUI()
+ static void RemoveDbtoolsClient();
+
+ /** try to get the data source from the given connection through the XChild interface.
+ If this is not possible, the data source will be created through its name.
+ @param _xConnection
+ The connection which should support the XChild interface. (not a must)
+ @param _sDataSourceName
+ The data source name will be used to create the data source when the connection can not be used for it.
+ @return
+ The data source.
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>
+ getDataSourceAsParent(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,const ::rtl::OUString& _sDataSourceName);
+
+ /** creates a RowSet, which must be disposed after use.
+ @param _sDataSourceName
+ The data source name
+ @param _sCommand
+ The command.
+ @param _nCommandType
+ The type of the command.
+ @param _xConnection
+ The active connection which may be <NULL/>.
+ @return
+ The new created RowSet.
+
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>
+ createCursor( const ::rtl::OUString& _sDataSourceName,
+ const ::rtl::OUString& _sCommand,
+ sal_Int32 _nCommandType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection
+ );
+ //merge into one document - returns the number of merged docs
+ sal_Int32 MergeDocuments( SwMailMergeConfigItem& rMMConfig, SwView& rSourceView );
+};
+
+#endif
+
diff --git a/sw/inc/dbui.hrc b/sw/inc/dbui.hrc
new file mode 100644
index 000000000000..2afc70221e3d
--- /dev/null
+++ b/sw/inc/dbui.hrc
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DBUI_HRC
+#define _DBUI_HRC
+
+// #include *****************************************************************
+
+#include "rcid.hrc"
+
+// Dialoge --------------------------------------------------------------------
+
+#define DLG_DBSELECTION (RC_DBUI_BEGIN)
+#define DLG_PRINTMONITOR (RC_DBUI_BEGIN + 1)
+#define DLG_AP_INSERT_DB_SEL (RC_DBUI_BEGIN + 2)
+
+#define DLG_MAILMERGEWIZARD (RC_DBUI_BEGIN + 3)
+#define DLG_MM_DOCSELECT_PAGE (RC_DBUI_BEGIN + 4)
+#define DLG_MM_OUTPUTTYPE_PAGE (RC_DBUI_BEGIN + 5)
+#define DLG_MM_ADDRESSBLOCK_PAGE (RC_DBUI_BEGIN + 6)
+#define DLG_MM_GREETINGS_PAGE (RC_DBUI_BEGIN + 7)
+#define DLG_MM_PREPAREMERGE_PAGE (RC_DBUI_BEGIN + 8)
+#define DLG_MM_MERGE_PAGE (RC_DBUI_BEGIN + 9)
+#define DLG_MM_OUTPUT_PAGE (RC_DBUI_BEGIN + 10)
+#define DLG_MM_ADDRESSLISTDIALOG (RC_DBUI_BEGIN + 11)
+#define DLG_MM_SELECTDBTABLEDDIALOG (RC_DBUI_BEGIN + 12)
+#define DLG_MM_DBTABLEPREVIEWDIALOG (RC_DBUI_BEGIN + 13)
+#define DLG_MM_CREATEADDRESSLIST (RC_DBUI_BEGIN + 14)
+#define DLG_MM_FIND_ENTRY (RC_DBUI_BEGIN + 15)
+#define DLG_MM_ADD_RENAME_ENTRY (RC_DBUI_BEGIN + 16)
+#define DLG_MM_CUSTOMIZE_ADDRESS_LIST (RC_DBUI_BEGIN + 17)
+#define DLG_MM_CUSTOMIZEADDRESSBLOCK (RC_DBUI_BEGIN + 18)
+#define DLG_MM_SELECTADDRESSBLOCK (RC_DBUI_BEGIN + 19)
+#define DLG_MM_ASSIGNFIELDS (RC_DBUI_BEGIN + 20)
+
+#define DLG_MM_LAYOUT_PAGE (RC_DBUI_BEGIN + 22)
+#define DLG_MM_COPYTO (RC_DBUI_BEGIN + 23)
+#define DLG_MM_MAILBODY (RC_DBUI_BEGIN + 24)
+#define DLG_MM_SENDMAILS (RC_DBUI_BEGIN + 25)
+#define DLG_MAILMERGECHILD (RC_DBUI_BEGIN + 26)
+#define DLG_MM_SAVEWARNING (RC_DBUI_BEGIN + 27)
+#define DLG_MM_QUERY (RC_DBUI_BEGIN + 28)
+#define DLG_MM_SENDWARNING (RC_DBUI_BEGIN + 29)
+#define DLG_MM_CREATIONMONITOR (RC_DBUI_BEGIN + 30)
+// Strings ------------------------------------------------------------------
+
+#define STR_DB_EMAIL (RC_DBUI_BEGIN)
+#define SA_ADDRESS_HEADER (RC_DBUI_BEGIN + 1)
+#define STR_NOTASSIGNED (RC_DBUI_BEGIN + 2)
+#define STR_FILTER_ALL (RC_DBUI_BEGIN + 3)
+#define STR_FILTER_SXB (RC_DBUI_BEGIN + 4)
+#define STR_FILTER_SXC (RC_DBUI_BEGIN + 5)
+#define STR_FILTER_DBF (RC_DBUI_BEGIN + 6)
+#define STR_FILTER_XLS (RC_DBUI_BEGIN + 7)
+#define STR_FILTER_TXT (RC_DBUI_BEGIN + 8)
+#define STR_FILTER_CSV (RC_DBUI_BEGIN + 9)
+#define STR_FILTER_ALL_DATA (RC_DBUI_BEGIN + 10)
+#define STR_FILTER_MDB (RC_DBUI_BEGIN + 11)
+#define STR_FILTER_ACCDB (RC_DBUI_BEGIN + 12)
+
+// Bitmaps ------------------------------------------------------------------
+
+
+// Elemente -----------------------------------------------------------------
+
+#define TLB_DBLIST 1
+#define BTN_OK 2
+#define BTN_CANCEL 3
+#define BTN_HELP 4
+
+#define FT_DOCNAME 5
+#define FT_PRINTING 6
+#define FT_PRINTER 7
+#define FT_PRINTINFO 8
+#define PB_CANCELPRNMON 9
+#define FT_SENDING 10
+#define STR_EMAILMON 11
+#define FT_STATUS 12
+#define FT_CREATEDOCUMENTS 13
+#define FT_PROGRESS 14
+#define FT_COUNTING 15
+#define STR_SAVEMON 16
+#define FT_SAVING 17
+
+#define MM_PART_TITLE 0
+#define MM_PART_FIRSTNAME 1
+#define MM_PART_LASTNAME 2
+#define MM_PART_COMPANY 3
+#define MM_PART_ADDRESS_1 4
+#define MM_PART_ADDRESS_2 5
+#define MM_PART_CITY 6
+#define MM_PART_REGION 7
+#define MM_PART_ZIP 8
+#define MM_PART_COUNTRY 9
+#define MM_PART_PHONE_PRIVATE 10
+#define MM_PART_PHONE_BUSINESS 11
+#define MM_PART_E_MAIL 12
+#define MM_PART_GENDER 13
+
+#endif
+
+
diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx
new file mode 100644
index 000000000000..e5754c510360
--- /dev/null
+++ b/sw/inc/dcontact.hxx
@@ -0,0 +1,549 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DCONTACT_HXX
+#define _DCONTACT_HXX
+
+#include <svx/svdobj.hxx>
+#include <svx/svdovirt.hxx>
+#include <swtypes.hxx>
+#include <fmtanchr.hxx>
+#include <frmfmt.hxx>
+#include <list>
+
+#include "calbck.hxx"
+#include <anchoreddrawobject.hxx>
+
+class SfxPoolItem;
+class SwFrmFmt;
+class SwFlyFrmFmt;
+class SwFlyFrm;
+class SwFrm;
+class SwPageFrm;
+class SwVirtFlyDrawObj;
+class SwFmtAnchor;
+class SwFlyDrawObj;
+class SwRect;
+class SwDrawContact;
+struct SwPosition;
+class SwIndex;
+class SdrTextObj;
+
+//Der Umgekehrte Weg: Sucht das Format zum angegebenen Objekt.
+//Wenn das Object ein SwVirtFlyDrawObj ist so wird das Format von
+//selbigem besorgt.
+//Anderfalls ist es eben ein einfaches Zeichenobjekt. Diese hat einen
+//UserCall und der ist Client vom gesuchten Format.
+//Implementierung in dcontact.cxx
+SW_DLLPUBLIC SwFrmFmt *FindFrmFmt( SdrObject *pObj );
+inline const SwFrmFmt *FindFrmFmt( const SdrObject *pObj )
+{ return ::FindFrmFmt( (SdrObject*)pObj ); }
+sal_Bool HasWrap( const SdrObject* pObj );
+
+void setContextWritingMode( SdrObject* pObj, SwFrm* pAnchor );
+
+//Bei Aenderungen das Objekt aus dem ContourCache entfernen.
+//Implementierung in TxtFly.Cxx
+void ClrContourCache( const SdrObject *pObj );
+
+// liefert BoundRect inklusive Abstand
+// --> OD 2006-08-15 #i68520# - change naming
+SwRect GetBoundRectOfAnchoredObj( const SdrObject* pObj );
+// <--
+
+//Liefert den UserCall ggf. vom Gruppenobjekt
+// OD 2004-03-31 #i26791# - change return type
+SwContact* GetUserCall( const SdrObject* );
+
+// liefert sal_True falls das SrdObject ein Marquee-Object (Lauftext) ist
+sal_Bool IsMarqueeTextObj( const SdrObject& rObj );
+
+//Basisklasse fuer die folgenden KontaktObjekte (Rahmen+Zeichenobjekte)
+class SwContact : public SdrObjUserCall, public SwClient
+{
+ // OD 05.09.2003 #112039# - boolean, indicating destruction of contact object
+ // important note: boolean has to be set at the beginning of each destructor
+ // in the subclasses using method <SetInDTOR()>.
+ bool mbInDTOR;
+
+ /** method to move object to visible/invisible layer
+
+ OD 21.08.2003 #i18447#
+ Implementation for the public method <MoveObjToVisibleLayer(..)>
+ and <MoveObjToInvisibleLayer(..)>
+ If object is in invisble respectively visible layer, its moved to
+ the corresponding visible respectively invisible layers.
+ For group object the members are individually moved to the corresponding
+ layer, because <SdrObjGroup::GetLayer()> does return 0, if members
+ aren't on the same layer as the group object, and
+ <SdrObjGroup::SetLayer(..)|NbcSetLayer(..)> sets also the layer of
+ the members.
+ OD 2004-01-15 #110582# - moved from subclass <SwDrawContact>
+
+ @author OD
+
+ @param _bToVisible
+ input parameter - boolean indicating, if object has to be moved to
+ visible (== true) or invisible (== false) layer.
+
+ @param _pDrawObj
+ input parameter, which will be changed - drawing object, which will
+ change its layer.
+ */
+ void _MoveObjToLayer( const bool _bToVisible,
+ SdrObject* _pDrawObj );
+
+protected:
+ // OD 05.09.2003 #112039# - accessor to set member <mbInDTOR>
+ void SetInDTOR();
+
+public:
+ TYPEINFO();
+
+ //Fuer den Reader, es wir nur die Verbindung hergestellt.
+ SwContact( SwFrmFmt *pToRegisterIn );
+ virtual ~SwContact();
+
+ // OD 2004-03-29 #i26791#
+ virtual const SwAnchoredObject* GetAnchoredObj( const SdrObject* _pSdrObj ) const = 0;
+ virtual SwAnchoredObject* GetAnchoredObj( SdrObject* _pSdrObj ) = 0;
+
+ // OD 13.05.2003 #108784# - made methods virtual and not inline
+ // OD 2004-04-01 #i26791# - made methods pure virtual
+ virtual const SdrObject *GetMaster() const = 0;
+ virtual SdrObject *GetMaster() = 0;
+ virtual void SetMaster( SdrObject* _pNewMaster ) = 0;
+
+ SwFrmFmt *GetFmt(){ return (SwFrmFmt*)GetRegisteredIn(); }
+ const SwFrmFmt *GetFmt() const
+ { return (const SwFrmFmt*)GetRegisteredIn(); }
+
+ // OD 05.09.2003 #112039# - accessor for member <mbInDTOR>
+ bool IsInDTOR() const;
+
+ /** method to move drawing object to corresponding visible layer
+
+ OD 21.08.2003 #i18447#
+ uses method <_MoveObjToLayer(..)>
+ OD 2004-01-15 #110582# - moved from subclass <SwDrawContact> and made virtual
+
+ @author OD
+
+ @param _pDrawObj
+ drawing object, which will be moved to the visible layer
+ */
+ virtual void MoveObjToVisibleLayer( SdrObject* _pDrawObj );
+
+ /** method to move drawing object to corresponding invisible layer
+
+ OD 21.08.2003 #i18447#
+ uses method <_MoveObjToLayer(..)>
+ OD 2004-01-15 #110582# - moved from subclass <SwDrawContact> and made virtual.
+
+ @author OD
+
+ @param _pDrawObj
+ drawing object, which will be moved to the visible layer
+ */
+ virtual void MoveObjToInvisibleLayer( SdrObject* _pDrawObj );
+
+ // -------------------------------------------------------------------------
+ // OD 2004-01-16 #110582# - some virtual helper methods for information
+ // about the object (Writer fly frame resp. drawing object)
+ const SwFmtAnchor& GetAnchorFmt() const
+ {
+ ASSERT( GetFmt(),
+ "<SwContact::GetAnchorFmt()> - no frame format -> crash" );
+
+ return GetFmt()->GetAnchor();
+ }
+
+ RndStdIds GetAnchorId() const { return GetAnchorFmt().GetAnchorId(); }
+ bool ObjAnchoredAtPage() const { return GetAnchorId() == FLY_AT_PAGE; }
+ bool ObjAnchoredAtFly() const { return GetAnchorId() == FLY_AT_FLY; }
+ bool ObjAnchoredAtPara() const { return GetAnchorId() == FLY_AT_PARA; }
+ bool ObjAnchoredAtChar() const { return GetAnchorId() == FLY_AT_CHAR; }
+ bool ObjAnchoredAsChar() const { return GetAnchorId() == FLY_AS_CHAR; }
+
+ const SwPosition& GetCntntAnchor() const
+ {
+ ASSERT( GetAnchorFmt().GetCntntAnchor(),
+ "<SwContact::GetCntntAnchor()> - no content anchor -> crash" );
+
+ return *(GetAnchorFmt().GetCntntAnchor());
+ }
+
+ const SwIndex& GetCntntAnchorIndex() const;
+
+ // -------------------------------------------------------------------------
+
+ /** get data collection of anchored objects, handled by with contact
+
+ OD 2004-08-23 #110810#
+
+ @author
+ */
+ virtual void GetAnchoredObjs( std::list<SwAnchoredObject*>& _roAnchoredObjs ) const = 0;
+
+ /** get minimum order number of anchored objects handled by with contact
+
+ OD 2004-08-24 #110810#
+
+ @author
+ */
+ sal_uInt32 GetMinOrdNum() const;
+
+ /** get maximum order number of anchored objects handled by with contact
+
+ OD 2004-08-24 #110810#
+
+ @author
+ */
+ sal_uInt32 GetMaxOrdNum() const;
+};
+
+//KontactObjekt fuer die Verbindung zwischen Rahmen bzw. deren Formaten
+//im StarWriter (SwClient) und den Zeichenobjekten des Drawing (SdrObjUserCall)
+
+class SW_DLLPUBLIC SwFlyDrawContact : public SwContact
+{
+private:
+ // OD 2004-04-01 #i26791#
+ SwFlyDrawObj* mpMasterObj;
+
+protected:
+ // virtuelle Methoden von SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
+
+public:
+ TYPEINFO();
+
+ //Legt das DrawObjekt an und meldet es beim Model an.
+ SwFlyDrawContact( SwFlyFrmFmt* pToRegisterIn, SdrModel* pMod );
+ virtual ~SwFlyDrawContact();
+
+ // OD 2004-03-29 #i26791#
+ virtual const SwAnchoredObject* GetAnchoredObj( const SdrObject* _pSdrObj ) const;
+ virtual SwAnchoredObject* GetAnchoredObj( SdrObject* _pSdrObj );
+
+ // OD 2004-04-01 #i26791#
+ virtual const SdrObject* GetMaster() const;
+ virtual SdrObject* GetMaster();
+ virtual void SetMaster( SdrObject* _pNewMaster );
+
+ // OD 2004-01-16 #110582# - override methods to control Writer fly frames,
+ // which are linked, and to assure that all objects anchored at/inside the
+ // Writer fly frame are also made visible/invisible.
+ virtual void MoveObjToVisibleLayer( SdrObject* _pDrawObj );
+ virtual void MoveObjToInvisibleLayer( SdrObject* _pDrawObj );
+
+ /** get data collection of anchored objects handled by with contact
+
+ OD 2004-08-23 #110810#
+
+ @author
+ */
+ virtual void GetAnchoredObjs( std::list<SwAnchoredObject*>& _roAnchoredObjs ) const;
+};
+
+// OD 16.05.2003 #108784# - new class for re-direct methods calls at a 'virtual'
+// drawing object to its referenced object.
+class SwDrawVirtObj : public SdrVirtObj
+{
+ private:
+ // data for connection to writer layout
+ // OD 2004-03-25 #i26791# - anchored drawing object instance for the
+ // 'virtual' drawing object
+ SwAnchoredDrawObject maAnchoredDrawObj;
+
+ // writer-drawing contact object the 'virtual' drawing object is controlled by.
+ // This object is also the <UserCall> of the drawing object, if it's
+ // inserted into the drawing layer.
+ SwDrawContact& mrDrawContact;
+
+ using SdrVirtObj::GetPlusHdl;
+
+ protected:
+ // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is
+ // not used but something own (top left of new SnapRect minus top left
+ // of original SnapRect)
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+ public:
+ TYPEINFO();
+
+ SwDrawVirtObj( SdrObject& _rNewObj,
+ SwDrawContact& _rDrawContact );
+ virtual ~SwDrawVirtObj();
+
+ // access to offset
+ // OD 30.06.2003 #108784# - virtual!!!
+ virtual const Point GetOffset() const;
+
+ virtual SdrObject* Clone() const;
+ virtual void operator=( const SdrObject& rObj );
+
+ // connection to writer layout
+ // OD 2004-03-29 #i26791#
+ const SwAnchoredObject* GetAnchoredObj() const;
+ SwAnchoredObject* AnchoredObj();
+ const SwFrm* GetAnchorFrm() const;
+ SwFrm* AnchorFrm();
+ void RemoveFromWriterLayout();
+
+ // connection to drawing layer
+ void AddToDrawingPage();
+ void RemoveFromDrawingPage();
+
+ // is 'virtual' drawing object connected to writer layout and
+ // to drawing layer.
+ bool IsConnected() const;
+
+ virtual void NbcSetAnchorPos(const Point& rPnt);
+
+ // #108784#
+ // All overloaded methods which need to use the offset
+ virtual void RecalcBoundRect();
+ virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual ::basegfx::B2DPolyPolygon TakeContour() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+ virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt16 nPlNum) const;
+ virtual void NbcMove(const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+ virtual void Move(const Size& rSiz);
+ virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void Rotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void Mirror(const Point& rRef1, const Point& rRef2);
+ virtual void Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+ virtual void RecalcSnapRect();
+ virtual const Rectangle& GetSnapRect() const;
+ virtual void SetSnapRect(const Rectangle& rRect);
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual const Rectangle& GetLogicRect() const;
+ virtual void SetLogicRect(const Rectangle& rRect);
+ virtual void NbcSetLogicRect(const Rectangle& rRect);
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+ virtual Point GetPoint(sal_uInt32 i) const;
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
+
+ // #108784#
+ virtual FASTBOOL HasTextEdit() const;
+
+ // OD 17.06.2003 #108784# - overload 'layer' methods
+ virtual SdrLayerID GetLayer() const;
+ virtual void NbcSetLayer(SdrLayerID nLayer);
+ virtual void SetLayer(SdrLayerID nLayer);
+
+ // FullDrag support
+ virtual bool supportsFullDrag() const;
+ virtual SdrObject* getFullDragClone() const;
+
+ // #i97197#
+ virtual void SetBoundRectDirty();
+ virtual const Rectangle& GetCurrentBoundRect() const;
+ virtual const Rectangle& GetLastBoundRect() const;
+};
+
+// OD 26.06.2003 #108784#
+bool CheckControlLayer( const SdrObject *pObj );
+
+//KontactObjekt fuer die Verbindung von Formaten als Repraesentanten der
+//Zeichenobjekte im StarWriter (SwClient) und den Objekten selbst im Drawing
+//(SdrObjUserCall).
+
+// --> OD 2006-01-18 #129959#
+class NestedUserCallHdl;
+// <--
+
+class SwDrawContact : public SwContact
+{
+ private:
+ // OD 2004-03-25 #i26791# - anchored drawing object instance for the
+ // 'master' drawing object
+ SwAnchoredDrawObject maAnchoredDrawObj;
+
+ // OD 16.05.2003 #108784# - data structure for collecting 'virtual'
+ // drawing object supporting drawing objects in headers/footers.
+ std::list<SwDrawVirtObj*> maDrawVirtObjs;
+
+ // OD 2004-04-01 #i26791# - boolean indicating set 'master' drawing
+ // object has been cleared.
+ bool mbMasterObjCleared : 1;
+
+ // OD 10.10.2003 #112299# - internal flag to indicate that disconnect
+ // from layout is in progress
+ bool mbDisconnectInProgress : 1;
+
+ // --> OD 2006-01-18 #129959#
+ // Needed data for handling of nested <SdrObjUserCall> events in
+ // method <_Changed(..)>
+ bool mbUserCallActive : 1;
+ // event type, which is handled for <mpSdrObjHandledByCurrentUserCall>.
+ // Note: value only valid, if <mbUserCallActive> is sal_True.
+ SdrUserCallType meEventTypeOfCurrentUserCall;
+
+ friend class NestedUserCallHdl;
+ // <--
+
+ // unary function used by <list> iterator to find a disconnected 'virtual'
+ // drawing object
+ struct UsedOrUnusedVirtObjPred
+ {
+ bool mbUsedPred;
+ UsedOrUnusedVirtObjPred( bool _bUsed ) : mbUsedPred( _bUsed ) {};
+ bool operator() ( const SwDrawVirtObj* _pDrawVirtObj )
+ {
+ if ( mbUsedPred )
+ {
+ return _pDrawVirtObj->IsConnected();
+ }
+ else
+ {
+ return !_pDrawVirtObj->IsConnected();
+ }
+ }
+ };
+
+ // unary function used by <list> iterator to find a 'virtual' drawing
+ // object anchored at a given frame
+ struct VirtObjAnchoredAtFrmPred
+ {
+ const SwFrm* mpAnchorFrm;
+ VirtObjAnchoredAtFrmPred( const SwFrm& _rAnchorFrm );
+ bool operator() ( const SwDrawVirtObj* _pDrawVirtObj );
+ };
+
+ // OD 16.05.2003 #108784# - method for adding/removing 'virtual' drawing object.
+ SwDrawVirtObj* CreateVirtObj();
+ void DestroyVirtObj( SwDrawVirtObj* pVirtObj );
+ void RemoveAllVirtObjs();
+
+ // OD 2004-03-31 #i26791#
+ void _InvalidateObjs( const bool _bUpdateSortedObjsList = false );
+
+ // --> OD 2006-01-23 #124157#
+ // no copy-constructor and no assignment operator
+ SwDrawContact( const SwDrawContact& );
+ SwDrawContact& operator=( const SwDrawContact& );
+ // <--
+
+ protected:
+ // virtuelle Methoden von SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
+
+ public:
+ TYPEINFO();
+
+ SwDrawContact( SwFrmFmt *pToRegisterIn, SdrObject *pObj );
+ virtual ~SwDrawContact();
+
+ // OD 2004-03-29 #i26791#
+ // --> OD 2005-01-06 #i30669# - no default value for parameter <_pSdrObj>
+ virtual const SwAnchoredObject* GetAnchoredObj( const SdrObject* _pSdrObj ) const;
+ virtual SwAnchoredObject* GetAnchoredObj( SdrObject* _pSdrObj );
+ // <--
+
+ // OD 2004-04-01 #i26791#
+ virtual const SdrObject* GetMaster() const;
+ virtual SdrObject* GetMaster();
+ virtual void SetMaster( SdrObject* _pNewMaster );
+
+ // OD 2004-03-29 #i26791#
+ const SwFrm* GetAnchorFrm( const SdrObject* _pDrawObj = 0L ) const;
+ SwFrm* GetAnchorFrm( SdrObject* _pDrawObj = 0L );
+
+ // --> OD 2004-06-30 #i28701# - page frame is now stored at member <maAnchoredDrawObj>
+ inline const SwPageFrm* GetPageFrm() const
+ {
+ return maAnchoredDrawObj.GetPageFrm();
+ }
+ inline SwPageFrm* GetPageFrm()
+ {
+ return maAnchoredDrawObj.GetPageFrm();
+ }
+ void SetPageFrm( SwPageFrm* _pNewPageFrm )
+ {
+ return maAnchoredDrawObj.SetPageFrm( _pNewPageFrm );
+ }
+ // <--
+ void ChkPage();
+ SwPageFrm* FindPage( const SwRect &rRect );
+
+ //Fuegt das SdrObject in die Arrays (SwPageFrm und SwFrm) des Layouts ein.
+ //Der Anker wird Anhand des Attributes SwFmtAnchor bestimmt.
+ //Das Objekt wird ggf. beim alten Anker abgemeldet.
+ void ConnectToLayout( const SwFmtAnchor *pAnch = 0 );
+ // OD 27.06.2003 #108784# - method to insert 'master' drawing object
+ // into drawing page
+ void InsertMasterIntoDrawPage();
+
+ void DisconnectFromLayout( bool _bMoveMasterToInvisibleLayer = true );
+ // OD 19.06.2003 #108784# - disconnect for a dedicated drawing object -
+ // could be 'master' or 'virtual'.
+ void DisconnectObjFromLayout( SdrObject* _pDrawObj );
+ // OD 26.06.2003 #108784# - method to remove 'master' drawing object
+ // from drawing page.
+ // To be used by the undo for delete of object. Call it after method
+ // <DisconnectFromLayout( bool = true )> is already performed.
+ // Note: <DisconnectFromLayout( bool )> no longer removes the 'master'
+ // drawing object from drawing page.
+ void RemoveMasterFromDrawPage();
+
+ // OD 19.06.2003 #108784# - get drawing object ('master' or 'virtual')
+ // by frame.
+ SdrObject* GetDrawObjectByAnchorFrm( const SwFrm& _rAnchorFrm );
+
+ // virtuelle Methoden von SdrObjUserCall
+ virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& rOldBoundRect);
+
+ // wird von Changed() und auch vom UndoDraw benutzt, uebernimmt
+ // das Notifien von Absaetzen, die ausweichen muessen
+ void _Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle* pOldBoundRect);
+
+ //Moved alle SW-Verbindungen zu dem neuen Master.
+ void ChangeMasterObject( SdrObject *pNewMaster );
+
+ // OD 19.06.2003 #108784#
+ SwDrawVirtObj* AddVirtObj();
+
+ // OD 20.06.2003 #108784#
+ void NotifyBackgrdOfAllVirtObjs( const Rectangle* pOldBoundRect );
+
+ /** get data collection of anchored objects, handled by with contact
+
+ OD 2004-08-23 #110810#
+
+ @author
+ */
+
+ static void GetTextObjectsFromFmt( std::list<SdrTextObj*>&, SwDoc* );
+ virtual void GetAnchoredObjs( std::list<SwAnchoredObject*>& _roAnchoredObjs ) const;
+};
+
+#endif
diff --git a/sw/inc/ddefld.hxx b/sw/inc/ddefld.hxx
new file mode 100644
index 000000000000..6fb7a76c3728
--- /dev/null
+++ b/sw/inc/ddefld.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_DDEFLD_HXX
+#define SW_DDEFLD_HXX
+
+#include <sfx2/lnkbase.hxx>
+#include "swdllapi.h"
+#include "fldbas.hxx"
+
+class SwDoc;
+
+/*--------------------------------------------------------------------
+ Beschreibung: FieldType fuer DDE
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDDEFieldType : public SwFieldType
+{
+ String aName;
+ String aExpansion;
+
+ ::sfx2::SvBaseLinkRef refLink;
+ SwDoc* pDoc;
+
+ sal_uInt16 nRefCnt;
+ sal_Bool bCRLFFlag : 1;
+ sal_Bool bDeleted : 1;
+
+ SW_DLLPRIVATE void _RefCntChgd();
+
+public:
+ SwDDEFieldType( const String& rName, const String& rCmd,
+ sal_uInt16 = sfx2::LINKUPDATE_ONCALL );
+ ~SwDDEFieldType();
+
+ const String& GetExpansion() const { return aExpansion; }
+ void SetExpansion( const String& rStr ) { aExpansion = rStr,
+ bCRLFFlag = sal_False; }
+
+ virtual SwFieldType* Copy() const;
+ virtual const String& GetName() const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+
+ String GetCmd() const;
+ void SetCmd( const String& rStr );
+
+ sal_uInt16 GetType() const { return refLink->GetUpdateMode(); }
+ void SetType( sal_uInt16 nType ) { refLink->SetUpdateMode( nType ); }
+
+ sal_Bool IsDeleted() const { return bDeleted; }
+ void SetDeleted( sal_Bool b ) { bDeleted = b; }
+
+ void UpdateNow() { refLink->Update(); }
+ void Disconnect() { refLink->Disconnect(); }
+
+ const ::sfx2::SvBaseLink& GetBaseLink() const { return *refLink; }
+ ::sfx2::SvBaseLink& GetBaseLink() { return *refLink; }
+
+ const SwDoc* GetDoc() const { return pDoc; }
+ SwDoc* GetDoc() { return pDoc; }
+ void SetDoc( SwDoc* pDoc );
+
+ void IncRefCnt() { if( !nRefCnt++ && pDoc ) _RefCntChgd(); }
+ void DecRefCnt() { if( !--nRefCnt && pDoc ) _RefCntChgd(); }
+
+ void SetCRLFDelFlag( sal_Bool bFlag = sal_True ) { bCRLFFlag = bFlag; }
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: DDE-Feld
+ --------------------------------------------------------------------*/
+
+class SwDDEField : public SwField
+{
+private:
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ SwDDEField(SwDDEFieldType*);
+ ~SwDDEField();
+
+ // ueber Typen Parameter ermitteln
+ // Name kann nicht geaendert werden
+ virtual const String& GetPar1() const;
+
+ // Commando
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+};
+
+
+#endif // SW_DDEFLD_HXX
diff --git a/sw/inc/dialog.hrc b/sw/inc/dialog.hrc
new file mode 100644
index 000000000000..bc11b017e13f
--- /dev/null
+++ b/sw/inc/dialog.hrc
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DIALOG_HRC
+#define _DIALOG_HRC
+
+// #include *****************************************************************
+
+#include "rcid.hrc"
+
+// Dialoge ******************************************************************
+
+#define DLG_SAVE_REGISTRY_FILE (RC_DIALOG_BEGIN + 1)
+
+#define DLG_PASSWD (RC_DIALOG_BEGIN + 3)
+#define DLG_PASTESPECIAL (RC_DIALOG_BEGIN + 5)
+#define DLG_LINKS (RC_DIALOG_BEGIN + 6)
+#define DLG_LINKEDIT (RC_DIALOG_BEGIN + 7)
+#define DLG_INSERT_ABSTRACT (RC_DIALOG_BEGIN + 8)
+#define DLG_ASCII_FILTER (RC_DIALOG_BEGIN + 9)
+#define DLG_WORDCOUNT (RC_DIALOG_BEGIN + 10)
+#define RID_QB_SPELL_CONTINUE (RC_DIALOG_BEGIN + 11)
+#define STR_SPELLING_COMPLETED (RC_DIALOG_BEGIN + 12)
+
+// Strings ******************************************************************
+
+#define STR_LINKEDIT_TEXT (RC_DIALOG_BEGIN + 1)
+
+#define STR_CLOSELINKMSG (RC_DIALOG_BEGIN + 3)
+#define STR_PATH_NOT_FOUND (RC_DIALOG_BEGIN + 4)
+
+#define STR_FLT_SGV (RC_DIALOG_BEGIN + 8)
+
+#define STR_NEWDLG_NAME (RC_DIALOG_BEGIN + 10)
+
+// Controls *****************************************************************
+
+#define CB_USE_PASSWD (RC_DIALOG_BEGIN )
+#define CB_READ_ONLY (RC_DIALOG_BEGIN + 1)
+
+// Bereiche *****************************************************************
+
+
+#define RC_REGIONSW_BEGIN (RC_DIALOG_BEGIN + 60)
+#define RC_REGIONSW_END (RC_DIALOG_BEGIN + 79)
+
+#define RC_MACASSGN_BEGIN (RC_DIALOG_BEGIN + 80)
+#define RC_MACASSGN_END (RC_DIALOG_BEGIN + 89)
+
+#define RC_DLG_ADDR (RC_DIALOG_BEGIN + 90)
+#define RC_SWDLG_BACKGROUND (RC_DIALOG_BEGIN + 91)
+#define RC_DLG_SWNUMFMTDLG (RC_DIALOG_BEGIN + 92)
+#define RC_DLG_SWBORDERDLG (RC_DIALOG_BEGIN + 93)
+#define RC_DLG_SWWRAPDLG (RC_DIALOG_BEGIN + 94)
+#define RC_DLG_SWFLDEDITDLG (RC_DIALOG_BEGIN + 95)
+// Ueberlaufpruefung ********************************************************
+
+#define DIALOG_ACT_END RC_MACASSGN_END
+
+#if DIALOG_ACT_END > RC_DIALOG_END
+#error Resource-Ueberlauf in #file, #line
+#endif
+
+#endif
+
diff --git a/sw/inc/dlelstnr.hxx b/sw/inc/dlelstnr.hxx
new file mode 100644
index 000000000000..225f470b44b0
--- /dev/null
+++ b/sw/inc/dlelstnr.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DLELSTNR_HXX_
+#define _DLELSTNR_HXX_
+
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/linguistic2/XDictionaryListEventListener.hpp>
+#include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <cppuhelper/implbase2.hxx> // helper for implementations
+
+
+namespace com { namespace sun { namespace star {
+ namespace linguistic2 {
+ class XDictionaryList;
+ class XLinguServiceManager;
+ class XProofreadingIterator;
+ }
+ namespace frame {
+ class XTerminateListener;
+ }
+} } }
+
+///////////////////////////////////////////////////////////////////////////
+// SwLinguServiceEventListener
+// is a EventListener that triggers spellchecking
+// and hyphenation when relevant changes (to the
+// dictionaries of the dictionary list, or properties) were made.
+//
+
+class SwLinguServiceEventListener :
+ public cppu::WeakImplHelper2
+ <
+ com::sun::star::linguistic2::XLinguServiceEventListener,
+ com::sun::star::frame::XTerminateListener
+ >
+{
+ com::sun::star::uno::Reference<
+ com::sun::star::frame::XDesktop > xDesktop;
+ com::sun::star::uno::Reference<
+ com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
+ com::sun::star::uno::Reference<
+ com::sun::star::linguistic2::XProofreadingIterator > xGCIterator;
+
+ // disallow use of copy-constructor and assignment operator
+ SwLinguServiceEventListener(const SwLinguServiceEventListener &);
+ SwLinguServiceEventListener & operator = (const SwLinguServiceEventListener &);
+
+public:
+ SwLinguServiceEventListener();
+ virtual ~SwLinguServiceEventListener();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEventObj ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XDictionaryListEventListener
+ virtual void SAL_CALL processDictionaryListEvent( const ::com::sun::star::linguistic2::DictionaryListEvent& rDicListEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XLinguServiceEventListener
+ virtual void SAL_CALL processLinguServiceEvent( const ::com::sun::star::linguistic2::LinguServiceEvent& rLngSvcEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& rEventObj ) throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& rEventObj ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif
+
diff --git a/sw/inc/dobjfac.hxx b/sw/inc/dobjfac.hxx
new file mode 100644
index 000000000000..8b25b38bb74b
--- /dev/null
+++ b/sw/inc/dobjfac.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DOBJFAC_HXX
+#define _DOBJFAC_HXX
+
+#include <tools/link.hxx>
+
+//-----------------------
+// class SwObjectFactory
+//-----------------------
+class SdrObjFactory;
+
+class SwObjectFactory
+{
+public:
+ DECL_LINK( MakeObject, SdrObjFactory * );
+};
+
+extern SwObjectFactory aSwObjectFactory;
+
+
+#endif // _DOBJFAC_HXX
+
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
new file mode 100644
index 000000000000..a72f4f46ec32
--- /dev/null
+++ b/sw/inc/doc.hxx
@@ -0,0 +1,2179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_DOC_HXX
+#define SW_DOC_HXX
+
+/** SwDoc interfaces */
+
+#include <IInterface.hxx>
+#include <IDocumentSettingAccess.hxx>
+#include <IDocumentDeviceAccess.hxx>
+#include <IDocumentMarkAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
+#include <IDocumentLinksAdministration.hxx>
+#include <IDocumentFieldsAccess.hxx>
+#include <IDocumentContentOperations.hxx>
+#include <IDocumentStylePoolAccess.hxx>
+#include <IDocumentLineNumberAccess.hxx>
+#include <IDocumentStatistics.hxx>
+#include <IDocumentState.hxx>
+#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentLayoutAccess.hxx>
+#include <IDocumentTimerAccess.hxx>
+#include <IDocumentChartDataProviderAccess.hxx>
+// --> OD 2007-10-26 #i83479#
+#include <IDocumentOutlineNodes.hxx>
+#include <IDocumentListItems.hxx>
+#include <set>
+// <--
+// --> OD 2008-03-12 #refactorlists#
+#include <IDocumentListsAccess.hxx>
+class SwList;
+// <--
+#include <IDocumentExternalData.hxx>
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <vcl/timer.hxx>
+#include "swdllapi.h"
+#include <swtypes.hxx>
+#include <swatrset.hxx>
+#include <toxe.hxx> // enums
+#include <flyenum.hxx>
+#include <itabenum.hxx>
+#include <swdbdata.hxx>
+#include <chcmprse.hxx>
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
+#include <vos/ref.hxx>
+#include <svx/svdtypes.hxx>
+#include <sfx2/objsh.hxx>
+#include <svl/style.hxx>
+#include <editeng/numitem.hxx>
+#include "comphelper/implementationreference.hxx"
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
+#ifdef FUTURE_VBA
+#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
+#endif
+
+#include <hash_map>
+#include <stringhash.hxx>
+
+#include <svtools/embedhlp.hxx>
+#include <vector>
+#include <set>
+#include <map>
+#include <memory>
+
+#include <boost/scoped_ptr.hpp>
+
+class SvxForbiddenCharactersTable;
+class SwExtTextInput;
+class DateTime;
+class EditFieldInfo;
+class JobSetup;
+class Color;
+class KeyCode;
+class Outliner;
+class OutputDevice;
+class Point;
+class SbxArray;
+class SdrModel;
+class SdrObject;
+class SdrUndoAction;
+class VirtualDevice;
+class SfxPrinter;
+class SvNumberFormatter;
+class SvStringsSort;
+class SvUShorts;
+class SvUShortsSort;
+class SvxMacro;
+class SvxMacroTableDtor;
+class SvxBorderLine;
+class SwAutoCompleteWord;
+class SwAutoCorrExceptWord;
+class SwCalc;
+class SwCellFrm;
+class SwCharFmt;
+class SwCharFmts;
+class SwConditionTxtFmtColl;
+class SwCrsrShell;
+class SwCursor;
+class SwDBNameInfField;
+class SwDocShell;
+class SwDocUpdtFld;
+class SwDrawFrmFmt;
+class SwDrawView;
+class SwEditShell;
+class SwFieldType;
+class SwField;
+class SwTxtFld;
+class SwFldTypes;
+class SwFlyFrmFmt;
+class SwFmt;
+class SwFmtINetFmt;
+class SwFmtRefMark;
+class SwFrmFmt;
+class SwFrmFmts;
+class SwFtnIdxs;
+class SwFtnInfo;
+class SwEndNoteInfo;
+class GraphicObject;
+class SwGrfFmtColl;
+class SwGrfFmtColls;
+class SwLineNumberInfo;
+class SwNewDBMgr;
+class SwNoTxtNode;
+class SwNodeIndex;
+class SwNodeRange;
+class SwNodes;
+class SwNumRule;
+class SwNumRuleTbl;
+class SwPageDesc;
+class SwPosFlyFrms;
+class SwPagePreViewPrtData;
+class SwRedline;
+class SwRedlineTbl;
+class SwRootFrm;
+class SwRubyList;
+class SwRubyListEntry;
+class SwSectionFmt;
+class SwSectionFmts;
+class SwSectionData;
+class SwSelBoxes;
+class SwSpzFrmFmts;
+class SwTOXBase;
+class SwTOXBaseSection;
+class SwTOXMark;
+class SwTOXMarks;
+class SwTOXType;
+class SwTOXTypes;
+class SwTabCols;
+class SwTable;
+class SwTableAutoFmt;
+class SwTableBox;
+class SwTableBoxFmt;
+class SwTableFmt;
+class SwTableLineFmt;
+class SwTableNode;
+class SwTextBlocks;
+class SwTxtFmtColl;
+class SwTxtFmtColls;
+class SwURLStateChanged;
+class SwUnoCrsr;
+class SwUnoCrsrTbl;
+class ViewShell;
+class _SetGetExpFld;
+class SwDrawContact;
+class SwLayouter;
+class SdrView;
+class SdrMarkList;
+class SwAuthEntry;
+class SwLayoutCache;
+class IStyleAccess;
+struct SwCallMouseEvent;
+struct SwDocStat;
+struct SwHash;
+struct SwSortOptions;
+struct SwDefTOXBase_Impl;
+class SwPrintData;
+class SwPrintUIOptions;
+class SdrPageView;
+struct SwConversionArgs;
+class SwRewriter;
+class SwMsgPoolItem;
+class SwChartDataProvider;
+class SwChartLockController_Helper;
+class IGrammarContact;
+class SwPrintData;
+class SwRenderData;
+class SwPageFrm;
+class SwViewOption;
+class IDocumentUndoRedo;
+
+namespace sw { namespace mark {
+ class MarkManager;
+}}
+namespace sw {
+ class MetaFieldManager;
+ class UndoManager;
+ class IShellCursorSupplier;
+}
+
+namespace com { namespace sun { namespace star {
+namespace i18n {
+ struct ForbiddenCharacters; // comes from the I18N UNO interface
+}
+namespace uno {
+ template < class > class Sequence;
+}
+namespace container {
+ class XNameContainer; // for getXForms()/isXForms()/initXForms() methods
+}
+}}}
+
+namespace sfx2 {
+ class SvLinkSource;
+ class IXmlIdRegistry;
+ class LinkManager;
+}
+
+//PageDescriptor-Schnittstelle, Array hier wegen inlines.
+typedef SwPageDesc* SwPageDescPtr;
+SV_DECL_PTRARR_DEL( SwPageDescs, SwPageDescPtr, 4, 4 )
+
+// forward declartion
+void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
+
+// global function to start grammar checking in the document
+void StartGrammarChecking( SwDoc &rDoc );
+
+class SW_DLLPUBLIC SwDoc :
+ public IInterface,
+ public IDocumentSettingAccess,
+ public IDocumentDeviceAccess,
+ public IDocumentRedlineAccess,
+ public IDocumentLinksAdministration,
+ public IDocumentFieldsAccess,
+ public IDocumentContentOperations,
+ public IDocumentStylePoolAccess,
+ public IDocumentLineNumberAccess,
+ public IDocumentStatistics,
+ public IDocumentState,
+ public IDocumentDrawModelAccess,
+ public IDocumentLayoutAccess,
+ public IDocumentTimerAccess,
+ public IDocumentChartDataProviderAccess,
+ // --> OD 2007-10-26 #i83479#
+ public IDocumentListItems,
+ public IDocumentOutlineNodes,
+ // <--
+ // --> OD 2008-03-12 #refactorlists#
+ public IDocumentListsAccess,
+ // <--
+ public IDocumentExternalData
+{
+
+ friend void _InitCore();
+ friend void _FinitCore();
+
+ //---------------- private Member --------------------------------
+
+ // -------------------------------------------------------------------
+ ::boost::scoped_ptr<SwNodes> m_pNodes; /// document content (Nodes Array)
+ SwAttrPool* mpAttrPool; // der Attribut Pool
+ SwPageDescs aPageDescs; // PageDescriptoren
+ Link aOle2Link; // OLE 2.0-Benachrichtigung
+ /* @@@MAINTAINABILITY-HORROR@@@
+ Timer should not be members of the model
+ */
+ Timer aIdleTimer; // der eigene IdleTimer
+ Timer aOLEModifiedTimer; // Timer for update modified OLE-Objecs
+ SwDBData aDBData; // database descriptor
+ ::com::sun::star::uno::Sequence <sal_Int8 > aRedlinePasswd;
+ String sTOIAutoMarkURL; // ::com::sun::star::util::URL of table of index AutoMark file
+ SvStringsDtor aPatternNms; // Array fuer die Namen der Dokument-Vorlagen
+ com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
+ xXForms; // container with XForms models
+ mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > m_xGCIterator;
+
+ const ::boost::scoped_ptr< ::sw::mark::MarkManager> pMarkManager;
+ const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
+ const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager;
+
+ // -------------------------------------------------------------------
+ // die Pointer
+ //Defaultformate
+ SwFrmFmt *pDfltFrmFmt;
+ SwFrmFmt *pEmptyPageFmt; // Format fuer die Default-Leerseite.
+ SwFrmFmt *pColumnContFmt; // Format fuer Spaltencontainer
+ SwCharFmt *pDfltCharFmt;
+ SwTxtFmtColl *pDfltTxtFmtColl; // Defaultformatcollections
+ SwGrfFmtColl *pDfltGrfFmtColl;
+
+ SwFrmFmts *pFrmFmtTbl; // Formattabellen
+ SwCharFmts *pCharFmtTbl;
+ SwSpzFrmFmts *pSpzFrmFmtTbl;
+ SwSectionFmts *pSectionFmtTbl;
+ SwFrmFmts *pTblFrmFmtTbl; // spz. fuer Tabellen
+ SwTxtFmtColls *pTxtFmtCollTbl; // FormatCollections
+ SwGrfFmtColls *pGrfFmtCollTbl;
+
+ SwTOXTypes *pTOXTypes; // Verzeichnisse
+ SwDefTOXBase_Impl * pDefTOXBases; // defaults of SwTOXBase's
+
+ ViewShell *pCurrentView; // SwDoc should get a new member pCurrentView//swmod 071225
+ SdrModel *pDrawModel; // StarView Drawing
+
+ SwDocUpdtFld *pUpdtFlds; // Struktur zum Field-Update
+ SwFldTypes *pFldTypes; // Feldtypen
+ SwNewDBMgr *pNewDBMgr; // Pointer auf den neuen DBMgr fuer
+ // Evaluierung der DB-Fields
+
+ VirtualDevice *pVirDev; // can be used for formatting
+ SfxPrinter *pPrt; // can be used for formatting
+ SwPrintData *pPrtData; // Print configuration
+
+ SwDoc *pGlossaryDoc; // Pointer auf das Glossary-Dokument. Dieses
+
+ SwNumRule *pOutlineRule;
+ SwFtnInfo *pFtnInfo;
+ SwEndNoteInfo *pEndNoteInfo;
+ SwLineNumberInfo*pLineNumberInfo;
+ SwFtnIdxs *pFtnIdxs;
+ SwDocStat *pDocStat; // Statistic Informationen
+ SvxMacroTableDtor *pMacroTable; // Tabelle der dokumentglobalen Macros
+
+ SwDocShell *pDocShell; // Ptr auf die SfxDocShell vom Doc
+ SfxObjectShellLock xTmpDocShell; // A temporary shell that is used to copy OLE-Nodes
+
+ sfx2::LinkManager *pLinkMgr; // Liste von Verknuepften (Grafiken/DDE/OLE)
+
+ SwAutoCorrExceptWord *pACEWord; // fuer die automatische Uebernahme von
+ // autokorrigierten Woertern, die "zurueck"
+ // verbessert werden
+ SwURLStateChanged *pURLStateChgd; // SfxClient fuer Aenderungen in der
+ // INetHistory
+ SvNumberFormatter *pNumberFormatter; // NumFormatter fuer die Tabellen/Felder
+
+ mutable SwNumRuleTbl *pNumRuleTbl; // Liste aller benannten NumRules
+
+ // Hash map to find numrules by name
+ mutable std::hash_map<String, SwNumRule *, StringHash> maNumRuleMap;
+
+ // --> OD 2008-03-12 #refactorlists#
+ typedef std::hash_map< String, SwList*, StringHash > tHashMapForLists;
+ // container to hold the lists of the text document
+ tHashMapForLists maLists;
+ // relation between list style and its default list
+ tHashMapForLists maListStyleLists;
+ // <--
+
+ SwRedlineTbl *pRedlineTbl; // Liste aller Redlines
+ String *pAutoFmtRedlnComment; // Kommentar fuer Redlines, die
+ // uebers Autoformat eingefuegt werden
+ SwUnoCrsrTbl *pUnoCrsrTbl;
+
+ SwPagePreViewPrtData *pPgPViewPrtData; // Einzuege/Abstaende fuers
+ // Drucken der Seitenansicht
+ SwPaM *pExtInputRing;
+
+ SwLayouter *pLayouter; // ::com::sun::star::frame::Controller for complex layout formatting
+ // like footnote/endnote in sections
+ IStyleAccess *pStyleAccess; // handling of automatic styles
+ SwLayoutCache *pLayoutCache; // Layout cache to read and save with the
+ // document for a faster formatting
+
+ SwModify *pUnoCallBack;
+ IGrammarContact *mpGrammarContact; // for grammar checking in paragraphs during editing
+
+ mutable comphelper::ImplementationReference< SwChartDataProvider
+ , ::com::sun::star::chart2::data::XDataProvider >
+ aChartDataProviderImplRef;
+ SwChartLockController_Helper *pChartControllerHelper;
+
+ // table of forbidden characters of this document
+ vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharsTable;
+#ifdef FUTURE_VBA
+ com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > mxVbaEvents;
+#endif
+ // --> OD 2007-10-26 #i83479#
+public:
+ struct lessThanNodeNum
+ {
+ bool operator()( const SwNodeNum* pNodeNumOne,
+ const SwNodeNum* pNodeNumTwo ) const;
+ };
+
+ typedef ::std::set< const SwNodeNum*, lessThanNodeNum > tImplSortedNodeNumList;
+private:
+ tImplSortedNodeNumList* mpListItemsList;
+ // <--
+
+ ::std::auto_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry;
+
+ // -------------------------------------------------------------------
+ // sonstige
+
+ sal_uInt16 nAutoFmtRedlnCommentNo; // SeqNo fuers UI-seitige zusammenfassen
+ // von AutoFmt-Redlines. Wird vom SwAutoFmt
+ // verwaltet!
+ sal_uInt16 nLinkUpdMode; // UpdateMode fuer Links
+ SwFldUpdateFlags eFldUpdMode; // Mode fuer Felder/Charts automatisch aktualisieren
+ RedlineMode_t eRedlineMode; // aktueller Redline Modus
+ SwCharCompressType eChrCmprType; // for ASIAN: compress punctuation/kana
+
+ sal_Int32 mReferenceCount;
+ sal_Int32 mIdleBlockCount;
+ sal_Int8 nLockExpFld; // Wenn != 0 hat UpdateExpFlds() keine Wirkung
+
+ /* Draw Model Layer IDs
+ * LayerIds, Heaven == ueber dem Dokument
+ * Hell == unter dem Dokument
+ * Controls == ganz oben
+ */
+ SdrLayerID nHeaven;
+ SdrLayerID nHell;
+ SdrLayerID nControls;
+ SdrLayerID nInvisibleHeaven;
+ SdrLayerID nInvisibleHell;
+ SdrLayerID nInvisibleControls;
+
+ bool mbGlossDoc : 1; //sal_True: ist ein Textbaustein Dokument
+ bool mbModified : 1; //sal_True: Dokument ist veraendert
+ bool mbDtor : 1; //sal_True: ist im SwDoc DTOR
+ // leider auch temporaer von
+ // SwSwgReader::InLayout(), wenn fehlerhafte
+ // Frames geloescht werden muessen
+ bool mbPageNums : 1; // TRUE: es gibt virtuelle Seitennummern
+ bool mbLoaded : 1; // TRUE: ein geladenes Doc
+ bool mbUpdateExpFld : 1; // TRUE: Expression-Felder updaten
+ bool mbNewDoc : 1; // TRUE: neues Doc
+ bool mbNewFldLst : 1; // TRUE: Felder-Liste neu aufbauen
+ bool mbCopyIsMove : 1; // TRUE: Copy ist ein verstecktes Move
+ bool mbVisibleLinks : 1; // TRUE: Links werden sichtbar eingefuegt
+ bool mbInReading : 1; // TRUE: Dokument wird gerade gelesen
+ bool mbInXMLImport : 1; // TRUE: During xml import, attribute portion building is not necessary
+ bool mbUpdateTOX : 1; // TRUE: nach Dokument laden die TOX Updaten
+ bool mbInLoadAsynchron : 1; // TRUE: Dokument wird gerade asynchron geladen
+ bool mbHTMLMode : 1; // TRUE: Dokument ist im HTMLMode
+ bool mbInCallModified : 1; // TRUE: im Set/Reset-Modified Link
+ bool mbIsGlobalDoc : 1; // TRUE: es ist ein GlobalDokument
+ bool mbGlblDocSaveLinks : 1; // TRUE: im GlobalDoc. gelinkte Sect. mit speichern
+ bool mbIsLabelDoc : 1; // TRUE: es ist ein Etiketten-Dokument
+ bool mbIsAutoFmtRedline : 1; // TRUE: die Redlines werden vom Autoformat aufgezeichnet
+ bool mbOLEPrtNotifyPending : 1; // TRUE: Printer ist geaendert und beim
+ // Erzeugen der ::com::sun::star::sdbcx::View ist eine Benachrichtigung
+ // der OLE-Objekte PrtOLENotify() notwendig.
+ bool mbAllOLENotify : 1; // True: Benachrichtigung aller Objekte ist notwendig
+ bool mbIsRedlineMove : 1; // True: die Redlines werden in/aus der Section verschoben
+ bool mbInsOnlyTxtGlssry : 1; // True: insert 'only text' glossary into doc
+ bool mbContains_MSVBasic : 1; // True: MS-VBasic exist is in our storage
+ bool mbPurgeOLE : 1; // sal_True: Purge OLE-Objects
+ bool mbKernAsianPunctuation : 1; // sal_True: kerning also for ASIAN punctuation
+ bool mbReadlineChecked : 1; // sal_True: if the query was already shown
+ bool mbLinksUpdated : 1; // OD 2005-02-11 #i38810#
+ // flag indicating, that the links have been updated.
+ bool mbClipBoard : 1; // true: this document represents the clipboard
+ bool mbColumnSelection : 1; // true: this content has bee created by a column selection
+ // (clipboard docs only)
+
+#ifdef DBG_UTIL
+ bool mbXMLExport : 1; // sal_True: during XML export
+#endif
+
+ // --> OD 2006-03-21 #b6375613#
+ // Document flag to trigger conversion, which applys the workaround for documents,
+ // which uses a certain layout defect in OOo 1.x to layout the documents.
+ // This conversion is performed, when the frames for the layout are created.
+ // Thus, this document flag has to be set after load a document and before
+ // creating the document view.
+ bool mbApplyWorkaroundForB6375613 : 1;
+ // <--
+
+ //
+ // COMPATIBILITY FLAGS START
+ //
+ //
+ // HISTORY OF THE COMPATIBILITY FLAGS:
+ //
+ // SO5:
+ // mbParaSpaceMax def = sal_False, sal_True since SO8
+ // mbParaSpaceMaxAtPages def = sal_False, sal_True since SO8
+ //
+ // SO6:
+ // mbTabCompat def = sal_False, sal_True since SO8
+ //
+ // SO7:
+ // mbUseVirtualDevice def = sal_True
+ // mbAddFlyOffsets def = sal_False, hidden
+ //
+ // SO7pp1:
+ // bOldNumbering def = sal_False, hidden
+ //
+ // SO8:
+ // mbAddExternalLeading def = sal_True
+ // mbUseHiResolutionVirtualDevice def = sal_True, hidden
+ // mbOldLineSpacing def = sal_False
+ // mbAddParaSpacingToTableCells def = sal_True
+ // mbUseFormerObjectPos def = sal_False
+ // mbUseFormerTextWrapping def = sal_False
+ // mbConsiderWrapOnObjPos def = sal_False
+ //
+ // SO8pp1:
+ // mbIgnoreFirstLineIndentInNumbering def = sal_False, hidden
+ // mbDoNotJustifyLinesWithManualBreak def = sal_False, hidden
+ // mbDoNotResetParaAttrsForNumFont def = sal_False, hidden
+ //
+ // SO8pp3
+ // mbDoNotCaptureDrawObjsOnPage def = sal_False, hidden
+ // - Relevant for drawing objects, which don't follow the text flow, but
+ // whose position is outside the page area:
+ // sal_False: Such drawing objects are captured on the page area of its anchor.
+ // sal_True: Such drawing objects can leave the page area, they aren't captured.
+ // mbTableRowKeep def = sal_False, hidden
+ // mbIgnoreTabsAndBlanksForLineCalculation def = sal_False, hidden
+ // mbClipAsCharacterAnchoredWriterFlyFrame def = sal_False, hidden
+ // - Introduced in order to re-activate clipping of as-character anchored
+ // Writer fly frames in method <SwFlyInCntFrm::MakeAll()> for documents,
+ // which are created with version prior SO8/OOo 2.0
+ //
+ // SO8pp4
+ // mbUnixForceZeroExtLeading def = sal_False, hidden
+ //
+ // SO8pu8
+ // mbOldPrinterMetrics def = sal_False, hidden
+ //
+ // SO9
+ // #i24363# tab stops relative to indent
+ // mbTabRelativeToIndent def = sal_True, hidden
+ // #i89181# suppress tab stop at left indent for paragraphs in lists, whose
+ // list level position and space mode equals LABEL_ALIGNMENT and whose list
+ // label is followed by a tab character.
+ // mbTabAtLeftIndentForParagraphsInList def = sal_False, hidden
+
+ bool mbParaSpaceMax : 1;
+ bool mbParaSpaceMaxAtPages : 1;
+ bool mbTabCompat : 1;
+ bool mbUseVirtualDevice : 1;
+ bool mbAddFlyOffsets : 1;
+ bool mbAddExternalLeading : 1;
+ bool mbUseHiResolutionVirtualDevice : 1;
+ bool mbOldLineSpacing : 1; // OD 2004-01-06 #i11859#
+ bool mbAddParaSpacingToTableCells : 1; // OD 2004-02-16 #106629#
+ bool mbUseFormerObjectPos : 1; // OD 2004-03-12 #i11860#
+ bool mbUseFormerTextWrapping : 1; // FME 2005-05-11 #108724#
+ bool mbConsiderWrapOnObjPos : 1; // OD 2004-05-05 #i28701#
+ // sal_True: object positioning algorithm has consider the wrapping style of // the floating screen objects as given by its attribute 'WrapInfluenceOnObjPos'
+ bool mbMathBaselineAlignment : 1; // TL 2010-10-29 #i972#
+
+ // non-ui-compatibility flags:
+ bool mbOldNumbering : 1; // HBRINKM #111955#
+ bool mbIgnoreFirstLineIndentInNumbering : 1; // FME 2005-05-30# i47448#
+ bool mbDoNotJustifyLinesWithManualBreak : 1; // FME 2005-06-08 #i49277#
+ bool mbDoNotResetParaAttrsForNumFont : 1; // FME 2005-08-11 #i53199#
+ bool mbTableRowKeep : 1; // FME 2006-02-10 #131283#
+ bool mbIgnoreTabsAndBlanksForLineCalculation : 1; // FME 2006-03-01 #i3952#
+ bool mbDoNotCaptureDrawObjsOnPage : 1; // OD 2006-03-14 #i62875#
+ bool mbOutlineLevelYieldsOutlineRule : 1;
+ bool mbClipAsCharacterAnchoredWriterFlyFrames : 1; // OD 2006-04-13 #b6402800#
+ bool mbUnixForceZeroExtLeading : 1; // FME 2006-10-09 #i60945#
+ bool mbOldPrinterMetrics : 1; // FME 2007-05-14 #147385#
+ bool mbTabRelativeToIndent : 1; // #i24363# tab stops relative to indent
+ bool mbProtectForm : 1;
+ bool mbTabAtLeftIndentForParagraphsInList; // OD 2008-06-05 #i89181# - see above
+
+ bool mbLastBrowseMode : 1;
+
+ // #i78591#
+ sal_uInt32 n32DummyCompatabilityOptions1;
+ sal_uInt32 n32DummyCompatabilityOptions2;
+ //
+ // COMPATIBILITY FLAGS END
+ //
+
+ sal_Bool mbStartIdleTimer ; // idle timer mode start/stop
+
+ static SwAutoCompleteWord *pACmpltWords; // Liste aller Worte fuers AutoComplete
+
+ //---------------- private Methoden ------------------------------
+ void checkRedlining(RedlineMode_t& _rReadlineMode);
+
+ DECL_LINK( AddDrawUndo, SdrUndoAction * );
+ // DrawModel
+ void DrawNotifyUndoHdl(); // wegen CLOOKs
+
+ // nur fuer den internen Gebrauch deshalb privat.
+ // Kopieren eines Bereiches im oder in ein anderes Dokument !
+ // Die Position darf nicht im Bereich liegen !!
+ bool CopyImpl( SwPaM&, SwPosition&, const bool MakeNewFrms /*= true */,
+ const bool bCopyAll, SwPaM *const pCpyRng /*= 0*/ ) const;
+
+ SwFlyFrmFmt* _MakeFlySection( const SwPosition& rAnchPos,
+ const SwCntntNode& rNode, RndStdIds eRequestId,
+ const SfxItemSet* pFlyAttrSet,
+ SwFrmFmt* = 0 );
+
+ SwFlyFrmFmt* _InsNoTxtNode( const SwPosition&rPos, SwNoTxtNode*,
+ const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet,
+ SwFrmFmt* = 0 );
+
+ void CopyFlyInFlyImpl( const SwNodeRange& rRg,
+ const xub_StrLen nEndContentIndex,
+ const SwNodeIndex& rStartIdx,
+ const bool bCopyFlyAtFly = false ) const;
+ sal_Int8 SetFlyFrmAnchor( SwFrmFmt& rFlyFmt, SfxItemSet& rSet, sal_Bool bNewFrms );
+
+ // --> OD 2005-01-13 #i40550#
+ typedef SwFmt* (SwDoc:: *FNCopyFmt)( const String&, SwFmt*, sal_Bool, sal_Bool );
+ // <--
+ SwFmt* CopyFmt( const SwFmt& rFmt, const SvPtrarr& rFmtArr,
+ FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt );
+ void CopyFmtArr( const SvPtrarr& rSourceArr, SvPtrarr& rDestArr,
+ FNCopyFmt fnCopyFmt, SwFmt& rDfltFmt );
+ void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
+ const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt );
+ SwFmt* FindFmtByName( const SvPtrarr& rFmtArr,
+ const String& rName ) const;
+
+ VirtualDevice& CreateVirtualDevice_() const;
+ SfxPrinter& CreatePrinter_() const;
+ void PrtDataChanged(); //Printer oder JobSetup geandert, es muss
+ //fuer entsprechende Invalidierungen und
+ //Benachrichtigungen gesorgt werden.
+
+ // gcc: aFtnInfo::CopyCtor ist private, also muessen wir uns auch schuetzen
+ SwDoc( const SwDoc &);
+
+ // fuer Felder:
+ void _InitFieldTypes(); // wird vom CTOR gerufen!!
+ void _MakeFldList( int eMode );
+
+ // Datenbankfelder:
+ void UpdateDBNumFlds( SwDBNameInfField& rDBFld, SwCalc& rCalc );
+ void AddUsedDBToList( SvStringsDtor& rDBNameList,
+ const SvStringsDtor& rUsedDBNames );
+ void AddUsedDBToList( SvStringsDtor& rDBNameList, const String& rDBName );
+ sal_Bool IsNameInArray( const SvStringsDtor& rOldNames, const String& rName );
+ void GetAllDBNames( SvStringsDtor& rAllDBNames );
+ void ReplaceUsedDBs( const SvStringsDtor& rUsedDBNames,
+ const String& rNewName, String& rFormel );
+ SvStringsDtor& FindUsedDBs( const SvStringsDtor& rAllDBNames,
+ const String& rFormel,
+ SvStringsDtor& rUsedDBNames );
+
+ void InitDrawModel();
+ void ReleaseDrawModel();
+
+ void _CreateNumberFormatter();
+
+ sal_Bool _UnProtectTblCells( SwTable& rTbl );
+
+ // erzeuge Anhand der vorgebenen Collection Teildokumente
+ // falls keine angegeben ist, nehme die Kapitelvorlage der 1. Ebene
+ sal_Bool SplitDoc( sal_uInt16 eDocType, const String& rPath,
+ const SwTxtFmtColl* pSplitColl );
+ sal_Bool SplitDoc( sal_uInt16 eDocType, const String& rPath, int nOutlineLevel = 0 ); //#outline level,add by zhaijianwei.
+
+
+ // Charts der angegebenen Tabelle updaten
+ void _UpdateCharts( const SwTable& rTbl, ViewShell& rVSh ) const;
+
+ sal_Bool _SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rRubyEntry,
+ sal_uInt16 nMode );
+
+ // unser eigener 'IdlTimer' ruft folgende Methode
+ DECL_LINK( DoIdleJobs, Timer * );
+ // der CharTimer ruft diese Methode
+ DECL_LINK( DoUpdateAllCharts, Timer * );
+ DECL_LINK( DoUpdateModifiedOLE, Timer * );
+
+ SwFmt *_MakeCharFmt(const String &, SwFmt *, sal_Bool, sal_Bool );
+ SwFmt *_MakeFrmFmt(const String &, SwFmt *, sal_Bool, sal_Bool );
+ SwFmt *_MakeTxtFmtColl(const String &, SwFmt *, sal_Bool, sal_Bool );
+
+ void InitTOXTypes();
+ void Paste( const SwDoc& );
+ bool DeleteAndJoinImpl(SwPaM&, const bool);
+ bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false);
+ bool DeleteRangeImpl(SwPaM&, const bool unused = false);
+ bool DeleteRangeImplImpl(SwPaM &);
+ bool ReplaceRangeImpl(SwPaM&, String const&, const bool);
+
+public:
+
+ /** Life cycle
+ */
+ SwDoc();
+ ~SwDoc();
+
+ inline bool IsInDtor() const { return mbDtor; }
+
+ /* @@@MAINTAINABILITY-HORROR@@@
+ Implementation details made public.
+ */
+ SwNodes & GetNodes() { return *m_pNodes; }
+ SwNodes const& GetNodes() const { return *m_pNodes; }
+
+ /** IInterface
+ */
+ virtual sal_Int32 acquire();
+ virtual sal_Int32 release();
+ virtual sal_Int32 getReferenceCount() const;
+
+ /** IDocumentSettingAccess
+ */
+ virtual bool get(/*[in]*/ DocumentSettingId id) const;
+ virtual void set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value);
+ virtual const com::sun::star::i18n::ForbiddenCharacters* getForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ bool bLocaleData ) const;
+ virtual void setForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ const com::sun::star::i18n::ForbiddenCharacters& rForbiddenCharacters );
+ virtual vos::ORef<SvxForbiddenCharactersTable>& getForbiddenCharacterTable();
+ virtual const vos::ORef<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() const;
+ virtual sal_uInt16 getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const;
+ virtual void setLinkUpdateMode( /*[in]*/ sal_uInt16 nMode );
+ virtual SwFldUpdateFlags getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const;
+ virtual void setFieldUpdateFlags( /*[in]*/ SwFldUpdateFlags eMode );
+ virtual SwCharCompressType getCharacterCompressionType() const;
+ virtual void setCharacterCompressionType( /*[in]*/SwCharCompressType nType );
+
+ /** IDocumentDeviceAccess
+ */
+ virtual SfxPrinter* getPrinter(/*[in]*/ bool bCreate ) const;
+ virtual void setPrinter(/*[in]*/ SfxPrinter* pP,/*[in]*/ bool bDeleteOld,/*[in]*/ bool bCallPrtDataChanged );
+ virtual VirtualDevice* getVirtualDevice(/*[in]*/ bool bCreate ) const;
+ virtual void setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*/ bool bDeleteOld, /*[in]*/ bool bCallVirDevDataChanged );
+ virtual OutputDevice* getReferenceDevice(/*[in]*/ bool bCreate ) const;
+ virtual void setReferenceDeviceType(/*[in]*/ bool bNewVirtual,/*[in]*/ bool bNewHiRes );
+ virtual const JobSetup* getJobsetup() const;
+ virtual void setJobsetup(/*[in]*/ const JobSetup& rJobSetup );
+ virtual const SwPrintData & getPrintData() const;
+ virtual void setPrintData(/*[in]*/ const SwPrintData& rPrtData);
+
+ /** IDocumentMarkAccess
+ */
+ IDocumentMarkAccess* getIDocumentMarkAccess();
+ const IDocumentMarkAccess* getIDocumentMarkAccess() const;
+
+ /** IDocumentRedlineAccess
+ */
+ virtual RedlineMode_t GetRedlineMode() const;
+ virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode);
+ virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode);
+ virtual bool IsRedlineOn() const;
+ virtual bool IsIgnoreRedline() const;
+ virtual bool IsInRedlines(const SwNode& rNode) const;
+ virtual const SwRedlineTbl& GetRedlineTbl() const;
+ virtual bool AppendRedline(/*[in]*/SwRedline* pPtr, /*[in]*/bool bCallDelete);
+ virtual bool SplitRedline(const SwPaM& rPam);
+ virtual bool DeleteRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType);
+ virtual bool DeleteRedline(/*[in]*/const SwStartNode& rSection, /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType);
+ virtual sal_uInt16 GetRedlinePos(/*[in]*/const SwNode& rNode, /*[in]*/sal_uInt16 nType) const;
+ virtual void CompressRedlines();
+ virtual const SwRedline* GetRedline(/*[in]*/const SwPosition& rPos, /*[in]*/sal_uInt16* pFndPos) const;
+ virtual bool IsRedlineMove() const;
+ virtual void SetRedlineMove(/*[in]*/bool bFlag);
+ virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete);
+ virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete);
+ virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete);
+ virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete);
+ virtual const SwRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const;
+ virtual const SwRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const;
+ virtual void UpdateRedlineAttr();
+ virtual sal_uInt16 GetRedlineAuthor();
+ virtual sal_uInt16 InsertRedlineAuthor(const String& rAuthor);
+ virtual bool SetRedlineComment(/*[in]*/const SwPaM& rPam, /*[in]*/const String& rComment);
+ virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const;
+ virtual void SetRedlinePassword(/*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword);
+
+ /** IDocumentUndoRedo
+ */
+ IDocumentUndoRedo & GetIDocumentUndoRedo();
+ IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
+
+ /** IDocumentLinksAdministration
+ */
+ virtual bool IsVisibleLinks() const;
+ virtual void SetVisibleLinks(bool bFlag);
+ virtual sfx2::LinkManager& GetLinkManager();
+ virtual const sfx2::LinkManager& GetLinkManager() const;
+ virtual void UpdateLinks(sal_Bool bUI);
+ virtual bool GetData(const String& rItem, const String& rMimeType, ::com::sun::star::uno::Any& rValue) const;
+ virtual bool SetData(const String& rItem, const String& rMimeType, const ::com::sun::star::uno::Any& rValue);
+ virtual ::sfx2::SvLinkSource* CreateLinkSource(const String& rItem);
+ virtual bool EmbedAllLinks();
+ virtual void SetLinksUpdated(const bool bNewLinksUpdated);
+ virtual bool LinksUpdated() const;
+
+ /** IDocumentFieldsAccess
+ */
+ virtual const SwFldTypes *GetFldTypes() const;
+ virtual SwFieldType *InsertFldType(const SwFieldType &);
+ virtual SwFieldType *GetSysFldType( const sal_uInt16 eWhich ) const;
+ virtual SwFieldType* GetFldType(sal_uInt16 nResId, const String& rName, bool bDbFieldMatching) const;
+ virtual void RemoveFldType(sal_uInt16 nFld);
+ virtual void UpdateFlds( SfxPoolItem* pNewHt, bool bCloseDB);
+ virtual void InsDeletedFldType(SwFieldType &);
+ virtual bool PutValueToField(const SwPosition & rPos, const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich);
+ virtual bool UpdateFld(SwTxtFld * rDstFmtFld, SwField & rSrcFld, SwMsgPoolItem * pMsgHnt, bool bUpdateTblFlds);
+ virtual void UpdateRefFlds(SfxPoolItem* pHt);
+ virtual void UpdateTblFlds(SfxPoolItem* pHt);
+ virtual void UpdateExpFlds(SwTxtFld* pFld, bool bUpdateRefFlds);
+ virtual void UpdateUsrFlds();
+ virtual void UpdatePageFlds(SfxPoolItem*);
+ virtual void LockExpFlds();
+ virtual void UnlockExpFlds();
+ virtual bool IsExpFldsLocked() const;
+ virtual SwDocUpdtFld& GetUpdtFlds() const;
+ virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen);
+ virtual void SetFixFields(bool bOnlyTimeDate, const DateTime* pNewDateTime);
+ virtual void FldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt);
+ virtual void FldsToCalc(SwCalc& rCalc, const _SetGetExpFld& rToThisFld);
+ virtual void FldsToExpand(SwHash**& ppTbl, sal_uInt16& rTblSize, const _SetGetExpFld& rToThisFld);
+ virtual bool IsNewFldLst() const;
+ virtual void SetNewFldLst( bool bFlag);
+ virtual void InsDelFldInFldLst(bool bIns, const SwTxtFld& rFld);
+
+ /** Returns the field at a certain position.
+ @param rPos position to search at
+ @return pointer to field at the given position or NULL in case no field is found
+ */
+ static SwField* GetField(const SwPosition& rPos);
+
+ /** Returns the field at a certain position.
+ @param rPos position to search at
+ @return pointer to field at the given position or NULL in case no field is found
+ */
+ static SwTxtFld* GetTxtFld(const SwPosition& rPos);
+
+ /** IDocumentContentOperations
+ */
+ virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll) const;
+ virtual void DeleteSection(SwNode* pNode);
+ virtual bool DeleteRange(SwPaM&);
+ virtual bool DelFullPara(SwPaM&);
+ // --> OD 2009-08-20 #i100466#
+ // Add optional parameter <bForceJoinNext>, default value <false>
+ // Needed for hiding of deletion redlines
+ virtual bool DeleteAndJoin( SwPaM&,
+ const bool bForceJoinNext = false );
+ // <--
+ virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags);
+ virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags);
+ virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags);
+ virtual bool Overwrite(const SwPaM &rRg, const String& rStr);
+ virtual bool InsertString(const SwPaM &rRg, const String&,
+ const enum InsertFlags nInsertMode = INS_EMPTYEXPAND );
+ virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic,
+ const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
+ virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
+ virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*);
+ virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
+ virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
+ const SetAttrMode nFlags);
+ virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
+ const SetAttrMode nFlags);
+ virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj);
+ virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&);
+ virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
+ virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart);
+ virtual bool AppendTxtNode(SwPosition& rPos);
+ virtual void SetModified(SwPaM &rPaM);
+ virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr,
+ const bool bRegExReplace);
+ virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos );
+
+ /** IDocumentStylePoolAccess
+ */
+ virtual SwTxtFmtColl* GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage = true );
+ virtual SwFmt* GetFmtFromPool( sal_uInt16 nId );
+ virtual SwFrmFmt* GetFrmFmtFromPool( sal_uInt16 nId );
+ virtual SwCharFmt* GetCharFmtFromPool( sal_uInt16 nId );
+ virtual SwPageDesc* GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage = true );
+ virtual SwNumRule* GetNumRuleFromPool( sal_uInt16 nId );
+ virtual bool IsPoolTxtCollUsed( sal_uInt16 nId ) const;
+ virtual bool IsPoolFmtUsed( sal_uInt16 nId ) const;
+ virtual bool IsPoolPageDescUsed( sal_uInt16 nId ) const;
+
+ /** IDocumentLineNumberAccess
+ */
+ virtual const SwLineNumberInfo& GetLineNumberInfo() const;
+ virtual void SetLineNumberInfo(const SwLineNumberInfo& rInfo);
+
+ /** IDocumentStatistics
+ */
+ virtual void DocInfoChgd();
+ virtual const SwDocStat &GetDocStat() const;
+ virtual void SetDocStat(const SwDocStat& rStat);
+ virtual void UpdateDocStat(SwDocStat& rStat);
+
+ /** IDocumentState
+ */
+ virtual void SetModified();
+ virtual void ResetModified();
+ virtual bool IsModified() const;
+ virtual bool IsLoaded() const;
+ virtual bool IsUpdateExpFld() const;
+ virtual bool IsNewDoc() const;
+ virtual bool IsPageNums() const;
+ virtual void SetPageNums(bool b);
+ virtual void SetNewDoc(bool b);
+ virtual void SetUpdateExpFldStat(bool b);
+ virtual void SetLoaded(bool b);
+
+ /** IDocumentDrawModelAccess
+ */
+ virtual const SdrModel* GetDrawModel() const;
+ virtual SdrModel* GetDrawModel();
+ virtual SdrLayerID GetHeavenId() const;
+ virtual SdrLayerID GetHellId() const;
+ virtual SdrLayerID GetControlsId() const;
+ virtual SdrLayerID GetInvisibleHeavenId() const;
+ virtual SdrLayerID GetInvisibleHellId() const;
+ virtual SdrLayerID GetInvisibleControlsId() const;
+ virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView );
+ virtual bool IsVisibleLayerId( const SdrLayerID& _nLayerId ) const;
+ virtual SdrLayerID GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId );
+ virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId );
+ virtual SdrModel* _MakeDrawModel();
+ virtual SdrModel* GetOrCreateDrawModel();
+
+ /** IDocumentLayoutAccess
+ */
+ virtual void SetCurrentViewShell( ViewShell* pNew );//swmod 071225
+ virtual SwLayouter* GetLayouter();
+ virtual const SwLayouter* GetLayouter() const;
+ virtual void SetLayouter( SwLayouter* pNew );
+ virtual SwFrmFmt* MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet );
+ virtual void DelLayoutFmt( SwFrmFmt *pFmt );
+ virtual SwFrmFmt* CopyLayoutFmt( const SwFrmFmt& rSrc, const SwFmtAnchor& rNewAnchor, bool bSetTxtFlyAtt, bool bMakeFrms );
+ virtual const ViewShell *GetCurrentViewShell() const; //swmod 080219
+ virtual ViewShell *GetCurrentViewShell();//swmod 080219 It must be able to communicate to a ViewShell.This is going to be removerd later.
+ virtual const SwRootFrm *GetCurrentLayout() const;
+ virtual SwRootFrm *GetCurrentLayout();//swmod 080219
+ virtual bool HasLayout() const;
+
+ /** IDocumentTimerAccess
+ */
+ virtual void StartIdling();
+ virtual void StopIdling();
+ virtual void BlockIdling();
+ virtual void UnblockIdling();
+
+ /** IDocumentChartDataProviderAccess
+ */
+ virtual SwChartDataProvider * GetChartDataProvider( bool bCreate = false ) const;
+ virtual void CreateChartInternalDataProviders( const SwTable *pTable );
+ virtual SwChartLockController_Helper & GetChartControllerHelper();
+
+ /** IDocumentListItems
+
+ OD 2007-10-26 #i83479#
+ */
+ virtual void addListItem( const SwNodeNum& rNodeNum );
+ virtual void removeListItem( const SwNodeNum& rNodeNum );
+ virtual String getListItemText( const SwNodeNum& rNodeNum,
+ const bool bWithNumber = true,
+ const bool bWithSpacesForLevel = false ) const;
+ virtual void getListItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const;
+ virtual void getNumItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const;
+
+ /** IDocumentOutlineNodes
+
+ OD 2007-11-15 #i83479#
+ */
+ virtual sal_Int32 getOutlineNodesCount() const;
+ virtual int getOutlineLevel( const sal_Int32 nIdx ) const;
+ virtual String getOutlineText( const sal_Int32 nIdx,
+ const bool bWithNumber,
+ const bool bWithSpacesForLevel ) const;
+ virtual SwTxtNode* getOutlineNode( const sal_Int32 nIdx ) const;
+ virtual void getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const;
+
+ /** IDocumentListsAccess
+
+ OD 2008-03-26 #refactorlists#
+ */
+ virtual SwList* createList( String sListId,
+ const String sDefaultListStyleName );
+ virtual void deleteList( const String sListId );
+ virtual SwList* getListByName( const String sListId ) const;
+ virtual SwList* createListForListStyle( const String sListStyleName );
+ virtual SwList* getListForListStyle( const String sListStyleName ) const;
+ virtual void deleteListForListStyle( const String sListStyleName );
+ // --> OD 2008-07-08 #i91400#
+ virtual void trackChangeOfListStyleName( const String sListStyleName,
+ const String sNewListStyleName );
+ // <--
+
+ /** IDocumentExternalData */
+ virtual void setExternalData(::sw::tExternalDataType eType,
+ ::sw::tExternalDataPointer pPayload);
+ virtual ::sw::tExternalDataPointer getExternalData(::sw::tExternalDataType eType);
+
+
+ /** INextInterface here
+ */
+
+ DECL_STATIC_LINK( SwDoc, BackgroundDone, SvxBrushItem *);
+ DECL_LINK(CalcFieldValueHdl, EditFieldInfo*);
+
+ /** OLE ???
+ */
+ bool IsOLEPrtNotifyPending() const { return mbOLEPrtNotifyPending; }
+ inline void SetOLEPrtNotifyPending( bool bSet = true );
+ void PrtOLENotify( sal_Bool bAll ); //Alle oder nur Markierte
+
+#ifdef DBG_UTIL
+ bool InXMLExport() const { return mbXMLExport; }
+ void SetXMLExport( bool bFlag ) { mbXMLExport = bFlag; }
+#endif
+
+ // liefert zu allen fliegenden Rahmen die Position im Dokument.
+ // Wird ein Pam-Pointer uebergeben, muessen die absatzgebundenen
+ // FlyFrames von der ::com::sun::star::awt::Selection vollstaendig umschlossen sein
+ // ( Start < Pos < End ) !!!
+ // (wird fuer die Writer benoetigt)
+ void GetAllFlyFmts( SwPosFlyFrms& rPosFlyFmts, const SwPaM* = 0,
+ sal_Bool bDrawAlso = sal_False ) const;
+
+ // wegen swrtf.cxx und define private public, jetzt hier
+ SwFlyFrmFmt *MakeFlyFrmFmt (const String &rFmtName, SwFrmFmt *pDerivedFrom);
+ SwDrawFrmFmt *MakeDrawFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom);
+
+ // JP 08.05.98: fuer Flys muss jetzt diese Schnittstelle benutzt
+ // werden. pAnchorPos muss gesetzt sein, wenn keine
+ // Seitenbindung vorliegt UND der ::com::sun::star::chaos::Anchor nicht schon
+ // im FlySet/FrmFmt mit gueltiger CntntPos gesetzt ist
+ /* #109161# new parameter bCalledFromShell
+
+ sal_True: An existing adjust item at pAnchorPos is propagated to
+ the content node of the new fly section. That propagation only
+ takes place if there is no adjust item in the paragraph style
+ for the new fly section.
+
+ sal_False: no propagation
+ */
+ SwFlyFrmFmt* MakeFlySection( RndStdIds eAnchorType,
+ const SwPosition* pAnchorPos,
+ const SfxItemSet* pSet = 0,
+ SwFrmFmt *pParent = 0,
+ sal_Bool bCalledFromShell = sal_False );
+ SwFlyFrmFmt* MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
+ const SwSelBoxes* pSelBoxes = 0,
+ SwFrmFmt *pParent = 0 );
+
+ void CopyWithFlyInFly( const SwNodeRange& rRg,
+ const xub_StrLen nEndContentIndex,
+ const SwNodeIndex& rInsPos,
+ sal_Bool bMakeNewFrms = sal_True,
+ sal_Bool bDelRedlines = sal_True,
+ sal_Bool bCopyFlyAtFly = sal_False ) const;
+
+ sal_Bool SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet );
+
+ sal_Bool SetFrmFmtToFly( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFmt,
+ SfxItemSet* pSet = 0, sal_Bool bKeepOrient = sal_False );
+ // --> OD 2009-07-20 #i73249#
+ void SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt,
+ const String& sNewTitle );
+ void SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt,
+ const String& sNewDescription );
+ // <--
+
+ /** Footnotes
+ */
+ // Fussnoten Informationen
+ const SwFtnInfo& GetFtnInfo() const { return *pFtnInfo; }
+ void SetFtnInfo(const SwFtnInfo& rInfo);
+ const SwEndNoteInfo& GetEndNoteInfo() const { return *pEndNoteInfo; }
+ void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
+ SwFtnIdxs& GetFtnIdxs() { return *pFtnIdxs; }
+ const SwFtnIdxs& GetFtnIdxs() const { return *pFtnIdxs; }
+ // change footnotes in area
+ bool SetCurFtn( const SwPaM& rPam, const String& rNumStr,
+ sal_uInt16 nNumber, bool bIsEndNote );
+
+ /** Operations on the content of the document e.g.
+ spell-checking/hyphenating/word-counting
+ */
+ ::com::sun::star::uno::Any
+ Spell( SwPaM&, ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &,
+ sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck,
+ SwConversionArgs *pConvArgs = 0 ) const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord >
+ Hyphenate( SwPaM *pPam, const Point &rCrsrPos,
+ sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
+
+ // count words in pam
+ void CountWords( const SwPaM& rPaM, SwDocStat& rStat ) const;
+
+
+ /** ???
+ */
+ // Textbaustein Dokument?
+ void SetGlossDoc( bool bGlssDc = true ) { mbGlossDoc = bGlssDc; }
+ bool IsInsOnlyTextGlossary() const { return mbInsOnlyTxtGlssry; }
+
+ // Abstakt fuellen
+ void Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, sal_Bool bImpress );
+
+ void ChangeAuthorityData(const SwAuthEntry* pNewData);
+
+ bool IsInCallModified() const { return mbInCallModified; }
+ sal_Bool IsInHeaderFooter( const SwNodeIndex& rIdx ) const;
+ short GetTextDirection( const SwPosition& rPos,
+ const Point* pPt = 0 ) const;
+ sal_Bool IsInVerticalText( const SwPosition& rPos,
+ const Point* pPt = 0 ) const;
+ /** Database ???
+ */
+
+ /* Datenbank && DB-Manager */
+ void SetNewDBMgr( SwNewDBMgr* pNewMgr ) { pNewDBMgr = pNewMgr; }
+ SwNewDBMgr* GetNewDBMgr() const { return pNewDBMgr; }
+ void ChangeDBFields( const SvStringsDtor& rOldNames,
+ const String& rNewName );
+ void SetInitDBFields(sal_Bool b);
+ // Von Feldern verwendete Datenbanken herausfinden
+ void GetAllUsedDB( SvStringsDtor& rDBNameList,
+ const SvStringsDtor* pAllDBNames = 0 );
+
+ void ChgDBData( const SwDBData& rNewData );
+ SwDBData GetDBData();
+ const SwDBData& GetDBDesc();
+ const SwDBData& _GetDBDesc() const { return aDBData; }
+
+ /** Some helper functions
+ */
+ String GetUniqueGrfName() const;
+ String GetUniqueOLEName() const;
+ String GetUniqueFrameName() const;
+
+ std::set<SwRootFrm*> GetAllLayouts();//swmod 080225
+
+ void SetFlyName( SwFlyFrmFmt& rFmt, const String& rName );
+ const SwFlyFrmFmt* FindFlyByName( const String& rName, sal_Int8 nNdTyp = 0 ) const;
+
+ void GetGrfNms( const SwFlyFrmFmt& rFmt, String* pGrfName,
+ String* pFltName ) const;
+
+ // setze bei allen Flys ohne Namen einen gueltigen (Wird von den Readern
+ // nach dem Einlesen gerufen )
+ void SetAllUniqueFlyNames();
+
+ //Zuruecksetzen der Attribute; es werden alle TxtHints und bei
+ //vollstaendiger Selektion harte Formatierung (AUTO-Formate) entfernt
+ // --> OD 2008-11-28 #i96644#
+ // introduce new optional parameter <bSendDataChangedEvents> in order to
+ // control, if the side effect "send data changed events" is triggered or not.
+ void ResetAttrs( const SwPaM &rRg,
+ sal_Bool bTxtAttr = sal_True,
+ const SvUShortsSort* = 0,
+ const bool bSendDataChangedEvents = true );
+ // <--
+ void RstTxtAttrs(const SwPaM &rRg, sal_Bool bInclRefToxMark = sal_False );
+
+ // Setze das Attribut im angegebenen Format. Ist Undo aktiv, wird
+ // das alte in die Undo-History aufgenommen
+ void SetAttr( const SfxPoolItem&, SwFmt& );
+ void SetAttr( const SfxItemSet&, SwFmt& );
+
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ // method to reset a certain attribute at the given format
+ void ResetAttrAtFormat( const sal_uInt16 nWhichId,
+ SwFmt& rChangedFormat );
+ // <--
+
+ // Setze das Attribut als neues default Attribut in diesem Dokument.
+ // Ist Undo aktiv, wird das alte in die Undo-History aufgenommen
+ void SetDefault( const SfxPoolItem& );
+ void SetDefault( const SfxItemSet& );
+
+ // Erfrage das Default Attribut in diesem Dokument.
+ const SfxPoolItem& GetDefault( sal_uInt16 nFmtHint ) const;
+ // TextAttribute nicht mehr aufspannen lassen
+ sal_Bool DontExpandFmt( const SwPosition& rPos, sal_Bool bFlag = sal_True );
+
+ /* Formate */
+ const SwFrmFmts* GetFrmFmts() const { return pFrmFmtTbl; }
+ SwFrmFmts* GetFrmFmts() { return pFrmFmtTbl; }
+ const SwCharFmts* GetCharFmts() const { return pCharFmtTbl;}
+
+ /* LayoutFormate (Rahmen, DrawObjecte), mal const mal nicht */
+ const SwSpzFrmFmts* GetSpzFrmFmts() const { return pSpzFrmFmtTbl; }
+ SwSpzFrmFmts* GetSpzFrmFmts() { return pSpzFrmFmtTbl; }
+
+ const SwFrmFmt *GetDfltFrmFmt() const { return pDfltFrmFmt; }
+ SwFrmFmt *GetDfltFrmFmt() { return pDfltFrmFmt; }
+ const SwFrmFmt *GetEmptyPageFmt() const { return pEmptyPageFmt; }
+ SwFrmFmt *GetEmptyPageFmt() { return pEmptyPageFmt; }
+ const SwFrmFmt *GetColumnContFmt() const{ return pColumnContFmt; }
+ SwFrmFmt *GetColumnContFmt() { return pColumnContFmt; }
+ const SwCharFmt *GetDfltCharFmt() const { return pDfltCharFmt;}
+ SwCharFmt *GetDfltCharFmt() { return pDfltCharFmt;}
+
+ // Returns the interface of the management of (auto)styles
+ IStyleAccess& GetIStyleAccess() { return *pStyleAccess; }
+
+ // Remove all language dependencies from all existing formats
+ void RemoveAllFmtLanguageDependencies();
+
+ SwFrmFmt *MakeFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom,
+ sal_Bool bBroadcast = sal_False, sal_Bool bAuto = sal_True);
+ void DelFrmFmt( SwFrmFmt *pFmt, sal_Bool bBroadcast = sal_False );
+ SwFrmFmt* FindFrmFmtByName( const String& rName ) const
+ { return (SwFrmFmt*)FindFmtByName( (SvPtrarr&)*pFrmFmtTbl, rName ); }
+
+ // --> OD 2005-01-13 #i40550#
+ SwCharFmt *MakeCharFmt(const String &rFmtName, SwCharFmt *pDerivedFrom,
+ sal_Bool bBroadcast = sal_False,
+ sal_Bool bAuto = sal_True );
+ // <--
+ void DelCharFmt(sal_uInt16 nFmt, sal_Bool bBroadcast = sal_False);
+ void DelCharFmt(SwCharFmt* pFmt, sal_Bool bBroadcast = sal_False);
+ SwCharFmt* FindCharFmtByName( const String& rName ) const
+ { return (SwCharFmt*)FindFmtByName( (SvPtrarr&)*pCharFmtTbl, rName ); }
+
+ /* Formatcollections (Vorlagen) */
+ // TXT
+ const SwTxtFmtColl* GetDfltTxtFmtColl() const { return pDfltTxtFmtColl; }
+ const SwTxtFmtColls *GetTxtFmtColls() const { return pTxtFmtCollTbl; }
+ // --> OD 2005-01-13 #i40550#
+ SwTxtFmtColl *MakeTxtFmtColl( const String &rFmtName,
+ SwTxtFmtColl *pDerivedFrom,
+ sal_Bool bBroadcast = sal_False,
+ sal_Bool bAuto = sal_True );
+ // <--
+ SwConditionTxtFmtColl* MakeCondTxtFmtColl( const String &rFmtName,
+ SwTxtFmtColl *pDerivedFrom,
+ sal_Bool bBroadcast = sal_False);
+ void DelTxtFmtColl(sal_uInt16 nFmt, sal_Bool bBroadcast = sal_False);
+ void DelTxtFmtColl( SwTxtFmtColl* pColl, sal_Bool bBroadcast = sal_False );
+ // --> OD 2007-11-06 #i62675#
+ // Add 4th optional parameter <bResetListAttrs>.
+ // 'side effect' of <SetTxtFmtColl> with <bReset = true> is that the hard
+ // attributes of the affected text nodes are cleared, except the break
+ // attribute, the page description attribute and the list style attribute.
+ // The new parameter <bResetListAttrs> indicates, if the list attributes
+ // (list style, restart at and restart with) are cleared as well in case
+ // that <bReset = true> and the paragraph style has a list style attribute set.
+ sal_Bool SetTxtFmtColl( const SwPaM &rRg, SwTxtFmtColl *pFmt,
+ bool bReset = true,
+ bool bResetListAttrs = false );
+ // <--
+ SwTxtFmtColl* FindTxtFmtCollByName( const String& rName ) const
+ { return (SwTxtFmtColl*)FindFmtByName( (SvPtrarr&)*pTxtFmtCollTbl, rName ); }
+
+ void ChkCondColls();
+
+ // GRF
+ const SwGrfFmtColl* GetDfltGrfFmtColl() const { return pDfltGrfFmtColl; }
+ const SwGrfFmtColls *GetGrfFmtColls() const { return pGrfFmtCollTbl; }
+ SwGrfFmtColl *MakeGrfFmtColl(const String &rFmtName,
+ SwGrfFmtColl *pDerivedFrom);
+ SwGrfFmtColl* FindGrfFmtCollByName( const String& rName ) const
+ { return (SwGrfFmtColl*)FindFmtByName( (SvPtrarr&)*pGrfFmtCollTbl, rName ); }
+
+ // Tabellen-Formate
+ const SwFrmFmts* GetTblFrmFmts() const { return pTblFrmFmtTbl; }
+ SwFrmFmts* GetTblFrmFmts() { return pTblFrmFmtTbl; }
+ sal_uInt16 GetTblFrmFmtCount( sal_Bool bUsed ) const;
+ SwFrmFmt& GetTblFrmFmt(sal_uInt16 nFmt, sal_Bool bUsed ) const;
+ SwTableFmt* MakeTblFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom);
+ void DelTblFrmFmt( SwTableFmt* pFmt );
+ SwTableFmt* FindTblFmtByName( const String& rName, sal_Bool bAll = sal_False ) const;
+
+ //Rahmenzugriff
+ //iterieren ueber Flys - fuer Basic-Collections
+ sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL) const;
+ SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL);
+
+
+ // kopiere die Formate in die eigenen Arrays und returne diese
+ SwFrmFmt *CopyFrmFmt ( const SwFrmFmt& );
+ SwCharFmt *CopyCharFmt( const SwCharFmt& );
+ SwTxtFmtColl* CopyTxtColl( const SwTxtFmtColl& rColl );
+ SwGrfFmtColl* CopyGrfColl( const SwGrfFmtColl& rColl );
+
+ // ersetze alle Formate mit denen aus rSource
+ void ReplaceStyles( SwDoc& rSource );
+
+ // erfrage ob die Absatz-/Zeichen-/Rahmen-/Seiten - Vorlage benutzt wird
+ sal_Bool IsUsed( const SwModify& ) const;
+ sal_Bool IsUsed( const SwNumRule& ) const;
+
+ // setze den Namen der neu geladenen Dokument-Vorlage
+ sal_uInt16 SetDocPattern( const String& rPatternName );
+ // gebe den Dok-VorlagenNamen zurueck. !!! Kann auch 0 sein !!!
+ String* GetDocPattern( sal_uInt16 nPos ) const { return aPatternNms[nPos]; }
+
+ // Loesche alle nicht referenzierten FeldTypen
+ void GCFieldTypes(); // impl. in docfld.cxx
+
+ // akt. Dokument mit Textbausteindokument verbinden/erfragen
+ void SetGlossaryDoc( SwDoc* pDoc ) { pGlossaryDoc = pDoc; }
+
+ // travel over PaM Ring
+ sal_Bool InsertGlossary( SwTextBlocks& rBlock, const String& rEntry,
+ SwPaM& rPaM, SwCrsrShell* pShell = 0);
+
+ // get the set of printable pages for the XRenderable API by
+ // evaluating the respective settings (see implementation)
+ void CalculatePagesForPrinting( const SwRootFrm& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
+ sal_Int32 nDocPageCount );
+ void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
+ sal_Int32 nDocPageCount );
+ void CalculatePagePairsForProspectPrinting( const SwRootFrm& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions,
+ sal_Int32 nDocPageCount );
+
+ //PageDescriptor-Schnittstelle
+ sal_uInt16 GetPageDescCnt() const { return aPageDescs.Count(); }
+ const SwPageDesc& GetPageDesc( const sal_uInt16 i ) const { return *aPageDescs[i]; }
+ SwPageDesc* FindPageDescByName( const String& rName,
+ sal_uInt16* pPos = 0 ) const;
+
+ // kopiere den gesamten PageDesc - ueber Dokumentgrenzen und "tief"!
+ // optional kann das kopieren der PoolFmtId, -HlpId verhindert werden
+ void CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
+ sal_Bool bCopyPoolIds = sal_True );
+
+ // kopiere die Kopzeile (mit dem Inhalt!) aus dem SrcFmt
+ // ins DestFmt ( auch ueber Doc grenzen hinaus!)
+ void CopyHeader( const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
+ { CopyPageDescHeaderFooterImpl( true, rSrcFmt, rDestFmt ); }
+ // kopiere die Fusszeile (mit dem Inhalt!) aus dem SrcFmt
+ // ins DestFmt ( auch ueber Doc grenzen hinaus!)
+ void CopyFooter( const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
+ { CopyPageDescHeaderFooterImpl( false, rSrcFmt, rDestFmt ); }
+
+ //fuer Reader
+
+ SwPageDesc * GetPageDesc( const String & rName );
+ SwPageDesc& _GetPageDesc( sal_uInt16 i ) const { return *aPageDescs[i]; }
+ void ChgPageDesc( const String & rName, const SwPageDesc& );
+ void ChgPageDesc( sal_uInt16 i, const SwPageDesc& );
+ sal_Bool FindPageDesc( const String & rName, sal_uInt16 * pFound );
+ // -> #116530#
+ void DelPageDesc( const String & rName, sal_Bool bBroadcast = sal_False);
+ void DelPageDesc( sal_uInt16 i, sal_Bool bBroadcast = sal_False );
+ // <- #116530#
+ void PreDelPageDesc(SwPageDesc * pDel); // #i7983#
+ // -> #116530#
+ sal_uInt16 MakePageDesc( const String &rName, const SwPageDesc* pCpy = 0,
+ sal_Bool bRegardLanguage = sal_True,
+ sal_Bool bBroadcast = sal_False);
+ void BroadcastStyleOperation(String rName, SfxStyleFamily eFamily,
+ sal_uInt16 nOp);
+ // <- #116530#
+
+
+ // --> FME 2005-03-16 #i44963# The html import sometimes overwrites the
+ // page sizes set in the page descriptions. This function is used to
+ // correct this.
+ void CheckDefaultPageFmt();
+ // <--
+
+ // Methoden fuer die Verzeichnisse:
+ // - Verzeichnismarke einfuegen loeschen travel
+ sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& ) const;
+ void DeleteTOXMark( const SwTOXMark* pTOXMark );
+ const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark,
+ SwTOXSearch eDir, sal_Bool bInReadOnly );
+
+ // - Verzeichnis einfuegen, und bei Bedarf erneuern
+ const SwTOXBaseSection* InsertTableOf( const SwPosition& rPos,
+ const SwTOXBase& rTOX,
+ const SfxItemSet* pSet = 0,
+ sal_Bool bExpand = sal_False );
+ const SwTOXBaseSection* InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd,
+ const SwTOXBase& rTOX,
+ const SfxItemSet* pSet = 0 );
+ const SwTOXBase* GetCurTOX( const SwPosition& rPos ) const;
+ const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX) const;
+
+ sal_Bool DeleteTOX( const SwTOXBase& rTOXBase, sal_Bool bDelNodes = sal_False );
+ String GetUniqueTOXBaseName( const SwTOXType& rType,
+ const String* pChkStr = 0 ) const;
+
+ sal_Bool SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName);
+ void SetTOXBaseProtection(const SwTOXBase& rTOXBase, sal_Bool bProtect);
+
+ // nach einlesen einer Datei alle Verzeichnisse updaten
+ void SetUpdateTOX( bool bFlag = true ) { mbUpdateTOX = bFlag; }
+ bool IsUpdateTOX() const { return mbUpdateTOX; }
+
+ const String& GetTOIAutoMarkURL() const {return sTOIAutoMarkURL;}
+ void SetTOIAutoMarkURL(const String& rSet) {sTOIAutoMarkURL = rSet;}
+ void ApplyAutoMark();
+
+ bool IsInReading() const { return mbInReading; }
+ void SetInReading( bool bNew ) { mbInReading = bNew; }
+
+ bool IsClipBoard() const { return mbClipBoard; }
+ // N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
+ void SetClipBoard( bool bNew ) { mbClipBoard = bNew; }
+
+ bool IsColumnSelection() const { return mbColumnSelection; }
+ void SetColumnSelection( bool bNew ) { mbColumnSelection = bNew; }
+
+ bool IsInXMLImport() const { return mbInXMLImport; }
+ void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
+
+ // - Verzeichnis-Typen verwalten
+ sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
+ const SwTOXType* GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const;
+ sal_Bool DeleteTOXType( TOXTypes eTyp, sal_uInt16 nId );
+ const SwTOXType* InsertTOXType( const SwTOXType& rTyp );
+ const SwTOXTypes& GetTOXTypes() const { return *pTOXTypes; }
+
+ const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, sal_Bool bCreate = sal_False );
+ void SetDefaultTOXBase(const SwTOXBase& rBase);
+
+ // - Schluessel fuer die Indexverwaltung
+ sal_uInt16 GetTOIKeys( SwTOIKeyType eTyp, SvStringsSort& rArr ) const;
+
+ // Sortieren Tabellen Text
+ sal_Bool SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions&);
+ sal_Bool SortText(const SwPaM&, const SwSortOptions&);
+
+ // korrigiere die im Dokument angemeldeten SwPosition-Objecte,
+ // wie z.B. die ::com::sun::star::text::Bookmarks oder die Verzeichnisse.
+ // JP 22.06.95: ist bMoveCrsr gesetzt, verschiebe auch die Crsr
+
+ // Setzt alles in rOldNode auf rNewPos + Offset
+ void CorrAbs( const SwNodeIndex& rOldNode, const SwPosition& rNewPos,
+ const xub_StrLen nOffset = 0, sal_Bool bMoveCrsr = sal_False );
+ // Setzt alles im Bereich von [rStartNode, rEndNode] nach rNewPos
+ void CorrAbs( const SwNodeIndex& rStartNode, const SwNodeIndex& rEndNode,
+ const SwPosition& rNewPos, sal_Bool bMoveCrsr = sal_False );
+ // Setzt alles im Bereich von rRange nach rNewPos
+ void CorrAbs( const SwPaM& rRange, const SwPosition& rNewPos,
+ sal_Bool bMoveCrsr = sal_False );
+ // Setzt alles in rOldNode auf relative Pos
+ void CorrRel( const SwNodeIndex& rOldNode, const SwPosition& rNewPos,
+ const xub_StrLen nOffset = 0, sal_Bool bMoveCrsr = sal_False );
+
+ // GliederungsRegeln erfragen / setzen
+ // --> OD 2005-11-02 #i51089 - TUNING#
+ inline SwNumRule* GetOutlineNumRule() const
+ {
+ return pOutlineRule;
+ }
+ // <--
+ void SetOutlineNumRule( const SwNumRule& rRule );
+ void PropagateOutlineRule();
+
+ // Gliederung - hoch-/runterstufen
+ sal_Bool OutlineUpDown( const SwPaM& rPam, short nOffset = 1 );
+ // Gliederung - hoch-/runtermoven
+ sal_Bool MoveOutlinePara( const SwPaM& rPam, short nOffset = 1);
+ // zu diesem Gliederungspunkt
+ sal_Bool GotoOutline( SwPosition& rPos, const String& rName ) const;
+ // die Aenderungen an den Gliederungsvorlagen in die OutlineRule uebernehmen
+
+ // setzt, wenn noch keine Numerierung, sonst wird geaendert
+ // arbeitet mit alten und neuen Regeln, nur Differenzen aktualisieren
+ // --> OD 2005-02-18 #i42921# - re-use unused 3rd parameter
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // Add optional parameter <bResetIndentAttrs> - default value sal_False.
+ // If <bResetIndentAttrs> equals true, the indent attributes "before text"
+ // and "first line indent" are additionally reset at the provided PaM, if
+ // the list style makes use of the new list level attributes.
+ // --> OD 2008-03-17 #refactorlists#
+ // introduce parameters <bCreateNewList> and <sContinuedListId>
+ // <bCreateNewList> indicates, if a new list is created by applying the
+ // given list style.
+ void SetNumRule( const SwPaM&,
+ const SwNumRule&,
+ const bool bCreateNewList,
+ const String sContinuedListId = String(),
+ sal_Bool bSetItem = sal_True,
+ const bool bResetIndentAttrs = false );
+ // <--
+ void SetCounted( const SwPaM&, bool bCounted);
+
+ // --> OD 2009-08-25 #i86492#
+ // no longer needed.
+ // SwDoc::SetNumRule( rPaM, rNumRule, false, <ListId>, sal_True, true ) have to be used instead.
+// /**
+// Replace numbering rules in a PaM by another numbering rule.
+
+// \param rPaM PaM to replace the numbering rules in
+// \param rNumRule numbering rule to replace the present numbering rules
+// */
+// void ReplaceNumRule(const SwPaM & rPaM, const SwNumRule & rNumRule);
+
+ void MakeUniqueNumRules(const SwPaM & rPaM);
+
+ void SetNumRuleStart( const SwPosition& rPos, sal_Bool bFlag = sal_True );
+ void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
+
+ SwNumRule* GetCurrNumRule( const SwPosition& rPos ) const;
+
+ const SwNumRuleTbl& GetNumRuleTbl() const { return *pNumRuleTbl; }
+
+ // #i36749#
+ /**
+ Add numbering rule to document.
+
+ @param pRule rule to add
+ */
+ void AddNumRule(SwNumRule * pRule);
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ // add optional parameter <eDefaultNumberFormatPositionAndSpaceMode>
+ sal_uInt16 MakeNumRule( const String &rName,
+ const SwNumRule* pCpy = 0,
+ sal_Bool bBroadcast = sal_False,
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode =
+ SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
+ // <--
+ sal_uInt16 FindNumRule( const String& rName ) const;
+ SwNumRule* FindNumRulePtr( const String& rName ) const;
+
+ // loeschen geht nur, wenn die ::com::sun::star::chaos::Rule niemand benutzt!
+ // #106897#
+ sal_Bool RenameNumRule(const String & aOldName, const String & aNewName,
+ sal_Bool bBroadcast = sal_False);
+ sal_Bool DelNumRule( const String& rName, sal_Bool bBroadCast = sal_False );
+ String GetUniqueNumRuleName( const String* pChkStr = 0, sal_Bool bAutoNum = sal_True ) const;
+
+ void UpdateNumRule(); // alle invaliden Updaten
+ // #106897#
+ void ChgNumRuleFmts( const SwNumRule& rRule, const String * pOldName = 0 );
+ sal_Bool ReplaceNumRule( const SwPosition& rPos, const String& rOldRule,
+ const String& rNewRule );
+
+ // zum naechsten/vorhergehenden Punkt auf gleicher Ebene
+ sal_Bool GotoNextNum( SwPosition&, sal_Bool bOverUpper = sal_True,
+ sal_uInt8* pUpper = 0, sal_uInt8* pLower = 0 );
+ sal_Bool GotoPrevNum( SwPosition&, sal_Bool bOverUpper = sal_True,
+ sal_uInt8* pUpper = 0, sal_uInt8* pLower = 0 );
+
+ // #i23731#
+ /** Searches for a text node with a numbering rule.
+
+ OD 2005-10-24 #i55391# - add optional parameter <bInvestigateStartNode>
+ OD 2008-03-18 #refactorlists# - add output parameter <sListId>
+
+ \param rPos position to start search
+ \param bForward - sal_True: search forward
+ - sal_False: search backward
+ \param bNum - sal_True: search for enumeration
+ - sal_False: search for itemize
+ \param bOutline - sal_True: search for outline numbering rule
+ - sal_False: search for non-outline numbering rule
+ \param nNonEmptyAllowed number of non-empty paragraphs allowed between
+ rPos and found paragraph
+
+ @param sListId
+ output parameter - in case a list style is found, <sListId> holds the
+ list id, to which the text node belongs, which applies the found list style.
+
+ @param bInvestigateStartNode
+ input parameter - boolean, indicating, if start node, determined by given
+ start position has to be investigated or not.
+ */
+ const SwNumRule * SearchNumRule(const SwPosition & rPos,
+ const bool bForward,
+ const bool bNum,
+ const bool bOutline,
+ int nNonEmptyAllowed,
+ String& sListId,
+ const bool bInvestigateStartNode = false );
+
+ // Absaetze ohne Numerierung, aber mit Einzuegen
+ sal_Bool NoNum( const SwPaM& );
+ // Loeschen, Splitten der Aufzaehlungsliste
+ void DelNumRules( const SwPaM& );
+
+ // Invalidates all numrules
+ void InvalidateNumRules();
+
+ // Hoch-/Runterstufen
+ sal_Bool NumUpDown( const SwPaM&, sal_Bool bDown = sal_True );
+ // Bewegt selektierte Absaetze (nicht nur Numerierungen)
+ // entsprechend des Offsets. (negativ: zum Doc-Anf.)
+ sal_Bool MoveParagraph( const SwPaM&, long nOffset = 1, sal_Bool bIsOutlMv = sal_False );
+ // No-/Numerierung ueber Delete/Backspace ein/abschalten #115901#
+ sal_Bool NumOrNoNum( const SwNodeIndex& rIdx, sal_Bool bDel = sal_False);
+ // Animation der Grafiken stoppen
+ void StopNumRuleAnimations( OutputDevice* );
+
+ // fuege eine neue Tabelle auf der Position rPos ein. (es
+ // wird vor dem Node eingefuegt !!)
+ //JP 28.10.96:
+ // fuer AutoFormat bei der Eingabe: dann muessen die Spalten
+ // auf die vordefinierten Breite gesetzt werden. Im Array stehen die
+ // Positionen der Spalten!! (nicht deren Breite!)
+ /* #109161# new parameter bCalledFromShell:
+
+ sal_True: called from shell -> propagate existing adjust item at
+ rPos to every new cell. A existing adjust item in the table
+ heading or table contents paragraph style prevent that
+ propagation.
+
+ sal_False: do not propagate
+ */
+ const SwTable* InsertTable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER
+ const SwPosition& rPos, sal_uInt16 nRows,
+ sal_uInt16 nCols, short eAdjust,
+ const SwTableAutoFmt* pTAFmt = 0,
+ const SvUShorts* pColArr = 0,
+ sal_Bool bCalledFromShell = sal_False,
+ sal_Bool bNewModel = sal_True );
+
+ // steht der Index in einer Tabelle, dann returne den TableNode sonst 0
+ SwTableNode* IsIdxInTbl( const SwNodeIndex& rIdx );
+ inline const SwTableNode* IsIdxInTbl( const SwNodeIndex& rIdx ) const;
+
+ // erzeuge aus dem makierten Bereich eine ausgeglichene Tabelle
+ const SwTable* TextToTable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER,
+ const SwPaM& rRange, sal_Unicode cCh,
+ short eAdjust,
+ const SwTableAutoFmt* = 0 );
+ // text to table conversion - API support
+ const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes );
+ // erzeuge aus der Tabelle wieder normalen Text
+ sal_Bool TableToText( const SwTableNode* pTblNd, sal_Unicode cCh );
+ // einfuegen von Spalten/Zeilen in der Tabelle
+ sal_Bool InsertCol( const SwCursor& rCursor,
+ sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
+ sal_Bool InsertCol( const SwSelBoxes& rBoxes,
+ sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
+ sal_Bool InsertRow( const SwCursor& rCursor,
+ sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
+ sal_Bool InsertRow( const SwSelBoxes& rBoxes,
+ sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
+ // loeschen von Spalten/Zeilen in der Tabelle
+ sal_Bool DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn = false );
+ sal_Bool DeleteRow( const SwCursor& rCursor );
+ sal_Bool DeleteCol( const SwCursor& rCursor );
+ // teilen / zusammenfassen von Boxen in der Tabelle
+ sal_Bool SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert = sal_True,
+ sal_uInt16 nCnt = 1, sal_Bool bSameHeight = sal_False );
+ // returnt den enum TableMergeErr
+ sal_uInt16 MergeTbl( SwPaM& rPam );
+ String GetUniqueTblName() const;
+ sal_Bool IsInsTblFormatNum() const;
+ sal_Bool IsInsTblChangeNumFormat() const;
+ sal_Bool IsInsTblAlignNum() const;
+
+ // aus der FEShell wg.. Undo und bModified
+ void GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr,
+ const SwCellFrm* pBoxFrm = 0 ) const;
+ void SetTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly,
+ const SwCursor* pCrsr, const SwCellFrm* pBoxFrm = 0 );
+ void GetTabRows( SwTabCols &rFill, const SwCursor* pCrsr,
+ const SwCellFrm* pBoxFrm = 0 ) const;
+ void SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCursor* pCrsr,
+ const SwCellFrm* pBoxFrm = 0 );
+
+
+ // Direktzugriff fuer Uno
+ void SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
+ const SwTableBox *pStart, sal_Bool bCurRowOnly);
+
+ void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet );
+
+ // AutoFormat fuer die Tabelle/TabellenSelection
+ sal_Bool SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew );
+ // Erfrage wie attributiert ist
+ sal_Bool GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet );
+ // setze das InsertDB als Tabelle Undo auf:
+ void AppendUndoForInsertFromDB( const SwPaM& rPam, sal_Bool bIsTable );
+ // setze die Spalten/Zeilen/ZTellen Breite/Hoehe
+ sal_Bool SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType,
+ SwTwips nAbsDiff, SwTwips nRelDiff );
+ SwTableBoxFmt* MakeTableBoxFmt();
+ SwTableLineFmt* MakeTableLineFmt();
+ // teste ob die Box ein numerischen Wert darstellt und aender dann ggfs.
+ // das Format der Box
+ void ChkBoxNumFmt( SwTableBox& rAktBox, sal_Bool bCallUpdate );
+ void SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
+ void ClearBoxNumAttrs( const SwNodeIndex& rNode );
+
+ sal_Bool InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
+ const SwTable* pCpyTbl = 0, sal_Bool bCpyName = sal_False,
+ sal_Bool bCorrPos = sal_False );
+
+ sal_Bool UnProtectCells( const String& rTblName );
+ sal_Bool UnProtectCells( const SwSelBoxes& rBoxes );
+ sal_Bool UnProtectTbls( const SwPaM& rPam );
+ sal_Bool HasTblAnyProtection( const SwPosition* pPos,
+ const String* pTblName = 0,
+ sal_Bool* pFullTblProtection = 0 );
+
+ // Tabelle an der Position in der GrundLine aufsplitten, sprich eine
+ // neue Tabelle erzeugen.
+ sal_Bool SplitTable( const SwPosition& rPos, sal_uInt16 eMode = 0,
+ sal_Bool bCalcNewSize = sal_False );
+ // und die Umkehrung davon. rPos muss in der Tabelle stehen, die bestehen
+ // bleibt. Das Flag besagt ob die aktuelle mit der davor oder dahinter
+ // stehenden vereint wird.
+ sal_Bool MergeTable( const SwPosition& rPos, sal_Bool bWithPrev = sal_True,
+ sal_uInt16 nMode = 0 );
+
+ // Charts der angegebenen Tabelle zum Update bewegen
+ void UpdateCharts( const String &rName ) const;
+ // update all charts, for that exists any table
+ void UpdateAllCharts() { DoUpdateAllCharts( 0 ); }
+ // Tabelle wird umbenannt und aktualisiert die Charts
+ void SetTableName( SwFrmFmt& rTblFmt, const String &rNewName );
+
+ // returne zum Namen die im Doc gesetzte Referenz
+ const SwFmtRefMark* GetRefMark( const String& rName ) const;
+ // returne die RefMark per Index - fuer Uno
+ const SwFmtRefMark* GetRefMark( sal_uInt16 nIndex ) const;
+ // returne die Namen aller im Doc gesetzten Referenzen.
+ // Ist der ArrayPointer 0 dann returne nur, ob im Doc. eine RefMark
+ // gesetzt ist
+ sal_uInt16 GetRefMarks( SvStringsDtor* = 0 ) const;
+
+ //Einfuegen einer Beschriftung - falls ein FlyFormat erzeugt wird, so
+ // returne dieses.
+ SwFlyFrmFmt* InsertLabel( const SwLabelType eType, const String &rTxt, const String& rSeparator,
+ const String& rNumberingSeparator,
+ const sal_Bool bBefore, const sal_uInt16 nId, const sal_uLong nIdx,
+ const String& rCharacterStyle,
+ const sal_Bool bCpyBrd = sal_True );
+ SwFlyFrmFmt* InsertDrawLabel(
+ const String &rTxt, const String& rSeparator, const String& rNumberSeparator,
+ const sal_uInt16 nId, const String& rCharacterStyle, SdrObject& rObj );
+
+ // erfrage den Attribut Pool
+ const SwAttrPool& GetAttrPool() const { return *mpAttrPool; }
+ SwAttrPool& GetAttrPool() { return *mpAttrPool; }
+
+ // suche ueber das Layout eine EditShell und ggfs. eine ViewShell
+ SwEditShell* GetEditShell( ViewShell** ppSh = 0 ) const;
+ ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
+
+ // OLE 2.0-Benachrichtung
+ inline void SetOle2Link(const Link& rLink) {aOle2Link = rLink;}
+ inline const Link& GetOle2Link() const {return aOle2Link;}
+
+ // insert section (the ODF kind of section, not the nodesarray kind)
+ SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
+ SwTOXBase const*const pTOXBase = 0,
+ SfxItemSet const*const pAttr = 0, bool const bUpdate = true);
+ sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
+ const SwNode** ppSttNd = 0 ) const;
+ SwSection* GetCurrSection( const SwPosition& rPos ) const;
+ SwSectionFmts& GetSections() { return *pSectionFmtTbl; }
+ const SwSectionFmts& GetSections() const { return *pSectionFmtTbl; }
+ SwSectionFmt *MakeSectionFmt( SwSectionFmt *pDerivedFrom );
+ void DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes = sal_False );
+ void UpdateSection(sal_uInt16 const nSect, SwSectionData &,
+ SfxItemSet const*const = 0, bool const bPreventLinkUpdate = false);
+ String GetUniqueSectionName( const String* pChkStr = 0 ) const;
+
+ /* @@@MAINTAINABILITY-HORROR@@@
+ The model should not have anything to do with a shell.
+ Unnecessary compile/link time dependency.
+ */
+ // Pointer auf die SfxDocShell vom Doc, kann 0 sein !!!
+ SwDocShell* GetDocShell() { return pDocShell; }
+ const SwDocShell* GetDocShell() const { return pDocShell; }
+ void SetDocShell( SwDocShell* pDSh );
+
+ // in case during copying of embedded object a new shell is created,
+ // it should be set here and cleaned later
+ void SetTmpDocShell( SfxObjectShellLock rLock ) { xTmpDocShell = rLock; }
+ SfxObjectShellLock GetTmpDocShell() { return xTmpDocShell; }
+
+ // fuer die TextBausteine - diese habe nur ein SvPersist zur
+ // Verfuegung
+ SfxObjectShell* GetPersist() const;
+
+ // Pointer auf den Storage des SfxDocShells, kann 0 sein !!!
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetDocStorage();
+
+ // abfrage/setze Flag, ob das Dokument im asynchronen Laden ist
+ bool IsInLoadAsynchron() const { return mbInLoadAsynchron; }
+ void SetInLoadAsynchron( bool bFlag ) { mbInLoadAsynchron = bFlag; }
+
+ // erzeuge um das zu Servende Object eine Selektion
+ sal_Bool SelectServerObj( const String& rStr, SwPaM*& rpPam,
+ SwNodeRange*& rpRange ) const;
+
+ // fuer Drag&Move: ( z.B. RefMarks "verschieben" erlauben )
+ bool IsCopyIsMove() const { return mbCopyIsMove; }
+ void SetCopyIsMove( bool bFlag ) { mbCopyIsMove = bFlag; }
+
+ SwDrawContact* GroupSelection( SdrView& );
+ void UnGroupSelection( SdrView& );
+ sal_Bool DeleteSelection( SwDrawView& );
+
+ // Invalidiert OnlineSpell-WrongListen
+ void SpellItAgainSam( sal_Bool bInvalid, sal_Bool bOnlyWrong, sal_Bool bSmartTags );
+ void InvalidateAutoCompleteFlag();
+
+ // <--
+ void SetCalcFieldValueHdl(Outliner* pOutliner);
+
+ // erfrage ob die ::com::sun::star::util::URL besucht war. Uebers Doc, falls nur ein ::com::sun::star::text::Bookmark
+ // angegeben ist. Dann muss der Doc. Name davor gesetzt werden!
+ sal_Bool IsVisitedURL( const String& rURL ) const;
+
+ // speicher die akt. Werte fuer die automatische Aufnahme von Ausnahmen
+ // in die Autokorrektur
+ void SetAutoCorrExceptWord( SwAutoCorrExceptWord* pNew );
+ SwAutoCorrExceptWord* GetAutoCorrExceptWord() { return pACEWord; }
+
+ const SwFmtINetFmt* FindINetAttr( const String& rName ) const;
+
+ // rufe ins dunkle Basic, mit evt. Return String
+ sal_Bool ExecMacro( const SvxMacro& rMacro, String* pRet = 0, SbxArray* pArgs = 0 );
+ // rufe ins dunkle Basic/JavaScript
+ sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
+ sal_Bool bChkPtr = sal_False, SbxArray* pArgs = 0,
+ const Link* pCallBack = 0 );
+
+ // linken Rand ueber Objectleiste einstellen (aenhlich dem Stufen von
+ // Numerierungen), optional kann man "um" den Offset stufen oder "auf"
+ // die Position gestuft werden (bModulus = sal_True)
+ void MoveLeftMargin( const SwPaM& rPam, sal_Bool bRight = sal_True,
+ sal_Bool bModulus = sal_True );
+
+ // Numberformatter erfragen
+ inline SvNumberFormatter* GetNumberFormatter( sal_Bool bCreate = sal_True );
+ inline const SvNumberFormatter* GetNumberFormatter( sal_Bool bCreate = sal_True ) const;
+
+ bool HasInvisibleContent() const;
+ /// delete invisible content, like hidden sections and paragraphs
+ bool RemoveInvisibleContent();
+ /// restore the invisible content if it's available on the undo stack
+ bool RestoreInvisibleContent();
+ // replace fields by text - mailmerge support
+ sal_Bool ConvertFieldsToText();
+
+ // erzeuge Anhand der vorgebenen Collection Teildokumente
+ // falls keine angegeben ist, nehme die Kapitelvorlage der 1. Ebene
+ sal_Bool GenerateGlobalDoc( const String& rPath,
+ const SwTxtFmtColl* pSplitColl = 0 );
+ sal_Bool GenerateGlobalDoc( const String& rPath, int nOutlineLevel = 0 ); //#outline level,add by zhaojianwei
+ sal_Bool GenerateHTMLDoc( const String& rPath,
+ const SwTxtFmtColl* pSplitColl = 0 );
+ sal_Bool GenerateHTMLDoc( const String& rPath, int nOutlineLevel = 0 ); //#outline level,add by zhaojianwei
+
+ // vergleiche zwei Dokument miteinander
+ long CompareDoc( const SwDoc& rDoc );
+ // merge zweier Dokumente
+ long MergeDoc( const SwDoc& rDoc );
+ // setze Kommentar-Text fuers Redline, das dann per AppendRedline
+ // hereinkommt. Wird vom Autoformat benutzt. 0-Pointer setzt den Modus
+ // wieder zurueck. Die SequenceNummer ist fuers UI-seitige zusammen-
+ // fassen von Redlines.
+ void SetAutoFmtRedlineComment( const String* pTxt, sal_uInt16 nSeqNo = 0 );
+
+ bool IsAutoFmtRedline() const { return mbIsAutoFmtRedline; }
+ void SetAutoFmtRedline( bool bFlag ) { mbIsAutoFmtRedline = bFlag; }
+
+ // fuer AutoFormat: mit Undo/Redlining - Behandlung
+ void SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId,
+ const SfxItemSet* pSet = 0 );
+ void SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& );
+
+ // !!!NUR fuer die SW-Textblocks!! beachtet kein LAYOUT!!!
+ void ClearDoc(); // loescht den gesamten Inhalt.
+
+ // erfrage / setze die Daten fuer die PagePreView
+ const SwPagePreViewPrtData* GetPreViewPrtData() const { return pPgPViewPrtData; }
+ // wenn der Pointer == 0 ist, dann wird im Doc der Pointer zerstoert,
+ // ansonsten wird das Object kopiert.
+ // Der Pointer geht NICHT in den Besitz des Doc's!!
+ void SetPreViewPrtData( const SwPagePreViewPrtData* pData );
+
+ // update all modified OLE-Objects. The modification is called over the
+ // StarOne - Interface --> Bug 67026
+ void SetOLEObjModified()
+ { if( GetCurrentViewShell() ) aOLEModifiedTimer.Start(); } //swmod 071107//swmod 071225
+
+ // -------------------- Uno - Schnittstellen ---------------------------
+ const SwUnoCrsrTbl& GetUnoCrsrTbl() const { return *pUnoCrsrTbl; }
+ SwUnoCrsr* CreateUnoCrsr( const SwPosition& rPos, sal_Bool bTblCrsr = sal_False );
+ // -------------------- Uno - Schnittstellen ---------------------------
+
+ // -------------------- FeShell - Schnittstellen -----------------------
+ // !!!!! diese gehen immer davon aus, das ein Layout existiert !!!!
+ sal_Bool ChgAnchor( const SdrMarkList& _rMrkList,
+ RndStdIds _eAnchorType,
+ const sal_Bool _bSameOnly,
+ const sal_Bool _bPosCorr );
+
+ void SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew );
+ void GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const;
+ void SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew );
+ void GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const;
+ sal_Bool BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly = sal_True );
+ void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
+ sal_Bool GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) const;
+ void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
+ void SetTabLineStyle( const SwCursor& rCursor,
+ const Color* pColor, sal_Bool bSetLine,
+ const SvxBorderLine* pBorderLine );
+ void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const;
+ void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew );
+ sal_Bool GetBoxAttr( const SwCursor& rCursor, SfxPoolItem &rToFill ) const;
+ void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
+ sal_uInt16 GetBoxAlign( const SwCursor& rCursor ) const;
+ void AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance = sal_False );
+
+ int Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest );
+ int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
+ void Unchain( SwFrmFmt &rFmt );
+
+ // fuers Copy/Move aus der FrmShell
+ SdrObject* CloneSdrObj( const SdrObject&, sal_Bool bMoveWithinDoc = sal_False,
+ sal_Bool bInsInPage = sal_True );
+
+ //
+ // -------------------- FeShell - Schnittstellen Ende ------------------
+
+
+ // Schnittstelle fuer die TextInputDaten - ( fuer die Texteingabe
+ // von japanischen/chinesischen Zeichen)
+ SwExtTextInput* CreateExtTextInput( const SwPaM& rPam );
+ void DeleteExtTextInput( SwExtTextInput* pDel );
+ SwExtTextInput* GetExtTextInput( const SwNode& rNd,
+ xub_StrLen nCntntPos = STRING_NOTFOUND) const;
+ SwExtTextInput* GetExtTextInput() const;
+
+ // Schnistelle fuer den Zugriff auf die AutoComplete-Liste
+ static SwAutoCompleteWord& GetAutoCompleteWords() { return *pACmpltWords; }
+
+ bool ContainsMSVBasic() const { return mbContains_MSVBasic; }
+ void SetContainsMSVBasic( bool bFlag ) { mbContains_MSVBasic = bFlag; }
+
+ // Interface for the list of Ruby - texts/attributes
+ sal_uInt16 FillRubyList( const SwPaM& rPam, SwRubyList& rList,
+ sal_uInt16 nMode );
+ sal_uInt16 SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
+ sal_uInt16 nMode );
+
+ void ReadLayoutCache( SvStream& rStream );
+ void WriteLayoutCache( SvStream& rStream );
+ SwLayoutCache* GetLayoutCache() const { return pLayoutCache; }
+
+ /** Checks if any of the text node contains hidden characters.
+ Used for optimization. Changing the view option 'view hidden text'
+ has to trigger a reformatting only if some of the text is hidden.
+ */
+ bool ContainsHiddenChars() const;
+
+ // call back for API wrapper
+ SwModify* GetUnoCallBack() const;
+
+ IGrammarContact* getGrammarContact() const { return mpGrammarContact; }
+
+ // -> #i27615#
+ /** Marks/Unmarks a list level of a certain list
+
+ OD 2008-04-02 #refactorlists#
+ levels of a certain lists are marked now
+
+ @param sListId list Id of the list whose level has to be marked/unmarked
+ @param nListLevel level to mark
+ @param bValue - sal_True mark the level
+ - sal_False unmark the level
+ */
+ void MarkListLevel( const String& sListId,
+ const int nListLevel,
+ const sal_Bool bValue );
+
+ /** Marks/Unmarks a list level of a certain list
+
+ OD 2008-04-02 #refactorlists#
+ levels of a certain lists are marked now
+
+ @param rList list whose level has to be marked/unmarked
+ @param nListLevel level to mark
+ @param bValue - sal_True mark the level
+ - sal_False unmark the level
+ */
+ void MarkListLevel( SwList& rList,
+ const int nListLevel,
+ const sal_Bool bValue );
+ // <- #i27615#
+
+ // Change a format undoable.
+ void ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet);
+
+ void RenameFmt(SwFmt & rFmt, const String & sNewName,
+ sal_Bool bBroadcast = sal_False);
+
+ // Change a TOX undoable.
+ void ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew);
+
+ // #111827#
+ /**
+ Returns a textual description of a PaM.
+
+ @param rPaM the PaM to describe
+
+ If rPaM only spans one paragraph the result is:
+
+ '<text in the PaM>'
+
+ <text in the PaM> is shortened to nUndoStringLength characters.
+
+ If rPaM spans more than one paragraph the result is:
+
+ paragraphs (STR_PARAGRAPHS)
+
+ @return the textual description of rPaM
+ */
+ String GetPaMDescr(const SwPaM & rPaM) const;
+
+ // -> #i23726#
+ sal_Bool IsFirstOfNumRule(SwPosition & rPos);
+ // <- #i23726#
+
+ // --> #i31958# access methods for XForms model(s)
+
+ /// access container for XForms model; will be NULL if !isXForms()
+ com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
+ getXForms() const;
+
+ com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > GetGCIterator() const;
+
+ /// is this an XForms document?
+ bool isXForms() const;
+
+ /// initialize XForms models; turn this into an XForms document
+ void initXForms( bool bCreateDefaultModel );
+ // <-- #i31958# access methods for XForms model(s)
+
+ // --> OD 2006-03-21 #b6375613#
+ inline bool ApplyWorkaroundForB6375613() const
+ {
+ return mbApplyWorkaroundForB6375613;
+ }
+ void SetApplyWorkaroundForB6375613( bool p_bApplyWorkaroundForB6375613 );
+ // <--
+
+ //Update all the page masters
+ void SetDefaultPageMode(bool bSquaredPageMode);
+ sal_Bool IsSquaredPageMode() const;
+
+ // i#78591#
+ void Setn32DummyCompatabilityOptions1( sal_uInt32 CompatabilityOptions1 )
+ {
+ n32DummyCompatabilityOptions1 = CompatabilityOptions1;
+ }
+ sal_uInt32 Getn32DummyCompatabilityOptions1( )
+ {
+ return n32DummyCompatabilityOptions1;
+ }
+ void Setn32DummyCompatabilityOptions2( sal_uInt32 CompatabilityOptions2 )
+ {
+ n32DummyCompatabilityOptions2 = CompatabilityOptions2;
+ }
+ sal_uInt32 Getn32DummyCompatabilityOptions2( )
+ {
+ return n32DummyCompatabilityOptions2;
+ }
+#ifdef FUTURE_VBA
+ com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > GetVbaEventProcessor();
+#endif
+ ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
+ ::sw::MetaFieldManager & GetMetaFieldManager();
+ ::sw::UndoManager & GetUndoManager();
+ ::sw::UndoManager const& GetUndoManager() const;
+ SfxObjectShell* CreateCopy(bool bCallInitNew) const;
+};
+
+
+// Diese Methode wird im Dtor vom SwDoc gerufen und loescht den Cache
+// der Konturobjekte
+void ClrContourCache();
+
+
+//------------------ inline impl. ---------------------------------
+
+inline const SwTableNode* SwDoc::IsIdxInTbl( const SwNodeIndex& rIdx ) const
+{
+ return ((SwDoc*)this)->IsIdxInTbl( rIdx );
+}
+
+inline SvNumberFormatter* SwDoc::GetNumberFormatter( sal_Bool bCreate )
+{
+ if( bCreate && !pNumberFormatter )
+ _CreateNumberFormatter();
+ return pNumberFormatter;
+}
+
+inline const SvNumberFormatter* SwDoc::GetNumberFormatter( sal_Bool bCreate ) const
+{
+ return ((SwDoc*)this)->GetNumberFormatter( bCreate );
+}
+
+inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
+{
+ mbOLEPrtNotifyPending = bSet;
+ if( !bSet )
+ mbAllOLENotify = sal_False;
+}
+
+// --> OD 2006-03-14 #i62875#
+// namespace <docfunc> for functions and procedures working on a Writer document.
+namespace docfunc
+{
+ /** method to check, if given Writer document contains at least one drawing object
+
+ OD 2006-03-17 #i62875#
+
+ @author OD
+
+ @param p_rDoc
+ input parameter - reference to the Writer document, which is investigated.
+ */
+ bool ExistsDrawObjs( SwDoc& p_rDoc );
+
+ /** method to check, if given Writer document contains only drawing objects,
+ which are completely on its page.
+
+ OD 2006-03-17 #i62875#
+
+ @author OD
+
+ @param p_rDoc
+ input parameter - reference to the Writer document, which is investigated.
+ */
+ bool AllDrawObjsOnPage( SwDoc& p_rDoc );
+
+ /** method to check, if the outline style has to written as a normal list style
+
+ OD 2006-09-27 #i69627#
+ The outline style has to written as a normal list style, if a parent
+ paragraph style of one of the paragraph styles, which are assigned to
+ the list levels of the outline style, has a list style set or inherits
+ a list style from its parent paragraphs style.
+ This information is needed for the OpenDocument file format export.
+
+ @author OD
+
+ @param rDoc
+ input parameter - reference to the text document, which is investigated.
+
+ @return boolean
+ indicating, if the outline style has to written as a normal list style
+ */
+ bool HasOutlineStyleToBeWrittenAsNormalListStyle( SwDoc& rDoc );
+}
+// <--
+#endif //_DOC_HXX
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
new file mode 100644
index 000000000000..f2318fb2ddb4
--- /dev/null
+++ b/sw/inc/docary.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DOCARY_HXX
+#define _DOCARY_HXX
+
+#include <com/sun/star/i18n/ForbiddenCharacters.hpp>
+
+class SwFieldType;
+class SwFrmFmt;
+class SwCharFmt;
+class SwTOXType;
+class SwUndo;
+class SwSectionFmt;
+class SwNumRule;
+class SwRedline;
+class SwUnoCrsr;
+class SwOLENode;
+
+namespace com { namespace sun { namespace star { namespace i18n {
+ struct ForbiddenCharacters; // comes from the I18N UNO interface
+}}}}
+
+#ifndef _TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+#include <swtypes.hxx>
+#include <svl/svarray.hxx>
+
+typedef SwFieldType* SwFldTypePtr;
+#define GROW_FLDTYPES 16
+
+//PageDescriptor-Schnittstelle
+//typedef SwPageDesc * SwPageDescPtr;
+//SV_DECL_PTRARR_DEL(SwPageDescs, SwPageDescPtr,1,1);
+
+typedef SwFrmFmt* SwFrmFmtPtr;
+SV_DECL_PTRARR_DEL(SwFrmFmts,SwFrmFmtPtr,4,4)
+
+//Spezifische Frameformate (Rahmen, DrawObjecte)
+SV_DECL_PTRARR_DEL(SwSpzFrmFmts,SwFrmFmtPtr,0,4)
+
+typedef SwCharFmt* SwCharFmtPtr;
+SV_DECL_PTRARR_DEL(SwCharFmts,SwCharFmtPtr,4,4)
+
+SV_DECL_PTRARR_DEL( SwFldTypes, SwFldTypePtr, INIT_FLDTYPES, GROW_FLDTYPES )
+
+typedef SwTOXType* SwTOXTypePtr;
+SV_DECL_PTRARR_DEL( SwTOXTypes, SwTOXTypePtr, 0, 1 )
+
+typedef SwSectionFmt* SwSectionFmtPtr;
+SV_DECL_PTRARR_DEL(SwSectionFmts,SwSectionFmtPtr,0,4)
+
+
+typedef SwNumRule* SwNumRulePtr;
+SV_DECL_PTRARR_DEL_VISIBILITY( SwNumRuleTbl, SwNumRulePtr, 0, 5, SW_DLLPUBLIC )
+
+typedef SwRedline* SwRedlinePtr;
+SV_DECL_PTRARR_SORT_DEL( _SwRedlineTbl, SwRedlinePtr, 0, 16 )
+
+class SwRedlineTbl : private _SwRedlineTbl
+{
+public:
+ SwRedlineTbl( sal_uInt8 nSize = 0, sal_uInt8 nG = 16 )
+ : _SwRedlineTbl( nSize, nG ) {}
+ ~SwRedlineTbl() {}
+
+ sal_Bool SavePtrInArr( SwRedlinePtr p ) { return _SwRedlineTbl::Insert( p ); }
+
+ sal_Bool Insert( SwRedlinePtr& p, sal_Bool bIns = sal_True );
+ sal_Bool Insert( SwRedlinePtr& p, sal_uInt16& rInsPos, sal_Bool bIns = sal_True );
+ sal_Bool InsertWithValidRanges( SwRedlinePtr& p, sal_uInt16* pInsPos = 0 );
+
+ void Remove( sal_uInt16 nP, sal_uInt16 nL = 1 );
+ void DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL=1 );
+
+ // suche den naechsten oder vorherigen Redline mit dergleichen Seq.No
+ // Mit dem Lookahead kann die Suche eingeschraenkt werden. 0 oder
+ // USHRT_MAX suchen im gesamten Array.
+ sal_uInt16 FindNextOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead = 20 ) const;
+ sal_uInt16 FindPrevOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead = 20 ) const;
+ sal_uInt16 FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
+ sal_uInt16 nLookahead = 20 ) const;
+ sal_uInt16 FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
+ sal_uInt16 nLookahead = 20 ) const;
+
+ using _SwRedlineTbl::Count;
+ using _SwRedlineTbl::operator[];
+ using _SwRedlineTbl::GetObject;
+ using _SwRedlineTbl::Seek_Entry;
+ using _SwRedlineTbl::GetPos;
+};
+
+typedef SwUnoCrsr* SwUnoCrsrPtr;
+SV_DECL_PTRARR_DEL( SwUnoCrsrTbl, SwUnoCrsrPtr, 0, 4 )
+
+typedef SwOLENode* SwOLENodePtr;
+SV_DECL_PTRARR(SwOLENodes,SwOLENodePtr,16,16)
+
+
+#endif //_DOCARY_HXX
+
diff --git a/sw/inc/docfac.hxx b/sw/inc/docfac.hxx
new file mode 100644
index 000000000000..697da8692b4d
--- /dev/null
+++ b/sw/inc/docfac.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DOCFAC_HXX
+#define _DOCFAC_HXX
+
+#include <tools/solar.h>
+
+class SwDoc;
+
+class SwDocFac
+{
+protected:
+ SwDoc* pDoc;
+
+public:
+ SwDocFac( SwDoc *pDoc = 0 );
+ ~SwDocFac();
+
+ // Das Dokument ist nach dem Aufruf von Read(..) angelegt
+ SwDoc* GetDoc();
+};
+
+#endif
+
diff --git a/sw/inc/dochdl.hrc b/sw/inc/dochdl.hrc
new file mode 100644
index 000000000000..47b0b8014240
--- /dev/null
+++ b/sw/inc/dochdl.hrc
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DOCHDL_HRC
+#define _DOCHDL_HRC
+
+#include "rcid.hrc"
+
+#define STR_NOGLOS (RC_DOCHDL_BEGIN + 1)
+#define MSG_ERR_INSERT_GLOS (RC_DOCHDL_BEGIN + 3)
+#define MSG_CLPBRD_FORMAT_ERROR (RC_DOCHDL_BEGIN + 4)
+#define MSG_UPDATE_NEW_GLOS_FMT (RC_DOCHDL_BEGIN + 5)
+
+#define DLG_SEL_GLOS (RC_DOCHDL_BEGIN + 6)
+#define STR_NO_TABLE (RC_DOCHDL_BEGIN + 7)
+
+#define STR_PRIVATETEXT (RC_DOCHDL_BEGIN + 8)
+#define STR_PRIVATEGRAPHIC (RC_DOCHDL_BEGIN + 9)
+#define STR_PRIVATEOLE (RC_DOCHDL_BEGIN + 10)
+#define STR_DDEFORMAT (RC_DOCHDL_BEGIN + 11)
+
+
+#define DOCHDL_ACT_END STR_DDEFORMAT
+
+#if DOCHDL_ACT_END > RC_DOCHDL_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
+
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
new file mode 100644
index 000000000000..cf475663c5cd
--- /dev/null
+++ b/sw/inc/docsh.hxx
@@ -0,0 +1,320 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWDOCSH_HXX
+#define _SWDOCSH_HXX
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <vcl/timer.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/objsh.hxx>
+#include "swdllapi.h"
+#include <swdll.hxx>
+#include <shellid.hxx>
+
+#include <svl/lstner.hxx>
+#include <svtools/embedhlp.hxx>
+
+class SwDoc;
+class SfxDocumentInfoDialog;
+class SfxStyleSheetBasePool;
+class SfxInPlaceClient;
+class FontList;
+class SwView;
+class SwWrtShell;
+class SwFEShell;
+class Reader;
+class SwReader;
+class SwCrsrShell;
+class SwSrcView;
+class SwPaM;
+class SwgReaderOption;
+class SwOLEObj;
+class IDocumentDeviceAccess;
+class IDocumentSettingAccess;
+class IDocumentTimerAccess;
+class IDocumentChartDataProviderAccess;
+
+
+class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
+{
+ SwDoc* pDoc; // Document
+ rtl::Reference< SfxStyleSheetBasePool > mxBasePool; // Durchreiche fuer Formate
+ FontList* pFontList; // aktuelle FontListe
+
+ // Nix geht ohne die WrtShell (historische Gruende)
+ // RuekwaertsPointer auf die View (historische Gruende)
+ // Dieser gilt solange bis im Activate ein neuer gesetzt wird
+ // oder dieser im Dtor der View geloescht wird
+ //
+ SwView* pView;
+ SwWrtShell* pWrtShell;
+
+ Timer aFinishedTimer; // Timer fuers ueberpriefen der
+ // Grafik-Links. Sind alle da,
+ // dann ist Doc voll. geladen
+
+ //SvPersistRef xOLEChildList; // fuers RemoveOLEObjects
+ comphelper::EmbeddedObjectContainer* pOLEChildList;
+ sal_Int16 nUpdateDocMode; // contains the com::sun::star::document::UpdateDocMode
+ bool bInUpdateFontList; //prevent nested calls of UpdateFontList
+ // Methoden fuer den Zugriff aufs Doc
+ SW_DLLPRIVATE void AddLink();
+ SW_DLLPRIVATE void RemoveLink();
+
+ // Hint abfangen fuer DocInfo
+ SW_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ // FileIO
+ SW_DLLPRIVATE virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+ SW_DLLPRIVATE virtual sal_Bool Load( SfxMedium& rMedium );
+ SW_DLLPRIVATE virtual sal_Bool LoadFrom( SfxMedium& rMedium );
+ SW_DLLPRIVATE virtual sal_Bool ConvertFrom( SfxMedium &rMedium );
+ SW_DLLPRIVATE virtual sal_Bool ConvertTo( SfxMedium &rMedium );
+ SW_DLLPRIVATE virtual sal_Bool SaveAs( SfxMedium& rMedium );
+ SW_DLLPRIVATE virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+
+ SW_DLLPRIVATE virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
+
+ // DocInfo dem Doc melden
+ //
+ SW_DLLPRIVATE virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
+ Window *pParent, const SfxItemSet &);
+ // OLE-Geraffel
+ SW_DLLPRIVATE virtual void Draw( OutputDevice*, const JobSetup&, sal_uInt16);
+
+ // Methoden fuer StyleSheets
+ SW_DLLPRIVATE sal_uInt16 Edit( const String &rName, const String& rParent, sal_uInt16 nFamily,
+ sal_uInt16 nMask, sal_Bool bNew,
+ sal_Bool bColumn = sal_False,
+ SwWrtShell* pActShell = 0,
+ sal_Bool bBasic = sal_False );
+ SW_DLLPRIVATE sal_uInt16 Delete(const String &rName, sal_uInt16 nFamily);
+ SW_DLLPRIVATE sal_uInt16 ApplyStyles(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0,
+ sal_uInt16 nMode = 0 );
+ SW_DLLPRIVATE sal_uInt16 DoWaterCan( const String &rName, sal_uInt16 nFamily);
+ SW_DLLPRIVATE sal_uInt16 UpdateStyle(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0);
+ SW_DLLPRIVATE sal_uInt16 MakeByExample(const String &rName,
+ sal_uInt16 nFamily, sal_uInt16 nMask, SwWrtShell* pShell = 0);
+
+ SW_DLLPRIVATE void InitDraw();
+ SW_DLLPRIVATE void SubInitNew(); // fuer InitNew und HtmlSourceModus
+
+ SW_DLLPRIVATE void RemoveOLEObjects();
+ SW_DLLPRIVATE void CalcLayoutForOLEObjects();
+
+ SW_DLLPRIVATE void Init_Impl();
+ SW_DLLPRIVATE DECL_STATIC_LINK( SwDocShell, IsLoadFinished, void* );
+
+
+ using SfxObjectShell::GetVisArea;
+ using SfxObjectShell::GetStyleFamilyBitmap;
+
+protected:
+ /// override to update text fields
+ virtual void DoFlushDocInfo();
+
+public:
+ using SotObject::GetInterface;
+
+ // aber selbst implementieren
+ SFX_DECL_INTERFACE(SW_DOCSHELL)
+ SFX_DECL_OBJECTFACTORY()
+ TYPEINFO();
+
+ static SfxInterface *_GetInterface() { return GetStaticInterface(); }
+
+ static rtl::OUString GetEventName( sal_Int32 nId );
+
+ //Das Doc wird fuer SO-Datenaustausch benoetigt!
+ SwDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED );
+ SwDocShell( const sal_uInt64 i_nSfxCreationFlags );
+ SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD );
+ ~SwDocShell();
+
+ // OLE 2.0-Benachrichtigung
+ DECL_LINK( Ole2ModifiedHdl, void * );
+
+ // OLE-Geraffel
+ virtual void SetVisArea( const Rectangle &rRect );
+ virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const;
+ virtual Printer *GetDocumentPrinter();
+ virtual OutputDevice* GetDocumentRefDev();
+ virtual void OnDocumentPrinterChanged( Printer * pNewPrinter );
+ virtual sal_uLong GetMiscStatus() const;
+
+ virtual void PrepareReload();
+ virtual void SetModified( sal_Bool = sal_True );
+
+ // Dispatcher
+ void Execute(SfxRequest &);
+ void ExecStyleSheet(SfxRequest&);
+ void ExecDB(SfxRequest&);
+
+ void GetState(SfxItemSet &);
+ void StateAlways(SfxItemSet &);
+ void StateStyleSheet(SfxItemSet&, SwWrtShell* pSh = 0 );
+
+ // Doc rausreichen aber VORSICHT
+ inline SwDoc* GetDoc() { return pDoc; }
+ inline const SwDoc* GetDoc() const { return pDoc; }
+ IDocumentDeviceAccess* getIDocumentDeviceAccess();
+ const IDocumentSettingAccess* getIDocumentSettingAccess() const;
+ IDocumentChartDataProviderAccess* getIDocumentChartDataProviderAccess();
+
+
+ void UpdateFontList();
+ void UpdateChildWindows();
+
+ // globaler IO
+ virtual sal_Bool Save();
+
+ // fuer VorlagenPI
+ virtual SfxStyleSheetBasePool* GetStyleSheetPool();
+
+ // Fuer Organizer
+ virtual sal_Bool Insert(SfxObjectShell &rSource,
+ sal_uInt16 nSourceIdx1,
+ sal_uInt16 nSourceIdx2,
+ sal_uInt16 nSourceIdx3,
+ sal_uInt16& nIdx1,
+ sal_uInt16& nIdx2,
+ sal_uInt16& nIdx3,
+ sal_uInt16& nRemovedIdx);
+
+ virtual sal_Bool Remove(sal_uInt16 nIdx1,
+ sal_uInt16 nIdx2 = INDEX_IGNORE,
+ sal_uInt16 nIdx3 = INDEX_IGNORE);
+
+ virtual Bitmap GetStyleFamilyBitmap( SfxStyleFamily eFamily, BmpColorMode eColorMode );
+
+ // View setzen fuer Aktionen ueber Shell
+ void SetView(SwView* pVw);
+ const SwView *GetView() const { return pView; }
+ SwView *GetView() { return pView; }
+
+ // Zugriff auf die zur SwView gehoerige SwWrtShell
+ SwWrtShell *GetWrtShell() { return pWrtShell; }
+ const SwWrtShell *GetWrtShell() const { return pWrtShell; }
+
+ // fuer die Core - die kennt die DocShell aber keine WrtShell!
+ SwFEShell *GetFEShell();
+ const SwFEShell *GetFEShell() const
+ { return ((SwDocShell*)this)->GetFEShell(); }
+
+
+ // Fuer Einfuegen Dokument
+ Reader* StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr,
+ SwCrsrShell* pCrsrSh = 0, SwPaM* pPaM = 0);
+
+ virtual long DdeGetData( const String& rItem, const String& rMimeType,
+ ::com::sun::star::uno::Any & rValue );
+ virtual long DdeSetData( const String& rItem, const String& rMimeType,
+ const ::com::sun::star::uno::Any & rValue );
+ virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem );
+ virtual void FillClass( SvGlobalName * pClassName,
+ sal_uInt32 * pClipFormat,
+ String * pAppName,
+ String * pLongUserName,
+ String * pUserName,
+ sal_Int32 nFileFormat,
+ sal_Bool bTemplate = sal_False ) const;
+
+ virtual void LoadStyles( SfxObjectShell& rSource );
+
+ void _LoadStyles( SfxObjectShell& rSource, sal_Bool bPreserveCurrentDocument );
+
+ // Seitenvorlagedialog anzeigen, ggf. auf Spaltenpage
+ void FormatPage( const String& rPage,
+ sal_Bool bColumn = sal_False,
+ SwWrtShell* pActShell = 0 );
+
+ // --> OD 2006-11-07 #i59688#
+ // linked graphics are now loaded on demand.
+ // Thus, loading of linked graphics no longer needed and necessary for
+ // the load of document being finished.
+// // Timer starten fuers ueberpruefen der Grafik-Links. Sind alle
+// // vollstaendig geladen, dann ist das Doc fertig
+// void StartLoadFinishedTimer();
+ void LoadingFinished();
+ // <--
+
+ // eine Uebertragung wird abgebrochen (wird aus dem SFX gerufen)
+ virtual void CancelTransfers();
+
+ // Doc aus Html-Source neu laden
+ void ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView );
+
+ sal_Int16 GetUpdateDocMode() const {return nUpdateDocMode;}
+
+ //Activate wait cursor for all windows of this document
+ //Optionally all dispatcher could be Locked
+ //Usually locking should be done using the class: SwWaitObject!
+ void EnterWait( sal_Bool bLockDispatcher );
+ void LeaveWait( sal_Bool bLockDispatcher );
+
+ void ToggleBrowserMode(sal_Bool bOn, SwView* pView);
+
+ sal_uLong LoadStylesFromFile( const String& rURL, SwgReaderOption& rOpt,
+ sal_Bool bUnoCall );
+ void InvalidateModel();
+ void ReactivateModel();
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > GetEventNames();
+
+ // --> FME 2004-08-05 #i20883# Digital Signatures and Encryption
+ virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates );
+ // <--
+
+ // --> FME 2005-02-25 #i42634# Overwrites SfxObjectShell::UpdateLinks
+ // This new function is necessary to trigger update of links in docs
+ // read by the binary filter:
+ virtual void UpdateLinks();
+ // <--
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
+ GetController();
+
+ SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef );
+
+ virtual const ::sfx2::IXmlIdRegistry* GetXmlIdRegistry() const;
+
+ // passwword protection for Writer (derived from SfxObjectShell)
+ // see also: FN_REDLINE_ON, FN_REDLINE_ON
+ virtual bool IsChangeRecording() const;
+ virtual bool HasChangeRecordProtection() const;
+ virtual void SetChangeRecording( bool bActivate );
+ virtual bool SetProtectionPassword( const String &rPassword );
+ virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash );
+};
+
+class Graphic;
+//implemented in source/ui/docvw/romenu.cxx
+String ExportGraphic( const Graphic &rGraphic, const String &rGrfName );
+
+#endif
diff --git a/sw/inc/docstat.hxx b/sw/inc/docstat.hxx
new file mode 100644
index 000000000000..5d40357524c8
--- /dev/null
+++ b/sw/inc/docstat.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DOCSTAT_HXX
+#define _DOCSTAT_HXX
+
+#include <tools/solar.h>
+#include "swdllapi.h"
+
+
+struct SW_DLLPUBLIC SwDocStat
+{
+ sal_uInt16 nTbl;
+ sal_uInt16 nGrf;
+ sal_uInt16 nOLE;
+ sal_uLong nPage;
+ /// paragraphs for document statistic: non-empty and non-hidden ones
+ sal_uLong nPara;
+ /// all paragraphs, including empty/hidden ones
+ sal_uLong nAllPara;
+ sal_uLong nWord;
+ sal_uLong nChar;
+ sal_Bool bModified;
+
+ SwDocStat();
+ void Reset();
+};
+
+#endif
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
new file mode 100644
index 000000000000..d8840a72a8d7
--- /dev/null
+++ b/sw/inc/docstyle.hxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DOCSTYLE_HXX
+#define _DOCSTYLE_HXX
+
+#include <rtl/ref.hxx>
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#endif
+#include <svl/style.hxx>
+#include <svl/itemset.hxx>
+#include "swdllapi.h"
+
+class SwDoc;
+class SwDocStyleSheetPool;
+class SwPageDesc;
+class SwCharFmt;
+class SwTxtFmtColl;
+class SwFrmFmt;
+class SwNumRule;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Lokale Hilfsklasse
+ --------------------------------------------------------------------*/
+class SwPoolFmtList : public SvStringsDtor
+{
+public:
+ SwPoolFmtList() {}
+ void Append( char cChar, const String& rStr );
+ void Erase();
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: temp. StyleSheet
+ --------------------------------------------------------------------*/
+class SW_DLLPUBLIC SwDocStyleSheet : public SfxStyleSheetBase
+{
+ friend class SwDocStyleSheetPool;
+ friend class SwStyleSheetIterator;
+
+ SwCharFmt* pCharFmt;
+ SwTxtFmtColl* pColl;
+ SwFrmFmt* pFrmFmt;
+ const SwPageDesc* pDesc;
+ const SwNumRule* pNumRule;
+
+ SwDoc& rDoc;
+ SfxItemSet aCoreSet;
+
+ sal_Bool bPhysical;
+
+
+ // leere Huelse zum richtigen StyleSheet (Core) machen
+ SW_DLLPRIVATE void Create();
+
+ // den StyleSheet mit Daten fuellen
+ enum FillStyleType {
+ FillOnlyName,
+ FillAllInfo,
+ FillPhysical
+ };
+
+ SW_DLLPRIVATE sal_Bool FillStyleSheet( FillStyleType eFType );
+
+protected:
+ virtual ~SwDocStyleSheet();
+
+public:
+ SwDocStyleSheet( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheetPool& rPool,
+ SfxStyleFamily eFam,
+ sal_uInt16 nMask);
+
+ SwDocStyleSheet( const SwDocStyleSheet& );
+
+ void Reset();
+
+ void SetMask(sal_uInt16 nMsk) { nMask = nMsk; }
+ void SetFamily(SfxStyleFamily eFam) { nFamily = eFam; }
+
+ sal_Bool IsPhysical() const { return bPhysical; }
+ void SetPhysical(sal_Bool bPhys);
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ // add optional parameter <bResetIndentAttrsAtParagraphStyle>, default value sal_False,
+ // which indicates that the indent attributes at a paragraph style should
+ // be reset in case that a list style is applied to the paragraph style and
+ // no indent attributes are applied.
+ void SetItemSet( const SfxItemSet& rSet,
+ const bool bResetIndentAttrsAtParagraphStyle = false );
+ // <--
+
+ virtual SfxItemSet& GetItemSet();
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ // new method for paragraph styles to merge indent attributes of applied list
+ // style into the given item set, if the list style indent attributes are applicable.
+ void MergeIndentAttrsOfListStyle( SfxItemSet& rSet );
+ // <--
+ virtual const String& GetParent() const;
+ virtual const String& GetFollow() const;
+
+ virtual sal_uLong GetHelpId( String& rFile );
+ virtual void SetHelpId( const String& r, sal_uLong nId );
+
+ // Vorbelegen der member ohne physikalischen Zugriff
+ // wird vom StyleSheetPool benutzt
+ //
+ void PresetName(const String& rName) { aName = rName; }
+ void PresetNameAndFamily(const String& rName);
+ void PresetParent(const String& rName){ aParent = rName; }
+ void PresetFollow(const String& rName){ aFollow = rName; }
+
+ virtual sal_Bool SetName( const String& rStr);
+ virtual sal_Bool SetParent( const String& rStr);
+ virtual sal_Bool SetFollow( const String& rStr);
+
+ virtual sal_Bool HasFollowSupport() const;
+ virtual sal_Bool HasParentSupport() const;
+ virtual sal_Bool HasClearParentSupport() const;
+ virtual String GetDescription();
+ virtual String GetDescription(SfxMapUnit eUnit);
+
+ SwCharFmt* GetCharFmt();
+ SwTxtFmtColl* GetCollection();
+ SwFrmFmt* GetFrmFmt();
+ const SwPageDesc* GetPageDesc();
+ const SwNumRule* GetNumRule();
+ void SetNumRule(const SwNumRule& rRule);
+
+ virtual sal_Bool IsUsed() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Iterator fuer den Pool
+ --------------------------------------------------------------------*/
+
+class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener
+{
+ rtl::Reference< SwDocStyleSheet > mxIterSheet;
+ rtl::Reference< SwDocStyleSheet > mxStyleSheet;
+ SwPoolFmtList aLst;
+ sal_uInt16 nLastPos;
+ sal_Bool bFirstCalled;
+
+ void AppendStyleList(const SvStringsDtor& rLst,
+ sal_Bool bUsed,
+ sal_uInt16 nSection,
+ char cType);
+
+public:
+ SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
+ SfxStyleFamily eFam, sal_uInt16 n=0xFFFF );
+ virtual ~SwStyleSheetIterator();
+
+ virtual sal_uInt16 Count();
+ virtual SfxStyleSheetBase *operator[](sal_uInt16 nIdx);
+ virtual SfxStyleSheetBase* First();
+ virtual SfxStyleSheetBase* Next();
+ virtual SfxStyleSheetBase* Find(const UniString& rStr);
+
+ virtual void Notify( SfxBroadcaster&, const SfxHint& );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Pool fuer
+ --------------------------------------------------------------------*/
+
+class SwDocStyleSheetPool : public SfxStyleSheetBasePool
+{
+ rtl::Reference< SwDocStyleSheet > mxStyleSheet;
+ SwDoc& rDoc;
+ sal_Bool bOrganizer : 1; // sal_True: fuer den Organizer
+
+
+ virtual SfxStyleSheetBase* Create( const String&, SfxStyleFamily, sal_uInt16 nMask);
+ virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& );
+
+ using SfxStyleSheetBasePool::Find;
+
+public:
+ SwDocStyleSheetPool( SwDoc&, sal_Bool bOrganizer = sal_False );
+
+ virtual void Replace( SfxStyleSheetBase& rSource,
+ SfxStyleSheetBase& rTarget );
+ virtual SfxStyleSheetBase& Make(const String&, SfxStyleFamily, sal_uInt16 nMask, sal_uInt16 nPos = 0xffff);
+
+ virtual SfxStyleSheetBase* Find( const String&, SfxStyleFamily eFam,
+ sal_uInt16 n=0xFFFF );
+
+ virtual sal_Bool SetParent( SfxStyleFamily eFam, const String &rStyle,
+ const String &rParent );
+
+ virtual void Remove( SfxStyleSheetBase* pStyle);
+
+ void SetOrganizerMode( sal_Bool bMode ) { bOrganizer = bMode; }
+ sal_Bool IsOrganizerMode() const { return bOrganizer; }
+
+ virtual SfxStyleSheetIterator* CreateIterator( SfxStyleFamily,
+ sal_uInt16 nMask );
+
+ SwDoc& GetDoc() const { return rDoc; }
+
+ void dispose();
+
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+protected:
+ virtual ~SwDocStyleSheetPool();
+
+ //Fuer die daemlicheren Compiler
+private:
+ SwDocStyleSheetPool( const SwDocStyleSheetPool& );
+};
+
+
+#endif
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
new file mode 100644
index 000000000000..4889288caf09
--- /dev/null
+++ b/sw/inc/docufld.hxx
@@ -0,0 +1,839 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_DOCUFLD_HXX
+#define SW_DOCUFLD_HXX
+
+
+#include <tools/date.hxx>
+#include <tools/datetime.hxx>
+
+
+#include <svl/macitem.hxx>
+
+#include "fldbas.hxx"
+#include "numrule.hxx"
+
+class _SetGetExpFlds;
+class SwTxtFld;
+class SwFrm;
+class OutlinerParaObject;
+class SwTextAPIObject;
+
+enum SwAuthorFormat
+{
+ AF_BEGIN,
+ AF_NAME = AF_BEGIN,
+ AF_SHORTCUT,
+ AF_END,
+ AF_FIXED = 0x8000
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Untertyp der Dokumentstatistik
+ --------------------------------------------------------------------*/
+
+enum SwDocStatSubType
+{
+ DS_BEGIN,
+ DS_PAGE = DS_BEGIN,
+ DS_PARA,
+ DS_WORD,
+ DS_CHAR,
+ DS_TBL,
+ DS_GRF,
+ DS_OLE,
+ DS_END
+};
+
+typedef sal_uInt16 SwDocInfoSubType;
+namespace nsSwDocInfoSubType
+{
+ // NB: these must denote consecutive integers!
+ // NB2: these are extended by 4 DI_INFO values for backward compatibility
+ // in filter/html/htmlfld.cxx, so make sure that DI_SUBTYPE_END
+ // really is the end, and is at least 4 less than DI_SUB_*!
+ const SwDocInfoSubType DI_SUBTYPE_BEGIN = 0;
+ const SwDocInfoSubType DI_TITEL = DI_SUBTYPE_BEGIN;
+ const SwDocInfoSubType DI_THEMA = 1;
+ const SwDocInfoSubType DI_KEYS = 2;
+ const SwDocInfoSubType DI_COMMENT = 3;
+ const SwDocInfoSubType DI_CREATE = 4;
+ const SwDocInfoSubType DI_CHANGE = 5;
+ const SwDocInfoSubType DI_PRINT = 6;
+ const SwDocInfoSubType DI_DOCNO = 7;
+ const SwDocInfoSubType DI_EDIT = 8;
+ const SwDocInfoSubType DI_CUSTOM = 9;
+ const SwDocInfoSubType DI_SUBTYPE_END = 10;
+
+
+ const SwDocInfoSubType DI_SUB_AUTHOR = 0x0100;
+ const SwDocInfoSubType DI_SUB_TIME = 0x0200;
+ const SwDocInfoSubType DI_SUB_DATE = 0x0300;
+ const SwDocInfoSubType DI_SUB_FIXED = 0x1000;
+ const SwDocInfoSubType DI_SUB_MASK = 0xff00;
+}
+
+
+enum RegInfoFormat // Nur noch zum laden alter Dokumente!!!
+{
+ RF_AUTHOR,
+ RF_TIME,
+ RF_DATE,
+ RF_ALL
+};
+
+enum SwPageNumSubType
+{
+ PG_RANDOM,
+ PG_NEXT,
+ PG_PREV
+};
+
+enum SwExtUserSubType
+{
+ EU_COMPANY /*EU_FIRMA*/,
+ EU_FIRSTNAME /*EU_VORNAME*/,
+ EU_NAME /*EU_NAME*/,
+ EU_SHORTCUT /*EU_ABK*/,
+ EU_STREET /*EU_STRASSE*/,
+ EU_COUNTRY /*EU_LAND*/,
+ EU_ZIP /*EU_PLZ*/,
+ EU_CITY /*EU_ORT*/,
+ EU_TITLE /*EU_TITEL*/,
+ EU_POSITION /*EU_POS*/,
+ EU_PHONE_PRIVATE /*EU_TELPRIV*/,
+ EU_PHONE_COMPANY /*EU_TELFIRMA*/,
+ EU_FAX,
+ EU_EMAIL,
+ EU_STATE,
+ EU_FATHERSNAME,
+ EU_APARTMENT
+};
+
+enum SwJumpEditFormat
+{
+ JE_FMT_TEXT,
+ JE_FMT_TABLE,
+ JE_FMT_FRAME,
+ JE_FMT_GRAPHIC,
+ JE_FMT_OLE
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seitennummer
+ --------------------------------------------------------------------*/
+
+class SwPageNumberFieldType : public SwFieldType
+{
+ sal_Int16 nNumberingType;
+ sal_uInt16 nNum, nMax;
+ sal_Bool bVirtuell;
+
+public:
+ SwPageNumberFieldType();
+
+ String& Expand( sal_uInt32 nFmt, short nOff, const String&, String& rRet ) const;
+ void ChangeExpansion( SwDoc* pDoc, sal_uInt16 nNum, sal_uInt16 nMax,
+ sal_Bool bVirtPageNum, const sal_Int16* pNumFmt = 0 );
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seitennummerierung
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwPageNumberField : public SwField
+{
+ String sUserStr;
+ sal_uInt16 nSubType;
+ short nOffset;
+
+public:
+ SwPageNumberField(SwPageNumberFieldType*, sal_uInt16 nSub = PG_RANDOM,
+ sal_uInt32 nFmt = 0, short nOff = 0);
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+
+ virtual sal_uInt16 GetSubType() const;
+ // virtual void SetSubType(sal_uInt16 nSub); // OM: entfernt, da unbenoetigt und gefaehrlich
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+
+ const String& GetUserString() const { return sUserStr; }
+ void SetUserString( const String& rS ) { sUserStr = rS; }
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Autoren
+ --------------------------------------------------------------------*/
+
+class SwAuthorFieldType : public SwFieldType
+{
+public:
+ SwAuthorFieldType();
+
+ String Expand(sal_uLong) const;
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: AutorenFeld
+ --------------------------------------------------------------------*/
+
+class SwAuthorField : public SwField
+{
+ String aContent;
+
+public:
+ SwAuthorField(SwAuthorFieldType*, sal_uInt32 nFmt = 0);
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ inline void SetExpansion(const String& rStr) { aContent = rStr; }
+ inline const String& GetContent() const { return aContent; }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Filename
+ --------------------------------------------------------------------*/
+
+class SwFileNameFieldType : public SwFieldType
+{
+ SwDoc *pDoc;
+public:
+ SwFileNameFieldType(SwDoc*);
+
+ String Expand(sal_uLong) const;
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: FileName
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwFileNameField : public SwField
+{
+ String aContent;
+
+public:
+ SwFileNameField(SwFileNameFieldType*, sal_uInt32 nFmt = 0);
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ inline void SetExpansion(const String& rStr) { aContent = rStr; }
+ inline const String& GetContent() const { return aContent; }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: TemplName
+ --------------------------------------------------------------------*/
+
+class SwTemplNameFieldType : public SwFieldType
+{
+ SwDoc *pDoc;
+public:
+ SwTemplNameFieldType(SwDoc*);
+
+ String Expand(sal_uLong) const;
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: TemplName
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwTemplNameField : public SwField
+{
+public:
+ SwTemplNameField(SwTemplNameFieldType*, sal_uInt32 nFmt = 0);
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Docstatistik
+ --------------------------------------------------------------------*/
+
+class SwDocStatFieldType : public SwFieldType
+{
+ SwDoc* pDoc;
+ sal_Int16 nNumberingType;//com::sun::star::style::NumberingType
+
+public:
+ SwDocStatFieldType(SwDoc*);
+ String Expand(sal_uInt16 nSubType, sal_uInt32 nFmt) const;
+ virtual SwFieldType* Copy() const;
+
+ inline void SetNumFormat( sal_Int16 eFmt ) { nNumberingType = eFmt; }
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dokumentstatistik
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDocStatField : public SwField
+{
+ sal_uInt16 nSubType;
+
+public:
+ SwDocStatField( SwDocStatFieldType*,
+ sal_uInt16 nSubType = 0, sal_uInt32 nFmt = 0);
+
+ void ChangeExpansion( const SwFrm* pFrm );
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16 nSub);
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: versteckter Text
+ --------------------------------------------------------------------*/
+
+class SwHiddenTxtFieldType : public SwFieldType
+{
+ sal_Bool bHidden;
+public:
+ SwHiddenTxtFieldType(sal_Bool bSetHidden = sal_True);
+
+ virtual SwFieldType* Copy() const;
+
+ void SetHiddenFlag( sal_Bool bSetHidden = sal_True );
+ inline sal_Bool GetHiddenFlag() const { return bHidden; }
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Versteckter Text
+ --------------------------------------------------------------------*/
+
+class SwHiddenTxtField : public SwField
+{
+ String aTRUETxt; // Text wenn Bedingung sal_True
+ String aFALSETxt; // Wenn Bedingung falsch
+ String aContent; // Ausgewerteter DB-Text
+
+ String aCond; // Bedingung
+ sal_uInt16 nSubType;
+
+ sal_Bool bCanToggle : 1; // kann das Feld einzeln getoggelt werden?
+ sal_Bool bIsHidden : 1; // ist es nicht sichtbar?
+ sal_Bool bValid : 1; // DB-Feld evaluiert?
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ SwHiddenTxtField( SwHiddenTxtFieldType*,
+ sal_Bool bConditional,
+ const String& rCond,
+ const String& rTxt,
+ sal_Bool bHidden = sal_False,
+ sal_uInt16 nSubType = TYP_HIDDENTXTFLD);
+
+ SwHiddenTxtField( SwHiddenTxtFieldType*,
+ const String& rCond,
+ const String& rTrue,
+ const String& rFalse,
+ sal_uInt16 nSubType = TYP_HIDDENTXTFLD);
+
+ virtual String GetFieldName() const;
+
+ void Evaluate(SwDoc*);
+
+ inline void SetValue(sal_Bool bHidden) { bIsHidden = bHidden; }
+ String GetColumnName(const String& rName);
+ String GetDBName(const String& rName, SwDoc *pDoc);
+
+ // Condition
+ virtual void SetPar1(const String& rStr);
+ virtual const String& GetPar1() const;
+
+ // True/False - String
+ virtual void SetPar2(const String& rStr);
+ virtual String GetPar2() const;
+
+
+ virtual sal_uInt16 GetSubType() const;
+ // virtual void SetSubType(sal_uInt16 nSub); // OM: entfernt, da unbenoetigt und gefaehrlich
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feld das zu einer Leerzeile (ohne Hoehe) expandiert
+ --------------------------------------------------------------------*/
+
+class SwHiddenParaFieldType : public SwFieldType
+{
+public:
+ SwHiddenParaFieldType();
+
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Versteckter Absatz
+ --------------------------------------------------------------------*/
+
+class SwHiddenParaField : public SwField
+{
+ String aCond;
+ sal_Bool bIsHidden:1;
+public:
+ // Direkte Eingabe alten Wert loeschen
+ SwHiddenParaField(SwHiddenParaFieldType*, const String& rCond);
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ void SetHidden(sal_Bool bHidden) { bIsHidden = bHidden; }
+ sal_Bool IsHidden() const { return bIsHidden; }
+
+ // Bedingung erfragen/setzen
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Macro ausfuehren
+ --------------------------------------------------------------------*/
+
+class SwMacroFieldType : public SwFieldType
+{
+ SwDoc* pDoc;
+
+public:
+ SwMacroFieldType(SwDoc*);
+
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Macrofeld
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwMacroField : public SwField
+{
+ String aMacro;
+ String aText;
+ sal_Bool bIsScriptURL;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ // Direkte Eingabe alten Wert loeschen
+ SwMacroField( SwMacroFieldType*, const String& rLibAndName,
+ const String& rTxt);
+
+ inline const String& GetMacro() const { return aMacro; }
+ String GetLibName() const;
+ String GetMacroName() const;
+ SvxMacro GetSvxMacro() const;
+
+ virtual String GetFieldName() const;
+
+ // Library und FileName
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+
+ // Macrotext
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+
+ static void CreateMacroString( String& rMacro,
+ const String& rMacroName,
+ const String& rLibraryName );
+
+ static sal_Bool isScriptURL( const String& str );
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: PostIts
+ --------------------------------------------------------------------*/
+
+class SwPostItFieldType : public SwFieldType
+{
+private:
+ SwDoc* mpDoc;
+public:
+ SwPostItFieldType(SwDoc* pDoc);
+
+ virtual SwFieldType* Copy() const;
+ SwDoc* GetDoc() {return mpDoc;};
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: PostIt
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwPostItField : public SwField
+{
+ String sTxt; // die Anmerkung
+ String sAuthor; // der Author
+ DateTime aDateTime; // Datum und Zeit der Anmerkung
+ OutlinerParaObject* mpText;
+ SwTextAPIObject* m_pTextObject;
+
+public:
+ SwPostItField( SwPostItFieldType*,
+ const String& rAuthor, const String& rTxt, const DateTime& rDate);
+ ~SwPostItField();
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ inline const Date GetDate() const { return aDateTime.GetDate(); }
+ inline const Time GetTime() const { return aDateTime.GetTime(); }
+
+ // Author
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+
+ // Text
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+ const String& GetTxt() const { return sTxt; }
+
+ const OutlinerParaObject* GetTextObject() const;
+ void SetTextObject( OutlinerParaObject* pText );
+
+ sal_uInt32 GetNumberOfParagraphs() const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+ virtual String GetDescription() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: DokumentInfo
+ --------------------------------------------------------------------*/
+
+class SwDocInfoFieldType : public SwValueFieldType
+{
+public:
+ SwDocInfoFieldType(SwDoc* pDc);
+
+ String Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, sal_uInt16 nLang, const String& rName) const;
+ virtual SwFieldType* Copy() const;
+};
+
+class SW_DLLPUBLIC SwDocInfoField : public SwValueField
+{
+ sal_uInt16 nSubType;
+ String aContent;
+ String aName;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const String& rName, sal_uInt32 nFmt=0);
+ SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const String& rName, const String& rValue, sal_uInt32 nFmt=0);
+
+ virtual void SetSubType(sal_uInt16);
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetLanguage(sal_uInt16 nLng);
+ virtual String GetFieldName() const;
+ String GetName() const { return aName; }
+ void SetName( const String& rName ) { aName = rName; }
+ inline void SetExpansion(const String& rStr) { aContent = rStr; }
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: erweiterte Benutzereinstellung
+ --------------------------------------------------------------------*/
+
+
+class SwExtUserFieldType : public SwFieldType
+{
+ String aData;
+public:
+ SwExtUserFieldType();
+
+ inline void SetData(const String& rStr) { aData = rStr; }
+
+ String Expand(sal_uInt16 nSubType, sal_uInt32 nFormat) const;
+ virtual SwFieldType* Copy() const;
+};
+
+class SwExtUserField : public SwField
+{
+ String aContent;
+ sal_uInt16 nType;
+
+public:
+ SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFmt=0);
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16 nSub);
+
+ inline void SetExpansion(const String& rStr) { aContent = rStr; }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Relatives Seitennummern - Feld
+ --------------------------------------------------------------------*/
+
+class SwRefPageSetFieldType : public SwFieldType
+{
+public:
+ SwRefPageSetFieldType();
+
+ virtual SwFieldType* Copy() const;
+
+protected:
+ // ueberlagert, weil es nichts zum Updaten gibt!
+ virtual void Modify( const SfxPoolItem*, const SfxPoolItem * );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Relative Seitennummerierung
+ --------------------------------------------------------------------*/
+
+class SwRefPageSetField : public SwField
+{
+ short nOffset;
+ sal_Bool bOn;
+
+public:
+ SwRefPageSetField( SwRefPageSetFieldType*, short nOff = 0,
+ sal_Bool bOn = sal_True );
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+
+ sal_Bool IsOn() const { return bOn; }
+
+ short GetOffset() const { return nOffset; }
+ void SetOffset( short nOff ) { nOffset = nOff; }
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: relatives Seitennummern - Abfrage Feld
+ --------------------------------------------------------------------*/
+
+class SwRefPageGetFieldType : public SwFieldType
+{
+ SwDoc* pDoc;
+ sal_Int16 nNumberingType;
+
+ void UpdateField( SwTxtFld* pTxtFld, _SetGetExpFlds& rSetList );
+protected:
+ // ueberlagert, um alle RefPageGet-Felder zu updaten
+ virtual void Modify( const SfxPoolItem*, const SfxPoolItem * );
+public:
+ SwRefPageGetFieldType( SwDoc* pDoc );
+ virtual SwFieldType* Copy() const;
+ sal_uInt16 MakeSetList( _SetGetExpFlds& rTmpLst );
+ SwDoc* GetDoc() const { return pDoc; }
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Relative Seitennummerierung Abfragen
+ --------------------------------------------------------------------*/
+
+class SwRefPageGetField : public SwField
+{
+ String sTxt;
+public:
+ SwRefPageGetField( SwRefPageGetFieldType*, sal_uInt32 nFmt );
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ void SetText( const String& rTxt ) { sTxt = rTxt; }
+
+ void ChangeExpansion( const SwFrm* pFrm, const SwTxtFld* pFld );
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feld zum Anspringen und Editieren
+ --------------------------------------------------------------------*/
+
+class SwJumpEditFieldType : public SwFieldType
+{
+ SwDoc* pDoc;
+ SwDepend aDep;
+
+public:
+ SwJumpEditFieldType( SwDoc* pDoc );
+ virtual SwFieldType* Copy() const;
+
+ SwCharFmt* GetCharFmt();
+};
+
+class SwJumpEditField : public SwField
+{
+ String sTxt, sHelp;
+public:
+ SwJumpEditField( SwJumpEditFieldType*, sal_uInt32 nFormat,
+ const String& sText, const String& sHelp );
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ // Platzhalter-Text
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+
+ // HinweisText
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+
+ SwCharFmt* GetCharFmt() const
+ { return ((SwJumpEditFieldType*)GetTyp())->GetCharFmt(); }
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Script Fieldtype
+ --------------------------------------------------------------------*/
+
+class SwScriptFieldType : public SwFieldType
+{
+ SwDoc* pDoc;
+public:
+ SwScriptFieldType( SwDoc* pDoc );
+
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Script Field
+ --------------------------------------------------------------------*/
+
+class SwScriptField : public SwField
+{
+ String sType; // Type von Code (Java/VBScript/...)
+ String sCode; // der Code als Text
+ // der Code als JavaCode ?
+
+ sal_Bool bCodeURL; // Code enthaelt URL eines Scripts
+
+public:
+ SwScriptField( SwScriptFieldType*, const String& rType,
+ const String& rCode, sal_Bool bURL=sal_False );
+
+ virtual String GetDescription() const;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ // Type
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+ // Text
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+
+ sal_Bool IsCodeURL() const { return bCodeURL; }
+ void SetCodeURL( sal_Bool bURL ) { bCodeURL = bURL; }
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Combined Character Fieldtype
+ --------------------------------------------------------------------*/
+
+class SwCombinedCharFieldType : public SwFieldType
+{
+public:
+ SwCombinedCharFieldType();
+
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Script Field
+ --------------------------------------------------------------------*/
+
+#define MAX_COMBINED_CHARACTERS 6
+
+class SW_DLLPUBLIC SwCombinedCharField : public SwField
+{
+ String sCharacters; // combine these characters
+
+public:
+ SwCombinedCharField( SwCombinedCharFieldType*, const String& rChars );
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ // Characters
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+
+#endif // SW_DOCUFLD_HXX
diff --git a/sw/inc/dpage.hxx b/sw/inc/dpage.hxx
new file mode 100644
index 000000000000..84a1b2c99ba1
--- /dev/null
+++ b/sw/inc/dpage.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DPAGE_HXX
+#define _DPAGE_HXX
+
+#ifndef _FM_FMPAGE_HXX
+#include <svx/fmpage.hxx>
+#endif
+#include <svx/svdobj.hxx>
+
+class SdrPageGridFrameList;
+class SwDrawDocument;
+class SwDoc;
+
+class SwDPage : public FmFormPage, public SdrObjUserCall
+{
+ SdrPageGridFrameList* pGridLst;
+ SwDoc& rDoc;
+
+public:
+ SwDPage(SwDrawDocument& rNewModel, sal_Bool bMasterPage=sal_False);
+ ~SwDPage();
+
+ // #i3694#
+ // This GetOffset() method is not needed anymore, it even leads to errors.
+ // virtual Point GetOffset() const;
+ virtual SdrObject* ReplaceObject( SdrObject* pNewObj, sal_uLong nObjNum );
+
+ virtual const SdrPageGridFrameList* GetGridFrameList(const SdrPageView* pPV,
+ const Rectangle *pRect) const;
+
+ sal_Bool RequestHelp( Window* pWindow, SdrView* pView, const HelpEvent& rEvt );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage();
+};
+
+#endif // _DPAGE_HXX
+
+
+
diff --git a/sw/inc/drawdoc.hxx b/sw/inc/drawdoc.hxx
new file mode 100644
index 000000000000..cca6390e9198
--- /dev/null
+++ b/sw/inc/drawdoc.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _DRAWDOC_HXX
+#define _DRAWDOC_HXX
+
+#ifndef _FM_FMMODEL_HXX
+#include <svx/fmmodel.hxx>
+#endif
+
+class SwDoc;
+class SwDocShell;
+
+//==================================================================
+
+class SwDrawDocument : public FmFormModel
+{
+ SwDoc* pDoc;
+public:
+ SwDrawDocument( SwDoc* pDoc );
+ ~SwDrawDocument();
+
+ const SwDoc& GetDoc() const { return *pDoc; }
+ SwDoc& GetDoc() { return *pDoc; }
+
+ virtual SdrPage* AllocPage(FASTBOOL bMasterPage);
+
+ // fuers "load on demand" von Grafiken im DrawingLayer
+ virtual SvStream* GetDocumentStream( SdrDocumentStreamInfo& rInfo ) const;
+
+ // fuers Speicher von Rechtecken als Control-Ersatz fuker Versionen < 5.0
+ virtual SdrLayerID GetControlExportLayerId( const SdrObject & ) const;
+
+protected:
+ // --> OD 2006-03-01 #b6382898#
+ // overload of <SdrModel::createUnoModel()> is needed to provide corresponding uno model.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel();
+ // <--
+};
+
+
+#endif
diff --git a/sw/inc/edglbldc.hxx b/sw/inc/edglbldc.hxx
new file mode 100644
index 000000000000..23e63a8483d8
--- /dev/null
+++ b/sw/inc/edglbldc.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _EDGLBLDC_HXX
+#define _EDGLBLDC_HXX
+
+#include <svl/svarray.hxx>
+
+class SwSection;
+class SwTOXBase;
+class SwTOXBaseSection;
+
+enum GlobalDocContentType {
+ GLBLDOC_UNKNOWN,
+ GLBLDOC_TOXBASE,
+ GLBLDOC_SECTION
+};
+
+class SwGlblDocContent
+{
+ GlobalDocContentType eType;
+ sal_uLong nDocPos;
+ union {
+ const SwTOXBase* pTOX;
+ const SwSection* pSect;
+ } PTR;
+
+public:
+ SwGlblDocContent( sal_uLong nPos );
+ SwGlblDocContent( const SwTOXBaseSection* pTOX );
+ SwGlblDocContent( const SwSection* pSect );
+
+ // Inhalte abfragen
+ GlobalDocContentType GetType() const { return eType; }
+ const SwSection* GetSection() const
+ { return GLBLDOC_SECTION == eType ? PTR.pSect : 0; }
+ const SwTOXBase* GetTOX() const
+ { return GLBLDOC_TOXBASE == eType ? PTR.pTOX : 0; }
+ sal_uLong GetDocPos() const { return nDocPos; }
+
+ // fuers Sortieren
+ inline int operator==( const SwGlblDocContent& rCmp ) const
+ { return GetDocPos() == rCmp.GetDocPos(); }
+ inline int operator<( const SwGlblDocContent& rCmp ) const
+ { return GetDocPos() < rCmp.GetDocPos(); }
+};
+
+
+typedef SwGlblDocContent* SwGlblDocContentPtr;
+SV_DECL_PTRARR_SORT_DEL( SwGlblDocContents, SwGlblDocContentPtr, 10, 10 )
+
+
+
+#endif
diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx
new file mode 100644
index 000000000000..16a2a3ecb2f5
--- /dev/null
+++ b/sw/inc/edimp.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _EDIMP_HXX
+#define _EDIMP_HXX
+
+#include <tools/solar.h>
+#include <svl/svarray.hxx>
+
+class SwPaM;
+class SwNodeIndex;
+
+/*
+ * MACROS um ueber alle Bereiche zu iterieren
+ */
+#define PCURCRSR (_pStartCrsr)
+
+#define FOREACHPAM_START(pCURSH) \
+ {\
+ SwPaM *_pStartCrsr = (pCURSH)->GetCrsr(), *__pStartCrsr = _pStartCrsr; \
+ do {
+
+#define FOREACHPAM_END() \
+ } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); \
+ }
+
+
+
+struct SwPamRange
+{
+ sal_uLong nStart, nEnd;
+
+ SwPamRange() : nStart( 0 ), nEnd( 0 ) {}
+ SwPamRange( sal_uLong nS, sal_uLong nE ) : nStart( nS ), nEnd( nE ) {}
+
+ sal_Bool operator==( const SwPamRange& rRg )
+ { return nStart == rRg.nStart ? sal_True : sal_False; }
+ sal_Bool operator<( const SwPamRange& rRg )
+ { return nStart < rRg.nStart ? sal_True : sal_False; }
+};
+
+SV_DECL_VARARR_SORT( _SwPamRanges, SwPamRange, 0, 1 )
+
+class SwPamRanges : private _SwPamRanges
+{
+public:
+ SwPamRanges( const SwPaM& rRing );
+
+ void Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 );
+ SwPaM& SetPam( sal_uInt16 nArrPos, SwPaM& rPam );
+
+ sal_uInt16 Count() const
+ { return _SwPamRanges::Count(); }
+ SwPamRange operator[]( sal_uInt16 nPos ) const
+ { return _SwPamRanges::operator[](nPos); }
+};
+
+
+#endif
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
new file mode 100644
index 000000000000..43992dc7b359
--- /dev/null
+++ b/sw/inc/editsh.hxx
@@ -0,0 +1,974 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _EDITSH_HXX
+#define _EDITSH_HXX
+
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <tools/string.hxx>
+#include <svl/svarray.hxx>
+#include <vcl/font.hxx>
+#include <editeng/swafopt.hxx>
+#include "swdllapi.h"
+#include <crsrsh.hxx> // fuer Basisklasse
+#include <itabenum.hxx>
+#include <swdbdata.hxx>
+#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
+#include <com/sun/star/linguistic2/ProofreadingResult.hpp>
+#include <fldupde.hxx>
+#include <tblenum.hxx>
+#include <IMark.hxx>
+
+#include <vector>
+#include <swundo.hxx>
+#include <svtools/embedhlp.hxx>
+
+class PolyPolygon;
+class SwDoc;
+class DateTime;
+class CommandExtTextInputData;
+
+class SvUShortsSort;
+class SvNumberFormatter;
+class SfxPoolItem;
+class SfxItemSet;
+class SvxAutoCorrect;
+
+class SwField; // fuer Felder
+class SwFieldType;
+class SwDDEFieldType;
+class SwNewDBMgr;
+
+struct SwDocStat;
+class SvStringsDtor;
+class SvStringsSort;
+class SwAutoCompleteWord;
+
+class SwFmtRefMark;
+
+class SwNumRule; // Numerierung
+//class SwNodeNum; // Numerierung
+
+class SwTxtFmtColl;
+class SwGrfNode;
+class SwFlyFrmFmt;
+
+class SwFrmFmt; // fuer GetTxtNodeFmts()
+class SwCharFmt;
+class SwExtTextInput;
+class SwRootFrm; // fuer CTOR
+class Graphic; // fuer GetGraphic
+class GraphicObject; // fuer GetGraphicObj
+class SwFmtINetFmt; // InsertURL
+class SwTable;
+class SwTextBlocks; // fuer GlossaryRW
+class SwFmtFtn;
+class SwSection;
+class SwSectionData;
+class SwSectionFmt;
+class SwTOXMarks;
+class SwTOXBase;
+class SwTOXType;
+class SwTableAutoFmt;
+class SwPageDesc;
+class SwTxtINetFmt;
+class SwSeqFldList;
+class SwGlblDocContent;
+class SwGlblDocContents;
+class SwRedline;
+class SwRedlineData;
+class SwFtnInfo;
+class SwEndNoteInfo;
+class SwLineNumberInfo;
+class SwAuthEntry;
+class SwRewriter;
+struct SwConversionArgs;
+
+
+namespace com { namespace sun { namespace star { namespace uno {
+ template < class > class Sequence;
+}}}}
+
+namespace svx{
+struct SpellPortion;
+typedef std::vector<SpellPortion> SpellPortions;
+}
+
+namespace sfx2{
+class LinkManager;
+}
+
+namespace sw {
+ class UndoRedoContext;
+}
+
+#define GETSELTXT_PARABRK_TO_BLANK 0
+#define GETSELTXT_PARABRK_KEEP 1
+#define GETSELTXT_PARABRK_TO_ONLYCR 2
+
+/****************************************************************
+ * zum Abfragen der INet-Attribute fuer den Navigator
+ ****************************************************************/
+struct SwGetINetAttr
+{
+ String sText;
+ const SwTxtINetFmt& rINetAttr;
+
+ SwGetINetAttr( const String& rTxt, const SwTxtINetFmt& rAttr )
+ : sText( rTxt ), rINetAttr( rAttr )
+ {}
+};
+SV_DECL_PTRARR_DEL( SwGetINetAttrs, SwGetINetAttr*, 0, 5 )
+
+/****************************************************************
+ * Typen der Inhaltsformen
+ ****************************************************************/
+#define CNT_TXT 0x0001
+#define CNT_GRF 0x0002
+#define CNT_OLE 0x0010
+/* Teste einen sal_uInt16 auf eine bestimmte Inhaltsform */
+#define CNT_HasTxt(USH) ((USH)&CNT_TXT)
+#define CNT_HasGrf(USH) ((USH)&CNT_GRF)
+#define CNT_HasOLE(USH) ((USH)&CNT_OLE)
+
+class SW_DLLPUBLIC SwEditShell: public SwCrsrShell
+{
+ static SvxSwAutoFmtFlags* pAutoFmtFlags;
+
+ // fuer die privaten Methoden DelRange und die vom AutoCorrect
+ friend class SwAutoFormat;
+ friend void _InitCore();
+ friend void _FinitCore();
+ // fuer die PamCorrAbs/-Rel Methoden
+ friend class SwUndo;
+
+ SW_DLLPRIVATE SfxPoolItem& _GetChrFmt( SfxPoolItem& ) const;
+
+ /*
+ * liefert einen Pointer auf einen SwGrfNode; dieser wird von
+ * GetGraphic() und GetGraphicSize() verwendet.
+ */
+ SW_DLLPRIVATE SwGrfNode *_GetGrfNode() const ;
+
+ SW_DLLPRIVATE void DeleteSel( SwPaM& rPam, sal_Bool* pUndo = 0 );
+
+ SW_DLLPRIVATE void _SetSectionAttr( SwSectionFmt& rSectFmt, const SfxItemSet& rSet );
+
+ using ViewShell::UpdateFlds;
+ using SwModify::GetInfo;
+
+public:
+ // Editieren (immer auf allen selektierten Bereichen)
+ void Insert( sal_Unicode, sal_Bool bOnlyCurrCrsr = sal_False );
+ void Insert2( const String &, const bool bForceExpandHints = false );
+ void Overwrite( const String & );
+
+ // Ersetz einen selektierten Bereich in einem TextNode mit dem
+ // String. Ist fuers Suchen&Ersetzen gedacht.
+ // bRegExpRplc - ersetze Tabs (\\t) und setze den gefundenen String
+ // ein ( nicht \& )
+ // z.B.: Fnd: "zzz", Repl: "xx\t\\t..&..\&"
+ // --> "xx\t<Tab>..zzz..&"
+ sal_Bool Replace( const String& rNewStr, sal_Bool bRegExpRplc = sal_False );
+
+ // loescht den Inhalt aller Bereiche;
+ // werden ganze Nodes selektiert, werden die Nodes geloescht
+ long Delete();
+
+ // remove a complete paragraph
+ sal_Bool DelFullPara();
+
+ // change text to Upper/Lower/Hiragana/Katagana/...
+ void TransliterateText( sal_uInt32 nType );
+
+ // count words in current selection
+ void CountWords( SwDocStat& rStat ) const;
+
+ // loesche den nicht sichtbaren Content aus dem Document, wie z.B.:
+ // versteckte Bereiche, versteckte Absaetze
+ sal_Bool RemoveInvisibleContent();
+
+ // replace fields by text - mailmerge support
+ sal_Bool ConvertFieldsToText();
+ // set all numbering start points to a fixed value - mailmerge support
+ void SetNumberingRestart();
+
+ // embedded alle lokalen Links (Bereiche/Grafiken)
+ sal_uInt16 GetLinkUpdMode(sal_Bool bDocSettings = sal_False) const;
+ void SetLinkUpdMode( sal_uInt16 nMode );
+
+ // kopiere den Inhalt aller Bereiche an die akt. Cursor-Position
+ // in die angegebene Shell
+ long Copy( SwEditShell* pDestShell = 0 );
+
+ // fuers Kopieren uebers ClipBoard:
+ // wird Tabelle in Tabelle kopiert, verschiebe aus dieser dann
+ // alle Cursor. Copy und Paste muss aufgrund der FlyFrames in
+ // der FEShell stehen!
+ // kopiere alle Selectionen und das Doc
+ //JP 21.10.96: und fuer die SVX-Autokorrektur
+ sal_Bool _CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pNdInsPos = 0 );
+
+ long SplitNode( sal_Bool bAutoFormat = sal_False, sal_Bool bCheckTableStart = sal_True );
+ sal_Bool AppendTxtNode();
+ void AutoFmtBySplitNode();
+
+ // ist der Cursor in einem INetAttribut, dann wird das komplett
+ // geloescht; inclusive des Hinweistextes (wird beim Drag&Drop gebraucht)
+ sal_Bool DelINetAttrWithText();
+
+ // ist der Cursor am Ende einer Zeichenvorlage, an der das DontExpand-Flag
+ // noch nicht gesetzt ist, wird dies gesetzt ( => return sal_True; )
+ sal_Bool DontExpandFmt();
+
+ // Anwenden / Entfernen von Attributen
+ // liefert Attribute im angeforderten AttributSet. Wenn nicht eindeutig
+ // steht im Set ein DONT_CARE !!
+ // --> OD 2008-01-16 #newlistlevelattrs#
+ // Renaming method to <GetCurAttr(..)> indicating that the attributes at
+ // the current cursors are retrieved.
+ // Introduce 2nd optional parameter <bMergeIndentValuesOfNumRule>.
+ // If <bMergeIndentValuesOfNumRule> == sal_True, the indent attributes of
+ // the corresponding list level of an applied list style is merged into
+ // the requested item set as a LR-SPACE item, if corresponding node has not
+ // its own indent attributes and the position-and-space mode of the list
+ // level is SvxNumberFormat::LABEL_ALIGNMENT.
+ sal_Bool GetCurAttr( SfxItemSet& ,
+ const bool bMergeIndentValuesOfNumRule = false ) const;
+ // <--
+ void SetAttr( const SfxPoolItem&, sal_uInt16 nFlags = 0 );
+ void SetAttr( const SfxItemSet&, sal_uInt16 nFlags = 0 );
+
+ // Setze das Attribut als neues default Attribut im Dokument.
+ void SetDefault( const SfxPoolItem& );
+
+ // Erfrage das Default Attribut vom Dokument.
+ const SfxPoolItem& GetDefault( sal_uInt16 nFmtHint ) const;
+
+ void ResetAttr( const SvUShortsSort* pAttrs = 0 );
+ void GCAttr();
+
+ // returns the scripttpye of the selection
+ sal_uInt16 GetScriptType() const;
+
+ // returns the language at current cursor position
+ sal_uInt16 GetCurLang() const;
+
+ // TABLE
+ sal_uInt16 GetTblFrmFmtCount( sal_Bool bUsed = sal_False ) const;
+ SwFrmFmt& GetTblFrmFmt(sal_uInt16 nFmt, sal_Bool bUsed = sal_False ) const;
+ String GetUniqueTblName() const;
+
+ // CHAR
+ sal_uInt16 GetCharFmtCount() const;
+ SwCharFmt& GetCharFmt(sal_uInt16 nFmt) const;
+ SwCharFmt* GetCurCharFmt() const;
+ void FillByEx(SwCharFmt*, sal_Bool bReset = sal_False);
+ SwCharFmt* MakeCharFmt( const String& rName, SwCharFmt* pDerivedFrom = 0 );
+ SwCharFmt* FindCharFmtByName( const String& rName ) const;
+
+
+ /* Formatcollections, neu */
+ /* GetXXXCount() liefert die Anzahl der im Dokument vorhandenen XXX
+ * GetXXX(i) liefert das i-te XXX (ERR_RAISE bei Ueberindizierung!)
+ * DelXXX(i) loescht das i-te XXX (ERR_RAISE bei Ueberindizierung!)
+ * GetCurXXX() liefert das am Cursor oder in den Bereichen
+ * geltende XXX (0, wenn nicht eindeutig!)
+ * SetXXX() setzt am Cursor oder in den Bereichen das XXX
+ * MakeXXX() macht ein XXX, abgeleitet vom pDerivedFrom
+ */
+
+ // TXT
+ SwTxtFmtColl& GetDfltTxtFmtColl() const;
+ sal_uInt16 GetTxtFmtCollCount() const;
+ SwTxtFmtColl& GetTxtFmtColl( sal_uInt16 nTxtFmtColl) const;
+ SwTxtFmtColl* GetCurTxtFmtColl() const;
+ // --> OD 2007-11-06 #i62675#
+ // Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTxtFmtColl(..)>
+ void SetTxtFmtColl( SwTxtFmtColl*,
+ bool bResetListAttrs = false );
+ // <--
+ SwTxtFmtColl *MakeTxtFmtColl(const String &rFmtCollName,
+ SwTxtFmtColl *pDerivedFrom = 0);
+ void FillByEx(SwTxtFmtColl*, sal_Bool bReset = sal_False);
+ SwTxtFmtColl* FindTxtFmtCollByName( const String& rName ) const;
+
+ // Gebe die "Auto-Collection" mit der Id zurueck. Existiert
+ // sie noch nicht, dann erzuege sie
+ SwTxtFmtColl* GetTxtCollFromPool( sal_uInt16 nId );
+ // return das geforderte automatische Format - Basis-Klasse !
+ SwFmt* GetFmtFromPool( sal_uInt16 nId );
+ // returne die geforderte automatische Seiten-Vorlage
+ SwPageDesc* GetPageDescFromPool( sal_uInt16 nId );
+
+ // erfrage ob die Absatz-/Zeichen-/Rahmen-/Seiten - Vorlage benutzt wird
+ sal_Bool IsUsed( const SwModify& ) const;
+
+ // returne das geforderte automatische Format
+ SwFrmFmt* GetFrmFmtFromPool( sal_uInt16 nId )
+ { return (SwFrmFmt*)SwEditShell::GetFmtFromPool( nId ); }
+ SwCharFmt* GetCharFmtFromPool( sal_uInt16 nId )
+ { return (SwCharFmt*)SwEditShell::GetFmtFromPool( nId ); }
+
+ // Felder
+ void Insert2(SwField&, const bool bForceExpandHints = false);
+ SwField* GetCurFld() const;
+
+ void UpdateFlds( SwField & ); // ein einzelnes Feld
+
+ sal_uInt16 GetFldTypeCount(sal_uInt16 nResId = USHRT_MAX, sal_Bool bUsed = sal_False) const;
+ SwFieldType* GetFldType(sal_uInt16 nId, sal_uInt16 nResId = USHRT_MAX, sal_Bool bUsed = sal_False) const;
+ SwFieldType* GetFldType(sal_uInt16 nResId, const String& rName) const;
+
+ void RemoveFldType(sal_uInt16 nId, sal_uInt16 nResId = USHRT_MAX);
+ void RemoveFldType(sal_uInt16 nResId, const String& rName);
+
+ void FieldToText( SwFieldType* pType );
+
+ void ChangeAuthorityData(const SwAuthEntry* pNewData);
+
+ // Datenbankinfo
+ SwDBData GetDBData() const;
+ const SwDBData& GetDBDesc() const;
+ void ChgDBData(const SwDBData& SwDBData);
+ void ChangeDBFields( const SvStringsDtor& rOldNames,
+ const String& rNewName );
+ void GetAllUsedDB( SvStringsDtor& rDBNameList,
+ SvStringsDtor* pAllDBNames = 0 );
+
+ sal_Bool IsAnyDatabaseFieldInDoc()const;
+ //check whether DB fields point to an available data source and returns it
+ sal_Bool IsFieldDataSourceAvailable(String& rUsedDataSource) const;
+ void UpdateExpFlds(sal_Bool bCloseDB = sal_False);// nur alle ExpressionFelder updaten
+ void SetFixFields( sal_Bool bOnlyTimeDate = sal_False,
+ const DateTime* pNewDateTime = 0 );
+ void LockExpFlds();
+ void UnlockExpFlds();
+
+ SwFldUpdateFlags GetFldUpdateFlags(sal_Bool bDocSettings = sal_False) const;
+ void SetFldUpdateFlags( SwFldUpdateFlags eFlags );
+
+ // fuer die Evaluierung der DBFelder (neuer DB-Manager)
+ SwNewDBMgr* GetNewDBMgr() const;
+
+ SwFieldType* InsertFldType(const SwFieldType &);
+
+ // Aenderungen am Dokument?
+ sal_Bool IsModified() const;
+ void SetModified();
+ void ResetModified();
+ void SetUndoNoResetModified();
+
+ // Dokument - Statistics
+ void UpdateDocStat( SwDocStat& rStat );
+
+ // Verzeichnismarke einfuegen loeschen
+ void Insert(const SwTOXMark& rMark);
+ void DeleteTOXMark(SwTOXMark* pMark);
+
+ // Alle Markierungen am aktuellen SPoint ermitteln
+ sal_uInt16 GetCurTOXMarks(SwTOXMarks& rMarks) const ;
+
+ // Verzeichnis einfuegen, und bei Bedarf erneuern
+ void InsertTableOf(const SwTOXBase& rTOX,
+ const SfxItemSet* pSet = 0);
+ sal_Bool UpdateTableOf(const SwTOXBase& rTOX,
+ const SfxItemSet* pSet = 0);
+ const SwTOXBase* GetCurTOX() const;
+ const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, sal_Bool bCreate = sal_False );
+ void SetDefaultTOXBase(const SwTOXBase& rBase);
+
+ sal_Bool IsTOXBaseReadonly(const SwTOXBase& rTOXBase) const;
+ void SetTOXBaseReadonly(const SwTOXBase& rTOXBase, sal_Bool bReadonly);
+
+ sal_uInt16 GetTOXCount() const;
+ const SwTOXBase* GetTOX( sal_uInt16 nPos ) const;
+ sal_Bool DeleteTOX( const SwTOXBase& rTOXBase, sal_Bool bDelNodes = sal_False );
+
+ // nach einlesen einer Datei alle Verzeichnisse updaten
+ void SetUpdateTOX( sal_Bool bFlag = sal_True );
+ sal_Bool IsUpdateTOX() const;
+
+ // Verzeichnis-Typen verwalten
+ sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const;
+ const SwTOXType* GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const;
+ void InsertTOXType(const SwTOXType& rTyp);
+
+ //AutoMark file
+ const String& GetTOIAutoMarkURL() const;
+ void SetTOIAutoMarkURL(const String& rSet);
+ void ApplyAutoMark();
+
+ // Schluessel fuer die Indexverwaltung
+ sal_uInt16 GetTOIKeys( SwTOIKeyType eTyp, SvStringsSort& rArr ) const;
+
+ void SetOutlineNumRule(const SwNumRule&);
+ const SwNumRule* GetOutlineNumRule() const;
+ // Gliederung - hoch-/runterstufen
+ sal_Bool OutlineUpDown( short nOffset = 1 );
+ // Gliederung - hoch-/runtermoven
+ sal_Bool MoveOutlinePara( short nOffset = 1);
+ // Outlines and SubOutline are protected ?
+ sal_Bool IsProtectedOutlinePara() const;
+
+ // Numerierung Aufzaehlunglisten
+ // liefert Regelwerk der aktuellen Aufzaehlung (sal_False sonst)
+ const SwNumRule* GetCurNumRule() const;
+
+ // setzt, wenn noch keine Numerierung, sonst wird geaendert
+ // arbeitet mit alten und neuen Regeln, nur Differenzen aktualisieren
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // Add optional parameter <bResetIndentAttrs> (default value sal_False).
+ // If <bResetIndentAttrs> equals true, the indent attributes "before text"
+ // and "first line indent" are additionally reset at the current selection,
+ // if the list style makes use of the new list level attributes.
+ // --> OD 2008-03-17 #refactorlists#
+ // introduce parameters <bCreateNewList> and <sContinuedListId>
+ // <bCreateNewList> indicates, if a new list is created by applying the
+ // given list style.
+ // If <bCreateNewList> equals sal_False, <sContinuedListId> may contain the
+ // list Id of a list, which has to be continued by applying the given list style
+ void SetCurNumRule( const SwNumRule&,
+ const bool bCreateNewList /*= false*/,
+ const String sContinuedListId = String(),
+ const bool bResetIndentAttrs = false );
+ // <--
+ // Absaetze ohne Numerierung, aber mit Einzuegen
+ sal_Bool NoNum();
+ // Loeschen, Splitten der Aufzaehlungsliste
+ void DelNumRules();
+ // Hoch-/Runterstufen
+ sal_Bool NumUpDown( sal_Bool bDown = sal_True );
+ // Hoch-/Runtermoven sowohl innerhalb als auch ausserhalb von Numerierungen
+ sal_Bool MoveParagraph( long nOffset = 1);
+ sal_Bool MoveNumParas( sal_Bool bUpperLower, sal_Bool bUpperLeft );
+ // No-/Numerierung ueber Delete/Backspace ein/abschalten #115901#
+ sal_Bool NumOrNoNum( sal_Bool bDelete = sal_False, sal_Bool bChkStart = sal_True);
+ // -> #i23726#
+ // --> OD 2008-06-09 #i90078#
+ // Remove unused default parameter <nLevel> and <bRelative>.
+ // Adjust method name and parameter name
+ void ChangeIndentOfAllListLevels( short nDiff );
+ // Adjust method name
+ void SetIndent(short nIndent, const SwPosition & rPos);
+ // <--
+ sal_Bool IsFirstOfNumRule() const;
+ sal_Bool IsFirstOfNumRule(const SwPaM & rPaM) const;
+ // <- #i23726#
+
+ sal_Bool IsNoNum( sal_Bool bChkStart = sal_True ) const;
+ // returne den Num-Level des Nodes, in dem sich der Point vom
+ // Cursor befindet. Return kann sein :
+ // - NO_NUMBERING, 0..MAXLEVEL-1, NO_NUMLEVEL .. NO_NUMLEVEL|MAXLEVEL-1
+ // --> OD 2008-02-29 #refactorlists# - removed <pHasChilds>
+// sal_uInt8 GetNumLevel( sal_Bool* pHasChilds = 0 ) const;
+ sal_uInt8 GetNumLevel() const;
+ // <--
+ // detect highest and lowest level to check moving of outline levels
+ void GetCurrentOutlineLevels( sal_uInt8& rUpper, sal_uInt8& rLower );
+
+
+ // get Outline level of current paragraph
+ int GetCurrentParaOutlineLevel( ) const;// #outlinelevel add by zhaojianwei
+
+ // -> i29560
+ sal_Bool HasNumber() const;
+ sal_Bool HasBullet() const;
+ // <- i29560
+
+ String GetUniqueNumRuleName( const String* pChkStr = 0, sal_Bool bAutoNum = sal_True ) const;
+ void ChgNumRuleFmts( const SwNumRule& rRule );
+ // setze und erfrage, ob an aktueller PointPos eine Numerierung mit
+ // dem StartFlag startet
+ void SetNumRuleStart( sal_Bool bFlag = sal_True );
+ sal_Bool IsNumRuleStart() const;
+ void SetNodeNumStart( sal_uInt16 nStt );
+ // --> OD 2008-02-29 #refactorlists#
+ sal_uInt16 GetNodeNumStart() const;
+ // <--
+ sal_Bool ReplaceNumRule( const String& rOldRule, const String& rNewRule );
+ // Searches for a text node with a numbering rule.
+ // --> OD 2008-03-18 #refactorlists# - add output parameter <sListId>
+ // in case a list style is found, <sListId> holds the list id, to which the
+ // text node belongs, which applies the found list style.
+ const SwNumRule * SearchNumRule(const bool bForward,
+ const bool bNum,
+ const bool bOutline,
+ int nNonEmptyAllowed,
+ String& sListId );
+ // <--
+
+ // Undo
+ // UndoHistory am Dokument pflegen
+ // bei Save, SaveAs, Create wird UndoHistory zurueckgesetzt ???
+ void DoUndo( sal_Bool bOn = sal_True );
+ sal_Bool DoesUndo() const;
+ void DoGroupUndo( sal_Bool bUn = sal_True );
+ sal_Bool DoesGroupUndo() const;
+ void DelAllUndoObj();
+
+ // macht rueckgaengig:
+ // setzt Undoklammerung auf, liefert nUndoId der Klammerung
+ SwUndoId StartUndo( SwUndoId eUndoId = UNDO_EMPTY, const SwRewriter * pRewriter = 0 );
+ // schliesst Klammerung der nUndoId, nicht vom UI benutzt
+ SwUndoId EndUndo( SwUndoId eUndoId = UNDO_EMPTY, const SwRewriter * pRewriter = 0 );
+
+ bool GetLastUndoInfo(::rtl::OUString *const o_pStr,
+ SwUndoId *const o_pId) const;
+ bool GetFirstRedoInfo(::rtl::OUString *const o_pStr) const;
+ SwUndoId GetRepeatInfo(::rtl::OUString *const o_pStr) const;
+
+ /// is it forbidden to modify cursors via API calls?
+ bool CursorsLocked() const;
+ /// set selections to those contained in the UndoRedoContext
+ /// should only be called by sw::UndoManager!
+ void HandleUndoRedoContext(::sw::UndoRedoContext & rContext);
+
+ bool Undo(sal_uInt16 const nCount = 1);
+ bool Redo(sal_uInt16 const nCount = 1);
+ bool Repeat(sal_uInt16 const nCount);
+
+ // fuer alle Sichten auf dieses Dokument
+ void StartAllAction();
+ void EndAllAction();
+
+ //Damit Start-/EndActions aufgesetzt werden koennen.
+ void CalcLayout();
+
+ // Inhaltsform bestimmen, holen, liefert Type am CurCrsr->SPoint
+ sal_uInt16 GetCntType() const;
+ sal_Bool HasOtherCnt() const; // gibt es Rahmen, Fussnoten, ...
+
+ /* Anwenden der ViewOptions mit Start-/EndAction */
+ virtual void ApplyViewOptions( const SwViewOption &rOpt );
+
+ // Text innerhalb der Selektion erfragen
+ // Returnwert liefert sal_False, wenn der selektierte Bereich
+ // zu gross ist, um in den Stringpuffer kopiert zu werden
+ // oder andere Fehler auftreten
+ sal_Bool GetSelectedText( String &rBuf,
+ int nHndlParaBreak = GETSELTXT_PARABRK_TO_BLANK );
+
+ /*
+ * liefert eine Graphic, wenn CurCrsr->Point() auf einen
+ * SwGrfNode zeigt (und Mark nicht gesetzt ist oder auf die
+ * gleiche Graphic zeigt), sonst gibt's was auf die Finger
+ */
+ // --> OD 2005-02-09 #119353# - robust
+ const Graphic* GetGraphic( sal_Bool bWait = sal_True ) const;
+ const GraphicObject* GetGraphicObj() const;
+ // <--
+ sal_Bool IsGrfSwapOut( sal_Bool bOnlyLinked = sal_False ) const;
+ sal_uInt16 GetGraphicType() const;
+
+ const PolyPolygon *GetGraphicPolygon() const;
+ void SetGraphicPolygon( const PolyPolygon *pPoly );
+
+ // If there's an automatic, not manipulated polygon at the selected
+ // notxtnode, it has to be deleted, e.g. cause the object has changed.
+ void ClearAutomaticContour();
+
+ /*
+ * liefert die Groesse einer Graphic in Twips, wenn der Cursor
+ * auf einer Graphic steht; sal_Bool liefert sal_False, wenn s.o.
+ */
+ sal_Bool GetGrfSize(Size&) const;
+ /*
+ * liefert den Namen und den Filter einer Graphic, wenn der Cursor
+ * auf einer Graphic steht, sonst gibt's was auf die Finger!
+ * Ist ein String-Ptr != 0 dann returne den entsp. Namen
+ */
+ void GetGrfNms( String* pGrfName, String* pFltName,
+ const SwFlyFrmFmt* = 0 ) const;
+ /*
+ * erneutes Einlesen, falls Graphic nicht Ok ist. Die
+ * aktuelle wird durch die neue ersetzt.
+ */
+ void ReRead( const String& rGrfName, const String& rFltName,
+ const Graphic* pGraphic = 0,
+ const GraphicObject* pGrafObj = 0 );
+
+// // alternativen Text einer Grafik/OLe-Objectes abfragen/setzen
+// const String& GetAlternateText() const;
+// void SetAlternateText( const String& rTxt );
+
+ //eindeutige Identifikation des Objektes (fuer ImageMapDlg)
+ void *GetIMapInventor() const;
+ // --> OD 2007-03-01 #i73788#
+ // remove default parameter, because method always called this default value
+ Graphic GetIMapGraphic() const; //liefert eine Graphic fuer alle Flys!
+ // <--
+ const SwFlyFrmFmt* FindFlyByName( const String& rName, sal_uInt8 nNdTyp = 0 ) const;
+
+ //liefert ein ClientObject, wenn CurCrsr->Point() auf einen
+ //SwOLENode zeigt (und Mark nicht gesetzt ist oder auf das
+ //gleiche ClientObject zeigt), sonst gibt's was auf die
+ //Finger.
+ svt::EmbeddedObjectRef& GetOLEObject() const;
+ //Gibt es ein OleObject mit diesem Namen (SwFmt)?
+ sal_Bool HasOLEObj( const String &rName ) const;
+
+ //Liefert den Pointer auf die Daten des Chart, indem sich der Crsr
+ //befindet.
+ void SetChartName( const String &rName );
+
+ //Updaten der Inhalte aller Charts zu der Tabelle mit dem angegeben Namen
+ void UpdateCharts( const String &rName );
+
+ // aktuelles Wort erfragen
+ String GetCurWord();
+
+ // Textbaustein aus dem Textbausteindokument in
+ // das aktuelle Dokument, Vorlagen nur wenn es nicht schon gibt
+ void InsertGlossary( SwTextBlocks& rGlossary, const String& );
+ // aktuelle Selektion zum Textbaustein machen und ins
+ // Textbausteindokument einfuegen, einschliesslich Vorlagen
+ sal_uInt16 MakeGlossary( SwTextBlocks& rToFill, const String& rName,
+ const String& rShortName, sal_Bool bSaveRelFile = sal_False,
+ const String* pOnlyTxt=0 );
+ // speicher den gesamten Inhalt des Docs als Textbaustein
+ sal_uInt16 SaveGlossaryDoc( SwTextBlocks& rGlossary, const String& rName,
+ const String& rShortName,
+ sal_Bool bSaveRelFile = sal_False,
+ sal_Bool bOnlyTxt = sal_False );
+
+ // Linguistik
+ // Selektionen sichern
+ void HyphStart( SwDocPositions eStart, SwDocPositions eEnde );
+ // Selektionen wiederherstellen
+ void HyphEnd();
+ com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>
+ HyphContinue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
+ // zu trennendes Wort ignorieren
+ void HyphIgnore();
+
+ // zum Einfuegen des SoftHyphens, Position ist der Offset
+ // innerhalb des getrennten Wortes.
+ void InsertSoftHyph( const xub_StrLen nHyphPos );
+
+ //Tabelle
+ const SwTable& InsertTable( const SwInsertTableOptions& rInsTblOpts, // ALL_TBL_INS_ATTR
+ sal_uInt16 nRows, sal_uInt16 nCols,
+ sal_Int16 eAdj = com::sun::star::text::HoriOrientation::FULL,
+ const SwTableAutoFmt* pTAFmt = 0 );
+
+ void InsertDDETable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER
+ SwDDEFieldType* pDDEType,
+ sal_uInt16 nRows, sal_uInt16 nCols,
+ sal_Int16 eAdj = com::sun::star::text::HoriOrientation::FULL );
+
+ void UpdateTable();
+ void SetTableName( SwFrmFmt& rTblFmt, const String &rNewName );
+
+ SwFrmFmt *GetTableFmt();
+ sal_Bool TextToTable( const SwInsertTableOptions& rInsTblOpts, //ALL_TBL_INS_ATTR
+ sal_Unicode cCh,
+ sal_Int16 eAdj = com::sun::star::text::HoriOrientation::FULL,
+ const SwTableAutoFmt* pTAFmt = 0 );
+ sal_Bool TableToText( sal_Unicode cCh );
+ sal_Bool IsTextToTableAvailable() const;
+
+ sal_Bool GetTblBoxFormulaAttrs( SfxItemSet& rSet ) const;
+ void SetTblBoxFormulaAttrs( const SfxItemSet& rSet );
+
+ sal_Bool IsTableBoxTextFormat() const;
+ String GetTableBoxText() const;
+
+ // Change Modus erfragen/setzen
+ TblChgMode GetTblChgMode() const;
+ void SetTblChgMode( TblChgMode eMode );
+
+ // Tabelle an der Cursor Position aufsplitten
+ sal_Bool SplitTable( sal_uInt16 eMode );
+ // Tabellen verbinden
+ // CanMerge kann feststellen, ob Prev oder Next moeglich ist. Wird
+ // der Pointer pChkNxtPrv uebergeben, wird festgestellt in welche
+ // Richtung es moeglich ist.
+ sal_Bool CanMergeTable( sal_Bool bWithPrev = sal_True, sal_Bool* pChkNxtPrv = 0 ) const;
+ sal_Bool MergeTable( sal_Bool bWithPrev = sal_True, sal_uInt16 nMode = 0 );
+ // setze das InsertDB als Tabelle Undo auf:
+ void AppendUndoForInsertFromDB( sal_Bool bIsTable );
+
+ /*
+ functions used for spell checking and text conversion
+ */
+
+ // Selektionen sichern
+ void SpellStart( SwDocPositions eStart, SwDocPositions eEnde,
+ SwDocPositions eCurr, SwConversionArgs *pConvArgs = 0 );
+ // Selektionen wiederherstellen
+ void SpellEnd( SwConversionArgs *pConvArgs = 0, bool bRestoreSelection = true );
+ ::com::sun::star::uno::Any SpellContinue(
+ sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
+ SwConversionArgs *pConvArgs = 0 );
+
+ // spells on a sentence basis - the SpellPortions are needed
+ // returns false if no error could be found
+ bool SpellSentence(::svx::SpellPortions& rToFill, bool bIsGrammarCheck );
+ // make SpellIter start with the current sentence when called next time
+ void PutSpellingToSentenceStart();
+ // moves the continuation position to the end of the currently checked sentence
+ void MoveContinuationPosToEndOfCheckedSentence();
+ //applies a changed sentence
+ void ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, bool bRecheck);
+
+
+ // check SwSpellIter data to see if the last sentence got grammar checked
+ bool HasLastSentenceGotGrammarChecked() const;
+ // Is text conversion active somewhere else?
+ sal_Bool HasConvIter() const;
+ // Is hyphenation active somewhere else?
+ sal_Bool HasHyphIter() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellAlternatives >
+ GetCorrection( const Point* pPt, SwRect& rSelectRect );
+
+
+ bool GetGrammarCorrection( ::com::sun::star::linguistic2::ProofreadingResult /*out*/ &rResult,
+ sal_Int32 /*out*/ &rErrorPosInText,
+ sal_Int32 /*out*/ &rErrorIndexInResult,
+ ::com::sun::star::uno::Sequence< rtl::OUString > /*out*/ &rSuggestions,
+ const Point* pPt, SwRect& rSelectRect );
+
+ void IgnoreGrammarErrorAt( SwPaM& rErrorPosition );
+ void SetLinguRange( SwDocPositions eStart, SwDocPositions eEnde );
+
+ // returne zum Namen die im Doc gesetzte Referenz
+ const SwFmtRefMark* GetRefMark( const String& rName ) const;
+ // returne die Namen aller im Doc gesetzten Referenzen
+ // Ist der ArrayPointer 0 dann returne nur, ob im Doc. eine RefMark
+ // gesetzt ist
+ sal_uInt16 GetRefMarks( SvStringsDtor* = 0 ) const;
+
+ // rufe die Autokorrektur auf
+ void AutoCorrect( SvxAutoCorrect& rACorr, sal_Bool bInsertMode = sal_True,
+ sal_Unicode cChar = ' ' );
+ sal_Bool GetPrevAutoCorrWord( SvxAutoCorrect& rACorr, String& rWord );
+
+ // dann setze nach entsprechenden Regeln unsere Vorlagen
+ void AutoFormat( const SvxSwAutoFmtFlags* pAFlags = 0 );
+
+ static SvxSwAutoFmtFlags* GetAutoFmtFlags();
+ static void SetAutoFmtFlags(SvxSwAutoFmtFlags *);
+
+ // errechnet die Selektion
+ String Calculate();
+
+ sal_Bool InsertURL( const SwFmtINetFmt& rFmt, const String& rStr,
+ sal_Bool bKeepSelection = sal_False );
+ sal_uInt16 GetINetAttrs( SwGetINetAttrs& rArr );
+
+ //SS Fuer holen/ersetzen DropCap-Inhalt
+ String GetDropTxt( const sal_uInt16 nChars ) const;
+ void ReplaceDropTxt( const String &rStr );
+
+ // may an outline be moved or copied?
+ // Check whether it's in text body, not in table, and not read-only (move)
+ sal_Bool IsOutlineMovable( sal_uInt16 nIdx ) const;
+ sal_Bool IsOutlineCopyable( sal_uInt16 nIdx ) const;
+
+ sal_uInt16 GetLineCount( sal_Bool bActPos = sal_True );
+
+ // erfrage und setze den Fussnoten-Text/Nummer. Set.. auf akt. SSelection!
+ sal_Bool GetCurFtn( SwFmtFtn* pToFillFtn = 0 );
+ bool SetCurFtn( const SwFmtFtn& rFillFtn );
+ bool HasFtns( bool bEndNotes = false ) const;
+//z.Zt nicht benoetigt sal_uInt16 GetFtnCnt( sal_Bool bEndNotes = sal_False ) const;
+ // gebe Liste aller Fussnoten und deren Anfangstexte
+ sal_uInt16 GetSeqFtnList( SwSeqFldList& rList, bool bEndNotes = false );
+
+ SwSection const* InsertSection(
+ SwSectionData & rNewData, SfxItemSet const*const = 0 );
+ sal_Bool IsInsRegionAvailable() const;
+ const SwSection* GetCurrSection() const;
+ // liefert wie GetCurrSection() den aktuellen Bereich, allerdings geht diese Funktion
+ // ueber die Frames und erwischt dabei auch den Bereich, wenn der Cursor in einer
+ // Fussnote steht, deren Referenz in einem spaltigen Bereich steckt.
+ // Wenn man bOutOfTab setzt, wird der Bereich gesucht,
+ // der die Tabelle umfasst, nicht etwa ein innerer.
+ const SwSection* GetAnySection( sal_Bool bOutOfTab = sal_False, const Point* pPt = 0 ) const;
+
+ sal_uInt16 GetSectionFmtCount() const;
+ sal_uInt16 GetSectionFmtPos( const SwSectionFmt& ) const;
+ const SwSectionFmt& GetSectionFmt(sal_uInt16 nFmt) const;
+ void DelSectionFmt( sal_uInt16 nFmt );
+ void UpdateSection(sal_uInt16 const nSect, SwSectionData &,
+ SfxItemSet const*const = 0);
+ sal_Bool IsAnySectionInDoc( sal_Bool bChkReadOnly = sal_False,
+ sal_Bool bChkHidden = sal_False,
+ sal_Bool BChkTOX = sal_False ) const;
+
+ String GetUniqueSectionName( const String* pChkStr = 0 ) const;
+
+ //Attribute setzen
+ void SetSectionAttr(const SfxItemSet& rSet, SwSectionFmt* pSectFmt = 0);
+
+ // search inside the cursor selection for full selected sections.
+ // if any part of section in the selection return 0.
+ // if more than one in the selection return the count
+ sal_uInt16 GetFullSelectedSectionCount() const;
+
+ // special insert: Insert a new text node just before or after a section or
+ // table, if the cursor is positioned at the start/end of said
+ // section/table. The purpose of the method is to allow users to inert text
+ // at certain 'impossible' position, e.g. before a table at the document
+ // start or between to sections.
+ bool DoSpecialInsert();
+ bool CanSpecialInsert() const;
+
+ // Optimierung UI
+ void SetNewDoc(sal_Bool bNew = sal_True);
+
+ sfx2::LinkManager& GetLinkManager();
+ inline const sfx2::LinkManager& GetLinkManager() const;
+
+ // linken Rand ueber Objectleiste einstellen (aenhlich dem Stufen von
+ // Numerierungen), optional kann man "um" den Offset stufen oder "auf"
+ // die Position gestuft werden (bModulus = sal_True)
+ sal_Bool IsMoveLeftMargin( sal_Bool bRight = sal_True, sal_Bool bModulus = sal_True ) const;
+ void MoveLeftMargin( sal_Bool bRight = sal_True, sal_Bool bModulus = sal_True );
+
+ // Numberformatter vom Doc erfragen
+ SvNumberFormatter* GetNumberFormatter();
+ const SvNumberFormatter* GetNumberFormatter() const
+ { return ((SwEditShell*)this)->GetNumberFormatter(); }
+
+ // Schnitstellen fuers GlobalDokument
+ sal_Bool IsGlobalDoc() const;
+ void SetGlblDocSaveLinks( sal_Bool bFlag = sal_True );
+ sal_Bool IsGlblDocSaveLinks() const;
+ sal_uInt16 GetGlobalDocContent( SwGlblDocContents& rArr ) const;
+ sal_Bool InsertGlobalDocContent( const SwGlblDocContent& rPos,
+ SwSectionData & rNew );
+ sal_Bool InsertGlobalDocContent( const SwGlblDocContent& rPos,
+ const SwTOXBase& rTOX );
+ sal_Bool InsertGlobalDocContent( const SwGlblDocContent& rPos );
+ sal_Bool DeleteGlobalDocContent( const SwGlblDocContents& rArr,
+ sal_uInt16 nPos );
+ sal_Bool MoveGlobalDocContent( const SwGlblDocContents& rArr ,
+ sal_uInt16 nFromPos, sal_uInt16 nToPos,
+ sal_uInt16 nNewPos );
+ sal_Bool GotoGlobalDocContent( const SwGlblDocContent& rPos );
+
+ // alles fuers Redlining
+ sal_uInt16 GetRedlineMode() const;
+ void SetRedlineMode( sal_uInt16 eMode );
+ sal_Bool IsRedlineOn() const;
+ sal_uInt16 GetRedlineCount() const;
+ const SwRedline& GetRedline( sal_uInt16 nPos ) const;
+ sal_Bool AcceptRedline( sal_uInt16 nPos );
+ sal_Bool RejectRedline( sal_uInt16 nPos );
+ // suche das Redline zu diesem Data und returne die Pos im Array
+ // USHRT_MAX wird returnt, falls nicht vorhanden
+ sal_uInt16 FindRedlineOfData( const SwRedlineData& ) const;
+
+ // Kommentar am Redline an der Position setzen
+ sal_Bool SetRedlineComment( const String& rS );
+ const SwRedline* GetCurrRedline() const;
+
+ // Redline Anzeigeattribute wurden geaendert, Views updaten
+ void UpdateRedlineAttr();
+
+ // vergleiche zwei Dokument mit einander
+ long CompareDoc( const SwDoc& rDoc );
+ // merge zweier Dokumente
+ long MergeDoc( const SwDoc& rDoc );
+
+ // Dokumentglobale Fussnoteneigenschaften
+ const SwFtnInfo& GetFtnInfo() const;
+ void SetFtnInfo(const SwFtnInfo& rInfo);
+ const SwEndNoteInfo& GetEndNoteInfo() const;
+ void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
+
+ //Einstellungen fuer Zeilennummierung
+ const SwLineNumberInfo &GetLineNumberInfo() const;
+ void SetLineNumberInfo( const SwLineNumberInfo& rInfo);
+
+ // Etiketten: Bereiche synchronisieren
+ void SetLabelDoc( sal_Bool bFlag = sal_True );
+ sal_Bool IsLabelDoc() const;
+
+ // Schnittstelle fuer die TextInputDaten - ( fuer die Texteingabe
+ // von japanischen/chinesischen Zeichen)
+ SwExtTextInput* CreateExtTextInput(LanguageType eInputLanguage);
+ String DeleteExtTextInput( SwExtTextInput* pDel = 0, sal_Bool bInsText = sal_True);
+// SwExtTextInput* GetExtTextInput() const;
+ void SetExtTextInputData( const CommandExtTextInputData& );
+
+ // Schnistelle fuer den Zugriff auf die AutoComplete-Liste
+ static SwAutoCompleteWord& GetAutoCompleteWords();
+
+ // returns a scaling factor of selected text. Used for the rotated
+ // character attribut dialog.
+ sal_uInt16 GetScalingOfSelectedText() const;
+
+ // ctor/dtor
+ SwEditShell( SwDoc&, Window*, const SwViewOption *pOpt = 0 );
+ // verkleideter Copy-Constructor
+ SwEditShell( SwEditShell&, Window* );
+ virtual ~SwEditShell();
+
+private:
+ // fuer METWARE:
+ // es wird nicht kopiert und nicht zugewiesen
+ SwEditShell(const SwEditShell &);
+ const SwEditShell &operator=(const SwEditShell &);
+};
+
+inline const sfx2::LinkManager& SwEditShell::GetLinkManager() const
+{ return ((SwEditShell*)this)->GetLinkManager(); }
+
+/*
+ * Klasse fuer den automatisierten Aufruf von Start- und
+ * EndAction();
+ */
+class SwActKontext {
+ SwEditShell *pSh;
+public:
+ SwActKontext(SwEditShell *pShell);
+ ~SwActKontext();
+};
+
+#define ACT_KONTEXT(x) SwActKontext _aActKontext_(x)
+
+/*
+ * Klasse fuer den automatisierten Aufruf von Start- und
+ * EndCrsrMove();
+ */
+class SwMvKontext {
+ SwEditShell *pSh;
+public:
+ SwMvKontext(SwEditShell *pShell );
+ ~SwMvKontext();
+};
+
+#define MV_KONTEXT(x) SwMvKontext _aMvKontext_(x)
+
+
+
+#endif
diff --git a/sw/inc/envelp.hrc b/sw/inc/envelp.hrc
new file mode 100644
index 000000000000..ce210d4b6f2b
--- /dev/null
+++ b/sw/inc/envelp.hrc
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ENVELP_HRC
+#define _ENVELP_HRC
+
+// #include -------------------------------------------------------------------
+
+#include "rcid.hrc"
+
+// Dialoge --------------------------------------------------------------------
+
+#define DLG_ENV (RC_ENVELP_BEGIN )
+#define DLG_LAB (RC_ENVELP_BEGIN + 1)
+
+#define TP_ENV_ENV (RC_ENVELP_BEGIN + 2)
+#define TP_ENV_FMT (RC_ENVELP_BEGIN + 3)
+#define TP_ENV_PRT (RC_ENVELP_BEGIN + 4)
+
+#define TP_LAB_LAB (RC_ENVELP_BEGIN + 5)
+#define TP_LAB_FMT (RC_ENVELP_BEGIN + 6)
+#define TP_LAB_PRT (RC_ENVELP_BEGIN + 7)
+
+#define DLG_MAILMERGE (RC_ENVELP_BEGIN + 8)
+
+#define DLG_SYNC_BTN (RC_ENVELP_BEGIN + 9)
+#define DLG_SAVE_LABEL (RC_ENVELP_BEGIN + 10)
+
+// Bereiche -------------------------------------------------------------------
+
+#define RC_ENVLOP_BEGIN (RC_ENVELP_BEGIN )
+#define RC_ENVLOP_END (RC_ENVELP_BEGIN + 9)
+
+#define RC_ENVFMT_BEGIN (RC_ENVELP_BEGIN + 10)
+#define RC_ENVFMT_END (RC_ENVELP_BEGIN + 19)
+
+#define RC_ENVPRT_BEGIN (RC_ENVELP_BEGIN + 20)
+#define RC_ENVPRT_END (RC_ENVELP_BEGIN + 39)
+
+#define RC_LABEL_BEGIN (RC_ENVELP_BEGIN + 40)
+#define RC_LABEL_END (RC_ENVELP_BEGIN + 49)
+
+#define RC_LABFMT_BEGIN (RC_ENVELP_BEGIN + 50)
+#define RC_LABFMT_END (RC_ENVELP_BEGIN + 59)
+
+#define RC_LABPRT_BEGIN (RC_ENVELP_BEGIN + 60)
+#define RC_LABPRT_END (RC_ENVELP_BEGIN + 69)
+
+// Strings --------------------------------------------------------------------
+
+#define STR_DATABASE_NOT_OPENED (RC_ENVLOP_BEGIN + 60)
+#define STR_NO_DRIVERS (RC_ENVLOP_BEGIN + 61)
+#define DLG_MERGE_CREATE (RC_ENVLOP_BEGIN + 62)
+#define DLG_MERGE_FIELD_CONNECTIONS (RC_ENVLOP_BEGIN + 63)
+
+#define STR_BTN_NEW_DOC (RC_ENVLOP_BEGIN + 64)
+#define STR_BTN_NEWDOC (RC_ENVLOP_BEGIN + 65)
+#define STR_SENDER_TOKENS (RC_ENVLOP_BEGIN + 66)
+
+#define RC_ENVPRT_HC_BEGIN (RC_ENVLOP_BEGIN + 70)
+#define RC_ENVPRT_HC_END (RC_ENVLOP_BEGIN + 82)
+
+// Ueberlaufpruefung ----------------------------------------------------------
+
+#define ENVELP_ACT_END STR_SENDER_TOKENS
+
+#if ENVELP_ACT_END > RC_ENVPRT_HC_END
+#error Resource-Ueberlauf in #file, #line
+#endif
+
+#endif
+
+
diff --git a/sw/inc/errhdl.hxx b/sw/inc/errhdl.hxx
new file mode 100644
index 000000000000..31002c1875c8
--- /dev/null
+++ b/sw/inc/errhdl.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ERRHDL_HXX
+#define _ERRHDL_HXX
+
+#ifdef DBG_UTIL
+
+#include <tools/solar.h>
+#include <sal/types.h>
+#include "swdllapi.h"
+
+extern sal_Bool bAssert; // sal_True, wenn eine ASSERT-Box hochkam
+
+
+// -----------------------------------------------------------------------
+// Ausgabe einer Fehlermeldung inkl. Dateiname und Zeilennummer
+// wo der Fehler auftrat.
+// Die Funktion darf nicht direkt benutzt werden!
+// -----------------------------------------------------------------------
+SW_DLLPUBLIC void AssertFail( const sal_Char*, const sal_Char*, sal_uInt16 );
+SW_DLLPUBLIC void AssertFail( sal_uInt16, const sal_Char*, sal_uInt16 );
+
+#define ASSERT( cond, message ) \
+ if( !(cond) ) { \
+ const char *_pErrorText = #message; \
+ const char *_pFileName = __FILE__; \
+ ::AssertFail( _pErrorText, _pFileName, __LINE__ ); \
+ }
+
+// -----------------------------------------------------------------------
+// Prueft ob die angegebene Bedingung wahr ist, wenn nicht wird eine
+// Fehlermeldung die ueber die ID Identifiziert wird, ausgegeben.
+// -----------------------------------------------------------------------
+#define ASSERT_ID( cond, id ) \
+ if( !(cond) ) { \
+ const char *_pFileName = __FILE__; \
+ ::AssertFail( (sal_uInt16)id, _pFileName, __LINE__ ); \
+ }
+
+
+// -----------------------------------------------------------------------
+// Beim Bilden der Produktversion werden alle Debug-Utilities automatisch
+// ignoriert
+// -----------------------------------------------------------------------
+#else
+#define ASSERT( cond, message ) ;
+#define ASSERT_ID( cond, id ) ;
+#endif // PRODUCT
+
+
+
+#endif
diff --git a/sw/inc/error.h b/sw/inc/error.h
new file mode 100644
index 000000000000..649deeb8a5be
--- /dev/null
+++ b/sw/inc/error.h
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWERROR_H
+#define _SWERROR_H
+
+#define ERR_SWGBASE 25000
+
+/*** Error Codes **********************************************************/
+#define ERR_VAR_IDX (ERR_SWGBASE+ 0)
+#define ERR_OUTOFSCOPE (ERR_SWGBASE+ 1)
+
+/* Error Codes fuer Numerierungsregeln */
+#define ERR_NUMLEVEL (ERR_SWGBASE+ 2)
+
+/* Error Codes fuer TxtNode */
+#define ERR_NOHINTS (ERR_SWGBASE+ 3)
+
+// von _START bis _END sind in der COREDL.DLL entsprechende Strings
+// abgelegt, die erfragt werden koennen.
+#define ERR_SWGMSG_START (ERR_VAR_IDX)
+#define ERR_SWGMSG_END (ERR_NOHINTS)
+
+
+
+#endif
diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
new file mode 100644
index 000000000000..3d3169fcf27a
--- /dev/null
+++ b/sw/inc/expfld.hxx
@@ -0,0 +1,444 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_EXPFLD_HXX
+#define SW_EXPFLD_HXX
+
+#include <svl/svarray.hxx>
+#include "swdllapi.h"
+#include <fldbas.hxx>
+#include <cellfml.hxx>
+
+class SfxPoolItem;
+class SwTxtNode;
+class SwFrm;
+struct SwPosition;
+class SwTxtFld;
+class SwDoc;
+class SwFmtFld;
+class _SetGetExpFlds;
+class SwEditShell;
+
+// Vorwaertsdeklaration: besorge den "Body-TextNode", fuer Exp.Fld in Fly's
+// Header/Footers/Footnodes
+const SwTxtNode* GetBodyTxtNode( const SwDoc& pDoc, SwPosition& rPos,
+ const SwFrm& rFrm );
+// Wandlung Address -> Adressen
+void ReplacePoint(String& sTmpName, sal_Bool bWithCommandType = sal_False);
+
+struct _SeqFldLstElem
+{
+ String sDlgEntry;
+ sal_uInt16 nSeqNo;
+
+ _SeqFldLstElem( const String& rStr, sal_uInt16 nNo )
+ : sDlgEntry( rStr ), nSeqNo( nNo )
+ {}
+};
+SV_DECL_PTRARR_DEL( _SwSeqFldList, _SeqFldLstElem*, 10, 10 )
+
+class SW_DLLPUBLIC SwSeqFldList : public _SwSeqFldList
+{
+public:
+ SwSeqFldList() : _SwSeqFldList( 10, 10 ) {}
+
+ sal_Bool InsertSort( _SeqFldLstElem* );
+ sal_Bool SeekEntry( const _SeqFldLstElem& , sal_uInt16* pPos = 0 );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ausdruck
+ --------------------------------------------------------------------*/
+
+class SwGetExpFieldType : public SwValueFieldType
+{
+public:
+ SwGetExpFieldType(SwDoc* pDoc);
+ virtual SwFieldType* Copy() const;
+
+ // ueberlagert, weil das Get-Field nicht veraendert werden kann
+ // und dann auch nicht aktualisiert werden muss. Aktualisierung
+ // erfolgt beim Aendern von Set-Werten !
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: GetExperession
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwGetExpField : public SwFormulaField
+{
+ String sExpand;
+ sal_Bool bIsInBodyTxt;
+ sal_uInt16 nSubType;
+
+ bool bLateInitialization; // #i82544#
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ SwGetExpField( SwGetExpFieldType*, const String& rFormel,
+ sal_uInt16 nSubType = nsSwGetSetExpType::GSE_EXPR, sal_uLong nFmt = 0);
+
+ virtual void SetValue( const double& rVal );
+ virtual void SetLanguage(sal_uInt16 nLng);
+
+ inline const String& GetExpStr() const;
+ inline void ChgExpStr(const String& rExpand);
+
+ // wird von der Formatierung abgefragt
+ inline sal_Bool IsInBodyTxt() const;
+ // wird von UpdateExpFlds gesetzt (dort ist die Node-Position bekannt)
+ inline void ChgBodyTxtFlag( sal_Bool bIsInBody );
+ // fuer Felder in Header/Footer/Footnotes/Flys:
+ // (wird nur von der Formatierung aufgerufen!!)
+ void ChangeExpansion( const SwFrm&, const SwTxtFld& );
+
+ virtual String GetFieldName() const;
+
+ // Die Formel aendern
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16 nType);
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+
+ static sal_uInt16 GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc);
+ // #i82544#
+ void SetLateInitialization() { bLateInitialization = true;}
+};
+
+inline void SwGetExpField::ChgExpStr(const String& rExpand)
+ { sExpand = rExpand;}
+
+inline const String& SwGetExpField::GetExpStr() const
+ { return sExpand; }
+
+// wird von der Formatierung abgefragt
+inline sal_Bool SwGetExpField::IsInBodyTxt() const
+ { return bIsInBodyTxt; }
+
+// wird von UpdateExpFlds gesetzt (dort ist die Node-Position bekannt)
+inline void SwGetExpField::ChgBodyTxtFlag( sal_Bool bIsInBody )
+ { bIsInBodyTxt = bIsInBody; }
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ausdruck setzen
+ --------------------------------------------------------------------*/
+
+class SwSetExpField;
+
+class SW_DLLPUBLIC SwSetExpFieldType : public SwValueFieldType
+{
+ String sName;
+ const SwNode* pOutlChgNd;
+ String sDelim;
+ sal_uInt16 nType;
+ sal_uInt8 nLevel;
+ sal_Bool bDeleted;
+
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
+
+public:
+ SwSetExpFieldType( SwDoc* pDoc, const String& rName,
+ sal_uInt16 nType = nsSwGetSetExpType::GSE_EXPR );
+ virtual SwFieldType* Copy() const;
+ virtual const String& GetName() const;
+
+ inline void SetType(sal_uInt16 nTyp);
+ inline sal_uInt16 GetType() const;
+
+ void SetSeqFormat(sal_uLong nFormat);
+ sal_uLong GetSeqFormat();
+
+ sal_Bool IsDeleted() const { return bDeleted; }
+ void SetDeleted( sal_Bool b ) { bDeleted = b; }
+
+ // ueberlagert, weil das Set-Field selbst dafuer sorgt, das
+ // es aktualisiert wird.
+ inline const String& GetSetRefName() const;
+
+ sal_uInt16 SetSeqRefNo( SwSetExpField& rFld );
+
+ sal_uInt16 GetSeqFldList( SwSeqFldList& rList );
+ String MakeSeqName( sal_uInt16 nSeqNo );
+
+ // Seqencefelder ggfs. Kapitelweise numerieren
+// sal_Unicode GetDelimiter() const { return cDelim; }
+// void SetDelimiter( sal_Unicode c ) { cDelim = c; }
+ const String& GetDelimiter() const { return sDelim; }
+ void SetDelimiter( const String& s ) { sDelim = s; }
+ sal_uInt8 GetOutlineLvl() const { return nLevel; }
+ void SetOutlineLvl( sal_uInt8 n ) { nLevel = n; }
+ void SetChapter( SwSetExpField& rFld, const SwNode& rNd );
+ // Member nur fuers SwDoc::UpdateExpFld - wird nur waehrend der Laufzeit
+ // von SequencefeldTypen benoetigt!!!
+ const SwNode* GetOutlineChgNd() const { return pOutlChgNd; }
+ void SetOutlineChgNd( const SwNode* p ) { pOutlChgNd = p; }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+inline void SwSetExpFieldType::SetType( sal_uInt16 nTyp )
+{
+ nType = nTyp;
+ EnableFormat( !(nType & (nsSwGetSetExpType::GSE_SEQ|nsSwGetSetExpType::GSE_STRING)));
+}
+
+inline sal_uInt16 SwSetExpFieldType::GetType() const
+ { return nType; }
+
+inline const String& SwSetExpFieldType::GetSetRefName() const
+ { return sName; }
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ausdruck
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwSetExpField : public SwFormulaField
+{
+ String sExpand;
+ String aPText;
+ String aSeqText;
+ sal_Bool bInput;
+ sal_uInt16 nSeqNo;
+ sal_uInt16 nSubType;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ SwSetExpField(SwSetExpFieldType*, const String& rFormel, sal_uLong nFmt = 0);
+
+ virtual void SetValue( const double& rVal );
+
+ inline const String& GetExpStr() const;
+
+ inline void ChgExpStr( const String& rExpand );
+
+ inline void SetPromptText(const String& rStr);
+ inline const String& GetPromptText() const;
+
+ inline void SetInputFlag(sal_Bool bInp);
+ inline sal_Bool GetInputFlag() const;
+
+ virtual String GetFieldName() const;
+
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16 nType);
+
+ inline sal_Bool IsSequenceFld() const;
+
+ // fuer SequenceFelder - logische Nummer
+ inline void SetSeqNumber( sal_uInt16 n ) { nSeqNo = n; }
+ inline sal_uInt16 GetSeqNumber() const { return nSeqNo; }
+
+ // Der Name nur erfragen
+ virtual const String& GetPar1() const;
+
+ // Die Formel
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+inline const String& SwSetExpField::GetExpStr() const
+ { return sExpand; }
+
+inline void SwSetExpField::ChgExpStr( const String& rExpand )
+ { sExpand = rExpand; }
+
+inline void SwSetExpField::SetPromptText(const String& rStr)
+ { aPText = rStr; }
+
+inline const String& SwSetExpField::GetPromptText() const
+ { return aPText; }
+
+inline void SwSetExpField::SetInputFlag(sal_Bool bInp)
+ { bInput = bInp; }
+
+inline sal_Bool SwSetExpField::GetInputFlag() const
+ { return bInput; }
+
+inline sal_Bool SwSetExpField::IsSequenceFld() const
+ { return 0 != (nsSwGetSetExpType::GSE_SEQ & ((SwSetExpFieldType*)GetTyp())->GetType()); }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Eingabe im Text/Variable setzen
+ --------------------------------------------------------------------*/
+
+class SwInputFieldType : public SwFieldType
+{
+ SwDoc* pDoc;
+public:
+ SwInputFieldType( SwDoc* pDoc );
+
+ virtual SwFieldType* Copy() const;
+
+ SwDoc* GetDoc() const { return pDoc; }
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Eingabefeld
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwInputField : public SwField
+{
+ String aContent;
+ String aPText;
+ String aHelp;
+ String aToolTip;
+ sal_uInt16 nSubType;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ // Direkte Eingabe ueber Dialog alten Wert loeschen
+ SwInputField(SwInputFieldType*, const String& rContent ,
+ const String& rPrompt, sal_uInt16 nSubType = 0,
+ sal_uLong nFmt = 0);
+
+ virtual String GetFieldName() const;
+
+ // Content
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+
+ // aPromptText
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+
+ virtual String GetHelp() const;
+ virtual void SetHelp(const String & rStr);
+
+ virtual String GetToolTip() const;
+ virtual void SetToolTip(const String & rStr);
+
+ virtual sal_Bool isFormField() const;
+
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16 nSub);
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+/*--------------------------------------------------------------------
+ Description: Sorted list of input fields and DropDown fields
+ --------------------------------------------------------------------*/
+
+class SwInputFieldList
+{
+public:
+ SwInputFieldList( SwEditShell* pShell, sal_Bool bBuildTmpLst = sal_False );
+ ~SwInputFieldList();
+
+ sal_uInt16 Count() const;
+ SwField* GetField(sal_uInt16 nId);
+
+ void GotoFieldPos(sal_uInt16 nId);
+ void PushCrsr();
+ void PopCrsr();
+
+ // vergleiche TmpLst mit akt Feldern. Alle neue kommen in die SortLst
+ // damit sie geupdatet werden koennen. Returnt die Anzahl.
+ // (Fuer Textbausteine: nur seine Input-Felder aktualisieren)
+ sal_uInt16 BuildSortLst();
+
+ // Alle unselektierten Felder aus Liste entfernen
+ void RemoveUnselectedFlds();
+
+private:
+ SwEditShell* pSh;
+ _SetGetExpFlds* pSrtLst;
+ SvPtrarr aTmpLst;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Tabellen-Formelfeld
+ (Implementierung steht in tblcalc.cxx)
+ --------------------------------------------------------------------*/
+
+class SwTblFieldType : public SwValueFieldType
+{
+public:
+ SwTblFieldType(SwDoc* pDocPtr);
+ virtual SwFieldType* Copy() const;
+};
+
+
+// MSC will den hier nicht
+//typedef void (SwField:: *FnScanFormel)( const SwTable&, String&,
+// String&, String* = 0, void* = 0 );
+
+
+class SwTblField : public SwValueField, public SwTableFormula
+{
+ String sExpand;
+ sal_uInt16 nSubType;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ // suche den TextNode, in dem das Feld steht
+ virtual const SwNode* GetNodeOfFormula() const;
+
+ String GetCommand();
+
+public:
+ SwTblField( SwTblFieldType*, const String& rFormel,
+ sal_uInt16 nSubType = 0, sal_uLong nFmt = 0);
+
+ virtual void SetValue( const double& rVal );
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16 nType);
+
+ const String& GetExpStr() const { return sExpand; }
+ void ChgExpStr(const String& rStr) { sExpand = rStr; }
+
+ // berechne sich selbst
+ void CalcField( SwTblCalcPara& rCalcPara );
+
+ virtual String GetFieldName() const;
+
+ // Die Formel
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+};
+
+
+#endif // SW_EXPFLD_HXX
diff --git a/sw/inc/extinput.hxx b/sw/inc/extinput.hxx
new file mode 100644
index 000000000000..dba9bb5b5e2c
--- /dev/null
+++ b/sw/inc/extinput.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _EXTINPUT_HXX
+#define _EXTINPUT_HXX
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#endif
+#include <pam.hxx>
+#include <i18npool/lang.h>
+
+class CommandExtTextInputData;
+
+class SwExtTextInput : public SwPaM
+{
+ SvUShorts aAttrs;
+ String sOverwriteText;
+ sal_Bool bInsText : 1;
+ sal_Bool bIsOverwriteCursor : 1;
+ LanguageType eInputLanguage;
+public:
+ SwExtTextInput( const SwPaM& rPam, Ring* pRing = 0 );
+ virtual ~SwExtTextInput();
+
+ void SetInputData( const CommandExtTextInputData& rData );
+ const SvUShorts& GetAttrs() const { return aAttrs; }
+ void SetInsText( sal_Bool bFlag ) { bInsText = bFlag; }
+ sal_Bool IsOverwriteCursor() const { return bIsOverwriteCursor; }
+ void SetOverwriteCursor( sal_Bool bFlag );
+ void SetLanguage(LanguageType eSet) { eInputLanguage = eSet;}
+};
+
+#endif //_EXTINPUT_HXX
+
diff --git a/sw/inc/fchrfmt.hxx b/sw/inc/fchrfmt.hxx
new file mode 100644
index 000000000000..53de41c11e3b
--- /dev/null
+++ b/sw/inc/fchrfmt.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FCHRFMT_HXX
+#define _FCHRFMT_HXX
+
+
+#include <svl/poolitem.hxx>
+#include <calbck.hxx>
+#include <format.hxx>
+
+class SwCharFmt;
+class SwTxtCharFmt;
+class IntlWrapper;
+
+// ATT_CHARFMT *********************************************
+
+
+class SW_DLLPUBLIC SwFmtCharFmt: public SfxPoolItem, public SwClient
+{
+ friend class SwTxtCharFmt;
+ SwTxtCharFmt* pTxtAttr; // mein TextAttribut
+
+public:
+ SwFmtCharFmt() : pTxtAttr(0) {}
+
+ // single argument ctors shall be explicit.
+ explicit SwFmtCharFmt( SwCharFmt *pFmt );
+ virtual ~SwFmtCharFmt();
+
+ // @@@ public copy ctor, but no copy assignment?
+ SwFmtCharFmt( const SwFmtCharFmt& rAttr );
+protected:
+ virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
+
+private:
+ // @@@ public copy ctor, but no copy assignment?
+ SwFmtCharFmt & operator= (const SwFmtCharFmt &);
+public:
+
+ TYPEINFO();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
+
+ void SetCharFmt( SwFmt* pFmt ) { pFmt->Add(this); }
+ SwCharFmt* GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); }
+};
+#endif
+
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
new file mode 100644
index 000000000000..0d659aee244d
--- /dev/null
+++ b/sw/inc/fesh.hxx
@@ -0,0 +1,802 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FESH_HXX
+#define _FESH_HXX
+
+#include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/embed/XClassifiedObject.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+
+#include <svx/svdobj.hxx>
+#include "swdllapi.h"
+#include <editsh.hxx>
+#include <flyenum.hxx>
+
+// OD 25.06.2003 #108784#
+#include <svx/svdtypes.hxx>
+
+#include <svtools/embedhlp.hxx>
+
+#ifndef INCLUDED_VECTOR
+#include <vector>
+#define INCLUDED_VECTOR
+#endif
+
+
+class SwFlyFrm;
+class SwTabCols;
+class SvxBrushItem;
+class SvxFrameDirectionItem;
+class SwTableAutoFmt;
+class SwFrm;
+class SwFmtFrmSize;
+class SwFmtRowSplit;
+class SvxBorderLine;
+class SdrObject;
+class Color;
+class Outliner;
+class SotDataObject;
+class SwFrmFmt;
+struct SwSortOptions;
+class SdrMarkList;
+
+namespace svx
+{
+ class ISdrObjectFilter;
+}
+
+
+// return values for GetFrmType() und GetSelFrmType().
+//! values can be combined via logival or
+#define FRMTYPE_NONE (sal_uInt16) 0
+#define FRMTYPE_PAGE (sal_uInt16) 1
+#define FRMTYPE_HEADER (sal_uInt16) 2
+#define FRMTYPE_FOOTER (sal_uInt16) 4
+#define FRMTYPE_BODY (sal_uInt16) 8
+#define FRMTYPE_COLUMN (sal_uInt16) 16
+#define FRMTYPE_TABLE (sal_uInt16) 32
+#define FRMTYPE_FLY_FREE (sal_uInt16) 64
+#define FRMTYPE_FLY_ATCNT (sal_uInt16) 128
+#define FRMTYPE_FLY_INCNT (sal_uInt16) 256
+#define FRMTYPE_FOOTNOTE (sal_uInt16) 512
+#define FRMTYPE_FTNPAGE (sal_uInt16) 1024
+#define FRMTYPE_FLY_ANY (sal_uInt16) 2048
+#define FRMTYPE_DRAWOBJ (sal_uInt16) 4096
+#define FRMTYPE_COLSECT (sal_uInt16) 8192
+#define FRMTYPE_COLSECTOUTTAB (sal_uInt16) 16384
+
+#define FRMTYPE_ANYCOLSECT ( FRMTYPE_COLSECT | FRMTYPE_COLSECTOUTTAB )
+
+//! values can be combined via logival or
+#define GOTOOBJ_DRAW_CONTROL (sal_uInt16) 1
+#define GOTOOBJ_DRAW_SIMPLE (sal_uInt16) 2
+#define GOTOOBJ_DRAW_ANY (sal_uInt16) 3
+#define GOTOOBJ_FLY_FRM (sal_uInt16) 4
+#define GOTOOBJ_FLY_GRF (sal_uInt16) 8
+#define GOTOOBJ_FLY_OLE (sal_uInt16) 16
+#define GOTOOBJ_FLY_ANY (sal_uInt16) 28
+#define GOTOOBJ_GOTO_ANY (sal_uInt16) 31
+
+//! values can be combined via logival or
+#define FLYPROTECT_CONTENT (sal_uInt16) 1 // kann verodert werden!
+#define FLYPROTECT_SIZE (sal_uInt16) 2
+#define FLYPROTECT_POS (sal_uInt16) 4
+#define FLYPROTECT_PARENT (sal_uInt16) 8 // nur Parents untersuchen
+#define FLYPROTECT_FIXED (sal_uInt16) 16 // nur nicht aufhebbarer Schutz
+ // z.B. durch OLE-Server, gilt auch
+ // fuer Dialog
+
+
+enum ObjCntType //Fuer das Ermitteln des Cntnts per Positon (D&D)
+{
+ OBJCNT_NONE,
+ OBJCNT_FLY,
+ OBJCNT_GRF,
+ OBJCNT_OLE,
+ OBJCNT_SIMPLE,
+ OBJCNT_CONTROL,
+ OBJCNT_URLBUTTON,
+
+ OBJCNT_GROUPOBJ,
+ OBJCNT_DONTCARE // nicht bestimmbar - unterschiedliche Objecte selektiert
+};
+
+//fuer GetAnyCurRect
+enum CurRectType
+{
+ RECT_PAGE, //Rect der aktuellen Seite.
+ RECT_PAGE_CALC, //... Seite wird ggf. Formatiert
+ RECT_PAGE_PRT, //Rect der aktuellen PrtArea der Seite
+ RECT_FRM, //Rect des aktuellen Rahmen
+ RECT_FLY_EMBEDDED, //Rect des aktuellen FlyFrm
+ RECT_FLY_PRT_EMBEDDED, //Rect der PrtArea des FlyFrm
+ RECT_SECTION, //Rect des aktuellen Bereichs
+ RECT_OUTTABSECTION, //Rect des aktuellen Bereichs,
+ // aber ausserhalb der Tabelle
+ RECT_SECTION_PRT, //Rect der aktuellen PrtArea des Bereichs
+ RECT_OUTTABSECTION_PRT, //Rect der aktuellen PrtArea des Bereichs,
+ // aber ausserhalb der Tabelle
+ RECT_HEADERFOOTER, //Rect des aktuellen Headers/Footer
+ RECT_HEADERFOOTER_PRT, //Rect der PrtArea des aktuellen Headers/Footers
+
+ RECT_PAGES_AREA //Rect covering the pages area
+};
+
+struct SwGetCurColNumPara
+{
+ const SwFrmFmt* pFrmFmt;
+ const SwRect* pPrtRect, *pFrmRect;
+ SwGetCurColNumPara() : pFrmFmt( 0 ), pPrtRect( 0 ), pFrmRect( 0 ) {}
+};
+
+#define SW_PASTESDR_INSERT 1
+#define SW_PASTESDR_REPLACE 2
+#define SW_PASTESDR_SETATTR 3
+
+#define SW_ADD_SELECT 1
+#define SW_ENTER_GROUP 2
+#define SW_LEAVE_FRAME 4
+
+#define SW_MOVE_UP 0
+#define SW_MOVE_DOWN 1
+#define SW_MOVE_LEFT 2
+#define SW_MOVE_RIGHT 3
+
+#define SW_TABCOL_NONE 0
+#define SW_TABCOL_HORI 1
+#define SW_TABCOL_VERT 2
+#define SW_TABROW_HORI 3
+#define SW_TABROW_VERT 4
+// --> FME 2004-07-30 #i32329# Enhanced table selection
+#define SW_TABSEL_HORI 5
+#define SW_TABSEL_HORI_RTL 6
+#define SW_TABROWSEL_HORI 7
+#define SW_TABROWSEL_HORI_RTL 8
+#define SW_TABCOLSEL_HORI 9
+#define SW_TABSEL_VERT 10
+#define SW_TABROWSEL_VERT 11
+#define SW_TABCOLSEL_VERT 12
+// <--
+
+class SdrDropMarkerOverlay;
+
+class SW_DLLPUBLIC SwFEShell : public SwEditShell
+{
+ SdrDropMarkerOverlay *pChainFrom, *pChainTo;
+ sal_Bool bCheckForOLEInCaption;
+
+ SW_DLLPRIVATE SwFlyFrm *FindFlyFrm() const;
+ SW_DLLPRIVATE SwFlyFrm *FindFlyFrm( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& ) const;
+
+ //Actions fuer alle Shells beenden und ChangeLink rufen.
+ SW_DLLPRIVATE void EndAllActionAndCall();
+
+ SW_DLLPRIVATE void ScrollTo( const Point &rPt );
+
+ // OD 25.06.2003 #108784# - correct type of 1st parameter
+ SW_DLLPRIVATE void ChangeOpaque( SdrLayerID nLayerId );
+
+ // Used for mouse operations on a table:
+ // Returns a cell frame that is 'close' to rPt.
+ SW_DLLPRIVATE const SwFrm *GetBox( const Point &rPt, bool* pbRow = 0, bool* pbCol = 0 ) const;
+
+ //0 == in keiner Spalte
+ SW_DLLPRIVATE sal_uInt16 _GetCurColNum( const SwFrm *pFrm,
+ SwGetCurColNumPara* pPara ) const;
+
+ SW_DLLPRIVATE void _GetTabCols( SwTabCols &rToFill, const SwFrm *pBox ) const;
+ SW_DLLPRIVATE void _GetTabRows( SwTabCols &rToFill, const SwFrm *pBox ) const;
+
+ SW_DLLPRIVATE sal_Bool ImpEndCreate();
+
+ SW_DLLPRIVATE ObjCntType GetObjCntType( const SdrObject& rObj ) const;
+
+ // Methoden fuers kopieren von DrawObjecten
+ SW_DLLPRIVATE sal_Bool CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt,
+ const Point& rInsPt, sal_Bool bIsMove,
+ sal_Bool bSelectInsert );
+
+ // get list of marked SdrObjects;
+ // helper method for GetSelFrmType, IsSelContainsControl
+ SW_DLLPRIVATE const SdrMarkList* _GetMarkList() const;
+
+ SW_DLLPRIVATE sal_Bool CheckHeadline( bool bRepeat ) const;
+
+ using SwEditShell::Copy;
+
+public:
+
+ using SwEditShell::Insert;
+
+ TYPEINFO();
+ SwFEShell( SwDoc& rDoc, Window *pWin, const SwViewOption *pOpt = 0 );
+ SwFEShell( SwEditShell& rShell, Window *pWin );
+ virtual ~SwFEShell();
+
+ // Copy und Paste Methoden fuer das interne Clipboard
+ sal_Bool Copy( SwDoc* pClpDoc, const String* pNewClpTxt = 0 );
+ sal_Bool Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames = sal_False);
+ //paste some pages into another doc - used in mailmerge
+ sal_Bool PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt16 nEndPage);
+ // Copy-Methode fuer Drag&Drop
+ sal_Bool Copy( SwFEShell*, const Point& rSttPt, const Point& rInsPt,
+ sal_Bool bIsMove = sal_False, sal_Bool bSelectInsert = sal_True );
+
+ void SelectFlyFrm( SwFlyFrm& rFrm, sal_Bool bNew = sal_False );
+
+ // befindet sich der selektierte Rahmen innerhalb eines anderen?
+ const SwFrmFmt* IsFlyInFly();
+
+//SS fuer DrawObjekte und Rahmen-----------------------------
+
+ //Wenn ein Objekt angegeben wurde, so wird genau diese Markiert (anstatt
+ //ueber die Position zu suchen.
+ sal_Bool SelectObj( const Point& rSelPt, sal_uInt8 nFlag = 0, SdrObject *pObj = 0 );
+ void DelSelectedObj();
+
+ //Selektion nach oben unten bewegen (Z-Order).
+ //sal_True == ganz nach oben/unten
+ //sal_False == einen ueberholen
+ void SelectionToTop ( sal_Bool bTop = sal_True );
+ void SelectionToBottom( sal_Bool bBottom = sal_True );
+
+ short GetLayerId() const; //1 Heaven, 0 Hell, -1 Uneindeutig
+ void SelectionToHeaven(); //Ueber dem Dokument
+ void SelectionToHell(); //Unter dem Dokument
+
+ // folgende zwei Methoden returnen den enum SdrHdlKind, um sich ein
+ // includen von SVDRAW.HXX zu ersparen als int deklariert.
+ bool IsObjSelectable( const Point& rPt );
+ int IsInsideSelectedObj( const Point& rPt ); //!! returns enum values
+
+ // #107513#
+ // Test if there is a draw object at that position and if it should be selected.
+ // The 'should' is aimed at Writer text fly frames which may be in front of
+ // the draw object.
+ sal_Bool ShouldObjectBeSelected(const Point& rPt);
+
+ sal_Bool MoveAnchor( sal_uInt16 nDir );
+
+ // Returns if Upper of frame at current position is section frame
+ // Currently only used by the rules. To be replaced by something more
+ // sophisticated one day.
+ bool IsDirectlyInSection() const;
+
+ //Returnwerte siehe oben FrmType.
+ //pPt: Crsr bzw. DocPos; bStopAtFly: Bei Flys anhalten oder ueber den Anchor weitergehen
+ // Obgleich (0,sal_True) eine Art Standard ist, sind die Parameter nicht defaultet, damit
+ // bei jeder Benutzung insbesondere das bStopAtFly bewusst genutzt wird.
+ sal_uInt16 GetFrmType( const Point *pPt, sal_Bool bStopAtFly ) const;
+ sal_uInt16 GetSelFrmType() const; //Selektion (Drawing)
+
+ /** #108784# check whether selected frame contains a control;
+ * companion method to GetSelFrmType, used for preventing
+ * drag&drop of controls into header */
+ bool IsSelContainsControl() const;
+
+ ObjCntType GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const;
+ ObjCntType GetObjCntTypeOfSelection( SdrObject** ppObj = 0 ) const;
+
+ //Zum Anpassen der PosAttr bei Ankerwechseln.
+ SwRect GetObjRect() const;
+ //Zum Verschieben von Flys mit der Tastatur
+ SwRect GetFlyRect() const;
+ // OD 18.09.2003 #i17567#, #108749#, #110354# - adjustments to allow
+ // negative vertical positions for fly frames anchored
+ // to paragraph or to character.
+ // OD 02.10.2003 #i18732# - adjustments for new option 'FollowTextFlow'
+ // OD 12.11.2003 #i22341# - adjustments for new vertical alignment at top of line
+ void CalcBoundRect( SwRect& _orRect,
+ const RndStdIds _nAnchorId,
+ const sal_Int16 _eHoriRelOrient = com::sun::star::text::RelOrientation::FRAME,
+ const sal_Int16 _eVertRelOrient = com::sun::star::text::RelOrientation::FRAME,
+ const SwPosition* _pToCharCntntPos = NULL,
+ const bool _bFollowTextFlow = false,
+ bool _bMirror = false,
+ Point* _opRef = NULL,
+ Size* _opPercent = NULL ) const;
+
+ // Groesse von Drawobjekten setzen
+ void SetObjRect( const SwRect& rRect );
+
+ long BeginDrag( const Point *pPt, sal_Bool bProp );
+ long Drag ( const Point *pPt, sal_Bool bProp );
+ long EndDrag ( const Point *pPt, sal_Bool bProp );
+ void BreakDrag();
+
+ //Methoden fuer die Statuszeile.
+ Point GetAnchorObjDiff() const; //Abstand zum Anker
+ Point GetObjAbsPos() const; //Absolute Position
+ Size GetObjSize() const; //Groesse, ggf. die umschliessende
+
+ //SS fuer die BriefUmschlaege: hole alle Seitengebundenen Objekte
+ //und setze diese auf eine neue Seite.
+ void GetPageObjs( SvPtrarr& rFillArr );
+ void SetPageObjsNewPage( SvPtrarr& rFillArr, int nOffset = 1 );
+
+ // zeige die aktuelle Selektion an ( ggfs. den Rahmen/DrawObject)
+ virtual void MakeSelVisible();
+
+ // returne das FrmFmt von dem evt. unter dem Point stehenden Object.
+ // Das Object wird nicht selektiert!
+ const SwFrmFmt* GetFmtFromObj( const Point& rPt, SwRect** pRectToFill = 0 ) const;
+ // returns a format too, if the point is over the text of any fly
+ const SwFrmFmt* GetFmtFromAnyObj( const Point& rPt ) const;
+
+ //Welcher Schutz ist am selektierten Objekt gesetzt?
+ //!! returns several flags in sal_uInt8
+ sal_uInt8 IsSelObjProtected( sal_uInt16 /*FLYPROTECT_...*/ eType ) const;
+
+ //Liefert neben der Grafik in rName bei gelinkten Grafiken den Namen mit
+ //Pfad und sonst den Grafiknamen. rbLink ist TRU bei gelinkten Grafiken.
+ const Graphic *GetGrfAtPos( const Point &rDocPos,
+ String &rName, sal_Bool &rbLink ) const;
+
+ // --> OD 2009-07-13 #i73249#
+ const String GetObjTitle() const;
+ void SetObjTitle( const String& rTitle );
+ const String GetObjDescription() const;
+ void SetObjDescription( const String& rDescription );
+ // <--
+
+//SS fuer Rahmen --------------------------------------------
+
+ sal_Bool IsFrmSelected() const;
+ sal_Bool GetFlyFrmAttr( SfxItemSet &rSet ) const;
+ sal_Bool SetFlyFrmAttr( SfxItemSet &rSet );
+ sal_Bool ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet = 0 );
+ const SwFrmFmt *NewFlyFrm( const SfxItemSet &rSet, sal_Bool bAnchValid = sal_False,
+ SwFrmFmt *pParent = 0 );
+ void SetFlyPos( const Point &rAbsPos);
+ Point FindAnchorPos( const Point &rAbsPos, sal_Bool bMoveIt = sal_False );
+ // determines whether a frame or its environment is vertically formatted and right-to-left
+ // --> OD 2009-08-31 #mongolianlayout#
+ // also determines, if frame or its environmane is in mongolianlayout (vertical left-to-right)
+ // - add output parameter <bVertL2R>
+ sal_Bool IsFrmVertical(const sal_Bool bEnvironment, sal_Bool& bRightToLeft, sal_Bool& bVertL2R) const;
+
+ SwFrmFmt* GetCurFrmFmt() const; //Wenn Rahmen, dann Rahmenvorlage, sonst 0
+ void SetFrmFmt( SwFrmFmt *pFmt, sal_Bool bKeepOrient = sal_False, Point* pDocPos = 0 ); //Wenn Rahmen, dann Rahmenvorlage setzen
+ const SwFlyFrm *GetCurrFlyFrm() const { return FindFlyFrm(); }
+
+ // finde/loeschen den Fly, in dem der Cursor steht
+ SwFrmFmt* WizzardGetFly();
+
+ //Selebstaendiges selektieren von Flys
+ sal_Bool GotoNextFly( sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_FLY_ANY )
+ { return GotoObj( sal_True, eType ); }
+ sal_Bool GotoPrevFly( sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_FLY_ANY)
+ { return GotoObj( sal_False, eType); }
+
+ //iterieren ueber Flys - fuer Basic-Collections
+ sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL ) const;
+ const SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL) const;
+
+ //Wenn ein fly selectiert ist, zieht er den Crsr in den ersten CntntFrm
+ const SwFrmFmt* SelFlyGrabCrsr();
+
+ //Get FlyFrameFormat; fuer UI Macro Anbindung an Flys
+ const SwFrmFmt* GetFlyFrmFmt() const;
+ SwFrmFmt* GetFlyFrmFmt();
+
+ //OLE, Server fordert neue Groesse an, die gewuenschten Werte werden
+ //als Rahmenattribute eingestellt. Wenn die Werte nicht erlaubt sind,
+ //so wird von der Formatierung geclippt und eine Scalierung eingestellt.
+ //siehe CalcAndSetScale().
+ // The return value is the applied size.
+ Size RequestObjectResize( const SwRect &rRect, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
+
+ //The layout has been changed, so the active object has to be moved after that
+ virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
+
+ //Der Client fuer das OleObject muss bezueglich der Scalierung auf dem
+ //neuesten Stand gehalten werden. Impl in der WrtShell.
+ //Wird ein Pointer auf eine Size uebergeben, so ist diese die aktuelle
+ //Core-Groesse des Objectes. Anderfalls wird die Groesse per GetCurFlyRect()
+ //besorgt.
+ virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
+ const SwRect *pFlyPrtRect = 0,
+ const SwRect *pFlyFrmRect = 0 ) = 0;
+
+ //Objekte mit ActivateWhenVisible werden beim Paint Connected.
+ //gerufen von notxtfrm::Paint, impl in wrtsh
+ virtual void ConnectObj( svt::EmbeddedObjectRef&,
+ const SwRect &rPrt,
+ const SwRect &rFrm ) = 0;
+
+ //Sichbaren Bereich auf das Object setzen, wenn es noch nicht sichtbar ist.
+ void MakeObjVisible( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& ) const;
+
+ // check resize of OLE-Object
+ sal_Bool IsCheckForOLEInCaption() const { return bCheckForOLEInCaption; }
+ void SetCheckForOLEInCaption( sal_Bool bFlag ) { bCheckForOLEInCaption = bFlag; }
+
+ // setze am selektierten FlyFrame einen Namen
+ void SetFlyName( const String& rName );
+ const String& GetFlyName() const;
+
+ // get reference to OLE object (if there is one) for selected FlyFrame
+ const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef() const;
+
+ // erezeuge eindeutige Namen fuer Rahmen
+ String GetUniqueGrfName() const;
+ String GetUniqueOLEName() const;
+ String GetUniqueFrameName() const;
+
+ // springe zum benannten Rahmen (Grafik/OLE)
+ sal_Bool GotoFly( const String& rName, FlyCntType eType = FLYCNTTYPE_ALL,
+ sal_Bool bSelFrame = sal_True );
+ // steht an der Position eine Grafik mit einer URL ?
+ const SwFrmFmt* IsURLGrfAtPos( const Point& rPt, String* pURL = 0,
+ String *pTargetFrameName = 0,
+ String *pURLDescription = 0 ) const;
+
+ //Fuer das Chain wird immer der durch das Format spezifizierte Fly
+ //mit dem durch den Point getroffenen verbunden.
+ //In rRect wird das Rect des Flys geliefert (fuer Highlight desselben)
+ int Chainable( SwRect &rRect, const SwFrmFmt &rSource, const Point &rPt ) const;
+ int Chain( SwFrmFmt &rSource, const Point &rPt );
+ int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
+ void Unchain( SwFrmFmt &rFmt );
+ void HideChainMarker();
+ void SetChainMarker();
+
+ Size GetGraphicDefaultSize() const;
+
+//SS fuer DrawObjekte ---------------------
+
+ //Temporaer um Bug zu umgehen.
+ void CheckUnboundObjects();
+
+ //Achtung: Uneindeutikeiten bei Mehrfachselektionen.
+ sal_Bool GetObjAttr( SfxItemSet &rSet ) const;
+ sal_Bool SetObjAttr( const SfxItemSet &rSet );
+
+ const SdrObject* GetBestObject( sal_Bool bNext, sal_uInt16 eType = GOTOOBJ_DRAW_ANY, sal_Bool bFlat = sal_True, const ::svx::ISdrObjectFilter* pFilter = NULL );
+ sal_Bool GotoObj( sal_Bool bNext, sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_DRAW_ANY);
+
+ //Setzen vom DragMode (z.B. Rotate), tut nix bei Rahmenselektion.
+ void SetDragMode( sal_uInt16 eSdrDragMode );
+
+ sal_uInt16 IsObjSelected() const; //Liefert gleich die Anzahl der Objekte,
+ //zaehlt aber nicht die Objekte in Gruppen.
+ sal_Bool IsObjSelected( const SdrObject& rObj ) const;
+
+ void EndTextEdit(); //Loescht ggf. das Objekt.
+
+ //Ankertyp des selektierten Objektes, -1 bei Uneindeutigkeit oder
+ //Rahmenselektion; FLY_AT_PAGE bzw. FLY_AT_PARA aus frmatr.hxx sonst.
+ short GetAnchorId() const;
+
+ //Erzeugen von DrawObjekten, beim Begin wird der Objekttyp mitgegeben.
+ //Beim End kann ein Cmd mitgegeben werden, hier ist ggf.
+ //SDRCREATE_RESTRAINTEND fuer Ende oder SDRCREATE_NEXTPOINT fuer ein
+ //Polygon relevant. Nach dem RESTRAINTEND ist das Objekt erzeugt und
+ //selektiert.
+ //Mit BreakCreate wird der Vorgang abgebrochen, dann ist kein Objekt
+ //mehr selektiert.
+ sal_Bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Point &rPos );
+ sal_Bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, sal_uInt32 eObjInventor, const Point &);
+ void MoveCreate ( const Point &rPos );
+ sal_Bool EndCreate ( sal_uInt16 eSdrCreateCmd );
+ void BreakCreate();
+ sal_Bool IsDrawCreate() const;
+ void CreateDefaultShape( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Rectangle& rRect, sal_uInt16 nSlotId);
+
+ // Funktionen f�r Rubberbox, um Draw-Objekte zu selektieren
+ sal_Bool BeginMark( const Point &rPos );
+ void MoveMark ( const Point &rPos );
+ sal_Bool EndMark ();
+ void BreakMark();
+
+ //Gruppe erzeugen, aufloesen, nix bei Rahmenselektion.
+ sal_Bool IsGroupSelected(); //Kann auch eine Mischselektion sein!
+ void GroupSelection(); //Hinterher ist die Gruppe selektiert.
+ void UnGroupSelection(); //Die Einzelobjekte sind Selektiert
+ //Es koennen noch immer Gruppen dabei sein.
+
+ // OD 27.06.2003 #108784# - change return type.
+ bool IsGroupAllowed() const;
+
+ void MirrorSelection( sal_Bool bHorizontal ); //Bei sal_False Vertikal
+
+ //frmatr.hxx. Hier kein enum wg. Abhaengigkeiten
+ //Der sal_Bool ist nur fuer internen Gebrauch! Anker wird nur - anhand der
+ //aktuellen Dokumentposition - neu gesetzt aber nicht umgesetzt.
+ void ChgAnchor( int eAnchorId, sal_Bool bSameOnly = sal_False,
+ sal_Bool bPosCorr = sal_True );
+
+ sal_Bool SetDrawingAttr( SfxItemSet &rSet );
+
+ // hole die selectierten DrawObj als Grafik (MetaFile/Bitmap)
+ // Return-Wert besagt ob konvertiert wurde!!
+ sal_Bool GetDrawObjGraphic( sal_uLong nFmt, Graphic& rGrf ) const;
+
+ void Paste( SvStream& rStm, sal_uInt16 nAction, const Point* pPt = 0 );
+ sal_Bool Paste( const Graphic &rGrf );
+ sal_Bool Paste( SotDataObject& rObj, const Point& rPt );
+
+ sal_Bool IsAlignPossible() const;
+ void SetCalcFieldValueHdl(Outliner* pOutliner);
+
+ void Insert(const String& rGrfName,
+ const String& rFltName,
+ const Graphic* pGraphic = 0,
+ const SfxItemSet* pFlyAttrSet = 0,
+ const SfxItemSet* pGrfAttrSet = 0,
+ SwFrmFmt* = 0 );
+
+ // Insertion of a drawing object which have to be already inserted in the DrawModel
+ void InsertDrawObj( SdrObject& rDrawObj,
+ const Point& rInsertPosition );
+
+ sal_Bool ReplaceSdrObj( const String& rGrfName, const String& rFltName,
+ const Graphic* pGrf = 0 );
+
+ // --> #i972#
+ // for starmath formulas anchored 'as char' it alignes it baseline to baseline
+ // changing the previous vertical orientation
+ void AlignFormulaToBaseline( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, SwFlyFrm * pFly = 0 );
+
+ // aligns all formulas with anchor 'as char' to baseline
+ void AlignAllFormulasToBaseline();
+ // <--
+
+//------------------------------------------
+
+ //Auskunft ueber naechstliegenden Inhalt zum uebergebenen Point
+ Point GetCntntPos( const Point& rPoint, sal_Bool bNext ) const;
+
+ //convert document position into position relative to the current page
+ Point GetRelativePagePosition(const Point& rDocPos);
+
+ //Layout-Selektion Hiden/Zeigen und aufruf an die CrsrSh weiterreichen.
+ void ShLooseFcs();
+ void ShGetFcs( sal_Bool bUpdate = sal_True );
+
+ //PageDescriptor-Schnittstelle
+ void ChgCurPageDesc( const SwPageDesc& );
+ sal_uInt16 GetCurPageDesc( const sal_Bool bCalcFrm = sal_True ) const;
+ sal_uInt16 GetMousePageDesc( const Point &rPt ) const;
+ sal_uInt16 GetPageDescCnt() const;
+ SwPageDesc* FindPageDescByName( const String& rName,
+ sal_Bool bGetFromPool = sal_False,
+ sal_uInt16* pPos = 0 );
+
+ const SwPageDesc& GetPageDesc( sal_uInt16 i ) const;
+ void ChgPageDesc( sal_uInt16 i, const SwPageDesc& );
+ // if inside all selection only one PageDesc, return this.
+ // Otherwise return 0 pointer
+ const SwPageDesc* GetSelectedPageDescs() const;
+
+ const SwRect& GetAnyCurRect( CurRectType eType,
+ const Point* pPt = 0,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& =
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >() ) const;
+
+ //Seitennummer der Seite in der der Point liegt, 0 wenn keine
+ //getroffen ist.
+ sal_uInt16 GetPageNumber( const Point &rPoint ) const;
+ sal_Bool GetPageNumber( long nYPos, sal_Bool bAtCrsrPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, String &rDisplay ) const;
+
+ SwFlyFrmFmt* InsertObject( const svt::EmbeddedObjectRef&,
+ const SfxItemSet* pFlyAttrSet = 0,
+ const SfxItemSet* pGrfAttrSet = 0,
+ SwFrmFmt* = 0 );
+ sal_Bool FinishOLEObj(); // Server wird beendet
+
+ //Attribute der Tabelle besorgen/setzen.
+ void GetTblAttr( SfxItemSet & ) const;
+ void SetTblAttr( const SfxItemSet & );
+
+ //Tabelle vollstaendig selektiert?
+ sal_Bool HasWholeTabSelection() const;
+ //Ist der Inhalt einer Tabellenzelle oder mindestens eine Tabellenzelle
+ //vollstaendig selektiert ist
+ sal_Bool HasBoxSelection() const;
+
+ sal_Bool InsertRow( sal_uInt16 nCnt, sal_Bool bBehind );
+ sal_Bool InsertCol( sal_uInt16 nCnt, sal_Bool bBehind ); // 0 == am Ende
+ sal_Bool DeleteCol();
+ sal_Bool DeleteRow();
+
+ sal_Bool DeleteTblSel(); //Aktuelle Selektion, ggf. die ganze Tabelle.
+
+ sal_uInt16 MergeTab(); //Merged selektierte Tabellenteile zusammen
+ //Fehler ueber enum zurueck
+ // Zelle Vertikal oder Horizontal splitten.
+ sal_Bool SplitTab( sal_Bool nVert = sal_True, sal_uInt16 nCnt = 1, sal_Bool bSameHeight = sal_False );
+ sal_Bool Sort(const SwSortOptions&); //Sortieren.
+
+ void SetRowHeight( const SwFmtFrmSize &rSz );
+ //Der Pointer muss vom Aufrufer zerstoert werden wenn != 0
+ void GetRowHeight( SwFmtFrmSize *&rpSz ) const;
+
+ void SetRowSplit( const SwFmtRowSplit &rSz );
+ void GetRowSplit( SwFmtRowSplit *&rpSz ) const;
+
+ void SetBoxAlign( sal_uInt16 nOrient );
+ sal_uInt16 GetBoxAlign() const; //USHRT_MAX fuer uneindeutig!
+
+ //Ausgleichen der Zeilenhoehen. Mit bTstOnly festellen ob mehr als eine
+ //Zeile markiert ist.
+ sal_Bool BalanceRowHeight( sal_Bool bTstOnly );
+
+ void SetTabBorders( const SfxItemSet& rSet );
+ void GetTabBorders( SfxItemSet& rSet) const;
+ void SetTabLineStyle(const Color* pColor, sal_Bool bSetLine = sal_False, const SvxBorderLine* pBorderLine = NULL);
+
+ void SetTabBackground( const SvxBrushItem &rNew );
+ void GetTabBackground( SvxBrushItem &rToFill ) const;
+
+ void SetBoxBackground( const SvxBrushItem &rNew );
+ sal_Bool GetBoxBackground( SvxBrushItem &rToFill ) const; //sal_False uneindeutig
+
+ void SetBoxDirection( const SvxFrameDirectionItem& rNew );
+ sal_Bool GetBoxDirection( SvxFrameDirectionItem& rToFill ) const; //sal_False uneindeutig
+
+ void SetRowBackground( const SvxBrushItem &rNew );
+ sal_Bool GetRowBackground( SvxBrushItem &rToFill ) const; //sal_False uneindeutig
+
+ sal_uInt8 WhichMouseTabCol( const Point &rPt ) const;
+ void GetTabCols( SwTabCols &rToFill ) const; //Spalten- und Randinfo.
+ void SetTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly = sal_True );
+ void GetMouseTabCols( SwTabCols &rToFill, const Point &rPt ) const;
+ void SetMouseTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly,
+ const Point &rPt );
+
+ // --> FME 2004-07-30 #i20126# Enhanced table selection
+ // pEnd will be used during MouseMove
+ bool SelTblRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
+ // <--
+
+ // #i24134# adjustment of table rows via Ruler
+ void GetTabRows( SwTabCols &rToFill ) const;
+ void SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly );
+ void GetMouseTabRows( SwTabCols &rToFill, const Point &rPt ) const;
+ void SetMouseTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const Point &rPt );
+
+ void ProtectCells(); //Falls eine Tabselektion besteht, wird sie ver-
+ // nichtet, wenn der Cursor nicht in Readonly darf
+ void UnProtectCells(); // auf die Tabellenselektin
+ void UnProtectTbls(); //bei allen Tabellen in der Selektion den Schutz aufheben
+ sal_Bool HasTblAnyProtection( const String* pTblName = 0,
+ sal_Bool* pFullTblProtection = 0 );
+ sal_Bool CanUnProtectCells() const;
+
+ sal_uInt16 GetRowsToRepeat() const;
+ void SetRowsToRepeat( sal_uInt16 nNumOfRows );
+ sal_uInt16 GetVirtPageNum( const sal_Bool bCalcFrm = sal_True );
+ //returns the number of table rows currently selected
+ //if the selection start at the top of the table
+ sal_uInt16 GetRowSelectionFromTop() const;
+
+ sal_Bool IsInRepeatedHeadline() const { return CheckHeadline( true ); }
+ sal_Bool IsInHeadline() const { return CheckHeadline( false ); }
+
+ //Stellt die Breiten der Zellen so ein, dass der Inhalt moeglichst
+ //nicht umgebrochen werden muss.
+ //bBalance sorgt fuer einen Ausgleich der markierten Spalten.
+ void AdjustCellWidth( sal_Bool bBalance = sal_False );
+ //Nicht erlaubt, wenn nur leere Zellen selektiert sind.
+ sal_Bool IsAdjustCellWidthAllowed( sal_Bool bBalance = sal_False ) const;
+
+ //Ausgleich der Zellenbreiten, mit bTstOnly feststellen, ob mehr als
+ //eine Zelle markiert ist.
+ sal_Bool BalanceCellWidth( sal_Bool bTstOnly );
+
+ // AutoFormat fuer die Tabelle/TabellenSelection
+ sal_Bool SetTableAutoFmt( const SwTableAutoFmt& rNew );
+ // Erfrage wie attributiert ist
+ sal_Bool GetTableAutoFmt( SwTableAutoFmt& rGet );
+ // aender eine Zellenbreite/-Hoehe/Spaltenbreite/Zeilenhoehe
+ sal_Bool SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff = 283 );
+ // Autosumme
+ sal_Bool GetAutoSum( String& rFml ) const;
+
+ //Phy: Tatsaechliche Seitenanzahl.
+ //Virt: Vom User evtl. gesetzten Offset mit einbeziehen.
+ sal_uInt16 GetPhyPageNum();
+
+ // Setzt an der aktuellen Postion einen neuen Page Offset
+ void SetNewPageOffset( sal_uInt16 nOffset );
+ void SetPageOffset( sal_uInt16 nOffset ); //Aendert den letzten Page Offset
+ sal_uInt16 GetPageOffset() const; //Liefert den letzten Page Offset
+
+ //SS fuer Beschriftungen
+ void InsertLabel( const SwLabelType eType, const String &rTxt, const String& rSeparator,
+ const String& rNumberSeparator,
+ const sal_Bool bBefore, const sal_uInt16 nId,
+ const String& rCharacterStyle,
+ const sal_Bool bCpyBrd = sal_True );
+
+ //Das Lineal will auch noch etwas von uns wissen.
+ sal_uInt16 GetCurColNum( SwGetCurColNumPara* pPara = 0 ) const; //0 == in keiner Spalte
+ sal_uInt16 GetCurMouseColNum( const Point &rPt,
+ SwGetCurColNumPara* pPara = 0 ) const;
+ sal_uInt16 GetCurTabColNum() const; //0 == in keiner Tabelle
+ sal_uInt16 GetCurMouseTabColNum( const Point &rPt ) const;
+ sal_uInt16 GetCurOutColNum( SwGetCurColNumPara* pPara = 0 ) const; // aktuelle aeussere Spalte
+
+ sal_Bool IsTableRightToLeft() const;
+ sal_Bool IsMouseTableRightToLeft( const Point &rPt ) const;
+ sal_Bool IsTableVertical() const;
+
+ sal_Bool IsLastCellInRow() const;
+ // Die Breite des aktuellen Bereichs fuer Spaltendialog
+ long GetSectionWidth( SwFmt& rFmt ) const;
+
+ void GetConnectableFrmFmts
+ (SwFrmFmt & rFmt, const String & rReference, sal_Bool bSuccessors,
+ ::std::vector< String > & aPrevPageVec,
+ ::std::vector< String > & aThisPageVec,
+ ::std::vector< String > & aNextPageVec,
+ ::std::vector< String > & aRestVec);
+
+ /** SwFEShell::GetShapeBackgrd
+
+ OD 02.09.2002 for #102450#:
+ method determines background color of the page the selected drawing
+ object is on and returns this color.
+ If no color is found, because no drawing object is selected or ...,
+ color COL_BLACK (default color on constructing object of class Color)
+ is returned.
+
+ @author OD
+
+ @returns an object of class Color
+ */
+ const Color GetShapeBackgrd() const;
+
+ /** Is default horizontal text direction for selected drawing object right-to-left
+
+ OD 09.12.2002 #103045#
+ Because drawing objects only painted for each page only, the default
+ horizontal text direction of a drawing object is given by the corresponding
+ page property.
+
+ @author OD
+
+ @returns boolean, indicating, if the horizontal text direction of the
+ page, the selected drawing object is on, is right-to-left.
+ */
+ bool IsShapeDefaultHoriTextDirR2L() const;
+
+ void ParkCursorInTab();
+
+ // -> #i23726#
+ SwTxtNode * GetNumRuleNodeAtPos(const Point &rPot);
+ sal_Bool IsNumLabel( const Point &rPt, int nMaxOffset = -1 );
+ // <- #i23726#
+ // --> OD 2005-02-21 #i42921#
+ bool IsVerticalModeAtNdAndPos( const SwTxtNode& _rTxtNode,
+ const Point& _rDocPos ) const;
+ // <--
+
+};
+
+#endif
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
new file mode 100644
index 000000000000..d248c74a53f5
--- /dev/null
+++ b/sw/inc/fldbas.hxx
@@ -0,0 +1,462 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_FLDBAS_HXX
+#define SW_FLDBAS_HXX
+
+#include <i18npool/lang.h>
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+#include "swdllapi.h"
+#include <calbck.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+class SwDoc;
+class SvStringsDtor;
+class SvNumberFormatter;
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: die ID's fuer die Feldtypen
+ --------------------------------------------------------------------*/
+
+enum RES_FIELDS
+{
+// Fuer die alten Dokumente muessen die Field-Which IDS erhalten bleiben !!!!
+ RES_FIELDS_BEGIN,
+ RES_DBFLD = RES_FIELDS_BEGIN,
+ RES_USERFLD,
+ RES_FILENAMEFLD,
+ RES_DBNAMEFLD,
+ RES_DATEFLD,
+ RES_TIMEFLD,
+ RES_PAGENUMBERFLD,
+ RES_AUTHORFLD,
+ RES_CHAPTERFLD,
+ RES_DOCSTATFLD,
+ RES_GETEXPFLD,
+ RES_SETEXPFLD,
+ RES_GETREFFLD,
+ RES_HIDDENTXTFLD,
+ RES_POSTITFLD,
+ RES_FIXDATEFLD,
+ RES_FIXTIMEFLD,
+ RES_REGFLD,
+ RES_VARREGFLD,
+ RES_SETREFFLD,
+ RES_INPUTFLD,
+ RES_MACROFLD,
+ RES_DDEFLD,
+ RES_TABLEFLD,
+ RES_HIDDENPARAFLD,
+ RES_DOCINFOFLD,
+ RES_TEMPLNAMEFLD,
+ RES_DBNEXTSETFLD,
+ RES_DBNUMSETFLD,
+ RES_DBSETNUMBERFLD,
+ RES_EXTUSERFLD,
+ RES_REFPAGESETFLD,
+ RES_REFPAGEGETFLD,
+ RES_INTERNETFLD,
+ RES_JUMPEDITFLD,
+ RES_SCRIPTFLD,
+ RES_DATETIMEFLD,
+ RES_AUTHORITY, //Table of authorities
+ RES_COMBINED_CHARS,
+ RES_DROPDOWN,
+ RES_FIELDS_END
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Liste der FieldTypes am UI
+ --------------------------------------------------------------------*/
+
+enum SwFldTypesEnum
+{
+ TYP_BEGIN,
+ TYP_DATEFLD = TYP_BEGIN, // 0
+ TYP_TIMEFLD,
+ TYP_FILENAMEFLD,
+ TYP_DBNAMEFLD,
+ TYP_CHAPTERFLD,
+ TYP_PAGENUMBERFLD,
+ TYP_DOCSTATFLD,
+ TYP_AUTHORFLD,
+ TYP_SETFLD,
+ TYP_GETFLD,
+ TYP_FORMELFLD, // 10
+ TYP_HIDDENTXTFLD,
+ TYP_SETREFFLD,
+ TYP_GETREFFLD,
+ TYP_DDEFLD,
+ TYP_MACROFLD,
+ TYP_INPUTFLD,
+ TYP_HIDDENPARAFLD,
+ TYP_DOCINFOFLD,
+ TYP_DBFLD,
+ TYP_USERFLD, // 20
+ TYP_POSTITFLD,
+ TYP_TEMPLNAMEFLD,
+ TYP_SEQFLD,
+ TYP_DBNEXTSETFLD,
+ TYP_DBNUMSETFLD,
+ TYP_DBSETNUMBERFLD,
+ TYP_CONDTXTFLD,
+ TYP_NEXTPAGEFLD,
+ TYP_PREVPAGEFLD,
+ TYP_EXTUSERFLD, // 30
+ TYP_FIXDATEFLD,
+ TYP_FIXTIMEFLD,
+ TYP_SETINPFLD,
+ TYP_USRINPFLD,
+ TYP_SETREFPAGEFLD,
+ TYP_GETREFPAGEFLD,
+ TYP_INTERNETFLD,
+ TYP_JUMPEDITFLD,
+ TYP_SCRIPTFLD, // 40
+ TYP_AUTHORITY,
+ TYP_COMBINED_CHARS,
+ TYP_DROPDOWN,
+ TYP_END
+};
+
+
+enum SwFileNameFormat
+{
+ FF_BEGIN,
+ FF_NAME = FF_BEGIN,
+ FF_PATHNAME,
+ FF_PATH,
+ FF_NAME_NOEXT,
+ FF_UI_NAME,
+ FF_UI_RANGE,
+ FF_END,
+ FF_FIXED = 0x8000
+};
+
+enum SwVarFormat
+{
+ VVF_CMD = 0x0010, // Kommando anzeigen
+ VVF_INVISIBLE = 0x0040, // unsichtbar
+ VVF_XXP = 0x0400, // 1234%
+ VVF_XX_XXP = 0x0800, // 1.234,56%
+ VVF_CLEAR = 0x000f,
+
+// ab hier neue Formate
+ VVF_SYS = 0x2000, //Zahlenformat aus der Systemeinstellung
+ VVF_X = 0x2100, // 1234
+ VVF_X_X = 0x2200, // 1234,5
+ VVF_X_XX = 0x2300, // 1245,56
+ VVF_XX_X = 0x2400, // 1.234,5
+ VVF_XX_XX = 0x2500, // 1.234,56
+ VVF_XX_XXX = 0x2600, // 1.234,567
+ VVF_SYS_CUR = 0x2700, // W???hrungsformat aus der Systemeinstellung
+ VVF_CUR_X = 0x2800, // DM 1234
+ VVF_CUR_XX_XX = 0x2900, // DM 1234,56 DM 1234,00
+ VVF_CUR_XX_X0 = 0x2a00, // DM 1234,56 DM 1234,--
+ VVF_X_CUR = 0x2b00, // 1234 DM
+ VVF_XX_XX_CUR = 0x2c00, // 1234,56 DM 1234,00 DM
+ VVF_XX_X0_CUR = 0x2d00, // 1234,56 DM 1234,-- DM
+// Kompatibilitaet:
+ VF_CMD = VVF_CMD,
+ VF_INVISIBLE = VVF_INVISIBLE,
+ VF_XXP = VVF_XXP,
+ VF_XX_XXP = VVF_XX_XXP,
+ VF_VISIBLE = VVF_SYS,
+ VF_XX = VVF_X,
+ VF_XX_XX = VVF_XX_XX,
+ VF_XX_XX_CUR = VVF_SYS_CUR,
+ VF_CLEAR = VVF_CLEAR
+
+};
+
+typedef sal_uInt16 SwGetSetExpType;
+namespace nsSwGetSetExpType
+{
+ const SwGetSetExpType GSE_STRING = 0x0001; // String
+ const SwGetSetExpType GSE_EXPR = 0x0002; // Expression
+ const SwGetSetExpType GSE_INP = 0x0004; // InputField
+ const SwGetSetExpType GSE_SEQ = 0x0008; // Sequence
+ const SwGetSetExpType GSE_FORMULA = 0x0010; // Formel
+}
+
+typedef sal_uInt16 SwExtendedSubType;
+namespace nsSwExtendedSubType
+{
+ const SwExtendedSubType SUB_CMD = 0x0100; // Kommando anzeigen
+ const SwExtendedSubType SUB_INVISIBLE = 0x0200; // unsichtbar
+ const SwExtendedSubType SUB_OWN_FMT = 0x0400; // SwDBField: Uebernimmt Formatierung nicht
+ // aus Datenbank
+}
+
+enum SwInputFieldSubType
+{
+ INP_TXT = 0x01,
+ INP_USR = 0x02,
+ INP_VAR = 0x03
+};
+
+
+enum SwUserType
+{
+ UF_STRING = 0x01,
+ UF_EXPR = 0x02
+};
+
+enum SwDateTimeSubType
+{
+ FIXEDFLD = 1,
+ DATEFLD = 2,
+ TIMEFLD = 4
+};
+
+
+extern sal_uInt16 __FAR_DATA aTypeTab[];
+
+/*--------------------------------------------------------------------
+ Beschreibung: Allgemeine Tools
+ --------------------------------------------------------------------*/
+
+String GetResult(double nVal, sal_uInt32 nNumFmt, sal_uInt16 nLang = LANGUAGE_SYSTEM);
+void SetErrorStr(const String& rStr);
+//String ExpandDate(const Date& rDate, sal_uLong nFmt, sal_uInt16 nLang);
+//String ExpandTime(const Time& rTime, sal_uLong nFmt, sal_uInt16 nLang);
+String FormatNumber(sal_uInt16 nNum, sal_uInt32 nFormat);
+
+/*--------------------------------------------------------------------
+ Beschreibung: Instanzen von SwFields und Abgeleiteten kommen 0-n mal vor.
+ Zu jeder Klasse SwFields existiert
+ 1 Instanz der zugehoerigen Typenklasse
+ Basisklasse aller Feldtypen ist SwFieldType
+ --------------------------------------------------------------------*/
+
+DBG_NAMEEX(SwFieldType)
+
+class SW_DLLPUBLIC SwFieldType : public SwModify
+{
+ sal_uInt16 nWhich;
+
+ friend void _FinitUI(); // um den Pointer zu loeschen!
+ static SvStringsDtor* pFldNames;
+
+ static void _GetFldName(); // legt die FldNames an, fldmgr.cxx!
+
+protected:
+ // single argument ctors shall be explicit.
+ explicit SwFieldType( sal_uInt16 nWhichId );
+
+public:
+
+#ifdef DBG_UTIL
+ virtual ~SwFieldType();
+#endif
+ static const String& GetTypeStr( sal_uInt16 nTypeId );
+
+ // nur in abgeleiteten Klassen
+ virtual const String& GetName() const;
+ virtual SwFieldType* Copy() const = 0;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+
+ sal_uInt16 Which() const { return nWhich; }
+
+ inline void UpdateFlds() const;
+};
+
+inline void SwFieldType::UpdateFlds() const
+{
+ ((SwFieldType*)this)->ModifyNotification( 0, 0 );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Basisklasse aller Felder.
+ Ueber Which wird der Typ des Feldes abgefragt.
+ Ueber Expand() wird der expandierte Inhalt
+ des Feldes in Erfahrung gebracht.
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwField
+{
+private:
+ mutable String m_Cache; /// #i85766# cached expansion (for clipboard)
+ sal_uInt16 nLang; // Immer ueber SetLanguage aendern!
+ sal_Bool bIsAutomaticLanguage;
+ sal_uInt32 nFormat;
+
+ SwFieldType* pType;
+
+ virtual String Expand() const = 0;
+ virtual SwField* Copy() const = 0;
+
+protected:
+ void SetFormat(sal_uInt32 nSet) {nFormat = nSet;}
+
+ SwField(SwFieldType* pTyp, sal_uInt32 nFmt = 0, sal_uInt16 nLang = LANGUAGE_SYSTEM);
+
+public:
+ virtual ~SwField();
+
+ // Typ feststellen
+ inline SwFieldType* GetTyp() const;
+
+ // neuen Typ setzen (wird fuer das Kopieren zwischen Dokumenten benutzt)
+ virtual SwFieldType* ChgTyp( SwFieldType* );
+
+ /** expand the field.
+ @param bCached return cached field value.
+ @remark most callers should use the cached field value.
+ this is because various fields need special handing
+ (ChangeExpansion()) to return correct values, and only
+ SwTxtFormatter::NewFldPortion() sets things up properly.
+ @return the generated text (suitable for display)
+ */
+ String ExpandField(bool const bCached) const;
+
+ virtual String GetFieldName() const;
+
+ SwField * CopyField() const;
+
+ // ResId
+ sal_uInt16 Which() const
+#ifndef DBG_UTIL
+ { return pType->Which(); }
+#else
+ ; // in fldbas.cxx implementiert
+#endif
+
+ // TYP_ID
+ sal_uInt16 GetTypeId() const;
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16);
+
+ // Sprache an der Feldposition
+ inline sal_uInt16 GetLanguage() const;
+ virtual void SetLanguage(sal_uInt16 nLng);
+
+ // Parameter fuer Dialog und BASIC erfragen
+ inline sal_uInt32 GetFormat() const;
+ virtual const String& GetPar1() const;
+ virtual String GetPar2() const;
+
+ virtual String GetFormula() const;
+
+ virtual void ChangeFormat(sal_uInt32 n);
+ virtual void SetPar1(const String& rStr);
+ virtual void SetPar2(const String& rStr);
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId );
+ // hat das Feld eine Action auf dem ClickHandler ? (z.B. INetFelder,..)
+ sal_Bool HasClickHdl() const;
+ // ist es ein Fix-Feld?
+ sal_Bool IsFixed() const;
+
+ sal_Bool IsAutomaticLanguage() const { return bIsAutomaticLanguage;}
+ void SetAutomaticLanguage(sal_Bool bSet){bIsAutomaticLanguage = bSet;}
+
+ virtual String GetDescription() const;
+};
+
+inline SwFieldType* SwField::GetTyp() const
+ { return pType; }
+
+inline sal_uInt32 SwField::GetFormat() const
+ { return nFormat; }
+
+inline sal_uInt16 SwField::GetLanguage() const
+ { return nLang; }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Felder mit Values, die ueber der Numberformatter
+ formatiert werden muessen
+ --------------------------------------------------------------------*/
+
+class SwValueFieldType : public SwFieldType
+{
+ SwDoc* pDoc;
+ sal_Bool bUseFormat; // Numberformatter verwenden
+
+protected:
+ SwValueFieldType( SwDoc* pDocPtr, sal_uInt16 nWhichId );
+ SwValueFieldType( const SwValueFieldType& rTyp );
+
+public:
+ inline SwDoc* GetDoc() const { return pDoc; }
+ inline void SetDoc(SwDoc* pNewDoc) { pDoc = pNewDoc; }
+
+ inline sal_Bool UseFormat() const { return bUseFormat; }
+ inline void EnableFormat(sal_Bool bFormat = sal_True) { bUseFormat = bFormat; }
+
+ String ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const;
+ void DoubleToString(String &rValue, const double &rVal, LanguageType eLng) const;
+ void DoubleToString(String &rValue, const double &rVal, sal_uInt32 nFmt) const;
+};
+
+class SW_DLLPUBLIC SwValueField : public SwField
+{
+ double fValue;
+// String sExpand;
+
+protected:
+ SwValueField( SwValueFieldType* pFldType, sal_uInt32 nFmt = 0, sal_uInt16 nLang = LANGUAGE_SYSTEM, const double fVal = 0.0 );
+ SwValueField( const SwValueField& rFld );
+
+public:
+ virtual ~SwValueField();
+
+ virtual SwFieldType* ChgTyp( SwFieldType* );
+ virtual void SetLanguage(sal_uInt16 nLng);
+// os: wozu war das denn da?
+// virtual void ChangeFormat(sal_uLong n);
+
+ inline SwDoc* GetDoc() const { return ((SwValueFieldType*)GetTyp())->GetDoc(); }
+
+ virtual double GetValue() const;
+ virtual void SetValue( const double& rVal );
+
+ inline String ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const
+ { return ((SwValueFieldType*)GetTyp())->ExpandValue(rVal, nFmt, nLng); }
+
+ static sal_uInt32 GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt32 nFmt);
+};
+
+class SW_DLLPUBLIC SwFormulaField : public SwValueField
+{
+ String sFormula;
+
+protected:
+ SwFormulaField( SwValueFieldType* pFldType, sal_uInt32 nFmt = 0, const double fVal = 0.0 );
+ SwFormulaField( const SwFormulaField& rFld );
+
+public:
+ virtual String GetFormula() const;
+ void SetFormula(const String& rStr);
+
+ void SetExpandedFormula(const String& rStr);
+ String GetExpandedFormula() const;
+};
+
+#endif // SW_FLDBAS_HXX
diff --git a/sw/inc/flddat.hxx b/sw/inc/flddat.hxx
new file mode 100644
index 000000000000..b5f7292d32ba
--- /dev/null
+++ b/sw/inc/flddat.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_FLDDAT_HXX
+#define SW_FLDDAT_HXX
+
+#include <tools/string.hxx>
+
+#include "fldbas.hxx"
+
+class DateTime;
+class Date;
+class Time;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Formate
+ --------------------------------------------------------------------*/
+
+enum SwDateFormat
+{
+ DF_BEGIN,
+ //neue Formate:
+ DFF_SSYS = DF_BEGIN,
+ DFF_LSYS ,
+ DFF_DMY ,
+ DFF_DMYY ,
+ DFF_DMMY ,
+ DFF_DMMYY,
+ DFF_DMMMY ,
+ DFF_DMMMYY,
+ DFF_DDMMY ,
+ DFF_DDMMMY ,
+ DFF_DDMMMYY ,
+ DFF_DDDMMMY ,
+ DFF_DDDMMMYY ,
+ DFF_MY ,
+ DFF_MD ,
+ DFF_YMD ,
+ DFF_YYMD ,
+ DF_END ,
+// Kompatibilitaet:
+ DF_SSYS = DFF_SSYS,
+ DF_LSYS = DFF_LSYS,
+ DF_SHORT = DFF_DMY,
+ DF_SCENT = DFF_DMYY,
+ DF_LMON = DFF_DMMYY,
+ DF_LMONTH = DFF_DMMMYY,
+ DF_LDAYMON = DFF_DDMMMYY,
+ DF_LDAYMONTH= DFF_DDDMMMYY
+};
+
+enum SwTimeFormat
+{
+ TF_BEGIN,
+ TF_SYSTEM=TF_BEGIN,
+ TF_SSMM_24,
+ TF_SSMM_12,
+ TF_END
+};
+
+enum SwTimeSubFormat
+{
+ TIME_FIX,
+ TIME_VAR
+};
+
+enum SwDateSubFormat
+{
+ DATE_FIX,
+ DATE_VAR
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datum/Uhrzeitfeld
+ --------------------------------------------------------------------*/
+
+class SwDateTimeFieldType : public SwValueFieldType
+{
+public:
+ SwDateTimeFieldType(SwDoc* pDoc);
+
+ virtual SwFieldType* Copy() const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datum/Uhrzeitfeld
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwDateTimeField : public SwValueField
+{
+ sal_uInt16 nSubType;
+ long nOffset; // Offset in Minuten
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ SwDateTimeField(SwDateTimeFieldType* pType, sal_uInt16 nSubType = DATEFLD,
+ sal_uLong nFmt = 0, sal_uInt16 nLng = 0);
+
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16 nSub);
+
+ virtual double GetValue() const;
+
+ virtual void SetPar2(const String& rStr);
+ virtual String GetPar2() const;
+
+ inline sal_Bool IsDate() const
+ { return (nSubType & DATEFLD) != 0; }
+
+ inline void SetOffset(long nMinutes) { nOffset = nMinutes; }
+ inline long GetOffset() const { return nOffset; }
+
+ Date GetDate(sal_Bool bUseOffset = sal_False) const;
+ Time GetTime(sal_Bool bUseOffset = sal_False) const;
+ void SetDateTime(const DateTime& rDT);
+ static double GetDateTime(SwDoc* pDoc, const DateTime& rDT);
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nMId ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nMId );
+};
+
+#endif // SW_FLDDAT_HXX
diff --git a/sw/inc/flddropdown.hxx b/sw/inc/flddropdown.hxx
new file mode 100644
index 000000000000..b18a8fa22b9b
--- /dev/null
+++ b/sw/inc/flddropdown.hxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_FLDDROPDOWN_HXX
+#define SW_FLDDROPDOWN_HXX
+
+#include "com/sun/star/uno/Sequence.hxx"
+#include "swdllapi.h"
+#include "fldbas.hxx"
+
+#include <vector>
+
+/**
+ Field type for dropdown boxes.
+*/
+class SwDropDownFieldType : public SwFieldType
+{
+public:
+ /**
+ Constructor
+ */
+ SwDropDownFieldType();
+
+ /**
+ Destructor
+ */
+ virtual ~SwDropDownFieldType();
+
+ /**
+ Create a copy of this field type.
+
+ @return a copy of this type
+ */
+ virtual SwFieldType * Copy () const;
+};
+
+/**
+ Dropdown field.
+
+ The dropdown field contains a list of strings. At most one of them
+ can be selected.
+*/
+class SW_DLLPUBLIC SwDropDownField : public SwField
+{
+ /**
+ the possible values (aka items) of the dropdown box
+ */
+ std::vector<String> aValues;
+
+ /**
+ the selected item
+ */
+ String aSelectedItem;
+
+ /**
+ the name of the field
+ */
+ String aName;
+
+ /**
+ help text
+ */
+ String aHelp;
+
+ /**
+ tool tip string
+ */
+ String aToolTip;
+
+ /**
+ Expands the field.
+
+ The expanded value of the field is the value of the selected
+ item. If no item is selected, an empty string is returned.
+
+ @return the expanded value of the field
+ */
+ virtual String Expand() const;
+
+ /**
+ Creates a copy of this field.
+
+ @return the copy of this field
+ */
+ virtual SwField * Copy() const;
+
+public:
+ /**
+ Constructor
+
+ @param pTyp field type for this field
+ */
+ SwDropDownField(SwFieldType * pTyp);
+
+ /**
+ Copy constructor
+
+ @param rSrc dropdown field to copy
+ */
+ SwDropDownField(const SwDropDownField & rSrc);
+
+ /**
+ Destructor
+ */
+ virtual ~SwDropDownField();
+
+ /**
+ Returns the selected value.
+
+ @see Expand
+
+ @return the selected value
+ */
+ virtual const String & GetPar1() const;
+
+ /**
+ Returns the name of the field.
+
+ @return the name of the field
+ */
+ virtual String GetPar2() const;
+
+ /**
+ Sets the selected value.
+
+ If rStr is an item of the field that item will be
+ selected. Otherwise no item will be selected, i.e. the
+ resulting selection will be empty.
+ */
+ virtual void SetPar1(const String & rStr);
+
+ /**
+ Sets the name of the field.
+
+ @param rStr the new name of the field
+ */
+ virtual void SetPar2(const String & rStr);
+
+ /**
+ Sets the items of the dropdown box.
+
+ After setting the items the selection will be empty.
+
+ @param rItems the new items
+ */
+ void SetItems(const std::vector<String> & rItems);
+
+ /**
+ Sets the items of the dropdown box.
+
+ After setting the items the selection will be empty.
+
+ @param rItems the new items
+ */
+ void SetItems(const com::sun::star::uno::Sequence<rtl::OUString> & rItems);
+
+ /**
+ Returns the items of the dropdown box.
+
+ @return the items of the dropdown box
+ */
+ com::sun::star::uno::Sequence<rtl::OUString> GetItemSequence() const;
+
+ /**
+ Returns the selected item.
+
+ @return the selected item
+ */
+ const String & GetSelectedItem() const;
+
+ /**
+ Returns the name of the field.
+
+ @return the name of the field
+ */
+ const String & GetName() const;
+
+ /**
+ Returns the help text of the field.
+
+ @return the help text of the field
+ */
+ const String & GetHelp() const;
+
+ /**
+ Returns the tool tip of the field.
+
+ @return the tool tip of the field
+ */
+ const String & GetToolTip() const;
+
+ /**
+ Sets the selected item.
+
+ If rItem is found in this dropdown field it is selected. If
+ rItem is not found the selection will be empty.
+
+ @param rItem the item to be set
+
+ @retval sal_True the selected item was successfully set
+ @retval sal_True failure (empty selection)
+ */
+ sal_Bool SetSelectedItem(const String & rItem);
+
+ /**
+ Sets the name of the field.
+
+ @param rName the new name of the field
+ */
+ void SetName(const String & rName);
+
+ /**
+ Sets the help text of the field.
+
+ @param rHelp the help text
+ */
+ void SetHelp(const String & rHelp);
+
+ /**
+ Sets the tool tip of the field.
+
+ @param rToolTip the tool tip
+ */
+ void SetToolTip(const String & rToolTip);
+
+ /**
+ API: Gets a property value from the dropdown field.
+
+ @param rVal return value
+ @param nMId
+ - FIELD_PROP_PAR1 Get selected item (String)
+ - FIELD_PROP_STRINGS Get all items (Sequence)
+ - FIELD_PROP_PAR3 Get the help text of the field.
+ - FIELD_PROP_PAR4 Get the tool tip of the field.
+ */
+ virtual sal_Bool QueryValue(com::sun::star::uno::Any &rVal, sal_uInt16 nWhichId) const;
+
+ /**
+ API: Sets a property value on the dropdown field.
+
+ @param rVal value to set
+ @param nMId
+ - FIELD_PROP_PAR1 Set selected item (String)
+ - FIELD_PROP_STRINGS Set all items (Sequence)
+ - FIELD_PROP_PAR3 Set the help text of the field.
+ - FIELD_PROP_PAR4 Set the tool tip of the field.
+ */
+ virtual sal_Bool PutValue(const com::sun::star::uno::Any &rVal, sal_uInt16 nWhichId);
+};
+
+#endif
diff --git a/sw/inc/fldinit.hxx b/sw/inc/fldinit.hxx
new file mode 100644
index 000000000000..40fbac692444
--- /dev/null
+++ b/sw/inc/fldinit.hxx
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FLDINIT_HXX
+#define _FLDINIT_HXX
+
+/*--------------------------------------------------------------------
+ Beschreibung: Tabelle aller FeldInfos
+ --------------------------------------------------------------------*/
+
+void InitFieldInfo();
+void FinitFieldInfo();
+
+
+#endif // _FLDINIT_HXX
diff --git a/sw/inc/fldui.hrc b/sw/inc/fldui.hrc
new file mode 100644
index 000000000000..b08972ed4d96
--- /dev/null
+++ b/sw/inc/fldui.hrc
@@ -0,0 +1,292 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FLDUI_HRC
+#define _FLDUI_HRC
+
+#include "rcid.hrc"
+
+
+#define DLG_FLD RC_FLDDLG_BEGIN
+#define DLG_RECORD_MRG (RC_FLDDLG_BEGIN + 1)
+#define DLG_RECORD_INS (RC_FLDDLG_BEGIN + 2)
+#define DLG_FLD_EDIT (RC_FLDDLG_BEGIN + 3)
+#define DLG_POSTIT (RC_FLDDLG_BEGIN + 4)
+#define DLG_FLD_INPUT (RC_FLDDLG_BEGIN + 5)
+#define DLG_BRCFG (RC_FLDDLG_BEGIN + 6)
+#define DLG_BRSEEK (RC_FLDDLG_BEGIN + 7)
+#define DLG_BRSORT (RC_FLDDLG_BEGIN + 8)
+#define DLG_CHANGE_DB (RC_FLDDLG_BEGIN + 9)
+#define DLG_JAVAEDIT (RC_FLDDLG_BEGIN + 10)
+#define DLG_FLD_INSERT (RC_FLDDLG_BEGIN + 11)
+#define DLG_FLD_DROPDOWN (RC_FLDDLG_BEGIN + 12)
+
+/*--------------------------------------------------------------------
+ Beschreibung: TypeId
+ --------------------------------------------------------------------*/
+
+#define STR_TYPE_BEGIN RC_FLDDLG_BEGIN
+#define STR_DATEFLD STR_TYPE_BEGIN
+#define STR_TIMEFLD (STR_TYPE_BEGIN + 1)
+#define STR_FILENAMEFLD (STR_TYPE_BEGIN + 2)
+#define STR_DBNAMEFLD (STR_TYPE_BEGIN + 3)
+#define STR_CHAPTERFLD (STR_TYPE_BEGIN + 4)
+#define STR_PAGENUMBERFLD (STR_TYPE_BEGIN + 5)
+#define STR_DOCSTATFLD (STR_TYPE_BEGIN + 6)
+#define STR_AUTHORFLD (STR_TYPE_BEGIN + 7)
+#define STR_SETFLD (STR_TYPE_BEGIN + 8)
+#define STR_GETFLD (STR_TYPE_BEGIN + 9)
+#define STR_FORMELFLD (STR_TYPE_BEGIN + 10)
+#define STR_CONDTXTFLD (STR_TYPE_BEGIN + 11)
+#define STR_SETREFFLD (STR_TYPE_BEGIN + 12)
+#define STR_GETREFFLD (STR_TYPE_BEGIN + 13)
+#define STR_DDEFLD (STR_TYPE_BEGIN + 14)
+#define STR_MACROFLD (STR_TYPE_BEGIN + 15)
+#define STR_INPUTFLD (STR_TYPE_BEGIN + 16)
+#define STR_DOCINFOFLD (STR_TYPE_BEGIN + 17)
+#define STR_DBFLD (STR_TYPE_BEGIN + 19)
+#define STR_USERFLD (STR_TYPE_BEGIN + 20)
+#define STR_POSTITFLD (STR_TYPE_BEGIN + 21)
+#define STR_HIDDENPARAFLD (STR_TYPE_BEGIN + 22)
+
+#define STR_TEMPLNAMEFLD (STR_TYPE_BEGIN + 24)
+#define STR_SEQFLD (STR_TYPE_BEGIN + 25)
+#define STR_DBNEXTSETFLD (STR_TYPE_BEGIN + 26)
+#define STR_DBNUMSETFLD (STR_TYPE_BEGIN + 27)
+#define STR_DBSETNUMBERFLD (STR_TYPE_BEGIN + 28)
+#define STR_PREVPAGEFLD (STR_TYPE_BEGIN + 29)
+#define STR_NEXTPAGEFLD (STR_TYPE_BEGIN + 30)
+#define STR_HIDDENTXTFLD (STR_TYPE_BEGIN + 31)
+#define STR_EXTUSERFLD (STR_TYPE_BEGIN + 32)
+#define STR_SETINPUTFLD (STR_TYPE_BEGIN + 33)
+#define STR_USRINPUTFLD (STR_TYPE_BEGIN + 34)
+#define STR_SETREFPAGEFLD (STR_TYPE_BEGIN + 35)
+#define STR_GETREFPAGEFLD (STR_TYPE_BEGIN + 36)
+#define STR_INTERNETFLD (STR_TYPE_BEGIN + 37)
+#define STR_JUMPEDITFLD (STR_TYPE_BEGIN + 38)
+#define STR_SCRIPTFLD (STR_TYPE_BEGIN + 39)
+#define STR_AUTHORITY (STR_TYPE_BEGIN + 40)
+#define STR_COMBINED_CHARS (STR_TYPE_BEGIN + 41)
+#define STR_DROPDOWN (STR_TYPE_BEGIN + 42)
+#define STR_CUSTOM (STR_TYPE_BEGIN + 43)
+#define STR_TYPE_END (STR_TYPE_BEGIN + 44)
+
+/*--------------------------------------------------------------------
+ Beschreibung: SubTypes
+ --------------------------------------------------------------------*/
+
+#define FLD_DATE_BEGIN STR_TYPE_END
+#define FLD_DATE_FIX FLD_DATE_BEGIN
+#define FLD_DATE_STD (FLD_DATE_BEGIN + 1)
+#define FLD_DATE_END (FLD_DATE_BEGIN + 2)
+
+#define FLD_TIME_BEGIN FLD_DATE_END
+#define FLD_TIME_FIX FLD_TIME_BEGIN
+#define FLD_TIME_STD (FLD_TIME_BEGIN + 1)
+#define FLD_TIME_END (FLD_TIME_BEGIN + 2)
+
+#define FLD_STAT_BEGIN FLD_TIME_END
+#define FLD_STAT_PAGE FLD_STAT_BEGIN
+#define FLD_STAT_PARA (FLD_STAT_BEGIN + 1)
+#define FLD_STAT_WORD (FLD_STAT_BEGIN + 2)
+#define FLD_STAT_CHAR (FLD_STAT_BEGIN + 3)
+#define FLD_STAT_TABLE (FLD_STAT_BEGIN + 4)
+#define FLD_STAT_GRF (FLD_STAT_BEGIN + 5)
+#define FLD_STAT_OBJ (FLD_STAT_BEGIN + 6)
+#define FLD_STAT_END (FLD_STAT_BEGIN + 7)
+
+#define FLD_INPUT_BEGIN FLD_STAT_END
+#define FLD_INPUT_TEXT FLD_INPUT_BEGIN
+#define FLD_INPUT_END (FLD_INPUT_BEGIN + 1)
+
+#define FLD_EU_BEGIN FLD_INPUT_END
+#define FLD_EU_FIRMA FLD_EU_BEGIN
+#define FLD_EU_VORNAME (FLD_EU_BEGIN + 1)
+#define FLD_EU_NAME (FLD_EU_BEGIN + 2)
+#define FLD_EU_ABK (FLD_EU_BEGIN + 3)
+#define FLD_EU_STRASSE (FLD_EU_BEGIN + 4)
+#define FLD_EU_LAND (FLD_EU_BEGIN + 5)
+#define FLD_EU_PLZ (FLD_EU_BEGIN + 6)
+#define FLD_EU_ORT (FLD_EU_BEGIN + 7)
+#define FLD_EU_TITEL (FLD_EU_BEGIN + 8)
+#define FLD_EU_POS (FLD_EU_BEGIN + 9)
+#define FLD_EU_TELPRIV (FLD_EU_BEGIN + 10)
+#define FLD_EU_TELFIRMA (FLD_EU_BEGIN + 11)
+#define FLD_EU_FAX (FLD_EU_BEGIN + 12)
+#define FLD_EU_EMAIL (FLD_EU_BEGIN + 13)
+#define FLD_EU_STATE (FLD_EU_BEGIN + 14)
+#define FLD_EU_END (FLD_EU_BEGIN + 15)
+
+#define FLD_PAGEREF_BEGIN FLD_EU_END
+#define FLD_PAGEREF_OFF FLD_PAGEREF_BEGIN
+#define FLD_PAGEREF_ON (FLD_PAGEREF_BEGIN+1)
+#define FLD_PAGEREF_END (FLD_PAGEREF_BEGIN+2)
+
+/*----------------------------------------------------------
+ Format-Id's
+ ----------------------------------------------------------*/
+// Text
+#define FMT_TEXT FLD_PAGEREF_END
+
+// Nummern
+#define FMT_NUM_BEGIN (FMT_TEXT + 1)
+#define FMT_NUM_ABC FMT_NUM_BEGIN
+#define FMT_NUM_SABC (FMT_NUM_BEGIN + 1)
+#define FMT_NUM_ABC_N (FMT_NUM_BEGIN + 2)
+#define FMT_NUM_SABC_N (FMT_NUM_BEGIN + 3)
+#define FMT_NUM_ROMAN (FMT_NUM_BEGIN + 4)
+#define FMT_NUM_SROMAN (FMT_NUM_BEGIN + 5)
+#define FMT_NUM_ARABIC (FMT_NUM_BEGIN + 6)
+#define FMT_NUM_PAGEDESC (FMT_NUM_BEGIN + 7)
+#define FMT_NUM_PAGESPECIAL (FMT_NUM_BEGIN + 8)
+#define FMT_NUM_END (FMT_NUM_BEGIN + 9)
+
+// AuthorFormat
+#define FMT_AUTHOR_BEGIN FMT_NUM_END
+#define FMT_AUTHOR_NAME FMT_AUTHOR_BEGIN
+#define FMT_AUTHOR_SCUT (FMT_AUTHOR_BEGIN + 1)
+#define FMT_AUTHOR_END (FMT_AUTHOR_BEGIN + 2)
+
+// Variable setzen
+#define FMT_SETVAR_BEGIN FMT_AUTHOR_END
+#define FMT_SETVAR_SYS (FMT_SETVAR_BEGIN + 0)
+#define FMT_SETVAR_TEXT (FMT_SETVAR_BEGIN + 1)
+#define FMT_SETVAR_END (FMT_SETVAR_BEGIN + 2)
+
+// Variable einfuegen
+#define FMT_GETVAR_BEGIN FMT_SETVAR_END
+#define FMT_GETVAR_TEXT (FMT_GETVAR_BEGIN + 0)
+#define FMT_GETVAR_NAME (FMT_GETVAR_BEGIN + 1)
+#define FMT_GETVAR_END (FMT_GETVAR_BEGIN + 2)
+
+// Userfeld einfuegen
+#define FMT_USERVAR_BEGIN FMT_GETVAR_END
+#define FMT_USERVAR_TEXT (FMT_USERVAR_BEGIN + 0)
+#define FMT_USERVAR_CMD (FMT_USERVAR_BEGIN + 1)
+#define FMT_USERVAR_END (FMT_USERVAR_BEGIN + 2)
+
+// Datenbankfeld einfuegen
+#define FMT_DBFLD_BEGIN FMT_USERVAR_END
+#define FMT_DBFLD_DB (FMT_DBFLD_BEGIN + 0)
+#define FMT_DBFLD_SYS (FMT_DBFLD_BEGIN + 1)
+#define FMT_DBFLD_END (FMT_DBFLD_BEGIN + 2)
+
+//FileNameFormat
+// Achtung die letzten 4 Formate gibt es in RTF nicht (Verlust!)
+#define FMT_FF_BEGIN FMT_DBFLD_END
+#define FMT_FF_NAME FMT_FF_BEGIN
+#define FMT_FF_PATHNAME (FMT_FF_BEGIN + 1)
+#define FMT_FF_PATH (FMT_FF_BEGIN + 2)
+#define FMT_FF_NAME_NOEXT (FMT_FF_BEGIN + 3)
+#define FMT_FF_UI_NAME (FMT_FF_BEGIN + 4)
+#define FMT_FF_UI_RANGE (FMT_FF_BEGIN + 5)
+#define FMT_FF_END (FMT_FF_BEGIN + 6)
+
+// Registry-Format
+#define FMT_REG_BEGIN FMT_FF_END
+#define FMT_REG_AUTHOR FMT_REG_BEGIN
+#define FMT_REG_TIME (FMT_REG_BEGIN + 1)
+#define FMT_REG_DATE (FMT_REG_BEGIN + 2)
+#define FMT_REG_END (FMT_REG_BEGIN + 3)
+
+// Kapitel
+#define FMT_CHAPTER_BEGIN FMT_REG_END
+#define FMT_CHAPTER_NO FMT_CHAPTER_BEGIN
+#define FMT_CHAPTER_NAME (FMT_CHAPTER_BEGIN + 1)
+#define FMT_CHAPTER_NAMENO (FMT_CHAPTER_BEGIN + 2)
+#define FMT_CHAPTER_NO_NOSEPARATOR (FMT_CHAPTER_BEGIN + 3)
+#define FMT_CHAPTER_END (FMT_CHAPTER_BEGIN + 4)
+
+// DDE-Formate
+#define FMT_DDE_BEGIN FMT_CHAPTER_END
+#define FMT_DDE_NORMAL FMT_DDE_BEGIN
+#define FMT_DDE_HOT (FMT_DDE_BEGIN + 1)
+#define FMT_DDE_END (FMT_DDE_BEGIN + 2)
+
+#define FMT_REF_BEGIN FMT_DDE_END
+#define FMT_REF_PAGE FMT_REF_BEGIN
+#define FMT_REF_CHAPTER (FMT_REF_BEGIN + 1)
+#define FMT_REF_TEXT (FMT_REF_BEGIN + 2)
+#define FMT_REF_UPDOWN (FMT_REF_BEGIN + 3)
+#define FMT_REF_PAGE_PGDSC (FMT_REF_BEGIN + 4)
+#define FMT_REF_ONLYNUMBER (FMT_REF_BEGIN + 5)
+#define FMT_REF_ONLYCAPTION (FMT_REF_BEGIN + 6)
+#define FMT_REF_ONLYSEQNO (FMT_REF_BEGIN + 7)
+#define FMT_REF_NUMBER (FMT_REF_BEGIN + 8)
+#define FMT_REF_NUMBER_NO_CONTEXT (FMT_REF_BEGIN + 9)
+#define FMT_REF_NUMBER_FULL_CONTEXT (FMT_REF_BEGIN + 10)
+#define FMT_REF_END (FMT_REF_BEGIN + 11)
+
+// Platzhalter
+#define FMT_MARK_BEGIN FMT_REF_END
+#define FMT_MARK_TEXT FMT_MARK_BEGIN
+#define FMT_MARK_TABLE (FMT_MARK_BEGIN + 1)
+#define FMT_MARK_FRAME (FMT_MARK_BEGIN + 2)
+#define FMT_MARK_GRAFIC (FMT_MARK_BEGIN + 3)
+#define FMT_MARK_OLE (FMT_MARK_BEGIN + 4)
+#define FMT_MARK_END (FMT_MARK_BEGIN + 5)
+
+/*--------------------------------------------------------------------
+ Beschreibung: globale String-Ressourcen
+ --------------------------------------------------------------------*/
+
+#define STR_FLDUI FMT_MARK_END
+#define STR_INSERT STR_FLDUI
+#define STR_ALL (STR_FLDUI + 1)
+#define STR_EXTRA (STR_FLDUI + 2)
+
+/*--------------------------------------------------------------------
+ Beschreibung: Buttons fuer Field-Edit-Dlg
+ --------------------------------------------------------------------*/
+
+#define BTN_FLDEDT_PREV STR_EXTRA
+#define BTN_FLDEDT_NEXT (STR_EXTRA + 1)
+#define PB_FLDEDT_ADDRESS (STR_EXTRA + 2)
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zusaetzliche Strings
+ --------------------------------------------------------------------*/
+
+#define STR_COND STR_EXTRA
+#define STR_TEXT (STR_EXTRA + 1)
+#define STR_DDE_CMD (STR_EXTRA + 2)
+#define STR_INSTEXT (STR_EXTRA + 3)
+#define STR_COMBCHRS_FT (STR_EXTRA + 4)
+#define STR_PROMPT (STR_EXTRA + 5)
+#define STR_MACNAME (STR_EXTRA + 6)
+#define STR_SETNO (STR_EXTRA + 7)
+#define STR_OFFSET (STR_EXTRA + 8)
+#define STR_VALUE (STR_EXTRA + 9)
+
+#define STR_URLPROMPT (STR_EXTRA + 11)
+#define STR_FORMULA (STR_EXTRA + 12)
+#define STR_ALL_DATABASE (STR_EXTRA + 13)
+#define STR_FLD_EDIT_DLG (STR_EXTRA + 14)
+
+#define FLDDLG_ACT_END (STR_FLD_EDIT_DLG)
+
+
+#endif
diff --git a/sw/inc/fldupde.hxx b/sw/inc/fldupde.hxx
new file mode 100644
index 000000000000..79443e092d61
--- /dev/null
+++ b/sw/inc/fldupde.hxx
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FLDUPDE_HXX
+#define _FLDUPDE_HXX
+
+enum SwFldUpdateFlags
+{
+ AUTOUPD_OFF,
+ AUTOUPD_FIELD_ONLY,
+ AUTOUPD_FIELD_AND_CHARTS,
+ AUTOUPD_GLOBALSETTING
+};
+
+
+#endif
diff --git a/sw/inc/flyenum.hxx b/sw/inc/flyenum.hxx
new file mode 100644
index 000000000000..765a23cda0b1
--- /dev/null
+++ b/sw/inc/flyenum.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FLYENUM_HXX
+#define _FLYENUM_HXX
+
+enum FlyCntType
+{
+ FLYCNTTYPE_ALL = 0,
+ FLYCNTTYPE_FRM,
+ FLYCNTTYPE_GRF,
+ FLYCNTTYPE_OLE
+
+};
+
+//Returnwerte fuer Chainable und Chain
+#define SW_CHAIN_OK 0
+#define SW_CHAIN_NOT_EMPTY 1 //Nur leere Frames duerfen connected werden
+#define SW_CHAIN_IS_IN_CHAIN 2 //Destination ist bereits in einer chain
+#define SW_CHAIN_WRONG_AREA 3 //Destination steht in einer nicht erlaubten
+ //Section (Kopf-/Fusszeile)
+#define SW_CHAIN_NOT_FOUND 4 //Destination und/oder Source nicht gefunden
+#define SW_CHAIN_SOURCE_CHAINED 5 //Source hat bereits einen Follow
+#define SW_CHAIN_SELF 6 //Sich selbst zu verketten ist
+ //natuerlich nicht erleubt.
+
+
+
+#endif
+
+
diff --git a/sw/inc/flypos.hxx b/sw/inc/flypos.hxx
new file mode 100644
index 000000000000..488e49ad2f9e
--- /dev/null
+++ b/sw/inc/flypos.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FLYPOS_HXX
+#define _FLYPOS_HXX
+
+
+#include <svl/svarray.hxx>
+#include <swdllapi.h>
+
+class SwFrmFmt;
+class SwNodeIndex;
+
+// Struktur zum Erfragen der akt. freifliegenden Rahmen am Dokument.
+class SW_DLLPUBLIC SwPosFlyFrm
+{
+ const SwFrmFmt* pFrmFmt; // das FlyFrmFmt
+// SwPosition* pPos; // Position in den ContentNode
+ SwNodeIndex* pNdIdx; // es reicht ein Index auf den Node
+ sal_uInt32 nOrdNum;
+public:
+ SwPosFlyFrm( const SwNodeIndex& , const SwFrmFmt*, sal_uInt16 nArrPos );
+ virtual ~SwPosFlyFrm(); // virtual fuer die Writer (DLL !!)
+
+ // operatoren fuer das Sort-Array
+ sal_Bool operator==( const SwPosFlyFrm& );
+ sal_Bool operator<( const SwPosFlyFrm& );
+
+ const SwFrmFmt& GetFmt() const { return *pFrmFmt; }
+ const SwNodeIndex& GetNdIndex() const { return *pNdIdx; }
+ sal_uInt32 GetOrdNum() const { return nOrdNum; }
+};
+
+typedef SwPosFlyFrm* SwPosFlyFrmPtr;
+SV_DECL_PTRARR_SORT_VISIBILITY( SwPosFlyFrms, SwPosFlyFrmPtr, 0, 40, SW_DLLPUBLIC )
+
+#endif // _FLYPOS_HXX
diff --git a/sw/inc/fmtanchr.hxx b/sw/inc/fmtanchr.hxx
new file mode 100644
index 000000000000..3c91bad86b60
--- /dev/null
+++ b/sw/inc/fmtanchr.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTANCHR_HXX
+#define _FMTANCHR_HXX
+
+#include "swdllapi.h"
+#include <hintids.hxx>
+#include <swtypes.hxx>
+#include <format.hxx>
+#include <svl/poolitem.hxx>
+
+struct SwPosition;
+class IntlWrapper;
+#define IVER_FMTANCHOR_LONGIDX ((sal_uInt16)1)
+
+//FlyAnchor, Anker des Freifliegenden Rahmen ----
+
+class SW_DLLPUBLIC SwFmtAnchor: public SfxPoolItem
+{
+ SwPosition *pCntntAnchor; //0 Fuer Seitengebundene Rahmen.
+ //Index fuer Absatzgebundene Rahmen.
+ //Position fuer Zeichengebundene Rahmen
+ RndStdIds nAnchorId;
+ sal_uInt16 nPageNum; //Seitennummer bei Seitengeb. Rahmen.
+
+ // OD 2004-05-05 #i28701# - getting anchor positions ordered
+ sal_uInt32 mnOrder;
+ static sal_uInt32 mnOrderCounter;
+
+public:
+ SwFmtAnchor( RndStdIds eRnd = FLY_AT_PAGE, sal_uInt16 nPageNum = 0 );
+ SwFmtAnchor( const SwFmtAnchor &rCpy );
+ ~SwFmtAnchor();
+
+ // Zuweisungsoperator
+ SwFmtAnchor &operator=( const SwFmtAnchor& );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ RndStdIds GetAnchorId() const { return nAnchorId; }
+ sal_uInt16 GetPageNum() const { return nPageNum; }
+ const SwPosition *GetCntntAnchor() const { return pCntntAnchor; }
+ // OD 2004-05-05 #i28701#
+ sal_uInt32 GetOrder() const;
+
+ void SetType( RndStdIds nRndId ) { nAnchorId = nRndId; }
+ void SetPageNum( sal_uInt16 nNew ) { nPageNum = nNew; }
+ void SetAnchor( const SwPosition *pPos );
+};
+
+inline const SwFmtAnchor &SwAttrSet::GetAnchor(sal_Bool bInP) const
+ { return static_cast<const SwFmtAnchor&>(Get(RES_ANCHOR, bInP)); }
+
+ inline const SwFmtAnchor &SwFmt::GetAnchor(sal_Bool bInP) const
+ { return aSet.GetAnchor(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtautofmt.hxx b/sw/inc/fmtautofmt.hxx
new file mode 100644
index 000000000000..ce16b775b82d
--- /dev/null
+++ b/sw/inc/fmtautofmt.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTAUTOFMT_HXX
+#define _FMTAUTOFMT_HXX
+
+
+#include <svl/poolitem.hxx>
+#include <format.hxx>
+#include <boost/shared_ptr.hpp>
+
+// ATT_AUTOFMT *********************************************
+
+
+class SwFmtAutoFmt: public SfxPoolItem
+{
+ boost::shared_ptr<SfxItemSet> mpHandle;
+
+public:
+ SwFmtAutoFmt( sal_uInt16 nWhich = RES_TXTATR_AUTOFMT );
+
+ // single argument ctors shall be explicit.
+ virtual ~SwFmtAutoFmt();
+
+ // @@@ public copy ctor, but no copy assignment?
+ SwFmtAutoFmt( const SwFmtAutoFmt& rAttr );
+private:
+ // @@@ public copy ctor, but no copy assignment?
+ SwFmtAutoFmt & operator= (const SwFmtAutoFmt &);
+public:
+
+ TYPEINFO();
+
+ // "pure virtual methods" of SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ void SetStyleHandle( boost::shared_ptr<SfxItemSet> pHandle ) { mpHandle = pHandle; }
+ const boost::shared_ptr<SfxItemSet> GetStyleHandle() const { return mpHandle; }
+ boost::shared_ptr<SfxItemSet> GetStyleHandle() { return mpHandle; }
+};
+
+#endif
+
diff --git a/sw/inc/fmtclbl.hxx b/sw/inc/fmtclbl.hxx
new file mode 100644
index 000000000000..8feb5293c141
--- /dev/null
+++ b/sw/inc/fmtclbl.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTCLBL_HXX
+#define _FMTCLBL_HXX
+
+
+#include <svl/eitem.hxx>
+#include <hintids.hxx>
+#include <format.hxx>
+#include "swdllapi.h"
+
+class SW_DLLPUBLIC SwFmtNoBalancedColumns : public SfxBoolItem
+{
+public:
+ SwFmtNoBalancedColumns( sal_Bool bFlag = sal_False )
+ : SfxBoolItem( RES_COLUMNBALANCE, bFlag ) {}
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+};
+
+
+inline const SwFmtNoBalancedColumns &SwAttrSet::GetBalancedColumns(sal_Bool bInP) const
+ { return (const SwFmtNoBalancedColumns&)Get( RES_COLUMNBALANCE, bInP ); }
+
+inline const SwFmtNoBalancedColumns &SwFmt::GetBalancedColumns(sal_Bool bInP) const
+ { return aSet.GetBalancedColumns( bInP ); }
+
+#endif
+
diff --git a/sw/inc/fmtclds.hxx b/sw/inc/fmtclds.hxx
new file mode 100644
index 000000000000..8a649ed5b80f
--- /dev/null
+++ b/sw/inc/fmtclds.hxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTCLDS_HXX
+#define _FMTCLDS_HXX
+
+#include <tools/color.hxx>
+#include <svl/poolitem.hxx>
+#include "swdllapi.h"
+#include <hintids.hxx>
+#include <format.hxx>
+
+//Der ColumnDescriptor --------------------------
+
+class SwColumn
+{
+ sal_uInt16 nWish; //Wunschbreite incl. Raender.
+ //Verhaelt sich proportional zum Verhaeltniss:
+ //Wunschbreite der Umgebung / aktuelle Breite der Spalte
+ sal_uInt16 nUpper; //Oberer Rand
+ sal_uInt16 nLower; //Unterer Rand
+ sal_uInt16 nLeft; //Linker Rand
+ sal_uInt16 nRight; //Rechter Rand
+
+public:
+ SwColumn();
+
+ sal_Bool operator==( const SwColumn & );
+
+
+ void SetWishWidth( sal_uInt16 nNew ) { nWish = nNew; }
+ void SetUpper( sal_uInt16 nNew ) { nUpper = nNew; }
+ void SetLower( sal_uInt16 nNew ) { nLower = nNew; }
+ void SetLeft ( sal_uInt16 nNew ) { nLeft = nNew; }
+ void SetRight( sal_uInt16 nNew ) { nRight = nNew; }
+
+ sal_uInt16 GetWishWidth() const { return nWish; }
+ sal_uInt16 GetUpper() const { return nUpper; }
+ sal_uInt16 GetLower() const { return nLower; }
+ sal_uInt16 GetLeft () const { return nLeft; }
+ sal_uInt16 GetRight() const { return nRight; }
+};
+
+typedef SwColumn* SwColumnPtr;
+SV_DECL_PTRARR_DEL( SwColumns, SwColumnPtr, 0, 2 )
+
+enum SwColLineAdj
+{
+ COLADJ_NONE,
+ COLADJ_TOP,
+ COLADJ_CENTER,
+ COLADJ_BOTTOM
+};
+
+class SW_DLLPUBLIC SwFmtCol : public SfxPoolItem
+{
+// Pen aPen; //Pen fuer die Linine zwischen den Spalten
+ sal_uLong nLineWidth; //width of the separator line
+ Color aLineColor; //color of the separator line
+
+ sal_uInt8 nLineHeight; //Prozentuale Hoehe der Linien
+ //(Relativ zu der Hoehe der Spalten incl. UL).
+ SwColLineAdj eAdj; //Linie wird oben, mittig oder unten ausgerichtet.
+
+ SwColumns aColumns; //Informationen fuer die einzelnen Spalten.
+ sal_uInt16 nWidth; //Gesamtwunschbreite aller Spalten.
+
+ sal_Bool bOrtho; //Nur wenn dieses Flag gesetzt ist wird beim setzen
+ //der GutterWidth eine 'optische Verteilung'
+ //vorgenommen.
+ //Es muss zurueckgesetzt werden wenn an den
+ //Spaltenbreiten bzw. den Raendern gedreht wird.
+ //Wenn es wieder gesetzt wird wird automatisch neu
+ //gemischt (optisch verteilt).
+ //Das Flag ist initial gesetzt.
+
+ SW_DLLPRIVATE void Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct );
+
+public:
+ SwFmtCol();
+ SwFmtCol( const SwFmtCol& );
+ ~SwFmtCol();
+
+ SwFmtCol& operator=( const SwFmtCol& );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ const SwColumns &GetColumns() const { return aColumns; }
+ SwColumns &GetColumns() { return aColumns; }
+ sal_uInt16 GetNumCols() const { return aColumns.Count(); }
+// const Pen& GetLinePen() const { return aPen; }
+ sal_uLong GetLineWidth() const { return nLineWidth;}
+ const Color& GetLineColor() const { return aLineColor;}
+
+
+ SwColLineAdj GetLineAdj() const { return eAdj; }
+ sal_Bool IsOrtho() const { return bOrtho; }
+ sal_uInt16 GetWishWidth() const { return nWidth; }
+ sal_uInt8 GetLineHeight()const { return nLineHeight; }
+
+ //Return USHRT_MAX wenn uneindeutig.
+ //Return die kleinste Breite wenn bMin True ist.
+ sal_uInt16 GetGutterWidth( sal_Bool bMin = sal_False ) const;
+
+// void SetLinePen( const Pen& rNew ) { aPen = rNew; }
+ void SetLineWidth(sal_uLong nLWidth) { nLineWidth = nLWidth;}
+ void SetLineColor(const Color& rCol ) { aLineColor = rCol;}
+ void SetLineHeight( sal_uInt8 nNew ) { nLineHeight = nNew; }
+ void SetLineAdj( SwColLineAdj eNew ){ eAdj = eNew; }
+ void SetWishWidth( sal_uInt16 nNew ) { nWidth = nNew; }
+
+ //Mit dieser Funktion koennen die Spalten (immer wieder) initialisert
+ //werden. Das Ortho Flag wird automatisch gesetzt.
+ void Init( sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct );
+
+ //Stellt die Raender fuer die Spalten in aColumns ein.
+ //Wenn das Flag bOrtho gesetzt ist, werden die Spalten neu optisch
+ //verteilt. Ist das Flag nicht gesetzt werden die Spaltenbreiten nicht
+ //veraendert und die Raender werden einfach eingestellt.
+ void SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct );
+
+ //Verteilt ebenfalls automatisch neu wenn das Flag gesetzt wird;
+ //nur dann wird auch der zweite Param. benoetigt und beachtet.
+ void SetOrtho( sal_Bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct );
+
+ //Fuer den Reader
+ void _SetOrtho( sal_Bool bNew ) { bOrtho = bNew; }
+
+ //Berechnet die aktuelle Breite der Spalte nCol.
+ //Das Verhaeltniss von Wunschbreite der Spalte zum Returnwert ist
+ //proportional zum Verhaeltniss des Gesamtwunschwertes zu nAct.
+ sal_uInt16 CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const;
+
+ //Wie oben, aber es wir die Breite der PrtArea - also das was fuer
+ //den Anwender die Spalte ist - geliefert.
+ sal_uInt16 CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const;
+};
+
+inline const SwFmtCol &SwAttrSet::GetCol(sal_Bool bInP) const
+ { return (const SwFmtCol&)Get( RES_COL,bInP); }
+
+inline const SwFmtCol &SwFmt::GetCol(sal_Bool bInP) const
+ { return aSet.GetCol(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtcnct.hxx b/sw/inc/fmtcnct.hxx
new file mode 100644
index 000000000000..28252ff1c99c
--- /dev/null
+++ b/sw/inc/fmtcnct.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTCNCT_HXX
+#define _FMTCNCT_HXX
+
+#include <hintids.hxx>
+#include <svl/poolitem.hxx>
+#include <format.hxx>
+#include <calbck.hxx>
+
+
+class SwFlyFrmFmt;
+class IntlWrapper;
+
+//Verbindung (Textfluss) zwischen zwei FlyFrms
+
+class SW_DLLPUBLIC SwFmtChain: public SfxPoolItem
+{
+ SwClient aPrev, //Vorgaenger (SwFlyFrmFmt), wenn es diesen gibt.
+ aNext; //Nachfolger (SwFlyFrmFmt), wenn es diesen gibt.
+
+
+public:
+ SwFmtChain() : SfxPoolItem( RES_CHAIN ) {}
+ SwFmtChain( const SwFmtChain &rCpy );
+
+ inline SwFmtChain &operator=( const SwFmtChain& );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+
+ SwFlyFrmFmt* GetPrev() const { return (SwFlyFrmFmt*)aPrev.GetRegisteredIn(); }
+ SwFlyFrmFmt* GetNext() const { return (SwFlyFrmFmt*)aNext.GetRegisteredIn(); }
+
+
+ void SetPrev( SwFlyFrmFmt *pFmt );
+ void SetNext( SwFlyFrmFmt *pFmt );
+};
+
+SwFmtChain &SwFmtChain::operator=( const SwFmtChain &rCpy )
+{
+ SetPrev( rCpy.GetPrev() );
+ SetNext( rCpy.GetNext() );
+ return *this;
+}
+
+
+inline const SwFmtChain &SwAttrSet::GetChain(sal_Bool bInP) const
+ { return (const SwFmtChain&)Get( RES_CHAIN,bInP); }
+
+inline const SwFmtChain &SwFmt::GetChain(sal_Bool bInP) const
+ { return aSet.GetChain(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtcntnt.hxx b/sw/inc/fmtcntnt.hxx
new file mode 100644
index 000000000000..af4e8a3f3b8f
--- /dev/null
+++ b/sw/inc/fmtcntnt.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTCNTNT_HXX
+#define _FMTCNTNT_HXX
+
+#include <svl/poolitem.hxx>
+#include <hintids.hxx>
+#include <format.hxx>
+
+class SwNodeIndex;
+class SwStartNode;
+
+//Cntnt, Inhalt des Frame (Header, Footer, Fly) ----
+
+class SW_DLLPUBLIC SwFmtCntnt: public SfxPoolItem
+{
+ SwNodeIndex *pStartNode;
+
+ SwFmtCntnt &operator=( const SwFmtCntnt & ); //Kopieren verboten
+
+public:
+// SwFmtCntnt( const SwNodeIndex *pStartNodeIdx = 0 );
+ SwFmtCntnt( const SwStartNode* pStartNode = 0 );
+ SwFmtCntnt( const SwFmtCntnt &rCpy );
+ ~SwFmtCntnt();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ const SwNodeIndex *GetCntntIdx() const { return pStartNode; }
+ void SetNewCntntIdx( const SwNodeIndex *pIdx );
+};
+
+inline const SwFmtCntnt &SwAttrSet::GetCntnt(sal_Bool bInP) const
+ { return (const SwFmtCntnt&)Get( RES_CNTNT,bInP); }
+
+inline const SwFmtCntnt &SwFmt::GetCntnt(sal_Bool bInP) const
+ { return aSet.GetCntnt(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
new file mode 100644
index 000000000000..2ef671b8463a
--- /dev/null
+++ b/sw/inc/fmtcol.hxx
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTCOL_HXX
+#define _FMTCOL_HXX
+
+#include <svl/svarray.hxx>
+#include "swdllapi.h"
+#include <format.hxx>
+#include <swtypes.hxx> // fuer MAXLEVEL
+
+class SwDoc; // fuer friend
+
+class SwFmtColl : public SwFmt
+{
+protected:
+ SwFmtColl( SwAttrPool& rPool, const sal_Char* pFmtName,
+ const sal_uInt16* pWhichRanges, SwFmtColl* pDerFrom,
+ sal_uInt16 nFmtWhich )
+ : SwFmt( rPool, pFmtName, pWhichRanges, pDerFrom, nFmtWhich )
+ { SetAuto( sal_False ); }
+
+ SwFmtColl( SwAttrPool& rPool, const String &rFmtName,
+ const sal_uInt16* pWhichRanges, SwFmtColl* pDerFrom,
+ sal_uInt16 nFmtWhich )
+ : SwFmt( rPool, rFmtName, pWhichRanges, pDerFrom, nFmtWhich )
+ { SetAuto( sal_False ); }
+
+
+private:
+ // erstmal wird nicht kopiert und nicht zugewiesen
+ SwFmtColl(const SwFmtColl & );
+ const SwFmtColl &operator=(const SwFmtColl &);
+};
+
+
+class SW_DLLPUBLIC SwTxtFmtColl: public SwFmtColl
+{
+ friend class SwDoc;
+
+ SwTxtFmtColl(const SwTxtFmtColl & rRef);
+
+ // --> OD 2007-01-24 #i73790#
+ bool mbStayAssignedToListLevelOfOutlineStyle;
+ // <--
+
+protected:
+ //sal_uInt8 nOutlineLevel; //<-#outline level, removed by zhaojianwei
+ bool mbAssignedToOutlineStyle;//<-#outline level added by zhaojianwei
+
+ SwTxtFmtColl *pNextTxtFmtColl;
+
+ SwTxtFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
+ SwTxtFmtColl* pDerFrom = 0,
+ sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
+ : SwFmtColl( rPool, pFmtCollName, aTxtFmtCollSetRange,
+ pDerFrom, nFmtWh ),
+ // --> OD 2007-01-24 #i73790#
+ mbStayAssignedToListLevelOfOutlineStyle( false ),
+ // <--
+ //nOutlineLevel( NO_NUMBERING ) //<-#outline level,removed by zhaojianwei
+ mbAssignedToOutlineStyle(false) //<-#outline level,added by zhaojianwei
+ { pNextTxtFmtColl = this; }
+
+ SwTxtFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
+ SwTxtFmtColl* pDerFrom = 0,
+ sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
+ : SwFmtColl( rPool, rFmtCollName, aTxtFmtCollSetRange,
+ pDerFrom, nFmtWh ),
+ // --> OD 2007-01-24 #i73790#
+ mbStayAssignedToListLevelOfOutlineStyle( false ),
+ // <--
+ //nOutlineLevel( NO_NUMBERING ) //<-#outline level,removed by zhaojianwei
+ mbAssignedToOutlineStyle(false) //<-#outline level,added by zhaojianwei
+ { pNextTxtFmtColl = this; }
+
+ // zum "abfischen" von UL-/LR-/FontHeight Aenderungen
+ virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
+
+public:
+
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+
+ inline void SetNextTxtFmtColl(SwTxtFmtColl& rNext);
+ SwTxtFmtColl& GetNextTxtFmtColl() const { return *pNextTxtFmtColl; }
+
+ sal_Bool IsAtDocNodeSet() const;
+
+ // --> OD 2006-11-22 #i71574#
+ //<-#outline level,zhaojianwei
+ void SetAttrOutlineLevel( int );
+ int GetAttrOutlineLevel() const;
+ int GetAssignedOutlineStyleLevel() const;
+ inline bool IsAssignedToListLevelOfOutlineStyle() const
+ {
+ return mbAssignedToOutlineStyle;
+ }
+ void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel);
+ void DeleteAssignmentToListLevelOfOutlineStyle();
+ //<-end
+ // <--
+
+ // --> OD 2008-03-04 #refactorlists#
+ // override to recognize changes on the <SwNumRuleItem> and register/unregister
+ // the paragragh style at the corresponding <SwNumRule> instance
+ virtual sal_Bool SetFmtAttr( const SfxPoolItem& rAttr );
+ virtual sal_Bool SetFmtAttr( const SfxItemSet& rSet );
+ virtual sal_Bool ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
+ // <--
+
+ // --> OD 2007-01-24 #i73790#
+ // override <ResetAllFmtAttr()> to stay assigned to list level of outline style
+ virtual sal_uInt16 ResetAllFmtAttr();
+
+ inline bool StayAssignedToListLevelOfOutlineStyle() const
+ {
+ return mbStayAssignedToListLevelOfOutlineStyle;
+ }
+ // <--
+
+ // --> OD 2008-02-13 #newlistleveattrs#
+ bool AreListLevelIndentsApplicable() const;
+ // <--
+
+/*----------------- JP 09.08.94 17:36 -------------------
+ wird die Funktionalitaet von Zeichenvorlagen an Absatzvorlagen
+ ueberhaupt benoetigt ??
+
+ Wenn, ja dann muessen im TextNode und hier in der TxtCollection ein 2.
+ Attset fuer die Char-Attribute angelegt werden; damit die Vererbung
+ und der Zugriff auf die gesetzen Attribute richtig funktioniert!!
+
+ virtual sal_Bool SetDerivedFrom( SwFmtColl* pDerFrom = 0 );
+
+ inline SwCharFmt* GetCharFmt() const;
+ inline sal_Bool IsCharFmtSet() const;
+ void SetCharFmt(SwCharFmt *);
+ void ResetCharFmt();
+inline sal_Bool SwTxtFmtColl::IsCharFmtSet() const
+{
+ return aCharDepend.GetRegisteredIn() ? sal_True : sal_False;
+}
+inline SwCharFmt* SwTxtFmtColl::GetCharFmt() const
+{
+ return (SwCharFmt*)aCharDepend.GetRegisteredIn();
+}
+--------------------------------------------------*/
+};
+
+typedef SwTxtFmtColl* SwTxtFmtCollPtr;
+SV_DECL_PTRARR(SwTxtFmtColls,SwTxtFmtCollPtr,2,4)
+
+
+class SwGrfFmtColl: public SwFmtColl
+{
+ friend class SwDoc;
+protected:
+ SwGrfFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
+ SwGrfFmtColl* pDerFrom = 0 )
+ : SwFmtColl( rPool, pFmtCollName, aGrfFmtCollSetRange,
+ pDerFrom, RES_GRFFMTCOLL )
+ {}
+
+ SwGrfFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
+ SwGrfFmtColl* pDerFrom = 0 )
+ : SwFmtColl( rPool, rFmtCollName, aGrfFmtCollSetRange,
+ pDerFrom, RES_GRFFMTCOLL )
+ {}
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+};
+
+typedef SwGrfFmtColl* SwGrfFmtCollPtr;
+SV_DECL_PTRARR(SwGrfFmtColls,SwGrfFmtCollPtr,2,4)
+
+
+
+//FEATURE::CONDCOLL
+// --------- Bedingte Vorlagen -------------------------------
+
+enum Master_CollConditions
+{
+ PARA_IN_LIST = 0x0001,
+ PARA_IN_OUTLINE = 0x0002,
+ PARA_IN_FRAME = 0x0004,
+ PARA_IN_TABLEHEAD = 0x0008,
+ PARA_IN_TABLEBODY = 0x0010,
+ PARA_IN_SECTION = 0x0020,
+ PARA_IN_FOOTENOTE = 0x0040,
+ PARA_IN_FOOTER = 0x0080,
+ PARA_IN_HEADER = 0x0100,
+ PARA_IN_ENDNOTE = 0x0200,
+ // ...
+ USRFLD_EXPRESSION = (int)0x8000
+};
+
+
+class SW_DLLPUBLIC SwCollCondition : public SwClient
+{
+ sal_uLong nCondition;
+ union
+ {
+ sal_uLong nSubCondition;
+ String* pFldExpression;
+ } aSubCondition;
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+
+
+ SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
+ sal_uLong nSubCond = 0 );
+ SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
+ const String& rSubExp );
+ virtual ~SwCollCondition();
+
+ // @@@ public copy ctor, but no copy assignment?
+ SwCollCondition( const SwCollCondition& rCpy );
+private:
+ // @@@ public copy ctor, but no copy assignment?
+ SwCollCondition & operator= (const SwCollCondition &);
+public:
+
+ int operator==( const SwCollCondition& rCmp ) const;
+ int operator!=( const SwCollCondition& rCmp ) const
+ { return ! (*this == rCmp); }
+
+ sal_uLong GetCondition() const { return nCondition; }
+ sal_uLong GetSubCondition() const { return aSubCondition.nSubCondition; }
+ const String* GetFldExpression() const
+ { return aSubCondition.pFldExpression; }
+
+ void SetCondition( sal_uLong nCond, sal_uLong nSubCond );
+ SwTxtFmtColl* GetTxtFmtColl() const { return (SwTxtFmtColl*)GetRegisteredIn(); }
+ void RegisterToFormat( SwFmt& );
+};
+
+
+typedef SwCollCondition* SwCollConditionPtr;
+SV_DECL_PTRARR_DEL( SwFmtCollConditions, SwCollConditionPtr, 0, 5 )
+
+class SW_DLLPUBLIC SwConditionTxtFmtColl : public SwTxtFmtColl
+{
+ friend class SwDoc;
+protected:
+ SwFmtCollConditions aCondColls;
+
+ SwConditionTxtFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
+ SwTxtFmtColl* pDerFrom = 0 )
+ : SwTxtFmtColl( rPool, pFmtCollName, pDerFrom, RES_CONDTXTFMTCOLL )
+ {}
+ SwConditionTxtFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
+ SwTxtFmtColl* pDerFrom = 0 )
+ : SwTxtFmtColl( rPool, rFmtCollName, pDerFrom, RES_CONDTXTFMTCOLL )
+ {}
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+
+ virtual ~SwConditionTxtFmtColl();
+
+ const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const;
+ const SwFmtCollConditions& GetCondColls() const { return aCondColls; }
+ void InsertCondition( const SwCollCondition& rCond );
+ sal_Bool RemoveCondition( const SwCollCondition& rCond );
+
+ void SetConditions( const SwFmtCollConditions& );
+};
+
+//FEATURE::CONDCOLL
+
+// ------------- Inline Implementierungen --------------------
+
+inline void SwTxtFmtColl::SetNextTxtFmtColl( SwTxtFmtColl& rNext )
+{
+ pNextTxtFmtColl = &rNext;
+}
+#endif
+
diff --git a/sw/inc/fmtcolfunc.hxx b/sw/inc/fmtcolfunc.hxx
new file mode 100644
index 000000000000..4cb10c468fd0
--- /dev/null
+++ b/sw/inc/fmtcolfunc.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTCOLFUNC_HXX
+#define _FMTCOLFUNC_HXX
+
+class SwFmt;
+class SwNumRuleItem;
+
+// namespace <TxtFmtCollFunc> for functions and procedures working on
+// paragraph styles (instances of <SwTxtFmtColl>
+namespace TxtFmtCollFunc
+{
+ /** Checks, if assignment of paragraph style to list level of outline style
+ has to be deleted, and deletes the assignment, if needed.
+
+ OD 2006-11-22 #i71574#
+ The assignment of a paragraph style to a list level of the outline style
+ has to be deleted, if the numbering rule, which is set at the paragraph
+ style isn't the outline style.
+
+ @author OD
+ */
+ void CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle(
+ SwFmt* pFmt,
+ const SwNumRuleItem* pNewNumRuleItem = 0L );
+
+ /** determines the list style, which directly set at the given paragraph style
+
+ OD 2008-03-04 #refactorlists#
+
+ @author OD
+
+ @param rTxtFmtColl
+ input parameter - paragraph style for which the list style should be retrieved
+
+ @return pointer to <SwNumRule> instance, if the given paragraph style
+ has directly set a list style, 0 otherwise
+ */
+ SwNumRule* GetNumRule( SwTxtFmtColl& rTxtFmtColl );
+
+ /** adds the given paragraph style at the directly set list style
+
+ OD 2008-03-04 #refactorlists#
+ Note: If the given paragraph style has no directly set list style, nothing happens
+
+ @param rTxtFmtColl
+ input parameter - paragraph style which is added to its directly set list style
+
+ @author OD
+ */
+ void AddToNumRule( SwTxtFmtColl& rTxtFmtColl );
+
+ /** removes te given paragraph style from the directly set list style
+
+ OD 2008-03-04 #refactorlists#
+ Note: If the given paragraph style has no directly set list style, nothing happens
+
+ @param rTxtFmtColl
+ input parameter - paragraph style which is removed from its directly set list style
+
+ @author OD
+ */
+ void RemoveFromNumRule( SwTxtFmtColl& rTxtFmtColl );
+}
+#endif
diff --git a/sw/inc/fmteiro.hxx b/sw/inc/fmteiro.hxx
new file mode 100644
index 000000000000..476708948e60
--- /dev/null
+++ b/sw/inc/fmteiro.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTEIRO_HXX
+#define _FMTEIRO_HXX
+
+
+#include <svl/eitem.hxx>
+#include <hintids.hxx>
+#include <format.hxx>
+#include "swdllapi.h"
+
+class IntlWrapper;
+
+class SW_DLLPUBLIC SwFmtEditInReadonly : public SfxBoolItem
+{
+public:
+ SwFmtEditInReadonly( sal_uInt16 nId = RES_EDIT_IN_READONLY,
+ sal_Bool bPrt = sal_False ) : SfxBoolItem( nId, bPrt ) {}
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+inline const SwFmtEditInReadonly &SwAttrSet::GetEditInReadonly(sal_Bool bInP) const
+ { return (const SwFmtEditInReadonly&)Get( RES_EDIT_IN_READONLY,bInP); }
+
+inline const SwFmtEditInReadonly &SwFmt::GetEditInReadonly(sal_Bool bInP) const
+ { return aSet.GetEditInReadonly(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtflcnt.hxx b/sw/inc/fmtflcnt.hxx
new file mode 100644
index 000000000000..a1fbc11feb54
--- /dev/null
+++ b/sw/inc/fmtflcnt.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTFLCNT_HXX
+#define _FMTFLCNT_HXX
+
+
+#include <svl/poolitem.hxx>
+
+class SwFrmFmt;
+class SwTxtFlyCnt;
+// ATT_FLYCNT *******************************************************
+
+class SwFmtFlyCnt : public SfxPoolItem
+{
+ friend class SwTxtFlyCnt;
+ SwTxtFlyCnt* pTxtAttr; // mein TextAttribut
+ SwFrmFmt* pFmt; // mein Fly/DrawFrame-Format
+ // geschuetzter CopyCtor
+ SwFmtFlyCnt& operator=(const SwFmtFlyCnt& rFlyCnt);
+
+public:
+ SwFmtFlyCnt( SwFrmFmt *pFrmFmt );
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ inline SwFrmFmt *GetFrmFmt() const { return pFmt; }
+ // fuer Undo: loesche "logisch" das FlyFrmFormat, wird sich im
+ // Undo-Object gemerkt.
+ inline void SetFlyFmt( SwFrmFmt* pNew = 0 ) { pFmt = pNew; }
+
+ const SwTxtFlyCnt *GetTxtFlyCnt() const { return pTxtAttr; }
+ SwTxtFlyCnt *GetTxtFlyCnt() { return pTxtAttr; }
+
+ // OD 27.06.2003 #108784#
+ bool Sw3ioExportAllowed() const;
+};
+
+#endif
+
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
new file mode 100644
index 000000000000..372fa82fe5e7
--- /dev/null
+++ b/sw/inc/fmtfld.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTFLD_HXX
+#define _FMTFLD_HXX
+
+#include <list>
+#include <svl/poolitem.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/smplhint.hxx>
+
+#include "swdllapi.h"
+#include <calbck.hxx>
+
+class SwField;
+class SwTxtFld;
+class SwView;
+class SwFieldType;
+
+// ATT_FLD ***********************************
+class SW_DLLPUBLIC SwFmtFld : public SfxPoolItem, public SwClient, public SfxBroadcaster
+{
+ friend class SwTxtFld;
+ friend void _InitCore();
+
+ SwField *pField;
+ SwTxtFld* pTxtAttr; // mein TextAttribut
+
+ SwFmtFld(); // das default-Attibut
+
+ // geschuetzter CopyCtor
+ // @@@ copy construction allowed, but copy assignment is not? @@@
+ SwFmtFld& operator=(const SwFmtFld& rFld);
+
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+ virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint );
+
+public:
+ TYPEINFO();
+
+ // single argument constructors shall be explicit.
+ explicit SwFmtFld( const SwField &rFld );
+
+ // @@@ copy construction allowed, but copy assignment is not? @@@
+ SwFmtFld( const SwFmtFld& rAttr );
+
+ virtual ~SwFmtFld();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
+
+ const SwField *GetFld() const { return pField; }
+ SwField *GetFld() { return pField; }
+
+ // #111840#
+ /**
+ Sets current field.
+
+ @param pField new field
+
+ @attention The current field will be destroyed before setting the new field.
+ */
+ void SetFld(SwField * pField);
+
+ const SwTxtFld *GetTxtFld() const { return pTxtAttr; }
+ SwTxtFld *GetTxtFld() { return pTxtAttr; }
+
+ void RegisterToFieldType( SwFieldType& );
+ sal_Bool IsFldInDoc() const;
+ sal_Bool IsProtect() const;
+};
+
+class SW_DLLPUBLIC SwFmtFldHint : public SfxHint
+{
+#define SWFMTFLD_INSERTED 1
+#define SWFMTFLD_REMOVED 2
+#define SWFMTFLD_FOCUS 3
+#define SWFMTFLD_CHANGED 4
+#define SWFMTFLD_LANGUAGE 5
+
+ const SwFmtFld* pFld;
+ sal_Int16 nWhich;
+ const SwView* pView;
+
+public:
+ SwFmtFldHint( const SwFmtFld* p, sal_Int16 n, const SwView* pV = 0)
+ : pFld(p)
+ , nWhich(n)
+ , pView(pV)
+ {}
+
+ TYPEINFO();
+ const SwFmtFld* GetField() const { return pFld; }
+ sal_Int16 Which() const { return nWhich; }
+ const SwView* GetView() const { return pView; }
+};
+
+#endif
diff --git a/sw/inc/fmtfollowtextflow.hxx b/sw/inc/fmtfollowtextflow.hxx
new file mode 100644
index 000000000000..878b59e5ccf6
--- /dev/null
+++ b/sw/inc/fmtfollowtextflow.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTFOLLOWTEXTFLOW_HXX
+#define _FMTFOLLOWTEXTFLOW_HXX
+
+
+#include <svl/eitem.hxx>
+#include <hintids.hxx>
+#include <format.hxx>
+#include "swdllapi.h"
+
+class IntlWrapper;
+
+class SW_DLLPUBLIC SwFmtFollowTextFlow : public SfxBoolItem
+{
+public:
+ SwFmtFollowTextFlow( sal_Bool bFlag = sal_False )
+ : SfxBoolItem( RES_FOLLOW_TEXT_FLOW, bFlag ) {}
+
+ TYPEINFO();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+
+#if !(defined(MACOSX) && ( __GNUC__ < 3 ))
+// GrP moved to gcc_outl.cxx; revisit with gcc3
+inline const SwFmtFollowTextFlow &SwAttrSet::GetFollowTextFlow(sal_Bool bInP) const
+ { return (const SwFmtFollowTextFlow&)Get( RES_FOLLOW_TEXT_FLOW, bInP ); }
+
+inline const SwFmtFollowTextFlow &SwFmt::GetFollowTextFlow(sal_Bool bInP) const
+ { return aSet.GetFollowTextFlow( bInP ); }
+#endif
+
+#endif
+
diff --git a/sw/inc/fmtfordr.hxx b/sw/inc/fmtfordr.hxx
new file mode 100644
index 000000000000..04647edc1e68
--- /dev/null
+++ b/sw/inc/fmtfordr.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTFORDR_HXX
+#define _FMTFORDR_HXX
+
+#include <svl/eitem.hxx>
+#include <hintids.hxx>
+#include <format.hxx>
+
+//Die FillOrder ---------------------------------
+
+enum SwFillOrder
+{
+ SW_FILL_ORDER_BEGIN,
+ ATT_TOP_DOWN = SW_FILL_ORDER_BEGIN,
+ ATT_BOTTOM_UP,
+ ATT_LEFT_TO_RIGHT,
+ ATT_RIGHT_TO_LEFT,
+ SW_FILL_ORDER_END
+};
+
+class SwFmtFillOrder: public SfxEnumItem
+{
+public:
+ SwFmtFillOrder( SwFillOrder = ATT_TOP_DOWN );
+ inline SwFmtFillOrder &operator=( const SwFmtFillOrder &rCpy );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ SwFillOrder GetFillOrder() const { return SwFillOrder(GetValue()); }
+};
+
+inline SwFmtFillOrder &SwFmtFillOrder::operator=( const SwFmtFillOrder &rCpy )
+{
+ SetValue( rCpy.GetValue() );
+ return *this;
+}
+
+inline const SwFmtFillOrder &SwAttrSet::GetFillOrder(sal_Bool bInP) const
+ { return (const SwFmtFillOrder&)Get( RES_FILL_ORDER,bInP); }
+
+inline const SwFmtFillOrder &SwFmt::GetFillOrder(sal_Bool bInP) const
+ { return aSet.GetFillOrder(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtfsize.hxx b/sw/inc/fmtfsize.hxx
new file mode 100644
index 000000000000..ec3b7458ef6a
--- /dev/null
+++ b/sw/inc/fmtfsize.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTFSIZE_HXX
+#define _FMTFSIZE_HXX
+
+#include <tools/gen.hxx>
+#include <svl/poolitem.hxx>
+#include "swdllapi.h"
+#include <hintids.hxx>
+#include <swtypes.hxx>
+#include <format.hxx>
+
+class IntlWrapper;
+
+//Die Framesize ---------------------------------
+
+enum SwFrmSize
+{
+ ATT_VAR_SIZE, //Frm ist in der Var-Richtung variabel
+ ATT_FIX_SIZE, //Frm ist in der Var-Richtung unbeweglich
+ ATT_MIN_SIZE //Der Wert in der Var-Richtung beschreibt eine
+ //Minimalgroesse, die nicht unter- wohl aber
+ //ueberschritten werden kann.
+};
+
+class SW_DLLPUBLIC SwFmtFrmSize: public SfxPoolItem
+{
+ Size aSize;
+ SwFrmSize eFrmHeightType;
+ SwFrmSize eFrmWidthType;
+ sal_uInt8 nWidthPercent; //Fuer Tabellen kann die Breite in Prozent
+ sal_uInt8 nHeightPercent; //angegeben sein.
+ //Fuer Rahmen koennen Hoehe und/oder Breite
+ //in Prozent angegeben sein. Wenn nur eine
+ //der Angaben in Prozent angeben ist, kann
+ //durch den ausgezeichneten Wert 0xFF in der
+ //anderen Prozentangabe bestimmt werden, das
+ //sich diese Richtung proportional zur anderen
+ //verhaelt. Basis fuer die Umrechnung sind fuer
+ //diesen Fall die Angaben in der Size.
+ //Die Prozentwerte beziehen sich immer auf die
+ //Umgebung in der das Objekt steht (PrtArea)
+ //Auf die Bildschirmbreite abzueglich Raender
+ //in der BrowseView wenn die Umgebung die Seite
+ //ist.
+public:
+ SwFmtFrmSize( SwFrmSize eSize = ATT_VAR_SIZE,
+ SwTwips nWidth = 0, SwTwips nHeight = 0 );
+ SwFmtFrmSize& operator=( const SwFmtFrmSize& rCpy );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ SwFrmSize GetHeightSizeType() const { return eFrmHeightType; }
+ void SetHeightSizeType( SwFrmSize eSize ) { eFrmHeightType = eSize; }
+
+ SwFrmSize GetWidthSizeType() const { return eFrmWidthType; }
+ void SetWidthSizeType( SwFrmSize eSize ) { eFrmWidthType = eSize; }
+
+ const Size& GetSize() const { return aSize; }
+ void SetSize( const Size &rNew ) { aSize = rNew; }
+
+ SwTwips GetHeight() const { return aSize.Height(); }
+ SwTwips GetWidth() const { return aSize.Width(); }
+ void SetHeight( const SwTwips nNew ) { aSize.Height() = nNew; }
+ void SetWidth ( const SwTwips nNew ) { aSize.Width() = nNew; }
+
+ sal_uInt8 GetHeightPercent() const{ return nHeightPercent; }
+ sal_uInt8 GetWidthPercent() const { return nWidthPercent; }
+ void SetHeightPercent( sal_uInt8 n ) { nHeightPercent = n; }
+ void SetWidthPercent ( sal_uInt8 n ) { nWidthPercent = n; }
+};
+
+inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(sal_Bool bInP) const
+ { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); }
+
+inline const SwFmtFrmSize &SwFmt::GetFrmSize(sal_Bool bInP) const
+ { return aSet.GetFrmSize(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtftn.hxx b/sw/inc/fmtftn.hxx
new file mode 100644
index 000000000000..9a470ddfa1df
--- /dev/null
+++ b/sw/inc/fmtftn.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTFTN_HXX
+#define _FMTFTN_HXX
+
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+#include "swdllapi.h"
+
+class SwDoc;
+class SwTxtFtn;
+
+// ATT_FTN **********************************************************
+
+class SW_DLLPUBLIC SwFmtFtn: public SfxPoolItem
+{
+ friend class SwTxtFtn;
+ SwTxtFtn* pTxtAttr; //mein TextAttribut
+ String aNumber; //Benutzerdefinierte 'Nummer'
+ sal_uInt16 nNumber; //Automatische Nummerierung
+ bool m_bEndNote; // is it an End note?
+
+ // geschuetzter CopyCtor
+ SwFmtFtn& operator=(const SwFmtFtn& rFtn);
+ SwFmtFtn( const SwFmtFtn& );
+
+public:
+ SwFmtFtn( bool bEndNote = false );
+ virtual ~SwFmtFtn();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ const String &GetNumStr() const { return aNumber; }
+ const sal_uInt16 &GetNumber() const { return nNumber; }
+ bool IsEndNote() const { return m_bEndNote;}
+
+ void SetNumStr( const String& rStr ) { aNumber = rStr; }
+ void SetNumber( sal_uInt16 nNo ) { nNumber = nNo; }
+ void SetEndNote( bool b );
+
+ void SetNumber( const SwFmtFtn& rFtn )
+ { nNumber = rFtn.nNumber; aNumber = rFtn.aNumber; }
+
+ const SwTxtFtn *GetTxtFtn() const { return pTxtAttr; }
+ SwTxtFtn *GetTxtFtn() { return pTxtAttr; }
+
+ void GetFtnText( String& rStr ) const;
+
+ // returnt den anzuzeigenden String der Fuss-/Endnote
+ String GetViewNumStr( const SwDoc& rDoc, sal_Bool bInclStrs = sal_False ) const;
+};
+
+
+#endif
+
diff --git a/sw/inc/fmtftntx.hxx b/sw/inc/fmtftntx.hxx
new file mode 100644
index 000000000000..f3472108de97
--- /dev/null
+++ b/sw/inc/fmtftntx.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTFTNTX_HXX
+#define _FMTFTNTX_HXX
+
+#include <svl/eitem.hxx>
+#include <hintids.hxx>
+#include <format.hxx>
+#include <numrule.hxx>
+#include "swdllapi.h"
+
+enum SwFtnEndPosEnum
+{
+ FTNEND_ATPGORDOCEND, // at page or document end
+ FTNEND_ATTXTEND, // at end of the current text end
+ FTNEND_ATTXTEND_OWNNUMSEQ, // -""- and with own number sequence
+ FTNEND_ATTXTEND_OWNNUMANDFMT, // -""- and with onw numberformat
+ FTNEND_ATTXTEND_END
+};
+
+
+class SW_DLLPUBLIC SwFmtFtnEndAtTxtEnd : public SfxEnumItem
+{
+ String sPrefix;
+ String sSuffix;
+ SvxNumberType aFmt;
+ sal_uInt16 nOffset;
+
+protected:
+ SwFmtFtnEndAtTxtEnd( sal_uInt16 nWhichL, SwFtnEndPosEnum ePos )
+ : SfxEnumItem( nWhichL, sal::static_int_cast< sal_uInt16 >(ePos) ), nOffset( 0 )
+ {}
+ SwFmtFtnEndAtTxtEnd( const SwFmtFtnEndAtTxtEnd& rAttr )
+ : SfxEnumItem( rAttr ), sPrefix( rAttr.sPrefix ),
+ sSuffix( rAttr.sSuffix ), aFmt( rAttr.aFmt ),
+ nOffset( rAttr.nOffset )
+ {}
+
+public:
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+// will be used at time??
+// void FillVariable( SbxVariable &rVar,
+// SfxMapUnit eCoreMetric,
+// SfxMapUnit eUserMetric ) const;
+// virtual SfxArgumentError SetVariable( const SbxVariable &rVal,
+// SfxMapUnit eCoreMetric,
+// SfxMapUnit eUserMetric );
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ inline sal_Bool IsAtEnd() const { return FTNEND_ATPGORDOCEND != GetValue(); }
+
+ SwFmtFtnEndAtTxtEnd & operator=( const SwFmtFtnEndAtTxtEnd & rAttr );
+
+ sal_Int16 GetNumType() const { return aFmt.GetNumberingType(); }
+ void SetNumType( sal_Int16 eType ) { aFmt.SetNumberingType(eType); }
+
+ const SvxNumberType& GetSwNumType() const { return aFmt; }
+
+ sal_uInt16 GetOffset() const { return nOffset; }
+ void SetOffset( sal_uInt16 nOff ) { nOffset = nOff; }
+
+ const String& GetPrefix() const { return sPrefix; }
+ void SetPrefix(const String& rSet) { sPrefix = rSet; }
+
+ const String& GetSuffix() const { return sSuffix; }
+ void SetSuffix(const String& rSet) { sSuffix = rSet; }
+};
+
+class SW_DLLPUBLIC SwFmtFtnAtTxtEnd : public SwFmtFtnEndAtTxtEnd
+{
+public:
+ SwFmtFtnAtTxtEnd( SwFtnEndPosEnum ePos = FTNEND_ATPGORDOCEND )
+ : SwFmtFtnEndAtTxtEnd( RES_FTN_AT_TXTEND, ePos )
+ {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+};
+
+class SW_DLLPUBLIC SwFmtEndAtTxtEnd : public SwFmtFtnEndAtTxtEnd
+{
+public:
+ SwFmtEndAtTxtEnd( SwFtnEndPosEnum ePos = FTNEND_ATPGORDOCEND )
+ : SwFmtFtnEndAtTxtEnd( RES_END_AT_TXTEND, ePos )
+ {
+ SetNumType( SVX_NUM_ROMAN_LOWER );
+ }
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+};
+
+inline const SwFmtFtnAtTxtEnd &SwAttrSet::GetFtnAtTxtEnd(sal_Bool bInP) const
+ { return (const SwFmtFtnAtTxtEnd&)Get( RES_FTN_AT_TXTEND, bInP); }
+inline const SwFmtEndAtTxtEnd &SwAttrSet::GetEndAtTxtEnd(sal_Bool bInP) const
+ { return (const SwFmtEndAtTxtEnd&)Get( RES_END_AT_TXTEND, bInP); }
+
+
+inline const SwFmtFtnAtTxtEnd &SwFmt::GetFtnAtTxtEnd(sal_Bool bInP) const
+ { return aSet.GetFtnAtTxtEnd(bInP); }
+inline const SwFmtEndAtTxtEnd &SwFmt::GetEndAtTxtEnd(sal_Bool bInP) const
+ { return aSet.GetEndAtTxtEnd(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmthdft.hxx b/sw/inc/fmthdft.hxx
new file mode 100644
index 000000000000..73a56a283a2b
--- /dev/null
+++ b/sw/inc/fmthdft.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTHDFT_HXX
+#define _FMTHDFT_HXX
+
+#include <hintids.hxx>
+#include <format.hxx>
+#include <svl/poolitem.hxx>
+#include <calbck.hxx>
+
+class SwFrmFmt;
+class IntlWrapper;
+class SwFmt;
+
+//Kopfzeile, fuer Seitenformate
+//Client von FrmFmt das den Header beschreibt.
+
+class SW_DLLPUBLIC SwFmtHeader: public SfxPoolItem, public SwClient
+{
+ sal_Bool bActive; //Nur zur Steuerung (Erzeugung des Inhaltes)
+
+public:
+ SwFmtHeader( sal_Bool bOn = sal_False );
+ SwFmtHeader( SwFrmFmt *pHeaderFmt );
+ SwFmtHeader( const SwFmtHeader &rCpy );
+ ~SwFmtHeader();
+ SwFmtHeader& operator=( const SwFmtHeader &rCpy );
+
+ TYPEINFO();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ const SwFrmFmt *GetHeaderFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+ SwFrmFmt *GetHeaderFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
+
+ void RegisterToFormat( SwFmt& rFmt );
+ sal_Bool IsActive() const { return bActive; }
+ void SetActive( sal_Bool bNew = sal_True ) { bActive = bNew; }
+};
+
+
+//Fusszeile, fuer Seitenformate
+//Client von FrmFmt das den Footer beschreibt.
+
+class SW_DLLPUBLIC SwFmtFooter: public SfxPoolItem, public SwClient
+{
+ sal_Bool bActive; //Nur zur Steuerung (Erzeugung des Inhaltes)
+
+public:
+ SwFmtFooter( sal_Bool bOn = sal_False );
+ SwFmtFooter( SwFrmFmt *pFooterFmt );
+ SwFmtFooter( const SwFmtFooter &rCpy );
+ ~SwFmtFooter();
+ SwFmtFooter& operator=( const SwFmtFooter &rCpy );
+
+ TYPEINFO();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ const SwFrmFmt *GetFooterFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+ SwFrmFmt *GetFooterFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
+
+ void RegisterToFormat( SwFmt& rFmt );
+ sal_Bool IsActive() const { return bActive; }
+ void SetActive( sal_Bool bNew = sal_True ) { bActive = bNew; }
+};
+
+inline const SwFmtHeader &SwAttrSet::GetHeader(sal_Bool bInP) const
+ { return (const SwFmtHeader&)Get( RES_HEADER,bInP); }
+inline const SwFmtFooter &SwAttrSet::GetFooter(sal_Bool bInP) const
+ { return (const SwFmtFooter&)Get( RES_FOOTER,bInP); }
+
+inline const SwFmtHeader &SwFmt::GetHeader(sal_Bool bInP) const
+ { return aSet.GetHeader(bInP); }
+inline const SwFmtFooter &SwFmt::GetFooter(sal_Bool bInP) const
+ { return aSet.GetFooter(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtinfmt.hxx b/sw/inc/fmtinfmt.hxx
new file mode 100644
index 000000000000..bfb6d35d2e76
--- /dev/null
+++ b/sw/inc/fmtinfmt.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTINFMT_HXX
+#define _FMTINFMT_HXX
+
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+#include "swdllapi.h"
+
+class SvxMacro;
+class SvxMacroTableDtor;
+class SwTxtINetFmt;
+class IntlWrapper;
+
+// ATT_INETFMT *********************************************
+
+class SW_DLLPUBLIC SwFmtINetFmt: public SfxPoolItem
+{
+ friend class SwTxtINetFmt;
+
+ String aURL; // die URL
+ String aTargetFrame; // in diesen Frame soll die URL
+ String aINetFmt;
+ String aVisitedFmt;
+ String aName; // Name des Links
+ SvxMacroTableDtor* pMacroTbl;
+ SwTxtINetFmt* pTxtAttr; // mein TextAttribut
+ sal_uInt16 nINetId;
+ sal_uInt16 nVisitedId;
+public:
+ SwFmtINetFmt( const String& rURL, const String& rTarget );
+ SwFmtINetFmt( const SwFmtINetFmt& rAttr );
+ SwFmtINetFmt(); // for TypeInfo
+ virtual ~SwFmtINetFmt();
+
+ TYPEINFO();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+
+
+ const SwTxtINetFmt* GetTxtINetFmt() const { return pTxtAttr; }
+ SwTxtINetFmt* GetTxtINetFmt() { return pTxtAttr; }
+
+ const String& GetValue() const { return aURL; }
+
+ const String& GetName() const { return aName; }
+ void SetName( const String& rNm ) { aName = rNm; }
+
+ const String& GetTargetFrame() const { return aTargetFrame; }
+
+ const String& GetINetFmt() const { return aINetFmt; }
+ void SetINetFmt( const String& rNm ) { aINetFmt = rNm; }
+
+ const String& GetVisitedFmt() const { return aVisitedFmt; }
+ void SetVisitedFmt( const String& rNm ) { aVisitedFmt = rNm; }
+
+ sal_uInt16 GetINetFmtId() const { return nINetId; }
+ void SetINetFmtId( sal_uInt16 nNew ) { nINetId = nNew; }
+
+ sal_uInt16 GetVisitedFmtId() const { return nVisitedId; }
+ void SetVisitedFmtId( sal_uInt16 nNew ) { nVisitedId = nNew; }
+
+ // setze eine neue oder loesche die akt. MakroTabelle
+ void SetMacroTbl( const SvxMacroTableDtor* pTbl = 0 );
+ const SvxMacroTableDtor* GetMacroTbl() const { return pMacroTbl; }
+
+ // setze / erfrage ein Makro
+ void SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro );
+ const SvxMacro* GetMacro( sal_uInt16 nEvent ) const;
+};
+
+
+#endif
+
diff --git a/sw/inc/fmtline.hxx b/sw/inc/fmtline.hxx
new file mode 100644
index 000000000000..fb04ec8ed94d
--- /dev/null
+++ b/sw/inc/fmtline.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_FMTLINE_HXX
+#define SW_FMTLINE_HXX
+
+
+#include <svl/poolitem.hxx>
+#include <hintids.hxx>
+#include <format.hxx>
+#include "swdllapi.h"
+
+class IntlWrapper;
+
+class SW_DLLPUBLIC SwFmtLineNumber: public SfxPoolItem
+{
+ sal_uLong nStartValue :24; //Startwert fuer den Absatz, 0 == kein Startwert
+ sal_uLong bCountLines :1; //Zeilen des Absatzes sollen mitgezaehlt werden.
+
+public:
+ SwFmtLineNumber();
+ ~SwFmtLineNumber();
+
+ TYPEINFO();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ sal_uLong GetStartValue() const { return nStartValue; }
+ sal_Bool IsCount() const { return bCountLines != 0; }
+
+ void SetStartValue( sal_uLong nNew ) { nStartValue = nNew; }
+ void SetCountLines( sal_Bool b ) { bCountLines = b; }
+};
+
+inline const SwFmtLineNumber &SwAttrSet::GetLineNumber(sal_Bool bInP) const
+ { return (const SwFmtLineNumber&)Get( RES_LINENUMBER,bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtlsplt.hxx b/sw/inc/fmtlsplt.hxx
new file mode 100644
index 000000000000..1ac109d067ef
--- /dev/null
+++ b/sw/inc/fmtlsplt.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTTSPLT_HXX
+#define _FMTTSPLT_HXX
+
+#include <svl/eitem.hxx>
+#include <hintids.hxx>
+#include <format.hxx>
+#include "swdllapi.h"
+
+class IntlWrapper;
+
+class SW_DLLPUBLIC SwFmtLayoutSplit : public SfxBoolItem
+{
+public:
+ SwFmtLayoutSplit( sal_Bool bSplit = sal_True ) : SfxBoolItem( RES_LAYOUT_SPLIT, bSplit ) {}
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+inline const SwFmtLayoutSplit &SwAttrSet::GetLayoutSplit(sal_Bool bInP) const
+ { return (const SwFmtLayoutSplit&)Get( RES_LAYOUT_SPLIT,bInP); }
+
+inline const SwFmtLayoutSplit &SwFmt::GetLayoutSplit(sal_Bool bInP) const
+ { return aSet.GetLayoutSplit(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtmeta.hxx b/sw/inc/fmtmeta.hxx
new file mode 100755
index 000000000000..82c0d104f7b4
--- /dev/null
+++ b/sw/inc/fmtmeta.hxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_FMTMETA_HXX
+#define SW_FMTMETA_HXX
+
+#include <cppuhelper/weakref.hxx>
+
+#include <svl/poolitem.hxx>
+#include <sfx2/Metadatable.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+
+#include <vector>
+
+
+namespace com { namespace sun { namespace star {
+ namespace text {
+ class XTextField;
+ }
+}}}
+
+
+/**
+ * The classes that make up a meta entity are:
+ * <dl>
+ * <dt>SwTxtMeta</dt><dd>the text hint</dd>
+ * <dt>SwFmtMeta</dt><dd>the pool item</dd>
+ * <dt>sw::Meta</dt><dd>the metadatable entity itself</dd>
+ * <dt>SwXMeta</dt><dd>the UNO wrapper object</dd>
+ * </dl>
+ *
+ * The text hint contains the pool item (as usual) and has a pointer to the
+ * text node at which it is attached.
+ * The pool item has a shared pointer to the metadatable entity, and a reverse
+ * pointer to the text attribute at which it is attached.
+ * The pool item is non-poolable; it may only be attached to one text
+ * attribute.
+ * Of all the pool items that refer to a metadatable entity, only one may be
+ * in the document content at any time. Others may be in the undo array, or in
+ * undo objects.
+ * The metadatable entity has a reverse pointer to the pool item that is
+ * currently in the document. It also registers as a client at the text node
+ * at which it is attached via this pool item and its text attribute.
+ * The UNO wrapper object registers as a client at the metadatable entity.
+ *
+ * Copying the metadatable entity proceeds in the following way:
+ * <ol>
+ * <li>The pool item is cloned (because it is non-poolable); the clone
+ * points to the same metadatable entity, but the metadatable entity's
+ * reverse pointer is unchanged.</li>
+ * <li>The DoCopy() method is called at the new pool item:
+ * it will clone the metadatable entity (using RegisterAsCopyOf).
+ * This is necessary, because first, a metadatable entity may
+ * only be inserted once into a document, and second, the copy may be
+ * inserted into a different document than the source document!</li>
+ * <li>A new text hint is created, taking over the new pool item.</li>
+ * <li>The text hint is inserted into the hints array of some text node.</li>
+ * </ol>
+ */
+
+class SwTxtMeta;
+class SwXMeta;
+class SwXMetaField;
+namespace sw {
+ class Meta;
+}
+
+class SwFmtMeta
+ : public SfxPoolItem
+{
+private:
+ friend class SwTxtMeta; // needs SetTxtAttr, DoCopy
+ friend class ::sw::Meta; // needs m_pTxtAttr
+
+ ::boost::shared_ptr< ::sw::Meta > m_pMeta;
+ SwTxtMeta * m_pTxtAttr;
+
+ SwTxtMeta * GetTxtAttr() { return m_pTxtAttr; }
+ void SetTxtAttr(SwTxtMeta * const i_pTxtAttr);
+
+ /// this method <em>must</em> be called when the hint is actually copied
+ void DoCopy(::sw::MetaFieldManager & i_rTargetDocManager,
+ SwTxtNode & i_rTargetTxtNode);
+
+ explicit SwFmtMeta( const sal_uInt16 i_nWhich );
+
+public:
+ // takes ownership
+ explicit SwFmtMeta( ::boost::shared_ptr< ::sw::Meta > const & i_pMeta,
+ const sal_uInt16 i_nWhich );
+ virtual ~SwFmtMeta();
+
+ // SfxPoolItem
+ virtual int operator==( const SfxPoolItem & ) const;
+ virtual SfxPoolItem * Clone( SfxItemPool *pPool = 0 ) const;
+
+ /// notify clients registered at m_pMeta that this meta is being (re-)moved
+ void NotifyChangeTxtNode(SwTxtNode *const pTxtNode);
+ static SwFmtMeta * CreatePoolDefault( const sal_uInt16 i_nWhich );
+ ::sw::Meta * GetMeta() { return m_pMeta.get(); }
+};
+
+
+namespace sw {
+
+class MetaFieldManager;
+
+class Meta
+ : public ::sfx2::Metadatable
+ , public SwModify
+{
+protected:
+ friend class ::SwFmtMeta; // SetFmtMeta, NotifyChangeTxtNode
+ friend class ::SwXMeta; // GetTxtNode, GetTxtAttr, Get/SetXMeta
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::rdf::XMetadatable> m_wXMeta;
+
+ SwFmtMeta * m_pFmt;
+ SwTxtNode * m_pTxtNode;
+
+ SwTxtMeta * GetTxtAttr() const;
+ SwTxtNode * GetTxtNode() const; // returns 0 if not in document (undo)
+
+ SwFmtMeta * GetFmtMeta() const { return m_pFmt; }
+ void SetFmtMeta( SwFmtMeta * const i_pFmt ) { m_pFmt = i_pFmt; };
+
+ void NotifyChangeTxtNodeImpl();
+ void NotifyChangeTxtNode(SwTxtNode *const pTxtNode);
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::rdf::XMetadatable> const& GetXMeta() const
+ { return m_wXMeta; }
+ void SetXMeta(::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable> const& xMeta)
+ { m_wXMeta = xMeta; }
+
+ // SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
+
+public:
+ explicit Meta(SwFmtMeta * const i_pFmt = 0);
+ virtual ~Meta();
+
+ // sfx2::Metadatable
+ virtual ::sfx2::IXmlIdRegistry& GetRegistry();
+ virtual bool IsInClipboard() const;
+ virtual bool IsInUndo() const;
+ virtual bool IsInContent() const;
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > MakeUnoObject();
+};
+
+class MetaField
+ : public Meta
+{
+private:
+ friend class ::SwFmtMeta;
+ friend class ::SwXMetaField;
+ friend class ::sw::MetaFieldManager;
+
+ sal_uInt32 m_nNumberFormat;
+ bool m_bIsFixedLanguage;
+
+ sal_uInt32 GetNumberFormat(::rtl::OUString const & rContent) const;
+ void SetNumberFormat(sal_uInt32 nNumberFormat);
+ bool IsFixedLanguage() const { return m_bIsFixedLanguage; }
+ void SetIsFixedLanguage(bool b) { m_bIsFixedLanguage = b; }
+
+ explicit MetaField(SwFmtMeta * const i_pFmt = 0,
+ const sal_uInt32 nNumberFormat = SAL_MAX_UINT32,
+ const bool bIsFixedLanguage = false );
+
+public:
+ /// get prefix/suffix from the RDF repository. @throws RuntimeException
+ void GetPrefixAndSuffix(
+ ::rtl::OUString *const o_pPrefix, ::rtl::OUString *const o_pSuffix);
+};
+
+/** knows all meta-fields in the document. */
+class MetaFieldManager
+ : private ::boost::noncopyable
+{
+private:
+ typedef ::std::vector< ::boost::weak_ptr<MetaField> > MetaFieldList_t;
+ MetaFieldList_t m_MetaFields;
+
+public:
+ MetaFieldManager();
+ ::boost::shared_ptr<MetaField> makeMetaField(
+ SwFmtMeta * const i_pFmt = 0,
+ const sal_uInt32 nNumberFormat = SAL_MAX_UINT32,
+ const bool bIsFixedLanguage = false );
+ /// get all meta fields
+ ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextField> > getMetaFields();
+};
+
+} // namespace sw
+
+#endif // SW_FMTMETA_HXX
+
diff --git a/sw/inc/fmtornt.hxx b/sw/inc/fmtornt.hxx
new file mode 100644
index 000000000000..aa6389992a3d
--- /dev/null
+++ b/sw/inc/fmtornt.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTORNT_HXX
+#define _FMTORNT_HXX
+
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
+#include "swdllapi.h"
+#include <hintids.hxx>
+#include <swtypes.hxx>
+#include <format.hxx>
+#include <svl/poolitem.hxx>
+
+
+class IntlWrapper;
+
+#define IVER_VERTORIENT_REL ((sal_uInt16)0x0001)
+
+class SW_DLLPUBLIC SwFmtVertOrient: public SfxPoolItem
+{
+ SwTwips nYPos; //Enthaelt _immer_ die aktuelle RelPos.
+ sal_Int16 eOrient;
+ sal_Int16 eRelation;
+public:
+ TYPEINFO();
+ SwFmtVertOrient( SwTwips nY = 0, sal_Int16 eVert = com::sun::star::text::VertOrientation::NONE,
+ sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA );
+ inline SwFmtVertOrient &operator=( const SwFmtVertOrient &rCpy );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ sal_Int16 GetVertOrient() const { return eOrient; }
+ sal_Int16 GetRelationOrient() const { return eRelation; }
+ void SetVertOrient( sal_Int16 eNew ) { eOrient = eNew; }
+ void SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
+
+ SwTwips GetPos() const { return nYPos; }
+ void SetPos( SwTwips nNew ) { nYPos = nNew; }
+};
+
+//SwFmtHoriOrient, wie und woran orientiert --
+// sich der FlyFrm in der Hoizontalen ----------
+
+#define IVER_HORIORIENT_TOGGLE ((sal_uInt16)0x0001)
+#define IVER_HORIORIENT_REL ((sal_uInt16)0x0002)
+
+class SW_DLLPUBLIC SwFmtHoriOrient: public SfxPoolItem
+{
+ SwTwips nXPos; //Enthaelt _immer_ die aktuelle RelPos.
+ sal_Int16 eOrient;
+ sal_Int16 eRelation;
+ sal_Bool bPosToggle : 1; // auf geraden Seiten Position spiegeln
+public:
+ TYPEINFO();
+ SwFmtHoriOrient( SwTwips nX = 0, sal_Int16 eHori = com::sun::star::text::HoriOrientation::NONE,
+ sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA, sal_Bool bPos = sal_False );
+ inline SwFmtHoriOrient &operator=( const SwFmtHoriOrient &rCpy );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ sal_Int16 GetHoriOrient() const { return eOrient; }
+ sal_Int16 GetRelationOrient() const { return eRelation; }
+ void SetHoriOrient( sal_Int16 eNew ) { eOrient = eNew; }
+ void SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
+
+ SwTwips GetPos() const { return nXPos; }
+ void SetPos( SwTwips nNew ) { nXPos = nNew; }
+
+ sal_Bool IsPosToggle() const { return bPosToggle; }
+ void SetPosToggle( sal_Bool bNew ) { bPosToggle = bNew; }
+};
+
+inline SwFmtVertOrient &SwFmtVertOrient::operator=( const SwFmtVertOrient &rCpy )
+{
+ nYPos = rCpy.GetPos();
+ eOrient = rCpy.GetVertOrient();
+ eRelation = rCpy.GetRelationOrient();
+ return *this;
+}
+inline SwFmtHoriOrient &SwFmtHoriOrient::operator=( const SwFmtHoriOrient &rCpy )
+{
+ nXPos = rCpy.GetPos();
+ eOrient = rCpy.GetHoriOrient();
+ eRelation = rCpy.GetRelationOrient();
+ bPosToggle = rCpy.IsPosToggle();
+ return *this;
+}
+
+inline const SwFmtVertOrient &SwAttrSet::GetVertOrient(sal_Bool bInP) const
+ { return (const SwFmtVertOrient&)Get( RES_VERT_ORIENT,bInP); }
+inline const SwFmtHoriOrient &SwAttrSet::GetHoriOrient(sal_Bool bInP) const
+ { return (const SwFmtHoriOrient&)Get( RES_HORI_ORIENT,bInP); }
+
+inline const SwFmtVertOrient &SwFmt::GetVertOrient(sal_Bool bInP) const
+ { return aSet.GetVertOrient(bInP); }
+inline const SwFmtHoriOrient &SwFmt::GetHoriOrient(sal_Bool bInP) const
+ { return aSet.GetHoriOrient(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtpdsc.hxx b/sw/inc/fmtpdsc.hxx
new file mode 100644
index 000000000000..2363fddddf34
--- /dev/null
+++ b/sw/inc/fmtpdsc.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTPDSC_HXX
+#define _FMTPDSC_HXX
+
+
+#include <svl/poolitem.hxx>
+#include "swdllapi.h"
+#include <hintids.hxx>
+#include <format.hxx>
+#include <calbck.hxx>
+
+class SwPageDesc;
+class SwHistory;
+class SwPaM;
+class IntlWrapper;
+class SwEndNoteInfo;
+
+//Pagedescriptor
+//Client vom SwPageDesc der durch das Attribut "beschrieben" wird.
+
+#define IVER_FMTPAGEDESC_NOAUTO ((sal_uInt16)0x0001)
+#define IVER_FMTPAGEDESC_LONGPAGE ((sal_uInt16)0x0002)
+
+class SW_DLLPUBLIC SwFmtPageDesc : public SfxPoolItem, public SwClient
+{
+ // diese "Doc"-Funktion ist friend, um nach dem kopieren das
+ // Auto-Flag setzen zu koennen !!
+ friend sal_Bool InsAttr( SwDoc*, const SwPaM &, const SfxItemSet&, sal_uInt16,
+ SwHistory* );
+ sal_uInt16 nNumOffset; // Seitennummer Offset
+ sal_uInt16 nDescNameIdx; // SW3-Reader: Stringpool-Index des Vorlagennamens
+ SwModify* pDefinedIn; // Verweis auf das Objekt, in dem das
+ // Attribut gesetzt wurde (CntntNode/Format)
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
+ virtual void SwClientNotify( const SwModify&, const SfxHint& rHint );
+
+public:
+ SwFmtPageDesc( const SwPageDesc *pDesc = 0 );
+ SwFmtPageDesc( const SwFmtPageDesc &rCpy );
+ SwFmtPageDesc &operator=( const SwFmtPageDesc &rCpy );
+ ~SwFmtPageDesc();
+
+ TYPEINFO();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ SwPageDesc *GetPageDesc() { return (SwPageDesc*)GetRegisteredIn(); }
+ const SwPageDesc *GetPageDesc() const { return (SwPageDesc*)GetRegisteredIn(); }
+
+ sal_uInt16 GetNumOffset() const { return nNumOffset; }
+ void SetNumOffset( sal_uInt16 nNum ) { nNumOffset = nNum; }
+
+ // erfrage/setze, wo drin das Attribut verankert ist
+ inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
+ void ChgDefinedIn( const SwModify* pNew ) { pDefinedIn = (SwModify*)pNew; }
+ void RegisterToEndNotInfo( SwEndNoteInfo& );
+ void RegisterToPageDesc( SwPageDesc& );
+ bool KnowsPageDesc() const;
+};
+
+
+inline const SwFmtPageDesc &SwAttrSet::GetPageDesc(sal_Bool bInP) const
+ { return (const SwFmtPageDesc&)Get( RES_PAGEDESC,bInP); }
+
+inline const SwFmtPageDesc &SwFmt::GetPageDesc(sal_Bool bInP) const
+ { return aSet.GetPageDesc(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtrfmrk.hxx b/sw/inc/fmtrfmrk.hxx
new file mode 100644
index 000000000000..9f97282d8e10
--- /dev/null
+++ b/sw/inc/fmtrfmrk.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTRFMRK_HXX
+#define _FMTRFMRK_HXX
+
+
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+
+class SwTxtRefMark;
+
+// ATT_REFMARK *******************************************************
+
+class SwFmtRefMark : public SfxPoolItem
+{
+ friend class SwTxtRefMark;
+ SwTxtRefMark* pTxtAttr; // mein TextAttribut
+
+ // geschuetzter CopyCtor
+ SwFmtRefMark& operator=(const SwFmtRefMark& rRefMark);
+ String aRefName;
+
+public:
+ SwFmtRefMark( const String& rTxt );
+ SwFmtRefMark( const SwFmtRefMark& rRefMark );
+ ~SwFmtRefMark( );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ const SwTxtRefMark *GetTxtRefMark() const { return pTxtAttr; }
+ SwTxtRefMark *GetTxtRefMark() { return pTxtAttr; }
+
+ inline String &GetRefName() { return aRefName; }
+ inline const String &GetRefName() const { return aRefName; }
+};
+
+#endif
+
diff --git a/sw/inc/fmtrowsplt.hxx b/sw/inc/fmtrowsplt.hxx
new file mode 100644
index 000000000000..8f0606b87ac2
--- /dev/null
+++ b/sw/inc/fmtrowsplt.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTROWSPLT_HXX
+#define _FMTROWSPLT_HXX
+
+#include <svl/eitem.hxx>
+#include "swdllapi.h"
+#include <hintids.hxx>
+#include <format.hxx>
+
+class IntlWrapper;
+
+class SW_DLLPUBLIC SwFmtRowSplit : public SfxBoolItem
+{
+public:
+ SwFmtRowSplit( sal_Bool bSplit = sal_True ) : SfxBoolItem( RES_ROW_SPLIT, bSplit ) {}
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+inline const SwFmtRowSplit &SwAttrSet::GetRowSplit(sal_Bool bInP) const
+ { return (const SwFmtRowSplit&)Get( RES_ROW_SPLIT,bInP); }
+
+inline const SwFmtRowSplit &SwFmt::GetRowSplit(sal_Bool bInP) const
+ { return aSet.GetRowSplit(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtruby.hxx b/sw/inc/fmtruby.hxx
new file mode 100644
index 000000000000..76f2156bcfdd
--- /dev/null
+++ b/sw/inc/fmtruby.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTRUBY_HXX
+#define _FMTRUBY_HXX
+
+
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+
+class SwTxtRuby;
+
+class SW_DLLPUBLIC SwFmtRuby : public SfxPoolItem
+{
+ friend class SwTxtRuby;
+
+ String sRubyTxt; // the ruby txt
+ String sCharFmtName; // name of the charformat
+ SwTxtRuby* pTxtAttr; // the TextAttribut
+ sal_uInt16 nCharFmtId; // PoolId of the charformat
+ sal_uInt16 nPosition; // Position of the Ruby-Character
+ sal_uInt16 nAdjustment; // specific adjustment of the Ruby-Ch.
+
+public:
+ SwFmtRuby( const String& rRubyTxt );
+ SwFmtRuby( const SwFmtRuby& rAttr );
+ virtual ~SwFmtRuby();
+
+ SwFmtRuby& operator=( const SwFmtRuby& rAttr );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+
+
+ const SwTxtRuby* GetTxtRuby() const { return pTxtAttr; }
+ SwTxtRuby* GetTxtRuby() { return pTxtAttr; }
+
+ const String& GetText() const { return sRubyTxt; }
+ void SetText( const String& rTxt ) { sRubyTxt = rTxt; }
+
+ const String& GetCharFmtName() const { return sCharFmtName; }
+ void SetCharFmtName( const String& rNm ) { sCharFmtName = rNm; }
+
+ sal_uInt16 GetCharFmtId() const { return nCharFmtId; }
+ void SetCharFmtId( sal_uInt16 nNew ) { nCharFmtId = nNew; }
+
+ sal_uInt16 GetPosition() const { return nPosition; }
+ void SetPosition( sal_uInt16 nNew ) { nPosition = nNew; }
+
+ sal_uInt16 GetAdjustment() const { return nAdjustment; }
+ void SetAdjustment( sal_uInt16 nNew ) { nAdjustment = nNew; }
+};
+
+
+#endif
+
diff --git a/sw/inc/fmtsrnd.hxx b/sw/inc/fmtsrnd.hxx
new file mode 100644
index 000000000000..f9ceb522a2c5
--- /dev/null
+++ b/sw/inc/fmtsrnd.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTSRND_HXX
+#define _FMTSRND_HXX
+
+#include "swdllapi.h"
+#include <hintids.hxx>
+#include <format.hxx>
+#include <svl/eitem.hxx>
+
+// --> OD 2006-08-15 #i68520# - refactoring
+// separate enumeration <SwSurround> in own header file
+#include <fmtsrndenum.hxx>
+// <--
+class IntlWrapper;
+
+//SwFmtSurround, wie soll sich der ---------------
+// Dokumentinhalt unter dem Rahmen verhalten ---
+
+class SW_DLLPUBLIC SwFmtSurround: public SfxEnumItem
+{
+ sal_Bool bAnchorOnly :1;
+ sal_Bool bContour :1;
+ sal_Bool bOutside :1;
+public:
+ SwFmtSurround( SwSurround eNew = SURROUND_PARALLEL );
+ SwFmtSurround( const SwFmtSurround & );
+ inline SwFmtSurround &operator=( const SwFmtSurround &rCpy );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual sal_uInt16 GetValueCount() const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+
+ SwSurround GetSurround()const { return SwSurround( GetValue() ); }
+ sal_Bool IsAnchorOnly() const { return bAnchorOnly; }
+ sal_Bool IsContour() const { return bContour; }
+ sal_Bool IsOutside() const { return bOutside; }
+ void SetSurround ( SwSurround eNew ){ SfxEnumItem::SetValue( sal_uInt16( eNew ) ); }
+ void SetAnchorOnly( sal_Bool bNew ) { bAnchorOnly = bNew; }
+ void SetContour( sal_Bool bNew ) { bContour = bNew; }
+ void SetOutside( sal_Bool bNew ) { bOutside = bNew; }
+};
+
+inline SwFmtSurround &SwFmtSurround::operator=( const SwFmtSurround &rCpy )
+{
+ bAnchorOnly = rCpy.IsAnchorOnly();
+ bContour = rCpy.IsContour();
+ bOutside = rCpy.IsOutside();
+ SfxEnumItem::SetValue( rCpy.GetValue() );
+ return *this;
+}
+
+inline const SwFmtSurround &SwAttrSet::GetSurround(sal_Bool bInP) const
+ { return (const SwFmtSurround&)Get( RES_SURROUND,bInP); }
+
+inline const SwFmtSurround &SwFmt::GetSurround(sal_Bool bInP) const
+ { return aSet.GetSurround(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtsrndenum.hxx b/sw/inc/fmtsrndenum.hxx
new file mode 100644
index 000000000000..688d89a236ea
--- /dev/null
+++ b/sw/inc/fmtsrndenum.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTSRNDENUM_HXX
+#define _FMTSRNDENUM_HXX
+
+enum SwSurround {
+ SURROUND_BEGIN,
+ SURROUND_NONE = SURROUND_BEGIN,
+ SURROUND_THROUGHT,
+ SURROUND_PARALLEL,
+ SURROUND_IDEAL,
+ SURROUND_LEFT,
+ SURROUND_RIGHT,
+ SURROUND_END
+};
+
+#endif
diff --git a/sw/inc/fmtui.hrc b/sw/inc/fmtui.hrc
new file mode 100644
index 000000000000..a25aa4425c5e
--- /dev/null
+++ b/sw/inc/fmtui.hrc
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTUI_HRC
+#define _FMTUI_HRC
+
+#include "rcid.hrc"
+
+
+#define DLG_FMTENTRY (RC_FMTUI_BEGIN)
+#define DLG_NEW_FILE (RC_FMTUI_BEGIN + 1)
+#define STR_PAGE_STD (RC_FMTUI_BEGIN + 2)
+#define STR_PAGE_BORDER (RC_FMTUI_BEGIN + 3)
+#define STR_PAGE_HEADER (RC_FMTUI_BEGIN + 4)
+#define STR_PAGE_FOOTER (RC_FMTUI_BEGIN + 5)
+#define STR_PAGE_COLUMN (RC_FMTUI_BEGIN + 6)
+#define STR_PAGE_FOOTNOTE (RC_FMTUI_BEGIN + 7)
+#define STR_PAGE_TEXTGRID (RC_FMTUI_BEGIN + 8)
+
+#define DLG_STD_CHAR (RC_FMTUI_BEGIN + 15)
+
+#define MN_TEXT (RC_FMTUI_BEGIN + 20)
+#define MN_GRAFIC (RC_FMTUI_BEGIN + 21)
+#define MN_TABLE (RC_FMTUI_BEGIN + 22)
+
+#define MN_REGION (RC_FMTUI_BEGIN + 24)
+#define MN_REGION_SUB (RC_FMTUI_BEGIN + 25)
+
+
+#define DLG_DOC_STYLE (RC_FMTUI_BEGIN + 26)
+#define DLG_NEW_COLL (RC_FMTUI_BEGIN + 28)
+
+#define DLG_TEMPLATE_PI (RC_FMTUI_BEGIN + 29)
+#define DLG_HELP_ID (RC_FMTUI_BEGIN + 30)
+
+#define STR_OVERWRITE (RC_FMTUI_BEGIN + 32)
+#define ST_CUSTOMIZE 1
+
+// die Abstaende zur Basis 2 nicht aendern !!!!
+#define DLG_TEMPLATE_BASE (RC_FMTUI_BEGIN + 40)
+#define DLG_TEMPLATE_1 (RC_FMTUI_BEGIN + 41)
+#define DLG_TEMPLATE_2 (RC_FMTUI_BEGIN + 42)
+#define DLG_TEMPLATE_3 (RC_FMTUI_BEGIN + 44)
+#define DLG_TEMPLATE_4 (RC_FMTUI_BEGIN + 48)
+#define DLG_TEMPLATE_5 (RC_FMTUI_BEGIN + 56)
+
+
+#if DLG_TEMPLATE_5 > RC_FMTUI_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#define TEMPLATEPI_IDX_ALL 1
+#define TEMPLATEPI_IDX_USED 2
+#define TEMPLATEPI_IDX_USER 3
+#define TEMPLATEPI_IDX_AUTOMATIC 4
+#define TEMPLATEPI_IDX_TEXT 5
+#define TEMPLATEPI_IDX_CHAPTER 6
+#define TEMPLATEPI_IDX_LIST 7
+#define TEMPLATEPI_IDX_IDX 8
+#define TEMPLATEPI_IDX_EXTRA 9
+
+
+
+#endif
+
diff --git a/sw/inc/fmturl.hxx b/sw/inc/fmturl.hxx
new file mode 100644
index 000000000000..86241fb60649
--- /dev/null
+++ b/sw/inc/fmturl.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FMTURL_HXX
+#define _FMTURL_HXX
+
+#include <svl/poolitem.hxx>
+#include "swdllapi.h"
+#include <hintids.hxx>
+#include <format.hxx>
+
+class ImageMap;
+class IntlWrapper;
+
+// URL, ServerMap und ClientMap
+
+class SW_DLLPUBLIC SwFmtURL: public SfxPoolItem
+{
+ String sTargetFrameName; // in diesen Frame soll die URL
+ String sURL; //Einfache URL
+ String sName; // Name des Anchors
+ ImageMap *pMap; //ClientSide Images
+
+ sal_Bool bIsServerMap; //mit der URL eine ServerSideImageMap
+
+ SwFmtURL& operator=( const SwFmtURL& );
+
+public:
+ SwFmtURL();
+
+ // @@@ copy construction allowed, but assigment is not? @@@
+ SwFmtURL( const SwFmtURL& );
+
+ virtual ~SwFmtURL();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ void SetTargetFrameName( const String& rStr ) { sTargetFrameName = rStr; }
+ void SetURL( const String &rURL, sal_Bool bServerMap );
+ void SetMap( const ImageMap *pM ); //Pointer wird kopiert!
+
+ const String &GetTargetFrameName()const { return sTargetFrameName; }
+ const String &GetURL() const { return sURL; }
+ sal_Bool IsServerMap() const { return bIsServerMap; }
+ const ImageMap *GetMap() const { return pMap; }
+ ImageMap *GetMap() { return pMap; }
+
+ const String& GetName() const { return sName; }
+ void SetName( const String& rNm ) { sName = rNm; }
+};
+
+
+inline const SwFmtURL &SwAttrSet::GetURL(sal_Bool bInP) const
+ { return (const SwFmtURL&)Get( RES_URL,bInP); }
+
+inline const SwFmtURL &SwFmt::GetURL(sal_Bool bInP) const
+ { return aSet.GetURL(bInP); }
+
+#endif
+
diff --git a/sw/inc/fmtwrapinfluenceonobjpos.hxx b/sw/inc/fmtwrapinfluenceonobjpos.hxx
new file mode 100644
index 000000000000..1959ff1abf9f
--- /dev/null
+++ b/sw/inc/fmtwrapinfluenceonobjpos.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FMTWRAPINFLUENCEONOBJPOS_HXX
+#define _FMTWRAPINFLUENCEONOBJPOS_HXX
+
+#include <hintids.hxx>
+#include <format.hxx>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/text/WrapInfluenceOnPosition.hpp>
+
+class SW_DLLPUBLIC SwFmtWrapInfluenceOnObjPos: public SfxPoolItem
+{
+private:
+ sal_Int16 mnWrapInfluenceOnPosition;
+
+public:
+ TYPEINFO();
+
+ // --> OD 2004-10-18 #i35017# - constant name has changed
+ SwFmtWrapInfluenceOnObjPos(
+ sal_Int16 _nWrapInfluenceOnPosition =
+ com::sun::star::text::WrapInfluenceOnPosition::ONCE_CONCURRENT );
+ // <--
+ SwFmtWrapInfluenceOnObjPos(
+ const SwFmtWrapInfluenceOnObjPos& _rCpy );
+ ~SwFmtWrapInfluenceOnObjPos();
+
+ SwFmtWrapInfluenceOnObjPos& operator=(
+ const SwFmtWrapInfluenceOnObjPos& _rSource );
+
+ // pure virtual methods of class <SfxPoolItem>
+ virtual int operator==( const SfxPoolItem& _rAttr ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ // direct accessors to data
+ void SetWrapInfluenceOnObjPos( sal_Int16 _nWrapInfluenceOnPosition );
+ // --> OD 2004-10-18 #i35017# - add parameter <_bIterativeAsOnceConcurrent>
+ // to control, if value <ITERATIVE> has to be treated as <ONCE_CONCURRENT>
+ sal_Int16 GetWrapInfluenceOnObjPos(
+ const bool _bIterativeAsOnceConcurrent = false ) const;
+ // <--
+};
+
+inline const SwFmtWrapInfluenceOnObjPos& SwAttrSet::GetWrapInfluenceOnObjPos(sal_Bool bInP) const
+ { return (const SwFmtWrapInfluenceOnObjPos&)Get( RES_WRAP_INFLUENCE_ON_OBJPOS,bInP); }
+
+ inline const SwFmtWrapInfluenceOnObjPos& SwFmt::GetWrapInfluenceOnObjPos(sal_Bool bInP) const
+ { return aSet.GetWrapInfluenceOnObjPos(bInP); }
+
+#endif
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
new file mode 100644
index 000000000000..b553c9eadbd2
--- /dev/null
+++ b/sw/inc/format.hxx
@@ -0,0 +1,355 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FORMAT_HXX
+#define _FORMAT_HXX
+
+#include <tools/solar.h>
+#include "swdllapi.h"
+#include <errhdl.hxx> // fuer ASSERT
+#include <swatrset.hxx> // fuer SfxItemPool/-Set, Attr forward decl.
+#include <calbck.hxx> // fuer SwModify
+#include <hintids.hxx>
+
+class IDocumentSettingAccess;
+class IDocumentDrawModelAccess;
+class IDocumentLayoutAccess;
+class IDocumentTimerAccess;
+class IDocumentFieldsAccess;
+class IDocumentChartDataProviderAccess;
+class SwDoc;
+
+class SW_DLLPUBLIC SwFmt : public SwModify
+{
+ String aFmtName;
+ SwAttrSet aSet;
+
+ sal_uInt16 nWhichId;
+ sal_uInt16 nFmtId; // Format-ID fuer Lesen/Schreiben
+ sal_uInt16 nPoolFmtId; // Id-fuer "automatich" erzeugte Formate
+ // (ist keine harte Attributierung !!)
+ sal_uInt16 nPoolHelpId; // HelpId fuer diese Pool-Vorlage
+ sal_uInt8 nPoolHlpFileId; // FilePos ans Doc auf die Vorlagen-Hilfen
+ sal_Bool bWritten : 1; // sal_True: bereits geschrieben
+ sal_Bool bAutoFmt : 1; // sal_False: es handelt sich um eine Vorlage
+ // ist dflt immer auf sal_True !
+ sal_Bool bFmtInDTOR : 1; // sal_True: das Format wird geloscht. Damit man in
+ // der FmtChg-Message das erkennen kann!!!
+ sal_Bool bAutoUpdateFmt : 1; // sal_True: am Format werden die Attribute
+ // eines kompletten Absatzes gesetzt (UI-seitig!)
+
+protected:
+ SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+ const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich );
+ SwFmt( SwAttrPool& rPool, const String &rFmtNm, const sal_uInt16* pWhichRanges,
+ SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich );
+ SwFmt( const SwFmt& rFmt );
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue );
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+
+ virtual ~SwFmt();
+ SwFmt &operator=(const SwFmt&);
+
+ // fuer die Abfrage der Writer-Funktionen
+ sal_uInt16 Which() const { return nWhichId; }
+
+ // erfrage vom Format Informationen
+ virtual sal_Bool GetInfo( SfxPoolItem& ) const;
+
+ // kopiere Attribute; auch ueber Dokumentgrenzen hinweg
+ void CopyAttrs( const SwFmt&, sal_Bool bReplace=sal_True );
+
+ // loesche alle Attribute, die nicht in rFmt stehen
+ void DelDiffs( const SfxItemSet& rSet );
+ void DelDiffs( const SwFmt& rFmt ) { DelDiffs( rFmt.GetAttrSet() ); }
+
+ // Umhaengen des Formats (0 = Default)
+ sal_Bool SetDerivedFrom(SwFmt *pDerivedFrom = 0);
+
+ // Ist bInParents sal_False,
+ // wird nur in diesem Format nach dem Attribut gesucht.
+ inline const SfxPoolItem& GetFmtAttr( sal_uInt16 nWhich,
+ sal_Bool bInParents = sal_True ) const;
+ inline SfxItemState GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent = sal_True,
+ const SfxPoolItem **ppItem = 0 ) const;
+ // --> OD 2008-03-03 #refactorlists#
+ // methods renamed and made virtual
+ virtual sal_Bool SetFmtAttr( const SfxPoolItem& rAttr );
+ virtual sal_Bool SetFmtAttr( const SfxItemSet& rSet );
+ virtual sal_Bool ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
+ // <--
+
+ // --> OD 2007-01-24 #i73790#
+ // Method renamed and made virtual
+ // Nimmt alle Hints aus dem Delta-Array,
+ // liefert die Anzahl der geloeschten Hints
+ virtual sal_uInt16 ResetAllFmtAttr();
+ // <--
+
+ inline SwFmt* DerivedFrom() const { return (SwFmt*)GetRegisteredIn(); }
+ inline sal_Bool IsDefault() const { return DerivedFrom() == 0; }
+
+ inline const String& GetName() const { return aFmtName; }
+ void SetName( const String& rNewName, sal_Bool bBroadcast=sal_False );
+ inline void SetName( const sal_Char* pNewName,
+ sal_Bool bBroadcast=sal_False);
+
+ // zur Abfrage des Attribute Arrays
+ inline const SwAttrSet& GetAttrSet() const { return aSet; }
+
+ // Das Doc wird jetzt am SwAttrPool gesetzt. Dadurch hat man es immer
+ // im Zugriff.
+ const SwDoc *GetDoc() const { return aSet.GetDoc(); }
+ SwDoc *GetDoc() { return aSet.GetDoc(); }
+
+ /** Provides access to the document settings interface
+ */
+ const IDocumentSettingAccess* getIDocumentSettingAccess() const;
+
+ /** Provides access to the document draw model interface
+ */
+ const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
+ IDocumentDrawModelAccess* getIDocumentDrawModelAccess();
+
+ /** Provides access to the document layout interface
+ */
+ const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
+ IDocumentLayoutAccess* getIDocumentLayoutAccess();
+
+ /** Provides access to the document idle timer interface
+ */
+ IDocumentTimerAccess* getIDocumentTimerAccess();
+
+ /** Provides access to the document idle timer interface
+ */
+ IDocumentFieldsAccess* getIDocumentFieldsAccess();
+
+ /** gives access to the chart data-provider
+ */
+ IDocumentChartDataProviderAccess* getIDocumentChartDataProviderAccess();
+
+ // erfragen und setzen der Poolvorlagen-Id's
+ sal_uInt16 GetPoolFmtId() const { return nPoolFmtId; }
+ void SetPoolFmtId( sal_uInt16 nId ) { nPoolFmtId = nId; }
+
+ // erfragen und setzen der Hilfe-Id's fuer die Document-Vorlagen
+ sal_uInt16 GetPoolHelpId() const { return nPoolHelpId; }
+ void SetPoolHelpId( sal_uInt16 nId ) { nPoolHelpId = nId; }
+ sal_uInt8 GetPoolHlpFileId() const { return nPoolHlpFileId; }
+ void SetPoolHlpFileId( sal_uInt8 nId ) { nPoolHlpFileId = nId; }
+ // erfrage die Attribut-Beschreibung, returnt den reingereichten String
+ void GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText ) const
+ { aSet.GetPresentation( ePres, eCoreMetric, ePresMetric, rText ); }
+ // Das Format-ID fuer Lesen/Schreiben:
+ void ResetWritten() { bWritten = sal_False; }
+
+ // Abfragen/Setzen vom AutoFmt-Flag
+ sal_Bool IsAuto() const { return bAutoFmt; }
+ void SetAuto( sal_Bool bNew = sal_False ) { bAutoFmt = bNew; }
+
+ // Abfragen/Setzen vom bAutoUpdateFmt-Flag
+ sal_Bool IsAutoUpdateFmt() const { return bAutoUpdateFmt; }
+ void SetAutoUpdateFmt( sal_Bool bNew = sal_True ) { bAutoUpdateFmt = bNew; }
+
+ sal_Bool IsFmtInDTOR() const { return bFmtInDTOR; }
+
+ // GetMethoden: das Bool gibt an, ob nur im Set (sal_False) oder auch in
+ // den Parents gesucht werden soll. Wird nichts gefunden,
+ // wird das deflt. Attribut returnt.
+ // Charakter-Attribute - impl. steht im charatr.hxx
+ // AMA 12.10.94: Umstellung von SwFmt... auf Svx...
+ inline const SvxPostureItem &GetPosture( sal_Bool = sal_True ) const;
+ inline const SvxWeightItem &GetWeight( sal_Bool = sal_True ) const;
+ inline const SvxShadowedItem &GetShadowed( sal_Bool = sal_True ) const;
+ inline const SvxAutoKernItem &GetAutoKern( sal_Bool = sal_True ) const;
+ inline const SvxWordLineModeItem &GetWordLineMode( sal_Bool = sal_True ) const;
+ inline const SvxContourItem &GetContour( sal_Bool = sal_True ) const;
+ inline const SvxKerningItem &GetKerning( sal_Bool = sal_True ) const;
+ inline const SvxUnderlineItem &GetUnderline( sal_Bool = sal_True ) const;
+ inline const SvxOverlineItem &GetOverline( sal_Bool = sal_True ) const;
+ inline const SvxCrossedOutItem &GetCrossedOut( sal_Bool = sal_True ) const;
+ inline const SvxFontHeightItem &GetSize( sal_Bool = sal_True ) const;
+ inline const SvxPropSizeItem &GetPropSize( sal_Bool = sal_True ) const;
+ inline const SvxFontItem &GetFont( sal_Bool = sal_True ) const;
+ inline const SvxColorItem &GetColor( sal_Bool = sal_True ) const;
+ inline const SvxCharSetColorItem &GetCharSetColor( sal_Bool = sal_True ) const;
+ inline const SvxLanguageItem &GetLanguage( sal_Bool = sal_True ) const;
+ inline const SvxEscapementItem &GetEscapement( sal_Bool = sal_True ) const;
+ inline const SvxCaseMapItem &GetCaseMap( sal_Bool = sal_True ) const;
+ inline const SvxNoHyphenItem &GetNoHyphenHere( sal_Bool = sal_True ) const;
+ inline const SvxBlinkItem &GetBlink( sal_Bool = sal_True ) const;
+ inline const SvxBrushItem &GetChrBackground( sal_Bool = sal_True ) const;
+
+ inline const SvxFontItem &GetCJKFont( sal_Bool = sal_True ) const;
+ inline const SvxFontHeightItem &GetCJKSize( sal_Bool = sal_True ) const;
+ inline const SvxLanguageItem &GetCJKLanguage( sal_Bool = sal_True ) const;
+ inline const SvxPostureItem &GetCJKPosture( sal_Bool = sal_True ) const;
+ inline const SvxWeightItem &GetCJKWeight( sal_Bool = sal_True ) const;
+ inline const SvxFontItem &GetCTLFont( sal_Bool = sal_True ) const;
+ inline const SvxFontHeightItem &GetCTLSize( sal_Bool = sal_True ) const;
+ inline const SvxLanguageItem &GetCTLLanguage( sal_Bool = sal_True ) const;
+ inline const SvxPostureItem &GetCTLPosture( sal_Bool = sal_True ) const;
+ inline const SvxWeightItem &GetCTLWeight( sal_Bool = sal_True ) const;
+ inline const SfxBoolItem &GetWritingDirection( sal_Bool = sal_True ) const;
+ inline const SvxEmphasisMarkItem &GetEmphasisMark( sal_Bool = sal_True ) const;
+ inline const SvxTwoLinesItem &Get2Lines( sal_Bool = sal_True ) const;
+ inline const SvxCharScaleWidthItem &GetCharScaleW( sal_Bool = sal_True ) const;
+ inline const SvxCharRotateItem &GetCharRotate( sal_Bool = sal_True ) const;
+ inline const SvxCharReliefItem &GetCharRelief( sal_Bool = sal_True ) const;
+ inline const SvxCharHiddenItem &GetCharHidden( sal_Bool = sal_True ) const;
+
+ // Frame-Attribute - impl. steht im frmatr.hxx,
+ inline const SwFmtFillOrder &GetFillOrder( sal_Bool = sal_True ) const;
+ inline const SwFmtFrmSize &GetFrmSize( sal_Bool = sal_True ) const;
+ inline const SwFmtHeader &GetHeader( sal_Bool = sal_True ) const;
+ inline const SwFmtFooter &GetFooter( sal_Bool = sal_True ) const;
+ inline const SwFmtSurround &GetSurround( sal_Bool = sal_True ) const;
+ inline const SwFmtHoriOrient &GetHoriOrient( sal_Bool = sal_True ) const;
+ inline const SwFmtAnchor &GetAnchor( sal_Bool = sal_True ) const;
+ inline const SwFmtCol &GetCol( sal_Bool = sal_True ) const;
+ inline const SvxPaperBinItem &GetPaperBin( sal_Bool = sal_True ) const;
+ inline const SvxLRSpaceItem &GetLRSpace( sal_Bool = sal_True ) const;
+ inline const SvxULSpaceItem &GetULSpace( sal_Bool = sal_True ) const;
+ inline const SwFmtCntnt &GetCntnt( sal_Bool = sal_True ) const;
+ inline const SvxPrintItem &GetPrint( sal_Bool = sal_True ) const;
+ inline const SvxOpaqueItem &GetOpaque( sal_Bool = sal_True ) const;
+ inline const SvxProtectItem &GetProtect( sal_Bool = sal_True ) const;
+ inline const SwFmtVertOrient &GetVertOrient( sal_Bool = sal_True ) const;
+ inline const SvxBoxItem &GetBox( sal_Bool = sal_True ) const;
+ inline const SvxFmtKeepItem &GetKeep( sal_Bool = sal_True ) const;
+ inline const SvxBrushItem &GetBackground( sal_Bool = sal_True ) const;
+ inline const SvxShadowItem &GetShadow( sal_Bool = sal_True ) const;
+ inline const SwFmtPageDesc &GetPageDesc( sal_Bool = sal_True ) const;
+ inline const SvxFmtBreakItem &GetBreak( sal_Bool = sal_True ) const;
+ inline const SvxMacroItem &GetMacro( sal_Bool = sal_True ) const;
+ inline const SwFmtURL &GetURL( sal_Bool = sal_True ) const;
+ inline const SwFmtEditInReadonly &GetEditInReadonly( sal_Bool = sal_True ) const;
+ inline const SwFmtLayoutSplit &GetLayoutSplit( sal_Bool = sal_True ) const;
+ inline const SwFmtRowSplit &GetRowSplit( sal_Bool = sal_True ) const;
+ inline const SwFmtChain &GetChain( sal_Bool = sal_True ) const;
+ inline const SwFmtLineNumber &GetLineNumber( sal_Bool = sal_True ) const;
+ inline const SwFmtFtnAtTxtEnd &GetFtnAtTxtEnd( sal_Bool = sal_True ) const;
+ inline const SwFmtEndAtTxtEnd &GetEndAtTxtEnd( sal_Bool = sal_True ) const;
+ inline const SwFmtNoBalancedColumns &GetBalancedColumns( sal_Bool = sal_True ) const;
+ inline const SvxFrameDirectionItem &GetFrmDir( sal_Bool = sal_True ) const;
+ inline const SwTextGridItem &GetTextGrid( sal_Bool = sal_True ) const;
+ inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( sal_Bool = sal_True ) const;
+ // OD 18.09.2003 #i18732#
+ inline const SwFmtFollowTextFlow &GetFollowTextFlow(sal_Bool = sal_True) const;
+ // OD 2004-05-05 #i28701#
+ inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const;
+
+ // Grafik-Attribute - impl. steht im grfatr.hxx
+ inline const SwMirrorGrf &GetMirrorGrf( sal_Bool = sal_True ) const;
+ inline const SwCropGrf &GetCropGrf( sal_Bool = sal_True ) const;
+ inline const SwRotationGrf &GetRotationGrf(sal_Bool = sal_True ) const;
+ inline const SwLuminanceGrf &GetLuminanceGrf(sal_Bool = sal_True ) const;
+ inline const SwContrastGrf &GetContrastGrf(sal_Bool = sal_True ) const;
+ inline const SwChannelRGrf &GetChannelRGrf(sal_Bool = sal_True ) const;
+ inline const SwChannelGGrf &GetChannelGGrf(sal_Bool = sal_True ) const;
+ inline const SwChannelBGrf &GetChannelBGrf(sal_Bool = sal_True ) const;
+ inline const SwGammaGrf &GetGammaGrf(sal_Bool = sal_True ) const;
+ inline const SwInvertGrf &GetInvertGrf(sal_Bool = sal_True ) const;
+ inline const SwTransparencyGrf &GetTransparencyGrf(sal_Bool = sal_True ) const;
+ inline const SwDrawModeGrf &GetDrawModeGrf(sal_Bool = sal_True ) const;
+
+ // Paragraph-Attribute - impl. steht im paratr.hxx
+ inline const SvxLineSpacingItem &GetLineSpacing( sal_Bool = sal_True ) const;
+ inline const SvxAdjustItem &GetAdjust( sal_Bool = sal_True ) const;
+ inline const SvxFmtSplitItem &GetSplit( sal_Bool = sal_True ) const;
+ inline const SwRegisterItem &GetRegister( sal_Bool = sal_True ) const;
+ inline const SwNumRuleItem &GetNumRule( sal_Bool = sal_True ) const;
+ inline const SvxWidowsItem &GetWidows( sal_Bool = sal_True ) const;
+ inline const SvxOrphansItem &GetOrphans( sal_Bool = sal_True ) const;
+ inline const SvxTabStopItem &GetTabStops( sal_Bool = sal_True ) const;
+ inline const SvxHyphenZoneItem &GetHyphenZone( sal_Bool = sal_True ) const;
+ inline const SwFmtDrop &GetDrop( sal_Bool = sal_True ) const;
+ inline const SvxScriptSpaceItem &GetScriptSpace(sal_Bool = sal_True) const;
+ inline const SvxHangingPunctuationItem &GetHangingPunctuation(sal_Bool = sal_True) const;
+ inline const SvxForbiddenRuleItem &GetForbiddenRule(sal_Bool = sal_True) const;
+ inline const SvxParaVertAlignItem &GetParaVertAlign(sal_Bool = sal_True) const;
+ inline const SvxParaGridItem &GetParaGrid(sal_Bool = sal_True) const;
+ inline const SwParaConnectBorderItem &GetParaConnectBorder(sal_Bool = sal_True ) const;
+
+ // TabellenBox-Attribute - impl. steht im cellatr.hxx
+ inline const SwTblBoxNumFormat &GetTblBoxNumFmt( sal_Bool = sal_True ) const;
+ inline const SwTblBoxFormula &GetTblBoxFormula( sal_Bool = sal_True ) const;
+ inline const SwTblBoxValue &GetTblBoxValue( sal_Bool = sal_True ) const;
+
+ /** SwFmt::IsBackgroundTransparent - for feature #99657#
+
+ OD 22.08.2002
+ Virtual method to determine, if background of format is transparent.
+ Default implementation returns false. Thus, subclasses have to overload
+ method, if the specific subclass can have a transparent background.
+
+ @author OD
+
+ @return false, default implementation
+ */
+ virtual sal_Bool IsBackgroundTransparent() const;
+
+ /** SwFmt::IsShadowTransparent - for feature #99657#
+
+ OD 22.08.2002
+ Virtual method to determine, if shadow of format is transparent.
+ Default implementation returns false. Thus, subclasses have to overload
+ method, if the specific subclass can have a transparent shadow.
+
+ @author OD
+
+ @return false, default implementation
+ */
+ virtual sal_Bool IsShadowTransparent() const;
+};
+
+// --------------- inline Implementierungen ------------------------
+
+inline const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich,
+ sal_Bool bInParents ) const
+{
+ return aSet.Get( nWhich, bInParents );
+}
+
+inline void SwFmt::SetName( const sal_Char* pNewName,
+ sal_Bool bBroadcast )
+{
+ String aTmp( String::CreateFromAscii( pNewName ) );
+ SetName( aTmp, bBroadcast );
+}
+
+inline SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent,
+ const SfxPoolItem **ppItem ) const
+{
+ return aSet.GetItemState( nWhich, bSrchInParent, ppItem );
+}
+
+#undef inline
+
+#endif // _FORMAT_HXX
diff --git a/sw/inc/frmatr.hxx b/sw/inc/frmatr.hxx
new file mode 100644
index 000000000000..94deef35e018
--- /dev/null
+++ b/sw/inc/frmatr.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FRMATR_HXX
+#define _FRMATR_HXX
+
+#include <hintids.hxx> //die Ids der Attribute, vor frmitems damit die
+#include <format.hxx> //fuer Implementierung der inlines
+
+//------------------------ Inlines ---------------------------------
+
+
+/******************************************************************************
+ * Implementierung der FrameAttribut Methoden vom SwAttrSet
+ ******************************************************************************/
+
+inline const SvxPaperBinItem &SwAttrSet::GetPaperBin(sal_Bool bInP) const
+ { return (const SvxPaperBinItem&)Get( RES_PAPER_BIN,bInP); }
+inline const SvxLRSpaceItem &SwAttrSet::GetLRSpace(sal_Bool bInP) const
+ { return (const SvxLRSpaceItem&)Get( RES_LR_SPACE,bInP); }
+inline const SvxULSpaceItem &SwAttrSet::GetULSpace(sal_Bool bInP) const
+ { return (const SvxULSpaceItem&)Get( RES_UL_SPACE,bInP); }
+inline const SvxPrintItem &SwAttrSet::GetPrint(sal_Bool bInP) const
+ { return (const SvxPrintItem&)Get( RES_PRINT,bInP); }
+inline const SvxOpaqueItem &SwAttrSet::GetOpaque(sal_Bool bInP) const
+ { return (const SvxOpaqueItem&)Get( RES_OPAQUE,bInP); }
+inline const SvxProtectItem &SwAttrSet::GetProtect(sal_Bool bInP) const
+ { return (const SvxProtectItem&)Get( RES_PROTECT,bInP); }
+inline const SvxBoxItem &SwAttrSet::GetBox(sal_Bool bInP) const
+ { return (const SvxBoxItem&)Get( RES_BOX,bInP); }
+inline const SvxFmtKeepItem &SwAttrSet::GetKeep(sal_Bool bInP) const
+ { return (const SvxFmtKeepItem&)Get( RES_KEEP,bInP); }
+inline const SvxBrushItem &SwAttrSet::GetBackground(sal_Bool bInP) const
+ { return (const SvxBrushItem&)Get( RES_BACKGROUND,bInP); }
+inline const SvxShadowItem &SwAttrSet::GetShadow(sal_Bool bInP) const
+ { return (const SvxShadowItem&)Get( RES_SHADOW,bInP); }
+inline const SvxFmtBreakItem &SwAttrSet::GetBreak(sal_Bool bInP) const
+ { return (const SvxFmtBreakItem&)Get( RES_BREAK,bInP); }
+inline const SvxMacroItem &SwAttrSet::GetMacro(sal_Bool bInP) const
+ { return (const SvxMacroItem&)Get( RES_FRMMACRO,bInP); }
+inline const SvxFrameDirectionItem &SwAttrSet::GetFrmDir(sal_Bool bInP) const
+ { return (const SvxFrameDirectionItem&)Get( RES_FRAMEDIR,bInP); }
+
+
+/******************************************************************************
+ * Implementierung der FrameAttribut Methoden vom SwFmt
+ ******************************************************************************/
+
+inline const SvxPaperBinItem &SwFmt::GetPaperBin(sal_Bool bInP) const
+ { return aSet.GetPaperBin(bInP); }
+inline const SvxLRSpaceItem &SwFmt::GetLRSpace(sal_Bool bInP) const
+ { return aSet.GetLRSpace(bInP); }
+inline const SvxULSpaceItem &SwFmt::GetULSpace(sal_Bool bInP) const
+ { return aSet.GetULSpace(bInP); }
+inline const SvxPrintItem &SwFmt::GetPrint(sal_Bool bInP) const
+ { return aSet.GetPrint(bInP); }
+inline const SvxOpaqueItem &SwFmt::GetOpaque(sal_Bool bInP) const
+ { return aSet.GetOpaque(bInP); }
+inline const SvxProtectItem &SwFmt::GetProtect(sal_Bool bInP) const
+ { return aSet.GetProtect(bInP); }
+inline const SvxBoxItem &SwFmt::GetBox(sal_Bool bInP) const
+ { return aSet.GetBox(bInP); }
+inline const SvxFmtKeepItem &SwFmt::GetKeep(sal_Bool bInP) const
+ { return aSet.GetKeep(bInP); }
+inline const SvxBrushItem &SwFmt::GetBackground(sal_Bool bInP) const
+ { return aSet.GetBackground(bInP); }
+inline const SvxShadowItem &SwFmt::GetShadow(sal_Bool bInP) const
+ { return aSet.GetShadow(bInP); }
+inline const SvxFmtBreakItem &SwFmt::GetBreak(sal_Bool bInP) const
+ { return aSet.GetBreak(bInP); }
+inline const SvxMacroItem &SwFmt::GetMacro(sal_Bool bInP) const
+ { return aSet.GetMacro(bInP); }
+inline const SvxFrameDirectionItem &SwFmt::GetFrmDir(sal_Bool bInP) const
+ { return aSet.GetFrmDir(bInP); }
+
+#endif //_FRMATR_HXX
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
new file mode 100644
index 000000000000..526ee8f9a6de
--- /dev/null
+++ b/sw/inc/frmfmt.hxx
@@ -0,0 +1,329 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FRMFMT_HXX
+#define _FRMFMT_HXX
+
+#include <com/sun/star/text/PositionLayoutDir.hpp>
+#include <cppuhelper/weakref.hxx>
+#include <tools/gen.hxx>
+#include <format.hxx>
+#include "swdllapi.h"
+
+class SwFlyFrm;
+class SwAnchoredObject;
+class Graphic;
+class Point;
+class ImageMap;
+class IMapObject;
+class SwRect;
+class SwContact;
+class SdrObject;
+
+class SW_DLLPUBLIC SwFrmFmt: public SwFmt
+{
+ friend class SwDoc;
+ friend class SwPageDesc; //darf den protected CTor rufen.
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::uno::XInterface> m_wXObject;
+
+protected:
+ SwFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+ SwFrmFmt *pDrvdFrm, sal_uInt16 nFmtWhich = RES_FRMFMT,
+ const sal_uInt16* pWhichRange = 0 )
+ : SwFmt( rPool, pFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange),
+ pDrvdFrm, nFmtWhich )
+ {}
+
+ SwFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
+ SwFrmFmt *pDrvdFrm, sal_uInt16 nFmtWhich = RES_FRMFMT,
+ const sal_uInt16* pWhichRange = 0 )
+ : SwFmt( rPool, rFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange),
+ pDrvdFrm, nFmtWhich )
+ {}
+
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue );
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+
+ //Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt).
+ virtual void DelFrms();
+
+ //Erzeugt die Ansichten
+ virtual void MakeFrms();
+
+ virtual Graphic MakeGraphic( ImageMap* pMap = NULL );
+
+ // returnt das IMapObject, das an dem Format (Fly), in der ImageMap
+ // an der Point Position definiert ist.
+ // rPoint - teste auf der DocPosition
+ // pFly - optionaler FlyFrame, falls der schon bekannt ist.
+ IMapObject* GetIMapObject( const Point& rPoint,
+ const SwFlyFrm *pFly = 0 ) const;
+
+ // Gibt die tatsaechlche Groesse des Frames zurueck bzw. ein leeres
+ // Rechteck, wenn kein Layout existiert. Wird pPoint angegeben, dann
+ // wird der am dichtesten liegende Frame gesucht.
+ SwRect FindLayoutRect( const sal_Bool bPrtArea = sal_False,
+ const Point* pPoint = 0,
+ const sal_Bool bCalcFrm = sal_False ) const;
+
+ // Sucht das SdrObject. Der SdrObjUserCall ist Client vom Format.
+ // Der UserCall kennt sein SdrObject.
+ SwContact *FindContactObj();
+ const SwContact *FindContactObj() const
+ { return ((SwFrmFmt*)this)->FindContactObj(); }
+
+ // returns the SdrObject, that ist connected to the ContactObject.
+ // Only DrawFrmFmts are connected to the "real SdrObject". FlyFrmFmts
+ // are connected to a Master and all FlyFrms has the "real SdrObject".
+ // "Real SdrObject" has position and a Z-order.
+ SdrObject *FindSdrObject();
+ const SdrObject *FindSdrObject() const
+ { return ((SwFrmFmt*)this)->FindSdrObject(); }
+
+ SdrObject *FindRealSdrObject();
+ const SdrObject *FindRealSdrObject() const
+ { return ((SwFrmFmt*)this)->FindRealSdrObject(); }
+
+ sal_Bool IsLowerOf( const SwFrmFmt& rFmt ) const;
+
+ // --> OD 2004-07-27 #i31698#
+ enum tLayoutDir
+ {
+ HORI_L2R,
+ HORI_R2L,
+ VERT_R2L,
+ VERT_L2R // not supported yet
+ };
+
+ virtual SwFrmFmt::tLayoutDir GetLayoutDir() const;
+ virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir );
+ // <--
+
+ // --> OD 2004-08-06 #i28749#
+ virtual sal_Int16 GetPositionLayoutDir() const;
+ virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir );
+ // <--
+
+ virtual String GetDescription() const;
+
+ SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::uno::XInterface> const& GetXObject() const
+ { return m_wXObject; }
+ SW_DLLPRIVATE void SetXObject(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface> const& xObject)
+ { m_wXObject = xObject; }
+
+ DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt)
+ void RegisterToFormat( SwFmt& rFmt );
+};
+
+//Das FlyFrame-Format ------------------------------
+
+class SW_DLLPUBLIC SwFlyFrmFmt: public SwFrmFmt
+{
+ friend class SwDoc;
+
+ // #i972:
+ // it stores the previous position of Prt rectangle from RequestObjectResize
+ // so it can be used to move frames of non-resizable objects to align them correctly
+ // when they get borders (this is done in SwWrtShell::CalcAndGetScale)
+ Point m_aLastFlyFrmPrtRectPos;
+
+ //Beide nicht vorhanden.
+ SwFlyFrmFmt( const SwFlyFrmFmt &rCpy );
+ SwFlyFrmFmt &operator=( const SwFlyFrmFmt &rCpy );
+
+protected:
+ SwFlyFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+ SwFrmFmt *pDrvdFrm )
+ : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FLYFRMFMT )
+ {}
+ SwFlyFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
+ SwFrmFmt *pDrvdFrm )
+ : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FLYFRMFMT )
+ {}
+
+public:
+ TYPEINFO();
+ ~SwFlyFrmFmt();
+
+ //Erzeugt die Ansichten
+ virtual void MakeFrms();
+
+ SwFlyFrm* GetFrm( const Point* pDocPos = 0,
+ const sal_Bool bCalcFrm = sal_False ) const;
+
+ SwAnchoredObject* GetAnchoredObj( const Point* pDocPos = 0,
+ const sal_Bool bCalcFrm = sal_False ) const;
+
+ virtual Graphic MakeGraphic( ImageMap* pMap = NULL );
+
+ virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
+
+ // --> OD 2009-07-14 #i73249#
+ const String GetObjTitle() const;
+ void SetObjTitle( const String& rTitle,
+ bool bBroadcast = false );
+ const String GetObjDescription() const;
+ void SetObjDescription( const String& rDescription,
+ bool bBroadcast = false );
+ // <--
+
+ /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657#
+
+ OD 22.08.2002 - overloading virtual method and its default implementation,
+ because format of fly frame provides transparent backgrounds.
+ Method determines, if background of fly frame is transparent.
+
+ @author OD
+
+ @return true, if background color is transparent, but not "no fill"
+ or a existing background graphic is transparent.
+ */
+ virtual sal_Bool IsBackgroundTransparent() const;
+
+ /** SwFlyFrmFmt::IsBackgroundBrushInherited - for #103898#
+
+ OD 08.10.2002 - method to determine, if the brush for drawing the
+ background is "inherited" from its parent/grandparent.
+ This is the case, if no background graphic is set and the background
+ color is "no fill"/"auto fill"
+
+ @author OD
+
+ @return true, if background brush is "inherited" from parent/grandparent
+ */
+ sal_Bool IsBackgroundBrushInherited() const;
+
+ const Point & GetLastFlyFrmPrtRectPos() const { return m_aLastFlyFrmPrtRectPos; }
+ void SetLastFlyFrmPrtRectPos( const Point &rPoint ) { m_aLastFlyFrmPrtRectPos = rPoint; }
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwFlyFrmFmt)
+};
+
+//Das DrawFrame-Format -----------------------------
+
+class SW_DLLPUBLIC SwDrawFrmFmt: public SwFrmFmt
+{
+ friend class SwDoc;
+
+ mutable const SdrObject * pSdrObjCached;
+ mutable String sSdrObjCachedComment;
+
+ //Beide nicht vorhanden.
+ SwDrawFrmFmt( const SwDrawFrmFmt &rCpy );
+ SwDrawFrmFmt &operator=( const SwDrawFrmFmt &rCpy );
+
+ // --> OD 2004-07-27 #i31698#
+ SwFrmFmt::tLayoutDir meLayoutDir;
+ // <--
+ // --> OD 2004-08-06 #i28749#
+ sal_Int16 mnPositionLayoutDir;
+ // <--
+ // --> OD 2005-03-11 #i44334#, #i44681#
+ bool mbPosAttrSet;
+ // <--
+protected:
+ SwDrawFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+ SwFrmFmt *pDrvdFrm )
+ : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_DRAWFRMFMT ),
+ pSdrObjCached(NULL),
+ // --> OD 2004-07-28 #i31698#
+ meLayoutDir( SwFrmFmt::HORI_L2R ),
+ // <--
+ // --> OD 2004-08-06 #i28749#
+ // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010#
+ mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ),
+ // <--
+ // --> OD 2005-03-11 #i44334#, #i44681#
+ mbPosAttrSet( false )
+ // <--
+
+ {}
+ SwDrawFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
+ SwFrmFmt *pDrvdFrm )
+ : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_DRAWFRMFMT ),
+ pSdrObjCached(NULL),
+ // --> OD 2004-07-28 #i31698#
+ meLayoutDir( SwFrmFmt::HORI_L2R ),
+ // <--
+ // --> OD 2004-08-06 #i28749#
+ // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010#
+ mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ),
+ // <--
+ // --> OD 2005-03-11 #i44334#, #i44681#
+ mbPosAttrSet( false )
+ // <--
+ {}
+
+public:
+ TYPEINFO();
+ ~SwDrawFrmFmt();
+
+ //DrawObjecte werden aus den Arrays am Layout entfernt. Die DrawObjecte
+ //werden als geloescht gekennzeichnet.
+ virtual void DelFrms();
+
+ //Anmelden der DrawObjecte in den Arrays am Layout. Loeschkennzeichen
+ //werden zurueckgesetzt.
+ virtual void MakeFrms();
+
+ virtual Graphic MakeGraphic( ImageMap* pMap = NULL );
+
+ // --> OD 2004-07-27 #i31698#
+ virtual SwFrmFmt::tLayoutDir GetLayoutDir() const;
+ virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir );
+ // <--
+
+ // --> OD 2004-08-06 #i28749#
+ virtual sal_Int16 GetPositionLayoutDir() const;
+ virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir );
+ // <--
+
+ // --> OD 2005-03-11 #i44334#, #i44681#
+ inline bool IsPosAttrSet() const { return mbPosAttrSet; }
+ inline void PosAttrSet() { mbPosAttrSet = true; }
+ // <--
+
+ // --> OD 2005-08-16 #i53320#
+ inline void ResetPosAttr()
+ {
+ mbPosAttrSet = false;
+ }
+ // <--
+
+ virtual String GetDescription() const;
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwDrawFrmFmt);
+};
+
+
+#endif
+
diff --git a/sw/inc/ftnidx.hxx b/sw/inc/ftnidx.hxx
new file mode 100644
index 000000000000..9e645ee32e3c
--- /dev/null
+++ b/sw/inc/ftnidx.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FTNIDX_HXX
+#define _FTNIDX_HXX
+
+
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+
+class SwTxtFtn;
+class SwNodeIndex;
+class SwSectionNode;
+
+// ueberall, wo der NodeIndex gebraucht wird, werden die hier fehlenden
+// Headerfiles schon includes. Darum hier nur als define und nicht als
+// inline Methode (spart Compile-Zeit)
+#define _SwTxtFtn_GetIndex( pFIdx ) (pFIdx->GetTxtNode().GetIndex())
+
+
+typedef SwTxtFtn* SwTxtFtnPtr;
+SV_DECL_PTRARR_SORT( _SwFtnIdxs, SwTxtFtnPtr, 0, 10 )
+
+class SwFtnIdxs : public _SwFtnIdxs
+{
+public:
+ SwFtnIdxs() {}
+
+ void UpdateFtn( const SwNodeIndex& rStt ); // ab Pos. alle Updaten
+ void UpdateAllFtn(); // alle Fussnoten updaten
+
+ SwTxtFtn* SeekEntry( const SwNodeIndex& rIdx, sal_uInt16* pPos = 0 ) const;
+};
+
+
+class SwUpdFtnEndNtAtEnd
+{
+ SvPtrarr aFtnSects, aEndSects;
+ SvUShorts aFtnNums, aEndNums;
+
+public:
+ SwUpdFtnEndNtAtEnd() : aFtnSects( 0, 4 ), aEndSects( 0, 4 ),
+ aFtnNums( 0, 4 ), aEndNums( 0, 4 )
+ {}
+
+ static const SwSectionNode* FindSectNdWithEndAttr(
+ const SwTxtFtn& rTxtFtn );
+
+ sal_uInt16 GetNumber( const SwTxtFtn& rTxtFtn, const SwSectionNode& rNd );
+ sal_uInt16 ChkNumber( const SwTxtFtn& rTxtFtn );
+};
+
+
+
+#endif // _FTNIDX_HXX
+
diff --git a/sw/inc/ftninfo.hxx b/sw/inc/ftninfo.hxx
new file mode 100644
index 000000000000..ee208c428799
--- /dev/null
+++ b/sw/inc/ftninfo.hxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _FTNINFO_HXX
+#define _FTNINFO_HXX
+
+#include <tools/string.hxx>
+#include "swdllapi.h"
+#include <calbck.hxx>
+#include <editeng/numitem.hxx>
+
+class SwTxtFmtColl;
+class SwPageDesc;
+class SwCharFmt;
+class SwDoc;
+
+class SW_DLLPUBLIC SwEndNoteInfo : public SwClient
+{
+ SwDepend aPageDescDep;
+ SwDepend aCharFmtDep, aAnchorCharFmtDep;
+ String sPrefix;
+ String sSuffix;
+protected:
+ bool m_bEndNote;
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
+
+public:
+ SvxNumberType aFmt;
+ sal_uInt16 nFtnOffset;
+
+ void ChgPageDesc( SwPageDesc *pDesc );
+ SwPageDesc* GetPageDesc( SwDoc &rDoc ) const;
+ bool KnowsPageDesc() const;
+ bool DependsOn( const SwPageDesc* ) const;
+
+ void SetFtnTxtColl(SwTxtFmtColl& rColl);
+ SwTxtFmtColl* GetFtnTxtColl() const { return (SwTxtFmtColl*) GetRegisteredIn(); } // kann 0 sein
+
+ SwCharFmt* GetCharFmt(SwDoc &rDoc) const;
+ void SetCharFmt( SwCharFmt* );
+ SwClient *GetCharFmtDep() const { return (SwClient*)&aCharFmtDep; }
+
+ SwCharFmt* GetAnchorCharFmt(SwDoc &rDoc) const;
+ void SetAnchorCharFmt( SwCharFmt* );
+ SwClient *GetAnchorCharFmtDep() const { return (SwClient*)&aAnchorCharFmtDep; }
+
+ SwEndNoteInfo & operator=(const SwEndNoteInfo&);
+ sal_Bool operator==( const SwEndNoteInfo &rInf ) const;
+
+ SwEndNoteInfo( SwTxtFmtColl *pTxtColl = 0);
+ SwEndNoteInfo(const SwEndNoteInfo&);
+
+ const String& GetPrefix() const { return sPrefix; }
+ const String& GetSuffix() const { return sSuffix; }
+
+ void SetPrefix(const String& rSet) { sPrefix = rSet; }
+ void SetSuffix(const String& rSet) { sSuffix = rSet; }
+ void ReleaseCollection() { if ( GetRegisteredInNonConst() ) GetRegisteredInNonConst()->Remove( this ); }
+};
+
+enum SwFtnPos
+{
+ //Derzeit nur PAGE und CHAPTER. CHAPTER == Dokumentendenoten.
+ FTNPOS_PAGE = 1,
+ FTNPOS_CHAPTER = 8
+};
+
+enum SwFtnNum
+{
+ FTNNUM_PAGE, FTNNUM_CHAPTER, FTNNUM_DOC
+};
+
+class SW_DLLPUBLIC SwFtnInfo: public SwEndNoteInfo
+{
+ using SwEndNoteInfo::operator ==;
+
+public:
+ String aQuoVadis;
+ String aErgoSum;
+ SwFtnPos ePos;
+ SwFtnNum eNum;
+
+
+ SwFtnInfo& operator=(const SwFtnInfo&);
+
+ sal_Bool operator==( const SwFtnInfo &rInf ) const;
+
+ SwFtnInfo(SwTxtFmtColl* pTxtColl = 0);
+ SwFtnInfo(const SwFtnInfo&);
+};
+
+
+#endif
diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc
new file mode 100644
index 000000000000..b64494b847ae
--- /dev/null
+++ b/sw/inc/globals.hrc
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _GLOBALS_HRC
+#define _GLOBALS_HRC
+
+
+// Versions-Definition wie in solar.h und swtypes.hxx
+//#define SW_FILEFORMAT_40 3580
+
+#include "rcid.hrc"
+
+// STRINGS -----------------------------------------------------------
+
+#define STR_DLLNOTFOUND (RC_GLOBALS_BEGIN + 0)
+#define STR_FMT_STD (RC_GLOBALS_BEGIN + 1)
+#define STR_LOAD_GLOBAL_DOC (RC_GLOBALS_BEGIN + 2)
+
+#define STR_SEPARATOR (RC_GLOBALS_BEGIN + 4)
+
+
+#define STR_BASIC_IMPORT (RC_GLOBALS_BEGIN + 5)
+#define STR_BASIC_BEGIN (RC_GLOBALS_BEGIN + 6)
+#define STR_BASIC_END (RC_GLOBALS_BEGIN + 7)
+#define STR_BASIC_REC_LIB (RC_GLOBALS_BEGIN + 8)
+#define STR_TEMPLATE_WILDCARD (RC_GLOBALS_BEGIN + 9)
+#define STR_DOC_STAT (RC_GLOBALS_BEGIN + 10)
+
+#define STR_PAGE (RC_GLOBALS_BEGIN + 14)
+#define STR_PRINTOPTUI (RC_GLOBALS_BEGIN + 15)
+
+//EventStrings
+
+#define STR_EVENT_OBJECT_SELECT ( RC_GLOBALS_BEGIN + 17 )
+#define STR_EVENT_START_INS_GLOSSARY ( RC_GLOBALS_BEGIN + 18 )
+#define STR_EVENT_END_INS_GLOSSARY ( RC_GLOBALS_BEGIN + 19 )
+#define STR_EVENT_MOUSEOVER_OBJECT ( RC_GLOBALS_BEGIN + 20 )
+#define STR_EVENT_MOUSECLICK_OBJECT ( RC_GLOBALS_BEGIN + 21 )
+#define STR_EVENT_MOUSEOUT_OBJECT ( RC_GLOBALS_BEGIN + 22 )
+#define STR_EVENT_IMAGE_LOAD ( RC_GLOBALS_BEGIN + 23 )
+#define STR_EVENT_IMAGE_ABORT ( RC_GLOBALS_BEGIN + 24 )
+#define STR_EVENT_IMAGE_ERROR ( RC_GLOBALS_BEGIN + 25 )
+#define STR_EVENT_FRM_KEYINPUT_A ( RC_GLOBALS_BEGIN + 26 )
+#define STR_EVENT_FRM_KEYINPUT_NOA ( RC_GLOBALS_BEGIN + 27 )
+#define STR_EVENT_FRM_RESIZE ( RC_GLOBALS_BEGIN + 28 )
+#define STR_EVENT_FRM_MOVE ( RC_GLOBALS_BEGIN + 29 )
+
+// Strings fuer Rahmenausrichtungen im Popup
+#define STR_TOP_BASE (RC_GLOBALS_BEGIN + 30)
+#define STR_BOTTOM_BASE (RC_GLOBALS_BEGIN + 31)
+#define STR_CENTER_BASE (RC_GLOBALS_BEGIN + 32)
+#define STR_TOP (RC_GLOBALS_BEGIN + 33)
+#define STR_BOTTOM (RC_GLOBALS_BEGIN + 34)
+#define STR_CENTER_HORI (RC_GLOBALS_BEGIN + 35)
+#define STR_CENTER_VERT (RC_GLOBALS_BEGIN + 36)
+
+#define STR_LOAD_HTML_DOC (RC_GLOBALS_BEGIN + 37)
+
+#define STR_AUTH (RC_GLOBALS_BEGIN + 38)
+#define STR_TBL (RC_GLOBALS_BEGIN + 39)
+#define STR_TOO (RC_GLOBALS_BEGIN + 40)
+#define STR_TOILL (RC_GLOBALS_BEGIN + 41)
+
+// more Strings
+
+// BITMAPS -----------------------------------------------------------
+
+#define RES_TABL (RC_GLOBALS_BEGIN + 1)
+#define RES_TABR (RC_GLOBALS_BEGIN + 2)
+#define RES_TABD (RC_GLOBALS_BEGIN + 3)
+#define RES_TABC (RC_GLOBALS_BEGIN + 4)
+
+// DIALOGE -----------------------------------------------------------
+
+#define DLG_LISTBOX (RC_GLOBALS_BEGIN + 1)
+#define DLG_THESAURUS (RC_GLOBALS_BEGIN + 2)
+#define DLG_SPECIAL (RC_GLOBALS_BEGIN + 3)
+
+// QUERYBOX ---------------------------------------------------------
+
+#define DLG_WRAP (RC_GLOBALS_BEGIN + 4)
+#define DLG_BODY (RC_GLOBALS_BEGIN + 5)
+#define DLG_PRT_FIELDNAME (RC_GLOBALS_BEGIN + 6)
+
+// INFOBOX ------------------------------------------------------------
+
+#define ERR_CLPBRD_READ (RC_GLOBALS_BEGIN + 1)
+#define ERR_CLPBRD_WRITE (RC_GLOBALS_BEGIN + 2)
+#define MSG_ERROR_PASSWD (RC_GLOBALS_BEGIN + 3)
+
+
+// ACC ---------------------------------------------------------------
+
+#define FN_CHAR_LEFT_SEL (RC_GLOBALS_BEGIN + 1) //
+#define FN_CHAR_RIGHT_SEL (RC_GLOBALS_BEGIN + 2) //
+#define FN_LINE_UP_SEL (RC_GLOBALS_BEGIN + 3) //
+#define FN_LINE_DOWN_SEL (RC_GLOBALS_BEGIN + 4) //
+#define FN_START_OF_LINE_SEL (RC_GLOBALS_BEGIN + 5) // StartOfLine
+#define FN_END_OF_LINE_SEL (RC_GLOBALS_BEGIN + 6) // EndOfLine
+#define FN_START_OF_DOCUMENT_SEL (RC_GLOBALS_BEGIN + 7) // StartOfDocument
+#define FN_END_OF_DOCUMENT_SEL (RC_GLOBALS_BEGIN + 8) // EndOfDocument
+#define FN_START_OF_NEXT_PAGE_SEL (RC_GLOBALS_BEGIN + 9) // StartOfNextPage ???
+#define FN_END_OF_NEXT_PAGE_SEL (RC_GLOBALS_BEGIN + 10) // ???
+#define FN_START_OF_PREV_PAGE_SEL (RC_GLOBALS_BEGIN + 11) // StartOfPrevPage ???
+#define FN_END_OF_PREV_PAGE_SEL (RC_GLOBALS_BEGIN + 12) // ???
+#define FN_START_OF_PAGE_SEL (RC_GLOBALS_BEGIN + 13) // StartOfPage
+#define FN_END_OF_PAGE_SEL (RC_GLOBALS_BEGIN + 14) // EndOfPage
+#define FN_START_OF_WINDOW_SEL (RC_GLOBALS_BEGIN + 15) // StartOfWindow
+#define FN_END_OF_WINDOW_SEL (RC_GLOBALS_BEGIN + 16) // EndOfWindow
+#define FN_START_OF_COLUMN_SEL (RC_GLOBALS_BEGIN + 17) // StartOfColumn
+#define FN_END_OF_COLUMN_SEL (RC_GLOBALS_BEGIN + 18) // EndOfColumn
+#define FN_START_OF_PARA_SEL (RC_GLOBALS_BEGIN + 19) // StartOfPara
+#define FN_END_OF_PARA_SEL (RC_GLOBALS_BEGIN + 20) // EndOfPara
+#define FN_NEXT_WORD_SEL (RC_GLOBALS_BEGIN + 21) // NextWord
+#define FN_PREV_WORD_SEL (RC_GLOBALS_BEGIN + 22) // PrevWord
+#define FN_NEXT_SENT_SEL (RC_GLOBALS_BEGIN + 23) // NextSentence
+#define FN_PREV_SENT_SEL (RC_GLOBALS_BEGIN + 24) // PrevSentence
+
+#define FN_START_OF_NEXT_COLUMN_SEL (RC_GLOBALS_BEGIN + 25)
+#define FN_END_OF_NEXT_COLUMN_SEL (RC_GLOBALS_BEGIN + 26)
+#define FN_START_OF_PREV_COLUMN_SEL (RC_GLOBALS_BEGIN + 27)
+#define FN_END_OF_PREV_COLUMN_SEL (RC_GLOBALS_BEGIN + 28)
+#define FN_PAGEUP_SEL (RC_GLOBALS_BEGIN + 29)
+#define FN_PAGEDOWN_SEL (RC_GLOBALS_BEGIN + 30)
+
+// TABPAGES -----------------------------------------------------------
+
+#define TP_PAGE_STD (RC_GLOBALS_BEGIN + 1)
+#define TP_PAGE_EXT (RC_GLOBALS_BEGIN + 2)
+
+#define TP_PARA_STD (RC_GLOBALS_BEGIN + 3)
+#define TP_PARA_EXT (RC_GLOBALS_BEGIN + 4)
+
+#define TP_FRAME_STD (RC_GLOBALS_BEGIN + 5)
+#define TP_FRAME_EXT (RC_GLOBALS_BEGIN + 6)
+
+#define TP_CHAR_STD (RC_GLOBALS_BEGIN + 7)
+#define TP_CHAR_EXT (RC_GLOBALS_BEGIN + 8)
+
+#define TP_TABULATOR (RC_GLOBALS_BEGIN + 9)
+#define TP_DROPCAPS (RC_GLOBALS_BEGIN + 10)
+#define TP_BACKGROUND (RC_GLOBALS_BEGIN + 11)
+#define TP_BORDER (RC_GLOBALS_BEGIN + 12)
+#define TP_COLUMN (RC_GLOBALS_BEGIN + 13)
+
+#define TP_DOC_STAT (RC_GLOBALS_BEGIN + 15)
+
+#define TP_HEADER_PAGE (RC_GLOBALS_BEGIN + 16)
+#define TP_FOOTER_PAGE (RC_GLOBALS_BEGIN + 17)
+#define TP_FOOTNOTE_PAGE (RC_GLOBALS_BEGIN + 18)
+
+#define TP_OPTGENERAL_PAGE (RC_GLOBALS_BEGIN + 19) //Sfx-Seiten
+#define TP_OPTSAVE_PAGE (RC_GLOBALS_BEGIN + 20)
+#define TP_OPTPATH_PAGE (RC_GLOBALS_BEGIN + 21)
+#define TP_OPTSPELL_PAGE (RC_GLOBALS_BEGIN + 22)
+ //Sw-Seiten
+#define SW_EDIT_OPTIONS_TDLG (RC_GLOBALS_BEGIN + 23)
+#define SW_BROWSER_OPTIONS_TDLG (RC_GLOBALS_BEGIN + 24)
+#define TP_OPTTEST_PAGE (RC_GLOBALS_BEGIN + 25)
+#define TP_OPTPRINT_PAGE (RC_GLOBALS_BEGIN + 26)
+#define TP_OPTCOLOR_PAGE (RC_GLOBALS_BEGIN + 27)
+
+#define SW_OPTIONS_TDLG (RC_GLOBALS_BEGIN + 28)
+#define SW_OPTIONS_TDLG_ELEM (RC_GLOBALS_BEGIN + 29)
+#define SW_OPTIONS_TDLG_PRINT (RC_GLOBALS_BEGIN + 30)
+
+#define TP_FRM_STD (RC_GLOBALS_BEGIN + 31)
+
+#define TP_OPTGRID_PAGE (RC_GLOBALS_BEGIN + 33)
+
+#define TP_FORMAT_TABLE (RC_GLOBALS_BEGIN + 34)
+#define TP_GRF_EXT (RC_GLOBALS_BEGIN + 35)
+
+#define DLG_FRM_STD (RC_GLOBALS_BEGIN + 36)
+#define DLG_FRM_GRF (RC_GLOBALS_BEGIN + 37)
+#define DLG_FRM_OLE (RC_GLOBALS_BEGIN + 38)
+
+#define RID_INPUT_TOOLBOX (RC_GLOBALS_BEGIN + 39)
+
+#define TP_MACRO_ASSIGN (RC_GLOBALS_BEGIN + 40)
+#define TP_FRM_URL (RC_GLOBALS_BEGIN + 42)
+#define TP_CHAR_URL (RC_GLOBALS_BEGIN + 43)
+
+#define TP_LAYOUT_OPT (RC_GLOBALS_BEGIN + 44)
+#define TP_CONTENT_OPT (RC_GLOBALS_BEGIN + 45)
+#define TP_HTML_OPT (RC_GLOBALS_BEGIN + 46)
+#define TP_STD_FONT (RC_GLOBALS_BEGIN + 47)
+#define TP_CONDCOLL (RC_GLOBALS_BEGIN + 48)
+
+#define TP_FRM_WRAP (RC_GLOBALS_BEGIN + 49)
+#define TP_FRM_ADD (RC_GLOBALS_BEGIN + 51)
+
+#define TP_TABLE_TEXTFLOW (RC_GLOBALS_BEGIN + 52)
+
+#define TP_AUTOFMT_BY_INPUT (RC_GLOBALS_BEGIN + 53)
+#define TP_AUTOFMT_APPLY (RC_GLOBALS_BEGIN + 54)
+
+#define TP_PARA_ALIGN (RC_GLOBALS_BEGIN + 55)
+#define TP_OPTTABLE_PAGE (RC_GLOBALS_BEGIN + 56)
+
+#define TP_NUMBER (RC_GLOBALS_BEGIN + 57)
+
+#define DLG_NUM_BULLET (RC_GLOBALS_BEGIN + 58)
+#define TP_PICK_SINGLE_NUM (RC_GLOBALS_BEGIN + 59)
+#define TP_PICK_BULLET (RC_GLOBALS_BEGIN + 60)
+#define TP_PICK_NUM (RC_GLOBALS_BEGIN + 61)
+#define TP_PICK_BMP (RC_GLOBALS_BEGIN + 62)
+
+#define TP_FLD_DB (RC_GLOBALS_BEGIN + 64)
+#define TP_FLD_DOKINF (RC_GLOBALS_BEGIN + 65)
+#define TP_FLD_VAR (RC_GLOBALS_BEGIN + 66)
+#define TP_FLD_DOK (RC_GLOBALS_BEGIN + 67)
+#define TP_FLD_FUNC (RC_GLOBALS_BEGIN + 68)
+#define TP_FLD_REF (RC_GLOBALS_BEGIN + 69)
+
+#define TP_OPTSHDWCRSR (RC_GLOBALS_BEGIN + 70)
+#define TP_NUM_OPTIONS (RC_GLOBALS_BEGIN + 71)
+#define TP_NUM_POSITION (RC_GLOBALS_BEGIN + 72)
+#define TP_NUMPARA (RC_GLOBALS_BEGIN + 73)
+
+#define TP_REDLINE_OPT (RC_GLOBALS_BEGIN + 74)
+
+#define TP_LINENUMBERING (RC_GLOBALS_BEGIN + 75)
+#define TP_OUTLINE_NUM (RC_GLOBALS_BEGIN + 76)
+
+#define TP_OPTINSERT_PAGE (RC_GLOBALS_BEGIN + 77)
+#define TP_OPTCAPTION_PAGE (RC_GLOBALS_BEGIN + 78)
+#define DLG_SVXTEST_NUM_BULLET (RC_GLOBALS_BEGIN + 79)
+#define TP_OPTLOAD_PAGE (RC_GLOBALS_BEGIN + 80)
+#define TP_INSERT_TOX (RC_GLOBALS_BEGIN + 81)
+#define TP_TOX_FORM_ENTRY (RC_GLOBALS_BEGIN + 82)
+#define TP_TOX_FORM_STYLES (RC_GLOBALS_BEGIN + 83)
+#define DLG_INSERT_TOX_TABDLG (RC_GLOBALS_BEGIN + 84)
+#define TP_INSERT_SECTION (RC_GLOBALS_BEGIN + 85)
+#define DLG_INSERT_SECTION (RC_GLOBALS_BEGIN + 86)
+#define DLG_SECTION_PROPERTIES (RC_GLOBALS_BEGIN + 87)
+#define DLG_RENAME_XNAMED (RC_GLOBALS_BEGIN + 88)
+#define DLG_MULTI_TOX (RC_GLOBALS_BEGIN + 89)
+#define TP_TOX_SELECT (RC_GLOBALS_BEGIN + 90)
+#define TP_TOX_ENTRY (RC_GLOBALS_BEGIN + 91)
+#define TP_TOX_STYLES (RC_GLOBALS_BEGIN + 92)
+#define TP_VISITING_CARDS (RC_GLOBALS_BEGIN + 93)
+#define DLG_ADD_IDX_STYLES (RC_GLOBALS_BEGIN + 94)
+#define TP_PRIVATE_DATA (RC_GLOBALS_BEGIN + 95)
+#define TP_BUSINESS_DATA (RC_GLOBALS_BEGIN + 96)
+#define TP_SECTION_FTNENDNOTES (RC_GLOBALS_BEGIN + 97)
+#define TP_CHAR_POS (RC_GLOBALS_BEGIN + 98)
+#define TP_CHAR_TWOLN (RC_GLOBALS_BEGIN + 99)
+#define TP_PARA_ASIAN (RC_GLOBALS_BEGIN + 100)
+#define TP_TEXTGRID_PAGE (RC_GLOBALS_BEGIN + 101)
+#define TP_SECTION_INDENTS (RC_GLOBALS_BEGIN + 102)
+#define TP_OPTCOMPATIBILITY_PAGE (RC_GLOBALS_BEGIN + 103)
+#define TP_MAILCONFIG (RC_GLOBALS_BEGIN + 104)
+//maximum: RC_GLOBALS_BEGIN + 119
+
+#if STR_DOC_STAT > RC_GLOBALS_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#define SID_PREVIEWFLAG_TYPE (RC_GLOBALS_BEGIN + 114)
+#define SID_FONTMODE_TYPE (RC_GLOBALS_BEGIN + 115)
+#define SID_FAX_LIST (RC_GLOBALS_BEGIN + 116)
+#define SID_WRT_SHELL (RC_GLOBALS_BEGIN + 117)
+
+#define DLG_LINE_NUMBERING (RC_GLOBALS_BEGIN + 118)
+#endif // _GLOBALS_HRC
diff --git a/sw/inc/globdoc.hxx b/sw/inc/globdoc.hxx
new file mode 100644
index 000000000000..201f999cc2ce
--- /dev/null
+++ b/sw/inc/globdoc.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWGLOBDOCSH_HXX
+#define _SWGLOBDOCSH_HXX
+
+#include <swdll.hxx>
+#include "docsh.hxx"
+
+class SwGlobalDocShell : public SwDocShell
+{
+public:
+
+ SFX_DECL_OBJECTFACTORY();
+ TYPEINFO();
+
+ SwGlobalDocShell(SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED);
+ ~SwGlobalDocShell();
+
+ virtual void FillClass( SvGlobalName * pClassName,
+ sal_uInt32 * pClipFormat,
+ String * pAppName,
+ String * pLongUserName,
+ String * pUserName,
+ sal_Int32 nFileFormat,
+ sal_Bool bTemplate = sal_False ) const;
+};
+
+#endif
+
diff --git a/sw/inc/grfatr.hxx b/sw/inc/grfatr.hxx
new file mode 100644
index 000000000000..28c24e16b48a
--- /dev/null
+++ b/sw/inc/grfatr.hxx
@@ -0,0 +1,370 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _GRFATR_HXX
+#define _GRFATR_HXX
+
+#include <hintids.hxx> // fuer die WhichIds @@@ must be included first @@@
+#include <tools/gen.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/grfcrop.hxx>
+#include "swdllapi.h"
+#include <swatrset.hxx> // fuer inlines
+#include <format.hxx> // fuer inlines
+
+/******************************************************************************
+ * class SwMirrorGrf
+ ******************************************************************************/
+
+enum MirrorGraph
+{
+RES_MIRROR_GRAPH_BEGIN,
+ RES_MIRROR_GRAPH_DONT = RES_MIRROR_GRAPH_BEGIN,
+ RES_MIRROR_GRAPH_VERT,
+ RES_MIRROR_GRAPH_HOR,
+ RES_MIRROR_GRAPH_BOTH,
+RES_MIRROR_GRAPH_END
+};
+
+class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
+{
+ sal_Bool bGrfToggle; // auf geraden Seiten Grafiken spiegeln
+
+public:
+ SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
+ : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< sal_uInt16 >(eMiro) ), bGrfToggle( sal_False )
+ {}
+ SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
+ : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
+ bGrfToggle( rMirrorGrf.IsGrfToggle() )
+ {}
+
+ // pure virtual-Methoden von SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ // pure virtual-Methiden von SfxEnumItem
+ virtual sal_uInt16 GetValueCount() const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+
+ inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
+ {
+ SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
+ bGrfToggle = rMirrorGrf.IsGrfToggle();
+ return *this;
+ }
+
+ inline sal_Bool IsGrfToggle() const { return bGrfToggle; }
+ inline void SetGrfToggle( sal_Bool bNew ) { bGrfToggle = bNew; }
+};
+
+
+/******************************************************************************
+ * class SwAttrCropGrf
+ ******************************************************************************/
+
+class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop
+{
+public:
+ TYPEINFO();
+ SwCropGrf();
+ SwCropGrf( sal_Int32 nLeft, sal_Int32 nRight,
+ sal_Int32 nTop, sal_Int32 nBottom );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+};
+
+class SwRotationGrf : public SfxUInt16Item
+{
+ Size aUnrotatedSize;
+public:
+ SwRotationGrf( sal_Int16 nVal = 0 )
+ : SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
+ {}
+ SwRotationGrf( sal_Int16 nVal, const Size& rSz )
+ : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
+ {}
+
+ // pure virtual-Methiden from SfxInt16Item
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+
+ void SetUnrotatedSize( const Size& rSz ) { aUnrotatedSize = rSz; }
+ const Size& GetUnrotatedSize() const { return aUnrotatedSize; }
+};
+
+class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item
+{
+public:
+ SwLuminanceGrf( sal_Int16 nVal = 0 )
+ : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
+ {}
+
+ // pure virtual-Methiden from SfxInt16Item
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item
+{
+public:
+ SwContrastGrf( sal_Int16 nVal = 0 )
+ : SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
+ {}
+
+ // pure virtual-Methiden from SfxInt16Item
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+class SwChannelGrf : public SfxInt16Item
+{
+protected:
+ SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL )
+ : SfxInt16Item( nWhichL, nVal )
+ {}
+
+public:
+ // pure virtual-Methiden from SfxInt16Item
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+class SwChannelRGrf : public SwChannelGrf
+{
+public:
+ SwChannelRGrf( sal_Int16 nVal = 0 )
+ : SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
+ {}
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+};
+class SwChannelGGrf : public SwChannelGrf
+{
+public:
+ SwChannelGGrf( sal_Int16 nVal = 0 )
+ : SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
+ {}
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+};
+class SwChannelBGrf : public SwChannelGrf
+{
+public:
+ SwChannelBGrf( sal_Int16 nVal = 0 )
+ : SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
+ {}
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+};
+
+class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem
+{
+ double nValue;
+public:
+ TYPEINFO();
+ SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
+ {}
+
+ SwGammaGrf( const double& rVal )
+ : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
+ {}
+
+ inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
+ {
+ SetValue( rCopy.GetValue() );
+ return *this;
+ }
+
+ // pure virtual-Methiden von SfxEnumItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+
+
+ const double& GetValue() const { return nValue; }
+ void SetValue( const double& rVal ) { nValue = rVal; }
+};
+
+class SwInvertGrf: public SfxBoolItem
+{
+public:
+ SwInvertGrf( sal_Bool bVal = sal_False )
+ : SfxBoolItem( RES_GRFATR_INVERT, bVal )
+ {}
+
+ // pure virtual-Methiden from SfxInt16Item
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+class SwTransparencyGrf : public SfxByteItem
+{
+public:
+ SwTransparencyGrf( sal_Int8 nVal = 0 )
+ : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
+ {}
+
+ // pure virtual-Methiden from SfxInt16Item
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+};
+
+class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
+{
+public:
+ SwDrawModeGrf( sal_uInt16 nMode = 0 )
+ : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
+ {}
+
+ // pure virtual-Methoden von SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ // pure virtual-Methiden von SfxEnumItem
+ virtual sal_uInt16 GetValueCount() const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+};
+
+
+
+/******************************************************************************
+ * Implementierung der GrafikAttribut Methoden vom SwAttrSet
+ ******************************************************************************/
+
+inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(sal_Bool bInP) const
+ { return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); }
+inline const SwCropGrf &SwAttrSet::GetCropGrf(sal_Bool bInP) const
+ { return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); }
+inline const SwRotationGrf &SwAttrSet::GetRotationGrf(sal_Bool bInP) const
+ { return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); }
+inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(sal_Bool bInP) const
+ { return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); }
+inline const SwContrastGrf &SwAttrSet::GetContrastGrf(sal_Bool bInP) const
+ { return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); }
+inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(sal_Bool bInP) const
+ { return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); }
+inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(sal_Bool bInP) const
+ { return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); }
+inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(sal_Bool bInP) const
+ { return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); }
+inline const SwGammaGrf &SwAttrSet::GetGammaGrf(sal_Bool bInP) const
+ { return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); }
+inline const SwInvertGrf &SwAttrSet::GetInvertGrf(sal_Bool bInP) const
+ { return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); }
+inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(sal_Bool bInP) const
+ { return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); }
+inline const SwDrawModeGrf &SwAttrSet::GetDrawModeGrf(sal_Bool bInP) const
+ { return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); }
+
+/******************************************************************************
+ * Implementierung der GrafikAttribut Methoden vom SwFmt
+ ******************************************************************************/
+
+inline const SwMirrorGrf &SwFmt::GetMirrorGrf(sal_Bool bInP) const
+ { return aSet.GetMirrorGrf(bInP); }
+inline const SwCropGrf &SwFmt::GetCropGrf(sal_Bool bInP) const
+ { return aSet.GetCropGrf(bInP); }
+inline const SwRotationGrf &SwFmt::GetRotationGrf(sal_Bool bInP) const
+ { return aSet.GetRotationGrf(bInP); }
+inline const SwLuminanceGrf &SwFmt::GetLuminanceGrf(sal_Bool bInP) const
+ { return aSet.GetLuminanceGrf( bInP); }
+inline const SwContrastGrf &SwFmt::GetContrastGrf(sal_Bool bInP) const
+ { return aSet.GetContrastGrf( bInP); }
+inline const SwChannelRGrf &SwFmt::GetChannelRGrf(sal_Bool bInP) const
+ { return aSet.GetChannelRGrf( bInP); }
+inline const SwChannelGGrf &SwFmt::GetChannelGGrf(sal_Bool bInP) const
+ { return aSet.GetChannelGGrf( bInP); }
+inline const SwChannelBGrf &SwFmt::GetChannelBGrf(sal_Bool bInP) const
+ { return aSet.GetChannelBGrf( bInP); }
+inline const SwGammaGrf &SwFmt::GetGammaGrf(sal_Bool bInP) const
+ { return aSet.GetGammaGrf( bInP); }
+inline const SwInvertGrf &SwFmt::GetInvertGrf(sal_Bool bInP) const
+ { return aSet.GetInvertGrf( bInP); }
+inline const SwTransparencyGrf &SwFmt::GetTransparencyGrf(sal_Bool bInP) const
+ { return aSet.GetTransparencyGrf( bInP); }
+inline const SwDrawModeGrf &SwFmt::GetDrawModeGrf(sal_Bool bInP) const
+ { return aSet.GetDrawModeGrf(bInP); }
+
+
+#endif // _GRFATR_HXX
diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h
new file mode 100644
index 000000000000..38b50dfdab3e
--- /dev/null
+++ b/sw/inc/helpid.h
@@ -0,0 +1,992 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "swcommands.h"
+#include <svx/svxcommands.h>
+#include <sfx2/sfxcommands.h>
+
+#define HID_BIB_BASE "SW_HID_BIB_BASE"
+#define HID_DBSEL "SW_HID_DBSEL"
+#define HID_DBEDIT "SW_HID_DBEDIT"
+#define HID_PRINT_OPTION "SW_HID_PRINT_OPTION"
+#define HID_MERGE_PRINTMONITOR "SW_HID_MERGE_PRINTMONITOR"
+#define HID_FLD_INPUT "SW_HID_FLD_INPUT"
+#define HID_CONFIG_MISC "SW_HID_CONFIG_MISC"
+#define HID_CONFIG_PATH "SW_HID_CONFIG_PATH"
+#define HID_CONFIG_TB "SW_HID_CONFIG_TB"
+#define HID_PG_FOOTNOTE "SW_HID_PG_FOOTNOTE"
+#define HID_FORMAT_GRAPHIC "SW_HID_FORMAT_GRAPHIC"
+#define HID_FILTERSTATUS "SW_HID_FILTERSTATUS"
+#define HID_DOCINFO_EDT "SW_HID_DOCINFO_EDT"
+#define HID_DBLOGON "SW_HID_DBLOGON"
+#define HID_MAC_ASSIGN "SW_HID_MAC_ASSIGN"
+#define HID_CONFIG_MN "SW_HID_CONFIG_MN"
+#define HID_PAPERSIZE "SW_HID_PAPERSIZE"
+#define HID_PASSWD "SW_HID_PASSWD"
+#define HID_SPELLING_OPTIONS "SW_HID_SPELLING_OPTIONS"
+#define HID_HYPHENATE_OPTIONS "SW_HID_HYPHENATE_OPTIONS"
+#define HID_FORMAT_COLUMN "SW_HID_FORMAT_COLUMN"
+#define HID_CONFIG_SAVE "SW_HID_CONFIG_SAVE"
+#define HID_NUM_NAMES "SW_HID_NUM_NAMES"
+#define HID_SYMBOL_SELECT "SW_HID_SYMBOL_SELECT"
+#define HID_CONFIG_KY "SW_HID_CONFIG_KY"
+#define HID_LINKEDIT "SW_HID_LINKEDIT"
+#define HID_GRAPHIC_PREVIEW "SW_HID_GRAPHIC_PREVIEW"
+#define HID_DICTIONARY "SW_HID_DICTIONARY"
+#define HID_SET_STYLE "SW_HID_SET_STYLE"
+#define HID_RIBBONBAR "SW_HID_RIBBONBAR"
+#define HID_STATUSLINE "SW_HID_STATUSLINE"
+#define HID_DOCBAR "SW_HID_DOCBAR"
+#define HID_VRULER "SW_HID_VRULER"
+#define HID_MAKRO_WINDOW "SW_HID_MAKRO_WINDOW"
+#define HID_ENVELOP_FORMAT "SW_HID_ENVELOP_FORMAT"
+#define HID_ENVELOP_PRINTER "SW_HID_ENVELOP_PRINTER"
+
+#define HID_HEADER_FOOTER_DLG "SW_HID_HEADER_FOOTER_DLG"
+#define HID_GRID_DLG "SW_HID_GRID_DLG"
+#define HID_USER_ADDRESS_DLG "SW_HID_USER_ADDRESS_DLG"
+#define HID_SELECT_FAX_DLG "SW_HID_SELECT_FAX_DLG"
+
+#define HID_LABEL_FORMAT "SW_HID_LABEL_FORMAT"
+#define HID_BRSORT "SW_HID_BRSORT"
+#define HID_BRSEEK "SW_HID_BRSEEK"
+#define HID_BRCFG "SW_HID_BRCFG"
+
+#define HID_FORMEDT_CONTENT "SW_HID_FORMEDT_CONTENT"
+#define HID_FORMEDT_USER "SW_HID_FORMEDT_USER"
+#define HID_FORMEDT_INDEX "SW_HID_FORMEDT_INDEX"
+
+#define HID_SCRL_PAGEUP "SW_HID_SCRL_PAGEUP"
+#define HID_SCRL_PAGEDOWN "SW_HID_SCRL_PAGEDOWN"
+
+#define HID_DRAW_WIN "SW_HID_DRAW_WIN"
+#define HID_EDIT_WIN "SW_HID_EDIT_WIN"
+
+#define HID_INSERT_CTRL "SW_HID_INSERT_CTRL" // TbxControl Einfuegen
+#define HID_INSERT_OBJ_CTRL "SW_HID_INSERT_OBJ_CTRL"
+#define HID_INSERT_FIELD_CTRL "SW_HID_INSERT_FIELD_CTRL"
+
+#define HID_SOURCEVIEW "SW_HID_SOURCEVIEW"
+#define HID_TBL_OPT_CTRL "SW_HID_TBL_OPT_CTRL"
+#define HID_AUTOFORMAT_CLB "SW_HID_AUTOFORMAT_CLB"
+
+#define HID_SCRL_NAVI "SW_HID_SCRL_NAVI"
+#define HID_NAVI_DRAG_HYP "SW_HID_NAVI_DRAG_HYP"
+#define HID_NAVI_DRAG_LINK "SW_HID_NAVI_DRAG_LINK"
+#define HID_NAVI_DRAG_COPY "SW_HID_NAVI_DRAG_COPY"
+#define HID_NAVI_OUTLINES "SW_HID_NAVI_OUTLINES"
+
+#define HID_AUTOFORMAT_EXEC "SW_HID_AUTOFORMAT_EXEC"
+#define HID_AUTOFORMAT_CLOSE "SW_HID_AUTOFORMAT_CLOSE"
+
+#define HID_PAGEPREVIEW "SW_HID_PAGEPREVIEW"
+#define HID_SOURCE_EDITWIN "SW_HID_SOURCE_EDITWIN"
+
+// Dialog Help-IDs **********************************************************
+
+#define HID_CONVERT_FROM "SW_HID_CONVERT_FROM"
+#define HID_CONVERT_TO "SW_HID_CONVERT_TO"
+#define HID_EDIT_POSTIT "SW_HID_EDIT_POSTIT"
+#define HID_INSERT_CHART "SW_HID_INSERT_CHART"
+#define HID_PAGE_PREVIEW "SW_HID_PAGE_PREVIEW"
+#define HID_INSERT_HYPERLINK "SW_HID_INSERT_HYPERLINK"
+#define HID_NAVIGATOR_TREELIST "SW_HID_NAVIGATOR_TREELIST"
+#define HID_DLG_CAPTION "SW_HID_DLG_CAPTION"
+#define HID_DLG_GLOSS_DECIDE "SW_HID_DLG_GLOSS_DECIDE"
+#define HID_NAVIGATOR_TOOLBOX "SW_HID_NAVIGATOR_TOOLBOX"
+#define HID_NAVIGATOR_LISTBOX "SW_HID_NAVIGATOR_LISTBOX"
+#define HID_NUM_BULLET_DLG "SW_HID_NUM_BULLET_DLG"
+#define HID_VS_SINGLENUM "SW_HID_VS_SINGLENUM"
+#define HID_VS_NUM "SW_HID_VS_NUM"
+#define HID_VS_BULLET "SW_HID_VS_BULLET"
+#define HID_VS_NUMBMP "SW_HID_VS_NUMBMP"
+#define HID_VS_RULER "SW_HID_VS_RULER"
+#define HID_RULER_DIALOG "SW_HID_RULER_DIALOG"
+#define HID_INSERT_ABSTRACT "SW_HID_INSERT_ABSTRACT"
+#define HID_NAVI_TBX1 "SW_HID_NAVI_TBX1"
+#define HID_NAVI_TBX2 "SW_HID_NAVI_TBX2"
+#define HID_NAVI_TBX3 "SW_HID_NAVI_TBX3"
+#define HID_NAVI_TBX4 "SW_HID_NAVI_TBX4"
+#define HID_NAVI_TBX5 "SW_HID_NAVI_TBX5"
+#define HID_NAVI_TBX6 "SW_HID_NAVI_TBX6"
+#define HID_NAVI_TBX7 "SW_HID_NAVI_TBX7"
+#define HID_NAVI_TBX8 "SW_HID_NAVI_TBX8"
+#define HID_NAVI_TBX9 "SW_HID_NAVI_TBX9"
+#define HID_NAVI_TBX10 "SW_HID_NAVI_TBX10"
+#define HID_NAVI_TBX11 "SW_HID_NAVI_TBX11"
+#define HID_NAVI_TBX12 "SW_HID_NAVI_TBX12"
+#define HID_NAVI_TBX13 "SW_HID_NAVI_TBX13"
+#define HID_NAVI_TBX14 "SW_HID_NAVI_TBX14"
+#define HID_NAVI_TBX15 "SW_HID_NAVI_TBX15"
+#define HID_NAVI_VS "SW_HID_NAVI_VS"
+#define HID_NUM_FORMAT_BTN "SW_HID_NUM_FORMAT_BTN"
+#define HID_PPREV_ZOOM "SW_HID_PPREV_ZOOM"
+#define HID_NAVI_TBX16 "SW_HID_NAVI_TBX16"
+#define HID_LTEMPL_TEXT "SW_HID_LTEMPL_TEXT"
+#define HID_LTEMPL_FRAME "SW_HID_LTEMPL_FRAME"
+#define HID_LTEMPL_PAGE "SW_HID_LTEMPL_PAGE"
+#define HID_LTEMPL_OVERRIDE "SW_HID_LTEMPL_OVERRIDE"
+#define HID_LTEMPL_TEMPLATES "SW_HID_LTEMPL_TEMPLATES"
+#define HID_NAVI_TBX17 "SW_HID_NAVI_TBX17"
+#define HID_NAVI_TBX18 "SW_HID_NAVI_TBX18"
+#define HID_NAVI_TBX19 "SW_HID_NAVI_TBX19"
+#define HID_NAVI_TBX20 "SW_HID_NAVI_TBX20"
+#define HID_NAVI_TBX21 "SW_HID_NAVI_TBX21"
+#define HID_NAVI_TBX22 "SW_HID_NAVI_TBX22"
+#define HID_NAVI_TBX23 "SW_HID_NAVI_TBX23"
+#define HID_NAVI_TBX24 "SW_HID_NAVI_TBX24"
+#define HID_NAVIGATOR_GLOBAL_TOOLBOX "SW_HID_NAVIGATOR_GLOBAL_TOOLBOX"
+#define HID_NAVIGATOR_GLOB_TREELIST "SW_HID_NAVIGATOR_GLOB_TREELIST"
+#define HID_GLOS_GROUP_TREE "SW_HID_GLOS_GROUP_TREE"
+#define HID_GLBLTREE_UPDATE "SW_HID_GLBLTREE_UPDATE"
+#define HID_GLBLTREE_INSERT "SW_HID_GLBLTREE_INSERT"
+#define HID_GLBLTREE_EDIT "SW_HID_GLBLTREE_EDIT"
+#define HID_GLBLTREE_DEL "SW_HID_GLBLTREE_DEL"
+#define HID_GLBLTREE_INS_IDX "SW_HID_GLBLTREE_INS_IDX"
+#define HID_GLBLTREE_INS_CNTIDX "SW_HID_GLBLTREE_INS_CNTIDX"
+#define HID_GLBLTREE_INS_USRIDX "SW_HID_GLBLTREE_INS_USRIDX"
+#define HID_GLBLTREE_INS_FILE "SW_HID_GLBLTREE_INS_FILE"
+#define HID_GLBLTREE_INS_NEW_FILE "SW_HID_GLBLTREE_INS_NEW_FILE"
+#define HID_GLBLTREE_INS_TEXT "SW_HID_GLBLTREE_INS_TEXT"
+#define HID_GLBLTREE_UPD_SEL "SW_HID_GLBLTREE_UPD_SEL"
+#define HID_GLBLTREE_UPD_IDX "SW_HID_GLBLTREE_UPD_IDX"
+#define HID_GLBLTREE_UPD_LINK "SW_HID_GLBLTREE_UPD_LINK"
+#define HID_GLBLTREEUPD_ALL "SW_HID_GLBLTREEUPD_ALL"
+#define HID_NUM_OUTL_NAMED_NUMS "SW_HID_NUM_OUTL_NAMED_NUMS"
+#define HID_NUM_OUTL_NUM_SAVEAS "SW_HID_NUM_OUTL_NUM_SAVEAS"
+#define HID_NUM_NAMED_NUMS "SW_HID_NUM_NAMED_NUMS"
+#define HID_NUM_NUM_SAVEAS "SW_HID_NUM_NUM_SAVEAS"
+#define HID_NUM_STD_NUMBER "SW_HID_NUM_STD_NUMBER"
+#define HID_NUM_DEL_NUMBER "SW_HID_NUM_DEL_NUMBER"
+#define HID_NUM_STD_BULLET "SW_HID_NUM_STD_BULLET"
+#define HID_NUM_DEL_BULLET "SW_HID_NUM_DEL_BULLET"
+#define HID_NAVI_CONTENT "SW_HID_NAVI_CONTENT"
+#define HID_NAVI_GLOBAL "SW_HID_NAVI_GLOBAL"
+#define HID_LTEMPL_NUMBERING "SW_HID_LTEMPL_NUMBERING"
+#define HID_FLDVAR_APPLY "SW_HID_FLDVAR_APPLY"
+#define HID_FLDVAR_DELETE "SW_HID_FLDVAR_DELETE"
+#define HID_FLDEDT_ADDRESS "SW_HID_FLDEDT_ADDRESS"
+#define HID_SORT_ACTION "SW_HID_SORT_ACTION"
+#define HID_SORT_AUTHOR "SW_HID_SORT_AUTHOR"
+#define HID_SORT_DATE "SW_HID_SORT_DATE"
+#define HID_SORT_COMMENT "SW_HID_SORT_COMMENT"
+#define HID_SW_SORT_POSITION "SW_HID_SW_SORT_POSITION"
+#define HID_SYNC_BTN "SW_HID_SYNC_BTN"
+#define HID_EDIT_COMMENT "SW_HID_EDIT_COMMENT"
+#define HID_SEL_TEMPLATE "SW_HID_SEL_TEMPLATE"
+#define HID_DLG_SEQUENCE_OPTION "SW_HID_DLG_SEQUENCE_OPTION"
+#define HID_DLG_FLDEDT_NEXT "SW_HID_DLG_FLDEDT_NEXT"
+#define HID_DLG_FLDEDT_PREV "SW_HID_DLG_FLDEDT_PREV"
+#define HID_DLG_FLDEDT_ADDRESS "SW_HID_DLG_FLDEDT_ADDRESS"
+#define HID_DLG_PRV_PRT_OPTIONS "SW_HID_DLG_PRV_PRT_OPTIONS"
+
+#define HID_FILEDLG_CHARDLG "SW_HID_FILEDLG_CHARDLG"
+#define HID_FILEDLG_LOADTEMPLATE "SW_HID_FILEDLG_LOADTEMPLATE"
+#define HID_FILEDLG_ROMENU "SW_HID_FILEDLG_ROMENU"
+#define HID_FILEDLG_MAILMRGE1 "SW_HID_FILEDLG_MAILMRGE1"
+#define HID_FILEDLG_MAILMRGE2 "SW_HID_FILEDLG_MAILMRGE2"
+#define HID_FILEDLG_FRMPAGE "SW_HID_FILEDLG_FRMPAGE"
+#define HID_FILEDLG_SRCVIEW "SW_HID_FILEDLG_SRCVIEW"
+#define HID_FILEDLG_WIZDOKU "SW_HID_FILEDLG_WIZDOKU"
+#define HID_PREVIEW_ZOOM "SW_HID_PREVIEW_ZOOM"
+
+#define HID_REDLINE_AUTOFMT_ACCEPT "SW_HID_REDLINE_AUTOFMT_ACCEPT"
+#define HID_MULTI_TOX_DLG "SW_HID_MULTI_TOX_DLG"
+#define HID_ASCII_FILTER "SW_HID_ASCII_FILTER"
+#define HID_GLBLTREE_EDIT_LINK "SW_HID_GLBLTREE_EDIT_LINK"
+#define HID_FORMAT_NAME_OBJECT_NAME "SW_HID_FORMAT_NAME_OBJECT_NAME"// #100286#
+#define HID_REFSELECTION_TOOLTIP "SW_HID_REFSELECTION_TOOLTIP" // #i83479#
+
+
+// TabPage Help-IDs *********************************************************
+
+#define HID_DROPCAPS "SW_HID_DROPCAPS"
+#define HID_FRM_EXT "SW_HID_FRM_EXT"
+#define HID_FRM_STD "SW_HID_FRM_STD"
+#define HID_GRF_EXT "SW_HID_GRF_EXT"
+#define HID_COLUMN "SW_HID_COLUMN"
+#define HID_DOC_STAT "SW_HID_DOC_STAT"
+#define HID_MACROASSIGN "SW_HID_MACROASSIGN"
+#define HID_FOOTNOTE_PAGE "SW_HID_FOOTNOTE_PAGE"
+#define HID_OPTDOCDISP_PAGE "SW_HID_OPTDOCDISP_PAGE"
+#define HID_OPTGRID_PAGE "SW_HID_OPTGRID_PAGE"
+#define HID_OPTTEST_PAGE "SW_HID_OPTTEST_PAGE"
+#define HID_OPTPRINT_PAGE "SW_HID_OPTPRINT_PAGE"
+#define HID_FORMAT_TABLE "SW_HID_FORMAT_TABLE"
+#define HID_TABLE_COLUMN "SW_HID_TABLE_COLUMN"
+#define HID_LAB_LAB "SW_HID_LAB_LAB"
+#define HID_LAB_PRT "SW_HID_LAB_PRT"
+#define HID_ENV_PRT "SW_HID_ENV_PRT"
+#define HID_LAB_FMT "SW_HID_LAB_FMT"
+#define HID_ENV_ENV "SW_HID_ENV_ENV"
+#define HID_ENV_FMT "SW_HID_ENV_FMT"
+#define HID_FRM_URL "SW_HID_FRM_URL"
+#define HID_CHAR_URL "SW_HID_CHAR_URL"
+#define HID_CONTENT_OPT "SW_HID_CONTENT_OPT"
+#define HID_LAYOUT_OPT "SW_HID_LAYOUT_OPT"
+#define HID_STD_FONT "SW_HID_STD_FONT"
+#define HID_COND_COLL "SW_HID_COND_COLL"
+#define HID_FRM_ADD "SW_HID_FRM_ADD"
+#define HID_TABLE_TEXTFLOW "SW_HID_TABLE_TEXTFLOW"
+#define HID_AUTOFMT_BY_INPUT "SW_HID_AUTOFMT_BY_INPUT"
+#define HID_AUTOFMT_APPLY "SW_HID_AUTOFMT_APPLY"
+#define HID_OPTTABLE_PAGE "SW_HID_OPTTABLE_PAGE"
+#define HID_PICK_SINGLE_NUM "SW_HID_PICK_SINGLE_NUM"
+#define HID_PICK_BULLET "SW_HID_PICK_BULLET"
+#define HID_PICK_NUM "SW_HID_PICK_NUM"
+#define HID_PICK_BMP "SW_HID_PICK_BMP"
+
+#define HID_FLD_DB "SW_HID_FLD_DB"
+#define HID_FLD_DOKINF "SW_HID_FLD_DOKINF"
+#define HID_FLD_VAR "SW_HID_FLD_VAR"
+#define HID_FLD_DOK "SW_HID_FLD_DOK"
+#define HID_FLD_FUNC "SW_HID_FLD_FUNC"
+#define HID_FLD_REF "SW_HID_FLD_REF"
+#define HID_OPTSHDWCRSR "SW_HID_OPTSHDWCRSR"
+#define HID_NUM_OPTIONS "SW_HID_NUM_OPTIONS"
+#define HID_NUM_POSITION "SW_HID_NUM_POSITION"
+#define HID_NUMPARA "SW_HID_NUMPARA"
+#define HID_FOOTNOTE_OPTIONS "SW_HID_FOOTNOTE_OPTIONS"
+#define HID_ENDNOTE_OPTIONS "SW_HID_ENDNOTE_OPTIONS"
+#define HID_REDLINE_OPT "SW_HID_REDLINE_OPT"
+#define HID_LINENUMBERING "SW_HID_LINENUMBERING"
+#define HID_REDLINE_ACCEPT "SW_HID_REDLINE_ACCEPT"
+#define HID_EDIT_FLD_DB "SW_HID_EDIT_FLD_DB"
+#define HID_EDIT_FLD_DOKINF "SW_HID_EDIT_FLD_DOKINF"
+#define HID_EDIT_FLD_VAR "SW_HID_EDIT_FLD_VAR"
+#define HID_EDIT_FLD_DOK "SW_HID_EDIT_FLD_DOK"
+#define HID_EDIT_FLD_FUNC "SW_HID_EDIT_FLD_FUNC"
+#define HID_EDIT_FLD_REF "SW_HID_EDIT_FLD_REF"
+#define HID_REDLINE_CTRL "SW_HID_REDLINE_CTRL"
+#define HID_TP_OUTLINE_NUM "SW_HID_TP_OUTLINE_NUM"
+#define HID_OPTINSERT_PAGE "SW_HID_OPTINSERT_PAGE"
+#define HID_OPTCAPTION_PAGE "SW_HID_OPTCAPTION_PAGE"
+#define HID_OPTLOAD_PAGE "SW_HID_OPTLOAD_PAGE"
+#define HID_INSERT_TOX_PAGE "SW_HID_INSERT_TOX_PAGE"
+#define HID_TOX_FORM_ENTRY_PAGE "SW_HID_TOX_FORM_ENTRY_PAGE"
+#define HID_TOX_FORM_STYLES_PAGE "SW_HID_TOX_FORM_STYLES_PAGE"
+#define HID_INSERT_TOX_TABDLG "SW_HID_INSERT_TOX_TABDLG"
+#define HID_INSERT_SECTION_PAGE "SW_HID_INSERT_SECTION_PAGE"
+#define HID_INSERT_SECTION_DLG "SW_HID_INSERT_SECTION_DLG"
+#define HID_SECTION_PROPERTIES_DLG "SW_HID_SECTION_PROPERTIES_DLG"
+#define HID_RENAME_XNAMED "SW_HID_RENAME_XNAMED"
+#define HID_TP_TOX_SELECT "SW_HID_TP_TOX_SELECT"
+#define HID_TP_TOX_ENTRY "SW_HID_TP_TOX_ENTRY"
+#define HID_TOX_STYLES_PAGE "SW_HID_TOX_STYLES_PAGE"
+#define HID_TP_VISITING_CARDS "SW_HID_TP_VISITING_CARDS"
+#define HID_DLG_ADD_IDX_STYLES "SW_HID_DLG_ADD_IDX_STYLES"
+#define HID_ADD_STYLES_TLB "SW_HID_ADD_STYLES_TLB"
+#define HID_OLE_CHECKLB "SW_HID_OLE_CHECKLB"
+#define HID_DLG_CREATE_AUTH_ENTRY "SW_HID_DLG_CREATE_AUTH_ENTRY"
+#define HID_TP_PRIVATE_DATA "SW_HID_TP_PRIVATE_DATA"
+
+#define HID_TP_BUSINESS_DATA "SW_HID_TP_BUSINESS_DATA"
+#define HID_SECTION_FTNENDNOTES_PAGE "SW_HID_SECTION_FTNENDNOTES_PAGE"
+#define HID_TEXTGRID_PAGE "SW_HID_TEXTGRID_PAGE"
+#define HID_OPTCOMPATIBILITY_PAGE "SW_HID_OPTCOMPATIBILITY_PAGE"
+#define HID_COMPATIBILITY_OPTIONS_BOX "SW_HID_COMPATIBILITY_OPTIONS_BOX"
+
+// AutoPilot Help-IDs *********************************************************
+
+#define HID_LETTER_PAGE1 "SW_HID_LETTER_PAGE1"
+#define HID_LETTER_PAGE2 "SW_HID_LETTER_PAGE2"
+#define HID_LETTER_PAGE3 "SW_HID_LETTER_PAGE3"
+#define HID_LETTER_PAGE4 "SW_HID_LETTER_PAGE4"
+#define HID_LETTER_PAGE5 "SW_HID_LETTER_PAGE5"
+#define HID_LETTER_PAGE6 "SW_HID_LETTER_PAGE6"
+#define HID_LETTER_PAGE7 "SW_HID_LETTER_PAGE7"
+#define HID_LETTER_PAGE8 "SW_HID_LETTER_PAGE8"
+#define HID_LETTER_PAGE9 "SW_HID_LETTER_PAGE9"
+
+#define HID_FAX_PAGE1 "SW_HID_FAX_PAGE1"
+#define HID_FAX_PAGE2 "SW_HID_FAX_PAGE2"
+#define HID_FAX_PAGE3 "SW_HID_FAX_PAGE3"
+#define HID_FAX_PAGE4 "SW_HID_FAX_PAGE4"
+#define HID_FAX_PAGE5 "SW_HID_FAX_PAGE5"
+#define HID_FAX_PAGE6 "SW_HID_FAX_PAGE6"
+#define HID_FAX_PAGE7 "SW_HID_FAX_PAGE7"
+#define HID_FAX_PAGE8 "SW_HID_FAX_PAGE8"
+
+#define HID_MEMO_PAGE1 "SW_HID_MEMO_PAGE1"
+#define HID_MEMO_PAGE2 "SW_HID_MEMO_PAGE2"
+#define HID_MEMO_PAGE3 "SW_HID_MEMO_PAGE3"
+#define HID_MEMO_PAGE4 "SW_HID_MEMO_PAGE4"
+#define HID_MEMO_PAGE5 "SW_HID_MEMO_PAGE5"
+
+#define HID_AGENDA_PAGE1 "SW_HID_AGENDA_PAGE1"
+#define HID_AGENDA_PAGE2 "SW_HID_AGENDA_PAGE2"
+#define HID_AGENDA_PAGE3 "SW_HID_AGENDA_PAGE3"
+#define HID_AGENDA_PAGE4 "SW_HID_AGENDA_PAGE4"
+#define HID_AGENDA_PAGE5 "SW_HID_AGENDA_PAGE5"
+#define HID_AGENDA_PAGE6 "SW_HID_AGENDA_PAGE6"
+
+#define HID_AUTOPILOT_NEXT "SW_HID_AUTOPILOT_NEXT"
+#define HID_AUTOPILOT_PREV "SW_HID_AUTOPILOT_PREV"
+#define HID_AUTOPILOT_OK "SW_HID_AUTOPILOT_OK"
+
+// HelpIds fuers Menue *****************************************************
+
+#define HID_MN_SUB_TBLROW "SW_HID_MN_SUB_TBLROW"
+#define HID_MN_SUB_TBLCOL "SW_HID_MN_SUB_TBLCOL"
+#define HID_MN_SUB_AUTOFORMAT "SW_HID_MN_SUB_AUTOFORMAT"
+#define HID_MN_SUB_TOOLBAR "SW_HID_MN_SUB_TOOLBAR"
+#define HID_MN_SUB_FIELD "SW_HID_MN_SUB_FIELD"
+#define HID_MN_SUB_GRAPHIC "SW_HID_MN_SUB_GRAPHIC"
+#define HID_MN_SUB_TEMPLATES "SW_HID_MN_SUB_TEMPLATES"
+#define HID_MN_SUB_ARRANGE "SW_HID_MN_SUB_ARRANGE"
+#define HID_MN_SUB_SPELLING "SW_HID_MN_SUB_SPELLING"
+#define HID_MN_SUB_UPDATE "SW_HID_MN_SUB_UPDATE"
+#define HID_MN_SUB_MIRROR "SW_HID_MN_SUB_MIRROR"
+#define HID_MN_SUB_ALIGN "SW_HID_MN_SUB_ALIGN"
+#define HID_MN_SUB_OPTIONS "SW_HID_MN_SUB_OPTIONS"
+
+#define HID_MN_CALC_PHD "SW_HID_MN_CALC_PHD"
+#define HID_MN_CALC_SQRT "SW_HID_MN_CALC_SQRT"
+#define HID_MN_CALC_OR "SW_HID_MN_CALC_OR"
+#define HID_MN_CALC_XOR "SW_HID_MN_CALC_XOR"
+#define HID_MN_CALC_AND "SW_HID_MN_CALC_AND"
+#define HID_MN_CALC_NOT "SW_HID_MN_CALC_NOT"
+#define HID_MN_CALC_EQ "SW_HID_MN_CALC_EQ"
+#define HID_MN_CALC_NEQ "SW_HID_MN_CALC_NEQ"
+#define HID_MN_CALC_LEQ "SW_HID_MN_CALC_LEQ"
+#define HID_MN_CALC_GEQ "SW_HID_MN_CALC_GEQ"
+#define HID_MN_CALC_LES "SW_HID_MN_CALC_LES"
+#define HID_MN_CALC_GRE "SW_HID_MN_CALC_GRE"
+#define HID_MN_CALC_SUM "SW_HID_MN_CALC_SUM"
+#define HID_MN_CALC_MEAN "SW_HID_MN_CALC_MEAN"
+#define HID_MN_CALC_MIN "SW_HID_MN_CALC_MIN"
+#define HID_MN_CALC_MAX "SW_HID_MN_CALC_MAX"
+#define HID_MN_CALC_SIN "SW_HID_MN_CALC_SIN"
+#define HID_MN_CALC_COS "SW_HID_MN_CALC_COS"
+#define HID_MN_CALC_TAN "SW_HID_MN_CALC_TAN"
+#define HID_MN_CALC_ASIN "SW_HID_MN_CALC_ASIN"
+#define HID_MN_CALC_ACOS "SW_HID_MN_CALC_ACOS"
+#define HID_MN_CALC_ATAN "SW_HID_MN_CALC_ATAN"
+#define HID_MN_CALC_POW "SW_HID_MN_CALC_POW"
+#define HID_MN_CALC_LISTSEP "SW_HID_MN_CALC_LISTSEP"
+#define HID_MN_POP_OPS "SW_HID_MN_POP_OPS"
+#define HID_MN_POP_STATISTICS "SW_HID_MN_POP_STATISTICS"
+#define HID_MN_POP_FUNC "SW_HID_MN_POP_FUNC"
+#define HID_MN_RSC_END "SW_HID_MN_RSC_END"
+#define HID_MN_CALC_ROUND "SW_HID_MN_CALC_ROUND"
+#define HID_MN_SUB_MACRO "SW_HID_MN_SUB_MACRO"
+
+#define HID_MN_READONLY_SAVEGRAPHIC "SW_HID_MN_READONLY_SAVEGRAPHIC"
+#define HID_MN_READONLY_GRAPHICTOGALLERY "SW_HID_MN_READONLY_GRAPHICTOGALLERY"
+#define HID_MN_READONLY_TOGALLERYLINK "SW_HID_MN_READONLY_TOGALLERYLINK"
+#define HID_MN_READONLY_TOGALLERYCOPY "SW_HID_MN_READONLY_TOGALLERYCOPY"
+#define HID_MN_READONLY_SAVEBACKGROUND "SW_HID_MN_READONLY_SAVEBACKGROUND"
+#define HID_MN_READONLY_BACKGROUNDTOGALLERY "SW_HID_MN_READONLY_BACKGROUNDTOGALLERY"
+#define HID_MN_READONLY_COPYLINK "SW_HID_MN_READONLY_COPYLINK"
+#define HID_MN_READONLY_COPYGRAPHIC "SW_HID_MN_READONLY_COPYGRAPHIC"
+#define HID_MN_READONLY_LOADGRAPHIC "SW_HID_MN_READONLY_LOADGRAPHIC"
+#define HID_MN_READONLY_GRAPHICOFF "SW_HID_MN_READONLY_GRAPHICOFF"
+#define HID_MN_READONLY_PLUGINOFF "SW_HID_MN_READONLY_PLUGINOFF"
+
+#define HID_MD_GLOS_DEFINE "SW_HID_MD_GLOS_DEFINE"
+#define HID_MD_GLOS_REPLACE "SW_HID_MD_GLOS_REPLACE"
+#define HID_MD_GLOS_RENAME "SW_HID_MD_GLOS_RENAME"
+#define HID_MD_GLOS_DELETE "SW_HID_MD_GLOS_DELETE"
+#define HID_MD_GLOS_EDIT "SW_HID_MD_GLOS_EDIT"
+#define HID_MD_GLOS_MACRO "SW_HID_MD_GLOS_MACRO"
+#define HID_LINGU_ADD_WORD "SW_HID_LINGU_ADD_WORD"
+#define HID_LINGU_IGNORE_WORD "SW_HID_LINGU_IGNORE_WORD"
+#define HID_LINGU_SPELLING_DLG "SW_HID_LINGU_SPELLING_DLG"
+#define HID_LINGU_AUTOCORR "SW_HID_LINGU_AUTOCORR"
+#define HID_LINGU_REPLACE "SW_HID_LINGU_REPLACE"
+#define HID_MD_GLOS_CATEGORY "SW_HID_MD_GLOS_CATEGORY"
+#define HID_REGION_TREE "SW_HID_REGION_TREE"
+#define HID_LINGU_WORD_LANGUAGE "SW_HID_LINGU_WORD_LANGUAGE"
+#define HID_LINGU_PARA_LANGUAGE "SW_HID_LINGU_PARA_LANGUAGE"
+#define HID_MD_GLOS_DEFINE_TEXT "SW_HID_MD_GLOS_DEFINE_TEXT"
+#define HID_DLG_PASSWD_SECTION "SW_HID_DLG_PASSWD_SECTION"
+#define HID_MD_COPY_TO_CLIPBOARD "SW_HID_MD_COPY_TO_CLIPBOARD"
+#define HID_MD_GLOS_IMPORT "SW_HID_MD_GLOS_IMPORT"
+#define HID_SMARTTAG_MAIN "SW_HID_SMARTTAG_MAIN" // SMARTTAGS
+#define HID_LINGU_IGNORE_SELECTION "SW_HID_LINGU_IGNORE_SELECTION" // grammar check context menu
+
+// Weiter Help-IDs **********************************************************
+
+#define HID_CLOSE_FILE "SW_HID_CLOSE_FILE"
+#define HID_LAUNCH_REGISTRY "SW_HID_LAUNCH_REGISTRY"
+#define HID_MERGE_FILE "SW_HID_MERGE_FILE"
+#define HID_MERGE_FILE_DLG "SW_HID_MERGE_FILE_DLG"
+#define HID_NEW_FILE "SW_HID_NEW_FILE"
+#define HID_OPEN_FILE "SW_HID_OPEN_FILE"
+#define HID_OPEN_LASTVERSION "SW_HID_OPEN_LASTVERSION"
+#define HID_PRINT_FILE "SW_HID_PRINT_FILE"
+#define HID_PRINT_FILE_OPTIONS "SW_HID_PRINT_FILE_OPTIONS"
+#define HID_SAVE_FILE_AS "SW_HID_SAVE_FILE_AS"
+#define HID_SAVE_FILE "SW_HID_SAVE_FILE"
+#define HID_SETUP_PRINTER_DLG "SW_HID_SETUP_PRINTER_DLG"
+#define HID_EXIT "SW_HID_EXIT"
+#define HID_CREATE_DOCUMENT "SW_HID_CREATE_DOCUMENT"
+#define HID_DOCSTAT_DLG "SW_HID_DOCSTAT_DLG"
+#define HID_LOAD_TEMPLATE_DLG "SW_HID_LOAD_TEMPLATE_DLG"
+#define HID_SAVE_ALL "SW_HID_SAVE_ALL"
+#define HID_NEW_FILE_DEFAULT "SW_HID_NEW_FILE_DEFAULT"
+#define HID_PRINT_FILE_DEFAULT "SW_HID_PRINT_FILE_DEFAULT"
+#define HID_FAX "SW_HID_FAX"
+#define HID_SELECT_DATABASE "SW_HID_SELECT_DATABASE"
+#define HID_DOC_INFO_DLG "SW_HID_DOC_INFO_DLG"
+#define HID_DOC_MGR_DLG "SW_HID_DOC_MGR_DLG"
+#define HID_OPTCAPTION_CLB "SW_HID_OPTCAPTION_CLB"
+
+#define HID_COPY "SW_HID_COPY"
+#define HID_CUT "SW_HID_CUT"
+#define HID_EDIT_FIELD "SW_HID_EDIT_FIELD"
+#define HID_EDIT_FILE_INFO_DLG "SW_HID_EDIT_FILE_INFO_DLG"
+#define HID_EDIT_LINK_DLG "SW_HID_EDIT_LINK_DLG"
+#define HID_EDIT_OBJECT "SW_HID_EDIT_OBJECT"
+#define HID_GOTO "SW_HID_GOTO"
+#define HID_SET_FIELD_VALUE "SW_HID_SET_FIELD_VALUE"
+#define HID_PASTE "SW_HID_PASTE"
+#define HID_REDO "SW_HID_REDO"
+#define HID_SEARCH "SW_HID_SEARCH"
+#define HID_REPLACE "SW_HID_REPLACE"
+#define HID_SELECT_ALL "SW_HID_SELECT_ALL"
+#define HID_UNDO "SW_HID_UNDO"
+#define HID_REPEAT "SW_HID_REPEAT"
+#define HID_BUFFER_UPDATE "SW_HID_BUFFER_UPDATE"
+#define HID_UPDATE_FIELDS "SW_HID_UPDATE_FIELDS"
+#define HID_EXECUTE_MACROFIELD "SW_HID_EXECUTE_MACROFIELD"
+#define HID_EDIT_FORMULA "SW_HID_EDIT_FORMULA"
+#define HID_CALC_TABLE "SW_HID_CALC_TABLE"
+#define HID_NUM_BULLET_DOWN "SW_HID_NUM_BULLET_DOWN"
+#define HID_NUM_BULLET_UP "SW_HID_NUM_BULLET_UP"
+#define HID_NUM_BULLET_PREV "SW_HID_NUM_BULLET_PREV"
+#define HID_NUM_BULLET_NEXT "SW_HID_NUM_BULLET_NEXT"
+#define HID_NUM_BULLET_MOVEUP "SW_HID_NUM_BULLET_MOVEUP"
+#define HID_NUM_BULLET_MOVEDOWN "SW_HID_NUM_BULLET_MOVEDOWN"
+#define HID_NUM_BULLET_NONUM "SW_HID_NUM_BULLET_NONUM"
+#define HID_NUM_BULLET_OFF "SW_HID_NUM_BULLET_OFF"
+#define HID_NUM_BULLET_ON "SW_HID_NUM_BULLET_ON"
+#define HID_NUM_BULLET_OUTLINE_DOWN "SW_HID_NUM_BULLET_OUTLINE_DOWN"
+#define HID_NUM_BULLET_OUTLINE_UP "SW_HID_NUM_BULLET_OUTLINE_UP"
+#define HID_NUM_BULLET_OUTLINE_MOVEUP "SW_HID_NUM_BULLET_OUTLINE_MOVEUP"
+#define HID_NUM_BULLET_OUTLINE_MOVEDOWN "SW_HID_NUM_BULLET_OUTLINE_MOVEDOWN"
+#define HID_UPDATE_INPUTFIELDS "SW_HID_UPDATE_INPUTFIELDS"
+#define HID_NUM_NUMBERING_ON "SW_HID_NUM_NUMBERING_ON"
+#define HID_REPEAT_SEARCH "SW_HID_REPEAT_SEARCH"
+#define HID_REPAGINATE "SW_HID_REPAGINATE"
+
+#define HID_REFRESH_VIEW "SW_HID_REFRESH_VIEW"
+#define HID_RIBBON "SW_HID_RIBBON"
+#define HID_RULER "SW_HID_RULER"
+#define HID_STATUSBAR "SW_HID_STATUSBAR"
+#define HID_TOOLBOX "SW_HID_TOOLBOX"
+#define HID_VIEW_BOUNDS "SW_HID_VIEW_BOUNDS"
+#define HID_VIEW_FIELDS "SW_HID_VIEW_FIELDS"
+#define HID_VLINEAL "SW_HID_VLINEAL"
+#define HID_VSCROLLBAR "SW_HID_VSCROLLBAR"
+#define HID_HSCROLLBAR "SW_HID_HSCROLLBAR"
+#define HID_VIEW_META_CHARS "SW_HID_VIEW_META_CHARS"
+#define HID_VIEW_MARKS "SW_HID_VIEW_MARKS"
+#define HID_VIEW_FIELDNAME "SW_HID_VIEW_FIELDNAME"
+#define HID_VIEW_TABLEGRID "SW_HID_VIEW_TABLEGRID"
+#define HID_ZOOM "SW_HID_ZOOM"
+
+#define HID_DELETE_BOOKMARK "SW_HID_DELETE_BOOKMARK"
+#define HID_INSERT_BREAK "SW_HID_INSERT_BREAK"
+#define HID_INSERT_COLUMN_BREAK "SW_HID_INSERT_COLUMN_BREAK"
+#define HID_INSERT_FILE "SW_HID_INSERT_FILE"
+#define HID_INSERT_FOOTNOTE "SW_HID_INSERT_FOOTNOTE"
+#define HID_INSERT_GRAFIC "SW_HID_INSERT_GRAFIC"
+#define HID_INSERT_LINEBREAK "SW_HID_INSERT_LINEBREAK"
+#define HID_INSERT_MERGEFIELD_DLG "SW_HID_INSERT_MERGEFIELD_DLG"
+#define HID_INSERT_OBJECT_DLG "SW_HID_INSERT_OBJECT_DLG"
+#define HID_INSERT_PAGEBREAK "SW_HID_INSERT_PAGEBREAK"
+#define HID_INSERT_RECORD "SW_HID_INSERT_RECORD"
+#define HID_MERGE_RECORD "SW_HID_MERGE_RECORD"
+#define HID_INSERT_SYMBOL "SW_HID_INSERT_SYMBOL"
+#define HID_INSERT_STRING "SW_HID_INSERT_STRING"
+#define HID_INSERT_COLS "SW_HID_INSERT_COLS"
+#define HID_INSERT_FRAME_INTERACT "SW_HID_INSERT_FRAME_INTERACT"
+#define HID_INSERT_FRAME "SW_HID_INSERT_FRAME"
+#define HID_INSERT_IDX_ENTRY "SW_HID_INSERT_IDX_ENTRY"
+#define HID_INSERT_USERIDX_ENTRY "SW_HID_INSERT_USERIDX_ENTRY"
+#define HID_INSERT_CNTNTIDX_ENTRY "SW_HID_INSERT_CNTNTIDX_ENTRY"
+#define HID_INSERT_SOFT_HYPHEN "SW_HID_INSERT_SOFT_HYPHEN"
+#define HID_INSERT_HARD_SPACE "SW_HID_INSERT_HARD_SPACE"
+
+#define HID_SET_FONT "SW_HID_SET_FONT"
+#define HID_SET_FONT_SIZE "SW_HID_SET_FONT_SIZE"
+#define HID_GROW_FONT_SIZE "SW_HID_GROW_FONT_SIZE"
+#define HID_SHRINK_FONT_SIZE "SW_HID_SHRINK_FONT_SIZE"
+#define HID_SET_BOLD "SW_HID_SET_BOLD"
+#define HID_SET_ITALIC "SW_HID_SET_ITALIC"
+#define HID_SET_SHADOW "SW_HID_SET_SHADOW"
+#define HID_SET_OUTLINE "SW_HID_SET_OUTLINE"
+#define HID_SET_UNDERLINE "SW_HID_SET_UNDERLINE"
+#define HID_SET_STRIKEOUT "SW_HID_SET_STRIKEOUT"
+#define HID_SET_SUPER_SCRIPT "SW_HID_SET_SUPER_SCRIPT"
+#define HID_SET_SUB_SCRIPT "SW_HID_SET_SUB_SCRIPT"
+#define HID_SET_COLOR "SW_HID_SET_COLOR"
+#define HID_SET_CASEMAP "SW_HID_SET_CASEMAP"
+#define HID_SET_LANGUAGE "SW_HID_SET_LANGUAGE"
+#define HID_SET_KERNING "SW_HID_SET_KERNING"
+#define HID_INDENT_TO_TABSTOP "SW_HID_INDENT_TO_TABSTOP"
+#define HID_SET_LEFT_PARA "SW_HID_SET_LEFT_PARA"
+#define HID_SET_RIGHT_PARA "SW_HID_SET_RIGHT_PARA"
+#define HID_SET_CENTER_PARA "SW_HID_SET_CENTER_PARA"
+#define HID_SET_JUSTIFY_PARA "SW_HID_SET_JUSTIFY_PARA"
+#define HID_SET_LINE_SPACE_1 "SW_HID_SET_LINE_SPACE_1"
+#define HID_SET_LINE_SPACE_15 "SW_HID_SET_LINE_SPACE_15"
+#define HID_SET_LINE_SPACE_2 "SW_HID_SET_LINE_SPACE_2"
+#define HID_FLIP_HORZ_GRAFIC "SW_HID_FLIP_HORZ_GRAFIC"
+#define HID_FLIP_VERT_GRAFIC "SW_HID_FLIP_VERT_GRAFIC"
+#define HID_SET_ADJUST "SW_HID_SET_ADJUST"
+#define HID_SET_LRMARGIN "SW_HID_SET_LRMARGIN"
+#define HID_SET_ULMARGIN "SW_HID_SET_ULMARGIN"
+#define HID_UNINDENT_TO_TABSTOP "SW_HID_UNINDENT_TO_TABSTOP"
+#define HID_SET_HYPHEN_ZONE "SW_HID_SET_HYPHEN_ZONE"
+#define HID_SET_PAGE_BREAK "SW_HID_SET_PAGE_BREAK"
+#define HID_SET_KEEP_TOGETHER "SW_HID_SET_KEEP_TOGETHER"
+#define HID_SET_WIDOW "SW_HID_SET_WIDOW"
+#define HID_SET_ORPHAN "SW_HID_SET_ORPHAN"
+#define HID_FORMAT_SHADOW "SW_HID_FORMAT_SHADOW"
+#define HID_FORMAT_BORDER "SW_HID_FORMAT_BORDER"
+#define HID_FORMAT_CHAR_DLG "SW_HID_FORMAT_CHAR_DLG"
+#define HID_FORMAT_PARA_DLG "SW_HID_FORMAT_PARA_DLG"
+#define HID_FORMAT_TAB "SW_HID_FORMAT_TAB"
+#define HID_FORMAT_TAB_DLG "SW_HID_FORMAT_TAB_DLG"
+#define HID_FORMAT_BORDER_DLG "SW_HID_FORMAT_BORDER_DLG"
+#define HID_FORMAT_BACKGROUND "SW_HID_FORMAT_BACKGROUND"
+#define HID_FORMAT_BACKGROUND_DLG "SW_HID_FORMAT_BACKGROUND_DLG"
+#define HID_FORMAT_PAGE "SW_HID_FORMAT_PAGE"
+#define HID_FORMAT_PAGE_DLG "SW_HID_FORMAT_PAGE_DLG"
+#define HID_FORMAT_DROPCAPS "SW_HID_FORMAT_DROPCAPS"
+#define HID_FORMAT_FRAME_DLG "SW_HID_FORMAT_FRAME_DLG"
+#define HID_FORMAT_GRAFIC_DLG "SW_HID_FORMAT_GRAFIC_DLG"
+#define HID_FORMAT_TABLE_DLG "SW_HID_FORMAT_TABLE_DLG"
+#define HID_NEW_STYLE_BY_EXAMPLE "SW_HID_NEW_STYLE_BY_EXAMPLE"
+#define HID_UPDATE_STYLE_BY_EXAMPLE "SW_HID_UPDATE_STYLE_BY_EXAMPLE"
+#define HID_STYLE_SHEET_FRAME_DLG "SW_HID_STYLE_SHEET_FRAME_DLG"
+#define HID_STYLE_SHEET_DOC_DLG "SW_HID_STYLE_SHEET_DOC_DLG"
+#define HID_FORMAT_RESET "SW_HID_FORMAT_RESET"
+#define HID_FRAME_TO_TOP "SW_HID_FRAME_TO_TOP"
+#define HID_FRAME_TO_BOTTOM "SW_HID_FRAME_TO_BOTTOM"
+#define HID_FRAME_NOWRAP "SW_HID_FRAME_NOWRAP"
+#define HID_FRAME_WRAP "SW_HID_FRAME_WRAP"
+#define HID_FRAME_WRAPTHRU "SW_HID_FRAME_WRAPTHRU"
+#define HID_FRAME_ALIGN_HORZ_LEFT "SW_HID_FRAME_ALIGN_HORZ_LEFT"
+#define HID_FRAME_ALIGN_HORZ_RIGHT "SW_HID_FRAME_ALIGN_HORZ_RIGHT"
+#define HID_FRAME_ALIGN_HORZ_CENTER "SW_HID_FRAME_ALIGN_HORZ_CENTER"
+#define HID_FRAME_ALIGN_VERT_TOP "SW_HID_FRAME_ALIGN_VERT_TOP"
+#define HID_FRAME_ALIGN_VERT_BOTTOM "SW_HID_FRAME_ALIGN_VERT_BOTTOM"
+#define HID_FRAME_ALIGN_VERT_CENTER "SW_HID_FRAME_ALIGN_VERT_CENTER"
+#define HID_SET_FRM_SIZE "SW_HID_SET_FRM_SIZE"
+#define HID_SET_FRM_POSITION "SW_HID_SET_FRM_POSITION"
+#define HID_SET_FRM_ANCHOR "SW_HID_SET_FRM_ANCHOR"
+#define HID_SET_FRM_WRAP "SW_HID_SET_FRM_WRAP"
+#define HID_SET_FRM_DIST "SW_HID_SET_FRM_DIST"
+#define HID_SET_FRM_OPTIONS "SW_HID_SET_FRM_OPTIONS"
+#define HID_SET_GRF_MIRROR "SW_HID_SET_GRF_MIRROR"
+#define HID_SET_TABLE_WIDTH "SW_HID_SET_TABLE_WIDTH"
+#define HID_SET_TABLE_ALIGN "SW_HID_SET_TABLE_ALIGN"
+#define HID_SET_CHAR_STYLE "SW_HID_SET_CHAR_STYLE"
+#define HID_SET_PARA_STYLE "SW_HID_SET_PARA_STYLE"
+#define HID_SET_PAGE_STYLE "SW_HID_SET_PAGE_STYLE"
+#define HID_SET_FRM_MACRO "SW_HID_SET_FRM_MACRO"
+#define HID_SET_FRM_COLUMNS "SW_HID_SET_FRM_COLUMNS"
+#define HID_SET_FRM_COLUMN_WIDTH "SW_HID_SET_FRM_COLUMN_WIDTH"
+#define HID_UPDATE_STYLES_DIRECT "SW_HID_UPDATE_STYLES_DIRECT"
+
+#define HID_TABLE_INSERT_ROW "SW_HID_TABLE_INSERT_ROW"
+#define HID_TABLE_DELETE_ROW "SW_HID_TABLE_DELETE_ROW"
+#define HID_TABLE_DELETE_COL "SW_HID_TABLE_DELETE_COL"
+#define HID_TABLE_MERGE_CELLS "SW_HID_TABLE_MERGE_CELLS"
+#define HID_AUTOFMT_TABLE "SW_HID_AUTOFMT_TABLE"
+#define HID_SWDLG_STRINPUT "SW_HID_SWDLG_STRINPUT"
+#define HID_TABLE_SET_ULSPACE "SW_HID_TABLE_SET_ULSPACE"
+#define HID_TABLE_SET_GRID "SW_HID_TABLE_SET_GRID"
+#define HID_TABLE_SET_SHADOW "SW_HID_TABLE_SET_SHADOW"
+#define HID_TABLE_SELECT_ROW "SW_HID_TABLE_SELECT_ROW"
+#define HID_TABLE_SELECT_COL "SW_HID_TABLE_SELECT_COL"
+#define HID_TABLE_SELECT_ALL "SW_HID_TABLE_SELECT_ALL"
+#define HID_TABLE_SET_READ_ONLY_CELLS "SW_HID_TABLE_SET_READ_ONLY_CELLS"
+#define HID_TABLE_UNSET_READ_ONLY_CELLS "SW_HID_TABLE_UNSET_READ_ONLY_CELLS"
+#define HID_PAGE_STYLE_SET_COLS "SW_HID_PAGE_STYLE_SET_COLS"
+#define HID_SET_PROP_LINE_SPACE "SW_HID_SET_PROP_LINE_SPACE"
+#define HID_SET_ABS_LINE_SPACE "SW_HID_SET_ABS_LINE_SPACE"
+
+#define HID_SPELLING_DLG "SW_HID_SPELLING_DLG"
+#define HID_THESAURUS_DLG "SW_HID_THESAURUS_DLG"
+#define HID_HYPHENATE_OPT_DLG "SW_HID_HYPHENATE_OPT_DLG"
+#define HID_SORTING "SW_HID_SORTING"
+#define HID_SORTING_DLG "SW_HID_SORTING_DLG"
+#define HID_CALCULATE "SW_HID_CALCULATE"
+#define HID_RECORD_MACRO_DLG "SW_HID_RECORD_MACRO_DLG"
+#define HID_PLAY_MACRO_DLG "SW_HID_PLAY_MACRO_DLG"
+#define HID_CONFIG_DLG "SW_HID_CONFIG_DLG"
+#define HID_EXPAND_GLOSSARY "SW_HID_EXPAND_GLOSSARY"
+#define HID_RENAME_GLOSSARY "SW_HID_RENAME_GLOSSARY"
+#define HID_CONFIG_MENU "SW_HID_CONFIG_MENU"
+#define HID_CONFIG_KEY "SW_HID_CONFIG_KEY"
+#define HID_ASSIGN_LOCAL_MACRO_DLG "SW_HID_ASSIGN_LOCAL_MACRO_DLG"
+#define HID_COMPILE_MACRO "SW_HID_COMPILE_MACRO"
+#define HID_CONFIG_VIEWOPTIONS "SW_HID_CONFIG_VIEWOPTIONS"
+#define HID_CONFIG_COLORS "SW_HID_CONFIG_COLORS"
+#define HID_INSERT_GLOSSARY "SW_HID_INSERT_GLOSSARY"
+#define HID_AUTO_CORRECT "SW_HID_AUTO_CORRECT"
+#define HID_AUTO_CORRECT_DLG "SW_HID_AUTO_CORRECT_DLG"
+#define HID_HELP_PI "SW_HID_HELP_PI"
+#define HID_NAVIGATION_PI "SW_HID_NAVIGATION_PI"
+#define HID_TEMPLATE_PI "SW_HID_TEMPLATE_PI"
+#define HID_ADDR_PI "SW_HID_ADDR_PI"
+#define HID_NAVIGATION_PI_GOTO_PAGE "SW_HID_NAVIGATION_PI_GOTO_PAGE"
+#define HID_LETTER_WIZZARD "SW_HID_LETTER_WIZZARD"
+#define HID_FAX_WIZZARD "SW_HID_FAX_WIZZARD"
+#define HID_MEMO_WIZZARD "SW_HID_MEMO_WIZZARD"
+#define HID_AGENDA_WIZZARD "SW_HID_AGENDA_WIZZARD"
+
+#define HID_NEW_WINDOW "SW_HID_NEW_WINDOW"
+#define HID_ARRANGE_ALL_WIN "SW_HID_ARRANGE_ALL_WIN"
+#define HID_ARRANGE_CASCADE_WIN "SW_HID_ARRANGE_CASCADE_WIN"
+#define HID_ARRANGE_HORZ_WIN "SW_HID_ARRANGE_HORZ_WIN"
+#define HID_ARRANGE_VERT_WIN "SW_HID_ARRANGE_VERT_WIN"
+
+#define HID_SHOW_HELP_INDEX "SW_HID_SHOW_HELP_INDEX"
+#define HID_SHOW_KEYBOARD_HELP "SW_HID_SHOW_KEYBOARD_HELP"
+#define HID_SHOW_HELP_MANUAL "SW_HID_SHOW_HELP_MANUAL"
+#define HID_SHOW_UPDATE_HELP "SW_HID_SHOW_UPDATE_HELP"
+
+#define HID_CHAR_LEFT "SW_HID_CHAR_LEFT"
+#define HID_CHAR_RIGHT "SW_HID_CHAR_RIGHT"
+#define HID_LINE_UP "SW_HID_LINE_UP"
+#define HID_LINE_DOWN "SW_HID_LINE_DOWN"
+#define HID_START_OF_LINE "SW_HID_START_OF_LINE"
+#define HID_END_OF_LINE "SW_HID_END_OF_LINE"
+#define HID_START_OF_DOCUMENT "SW_HID_START_OF_DOCUMENT"
+#define HID_END_OF_DOCUMENT "SW_HID_END_OF_DOCUMENT"
+#define HID_START_OF_NEXT_PAGE "SW_HID_START_OF_NEXT_PAGE"
+#define HID_END_OF_NEXT_PAGE "SW_HID_END_OF_NEXT_PAGE"
+#define HID_START_OF_PREV_PAGE "SW_HID_START_OF_PREV_PAGE"
+#define HID_END_OF_PREV_PAGE "SW_HID_END_OF_PREV_PAGE"
+#define HID_START_OF_PAGE "SW_HID_START_OF_PAGE"
+#define HID_END_OF_PAGE "SW_HID_END_OF_PAGE"
+#define HID_START_OF_COLUMN "SW_HID_START_OF_COLUMN"
+#define HID_END_OF_COLUMN "SW_HID_END_OF_COLUMN"
+#define HID_START_OF_PARA "SW_HID_START_OF_PARA"
+#define HID_END_OF_PARA "SW_HID_END_OF_PARA"
+#define HID_NEXT_WORD "SW_HID_NEXT_WORD"
+#define HID_PREV_WORD "SW_HID_PREV_WORD"
+#define HID_NEXT_SENT "SW_HID_NEXT_SENT"
+#define HID_PREV_SENT "SW_HID_PREV_SENT"
+#define HID_DELETE "SW_HID_DELETE"
+#define HID_BACKSPACE "SW_HID_BACKSPACE"
+#define HID_DELETE_SENT "SW_HID_DELETE_SENT"
+#define HID_DELETE_BACK_SENT "SW_HID_DELETE_BACK_SENT"
+#define HID_DELETE_WORD "SW_HID_DELETE_WORD"
+#define HID_DELETE_BACK_WORD "SW_HID_DELETE_BACK_WORD"
+#define HID_DELETE_LINE "SW_HID_DELETE_LINE"
+#define HID_DELETE_BACK_LINE "SW_HID_DELETE_BACK_LINE"
+#define HID_DELETE_PARA "SW_HID_DELETE_PARA"
+#define HID_DELETE_BACK_PARA "SW_HID_DELETE_BACK_PARA"
+#define HID_DELETE_WHOLE_LINE "SW_HID_DELETE_WHOLE_LINE"
+#define HID_SET_INS_MODE "SW_HID_SET_INS_MODE"
+#define HID_PAGEUP "SW_HID_PAGEUP"
+#define HID_PAGEDOWN "SW_HID_PAGEDOWN"
+#define HID_SET_ADD_MODE "SW_HID_SET_ADD_MODE"
+#define HID_SET_EXT_MODE "SW_HID_SET_EXT_MODE"
+#define HID_ESCAPE "SW_HID_ESCAPE"
+#define HID_SELECT_WORD "SW_HID_SELECT_WORD"
+#define HID_START_TABLE "SW_HID_START_TABLE"
+#define HID_END_TABLE "SW_HID_END_TABLE"
+#define HID_NEXT_TABLE "SW_HID_NEXT_TABLE"
+#define HID_PREV_TABLE "SW_HID_PREV_TABLE"
+#define HID_START_OF_NEXT_COLUMN "SW_HID_START_OF_NEXT_COLUMN"
+#define HID_END_OF_NEXT_COLUMN "SW_HID_END_OF_NEXT_COLUMN"
+#define HID_START_OF_PREV_COLUMN "SW_HID_START_OF_PREV_COLUMN"
+#define HID_END_OF_PREV_COLUMN "SW_HID_END_OF_PREV_COLUMN"
+#define HID_FOOTNOTE_TO_ANCHOR "SW_HID_FOOTNOTE_TO_ANCHOR"
+#define HID_NEXT_FOOTNOTE "SW_HID_NEXT_FOOTNOTE"
+#define HID_PREV_FOOTNOTE "SW_HID_PREV_FOOTNOTE"
+#define HID_CNTNT_TO_NEXT_FRAME "SW_HID_CNTNT_TO_NEXT_FRAME"
+#define HID_FRAME_TO_ANCHOR "SW_HID_FRAME_TO_ANCHOR"
+#define HID_TO_HEADER "SW_HID_TO_HEADER"
+#define HID_TO_FOOTER "SW_HID_TO_FOOTER"
+#define HID_IDX_MARK_TO_IDX "SW_HID_IDX_MARK_TO_IDX"
+
+#define HID_ENVELOP "SW_HID_ENVELOP"
+#define HID_LABEL "SW_HID_LABEL"
+#define HID_ENVELOP_PRINT "SW_HID_ENVELOP_PRINT"
+
+#define HID_NAVIGATION_IMGBTN "SW_HID_NAVIGATION_IMGBTN"
+#define HID_ENVELOP_INSERT "SW_HID_ENVELOP_INSERT"
+
+#define HID_WEBTOOLS_TOOLBOX "SW_HID_WEBTOOLS_TOOLBOX"
+#define HID_WEBTEXT_TOOLBOX "SW_HID_WEBTEXT_TOOLBOX"
+#define HID_WEBFRAME_TOOLBOX "SW_HID_WEBFRAME_TOOLBOX"
+#define HID_TEXT_TOOLBOX "SW_HID_TEXT_TOOLBOX"
+#define HID_TABLE_TOOLBOX "SW_HID_TABLE_TOOLBOX"
+#define HID_FRAME_TOOLBOX "SW_HID_FRAME_TOOLBOX"
+#define HID_GRAFIK_TOOLBOX "SW_HID_GRAFIK_TOOLBOX"
+#define HID_OLE_TOOLBOX "SW_HID_OLE_TOOLBOX"
+#define HID_DRAW_TOOLBOX "SW_HID_DRAW_TOOLBOX"
+#define HID_BEZIER_TOOLBOX "SW_HID_BEZIER_TOOLBOX"
+#define HID_DRAW_TEXT_TOOLBOX "SW_HID_DRAW_TEXT_TOOLBOX"
+#define HID_NUM_TOOLBOX "SW_HID_NUM_TOOLBOX"
+#define HID_TOOLS_TOOLBOX "SW_HID_TOOLS_TOOLBOX"
+#define HID_SRCVIEW_TOOLBOX "SW_HID_SRCVIEW_TOOLBOX"
+
+#define HID_LABEL_INSERT "SW_HID_LABEL_INSERT"
+#define HID_CALC_TOOLBOX "SW_HID_CALC_TOOLBOX"
+#define HID_PVIEW_TOOLBOX "SW_HID_PVIEW_TOOLBOX"
+
+#define HID_FIELD_INSERT "SW_HID_FIELD_INSERT"
+#define HID_FIELD_CLOSE "SW_HID_FIELD_CLOSE"
+
+#define HID_COND_COLL_TABLIST "SW_HID_COND_COLL_TABLIST"
+
+#define HID_DB_SELECTION_TLB "SW_HID_DB_SELECTION_TLB"
+#define HID_FIELD_DINF_TYPE "SW_HID_FIELD_DINF_TYPE"
+
+#define HID_DRAWFORM_TOOLBOX "SW_HID_DRAWFORM_TOOLBOX"
+#define HID_SELECT_TEMPLATE "SW_HID_SELECT_TEMPLATE"
+
+#define HID_AP_INSERT_DB_SEL "SW_HID_AP_INSERT_DB_SEL"
+#define HID_WEBGRAPHIC_TOOLBOX "SW_HID_WEBGRAPHIC_TOOLBOX"
+#define HID_OUTLINE_FORM "SW_HID_OUTLINE_FORM"
+#define HID_NUM_RESET "SW_HID_NUM_RESET"
+
+#define HID_AUTOFORMAT_REJECT "SW_HID_AUTOFORMAT_REJECT"
+#define HID_AUTOFORMAT_ACCEPT "SW_HID_AUTOFORMAT_ACCEPT"
+#define HID_AUTOFORMAT_EDIT_CHG "SW_HID_AUTOFORMAT_EDIT_CHG"
+
+//insert index/entries/Pattern buttons and edits
+#define HID_TOX_ENTRY_BUTTON "SW_HID_TOX_ENTRY_BUTTON"
+#define HID_TOX_ENTRY_EDIT "SW_HID_TOX_ENTRY_EDIT"
+
+#define HID_DLG_NEW_USER_IDX "SW_HID_DLG_NEW_USER_IDX"
+#define HID_INSERT_IDX_MRK_OK "SW_HID_INSERT_IDX_MRK_OK"
+#define HID_INSERT_IDX_MRK_CLOSE "SW_HID_INSERT_IDX_MRK_CLOSE"
+#define HID_INSERT_AUTH_MRK_OK "SW_HID_INSERT_AUTH_MRK_OK"
+#define HID_INSERT_AUTH_MRK_CLOSE "SW_HID_INSERT_AUTH_MRK_CLOSE"
+#define HID_INSERT_IDX_MRK_DELETE "SW_HID_INSERT_IDX_MRK_DELETE"
+#define HID_INSERT_IDX_MRK_NEW "SW_HID_INSERT_IDX_MRK_NEW"
+#define HID_INSERT_IDX_MRK_PREV "SW_HID_INSERT_IDX_MRK_PREV"
+#define HID_INSERT_IDX_MRK_PREV_SAME "SW_HID_INSERT_IDX_MRK_PREV_SAME"
+#define HID_INSERT_IDX_MRK_NEXT "SW_HID_INSERT_IDX_MRK_NEXT"
+#define HID_INSERT_IDX_MRK_NEXT_SAME "SW_HID_INSERT_IDX_MRK_NEXT_SAME"
+#define HID_INSERT_IDX_MRK_TYPE "SW_HID_INSERT_IDX_MRK_TYPE"
+#define HID_INSERT_IDX_MRK_ENTRY "SW_HID_INSERT_IDX_MRK_ENTRY"
+#define HID_INSERT_IDX_MRK_PRIM_KEY "SW_HID_INSERT_IDX_MRK_PRIM_KEY"
+#define HID_INSERT_IDX_MRK_SEC_KEY "SW_HID_INSERT_IDX_MRK_SEC_KEY"
+#define HID_INSERT_IDX_MRK_LEVEL "SW_HID_INSERT_IDX_MRK_LEVEL"
+#define HID_INSERT_IDX_MRK_MAIN_ENTRY "SW_HID_INSERT_IDX_MRK_MAIN_ENTRY"
+#define HID_INSERT_IDX_MRK_APPLY_ALL "SW_HID_INSERT_IDX_MRK_APPLY_ALL"
+#define HID_INSERT_AUTH_MRK_ENTRY "SW_HID_INSERT_AUTH_MRK_ENTRY"
+#define HID_INSERT_AUTH_MRK_CREATE_ENTRY "SW_HID_INSERT_AUTH_MRK_CREATE_ENTRY"
+#define HID_INSERT_AUTH_MRK_EDIT_ENTRY "SW_HID_INSERT_AUTH_MRK_EDIT_ENTRY"
+#define HID_TOKEN_WINDOW "SW_HID_TOKEN_WINDOW"
+
+#define HID_AUTH_FIELD_IDENTIFIER "SW_HID_AUTH_FIELD_IDENTIFIER"
+#define HID_AUTH_FIELD_AUTHORITY_TYPE "SW_HID_AUTH_FIELD_AUTHORITY_TYPE"
+#define HID_AUTH_FIELD_ADDRESS "SW_HID_AUTH_FIELD_ADDRESS"
+#define HID_AUTH_FIELD_ANNOTE "SW_HID_AUTH_FIELD_ANNOTE"
+#define HID_AUTH_FIELD_AUTHOR "SW_HID_AUTH_FIELD_AUTHOR"
+#define HID_AUTH_FIELD_BOOKTITLE "SW_HID_AUTH_FIELD_BOOKTITLE"
+#define HID_AUTH_FIELD_CHAPTER "SW_HID_AUTH_FIELD_CHAPTER"
+#define HID_AUTH_FIELD_EDITION "SW_HID_AUTH_FIELD_EDITION"
+#define HID_AUTH_FIELD_EDITOR "SW_HID_AUTH_FIELD_EDITOR"
+#define HID_AUTH_FIELD_HOWPUBLISHED "SW_HID_AUTH_FIELD_HOWPUBLISHED"
+#define HID_AUTH_FIELD_INSTITUTION "SW_HID_AUTH_FIELD_INSTITUTION"
+#define HID_AUTH_FIELD_JOURNAL "SW_HID_AUTH_FIELD_JOURNAL"
+#define HID_AUTH_FIELD_MONTH "SW_HID_AUTH_FIELD_MONTH"
+#define HID_AUTH_FIELD_NOTE "SW_HID_AUTH_FIELD_NOTE"
+#define HID_AUTH_FIELD_NUMBER "SW_HID_AUTH_FIELD_NUMBER"
+#define HID_AUTH_FIELD_ORGANIZATIONS "SW_HID_AUTH_FIELD_ORGANIZATIONS"
+#define HID_AUTH_FIELD_PAGES "SW_HID_AUTH_FIELD_PAGES"
+#define HID_AUTH_FIELD_PUBLISHER "SW_HID_AUTH_FIELD_PUBLISHER"
+#define HID_AUTH_FIELD_SCHOOL "SW_HID_AUTH_FIELD_SCHOOL"
+#define HID_AUTH_FIELD_SERIES "SW_HID_AUTH_FIELD_SERIES"
+#define HID_AUTH_FIELD_TITLE "SW_HID_AUTH_FIELD_TITLE"
+#define HID_AUTH_FIELD_REPORT_TYPE "SW_HID_AUTH_FIELD_REPORT_TYPE"
+#define HID_AUTH_FIELD_VOLUME "SW_HID_AUTH_FIELD_VOLUME"
+#define HID_AUTH_FIELD_YEAR "SW_HID_AUTH_FIELD_YEAR"
+#define HID_AUTH_FIELD_URL "SW_HID_AUTH_FIELD_URL"
+#define HID_AUTH_FIELD_CUSTOM1 "SW_HID_AUTH_FIELD_CUSTOM1"
+#define HID_AUTH_FIELD_CUSTOM2 "SW_HID_AUTH_FIELD_CUSTOM2"
+#define HID_AUTH_FIELD_CUSTOM3 "SW_HID_AUTH_FIELD_CUSTOM3"
+#define HID_AUTH_FIELD_CUSTOM4 "SW_HID_AUTH_FIELD_CUSTOM4"
+#define HID_AUTH_FIELD_CUSTOM5 "SW_HID_AUTH_FIELD_CUSTOM5"
+#define HID_AUTH_FIELD_ISBN "SW_HID_AUTH_FIELD_ISBN"
+
+#define HID_AUTH_MARK_DLG_FROM_COMP_RB "SW_HID_AUTH_MARK_DLG_FROM_COMP_RB"
+#define HID_AUTH_MARK_DLG_FROM_DOC_RB "SW_HID_AUTH_MARK_DLG_FROM_DOC_RB"
+#define HID_AUTH_MARK_DLG_ID_LISTBOX "SW_HID_AUTH_MARK_DLG_ID_LISTBOX"
+
+#define HID_INSERT_INDEX_ENTRY_LEVEL_LB "SW_HID_INSERT_INDEX_ENTRY_LEVEL_LB"
+#define HID_INSERT_IDX_MRK_SRCH_CASESENSITIVE "SW_HID_INSERT_IDX_MRK_SRCH_CASESENSITIVE"
+#define HID_INSERT_IDX_MRK_SRCH_WORDONLY "SW_HID_INSERT_IDX_MRK_SRCH_WORDONLY"
+#define HID_DLG_CREATE_AUTOMARK "SW_HID_DLG_CREATE_AUTOMARK"
+#define HID_BUSINESS_CARD_CONTENT "SW_HID_BUSINESS_CARD_CONTENT"
+#define HID_SAVE_LABEL_DLG "SW_HID_SAVE_LABEL_DLG"
+#define HID_BUSINESS_FMT_PAGE "SW_HID_BUSINESS_FMT_PAGE"
+#define HID_BUSINESS_FMT_PAGE_CONT "SW_HID_BUSINESS_FMT_PAGE_CONT"
+#define HID_BUSINESS_FMT_PAGE_SHEET "SW_HID_BUSINESS_FMT_PAGE_SHEET"
+#define HID_BUSINESS_FMT_PAGE_BRAND "SW_HID_BUSINESS_FMT_PAGE_BRAND"
+#define HID_BUSINESS_FMT_PAGE_TYPE "SW_HID_BUSINESS_FMT_PAGE_TYPE"
+#define HID_SEND_MASTER_DIALOG "SW_HID_SEND_MASTER_DIALOG"
+#define HID_SEND_MASTER_CTRL_PUSHBUTTON_OK "SW_HID_SEND_MASTER_CTRL_PUSHBUTTON_OK"
+#define HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL "SW_HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL"
+#define HID_SEND_MASTER_CTRL_LISTBOX_FILTER "SW_HID_SEND_MASTER_CTRL_LISTBOX_FILTER"
+#define HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW "SW_HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW"
+#define HID_SEND_MASTER_CTRL_EDIT_FILEURL "SW_HID_SEND_MASTER_CTRL_EDIT_FILEURL"
+#define HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION "SW_HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION"
+#define HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE "SW_HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE"
+#define HID_SEND_MASTER_CTRL_DUMMY "SW_HID_SEND_MASTER_CTRL_DUMMY"
+
+#define HID_SEND_HTML_DIALOG "SW_HID_SEND_HTML_DIALOG"
+#define HID_SEND_HTML_CTRL_PUSHBUTTON_OK "SW_HID_SEND_HTML_CTRL_PUSHBUTTON_OK"
+#define HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL "SW_HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL"
+#define HID_SEND_HTML_CTRL_LISTBOX_FILTER "SW_HID_SEND_HTML_CTRL_LISTBOX_FILTER"
+#define HID_SEND_HTML_CTRL_CONTROL_FILEVIEW "SW_HID_SEND_HTML_CTRL_CONTROL_FILEVIEW"
+#define HID_SEND_HTML_CTRL_EDIT_FILEURL "SW_HID_SEND_HTML_CTRL_EDIT_FILEURL"
+#define HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION "SW_HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION"
+#define HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE "SW_HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE"
+#define HID_SEND_HTML_CTRL_DUMMY "SW_HID_SEND_HTML_CTRL_DUMMY"
+
+#define HID_INSERT_IDX_MRK_PHONETIC_READING "SW_HID_INSERT_IDX_MRK_PHONETIC_READING"
+#define HID_COLUMN_VALUESET "SW_HID_COLUMN_VALUESET"
+#define HID_PVIEW_ZOOM_LB "SW_HID_PVIEW_ZOOM_LB"
+#define HID_MAIL_MERGE_SELECT "SW_HID_MAIL_MERGE_SELECT"
+#define HID_MAIL_MERGE_CREATE_FROM "SW_HID_MAIL_MERGE_CREATE_FROM"
+#define HID_MAIL_MERGE_INSERT_FIELDS "SW_HID_MAIL_MERGE_INSERT_FIELDS"
+#define HID_PRINT_AS_MERGE "SW_HID_PRINT_AS_MERGE"
+#define HID_MERGE_SOURCE_UNAVAILABLE "SW_HID_MERGE_SOURCE_UNAVAILABLE"
+#define HID_DATA_SOURCES_UNAVAILABLE "SW_HID_DATA_SOURCES_UNAVAILABLE"
+#define HID_MODULE_TOOLBOX "SW_HID_MODULE_TOOLBOX"
+#define HID_SECTION_INDENTS_PAGE "SW_HID_SECTION_INDENTS_PAGE"
+
+#define HID_FLD_DROPDOWN "SW_HID_FLD_DROPDOWN"
+#define HID_MM_DOCSELECTPAGE "SW_HID_MM_DOCSELECTPAGE"
+#define HID_MM_OUTPUTTYPEPAGE "SW_HID_MM_OUTPUTTYPEPAGE"
+#define HID_MM_ADDRESSBLOCKPAGE "SW_HID_MM_ADDRESSBLOCKPAGE"
+#define HID_MM_GREETINGSPAGE "SW_HID_MM_GREETINGSPAGE"
+#define HID_MM_PREPAREMERGEPAGE "SW_HID_MM_PREPAREMERGEPAGE"
+#define HID_MM_MERGEPAGE "SW_HID_MM_MERGEPAGE"
+#define HID_MM_OUTPUTPAGE "SW_HID_MM_OUTPUTPAGE"
+#define HID_MM_ADDRESSLISTDIALOG "SW_HID_MM_ADDRESSLISTDIALOG"
+#define HID_MM_SELECTDBTABLEDDIALOG "SW_HID_MM_SELECTDBTABLEDDIALOG"
+#define HID_MM_SELECTDBTABLEDDIALOG_LISTBOX "SW_HID_MM_SELECTDBTABLEDDIALOG_LISTBOX"
+#define HID_MM_DBTABLEPREVIEWDIALOG "SW_HID_MM_DBTABLEPREVIEWDIALOG"
+#define HID_MM_CREATEADDRESSLIST "SW_HID_MM_CREATEADDRESSLIST"
+#define HID_MM_FIND_ENTRY "SW_HID_MM_FIND_ENTRY"
+#define HID_MM_ADD_RENAME_ENTRY "SW_HID_MM_ADD_RENAME_ENTRY"
+#define HID_MM_CUSTOMIZE_ADDRESS_LIST "SW_HID_MM_CUSTOMIZE_ADDRESS_LIST"
+#define HID_MM_CUSTOMIZEADDRESSBLOCK "SW_HID_MM_CUSTOMIZEADDRESSBLOCK"
+#define HID_MM_SELECTADDRESSBLOCK "SW_HID_MM_SELECTADDRESSBLOCK"
+#define HID_MM_ASSIGNFIELDS "SW_HID_MM_ASSIGNFIELDS"
+#define HID_MM_MAILNOTINSTALLED "SW_HID_MM_MAILNOTINSTALLED"
+#define HID_MM_LAYOUT_PAGE "SW_HID_MM_LAYOUT_PAGE"
+#define HID_MM_COPYTO "SW_HID_MM_COPYTO"
+#define HID_MM_ADDRESSLIST_HB "SW_HID_MM_ADDRESSLIST_HB"
+#define HID_MM_ADDRESSLIST_TLB "SW_HID_MM_ADDRESSLIST_TLB"
+#define HID_TP_MAILCONFIG "SW_HID_TP_MAILCONFIG"
+#define HID_MM_TESTACCOUNTSETTINGS "SW_HID_MM_TESTACCOUNTSETTINGS"
+#define HID_MM_TESTACCOUNTSETTINGS_TLB "SW_HID_MM_TESTACCOUNTSETTINGS_TLB"
+#define HID_MM_TESTACCOUNTSETTINGS_HB "SW_HID_MM_TESTACCOUNTSETTINGS_HB"
+#define HID_MM_MAILBODY "SW_HID_MM_MAILBODY"
+#define HID_MM_SENDMAILS "SW_HID_MM_SENDMAILS"
+#define HID_MM_SENDMAILS_STATUSLB "SW_HID_MM_SENDMAILS_STATUSLB"
+#define HID_MAILMERGECHILD "SW_HID_MAILMERGECHILD"
+#define HID_MM_CUSTOMFIELDS "SW_HID_MM_CUSTOMFIELDS"
+#define HID_DLG_WORDCOUNT "SW_HID_DLG_WORDCOUNT"
+#define HID_MM_MAILSTATUS_TLB "SW_HID_MM_MAILSTATUS_TLB"
+#define HID_RETURN_TO_MAILMERGE "SW_HID_RETURN_TO_MAILMERGE"
+#define HID_MM_SAVEWARNING "SW_HID_MM_SAVEWARNING"
+#define HID_MM_QUERY "SW_HID_MM_QUERY"
+#define HID_MM_SENDWARNING "SW_HID_MM_SENDWARNING"
+#define HID_MM_SERVERAUTHENTICATION "SW_HID_MM_SERVERAUTHENTICATION"
+
+#define HID_MEDIA_TOOLBOX "SW_HID_MEDIA_TOOLBOX"
+#define HID_NID_TBL "SW_HID_NID_TBL"
+#define HID_NID_FRM "SW_HID_NID_FRM"
+#define HID_NID_GRF "SW_HID_NID_GRF"
+#define HID_NID_OLE "SW_HID_NID_OLE"
+#define HID_NID_PGE "SW_HID_NID_PGE"
+#define HID_NID_OUTL "SW_HID_NID_OUTL"
+#define HID_NID_MARK "SW_HID_NID_MARK"
+#define HID_NID_DRW "SW_HID_NID_DRW"
+#define HID_NID_CTRL "SW_HID_NID_CTRL"
+#define HID_NID_PREV "SW_HID_NID_PREV"
+#define HID_NID_REG "SW_HID_NID_REG"
+#define HID_NID_BKM "SW_HID_NID_BKM"
+#define HID_NID_SEL "SW_HID_NID_SEL"
+#define HID_NID_FTN "SW_HID_NID_FTN"
+#define HID_NID_POSTIT "SW_HID_NID_POSTIT"
+#define HID_NID_SRCH_REP "SW_HID_NID_SRCH_REP"
+#define HID_NID_INDEX_ENTRY "SW_HID_NID_INDEX_ENTRY"
+#define HID_NID_TABLE_FORMULA "SW_HID_NID_TABLE_FORMULA"
+#define HID_NID_TABLE_FORMULA_ERROR "SW_HID_NID_TABLE_FORMULA_ERROR"
+#define HID_NID_NEXT "SW_HID_NID_NEXT"
+#define HID_MM_NEXT_PAGE "SW_HID_MM_NEXT_PAGE"
+#define HID_MM_PREV_PAGE "SW_HID_MM_PREV_PAGE"
+#define HID_MM_GREETINGS_CB_PERSONALIZED "SW_HID_MM_GREETINGS_CB_PERSONALIZED"
+#define HID_MM_GREETINGS_LB_FEMALE "SW_HID_MM_GREETINGS_LB_FEMALE"
+#define HID_MM_GREETINGS_PB_FEMALE "SW_HID_MM_GREETINGS_PB_FEMALE"
+#define HID_MM_GREETINGS_LB_MALE "SW_HID_MM_GREETINGS_LB_MALE"
+#define HID_MM_GREETINGS_PB_MALE "SW_HID_MM_GREETINGS_PB_MALE"
+#define HID_MM_GREETINGS_LB_FEMALECOLUMN "SW_HID_MM_GREETINGS_LB_FEMALECOLUMN"
+#define HID_MM_GREETINGS_CB_FEMALEFIELD "SW_HID_MM_GREETINGS_CB_FEMALEFIELD"
+#define HID_MM_GREETINGS_CB_NEUTRAL "SW_HID_MM_GREETINGS_CB_NEUTRAL"
+#define HID_MM_BODY_CB_PERSONALIZED "SW_HID_MM_BODY_CB_PERSONALIZED"
+#define HID_MM_BODY_LB_FEMALE "SW_HID_MM_BODY_LB_FEMALE"
+#define HID_MM_BODY_PB_FEMALE "SW_HID_MM_BODY_PB_FEMALE"
+#define HID_MM_BODY_LB_MALE "SW_HID_MM_BODY_LB_MALE"
+#define HID_MM_BODY_PB_MALE "SW_HID_MM_BODY_PB_MALE"
+#define HID_MM_BODY_LB_FEMALECOLUMN "SW_HID_MM_BODY_LB_FEMALECOLUMN"
+#define HID_MM_BODY_CB_FEMALEFIELD "SW_HID_MM_BODY_CB_FEMALEFIELD"
+#define HID_MM_BODY_CB_NEUTRAL "SW_HID_MM_BODY_CB_NEUTRAL"
+#define HID_MM_ASSIGN_FIELDS "SW_HID_MM_ASSIGN_FIELDS"
+#define HID_MM_HEADER_0 "SW_HID_MM_HEADER_0"
+#define HID_MM_HEADER_1 "SW_HID_MM_HEADER_1"
+#define HID_MM_HEADER_2 "SW_HID_MM_HEADER_2"
+#define HID_MM_HEADER_3 "SW_HID_MM_HEADER_3"
+#define HID_MM_HEADER_4 "SW_HID_MM_HEADER_4"
+#define HID_MM_HEADER_5 "SW_HID_MM_HEADER_5"
+#define HID_MM_HEADER_6 "SW_HID_MM_HEADER_6"
+#define HID_MM_HEADER_7 "SW_HID_MM_HEADER_7"
+#define HID_MM_HEADER_8 "SW_HID_MM_HEADER_8"
+#define HID_MM_HEADER_9 "SW_HID_MM_HEADER_9"
+#define HID_MM_HEADER_10 "SW_HID_MM_HEADER_10"
+#define HID_MM_HEADER_11 "SW_HID_MM_HEADER_11"
+#define HID_MM_HEADER_12 "SW_HID_MM_HEADER_12"
+#define HID_MM_HEADER_13 "SW_HID_MM_HEADER_13"
+
+#define HID_ITM_HOR_LEFT "SW_HID_ITM_HOR_LEFT"
+#define HID_ITM_HOR_CNTR "SW_HID_ITM_HOR_CNTR"
+#define HID_ITM_HOR_RGHT "SW_HID_ITM_HOR_RGHT"
+#define HID_ITM_VER_LEFT "SW_HID_ITM_VER_LEFT"
+#define HID_ITM_VER_CNTR "SW_HID_ITM_VER_CNTR"
+#define HID_ITM_VER_RGHT "SW_HID_ITM_VER_RGHT"
+
+#define HID_TBX_FORMULA_CALC "SW_HID_TBX_FORMULA_CALC"
+#define HID_TBX_FORMULA_CANCEL "SW_HID_TBX_FORMULA_CANCEL"
+#define HID_TBX_FORMULA_APPLY "SW_HID_TBX_FORMULA_APPLY"
+
diff --git a/sw/inc/hfspacingitem.hxx b/sw/inc/hfspacingitem.hxx
new file mode 100644
index 000000000000..0a4103688335
--- /dev/null
+++ b/sw/inc/hfspacingitem.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_HF_EAT_SPACINGITEM_HXX
+#define _SW_HF_EAT_SPACINGITEM_HXX
+
+
+#include <svl/eitem.hxx>
+#include <hintids.hxx>
+#include <format.hxx>
+
+class IntlWrapper;
+
+class SW_DLLPUBLIC SwHeaderAndFooterEatSpacingItem : public SfxBoolItem
+{
+public:
+ SwHeaderAndFooterEatSpacingItem( sal_uInt16 nId = RES_HEADER_FOOTER_EAT_SPACING,
+ sal_Bool bPrt = sal_False ) : SfxBoolItem( nId, bPrt ) {}
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+inline const SwHeaderAndFooterEatSpacingItem &SwAttrSet::GetHeaderAndFooterEatSpacing(sal_Bool bInP) const
+ { return (const SwHeaderAndFooterEatSpacingItem&)Get( RES_HEADER_FOOTER_EAT_SPACING,bInP); }
+
+inline const SwHeaderAndFooterEatSpacingItem &SwFmt::GetHeaderAndFooterEatSpacing(sal_Bool bInP) const
+ { return aSet.GetHeaderAndFooterEatSpacing(bInP); }
+
+#endif
+
diff --git a/sw/inc/hhcwrp.hxx b/sw/inc/hhcwrp.hxx
new file mode 100644
index 000000000000..7b60590db033
--- /dev/null
+++ b/sw/inc/hhcwrp.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _HHCWRP_HXX
+#define _HHCWRP_HXX
+
+#include <editeng/hangulhanja.hxx>
+#include <pam.hxx>
+
+class SwView;
+class Window;
+class SwWrtShell;
+struct SwConversionArgs;
+
+//////////////////////////////////////////////////////////////////////
+
+class SwHHCWrapper : public editeng::HangulHanjaConversion
+{
+ SwView * pView;
+ Window* pWin;
+ SwWrtShell &rWrtShell;
+
+ SwConversionArgs *pConvArgs; // object for arguments (and results) needed
+ // to find of next convertible text portion
+
+ xub_StrLen nLastPos; // starting position of the last found text part
+ // (needs to be sth that gets not moved like
+ // SwPaM or SwPosition by replace operations!)
+ sal_Int32 nUnitOffset;
+
+ sal_uInt16 nPageCount; // page count for progress bar
+ sal_uInt16 nPageStart; // first checked page
+
+ sal_Bool bIsDrawObj;
+ sal_Bool bIsStart;
+ sal_Bool bIsOtherCntnt;
+ sal_Bool bStartChk;
+ sal_Bool bIsSelection; // true if only the selected text should be converted
+ sal_Bool bInfoBox; // true if message should be displayed at the end
+ sal_Bool bIsConvSpecial; // true if special regions: header, footer, ... should be converted
+ sal_Bool bStartDone;
+ sal_Bool bEndDone;
+// sal_Bool bLastRet;
+
+ // from SvxSpellWrapper copied and modified
+ sal_Bool ConvNext_impl(); // former SpellNext
+ sal_Bool FindConvText_impl(); // former FindSpellError
+
+ // from SwSpellWrapper copied and modified
+ sal_Bool HasOtherCnt_impl();
+ void ConvStart_impl( SwConversionArgs *pConvArgs, SvxSpellArea eSpell ); // former SpellStart
+ void ConvEnd_impl( SwConversionArgs *pConvArgs ); // former SpellEnd
+ sal_Bool ConvContinue_impl( SwConversionArgs *pConvArgs ); // former SpellContinue
+
+ void SelectNewUnit_impl( const sal_Int32 nUnitStart,
+ const sal_Int32 nUnitEnd );
+ void ChangeText( const String &rNewText,
+ const ::rtl::OUString& rOrigText,
+ const ::com::sun::star::uno::Sequence< sal_Int32 > *pOffsets,
+ SwPaM *pCrsr );
+ void ChangeText_impl( const String &rNewText, sal_Bool bKeepAttributes );
+
+ inline sal_Bool IsDrawObj() { return bIsDrawObj; }
+ inline void SetDrawObj( sal_Bool bNew ) { bIsDrawObj = bNew; }
+
+protected:
+ virtual void GetNextPortion( ::rtl::OUString& rNextPortion,
+ LanguageType& rLangOfPortion,
+ sal_Bool bAllowImplicitChangesForNotConvertibleText );
+ virtual void HandleNewUnit( const sal_Int32 nUnitStart,
+ const sal_Int32 nUnitEnd );
+ virtual void ReplaceUnit(
+ const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd,
+ const ::rtl::OUString& rOrigText,
+ const ::rtl::OUString& rReplaceWith,
+ const ::com::sun::star::uno::Sequence< sal_Int32 > &rOffsets,
+ ReplacementAction eAction,
+ LanguageType *pNewUnitLanguage );
+
+ virtual sal_Bool HasRubySupport() const;
+
+public:
+ SwHHCWrapper(
+ SwView* pView,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF,
+ LanguageType nSourceLanguage, LanguageType nTargetLanguage,
+ const Font *pTargetFont,
+ sal_Int32 nConvOptions, sal_Bool bIsInteractive,
+ sal_Bool bStart, sal_Bool bOther, sal_Bool bSelection );
+
+ virtual ~SwHHCWrapper();
+
+ void Convert();
+};
+
+
+#endif
+
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
new file mode 100644
index 000000000000..c7aa3638d90a
--- /dev/null
+++ b/sw/inc/hintids.hxx
@@ -0,0 +1,486 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _HINTIDS_HXX
+#define _HINTIDS_HXX
+
+#include <tools/solar.h> // fuer __FAR_DATA
+#include <sal/types.h> // for sal_Unicode
+#include "swdllapi.h"
+
+// fuer SwTxtHints ohne Endindex wird folgendes Zeichen eingefuegt:
+//JP 24.05.00: for the new UniCode Version:
+#define CH_TXTATR_BREAKWORD ((sal_Unicode)0x01)
+#define CH_TXTATR_INWORD ((sal_Unicode)0x02)
+#define CH_TXTATR_TAB ((sal_Unicode)'\t')
+#define CH_TXTATR_NEWLINE ((sal_Unicode)'\n')
+#define CH_TXT_ATR_FIELDSTART ((sal_Unicode)0x04)
+#define CH_TXT_ATR_FIELDEND ((sal_Unicode)0x05)
+#define CH_TXT_ATR_SUBST_FIELDSTART ("[")
+#define CH_TXT_ATR_SUBST_FIELDEND ("]")
+#define CH_TXT_ATR_FORMELEMENT ((sal_Unicode)0x06)
+
+/*
+ * Hier kommen erst mal die enums fuer die Hints
+ */
+
+#define HINT_BEGIN 1
+
+#define POOLATTR_BEGIN HINT_BEGIN
+#define POOLATTR_END RES_UNKNOWNATR_END
+
+// Bereiche fuer die Id's der einzelnen Format-Attribute
+// die Which-Werte fuer die Charakter-Format Attribute
+enum RES_CHRATR
+{
+RES_CHRATR_BEGIN = HINT_BEGIN,
+ RES_CHRATR_CASEMAP = RES_CHRATR_BEGIN, // 1
+ RES_CHRATR_CHARSETCOLOR, // 2
+ RES_CHRATR_COLOR, // 3
+ RES_CHRATR_CONTOUR, // 4
+ RES_CHRATR_CROSSEDOUT, // 5
+ RES_CHRATR_ESCAPEMENT, // 6
+ RES_CHRATR_FONT, // 7
+ RES_CHRATR_FONTSIZE, // 8
+ RES_CHRATR_KERNING, // 9
+ RES_CHRATR_LANGUAGE, // 10
+ RES_CHRATR_POSTURE, // 11
+ RES_CHRATR_PROPORTIONALFONTSIZE, // 12
+ RES_CHRATR_SHADOWED, // 13
+ RES_CHRATR_UNDERLINE, // 14
+ RES_CHRATR_WEIGHT, // 15
+ RES_CHRATR_WORDLINEMODE, // 16
+ RES_CHRATR_AUTOKERN, // 17
+ RES_CHRATR_BLINK, // 18
+ RES_CHRATR_NOHYPHEN, // 19
+ RES_CHRATR_NOLINEBREAK, // 20
+ RES_CHRATR_BACKGROUND, // 21
+ RES_CHRATR_CJK_FONT, // 22
+ RES_CHRATR_CJK_FONTSIZE, // 23
+ RES_CHRATR_CJK_LANGUAGE, // 24
+ RES_CHRATR_CJK_POSTURE, // 25
+ RES_CHRATR_CJK_WEIGHT, // 26
+ RES_CHRATR_CTL_FONT, // 27
+ RES_CHRATR_CTL_FONTSIZE, // 28
+ RES_CHRATR_CTL_LANGUAGE, // 29
+ RES_CHRATR_CTL_POSTURE, // 30
+ RES_CHRATR_CTL_WEIGHT, // 31
+ RES_CHRATR_ROTATE, // 32
+ RES_CHRATR_EMPHASIS_MARK, // 33
+ RES_CHRATR_TWO_LINES, // 34
+ RES_CHRATR_SCALEW, // 35
+ RES_CHRATR_RELIEF, // 36
+ RES_CHRATR_HIDDEN, // 37
+ RES_CHRATR_OVERLINE, // 38
+ RES_CHRATR_DUMMY1, // 39
+ RES_CHRATR_DUMMY2, // 40
+RES_CHRATR_END
+};
+
+// diese Attribute stehen nur im SwpAttr-Array vom TextNode
+enum RES_TXTATR
+{
+RES_TXTATR_BEGIN = RES_CHRATR_END,
+
+/** text attributes with start and end.
+ #i105453#:
+ Hints (SwTxtAttr) with the same start and end position are sorted by
+ WhichId, i.e., the TXTATR constants defined here.
+ The text formatting (SwAttrIter) poses some requirements on TXTATR order:
+ - AUTOFMT must precede CHARFMT, so that auto style can overwrite char style.
+ - INETFMT must precede CHARFMT, so that link style can overwrite char style.
+ (this is actually surprising: CHARFMT hints are not split at INETFMT
+ hints on insertion, but on exporting to ODF. if CHARFMT would precede
+ INETFMT, then exporting and importing will effectively change precedence)
+
+ Nesting hints (SwTxtAttrNesting) also have requirements on TXTATR order,
+ to ensure proper nesting (because CJK_RUBY and INETFMT have no CH_TXTATR):
+ - INETFMT should precede CJK_RUBY (for UNO API it does not matter...)
+ - META and METAFIELD must precede CJK_RUBY and INETFMT
+ */
+RES_TXTATR_WITHEND_BEGIN = RES_TXTATR_BEGIN ,
+ RES_TXTATR_REFMARK = RES_TXTATR_WITHEND_BEGIN, // 41
+ RES_TXTATR_TOXMARK, // 42
+ RES_TXTATR_META, // 43
+ RES_TXTATR_METAFIELD, // 44
+ RES_TXTATR_AUTOFMT, // 45
+ RES_TXTATR_INETFMT, // 46
+ RES_TXTATR_CHARFMT, // 47
+ RES_TXTATR_CJK_RUBY, // 48
+ RES_TXTATR_UNKNOWN_CONTAINER, // 49
+ RES_TXTATR_DUMMY5, // 50
+RES_TXTATR_WITHEND_END,
+
+// alle TextAttribute ohne ein Ende
+RES_TXTATR_NOEND_BEGIN = RES_TXTATR_WITHEND_END,
+ RES_TXTATR_FIELD = RES_TXTATR_NOEND_BEGIN, // 51
+ RES_TXTATR_FLYCNT, // 52
+ RES_TXTATR_FTN, // 53
+ RES_TXTATR_DUMMY4, // 54
+ RES_TXTATR_DUMMY3, // 55
+ RES_TXTATR_DUMMY1, // 56
+ RES_TXTATR_DUMMY2, // 57
+RES_TXTATR_NOEND_END,
+RES_TXTATR_END = RES_TXTATR_NOEND_END
+};
+
+enum RES_PARATR
+{
+RES_PARATR_BEGIN = RES_TXTATR_END,
+ RES_PARATR_LINESPACING = RES_PARATR_BEGIN, // 58
+ RES_PARATR_ADJUST, // 59
+ RES_PARATR_SPLIT, // 60
+ RES_PARATR_ORPHANS, // 61
+ RES_PARATR_WIDOWS, // 62
+ RES_PARATR_TABSTOP, // 63
+ RES_PARATR_HYPHENZONE, // 64
+ RES_PARATR_DROP, // 65
+ RES_PARATR_REGISTER, // 66
+ RES_PARATR_NUMRULE, // 67
+ RES_PARATR_SCRIPTSPACE, // 68
+ RES_PARATR_HANGINGPUNCTUATION, // 69
+ RES_PARATR_FORBIDDEN_RULES, // 70
+ RES_PARATR_VERTALIGN, // 71
+ RES_PARATR_SNAPTOGRID, // 72
+ RES_PARATR_CONNECT_BORDER, // 73
+ RES_PARATR_OUTLINELEVEL, // 74
+RES_PARATR_END
+};
+
+// --> OD 2008-02-25 #refactorlists#
+// list attributes for paragraphs.
+// intentionally these list attributes are not contained in paragraph styles
+enum RES_PARATR_LIST
+{
+RES_PARATR_LIST_BEGIN = RES_PARATR_END,
+ RES_PARATR_LIST_ID = RES_PARATR_LIST_BEGIN, // 75
+ RES_PARATR_LIST_LEVEL, // 76
+ RES_PARATR_LIST_ISRESTART, // 77
+ RES_PARATR_LIST_RESTARTVALUE, // 78
+ RES_PARATR_LIST_ISCOUNTED, // 79
+RES_PARATR_LIST_END
+};
+// <--
+
+enum RES_FRMATR
+{
+RES_FRMATR_BEGIN = RES_PARATR_LIST_END,
+ RES_FILL_ORDER = RES_FRMATR_BEGIN, // 80
+ RES_FRM_SIZE, // 81
+ RES_PAPER_BIN, // 82
+ RES_LR_SPACE, // 83
+ RES_UL_SPACE, // 84
+ RES_PAGEDESC, // 85
+ RES_BREAK, // 86
+ RES_CNTNT, // 87
+ RES_HEADER, // 88
+ RES_FOOTER, // 89
+ RES_PRINT, // 90
+ RES_OPAQUE, // 91
+ RES_PROTECT, // 92
+ RES_SURROUND, // 93
+ RES_VERT_ORIENT, // 94
+ RES_HORI_ORIENT, // 95
+ RES_ANCHOR, // 96
+ RES_BACKGROUND, // 97
+ RES_BOX, // 98
+ RES_SHADOW, // 99
+ RES_FRMMACRO, // 100
+ RES_COL, // 101
+ RES_KEEP, // 102
+ RES_URL, // 103
+ RES_EDIT_IN_READONLY, // 104
+ RES_LAYOUT_SPLIT, // 105
+ RES_CHAIN, // 106
+ RES_TEXTGRID, // 107
+ RES_LINENUMBER , // 108
+ RES_FTN_AT_TXTEND, // 109
+ RES_END_AT_TXTEND, // 110
+ RES_COLUMNBALANCE, // 111
+ RES_FRAMEDIR, // 112
+ RES_HEADER_FOOTER_EAT_SPACING, // 113
+ RES_ROW_SPLIT, // 114
+ // OD 18.09.2003 #i18732# - insert new item and 5 dummies
+ RES_FOLLOW_TEXT_FLOW, // 115
+// --> collapsing borders FME 2005-05-27 #i29550#
+ RES_COLLAPSING_BORDERS, // 116
+// <-- collapsing
+ // OD 2004-05-04 #i28701# - use dummy1 for new item
+ RES_WRAP_INFLUENCE_ON_OBJPOS, // 117
+ RES_AUTO_STYLE, // 118
+ RES_FRMATR_STYLE_NAME, // 119
+ RES_FRMATR_CONDITIONAL_STYLE_NAME, // 120
+RES_FRMATR_END
+};
+
+enum RES_GRFATR
+{
+RES_GRFATR_BEGIN = RES_FRMATR_END,
+ RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN, // 121
+ RES_GRFATR_CROPGRF, // 122
+
+ RES_GRFATR_ROTATION, // 123
+ RES_GRFATR_LUMINANCE, // 124
+ RES_GRFATR_CONTRAST, // 125
+ RES_GRFATR_CHANNELR, // 126
+ RES_GRFATR_CHANNELG, // 127
+ RES_GRFATR_CHANNELB, // 128
+ RES_GRFATR_GAMMA, // 129
+ RES_GRFATR_INVERT, // 130
+ RES_GRFATR_TRANSPARENCY, // 131
+ RES_GRFATR_DRAWMODE, // 132
+
+ RES_GRFATR_DUMMY1, // 133
+ RES_GRFATR_DUMMY2, // 134
+ RES_GRFATR_DUMMY3, // 135
+ RES_GRFATR_DUMMY4, // 136
+ RES_GRFATR_DUMMY5, // 137
+RES_GRFATR_END
+};
+
+enum RES_BOXATR
+{
+RES_BOXATR_BEGIN = RES_GRFATR_END,
+ RES_BOXATR_FORMAT = RES_BOXATR_BEGIN, // 138
+ RES_BOXATR_FORMULA, // 139
+ RES_BOXATR_VALUE, // 140
+RES_BOXATR_END
+};
+
+enum RES_UNKNOWNATR
+{
+RES_UNKNOWNATR_BEGIN = RES_BOXATR_END,
+ RES_UNKNOWNATR_CONTAINER = RES_UNKNOWNATR_BEGIN,// 141
+RES_UNKNOWNATR_END
+};
+
+
+
+// ID-s fuer die Formate
+enum RES_FMT
+{
+RES_FMT_BEGIN = RES_UNKNOWNATR_END,
+ RES_CHRFMT = RES_FMT_BEGIN,
+ RES_FRMFMT,
+ RES_FLYFRMFMT,
+ RES_TXTFMTCOLL,
+ RES_GRFFMTCOLL,
+ RES_DRAWFRMFMT,
+ RES_CONDTXTFMTCOLL,
+RES_FMT_END
+};
+
+// die ID's fuer Messages in den Formaten
+enum RES_MSG
+{
+RES_MSG_BEGIN = RES_FMT_END,
+ RES_OBJECTDYING = RES_MSG_BEGIN,
+ RES_FMT_CHG,
+ RES_ATTRSET_CHG,
+ RES_FRM_SIZECHG,
+ RES_TXTATR_FLDCHG,
+ RES_TXTATR_EMPTYCHG,
+ RES_INS_CHR,
+ RES_INS_TXT,
+ RES_DEL_CHR,
+ RES_DEL_TXT,
+ RES_UPDATE_ATTR,
+ RES_PAGEDESC_FTNINFO,
+ RES_REFMARKFLD_UPDATE,
+ RES_DOCPOS_UPDATE,
+ RES_TABLEFML_UPDATE,
+ RES_UPDATEDDETBL,
+ RES_TBLHEADLINECHG,
+ RES_AUTOFMT_DOCNODE,
+ RES_REPAINT,
+ RES_DOC_DTOR,
+ RES_SECTION_HIDDEN,
+ RES_SECTION_NOT_HIDDEN,
+ RES_GRAPHIC_ARRIVED,
+ RES_GRAPHIC_PIECE_ARRIVED,
+ RES_HIDDENPARA_PRINT,
+ RES_CONDCOLL_CONDCHG,
+ RES_VIRTPAGENUM_INFO,
+ // --> OD 2008-02-25 #refactorlists#
+// RES_GETNUMNODES,
+ // <--
+ RES_GETLOWERNUMLEVEL,
+ RES_RESET_FMTWRITTEN,
+ RES_REMOVE_UNO_OBJECT,
+ RES_GRF_REREAD_AND_INCACHE,
+ RES_SECTION_RESETHIDDENFLAG,
+ RES_FINDNEARESTNODE,
+ RES_CONTENT_VISIBLE,
+ RES_FOOTNOTE_DELETED,
+ RES_REFMARK_DELETED,
+ RES_TOXMARK_DELETED,
+ RES_GRAPHIC_SWAPIN,
+ RES_FIELD_DELETED,
+ RES_NAME_CHANGED,
+ RES_TITLE_CHANGED,
+ RES_DESCRIPTION_CHANGED,
+ RES_UNOCURSOR_LEAVES_SECTION,
+ RES_LINKED_GRAPHIC_STREAM_ARRIVED,
+RES_MSG_END
+};
+
+
+// eine ID fuer den RTF-Reader. Die Stylesheets werden wie
+// Attribute behandelt, d.H. es gibt ein StyleSheet Attribut. Um
+// nicht mit anderen Which()-Werten zu kollidieren, ist der Wert
+// hier mit aufgefuehrt. (Auch das Hilfesystem definiert neue
+// Attribute !!)
+enum RES_FLTRATTR
+{
+RES_FLTRATTR_BEGIN = RES_MSG_END,
+ RES_FLTR_STYLESHEET = RES_FLTRATTR_BEGIN,
+ RES_FLTR_BOOKMARK,
+ RES_FLTR_ANCHOR,
+ RES_FLTR_BORDER,
+ RES_FLTR_NUMRULE,
+ RES_FLTR_NUMRULE_NUM,
+ RES_FLTR_SDR_ANCHOR,
+ RES_FLTR_TOX,
+ RES_FLTR_SECTION,
+ RES_FLTR_REDLINE,
+ RES_FLTR_SCRIPTTYPE,
+RES_FLTRATTR_END
+};
+
+#define RES_TBX_DUMMY RES_FLTRATTR_END + 1
+
+#define HINT_END RES_TBX_DUMMY
+
+// Fehler-Erkennung !!
+#define INVALID_HINT HINT_END
+#define RES_WHICHHINT_END HINT_END
+
+
+inline bool isATR(const sal_uInt16 nWhich)
+{
+ return (RES_CHRATR_BEGIN <= nWhich) && (RES_UNKNOWNATR_END > nWhich);
+}
+inline bool isCHRATR(const sal_uInt16 nWhich)
+{
+ return (RES_CHRATR_BEGIN <= nWhich) && (RES_CHRATR_END > nWhich);
+}
+inline bool isTXTATR_WITHEND(const sal_uInt16 nWhich)
+{
+ return (RES_TXTATR_WITHEND_BEGIN <= nWhich)
+ && (RES_TXTATR_WITHEND_END > nWhich);
+}
+inline bool isTXTATR_NOEND(const sal_uInt16 nWhich)
+{
+ return (RES_TXTATR_NOEND_BEGIN <= nWhich)
+ && (RES_TXTATR_NOEND_END > nWhich);
+}
+inline bool isTXTATR(const sal_uInt16 nWhich)
+{
+ return (RES_TXTATR_BEGIN <= nWhich) && (RES_TXTATR_END > nWhich);
+}
+inline bool isPARATR(const sal_uInt16 nWhich)
+{
+ return (RES_PARATR_BEGIN <= nWhich) && (RES_PARATR_END > nWhich);
+}
+inline bool isPARATR_LIST(const sal_uInt16 nWhich)
+{
+ return (RES_PARATR_LIST_BEGIN <= nWhich) && (RES_PARATR_LIST_END > nWhich); }
+inline bool isFRMATR(const sal_uInt16 nWhich)
+{
+ return (RES_FRMATR_BEGIN <= nWhich) && (RES_FRMATR_END > nWhich);
+}
+inline bool isGRFATR(const sal_uInt16 nWhich)
+{
+ return (RES_GRFATR_BEGIN <= nWhich) && (RES_GRFATR_END > nWhich);
+}
+inline bool isBOXATR(const sal_uInt16 nWhich)
+{
+ return (RES_BOXATR_BEGIN <= nWhich) && (RES_BOXATR_END > nWhich);
+}
+inline bool isUNKNOWNATR(const sal_uInt16 nWhich)
+{
+ return (RES_UNKNOWNATR_BEGIN <= nWhich) && (RES_UNKNOWNATR_END > nWhich);
+}
+
+
+/*
+ * hole aus der statischen Default-Attribut Tabelle ueber den Which-Wert
+ * das entsprechende default Attribut.
+ * Ist keines vorhanden, returnt ein 0-Pointer !!!
+ *
+ * Diese Funktion ist im Init.CXX implementiert. Damit die Formate darauf
+ * zugreifen koennen, ist sie hier als extern deklariert.
+ * Im PRODUCT ist das Teil inline.
+ */
+class SfxPoolItem;
+struct SfxItemInfo;
+typedef SfxPoolItem* SwDfltAttrTab[ POOLATTR_END - POOLATTR_BEGIN ];
+
+extern SwDfltAttrTab __FAR_DATA aAttrTab;
+extern SfxItemInfo __FAR_DATA aSlotTab[];
+
+SW_DLLPUBLIC const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich );
+
+SW_DLLPUBLIC sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript );
+
+// return for the given TextAttribut without an end the correct character.
+// This function returns
+// CH_TXTATR_BREAKWORD for Textattribut which breaks a word (default)
+// CH_TXTATR_INWORD for Textattribut which dont breaks a word
+class SwTxtAttr;
+sal_Unicode GetCharOfTxtAttr( const SwTxtAttr& rAttr );
+
+// alle Sets stehen im init.cxx
+
+// AttrSet-Range fuer die 3 Break-Attribute
+extern sal_uInt16 __FAR_DATA aBreakSetRange[];
+// AttrSet-Range fuer die TxtFmtColl
+extern sal_uInt16 __FAR_DATA aTxtFmtCollSetRange[];
+// AttrSet-Range fuer die GrfFmtColl
+extern sal_uInt16 __FAR_DATA aGrfFmtCollSetRange[];
+// AttrSet-Range fuer die TextNode
+SW_DLLPUBLIC extern sal_uInt16 __FAR_DATA aTxtNodeSetRange[];
+// AttrSet-Range fuer die NoTxtNode
+extern sal_uInt16 __FAR_DATA aNoTxtNodeSetRange[];
+// AttrSet-Range fuer die SwTable
+extern sal_uInt16 __FAR_DATA aTableSetRange[];
+// AttrSet-Range fuer die SwTableLine
+extern sal_uInt16 __FAR_DATA aTableLineSetRange[];
+// AttrSet-Range fuer die SwTableBox
+extern sal_uInt16 __FAR_DATA aTableBoxSetRange[];
+// AttrSet-Range fuer die SwFrmFmt
+SW_DLLPUBLIC extern sal_uInt16 __FAR_DATA aFrmFmtSetRange[];
+// AttrSet-Range fuer die SwCharFmt
+extern sal_uInt16 __FAR_DATA aCharFmtSetRange[];
+// AttrSet-Range fuer die character autostyles
+extern sal_uInt16 __FAR_DATA aCharAutoFmtSetRange[];
+// AttrSet-Range fuer die SwPageDescFmt
+extern sal_uInt16 __FAR_DATA aPgFrmFmtSetRange[];
+
+// check if ID is InRange of AttrSet-Ids
+sal_Bool IsInRange( const sal_uInt16* pRange, const sal_uInt16 nId );
+
+#endif
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
new file mode 100644
index 000000000000..8476d8542f70
--- /dev/null
+++ b/sw/inc/hints.hxx
@@ -0,0 +1,284 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _HINTS_HXX
+#define _HINTS_HXX
+
+#ifndef _TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+#include <swatrset.hxx>
+
+class SwFmt;
+class OutputDevice;
+class SwTable;
+class SwNode;
+class SwNodes;
+class SwCntntNode;
+class SwPageFrm;
+class SwFrm;
+class SwTxtNode;
+class SwHistory;
+
+// Basis-Klasse fuer alle Message-Hints:
+// "Overhead" vom SfxPoolItem wird hier behandelt
+class SwMsgPoolItem : public SfxPoolItem
+{
+public:
+ SwMsgPoolItem( sal_uInt16 nWhich );
+
+ // "Overhead" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+};
+
+
+// ---------------------------------------
+// SwPtrMsgPoolItem (altes SwObjectDying!)
+// ---------------------------------------
+
+class SwPtrMsgPoolItem : public SwMsgPoolItem
+{
+public:
+ void * pObject;
+
+ SwPtrMsgPoolItem( sal_uInt16 nId, void * pObj )
+ : SwMsgPoolItem( nId ), pObject( pObj )
+ {}
+};
+
+
+
+/*
+ * SwFmtChg wird verschickt, wenn ein Format gegen ein anderes
+ * Format ausgewechselt worden ist. Es werden immer 2. Hints verschickt,
+ * das alte und neue Format.
+ */
+class SwFmtChg: public SwMsgPoolItem
+{
+public:
+ SwFmt *pChangedFmt;
+ SwFmtChg( SwFmt *pFmt );
+};
+
+
+class SwInsTxt: public SwMsgPoolItem
+{
+public:
+ xub_StrLen nPos;
+ xub_StrLen nLen;
+
+ SwInsTxt( xub_StrLen nP, xub_StrLen nL );
+};
+
+class SwDelChr: public SwMsgPoolItem
+{
+public:
+ xub_StrLen nPos;
+
+ SwDelChr( xub_StrLen nP );
+};
+
+class SwDelTxt: public SwMsgPoolItem
+{
+public:
+ xub_StrLen nStart;
+ xub_StrLen nLen;
+
+ SwDelTxt( xub_StrLen nS, xub_StrLen nL );
+};
+
+class SwUpdateAttr: public SwMsgPoolItem
+{
+public:
+ xub_StrLen nStart;
+ xub_StrLen nEnd;
+ sal_uInt16 nWhichAttr;
+ SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, sal_uInt16 nW );
+};
+
+
+// SwRefMarkFldUpdate wird verschickt, wenn sich die ReferenzMarkierungen
+// Updaten sollen. Um Seiten-/KapitelNummer feststellen zu koennen, muss
+// der akt. Frame befragt werden. Dafuer wird das akt. OutputDevice benoetigt.
+class SwRefMarkFldUpdate : public SwMsgPoolItem
+{
+public:
+ const OutputDevice* pOut; // Pointer auf das aktuelle Output-Device
+ SwRefMarkFldUpdate( const OutputDevice* );
+};
+
+// SwDocPosUpdate wird verschickt, um zu signalisieren, dass nur die
+// Frames ab oder bis zu einer bestimmten dokument-globalen Position
+// geupdated werden brauchen. Zur Zeit wird dies nur beim Updaten
+// von Seitennummernfeldern benoetigt.
+
+class SwDocPosUpdate : public SwMsgPoolItem
+{
+public:
+ const long nDocPos;
+ SwDocPosUpdate( const long nDocPos );
+};
+
+// SwTableFmlUpdate wird verschickt, wenn sich die Tabelle neu berechnen soll
+// JP 16.02.99: oder wenn die Tabelle selbst gemergt oder gesplittet wird
+enum TableFmlUpdtFlags { TBL_CALC = 0,
+ TBL_BOXNAME,
+ TBL_BOXPTR,
+ TBL_RELBOXNAME,
+ TBL_MERGETBL,
+ TBL_SPLITTBL
+ };
+class SwTableFmlUpdate : public SwMsgPoolItem
+{
+public:
+ const SwTable* pTbl; // Pointer auf die zu aktuelle Tabelle
+ union {
+ const SwTable* pDelTbl; // Merge: Ptr auf die zu loeschende Tabelle
+ const String* pNewTblNm; // Split: der Name der neuen Tabelle
+ } DATA;
+ SwHistory* pHistory;
+ sal_uInt16 nSplitLine; // Split: ab dieser BaseLine wird gespl.
+ TableFmlUpdtFlags eFlags;
+ sal_Bool bModified : 1;
+ sal_Bool bBehindSplitLine : 1;
+
+ SwTableFmlUpdate( const SwTable* );
+};
+
+
+class SwAutoFmtGetDocNode: public SwMsgPoolItem
+{
+public:
+ const SwCntntNode* pCntntNode;
+ const SwNodes* pNodes;
+
+ SwAutoFmtGetDocNode( const SwNodes* pNds );
+};
+
+/*
+ * SwAttrSetChg wird verschicht, wenn sich in dem SwAttrSet rTheChgdSet
+ * etwas veraendert hat. Es werden immer 2. Hints
+ * verschickt, die alten und neuen Items in dem rTheChgdSet.
+ */
+class SwAttrSetChg: public SwMsgPoolItem
+{
+ sal_Bool bDelSet;
+ SwAttrSet* pChgSet; // was sich veraendert hat
+ const SwAttrSet* pTheChgdSet; // wird nur zum Vergleichen gebraucht !!
+public:
+ SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet );
+ SwAttrSetChg( const SwAttrSetChg& );
+ ~SwAttrSetChg();
+
+ // was sich veraendert hat
+ const SwAttrSet* GetChgSet() const { return pChgSet; }
+ SwAttrSet* GetChgSet() { return pChgSet; }
+
+ // wo es sich geaendert hat
+ const SwAttrSet* GetTheChgdSet() const { return pTheChgdSet; }
+
+ sal_uInt16 Count() const { return pChgSet->Count(); }
+ void ClearItem( sal_uInt16 nWhichL = 0 )
+#ifndef DBG_UTIL
+ { pChgSet->ClearItem( nWhichL ); }
+#else
+ ;
+#endif
+};
+
+class SwCondCollCondChg: public SwMsgPoolItem
+{
+public:
+ SwFmt *pChangedFmt;
+ SwCondCollCondChg( SwFmt *pFmt );
+};
+
+class SwVirtPageNumInfo: public SwMsgPoolItem
+{
+ const SwPageFrm *pPage;
+ const SwPageFrm *pOrigPage;
+ const SwFrm *pFrm; //An einem Absatz/Tabelle koennen mehrere
+ //Attribute sitzen. Der Frame muss dann
+ //muss dann letztlich bei bestimmen
+ //welches Attribut gilt und um welche physikalische
+ //Seite es sich handelt.
+public:
+ SwVirtPageNumInfo( const SwPageFrm *pPg );
+
+ const SwPageFrm *GetPage() { return pPage; }
+ const SwPageFrm *GetOrigPage() { return pOrigPage;}
+ const SwFrm *GetFrm() { return pFrm; }
+ void SetInfo( const SwPageFrm *pPg,
+ const SwFrm *pF ) { pFrm = pF, pPage = pPg; }
+};
+
+
+// --> OD 2008-02-19 #refactorlists#
+//DECLARE_TABLE( SwTxtNodeTable, SwTxtNode* )
+
+//class SwNumRuleInfo : public SwMsgPoolItem
+//{
+// SwTxtNodeTable aList;
+// const String& rName;
+//public:
+// SwNumRuleInfo( const String& rRuleName );
+
+// const String& GetName() const { return rName; }
+// void AddNode( SwTxtNode& rNd );
+
+// // erzeuge die Liste aller Nodes der NumRule in dem angegebenem Doc
+// // Der Code steht im docnum.cxx
+// // #111955#
+// void MakeList( SwDoc& rDoc, sal_Bool bOutline = sal_False );
+
+// const SwTxtNodeTable& GetTxtNodeList() const { return aList; }
+//};
+// <--
+
+class SwFindNearestNode : public SwMsgPoolItem
+{
+ const SwNode *pNd, *pFnd;
+public:
+ SwFindNearestNode( const SwNode& rNd );
+ void CheckNode( const SwNode& rNd );
+
+ const SwNode* GetFoundNode() const { return pFnd; }
+};
+
+class SwStringMsgPoolItem : public SwMsgPoolItem
+{
+ String sStr;
+public:
+
+ const String& GetString() const { return sStr; }
+
+ SwStringMsgPoolItem( sal_uInt16 nId, const String& rStr )
+ : SwMsgPoolItem( nId ), sStr( rStr )
+ {}
+};
+
+#endif
diff --git a/sw/inc/htmltbl.hxx b/sw/inc/htmltbl.hxx
new file mode 100644
index 000000000000..cf95a232d9df
--- /dev/null
+++ b/sw/inc/htmltbl.hxx
@@ -0,0 +1,491 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _HTMLTBL_HXX
+#define _HTMLTBL_HXX
+
+
+#include <vcl/timer.hxx>
+#include <editeng/svxenum.hxx>
+
+#include "swtypes.hxx"
+#include "node.hxx" // Fuer SwStartNode
+
+
+class SwTableBox;
+class SwTable;
+class SwHTMLTableLayout;
+class SwDoc;
+class SwFrmFmt;
+
+#define HTMLTABLE_RESIZE_NOW (ULONG_MAX)
+
+class SwHTMLTableLayoutCnts
+{
+ SwHTMLTableLayoutCnts *pNext; // der naechste Inhalt
+
+ // von den beiden naechsten Pointern darf nur einer gesetzt sein!
+ SwTableBox *pBox; // ein Box
+ SwHTMLTableLayout *pTable; // eine "Tabelle in der Tabelle"
+
+ // Beim ersten Durchlauf gibt es noch keine Boxen. Es wird dann
+ // pStartNode anstelle von pBox verwendet.
+ const SwStartNode *pStartNode;
+
+ // Die folgenden Zahler geben an, wie oft ein Pass bereits fuer diesen
+ // Inhalt durchgefuehrt wurde. Dazu werden sie mit einer Soll-Vorgabe
+ // verglichen. Wird 255 erreicht laufen sie bei 0 weiter. So wird
+ // eine Reinitialisierung bei jedem Resize vermieden.
+ sal_uInt8 nPass1Done; // Wieoft wurde Pass 1 aufgerufen?
+ sal_uInt8 nWidthSet; // Wieoft wurde die Breite gesetzt?
+
+ sal_Bool bNoBreakTag; // <NOBR>-Tag ueber gesamten Inhalt
+
+public:
+
+ SwHTMLTableLayoutCnts( const SwStartNode* pSttNd, SwHTMLTableLayout* pTab,
+ sal_Bool bNoBreakTag, SwHTMLTableLayoutCnts* pNxt );
+
+ ~SwHTMLTableLayoutCnts();
+
+ void SetTableBox( SwTableBox *pBx ) { pBox = pBx; }
+ SwTableBox *GetTableBox() const { return pBox; }
+
+ SwHTMLTableLayout *GetTable() const { return pTable; }
+
+ const SwStartNode *GetStartNode() const;
+
+ // Ermitteln des naechsten Knotens
+ SwHTMLTableLayoutCnts *GetNext() const { return pNext; }
+
+ void SetWidthSet( sal_uInt8 nRef ) { nWidthSet = nRef; }
+ sal_Bool IsWidthSet( sal_uInt8 nRef ) const { return nRef==nWidthSet; }
+
+ void SetPass1Done( sal_uInt8 nRef ) { nPass1Done = nRef; }
+ sal_Bool IsPass1Done( sal_uInt8 nRef ) const { return nRef==nPass1Done; }
+
+ sal_Bool HasNoBreakTag() const { return bNoBreakTag; }
+};
+
+/* */
+
+class SwHTMLTableLayoutCell
+{
+ SwHTMLTableLayoutCnts *pContents; // der Inhalt der Zelle
+
+ sal_uInt16 nRowSpan; // ROWSPAN der Zelle
+ sal_uInt16 nColSpan; // COLSPAN der Zelle
+ sal_uInt16 nWidthOption;// angegebene Breite der Zelle in Twip oder %
+
+ sal_Bool bPrcWidthOption : 1;// nWidth ist %-Angabe
+ sal_Bool bNoWrapOption : 1; // NOWRAP-Option
+
+public:
+
+ SwHTMLTableLayoutCell( SwHTMLTableLayoutCnts *pCnts,
+ sal_uInt16 nRSpan, sal_uInt16 nCSpan,
+ sal_uInt16 nWidthOpt, sal_Bool bPrcWdthOpt,
+ sal_Bool nNWrapOpt );
+
+ ~SwHTMLTableLayoutCell();
+
+ // Setzen/Ermitteln des Inhalts einer Zelle
+ void SetContents( SwHTMLTableLayoutCnts *pCnts ) { pContents = pCnts; }
+ SwHTMLTableLayoutCnts *GetContents() const { return pContents; }
+
+ inline void SetProtected();
+
+ // ROWSPAN/COLSPAN der Zelle Setzen/Ermitteln
+ void SetRowSpan( sal_uInt16 nRSpan ) { nRowSpan = nRSpan; }
+ sal_uInt16 GetRowSpan() const { return nRowSpan; }
+ sal_uInt16 GetColSpan() const { return nColSpan; }
+
+ sal_uInt16 GetWidthOption() const { return nWidthOption; }
+ sal_Bool IsPrcWidthOption() const { return bPrcWidthOption; }
+
+ sal_Bool HasNoWrapOption() const { return bNoWrapOption; }
+};
+
+/* */
+
+class SwHTMLTableLayoutColumn
+{
+ // Zwischenwerte von AutoLayoutPass1
+ sal_uLong nMinNoAlign, nMaxNoAlign, nAbsMinNoAlign;
+
+ // Ergebnisse von AutoLayoutPass1
+ sal_uLong nMin, nMax;
+
+ // Ergibnisse von Pass 2
+ sal_uInt16 nAbsColWidth; // in Twips
+ sal_uInt16 nRelColWidth; // in Twips bzw. relativ zu USHRT_MAX
+
+ sal_uInt16 nWidthOption; // Optionen von <COL> oder <TD>/<TH>
+
+ sal_Bool bRelWidthOption : 1;
+ sal_Bool bLeftBorder : 1;
+
+public:
+
+ SwHTMLTableLayoutColumn( sal_uInt16 nColWidthOpt, sal_Bool bRelColWidthOpt,
+ sal_Bool bLBorder );
+
+ ~SwHTMLTableLayoutColumn() {}
+
+ inline void MergeCellWidthOption( sal_uInt16 nWidth, sal_Bool bPrc );
+ inline void SetWidthOption( sal_uInt16 nWidth, sal_Bool bRelWidth, sal_Bool bTest );
+
+ sal_uInt16 GetWidthOption() const { return nWidthOption; }
+ sal_Bool IsRelWidthOption() const { return bRelWidthOption; }
+
+ inline void MergeMinMaxNoAlign( sal_uLong nMin, sal_uLong nMax, sal_uLong nAbsMin );
+ sal_uLong GetMinNoAlign() const { return nMinNoAlign; }
+ sal_uLong GetMaxNoAlign() const { return nMaxNoAlign; }
+ sal_uLong GetAbsMinNoAlign() const { return nAbsMinNoAlign; }
+ inline void ClearPass1Info( sal_Bool bWidthOpt );
+
+ inline void SetMinMax( sal_uLong nMin, sal_uLong nMax );
+ void SetMax( sal_uLong nVal ) { nMax = nVal; }
+ void AddToMin( sal_uLong nVal ) { nMin += nVal; }
+ void AddToMax( sal_uLong nVal ) { nMax += nVal; }
+ sal_uLong GetMin() const { return nMin; }
+ sal_uLong GetMax() const { return nMax; }
+
+ void SetAbsColWidth( sal_uInt16 nWidth ) { nAbsColWidth = nWidth; }
+ sal_uInt16 GetAbsColWidth() const { return nAbsColWidth; }
+
+ void SetRelColWidth( sal_uInt16 nWidth ) { nRelColWidth = nWidth; }
+ sal_uInt16 GetRelColWidth() const { return nRelColWidth; }
+
+ sal_Bool HasLeftBorder() const { return bLeftBorder; }
+};
+
+/* */
+
+class SwHTMLTableLayout
+{
+ Timer aResizeTimer; // Timer fuer DelayedResize
+
+ SwHTMLTableLayoutColumn **aColumns;
+ SwHTMLTableLayoutCell **aCells;
+
+ const SwTable *pSwTable; // die SwTable (nur Top-Table)
+ SwTableBox *pLeftFillerBox; // linke Filler-Zelle (nur Tab in Tab)
+ SwTableBox *pRightFillerBox; // rechte Filler-Zelle (nur Tab-in Tab)
+
+ sal_uLong nMin; // minimale Breite der Tabelle (Twips)
+ sal_uLong nMax; // maximale Breite der Tabelle (Twips)
+
+ sal_uInt16 nRows; // Anzahl Zeilen
+ sal_uInt16 nCols; // Anzahl Spalten
+
+ sal_uInt16 nLeftMargin; // Abstand zum linken Rand (aus Absatz)
+ sal_uInt16 nRightMargin; // Abstand zum rechten Rand (aus Absatz)
+
+ sal_uInt16 nInhAbsLeftSpace; // von umgebender Zelle geerbter Abstand,
+ sal_uInt16 nInhAbsRightSpace; // der Zellen zugeschlagen wurde
+
+ sal_uInt16 nRelLeftFill; // relative Breiten der Zellen zur
+ sal_uInt16 nRelRightFill; // Ausrichtung von Tabellen in Tabellen
+
+ sal_uInt16 nRelTabWidth; // Die relative Breite der Tabelle
+
+ sal_uInt16 nWidthOption; // die Breite der Tabelle (in Twip oder %)
+ sal_uInt16 nCellPadding; // Abstand zum Inhalt (in Twip)
+ sal_uInt16 nCellSpacing; // Absatnd zwischen Zellen (in Twip)
+ sal_uInt16 nBorder; // Dicke der ausseren Umrandung bzw.
+ // Platz, den Netscape hierfuer einrechnet.
+
+ sal_uInt16 nLeftBorderWidth;
+ sal_uInt16 nRightBorderWidth;
+ sal_uInt16 nInhLeftBorderWidth;
+ sal_uInt16 nInhRightBorderWidth;
+ sal_uInt16 nBorderWidth;
+
+ sal_uInt16 nDelayedResizeAbsAvail; // Param fuer's verzoegerte Resize
+ sal_uInt16 nLastResizeAbsAvail;
+
+ sal_uInt8 nPass1Done; // Vorgabe-Werte fuer die einzelen
+ sal_uInt8 nWidthSet; // Schleifen-Durchlauefe
+
+ SvxAdjust eTableAdjust; // Die Ausrichtung der Tabelle
+
+ sal_Bool bColsOption : 1; // Tabelle besitzt eine COLS-Option
+ sal_Bool bColTags : 1; // Tabelle besitzt COL/COLGRP-Tags
+ sal_Bool bPrcWidthOption : 1; // Breite ist eine %-Angabe
+ sal_Bool bUseRelWidth : 1; // SwTable bekommt relative Breite
+
+ sal_Bool bMustResize : 1; // Tabelle muss in der Breite ang. werden
+ sal_Bool bExportable : 1; // Layout kann zum Export genutzt werden
+ sal_Bool bBordersChanged : 1; // Umrandung wurde geaendert
+ sal_Bool bMayBeInFlyFrame : 1; // Die Tabelle koennte im Rahmen sein
+
+ sal_Bool bDelayedResizeRecalc : 1; // Param fuer's verzoegerte Resize
+ sal_Bool bMustNotResize : 1; // Die Tabelle darf nicht reseized werden
+ sal_Bool bMustNotRecalc : 1; // Tabelle darf nicht an Inhalt angepasst
+ // werden
+
+// sal_uInt16 GetLeftBorderWidth( sal_uInt16 nCol ) const;
+// sal_uInt16 GetRightBorderWidth( sal_uInt16 nCol, sal_uInt16 nColSpan ) const;
+
+ void AddBorderWidth( sal_uLong &rMin, sal_uLong &rMax, sal_uLong& rAbsMin,
+ sal_uInt16 nCol, sal_uInt16 nColSpan,
+ sal_Bool bSwBorders=sal_True ) const;
+ void SetBoxWidth( SwTableBox *pBox, sal_uInt16 nCol, sal_uInt16 nColSpan ) const;
+
+ const SwStartNode *GetAnyBoxStartNode() const;
+ SwFrmFmt *FindFlyFrmFmt() const;
+ const SwDoc *GetDoc() const { return GetAnyBoxStartNode()->GetDoc(); }
+
+ void ClearPass1Info() { nMin = nMax = 0; }
+
+ void _Resize( sal_uInt16 nAbsAvail, sal_Bool bRecalc=sal_False );
+
+ DECL_STATIC_LINK( SwHTMLTableLayout, DelayedResize_Impl, void* );
+
+ static sal_uInt16 GetBrowseWidthByVisArea( const SwDoc& rDoc );
+public:
+
+ SwHTMLTableLayout( const SwTable *pSwTbl,
+ sal_uInt16 nRows, sal_uInt16 nCols, sal_Bool bColsOpt, sal_Bool ColTgs,
+ sal_uInt16 nWidth, sal_Bool bPrcWidth, sal_uInt16 nBorderOpt,
+ sal_uInt16 nCellPad, sal_uInt16 nCellSp, SvxAdjust eAdjust,
+ sal_uInt16 nLMargin, sal_uInt16 nRMargin, sal_uInt16 nBWidth,
+ sal_uInt16 nLeftBWidth, sal_uInt16 nRightBWidth,
+ sal_uInt16 nInhLeftBWidth, sal_uInt16 nInhRightBWidth );
+
+ ~SwHTMLTableLayout();
+
+ sal_uInt16 GetLeftCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan,
+ sal_Bool bSwBorders=sal_True ) const;
+ sal_uInt16 GetRightCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan,
+ sal_Bool bSwBorders=sal_True ) const;
+ inline sal_uInt16 GetInhCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan ) const;
+
+ inline void SetInhBorderWidths( sal_uInt16 nLeft, sal_uInt16 nRight );
+
+
+ void GetAvail( sal_uInt16 nCol, sal_uInt16 nColSpan, sal_uInt16& rAbsAvail,
+ sal_uInt16& rRelAvail ) const;
+
+ void AutoLayoutPass1();
+ void AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAvail,
+ sal_uInt16 nAbsLeftSpace, sal_uInt16 nAbsRightSpace,
+ sal_uInt16 nParentInhSpace );
+ void SetWidths( sal_Bool bCallPass2=sal_False, sal_uInt16 nAbsAvail=0,
+ sal_uInt16 nRelAvail=0, sal_uInt16 nAbsLeftSpace=0,
+ sal_uInt16 nAbsRightSpace=0,
+ sal_uInt16 nParentInhSpace=0 );
+
+ inline SwHTMLTableLayoutColumn *GetColumn( sal_uInt16 nCol ) const;
+ inline void SetColumn( SwHTMLTableLayoutColumn *pCol, sal_uInt16 nCol );
+
+ inline SwHTMLTableLayoutCell *GetCell( sal_uInt16 nRow, sal_uInt16 nCol ) const;
+ inline void SetCell( SwHTMLTableLayoutCell *pCell, sal_uInt16 nRow, sal_uInt16 nCol );
+
+ void SetLeftFillerBox( SwTableBox *pBox ) { pLeftFillerBox = pBox; }
+ void SetRightFillerBox( SwTableBox *pBox ) { pRightFillerBox = pBox; }
+
+ sal_uLong GetMin() const { return nMin; }
+ sal_uLong GetMax() const { return nMax; }
+ sal_uInt16 GetRelLeftFill() const { return nRelLeftFill; }
+ sal_uInt16 GetRelRightFill() const { return nRelRightFill; }
+
+ inline long GetBrowseWidthMin() const;
+
+ sal_Bool HasColsOption() const { return bColsOption; }
+ sal_Bool HasColTags() const { return bColTags; }
+
+ sal_Bool IsTopTable() const { return pSwTable != 0; }
+
+ void SetMustResize( sal_Bool bSet ) { bMustResize = bSet; }
+ void SetMustNotResize( sal_Bool bSet ) { bMustNotResize = bSet; }
+ void SetMustNotRecalc( sal_Bool bSet ) { bMustNotRecalc = bSet; }
+
+ // Neueberechnung der Tabellenbreiten fuer die uebergebene verfuegbare
+ // Breite.
+ // - Wenn bRecalc gesetzt ist, werden auch der Inhalt der Boxen
+ // zur Berechnung herangezogen.
+ // neu berechnet.
+ // - Wenn bForce gesetzt ist, wird die Tabelle auch neu berechnet, wenn
+ // dies mit SetMustNotResize unterdrueckt werden soll.
+ // - Wenn nDelay>0 wird die Berechnung entsprechend verzoegert.
+ // Innerhalb der Verzeoegerung auftretende Resize-Aufrufe werden
+ // ignoriert, die Verzeogerung wird aber ggf. uebernommen.
+ // - Wenn nDelay==HTMLTABLE_RESIZE_NOW ist, wird sofort Resized und
+ // eventuell noch asstehende Resize-Aufrufe werden nicht mehr
+ // ausgefuehrt.
+ // - Der Rueckgabewert gibt an, ob sich die Tabelle geaendert hat.
+ sal_Bool Resize( sal_uInt16 nAbsAvail, sal_Bool bRecalc=sal_False, sal_Bool bForce=sal_False,
+ sal_uLong nDelay=0 );
+
+ void BordersChanged( sal_uInt16 nAbsAvail, sal_Bool bRecalc=sal_False );
+
+ // Ermitteln der verfuegbaren Breite. Das geht nur, wenn ein Layout
+ // oder eine ViewShell vorhanden ist. Sonst wird 0 zurueckgegeben.
+ // (Wird vom HTML-Filter benoetigt, da der nicht an das Layout kommt.)
+ static sal_uInt16 GetBrowseWidth( const SwDoc& rDoc );
+
+ // Ermitteln der verfuegbaren Breite uber den Tabellen-Frame
+ sal_uInt16 GetBrowseWidthByTabFrm( const SwTabFrm& rTabFrm ) const;
+
+ // Ermitteln der verfuegbaren Breite uber den Tabellen-Frame oder
+ // das statische GetBrowseWidth, wenn kein Layout existiert.
+ sal_uInt16 GetBrowseWidthByTable( const SwDoc& rDoc ) const;
+
+ // Fuer Export
+ sal_uInt16 GetWidthOption() const { return nWidthOption; }
+ sal_Bool HasPrcWidthOption() const { return bPrcWidthOption; }
+
+ sal_uInt16 GetCellPadding() const { return nCellPadding; }
+ sal_uInt16 GetCellSpacing() const { return nCellSpacing; }
+ sal_uInt16 GetBorder() const { return nBorder; }
+
+ sal_uInt16 GetRowCount() const { return nRows; }
+ sal_uInt16 GetColCount() const { return nCols; }
+
+ void SetExportable( sal_Bool bSet ) { bExportable = bSet; }
+ sal_Bool IsExportable() const { return bExportable; }
+
+ sal_Bool HaveBordersChanged() const { return bBordersChanged; }
+
+ void SetMayBeInFlyFrame( sal_Bool bSet ) { bMayBeInFlyFrame = bSet; }
+ sal_Bool MayBeInFlyFrame() const { return bMayBeInFlyFrame; }
+};
+
+/* */
+
+inline void SwHTMLTableLayoutCell::SetProtected()
+{
+ nRowSpan = 1;
+ nColSpan = 1;
+
+ pContents = 0;
+}
+
+/* */
+
+inline void SwHTMLTableLayoutColumn::MergeMinMaxNoAlign( sal_uLong nCMin,
+ sal_uLong nCMax, sal_uLong nAbsMin )
+{
+ if( nCMin > nMinNoAlign )
+ nMinNoAlign = nCMin;
+ if( nCMax > nMaxNoAlign )
+ nMaxNoAlign = nCMax;
+ if( nAbsMin > nAbsMinNoAlign )
+ nAbsMinNoAlign = nAbsMin;
+}
+
+inline void SwHTMLTableLayoutColumn::ClearPass1Info( sal_Bool bWidthOpt )
+{
+ nMinNoAlign = nMaxNoAlign = nAbsMinNoAlign = MINLAY;
+ nMin = nMax = 0;
+ if( bWidthOpt )
+ {
+ nWidthOption = 0;
+ bRelWidthOption = sal_False;
+ }
+}
+
+inline void SwHTMLTableLayoutColumn::MergeCellWidthOption(
+ sal_uInt16 nWidth, sal_Bool bRel )
+{
+ if( !nWidthOption ||
+ (bRel==bRelWidthOption && nWidthOption < nWidth) )
+ {
+ nWidthOption = nWidth;
+ bRelWidthOption = bRel;
+ }
+}
+
+inline void SwHTMLTableLayoutColumn::SetMinMax( sal_uLong nMn, sal_uLong nMx )
+{
+ nMin = nMn;
+ nMax = nMx;
+}
+
+/* */
+
+inline sal_uInt16 SwHTMLTableLayout::GetInhCellSpace( sal_uInt16 nCol,
+ sal_uInt16 nColSpan ) const
+{
+ sal_uInt16 nSpace = 0;
+ if( nCol==0 )
+ nSpace = nSpace + sal::static_int_cast< sal_uInt16 >(nInhAbsLeftSpace);
+ if( nCol+nColSpan==nCols )
+ nSpace = nSpace + sal::static_int_cast< sal_uInt16 >(nInhAbsRightSpace);
+
+ return nSpace;
+}
+
+inline SwHTMLTableLayoutColumn *SwHTMLTableLayout::GetColumn( sal_uInt16 nCol ) const
+{
+ return aColumns[nCol];
+}
+
+inline void SwHTMLTableLayoutColumn::SetWidthOption(
+ sal_uInt16 nWidth, sal_Bool bRelWidth, sal_Bool bTest )
+{
+ if( bTest && bRelWidthOption==bRelWidth )
+ {
+ if( nWidth > nWidthOption )
+ nWidthOption = nWidth;
+ }
+ else
+ nWidthOption = nWidth;
+ bRelWidthOption = bRelWidth;
+}
+
+inline void SwHTMLTableLayout::SetColumn( SwHTMLTableLayoutColumn *pCol, sal_uInt16 nCol )
+{
+ aColumns[nCol] = pCol;
+}
+
+inline SwHTMLTableLayoutCell *SwHTMLTableLayout::GetCell( sal_uInt16 nRow, sal_uInt16 nCol ) const
+{
+ return aCells[nRow*nCols+nCol];
+}
+
+inline void SwHTMLTableLayout::SetCell( SwHTMLTableLayoutCell *pCell,
+ sal_uInt16 nRow, sal_uInt16 nCol )
+{
+ aCells[nRow*nCols+nCol] = pCell;
+}
+
+inline long SwHTMLTableLayout::GetBrowseWidthMin() const
+{
+ return (long)( (!nWidthOption || bPrcWidthOption) ? nMin : nRelTabWidth );
+}
+
+void SwHTMLTableLayout::SetInhBorderWidths( sal_uInt16 nLeft, sal_uInt16 nRight )
+{
+ nInhLeftBorderWidth = nLeft;
+ nInhRightBorderWidth = nRight;
+}
+
+
+#endif
diff --git a/sw/inc/index.hrc b/sw/inc/index.hrc
new file mode 100644
index 000000000000..badc0278b137
--- /dev/null
+++ b/sw/inc/index.hrc
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/* fuer den DesignEditor
+#define RC_INDEX_BEGIN 256
+*/
+
+#ifndef _INDEX_HRC
+#define _INDEX_HRC
+
+#include "rcid.hrc"
+
+#define DLG_FORMEDT (RC_INDEX_BEGIN + 0)
+#define DLG_IDX (RC_INDEX_BEGIN + 1)
+#define DLG_USRIDX (RC_INDEX_BEGIN + 2)
+#define DLG_INSIDXMARK (RC_INDEX_BEGIN + 3)
+#define DLG_CNTTABLE (RC_INDEX_BEGIN + 4)
+#define DLG_MULTMRK (RC_INDEX_BEGIN + 5)
+
+#define STR_TITLE (RC_INDEX_BEGIN + 6)
+#define STR_ALPHA (RC_INDEX_BEGIN + 7)
+#define STR_LEVEL (RC_INDEX_BEGIN + 8)
+
+#define DLG_INSAUTHMARK (RC_INDEX_BEGIN + 9)
+#define DLG_CREATE_AUTH_ENTRY (RC_INDEX_BEGIN + 10)
+#define DLG_EDIT_IDXMARK (RC_INDEX_BEGIN + 11)
+#define DLG_EDIT_AUTHMARK (RC_INDEX_BEGIN + 12)
+
+#define STR_IDXMRK_INSERT (RC_INDEX_BEGIN + 13)
+#define STR_IDXMRK_EDIT (RC_INDEX_BEGIN + 14)
+#define STR_AUTHMRK_EDIT (RC_INDEX_BEGIN + 15)
+#define STR_AUTHMRK_INSERT (RC_INDEX_BEGIN + 16)
+
+#define DLG_NEW_USER_IDX (RC_INDEX_BEGIN + 17)
+
+#define STR_FILE_NOT_FOUND (RC_INDEX_BEGIN + 18)
+#define DLG_CHANGE_AUTH_ENTRY (RC_INDEX_BEGIN + 19)
+#define DLG_CREATE_AUTOMARK (RC_INDEX_BEGIN + 20)
+
+#define DLG_EDIT_IDXMARK_CJK (RC_INDEX_BEGIN + 21)
+#define DLG_INSIDXMARK_CJK (RC_INDEX_BEGIN + 22)
+#endif // _INDEX_HRC
diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
new file mode 100644
index 000000000000..fd5ba88b0a69
--- /dev/null
+++ b/sw/inc/index.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _INDEX_HXX
+#define _INDEX_HXX
+
+#include <limits.h>
+#include <tools/solar.h>
+#include <tools/rtti.hxx> // for RTTI of SwIndexReg
+#include <tools/string.hxx> // for xub_StrLen
+#include <swdllapi.h>
+
+#define INVALID_INDEX STRING_NOTFOUND
+
+// Maximale Anzahl von Indizies im IndexArray (zum Abtesten auf Ueberlaeufe)
+class SwIndex;
+class SwIndexReg;
+struct SwPosition;
+
+#ifndef DBG_UTIL
+#define INLINE inline
+#else
+#define INLINE
+#endif
+
+class SW_DLLPUBLIC SwIndex
+{
+ friend class SwIndexReg;
+
+#ifdef DBG_UTIL
+ static int nSerial;
+ int MySerial;
+#endif
+
+ xub_StrLen nIndex;
+ SwIndexReg* pArray;
+ SwIndex *pNext, *pPrev;
+
+ SwIndex& ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue );
+ void Remove(); // Ausketten
+
+public:
+ explicit SwIndex(SwIndexReg *const pReg, xub_StrLen const nIdx = 0);
+ SwIndex( const SwIndex & );
+ SwIndex( const SwIndex &, short nDiff );
+ ~SwIndex() { Remove(); }
+
+ INLINE xub_StrLen operator++();
+ INLINE xub_StrLen operator--();
+#ifndef CFRONT
+ INLINE xub_StrLen operator++(int);
+ INLINE xub_StrLen operator--(int);
+#endif
+
+ INLINE xub_StrLen operator+=( xub_StrLen );
+ INLINE xub_StrLen operator-=( xub_StrLen );
+ INLINE xub_StrLen operator+=( const SwIndex& );
+ INLINE xub_StrLen operator-=( const SwIndex& );
+
+ INLINE sal_Bool operator<( const SwIndex& ) const;
+ INLINE sal_Bool operator<=( const SwIndex& ) const;
+ INLINE sal_Bool operator>( const SwIndex& ) const;
+ INLINE sal_Bool operator>=( const SwIndex& ) const;
+ sal_Bool operator==( const SwIndex& rSwIndex ) const
+ { return (nIndex == rSwIndex.nIndex) && (pArray == rSwIndex.pArray); }
+
+ sal_Bool operator!=( const SwIndex& rSwIndex ) const
+ { return (nIndex != rSwIndex.nIndex) || (pArray != rSwIndex.pArray); }
+
+ sal_Bool operator<( xub_StrLen nWert ) const { return nIndex < nWert; }
+ sal_Bool operator<=( xub_StrLen nWert ) const { return nIndex <= nWert; }
+ sal_Bool operator>( xub_StrLen nWert ) const { return nIndex > nWert; }
+ sal_Bool operator>=( xub_StrLen nWert ) const { return nIndex >= nWert; }
+ sal_Bool operator==( xub_StrLen nWert ) const { return nIndex == nWert; }
+ sal_Bool operator!=( xub_StrLen nWert ) const { return nIndex != nWert; }
+
+ INLINE SwIndex& operator=( xub_StrLen );
+ SwIndex& operator=( const SwIndex & );
+
+ // gebe den Wert vom Index als xub_StrLen zurueck
+ xub_StrLen GetIndex() const { return nIndex; }
+
+ // ermoeglicht Zuweisungen ohne Erzeugen eines temporaeren
+ // Objektes
+ SwIndex &Assign(SwIndexReg *,xub_StrLen);
+
+ // Herausgabe des Pointers auf das IndexArray,
+ // (fuers RTTI am SwIndexReg)
+ const SwIndexReg* GetIdxReg() const { return pArray; }
+};
+
+#undef INLINE
+
+class SwIndexReg
+{
+ friend class SwIndex;
+ friend bool lcl_PosOk(const SwPosition & aPos);
+
+ const SwIndex *pFirst, *pLast, *pMiddle;
+
+ // ein globales Array, in das Indizies verschoben werden, die mal
+ // temporaer "ausgelagert" werden muessen; oder die zum Zeitpunkt des
+ // anlegens kein gueltiges Array kennen (SwPaM/SwPosition!)
+ friend void _InitCore();
+ friend void _FinitCore();
+ static SwIndexReg* pEmptyIndexArray;
+
+protected:
+ virtual void Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
+ const bool bNegative = false, const bool bDelete = false );
+
+ void ChkArr();
+
+ sal_Bool HasAnyIndex() const { return 0 != pFirst; }
+
+public:
+ SwIndexReg();
+ virtual ~SwIndexReg();
+
+ // rtti, abgeleitete moegens gleichtun oder nicht. Wenn sie es gleichtun
+ // kann ueber das SwIndexReg typsicher gecastet werden.
+ TYPEINFO();
+
+ void MoveTo( SwIndexReg& rArr );
+};
+
+#ifndef DBG_UTIL
+
+inline xub_StrLen SwIndex::operator++()
+{
+ return ChgValue( *this, nIndex+1 ).nIndex;
+}
+inline xub_StrLen SwIndex::operator--()
+{
+ return ChgValue( *this, nIndex-1 ).nIndex;
+}
+#ifndef CFRONT
+inline xub_StrLen SwIndex::operator++(int)
+{
+ xub_StrLen nOldIndex = nIndex;
+ ChgValue( *this, nIndex+1 );
+ return nOldIndex;
+}
+inline xub_StrLen SwIndex::operator--(int)
+{
+ xub_StrLen nOldIndex = nIndex;
+ ChgValue( *this, nIndex-1 );
+ return nOldIndex;
+}
+#endif
+
+inline xub_StrLen SwIndex::operator+=( xub_StrLen nWert )
+{
+ return ChgValue( *this, nIndex + nWert ).nIndex;
+}
+inline xub_StrLen SwIndex::operator-=( xub_StrLen nWert )
+{
+ return ChgValue( *this, nIndex - nWert ).nIndex;
+}
+inline xub_StrLen SwIndex::operator+=( const SwIndex& rIndex )
+{
+ return ChgValue( *this, nIndex + rIndex.nIndex ).nIndex;
+}
+inline xub_StrLen SwIndex::operator-=( const SwIndex& rIndex )
+{
+ return ChgValue( *this, nIndex - rIndex.nIndex ).nIndex;
+}
+
+inline sal_Bool SwIndex::operator<( const SwIndex& rIndex ) const
+{
+ return nIndex < rIndex.nIndex;
+}
+inline sal_Bool SwIndex::operator<=( const SwIndex& rIndex ) const
+{
+ return nIndex <= rIndex.nIndex;
+}
+inline sal_Bool SwIndex::operator>( const SwIndex& rIndex ) const
+{
+ return nIndex > rIndex.nIndex;
+}
+inline sal_Bool SwIndex::operator>=( const SwIndex& rIndex ) const
+{
+ return nIndex >= rIndex.nIndex;
+}
+inline SwIndex& SwIndex::operator=( xub_StrLen nWert )
+{
+ if( nIndex != nWert )
+ ChgValue( *this, nWert );
+ return *this;
+}
+
+#endif // PRODUCT
+
+#endif
diff --git a/sw/inc/inetfld.hxx b/sw/inc/inetfld.hxx
new file mode 100644
index 000000000000..4160928ea8ce
--- /dev/null
+++ b/sw/inc/inetfld.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_INETFLD_HXX
+#define SW_INETFLD_HXX
+
+
+#include "fldbas.hxx"
+
+class SvxMacro;
+class SvxMacroTableDtor;
+class SwINetField;
+class SwCharFmt;
+class SwDoc;
+
+/*--------------------------------------------------------------------
+ Beschreibung: InterNet-FieldType -> Lade Document mit der URL
+ --------------------------------------------------------------------*/
+
+class SwINetFieldType : public SwFieldType
+{
+ SwDepend aNormalFmt;
+ SwDepend aVisitFmt;
+ SwDoc* pDoc;
+
+public:
+ SwINetFieldType( SwDoc* pDoc );
+
+ virtual SwFieldType* Copy() const;
+
+ SwCharFmt* GetCharFmt( const SwINetField& rFld );
+
+ SwDoc* GetDoc() const { return pDoc; }
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: InterNet-Field -> Lade Document mit der URL
+ --------------------------------------------------------------------*/
+
+class SwINetField : public SwField
+{
+ friend class SwINetFieldType;
+
+ String sTargetFrameName; // in diesen Frame soll die URL
+ String sURL;
+ String sText;
+ SvxMacroTableDtor* pMacroTbl;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ // Direkte Eingabe alten Wert loeschen
+ SwINetField( SwINetFieldType* pTyp, sal_uInt16 nFmt,
+ const String& rURL, const String& rText );
+ virtual ~SwINetField();
+
+ virtual String GetFieldName() const;
+
+ // URL
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+
+ // HinweisText
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+
+ // das ist das akt. Zeichenformat
+ SwCharFmt* GetCharFmt();
+ const SwCharFmt* GetCharFmt() const
+ { return ((SwINetField*)this)->GetCharFmt(); }
+
+ const String& GetTargetFrameName() const { return sTargetFrameName; }
+ void SetTargetFrameName( const String& rNm ) { sTargetFrameName = rNm; }
+
+ // setze eine neue oder loesche die akt. MakroTabelle
+ void SetMacroTbl( const SvxMacroTableDtor* pTbl = 0 );
+ const SvxMacroTableDtor* GetMacroTbl() const { return pMacroTbl; }
+
+ // setze / erfrage ein Makro
+ void SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro );
+ const SvxMacro* GetMacro( sal_uInt16 nEvent ) const;
+};
+
+
+#endif // SW_INETFLD_HXX
+
diff --git a/sw/inc/init.hxx b/sw/inc/init.hxx
new file mode 100644
index 000000000000..55f6a1860459
--- /dev/null
+++ b/sw/inc/init.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _INIT_HXX
+#define _INIT_HXX
+
+class ViewShell;
+
+void _InitCore(); // bastyp/init.cxx
+void _FinitCore();
+
+void _InitFilter(); // basflt/fltini.cxx
+void _FinitFilter();
+
+// layout/newfrm.cxx
+void _FrmInit();
+void _FrmFinit();
+void SetShell( ViewShell *pSh );
+
+// text/txtfrm.cxx
+void _TextInit();
+void _TextFinit();
+
+
+#endif
diff --git a/sw/inc/io.hxx b/sw/inc/io.hxx
new file mode 100644
index 000000000000..66af95e9a28a
--- /dev/null
+++ b/sw/inc/io.hxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+// eigene Klasse fuer IO, die die systemunabhaengige Darstellung
+// uebernimmt (bytes dreht, Character konvertiert)
+// das Schreiben erfolgt aus Effizienzgruenden binaer
+#ifndef _IO_HXX
+#define _IO_HXX
+
+#ifdef UNX
+#include <unistd.h>
+#else
+#include <io.h>
+#endif
+
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+
+#ifndef _KEYCOD_HXX //autogen
+#include <vcl/keycod.hxx>
+#endif
+#include <tools/stream.hxx>
+
+/*$
+class BinaryFile {
+ int fd;
+public:
+ enum IO_OpenMode {
+ BF_READ = O_RDONLY,
+ BF_WRITE = O_RDWR,
+ BF_CREATE = O_CREAT,
+ BF_TRUNC = O_TRUNC
+ };
+ // ctor oeffnet File im BinearMode, dtor schliesst es
+ BinaryFile(const String &, int eOpenMode);
+ ~BinaryFile();
+ sal_Bool Ok() const {
+ return -1 != fd;
+ }
+ operator int() const { return fd; }
+};
+*/
+
+class SwIOin {
+private:
+ SvFileStream aStr; //$ ifstream
+public:
+ // Stream wird im entsprechenden Mode erzeugt.
+ SwIOin(const String &rFilename, StreamMode nMode =
+ STREAM_READ | STREAM_NOCREATE );
+
+ SwIOin& operator>>(char& val);
+ SwIOin& operator>>(unsigned char& val);
+ SwIOin& operator>>(char* val);
+ SwIOin& operator>>(unsigned char* val);
+ SwIOin& operator>>(short& val);
+ SwIOin& operator>>(unsigned short& val);
+ SwIOin& operator>>(long& val);
+ SwIOin& operator>>(unsigned long& val);
+ String ReadString();
+ KeyCode ReadKeyCode();
+ // kann erweitert werden fuer weitere Arrays von
+ // Basistypen; nLen ist die Anzahl der Elemente
+ SwIOin& Read(char *buf, unsigned nLen);
+
+ int operator!() { return aStr.GetError() != SVSTREAM_OK; }
+ SvFileStream &operator()() {
+ return aStr;
+ }
+};
+
+class SwIOout {
+private:
+ void _write(const char *buf, unsigned size);
+ SvFileStream aStr; //$ ofstream
+public:
+ // Stream wird im entsprechenden Mode erzeugt.
+ SwIOout( const String &rFilename, StreamMode nMode =
+ STREAM_WRITE | STREAM_NOCREATE );
+ SwIOout& operator<<(char val);
+ SwIOout& operator<<(unsigned char val);
+ SwIOout& operator<<(char* val);
+ SwIOout& operator<<(unsigned char* val);
+ SwIOout& operator<<(short val);
+ SwIOout& operator<<(unsigned short val);
+ SwIOout& operator<<(long val);
+ SwIOout& operator<<(unsigned long val);
+ SwIOout& operator<<(const String &);
+ SwIOout& operator<<(const KeyCode &);
+ // kann erweitert werden fuer weitere Arrays von
+ // Basistypen; nLen ist die Anzahl der Elemente
+ SwIOout& Write(const char *buf, unsigned nLen);
+
+ int operator!() { return aStr.GetError() != SVSTREAM_OK; }
+ SvFileStream &operator()() {
+ return aStr;
+ }
+};
+
+
+class SwIOinout {
+private:
+ SvFileStream aStr; //$ fstream
+
+public:
+ // Stream wird im entsprechenden Mode erzeugt.
+ SwIOinout(const String &rFilename, StreamMode nMode =
+ STREAM_READWRITE | STREAM_NOCREATE );
+
+ SwIOinout& operator>>(char& val);
+ SwIOinout& operator>>(unsigned char& val);
+ SwIOinout& operator>>(char* val);
+ SwIOinout& operator>>(unsigned char* val);
+ SwIOinout& operator>>(short& val);
+ SwIOinout& operator>>(unsigned short& val);
+ SwIOinout& operator>>(long& val);
+ SwIOinout& operator>>(unsigned long& val);
+ String ReadString();
+ KeyCode ReadKeyCode();
+ // kann erweitert werden fuer weitere Arrays von
+ // Basistypen; nLen ist die Anzahl der Elemente
+ SwIOinout& Read(char *buf, unsigned nLen);
+ SwIOinout& Read(unsigned short *buf, unsigned nLen );
+
+ SwIOinout& operator<<(char val);
+ SwIOinout& operator<<(unsigned char val);
+ SwIOinout& operator<<(char* val);
+ SwIOinout& operator<<(unsigned char* val);
+ SwIOinout& operator<<(short val);
+ SwIOinout& operator<<(unsigned short val);
+ SwIOinout& operator<<(long val);
+ SwIOinout& operator<<(unsigned long val);
+ SwIOinout& operator<<(const String &);
+ SwIOinout& operator<<(const KeyCode &);
+ // kann erweitert werden fuer weitere Arrays von
+ // Basistypen; nLen ist die Anzahl der Elemente
+ SwIOinout& Write(const char *buf, unsigned nLen);
+
+ int operator!() { return aStr.GetError() != SVSTREAM_OK; }
+ SvFileStream &operator()() {
+ return aStr;
+ }
+
+ sal_Bool Ok();
+};
+
+
+
+#endif
+
diff --git a/sw/inc/iodetect.hxx b/sw/inc/iodetect.hxx
new file mode 100644
index 000000000000..2fb66559b98d
--- /dev/null
+++ b/sw/inc/iodetect.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _IODETECT_HXX_
+#define _IODETECT_HXX_
+
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <osl/endian.h>
+#include <errhdl.hxx> // for ASSERT
+#include <tools/string.hxx>
+#include <swdllapi.h>
+
+#define FILTER_RTF "RTF" // RTF-Filter
+#define sRtfWH "WH_RTF"
+#define FILTER_TEXT "TEXT" // Text-Filter mit Default-CodeSet
+#define FILTER_BAS "BAS" // StarBasic (identisch mit ANSI)
+#define FILTER_WW8 "CWW8" // WinWord 97-Filter
+#define FILTER_TEXT_DLG "TEXT_DLG" // text filter with encoding dialog
+#define FILTER_XML "CXML" // XML filter
+#define FILTER_XMLV "CXMLV" // XML filter
+#define FILTER_XMLVW "CXMLVWEB" // XML filter
+#define sHTML "HTML"
+#define sWW1 "WW1"
+#define sWW5 "WW6"
+#define sWW6 "CWW6"
+
+#define sSWRITER "swriter"
+#define sSWRITERWEB "swriter/web"
+
+struct SwIoDetect
+{
+ const sal_Char* pName;
+ sal_uInt16 nLen;
+
+ inline SwIoDetect( const sal_Char *pN, sal_uInt16 nL )
+ : pName( pN ), nLen( nL )
+ {}
+
+ inline int IsFilter( const String& rNm ) const
+ {
+ return pName && rNm.EqualsAscii( pName, 0, nLen );
+ }
+
+ const sal_Char* IsReader( const sal_Char* pHeader, sal_uLong nLen_,
+ const String &rFileName, const String& rUserData ) const;
+};
+
+enum ReaderWriterEnum {
+ READER_WRITER_RTF,
+ READER_WRITER_BAS,
+ READER_WRITER_WW6,
+ READER_WRITER_WW8,
+ READER_WRITER_RTF_WH,
+ READER_WRITER_HTML,
+ READER_WRITER_WW1,
+ READER_WRITER_WW5,
+ READER_WRITER_XML,
+ READER_WRITER_TEXT_DLG,
+ READER_WRITER_TEXT,
+ MAXFILTER
+};
+
+extern SwIoDetect aFilterDetect[];
+
+// Die folgende Klasse ist ein Wrappe fuer die Basic-I/O-Funktionen
+// des Writer 3.0. Alles ist statisch. Alle u.a. Filternamen sind die
+// Writer-internen Namen, d.h. die namen, die in INSTALL.INI vor dem
+// Gleichheitszeichen stehen, z.b. SWG oder ASCII.
+
+class SwIoSystem
+{
+public:
+ // suche ueber den internen FormatNamen den Filtereintrag
+ SW_DLLPUBLIC static const SfxFilter* GetFilterOfFormat( const String& rFormat,
+ const SfxFilterContainer* pCnt = 0 );
+
+ // Feststellen des zu verwendenden Filters fuer die uebergebene
+ // Datei. Der Filtername wird zurueckgeliefert. Konnte kein Filter
+ // zurueckgeliefert werden, wird der Name des ASCII-Filters geliefert!
+ static const SfxFilter* GetFileFilter( const String& rFileName,
+ const String& rPrefFltName,
+ SfxMedium* pMedium = 0 );
+
+ // Feststellen ob das File in dem vorgegebenen Format vorliegt.
+ // Z.z werden nur unsere eigene Filter unterstuetzt!!
+ static sal_Bool IsFileFilter( SfxMedium& rMedium, const String& rFmtName,
+ const SfxFilter** ppFlt = 0 );
+
+ static sal_Bool IsValidStgFilter( SotStorage& , const SfxFilter& );
+ static sal_Bool IsValidStgFilter( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const SfxFilter& rFilter);
+
+ static bool IsDetectableText( const sal_Char* pBuf, sal_uLong &rLen,
+ CharSet *pCharSet=0, bool *pSwap=0, LineEnd *pLineEnd=0, bool bEncodedFilter = false );
+ // static bool IsDetectableW4W(const String& rFileName, const String& rUserData);
+
+ static const SfxFilter* GetTextFilter( const sal_Char* pBuf, sal_uLong nLen );
+
+ static const String GetSubStorageName( const SfxFilter& rFltr );
+};
+
+#endif
diff --git a/sw/inc/istyleaccess.hxx b/sw/inc/istyleaccess.hxx
new file mode 100644
index 000000000000..af19caec9252
--- /dev/null
+++ b/sw/inc/istyleaccess.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ISTYLEACCESS_HXX
+#define _ISTYLEACCESS_HXX
+
+#include <vector>
+#include <svl/stylepool.hxx>
+
+/*--------------------------------------------------------------------
+ Management of (automatic) styles
+ --------------------------------------------------------------------*/
+
+class SwStyleHandle;
+
+class IStyleAccess
+{
+public:
+
+ enum SwAutoStyleFamily
+ {
+ AUTO_STYLE_CHAR,
+ AUTO_STYLE_RUBY,
+ AUTO_STYLE_PARA,
+ AUTO_STYLE_NOTXT
+ };
+
+ virtual ~IStyleAccess() {}
+
+ virtual StylePool::SfxItemSet_Pointer_t getAutomaticStyle( const SfxItemSet& rSet,
+ SwAutoStyleFamily eFamily ) = 0;
+ virtual void getAllStyles( std::vector<StylePool::SfxItemSet_Pointer_t> &rStyles,
+ SwAutoStyleFamily eFamily ) = 0;
+ // It's slow to iterate through a stylepool looking for a special name, but if
+ // the style has been inserted via "cacheAutomaticStyle" instead of "getAutomaticStyle",
+ // it's faster
+ virtual StylePool::SfxItemSet_Pointer_t getByName( const rtl::OUString& rName,
+ SwAutoStyleFamily eFamily ) = 0;
+ // insert the style to the pool and the cache (used during import)
+ virtual StylePool::SfxItemSet_Pointer_t cacheAutomaticStyle( const SfxItemSet& rSet,
+ SwAutoStyleFamily eFamily ) = 0;
+ // To release the cached styles (shared_pointer!)
+ virtual void clearCaches() = 0;
+};
+
+#endif // _ISTYLEACCESS_HXX
diff --git a/sw/inc/itabenum.hxx b/sw/inc/itabenum.hxx
new file mode 100644
index 000000000000..9dfa8c3a43b7
--- /dev/null
+++ b/sw/inc/itabenum.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ITABENUM_HXX
+#define _ITABENUM_HXX
+
+#include <tools/solar.h>
+
+namespace tabopts
+{
+ const sal_uInt16 DEFAULT_BORDER = 0x01;
+ const sal_uInt16 HEADLINE = 0x02;
+// const sal_uInt16 REPEAT = 0x04;
+// const sal_uInt16 HEADLINE_REPEAT = 0x06; // Headline + Repeat
+ const sal_uInt16 SPLIT_LAYOUT = 0x08;
+ const sal_uInt16 HEADLINE_NO_BORDER = HEADLINE | SPLIT_LAYOUT;
+ const sal_uInt16 ALL_TBL_INS_ATTR = DEFAULT_BORDER | HEADLINE | SPLIT_LAYOUT;
+}
+
+struct SwInsertTableOptions
+{
+ sal_uInt16 mnInsMode;
+ sal_uInt16 mnRowsToRepeat;
+
+ SwInsertTableOptions( sal_uInt16 nInsMode, sal_uInt16 nRowsToRepeat ) :
+ mnInsMode( nInsMode ), mnRowsToRepeat( nRowsToRepeat ) {};
+};
+
+
+#endif
+
diff --git a/sw/inc/lineinfo.hxx b/sw/inc/lineinfo.hxx
new file mode 100644
index 000000000000..91f5ac7712de
--- /dev/null
+++ b/sw/inc/lineinfo.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_LINEINFO_HXX
+#define SW_LINEINFO_HXX
+
+#include "calbck.hxx"
+#include <editeng/numitem.hxx>
+#include "swdllapi.h"
+
+class SwCharFmt;
+class IDocumentStylePoolAccess;
+
+enum LineNumberPosition
+{
+ LINENUMBER_POS_LEFT,
+ LINENUMBER_POS_RIGHT,
+ LINENUMBER_POS_INSIDE,
+ LINENUMBER_POS_OUTSIDE
+};
+
+class SW_DLLPUBLIC SwLineNumberInfo : public SwClient //purpose of derivation from SwClient:
+ //character style for displaying the numbers.
+{
+ SvxNumberType aType; //e.g. roman linenumbers
+ String aDivider; //String for aditional interval (vert. lines user defined)
+ sal_uInt16 nPosFromLeft; //Position for paint
+ sal_uInt16 nCountBy; //Paint only for every n line
+ sal_uInt16 nDividerCountBy; //Interval for display of an user defined
+ //string every n lines
+ LineNumberPosition ePos; //Where should the display occur (number and divicer)
+ sal_Bool bPaintLineNumbers; //Should anything be displayed?
+ sal_Bool bCountBlankLines; //Count empty lines?
+ sal_Bool bCountInFlys; //Count also within FlyFrames?
+ sal_Bool bRestartEachPage; //Restart counting at the first paragraph of each page
+ //(even on follows when paragraphs are splitted)
+protected:
+ virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
+
+public:
+ SwLineNumberInfo();
+ SwLineNumberInfo(const SwLineNumberInfo&);
+
+ SwLineNumberInfo& operator=(const SwLineNumberInfo&);
+ sal_Bool operator==( const SwLineNumberInfo& rInf ) const;
+
+ SwCharFmt *GetCharFmt( IDocumentStylePoolAccess& rIDSPA ) const;
+ void SetCharFmt( SwCharFmt* );
+
+ const SvxNumberType &GetNumType() const { return aType; }
+ void SetNumType( SvxNumberType aNew ){ aType = aNew; }
+
+ const String &GetDivider() const { return aDivider; }
+ void SetDivider( const String &r ) { aDivider = r; }
+ sal_uInt16 GetDividerCountBy() const { return nDividerCountBy; }
+ void SetDividerCountBy( sal_uInt16 n ) { nDividerCountBy = n; }
+
+ sal_uInt16 GetPosFromLeft() const { return nPosFromLeft; }
+ void SetPosFromLeft( sal_uInt16 n) { nPosFromLeft = n; }
+
+ sal_uInt16 GetCountBy() const { return nCountBy; }
+ void SetCountBy( sal_uInt16 n) { nCountBy = n; }
+
+ LineNumberPosition GetPos() const { return ePos; }
+ void SetPos( LineNumberPosition eP ){ ePos = eP; }
+
+ sal_Bool IsPaintLineNumbers() const { return bPaintLineNumbers; }
+ void SetPaintLineNumbers( sal_Bool b ){ bPaintLineNumbers = b; }
+
+ sal_Bool IsCountBlankLines() const { return bCountBlankLines; }
+ void SetCountBlankLines( sal_Bool b ) { bCountBlankLines = b; }
+
+ sal_Bool IsCountInFlys() const { return bCountInFlys; }
+ void SetCountInFlys( sal_Bool b ) { bCountInFlys = b; }
+
+ sal_Bool IsRestartEachPage() const { return bRestartEachPage; }
+ void SetRestartEachPage( sal_Bool b ) { bRestartEachPage = b; }
+
+ bool HasCharFormat() const { return GetRegisteredIn() != 0; }
+};
+
+
+
+#endif
+
diff --git a/sw/inc/linkenum.hxx b/sw/inc/linkenum.hxx
new file mode 100644
index 000000000000..08fbb23654b3
--- /dev/null
+++ b/sw/inc/linkenum.hxx
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _LINKENUM_HXX
+#define _LINKENUM_HXX
+
+enum UpdateLinks
+{
+ NEVER,
+ MANUAL,
+ AUTOMATIC,
+ GLOBALSETTING
+};
+
+#endif
+
diff --git a/sw/inc/list.hxx b/sw/inc/list.hxx
new file mode 100644
index 000000000000..a080440a55ea
--- /dev/null
+++ b/sw/inc/list.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 LIST_HXX_INCLUDED
+#define LIST_HXX_INCLUDED
+
+#include <tools/string.hxx>
+
+class SwNumRule;
+class SwNodes;
+class SwNodeNum;
+
+class SwListImpl;
+
+class SwList
+{
+ public:
+ SwList( const String sListId,
+ SwNumRule& rDefaultListStyle,
+ const SwNodes& rNodes );
+ ~SwList();
+
+ const String GetListId() const;
+
+ const String GetDefaultListStyleName() const;
+
+ void InsertListItem( SwNodeNum& rNodeNum,
+ const int nLevel );
+ void RemoveListItem( SwNodeNum& rNodeNum );
+
+ void InvalidateListTree();
+ void ValidateListTree();
+
+ void MarkListLevel( const int nListLevel,
+ const sal_Bool bValue );
+
+ bool IsListLevelMarked( const int nListLevel ) const;
+
+// void ContinueList( SwList& rList );
+// const SwList* GetContinuedList() const;
+// void ClearContinuation();
+
+ private:
+ // no copy constructor and no assignment operator
+ SwList( const SwList& );
+ SwList& operator=( const SwList& );
+
+ SwListImpl* mpListImpl;
+};
+#endif // LIST_HXX_INCLUDED
diff --git a/sw/inc/listfunc.hxx b/sw/inc/listfunc.hxx
new file mode 100644
index 000000000000..b82ce6424249
--- /dev/null
+++ b/sw/inc/listfunc.hxx
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 LISTFUNC_HXX_INCLUDED
+#define LISTFUNC_HXX_INCLUDED
+
+class SwDoc;
+
+namespace listfunc
+{
+ const String CreateUniqueListId( const SwDoc& rDoc );
+}
+
+#endif // LISTFUNC_HXX_INCLUDED
diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx
new file mode 100644
index 000000000000..7a3f27bb0eed
--- /dev/null
+++ b/sw/inc/mdiexp.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _MDIEXP_HXX
+#define _MDIEXP_HXX
+
+#include <tools/solar.h>
+#include <tblenum.hxx>
+#include <layout/layout.hxx>
+#include <swdllapi.h>
+
+class UniString;
+class SwRect;
+class Size;
+class Dialog;
+class ViewShell;
+class SwDoc;
+class SwDocShell;
+
+extern void ScrollMDI(ViewShell* pVwSh, const SwRect &, sal_uInt16 nRangeX, sal_uInt16 nRangeY);
+extern sal_Bool IsScrollMDI(ViewShell* pVwSh, const SwRect &);
+extern void SizeNotify(ViewShell* pVwSh, const Size &);
+
+//Update der Statusleiste, waehrend einer Action.
+extern void PageNumNotify( ViewShell* pVwSh,
+ sal_uInt16 nPhyNum,
+ sal_uInt16 nVirtNum,
+ const UniString& rPg );
+
+enum FlyMode { FLY_DRAG_START, FLY_DRAG, FLY_DRAG_END };
+extern void FrameNotify( ViewShell* pVwSh, FlyMode eMode = FLY_DRAG );
+
+SW_DLLPUBLIC void StartProgress ( sal_uInt16 nMessId, long nStartVal, long nEndVal, SwDocShell *pDocSh = 0 );
+SW_DLLPUBLIC void EndProgress ( SwDocShell *pDocSh = 0 );
+SW_DLLPUBLIC void SetProgressState ( long nPosition, SwDocShell *pDocShell );
+void SetProgressText ( sal_uInt16 nMessId, SwDocShell *pDocShell );
+void RescheduleProgress( SwDocShell *pDocShell );
+
+void EnableCmdInterface(sal_Bool bEnable = sal_True);
+
+LAYOUT_NS Dialog* GetSearchDialog();
+
+void RepaintPagePreview( ViewShell* pVwSh, const SwRect& rRect );
+
+// ndgrf.cxx
+// alle QuickDraw-Bitmaps des speziellen Docs loeschen
+void DelAllGrfCacheEntries( SwDoc* pDoc );
+
+// ChgMode fuer Tabellen aus der Konfiguration lesen
+TblChgMode GetTblChgDefaultMode();
+
+sal_Bool JumpToSwMark( ViewShell* pVwSh, const UniString& rMark );
+
+
+#endif
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
new file mode 100644
index 000000000000..59b513965ed9
--- /dev/null
+++ b/sw/inc/modcfg.hxx
@@ -0,0 +1,343 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _MODOPT_HXX
+#define _MODOPT_HXX
+
+#include <tools/string.hxx>
+#include <tools/wintypes.hxx>
+#include <vcl/field.hxx>
+#include <svl/svarray.hxx>
+#include <unotools/configitem.hxx>
+#include "swdllapi.h"
+#include "authratr.hxx"
+#include <SwCapObjType.hxx>
+#include "tblenum.hxx"
+#include "itabenum.hxx"
+#include <tools/globname.hxx>
+class SwModuleOptions;
+
+//-----------------------------------------------------------------------------
+class InsCaptionOpt;
+typedef InsCaptionOpt* InsCaptionOptPtr;
+SV_DECL_PTRARR_SORT_DEL(InsCapOptArr, InsCaptionOptPtr, 0, 5)
+
+class InsCaptionOptArr : public InsCapOptArr
+{
+ friend class SwModuleOptions;
+ friend class SwInsertConfig;
+protected:
+ InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = 0) const;
+};
+
+/* -----------------------------10.10.00 16:14--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwRevisionConfig : public utl::ConfigItem
+{
+ friend class SwModuleOptions;
+
+ AuthorCharAttr aInsertAttr; //Revision/TextDisplay/Insert/Attribute // Redlining: Author-Zeichenattribute
+ //Revision/TextDisplay/Insert/Color
+ AuthorCharAttr aDeletedAttr; //Revision/TextDisplay/Delete/Attribute
+ //Revision/TextDisplay/Delete/Color
+ AuthorCharAttr aFormatAttr; //Revision/TextDisplay/ChangeAttribute/Attribute
+ //Revision/TextDisplay/ChangeAttribute/Color
+ sal_uInt16 nMarkAlign; //Revision/LinesChanged/Mark
+ Color aMarkColor; //Revision/LinesChanged/Color
+
+ const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
+ public:
+ SwRevisionConfig();
+ ~SwRevisionConfig();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ void Load();
+ void SetModified(){ConfigItem::SetModified();}
+};
+/* -----------------------------11.10.00 09:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwInsertConfig : public utl::ConfigItem
+{
+ friend class SwModuleOptions;
+
+ InsCaptionOptArr* pCapOptions;
+ InsCaptionOpt* pOLEMiscOpt;
+
+ SvGlobalName aGlobalNames[5];
+
+ sal_Bool bInsWithCaption; //Insert/Caption/Automatic // Objekte beschriftet einfuegen
+ sal_Bool bCaptionOrderNumberingFirst; //#i61007# caption order starting with numbering
+// sal_uInt16 nInsTblFlags; //Insert/Table/Header // Flags fuer Tabellen einfuegen
+ //Insert/Table/RepeatHeader
+ //Insert/Table/Split
+ //Insert/Table/Border
+ SwInsertTableOptions aInsTblOpts;
+ sal_Bool bIsWeb;
+
+ const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
+ public:
+ SwInsertConfig(sal_Bool bWeb);
+ ~SwInsertConfig();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ void Load();
+ void SetModified(){ConfigItem::SetModified();}
+};
+/* -----------------------------11.10.00 09:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwTableConfig : public utl::ConfigItem
+{
+ friend class SwModuleOptions;
+
+ sal_uInt16 nTblHMove; //int Table/Shift/Row
+ sal_uInt16 nTblVMove; //int Table/Shift/Column
+ sal_uInt16 nTblHInsert; //int Table/Insert/Row
+ sal_uInt16 nTblVInsert; //int Table/Insert/Column
+ TblChgMode eTblChgMode; //int Table/Change/Effect
+
+ sal_Bool bInsTblFormatNum; // Table/Input/NumberRecognition // Automatische Zahlenerkennung
+ sal_Bool bInsTblChangeNumFormat; // Table/Input/NumberFormatRecognition // Automatische Zahlenformaterkennung
+ sal_Bool bInsTblAlignNum; // Table/Input/Alignment // Zahlen ausrichten
+
+ const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
+ public:
+ SwTableConfig(sal_Bool bWeb);
+ ~SwTableConfig();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ void Load();
+ void SetModified(){ConfigItem::SetModified();}
+};
+/* -----------------------------18.01.01 16:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwMiscConfig : public utl::ConfigItem
+{
+ friend class SwModuleOptions;
+
+ String sWordDelimiter; // Statistics/WordNumber/Delimiter
+ sal_Bool bDefaultFontsInCurrDocOnly; // DefaultFont/Document
+ sal_Bool bShowIndexPreview ; // Index/ShowPreview
+ sal_Bool bGrfToGalleryAsLnk; // Misc/GraphicToGalleryAsLink
+ sal_Bool bNumAlignSize; // Numbering/Graphic/KeepRatio
+ sal_Bool bSinglePrintJob; // FormLetter/PrintOutput/SinglePrintJobs
+ sal_Bool bIsNameFromColumn; // FormLetter/FileOutput/FileName/Generation
+ sal_Bool bAskForMailMergeInPrint; // Ask if documents containing fields should be 'mailmerged'
+ sal_Int16 nMailingFormats; // FormLetter/MailingOutput/Formats
+ String sNameFromColumn; // FormLetter/FileOutput/FileName/FromDatabaseField (string!)
+ String sMailingPath; // FormLetter/FileOutput/Path
+ String sMailName; // FormLetter/FileOutput/FileName/FromManualSetting (string!)
+
+ const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
+ public:
+ SwMiscConfig();
+ ~SwMiscConfig();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ void Load();
+ void SetModified(){ConfigItem::SetModified();}
+};
+
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SW_DLLPUBLIC SwModuleOptions
+{
+ SwRevisionConfig aRevisionConfig;
+ SwInsertConfig aInsertConfig;
+ SwInsertConfig aWebInsertConfig;
+
+ SwTableConfig aTableConfig;
+ SwTableConfig aWebTableConfig;
+
+ SwMiscConfig aMiscConfig;
+
+ //fiscus: don't show tips of text fields - it's not part of the configuration!
+ sal_Bool bHideFieldTips : 1;
+
+public:
+ SwModuleOptions();
+
+ TblChgMode GetTblMode() const { return aTableConfig.eTblChgMode;}
+ void SetTblMode( TblChgMode eSet ) { aTableConfig.eTblChgMode = eSet;
+ aTableConfig.SetModified();}
+
+ sal_uInt16 GetTblHMove() const { return aTableConfig.nTblHMove;}
+ void SetTblHMove( sal_uInt16 nSet ) { aTableConfig.nTblHMove = nSet;
+ aTableConfig.SetModified();}
+
+ sal_uInt16 GetTblVMove() const { return aTableConfig.nTblVMove;}
+ void SetTblVMove( sal_uInt16 nSet ) { aTableConfig.nTblVMove = nSet;
+ aTableConfig.SetModified();}
+
+ sal_uInt16 GetTblHInsert() const {return aTableConfig.nTblHInsert;}
+ void SetTblHInsert( sal_uInt16 nSet ) { aTableConfig.nTblHInsert = nSet;
+ aTableConfig.SetModified();}
+
+ sal_uInt16 GetTblVInsert() const {return aTableConfig.nTblVInsert;}
+ void SetTblVInsert( sal_uInt16 nSet ) { aTableConfig.nTblVInsert = nSet;
+ aTableConfig.SetModified();}
+
+ const AuthorCharAttr &GetInsertAuthorAttr() const { return aRevisionConfig.aInsertAttr; }
+ void SetInsertAuthorAttr( AuthorCharAttr &rAttr ) { aRevisionConfig.aInsertAttr = rAttr;
+ aRevisionConfig.SetModified();}
+
+ const AuthorCharAttr &GetDeletedAuthorAttr() const { return aRevisionConfig.aDeletedAttr; }
+ void SetDeletedAuthorAttr( AuthorCharAttr &rAttr ) { aRevisionConfig.aDeletedAttr = rAttr;
+ aRevisionConfig.SetModified();}
+
+ const AuthorCharAttr &GetFormatAuthorAttr() const { return aRevisionConfig.aFormatAttr; }
+ void SetFormatAuthorAttr( AuthorCharAttr &rAttr ) { aRevisionConfig.aFormatAttr = rAttr;
+ aRevisionConfig.SetModified();}
+
+ sal_uInt16 GetMarkAlignMode() const { return aRevisionConfig.nMarkAlign; }
+ void SetMarkAlignMode(sal_uInt16 nMode) { aRevisionConfig.nMarkAlign = nMode;
+ aRevisionConfig.SetModified();}
+
+ const Color& GetMarkAlignColor() const { return aRevisionConfig.aMarkColor; }
+ void SetMarkAlignColor(const Color &rColor) { aRevisionConfig.aMarkColor = rColor;
+ aRevisionConfig.SetModified();}
+
+ sal_Bool IsInsWithCaption(sal_Bool bHTML) const
+ { return bHTML ? sal_False : aInsertConfig.bInsWithCaption; }
+ void SetInsWithCaption( sal_Bool bHTML, sal_Bool b )
+ { if(!bHTML)
+ aInsertConfig.bInsWithCaption = b;
+ aInsertConfig.SetModified();}
+
+ sal_Bool IsCaptionOrderNumberingFirst() const { return aInsertConfig.bCaptionOrderNumberingFirst; }
+ void SetCaptionOrderNumberingFirst( sal_Bool bSet )
+ {
+ if(aInsertConfig.bCaptionOrderNumberingFirst != bSet)
+ {
+ aInsertConfig.bCaptionOrderNumberingFirst = bSet;
+ aInsertConfig.SetModified();
+ }
+ }
+
+ sal_Bool IsInsTblFormatNum(sal_Bool bHTML) const
+ { return bHTML ? aWebTableConfig.bInsTblFormatNum : aTableConfig.bInsTblFormatNum; }
+ void SetInsTblFormatNum( sal_Bool bHTML, sal_Bool b )
+ { bHTML ? (aWebTableConfig.bInsTblFormatNum = b) : (aTableConfig.bInsTblFormatNum = b);
+ bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
+
+ sal_Bool IsInsTblChangeNumFormat(sal_Bool bHTML) const
+ { return bHTML ? aWebTableConfig.bInsTblChangeNumFormat : aTableConfig.bInsTblChangeNumFormat; }
+ void SetInsTblChangeNumFormat( sal_Bool bHTML, sal_Bool b )
+ { bHTML ? (aWebTableConfig.bInsTblChangeNumFormat = b) : (aTableConfig.bInsTblChangeNumFormat = b);
+ bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
+
+
+ sal_Bool IsInsTblAlignNum(sal_Bool bHTML) const
+ { return bHTML ? aWebTableConfig.bInsTblAlignNum : aTableConfig.bInsTblAlignNum; }
+ void SetInsTblAlignNum( sal_Bool bHTML, sal_Bool b )
+ { bHTML ? (aWebTableConfig.bInsTblAlignNum = b) : (aTableConfig.bInsTblAlignNum = b);
+ bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();;}
+
+ SwInsertTableOptions GetInsTblFlags(sal_Bool bHTML) const
+ { return bHTML ? aWebInsertConfig.aInsTblOpts : aInsertConfig.aInsTblOpts;}
+ void SetInsTblFlags( sal_Bool bHTML, const SwInsertTableOptions& rOpts ) {
+ bHTML ? (aWebInsertConfig.aInsTblOpts = rOpts) : (aInsertConfig.aInsTblOpts = rOpts);
+ bHTML ? aWebInsertConfig.SetModified() : aInsertConfig.SetModified();}
+
+ const InsCaptionOpt* GetCapOption(sal_Bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId);
+ sal_Bool SetCapOption(sal_Bool bHTML, const InsCaptionOpt* pOpt);
+
+
+ sal_Bool IsGrfToGalleryAsLnk() const { return aMiscConfig.bGrfToGalleryAsLnk; }
+ void SetGrfToGalleryAsLnk( sal_Bool b ) { aMiscConfig.bGrfToGalleryAsLnk = b;
+ aMiscConfig.SetModified();}
+
+ sal_Int16 GetMailingFormats() const { return aMiscConfig.nMailingFormats;}
+ void SetMailingFormats( sal_Int16 nSet ) { aMiscConfig.nMailingFormats = nSet;
+ aMiscConfig.SetModified();}
+
+ sal_Bool IsSinglePrintJob() const { return aMiscConfig.bSinglePrintJob; }
+ void SetSinglePrintJob( sal_Bool b ) { aMiscConfig.bSinglePrintJob = b;
+ aMiscConfig.SetModified();}
+
+ sal_Bool IsNumAlignSize() const { return aMiscConfig.bNumAlignSize; }
+ void SetNumAlignSize( sal_Bool b ) { aMiscConfig.bNumAlignSize = b;
+ aMiscConfig.SetModified();}
+
+ sal_Bool IsNameFromColumn() const { return aMiscConfig.bIsNameFromColumn; }
+ void SetIsNameFromColumn( sal_Bool bSet )
+ {
+ aMiscConfig.SetModified();
+ aMiscConfig.bIsNameFromColumn = bSet;
+ }
+
+ sal_Bool IsAskForMailMerge() const { return aMiscConfig.bAskForMailMergeInPrint;}
+ void SetAskForMailMerge(sal_Bool bSet)
+ {
+ aMiscConfig.SetModified();
+ aMiscConfig.bAskForMailMergeInPrint = bSet;
+ }
+
+
+ const String& GetNameFromColumn() const { return aMiscConfig.sNameFromColumn; }
+ void SetNameFromColumn( const String& rSet ) { aMiscConfig.sNameFromColumn = rSet;
+ aMiscConfig.SetModified();}
+
+ String GetMailingPath() const { return aMiscConfig.sMailingPath; }
+ void SetMailingPath(const String& sPath) { aMiscConfig.sMailingPath = sPath;
+ aMiscConfig.SetModified();}
+
+ String GetMailName() const { return aMiscConfig.sMailName; }
+ void SetMailName(const String& sName){ aMiscConfig.sMailName = sName;
+ aMiscConfig.SetModified();}
+
+ const String &GetWordDelimiter() const { return aMiscConfig.sWordDelimiter; }
+ void SetWordDelimiter(const String& sDelim) { aMiscConfig.sWordDelimiter = sDelim;
+ aMiscConfig.SetModified();}
+
+ //convert word delimiter from or to user interface
+ static String ConvertWordDelimiter(const String& rDelim, sal_Bool bFromUI);
+
+ sal_Bool IsShowIndexPreview() const {return aMiscConfig.bShowIndexPreview;}
+ void SetShowIndexPreview(sal_Bool bSet)
+ {aMiscConfig.bShowIndexPreview = bSet;
+ aMiscConfig.SetModified();}
+
+ sal_Bool IsDefaultFontInCurrDocOnly() const { return aMiscConfig.bDefaultFontsInCurrDocOnly;}
+ void SetDefaultFontInCurrDocOnly(sal_Bool bSet)
+ {
+ aMiscConfig.bDefaultFontsInCurrDocOnly = bSet;
+ aMiscConfig.SetModified();
+ }
+
+ sal_Bool IsHideFieldTips() const {return bHideFieldTips;}
+ void SetHideFieldTips(sal_Bool bSet) {bHideFieldTips = bSet;}
+};
+#endif
+
diff --git a/sw/inc/modeltoviewhelper.hxx b/sw/inc/modeltoviewhelper.hxx
new file mode 100644
index 000000000000..2d97ca9b32fc
--- /dev/null
+++ b/sw/inc/modeltoviewhelper.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MODELTOVIEWHELPER_HXX
+#define _MODELTOVIEWHELPER_HXX
+
+#include <sal/types.h>
+
+#include <vector>
+
+/** Some helpers for converting model strings to view strings.
+
+ A paragraph string does not have its fields expanded, i.e., they are
+ represented by a special character inside the string with an additional
+ attribute assigned to it. For some tasks (e.g., SmartTags) it is required
+ to expand the fields to get the string as it appears in the view. Two
+ helper functions are provided to convert model positions to view positions
+ and vice versa.
+*/
+namespace ModelToViewHelper
+{
+ /** For each field in the model string, there is an entry in the conversion
+ map. The first value of the ConversionMapEntry points to the field
+ position in the model string, the second value points to the associated
+ position in the view string. The last entry in the conversion map
+ denotes the lengths of the model resp. view string.
+ */
+ typedef std::pair< sal_uInt32 , sal_uInt32 > ConversionMapEntry;
+ typedef std::vector< ConversionMapEntry > ConversionMap;
+
+ /** This struct defines a position in the model string.
+
+ The 'main' position is given by mnPos. If there's a field located at
+ this position, mbIsField is set and mnSubPos denotes the position inside
+ that field.
+ */
+ struct ModelPosition
+ {
+ sal_uInt32 mnPos;
+ sal_uInt32 mnSubPos;
+ bool mbIsField;
+
+ ModelPosition() : mnPos(0), mnSubPos(0), mbIsField(false) {}
+ };
+
+ /** Converts a model position into a view position
+
+ @param pMap
+ pMap is the conversion map required for the calculation. If pMap is
+ 0, no conversion takes place, i.e., it is assumed that the model
+ string is identical to the view string.
+
+ @param nPos
+ nPos denotes a position in the model string which should be
+ converted. Note that converting model positions inside fields is
+ not supported, therefore nPos is not of type ModelPosition.
+
+ @return
+ the position of nPos in the view string. In case the conversion
+ could not be performed (e.g., because there is not ConversionMap or
+ nPos is behind the last entry in the conversion map) nPos will
+ be returned.
+ */
+ sal_uInt32 ConvertToViewPosition( const ConversionMap* pMap, sal_uInt32 nModelPos );
+
+ /** Converts a view position into a model position
+
+ @param pMap
+ pMap is the conversion map required for the calculation. If pMap is
+ 0, no conversion takes place, i.e., it is assumed that the model
+ string is identical to the view string.
+
+ @param nPos
+ nPos denotes a position in the view string which should be
+ converted.
+
+ @return
+ the position of nPos in the model string. In case the conversion
+ could not be performed (e.g., because there is not ConversionMap or
+ nPos is behind the last entry in the conversion map) a model
+ model position with mnPos = nPos and mnIsField = false will be
+ returned.
+ */
+ ModelPosition ConvertToModelPosition( const ConversionMap* pMap, sal_uInt32 nViewPos );
+}
+
+#endif
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
new file mode 100644
index 000000000000..cea112f655a0
--- /dev/null
+++ b/sw/inc/ndarr.hxx
@@ -0,0 +1,347 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_NDARR_HXX
+#define SW_NDARR_HXX
+
+#include <vector>
+
+#include <boost/utility.hpp>
+
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+
+#include <svl/svarray.hxx>
+#include <svtools/embedhlp.hxx>
+
+#include <bparr.hxx>
+#include <ndtyp.hxx>
+
+
+class Graphic;
+class GraphicObject;
+class String;
+class SwAttrSet;
+class SfxItemSet;
+class SwCntntNode;
+class SwDoc;
+class SwGrfFmtColl;
+class SwGrfNode;
+class SwHistory;
+class SwNode;
+class SwNodeIndex;
+class SwNodeRange;
+class SwOLENode;
+class SwOutlineNodes;
+class SwPaM;
+class SwSectionData;
+class SwSectionFmt;
+class SwTOXBase;
+class SwSectionNode;
+class SwStartNode;
+class SwTableBoxFmt;
+class SwTableFmt;
+class SwTableLine;
+class SwTableLineFmt;
+class SwTableNode;
+class SwTblToTxtSaves;
+class SwTxtFmtColl;
+class SwTxtNode;
+class SwUndoTblToTxt;
+class SwUndoTxtToTbl;
+struct SwPosition;
+
+
+// --------------------
+// class SwNodes
+// --------------------
+
+typedef SwNode * SwNodePtr;
+typedef sal_Bool (*FnForEach_SwNodes)( const SwNodePtr&, void* pArgs );
+
+SV_DECL_PTRARR_SORT( SwOutlineNodes, SwNodePtr, 0, 10 )
+
+class SW_DLLPUBLIC SwNodes
+ : private BigPtrArray
+ , private ::boost::noncopyable
+{
+ friend class SwDoc;
+ friend class SwNode;
+ friend class SwNodeIndex;
+
+ SwNodeIndex* pRoot; // Liste aller Indizies auf Nodes
+
+ // --> OD 2008-05-14 #refactorlists# - removed <bSyncNumberAndNumRule>
+ void InsertNode( const SwNodePtr pNode,
+ const SwNodeIndex& rPos );
+ void InsertNode( const SwNodePtr pNode,
+ sal_uLong nPos );
+ // <--
+
+
+ SwDoc* pMyDoc; // in diesem Doc ist das Nodes-Array
+
+ SwNode *pEndOfPostIts, *pEndOfInserts, // das sind die festen Bereiche
+ *pEndOfAutotext, *pEndOfRedlines,
+ *pEndOfContent;
+
+ mutable SwOutlineNodes* pOutlineNds; // Array aller GliederiungsNodes
+
+ sal_Bool bInNodesDel : 1; // falls rekursiv aufgerufen wird
+ // Num/Outline nicht aktualisierem
+ sal_Bool bInDelUpdOutl : 1; // Flags fuers aktualisieren von Outl.
+ sal_Bool bInDelUpdNum : 1; // Flags fuers aktualisieren von Outl.
+
+ // fuer dier Verwaltung der Indizies
+ void RegisterIndex( SwNodeIndex& rIdx );
+ void DeRegisterIndex( SwNodeIndex& rIdx );
+ void RemoveNode( sal_uLong nDelPos, sal_uLong nLen, sal_Bool bDel );
+
+ // Aktionen auf die Nodes
+ void SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEnd );
+ void DelNodes( const SwNodeIndex& rStart, sal_uLong nCnt = 1 );
+
+ void ChgNode( SwNodeIndex& rDelPos, sal_uLong nSize,
+ SwNodeIndex& rInsPos, sal_Bool bNewFrms );
+
+ void UpdtOutlineIdx( const SwNode& ); // Update ab Node alle OutlineNodes
+
+ void _CopyNodes( const SwNodeRange&, const SwNodeIndex&,
+ sal_Bool bNewFrms = sal_True, sal_Bool bTblInsDummyNode = sal_False ) const;
+ void _DelDummyNodes( const SwNodeRange& rRg );
+
+protected:
+ SwNodes( SwDoc* pDoc );
+
+public:
+ ~SwNodes();
+
+ typedef ::std::vector<SwNodeRange> NodeRanges_t;
+ typedef ::std::vector<NodeRanges_t> TableRanges_t;
+
+ SwNodePtr operator[]( sal_uLong n ) const
+ { return (SwNodePtr)BigPtrArray::operator[] ( n ); }
+
+ sal_uLong Count() const { return BigPtrArray::Count(); }
+ void ForEach( FnForEach_SwNodes fnForEach, void* pArgs = 0 )
+ {
+ BigPtrArray::ForEach( 0, BigPtrArray::Count(),
+ (FnForEach) fnForEach, pArgs );
+ }
+ void ForEach( sal_uLong nStt, sal_uLong nEnd, FnForEach_SwNodes fnForEach, void* pArgs = 0 )
+ {
+ BigPtrArray::ForEach( nStt, nEnd, (FnForEach) fnForEach, pArgs );
+ }
+ void ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd,
+ FnForEach_SwNodes fnForEach, void* pArgs = 0 );
+
+ // eine noch leere Section
+ SwNode& GetEndOfPostIts() const { return *pEndOfPostIts; }
+ // Section fuer alle Fussnoten
+ SwNode& GetEndOfInserts() const { return *pEndOfInserts; }
+ // Section fuer alle Flys/Header/Footers
+ SwNode& GetEndOfAutotext() const { return *pEndOfAutotext; }
+ // Section fuer alle Redlines
+ SwNode& GetEndOfRedlines() const { return *pEndOfRedlines; }
+ // das ist der letzte EndNode einer SonderSection. Hier nach kommt nur
+ // noch die normale ContentSection (also der BodyText)
+ SwNode& GetEndOfExtras() const { return *pEndOfRedlines; }
+ // die normale ContentSection (also der BodyText)
+ SwNode& GetEndOfContent() const { return *pEndOfContent; }
+
+ // ist das NodesArray das normale vom Doc? (nicht das UndoNds, .. )
+ // Implementierung steht im doc.hxx (weil man dazu Doc kennen muss) !
+ sal_Bool IsDocNodes() const;
+
+ sal_uInt16 GetSectionLevel(const SwNodeIndex &rIndex) const;
+ void Delete(const SwNodeIndex &rPos, sal_uLong nNodes = 1);
+
+ sal_Bool _MoveNodes( const SwNodeRange&, SwNodes& rNodes, const SwNodeIndex&,
+ sal_Bool bNewFrms = sal_True );
+ void MoveRange( SwPaM&, SwPosition&, SwNodes& rNodes );
+
+ void _Copy( const SwNodeRange& rRg, const SwNodeIndex& rInsPos,
+ sal_Bool bNewFrms = sal_True ) const
+ { _CopyNodes( rRg, rInsPos, bNewFrms ); }
+
+ void SectionUp( SwNodeRange *);
+ void SectionDown( SwNodeRange *pRange, SwStartNodeType = SwNormalStartNode );
+
+ sal_Bool CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd ) const;
+
+ void GoStartOfSection(SwNodeIndex *) const;
+ void GoEndOfSection(SwNodeIndex *) const;
+
+ SwCntntNode* GoNext(SwNodeIndex *) const;
+ SwCntntNode* GoPrevious(SwNodeIndex *) const;
+
+ //Gehe zum naechsten/vorherigen Cntnt/Tabellennode, fuer den
+ //es LayoutFrames gibt, dabei Kopf-/Fusszeilen/Rahmen etc. nicht verlassen
+ SwNode* GoNextWithFrm(SwNodeIndex *) const;
+ SwNode* GoPreviousWithFrm(SwNodeIndex *) const;
+
+ // zum naechsten Content-Node, der nicht geschuetzt oder versteckt ist
+ // (beides auf sal_False ==> GoNext/GoPrevious!!!)
+ SwCntntNode* GoNextSection( SwNodeIndex *, int bSkipHidden = sal_True,
+ int bSkipProtect = sal_True ) const;
+ SwCntntNode* GoPrevSection( SwNodeIndex *, int bSkipHidden = sal_True,
+ int bSkipProtect = sal_True ) const;
+
+ // erzeuge ein leere Section von Start und EndNode. Darf nur gerufen
+ // werden, wenn eine neue Section mit Inhalt erzeugt werden soll.
+ // Zum Beispiel bei den Filtern/Undo/...
+ SwStartNode* MakeEmptySection( const SwNodeIndex& rIdx,
+ SwStartNodeType = SwNormalStartNode );
+
+ // die Impl. von "Make...Node" stehen in den angegebenen .ccx-Files
+ SwTxtNode *MakeTxtNode( const SwNodeIndex & rWhere,
+ SwTxtFmtColl *pColl,
+ SwAttrSet* pAutoAttr = 0 ); // in ndtxt.cxx
+ SwStartNode* MakeTextSection( const SwNodeIndex & rWhere,
+ SwStartNodeType eSttNdTyp,
+ SwTxtFmtColl *pColl,
+ SwAttrSet* pAutoAttr = 0 );
+
+ SwGrfNode *MakeGrfNode( const SwNodeIndex & rWhere,
+ const String& rGrfName,
+ const String& rFltName,
+ const Graphic* pGraphic,
+ SwGrfFmtColl *pColl,
+ SwAttrSet* pAutoAttr = 0,
+ sal_Bool bDelayed = sal_False ); // in ndgrf.cxx
+
+ SwGrfNode *MakeGrfNode( const SwNodeIndex & rWhere,
+ const GraphicObject& rGrfObj,
+ SwGrfFmtColl *pColl,
+ SwAttrSet* pAutoAttr = 0 ); // in ndgrf.cxx
+
+ SwOLENode *MakeOLENode( const SwNodeIndex & rWhere,
+ const svt::EmbeddedObjectRef&,
+ SwGrfFmtColl *pColl,
+ SwAttrSet* pAutoAttr = 0 ); // in ndole.cxx
+ SwOLENode *MakeOLENode( const SwNodeIndex & rWhere,
+ const String &rName,
+ sal_Int64 nAspect,
+ SwGrfFmtColl *pColl,
+ SwAttrSet* pAutoAttr ); // in ndole.cxx
+
+ // Array aller GliederiungsNodes;
+ const SwOutlineNodes& GetOutLineNds() const;
+
+ //void UpdateOutlineNode( const SwNode&, sal_uInt8 nOldLevel, sal_uInt8 nNewLevel );//#outline level,removed by zhaojianwei
+ // alle Nodes Updaten - Rule/Format-Aenderung
+ void UpdateOutlineNode(SwNode & rNd);
+
+ // fuege die Nodes fuer die Tabelle ein
+ // wenn Lines angegeben, erzeuge die Matrix aus Lines & Boxen
+ // ansonsten nur die Anzahl von Boxen.
+ /* #109161#
+
+ New parameter pAttrSet: If pAttrSet is non-null and contains an
+ adjust item it is propagated to the table cells. If there is an
+ adjust in pCntntTxtColl or pHeadlineTxtColl this adjust item
+ overrides the item in pAttrSet.
+
+ */
+ SwTableNode* InsertTable( const SwNodeIndex& rNdIdx,
+ sal_uInt16 nBoxes, SwTxtFmtColl* pCntntTxtColl,
+ sal_uInt16 nLines = 0, sal_uInt16 nRepeat = 0,
+ SwTxtFmtColl* pHeadlineTxtColl = 0,
+ const SwAttrSet * pAttrSet = 0);
+
+ // erzeuge aus dem makierten Bereich eine ausgeglichene Tabelle
+ SwTableNode* TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
+ SwTableFmt* pTblFmt,
+ SwTableLineFmt* pLineFmt,
+ SwTableBoxFmt* pBoxFmt,
+ SwTxtFmtColl* pTxtColl,
+ SwUndoTxtToTbl* pUndo = 0 );
+
+ SwNodeRange * ExpandRangeForTableBox(const SwNodeRange & rRange);
+
+ //create a table from a vector of NodeRanges - API support
+ SwTableNode* TextToTable( const TableRanges_t& rTableNodes,
+ SwTableFmt* pTblFmt,
+ SwTableLineFmt* pLineFmt,
+ SwTableBoxFmt* pBoxFmt,
+ SwTxtFmtColl* pTxtColl
+ /*, SwUndo... pUndo*/ );
+
+ // erzeuge aus der Tabelle wieder normalen Text
+ sal_Bool TableToText( const SwNodeRange& rRange, sal_Unicode cCh,
+ SwUndoTblToTxt* = 0 );
+ // steht im untbl.cxx und darf nur vom Undoobject gerufen werden
+ SwTableNode* UndoTableToText( sal_uLong nStt, sal_uLong nEnd,
+ const SwTblToTxtSaves& rSavedData );
+
+ // fuege in der Line, vor der InsPos eine neue Box ein. Das Format
+ // wird von der nachfolgenden (vorhergenden;wenn an Ende) genommen
+ // in der Line muss schon eine Box vorhanden sein !
+ sal_Bool InsBoxen( SwTableNode*, SwTableLine*, SwTableBoxFmt*,
+ // Formate fuer den TextNode der Box
+ SwTxtFmtColl*, const SfxItemSet* pAutoAttr,
+ sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 );
+ // Splittet eine Tabelle in der Grund-Zeile, in der der Index steht.
+ // Alle GrundZeilen dahinter wandern in eine neue Tabelle/-Node.
+ // Ist das Flag bCalcNewSize auf sal_True, wird fuer beide neuen Tabellen
+ // die neue SSize aus dem Max der Boxen errechnet; vorrausgesetzt,
+ // die SSize ist "absolut" gesetzt (LONG_MAX)
+ // (Wird zur Zeit nur fuer den RTF-Parser benoetigt)
+ SwTableNode* SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter = sal_True,
+ sal_Bool bCalcNewSize = sal_False );
+ // fuegt 2 Tabellen, die hintereinander stehen, wieder zusammen
+ sal_Bool MergeTable( const SwNodeIndex& rPos, sal_Bool bWithPrev = sal_True,
+ sal_uInt16 nMode = 0, SwHistory* pHistory = 0 );
+
+ // fuege eine neue SwSection ein
+ SwSectionNode* InsertTextSection(SwNodeIndex const& rNdIdx,
+ SwSectionFmt& rSectionFmt,
+ SwSectionData const&,
+ SwTOXBase const*const pTOXBase,
+ SwNodeIndex const*const pEnde,
+ bool const bInsAtStart = true,
+ bool const bCreateFrms = true);
+
+ // in welchem Doc steht das Nodes-Array ?
+ SwDoc* GetDoc() { return pMyDoc; }
+ const SwDoc* GetDoc() const { return pMyDoc; }
+
+ // suche den vorhergehenden [/nachfolgenden ] ContentNode oder
+ // TabellenNode mit Frames. Wird kein Ende angeben, dann wird mit
+ // dem FrameIndex begonnen; ansonsten, wird mit dem vor rFrmIdx und
+ // dem hintern pEnd die Suche gestartet. Sollte kein gueltiger Node
+ // gefunden werden, wird 0 returnt. rFrmIdx zeigt auf dem Node mit
+ // Frames
+ SwNode* FindPrvNxtFrmNode( SwNodeIndex& rFrmIdx,
+ const SwNode* pEnd = 0 ) const;
+
+ //-> #112139#
+ SwNode * DocumentSectionStartNode(SwNode * pNode) const;
+ SwNode * DocumentSectionEndNode(SwNode * pNode) const;
+ //<- #112139#
+};
+
+#endif
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
new file mode 100644
index 000000000000..fb1c1d4c8c33
--- /dev/null
+++ b/sw/inc/ndgrf.hxx
@@ -0,0 +1,257 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _NDGRF_HXX
+#define _NDGRF_HXX
+#include <sfx2/lnkbase.hxx>
+#include <svtools/grfmgr.hxx>
+#include <ndnotxt.hxx>
+// --> OD, MAV 2005-08-17 #i53025#
+#include <com/sun/star/embed/XStorage.hpp>
+// <--
+// --> OD 2007-03-28 #i73788#
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+class SwAsyncRetrieveInputStreamThreadConsumer;
+// <--
+
+class SwGrfFmtColl;
+class SwDoc;
+class GraphicAttr;
+class SvStorage;
+// --------------------
+// SwGrfNode
+// --------------------
+class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode
+{
+ friend class SwNodes;
+
+ GraphicObject aGrfObj;
+ ::sfx2::SvBaseLinkRef refLink; // falls Grafik nur als Link, dann Pointer gesetzt
+ Size nGrfSize;
+// String aStrmName; // SW3: Name des Storage-Streams fuer Embedded
+ String aNewStrmName; // SW3/XML: new stream name (either SW3 stream
+ // name or package url)
+ String aLowResGrf; // HTML: LowRes Grafik (Ersatzdarstellung bis
+ // die normale (HighRes) geladen ist.
+ sal_Bool bTransparentFlagValid :1;
+ sal_Bool bInSwapIn :1;
+
+ sal_Bool bGrafikArrived :1;
+ sal_Bool bChgTwipSize :1;
+ sal_Bool bChgTwipSizeFromPixel :1;
+ sal_Bool bLoadLowResGrf :1;
+ sal_Bool bFrameInPaint :1; //Um Start-/EndActions im Paint (ueber
+ //SwapIn zu verhindern.
+ sal_Bool bScaleImageMap :1; //Image-Map in SetTwipSize skalieren
+
+ // --> OD 2007-01-19 #i73788#
+ boost::shared_ptr< SwAsyncRetrieveInputStreamThreadConsumer > mpThreadConsumer;
+ bool mbLinkedInputStreamReady;
+ com::sun::star::uno::Reference<com::sun::star::io::XInputStream> mxInputStream;
+ sal_Bool mbIsStreamReadOnly;
+ // <--
+
+ SwGrfNode( const SwNodeIndex& rWhere,
+ const String& rGrfName, const String& rFltName,
+ const Graphic* pGraphic,
+ SwGrfFmtColl* pGrfColl,
+ SwAttrSet* pAutoAttr = 0 );
+ // Ctor fuer Einlesen (SW/G) ohne Grafik
+ SwGrfNode( const SwNodeIndex& rWhere,
+ const String& rGrfName, const String& rFltName,
+ SwGrfFmtColl* pGrfColl,
+ SwAttrSet* pAutoAttr = 0 );
+ SwGrfNode( const SwNodeIndex& rWhere,
+ const GraphicObject& rGrfObj,
+ SwGrfFmtColl* pGrfColl,
+ SwAttrSet* pAutoAttr = 0 );
+
+ void InsertLink( const String& rGrfName, const String& rFltName );
+ sal_Bool ImportGraphic( SvStream& rStrm );
+ sal_Bool HasStreamName() const { return aGrfObj.HasUserData(); }
+ // --> OD 2005-05-04 #i48434# - adjust return type and rename method to
+ // indicate that its an private one.
+ // --> OD 2005-08-17 #i53025#
+ // embedded graphic stream couldn't be inside a 3.1 - 5.2 storage any more.
+ // Thus, return value isn't needed any more.
+ void _GetStreamStorageNames( String& rStrmName, String& rStgName ) const;
+ // <--
+ void DelStreamName();
+ DECL_LINK( SwapGraphic, GraphicObject* );
+
+ /** helper method to determine stream for the embedded graphic.
+
+ OD 2005-05-04 #i48434#
+ Important note: caller of this method has to handle the thrown exceptions
+ OD, MAV 2005-08-17 #i53025#
+ Storage, which should contain the stream of the embedded graphic, is
+ provided via parameter. Otherwise the returned stream will be closed
+ after the the method returns, because its parent stream is closed and deleted.
+ Proposed name of embedded graphic stream is also provided by parameter.
+
+ @author OD
+
+ @param _refPics
+ input parameter - reference to storage, which should contain the
+ embedded graphic stream.
+
+ @param _aStrmName
+ input parameter - proposed name of the embedded graphic stream.
+
+ @return SvStream*
+ new created stream of the embedded graphic, which has to be destroyed
+ after its usage. Could be NULL, if the stream isn't found.
+ */
+ SvStream* _GetStreamForEmbedGrf(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _refPics,
+ String& _aStrmName ) const;
+
+ /** helper method to get a substorage of the document storage for readonly access.
+
+ OD, MAV 2005-08-17 #i53025#
+ A substorage with the specified name will be opened readonly. If the provided
+ name is empty the root storage will be returned.
+
+ @param _aStgName
+ input parameter - name of substorage. Can be empty.
+
+ @return XStorage
+ reference to substorage or the root storage
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > _GetDocSubstorageOrRoot(
+ const String& aStgName ) const;
+
+public:
+ virtual ~SwGrfNode();
+ const Graphic& GetGrf() const { return aGrfObj.GetGraphic(); }
+ const GraphicObject& GetGrfObj() const { return aGrfObj; }
+ GraphicObject& GetGrfObj() { return aGrfObj; }
+
+ virtual SwCntntNode *SplitCntntNode( const SwPosition & );
+
+ virtual Size GetTwipSize() const;
+#ifndef _FESHVIEW_ONLY_INLINE_NEEDED
+ void SetTwipSize( const Size& rSz );
+
+ sal_Bool IsTransparent() const;
+
+ inline sal_Bool IsAnimated() const { return aGrfObj.IsAnimated(); }
+
+ inline sal_Bool IsChgTwipSize() const { return bChgTwipSize; }
+ inline sal_Bool IsChgTwipSizeFromPixel() const { return bChgTwipSizeFromPixel; }
+ inline void SetChgTwipSize( sal_Bool b, sal_Bool bFromPx=sal_False ) { bChgTwipSize = b; bChgTwipSizeFromPixel = bFromPx; }
+
+ inline sal_Bool IsGrafikArrived() const { return bGrafikArrived; }
+ inline void SetGrafikArrived( sal_Bool b ) { bGrafikArrived = b; }
+
+ inline sal_Bool IsFrameInPaint() const { return bFrameInPaint; }
+ inline void SetFrameInPaint( sal_Bool b ) { bFrameInPaint = b; }
+
+ inline sal_Bool IsScaleImageMap() const { return bScaleImageMap; }
+ inline void SetScaleImageMap( sal_Bool b ) { bScaleImageMap = b; }
+#endif
+ // steht in ndcopy.cxx
+ virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
+#ifndef _FESHVIEW_ONLY_INLINE_NEEDED
+
+ // erneutes Einlesen, falls Graphic nicht Ok ist. Die
+ // aktuelle wird durch die neue ersetzt.
+ sal_Bool ReRead( const String& rGrfName, const String& rFltName,
+ const Graphic* pGraphic = 0,
+ const GraphicObject* pGrfObj = 0,
+ sal_Bool bModify = sal_True );
+ // Laden der Grafik unmittelbar vor der Anzeige
+ short SwapIn( sal_Bool bWaitForData = sal_False );
+ // Entfernen der Grafik, um Speicher freizugeben
+ short SwapOut();
+ // Zugriff auf den Storage-Streamnamen
+ void SetStreamName( const String& r ) { aGrfObj.SetUserData( r ); }
+ void SetNewStreamName( const String& r ) { aNewStrmName = r; }
+ // is this node selected by any shell?
+ sal_Bool IsSelected() const;
+#endif
+
+ // Der Grafik sagen, dass sich der Node im Undobereich befindet
+ virtual sal_Bool SavePersistentData();
+ virtual sal_Bool RestorePersistentData();
+
+#ifndef _FESHVIEW_ONLY_INLINE_NEEDED
+ // Abfrage der Link-Daten
+ sal_Bool IsGrfLink() const { return refLink.Is(); }
+ inline sal_Bool IsLinkedFile() const;
+ inline sal_Bool IsLinkedDDE() const;
+ ::sfx2::SvBaseLinkRef GetLink() const { return refLink; }
+ sal_Bool GetFileFilterNms( String* pFileNm, String* pFilterNm ) const;
+ void ReleaseLink();
+
+ // Skalieren einer Image-Map: Die Image-Map wird um den Faktor
+ // zwischen Grafik-Groesse und Rahmen-Groesse vergroessert/verkleinert
+ void ScaleImageMap();
+
+ // returns the with our graphic attributes filled Graphic-Attr-Structure
+ GraphicAttr& GetGraphicAttr( GraphicAttr&, const SwFrm* pFrm ) const;
+
+#endif
+ // --> OD 2007-01-18 #i73788#
+ boost::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > GetThreadConsumer();
+ bool IsLinkedInputStreamReady() const;
+ void TriggerAsyncRetrieveInputStream();
+ void ApplyInputStream(
+ com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream,
+ const sal_Bool bIsStreamReadOnly );
+ void UpdateLinkWithInputStream();
+ // <--
+ // --> OD 2008-07-21 #i90395#
+ bool IsAsyncRetrieveInputStreamPossible() const;
+ // <--
+};
+
+
+// ----------------------------------------------------------------------
+// Inline Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
+inline SwGrfNode *SwNode::GetGrfNode()
+{
+ return ND_GRFNODE == nNodeType ? (SwGrfNode*)this : 0;
+}
+inline const SwGrfNode *SwNode::GetGrfNode() const
+{
+ return ND_GRFNODE == nNodeType ? (const SwGrfNode*)this : 0;
+}
+
+#ifndef _FESHVIEW_ONLY_INLINE_NEEDED
+inline sal_Bool SwGrfNode::IsLinkedFile() const
+{
+ return refLink.Is() && OBJECT_CLIENT_GRF == refLink->GetObjType();
+}
+inline sal_Bool SwGrfNode::IsLinkedDDE() const
+{
+ return refLink.Is() && OBJECT_CLIENT_DDE == refLink->GetObjType();
+}
+#endif
+
+
+#endif
diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx
new file mode 100644
index 000000000000..d549368d90f2
--- /dev/null
+++ b/sw/inc/ndhints.hxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _NDHINTS_HXX
+#define _NDHINTS_HXX
+
+
+#include <svl/svarray.hxx>
+#include <tools/mempool.hxx>
+
+#include "swtypes.hxx"
+
+
+class SwTxtNode;
+class SwRegHistory; // steht im RolBck.hxx
+class SwTxtAttr;
+class SwTxtAttrNesting;
+
+class SfxPoolItem;
+class SfxItemSet;
+class SwDoc;
+
+typedef enum {
+ COPY = true,
+ NEW = false,
+} CopyOrNew_t;
+
+// if COPY then pTxtNode must be given!
+SW_DLLPRIVATE SwTxtAttr *
+MakeTxtAttr( SwDoc & rDoc, SfxPoolItem & rNew,
+ xub_StrLen const nStt, xub_StrLen const nEnd,
+ CopyOrNew_t const bIsCopy = NEW, SwTxtNode *const pTxtNode = 0);
+SW_DLLPRIVATE SwTxtAttr *
+MakeTxtAttr( SwDoc & rDoc, const SfxItemSet & rSet,
+ xub_StrLen nStt, xub_StrLen nEnd );
+
+// create redline dummy text hint that must not be inserted into hints array
+SW_DLLPRIVATE SwTxtAttr*
+MakeRedlineTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr );
+
+
+/*
+ * Ableitung der Klasse SwpHints ueber den Umweg ueber SwpHts, da
+ * lediglich die Klasse SwTxtNode Attribute einfuegen und
+ * loeschen koennen soll. Anderen Klassen wie den Frames steht
+ * lediglich ein lesender Zugriff ueber den Index-Operator zur
+ * Verfuegung.
+ * Groesse beim Anlegen gleich 1, weil nur dann ein Array erzeug wird, wenn
+ * auch ein Hint eingefuegt wird.
+ */
+
+/*************************************************************************
+ * class SwpHtStart/End
+ *************************************************************************/
+
+SV_DECL_PTRARR_SORT(SwpHtStart,SwTxtAttr*,1,1)
+SV_DECL_PTRARR_SORT(SwpHtEnd,SwTxtAttr*,1,1)
+
+/*************************************************************************
+ * class SwpHintsArr
+ *************************************************************************/
+
+/// the Hints array
+class SwpHintsArray
+{
+
+protected:
+ SwpHtStart m_HintStarts;
+ SwpHtEnd m_HintEnds;
+
+ //FIXME: why are the non-const methods public?
+public:
+ void Insert( const SwTxtAttr *pHt );
+ void DeleteAtPos( const sal_uInt16 nPosInStart );
+ bool Resort();
+ SwTxtAttr * Cut( const sal_uInt16 nPosInStart );
+
+ inline const SwTxtAttr * GetStart( const sal_uInt16 nPos ) const
+ { return m_HintStarts[nPos]; }
+ inline const SwTxtAttr * GetEnd ( const sal_uInt16 nPos ) const
+ { return m_HintEnds [nPos]; }
+ inline SwTxtAttr * GetStart( const sal_uInt16 nPos )
+ { return m_HintStarts[nPos]; }
+ inline SwTxtAttr * GetEnd ( const sal_uInt16 nPos )
+ { return m_HintEnds [nPos]; }
+
+ inline sal_uInt16 GetEndCount() const { return m_HintEnds .Count(); }
+ inline sal_uInt16 GetStartCount() const { return m_HintStarts.Count(); }
+
+ inline sal_uInt16 GetStartOf( const SwTxtAttr *pHt ) const;
+ inline sal_uInt16 GetPos( const SwTxtAttr *pHt ) const
+ { return m_HintStarts.GetPos( pHt ); }
+
+ inline SwTxtAttr * GetTextHint( const sal_uInt16 nIdx )
+ { return GetStart(nIdx); }
+ inline const SwTxtAttr * operator[]( const sal_uInt16 nIdx ) const
+ { return m_HintStarts[nIdx]; }
+ inline sal_uInt16 Count() const { return m_HintStarts.Count(); }
+
+#ifdef DBG_UTIL
+ bool Check() const;
+#endif
+};
+
+/*************************************************************************
+ * class SwpHints
+ *************************************************************************/
+
+// public interface
+class SwpHints : public SwpHintsArray
+{
+private:
+ SwRegHistory* m_pHistory; // for Undo
+
+ bool m_bFontChange : 1; // font change
+ // true: the Node is in Split and Frames are moved
+ bool m_bInSplitNode : 1;
+ // m_bHasHiddenParaField is invalid, call CalcHiddenParaField()
+ bool m_bCalcHiddenParaField : 1;
+ bool m_bHasHiddenParaField : 1; // HiddenParaFld
+ bool m_bFootnote : 1; // footnotes
+ bool m_bDDEFields : 1; // the TextNode has DDE fields
+
+ // records a new attibute in m_pHistory.
+ void NoteInHistory( SwTxtAttr *pAttr, const bool bNew = false );
+
+ void CalcFlags( );
+
+ // Delete methods may only be called by the TextNode!
+ // Because the TextNode also guarantees removal of the Character for
+ // attributes without an end.
+ friend class SwTxtNode;
+ void DeleteAtPos( const sal_uInt16 nPos );
+ // Delete the given Hint. The Hint must actually be in the array!
+ void Delete( SwTxtAttr* pTxtHt );
+
+ inline void SetInSplitNode(bool bInSplit) { m_bInSplitNode = bInSplit; }
+ inline void SetCalcHiddenParaField() { m_bCalcHiddenParaField = true; }
+ inline void SetHiddenParaField( const bool bNew )
+ { m_bHasHiddenParaField = bNew; }
+ inline bool HasHiddenParaField() const
+ {
+ if ( m_bCalcHiddenParaField )
+ {
+ (const_cast<SwpHints*>(this))->CalcHiddenParaField();
+ }
+ return m_bHasHiddenParaField;
+ }
+
+ void InsertNesting(SwTxtAttrNesting & rNewHint);
+ bool TryInsertNesting(SwTxtNode & rNode, SwTxtAttrNesting & rNewHint);
+ void BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint,
+ const SetAttrMode nMode );
+ bool MergePortions( SwTxtNode& rNode );
+
+public:
+ SwpHints();
+
+ inline bool CanBeDeleted() const { return !Count(); }
+
+ // register a History, which receives all attribute changes (for Undo)
+ void Register( SwRegHistory* pHist ) { m_pHistory = pHist; }
+ // deregister the currently registered History
+ void DeRegister() { Register(0); }
+ SwRegHistory* GetHistory() const { return m_pHistory; }
+
+ /// try to insert the hint
+ /// @return true iff hint successfully inserted
+ bool TryInsertHint( SwTxtAttr * const pHint, SwTxtNode & rNode,
+ const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
+
+ inline bool HasFtn() const { return m_bFootnote; }
+ inline bool IsInSplitNode() const { return m_bInSplitNode; }
+
+ // calc current value of m_bHasHiddenParaField, returns true iff changed
+ bool CalcHiddenParaField();
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwpHints)
+};
+
+// Ausgabeoperator fuer die Texthints
+SvStream &operator<<(SvStream &aS, const SwpHints &rHints); //$ ostream
+
+/*************************************************************************
+ * Inline Implementations
+ *************************************************************************/
+
+inline sal_uInt16 SwpHintsArray::GetStartOf( const SwTxtAttr *pHt ) const
+{
+ sal_uInt16 nPos;
+ if ( !m_HintStarts.Seek_Entry( pHt, &nPos ) )
+ {
+ nPos = USHRT_MAX;
+ }
+ return nPos;
+}
+
+inline SwTxtAttr *SwpHintsArray::Cut( const sal_uInt16 nPosInStart )
+{
+ SwTxtAttr *pHt = GetTextHint(nPosInStart);
+ DeleteAtPos( nPosInStart );
+ return pHt;
+}
+
+
+#endif
diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
new file mode 100644
index 000000000000..695560bf7878
--- /dev/null
+++ b/sw/inc/ndindex.hxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_NDINDEX_HXX
+#define SW_NDINDEX_HXX
+
+#include <limits.h>
+
+#include <tools/solar.h>
+
+#include <node.hxx>
+
+
+class SwNode;
+class SwNodes;
+
+class SW_DLLPUBLIC SwNodeIndex
+{
+ friend void SwNodes::RegisterIndex( SwNodeIndex& );
+ friend void SwNodes::DeRegisterIndex( SwNodeIndex& );
+ friend void SwNodes::RemoveNode( sal_uLong, sal_uLong, sal_Bool );
+
+#ifdef DBG_UTIL
+ static int nSerial;
+ int MySerial;
+#endif
+
+ SwNode* pNd;
+ SwNodeIndex *pNext, *pPrev;
+
+ void Remove(); // Ausketten
+
+ // diese sind nicht erlaubt!
+ SwNodeIndex( SwNodes& rNds, sal_uInt16 nIdx );
+ SwNodeIndex( SwNodes& rNds, int nIdx );
+
+public:
+ SwNodeIndex( SwNodes& rNds, sal_uLong nIdx = 0 );
+ SwNodeIndex( const SwNodeIndex &, long nDiff = 0 );
+ SwNodeIndex( const SwNode&, long nDiff = 0 );
+ ~SwNodeIndex() { Remove(); }
+
+ inline sal_uLong operator++();
+ inline sal_uLong operator--();
+#ifndef CFRONT
+ inline sal_uLong operator++(int);
+ inline sal_uLong operator--(int);
+#endif
+
+ inline sal_uLong operator+=( sal_uLong );
+ inline sal_uLong operator-=( sal_uLong );
+ inline sal_uLong operator+=( const SwNodeIndex& );
+ inline sal_uLong operator-=( const SwNodeIndex& );
+
+ inline sal_Bool operator< ( const SwNodeIndex& ) const;
+ inline sal_Bool operator<=( const SwNodeIndex& ) const;
+ inline sal_Bool operator> ( const SwNodeIndex& ) const;
+ inline sal_Bool operator>=( const SwNodeIndex& ) const;
+ inline sal_Bool operator==( const SwNodeIndex& ) const;
+ inline sal_Bool operator!=( const SwNodeIndex& ) const;
+
+ inline sal_Bool operator< ( sal_uLong nWert ) const;
+ inline sal_Bool operator<=( sal_uLong nWert ) const;
+ inline sal_Bool operator> ( sal_uLong nWert ) const;
+ inline sal_Bool operator>=( sal_uLong nWert ) const;
+ inline sal_Bool operator==( sal_uLong nWert ) const;
+ inline sal_Bool operator!=( sal_uLong nWert ) const;
+
+ inline SwNodeIndex& operator=( sal_uLong );
+ SwNodeIndex& operator=( const SwNodeIndex& );
+ SwNodeIndex& operator=( const SwNode& );
+
+ // gebe den Wert vom Index als sal_uLong zurueck
+ inline sal_uLong GetIndex() const;
+
+ // ermoeglicht Zuweisungen ohne Erzeugen eines temporaeren Objektes
+ SwNodeIndex& Assign( SwNodes& rNds, sal_uLong );
+ SwNodeIndex& Assign( const SwNode& rNd, long nOffset = 0 );
+
+ // Herausgabe des Pointers auf das NodesArray,
+ inline const SwNodes& GetNodes() const;
+ inline SwNodes& GetNodes();
+
+ SwNode& GetNode() const { return *pNd; }
+};
+
+/*
+ * SwRange
+ */
+class SW_DLLPUBLIC SwNodeRange
+{
+public:
+ SwNodeIndex aStart;
+ SwNodeIndex aEnd;
+
+ SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE );
+ SwNodeRange( const SwNodeRange &rRange );
+
+ SwNodeRange( SwNodes& rArr, sal_uLong nSttIdx = 0, sal_uLong nEndIdx = 0 );
+ SwNodeRange( const SwNodeIndex& rS, long nSttDiff,
+ const SwNodeIndex& rE, long nEndDiff = 0 );
+ SwNodeRange( const SwNode& rS, long nSttDiff,
+ const SwNode& rE, long nEndDiff = 0 );
+};
+
+
+
+
+// fuer die inlines wird aber der node.hxx benoetigt. Dieses braucht aber
+// auch wieder dieses. Also alle Inlines, die auf pNd zugreifen werden
+// hier implementiert.
+
+inline sal_uLong SwNodeIndex::GetIndex() const
+{
+ return pNd->GetIndex();
+}
+inline const SwNodes& SwNodeIndex::GetNodes() const
+{
+ return pNd->GetNodes();
+}
+inline SwNodes& SwNodeIndex::GetNodes()
+{
+ return pNd->GetNodes();
+}
+inline sal_Bool SwNodeIndex::operator< ( sal_uLong nWert ) const
+{
+ return pNd->GetIndex() < nWert;
+}
+inline sal_Bool SwNodeIndex::operator<=( sal_uLong nWert ) const
+{
+ return pNd->GetIndex() <= nWert;
+}
+inline sal_Bool SwNodeIndex::operator> ( sal_uLong nWert ) const
+{
+ return pNd->GetIndex() > nWert;
+}
+inline sal_Bool SwNodeIndex::operator>=( sal_uLong nWert ) const
+{
+ return pNd->GetIndex() >= nWert;
+}
+inline sal_Bool SwNodeIndex::operator==( sal_uLong nWert ) const
+{
+ return pNd->GetIndex() == nWert;
+}
+inline sal_Bool SwNodeIndex::operator!=( sal_uLong nWert ) const
+{
+ return pNd->GetIndex() != nWert;
+}
+inline sal_Bool SwNodeIndex::operator<( const SwNodeIndex& rIndex ) const
+{
+ return pNd->GetIndex() < rIndex.GetIndex();
+}
+inline sal_Bool SwNodeIndex::operator<=( const SwNodeIndex& rIndex ) const
+{
+ return pNd->GetIndex() <= rIndex.GetIndex();
+}
+inline sal_Bool SwNodeIndex::operator>( const SwNodeIndex& rIndex ) const
+{
+ return pNd->GetIndex() > rIndex.GetIndex();
+}
+inline sal_Bool SwNodeIndex::operator>=( const SwNodeIndex& rIndex ) const
+{
+ return pNd->GetIndex() >= rIndex.GetIndex();
+}
+inline sal_Bool SwNodeIndex::operator==( const SwNodeIndex& rIdx ) const
+{
+ return pNd == rIdx.pNd;
+}
+inline sal_Bool SwNodeIndex::operator!=( const SwNodeIndex& rIdx ) const
+{
+ return pNd != rIdx.pNd;
+}
+
+inline sal_uLong SwNodeIndex::operator++()
+{
+ return ( pNd = GetNodes()[ pNd->GetIndex()+1 ] )->GetIndex();
+}
+inline sal_uLong SwNodeIndex::operator--()
+{
+ return ( pNd = GetNodes()[ pNd->GetIndex()-1 ] )->GetIndex();
+}
+#ifndef CFRONT
+inline sal_uLong SwNodeIndex::operator++(int)
+{
+ sal_uLong nOldIndex = pNd->GetIndex();
+ pNd = GetNodes()[ nOldIndex + 1 ];
+ return nOldIndex;
+}
+inline sal_uLong SwNodeIndex::operator--(int)
+{
+ sal_uLong nOldIndex = pNd->GetIndex();
+ pNd = GetNodes()[ nOldIndex - 1 ];
+ return nOldIndex;
+}
+#endif
+
+inline sal_uLong SwNodeIndex::operator+=( sal_uLong nWert )
+{
+ return ( pNd = GetNodes()[ pNd->GetIndex() + nWert ] )->GetIndex();
+}
+inline sal_uLong SwNodeIndex::operator-=( sal_uLong nWert )
+{
+ return ( pNd = GetNodes()[ pNd->GetIndex() - nWert ] )->GetIndex();
+}
+inline sal_uLong SwNodeIndex::operator+=( const SwNodeIndex& rIndex )
+{
+ return ( pNd = GetNodes()[ pNd->GetIndex() + rIndex.GetIndex() ] )->GetIndex();
+}
+inline sal_uLong SwNodeIndex::operator-=( const SwNodeIndex& rIndex )
+{
+ return ( pNd = GetNodes()[ pNd->GetIndex() - rIndex.GetIndex() ] )->GetIndex();
+}
+
+inline SwNodeIndex& SwNodeIndex::operator=( sal_uLong nWert )
+{
+ pNd = GetNodes()[ nWert ];
+ return *this;
+}
+
+#endif
diff --git a/sw/inc/ndnotxt.hxx b/sw/inc/ndnotxt.hxx
new file mode 100644
index 000000000000..5aab4f9a5708
--- /dev/null
+++ b/sw/inc/ndnotxt.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _NDNOTXT_HXX
+#define _NDNOTXT_HXX
+
+#include "node.hxx"
+
+class PolyPolygon;
+
+// --------------------
+// SwNoTxtNode
+// --------------------
+
+class SW_DLLPUBLIC SwNoTxtNode : public SwCntntNode
+{
+ friend class SwNodes;
+ friend class SwNoTxtFrm;
+
+// String aAlternateText; // alternativer Text (HTML)
+
+ PolyPolygon *pContour; // Polygon fuer Konturumlauf
+ sal_Bool bAutomaticContour : 1; // automatic contour polygon, not manipulated
+ sal_Bool bContourMapModeValid : 1; // contour map mode is not the graphics's
+ // prefered map mode, but either
+ // MM100 or or pixel
+ sal_Bool bPixelContour : 1; // contour map mode is invalid and pixel.
+
+ // erzeugt fuer alle Ableitungen einen AttrSet mit Bereichen
+ // fuer Frame- und Grafik-Attributen (wird nur vom SwCntntNode gerufen)
+ virtual void NewAttrSet( SwAttrPool& );
+
+ SwNoTxtNode( const SwNoTxtNode& ); //nicht erlaubt
+ SwNoTxtNode &operator=( const SwNoTxtNode& ); //nicht erlaubt
+
+protected:
+ SwNoTxtNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType,
+ SwGrfFmtColl *pGrColl, SwAttrSet* pAutoAttr = 0 );
+
+public:
+ ~SwNoTxtNode();
+
+ virtual SwCntntFrm *MakeFrm( SwFrm* );
+
+ inline SwGrfFmtColl *GetGrfColl() const { return (SwGrfFmtColl*)GetRegisteredIn(); }
+
+ virtual Size GetTwipSize() const = 0;
+
+ virtual sal_Bool SavePersistentData();
+ virtual sal_Bool RestorePersistentData();
+
+ const String GetTitle() const;
+ void SetTitle( const String& rTitle,
+ bool bBroadcast = false );
+ const String GetDescription() const;
+ void SetDescription( const String& rDescription,
+ bool bBroadcast = false );
+
+// const String GetAlternateText() const;
+// void SetAlternateText( const String& rTxt,
+// sal_Bool bBroadcast=sal_False );
+
+ void SetContour( const PolyPolygon *pPoly,
+ sal_Bool bAutomatic = sal_False );
+ const PolyPolygon *HasContour() const;
+ sal_Bool _HasContour() const { return pContour!=0; };
+ void GetContour( PolyPolygon &rPoly ) const;
+ void CreateContour();
+
+ void SetAutomaticContour( sal_Bool bSet ) { bAutomaticContour = bSet; }
+ sal_Bool HasAutomaticContour() const { return bAutomaticContour; }
+
+ // set either a MM100 or pixel contour
+ void SetContourAPI( const PolyPolygon *pPoly );
+
+ // get either a MM100 or pixel contour, return sal_False if no contour is set.
+ sal_Bool GetContourAPI( PolyPolygon &rPoly ) const;
+
+ void SetPixelContour( sal_Bool bSet ) { bPixelContour = bSet; }
+ sal_Bool IsPixelContour() const;
+
+ sal_Bool IsContourMapModeValid() const { return bContourMapModeValid; }
+
+ //Besorgt die Graphic, mit SwapIn fuer GrfNode, per GetData fuer OLE.
+ Graphic GetGraphic() const;
+};
+
+// Inline Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
+inline SwNoTxtNode *SwNode::GetNoTxtNode()
+{
+ return ND_NOTXTNODE & nNodeType ? (SwNoTxtNode*)this : 0;
+}
+inline const SwNoTxtNode *SwNode::GetNoTxtNode() const
+{
+ return ND_NOTXTNODE & nNodeType ? (const SwNoTxtNode*)this : 0;
+}
+
+#endif // _NDNOTXT_HXX
diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx
new file mode 100644
index 000000000000..0199d2e399bb
--- /dev/null
+++ b/sw/inc/ndole.hxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _NDOLE_HXX
+#define _NDOLE_HXX
+
+#include <ndnotxt.hxx>
+
+#include <svtools/embedhlp.hxx>
+
+class SwGrfFmtColl;
+class SwDoc;
+class SwOLENode;
+
+class SwOLEListener_Impl;
+class SwEmbedObjectLink;
+class SW_DLLPUBLIC SwOLEObj
+{
+ friend class SwOLENode;
+
+ const SwOLENode* pOLENd;
+ SwOLEListener_Impl* pListener;
+
+ //Entweder Ref oder Name sind bekannt, wenn nur der Name bekannt ist, wird
+ //dir Ref bei Anforderung durch GetOleRef() vom Sfx besorgt.
+ svt::EmbeddedObjectRef xOLERef;
+ String aName;
+
+ SwOLEObj( const SwOLEObj& rObj ); //nicht erlaubt.
+ SwOLEObj();
+
+ void SetNode( SwOLENode* pNode );
+
+public:
+ SwOLEObj( const svt::EmbeddedObjectRef& pObj );
+ SwOLEObj( const String &rName, sal_Int64 nAspect );
+ ~SwOLEObj();
+
+ sal_Bool UnloadObject();
+ static sal_Bool UnloadObject( ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > xObj,
+ const SwDoc* pDoc,
+ sal_Int64 nAspect );
+
+ String GetDescription();
+
+#ifndef _FESHVIEW_ONLY_INLINE_NEEDED
+ const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef();
+ svt::EmbeddedObjectRef& GetObject();
+ const String& GetCurrentPersistName() const { return aName; }
+ sal_Bool IsOleRef() const; //Damit das Objekt nicht unnoetig geladen werden muss.
+#endif
+};
+
+
+// --------------------
+// SwOLENode
+// --------------------
+
+class SW_DLLPUBLIC SwOLENode: public SwNoTxtNode
+{
+ friend class SwNodes;
+ mutable SwOLEObj aOLEObj;
+ Graphic* pGraphic;
+ String sChartTblName; // bei Chart Objecten: Name der ref. Tabelle
+ sal_Bool bOLESizeInvalid; //Soll beim SwDoc::PrtOLENotify beruecksichtig
+ //werden (zum Beispiel kopiert). Ist nicht
+ //Persistent.
+
+ SwEmbedObjectLink* mpObjectLink;
+ String maLinkURL;
+
+ SwOLENode( const SwNodeIndex &rWhere,
+ const svt::EmbeddedObjectRef&,
+ SwGrfFmtColl *pGrfColl,
+ SwAttrSet* pAutoAttr = 0 );
+
+ SwOLENode( const SwNodeIndex &rWhere,
+ const String &rName,
+ sal_Int64 nAspect,
+ SwGrfFmtColl *pGrfColl,
+ SwAttrSet* pAutoAttr = 0 );
+
+ // aOLEObj besitzt einen privaten Copy-CTOR, wir brauchen auch einen:
+ SwOLENode( const SwOLENode & );
+
+ using SwNoTxtNode::GetGraphic;
+
+public:
+ const SwOLEObj& GetOLEObj() const { return aOLEObj; }
+ SwOLEObj& GetOLEObj() { return aOLEObj; }
+ ~SwOLENode();
+
+ virtual SwCntntNode *SplitCntntNode( const SwPosition & );
+ // steht in ndcopy.cxx
+ virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
+
+ virtual Size GetTwipSize() const;
+
+ Graphic* GetGraphic();
+
+ Graphic* GetHCGraphic(); // tries to retrieve HighContrast representation if possible
+ void GetNewReplacement();
+
+ virtual sal_Bool SavePersistentData();
+ virtual sal_Bool RestorePersistentData();
+
+ sal_Bool IsInGlobalDocSection() const;
+ sal_Bool IsOLEObjectDeleted() const;
+
+ sal_Bool IsOLESizeInvalid() const { return bOLESizeInvalid; }
+ void SetOLESizeInvalid( sal_Bool b ){ bOLESizeInvalid = b; }
+
+ sal_Int64 GetAspect() const { return aOLEObj.GetObject().GetViewAspect(); }
+ void SetAspect( sal_Int64 nAspect) { aOLEObj.GetObject().SetViewAspect( nAspect ); }
+
+ // OLE-Object aus dem "Speicher" entfernen
+ // inline void Unload() { aOLEObj.Unload(); }
+ String GetDescription() const { return aOLEObj.GetDescription(); }
+
+ sal_Bool UpdateLinkURL_Impl();
+ void BreakFileLink_Impl();
+ void DisconnectFileLink_Impl();
+
+ void CheckFileLink_Impl();
+
+ // --> OD 2009-03-05 #i99665#
+ bool IsChart() const;
+ // <--
+
+#ifndef _FESHVIEW_ONLY_INLINE_NEEDED
+ const String& GetChartTblName() const { return sChartTblName; }
+ void SetChartTblName( const String& rNm ) { sChartTblName = rNm; }
+#endif
+};
+
+
+// Inline Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
+inline SwOLENode *SwNode::GetOLENode()
+{
+ return ND_OLENODE == nNodeType ? (SwOLENode*)this : 0;
+}
+inline const SwOLENode *SwNode::GetOLENode() const
+{
+ return ND_OLENODE == nNodeType ? (const SwOLENode*)this : 0;
+}
+
+#endif // _NDOLE_HXX
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
new file mode 100644
index 000000000000..26dbd29870b4
--- /dev/null
+++ b/sw/inc/ndtxt.hxx
@@ -0,0 +1,914 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_NDTXT_HXX
+#define SW_NDTXT_HXX
+
+#include <cppuhelper/weakref.hxx>
+
+#include "swdllapi.h"
+#include <error.h>
+#include <node.hxx>
+#include <hintids.hxx>
+#include <ndhints.hxx>
+#include <errhdl.hxx>
+#include <modeltoviewhelper.hxx>
+#include <SwNumberTreeTypes.hxx>
+#include <IDocumentContentOperations.hxx>
+
+#include <sfx2/Metadatable.hxx>
+
+#include <vector>
+#include <set>
+
+class SfxHint;
+class SwNumRule;
+class SwNodeNum;
+class SwList;
+class SvxLRSpaceItem;
+
+namespace utl {
+ class TransliterationWrapper;
+}
+
+class SwTxtFmtColl;
+class SwCntntFrm;
+class SwTxtFld; // Fuer GetTxtFld()
+class SfxItemSet;
+class SwUndoTransliterate;
+
+
+struct SwSpellArgs; // for Spell(), splargs.hxx
+struct SwConversionArgs; // for Convert(), splargs.hxx
+class SwInterHyphInfo; // for Hyphenate(), splargs.hxx
+class SwWrongList; // fuer OnlineSpelling
+class SwGrammarMarkUp;
+class OutputDevice;
+class SwScriptInfo;
+struct SwDocStat;
+struct SwParaIdleData_Impl;
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ template < class > class Sequence;
+ }
+ namespace text { class XTextContent; }
+} } }
+
+typedef std::set< xub_StrLen > SwSoftPageBreakList;
+
+// --------------------
+// SwTxtNode
+// --------------------
+class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
+{
+
+ // fuer das Erzeugen des ersten TextNode
+ friend class SwDoc; // CTOR und AppendTxtNode()
+ friend class SwNodes;
+ friend class SwTxtFrm;
+ friend class SwScriptInfo;
+
+ //Kann 0 sein, nur dann nicht 0 wenn harte Attribute drin stehen.
+ //Also niemals direkt zugreifen!
+ SwpHints *m_pSwpHints;
+
+ // --> OD 2005-11-02 #i51089 - TUNING#
+ mutable SwNodeNum* mpNodeNum; // Numerierung fuer diesen Absatz
+ // <--
+ XubString m_Text;
+
+ SwParaIdleData_Impl* m_pParaIdleData_Impl;
+
+ // Some of the chars this para are hidden. Paragraph has to be reformatted
+ // on changing the view to print preview.
+ mutable bool m_bContainsHiddenChars : 1;
+ // The whole paragraph is hidden because of the hidden text attribute
+ mutable bool m_bHiddenCharsHidePara : 1;
+ // The last two flags have to be recalculated if this flag is set:
+ mutable bool m_bRecalcHiddenCharFlags : 1;
+
+ mutable bool m_bLastOutlineState : 1;
+ bool m_bNotifiable;
+
+ // sal_uInt8 nOutlineLevel; //#outline level, removed by zhaojianwei.
+ // --> OD 2008-11-19 #i70748#
+ bool mbEmptyListStyleSetDueToSetOutlineLevelAttr;
+ // <--
+
+ // --> OD 2008-03-27 #refactorlists#
+ // boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or
+ // <ResetAllAttr(..)> method is running.
+ // Needed to avoid duplicate handling of attribute change actions.
+ bool mbInSetOrResetAttr;
+ // <--
+ // --> OD 2008-05-06 #refactorlists#
+ // pointer to the list, to whose the text node is added to
+ SwList* mpList;
+ // <--
+ /// #i111677# cached expansion (for clipboard)
+ ::std::auto_ptr< ::rtl::OUString > m_pNumStringCache;
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::text::XTextContent> m_wXParagraph;
+
+ SW_DLLPRIVATE SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl,
+ const SfxItemSet* pAutoAttr = 0 );
+
+ // Kopiert die Attribute an nStart nach pDest.
+ SW_DLLPRIVATE void CopyAttr( SwTxtNode *pDest, const xub_StrLen nStart, const xub_StrLen nOldPos);
+
+ SW_DLLPRIVATE SwTxtNode* _MakeNewTxtNode( const SwNodeIndex&, sal_Bool bNext = sal_True,
+ sal_Bool bChgFollow = sal_True );
+
+ SW_DLLPRIVATE void CutImpl(
+ SwTxtNode * const pDest, const SwIndex & rDestStart,
+ const SwIndex & rStart, /*const*/ xub_StrLen nLen,
+ const bool bUpdate = true );
+
+ // Verlagere alles umfassende harte Attribute in den AttrSet des Absatzes
+ SW_DLLPRIVATE void MoveTxtAttr_To_AttrSet(); // wird von SplitNode gerufen.
+
+ // lege den spz. AttrSet an
+ SW_DLLPRIVATE virtual void NewAttrSet( SwAttrPool& );
+
+ SW_DLLPRIVATE void Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt,
+ xub_StrLen nEndPos, sal_Bool bExpandFlds ) const;
+
+ // Optimization: Asking for information about hidden characters at SwScriptInfo
+ // updates these flags.
+ inline bool IsCalcHiddenCharFlags() const
+ { return m_bRecalcHiddenCharFlags; }
+ inline void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara, bool bNewContainsHiddenChars ) const
+ {
+ m_bHiddenCharsHidePara = bNewHiddenCharsHidePara;
+ m_bContainsHiddenChars = bNewContainsHiddenChars;
+ m_bRecalcHiddenCharFlags = false;
+ }
+
+ SW_DLLPRIVATE void CalcHiddenCharFlags() const;
+
+ SW_DLLPRIVATE SwNumRule * _GetNumRule(sal_Bool bInParent = sal_True) const;
+
+ SW_DLLPRIVATE void SetLanguageAndFont( const SwPaM &rPaM,
+ LanguageType nLang, sal_uInt16 nLangWhichId,
+ const Font *pFont, sal_uInt16 nFontWhichId );
+
+ //
+ // Start: Data collected during idle time
+ //
+ SW_DLLPRIVATE void SetParaNumberOfWords( sal_uLong nTmpWords ) const;
+ SW_DLLPRIVATE sal_uLong GetParaNumberOfWords() const;
+ SW_DLLPRIVATE void SetParaNumberOfChars( sal_uLong nTmpChars ) const;
+ SW_DLLPRIVATE sal_uLong GetParaNumberOfChars() const;
+ SW_DLLPRIVATE void InitSwParaStatistics( bool bNew );
+
+ /** create number for this text node, if not already existing
+
+ OD 2005-11-02 #i51089 - TUNING#
+ OD 2007-10-26 #i83479# - made private
+
+ @return number of this node
+ */
+ SwNodeNum* CreateNum() const;
+
+ inline void TryDeleteSwpHints();
+
+ SW_DLLPRIVATE void impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet);
+
+public:
+ bool IsWordCountDirty() const;
+ bool IsWrongDirty() const;
+ bool IsGrammarCheckDirty() const;
+ bool IsSmartTagDirty() const; // SMARTTAGS
+ bool IsAutoCompleteWordDirty() const;
+ void SetWordCountDirty( bool bNew ) const;
+ void SetWrongDirty( bool bNew ) const;
+ void SetGrammarCheckDirty( bool bNew ) const;
+ void SetSmartTagDirty( bool bNew ) const; // SMARTTAGS
+ void SetAutoCompleteWordDirty( bool bNew ) const;
+ void SetWrong( SwWrongList* pNew, bool bDelete = true );
+ SwWrongList* GetWrong();
+ // --> OD 2008-05-23 #i71360#
+ const SwWrongList* GetWrong() const;
+ // <--
+ void SetGrammarCheck( SwGrammarMarkUp* pNew, bool bDelete = true );
+ SwGrammarMarkUp* GetGrammarCheck();
+ // SMARTTAGS
+ void SetSmartTags( SwWrongList* pNew, bool bDelete = true );
+ SwWrongList* GetSmartTags();
+
+ //
+ // End: Data collected during idle time
+ //
+protected:
+ // fuers Umhaengen der TxtFmtCollections (Outline-Nummerierung!!)
+ virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
+ virtual void SwClientNotify( const SwModify&, const SfxHint& );
+
+public:
+ using SwCntntNode::GetAttr;
+
+ const String& GetTxt() const { return m_Text; }
+
+ // getters for SwpHints
+ inline SwpHints &GetSwpHints();
+ inline const SwpHints &GetSwpHints() const;
+ inline SwpHints *GetpSwpHints() { return m_pSwpHints; }
+ inline const SwpHints *GetpSwpHints() const { return m_pSwpHints; }
+ inline bool HasHints() const { return m_pSwpHints ? true : false; }
+ inline SwpHints &GetOrCreateSwpHints();
+
+ virtual ~SwTxtNode();
+
+ virtual xub_StrLen Len() const;
+
+ // steht in itratr
+ void GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax, sal_uLong &rAbs,
+ OutputDevice* pOut = 0 ) const;
+
+ // --> OD 2008-03-13 #refactorlists#
+ // overriding to handle change of certain paragraph attributes
+ virtual sal_Bool SetAttr( const SfxPoolItem& );
+ virtual sal_Bool SetAttr( const SfxItemSet& rSet );
+ virtual sal_Bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
+ virtual sal_Bool ResetAttr( const SvUShorts& rWhichArr );
+ virtual sal_uInt16 ResetAllAttr();
+ // <--
+
+ /// insert text content
+ void InsertText( const XubString & rStr, const SwIndex & rIdx,
+ const enum IDocumentContentOperations::InsertFlags nMode
+ = IDocumentContentOperations::INS_DEFAULT );
+
+ /** delete text content
+ ATTENTION: must not be called with a range that overlaps the start of
+ an attribute with both extent and dummy char
+ */
+ void EraseText ( const SwIndex &rIdx, const xub_StrLen nCount = STRING_LEN,
+ const enum IDocumentContentOperations::InsertFlags nMode
+ = IDocumentContentOperations::INS_DEFAULT );
+
+ /** delete all attributes.
+ If neither pSet nor nWhich is given, delete all attributes (except
+ refmarks, toxmarks, meta) in range.
+ @param rIdx start position
+ @param nLen range in which attributes will be deleted
+ @param pSet if not 0, delete only attributes contained in pSet
+ @param nWhich if not 0, delete only attributes with matching which
+ @param bInclRefToxMark
+ refmarks, toxmarks, and metas will be ignored unless this is true
+ ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
+ */
+ void RstAttr( const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich = 0,
+ const SfxItemSet* pSet = 0, sal_Bool bInclRefToxMark = sal_False );
+ void GCAttr();
+
+ // loesche das Text-Attribut (muss beim Pool abgemeldet werden!)
+ void DestroyAttr( SwTxtAttr* pAttr );
+
+ // loesche alle Attribute aus dem SwpHintsArray.
+ void ClearSwpHintsArr( bool bDelFields );
+
+ /// Insert pAttr into hints array. @return true iff inserted successfully
+ bool InsertHint( SwTxtAttr * const pAttr,
+ const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
+ /// create new text attribute from rAttr and insert it
+ /// @return inserted hint; 0 if not sure the hint is inserted
+ SwTxtAttr* InsertItem( SfxPoolItem& rAttr,
+ const xub_StrLen nStart, const xub_StrLen nEnd,
+ const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
+
+ // setze diese Attribute am TextNode. Wird der gesamte Bereich umspannt,
+ // dann setze sie nur im AutoAttrSet (SwCntntNode:: SetAttr)
+ sal_Bool SetAttr( const SfxItemSet& rSet,
+ xub_StrLen nStt, xub_StrLen nEnd,
+ const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
+ // erfrage die Attribute vom TextNode ueber den Bereich
+ // --> OD 2008-01-16 #newlistlevelattrs#
+ // Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>.
+ // If <bMergeIndentValuesOfNumRule> == sal_True, the indent attributes of
+ // the corresponding list level of an applied list style is merged into
+ // the requested item set as a LR-SPACE item, if <bOnlyTxtAttr> == sal_False,
+ // corresponding node has not its own indent attributes and the
+ // position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT.
+ sal_Bool GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
+ sal_Bool bOnlyTxtAttr = sal_False,
+ sal_Bool bGetFromChrFmt = sal_True,
+ const bool bMergeIndentValuesOfNumRule = false ) const;
+ // <--
+
+ // uebertrage Attribute eines AttrSets ( AutoFmt ) in das SwpHintsArray
+ void FmtToTxtAttr( SwTxtNode* pNd );
+
+ /// delete all attributes of type nWhich at nStart (opt. end nEnd)
+ void DeleteAttributes( const sal_uInt16 nWhich,
+ const xub_StrLen nStart, const xub_StrLen nEnd = 0 );
+ /// delete the attribute pTxtAttr
+ void DeleteAttribute ( SwTxtAttr * const pTxtAttr );
+
+ // Aktionen auf Text und Attributen
+ // --> OD 2008-11-18 #i96213#
+ // introduce optional parameter to control, if all attributes have to be copied.
+ void CopyText( SwTxtNode * const pDest,
+ const SwIndex &rStart,
+ const xub_StrLen nLen,
+ const bool bForceCopyOfAllAttrs = false );
+ void CopyText( SwTxtNode * const pDest,
+ const SwIndex &rDestStart,
+ const SwIndex &rStart,
+ xub_StrLen nLen,
+ const bool bForceCopyOfAllAttrs = false );
+ // <--
+
+ void CutText(SwTxtNode * const pDest,
+ const SwIndex & rStart, const xub_StrLen nLen);
+ inline void CutText(SwTxtNode * const pDest, const SwIndex &rDestStart,
+ const SwIndex & rStart, const xub_StrLen nLen);
+
+ /// replace nDelLen characters at rStart with rText
+ void ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen,
+ const XubString& rText );
+ void ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, const XubString& rText,
+ const ::com::sun::star::uno::Sequence<sal_Int32>& rOffsets );
+
+ // virtuelle Methoden aus dem CntntNode
+ virtual SwCntntFrm *MakeFrm( SwFrm* );
+ virtual SwCntntNode *SplitCntntNode( const SwPosition & );
+ virtual SwCntntNode *JoinNext();
+ virtual SwCntntNode *JoinPrev();
+
+ SwCntntNode *AppendNode( const SwPosition & );
+
+ // setze ggf. das DontExpand-Flag an INet bzw. Zeichenvorlagen
+ sal_Bool DontExpandFmt( const SwIndex& rIdx, bool bFlag = true,
+ sal_Bool bFmtToTxtAttributes = sal_True );
+
+ enum GetTxtAttrMode {
+ DEFAULT, /// DEFAULT: (Start < nIndex <= End)
+ EXPAND, /// EXPAND : (Start <= nIndex < End)
+ PARENT, /// PARENT : (Start < nIndex < End)
+ };
+
+ /** get the innermost text attribute covering position nIndex.
+ @param nWhich only attribute with this id is returned.
+ @param eMode the predicate for matching (@see GetTxtAttrMode).
+
+ ATTENTION: this function is not well-defined for those
+ hints of which several may cover a single position, like
+ RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
+ */
+ SwTxtAttr *GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
+ enum GetTxtAttrMode const eMode = DEFAULT) const;
+
+ /** get the innermost text attributes covering position nIndex.
+ @param nWhich only attributes with this id are returned.
+ @param eMode the predicate for matching (@see GetTxtAttrMode).
+ */
+ ::std::vector<SwTxtAttr *> GetTxtAttrsAt(xub_StrLen const nIndex,
+ RES_TXTATR const nWhich,
+ enum GetTxtAttrMode const eMode = DEFAULT) const;
+
+ /** get the text attribute at position nIndex which owns
+ the dummy character CH_TXTATR_* at that position, if one exists.
+ @param nIndex the position in the text
+ @param nWhich if different from RES_TXTATR_END, return only
+ attribute with given which id
+ @return the text attribute at nIndex of type nWhich, if it exists
+ */
+ SwTxtAttr *GetTxtAttrForCharAt( const xub_StrLen nIndex,
+ const RES_TXTATR nWhich = RES_TXTATR_END ) const;
+
+ // Aktuelles Wort zurueckliefern
+ XubString GetCurWord(xub_StrLen) const;
+ sal_uInt16 Spell(SwSpellArgs*);
+ sal_uInt16 Convert( SwConversionArgs & );
+
+ inline SwTxtFmtColl *GetTxtColl() const;
+ virtual SwFmtColl *ChgFmtColl( SwFmtColl* );
+ void _ChgTxtCollUpdateNum( const SwTxtFmtColl* pOld,
+ const SwTxtFmtColl* pNew );
+
+ // kopiere die Collection mit allen Autoformaten zum Dest-Node
+ // dieser kann auch in einem anderen Dokument stehen!
+ // (Methode steht im ndcopy.cxx!!)
+ void CopyCollFmt( SwTxtNode& rDestNd );
+
+ //const SwNodeNum* _GetNodeNum() const { return pNdNum; }
+
+ //
+ // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
+ //
+
+ /**
+ Returns numbering rule of this text node.
+
+ @param bInParent serach in parent attributes, too
+
+ @return numbering rule of this text node or NULL if none is set
+ */
+ SwNumRule *GetNumRule(sal_Bool bInParent = sal_True) const;
+
+ inline const SwNodeNum* GetNum() const
+ {
+ return mpNodeNum;
+ }
+
+ SwNumberTree::tNumberVector GetNumberVector() const;
+
+ /**
+ Returns if this text node is an outline.
+
+ @retval true this text node is an outline
+ @retval false else
+ */
+ bool IsOutline() const;
+
+ bool IsOutlineStateChanged() const;
+
+ void UpdateOutlineState();
+
+ /** -> #i23730#
+
+ Returns if this text node may be numbered.
+
+ A text node may be numbered if
+ - it has no SwNodeNum
+ - it has a SwNodeNum and it has a numbering rule and the according
+ SwNumFmt defines a numbering type that is an enumeration.
+
+ @retval sal_True this text node may be numbered
+ @retval sal_False else
+ */
+ //sal_Bool MayBeNumbered() const;
+
+ /**
+ Notify this textnode that its numbering rule has changed.
+ */
+ void NumRuleChgd();
+
+ /** Returns outline of numbering string
+
+ OD 2005-11-17 #128041#
+ Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control,
+ if the prefix and the suffix strings have to been included or not.
+
+ @param _bInclPrefixAndSuffixStrings
+ optional input parameter - boolean indicating, if the prefix and the
+ suffix strings have to been included or not. default value = <true>
+
+ @param _nRestrictToThisLevel
+ optional input parameter - unsigned integer indicating the maximum outline
+ level to which the output string must be restricted to. Default value is
+ MAXLEVEL
+ */
+ XubString GetNumString( const bool _bInclPrefixAndSuffixStrings = true, const unsigned int _nRestrictToThisLevel = MAXLEVEL ) const;
+
+ /**
+ Returns the additional indents of this text node and its numbering.
+
+ @param bTxtLeft ???
+
+ @return additional indents
+ */
+ long GetLeftMarginWithNum( sal_Bool bTxtLeft = sal_False ) const;
+
+ /**
+ Returns the combined first line indent of this text node and
+ its numbering.
+
+ @param the first line indent of this text node taking the
+ numbering into account (return parameter)
+
+ @retval sal_True this node has SwNodeNum and has numbering rule
+ @retval sal_False else
+ */
+ sal_Bool GetFirstLineOfsWithNum( short& rFirstOffset ) const;
+
+ // --> OD 2010-01-05 #b6884103#
+ SwTwips GetAdditionalIndentForStartingNewList() const;
+ // <--
+
+ // --> OD 2008-12-02 #i96772#
+ void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const;
+ // <--
+
+ /** return left margin for tab stop position calculation
+
+ OD 2008-06-30 #i91133#
+ Needed for text formatting
+ Method considers new list level attributes, which also can provide a left margin value
+
+ @author OD
+ */
+ long GetLeftMarginForTabCalculation() const;
+
+ /** -> #i29560
+ Returns if this text node has a number.
+
+ This text node has a number if it has a SwNodeNum and a
+ numbering rule and the numbering format specified for the
+ level of the SwNodeNum is of an enumeration type.
+
+ @retval sal_True This text node has a number.
+ @retval sal_False else
+ */
+ sal_Bool HasNumber() const;
+
+ /** -> #i29560
+ Returns if this text node has a bullet.
+
+ This text node has a bullet if it has a SwNodeNum and a
+ numbering rule and the numbering format specified for the
+ level of the SwNodeNum is of a bullet type.
+
+ @retval sal_True This text node has a bullet.
+ @retval sal_False else
+ */
+ sal_Bool HasBullet() const;
+
+ /** -> #i27615#
+ Returns is this text node is numbered.
+
+ This node is numbered if it has a SwNodeNum and it has a
+ numbering rule and has not a hidden SwNodeNum.
+
+ ATTENTION: Returns sal_True even if the SwNumFmt has type
+ SVX_NUM_NUMBER_NONE.
+
+ @retval sal_True This node is numbered.
+ @retval sal_False else
+ */
+ sal_Bool IsNumbered() const;
+
+ /** -> #i27615#
+ Returns if this text node has a marked label.
+
+ @retval true This text node has a marked label.
+ @retval false else
+ */
+ bool HasMarkedLabel() const;
+
+ /** Sets the list level of this text node.
+
+ Side effect, when the text node is a list item:
+ The text node's representation in the list tree (<SwNodeNum> instance)
+ is updated.
+
+ @param nLevel level to set
+ */
+ void SetAttrListLevel(int nLevel);
+
+ bool HasAttrListLevel() const;
+
+ int GetAttrListLevel() const;
+
+ /** Returns the actual list level of this text node, when it is a list item
+
+ @return the actual list level of this text node, if it is a list item,
+ -1 otherwise
+ */
+ int GetActualListLevel() const;
+
+ /**
+ Returns outline level of this text node.
+
+ If a text node has an outline number (i.e. it has an SwNodeNum
+ and a outline numbering rule) the outline level is the level of
+ this SwNodeNum.
+
+ If a text node has no outline number and has a paragraph style
+ attached the outline level is the outline level of the
+ paragraph style.
+
+ Otherwise the text node has no outline level (NO_NUMBERING).
+
+ NOTE: The outline level of text nodes is subject to change. The
+ plan is to have an SwTxtNode::nOutlineLevel member that is
+ updated from a paragraph style upon appliance of that paragraph
+ style.
+
+ @return outline level or NO_NUMBERING if there is no outline level
+ */
+ int GetAttrOutlineLevel() const;//#OutlineLevel,added by zhaojianwei
+
+ /**
+ Sets the out line level *at* a text node.
+
+ @param nLevel the level to be set
+
+ If the text node has an outline number the level is set at the
+ outline number.
+
+ If the text node has no outline number but has a paragraph
+ style applied the outline level is set at the paragraph style.
+
+ NOTE: This is subject to change, see GetOutlineLevel.
+ */
+ //void SetOutlineLevel(int nLevel);
+ void SetAttrOutlineLevel(int nLevel);//#OutlineLevel,added by zhaojianwei
+
+ // --> OD 2008-11-19 #i70748#
+ bool IsEmptyListStyleDueToSetOutlineLevelAttr();
+ void SetEmptyListStyleDueToSetOutlineLevelAttr();
+ void ResetEmptyListStyleDueToResetOutlineLevelAttr();
+ // <--
+
+ /**
+ Returns the width of leading tabs/blanks in this paragraph.
+ This space will be converted into numbering indent if the paragraph
+ is set to be numbered.
+
+ @return the width of the leading whitespace
+ */
+ sal_uInt16 GetWidthOfLeadingTabs() const;
+
+
+ /**
+ Returns if the paragraph has a visible numbering or bullet.
+ This includes all kinds of numbering/bullet/outlines.
+ Note: This function returns false, if the numbering format is
+ SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted.
+
+ @return sal_True if the paragraph has a visible numbering/bullet/outline
+ */
+ bool HasVisibleNumberingOrBullet() const;
+
+ // --> OD 2008-02-19 #refactorlists#
+ void SetListId( const String sListId );
+ String GetListId() const;
+ // <--
+
+ /** Determines, if the list level indent attributes can be applied to the
+ paragraph.
+
+ OD 2008-01-17 #newlistlevelattrs#
+ The list level indents can be applied to the paragraph under the one
+ of following conditions:
+ - the list style is directly applied to the paragraph and the paragraph
+ has no own indent attributes.
+ - the list style is applied to the paragraph through one of its paragraph
+ styles, the paragraph has no own indent attributes and on the paragraph
+ style hierarchy from the paragraph to the paragraph style with the
+ list style no indent attributes are found.
+
+ @author OD
+
+ @return boolean
+ */
+ bool AreListLevelIndentsApplicable() const;
+
+ /** Retrieves the list tab stop position, if the paragraph's list level defines
+ one and this list tab stop has to merged into the tap stops of the paragraph
+
+ OD 2008-01-17 #newlistlevelattrs#
+
+ @author OD
+
+ @param nListTabStopPosition
+ output parameter - containing the list tab stop position
+
+ @return boolean - indicating, if a list tab stop position is provided
+ */
+ bool GetListTabStopPosition( long& nListTabStopPosition ) const;
+
+ /** Retrieves the character following the list label, if the paragraph's
+ list level defines one.
+
+ OD 2008-01-17 #newlistlevelattrs#
+
+ @author OD
+
+ @return XubString - the list tab stop position
+ */
+ XubString GetLabelFollowedBy() const;
+
+ //
+ // END OF BULLET/NUMBERING/OUTLINE STUFF:
+ //
+
+ void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const;
+
+ sal_uInt16 GetLang( const xub_StrLen nBegin, const xub_StrLen nLen = 0,
+ sal_uInt16 nScript = 0 ) const;
+
+ // steht in ndcopy.cxx
+ sal_Bool IsSymbol( const xub_StrLen nBegin ) const; // steht in itratr.cxx
+ virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
+
+ // interaktive Trennung: wir finden den TxtFrm und rufen sein CalcHyph
+ sal_Bool Hyphenate( SwInterHyphInfo &rHyphInf );
+ void DelSoftHyph( const xub_StrLen nStart, const xub_StrLen nEnd );
+
+ // --> OD 2007-11-15 #i83479#
+ // add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating,
+ // when <bWithNum = true> that a space is inserted after the string for
+ // the list label.
+ // add 5th optional parameter <bWithSpacesForLevel> indicating, if additional
+ // spaces are inserted in front of the expanded text string depending on
+ // the list level.
+ XubString GetExpandTxt( const xub_StrLen nIdx = 0,
+ const xub_StrLen nLen = STRING_LEN,
+ const bool bWithNum = false,
+ const bool bAddSpaceAfterListLabelStr = false,
+ const bool bWithSpacesForLevel = false ) const;
+ // <--
+ sal_Bool GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx = 0,
+ xub_StrLen nIdx = 0, xub_StrLen nLen = STRING_LEN,
+ sal_Bool bWithNum = sal_False, sal_Bool bWithFtn = sal_True,
+ sal_Bool bReplaceTabsWithSpaces = sal_False ) const;
+
+ /*
+ *
+ */
+ const ModelToViewHelper::ConversionMap*
+ BuildConversionMap( rtl::OUString& rExpandText ) const;
+
+ XubString GetRedlineTxt( xub_StrLen nIdx = 0,
+ xub_StrLen nLen = STRING_LEN,
+ sal_Bool bExpandFlds = sal_False,
+ sal_Bool bWithNum = sal_False ) const;
+ //Liefert fuer die Initalfunktion tatsaechliche Anzahl der Initialzeichen
+ //bei nWishLen == 0 die des ersten Wortes
+ sal_uInt16 GetDropLen( sal_uInt16 nWishLen) const;
+
+ // Passes back info needed on the dropcap dimensions
+ bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const;
+
+ // Hidden Paragraph Field:
+ inline bool CalcHiddenParaField()
+ { return m_pSwpHints ? m_pSwpHints->CalcHiddenParaField() : false; }
+ // set CalcVisible flags
+ inline void SetCalcHiddenParaField()
+ { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); }
+
+ // is the paragraph visible?
+ inline bool HasHiddenParaField() const
+ { return m_pSwpHints ? m_pSwpHints->HasHiddenParaField() : false; }
+
+ //
+ // Hidden Paragraph Field:
+ //
+ inline bool HasHiddenCharAttribute( bool bWholePara ) const
+ {
+ if ( m_bRecalcHiddenCharFlags )
+ CalcHiddenCharFlags();
+ return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars;
+ }
+
+ inline void SetCalcHiddenCharFlags() const
+ { m_bRecalcHiddenCharFlags = true; }
+
+// --> FME 2004-06-08 #i12836# enhanced pdf
+ //
+ // Returns if the node is hidden due to
+ // 1. HiddenParaField
+ // 2. HiddenCharAttribute
+ // 3. HiddenSection
+ //
+ bool IsHidden() const;
+// <--
+
+ TYPEINFO(); // fuer rtti
+
+ // override SwIndexReg
+ virtual void Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
+ const bool bNegative = false, const bool bDelete = false );
+
+ // change text to Upper/Lower/Hiragana/Katagana/...
+ void TransliterateText( utl::TransliterationWrapper& rTrans,
+ xub_StrLen nStart, xub_StrLen nEnd,
+ SwUndoTransliterate* pUndo = 0 );
+
+ // count words in given range
+ void CountWords( SwDocStat& rStat, xub_StrLen nStart, xub_StrLen nEnd ) const;
+
+ // Checks some global conditions like loading or destruction of document
+ // to economize notifications
+ bool IsNotificationEnabled() const;
+
+ // Checks a temporary notification blocker and the global conditons of IsNotificationEnabled()
+ bool IsNotifiable() const;
+
+ void SetListRestart( bool bRestart );
+ // --> OD 2005-11-02 #i51089 - TUNING#
+ bool IsListRestart() const;
+ // <--
+
+ void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum );
+ bool HasAttrListRestartValue() const;
+ SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const;
+ SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const;
+
+ void SetCountedInList( bool bCounted );
+ bool IsCountedInList() const;
+
+ // --> OD 2008-03-13 #refactorlists#
+// void SyncNumberAndNumRule();
+// void UnregisterNumber();
+ void AddToList();
+ void RemoveFromList();
+ bool IsInList() const;
+ // <--
+
+ bool IsFirstOfNumRule() const;
+
+ sal_uInt16 GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) const;
+
+ SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::text::XTextContent> const& GetXParagraph() const
+ { return m_wXParagraph; }
+ SW_DLLPRIVATE void SetXParagraph(::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent> const& xParagraph)
+ { m_wXParagraph = xParagraph; }
+
+ // sfx2::Metadatable
+ virtual ::sfx2::IXmlIdRegistry& GetRegistry();
+ virtual bool IsInClipboard() const;
+ virtual bool IsInUndo() const;
+ virtual bool IsInContent() const;
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > MakeUnoObject();
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode)
+};
+
+//-----------------------------------------------------------------------------
+
+inline SwpHints & SwTxtNode::GetSwpHints()
+{
+ ASSERT_ID( m_pSwpHints, ERR_NOHINTS);
+ return *m_pSwpHints;
+}
+inline const SwpHints &SwTxtNode::GetSwpHints() const
+{
+ ASSERT_ID( m_pSwpHints, ERR_NOHINTS);
+ return *m_pSwpHints;
+}
+
+inline SwpHints& SwTxtNode::GetOrCreateSwpHints()
+{
+ if ( !m_pSwpHints )
+ {
+ m_pSwpHints = new SwpHints;
+ }
+ return *m_pSwpHints;
+}
+
+inline void SwTxtNode::TryDeleteSwpHints()
+{
+ if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() )
+ {
+ DELETEZ( m_pSwpHints );
+ }
+}
+
+inline SwTxtFmtColl* SwTxtNode::GetTxtColl() const
+{
+ return static_cast<SwTxtFmtColl*>(const_cast<SwModify*>(GetRegisteredIn()));
+}
+
+// fuer den IBM-Compiler nicht inlinen wg. 42876
+#ifndef ICC
+// Inline Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
+inline SwTxtNode *SwNode::GetTxtNode()
+{
+ return ND_TEXTNODE == nNodeType ? static_cast<SwTxtNode*>(this) : 0;
+}
+inline const SwTxtNode *SwNode::GetTxtNode() const
+{
+ return ND_TEXTNODE == nNodeType ? static_cast<const SwTxtNode*>(this) : 0;
+}
+#endif
+
+inline void
+SwTxtNode::CutText(SwTxtNode * const pDest, const SwIndex & rDestStart,
+ const SwIndex & rStart, const xub_StrLen nLen)
+{
+ CutImpl( pDest, rDestStart, rStart, nLen, true );
+}
+
+#endif
diff --git a/sw/inc/ndtyp.hxx b/sw/inc/ndtyp.hxx
new file mode 100644
index 000000000000..6fb429980703
--- /dev/null
+++ b/sw/inc/ndtyp.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _NDTYP_HXX
+#define _NDTYP_HXX
+
+#include <tools/solar.h>
+
+// Ids fuer die verschiedenden Nodes; in der Basisklasse steht der Member,
+// der angibt, um was fuer einen es sich handelt
+const sal_uInt8 ND_ENDNODE = 0x01;
+const sal_uInt8 ND_STARTNODE = 0x02;
+const sal_uInt8 ND_TABLENODE = 0x06;
+const sal_uInt8 ND_TEXTNODE = 0x08;
+const sal_uInt8 ND_GRFNODE = 0x10;
+const sal_uInt8 ND_OLENODE = 0x20;
+
+const sal_uInt8 ND_CONTENTNODE = 0x38; // ContentNode (eines von den 3 Bits)
+const sal_uInt8 ND_NOTXTNODE = 0x30; // NoTxtNode (eines von den 2 Bits)
+
+const sal_uInt8 ND_SECTIONNODE = 0x42;
+// nur fuer internen Gebrauch!!
+const sal_uInt8 ND_SECTIONDUMMY = 0x40; //(ND_SECTIONNODE & ~ND_STARTNODE);
+
+// spezielle Types der StartNodes, die keine Ableitungen sind, aber
+// "Bereiche" zusammenhalten.
+enum SwStartNodeType
+{
+ SwNormalStartNode = 0,
+ SwTableBoxStartNode,
+ SwFlyStartNode,
+ SwFootnoteStartNode,
+ SwHeaderStartNode,
+ SwFooterStartNode
+};
+
+// is the node the first and/or last node of a section?
+// This information is used for the export filters. Our layout never have a
+// distance before or after if the node is the first or last in a section.
+const sal_uInt8 ND_HAS_PREV_LAYNODE = 0x01;
+const sal_uInt8 ND_HAS_NEXT_LAYNODE = 0x02;
+
+
+
+#endif
diff --git a/sw/inc/newhdl.hxx b/sw/inc/newhdl.hxx
new file mode 100644
index 000000000000..574dc3f9167a
--- /dev/null
+++ b/sw/inc/newhdl.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _NEWHDL_HXX
+#define _NEWHDL_HXX
+
+#include <tools/link.hxx>
+
+#include "errhdl.hxx" // hier kommt auch swtypes rein, was ich brauche
+
+// ----------------------------------------------------------------------------
+
+extern void SW_NEW_HDL();
+
+class SwNewHdl
+{
+ friend void SW_NEW_HDL();
+private:
+ char* pWarnMem;
+ char* pExceptMem;
+ Link aWarnLnk;
+ Link aErrLnk;
+public:
+ void SetWarnLnk( const Link &rLink );
+ void SetErrLnk( const Link &rLink );
+
+ sal_Bool TryWarnMem();
+
+ sal_Bool Flush_WarnMem();
+ sal_Bool Flush_ExceptMem();
+
+ SwNewHdl();
+ ~SwNewHdl();
+};
+
+/******************************************************************************
+ * INLINE
+ ******************************************************************************/
+inline void SwNewHdl::SetWarnLnk( const Link &rLink )
+{
+ aWarnLnk = rLink;
+}
+
+inline void SwNewHdl::SetErrLnk( const Link &rLink )
+{
+ aErrLnk = rLink;
+}
+
+#endif
+
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
new file mode 100644
index 000000000000..4ff69260b044
--- /dev/null
+++ b/sw/inc/node.hxx
@@ -0,0 +1,768 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_NODE_HXX
+#define SW_NODE_HXX
+
+#include <vector>
+
+#include <boost/utility.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <tools/mempool.hxx>
+#include <tools/gen.hxx>
+
+#include "swdllapi.h"
+#include <ndarr.hxx>
+#include <ndtyp.hxx>
+#include <index.hxx>
+#include <fmtcol.hxx>
+
+// ---------------------
+// forward Deklarationen
+// ---------------------
+
+class SvUShorts;
+class SwCntntFrm;
+class SwCntntNode;
+class SwDoc;
+class SwEndNode;
+class SwFrm;
+class SwFrmFmt;
+class SwGrfNode;
+class SwNoTxtNode;
+class SwNodeIndex;
+class SwOLENode;
+class SwRect;
+class SwSection;
+class SwSectionFmt;
+class SwTOXBase;
+class SwSectionNode;
+class SwStartNode;
+class SwTabFrm;
+class SwRootFrm;
+class SwTable;
+class SwTableNode;
+class SwTableBox;
+class SwTxtNode;
+class SwPageDesc;
+class ViewShell;
+struct SwPosition;
+class IStyleAccess;
+class IDocumentSettingAccess;
+class IDocumentDeviceAccess;
+class IDocumentMarkAccess;
+class IDocumentRedlineAccess;
+class IDocumentStylePoolAccess;
+class IDocumentLineNumberAccess;
+class IDocumentLinksAdministration;
+class IDocumentFieldsAccess;
+class IDocumentContentOperations;
+class IDocumentListItems;
+class SwOLENodes;
+
+// --------------------
+// class SwNode
+// --------------------
+class SW_DLLPUBLIC SwNode : private /* public*/ BigPtrEntry
+{
+ friend class SwNodes;
+
+#ifdef DBG_UTIL
+ static long nSerial;
+ long nMySerial;
+#endif
+
+ sal_uInt8 nNodeType;
+
+ // JP 28.03.96
+ // fuer Textnodes: Stufungslevel der Autoformatierung. Ist erstmal hier
+ // gelandet, weil noch Bits frei sind
+ sal_uInt8 nAFmtNumLvl : 3;
+ sal_Bool bSetNumLSpace : 1; // fuer Numerierung: sal_True Einzug setzen
+ sal_Bool bIgnoreDontExpand : 1; // for Text Attributes - ignore the flag
+
+protected:
+ SwStartNode* pStartOfSection;
+
+ SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeId );
+
+ // fuer den initialen StartNode
+ SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNodeId );
+
+public:
+ virtual ~SwNode();
+
+#ifdef DBG_UTIL
+ long int GetSerial() const { return nMySerial; }
+#endif
+
+ sal_uInt16 GetSectionLevel() const;
+
+ inline sal_uLong StartOfSectionIndex() const;
+ inline const SwStartNode* StartOfSectionNode() const { return pStartOfSection; }
+ inline SwStartNode* StartOfSectionNode() { return pStartOfSection; }
+
+ inline sal_uLong EndOfSectionIndex() const;
+ inline const SwEndNode* EndOfSectionNode() const;
+ inline SwEndNode* EndOfSectionNode();
+
+ inline sal_uInt8 GetAutoFmtLvl() const { return nAFmtNumLvl; }
+ inline void SetAutoFmtLvl( sal_uInt8 nVal ) { nAFmtNumLvl = nVal; }
+
+ inline sal_Bool IsSetNumLSpace() const { return bSetNumLSpace; }
+ inline void SetNumLSpace( sal_Bool bFlag ) { bSetNumLSpace = bFlag; }
+
+ inline sal_Bool IsIgnoreDontExpand() const { return bIgnoreDontExpand; }
+ inline void SetIgnoreDontExpand( sal_Bool bNew ) { bIgnoreDontExpand = bNew; }
+
+ sal_uInt8 GetNodeType() const { return nNodeType; }
+
+ inline SwStartNode *GetStartNode();
+ inline const SwStartNode *GetStartNode() const;
+ inline SwCntntNode *GetCntntNode();
+ inline const SwCntntNode *GetCntntNode() const;
+ inline SwEndNode *GetEndNode();
+ inline const SwEndNode *GetEndNode() const;
+#ifndef ICC
+ inline
+#endif
+ SwTxtNode *GetTxtNode();
+
+#ifndef ICC
+ inline
+#endif
+ const SwTxtNode *GetTxtNode() const;
+ inline SwOLENode *GetOLENode();
+ inline const SwOLENode *GetOLENode() const;
+ inline SwNoTxtNode *GetNoTxtNode();
+ inline const SwNoTxtNode *GetNoTxtNode() const;
+ inline SwGrfNode *GetGrfNode();
+ inline const SwGrfNode *GetGrfNode() const;
+ inline SwTableNode *GetTableNode();
+ inline const SwTableNode *GetTableNode() const;
+ inline SwSectionNode *GetSectionNode();
+ inline const SwSectionNode *GetSectionNode() const;
+
+ inline sal_Bool IsStartNode() const;
+ inline sal_Bool IsCntntNode() const;
+ inline sal_Bool IsEndNode() const;
+ inline sal_Bool IsTxtNode() const;
+ inline sal_Bool IsTableNode() const;
+ inline sal_Bool IsSectionNode() const;
+ inline sal_Bool IsOLENode() const;
+ inline sal_Bool IsNoTxtNode() const;
+ inline sal_Bool IsGrfNode() const;
+
+ /**
+ Checks if this node is in redlines.
+
+ @retval sal_True this node is in redlines
+ @retval sal_False else
+ */
+ sal_Bool IsInRedlines() const;
+
+ // suche den TabellenNode, in dem dieser steht. Wenn in keiner
+ // Tabelle wird 0 returnt.
+ SwTableNode *FindTableNode();
+ inline const SwTableNode *FindTableNode() const;
+
+ // suche den SectionNode, in dem dieser steht. Wenn es in keiner
+ // Section steht wird 0 returnt.
+ SwSectionNode *FindSectionNode();
+ inline const SwSectionNode *FindSectionNode() const;
+
+ SwStartNode* FindSttNodeByType( SwStartNodeType eTyp );
+ inline const SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ) const;
+
+ const SwStartNode* FindTableBoxStartNode() const
+ { return FindSttNodeByType( SwTableBoxStartNode ); }
+ const SwStartNode* FindFlyStartNode() const
+ { return FindSttNodeByType( SwFlyStartNode ); }
+ const SwStartNode* FindFootnoteStartNode() const
+ { return FindSttNodeByType( SwFootnoteStartNode ); }
+ const SwStartNode* FindHeaderStartNode() const
+ { return FindSttNodeByType( SwHeaderStartNode ); }
+ const SwStartNode* FindFooterStartNode() const
+ { return FindSttNodeByType( SwFooterStartNode ); }
+
+ // in welchem Nodes-Array/Doc steht der Node ?
+ inline SwNodes& GetNodes();
+ inline const SwNodes& GetNodes() const;
+ inline SwDoc* GetDoc();
+ inline const SwDoc* GetDoc() const;
+
+ /** Provides access to the document setting interface
+ */
+ const IDocumentSettingAccess* getIDocumentSettingAccess() const;
+
+ /** Provides access to the document device interface
+ */
+ const IDocumentDeviceAccess* getIDocumentDeviceAccess() const;
+
+ /** Provides access to the document bookmark interface
+ */
+ const IDocumentMarkAccess* getIDocumentMarkAccess() const;
+
+ /** Provides access to the document redline interface
+ */
+ const IDocumentRedlineAccess* getIDocumentRedlineAccess() const;
+
+ /** Provides access to the document style pool interface
+ */
+ const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
+
+ /** Provides access to the document line number information interface
+ */
+ const IDocumentLineNumberAccess* getIDocumentLineNumberAccess() const;
+
+ /** Provides access to the document draw model interface
+ */
+ const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
+
+ /** Provides access to the document layout interface
+ */
+ const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
+ IDocumentLayoutAccess* getIDocumentLayoutAccess();
+
+ /** Provides access to the document links administration interface
+ */
+ const IDocumentLinksAdministration* getIDocumentLinksAdministration() const;
+ IDocumentLinksAdministration* getIDocumentLinksAdministration();
+
+ /** Provides access to the document fields administration interface
+ */
+ const IDocumentFieldsAccess* getIDocumentFieldsAccess() const;
+ IDocumentFieldsAccess* getIDocumentFieldsAccess();
+
+ /** Provides access to the document content operations interface
+ */
+ IDocumentContentOperations* getIDocumentContentOperations();
+
+ /** Provides access to the document automatic styles interface
+ */
+ IStyleAccess& getIDocumentStyleAccess();
+
+ /** Provides access to the document's numbered items interface
+
+ OD 2007-10-31 #i83479#
+
+ @author OD
+ */
+ IDocumentListItems& getIDocumentListItems();
+
+ // liegt der Node im Sichtbarenbereich der Shell ?
+ sal_Bool IsInVisibleArea( ViewShell* pSh = 0 ) const;
+ // befindet sich der Node in einem geschuetzten Bereich?
+ sal_Bool IsInProtectSect() const;
+ // befindet sich der Node in irgendetwas geschuetzten ?
+ // (Bereich/Rahmen/Tabellenzellen/... incl. des Ankers bei
+ // Rahmen/Fussnoten/..)
+ sal_Bool IsProtect() const;
+ // suche den PageDesc, mit dem dieser Node formatiert ist. Wenn das
+ // Layout vorhanden ist wird ueber das gesucht, ansonsten gibt es nur
+ // die harte Tour ueber die Nodes nach vorne suchen!!
+ // OD 18.03.2003 #106326#
+ const SwPageDesc* FindPageDesc( sal_Bool bCalcLay, sal_uInt32* pPgDescNdIdx = 0 ) const;
+
+ // falls der Node in einem Fly steht, dann wird das entsprechende Format
+ // returnt
+ SwFrmFmt* GetFlyFmt() const;
+
+ // falls der Node in einer Tabelle steht, dann wird die entsprechende
+ // TabellenBox returnt
+ SwTableBox* GetTblBox() const;
+
+ inline sal_uLong GetIndex() const { return GetPos(); }
+
+ const SwTxtNode* FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const;
+
+ sal_uInt8 HasPrevNextLayNode() const;
+
+private:
+ // privater Constructor, weil nie kopiert werden darf !!
+ SwNode( const SwNode & rNodes );
+ SwNode & operator= ( const SwNode & rNodes );
+};
+
+// --------------------
+// class SwStartNode
+// --------------------
+class SwStartNode: public SwNode
+{
+ friend class SwNode;
+ friend class SwNodes;
+ friend class SwEndNode; // um theEndOfSection zu setzen !!
+
+ SwEndNode* pEndOfSection;
+ SwStartNodeType eSttNdTyp;
+
+ // fuer den initialen StartNode
+ SwStartNode( SwNodes& rNodes, sal_uLong nPos );
+
+protected:
+ SwStartNode( const SwNodeIndex &rWhere,
+ const sal_uInt8 nNodeType = ND_STARTNODE,
+ SwStartNodeType = SwNormalStartNode );
+public:
+ DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode)
+
+ SwStartNodeType GetStartNodeType() const { return eSttNdTyp; }
+
+ // an alle ContentNodes der Section das ChkCondColl rufen
+ void CheckSectionCondColl() const;
+
+private:
+ // privater Constructor, weil nie kopiert werden darf !!
+ SwStartNode( const SwStartNode & rNode );
+ SwStartNode & operator= ( const SwStartNode & rNode );
+};
+
+
+// --------------------
+// class SwEndNode
+// --------------------
+class SwEndNode : public SwNode
+{
+ friend class SwNodes;
+ friend class SwTableNode; // um seinen EndNode anlegen zukoennen
+ friend class SwSectionNode; // um seinen EndNode anlegen zukoennen
+
+ // fuer den initialen StartNode
+ SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd );
+
+protected:
+ SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd );
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwEndNode)
+
+private:
+ // privater Constructor, weil nie kopiert werden darf !!
+ SwEndNode( const SwEndNode & rNode );
+ SwEndNode & operator= ( const SwEndNode & rNode );
+};
+
+
+// --------------------
+// SwCntntNode
+// --------------------
+class SW_DLLPUBLIC SwCntntNode: public SwModify, public SwNode, public SwIndexReg
+{
+ // Der Reader darf NewAttrSet() aufrufen!
+// friend class SwSwgReader;
+// friend class Sw3IoImp;
+
+//FEATURE::CONDCOLL
+ SwDepend* pCondColl;
+//FEATURE::CONDCOLL
+ mutable bool mbSetModifyAtAttr;
+
+protected:
+ SwCntntNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeType,
+ SwFmtColl *pFmtColl );
+ virtual ~SwCntntNode();
+
+ // Attribut-Set fuer alle AUTO-Attribute eines CntntNodes
+ // ( z.B: TxtNode oder NoTxtNode
+ boost::shared_ptr<const SfxItemSet> mpAttrSet;
+
+ // lasse von den entsprechenden Nodes die spz. AttrSets anlegen
+ virtual void NewAttrSet( SwAttrPool& ) = 0;
+
+ // There some functions that like to remove items from the internal
+ // SwAttrSet (handle):
+ sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds );
+
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+
+ // MakeFrm will be called for a certain layout
+ // pSib is another SwFrm of the same layout (e.g. the SwRootFrm itself, a sibling, the parent)
+ virtual SwCntntFrm *MakeFrm( SwFrm* pSib ) = 0;
+
+ virtual SwCntntNode *SplitCntntNode(const SwPosition & ) = 0;
+
+ virtual SwCntntNode *JoinNext();
+ virtual SwCntntNode *JoinPrev();
+ // koennen 2 Nodes zusammengefasst werden ?
+ // in pIdx kann die 2. Position returnt werden.
+ int CanJoinNext( SwNodeIndex* pIdx =0 ) const;
+ int CanJoinPrev( SwNodeIndex* pIdx =0 ) const;
+
+ void MakeStartIndex( SwIndex * pIdx ) { pIdx->Assign( this, 0 ); }
+ void MakeEndIndex( SwIndex * pIdx ) { pIdx->Assign( this, Len() ); }
+
+ sal_Bool GoNext(SwIndex *, sal_uInt16 nMode ) const;
+ sal_Bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const;
+
+ // Replacement for good old GetFrm(..):
+ SwCntntFrm *getLayoutFrm( const SwRootFrm*,
+ const Point* pDocPos = 0,
+ const SwPosition *pPos = 0,
+ const sal_Bool bCalcFrm = sal_True ) const;
+ // Gibt die tatsaechlcheGroesse des Frames zurueck bzw. ein leeres
+ // Rechteck, wenn kein Layout existiert.
+ // Wird fuer die Export Filter benoetigt.
+ SwRect FindLayoutRect( const sal_Bool bPrtArea = sal_False,
+ const Point* pPoint = 0,
+ const sal_Bool bCalcFrm = sal_False ) const;
+ SwRect FindPageFrmRect( const sal_Bool bPrtArea = sal_False,
+ const Point* pPoint = 0,
+ const sal_Bool bCalcFrm = sal_False ) const;
+ /*
+ * Methode erzeugt fuer den angegebenen Node alle Ansichten vom
+ * Dokument. Die erzeugten Contentframes werden in das entsprechende
+ * Layout gehaengt.
+ */
+ void MakeFrms( SwCntntNode& rNode );
+ /*
+ * Methode loescht fuer den Node alle Ansichten vom
+ * Dokument. Die Contentframes werden aus dem entsprechenden
+ * Layout ausgehaengt.
+ */
+ void DelFrms();
+
+ /*
+ * liefert die Anzahl der Elemente des Inhalts des Nodes;
+ * Default ist 1, Unterschiede gibt es beim TextNode und beim
+ * Formelnode.
+ */
+ virtual xub_StrLen Len() const;
+
+ virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const = 0;
+ // erfrage vom Client Informationen
+ virtual sal_Bool GetInfo( SfxPoolItem& ) const;
+
+ // SS fuer die PoolItems: (Harte-(Fmt)Attrbutierung)
+
+ // Ist bInParent sal_False, wird nur in diesem Node nach dem Attribut gesucht.
+ const SfxPoolItem& GetAttr( sal_uInt16 nWhich, sal_Bool bInParent=sal_True ) const;
+ sal_Bool GetAttr( SfxItemSet& rSet, sal_Bool bInParent=sal_True ) const;
+ // --> OD 2008-03-13 #refactorlists#
+ // made virtual
+ virtual sal_Bool SetAttr( const SfxPoolItem& );
+ virtual sal_Bool SetAttr( const SfxItemSet& rSet );
+ virtual sal_Bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
+ virtual sal_Bool ResetAttr( const SvUShorts& rWhichArr );
+ virtual sal_uInt16 ResetAllAttr();
+ // <--
+
+ // liefert das Attribut, das nicht ueber die bedingte Vorlage kommt!
+ const SfxPoolItem* GetNoCondAttr( sal_uInt16 nWhich, sal_Bool bInParents ) const;
+
+ // hat der Node schon eigene Auto-Attribute ?
+ // Zugriff auf SwAttrSet
+ inline const SwAttrSet &GetSwAttrSet() const;
+ inline const SwAttrSet *GetpSwAttrSet() const { return static_cast<const SwAttrSet*>(mpAttrSet.get()); }
+ inline sal_Bool HasSwAttrSet() const { return mpAttrSet ? sal_True : sal_False; }
+
+ virtual SwFmtColl* ChgFmtColl( SwFmtColl* );
+ SwFmtColl* GetFmtColl() const { return (SwFmtColl*)GetRegisteredIn(); }
+
+//FEATURE::CONDCOLL
+ inline SwFmtColl& GetAnyFmtColl() const;
+ void SetCondFmtColl( SwFmtColl* );
+ inline SwFmtColl* GetCondFmtColl() const;
+
+ sal_Bool IsAnyCondition( SwCollCondition& rTmp ) const;
+ void ChkCondColl();
+//FEATURE::CONDCOLL
+
+ // invalidiert die am Node gesetzte NumRule. Diese wird
+ // spaetestend in EndAction einer Shell geupdatet
+ sal_Bool InvalidateNumRule();
+
+ // --> OD 2005-02-21 #i42921# - determines the text direction for a certain
+ // position. Return -1, if text direction could *not* be determined.
+ short GetTextDirection( const SwPosition& rPos,
+ const Point* pPt ) const;
+ // <--
+
+ inline void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; }
+ inline bool GetModifyAtAttr() const { return mbSetModifyAtAttr; }
+
+ static SwOLENodes* CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize );
+
+private:
+ // privater Constructor, weil nie kopiert werden darf !!
+ SwCntntNode( const SwCntntNode & rNode );
+ SwCntntNode & operator= ( const SwCntntNode & rNode );
+};
+
+
+
+//---------
+// SwTableNode
+//---------
+class SW_DLLPUBLIC SwTableNode : public SwStartNode, public SwModify
+{
+ friend class SwNodes;
+ SwTable* pTable;
+protected:
+ virtual ~SwTableNode();
+
+public:
+ SwTableNode( const SwNodeIndex & );
+
+ const SwTable& GetTable() const { return *pTable; }
+ SwTable& GetTable() { return *pTable; }
+ SwTabFrm *MakeFrm( SwFrm* );
+
+ //Legt die Frms fuer den TableNode (also die TabFrms) an.
+ void MakeFrms( SwNodeIndex* pIdxBehind );
+
+ //Methode loescht fuer den Node alle Ansichten vom
+ //Dokument. Die Contentframes werden aus dem entsprechenden
+ //Layout ausgehaengt.
+ void DelFrms();
+
+ //Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
+ //Dokument. Die erzeugten Contentframes werden in das entsprechende
+ //Layout gehaengt.
+ void MakeFrms( const SwNodeIndex & rIdx );
+
+ SwTableNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
+ void SetNewTable( SwTable* , sal_Bool bNewFrames=sal_True );
+
+private:
+ // privater Constructor, weil nie kopiert werden darf !!
+ SwTableNode( const SwTableNode & rNode );
+ SwTableNode & operator= ( const SwTableNode & rNode );
+};
+
+
+//---------
+// SwSectionNode
+//---------
+class SwSectionNode
+ : public SwStartNode
+ , private ::boost::noncopyable
+{
+ friend class SwNodes;
+
+private:
+ ::std::auto_ptr<SwSection> const m_pSection;
+
+protected:
+ virtual ~SwSectionNode();
+
+public:
+ SwSectionNode(SwNodeIndex const&,
+ SwSectionFmt & rFmt, SwTOXBase const*const pTOXBase);
+
+ const SwSection& GetSection() const { return *m_pSection; }
+ SwSection& GetSection() { return *m_pSection; }
+
+ SwFrm *MakeFrm( SwFrm* );
+
+ //Legt die Frms fuer den SectionNode (also die SectionFrms) an.
+ //Im Defaultfall wird bis die Frames bis zum Ende des Bereichs angelegt,
+ //uebergibt man einen weiteren NodeIndex pEnd, so wird bis zu diesem
+ //ein MakeFrms gerufen, genutzt wird dies von TableToText
+ void MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEnd = NULL );
+
+ //Methode loescht fuer den Node alle Ansichten vom
+ //Dokument. Die Contentframes werden aus dem entsprechenden
+ //Layout ausgehaengt.
+ void DelFrms();
+
+ //Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
+ //Dokument. Die erzeugten Contentframes werden in das entsprechende
+ //Layout gehaengt.
+ void MakeFrms( const SwNodeIndex & rIdx );
+
+ SwSectionNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
+
+ // setze den Verweis im Format der Section auf sich selbst
+ void NodesArrChgd();
+
+ // ueberprueft bei _nicht_ versteckten Bereichen, ob es Inhalt gibt, der
+ // _nicht_ in einem versteckten (Unter-)Bereich liegt
+ sal_Bool IsCntntHidden() const;
+
+};
+
+
+
+// ---------------------- einige inline Methoden ----------------------
+inline SwEndNode *SwNode::GetEndNode()
+{
+ return ND_ENDNODE == nNodeType ? (SwEndNode*)this : 0;
+}
+inline const SwEndNode *SwNode::GetEndNode() const
+{
+ return ND_ENDNODE == nNodeType ? (const SwEndNode*)this : 0;
+}
+inline SwStartNode *SwNode::GetStartNode()
+{
+ return ND_STARTNODE & nNodeType ? (SwStartNode*)this : 0;
+}
+inline const SwStartNode *SwNode::GetStartNode() const
+{
+ return ND_STARTNODE & nNodeType ? (const SwStartNode*)this : 0;
+}
+inline SwTableNode *SwNode::GetTableNode()
+{
+ return ND_TABLENODE == nNodeType ? (SwTableNode*)this : 0;
+}
+inline const SwTableNode *SwNode::GetTableNode() const
+{
+ return ND_TABLENODE == nNodeType ? (const SwTableNode*)this : 0;
+}
+inline SwSectionNode *SwNode::GetSectionNode()
+{
+ return ND_SECTIONNODE == nNodeType ? (SwSectionNode*)this : 0;
+}
+inline const SwSectionNode *SwNode::GetSectionNode() const
+{
+ return ND_SECTIONNODE == nNodeType ? (const SwSectionNode*)this : 0;
+}
+inline SwCntntNode *SwNode::GetCntntNode()
+{
+ return ND_CONTENTNODE & nNodeType ? (SwCntntNode*)this : 0;
+}
+inline const SwCntntNode *SwNode::GetCntntNode() const
+{
+ return ND_CONTENTNODE & nNodeType ? (const SwCntntNode*)this : 0;
+}
+
+
+inline sal_Bool SwNode::IsStartNode() const
+{
+ return ND_STARTNODE & nNodeType ? sal_True : sal_False;
+}
+inline sal_Bool SwNode::IsCntntNode() const
+{
+ return ND_CONTENTNODE & nNodeType ? sal_True : sal_False;
+}
+inline sal_Bool SwNode::IsEndNode() const
+{
+ return ND_ENDNODE == nNodeType ? sal_True : sal_False;
+}
+inline sal_Bool SwNode::IsTxtNode() const
+{
+ return ND_TEXTNODE == nNodeType ? sal_True : sal_False;
+}
+inline sal_Bool SwNode::IsTableNode() const
+{
+ return ND_TABLENODE == nNodeType ? sal_True : sal_False;
+}
+inline sal_Bool SwNode::IsSectionNode() const
+{
+ return ND_SECTIONNODE == nNodeType ? sal_True : sal_False;
+}
+inline sal_Bool SwNode::IsNoTxtNode() const
+{
+ return ND_NOTXTNODE & nNodeType ? sal_True : sal_False;
+}
+inline sal_Bool SwNode::IsOLENode() const
+{
+ return ND_OLENODE == nNodeType ? sal_True : sal_False;
+}
+inline sal_Bool SwNode::IsGrfNode() const
+{
+ return ND_GRFNODE == nNodeType ? sal_True : sal_False;
+}
+
+inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const
+{
+ return ((SwNode*)this)->FindSttNodeByType( eTyp );
+}
+inline const SwTableNode* SwNode::FindTableNode() const
+{
+ return ((SwNode*)this)->FindTableNode();
+}
+inline const SwSectionNode* SwNode::FindSectionNode() const
+{
+ return ((SwNode*)this)->FindSectionNode();
+}
+inline sal_uLong SwNode::StartOfSectionIndex() const
+{
+ return pStartOfSection->GetIndex();
+}
+inline sal_uLong SwNode::EndOfSectionIndex() const
+{
+ const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
+ return pStNd->pEndOfSection->GetIndex();
+}
+inline const SwEndNode* SwNode::EndOfSectionNode() const
+{
+ const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
+ return pStNd->pEndOfSection;
+}
+inline SwEndNode* SwNode::EndOfSectionNode()
+{
+ SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
+ return pStNd->pEndOfSection;
+}
+
+inline SwNodes& SwNode::GetNodes()
+{
+ return (SwNodes&)GetArray();
+}
+inline const SwNodes& SwNode::GetNodes() const
+{
+ return (SwNodes&)GetArray();
+}
+
+inline SwDoc* SwNode::GetDoc()
+{
+ return GetNodes().GetDoc();
+}
+inline const SwDoc* SwNode::GetDoc() const
+{
+ return GetNodes().GetDoc();
+}
+
+inline SwFmtColl* SwCntntNode::GetCondFmtColl() const
+{
+ return pCondColl ? (SwFmtColl*)pCondColl->GetRegisteredIn() : 0;
+}
+
+
+inline SwFmtColl& SwCntntNode::GetAnyFmtColl() const
+{
+ return pCondColl && pCondColl->GetRegisteredIn()
+ ? *(SwFmtColl*)pCondColl->GetRegisteredIn()
+ : *(SwFmtColl*)GetRegisteredIn();
+}
+
+inline const SwAttrSet& SwCntntNode::GetSwAttrSet() const
+{
+ return mpAttrSet ? *GetpSwAttrSet() : GetAnyFmtColl().GetAttrSet();
+}
+
+//FEATURE::CONDCOLL
+
+inline const SfxPoolItem& SwCntntNode::GetAttr( sal_uInt16 nWhich,
+ sal_Bool bInParents ) const
+{
+ return GetSwAttrSet().Get( nWhich, bInParents );
+}
+#endif
diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
new file mode 100644
index 000000000000..ba8f0d5f22b8
--- /dev/null
+++ b/sw/inc/numrule.hxx
@@ -0,0 +1,368 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _NUMRULE_HXX
+#define _NUMRULE_HXX
+
+#include <tools/link.hxx>
+#include <tools/gen.hxx>
+#include <tools/string.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/numitem.hxx>
+#include "swdllapi.h"
+#include <swtypes.hxx>
+#include <calbck.hxx>
+#include <errhdl.hxx>
+#include <error.h>
+#include <hints.hxx>
+#include <hash_map>
+#include <stringhash.hxx>
+#include <SwNumberTreeTypes.hxx>
+#include <vector>
+
+class SwTxtFmtColl;
+class IDocumentListsAccess;
+class SwNodeNum;
+class Font;
+class SvxBrushItem;
+class SvxNumRule;
+class SwCharFmt;
+class SwDoc;
+class SwFmtVertOrient;
+class SwTxtNode;
+
+const sal_Unicode cBulletChar = 0x2022; // Charakter fuer Aufzaehlungen
+
+class SW_DLLPUBLIC SwNumFmt : public SvxNumberFormat, public SwClient
+{
+ SwFmtVertOrient* pVertOrient;
+
+ SW_DLLPRIVATE void UpdateNumNodes( SwDoc* pDoc );
+ SW_DLLPRIVATE virtual void NotifyGraphicArrived();
+
+ using SvxNumberFormat::operator ==;
+ using SvxNumberFormat::operator !=;
+
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
+
+public:
+ SwNumFmt();
+ SwNumFmt( const SwNumFmt& );
+ SwNumFmt( const SvxNumberFormat&, SwDoc* pDoc);
+
+ virtual ~SwNumFmt();
+
+ SwNumFmt& operator=( const SwNumFmt& );
+
+ sal_Bool operator==( const SwNumFmt& ) const;
+ sal_Bool operator!=( const SwNumFmt& r ) const { return !(*this == r); }
+
+ SwCharFmt* GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); }
+ void SetCharFmt( SwCharFmt* );
+ void ForgetCharFmt();
+
+ virtual void SetCharFmtName(const String& rSet);
+ virtual const String& GetCharFmtName()const;
+
+ virtual void SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize = 0, const sal_Int16* pOrient = 0);
+
+ virtual void SetVertOrient(sal_Int16 eSet);
+ virtual sal_Int16 GetVertOrient() const;
+ const SwFmtVertOrient* GetGraphicOrientation() const;
+
+ sal_Bool IsEnumeration() const; // #i22362#
+ sal_Bool IsItemize() const; // #i29560#
+};
+
+class SwPaM;
+enum SwNumRuleType { OUTLINE_RULE = 0, NUM_RULE = 1, RULE_END = 2 };
+class SW_DLLPUBLIC SwNumRule
+{
+// --> OD 2008-02-19 #refactorlists#
+public:
+ typedef std::vector< SwTxtNode* > tTxtNodeList;
+ typedef std::vector< SwTxtFmtColl* > tParagraphStyleList;
+// <--
+private:
+ friend void _FinitCore();
+
+#ifdef DBG_UTIL
+ long int nSerial;
+ static long int nInstances;
+#endif
+
+ static SwNumFmt* aBaseFmts [ RULE_END ][ MAXLEVEL ];
+ static sal_uInt16 aDefNumIndents[ MAXLEVEL ];
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ // default list level properties for position-and-space mode LABEL_ALIGNMENT
+ static SwNumFmt* aLabelAlignmentBaseFmts [ RULE_END ][ MAXLEVEL ];
+ // <--
+ static sal_uInt16 nRefCount;
+ static char* pDefOutlineName;
+
+ SwNumFmt* aFmts[ MAXLEVEL ];
+
+ /** container for associated text nodes
+
+ */
+ // --> OD 2008-02-19 #refactorlists#
+// SwTxtNodeTable* pTxtNodeList;
+ tTxtNodeList maTxtNodeList;
+ // <--
+
+ /** container for associated paragraph styles
+
+ OD 2008-03-03 #refactorlists#
+ */
+ tParagraphStyleList maParagraphStyleList;
+
+ // #i36749#
+ /**
+ hash_map containing "name->rule" relation
+ */
+ std::hash_map<String, SwNumRule *, StringHash> * pNumRuleMap;
+
+ String sName;
+ SwNumRuleType eRuleType;
+ sal_uInt16 nPoolFmtId; // Id-fuer "automatich" erzeugte NumRules
+ sal_uInt16 nPoolHelpId; // HelpId fuer diese Pool-Vorlage
+ sal_uInt8 nPoolHlpFileId; // FilePos ans Doc auf die Vorlagen-Hilfen
+ sal_Bool bAutoRuleFlag : 1;
+ sal_Bool bInvalidRuleFlag : 1;
+ sal_Bool bContinusNum : 1; // Fortlaufende Numerierung - ohne Ebenen
+ sal_Bool bAbsSpaces : 1; // die Ebenen repraesentieren absol. Einzuege
+ bool mbCountPhantoms;
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode meDefaultNumberFormatPositionAndSpaceMode;
+ // <--
+
+ // --> OD 2008-04-03 #refactorlists#
+ String msDefaultListId;
+ // <--
+
+public:
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // add parameter <eDefaultNumberFormatPositionAndSpaceMode>
+ SwNumRule( const String& rNm,
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode,
+ SwNumRuleType = NUM_RULE,
+ sal_Bool bAutoFlg = sal_True );
+
+ SwNumRule( const SwNumRule& );
+ ~SwNumRule();
+
+ SwNumRule& operator=( const SwNumRule& );
+ sal_Bool operator==( const SwNumRule& ) const;
+ sal_Bool operator!=( const SwNumRule& r ) const { return !(*this == r); }
+
+ const SwNumFmt* GetNumFmt( sal_uInt16 i ) const;
+ const SwNumFmt& Get( sal_uInt16 i ) const;
+
+ void Set( sal_uInt16 i, const SwNumFmt* );
+ void Set( sal_uInt16 i, const SwNumFmt& );
+ String MakeNumString( const SwNodeNum&, sal_Bool bInclStrings = sal_True,
+ sal_Bool bOnlyArabic = sal_False ) const;
+ // --> OD 2005-10-17 #126238#
+ // - add optional parameter <_nRestrictToThisLevel> in order to
+ // restrict returned string to this level.
+ String MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
+ const sal_Bool bInclStrings = sal_True,
+ const sal_Bool bOnlyArabic = sal_False,
+ const unsigned int _nRestrictToThisLevel = MAXLEVEL ) const;
+ // <--
+ // --> OD 2007-08-24 #i81002#
+ String MakeRefNumString( const SwNodeNum& rNodeNum,
+ const bool bInclSuperiorNumLabels = false,
+ const sal_uInt8 nRestrictInclToThisLevel = 0 ) const;
+ // <--
+
+ /** Returns list of associated text nodes.
+
+ OD 2008-02-19 #refactorlists#
+
+ @return list of associated text nodes
+ */
+// const SwTxtNodeTable * GetTxtNodeList() const { return pTxtNodeList; }
+ void GetTxtNodeList( SwNumRule::tTxtNodeList& rTxtNodeList ) const;
+ SwNumRule::tTxtNodeList::size_type GetTxtNodeListSize() const;
+
+ // --> OD 2008-02-19 #refactorlists#
+ void AddTxtNode( SwTxtNode& rTxtNode );
+ void RemoveTxtNode( SwTxtNode& rTxtNode );
+ // <--
+
+ // --> OD 2008-03-03 #refactorlists#
+ SwNumRule::tParagraphStyleList::size_type GetParagraphStyleListSize() const;
+ void AddParagraphStyle( SwTxtFmtColl& rTxtFmtColl );
+ void RemoveParagraphStyle( SwTxtFmtColl& rTxtFmtColl );
+ // <--
+
+ // --> OD 2008-04-03 #refactorlists#
+ inline void SetDefaultListId( const String sDefaultListId )
+ {
+ msDefaultListId = sDefaultListId;
+ }
+ inline String GetDefaultListId() const
+ {
+ return msDefaultListId;
+ }
+ // <--
+ // #i36749#
+ /**
+ Register this rule in a "name->numrule" map.
+
+ @param pNumRuleMap map to register in
+ */
+ void SetNumRuleMap(
+ std::hash_map<String, SwNumRule *, StringHash>* pNumRuleMap );
+
+ static char* GetOutlineRuleName() { return pDefOutlineName; }
+
+ static sal_uInt16 GetNumIndent( sal_uInt8 nLvl );
+ static sal_uInt16 GetBullIndent( sal_uInt8 nLvl );
+
+ SwNumRuleType GetRuleType() const { return eRuleType; }
+ void SetRuleType( SwNumRuleType eNew ) { eRuleType = eNew;
+ bInvalidRuleFlag = sal_True; }
+
+ // eine Art Copy-Constructor, damit die Num-Formate auch an den
+ // richtigen CharFormaten eines Dokumentes haengen !!
+ // (Kopiert die NumFormate und returnt sich selbst)
+ SwNumRule& CopyNumRule( SwDoc*, const SwNumRule& );
+
+ // testet ob die CharFormate aus dem angegeben Doc sind und kopiert
+ // die gegebenfalls
+ void CheckCharFmts( SwDoc* pDoc );
+
+ const String& GetName() const { return sName; }
+ // --> OD 2008-07-08 #i91400#
+ void SetName( const String& rNm,
+ IDocumentListsAccess& rDocListAccess ); // #i36749#
+ // <--
+
+ sal_Bool IsAutoRule() const { return bAutoRuleFlag; }
+ void SetAutoRule( sal_Bool bFlag ) { bAutoRuleFlag = bFlag; }
+
+ sal_Bool IsInvalidRule() const { return bInvalidRuleFlag; }
+ void SetInvalidRule( sal_Bool bFlag );
+
+ sal_Bool IsContinusNum() const { return bContinusNum; }
+ void SetContinusNum( sal_Bool bFlag ) { bContinusNum = bFlag; }
+
+ sal_Bool IsAbsSpaces() const { return bAbsSpaces; }
+ void SetAbsSpaces( sal_Bool bFlag ) { bAbsSpaces = bFlag; }
+
+ // #115901#
+ sal_Bool IsOutlineRule() const { return eRuleType == OUTLINE_RULE; }
+
+ bool IsCountPhantoms() const;
+ void SetCountPhantoms(bool bCountPhantoms);
+
+ // erfragen und setzen der Poolvorlagen-Id's
+ sal_uInt16 GetPoolFmtId() const { return nPoolFmtId; }
+ void SetPoolFmtId( sal_uInt16 nId ) { nPoolFmtId = nId; }
+
+ // erfragen und setzen der Hilfe-Id's fuer die Document-Vorlagen
+ sal_uInt16 GetPoolHelpId() const { return nPoolHelpId; }
+ void SetPoolHelpId( sal_uInt16 nId ) { nPoolHelpId = nId; }
+ sal_uInt8 GetPoolHlpFileId() const { return nPoolHlpFileId; }
+ void SetPoolHlpFileId( sal_uInt8 nId ) { nPoolHlpFileId = nId; }
+
+ void SetSvxRule(const SvxNumRule&, SwDoc* pDoc);
+ SvxNumRule MakeSvxNumRule() const;
+
+ // #i23726#, #i23725#
+ // --> OD 2008-06-09 #i90078#
+ // refactoring: provide certain method for certain purpose
+// void Indent(short aAmount, int nLevel = -1,
+// int nReferenceLevel = -1, sal_Bool bRelative = sal_True,
+// sal_Bool bFirstLine = sal_True, sal_Bool bCheckGtZero = sal_True);
+ // change indent of all list levels by given difference
+ void ChangeIndent( const short nDiff );
+ // set indent of certain list level to given value
+ void SetIndent( const short nNewIndent,
+ const sal_uInt16 nListLevel );
+ // set indent of first list level to given value and change other list level's
+ // indents accordingly
+ void SetIndentOfFirstListLevelAndChangeOthers( const short nNewIndent );
+ // <--
+
+ void Validate();
+};
+
+// --> OD 2006-06-27 #b6440955#
+// namespace for static functions and methods for numbering and bullets
+namespace numfunc
+{
+ /** retrieve font family name used for the default bullet list characters
+
+ @author OD
+ */
+ const String& GetDefBulletFontname();
+
+ /** determine if default bullet font is user defined
+
+ OD 2008-06-06 #i63395#
+ The default bullet font is user defined, if it is given in the user configuration
+
+ @author OD
+ */
+ bool IsDefBulletFontUserDefined();
+
+ /** retrieve font used for the default bullet list characters
+
+ @author OD
+ */
+ SW_DLLPUBLIC const Font& GetDefBulletFont();
+
+ /** retrieve unicode of character used for the default bullet list for the given list level
+
+ @author OD
+ */
+ sal_Unicode GetBulletChar( sal_uInt8 nLevel );
+
+ /** configuration, if at first position of the first list item the <TAB>-key
+ increased the indent of the complete list or only demotes this list item.
+ The same for <SHIFT-TAB>-key at the same position for decreasing the
+ indent of the complete list or only promotes this list item.
+
+ OD 2007-10-01 #b6600435#
+
+ @author OD
+ */
+ sal_Bool ChangeIndentOnTabAtFirstPosOfFirstListItem();
+
+ /**
+ OD 2008-06-06 #i89178#
+
+ @author OD
+ */
+ SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode();
+}
+
+#endif // _NUMRULE_HXX
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
new file mode 100644
index 000000000000..af6f73f9d133
--- /dev/null
+++ b/sw/inc/pagedesc.hxx
@@ -0,0 +1,349 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _PAGEDESC_HXX
+#define _PAGEDESC_HXX
+
+#include <tools/fract.hxx>
+#include <tools/color.hxx>
+#include <tools/string.hxx>
+#include "swdllapi.h"
+#include <swtypes.hxx> //fuer SwTwips
+#include <frmfmt.hxx>
+//#ifndef _NUMRULE_HXX
+//#include <numrule.hxx>
+//#endif
+#include <editeng/numitem.hxx>
+
+class SfxPoolItem;
+class SwTxtFmtColl;
+class SwNode;
+
+//Separator line adjustment
+enum SwFtnAdj
+{
+ FTNADJ_LEFT,
+ FTNADJ_CENTER,
+ FTNADJ_RIGHT
+};
+
+//footnote information
+class SW_DLLPUBLIC SwPageFtnInfo
+{
+ SwTwips nMaxHeight; //maximum height of the footnote area.
+ sal_uLong nLineWidth; //width of separator line
+ Color aLineColor; //color of the separator line
+ Fraction aWidth; //percentage width of the separator line.
+ SwFtnAdj eAdj; //line adjustment.
+ SwTwips nTopDist; //distance between body and separator.
+ SwTwips nBottomDist; //distance between separator and first footnote
+
+public:
+ SwTwips GetHeight() const { return nMaxHeight; }
+ sal_uLong GetLineWidth() const { return nLineWidth; }
+ const Color& GetLineColor() const { return aLineColor;}
+ const Fraction& GetWidth() const { return aWidth; }
+ SwFtnAdj GetAdj() const { return eAdj; }
+ SwTwips GetTopDist()const { return nTopDist; }
+ SwTwips GetBottomDist() const { return nBottomDist; }
+
+ void SetHeight( SwTwips nNew ) { nMaxHeight = nNew; }
+ void SetLineWidth(sal_uLong nSet ) { nLineWidth = nSet; }
+ void SetLineColor(const Color& rCol ) { aLineColor = rCol;}
+ void SetWidth( const Fraction &rNew){ aWidth = rNew; }
+ void SetAdj ( SwFtnAdj eNew ) { eAdj = eNew; }
+ void SetTopDist ( SwTwips nNew ) { nTopDist = nNew; }
+ void SetBottomDist( SwTwips nNew ) { nBottomDist = nNew; }
+
+ SwPageFtnInfo();
+ SwPageFtnInfo( const SwPageFtnInfo& );
+ SwPageFtnInfo& operator=( const SwPageFtnInfo& );
+
+ sal_Bool operator ==( const SwPageFtnInfo& ) const;
+};
+
+/*
+ * Verwendung des UseOnPage (eUse) und der FrmFmt'e
+ *
+ * RIGHT - aMaster nur fuer rechte Seiten, linke Seiten immer leer.
+ * LEFT - aLeft fuer linke Seiten, rechte Seiten immer leer.
+ * aLeft ist eine Kopie des Master.
+ * ALL - aMaster fuer rechte Seiten, aLeft fuer Linke Seiten.
+ * aLeft ist eine Kopie des Master.
+ * MIRROR - aMaster fuer rechte Seiten, aLeft fuer linke Seiten.
+ * aLeft ist eine Kopie des Master, Raender sind gespiegelt.
+ *
+ * UI dreht auschliesslich am Master! aLeft wird beim Chg am Dokument
+ * enstprechend dem eUse eingestellt.
+ *
+ * Damit es die Filter etwas einfacher haben werden weitere Werte im
+ * eUse untergebracht:
+ *
+ * HEADERSHARE - Headerinhalt auf beiden Seiten gleich
+ * FOOTERSHARE - Footerinhalt auf beiden Seiten gleich
+ *
+ * Die Werte werden bei den entsprechenden Get-/Set-Methden ausmaskiert.
+ * Zugriff auf das volle eUse inclusive der Header-Footer information
+ * per ReadUseOn(), WriteUseOn() (fuer Filter und CopyCTor)!
+ *
+ * Die FrmFormate fuer Header/Footer werden anhand der Attribute fuer
+ * Header/Footer vom UI am Master eingestellt (Hoehe, Raender, Hintergrund...);
+ * Header/Footer fuer die Linke Seite werden entsprechen kopiert bzw.
+ * gespielt (Chg am Dokument).
+ * Das jew. Attribut fuer den Inhalt wird automatisch beim Chg am
+ * Dokument versorgt (entsprechen den SHARE-informationen werden Inhalte
+ * erzeugt bzw. entfernt).
+ *
+ */
+
+typedef sal_uInt16 UseOnPage;
+namespace nsUseOnPage
+{
+ const UseOnPage PD_NONE = 0x0000; //for internal use only.
+ const UseOnPage PD_LEFT = 0x0001;
+ const UseOnPage PD_RIGHT = 0x0002;
+ const UseOnPage PD_ALL = 0x0003;
+ const UseOnPage PD_MIRROR = 0x0007;
+ const UseOnPage PD_HEADERSHARE = 0x0040;
+ const UseOnPage PD_FOOTERSHARE = 0x0080;
+ const UseOnPage PD_NOHEADERSHARE = 0x00BF; //for internal use only
+ const UseOnPage PD_NOFOOTERSHARE = 0x007F; //for internal use only
+}
+
+class SW_DLLPUBLIC SwPageDesc : public SwModify
+{
+ friend class SwDoc;
+ friend class SwUndoPageDescExt;
+
+ String aDescName;
+ SvxNumberType aNumType;
+ SwFrmFmt aMaster;
+ SwFrmFmt aLeft;
+ SwDepend aDepend; // wg. Registerhaltigkeit
+ SwPageDesc *pFollow;
+ sal_uInt16 nRegHeight; // Zeilenabstand und Fontascent der Vorlage
+ sal_uInt16 nRegAscent; // fuer die Registerhaltigkeit
+ UseOnPage eUse;
+ sal_Bool bLandscape;
+
+ //Fussnoteninformationen
+ SwPageFtnInfo aFtnInfo;
+
+ //Wird zum Spiegeln vom Chg (Doc) gerufen.
+ //Kein Abgleich an anderer Stelle.
+ SW_DLLPRIVATE void Mirror();
+
+ SW_DLLPRIVATE void ResetAllAttr( sal_Bool bLeft );
+
+ SW_DLLPRIVATE SwPageDesc(const String&, SwFrmFmt*, SwDoc *pDc );
+
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNewValue );
+
+public:
+ const String &GetName() const { return aDescName; }
+ void SetName( const String& rNewName ) { aDescName = rNewName; }
+
+ sal_Bool GetLandscape() const { return bLandscape; }
+ void SetLandscape( sal_Bool bNew ) { bLandscape = bNew; }
+
+ const SvxNumberType &GetNumType() const { return aNumType; }
+ void SetNumType( const SvxNumberType& rNew ) { aNumType = rNew; }
+
+ const SwPageFtnInfo &GetFtnInfo() const { return aFtnInfo; }
+ SwPageFtnInfo &GetFtnInfo() { return aFtnInfo; }
+ void SetFtnInfo( const SwPageFtnInfo &rNew ) { aFtnInfo = rNew; }
+
+ inline sal_Bool IsHeaderShared() const;
+ inline sal_Bool IsFooterShared() const;
+ inline void ChgHeaderShare( sal_Bool bNew );
+ inline void ChgFooterShare( sal_Bool bNew );
+
+ inline void SetUseOn( UseOnPage eNew );
+ inline UseOnPage GetUseOn() const;
+
+ void WriteUseOn( UseOnPage eNew ) { eUse = eNew; }
+ UseOnPage ReadUseOn () const { return eUse; }
+
+ SwFrmFmt &GetMaster() { return aMaster; }
+ SwFrmFmt &GetLeft() { return aLeft; }
+ const SwFrmFmt &GetMaster() const { return aMaster; }
+ const SwFrmFmt &GetLeft() const { return aLeft; }
+
+ // Reset all attrs of the format but keep the ones a pagedesc
+ // cannot live without.
+ inline void ResetAllMasterAttr();
+ inline void ResetAllLeftAttr();
+
+ //Mit den folgenden Methoden besorgt sich das Layout ein Format
+ //um eine Seite erzeugen zu koennen
+ inline SwFrmFmt *GetRightFmt();
+ inline const SwFrmFmt *GetRightFmt() const;
+ inline SwFrmFmt *GetLeftFmt();
+ inline const SwFrmFmt *GetLeftFmt() const;
+
+ sal_uInt16 GetRegHeight() const { return nRegHeight; }
+ sal_uInt16 GetRegAscent() const { return nRegAscent; }
+ void SetRegHeight( sal_uInt16 nNew ){ nRegHeight = nNew; }
+ void SetRegAscent( sal_uInt16 nNew ){ nRegAscent = nNew; }
+
+ inline void SetFollow( const SwPageDesc* pNew );
+ const SwPageDesc* GetFollow() const { return pFollow; }
+ SwPageDesc* GetFollow() { return pFollow; }
+
+ void SetRegisterFmtColl( const SwTxtFmtColl* rFmt );
+ const SwTxtFmtColl* GetRegisterFmtColl() const;
+ void RegisterChange();
+
+ // erfragen und setzen der PoolFormat-Id
+ sal_uInt16 GetPoolFmtId() const { return aMaster.GetPoolFmtId(); }
+ void SetPoolFmtId( sal_uInt16 nId ) { aMaster.SetPoolFmtId( nId ); }
+ sal_uInt16 GetPoolHelpId() const { return aMaster.GetPoolHelpId(); }
+ void SetPoolHelpId( sal_uInt16 nId ) { aMaster.SetPoolHelpId( nId ); }
+ sal_uInt8 GetPoolHlpFileId() const { return aMaster.GetPoolHlpFileId(); }
+ void SetPoolHlpFileId( sal_uInt8 nId ) { aMaster.SetPoolHlpFileId( nId ); }
+
+ // erfrage vom Client Informationen
+ virtual sal_Bool GetInfo( SfxPoolItem& ) const;
+
+ const SwFrmFmt* GetPageFmtOfNode( const SwNode& rNd,
+ sal_Bool bCheckForThisPgDc = sal_True ) const;
+ sal_Bool IsFollowNextPageOfNode( const SwNode& rNd ) const;
+
+ //Given a SwNode return the pagedesc in use at that location.
+ static const SwPageDesc* GetPageDescOfNode(const SwNode& rNd);
+
+ SwPageDesc& operator=( const SwPageDesc& );
+
+ SwPageDesc( const SwPageDesc& );
+ ~SwPageDesc();
+};
+
+inline void SwPageDesc::SetFollow( const SwPageDesc* pNew )
+{
+ pFollow = pNew ? (SwPageDesc*)pNew : this;
+}
+
+inline sal_Bool SwPageDesc::IsHeaderShared() const
+{
+ return eUse & nsUseOnPage::PD_HEADERSHARE ? sal_True : sal_False;
+}
+inline sal_Bool SwPageDesc::IsFooterShared() const
+{
+ return eUse & nsUseOnPage::PD_FOOTERSHARE ? sal_True : sal_False;
+}
+inline void SwPageDesc::ChgHeaderShare( sal_Bool bNew )
+{
+ if ( bNew )
+ eUse = (UseOnPage) (eUse | nsUseOnPage::PD_HEADERSHARE);
+ // (sal_uInt16&)eUse |= (sal_uInt16)nsUseOnPage::PD_HEADERSHARE;
+ else
+ eUse = (UseOnPage) (eUse & nsUseOnPage::PD_NOHEADERSHARE);
+ // (sal_uInt16&)eUse &= (sal_uInt16)nsUseOnPage::PD_NOHEADERSHARE;
+}
+inline void SwPageDesc::ChgFooterShare( sal_Bool bNew )
+{
+ if ( bNew )
+ eUse = (UseOnPage) (eUse | nsUseOnPage::PD_FOOTERSHARE);
+ // (sal_uInt16&)eUse |= (sal_uInt16)nsUseOnPage::PD_FOOTERSHARE;
+ else
+ eUse = (UseOnPage) (eUse & nsUseOnPage::PD_NOFOOTERSHARE);
+ // (sal_uInt16&)eUse &= (sal_uInt16)nsUseOnPage::PD_NOFOOTERSHARE;
+}
+inline void SwPageDesc::SetUseOn( UseOnPage eNew )
+{
+ UseOnPage eTmp = nsUseOnPage::PD_NONE;
+ if ( eUse & nsUseOnPage::PD_HEADERSHARE )
+ eTmp = nsUseOnPage::PD_HEADERSHARE;
+ // (sal_uInt16&)eTmp |= (sal_uInt16)nsUseOnPage::PD_HEADERSHARE;
+ if ( eUse & nsUseOnPage::PD_FOOTERSHARE )
+ eTmp = (UseOnPage) (eTmp | nsUseOnPage::PD_FOOTERSHARE);
+ // (sal_uInt16&)eTmp |= (sal_uInt16)nsUseOnPage::PD_FOOTERSHARE;
+ eUse = (UseOnPage) (eTmp | eNew);
+ // (sal_uInt16&)eUse = eTmp | eNew;
+}
+inline UseOnPage SwPageDesc::GetUseOn() const
+{
+ UseOnPage eRet = eUse;
+ eRet = (UseOnPage) (eRet & nsUseOnPage::PD_NOHEADERSHARE);
+ // (sal_uInt16&)eRet &= (sal_uInt16)nsUseOnPage::PD_NOHEADERSHARE;
+ eRet = (UseOnPage) (eRet & nsUseOnPage::PD_NOFOOTERSHARE);
+ // (sal_uInt16&)eRet &= (sal_uInt16)nsUseOnPage::PD_NOFOOTERSHARE;
+ return eRet;
+}
+
+inline void SwPageDesc::ResetAllMasterAttr()
+{
+ ResetAllAttr( sal_False );
+}
+
+inline void SwPageDesc::ResetAllLeftAttr()
+{
+ ResetAllAttr( sal_True );
+}
+
+inline SwFrmFmt *SwPageDesc::GetRightFmt()
+{
+ return nsUseOnPage::PD_RIGHT & eUse ? &aMaster : 0;
+}
+inline const SwFrmFmt *SwPageDesc::GetRightFmt() const
+{
+ return nsUseOnPage::PD_RIGHT & eUse ? &aMaster : 0;
+}
+inline SwFrmFmt *SwPageDesc::GetLeftFmt()
+{
+ return nsUseOnPage::PD_LEFT & eUse ? &aLeft : 0;
+}
+inline const SwFrmFmt *SwPageDesc::GetLeftFmt() const
+{
+ return nsUseOnPage::PD_LEFT & eUse ? &aLeft : 0;
+}
+
+class SwPageDescExt
+{
+ SwPageDesc aPageDesc;
+ SwDoc * pDoc;
+ String sFollow;
+
+ void SetPageDesc(const SwPageDesc & aPageDesc);
+
+public:
+ SwPageDescExt(const SwPageDesc & rPageDesc, SwDoc * pDoc);
+ SwPageDescExt(const SwPageDescExt & rSrc);
+ ~SwPageDescExt();
+
+ SwPageDescExt & operator = (const SwPageDescExt & rSrc);
+ SwPageDescExt & operator = (const SwPageDesc & rSrc);
+
+ const String & GetName() const;
+
+ operator SwPageDesc() const; // #i7983#
+};
+
+
+SwPageDesc* GetPageDescByName_Impl(SwDoc& rDoc, const String& rName);
+
+#endif //_PAGEDESC_HXX
diff --git a/sw/inc/pageiter.hxx b/sw/inc/pageiter.hxx
new file mode 100644
index 000000000000..2280ae414093
--- /dev/null
+++ b/sw/inc/pageiter.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _PAGEITER_HXX
+#define _PAGEITER_HXX
+
+#include <tools/solar.h>
+
+class SwDoc;
+class SwPageFrm;
+struct SwPosition;
+class SwPageDesc;
+
+class SwPageIter {
+ const SwDoc &rPDoc;
+ const SwPageFrm *pPage;
+
+public:
+ SwPageIter( const SwDoc &rDoc, const SwPosition &rStartPos );
+
+ sal_Bool IsEnd() const { return 0 == pPage; }
+ sal_Bool NextPage();
+ const SwPageDesc* GetPageDesc() const;
+ sal_Bool Seek( const SwPosition &rPos );
+ sal_Bool GetPosition( SwPosition &rPos ) const;
+};
+
+
+#endif
+
diff --git a/sw/inc/pagepreviewlayout.hxx b/sw/inc/pagepreviewlayout.hxx
new file mode 100644
index 000000000000..01d83afae52e
--- /dev/null
+++ b/sw/inc/pagepreviewlayout.hxx
@@ -0,0 +1,621 @@
+#ifndef _PAGEPREVIEWLAYOUT_HXX
+#define _PAGEPREVIEWLAYOUT_HXX
+
+// template class <std::vector>
+#include <vector>
+// datatypes sal_xyz
+#include <sal/types.h>
+// classes <Point>, <Size> and <Rectangle>
+#include <tools/gen.hxx>
+// datatype <SwTwips>
+#include <swtypes.hxx>
+
+class ViewShell;
+class SwRootFrm;
+class SwPageFrm;
+class Fraction;
+struct PrevwPage;
+
+// =============================================================================
+/** page preview functionality in the writer
+
+ OD 11.12.2002 #103492# - class <SwPagePreviewLayout>
+
+ @author OD
+*/
+class SwPagePreviewLayout
+{
+private:
+ friend class ViewShell;
+
+ // number of horizontal and vertical twips for spacing between the pages.
+ const SwTwips mnXFree;
+ const SwTwips mnYFree;
+
+ // view shell the print preview is generated for.
+ ViewShell& mrParentViewShell;
+ // top layout frame of the layout for accessing the pages
+ const SwRootFrm& mrLayoutRootFrm;
+
+ // boolean indicating, if the layout information (number of columns and rows)
+ // are valid.
+ bool mbLayoutInfoValid;
+ // boolean indicating, if the the calculated print preview layout sizes
+ // ( windows size in twips, maximal page size, column width, row height,
+ // width and height of a print preview page, size of the print preview
+ // document ) are valid
+ bool mbLayoutSizesValid;
+ // boolean indicating, if the the paint information ( physical number of
+ // start page, start column and row, paint offsets, rectangle visible of
+ // the print preview document.
+ bool mbPaintInfoValid;
+
+ Size maWinSize;
+ sal_uInt16 mnCols;
+ sal_uInt16 mnRows;
+ sal_uInt16 mnPages;
+ // OD 19.02.2003 #107369# - new flag for leaving blank left-top-corner
+ // OD 2004-03-05 #i18143# - the book preview is controlled by this flag
+ bool mbBookPreview;
+ bool mbBookPreviewModeToggled;
+
+ Size maMaxPageSize;
+ Rectangle maPreviewDocRect;
+ SwTwips mnColWidth;
+ SwTwips mnRowHeight;
+ SwTwips mnPrevwLayoutWidth;
+ SwTwips mnPrevwLayoutHeight;
+ bool mbDoesLayoutColsFitIntoWindow;
+ bool mbDoesLayoutRowsFitIntoWindow;
+
+ sal_uInt16 mnPaintPhyStartPageNum;
+ sal_uInt16 mnPaintStartCol;
+ sal_uInt16 mnPaintStartRow;
+ bool mbNoPageVisible;
+ Point maPaintStartPageOffset;
+ Point maPaintPreviewDocOffset;
+ Point maAdditionalPaintOffset;
+ Rectangle maPaintedPrevwDocRect;
+ sal_uInt16 mnSelectedPageNum;
+
+ std::vector<PrevwPage*> maPrevwPages;
+
+ // OD 07.11.2003 #i22014# - internal booleans to indicate, that a new print
+ // preview layout has been created during a paint.
+ mutable bool mbInPaint;
+ mutable bool mbNewLayoutDuringPaint;
+
+ bool mbPrintEmptyPages;
+
+ /** clear internal data about current page preview
+
+ OD 11.12.2002 #103492#
+
+ @author OD
+ */
+ void _Clear();
+
+ /** helper method to clear preview page layout sizes
+
+ OD 18.12.2002 #103492#
+
+ @author OD
+ */
+ void _ClearPrevwLayoutSizes();
+
+ /** helper method to clear data in preview page vectors
+
+ OD 13.12.2002 #103492#
+
+ @author OD
+ */
+ void _ClearPrevwPageData();
+
+ /** calculate page preview layout sizes
+
+ OD 18.12.2002 #103492#
+
+ @author OD
+ */
+ void _CalcPrevwLayoutSizes();
+
+ /** apply new zoom at given view shell
+
+ OD 11.12.2002 #103492#
+
+ @author OD
+
+ @param _aNewZoom
+ input parameter - new zoom percentage
+ */
+ void _ApplyNewZoomAtViewShell( sal_uInt8 _aNewZoom );
+
+ /** calculate additional paint offset
+
+ OD 12.12.2002 #103492#
+ helper method called by <Prepare> in order to calculate an additional
+ paint offset to center output in given window size.
+ The booleans <mbDoesLayoutRowsFitIntoWindow> and <mbDoesLayoutColsFitIntoWindow>
+ are also determined.
+ preconditions:
+ (1) preview layout is given (number of rows and columns).
+ (2) window size is given.
+ (3) height of row and width of column are calculated.
+ (4) paint offset of start page is calculated.
+
+ @author OD
+ */
+ void _CalcAdditionalPaintOffset();
+
+ /** calculate painted preview document rectangle
+
+ OD 12.12.2002 #103492#
+ helper method called by <Prepare> in order to calculate the rectangle,
+ which will be painted for the document arranged by the given preview
+ layout.
+ preconditions:
+ (1) paint offset of document preview is calculated.
+ (2) size of document preview is calculated.
+ (3) additional paint offset is calculated - see <_CalcAdditionalPaintOffset>.
+
+ @author OD
+ */
+ void _CalcDocPrevwPaintRect();
+
+ /** determines preview data for a given page and a given preview offset
+
+ OD 13.12.2002 #103492#
+
+ @author OD
+
+ @param _rPage
+ input parameter - constant reference to page frame, for which the
+ preview data will be calculated.
+
+ @param _rPrevwOffset
+ input parameter - constant reference to the offset the given page has
+ in the current preview window.
+ Note: Offset can be negative.
+
+ @param _opPrevwPage
+ output parameter - calculated preview data.
+
+ @return boolean, indicating, if calculation was successful.
+ */
+ bool _CalcPreviewDataForPage( const SwPageFrm& _rPage,
+ const Point& _rPrevwOffset,
+ PrevwPage* _opPrevwPage );
+
+ /** calculate preview pages
+
+ OD 12.12.2002 #103492#
+ helper method called by <Prepare> in order to determine which pages
+ will be visible in the current preview and calculate the data needed
+ to paint these pages. Also the accessible pages with its needed data
+ are determined.
+
+ @author OD
+ */
+ void _CalcPreviewPages();
+
+ /** get preview page by physical page number
+
+ OD 17.12.2002 #103492#
+
+ @author OD
+
+ @param _nPageNum
+ input parameter - physical page number of page, for which the preview
+ page will be returned.
+
+ @return pointer to preview page of current preview pages. If page doesn't
+ belongs to current preview pages, <0> is returned.
+ */
+ const PrevwPage* _GetPrevwPageByPageNum( const sal_uInt16 _nPageNum ) const;
+
+ /** paint selection mark at page
+
+ OD 17.12.2002 #103492#
+
+ @author OD
+ */
+ void _PaintSelectMarkAtPage( const PrevwPage* _aSelectedPrevwPage ) const;
+
+public:
+ /** constructor of <SwPagePreviewLayout>
+
+ OD 11.12.2002 #103492#
+
+ @author OD
+
+ @param _rParentViewShell
+ input parameter - reference to the view shell the page preview
+ layout belongs to. Reference will be hold as member <mrParentViewShell>.
+ Adjustments/Changes at this view shell:
+ (1) Adjustment of the mapping mode at the output device.
+ (2) Change of the zoom at the view options.
+ (3) Preparations for paint of the page preview.
+
+ @param _rLayoutRootFrm
+ input parameter - constant reference to the root frame of the layout.
+ Reference will be hold as member <mrLayoutRootFrm> in order to get
+ access to the page frames.
+ */
+ SwPagePreviewLayout( ViewShell& _rParentViewShell,
+ const SwRootFrm& _rLayoutRootFrm );
+
+ /** destructor of <SwPagePreviewLayout>
+
+ OD 17.12.2002 #103492#
+
+ @author
+ */
+ inline ~SwPagePreviewLayout()
+ {
+ _ClearPrevwPageData();
+ }
+
+ /** init page preview layout
+
+ OD 11.12.2002 #103492#
+ initialize the page preview settings for a given layout.
+ side effects:
+ (1) If parameter <_bCalcScale> is true, mapping mode with calculated
+ scaling is set at the output device and the zoom at the view options of
+ the given view shell is set with the calculated scaling.
+
+ @author OD
+
+ @param _nCols
+ input parameter - initial number of page columns in the preview.
+
+ @param _nRows
+ input parameter - initial number of page rows in the preview.
+
+ @param _rPxWinSize
+ input parameter - window size in which the preview will be displayed and
+ for which the scaling will be calculated.
+
+ @param _bCalcScale
+ input parameter - control, if method should calculate the needed
+ scaling for the proposed preview layout for the given window size
+ and sets the scaling at the output device and the view options.
+
+ @return boolean, indicating, if preview layout is successful initialized.
+ */
+ bool Init( const sal_uInt16 _nCols,
+ const sal_uInt16 _nRows,
+ const Size& _rPxWinSize,
+ const bool _bCalcScale
+ );
+
+ /** method to adjust page preview layout to document changes
+
+ OD 18.12.2002 #103492#
+
+ @author OD
+
+ @return boolean, indicating, if preview layout is successful initialized.
+ */
+ bool ReInit();
+
+ /** prepare paint of page preview
+
+ OD 12.12.2002 #103492#
+ With the valid preview layout settings - calculated and set by method
+ <Init(..)> - the paint of a specific part of the virtual preview
+ document is prepared. The corresponding part is given by either
+ a start page (parameter <_nProposedStartPageNum>) or a absolute position
+ (parameter <_aProposedStartPoint>).
+ The accessibility preview will also be updated via a corresponding
+ method call.
+ OD 21.03.2003 #108282# - delete parameter _onStartPageVirtNum
+
+ @author OD
+
+ @param _nProposedStartPageNum [0..<number of document pages>]
+ input parameter - proposed number of page, which should be painted in
+ the left-top-corner in the current output device. input parameter
+ <_bStartWithPageAtFirstCol> influences, if proposed page is actual
+ painted in the left-top-corner.
+
+ @param _nProposedStartPos [(0,0)..<PreviewDocumentSize>]
+ input parameter - proposed absolute position in the virtual preview
+ document, which should be painted in the left-top-corner in the current
+ output device.
+
+ @param _rPxWinSize
+ input parameter - pixel size of window the preview will be painted in.
+
+ @param _onStartPageNum
+ output parameter - physical number of page, which will be painted in the
+ left-top-corner in the current output device.
+
+ @param _orDocPreviewPaintRect
+ output parameter - rectangle of preview document, which will be painted.
+
+ @param _bStartWithPageAtFirstCol
+ input parameter with default value "true" - controls, if start page
+ is set to page in first column the proposed start page is located.
+
+ @return boolean, indicating, if prepare of preview paint was successful.
+ */
+ bool Prepare( const sal_uInt16 _nProposedStartPageNum,
+ const Point _aProposedStartPos,
+ const Size& _rPxWinSize,
+ sal_uInt16& _onStartPageNum,
+ Rectangle& _orDocPreviewPaintRect,
+ const bool _bStartWithPageAtFirstCol = true
+ );
+
+ /** get selected page number
+
+ OD 13.12.2002 #103492#
+
+ @author OD
+ */
+ inline sal_uInt16 SelectedPage()
+ {
+ return mnSelectedPageNum;
+ }
+
+ /** set selected page number
+
+ OD 14.01.2003 #103492#
+
+ @author OD
+ */
+ inline void SetSelectedPage( sal_uInt16 _nSelectedPageNum )
+ {
+ mnSelectedPageNum = _nSelectedPageNum;
+ }
+
+ /** paint prepared preview
+
+ OD 12.12.2002 #103492#
+
+ @author OD
+
+ @param _aOutRect
+ input parameter - Twip rectangle of window, which should be painted.
+
+ @return boolean, indicating, if paint of preview was performed
+ */
+ bool Paint( const Rectangle _aOutRect ) const;
+
+ /** repaint pages on page preview
+
+ OD 18.12.2002 #103492#
+ method to invalidate visible pages due to changes in a different
+ view shell.
+
+ @author OD
+ */
+ void Repaint( const Rectangle _aInvalidCoreRect ) const;
+
+ /** paint to mark new selected page
+
+ OD 17.12.2002 #103492#
+ Perform paint for current selected page in order to unmark it.
+ Set new selected page and perform paint to mark this page.
+
+ @author OD
+
+ @param _nNewSelectedPage
+ input parameter - physical number of page, which will be marked as selected.
+ */
+ void MarkNewSelectedPage( const sal_uInt16 _nSelectedPage );
+
+ /** calculate start position for new scale
+
+ OD 12.12.2002 #103492#
+ calculate new start position for a new scale. Calculation bases on the
+ current visible part of the document arranged in the given preview layout.
+ preconditions:
+ (1) new scaling is already set at the given output device.
+
+ @author OD
+
+ @return Point, start position for new scale
+ */
+ Point GetPreviewStartPosForNewScale( const Fraction& _aNewScale,
+ const Fraction& _aOldScale,
+ const Size& _aNewWinSize ) const;
+
+ /** determines, if page with given page number is visible in preview
+
+ OD 12.12.2002 #103492#
+
+ @author OD
+
+ @param _nPageNum
+ input parameter - physical number of page, for which it will be
+ determined, if it is visible.
+
+ @return boolean, indicating, if page with given page number is visible
+ in preview.
+ */
+ bool IsPageVisible( const sal_uInt16 _nPageNum ) const;
+
+ /** calculate data to bring new selected page into view.
+
+ OD 12.12.2002 #103492#
+
+ @author OD
+
+ @param _nHoriMove
+ input parameter - positive/negative number of columns the current
+ selected page have to be moved.
+
+ @param _nVertMove
+ input parameter - positive/negative number of rows the current
+ selected page have to be moved.
+
+ @param _orNewSelectedPage
+ output parameter - number of new selected page
+
+ @param _orNewStartPage
+ output parameter - number of new start page
+
+ @param _orNewStartPos
+ output parameter - new start position in document preview
+
+ @return boolean - indicating, that move was sucessful.
+ */
+ bool CalcStartValuesForSelectedPageMove( const sal_Int16 _nHoriMove,
+ const sal_Int16 _nVertMove,
+ sal_uInt16& _orNewSelectedPage,
+ sal_uInt16& _orNewStartPage,
+ Point& _orNewStartPos ) const;
+
+ /** checks, if given position is inside a shown document page
+
+ OD 17.12.2002 #103492#
+
+ @author OD
+
+ @param _aPrevwPos
+ input parameter - position inside the visible preview window.
+
+ @param _orDocPos
+ output parameter - corresponding position in the document, if given
+ preview position is inside a shown document page, not an empty page.
+ If not, it's value is <Point( 0, 0 )>.
+
+ @param _obPosInEmptyPage
+ output parameter - indicates, that given preview position lays inside
+ an shown empty page.
+
+ @param _onPageNum
+ output parameter - corresponding physical number of page, if given
+ preview position is inside a shown document page, considers also empty
+ pages. If not, it's value is <0>.
+
+ @return boolean - indicating, that given preview position lays inside
+ a shown document preview page, not an empty page.
+ */
+ bool IsPrevwPosInDocPrevwPage( const Point _aPrevwPos,
+ Point& _orDocPos,
+ bool& _obPosInEmptyPage,
+ sal_uInt16& _onPageNum ) const;
+
+ inline bool DoesPreviewLayoutRowsFitIntoWindow() const
+ {
+ return mbDoesLayoutRowsFitIntoWindow;
+ }
+
+ inline bool DoesPreviewLayoutColsFitIntoWindow() const
+ {
+ return mbDoesLayoutColsFitIntoWindow;
+ }
+
+ inline bool PreviewLayoutValid() const
+ {
+ return mbLayoutInfoValid && mbLayoutSizesValid && mbPaintInfoValid;
+ }
+
+ /** determine preview window page scroll amount
+
+ OD 17.12.2002 #103492#
+
+ @author OD
+
+ @param _nWinPagesToScroll
+ input parameter - number of preview window pages the scroll amount has
+ to be calculated for. Negative values for preview window page up
+ scrolling, positive values for preview window page down scrolling.
+
+ @return scroll amount in SwTwips
+ */
+ SwTwips GetWinPagesScrollAmount( const sal_Int16 _nWinPagesToScroll ) const;
+
+ /** determine row the page with the given number is in
+
+ OD 17.01.2003 #103492#
+
+ @author OD
+
+ @param _nPageNum
+ input parameter - physical page number of page, for which the row in
+ preview layout has to be calculated.
+
+ @return number of row the page with the given physical page number is in
+ */
+ sal_uInt16 GetRowOfPage( sal_uInt16 _nPageNum ) const;
+
+ /** determine column the page with the given number is in
+
+ OD 17.01.2003 #103492#
+
+ @author OD
+
+ @param _nPageNum
+ input parameter - physical page number of page, for which the column in
+ preview layout has to be calculated.
+
+ @return number of column the page with the given physical page number is in
+ */
+ sal_uInt16 GetColOfPage( sal_uInt16 _nPageNum ) const;
+
+ // OD 18.12.2002 #103492#
+ Size GetPrevwDocSize() const;
+
+ /** get size of a preview page by its physical page number
+
+ OD 15.01.2003 #103492#
+
+ @author OD
+
+ @param _nPageNum
+ input parameter - pysical page number of preview page, for which the
+ page size has to be returned.
+
+ @return an object of class <Size>
+ */
+ Size GetPrevwPageSizeByPageNum( sal_uInt16 _nPageNum ) const;
+
+ /** get virtual page number by its physical page number
+
+ OD 21.03.2003 #108282#
+
+ @author OD
+
+ @param _nPageNum
+ input parameter - pysical page number of preview page, for which the
+ virtual page number has to be determined.
+
+ @return virtual page number of page given by its physical page number,
+ if the page is in the current preview pages vector, otherwise 0.
+ */
+ sal_uInt16 GetVirtPageNumByPageNum( sal_uInt16 _nPageNum ) const;
+
+ /** enable/disable book preview
+
+ OD 2004-03-04 #i18143#
+
+ @author OD
+ */
+ bool SetBookPreviewMode( const bool _bEnableBookPreview,
+ sal_uInt16& _onStartPageNum,
+ Rectangle& _orDocPreviewPaintRect );
+
+ /** Convert relative to absolute page numbers (see PrintEmptyPages)
+
+ @author FME
+ */
+ sal_uInt16 ConvertRelativeToAbsolutePageNum( sal_uInt16 _nRelPageNum ) const;
+
+ /** Convert absolute to relative page numbers (see PrintEmptyPages)
+
+ @author FME
+ */
+ sal_uInt16 ConvertAbsoluteToRelativePageNum( sal_uInt16 _nAbsPageNum ) const;
+
+ /** get the number of preview pages
+
+ @author FME
+ */
+ sal_uInt16 GetNumberOfPreviewPages() { return sal::static_int_cast< sal_uInt16 >(maPrevwPages.size()); }
+};
+
+#endif // _PAGEPREVIEWLAYOUT_HXX
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
new file mode 100644
index 000000000000..995246f8d9e9
--- /dev/null
+++ b/sw/inc/pam.hxx
@@ -0,0 +1,280 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _PAM_HXX
+#define _PAM_HXX
+
+#include <stddef.h> // fuer MemPool
+#include <tools/gen.hxx>
+#include <tools/mempool.hxx>
+#include <cshtyp.hxx> // fuer die Funktions-Definitionen
+#include <ring.hxx> // Superklasse
+#include <index.hxx> // fuer SwIndex
+#include <ndindex.hxx> // fuer SwNodeIndex
+#include "swdllapi.h"
+
+class SwFmt;
+class SfxPoolItem;
+class SfxItemSet;
+class SwDoc;
+class SwNode;
+class SwCntntNode;
+class SwPaM;
+
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
+
+namespace utl {
+ class TextSearch;
+}
+
+struct SW_DLLPUBLIC SwPosition
+{
+ SwNodeIndex nNode;
+ SwIndex nContent;
+
+ SwPosition( const SwNodeIndex &rNode, const SwIndex &rCntnt );
+ explicit SwPosition( const SwNodeIndex &rNode );
+ explicit SwPosition( const SwNode& rNode );
+ explicit SwPosition( SwCntntNode& rNode, const xub_StrLen nOffset = 0 );
+
+ SwPosition( const SwPosition & );
+ SwPosition &operator=(const SwPosition &);
+
+ // #111827#
+ /**
+ Returns the document this position is in.
+
+ @return the document this position is in.
+ */
+ SwDoc * GetDoc() const;
+
+ sal_Bool operator < (const SwPosition &) const;
+ sal_Bool operator > (const SwPosition &) const;
+ sal_Bool operator <=(const SwPosition &) const;
+ sal_Bool operator >=(const SwPosition &) const;
+ sal_Bool operator ==(const SwPosition &) const;
+ sal_Bool operator !=(const SwPosition &) const;
+};
+
+
+// das Ergebnis eines Positions Vergleiches
+enum SwComparePosition {
+ POS_BEFORE, // Pos1 liegt vor Pos2
+ POS_BEHIND, // Pos1 liegt hinter Pos2
+ POS_INSIDE, // Pos1 liegt vollstaendig in Pos2
+ POS_OUTSIDE, // Pos2 liegt vollstaendig in Pos1
+ POS_EQUAL, // Pos1 ist genauso gross wie Pos2
+ POS_OVERLAP_BEFORE, // Pos1 ueberlappt Pos2 am Anfang
+ POS_OVERLAP_BEHIND, // Pos1 ueberlappt Pos2 am Ende
+ POS_COLLIDE_START, // Pos1 Start stoesst an Pos2 Ende
+ POS_COLLIDE_END // Pos1 End stoesst an Pos2 Start
+};
+SwComparePosition ComparePosition(
+ const SwPosition& rStt1, const SwPosition& rEnd1,
+ const SwPosition& rStt2, const SwPosition& rEnd2 );
+
+SwComparePosition ComparePosition(
+ const unsigned long nStt1, const unsigned long nEnd1,
+ const unsigned long nStt2, const unsigned long nEnd2 );
+
+
+// SwPointAndMark / SwPaM
+struct SwMoveFnCollection;
+typedef SwMoveFnCollection* SwMoveFn;
+SW_DLLPUBLIC extern SwMoveFn fnMoveForward; // SwPam::Move()/Find() default argument.
+SW_DLLPUBLIC extern SwMoveFn fnMoveBackward;
+
+typedef sal_Bool (*SwGoInDoc)( SwPaM& rPam, SwMoveFn fnMove );
+SW_DLLPUBLIC extern SwGoInDoc fnGoDoc;
+extern SwGoInDoc fnGoSection;
+SW_DLLPUBLIC extern SwGoInDoc fnGoNode;
+SW_DLLPUBLIC extern SwGoInDoc fnGoCntnt; // SwPam::Move() default argument.
+extern SwGoInDoc fnGoCntntCells;
+extern SwGoInDoc fnGoCntntSkipHidden;
+extern SwGoInDoc fnGoCntntCellsSkipHidden;
+
+void _InitPam();
+
+class SW_DLLPUBLIC SwPaM : public Ring
+{
+ SwPosition m_Bound1;
+ SwPosition m_Bound2;
+ SwPosition * m_pPoint; // points at either m_Bound1 or m_Bound2
+ SwPosition * m_pMark; // points at either m_Bound1 or m_Bound2
+ bool m_bIsInFrontOfLabel;
+
+ SwPaM* MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg = 0 );
+
+public:
+ SwPaM( const SwPosition& rPos, SwPaM* pRing = 0 );
+ SwPaM( const SwPosition& rMk, const SwPosition& rPt, SwPaM* pRing = 0 );
+ SwPaM( const SwNodeIndex& rMk, const SwNodeIndex& rPt,
+ long nMkOffset = 0, long nPtOffset = 0, SwPaM* pRing = 0 );
+ SwPaM( const SwNode& rMk, const SwNode& rPt,
+ long nMkOffset = 0, long nPtOffset = 0, SwPaM* pRing = 0 );
+ SwPaM( const SwNodeIndex& rMk, xub_StrLen nMkCntnt,
+ const SwNodeIndex& rPt, xub_StrLen nPtCntnt, SwPaM* pRing = 0 );
+ SwPaM( const SwNode& rMk, xub_StrLen nMkCntnt,
+ const SwNode& rPt, xub_StrLen nPtCntnt, SwPaM* pRing = 0 );
+ SwPaM( const SwNode& rNd, xub_StrLen nCntnt = 0, SwPaM* pRing = 0 );
+ SwPaM( const SwNodeIndex& rNd, xub_StrLen nCntnt = 0, SwPaM* pRing = 0 );
+ virtual ~SwPaM();
+
+ // @@@ semantic: no copy ctor.
+ SwPaM( SwPaM & );
+ // @@@ semantic: no copy assignment for super class Ring.
+ SwPaM& operator=( const SwPaM & );
+
+ // Bewegen des Cursors
+ sal_Bool Move( SwMoveFn fnMove = fnMoveForward,
+ SwGoInDoc fnGo = fnGoCntnt );
+
+ // Suchen
+ sal_uInt8 Find( const com::sun::star::util::SearchOptions& rSearchOpt,
+ sal_Bool bSearchInNotes,
+ utl::TextSearch& rSTxt,
+ SwMoveFn fnMove = fnMoveForward,
+ const SwPaM *pPam =0, sal_Bool bInReadOnly = sal_False);
+ sal_Bool Find( const SwFmt& rFmt,
+ SwMoveFn fnMove = fnMoveForward,
+ const SwPaM *pPam =0, sal_Bool bInReadOnly = sal_False);
+ sal_Bool Find( const SfxPoolItem& rAttr, sal_Bool bValue = sal_True,
+ SwMoveFn fnMove = fnMoveForward,
+ const SwPaM *pPam =0, sal_Bool bInReadOnly = sal_False );
+ sal_Bool Find( const SfxItemSet& rAttr, sal_Bool bNoColls,
+ SwMoveFn fnMove,
+ const SwPaM *pPam, sal_Bool bInReadOnly, sal_Bool bMoveFirst );
+
+ bool DoSearch( const com::sun::star::util::SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
+ SwMoveFn fnMove, sal_Bool bSrchForward, sal_Bool bRegSearch, sal_Bool bChkEmptyPara, sal_Bool bChkParaEnd,
+ xub_StrLen &nStart, xub_StrLen &nEnde,xub_StrLen nTxtLen,SwNode* pNode, SwPaM* pPam);
+
+ inline bool IsInFrontOfLabel() const { return m_bIsInFrontOfLabel; }
+ inline void _SetInFrontOfLabel( bool bNew ) { m_bIsInFrontOfLabel = bNew; }
+
+ virtual void SetMark();
+
+ void DeleteMark()
+ {
+ if (m_pMark != m_pPoint)
+ {
+ // clear the mark position; this helps if mark's SwIndex is
+ // registered at some node, and that node is then deleted
+ *m_pMark = SwPosition( SwNodeIndex( GetNode()->GetNodes() ) );
+ m_pMark = m_pPoint;
+ }
+ }
+#ifndef DBG_UTIL
+
+ void Exchange()
+ {
+ if (m_pPoint != m_pMark)
+ {
+ SwPosition *pTmp = m_pPoint;
+ m_pPoint = m_pMark;
+ m_pMark = pTmp;
+ }
+ }
+#else
+ void Exchange();
+#endif
+
+ /** A PaM marks a selection if Point and Mark are distinct positions.
+ @return true iff the PaM spans a selection
+ */
+ bool HasMark() const { return m_pPoint == m_pMark ? false : true; }
+
+ const SwPosition *GetPoint() const { return m_pPoint; }
+ SwPosition *GetPoint() { return m_pPoint; }
+ const SwPosition *GetMark() const { return m_pMark; }
+ SwPosition *GetMark() { return m_pMark; }
+
+ const SwPosition *Start() const
+ { return (*m_pPoint) <= (*m_pMark) ? m_pPoint : m_pMark; }
+ SwPosition *Start()
+ { return (*m_pPoint) <= (*m_pMark) ? m_pPoint : m_pMark; }
+
+ const SwPosition *End() const
+ { return (*m_pPoint) > (*m_pMark) ? m_pPoint : m_pMark; }
+ SwPosition *End()
+ { return (*m_pPoint) > (*m_pMark) ? m_pPoint : m_pMark; }
+
+ /// @return current Node at Point/Mark
+ SwNode * GetNode ( bool bPoint = true ) const
+ {
+ return &( bPoint ? m_pPoint->nNode : m_pMark->nNode ).GetNode();
+ }
+
+ /// @return current ContentNode at Point/Mark
+ SwCntntNode* GetCntntNode( bool bPoint = true ) const
+ {
+ return GetNode(bPoint)->GetCntntNode();
+ }
+
+ /**
+ Normalizes PaM, i.e. sort point and mark.
+
+ @param bPointFirst sal_True: If the point is behind the mark then swap.
+ sal_False: If the mark is behind the point then swap.
+ */
+ SwPaM & Normalize(sal_Bool bPointFirst = sal_True);
+
+ /// @return the document (SwDoc) at which the PaM is registered
+ SwDoc* GetDoc() const { return m_pPoint->nNode.GetNode().GetDoc(); }
+
+ SwPosition& GetBound( bool bOne = true )
+ { return bOne ? m_Bound1 : m_Bound2; }
+ const SwPosition& GetBound( bool bOne = true ) const
+ { return bOne ? m_Bound1 : m_Bound2; }
+
+ // erfrage die Seitennummer auf der der Cursor steht
+ sal_uInt16 GetPageNum( sal_Bool bAtPoint = sal_True, const Point* pLayPos = 0 );
+
+ // steht in etwas geschuetztem oder in die Selektion umspannt
+ // etwas geschuetztes.
+ sal_Bool HasReadonlySel( bool bFormView ) const;
+
+ sal_Bool ContainsPosition(const SwPosition & rPos)
+ { return *Start() <= rPos && rPos <= *End(); }
+
+ static sal_Bool Overlap(const SwPaM & a, const SwPaM & b);
+
+ static sal_Bool LessThan(const SwPaM & a, const SwPaM & b);
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwPaM);
+
+ String GetTxt() const;
+ void InvalidatePaM();
+};
+
+
+sal_Bool CheckNodesRange( const SwNodeIndex&, const SwNodeIndex&, sal_Bool );
+sal_Bool GoInCntnt( SwPaM & rPam, SwMoveFn fnMove );
+
+
+#endif // _PAM_HXX
diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx
new file mode 100644
index 000000000000..8a7f119bb539
--- /dev/null
+++ b/sw/inc/paratr.hxx
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _PARATR_HXX
+#define _PARATR_HXX
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include "swdllapi.h"
+#include <hintids.hxx>
+#include <calbck.hxx>
+#include <swatrset.hxx>
+#include <format.hxx>
+#include <swtypes.hxx>
+
+class SwCharFmt;
+class IntlWrapper;
+
+/*************************************************************************
+|* class SwFmtDrop
+*************************************************************************/
+
+#define DROP_WHOLEWORD ((sal_uInt16)0x0001)
+
+//Wenn ein SwFmtDrop Client ist, so ist dies das CharFmt welches den Font fuer
+//die DropCaps beschreibt. Ist es kein Client, so wird von der Formatierung
+//das CharFmt des Absatzes benutzt.
+//Wird das CharFmt verandert, so wird diese Aenderung ueber das Modify des
+//SwFmtDrop an die Absatze propagiert.
+class SW_DLLPUBLIC SwFmtDrop: public SfxPoolItem, public SwClient
+{
+ SwModify* pDefinedIn; // Modify-Object, in dem der DropCaps steht
+ // kann nur TxtFmtCollection/TxtNode sein
+ sal_uInt16 nDistance; // Abstand zum Textbeginn
+ sal_uInt16 nReadFmt; // fuer den Sw3-Reader: CharFormat-Id (Pool laden!)
+ sal_uInt8 nLines; // Anzahl der Zeilen
+ sal_uInt8 nChars; // Anzahl der Zeichen
+ sal_Bool bWholeWord; // Erstes Wort als Initialen
+public:
+ TYPEINFO(); //Bereits in der Basisklasse SwClient
+
+ SwFmtDrop();
+ virtual ~SwFmtDrop();
+
+ // @@@ public copy ctor, but no copy assignment?
+ SwFmtDrop( const SwFmtDrop & );
+private:
+ // @@@ public copy ctor, but no copy assignment?
+ SwFmtDrop & operator= (const SwFmtDrop &);
+
+protected:
+ virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
+
+public:
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline sal_uInt8 GetLines() const { return nLines; }
+ inline sal_uInt8 &GetLines() { return nLines; }
+
+ inline sal_uInt8 GetChars() const { return nChars; }
+ inline sal_uInt8 &GetChars() { return nChars; }
+
+ inline sal_Bool GetWholeWord() const { return bWholeWord; }
+ inline sal_uInt8 &GetWholeWord() { return bWholeWord; }
+
+ inline sal_uInt16 GetDistance() const { return nDistance; }
+ inline sal_uInt16 &GetDistance() { return nDistance; }
+
+ inline const SwCharFmt *GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); }
+ inline SwCharFmt *GetCharFmt() { return (SwCharFmt*)GetRegisteredIn(); }
+ void SetCharFmt( SwCharFmt *pNew );
+ // erfrage vom Client Informationen
+ virtual sal_Bool GetInfo( SfxPoolItem& ) const;
+
+ // erfrage und setze den Modify-Pointer
+ inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
+ inline void ChgDefinedIn( const SwModify* pNew )
+ { pDefinedIn = (SwModify*)pNew; }
+};
+
+class SwRegisterItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ inline SwRegisterItem( const sal_Bool bRegister = sal_False );
+
+ // @@@ public copy assignment, but no copy ctor?
+ inline SwRegisterItem& operator=( const SwRegisterItem& rRegister );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+inline SwRegisterItem::SwRegisterItem( const sal_Bool bRegister ) :
+ SfxBoolItem( RES_PARATR_REGISTER, bRegister )
+{}
+
+inline SwRegisterItem& SwRegisterItem::operator=(
+ const SwRegisterItem& rRegister )
+{
+ SetValue( rRegister.GetValue() );
+ return *this;
+}
+
+class SW_DLLPUBLIC SwNumRuleItem : public SfxStringItem
+{
+public:
+ TYPEINFO();
+
+ // --> OD 2008-03-04 #refactorlists# - removed <pDefinedIn>
+ SwNumRuleItem()
+ : SfxStringItem( RES_PARATR_NUMRULE, aEmptyStr ) {}
+
+ SwNumRuleItem( const String& rRuleName )
+ : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {}
+
+ SwNumRuleItem( const SwNumRuleItem& rCpy )
+ : SfxStringItem( RES_PARATR_NUMRULE, rCpy.GetValue() ) {}
+
+ SwNumRuleItem& operator=( const SwNumRuleItem& rCpy )
+ { SetValue( rCpy.GetValue() ); return *this; }
+ // <--
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
+};
+
+class SwParaConnectBorderItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ inline SwParaConnectBorderItem( const sal_Bool bConnect = sal_True );
+
+ // @@@ public copy assignment, but no copy ctor?
+ inline SwParaConnectBorderItem& operator=( const SwParaConnectBorderItem& rConnect );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+};
+
+inline SwParaConnectBorderItem::SwParaConnectBorderItem( const sal_Bool bConnect ) :
+ SfxBoolItem( RES_PARATR_CONNECT_BORDER, bConnect )
+{}
+
+inline SwParaConnectBorderItem& SwParaConnectBorderItem::operator=(
+ const SwParaConnectBorderItem& rConnect )
+{
+ SetValue( rConnect.GetValue() );
+ return *this;
+}
+
+
+
+/******************************************************************************
+ * Implementierung der Paragraph-Attribut Methoden vom SwAttrSet
+ ******************************************************************************/
+
+inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(sal_Bool bInP) const
+ { return (const SvxLineSpacingItem&)Get( RES_PARATR_LINESPACING,bInP); }
+inline const SvxAdjustItem &SwAttrSet::GetAdjust(sal_Bool bInP) const
+ { return (const SvxAdjustItem&)Get( RES_PARATR_ADJUST,bInP); }
+inline const SvxFmtSplitItem &SwAttrSet::GetSplit(sal_Bool bInP) const
+ { return (const SvxFmtSplitItem&)Get( RES_PARATR_SPLIT,bInP); }
+inline const SwRegisterItem &SwAttrSet::GetRegister(sal_Bool bInP) const
+ { return (const SwRegisterItem&)Get( RES_PARATR_REGISTER,bInP); }
+inline const SvxWidowsItem &SwAttrSet::GetWidows(sal_Bool bInP) const
+ { return (const SvxWidowsItem&)Get( RES_PARATR_WIDOWS,bInP); }
+inline const SvxOrphansItem &SwAttrSet::GetOrphans(sal_Bool bInP) const
+ { return (const SvxOrphansItem&)Get( RES_PARATR_ORPHANS,bInP); }
+inline const SvxTabStopItem &SwAttrSet::GetTabStops(sal_Bool bInP) const
+ { return (const SvxTabStopItem&)Get( RES_PARATR_TABSTOP,bInP); }
+inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(sal_Bool bInP) const
+ { return (const SvxHyphenZoneItem&)Get(RES_PARATR_HYPHENZONE,bInP); }
+inline const SwFmtDrop &SwAttrSet::GetDrop(sal_Bool bInP) const
+ { return (const SwFmtDrop&)Get(RES_PARATR_DROP,bInP); }
+inline const SwNumRuleItem &SwAttrSet::GetNumRule(sal_Bool bInP) const
+ { return (const SwNumRuleItem&)Get(RES_PARATR_NUMRULE,bInP); }
+inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(sal_Bool bInP) const
+ { return (const SvxScriptSpaceItem&)Get(RES_PARATR_SCRIPTSPACE,bInP); }
+inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(sal_Bool bInP) const
+ { return (const SvxHangingPunctuationItem&)Get(RES_PARATR_HANGINGPUNCTUATION,bInP); }
+inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(sal_Bool bInP) const
+ { return (const SvxForbiddenRuleItem&)Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
+inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(sal_Bool bInP) const
+ { return (const SvxParaVertAlignItem&)Get( RES_PARATR_VERTALIGN, bInP ); }
+inline const SvxParaGridItem &SwAttrSet::GetParaGrid(sal_Bool bInP) const
+ { return (const SvxParaGridItem&)Get( RES_PARATR_SNAPTOGRID, bInP ); }
+inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(sal_Bool bInP) const
+ { return (const SwParaConnectBorderItem&)Get( RES_PARATR_CONNECT_BORDER, bInP ); }
+
+/******************************************************************************
+ * Implementierung der Paragraph-Attribut Methoden vom SwFmt
+ ******************************************************************************/
+
+inline const SvxLineSpacingItem &SwFmt::GetLineSpacing(sal_Bool bInP) const
+ { return aSet.GetLineSpacing(bInP); }
+inline const SvxAdjustItem &SwFmt::GetAdjust(sal_Bool bInP) const
+ { return aSet.GetAdjust(bInP); }
+inline const SvxFmtSplitItem &SwFmt::GetSplit(sal_Bool bInP) const
+ { return aSet.GetSplit(bInP); }
+inline const SwRegisterItem &SwFmt::GetRegister(sal_Bool bInP) const
+ { return aSet.GetRegister(bInP); }
+inline const SvxWidowsItem &SwFmt::GetWidows(sal_Bool bInP) const
+ { return aSet.GetWidows(bInP); }
+inline const SvxOrphansItem &SwFmt::GetOrphans(sal_Bool bInP) const
+ { return aSet.GetOrphans(bInP); }
+inline const SvxTabStopItem &SwFmt::GetTabStops(sal_Bool bInP) const
+ { return aSet.GetTabStops(bInP); }
+inline const SvxHyphenZoneItem &SwFmt::GetHyphenZone(sal_Bool bInP) const
+ { return aSet.GetHyphenZone(bInP); }
+inline const SwFmtDrop &SwFmt::GetDrop(sal_Bool bInP) const
+ { return aSet.GetDrop(bInP); }
+inline const SwNumRuleItem &SwFmt::GetNumRule(sal_Bool bInP) const
+ { return aSet.GetNumRule(bInP); }
+inline const SvxScriptSpaceItem& SwFmt::GetScriptSpace(sal_Bool bInP) const
+ { return aSet.GetScriptSpace(bInP) ; }
+inline const SvxHangingPunctuationItem &SwFmt::GetHangingPunctuation(sal_Bool bInP) const
+ { return aSet.GetHangingPunctuation(bInP) ; }
+inline const SvxForbiddenRuleItem &SwFmt::GetForbiddenRule(sal_Bool bInP) const
+ { return (const SvxForbiddenRuleItem&)aSet.Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
+inline const SvxParaVertAlignItem &SwFmt::GetParaVertAlign(sal_Bool bInP) const
+ { return (const SvxParaVertAlignItem&)aSet.Get( RES_PARATR_VERTALIGN, bInP ); }
+inline const SvxParaGridItem &SwFmt::GetParaGrid(sal_Bool bInP) const
+ { return (const SvxParaGridItem&)aSet.Get( RES_PARATR_SNAPTOGRID, bInP ); }
+inline const SwParaConnectBorderItem &SwFmt::GetParaConnectBorder(sal_Bool bInP) const
+ { return (const SwParaConnectBorderItem&)aSet.Get( RES_PARATR_CONNECT_BORDER, bInP ); }
+
+#endif
diff --git a/sw/inc/pausethreadstarting.hxx b/sw/inc/pausethreadstarting.hxx
new file mode 100644
index 000000000000..14bb9b56b5b1
--- /dev/null
+++ b/sw/inc/pausethreadstarting.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _PAUSETHREADSTARTING_HXX
+#define _PAUSETHREADSTARTING_HXX
+
+/** Helper class to pause starting of threads during existence of an instance
+ of this class
+
+ OD 2007-03-16 #i73788#
+
+ @author OD
+*/
+class SwPauseThreadStarting
+{
+ public:
+
+ SwPauseThreadStarting();
+ ~SwPauseThreadStarting();
+
+ private:
+
+ bool mbPausedThreadStarting;
+};
+#endif
diff --git a/sw/inc/pch/precompiled_sw.cxx b/sw/inc/pch/precompiled_sw.cxx
new file mode 100644
index 000000000000..04a4242b04f2
--- /dev/null
+++ b/sw/inc/pch/precompiled_sw.cxx
@@ -0,0 +1,29 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
new file mode 100755
index 000000000000..13e8cb3ddbdd
--- /dev/null
+++ b/sw/inc/pch/precompiled_sw.hxx
@@ -0,0 +1,1002 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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): Generated on 2006-09-01 17:50:13.279643
+
+#ifdef PRECOMPILED_HEADERS
+
+//---MARKER---
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#include "avmedia/mediaitem.hxx"
+#include "avmedia/mediaplayer.hxx"
+#include "avmedia/mediatoolbox.hxx"
+#include "avmedia/mediawindow.hxx"
+
+#include "basegfx/numeric/ftools.hxx"
+
+#include "basic/basmgr.hxx"
+#include "basic/sbmeth.hxx"
+#include "basic/sbmod.hxx"
+#include "basic/sbstar.hxx"
+#include "basic/sbx.hxx"
+#include "basic/sbxobj.hxx"
+#include "basic/sbxvar.hxx"
+
+#include "boost/shared_ptr.hpp"
+
+#include "com/sun/star/accessibility/AccessibleEventId.hpp"
+#include "com/sun/star/accessibility/AccessibleRelation.hpp"
+#include "com/sun/star/accessibility/AccessibleRelationType.hpp"
+#include "com/sun/star/accessibility/AccessibleRole.hpp"
+#include "com/sun/star/accessibility/AccessibleStateType.hpp"
+#include "com/sun/star/accessibility/AccessibleTableModelChange.hpp"
+#include "com/sun/star/accessibility/AccessibleTableModelChangeType.hpp"
+#include "com/sun/star/accessibility/AccessibleTextType.hpp"
+#include "com/sun/star/accessibility/XAccessible.hpp"
+#include "com/sun/star/accessibility/XAccessibleEditableText.hpp"
+#include "com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp"
+#include "com/sun/star/accessibility/XAccessibleHyperlink.hpp"
+#include "com/sun/star/accessibility/XAccessibleHypertext.hpp"
+#include "com/sun/star/accessibility/XAccessibleImage.hpp"
+#include "com/sun/star/accessibility/XAccessibleRelationSet.hpp"
+#include "com/sun/star/accessibility/XAccessibleSelection.hpp"
+#include "com/sun/star/accessibility/XAccessibleStateSet.hpp"
+#include "com/sun/star/accessibility/XAccessibleTable.hpp"
+#include "com/sun/star/accessibility/XAccessibleTextAttributes.hpp"
+#include "com/sun/star/accessibility/XAccessibleValue.hpp"
+#include "com/sun/star/awt/MessageBoxCommand.hpp"
+#include "com/sun/star/awt/PosSize.hpp"
+#include "com/sun/star/awt/ScrollBarOrientation.hpp"
+#include "com/sun/star/awt/Size.hpp"
+#include "com/sun/star/awt/Style.hpp"
+#include "com/sun/star/awt/TextAlign.hpp"
+#include "com/sun/star/awt/VclWindowPeerAttribute.hpp"
+#include "com/sun/star/awt/XBitmap.hpp"
+#include "com/sun/star/awt/XButton.hpp"
+#include "com/sun/star/awt/XCheckBox.hpp"
+#include "com/sun/star/awt/XComboBox.hpp"
+#include "com/sun/star/awt/XControlModel.hpp"
+#include "com/sun/star/awt/XCurrencyField.hpp"
+#include "com/sun/star/awt/XDateField.hpp"
+#include "com/sun/star/awt/XDialog.hpp"
+#include "com/sun/star/awt/XFileDialog.hpp"
+#include "com/sun/star/awt/XFixedText.hpp"
+#include "com/sun/star/awt/XImageButton.hpp"
+#include "com/sun/star/awt/XLayoutConstrains.hpp"
+#include "com/sun/star/awt/XListBox.hpp"
+#include "com/sun/star/awt/XMessageBox.hpp"
+#include "com/sun/star/awt/XNumericField.hpp"
+#include "com/sun/star/awt/XPatternField.hpp"
+#include "com/sun/star/awt/XRadioButton.hpp"
+#include "com/sun/star/awt/XScrollBar.hpp"
+#include "com/sun/star/awt/XSpinField.hpp"
+#include "com/sun/star/awt/XTabControllerModel.hpp"
+#include "com/sun/star/awt/XTextArea.hpp"
+#include "com/sun/star/awt/XTextComponent.hpp"
+#include "com/sun/star/awt/XTextEditField.hpp"
+#include "com/sun/star/awt/XTextLayoutConstrains.hpp"
+#include "com/sun/star/awt/XTimeField.hpp"
+#include "com/sun/star/awt/XVclContainer.hpp"
+#include "com/sun/star/awt/XVclContainerPeer.hpp"
+#include "com/sun/star/beans/NamedValue.hpp"
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/beans/PropertyChangeEvent.hpp"
+#include "com/sun/star/beans/PropertyState.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/PropertyValues.hpp"
+#include "com/sun/star/beans/UnknownPropertyException.hpp"
+#include "com/sun/star/beans/XFastPropertySet.hpp"
+#include "com/sun/star/beans/XMultiPropertySet.hpp"
+#include "com/sun/star/beans/XMultiPropertyStates.hpp"
+#include "com/sun/star/beans/XPropertyAccess.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertyContainer.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include "com/sun/star/beans/XPropertyState.hpp"
+#include "com/sun/star/beans/XPropertyStateChangeListener.hpp"
+#include "com/sun/star/chart/XChartData.hpp"
+#include "com/sun/star/chart/XChartDataArray.hpp"
+#include "com/sun/star/container/XChild.hpp"
+#include "com/sun/star/container/XContainer.hpp"
+#include "com/sun/star/container/XContainerListener.hpp"
+#include "com/sun/star/container/XContentEnumerationAccess.hpp"
+#include "com/sun/star/container/XElementAccess.hpp"
+#include "com/sun/star/container/XEnumeration.hpp"
+#include "com/sun/star/container/XEnumerationAccess.hpp"
+#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
+#include "com/sun/star/container/XIndexAccess.hpp"
+#include "com/sun/star/container/XIndexContainer.hpp"
+#include "com/sun/star/container/XIndexReplace.hpp"
+#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/container/XNamed.hpp"
+#include "com/sun/star/container/XSet.hpp"
+#include "com/sun/star/datatransfer/XTransferable.hpp"
+#include "com/sun/star/datatransfer/XTransferableSupplier.hpp"
+#include "com/sun/star/datatransfer/clipboard/XClipboard.hpp"
+#include "com/sun/star/datatransfer/clipboard/XClipboardListener.hpp"
+#include "com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp"
+#include "com/sun/star/document/PrinterIndependentLayout.hpp"
+#include "com/sun/star/document/RedlineDisplayType.hpp"
+#include "com/sun/star/document/UpdateDocMode.hpp"
+#include "com/sun/star/document/XDocumentInfoSupplier.hpp"
+#include "com/sun/star/document/XDocumentInsertable.hpp"
+#include "com/sun/star/document/XEmbeddedObjectSupplier.hpp"
+#include "com/sun/star/document/XEmbeddedObjectSupplier2.hpp"
+#include "com/sun/star/document/XEventBroadcaster.hpp"
+#include "com/sun/star/document/XEventsSupplier.hpp"
+#include "com/sun/star/document/XExporter.hpp"
+#include "com/sun/star/document/XExtendedFilterDetection.hpp"
+#include "com/sun/star/document/XFilter.hpp"
+#include "com/sun/star/document/XImporter.hpp"
+#include "com/sun/star/document/XLinkTargetSupplier.hpp"
+#include "com/sun/star/document/XRedlinesSupplier.hpp"
+#include "com/sun/star/drawing/ColorMode.hpp"
+#include "com/sun/star/drawing/HomogenMatrix3.hpp"
+#include "com/sun/star/drawing/PointSequence.hpp"
+#include "com/sun/star/drawing/PointSequenceSequence.hpp"
+#include "com/sun/star/drawing/XConnectableShape.hpp"
+#include "com/sun/star/drawing/XConnectorShape.hpp"
+#include "com/sun/star/drawing/XControlShape.hpp"
+#include "com/sun/star/drawing/XDrawPage.hpp"
+#include "com/sun/star/drawing/XDrawPageSupplier.hpp"
+#include "com/sun/star/drawing/XShape.hpp"
+#include "com/sun/star/drawing/XShapeAligner.hpp"
+#include "com/sun/star/drawing/XShapeArranger.hpp"
+#include "com/sun/star/drawing/XShapeGroup.hpp"
+#include "com/sun/star/drawing/XShapeMirror.hpp"
+#include "com/sun/star/drawing/XShapes.hpp"
+#include "com/sun/star/drawing/XUniversalShapeDescriptor.hpp"
+#include "com/sun/star/embed/Aspects.hpp"
+#include "com/sun/star/embed/ElementModes.hpp"
+#include "com/sun/star/embed/EmbedMisc.hpp"
+#include "com/sun/star/embed/EmbedStates.hpp"
+#include "com/sun/star/embed/NoVisualAreaSizeException.hpp"
+#include "com/sun/star/embed/XClassifiedObject.hpp"
+#include "com/sun/star/embed/XComponentSupplier.hpp"
+#include "com/sun/star/embed/XEmbedObjectClipboardCreator.hpp"
+#include "com/sun/star/embed/XEmbedObjectCreator.hpp"
+#include "com/sun/star/embed/XEmbedPersist.hpp"
+#include "com/sun/star/embed/XEmbeddedObject.hpp"
+#include "com/sun/star/embed/XLinkCreator.hpp"
+#include "com/sun/star/embed/XLinkageSupport.hpp"
+#include "com/sun/star/embed/XStorage.hpp"
+#include "com/sun/star/embed/XTransactedObject.hpp"
+#include "com/sun/star/embed/XVisualObject.hpp"
+#include "com/sun/star/form/FormButtonType.hpp"
+#include "com/sun/star/form/FormComponentType.hpp"
+#include "com/sun/star/form/FormSubmitEncoding.hpp"
+#include "com/sun/star/form/FormSubmitMethod.hpp"
+#include "com/sun/star/form/ListSourceType.hpp"
+#include "com/sun/star/form/XForm.hpp"
+#include "com/sun/star/form/XFormComponent.hpp"
+#include "com/sun/star/form/XFormsSupplier.hpp"
+#include "com/sun/star/form/XImageProducerSupplier.hpp"
+#include "com/sun/star/frame/DispatchDescriptor.hpp"
+#include "com/sun/star/frame/DispatchResultState.hpp"
+#include "com/sun/star/frame/FrameSearchFlag.hpp"
+#include "com/sun/star/frame/XComponentLoader.hpp"
+#include "com/sun/star/frame/XController.hpp"
+#include "com/sun/star/frame/XDesktop.hpp"
+#include "com/sun/star/frame/XDispatch.hpp"
+#include "com/sun/star/frame/XDispatchHelper.hpp"
+#include "com/sun/star/frame/XDispatchProvider.hpp"
+#include "com/sun/star/frame/XDispatchProviderInterception.hpp"
+#include "com/sun/star/frame/XDispatchProviderInterceptor.hpp"
+#include "com/sun/star/frame/XFrame.hpp"
+#include "com/sun/star/frame/XLayoutManager.hpp"
+#include "com/sun/star/frame/XModel.hpp"
+#include "com/sun/star/frame/XNotifyingDispatch.hpp"
+#include "com/sun/star/frame/XStorable.hpp"
+#include "com/sun/star/frame/XTerminateListener.hpp"
+#include "com/sun/star/i18n/Boundary.hpp"
+#include "com/sun/star/i18n/BreakType.hpp"
+#include "com/sun/star/i18n/CharacterIteratorMode.hpp"
+#include "com/sun/star/i18n/CollatorOptions.hpp"
+#include "com/sun/star/i18n/ForbiddenCharacters.hpp"
+#include "com/sun/star/i18n/InputSequenceCheckMode.hpp"
+#include "com/sun/star/i18n/ScriptType.hpp"
+#include "com/sun/star/i18n/TextConversionOption.hpp"
+#include "com/sun/star/i18n/TransliterationModules.hpp"
+#include "com/sun/star/i18n/WordType.hpp"
+#include "com/sun/star/i18n/XBreakIterator.hpp"
+#include "com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp"
+#include "com/sun/star/i18n/XExtendedInputSequenceChecker.hpp"
+#include "com/sun/star/i18n/XForbiddenCharacters.hpp"
+#include "com/sun/star/io/XActiveDataControl.hpp"
+#include "com/sun/star/io/XActiveDataSource.hpp"
+#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/io/XOutputStream.hpp"
+#include "com/sun/star/io/XSeekable.hpp"
+#include "com/sun/star/lang/DisposedException.hpp"
+#include "com/sun/star/lang/EventObject.hpp"
+#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/ServiceNotRegisteredException.hpp"
+#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
+#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/lang/XEventListener.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/lang/XUnoTunnel.hpp"
+#include "com/sun/star/linguistic2/DictionaryListEventFlags.hpp"
+#include "com/sun/star/linguistic2/LinguServiceEventFlags.hpp"
+#include "com/sun/star/linguistic2/XDictionary.hpp"
+#include "com/sun/star/linguistic2/XDictionaryList.hpp"
+#include "com/sun/star/linguistic2/XDictionaryListEventListener.hpp"
+#include "com/sun/star/linguistic2/XHyphenatedWord.hpp"
+#include "com/sun/star/linguistic2/XHyphenator.hpp"
+#include "com/sun/star/linguistic2/XLinguServiceEventListener.hpp"
+#include "com/sun/star/linguistic2/XLinguServiceManager.hpp"
+#include "com/sun/star/linguistic2/XSpellAlternatives.hpp"
+#include "com/sun/star/linguistic2/XSpellChecker1.hpp"
+#include "com/sun/star/linguistic2/XThesaurus.hpp"
+#include "com/sun/star/mail/MailAttachment.hpp"
+#include "com/sun/star/mail/MailServiceType.hpp"
+#include "com/sun/star/mail/XAuthenticator.hpp"
+#include "com/sun/star/mail/XConnectionListener.hpp"
+#include "com/sun/star/mail/XMailMessage.hpp"
+#include "com/sun/star/mail/XMailService.hpp"
+#include "com/sun/star/mail/XSmtpService.hpp"
+#include "com/sun/star/packages/WrongPasswordException.hpp"
+#include "com/sun/star/packages/zip/ZipIOException.hpp"
+#include "com/sun/star/scanner/ScannerContext.hpp"
+#include "com/sun/star/scanner/XScannerManager.hpp"
+#include "com/sun/star/script/XEventAttacher.hpp"
+#include "com/sun/star/script/XEventAttacherManager.hpp"
+#include "com/sun/star/script/XLibraryContainer.hpp"
+#include "com/sun/star/sdb/CommandType.hpp"
+#include "com/sun/star/sdb/SQLContext.hpp"
+#include "com/sun/star/sdb/XColumn.hpp"
+#include "com/sun/star/sdb/XCompletedConnection.hpp"
+#include "com/sun/star/sdb/XCompletedExecution.hpp"
+#include "com/sun/star/sdb/XDatabaseAccess.hpp"
+#include "com/sun/star/sdb/XDocumentDataSource.hpp"
+#include "com/sun/star/sdb/XQueriesSupplier.hpp"
+#include "com/sun/star/sdb/XResultSetAccess.hpp"
+#include "com/sun/star/sdb/XSingleSelectQueryComposer.hpp"
+#include "com/sun/star/sdbc/DataType.hpp"
+#include "com/sun/star/sdbc/ResultSetType.hpp"
+#include "com/sun/star/sdbc/XCloseable.hpp"
+#include "com/sun/star/sdbc/XConnection.hpp"
+#include "com/sun/star/sdbc/XDataSource.hpp"
+#include "com/sun/star/sdbc/XResultSet.hpp"
+#include "com/sun/star/sdbc/XRow.hpp"
+#include "com/sun/star/sdbc/XRowSet.hpp"
+#include "com/sun/star/sdbcx/XColumnsSupplier.hpp"
+#include "com/sun/star/sdbcx/XRowLocate.hpp"
+#include "com/sun/star/sdbcx/XTablesSupplier.hpp"
+#include "com/sun/star/sheet/XCellRangeData.hpp"
+#include "com/sun/star/style/BreakType.hpp"
+#include "com/sun/star/style/DropCapFormat.hpp"
+#include "com/sun/star/style/GraphicLocation.hpp"
+#include "com/sun/star/style/LineNumberPosition.hpp"
+#include "com/sun/star/style/LineSpacing.hpp"
+#include "com/sun/star/style/LineSpacingMode.hpp"
+#include "com/sun/star/style/NumberingType.hpp"
+#include "com/sun/star/style/PageStyleLayout.hpp"
+#include "com/sun/star/style/ParagraphAdjust.hpp"
+#include "com/sun/star/style/ParagraphStyleCategory.hpp"
+#include "com/sun/star/style/VerticalAlignment.hpp"
+#include "com/sun/star/style/XStyle.hpp"
+#include "com/sun/star/style/XStyleFamiliesSupplier.hpp"
+#include "com/sun/star/style/XStyleLoader.hpp"
+#include "com/sun/star/table/CellContentType.hpp"
+#include "com/sun/star/table/TableSortField.hpp"
+#include "com/sun/star/table/XAutoFormattable.hpp"
+#include "com/sun/star/table/XCellRange.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XJob.hpp"
+#include "com/sun/star/task/XStatusIndicatorFactory.hpp"
+#include "com/sun/star/text/BibliographyDataField.hpp"
+#include "com/sun/star/text/ChapterFormat.hpp"
+#include "com/sun/star/text/ControlCharacter.hpp"
+#include "com/sun/star/text/DocumentStatistic.hpp"
+#include "com/sun/star/text/FilenameDisplayFormat.hpp"
+#include "com/sun/star/text/FootnoteNumbering.hpp"
+#include "com/sun/star/text/GraphicCrop.hpp"
+#include "com/sun/star/text/HoriOrientation.hpp"
+#include "com/sun/star/text/HoriOrientationFormat.hpp"
+#include "com/sun/star/text/HorizontalAdjust.hpp"
+#include "com/sun/star/text/InvalidTextContentException.hpp"
+#include "com/sun/star/text/MailMergeEvent.hpp"
+#include "com/sun/star/text/MailMergeType.hpp"
+#include "com/sun/star/text/NotePrintMode.hpp"
+#include "com/sun/star/text/PageNumberType.hpp"
+#include "com/sun/star/text/PlaceholderType.hpp"
+#include "com/sun/star/text/PositionLayoutDir.hpp"
+#include "com/sun/star/text/ReferenceFieldPart.hpp"
+#include "com/sun/star/text/ReferenceFieldSource.hpp"
+#include "com/sun/star/text/RelOrientation.hpp"
+#include "com/sun/star/text/RubyAdjust.hpp"
+#include "com/sun/star/text/SectionFileLink.hpp"
+#include "com/sun/star/text/SetVariableType.hpp"
+#include "com/sun/star/text/SizeType.hpp"
+#include "com/sun/star/text/TableColumnSeparator.hpp"
+#include "com/sun/star/text/TemplateDisplayFormat.hpp"
+#include "com/sun/star/text/TextContentAnchorType.hpp"
+#include "com/sun/star/text/TextGridMode.hpp"
+#include "com/sun/star/text/UserDataPart.hpp"
+#include "com/sun/star/text/UserFieldFormat.hpp"
+#include "com/sun/star/text/VertOrientation.hpp"
+#include "com/sun/star/text/VertOrientationFormat.hpp"
+#include "com/sun/star/text/WrapInfluenceOnPosition.hpp"
+#include "com/sun/star/text/WrapTextMode.hpp"
+#include "com/sun/star/text/XAutoTextContainer.hpp"
+#include "com/sun/star/text/XAutoTextEntry.hpp"
+#include "com/sun/star/text/XAutoTextGroup.hpp"
+#include "com/sun/star/text/XBookmarksSupplier.hpp"
+#include "com/sun/star/text/XChapterNumberingSupplier.hpp"
+#include "com/sun/star/text/XDefaultNumberingProvider.hpp"
+#include "com/sun/star/text/XDependentTextField.hpp"
+#include "com/sun/star/text/XDocumentIndex.hpp"
+#include "com/sun/star/text/XDocumentIndexMark.hpp"
+#include "com/sun/star/text/XDocumentIndexesSupplier.hpp"
+#include "com/sun/star/text/XEndnotesSettingsSupplier.hpp"
+#include "com/sun/star/text/XEndnotesSupplier.hpp"
+#include "com/sun/star/text/XFootnote.hpp"
+#include "com/sun/star/text/XFootnotesSettingsSupplier.hpp"
+#include "com/sun/star/text/XFootnotesSupplier.hpp"
+#include "com/sun/star/text/XLineNumberingProperties.hpp"
+#include "com/sun/star/text/XMailMergeBroadcaster.hpp"
+#include "com/sun/star/text/XMailMergeListener.hpp"
+#include "com/sun/star/text/XModule.hpp"
+#include "com/sun/star/text/XNumberingTypeInfo.hpp"
+#include "com/sun/star/text/XPageCursor.hpp"
+#include "com/sun/star/text/XPagePrintable.hpp"
+#include "com/sun/star/text/XParagraphCursor.hpp"
+#include "com/sun/star/text/XReferenceMarksSupplier.hpp"
+#include "com/sun/star/text/XRelativeTextContentInsert.hpp"
+#include "com/sun/star/text/XRelativeTextContentRemove.hpp"
+#include "com/sun/star/text/XRubySelection.hpp"
+#include "com/sun/star/text/XSentenceCursor.hpp"
+#include "com/sun/star/text/XText.hpp"
+#include "com/sun/star/text/XTextColumns.hpp"
+#include "com/sun/star/text/XTextContent.hpp"
+#include "com/sun/star/text/XTextCursor.hpp"
+#include "com/sun/star/text/XTextDocument.hpp"
+#include "com/sun/star/text/XTextEmbeddedObject.hpp"
+#include "com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp"
+#include "com/sun/star/text/XTextField.hpp"
+#include "com/sun/star/text/XTextFieldsSupplier.hpp"
+#include "com/sun/star/text/XTextFrame.hpp"
+#include "com/sun/star/text/XTextFramesSupplier.hpp"
+#include "com/sun/star/text/XTextGraphicObjectsSupplier.hpp"
+#include "com/sun/star/text/XTextRange.hpp"
+#include "com/sun/star/text/XTextRangeCompare.hpp"
+#include "com/sun/star/text/XTextSection.hpp"
+#include "com/sun/star/text/XTextSectionsSupplier.hpp"
+#include "com/sun/star/text/XTextTable.hpp"
+#include "com/sun/star/text/XTextTableCursor.hpp"
+#include "com/sun/star/text/XTextTablesSupplier.hpp"
+#include "com/sun/star/text/XTextViewCursor.hpp"
+#include "com/sun/star/text/XTextViewCursorSupplier.hpp"
+#include "com/sun/star/text/XWordCursor.hpp"
+#include "com/sun/star/ucb/CommandAbortedException.hpp"
+#include "com/sun/star/ucb/InteractiveAppException.hpp"
+#include "com/sun/star/ucb/TransferInfo.hpp"
+#include "com/sun/star/ucb/XCommandEnvironment.hpp"
+#include "com/sun/star/ucb/XContent.hpp"
+#include "com/sun/star/ucb/XContentIdentifier.hpp"
+#include "com/sun/star/ucb/XContentProvider.hpp"
+#include "com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp"
+#include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
+#include "com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp"
+#include "com/sun/star/ui/dialogs/ListboxControlActions.hpp"
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
+#include "com/sun/star/ui/dialogs/XFilePicker.hpp"
+#include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp"
+#include "com/sun/star/ui/dialogs/XFilterManager.hpp"
+#include "com/sun/star/ui/dialogs/XFolderPicker.hpp"
+#include "com/sun/star/uno/Any.h"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.h"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/XCurrentContext.hpp"
+#include "com/sun/star/uno/XNamingService.hpp"
+#include "com/sun/star/uri/XUriReferenceFactory.hpp"
+#include "com/sun/star/uri/XVndSunStarScriptUrl.hpp"
+#include "com/sun/star/util/CloseVetoException.hpp"
+#include "com/sun/star/util/Date.hpp"
+#include "com/sun/star/util/DateTime.hpp"
+#include "com/sun/star/util/DateTimeRange.hpp"
+#include "com/sun/star/util/SearchFlags.hpp"
+#include "com/sun/star/util/SearchOptions.hpp"
+#include "com/sun/star/util/Time.hpp"
+#include "com/sun/star/util/XArchiver.hpp"
+#include "com/sun/star/util/XCloseable.hpp"
+#include "com/sun/star/util/XLinkUpdate.hpp"
+#include "com/sun/star/util/XModifiable.hpp"
+#include "com/sun/star/util/XModifyBroadcaster.hpp"
+#include "com/sun/star/util/XModifyListener.hpp"
+#include "com/sun/star/util/XNumberFormatTypes.hpp"
+#include "com/sun/star/util/XNumberFormatsSupplier.hpp"
+#include "com/sun/star/util/XPropertyReplace.hpp"
+#include "com/sun/star/util/XRefreshListener.hpp"
+#include "com/sun/star/util/XRefreshable.hpp"
+#include "com/sun/star/util/XReplaceDescriptor.hpp"
+#include "com/sun/star/util/XReplaceable.hpp"
+#include "com/sun/star/util/XSortable.hpp"
+#include "com/sun/star/util/XURLTransformer.hpp"
+#include "com/sun/star/util/XUpdatable.hpp"
+#include "com/sun/star/view/DocumentZoomType.hpp"
+#include "com/sun/star/view/XLineCursor.hpp"
+#include "com/sun/star/view/XPrintSettingsSupplier.hpp"
+#include "com/sun/star/view/XRenderable.hpp"
+#include "com/sun/star/view/XScreenCursor.hpp"
+#include "com/sun/star/view/XSelectionChangeListener.hpp"
+#include "com/sun/star/view/XSelectionSupplier.hpp"
+#include "com/sun/star/view/XViewCursor.hpp"
+#include "com/sun/star/view/XViewSettingsSupplier.hpp"
+#include "com/sun/star/xforms/XFormsSupplier.hpp"
+#include "com/sun/star/xforms/XFormsUIHelper1.hpp"
+#include "com/sun/star/xforms/XModel.hpp"
+#include "com/sun/star/xml/sax/InputSource.hpp"
+#include "com/sun/star/xml/sax/XAttributeList.hpp"
+#include "com/sun/star/xml/sax/XDocumentHandler.hpp"
+#include "com/sun/star/xml/sax/XParser.hpp"
+
+#include "comphelper/ChainablePropertySet.hxx"
+#include "comphelper/ChainablePropertySetInfo.hxx"
+#include "comphelper/MasterPropertySet.hxx"
+#include "comphelper/MasterPropertySetInfo.hxx"
+#include "comphelper/SettingsHelper.hxx"
+#include "comphelper/TypeGeneration.hxx"
+#include "comphelper/accessibleeventnotifier.hxx"
+#include "comphelper/accessiblekeybindinghelper.hxx"
+#include "comphelper/classids.hxx"
+#include "comphelper/embeddedobjectcontainer.hxx"
+#include "comphelper/mediadescriptor.hxx"
+#include "comphelper/processfactory.hxx"
+#include "comphelper/seqstream.hxx"
+#include "comphelper/storagehelper.hxx"
+#include "comphelper/types.hxx"
+#include "comphelper/uno3.hxx"
+
+
+#include "cppuhelper/bootstrap.hxx"
+#include "cppuhelper/compbase1.hxx"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/implbase10.hxx"
+#include "cppuhelper/implbase11.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/implbase3.hxx"
+#include "cppuhelper/implbase4.hxx"
+#include "cppuhelper/implbase5.hxx"
+#include "cppuhelper/implbase6.hxx"
+#include "cppuhelper/implbase7.hxx"
+#include "cppuhelper/implbase8.hxx"
+#include "cppuhelper/implbase9.hxx"
+#include "cppuhelper/implbase_ex.hxx"
+#include "cppuhelper/implbase_ex_post.hxx"
+#include "cppuhelper/implbase_ex_pre.hxx"
+#include "cppuhelper/interfacecontainer.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakref.hxx"
+
+#include "framework/interaction.hxx"
+
+#include "svtools/grfmgr.hxx"
+#include "svl/mailenum.hxx"
+
+#include "i18npool/lang.h"
+#include "i18npool/mslangid.hxx"
+
+#include "linguistic/lngprops.hxx"
+
+#include "osl/conditn.hxx"
+#include "osl/diagnose.h"
+#include "osl/endian.h"
+#include "osl/file.hxx"
+#include "osl/interlck.h"
+#include "osl/module.h"
+#include "osl/module.hxx"
+#include "osl/mutex.hxx"
+#include "osl/thread.hxx"
+
+#include "rsc/rscsfx.hxx"
+
+#include "rtl/logfile.hxx"
+#include "rtl/math.hxx"
+#include "rtl/memory.h"
+#include "rtl/string.h"
+#include "rtl/string.hxx"
+#include "rtl/tencinfo.h"
+#include "rtl/textenc.h"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "rtl/uuid.h"
+
+#include "salhelper/condition.hxx"
+
+#include "sfx2/app.hxx"
+#include "sfx2/appuno.hxx"
+#include "sfx2/basedlgs.hxx"
+#include "sfx2/bindings.hxx"
+#include "sfx2/childwin.hxx"
+#include "sfx2/ctrlitem.hxx"
+#include "sfx2/dinfdlg.hxx"
+#include "sfx2/dispatch.hxx"
+#include "sfx2/docfilt.hxx"
+#include "sfx2/docinf.hxx"
+#include "sfx2/dockwin.hxx"
+#include "sfx2/doctempl.hxx"
+#include "sfx2/event.hxx"
+#include "sfx2/fcontnr.hxx"
+#include "sfx2/filedlghelper.hxx"
+#include "sfx2/frame.hxx"
+#include "sfx2/frmdescr.hxx"
+#include "sfx2/imagemgr.hxx"
+#include "sfx2/imgmgr.hxx"
+#include "sfx2/linkmgr.hxx"
+#include "sfx2/linksrc.hxx"
+#include "sfx2/lnkbase.hxx"
+#include "sfx2/mieclip.hxx"
+#include "sfx2/mnumgr.hxx"
+#include "sfx2/module.hxx"
+#include "sfx2/msg.hxx"
+#include "sfx2/msgpool.hxx"
+#include "sfx2/new.hxx"
+#include "sfx2/newstyle.hxx"
+#include "sfx2/objface.hxx"
+#include "sfx2/objitem.hxx"
+#include "sfx2/passwd.hxx"
+#include "sfx2/printer.hxx"
+#include "sfx2/prnmon.hxx"
+#include "sfx2/progress.hxx"
+#include "sfx2/request.hxx"
+#include "sfx2/sfx.hrc"
+#include "sfx2/sfxdefs.hxx"
+#include "sfx2/sfxdlg.hxx"
+#include "sfx2/sfxhelp.hxx"
+#include "sfx2/sfxsids.hrc"
+#include "sfx2/sfxuno.hxx"
+#include "sfx2/shell.hxx"
+#include "sfx2/styfitem.hxx"
+#include "sfx2/styledlg.hxx"
+#include "sfx2/tabdlg.hxx"
+#include "sfx2/tbxctrl.hxx"
+#include "sfx2/templdlg.hxx"
+#include "sfx2/tplpitem.hxx"
+#include "sfx2/viewfac.hxx"
+#include "sfx2/viewfrm.hxx"
+#include "sfx2/viewsh.hxx"
+
+#include "sot/clsids.hxx"
+#include "sot/exchange.hxx"
+#include "sot/factory.hxx"
+#include "sot/filelist.hxx"
+#include "sot/formats.hxx"
+#include "sot/stg.hxx"
+#include "sot/storage.hxx"
+#include "sot/storinfo.hxx"
+
+#include "svtools/FilterConfigItem.hxx"
+#include "svl/PasswordHelper.hxx"
+#include "svtools/accessibilityoptions.hxx"
+#include "svl/aeitem.hxx"
+#include "svl/cjkoptions.hxx"
+#include "unotools/cmdoptions.hxx"
+#include "svl/cntnrsrt.hxx"
+#include "svtools/collatorres.hxx"
+#include "svtools/colorcfg.hxx"
+#include "unotools/compatibility.hxx"
+#include "svtools/controldims.hrc"
+#include "svl/ctloptions.hxx"
+#include "svtools/ctrlbox.hxx"
+#include "svtools/ctrltool.hxx"
+#include "svtools/editbrowsebox.hxx"
+#include "svtools/ehdl.hxx"
+#include "svl/eitem.hxx"
+#include "svtools/embedhlp.hxx"
+#include "svtools/embedtransfer.hxx"
+#include "svtools/filter.hxx"
+#include "svl/flagitem.hxx"
+#include "unotools/fltrcfg.hxx"
+#include "svl/fstathelper.hxx"
+#include "svl/globalnameitem.hxx"
+#include "svtools/headbar.hxx"
+#include "svtools/htmlkywd.hxx"
+#include "svtools/htmltokn.h"
+#include "svl/imageitm.hxx"
+#include "svtools/imap.hxx"
+#include "svtools/indexentryres.hxx"
+#include "svl/inethist.hxx"
+#include "svtools/inetimg.hxx"
+#include "svtools/insdlg.hxx"
+#include "svl/intitem.hxx"
+#include "svl/isethint.hxx"
+#include "svl/itemiter.hxx"
+#include "svl/itempool.hxx"
+#include "svl/itemprop.hxx"
+#include "svl/itemset.hxx"
+#include "svl/languageoptions.hxx"
+#include "svl/lckbitem.hxx"
+#include "unotools/lingucfg.hxx"
+#include "unotools/linguprops.hxx"
+#include "svl/lstner.hxx"
+#include "unotools/misccfg.hxx"
+#include "unotools/moduleoptions.hxx"
+#include "svl/numuno.hxx"
+#include "svl/ownlist.hxx"
+#include "svtools/parhtml.hxx"
+#include "unotools/pathoptions.hxx"
+#include "svl/poolitem.hxx"
+#include "svtools/prgsbar.hxx"
+#include "svtools/prnsetup.hxx"
+#include "svl/ptitem.hxx"
+#include "svl/rectitem.hxx"
+#include "svtools/rtfkeywd.hxx"
+#include "svtools/rtfout.hxx"
+#include "svtools/rtftoken.h"
+#include "svtools/ruler.hxx"
+#include "unotools/saveopt.hxx"
+#include "svtools/scriptedtext.hxx"
+#include "svtools/sfxecode.hxx"
+#include "svl/slstitm.hxx"
+#include "svl/smplhint.hxx"
+#include "svtools/soerr.hxx"
+#include "svl/solar.hrc"
+#include "unotools/sourceviewconfig.hxx"
+#include "svtools/stdctrl.hxx"
+#include "svl/stritem.hxx"
+#include "svl/style.hrc"
+#include "svl/style.hxx"
+#include "svl/svarray.hxx"
+#include "svtools/svmedit.hxx"
+#include "svtools/svparser.hxx"
+#include "svl/svstdarr.hxx"
+#include "svtools/svtabbx.hxx"
+#include "svtools/svtreebx.hxx"
+#include "unotools/syslocale.hxx"
+#include "svtools/templdlg.hxx"
+#include "svtools/textview.hxx"
+#include "svtools/transfer.hxx"
+#include "svtools/txtattr.hxx"
+#include "svtools/txtcmp.hxx"
+#include "svl/undo.hxx"
+#include "unotools/undoopt.hxx"
+#include "svtools/unoevent.hxx"
+#include "svtools/unoimap.hxx"
+#include "svl/urihelper.hxx"
+#include "svl/urlbmk.hxx"
+#include "unotools/useroptions.hxx"
+#include "svtools/valueset.hxx"
+#include "svl/visitem.hxx"
+#include "svl/whiter.hxx"
+#include "svtools/xtextedt.hxx"
+
+#include "svx/IAccessibleParent.hxx"
+#include "svx/IAccessibleViewForwarder.hxx"
+#include "svx/SpellDialogChildWindow.hxx"
+#include "editeng/SpellPortions.hxx"
+#include "editeng/UnoForbiddenCharsTable.hxx"
+#include "editeng/acorrcfg.hxx"
+#include "svx/anchorid.hxx"
+#include "svl/asiancfg.hxx"
+#include "svx/checklbx.hxx"
+#include "svx/clipboardctl.hxx"
+#include "svx/clipfmtitem.hxx"
+#include "svx/contdlg.hxx"
+#include "svx/ctredlin.hxx"
+#include "svx/dataaccessdescriptor.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/dialogs.hrc"
+#include "svx/dlgutil.hxx"
+#include "editeng/editdata.hxx"
+#include "editeng/editeng.hxx"
+#include "editeng/editobj.hxx"
+#include "editeng/editstat.hxx"
+#include "editeng/editview.hxx"
+#include "editeng/eeitem.hxx"
+#include "filter/msfilter/escherex.hxx"
+#include "svx/extrusionbar.hxx"
+#include "svx/extrusioncolorcontrol.hxx"
+#include "svx/fillctrl.hxx"
+#include "svx/flagsdef.hxx"
+#include "editeng/flstitem.hxx"
+#include "svx/fmdmod.hxx"
+#include "svx/fmglob.hxx"
+#include "svx/fmobjfac.hxx"
+#include "svx/fmpage.hxx"
+#include "svx/fntctrl.hxx"
+#include "svx/fontwork.hxx"
+#include "svx/fontworkbar.hxx"
+#include "svx/fontworkgallery.hxx"
+#include "editeng/forbiddencharacterstable.hxx"
+#include "svx/formatpaintbrushctrl.hxx"
+#include "editeng/frmdir.hxx"
+#include "svx/galbrws.hxx"
+#include "svx/gallery.hxx"
+#include "svx/globlmn.hrc"
+#include "svx/grafctrl.hxx"
+#include "editeng/hangulhanja.hxx"
+#include "svx/hdft.hxx"
+#include "svtools/htmlcfg.hxx"
+#include "svx/htmlmode.hxx"
+#include "svx/hyperdlg.hxx"
+#include "svx/hyprlink.hxx"
+#include "svx/imapdlg.hxx"
+#include "editeng/itemtype.hxx"
+#include "svx/langbox.hxx"
+#include "svx/layctrl.hxx"
+#include "svx/lboxctrl.hxx"
+#include "svx/linectrl.hxx"
+#include "sfx2/linkmgr.hxx"
+#include "filter/msfilter/mscodec.hxx"
+#include "filter/msfilter/msdffimp.hxx"
+#include "filter/msfilter/msfiltertracer.hxx"
+#include "filter/msfilter/msocximex.hxx"
+#include "filter/msfilter/msoleexp.hxx"
+#include "editeng/numitem.hxx"
+#include "svx/numvset.hxx"
+#include "svx/objfac3d.hxx"
+#include "svx/ofaitem.hxx"
+#include "svx/optgenrl.hxx"
+#include "svx/optgrid.hxx"
+#include "editeng/outliner.hxx"
+#include "editeng/outlobj.hxx"
+#include "svx/pagectrl.hxx"
+#include "editeng/paperinf.hxx"
+#include "svx/paraprev.hxx"
+#include "svx/pfiledlg.hxx"
+#include "svx/prtqry.hxx"
+#include "svx/rectenum.hxx"
+#include "svx/rotmodit.hxx"
+#include "svx/rubydialog.hxx"
+#include "svx/ruler.hxx"
+#include "svx/rulritem.hxx"
+#include "editeng/scripttypeitem.hxx"
+#include "svx/sdgcoitm.hxx"
+#include "svx/sdggaitm.hxx"
+#include "svx/sdginitm.hxx"
+#include "svx/sdgluitm.hxx"
+#include "svx/sdgmoitm.hxx"
+#include "svx/sdgtritm.hxx"
+#include "svx/sdr/contact/displayinfo.hxx"
+#include "svx/sdr/contact/objectcontactofobjlistpainter.hxx"
+#include "svx/sdr/contact/viewcontactofsdrmediaobj.hxx"
+#include "svx/sdr/properties/defaultproperties.hxx"
+#include "svx/sdtaaitm.hxx"
+#include "svx/sdtacitm.hxx"
+#include "svx/sdtaditm.hxx"
+#include "svx/sdtagitm.hxx"
+#include "svx/sdtaitm.hxx"
+#include "svx/sdtakitm.hxx"
+#include "svx/simptabl.hxx"
+#include "editeng/splwrap.hxx"
+#include "svx/srchdlg.hxx"
+#include "svx/stddlg.hxx"
+#include "svx/strarray.hxx"
+#include "svx/xflasit.hxx"
+#include "svx/xflclit.hxx"
+#include "svx/xflgrit.hxx"
+#include "svx/xflhtit.hxx"
+#include "svx/xfltrit.hxx"
+#include "svx/xftadit.hxx"
+#include "svx/xftdiit.hxx"
+#include "svx/xftmrit.hxx"
+#include "svx/xftouit.hxx"
+#include "svx/xftsfit.hxx"
+#include "svx/xftshcit.hxx"
+#include "svx/xftshit.hxx"
+#include "svx/xftshxy.hxx"
+#include "svx/xftstit.hxx"
+#include "svx/xgrad.hxx"
+#include "svx/xlineit.hxx"
+#include "svx/xlineit0.hxx"
+#include "svx/xlnclit.hxx"
+#include "svx/xlndsit.hxx"
+#include "svx/xlnedit.hxx"
+#include "svx/xlnstit.hxx"
+#include "svx/xlnwtit.hxx"
+#include "svx/xmleohlp.hxx"
+#include "svx/xmlexchg.hxx"
+#include "svx/xmlgrhlp.hxx"
+#include "svx/xoutbmp.hxx"
+#include "svx/xpoly.hxx"
+#include "svx/xtable.hxx"
+#include "svx/xtextit0.hxx"
+#include "svx/zoomitem.hxx"
+
+#include "sys/stat.h"
+#include "sys/types.h"
+
+#include "toolkit/helper/vclunohelper.hxx"
+#include "toolkit/unohlp.hxx"
+
+#include "tools/bigint.hxx"
+#include "tools/cachestr.hxx"
+#include "tools/color.hxx"
+#include "tools/date.hxx"
+#include "tools/datetime.hxx"
+#include "tools/debug.hxx"
+#include "tools/errcode.hxx"
+#include "tools/errinf.hxx"
+#include "tools/fract.hxx"
+#include "tools/gen.hxx"
+#include "tools/globname.hxx"
+#include "tools/link.hxx"
+#include "tools/list.hxx"
+#include "tools/mempool.hxx"
+#include "tools/multisel.hxx"
+#include "tools/poly.hxx"
+#include "tools/pstm.hxx"
+#include "tools/rc.hxx"
+#include "tools/ref.hxx"
+#include "tools/resary.hxx"
+#include "tools/resid.hxx"
+#include "tools/resmgr.hxx"
+#include "tools/rtti.hxx"
+#include "tools/shl.hxx"
+#include "tools/solar.h"
+#include "tools/stream.hxx"
+#include "tools/string.hxx"
+#include "tools/table.hxx"
+#include "tools/tempfile.hxx"
+#include "tools/time.hxx"
+#include "tools/urlobj.hxx"
+
+#include "ucbhelper/commandenvironment.hxx"
+#include "ucbhelper/content.hxx"
+#include "ucbhelper/contentbroker.hxx"
+#include "ucbhelper/contentidentifier.hxx"
+
+#include "unicode/ubidi.h"
+
+#include "uno/lbnames.h"
+
+#include "unotools/accessiblerelationsethelper.hxx"
+#include "unotools/accessiblestatesethelper.hxx"
+#include "unotools/calendarwrapper.hxx"
+#include "unotools/charclass.hxx"
+#include "unotools/collatorwrapper.hxx"
+#include "unotools/configitem.hxx"
+#include "unotools/configmgr.hxx"
+#include "unotools/confignode.hxx"
+#include "unotools/configpathes.hxx"
+#include "unotools/intlwrapper.hxx"
+#include "unotools/localedatawrapper.hxx"
+#include "unotools/localfilehelper.hxx"
+#include "unotools/processfactory.hxx"
+#include "unotools/streamwrap.hxx"
+#include "unotools/tempfile.hxx"
+#include "unotools/transliterationwrapper.hxx"
+#include "unotools/ucbstreamhelper.hxx"
+
+#include "vcl/bitmap.hxx"
+#include "vcl/button.hxx"
+#include "vcl/cmdevt.h"
+#include "vcl/cmdevt.hxx"
+#include "vcl/combobox.hxx"
+#include "vcl/cursor.hxx"
+#include "vcl/cvtgrf.hxx"
+#include "vcl/dialog.hxx"
+#include "vcl/edit.hxx"
+#include "vcl/event.hxx"
+#include "vcl/field.hxx"
+#include "vcl/fixed.hxx"
+#include "tools/fldunit.hxx"
+#include "vcl/font.hxx"
+#include "unotools/fontcvt.hxx"
+#include "vcl/graph.hxx"
+#include "vcl/group.hxx"
+#include "vcl/help.hxx"
+#include "vcl/image.hxx"
+#include "vcl/button.hxx"
+#include "vcl/inputctx.hxx"
+#include "vcl/jobset.hxx"
+#include "vcl/keycod.hxx"
+#include "vcl/keycodes.hxx"
+#include "vcl/lstbox.hxx"
+#include "vcl/mapmod.hxx"
+#include "vcl/menu.hxx"
+#include "vcl/menubtn.hxx"
+#include "vcl/metric.hxx"
+#include "vcl/mnemonic.hxx"
+#include "vcl/morebtn.hxx"
+#include "vcl/msgbox.hxx"
+#include "vcl/outdev.hxx"
+#include "vcl/pdfextoutdevdata.hxx"
+#include "vcl/print.hxx"
+#include "vcl/region.hxx"
+#include "vcl/salbtype.hxx"
+#include "vcl/scrbar.hxx"
+#include "vcl/settings.hxx"
+#include "vcl/sound.hxx"
+#include "vcl/status.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/syswin.hxx"
+#include "vcl/timer.hxx"
+#include "vcl/toolbox.hxx"
+#include "vcl/vclenum.hxx"
+#include "vcl/virdev.hxx"
+#include "vcl/waitobj.hxx"
+#include "vcl/window.hxx"
+#include "tools/wintypes.hxx"
+#include "vcl/wrkwin.hxx"
+
+#include "vos/mutex.hxx"
+#include "vos/ref.hxx"
+
+#include "xmloff/DocumentSettingsContext.hxx"
+#include "xmloff/ProgressBarHelper.hxx"
+#include "xmloff/XMLBase64ImportContext.hxx"
+#include "xmloff/XMLFilterServiceNames.h"
+#include "xmloff/XMLFontAutoStylePool.hxx"
+#include "xmloff/XMLFontStylesContext.hxx"
+#include "xmloff/XMLGraphicsDefaultStyle.hxx"
+#include "xmloff/XMLTextListAutoStylePool.hxx"
+#include "xmloff/XMLTextMasterPageExport.hxx"
+#include "xmloff/XMLTextMasterStylesContext.hxx"
+#include "xmloff/XMLTextShapeImportHelper.hxx"
+#include "xmloff/XMLTextShapeStyleContext.hxx"
+#include "xmloff/XMLTextTableContext.hxx"
+#include "xmloff/attrlist.hxx"
+#include "xmloff/families.hxx"
+#include "xmloff/functional.hxx"
+#include "xmloff/i18nmap.hxx"
+#include "xmloff/maptype.hxx"
+#include "xmloff/nmspmap.hxx"
+#include "xmloff/numehelp.hxx"
+#include "xmloff/prhdlfac.hxx"
+#include "xmloff/prstylei.hxx"
+#include "xmloff/txtparae.hxx"
+#include "xmloff/txtprmap.hxx"
+#include "xmloff/txtstyli.hxx"
+#include "xmloff/uniref.hxx"
+#include "xmloff/xformsimport.hxx"
+#include "xmloff/xmlaustp.hxx"
+#include "xmloff/xmlement.hxx"
+#include "xmloff/xmlexp.hxx"
+#include "xmloff/xmlictxt.hxx"
+#include "xmloff/xmlmetae.hxx"
+#include "xmloff/xmlmetai.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "xmloff/xmlprmap.hxx"
+#include "xmloff/xmlscripti.hxx"
+#include "xmloff/xmlstyle.hxx"
+#include "xmloff/xmltabe.hxx"
+#include "xmloff/xmltkmap.hxx"
+#include "xmloff/xmltoken.hxx"
+#include "xmloff/xmltypes.hxx"
+#include "xmloff/xmluconv.hxx"
+//---MARKER---
+
+#endif
diff --git a/sw/inc/poolfmt.awk b/sw/inc/poolfmt.awk
new file mode 100644
index 000000000000..42e31bab981e
--- /dev/null
+++ b/sw/inc/poolfmt.awk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+#
+# Dieses awk-script generiert ein cxx-file, das alle PoolIds der Vorlage dumpt.
+# wird fuer den HelpPI gebraucht.
+# Aufruf: awk -f poolid.awk poolfmt.hxx > poolid.cxx
+# cl poolid.cxx
+# poolid.exe > ???.hrc
+#
+
+function Header() {
+ print "// This is an outputfile of an awk-script: $Workfile: poolfmt.awk $"
+ print "#include <solar.h> "
+ print
+ print "#include <stdio.h>"
+ print "#include <stdlib.h>"
+ print
+ print "#pragma hdrstop"
+ print
+ print "#include <iostream.hxx> "
+ print "#include \"poolfmt.hxx\""
+ print
+}
+
+function Main() {
+ print
+ print "void main( int , char *[] ) {"
+ sStr = "#define"
+ print " int nSize = (sizeof(ppPoolIds) / sizeof(PoolFmtIds)) - 1;"
+ print " for( int n = 0; n < nSize; n++ )"
+ print " printf( \"" sStr " %s\\t%8d\\n\", ppPoolIds[ n ].pStr, ppPoolIds[ n ].nId );"
+ print "}"
+}
+
+function TableHead() {
+ print
+ print "struct PoolFmtIds { int nId; const char* pStr; };"
+ print "static PoolFmtIds ppPoolIds[] = {"
+}
+
+function TableTail() {
+ print " 0, \"\" };"
+ print
+}
+
+BEGIN {
+ Header();
+ TableHead();
+}
+
+/^[ \t]*RES_/ && !index( $1, "_BEGIN" ) && !index( $1, "_END" ) && !index( $1, "_POOL_" ) {
+ sStr = $1;
+ split( $1, sStr, "," );
+ print " " sStr[1] ", \"" sStr[1] "\","
+}
+
+END {
+ TableTail();
+ Main();
+}
+
diff --git a/sw/inc/poolfmt.hrc b/sw/inc/poolfmt.hrc
new file mode 100644
index 000000000000..e68de680c243
--- /dev/null
+++ b/sw/inc/poolfmt.hrc
@@ -0,0 +1,288 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _POOLFMT_HRC
+#define _POOLFMT_HRC
+
+#include "rcid.hrc"
+
+// ---------------
+// die Formate
+// ---------------
+
+// Zeichenvorlagen:
+#define STR_POOLCHR_FOOTNOTE (RC_POOLCHRFMT_BEGIN+ 0)
+#define STR_POOLCHR_PAGENO (RC_POOLCHRFMT_BEGIN+ 1)
+#define STR_POOLCHR_LABEL (RC_POOLCHRFMT_BEGIN+ 2)
+#define STR_POOLCHR_DROPCAPS (RC_POOLCHRFMT_BEGIN+ 3)
+#define STR_POOLCHR_NUM_LEVEL (RC_POOLCHRFMT_BEGIN+ 4)
+#define STR_POOLCHR_BUL_LEVEL (RC_POOLCHRFMT_BEGIN+ 5)
+#define STR_POOLCHR_INET_NORMAL (RC_POOLCHRFMT_BEGIN+ 6)
+#define STR_POOLCHR_INET_VISIT (RC_POOLCHRFMT_BEGIN+ 7)
+#define STR_POOLCHR_JUMPEDIT (RC_POOLCHRFMT_BEGIN+ 8)
+#define STR_POOLCHR_TOXJUMP (RC_POOLCHRFMT_BEGIN+ 9)
+#define STR_POOLCHR_ENDNOTE (RC_POOLCHRFMT_BEGIN+ 10)
+#define STR_POOLCHR_LINENUM (RC_POOLCHRFMT_BEGIN+ 11)
+#define STR_POOLCHR_IDX_MAIN_ENTRY (RC_POOLCHRFMT_BEGIN+ 12)
+#define STR_POOLCHR_FOOTNOTE_ANCHOR (RC_POOLCHRFMT_BEGIN+ 13)
+#define STR_POOLCHR_ENDNOTE_ANCHOR (RC_POOLCHRFMT_BEGIN+ 14)
+#define STR_POOLCHR_RUBYTEXT (RC_POOLCHRFMT_BEGIN+ 15)
+#define STR_POOLCHR_VERT_NUM (RC_POOLCHRFMT_BEGIN+ 16)
+
+#define STR_POOLCHR_HTML_EMPHASIS (RC_POOLCHRFMT_HTML_BEGIN+ 0)
+#define STR_POOLCHR_HTML_CITIATION (RC_POOLCHRFMT_HTML_BEGIN+ 1)
+#define STR_POOLCHR_HTML_STRONG (RC_POOLCHRFMT_HTML_BEGIN+ 2)
+#define STR_POOLCHR_HTML_CODE (RC_POOLCHRFMT_HTML_BEGIN+ 3)
+#define STR_POOLCHR_HTML_SAMPLE (RC_POOLCHRFMT_HTML_BEGIN+ 4)
+#define STR_POOLCHR_HTML_KEYBOARD (RC_POOLCHRFMT_HTML_BEGIN+ 5)
+#define STR_POOLCHR_HTML_VARIABLE (RC_POOLCHRFMT_HTML_BEGIN+ 6)
+#define STR_POOLCHR_HTML_DEFINSTANCE (RC_POOLCHRFMT_HTML_BEGIN+ 7)
+#define STR_POOLCHR_HTML_TELETYPE (RC_POOLCHRFMT_HTML_BEGIN+ 8)
+
+// Rahmen-Vorlagen:
+#define STR_POOLFRM_FRAME (RC_POOLFRMFMT_BEGIN+ 0)
+#define STR_POOLFRM_GRAPHIC (RC_POOLFRMFMT_BEGIN+ 1)
+#define STR_POOLFRM_OLE (RC_POOLFRMFMT_BEGIN+ 2)
+#define STR_POOLFRM_FORMEL (RC_POOLFRMFMT_BEGIN+ 3)
+#define STR_POOLFRM_MARGINAL (RC_POOLFRMFMT_BEGIN+ 4)
+#define STR_POOLFRM_WATERSIGN (RC_POOLFRMFMT_BEGIN+ 5)
+#define STR_POOLFRM_LABEL (RC_POOLFRMFMT_BEGIN+ 6)
+
+// ---------------
+// die Vorlagen
+// ---------------
+// Gruppe Text
+#define STR_POOLCOLL_STANDARD (RC_POOLCOLL_TEXT_BEGIN+ 0)
+#define STR_POOLCOLL_TEXT (RC_POOLCOLL_TEXT_BEGIN+ 1)
+#define STR_POOLCOLL_TEXT_IDENT (RC_POOLCOLL_TEXT_BEGIN+ 2)
+#define STR_POOLCOLL_TEXT_NEGIDENT (RC_POOLCOLL_TEXT_BEGIN+ 3)
+#define STR_POOLCOLL_TEXT_MOVE (RC_POOLCOLL_TEXT_BEGIN+ 4)
+#define STR_POOLCOLL_GREETING (RC_POOLCOLL_TEXT_BEGIN+ 5)
+#define STR_POOLCOLL_SIGNATURE (RC_POOLCOLL_TEXT_BEGIN+ 6)
+#define STR_POOLCOLL_CONFRONTATION (RC_POOLCOLL_TEXT_BEGIN+ 7)
+#define STR_POOLCOLL_MARGINAL (RC_POOLCOLL_TEXT_BEGIN+ 8)
+
+ // Untergruppierung Ueberschriften
+#define STR_POOLCOLL_HEADLINE_BASE (RC_POOLCOLL_TEXT_BEGIN+ 9)
+#define STR_POOLCOLL_HEADLINE1 (RC_POOLCOLL_TEXT_BEGIN+ 10)
+#define STR_POOLCOLL_HEADLINE2 (RC_POOLCOLL_TEXT_BEGIN+ 11)
+#define STR_POOLCOLL_HEADLINE3 (RC_POOLCOLL_TEXT_BEGIN+ 12)
+#define STR_POOLCOLL_HEADLINE4 (RC_POOLCOLL_TEXT_BEGIN+ 13)
+#define STR_POOLCOLL_HEADLINE5 (RC_POOLCOLL_TEXT_BEGIN+ 14)
+#define STR_POOLCOLL_HEADLINE6 (RC_POOLCOLL_TEXT_BEGIN+ 15)
+#define STR_POOLCOLL_HEADLINE7 (RC_POOLCOLL_TEXT_BEGIN+ 16)
+#define STR_POOLCOLL_HEADLINE8 (RC_POOLCOLL_TEXT_BEGIN+ 17)
+#define STR_POOLCOLL_HEADLINE9 (RC_POOLCOLL_TEXT_BEGIN+ 18)
+#define STR_POOLCOLL_HEADLINE10 (RC_POOLCOLL_TEXT_BEGIN+ 19)
+
+// Gruppe Listen
+#define STR_POOLCOLL_NUMBUL_BASE (RC_POOLCOLL_LISTS_BEGIN+ 0)
+ // Untergruppe Nummerierung
+#define STR_POOLCOLL_NUM_LEVEL1S (RC_POOLCOLL_LISTS_BEGIN+ 1)
+#define STR_POOLCOLL_NUM_LEVEL1 (RC_POOLCOLL_LISTS_BEGIN+ 2)
+#define STR_POOLCOLL_NUM_LEVEL1E (RC_POOLCOLL_LISTS_BEGIN+ 3)
+#define STR_POOLCOLL_NUM_NONUM1 (RC_POOLCOLL_LISTS_BEGIN+ 4)
+#define STR_POOLCOLL_NUM_LEVEL2S (RC_POOLCOLL_LISTS_BEGIN+ 5)
+#define STR_POOLCOLL_NUM_LEVEL2 (RC_POOLCOLL_LISTS_BEGIN+ 6)
+#define STR_POOLCOLL_NUM_LEVEL2E (RC_POOLCOLL_LISTS_BEGIN+ 7)
+#define STR_POOLCOLL_NUM_NONUM2 (RC_POOLCOLL_LISTS_BEGIN+ 8)
+#define STR_POOLCOLL_NUM_LEVEL3S (RC_POOLCOLL_LISTS_BEGIN+ 9)
+#define STR_POOLCOLL_NUM_LEVEL3 (RC_POOLCOLL_LISTS_BEGIN+ 10)
+#define STR_POOLCOLL_NUM_LEVEL3E (RC_POOLCOLL_LISTS_BEGIN+ 11)
+#define STR_POOLCOLL_NUM_NONUM3 (RC_POOLCOLL_LISTS_BEGIN+ 12)
+#define STR_POOLCOLL_NUM_LEVEL4S (RC_POOLCOLL_LISTS_BEGIN+ 13)
+#define STR_POOLCOLL_NUM_LEVEL4 (RC_POOLCOLL_LISTS_BEGIN+ 14)
+#define STR_POOLCOLL_NUM_LEVEL4E (RC_POOLCOLL_LISTS_BEGIN+ 15)
+#define STR_POOLCOLL_NUM_NONUM4 (RC_POOLCOLL_LISTS_BEGIN+ 16)
+#define STR_POOLCOLL_NUM_LEVEL5S (RC_POOLCOLL_LISTS_BEGIN+ 17)
+#define STR_POOLCOLL_NUM_LEVEL5 (RC_POOLCOLL_LISTS_BEGIN+ 18)
+#define STR_POOLCOLL_NUM_LEVEL5E (RC_POOLCOLL_LISTS_BEGIN+ 19)
+#define STR_POOLCOLL_NUM_NONUM5 (RC_POOLCOLL_LISTS_BEGIN+ 20)
+
+ // Untergruppe Aufzaehlung
+#define STR_POOLCOLL_BUL_LEVEL1S (RC_POOLCOLL_LISTS_BEGIN+ 21)
+#define STR_POOLCOLL_BUL_LEVEL1 (RC_POOLCOLL_LISTS_BEGIN+ 22)
+#define STR_POOLCOLL_BUL_LEVEL1E (RC_POOLCOLL_LISTS_BEGIN+ 23)
+#define STR_POOLCOLL_BUL_NONUM1 (RC_POOLCOLL_LISTS_BEGIN+ 24)
+#define STR_POOLCOLL_BUL_LEVEL2S (RC_POOLCOLL_LISTS_BEGIN+ 25)
+#define STR_POOLCOLL_BUL_LEVEL2 (RC_POOLCOLL_LISTS_BEGIN+ 26)
+#define STR_POOLCOLL_BUL_LEVEL2E (RC_POOLCOLL_LISTS_BEGIN+ 27)
+#define STR_POOLCOLL_BUL_NONUM2 (RC_POOLCOLL_LISTS_BEGIN+ 28)
+#define STR_POOLCOLL_BUL_LEVEL3S (RC_POOLCOLL_LISTS_BEGIN+ 29)
+#define STR_POOLCOLL_BUL_LEVEL3 (RC_POOLCOLL_LISTS_BEGIN+ 30)
+#define STR_POOLCOLL_BUL_LEVEL3E (RC_POOLCOLL_LISTS_BEGIN+ 31)
+#define STR_POOLCOLL_BUL_NONUM3 (RC_POOLCOLL_LISTS_BEGIN+ 32)
+#define STR_POOLCOLL_BUL_LEVEL4S (RC_POOLCOLL_LISTS_BEGIN+ 33)
+#define STR_POOLCOLL_BUL_LEVEL4 (RC_POOLCOLL_LISTS_BEGIN+ 34)
+#define STR_POOLCOLL_BUL_LEVEL4E (RC_POOLCOLL_LISTS_BEGIN+ 35)
+#define STR_POOLCOLL_BUL_NONUM4 (RC_POOLCOLL_LISTS_BEGIN+ 36)
+#define STR_POOLCOLL_BUL_LEVEL5S (RC_POOLCOLL_LISTS_BEGIN+ 37)
+#define STR_POOLCOLL_BUL_LEVEL5 (RC_POOLCOLL_LISTS_BEGIN+ 38)
+#define STR_POOLCOLL_BUL_LEVEL5E (RC_POOLCOLL_LISTS_BEGIN+ 39)
+#define STR_POOLCOLL_BUL_NONUM5 (RC_POOLCOLL_LISTS_BEGIN+ 40)
+
+// Sonderbereiche
+ // Untergruppe Header
+#define STR_POOLCOLL_HEADER (RC_POOLCOLL_EXTRA_BEGIN+ 0)
+#define STR_POOLCOLL_HEADERL (RC_POOLCOLL_EXTRA_BEGIN+ 1)
+#define STR_POOLCOLL_HEADERR (RC_POOLCOLL_EXTRA_BEGIN+ 2)
+
+ // Untergruppe Footer
+#define STR_POOLCOLL_FOOTER (RC_POOLCOLL_EXTRA_BEGIN+ 3)
+#define STR_POOLCOLL_FOOTERL (RC_POOLCOLL_EXTRA_BEGIN+ 4)
+#define STR_POOLCOLL_FOOTERR (RC_POOLCOLL_EXTRA_BEGIN+ 5)
+
+ // Untergruppe Tabelle
+#define STR_POOLCOLL_TABLE (RC_POOLCOLL_EXTRA_BEGIN+ 6)
+#define STR_POOLCOLL_TABLE_HDLN (RC_POOLCOLL_EXTRA_BEGIN+ 7)
+
+ // Untergruppe Labels
+#define STR_POOLCOLL_LABEL (RC_POOLCOLL_EXTRA_BEGIN+ 8)
+#define STR_POOLCOLL_LABEL_ABB (RC_POOLCOLL_EXTRA_BEGIN+ 9)
+#define STR_POOLCOLL_LABEL_TABLE (RC_POOLCOLL_EXTRA_BEGIN+ 10)
+#define STR_POOLCOLL_LABEL_FRAME (RC_POOLCOLL_EXTRA_BEGIN+ 11)
+
+ // sonstiges
+#define STR_POOLCOLL_FRAME (RC_POOLCOLL_EXTRA_BEGIN+ 12)
+#define STR_POOLCOLL_FOOTNOTE (RC_POOLCOLL_EXTRA_BEGIN+ 13)
+#define STR_POOLCOLL_JAKETADRESS (RC_POOLCOLL_EXTRA_BEGIN+ 14)
+#define STR_POOLCOLL_SENDADRESS (RC_POOLCOLL_EXTRA_BEGIN+ 15)
+#define STR_POOLCOLL_ENDNOTE (RC_POOLCOLL_EXTRA_BEGIN+ 16)
+
+#define STR_POOLCOLL_LABEL_DRAWING (RC_POOLCOLL_EXTRA_BEGIN+ 17)
+
+// Gruppe Verzeichnisse
+#define STR_POOLCOLL_REGISTER_BASE (RC_POOLCOLL_REGISTER_BEGIN+ 0)
+ // Untergruppe Index-Verzeichnisse
+#define STR_POOLCOLL_TOX_IDXH (RC_POOLCOLL_REGISTER_BEGIN+ 1)
+#define STR_POOLCOLL_TOX_IDX1 (RC_POOLCOLL_REGISTER_BEGIN+ 2)
+#define STR_POOLCOLL_TOX_IDX2 (RC_POOLCOLL_REGISTER_BEGIN+ 3)
+#define STR_POOLCOLL_TOX_IDX3 (RC_POOLCOLL_REGISTER_BEGIN+ 4)
+#define STR_POOLCOLL_TOX_IDXBREAK (RC_POOLCOLL_REGISTER_BEGIN+ 5)
+
+ // Untergruppe Inhalts-Verzeichnisse
+#define STR_POOLCOLL_TOX_CNTNTH (RC_POOLCOLL_REGISTER_BEGIN+ 6)
+#define STR_POOLCOLL_TOX_CNTNT1 (RC_POOLCOLL_REGISTER_BEGIN+ 7)
+#define STR_POOLCOLL_TOX_CNTNT2 (RC_POOLCOLL_REGISTER_BEGIN+ 8)
+#define STR_POOLCOLL_TOX_CNTNT3 (RC_POOLCOLL_REGISTER_BEGIN+ 9)
+#define STR_POOLCOLL_TOX_CNTNT4 (RC_POOLCOLL_REGISTER_BEGIN+ 10)
+#define STR_POOLCOLL_TOX_CNTNT5 (RC_POOLCOLL_REGISTER_BEGIN+ 11)
+
+ // Untergruppe Benutzer-Verzeichnisse:
+#define STR_POOLCOLL_TOX_USERH (RC_POOLCOLL_REGISTER_BEGIN+ 12)
+#define STR_POOLCOLL_TOX_USER1 (RC_POOLCOLL_REGISTER_BEGIN+ 13)
+#define STR_POOLCOLL_TOX_USER2 (RC_POOLCOLL_REGISTER_BEGIN+ 14)
+#define STR_POOLCOLL_TOX_USER3 (RC_POOLCOLL_REGISTER_BEGIN+ 15)
+#define STR_POOLCOLL_TOX_USER4 (RC_POOLCOLL_REGISTER_BEGIN+ 16)
+#define STR_POOLCOLL_TOX_USER5 (RC_POOLCOLL_REGISTER_BEGIN+ 17)
+
+ // Untergruppe Inhalts-Verzeichnisse mehr Ebenen 5 - 10
+#define STR_POOLCOLL_TOX_CNTNT6 (RC_POOLCOLL_REGISTER_BEGIN+ 18)
+#define STR_POOLCOLL_TOX_CNTNT7 (RC_POOLCOLL_REGISTER_BEGIN+ 19)
+#define STR_POOLCOLL_TOX_CNTNT8 (RC_POOLCOLL_REGISTER_BEGIN+ 20)
+#define STR_POOLCOLL_TOX_CNTNT9 (RC_POOLCOLL_REGISTER_BEGIN+ 21)
+#define STR_POOLCOLL_TOX_CNTNT10 (RC_POOLCOLL_REGISTER_BEGIN+ 22)
+
+// illustrations index
+#define STR_POOLCOLL_TOX_ILLUSH (RC_POOLCOLL_REGISTER_BEGIN+ 23)
+#define STR_POOLCOLL_TOX_ILLUS1 (RC_POOLCOLL_REGISTER_BEGIN+ 24)
+
+// object index
+#define STR_POOLCOLL_TOX_OBJECTH (RC_POOLCOLL_REGISTER_BEGIN+ 25)
+#define STR_POOLCOLL_TOX_OBJECT1 (RC_POOLCOLL_REGISTER_BEGIN+ 26)
+
+// tables index
+#define STR_POOLCOLL_TOX_TABLESH (RC_POOLCOLL_REGISTER_BEGIN+ 27)
+#define STR_POOLCOLL_TOX_TABLES1 (RC_POOLCOLL_REGISTER_BEGIN+ 28)
+
+// index of authorities
+#define STR_POOLCOLL_TOX_AUTHORITIESH (RC_POOLCOLL_REGISTER_BEGIN+ 29)
+#define STR_POOLCOLL_TOX_AUTHORITIES1 (RC_POOLCOLL_REGISTER_BEGIN+ 30)
+
+ // Untergruppe Benutzer-Verzeichnisse mehr Ebenen 5 - 10
+#define STR_POOLCOLL_TOX_USER6 (RC_POOLCOLL_REGISTER_BEGIN+ 31)
+#define STR_POOLCOLL_TOX_USER7 (RC_POOLCOLL_REGISTER_BEGIN+ 32)
+#define STR_POOLCOLL_TOX_USER8 (RC_POOLCOLL_REGISTER_BEGIN+ 33)
+#define STR_POOLCOLL_TOX_USER9 (RC_POOLCOLL_REGISTER_BEGIN+ 34)
+#define STR_POOLCOLL_TOX_USER10 (RC_POOLCOLL_REGISTER_BEGIN+ 35)
+
+
+// Gruppe Kapitel/Dokument
+#define STR_POOLCOLL_DOC_TITEL (RC_POOLCOLL_DOC_BEGIN+ 0)
+#define STR_POOLCOLL_DOC_SUBTITEL (RC_POOLCOLL_DOC_BEGIN+ 1)
+
+// Gruppe HTML-Vorlagen
+#define STR_POOLCOLL_HTML_BLOCKQUOTE (RC_POOLCOLL_HTML_BEGIN+ 0)
+#define STR_POOLCOLL_HTML_PRE (RC_POOLCOLL_HTML_BEGIN+ 1)
+#define STR_POOLCOLL_HTML_HR (RC_POOLCOLL_HTML_BEGIN+ 2)
+#define STR_POOLCOLL_HTML_DD (RC_POOLCOLL_HTML_BEGIN+ 3)
+#define STR_POOLCOLL_HTML_DT (RC_POOLCOLL_HTML_BEGIN+ 4)
+
+//-----------------
+// Page styles
+//-----------------
+#define STR_POOLPAGE_STANDARD (RC_POOLPAGEDESC_BEGIN+ 0)
+#define STR_POOLPAGE_FIRST (RC_POOLPAGEDESC_BEGIN+ 1)
+#define STR_POOLPAGE_LEFT (RC_POOLPAGEDESC_BEGIN+ 2)
+#define STR_POOLPAGE_RIGHT (RC_POOLPAGEDESC_BEGIN+ 3)
+#define STR_POOLPAGE_JAKET (RC_POOLPAGEDESC_BEGIN+ 4)
+#define STR_POOLPAGE_REGISTER (RC_POOLPAGEDESC_BEGIN+ 5)
+#define STR_POOLPAGE_HTML (RC_POOLPAGEDESC_BEGIN+ 6)
+#define STR_POOLPAGE_FOOTNOTE (RC_POOLPAGEDESC_BEGIN+ 7)
+#define STR_POOLPAGE_ENDNOTE (RC_POOLPAGEDESC_BEGIN+ 8)
+#define STR_POOLPAGE_LANDSCAPE (RC_POOLPAGEDESC_BEGIN+ 9)
+
+//-----------------
+// Numbering styles
+//-----------------
+#define STR_POOLNUMRULE_NUM1 (RC_POOLNUMRULE_BEGIN+ 0)
+#define STR_POOLNUMRULE_NUM2 (RC_POOLNUMRULE_BEGIN+ 1)
+#define STR_POOLNUMRULE_NUM3 (RC_POOLNUMRULE_BEGIN+ 2)
+#define STR_POOLNUMRULE_NUM4 (RC_POOLNUMRULE_BEGIN+ 3)
+#define STR_POOLNUMRULE_NUM5 (RC_POOLNUMRULE_BEGIN+ 4)
+#define STR_POOLNUMRULE_BUL1 (RC_POOLNUMRULE_BEGIN+ 5)
+#define STR_POOLNUMRULE_BUL2 (RC_POOLNUMRULE_BEGIN+ 6)
+#define STR_POOLNUMRULE_BUL3 (RC_POOLNUMRULE_BEGIN+ 7)
+#define STR_POOLNUMRULE_BUL4 (RC_POOLNUMRULE_BEGIN+ 8)
+#define STR_POOLNUMRULE_BUL5 (RC_POOLNUMRULE_BEGIN+ 9)
+//IAccessibility2 Impplementaton 2009-----
+//Solution:Define column item's accessible name ID.
+#define STR_COLUMN_VALUESET_ITEM0 (RC_POOLNUMRULE_BEGIN + 10 )
+#define STR_COLUMN_VALUESET_ITEM1 (RC_POOLNUMRULE_BEGIN + 11 )
+#define STR_COLUMN_VALUESET_ITEM2 (RC_POOLNUMRULE_BEGIN + 12 )
+#define STR_COLUMN_VALUESET_ITEM3 (RC_POOLNUMRULE_BEGIN + 13 )
+#define STR_COLUMN_VALUESET_ITEM4 (RC_POOLNUMRULE_BEGIN + 14 )
+//-----IAccessibility2 Impplementaton 2009
+//-----------------
+// Paragraph styles
+//-----------------
+#define STR_POOLPARSTYLE_HEAD1 (STR_POOLPARSTYLE_BEGIN+ 0)
+#define STR_POOLPARSTYLE_HEAD2 (STR_POOLPARSTYLE_BEGIN+ 1)
+#define STR_POOLPARSTYLE_HEAD3 (STR_POOLPARSTYLE_BEGIN+ 2)
+#define STR_POOLPARSTYLE_DEFAULT (STR_POOLPARSTYLE_BEGIN+ 3)
+#define STR_POOLPARSTYLE_TEXTBODY (STR_POOLPARSTYLE_BEGIN+ 4)
+
+#endif
diff --git a/sw/inc/poolfmt.hxx b/sw/inc/poolfmt.hxx
new file mode 100644
index 000000000000..e3dec80e22a8
--- /dev/null
+++ b/sw/inc/poolfmt.hxx
@@ -0,0 +1,443 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _POOLFMT_HXX
+#define _POOLFMT_HXX
+
+#include <limits.h>
+#include <tools/solar.h>
+#include <editeng/frmdir.hxx>
+
+// POOLCOLL-IDs:
+// +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+// !User! Bereich ! 0 ! Offset !
+// +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+//
+// Bereich: 1 - Text
+// 2 - Listen
+// 3 - Sonderbereiche
+// 4 - Verzeichnisse
+// 5 - Kapitel / Dokument
+// 6 - HTML-Vorlagen
+
+// Andere IDs:
+// +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+// !User! Bereich ! 1 ! Offset !
+// +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+// Bereich: 0 - Zeichenvorlagen
+// 1 - Frame-Vorlagen
+// 2 - Seitenvorlagen
+// 3 - Absatzformate (?)
+// 4 - Grafikformate (?)
+
+// Fr alle IDs gilt:
+// Herkunft: 0 -Pool
+// 1 -Benutzer
+// Offset: innerhalb der Gruppe
+
+
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+//
+// ACHTUNG: neue ID's koennen nur noch am Ende der jeweiligen Gruppe
+// zugefuegt werden. Diese Id's werden vom Reader/Writer ge-
+// lesen und geschrieben. Diese kennen nur den Offset zum Start
+//
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+// Maske fuer Erkennung von COLLPOOL-Ids:
+
+const sal_uInt16 POOLGRP_NOCOLLID = (1 << 10);
+
+// POLLCOLL-Gruppen:
+
+const sal_uInt16 USER_FMT = (1 << 15);
+const sal_uInt16 POOL_FMT = (0 << 15);
+
+const sal_uInt16 COLL_TEXT_BITS = (1 << 11);
+const sal_uInt16 COLL_LISTS_BITS = (2 << 11);
+const sal_uInt16 COLL_EXTRA_BITS = (3 << 11);
+const sal_uInt16 COLL_REGISTER_BITS = (4 << 11);
+const sal_uInt16 COLL_DOC_BITS = (5 << 11);
+const sal_uInt16 COLL_HTML_BITS = (6 << 11);
+const sal_uInt16 COLL_GET_RANGE_BITS = (15 << 11);
+
+// Sonstige Gruppen:
+
+const sal_uInt16 POOLGRP_CHARFMT = (0 << 11) + POOLGRP_NOCOLLID;
+const sal_uInt16 POOLGRP_FRAMEFMT = (1 << 11) + POOLGRP_NOCOLLID;
+const sal_uInt16 POOLGRP_PAGEDESC = (2 << 11) + POOLGRP_NOCOLLID;
+const sal_uInt16 POOLGRP_NUMRULE = (3 << 11) + POOLGRP_NOCOLLID;
+//const sal_uInt16 POOLGRP_GRFFMT = (4 << 11) + POOLGRP_NOCOLLID; // ?
+
+// fuer Erkennung ob Benutzer-Vorlage oder nicht:
+const sal_uInt16 POOL_IDUSER_FMT =
+ USHRT_MAX & ~(COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID);
+
+inline sal_Bool IsPoolUserFmt( sal_uInt16 nId )
+{
+ return POOL_IDUSER_FMT ==
+ (nId & ~(COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID))
+ ? sal_True : sal_False;
+}
+
+
+// ID-s fuer die Bereiche
+enum RES_POOLFMT
+{
+RES_POOLFMT_BEGIN = 1, // HIER GEHT'S LOS !!!
+RES_POOL_CHRFMT = RES_POOLFMT_BEGIN,
+RES_POOL_FRMFMT,
+RES_POOL_TXTCOLL,
+RES_POOL_PAGEFMT,
+
+RES_POOL_PARFMT, // ???
+RES_POOL_GRFFMT, // ???
+RES_POOLFMT_END
+};
+
+// Bereiche fuer die Id's der einzelnen Formate
+
+// die Id's fuer die Zeichen-Vorlagen
+enum RES_POOL_CHRFMT_TYPE
+{
+RES_POOLCHR_BEGIN = POOLGRP_CHARFMT,
+RES_POOLCHR_NORMAL_BEGIN = POOLGRP_CHARFMT,
+
+RES_POOLCHR_FOOTNOTE = RES_POOLCHR_NORMAL_BEGIN, // Fussnote
+RES_POOLCHR_PAGENO, // Seiten/Feld
+RES_POOLCHR_LABEL, // Beschriftung
+RES_POOLCHR_DROPCAPS, // Initialienzeichen
+RES_POOLCHR_NUM_LEVEL, // Nummerierungszeichen
+RES_POOLCHR_BUL_LEVEL, // Aufzaehlungszeichen
+
+RES_POOLCHR_INET_NORMAL, // Internet normal
+RES_POOLCHR_INET_VISIT, // Internet besucht
+RES_POOLCHR_JUMPEDIT, // Platzhalter
+RES_POOLCHR_TOXJUMP, // Sprung aus Verzeichnis
+RES_POOLCHR_ENDNOTE, // Endnote
+RES_POOLCHR_LINENUM, // Zeilennummerierung
+RES_POOLCHR_IDX_MAIN_ENTRY, // main entry in indexes
+RES_POOLCHR_FOOTNOTE_ANCHOR, // Fussnotenanker
+RES_POOLCHR_ENDNOTE_ANCHOR, // Endnotenanker
+RES_POOLCHR_RUBYTEXT, // Rubytext
+RES_POOLCHR_VERT_NUM, // Vertical numbering symbols
+
+RES_POOLCHR_NORMAL_END,
+
+RES_POOLCHR_HTML_BEGIN = RES_POOLCHR_BEGIN + 50, // HTML-Vorlagen
+RES_POOLCHR_HTML_EMPHASIS= RES_POOLCHR_HTML_BEGIN,
+RES_POOLCHR_HTML_CITIATION,
+RES_POOLCHR_HTML_STRONG,
+RES_POOLCHR_HTML_CODE,
+RES_POOLCHR_HTML_SAMPLE,
+RES_POOLCHR_HTML_KEYBOARD,
+RES_POOLCHR_HTML_VARIABLE,
+RES_POOLCHR_HTML_DEFINSTANCE,
+RES_POOLCHR_HTML_TELETYPE,
+RES_POOLCHR_HTML_END,
+
+RES_POOLCHR_END = RES_POOLCHR_HTML_END
+};
+
+
+// die Id's fuer die Rahmen-Vorlagen
+enum RES_POOL_FRMFMT_TYPE
+{
+RES_POOLFRM_BEGIN = POOLGRP_FRAMEFMT,
+
+RES_POOLFRM_FRAME = RES_POOLFRM_BEGIN, // Rahmen
+RES_POOLFRM_GRAPHIC, // Graphic
+RES_POOLFRM_OLE, // OLE
+RES_POOLFRM_FORMEL, // Formeln
+RES_POOLFRM_MARGINAL, // Marginalen
+RES_POOLFRM_WATERSIGN, // Wasserzeichen
+RES_POOLFRM_LABEL, // Etikette
+
+RES_POOLFRM_END
+};
+
+// die Id's fuer die Seiten-Vorlagen
+enum RES_POOL_PAGEFMT_TYPE
+{
+RES_POOLPAGE_BEGIN = POOLGRP_PAGEDESC,
+
+RES_POOLPAGE_STANDARD = RES_POOLPAGE_BEGIN, // Standard-Seite
+RES_POOLPAGE_FIRST, // Erste Seite
+RES_POOLPAGE_LEFT, // Linke Seite
+RES_POOLPAGE_RIGHT, // Rechte Seite
+RES_POOLPAGE_JAKET, // Umschlag
+RES_POOLPAGE_REGISTER, // Verzeichnis
+RES_POOLPAGE_HTML, // HTML
+RES_POOLPAGE_FOOTNOTE, // Fussnote bei Dokumentende
+RES_POOLPAGE_ENDNOTE, // Endnotensseite
+RES_POOLPAGE_LANDSCAPE, // Landscape Page Style
+
+RES_POOLPAGE_END
+};
+
+// die Id's fuer die NumRule-Vorlagen
+enum RES_POOL_NUMRULE_TYPE
+{
+RES_POOLNUMRULE_BEGIN = POOLGRP_NUMRULE,
+RES_POOLNUMRULE_NUM1 = RES_POOLNUMRULE_BEGIN, // NumRule Numerierung 1
+RES_POOLNUMRULE_NUM2, // NumRule Numerierung 2
+RES_POOLNUMRULE_NUM3, // NumRule Numerierung 3
+RES_POOLNUMRULE_NUM4, // NumRule Numerierung 4
+RES_POOLNUMRULE_NUM5, // NumRule Numerierung 5
+RES_POOLNUMRULE_BUL1, // NumRule Bullets 1
+RES_POOLNUMRULE_BUL2, // NumRule Bullets 2
+RES_POOLNUMRULE_BUL3, // NumRule Bullets 3
+RES_POOLNUMRULE_BUL4, // NumRule Bullets 4
+RES_POOLNUMRULE_BUL5, // NumRule Bullets 5
+RES_POOLNUMRULE_END
+};
+
+// die Id's fuer die Absatz-Vorlagen
+enum RES_POOL_COLLFMT_TYPE
+{
+// Gruppe Text
+RES_POOLCOLL_TEXT_BEGIN = COLL_TEXT_BITS,
+
+RES_POOLCOLL_STANDARD = RES_POOLCOLL_TEXT_BEGIN, // Standard
+RES_POOLCOLL_TEXT, // Textkoerper
+RES_POOLCOLL_TEXT_IDENT, // Textkoerper Einzug
+RES_POOLCOLL_TEXT_NEGIDENT, // Textkoerper neg. Einzug
+RES_POOLCOLL_TEXT_MOVE, // Textkoerper Einrueckung
+RES_POOLCOLL_GREETING, // Grussformel
+RES_POOLCOLL_SIGNATURE, // Unterschrift
+RES_POOLCOLL_CONFRONTATION, // Gegenueberstellung
+RES_POOLCOLL_MARGINAL, // Marginalie
+
+ // Untergruppierung Ueberschriften
+RES_POOLCOLL_HEADLINE_BASE, // Basis-Ueberschrift
+RES_POOLCOLL_HEADLINE1, // Ueberschrift 1
+RES_POOLCOLL_HEADLINE2, // Ueberschrift 2
+RES_POOLCOLL_HEADLINE3, // Ueberschrift 3
+RES_POOLCOLL_HEADLINE4, // Ueberschrift 4
+RES_POOLCOLL_HEADLINE5, // Ueberschrift 5
+RES_POOLCOLL_HEADLINE6, // Ueberschrift 6
+RES_POOLCOLL_HEADLINE7, // Ueberschrift 7
+RES_POOLCOLL_HEADLINE8, // Ueberschrift 8
+RES_POOLCOLL_HEADLINE9, // Ueberschrift 9
+RES_POOLCOLL_HEADLINE10, // Ueberschrift 10
+
+RES_POOLCOLL_TEXT_END,
+
+
+// Gruppe Listen
+RES_POOLCOLL_LISTS_BEGIN = COLL_LISTS_BITS,
+
+RES_POOLCOLL_NUMBUL_BASE = RES_POOLCOLL_LISTS_BEGIN, // Basis-Liste
+
+ // Untergruppe Nummerierung
+RES_POOLCOLL_NUM_LEVEL1S, // Start Level1
+RES_POOLCOLL_NUM_LEVEL1, // 1. Level
+RES_POOLCOLL_NUM_LEVEL1E, // Ende Level1
+RES_POOLCOLL_NUM_NONUM1, // keine Nummerierung
+RES_POOLCOLL_NUM_LEVEL2S, // Start 2. Level
+RES_POOLCOLL_NUM_LEVEL2, // 2. Level
+RES_POOLCOLL_NUM_LEVEL2E, // Ende 2. Level
+RES_POOLCOLL_NUM_NONUM2, // keine Nummerierung
+RES_POOLCOLL_NUM_LEVEL3S, // Start 3. Level
+RES_POOLCOLL_NUM_LEVEL3, // 3. Level
+RES_POOLCOLL_NUM_LEVEL3E, // Ende 3. Level
+RES_POOLCOLL_NUM_NONUM3, // keine Nummerierung
+RES_POOLCOLL_NUM_LEVEL4S, // Start 4. Level
+RES_POOLCOLL_NUM_LEVEL4, // 4. Level
+RES_POOLCOLL_NUM_LEVEL4E, // Ende 4. Level
+RES_POOLCOLL_NUM_NONUM4, // keine Nummerierung
+RES_POOLCOLL_NUM_LEVEL5S, // Start 5. Level
+RES_POOLCOLL_NUM_LEVEL5, // 5. Level
+RES_POOLCOLL_NUM_LEVEL5E, // Ende 5. Level
+RES_POOLCOLL_NUM_NONUM5, // keine Nummerierung
+
+ // Untergruppe Aufzaehlung
+RES_POOLCOLL_BUL_LEVEL1S, // Start Level1
+RES_POOLCOLL_BUL_LEVEL1, // 1. Level
+RES_POOLCOLL_BUL_LEVEL1E, // Ende Level1
+RES_POOLCOLL_BUL_NONUM1, // keine Nummerierung
+RES_POOLCOLL_BUL_LEVEL2S, // Start 2. Level
+RES_POOLCOLL_BUL_LEVEL2, // 2. Level
+RES_POOLCOLL_BUL_LEVEL2E, // Ende 2. Level
+RES_POOLCOLL_BUL_NONUM2, // keine Nummerierung
+RES_POOLCOLL_BUL_LEVEL3S, // Start 3. Level
+RES_POOLCOLL_BUL_LEVEL3, // 3. Level
+RES_POOLCOLL_BUL_LEVEL3E, // Ende 3. Level
+RES_POOLCOLL_BUL_NONUM3, // keine Nummerierung
+RES_POOLCOLL_BUL_LEVEL4S, // Start 4. Level
+RES_POOLCOLL_BUL_LEVEL4, // 4. Level
+RES_POOLCOLL_BUL_LEVEL4E, // Ende 4. Level
+RES_POOLCOLL_BUL_NONUM4, // keine Nummerierung
+RES_POOLCOLL_BUL_LEVEL5S, // Start 5. Level
+RES_POOLCOLL_BUL_LEVEL5, // 5. Level
+RES_POOLCOLL_BUL_LEVEL5E, // Ende 5. Level
+RES_POOLCOLL_BUL_NONUM5, // keine Nummerierung
+
+RES_POOLCOLL_LISTS_END,
+
+
+// Sonderbereiche
+RES_POOLCOLL_EXTRA_BEGIN = COLL_EXTRA_BITS,
+
+ // Untergruppe Header
+RES_POOLCOLL_HEADER = RES_POOLCOLL_EXTRA_BEGIN, // Header Left&Right
+RES_POOLCOLL_HEADERL, // Header Left
+RES_POOLCOLL_HEADERR, // Header Right
+
+ // Untergruppe Footer
+RES_POOLCOLL_FOOTER, // Footer Left&Right
+RES_POOLCOLL_FOOTERL, // Footer Left
+RES_POOLCOLL_FOOTERR, // Footer Right
+
+ // Untergruppe Tabelle
+RES_POOLCOLL_TABLE, // Tabelle "Inhalt"
+RES_POOLCOLL_TABLE_HDLN, // Tabellen-Headline
+
+
+ // Untergruppe Beschriftung
+RES_POOLCOLL_LABEL, // Beschriftung-Basis
+RES_POOLCOLL_LABEL_ABB, // Beschriftung-Abbildung
+RES_POOLCOLL_LABEL_TABLE, // Beschriftung-Tabelle
+RES_POOLCOLL_LABEL_FRAME, // Beschriftung-Rahmen
+
+ // sonstiges
+RES_POOLCOLL_FRAME, // Rahmen
+RES_POOLCOLL_FOOTNOTE, // Fussnoten
+RES_POOLCOLL_JAKETADRESS, // UmschlagAdresse
+RES_POOLCOLL_SENDADRESS, // AbsenderAdresse
+RES_POOLCOLL_ENDNOTE, // Endnoten
+
+RES_POOLCOLL_LABEL_DRAWING, // Beschriftung-Zeichen-Objekte
+RES_POOLCOLL_EXTRA_END,
+
+
+// Gruppe Verzeichnisse
+RES_POOLCOLL_REGISTER_BEGIN = COLL_REGISTER_BITS,
+
+RES_POOLCOLL_REGISTER_BASE = RES_POOLCOLL_REGISTER_BEGIN, // Basis-Verzeichnis
+
+ // Untergruppe Index-Verzeichnisse
+RES_POOLCOLL_TOX_IDXH, // Header
+RES_POOLCOLL_TOX_IDX1, // 1. Ebene
+RES_POOLCOLL_TOX_IDX2, // 2. Ebene
+RES_POOLCOLL_TOX_IDX3, // 3. Ebene
+RES_POOLCOLL_TOX_IDXBREAK, // Trenner
+
+ // Untergruppe Inhalts-Verzeichnisse
+RES_POOLCOLL_TOX_CNTNTH, // Header
+RES_POOLCOLL_TOX_CNTNT1, // 1. Ebene
+RES_POOLCOLL_TOX_CNTNT2, // 2. Ebene
+RES_POOLCOLL_TOX_CNTNT3, // 3. Ebene
+RES_POOLCOLL_TOX_CNTNT4, // 4. Ebene
+RES_POOLCOLL_TOX_CNTNT5, // 5. Ebene
+
+ // Untergruppe Benutzer-Verzeichnisse:
+RES_POOLCOLL_TOX_USERH, // Header
+RES_POOLCOLL_TOX_USER1, // 1. Ebene
+RES_POOLCOLL_TOX_USER2, // 2. Ebene
+RES_POOLCOLL_TOX_USER3, // 3. Ebene
+RES_POOLCOLL_TOX_USER4, // 4. Ebene
+RES_POOLCOLL_TOX_USER5, // 5. Ebene
+
+
+RES_POOLCOLL_TOX_CNTNT6, // Inhalt 6. Ebene
+RES_POOLCOLL_TOX_CNTNT7, // Inhalt 7. Ebene
+RES_POOLCOLL_TOX_CNTNT8, // Inhalt 8. Ebene
+RES_POOLCOLL_TOX_CNTNT9, // Inhalt 9. Ebene
+RES_POOLCOLL_TOX_CNTNT10, // Inhalt 10. Ebene
+
+// illustrations index
+RES_POOLCOLL_TOX_ILLUSH, // illustrations header
+RES_POOLCOLL_TOX_ILLUS1, // illustrations all levels
+
+// object index
+RES_POOLCOLL_TOX_OBJECTH, // objects header
+RES_POOLCOLL_TOX_OBJECT1, // objects all levels
+
+// tables index
+RES_POOLCOLL_TOX_TABLESH, // tables header
+RES_POOLCOLL_TOX_TABLES1, // tables all levels
+
+// index of authorities
+RES_POOLCOLL_TOX_AUTHORITIESH, // authorities header
+RES_POOLCOLL_TOX_AUTHORITIES1, // authorities all levels
+
+// user index 6..10
+RES_POOLCOLL_TOX_USER6, // level 6
+RES_POOLCOLL_TOX_USER7, // level 7
+RES_POOLCOLL_TOX_USER8, // level 8
+RES_POOLCOLL_TOX_USER9, // level 9
+RES_POOLCOLL_TOX_USER10, // level 10
+
+RES_POOLCOLL_REGISTER_END,
+
+
+// Gruppe Kapitel/Dokument
+RES_POOLCOLL_DOC_BEGIN = COLL_DOC_BITS,
+
+RES_POOLCOLL_DOC_TITEL = RES_POOLCOLL_DOC_BEGIN, // Doc. Titel
+RES_POOLCOLL_DOC_SUBTITEL, // Doc. UnterTitel
+
+RES_POOLCOLL_DOC_END,
+
+// Gruppe HTML-Vorlagen
+RES_POOLCOLL_HTML_BEGIN = COLL_HTML_BITS,
+
+RES_POOLCOLL_HTML_BLOCKQUOTE = RES_POOLCOLL_HTML_BEGIN,
+RES_POOLCOLL_HTML_PRE,
+RES_POOLCOLL_HTML_HR,
+RES_POOLCOLL_HTML_DD,
+RES_POOLCOLL_HTML_DT,
+
+RES_POOLCOLL_HTML_END
+
+// Ende der Textformat-Vorlagen Sammlung
+};
+
+
+
+// erfrage den definierten Parent zu einer POOL-Id
+// returnt: 0 -> Standard
+// USHRT_MAX -> kein Parent
+// sonst -> den Parent
+sal_uInt16 GetPoolParent( sal_uInt16 nId );
+
+SvxFrameDirection GetDefaultFrameDirection(sal_uLong nLanguage);
+
+inline sal_Bool IsConditionalByPoolId(sal_uInt16 nId)
+ {
+ return RES_POOLCOLL_TEXT == nId;
+ }
+// die Id's fuer die Grafik-Formate
+/*enum RES_POOL_GRFFMT_TYPE
+{
+RES_POOLGRF_BEGIN = RES_POOLPAR_END,
+RES_POOLGRF_1 = RES_POOLGRF_BEGIN,
+RES_POOLGRF_END
+};
+*/
+
+#endif
diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx
new file mode 100644
index 000000000000..620936cdcf5b
--- /dev/null
+++ b/sw/inc/postithelper.hxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _POSTITHELPER_HXX
+#define _POSTITHELPER_HXX
+
+#include <swrect.hxx>
+#include <fmtfld.hxx>
+#include <redline.hxx>
+#include <vector>
+#include <vcl/window.hxx>
+#include <SidebarWindowsTypes.hxx>
+#include <svl/brdcst.hxx>
+
+class SwTxtFld;
+class SwRootFrm;
+class SwPostIt;
+class String;
+class SwPostItMgr;
+class SwEditWin;
+namespace sw { namespace sidebarwindows {
+ class SwSidebarWin;
+} }
+
+struct SwPosition;
+
+typedef sal_Int64 SwPostItBits;
+
+struct SwLayoutInfo
+{
+ const SwFrm* mpAnchorFrm;
+ SwRect mPosition;
+ SwRect mPageFrame;
+ SwRect mPagePrtArea;
+ unsigned long mnPageNumber;
+ sw::sidebarwindows::SidebarPosition meSidebarPosition;
+ sal_uInt16 mRedlineAuthor;
+
+ SwLayoutInfo()
+ : mpAnchorFrm(0)
+ , mPosition()
+ , mPageFrame()
+ , mPagePrtArea()
+ , mnPageNumber(1)
+ , meSidebarPosition(sw::sidebarwindows::SIDEBAR_NONE)
+ , mRedlineAuthor(0)
+ {}
+};
+
+namespace SwPostItHelper
+{
+ enum SwLayoutStatus
+ {
+ INVISIBLE, VISIBLE, INSERTED, DELETED, NONE, HIDDEN
+ };
+
+ SwLayoutStatus getLayoutInfos( std::vector< SwLayoutInfo >&, SwPosition& );
+ long getLayoutHeight( const SwRootFrm* pRoot );
+ void setSidebarChanged( SwRootFrm* pRoot, bool bBrowseMode );
+ unsigned long getPageInfo( SwRect& rPageFrm, const SwRootFrm* , const Point& );
+}
+
+class SwSidebarItem
+{
+public:
+ sw::sidebarwindows::SwSidebarWin* pPostIt;
+ bool bShow;
+ bool bFocus;
+
+ SwPostItHelper::SwLayoutStatus mLayoutStatus;
+ SwLayoutInfo maLayoutInfo;
+
+ SwSidebarItem( const bool aShow,
+ const bool aFocus)
+ : pPostIt(0)
+ , bShow(aShow)
+ , bFocus(aFocus)
+ , mLayoutStatus( SwPostItHelper::INVISIBLE )
+ , maLayoutInfo()
+ {}
+ virtual ~SwSidebarItem(){}
+ virtual SwPosition GetAnchorPosition() const = 0;
+ virtual bool UseElement() = 0;
+ virtual SwFmtFld* GetFmtFld() const = 0;
+ virtual SfxBroadcaster* GetBroadCaster() const = 0;
+ virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits) = 0;
+};
+/*
+class SwRedCommentItem: public SwSidebarItem
+{
+private:
+ SwRedline* pRedline;
+public:
+
+ SwRedCommentItem( SwRedline* pRed, bool aShow, bool aFocus)
+ : SwSidebarItem(aShow,aFocus),
+ pRedline(pRed) {}
+ virtual ~SwRedCommentItem() {}
+ virtual SwPosition GetAnchorPosition() const;
+ virtual bool UseElement();
+ virtual SwFmtFld* GetFmtFld() const {return 0; }
+ virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pRedline); }
+ virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits);
+};
+*/
+
+class SwAnnotationItem: public SwSidebarItem
+{
+ private:
+ SwFmtFld* pFmtFld;
+
+ public:
+ SwAnnotationItem( SwFmtFld* p,
+ const bool aShow,
+ const bool aFocus)
+ : SwSidebarItem( aShow, aFocus )
+ , pFmtFld(p)
+ {}
+ virtual ~SwAnnotationItem() {}
+ virtual SwPosition GetAnchorPosition() const;
+ virtual bool UseElement();
+ virtual SwFmtFld* GetFmtFld() const {return pFmtFld;}
+ virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pFmtFld); }
+ virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits);
+};
+
+#endif // _POSTITHELPER_HXX
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
new file mode 100644
index 000000000000..1e16d3d782e9
--- /dev/null
+++ b/sw/inc/printdata.hxx
@@ -0,0 +1,336 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_PRINTDATA_HXX
+#define SW_PRINTDATA_HXX
+
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <vcl/print.hxx>
+
+#include <set>
+#include <map>
+#include <vector>
+#include <utility>
+
+class SwPageFrm;
+class SwDoc;
+class SwDocShell;
+class ViewShell;
+class _SetGetExpFlds;
+class SwViewOption;
+class OutputDevice;
+class SwViewOptionAdjust_Impl;
+class SwPrtOptions;
+class ViewShell;
+class SfxViewShell;
+
+// forward declarations
+class SwPrintUIOptions;
+class SwRenderData;
+
+////////////////////////////////////////////////////////////
+
+
+class SwPrintData
+{
+ const SwPrintUIOptions * m_pPrintUIOptions; // not owner
+ const SwRenderData * m_pRenderData; // not owner
+
+public:
+
+ sal_Bool bPrintGraphic, bPrintTable, bPrintDraw, bPrintControl, bPrintPageBackground,
+ bPrintBlackFont,
+ //#i81434# - printing of hidden text
+ bPrintHiddenText, bPrintTextPlaceholder,
+ bPrintLeftPages, bPrintRightPages, bPrintReverse, bPrintProspect,
+ bPrintProspectRTL,
+ bPrintSingleJobs, bPaperFromSetup,
+ // --> FME 2005-12-13 #b6354161# Print empty pages
+ bPrintEmptyPages,
+ // <--
+ // #i56195# no field update while printing mail merge documents
+ bUpdateFieldsInPrinting,
+ bModified;
+
+ sal_Int16 nPrintPostIts;
+ rtl::OUString sFaxName;
+
+ SwPrintData()
+ {
+ m_pPrintUIOptions = NULL;
+ m_pRenderData = NULL;
+
+ bPrintGraphic =
+ bPrintTable =
+ bPrintDraw =
+ bPrintControl =
+ bPrintLeftPages =
+ bPrintRightPages =
+ bPrintPageBackground =
+ bPrintEmptyPages =
+ bUpdateFieldsInPrinting = sal_True;
+
+ bPaperFromSetup =
+ bPrintReverse =
+ bPrintProspect =
+ bPrintProspectRTL =
+ bPrintSingleJobs =
+ bModified =
+ bPrintBlackFont =
+ bPrintHiddenText =
+ bPrintTextPlaceholder = sal_False;
+
+ nPrintPostIts = 0;
+ }
+
+ virtual ~SwPrintData() {}
+
+ sal_Bool operator==(const SwPrintData& rData)const
+ {
+ return
+ bPrintGraphic == rData.bPrintGraphic &&
+ bPrintTable == rData.bPrintTable &&
+ bPrintDraw == rData.bPrintDraw &&
+ bPrintControl == rData.bPrintControl &&
+ bPrintPageBackground== rData.bPrintPageBackground &&
+ bPrintBlackFont == rData.bPrintBlackFont &&
+ bPrintLeftPages == rData.bPrintLeftPages &&
+ bPrintRightPages == rData.bPrintRightPages &&
+ bPrintReverse == rData.bPrintReverse &&
+ bPrintProspect == rData.bPrintProspect &&
+ bPrintProspectRTL == rData.bPrintProspectRTL &&
+ bPrintSingleJobs == rData.bPrintSingleJobs &&
+ bPaperFromSetup == rData.bPaperFromSetup &&
+ bPrintEmptyPages == rData.bPrintEmptyPages &&
+ bUpdateFieldsInPrinting == rData.bUpdateFieldsInPrinting &&
+ nPrintPostIts == rData.nPrintPostIts &&
+ sFaxName == rData.sFaxName &&
+ bPrintHiddenText == rData.bPrintHiddenText &&
+ bPrintTextPlaceholder == rData.bPrintTextPlaceholder;
+ }
+
+ // Note: in the context where this class ist used the pointers should always be valid
+ // during the lifetime of this object
+ const SwPrintUIOptions & GetPrintUIOptions() const { return *m_pPrintUIOptions; }
+ const SwRenderData & GetRenderData() const { return *m_pRenderData; }
+ void SetPrintUIOptions( const SwPrintUIOptions *pOpt ) { m_pPrintUIOptions = pOpt; }
+ void SetRenderData( const SwRenderData *pData ) { m_pRenderData = pData; }
+
+ sal_Bool IsPrintGraphic() const { return bPrintGraphic; }
+ sal_Bool IsPrintTable() const { return bPrintTable; }
+ sal_Bool IsPrintDraw() const { return bPrintDraw; }
+ sal_Bool IsPrintControl() const { return bPrintControl; }
+ sal_Bool IsPrintLeftPage() const { return bPrintLeftPages; }
+ sal_Bool IsPrintRightPage() const { return bPrintRightPages; }
+ sal_Bool IsPrintReverse() const { return bPrintReverse; }
+ sal_Bool IsPaperFromSetup() const { return bPaperFromSetup; }
+ sal_Bool IsPrintEmptyPages() const { return bPrintEmptyPages; }
+ sal_Bool IsPrintProspect() const { return bPrintProspect; }
+ sal_Bool IsPrintProspectRTL() const { return bPrintProspectRTL; }
+ sal_Bool IsPrintPageBackground() const { return bPrintPageBackground; }
+ sal_Bool IsPrintBlackFont() const { return bPrintBlackFont; }
+ sal_Bool IsPrintSingleJobs() const { return bPrintSingleJobs; }
+ sal_Int16 GetPrintPostIts() const { return nPrintPostIts; }
+ const rtl::OUString GetFaxName() const { return sFaxName; }
+ sal_Bool IsPrintHiddenText() const { return bPrintHiddenText; }
+ sal_Bool IsPrintTextPlaceholder() const { return bPrintTextPlaceholder; }
+
+ void SetPrintGraphic( sal_Bool b ) { doSetModified(); bPrintGraphic = b; }
+ void SetPrintTable( sal_Bool b ) { doSetModified(); bPrintTable = b; }
+ void SetPrintDraw( sal_Bool b ) { doSetModified(); bPrintDraw = b; }
+ void SetPrintControl( sal_Bool b ) { doSetModified(); bPrintControl = b; }
+ void SetPrintLeftPage( sal_Bool b ) { doSetModified(); bPrintLeftPages = b; }
+ void SetPrintRightPage( sal_Bool b ) { doSetModified(); bPrintRightPages = b; }
+ void SetPrintReverse( sal_Bool b ) { doSetModified(); bPrintReverse = b; }
+ void SetPaperFromSetup( sal_Bool b ) { doSetModified(); bPaperFromSetup = b; }
+ void SetPrintEmptyPages( sal_Bool b ) { doSetModified(); bPrintEmptyPages = b; }
+ void SetPrintPostIts( sal_Int16 n ) { doSetModified(); nPrintPostIts = n; }
+ void SetPrintProspect( sal_Bool b ) { doSetModified(); bPrintProspect = b; }
+ void SetPrintProspect_RTL( sal_Bool b ) { doSetModified(); bPrintProspectRTL = b; }
+ void SetPrintPageBackground( sal_Bool b ) { doSetModified(); bPrintPageBackground = b; }
+ void SetPrintBlackFont( sal_Bool b ) { doSetModified(); bPrintBlackFont = b; }
+ void SetPrintSingleJobs( sal_Bool b ) { doSetModified(); bPrintSingleJobs = b; }
+ void SetFaxName( const rtl::OUString& rSet ) { sFaxName = rSet; }
+ void SetPrintHiddenText( sal_Bool b ) { doSetModified(); bPrintHiddenText = b; }
+ void SetPrintTextPlaceholder( sal_Bool b ) { doSetModified(); bPrintTextPlaceholder = b; }
+
+ virtual void doSetModified () { bModified = sal_True;}
+};
+
+
+////////////////////////////////////////////////////////////
+
+
+class SwPrintUIOptions : public vcl::PrinterOptionsHelper
+{
+ OutputDevice* m_pLast;
+ const SwPrintData & m_rDefaultPrintData;
+
+public:
+ SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts, const SwPrintData &rDefaultPrintData );
+ virtual ~SwPrintUIOptions();
+
+ bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp );
+
+ bool IsPrintFormControls() const { return getBoolValue( "PrintControls", m_rDefaultPrintData.bPrintControl ); }
+ bool IsPrintPageBackground() const { return getBoolValue( "PrintPageBackground", m_rDefaultPrintData.bPrintPageBackground ); }
+ bool IsPrintProspect() const { return getBoolValue( "PrintProspect", m_rDefaultPrintData.bPrintProspect ); }
+ bool IsPrintProspectRTL() const { return getIntValue( "PrintProspectRTL", m_rDefaultPrintData.bPrintProspectRTL ) ? true : false; }
+ bool IsPrintTextPlaceholders() const { return getBoolValue( "PrintTextPlaceholder", m_rDefaultPrintData.bPrintTextPlaceholder ); }
+ bool IsPrintHiddenText() const { return getBoolValue( "PrintHiddenText", m_rDefaultPrintData.bPrintHiddenText ); }
+ bool IsPrintWithBlackTextColor() const { return getBoolValue( "PrintBlackFonts", m_rDefaultPrintData.bPrintBlackFont ); }
+ sal_Int16 GetPrintPostItsType() const { return static_cast< sal_Int16 >(getIntValue( "PrintAnnotationMode", m_rDefaultPrintData.nPrintPostIts )); }
+ bool IsPaperFromSetup() const { return getBoolValue( "PrintPaperFromSetup", m_rDefaultPrintData.bPaperFromSetup ); }
+ bool IsPrintReverse() const { return false; /*handled by print dialog now*/ /*getBoolValue( "PrintReversed", m_rDefaultPrintData.bPrintReverse );*/ }
+
+ bool IsPrintLeftPages() const;
+ bool IsPrintRightPages() const;
+ bool IsPrintEmptyPages( bool bIsPDFExport ) const;
+ bool IsPrintTables() const;
+ bool IsPrintGraphics() const;
+ bool IsPrintDrawings() const;
+};
+
+
+////////////////////////////////////////////////////////////
+
+// A class that stores temporary data that is needed for rendering the document.
+// Usually this data is created when 'getRendererCount' is called and
+// and it is used in the 'render' function of that same interface
+class SwRenderData
+{
+ // pages valid for printing (according to the current settings)
+ // and their respective start frames (see getRendererCount in unotxdoc.cxx)
+ // This set of pages does NOT depend on the 'PageRange' that is used as a printing option!
+ std::set< sal_Int32 > m_aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString )
+ std::map< sal_Int32, const SwPageFrm * > m_aValidStartFrames; // the map of start frames for those pages
+
+ // printer paper tray to use for each of the m_aValidPages above
+ std::map< sal_Int32, sal_Int32 > m_aPrinterPaperTrays;
+
+ // vector of pages and their order to be printed (duplicates and any order allowed!)
+ // (see 'render' in unotxdoc.cxx)
+ std::vector< sal_Int32 > m_aPagesToPrint;
+
+ std::vector< const SwPageFrm * > m_aPostItStartFrames;
+
+ // for prospect printing: the pairs of pages to be printed together on a single prospect page.
+ // -1 indicates a half page to be left empty.
+ std::vector< std::pair< sal_Int32, sal_Int32 > > m_aPagePairs;
+
+ rtl::OUString m_aPageRange;
+
+ // the view options to be applied for printing
+ SwViewOptionAdjust_Impl * m_pViewOptionAdjust;
+
+ SwPrintData * m_pPrtOptions;
+
+public:
+
+ // PostIt relevant data
+ _SetGetExpFlds * m_pPostItFields; // an array of "_SetGetExpFld *" sorted by page and line numbers
+ SwDoc * m_pPostItDoc;
+ ViewShell * m_pPostItShell;
+
+public:
+ SwRenderData();
+ ~SwRenderData();
+
+
+ bool HasPostItData() const { return m_pPostItShell != 0 && m_pPostItDoc != 0 && m_pPostItShell != 0; }
+ void CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev );
+ void DeletePostItData();
+
+ bool IsViewOptionAdjust() const { return m_pViewOptionAdjust != 0; }
+ bool NeedNewViewOptionAdjust( const ViewShell& ) const;
+ void ViewOptionAdjustStart( ViewShell &rSh, const SwViewOption &rViewOptions );
+ void ViewOptionAdjust( SwPrintData const* const pPrtOptions );
+ void ViewOptionAdjustStop();
+
+ bool HasSwPrtOptions() const { return m_pPrtOptions != 0; }
+ void SetSwPrtOptions(SwPrintData *const pOpt) { m_pPrtOptions = pOpt; }
+ SwPrintData const* GetSwPrtOptions() const { return m_pPrtOptions; }
+ SwPrintData & GetSwPrtOptionsRef() { return *m_pPrtOptions; }
+ void MakeSwPrtOptions( SwPrintData & rOptions, const SwDocShell *pDocShell,
+ const SwPrintUIOptions *pOpt, const SwRenderData *pData, bool bIsPDFExport );
+
+
+ typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t;
+ typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t;
+
+ std::set< sal_Int32 > & GetValidPagesSet() { return m_aValidPages; }
+ const std::set< sal_Int32 > & GetValidPagesSet() const { return m_aValidPages; }
+ ValidStartFramesMap_t & GetValidStartFrames() { return m_aValidStartFrames; }
+ const ValidStartFramesMap_t & GetValidStartFrames() const { return m_aValidStartFrames; }
+
+ // a map for printer paper tray numbers to use for each document page
+ // a value of -1 for the tray means that there is no specific tray defined
+ std::map< sal_Int32, sal_Int32 >& GetPrinterPaperTrays() { return m_aPrinterPaperTrays; }
+ const std::map< sal_Int32, sal_Int32 >& GetPrinterPaperTrays() const { return m_aPrinterPaperTrays; }
+
+ // used for 'normal' printing
+ // A page value of 0 as entry indicates that this page is not from the document but
+ // from the post-it document. (See also GetPostItStartFrame below)
+ std::vector< sal_Int32 > & GetPagesToPrint() { return m_aPagesToPrint; }
+ const std::vector< sal_Int32 > & GetPagesToPrint() const { return m_aPagesToPrint; }
+
+ // used for 'normal' printing with post-its
+ // - if the map entry will be NULL then the respective page to be printed is from
+ // the document. In that case use the value from GetPagesToPrint at the same index to
+ // get the phys. page number to be printed, and then retrieve the start frame to use
+ // from GetValidStartFrms.
+ // - If the entry is not NULL it is the start frame of the page from the post-it document
+ // that is to be printed
+ std::vector< const SwPageFrm * > & GetPostItStartFrames() { return m_aPostItStartFrames; }
+ const std::vector< const SwPageFrm * > & GetPostItStartFrames() const { return m_aPostItStartFrames; }
+
+ // used for prospect printing only
+ PagePairsVec_t & GetPagePairsForProspectPrinting() { return m_aPagePairs; }
+ const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return m_aPagePairs; }
+
+ rtl::OUString GetPageRange() const { return m_aPageRange; }
+ void SetPageRange( const rtl::OUString &rRange ) { m_aPageRange = rRange; }
+};
+
+
+////////////////////////////////////////////////////////////
+
+// last remnants of swprtopt.hxx:
+
+#define POSTITS_NONE 0
+#define POSTITS_ONLY 1
+#define POSTITS_ENDDOC 2
+#define POSTITS_ENDPAGE 3
+
+namespace sw {
+
+void InitPrintOptionsFromApplication(SwPrintData & o_rData, bool const bWeb);
+
+} // namespace sw
+
+#endif // SW_PRINTDATA_HXX
diff --git a/sw/inc/prtopt.hxx b/sw/inc/prtopt.hxx
new file mode 100644
index 000000000000..75f0520e35e8
--- /dev/null
+++ b/sw/inc/prtopt.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _PRTOPT_HXX
+#define _PRTOPT_HXX
+
+#include <unotools/configitem.hxx>
+#include <printdata.hxx>
+
+class SwPrintOptions : public SwPrintData, public utl::ConfigItem
+{
+ sal_Bool bIsWeb;
+
+ com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+public:
+ SwPrintOptions(sal_Bool bWeb);
+ virtual ~SwPrintOptions();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ virtual void doSetModified( ) { bModified = sal_True; SetModified();}
+
+ SwPrintOptions& operator=(const SwPrintData& rData)
+ {
+ SwPrintData::operator=( rData );
+ SetModified();
+ return *this;
+ }
+};
+
+#endif
+
diff --git a/sw/inc/pvprtdat.hxx b/sw/inc/pvprtdat.hxx
new file mode 100644
index 000000000000..14b20f147714
--- /dev/null
+++ b/sw/inc/pvprtdat.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _PVPRTDAT_HXX
+#define _PVPRTDAT_HXX
+
+
+#include <tools/solar.h>
+
+class SwPagePreViewPrtData
+{
+ sal_uLong nLeftSpace, nRightSpace, nTopSpace, nBottomSpace,
+ nHorzSpace, nVertSpace;
+ sal_uInt8 nRow, nCol;
+ sal_Bool bLandscape : 1;
+ sal_Bool bStretch : 1;
+public:
+ SwPagePreViewPrtData()
+ : nLeftSpace(0), nRightSpace(0), nTopSpace(0), nBottomSpace(0),
+ nHorzSpace(0), nVertSpace(0), nRow(1), nCol(1),
+ bLandscape(0),bStretch(0)
+ {}
+
+ sal_uLong GetLeftSpace() const { return nLeftSpace; }
+ void SetLeftSpace( sal_uLong n ) { nLeftSpace = n; }
+
+ sal_uLong GetRightSpace() const { return nRightSpace; }
+ void SetRightSpace( sal_uLong n ) { nRightSpace = n; }
+
+ sal_uLong GetTopSpace() const { return nTopSpace; }
+ void SetTopSpace( sal_uLong n ) { nTopSpace = n; }
+
+ sal_uLong GetBottomSpace() const { return nBottomSpace; }
+ void SetBottomSpace( sal_uLong n ) { nBottomSpace = n; }
+
+ sal_uLong GetHorzSpace() const { return nHorzSpace; }
+ void SetHorzSpace( sal_uLong n ) { nHorzSpace = n; }
+
+ sal_uLong GetVertSpace() const { return nVertSpace; }
+ void SetVertSpace( sal_uLong n ) { nVertSpace = n; }
+
+ sal_uInt8 GetRow() const { return nRow; }
+ void SetRow(sal_uInt8 n ) { nRow = n; }
+
+ sal_uInt8 GetCol() const { return nCol; }
+ void SetCol( sal_uInt8 n ) { nCol = n; }
+
+ sal_Bool GetLandscape() const { return bLandscape; }
+ void SetLandscape( sal_Bool b ) { bLandscape = b; }
+};
+
+
+#endif
+
+
diff --git a/sw/inc/rcid.hrc b/sw/inc/rcid.hrc
new file mode 100644
index 000000000000..8a788933dc4e
--- /dev/null
+++ b/sw/inc/rcid.hrc
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _RDIC_HRC
+#define _RDIC_HRC
+
+#ifndef _SFXSIDS_HRC //autogen
+#include <sfx2/sfxsids.hrc>
+#endif
+
+#define IMAGE_MASK_COLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
+// ----------------------------------------------------------------
+// Bereiche fuer die UI-Verzeichnisse
+// ----------------------------------------------------------------
+
+#define RC_BASE RID_SW_START // aus solar.hrc
+
+#define RC_APP RC_BASE
+#define RC_DIALOG (RC_BASE + 200)
+#define RC_DOCVW (RC_BASE + 300)
+#define RC_WEB (RC_BASE + 400)
+#define RC_GLOBDOC (RC_BASE + 500)
+#define RC_VIEW (RC_BASE + 600)
+#define RC_CHRDLG (RC_BASE + 700)
+#define RC_RIBBAR (RC_BASE + 720)
+#define RC_GLOBALS (RC_BASE + 800)
+#define RC_FMTUI (RC_BASE + 920)
+#define RC_FRMDLG (RC_BASE + 1000)
+#define RC_FLDDLG (RC_BASE + 1100)
+#define RC_UTLUI (RC_BASE + 1250)
+#define RC_ATTR (RC_BASE + 1350)
+#define RC_TABLE (RC_BASE + 1450)
+#define RC_CONFIG (RC_BASE + 1550)
+#define RC_MISC (RC_BASE + 1650)
+#define RC_WRTSH (RC_BASE + 1750)
+#define RC_INDEX (RC_BASE + 1950)
+#define RC_DBUI (RC_BASE + 2050)
+#define RC_DOCHDL (RC_BASE + 2150)
+#define RC_POOLCHRFMT (RC_BASE + 2250)
+#define RC_POOLHTMLCHRFMT (RC_BASE + 2290)
+#define RC_POOLFRMFMT (RC_BASE + 2330)
+#define RC_POOLTXTCOLL (RC_BASE + 2360)
+#define RC_POOLPAGEDESC (RC_BASE + 2550)
+#define RC_POOLNUMRULE (RC_BASE + 2650)
+#define RC_ENVELP (RC_BASE + 2750)
+#define RC_STATLIN_STR (RC_BASE + 2850)
+#define RC_COMMON_CORE (RC_BASE + 2950)
+#define RC_WIZARD (RC_BASE + 3050)
+#define RC_POPUPS (RC_BASE + 3150)
+#define RC_SHELLS (RC_BASE + 3250)
+#define RC_CFGITEMS (RC_BASE + 3350)
+#define RC_LINGU (RC_BASE + 3450)
+#define RC_ACCESS (RC_BASE + 3550)
+#define STR_POOLPARSTYLE (RC_BASE + 3650)
+#define RC_UNDO (RC_BASE + 3750)
+#define RC_SMARTTAG (RC_BASE + 3950) // SMARTTAGS
+#define RC_UNOCORE (RC_BASE + 4050)
+#define RC_ANNOTATION (RC_BASE + 4150)
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bereiche ausspannen
+ --------------------------------------------------------------------*/
+
+// App-Verzeichnis
+#define RC_APP_BEGIN RC_APP
+#define RC_APP_END (RC_APP_BEGIN + 199)
+
+// Dialog-Verzeichnis
+#define RC_DIALOG_BEGIN RC_DIALOG
+#define RC_DIALOG_END (RC_DIALOG_BEGIN + 99)
+
+// Editwin & Co
+#define RC_DOCVW_BEGIN RC_DOCVW
+#define RC_DOCVW_END (RC_DOCVW_BEGIN + 99)
+
+// Annotation
+#define RC_ANNOTATION_BEGIN RC_ANNOTATION
+#define RC_ANNOTATION_END (RC_ANNOTATION_BEGIN + 99)
+
+// SW/Web
+#define RC_WEB_BEGIN RC_WEB
+#define RC_WEB_END (RC_WEB_BEGIN + 199)
+
+//Globaldocument
+#define RC_GLOBDOC_BEGIN RC_GLOBDOC
+#define RC_GLOBDOC_END (RC_GLOBDOC_BEGIN + 99)
+
+// UI-View
+#define RC_VIEW_BEGIN RC_VIEW
+#define RC_VIEW_END (RC_VIEW_BEGIN + 99)
+
+// Zeichen Absatz Tab-Dialog
+#define RC_CHRDLG_BEGIN RC_CHRDLG
+#define RC_CHRDLG_END (RC_CHRDLG_BEGIN + 19)
+
+// Unsere Shell
+#define RC_WRTSH_BEGIN RC_WRTSH
+#define RC_WRTSH_END (RC_WRTSH_BEGIN + 49)
+
+// Verzeichnisse
+#define RC_INDEX_BEGIN RC_INDEX
+#define RC_INDEX_END (RC_INDEX + 99)
+
+//
+#define RC_RIBBAR_BEGIN RC_RIBBAR
+#define RC_RIBBAR_END (RC_RIBBAR_BEGIN + 79)
+
+// globale Ressourcen
+#define RC_GLOBALS_BEGIN RC_GLOBALS
+#define RC_GLOBALS_END (RC_GLOBALS_BEGIN + 119)
+
+// Format-Vorlagen
+#define RC_FMTUI_BEGIN RC_FMTUI
+#define RC_FMTUI_END (RC_FMTUI_BEGIN + 69)
+
+
+// Grafik Dialoge
+#define RC_GRFDLG_BEGIN RC_GRFDLG
+#define RC_GRFDLG_END (RC_GRFDLG_BEGIN + 99)
+
+// ????
+#define RC_FSTDLG_BEGIN RC_FSTDLG
+#define RC_FSTDLG_END (RC_FSTDLG_BEGIN + 99)
+
+// Rahmen Dialoge
+#define RC_FRMDLG_BEGIN RC_FRMDLG
+#define RC_FRMDLG_END (RC_FRMDLG_BEGIN + 99)
+
+// Feld Dialoge
+#define RC_FLDDLG_BEGIN RC_FLDDLG
+#define RC_FLDDLG_END (RC_FLDDLG_BEGIN + 149)
+
+// Utilities UI
+#define RC_UTLUI_BEGIN RC_UTLUI
+#define RC_UTLUI_END (RC_UTLUI + 99)
+
+// Utilities UI-Attribute
+#define RC_ATTR_BEGIN RC_ATTR
+#define RC_ATTR_END (RC_ATTR + 99)
+
+// Tabellen
+#define RC_TABLE_BEGIN RC_TABLE
+#define RC_TABLE_END (RC_TABLE + 99)
+
+// Konfiguration
+#define RC_CONFIG_BEGIN RC_CONFIG
+#define RC_CONFIG_END (RC_CONFIG + 99)
+
+
+// Verschiedenes
+#define RC_MISC_BEGIN RC_MISC
+#define RC_MISC_END (RC_MISC + 99)
+
+// DBMgr
+#define RC_DBUI_BEGIN RC_DBUI
+#define RC_DBUI_END (RC_DBUI + 99)
+
+// Der Rest der Imp-Klassen
+#define RC_DOCHDL_BEGIN RC_DOCHDL
+#define RC_DOCHDL_END (RC_DOCHDL + 99)
+
+// Zeichenvorlagen
+#define RC_POOLCHRFMT_BEGIN RC_POOLCHRFMT
+#define RC_POOLCHRFMT_END (RC_POOLCHRFMT + 29)
+#define RC_POOLCHRFMT_HTML_BEGIN RC_POOLHTMLCHRFMT
+#define RC_POOLCHRFMT_HTML_END (RC_POOLHTMLCHRFMT+ 30)
+
+
+// Rahmenvorlagen
+#define RC_POOLFRMFMT_BEGIN RC_POOLFRMFMT
+#define RC_POOLFRMFMT_END (RC_POOLFRMFMT + 20)
+
+// Collections
+#define RC_POOLTXTCOLL_BEGIN RC_POOLTXTCOLL
+
+#define RC_POOLCOLL_TEXT_BEGIN RC_POOLTXTCOLL
+#define RC_POOLCOLL_TEXT_END (RC_POOLTXTCOLL + 19)
+#define RC_POOLCOLL_LISTS_BEGIN (RC_POOLTXTCOLL + 20)
+#define RC_POOLCOLL_LISTS_END (RC_POOLTXTCOLL + 69)
+#define RC_POOLCOLL_EXTRA_BEGIN (RC_POOLTXTCOLL + 70)
+#define RC_POOLCOLL_EXTRA_END (RC_POOLTXTCOLL + 89)
+#define RC_POOLCOLL_REGISTER_BEGIN (RC_POOLTXTCOLL + 90)
+#define RC_POOLCOLL_REGISTER_END (RC_POOLTXTCOLL + 119)
+#define RC_POOLCOLL_DOC_BEGIN (RC_POOLTXTCOLL + 130)
+#define RC_POOLCOLL_DOC_END (RC_POOLTXTCOLL + 139)
+#define RC_POOLCOLL_HTML_BEGIN (RC_POOLTXTCOLL + 140)
+#define RC_POOLCOLL_HTML_END (RC_POOLTXTCOLL + 169)
+
+#define RC_POOLTXTCOLL_END RC_POOLCOLL_HTML_END
+
+// Poolvorlagen Seite
+#define RC_POOLPAGEDESC_BEGIN RC_POOLPAGEDESC
+#define RC_POOLPAGEDESC_END (RC_POOLPAGEDESC + 10)
+
+// Poolvorlagen Numerierung
+#define RC_POOLNUMRULE_BEGIN RC_POOLNUMRULE
+#define RC_POOLNUMRULE_END (RC_POOLNUMRULE + 10)
+
+// Pooltemplate Paragraph
+#define STR_POOLPARSTYLE_BEGIN STR_POOLPARSTYLE
+#define STR_POOLPARSTYLE_END (STR_POOLPARSTYLE + 9)
+
+// Envelp-Verzeichnis
+#define RC_ENVELP_BEGIN (RC_ENVELP )
+#define RC_ENVELP_END (RC_ENVELP + 99)
+
+// Statuszeile mit Laufbalken
+#define RC_STATLIN_STR_BEGIN (RC_STATLIN_STR)
+#define RC_STATLIN_STR_END (RC_STATLIN_STR + 49)
+
+// Gemeinsame Core-Strings
+#define RC_COMCORE_BEGIN (RC_COMMON_CORE)
+#define RC_COMCORE_END (RC_COMMON_CORE + 59)
+
+// Shell-Verzeichnis
+#define RC_SHELLS_BEGIN RC_SHELLS
+#define RC_SHELLS_END (RC_SHELLS + 99)
+
+// PopUpMenu's
+#define RC_POPUPS_BEGIN RC_POPUPS
+#define RC_POPUPS_END (RC_POPUPS + 99)
+
+// Strings fuer ConfigItems in div. Verzeichnissen
+#define RC_CFGITEMS_BEGIN RC_CFGITEMS
+#define RC_CFGITEMS_END (RC_CFGITEMS + 99)
+
+// Lingu
+#define RC_LINGU_BEGIN RC_LINGU
+#define RC_LINGU_END (RC_LINGU + 99)
+
+// Accessibility
+#define RC_ACCESS_BEGIN RC_ACCESS
+#define RC_ACCESS_END (RC_ACCESS + 99)
+
+// Undos
+#define RC_UNDO_BEGIN RC_UNDO
+#define RC_UNDO_END (RC_UNDO + 199)
+
+// SMARTTAGS
+// Smarttags
+#define RC_SMARTTAG_BEGIN RC_SMARTTAG
+#define RC_SMARTTAG_END (RC_SMARTTAG + 99)
+
+// unocore
+#define RC_UNOCORE_BEGIN RC_UNOCORE
+#define RC_UNOCORE_END (RC_UNOCORE + 10)
+
+#endif
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
new file mode 100644
index 000000000000..d4242d35f383
--- /dev/null
+++ b/sw/inc/redline.hxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _REDLINE_HXX
+#define _REDLINE_HXX
+
+#include <tools/datetime.hxx>
+#include <tools/string.hxx>
+
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#include <pam.hxx>
+
+#include <IDocumentRedlineAccess.hxx>
+
+#include <svl/smplhint.hxx>
+
+class SfxItemSet;
+class SwView;
+
+class SwRedlineExtraData
+{
+ SwRedlineExtraData( const SwRedlineExtraData& );
+ SwRedlineExtraData& operator=( const SwRedlineExtraData& );
+
+protected:
+ SwRedlineExtraData() {}
+
+public:
+ virtual ~SwRedlineExtraData();
+ virtual SwRedlineExtraData* CreateNew() const = 0;
+
+ virtual void Accept( SwPaM& rPam ) const;
+ virtual void Reject( SwPaM& rPam ) const;
+ virtual int operator == ( const SwRedlineExtraData& ) const;
+};
+
+class SwRedlineExtraData_FmtColl : public SwRedlineExtraData
+{
+ String sFmtNm;
+ SfxItemSet* pSet;
+ sal_uInt16 nPoolId;
+public:
+ SwRedlineExtraData_FmtColl( const String& rColl, sal_uInt16 nPoolFmtId,
+ const SfxItemSet* pSet = 0 );
+ virtual ~SwRedlineExtraData_FmtColl();
+ virtual SwRedlineExtraData* CreateNew() const;
+ virtual void Reject( SwPaM& rPam ) const;
+ virtual int operator == ( const SwRedlineExtraData& ) const;
+
+ void SetItemSet( const SfxItemSet& rSet );
+};
+
+class SwRedlineExtraData_Format : public SwRedlineExtraData
+{
+ SvUShorts aWhichIds;
+
+ SwRedlineExtraData_Format( const SwRedlineExtraData_Format& rCpy );
+
+public:
+ SwRedlineExtraData_Format( const SfxItemSet& rSet );
+ virtual ~SwRedlineExtraData_Format();
+ virtual SwRedlineExtraData* CreateNew() const;
+ virtual void Reject( SwPaM& rPam ) const;
+ virtual int operator == ( const SwRedlineExtraData& ) const;
+};
+
+
+class SW_DLLPUBLIC SwRedlineData
+{
+ friend class SwRedline;
+ SwRedlineData* pNext; // Verweis auf weitere Daten
+ SwRedlineExtraData* pExtraData;
+
+ String sComment;
+ DateTime aStamp;
+ RedlineType_t eType;
+ sal_uInt16 nAuthor, nSeqNo;
+
+public:
+ SwRedlineData( RedlineType_t eT, sal_uInt16 nAut );
+ SwRedlineData( const SwRedlineData& rCpy, sal_Bool bCpyNext = sal_True );
+
+ // fuer sw3io: pNext/pExtraData gehen in eigenen Besitz ueber!
+ SwRedlineData( RedlineType_t eT, sal_uInt16 nAut, const DateTime& rDT,
+ const String& rCmnt, SwRedlineData* pNxt,
+ SwRedlineExtraData* pExtraData = 0 );
+
+ ~SwRedlineData();
+
+ int operator==( const SwRedlineData& rCmp ) const
+ {
+ return nAuthor == rCmp.nAuthor &&
+ eType == rCmp.eType &&
+ sComment == rCmp.sComment &&
+ (( !pNext && !rCmp.pNext ) ||
+ ( pNext && rCmp.pNext && *pNext == *rCmp.pNext )) &&
+ (( !pExtraData && !rCmp.pExtraData ) ||
+ ( pExtraData && rCmp.pExtraData &&
+ *pExtraData == *rCmp.pExtraData ));
+ }
+ int operator!=( const SwRedlineData& rCmp ) const
+ { return !operator==( rCmp ); }
+
+ RedlineType_t GetType() const
+ { return ((RedlineType_t)(eType & nsRedlineType_t::REDLINE_NO_FLAG_MASK)); }
+ RedlineType_t GetRealType() const { return eType; }
+ sal_uInt16 GetAuthor() const { return nAuthor; }
+ const String& GetComment() const { return sComment; }
+ const DateTime& GetTimeStamp() const { return aStamp; }
+ inline const SwRedlineData* Next() const{ return pNext; }
+
+ void SetComment( const String& rS ) { sComment = rS; }
+ void SetTimeStamp( const DateTime& rDT ) { aStamp = rDT; }
+
+ void SetAutoFmtFlag()
+ { eType = (RedlineType_t)(eType | nsRedlineType_t::REDLINE_FORM_AUTOFMT); }
+ int CanCombine( const SwRedlineData& rCmp ) const
+ {
+ return nAuthor == rCmp.nAuthor &&
+ eType == rCmp.eType &&
+ sComment == rCmp.sComment &&
+ GetTimeStamp() == rCmp.GetTimeStamp() &&
+ (( !pNext && !rCmp.pNext ) ||
+ ( pNext && rCmp.pNext &&
+ pNext->CanCombine( *rCmp.pNext ))) &&
+ (( !pExtraData && !rCmp.pExtraData ) ||
+ ( pExtraData && rCmp.pExtraData &&
+ *pExtraData == *rCmp.pExtraData ));
+ }
+
+ // ExtraData wird kopiert, der Pointer geht also NICHT in den Besitz
+ // des RedlineObjectes!
+ void SetExtraData( const SwRedlineExtraData* pData );
+ const SwRedlineExtraData* GetExtraData() const { return pExtraData; }
+
+ // fuers UI-seitige zusammenfassen von Redline-Actionen. Wird z.Z. nur
+ // fuers Autoformat mit Redline benoetigt. Der Wert != 0 bedeutet dabei,
+ // das es noch weitere geben kann!
+ sal_uInt16 GetSeqNo() const { return nSeqNo; }
+ void SetSeqNo( sal_uInt16 nNo ) { nSeqNo = nNo; }
+
+ String GetDescr() const;
+};
+
+
+class SW_DLLPUBLIC SwRedline : public SwPaM
+{
+ SwRedlineData* pRedlineData;
+ SwNodeIndex* pCntntSect;
+ sal_Bool bDelLastPara : 1;
+ sal_Bool bIsLastParaDelete : 1;
+ sal_Bool bIsVisible : 1;
+
+ void MoveToSection();
+ void CopyToSection();
+ void DelCopyOfSection();
+ void MoveFromSection();
+
+public:
+ SwRedline( RedlineType_t eType, const SwPaM& rPam );
+ SwRedline( const SwRedlineData& rData, const SwPaM& rPam );
+ SwRedline( const SwRedlineData& rData, const SwPosition& rPos );
+ // fuer sw3io: pData geht in eigenen Besitz ueber!
+ SwRedline(SwRedlineData* pData, const SwPosition& rPos, sal_Bool bVsbl,
+ sal_Bool bDelLP, sal_Bool bIsPD) :
+ SwPaM( rPos ), pRedlineData( pData ), pCntntSect( 0 ),
+ bDelLastPara( bDelLP ), bIsLastParaDelete( bIsPD ), bIsVisible( bVsbl )
+ {}
+ SwRedline( const SwRedline& );
+ virtual ~SwRedline();
+
+ SwNodeIndex* GetContentIdx() const { return pCntntSect; }
+ // fuers Undo
+ void SetContentIdx( const SwNodeIndex* );
+
+ sal_Bool IsVisible() const { return bIsVisible; }
+ sal_Bool IsDelLastPara() const { return bDelLastPara; }
+
+ // das sal_Bool besagt, ob nach dem setzen der Pos kein Bereich mehr
+ // aufgespannt ist. -> sal_True, ansonten Bereich und sal_False
+ void SetStart( const SwPosition& rPos, SwPosition* pSttPtr = 0 )
+ {
+ if( !pSttPtr ) pSttPtr = Start();
+ *pSttPtr = rPos;
+ }
+ void SetEnd( const SwPosition& rPos, SwPosition* pEndPtr = 0 )
+ {
+ if( !pEndPtr ) pEndPtr = End();
+ *pEndPtr = rPos;
+ }
+ // liegt eine gueltige Selektion vor?
+ sal_Bool HasValidRange() const;
+
+ const SwRedlineData& GetRedlineData(sal_uInt16 nPos = 0) const;
+ int operator==( const SwRedlineData& rCmp ) const
+ { return *pRedlineData == rCmp; }
+ int operator!=( const SwRedlineData& rCmp ) const
+ { return *pRedlineData != rCmp; }
+ void SetAutoFmtFlag() { pRedlineData->SetAutoFmtFlag(); }
+
+ sal_uInt16 GetStackCount() const;
+ sal_uInt16 GetAuthor( sal_uInt16 nPos = 0) const;
+ const String& GetAuthorString( sal_uInt16 nPos = 0 ) const;
+ const DateTime& GetTimeStamp( sal_uInt16 nPos = 0) const;
+ RedlineType_t GetRealType( sal_uInt16 nPos = 0 ) const;
+ RedlineType_t GetType( sal_uInt16 nPos = 0) const
+ { return ( (RedlineType_t)(GetRealType( nPos ) & nsRedlineType_t::REDLINE_NO_FLAG_MASK)); }
+ const String& GetComment( sal_uInt16 nPos = 0 ) const;
+
+ void SetComment( const String& rS ) { pRedlineData->SetComment( rS ); }
+
+ // ExtraData wird kopiert, der Pointer geht also NICHT in den Besitz
+ // des RedlineObjectes!
+ void SetExtraData( const SwRedlineExtraData* pData )
+ { pRedlineData->SetExtraData( pData ); }
+ const SwRedlineExtraData* GetExtraData() const
+ { return pRedlineData->GetExtraData(); }
+
+ // fuers UI-seitige zusammenfassen von Redline-Actionen. Wird z.Z. nur
+ // fuers Autoformat mit Redline benoetigt. Der Wert != 0 bedeutet dabei,
+ // das es noch weitere geben kann!
+ sal_uInt16 GetSeqNo() const { return pRedlineData->GetSeqNo(); }
+ void SetSeqNo( sal_uInt16 nNo ) { pRedlineData->SetSeqNo( nNo ); }
+
+ // Beim Hide/ShowOriginal wird 2 mal ueber die Liste gelaufen, damit
+ // die Del-Redlines per Copy und Delete versteckt werden. Beim Move
+ // wird sonst die Attributierung falsch behandelt.
+ // Alle anderen Aufrufer muessen immer 0 angeben.
+ void CallDisplayFunc( sal_uInt16 nLoop = 0 );
+ void Show( sal_uInt16 nLoop = 0 );
+ void Hide( sal_uInt16 nLoop = 0 );
+ void ShowOriginal( sal_uInt16 nLoop = 0 );
+
+ // calculates the intersection with text node number nNdIdx
+ void CalcStartEnd( sal_uLong nNdIdx, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
+
+ void InvalidateRange(); // das Layout anstossen
+
+ sal_Bool IsOwnRedline( const SwRedline& rRedl ) const
+ { return GetAuthor() == rRedl.GetAuthor(); }
+ sal_Bool CanCombine( const SwRedline& rRedl ) const;
+
+ void PushData( const SwRedline& rRedl, sal_Bool bOwnAsNext = sal_True );
+ sal_Bool PopData();
+
+ // #111827#
+ /**
+ Returns textual description of this a redline data element of
+ this redline.
+
+ @param nPos index of the redline data element to describe
+
+ The textual description of the selected element contains the
+ kind of redline and the possibly shortened text of the redline.
+
+ @return textual description of the selected redline data element
+ */
+ String GetDescr(sal_uInt16 nPos = 0);
+
+ int operator==( const SwRedline& ) const;
+ int operator<( const SwRedline& ) const;
+};
+
+class SW_DLLPUBLIC SwRedlineHint : public SfxHint
+{
+#define SWREDLINE_INSERTED 1
+#define SWREDLINE_REMOVED 2
+#define SWREDLINE_FOCUS 3
+#define SWREDLINE_CHANGED 4
+#define SWREDLINE_LANGUAGE 5
+
+ const SwRedline* pRedline;
+ sal_Int16 nWhich;
+ const SwView* pView;
+
+public:
+ SwRedlineHint( const SwRedline* p, sal_Int16 n, const SwView* pV = 0)
+ : pRedline(p)
+ , nWhich(n)
+ , pView(pV)
+ {}
+
+ TYPEINFO();
+ const SwRedline* GetRedline() const { return pRedline; }
+ sal_Int16 Which() const { return nWhich; }
+ const SwView* GetView() const { return pView; }
+};
+
+
+#endif
diff --git a/sw/inc/redlnaut.hxx b/sw/inc/redlnaut.hxx
new file mode 100644
index 000000000000..e1a238f0704b
--- /dev/null
+++ b/sw/inc/redlnaut.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _REDLNAUT_HXX
+#define _REDLNAUT_HXX
+
+#include <tools/string.hxx>
+#include <tools/color.hxx>
+
+#include "swtypes.hxx"
+
+class SfxItemSet;
+class SwAttrPool;
+
+class SwRedlineAuthor
+{
+ String sAuthor;
+ Color aChgLineColor;
+ SfxItemSet *pInsAttrSet, *pDelAttrSet, *pFmtAttrSet;
+ short eChgLineOrient;
+ sal_uInt8 cDelChar;
+public:
+ SwRedlineAuthor( SwAttrPool& rPool, const String& );
+ SwRedlineAuthor( const SwRedlineAuthor& );
+ ~SwRedlineAuthor();
+
+ SwRedlineAuthor& operator=( const SwRedlineAuthor& );
+};
+
+
+#endif
diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
new file mode 100644
index 000000000000..daf690861260
--- /dev/null
+++ b/sw/inc/reffld.hxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_REFFLD_HXX
+#define SW_REFFLD_HXX
+
+#include <fldbas.hxx>
+
+class SfxPoolItem;
+class SwDoc;
+class SwTxtNode;
+class SwTxtFld;
+
+enum REFERENCESUBTYPE
+{
+ REF_SETREFATTR = 0,
+ REF_SEQUENCEFLD,
+ REF_BOOKMARK,
+ REF_OUTLINE,
+ REF_FOOTNOTE,
+ REF_ENDNOTE
+};
+
+enum REFERENCEMARK
+{
+ REF_BEGIN,
+ REF_PAGE = REF_BEGIN,
+ REF_CHAPTER,
+ REF_CONTENT,
+ REF_UPDOWN,
+ REF_PAGE_PGDESC,
+ REF_ONLYNUMBER,
+ REF_ONLYCAPTION,
+ REF_ONLYSEQNO,
+ // --> OD 2007-08-24 #i81002#
+ // new reference format types for referencing bookmarks and set references
+ REF_NUMBER,
+ REF_NUMBER_NO_CONTEXT,
+ REF_NUMBER_FULL_CONTEXT,
+ // <--
+ REF_END
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Referenz holen
+ --------------------------------------------------------------------*/
+
+class SwGetRefFieldType : public SwFieldType
+{
+ SwDoc* pDoc;
+protected:
+ // ueberlagert, um alle Ref-Felder zu updaten
+ virtual void Modify( const SfxPoolItem*, const SfxPoolItem * );
+public:
+ SwGetRefFieldType(SwDoc* pDoc );
+ virtual SwFieldType* Copy() const;
+
+ SwDoc* GetDoc() const { return pDoc; }
+
+ void MergeWithOtherDoc( SwDoc& rDestDoc );
+
+ static SwTxtNode* FindAnchor( SwDoc* pDoc, const String& rRefMark,
+ sal_uInt16 nSubType, sal_uInt16 nSeqNo,
+ sal_uInt16* pStt, sal_uInt16* pEnd = 0 );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Referenzfeld
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwGetRefField : public SwField
+{
+private:
+ String sSetRefName;
+ String sTxt;
+ sal_uInt16 nSubType;
+ sal_uInt16 nSeqNo;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+ // --> OD 2007-08-24 #i81002#
+ String MakeRefNumStr( const SwTxtNode& rTxtNodeOfField,
+ const SwTxtNode& rTxtNodeOfReferencedItem,
+ const sal_uInt32 nRefNumFormat ) const;
+ // <--
+public:
+ SwGetRefField( SwGetRefFieldType*, const String& rSetRef,
+ sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFmt );
+
+ virtual ~SwGetRefField();
+
+ virtual String GetFieldName() const;
+
+ const String& GetSetRefName() const { return sSetRefName; }
+
+ // --> OD 2007-09-06 #i81002#
+ // The <SwTxtFld> instance, which represents the text attribute for the
+ // <SwGetRefField> instance, has to be passed to the method.
+ // This <SwTxtFld> instance is needed for the reference format type REF_UPDOWN
+ // and REF_NUMBER.
+ // Note: This instance may be NULL (field in Undo/Redo). This will cause
+ // no update for these reference format types.
+ void UpdateField( const SwTxtFld* pFldTxtAttr );
+ // <--
+ void SetExpand( const String& rStr ) { sTxt = rStr; }
+
+ // SubType erfragen/setzen
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType( sal_uInt16 n );
+
+ // --> OD 2007-11-09 #i81002#
+ bool IsRefToHeadingCrossRefBookmark() const;
+ bool IsRefToNumItemCrossRefBookmark() const;
+ const SwTxtNode* GetReferencedTxtNode() const;
+ // <--
+ // --> OD 2008-01-09 #i85090#
+ String GetExpandedTxtOfReferencedTxtNode() const;
+ // <--
+
+ // SequenceNo erfragen/setzen (nur fuer REF_SEQUENCEFLD interressant)
+ sal_uInt16 GetSeqNo() const { return nSeqNo; }
+ void SetSeqNo( sal_uInt16 n ) { nSeqNo = n; }
+
+ // Name der Referenz
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
+
+ virtual String GetPar2() const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId );
+
+ void ConvertProgrammaticToUIName();
+
+ virtual String GetDescription() const;
+};
+
+
+#endif // SW_REFFLD_HXX
+
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
new file mode 100644
index 000000000000..db9fe273a229
--- /dev/null
+++ b/sw/inc/ring.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _RING_HXX
+#define _RING_HXX
+
+#include <swdllapi.h>
+#include <swtypes.hxx>
+
+class SW_DLLPUBLIC Ring
+{
+ Ring *pNext;
+ Ring* pPrev; // zur Optimierung, damit das ein/ausketten schneller geht!
+
+protected:
+ Ring() { pNext = this; pPrev = this; }
+ Ring( Ring * );
+public:
+ virtual ~Ring();
+ void MoveTo( Ring *pDestRing );
+ void MoveRingTo( Ring *pDestRing );
+
+ Ring* GetNext() const { return pNext; }
+ Ring* GetPrev() const { return pPrev; }
+
+ sal_uInt32 numberOf() const;
+};
+
+
+#endif
diff --git a/sw/inc/rubylist.hxx b/sw/inc/rubylist.hxx
new file mode 100644
index 000000000000..7ade01996237
--- /dev/null
+++ b/sw/inc/rubylist.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _RUBYLIST_HXX
+#define _RUBYLIST_HXX
+
+#include <svl/svarray.hxx>
+#include <swtypes.hxx>
+#include <fmtruby.hxx>
+
+class SwRubyListEntry
+{
+ String sText;
+ SwFmtRuby aRubyAttr;
+public:
+ SwRubyListEntry() : aRubyAttr( aEmptyStr ) {}
+ ~SwRubyListEntry();
+
+ const String& GetText() const { return sText; }
+ void SetText( const String& rStr ) { sText = rStr; }
+
+ const SwFmtRuby& GetRubyAttr() const { return aRubyAttr; }
+ SwFmtRuby& GetRubyAttr() { return aRubyAttr; }
+ void SetRubyAttr( const SwFmtRuby& rAttr ) { aRubyAttr = rAttr; }
+};
+
+typedef SwRubyListEntry* SwRubyListEntryPtr;
+SV_DECL_PTRARR_DEL( SwRubyList, SwRubyListEntryPtr, 0, 32 )
+
+
+#endif //_RUBYLIST_HXX
diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx
new file mode 100644
index 000000000000..ad8bddde0007
--- /dev/null
+++ b/sw/inc/section.hxx
@@ -0,0 +1,389 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SECTION_HXX
+#define _SECTION_HXX
+
+#include <boost/utility.hpp>
+
+#include <com/sun/star/uno/Sequence.h>
+
+#include <tools/rtti.hxx>
+#include <tools/ref.hxx>
+#include <svl/svarray.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <sfx2/Metadatable.hxx>
+
+#include <frmfmt.hxx>
+
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XTextSection; }
+} } }
+
+// Forward Deklaration
+class SwSectionFmt;
+class SwDoc;
+class SwSection;
+class SwSectionNode;
+class SwTOXBase;
+
+#ifndef SW_DECL_SWSERVEROBJECT_DEFINED
+#define SW_DECL_SWSERVEROBJECT_DEFINED
+SV_DECL_REF( SwServerObject )
+#endif
+
+SV_DECL_PTRARR( SwSections, SwSection*, 0, 4 )
+
+enum SectionType { CONTENT_SECTION,
+ TOX_HEADER_SECTION,
+ TOX_CONTENT_SECTION,
+ DDE_LINK_SECTION = OBJECT_CLIENT_DDE,
+ FILE_LINK_SECTION = OBJECT_CLIENT_FILE
+/*
+// verbleiben noch:
+ OBJECT_CLIENT_SO = 0x80,
+ OBJECT_CLIENT_OLE = 0x82,
+ OBJECT_CLIENT_OLE_CACHE = 0x83,
+*/
+ };
+
+enum LinkCreateType
+{
+ CREATE_NONE, // nichts weiter tun
+ CREATE_CONNECT, // Link gleich connecten
+ CREATE_UPDATE // Link connecten und updaten
+};
+
+class SW_DLLPUBLIC SwSectionData
+{
+private:
+ SectionType m_eType;
+
+ String m_sSectionName;
+ String m_sCondition;
+ String m_sLinkFileName;
+ String m_sLinkFilePassword; // JP 27.02.2001: must be changed to Sequence
+ ::com::sun::star::uno::Sequence <sal_Int8> m_Password;
+
+ /// it seems this flag caches the current final "hidden" state
+ bool m_bHiddenFlag : 1;
+ /// flags that correspond to attributes in the format:
+ /// may have different value than format attribute:
+ /// format attr has value for this section, while flag is
+ /// effectively ORed with parent sections!
+ bool m_bProtectFlag : 1;
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ bool m_bEditInReadonlyFlag : 1;
+ // <--
+ bool m_bHidden : 1; // all paragraphs hidden?
+ bool m_bCondHiddenFlag : 1; // Hiddenflag for condition
+ bool m_bConnectFlag : 1; // connected to server?
+
+public:
+
+ SwSectionData(SectionType const eType, String const& rName);
+ explicit SwSectionData(SwSection const&);
+ SwSectionData(SwSectionData const&);
+ SwSectionData & operator=(SwSectionData const&);
+ bool operator==(SwSectionData const&) const;
+
+ String const& GetSectionName() const { return m_sSectionName; }
+ void SetSectionName(String const& rName){ m_sSectionName = rName; }
+ SectionType GetType() const { return m_eType; }
+ void SetType(SectionType const eNew) { m_eType = eNew; }
+
+ bool IsHidden() const { return m_bHidden; }
+ void SetHidden(bool const bFlag = true) { m_bHidden = bFlag; }
+
+ bool IsHiddenFlag() const { return m_bHiddenFlag; }
+ SW_DLLPRIVATE void
+ SetHiddenFlag(bool const bFlag) { m_bHiddenFlag = bFlag; }
+ bool IsProtectFlag() const { return m_bProtectFlag; }
+ SW_DLLPRIVATE void
+ SetProtectFlag(bool const bFlag) { m_bProtectFlag = bFlag; }
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ bool IsEditInReadonlyFlag() const { return m_bEditInReadonlyFlag; }
+ void SetEditInReadonlyFlag(bool const bFlag)
+ { m_bEditInReadonlyFlag = bFlag; }
+ // <--
+
+ void SetCondHidden(bool const bFlag = true) { m_bCondHiddenFlag = bFlag; };
+ bool IsCondHidden() const { return m_bCondHiddenFlag; }
+
+ String const& GetCondition() const { return m_sCondition; }
+ void SetCondition(String const& rNew) { m_sCondition = rNew; }
+
+ String const& GetLinkFileName() const { return m_sLinkFileName; };
+ void SetLinkFileName(String const& rNew, String const* pPassWd = 0)
+ {
+ m_sLinkFileName = rNew;
+ if (pPassWd) { SetLinkFilePassword(*pPassWd); }
+ }
+
+ String const& GetLinkFilePassword() const { return m_sLinkFilePassword; }
+ void SetLinkFilePassword(String const& rS) { m_sLinkFilePassword = rS; }
+
+ ::com::sun::star::uno::Sequence<sal_Int8> const& GetPassword() const
+ { return m_Password; }
+ void SetPassword(::com::sun::star::uno::Sequence<sal_Int8> const& rNew)
+ { m_Password = rNew; }
+ bool IsLinkType() const
+ { return (DDE_LINK_SECTION == m_eType) || (FILE_LINK_SECTION == m_eType); }
+
+ bool IsConnectFlag() const { return m_bConnectFlag; }
+ void SetConnectFlag(bool const bFlag = true){ m_bConnectFlag = bFlag; }
+};
+
+class SW_DLLPUBLIC SwSection
+ : public SwClient
+{
+ // damit beim Anlegen/Loeschen von Frames das Flag richtig gepflegt wird!
+ friend class SwSectionNode;
+ // the "read CTOR" of SwSectionFrm have to change the Hiddenflag
+ friend class SwSectionFrm;
+
+private:
+ SwSectionData m_Data;
+
+ SwServerObjectRef m_RefObj; // set if DataServer
+ ::sfx2::SvBaseLinkRef m_RefLink;
+
+ SW_DLLPRIVATE void ImplSetHiddenFlag(
+ bool const bHidden, bool const bCondition);
+
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
+
+public:
+ TYPEINFO(); // rtti
+
+ SwSection(SectionType const eType, String const& rName,
+ SwSectionFmt & rFormat);
+ virtual ~SwSection();
+
+ bool DataEquals(SwSectionData const& rCmp) const;
+
+ void SetSectionData(SwSectionData const& rData);
+
+ String const& GetSectionName() const { return m_Data.GetSectionName(); }
+ void SetSectionName(String const& rName){ m_Data.SetSectionName(rName); }
+ SectionType GetType() const { return m_Data.GetType(); }
+ void SetType(SectionType const eType) { return m_Data.SetType(eType); }
+
+ SwSectionFmt* GetFmt() { return (SwSectionFmt*)GetRegisteredIn(); }
+ SwSectionFmt* GetFmt() const { return (SwSectionFmt*)GetRegisteredIn(); }
+
+ // setze die Hidden/Protected -> gesamten Baum updaten !
+ // (Attribute/Flags werden gesetzt/erfragt)
+ bool IsHidden() const { return m_Data.IsHidden(); }
+ void SetHidden (bool const bFlag = true);
+ bool IsProtect() const;
+ void SetProtect(bool const bFlag = true);
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ bool IsEditInReadonly() const;
+ void SetEditInReadonly(bool const bFlag = true);
+ // <--
+
+ // erfrage die internen Flags (Zustand inklusive Parents nicht, was
+ // aktuell an der Section gesetzt ist!!)
+ bool IsHiddenFlag() const { return m_Data.IsHiddenFlag(); }
+ bool IsProtectFlag() const { return m_Data.IsProtectFlag(); }
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ bool IsEditInReadonlyFlag() const { return m_Data.IsEditInReadonlyFlag(); }
+ // <--
+
+ void SetCondHidden(bool const bFlag = true);
+ bool IsCondHidden() const { return m_Data.IsCondHidden(); }
+ // erfrage (auch ueber die Parents), ob diese Section versteckt sein soll.
+ sal_Bool CalcHiddenFlag() const;
+
+
+ inline SwSection* GetParent() const;
+
+ String const& GetCondition() const { return m_Data.GetCondition(); }
+ void SetCondition(String const& rNew) { m_Data.SetCondition(rNew); }
+
+ const String& GetLinkFileName() const;
+ void SetLinkFileName(String const& rNew, String const*const pPassWd = 0);
+ // password of linked file (only valid during runtime!)
+ String const& GetLinkFilePassword() const
+ { return m_Data.GetLinkFilePassword(); }
+ void SetLinkFilePassword(String const& rS)
+ { m_Data.SetLinkFilePassword(rS); }
+
+ // get / set password of this section
+ ::com::sun::star::uno::Sequence<sal_Int8> const& GetPassword() const
+ { return m_Data.GetPassword(); }
+ void SetPassword(::com::sun::star::uno::Sequence <sal_Int8> const& rNew)
+ { m_Data.SetPassword(rNew); }
+
+ // Daten Server-Methoden
+ void SetRefObject( SwServerObject* pObj );
+ const SwServerObject* GetObject() const { return & m_RefObj; }
+ SwServerObject* GetObject() { return & m_RefObj; }
+ bool IsServer() const { return m_RefObj.Is(); }
+
+ // Methoden fuer gelinkte Bereiche
+ sal_uInt16 GetUpdateType() const { return m_RefLink->GetUpdateMode(); }
+ void SetUpdateType(sal_uInt16 const nType )
+ { m_RefLink->SetUpdateMode(nType); }
+
+ bool IsConnected() const { return m_RefLink.Is(); }
+ void UpdateNow() { m_RefLink->Update(); }
+ void Disconnect() { m_RefLink->Disconnect(); }
+
+ const ::sfx2::SvBaseLink& GetBaseLink() const { return *m_RefLink; }
+ ::sfx2::SvBaseLink& GetBaseLink() { return *m_RefLink; }
+
+ void CreateLink( LinkCreateType eType );
+
+ void MakeChildLinksVisible( const SwSectionNode& rSectNd );
+
+ bool IsLinkType() const { return m_Data.IsLinkType(); }
+
+ // Flags fuer UI - Verbindung geklappt?
+ bool IsConnectFlag() const { return m_Data.IsConnectFlag(); }
+ void SetConnectFlag(bool const bFlag = true)
+ { m_Data.SetConnectFlag(bFlag); }
+
+ // return the TOX base class if the section is a TOX section
+ const SwTOXBase* GetTOXBase() const;
+
+ // --> OD 2007-02-14 #b6521322#
+ void BreakLink();
+ // <--
+
+};
+
+
+enum SectionSort { SORTSECT_NOT, SORTSECT_NAME, SORTSECT_POS };
+
+class SW_DLLPUBLIC SwSectionFmt
+ : public SwFrmFmt
+ , public ::sfx2::Metadatable
+{
+ friend class SwDoc;
+
+ /** why does this exist in addition to the m_wXObject in SwFrmFmt?
+ in case of an index, both a SwXDocumentIndex and a SwXTextSection
+ register at this SwSectionFmt, so we need to have two refs.
+ */
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::text::XTextSection> m_wXTextSection;
+
+ SW_DLLPRIVATE void UpdateParent(); // Parent wurde veraendert
+
+protected:
+ SwSectionFmt( SwSectionFmt* pDrvdFrm, SwDoc *pDoc );
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+ ~SwSectionFmt();
+
+ //Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt).
+ virtual void DelFrms();
+
+ //Erzeugt die Ansichten
+ virtual void MakeFrms();
+
+ // erfrage vom Format Informationen
+ virtual sal_Bool GetInfo( SfxPoolItem& ) const;
+
+ SwSection* GetSection() const;
+ inline SwSectionFmt* GetParent() const;
+ inline SwSection* GetParentSection() const;
+
+ // alle Sections, die von dieser abgeleitet sind
+ // - sortiert nach : Name oder Position oder unsortiert
+ // - alle oder nur die, die sich im normalten Nodes-Array befinden
+ sal_uInt16 GetChildSections( SwSections& rArr,
+ SectionSort eSort = SORTSECT_NOT,
+ sal_Bool bAllSections = sal_True ) const;
+
+ // erfrage, ob sich die Section im Nodes-Array oder UndoNodes-Array
+ // befindet.
+ sal_Bool IsInNodesArr() const;
+
+ SwSectionNode* GetSectionNode(bool const bEvenIfInUndo = false);
+ const SwSectionNode* GetSectionNode(bool const bEvenIfInUndo = false) const
+ { return const_cast<SwSectionFmt *>(this)
+ ->GetSectionNode(bEvenIfInUndo); }
+
+ // ist die Section eine gueltige fuers GlobalDocument?
+ const SwSection* GetGlobalDocSection() const;
+
+ SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::text::XTextSection> const& GetXTextSection() const
+ { return m_wXTextSection; }
+ SW_DLLPRIVATE void SetXTextSection(::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextSection> const& xTextSection)
+ { m_wXTextSection = xTextSection; }
+
+ // sfx2::Metadatable
+ virtual ::sfx2::IXmlIdRegistry& GetRegistry();
+ virtual bool IsInClipboard() const;
+ virtual bool IsInUndo() const;
+ virtual bool IsInContent() const;
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > MakeUnoObject();
+
+};
+
+// -------------- inlines ---------------------------------
+
+inline SwSection* SwSection::GetParent() const
+{
+ SwSectionFmt* pFmt = GetFmt();
+ SwSection* pRet = 0;
+ if( pFmt )
+ pRet = pFmt->GetParentSection();
+ return pRet;
+}
+
+inline SwSectionFmt* SwSectionFmt::GetParent() const
+{
+ SwSectionFmt* pRet = 0;
+ if( GetRegisteredIn() )
+ pRet = PTR_CAST( SwSectionFmt, GetRegisteredIn() );
+ return pRet;
+}
+
+inline SwSection* SwSectionFmt::GetParentSection() const
+{
+ SwSectionFmt* pParent = GetParent();
+ SwSection* pRet = 0;
+ if( pParent )
+ {
+ pRet = pParent->GetSection();
+ }
+ return pRet;
+}
+
+
+#endif /* _SECTION_HXX */
diff --git a/sw/inc/shellid.hxx b/sw/inc/shellid.hxx
new file mode 100644
index 000000000000..7ca50ff1e183
--- /dev/null
+++ b/sw/inc/shellid.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SHELLID_HXX
+#define _SHELLID_HXX
+
+#include <sfx2/shell.hxx>
+
+/*--------------------------------------------------------------------
+ Beschreibung: Mapping fuer UI-Parameter
+ --------------------------------------------------------------------*/
+
+#define SW_BASESHELL (SFX_INTERFACE_SW_START + 1)
+#define SW_TEXTSHELL (SFX_INTERFACE_SW_START + 2)
+#define SW_LISTSHELL (SFX_INTERFACE_SW_START + 3)
+#define SW_TABSHELL (SFX_INTERFACE_SW_START + 4)
+#define SW_FRAMESHELL (SFX_INTERFACE_SW_START + 5)
+#define SW_GRFSHELL (SFX_INTERFACE_SW_START + 6)
+#define SW_OLESHELL (SFX_INTERFACE_SW_START + 7)
+#define SW_DRAWSHELL (SFX_INTERFACE_SW_START + 8)
+#define SW_DRWTXTSHELL (SFX_INTERFACE_SW_START + 9)
+
+#define SW_INTERFACE_MODULE (SFX_INTERFACE_SW_START + 10)
+#define SW_DOCSHELL (SFX_INTERFACE_SW_START + 11)
+#define SW_VIEWSHELL (SFX_INTERFACE_SW_START + 12)
+#define SW_PAGEPREVIEW (SFX_INTERFACE_SW_START + 13)
+#define SW_GLOSDOCSHELL (SFX_INTERFACE_SW_START + 14)
+#define SW_SRC_VIEWSHELL (SFX_INTERFACE_SW_START + 15)
+
+#define SW_BEZIERSHELL (SFX_INTERFACE_SW_START + 16)
+#define SW_DRAWBASESHELL (SFX_INTERFACE_SW_START + 17)
+#define SW_DRAWFORMSHELL (SFX_INTERFACE_SW_START + 18)
+
+#define SW_WEBDOCSHELL (SFX_INTERFACE_SW_START + 19)
+#define SW_WEBVIEWSHELL (SFX_INTERFACE_SW_START + 20)
+#define SW_WEBBASESHELL (SFX_INTERFACE_SW_START + 21)
+#define SW_WEBTEXTSHELL (SFX_INTERFACE_SW_START + 22)
+#define SW_WEBFRAMESHELL (SFX_INTERFACE_SW_START + 23)
+#define SW_WEBGLOSDOCSHELL (SFX_INTERFACE_SW_START + 24)
+#define SW_WEBLISTSHELL (SFX_INTERFACE_SW_START + 25)
+#define SW_WEBTABSHELL (SFX_INTERFACE_SW_START + 26)
+#define SW_WEBGRFSHELL (SFX_INTERFACE_SW_START + 27)
+#define SW_WEBOLESHELL (SFX_INTERFACE_SW_START + 28)
+#define SW_WEBDRAWBASESHELL (SFX_INTERFACE_SW_START + 29)
+#define SW_WEBDRAWFORMSHELL (SFX_INTERFACE_SW_START + 30)
+
+#define SW_MEDIASHELL (SFX_INTERFACE_SW_START + 31)
+#define SW_ANNOTATIONSHELL (SFX_INTERFACE_SW_START + 32)
+
+#endif // _UIPARAM_HXX
diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
new file mode 100644
index 000000000000..acfb213911db
--- /dev/null
+++ b/sw/inc/shellio.hxx
@@ -0,0 +1,678 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_SHELLIO_HXX
+#define SW_SHELLIO_HXX
+
+#include <memory>
+#include <boost/utility.hpp>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sot/formats.hxx>
+#include <sot/storage.hxx>
+#include <svtools/parhtml.hxx>
+#include <tools/string.hxx>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <tools/datetime.hxx>
+#include <tools/ref.hxx>
+#include <tools/urlobj.hxx>
+#include <swdllapi.h>
+#include <swtypes.hxx>
+#include <docfac.hxx> // SwDocFac
+#include <errhdl.hxx>
+#include <iodetect.hxx>
+
+// einige Forward - Deklarationen
+class SfxFilterContainer;
+class SfxFilter;
+class SfxItemPool;
+class SfxItemSet;
+class SfxMedium;
+class SvPtrarr;
+class SvStream;
+class SvStrings;
+class SvxFontItem;
+class SvxMacroTableDtor;
+//class Sw3Io;
+class SwCntntNode;
+class SwCrsrShell;
+class SwDoc;
+class SwPaM;
+class SwTextBlocks;
+struct SwPosition;
+struct Writer_Impl;
+
+// ab so vielen chars wird ein mit einem ASCII/W4W-Reader eingelesener
+// Absatz zwangsweise umgebrochen. Muss immer groesser als 200 sein !!!
+#define MAX_ASCII_PARA 10000
+
+
+class SW_DLLPUBLIC SwAsciiOptions
+{
+ String sFont;
+ rtl_TextEncoding eCharSet;
+ sal_uInt16 nLanguage;
+ LineEnd eCRLF_Flag;
+
+public:
+
+ const String& GetFontName() const { return sFont; }
+ void SetFontName( const String& rFont ) { sFont = rFont; }
+
+ rtl_TextEncoding GetCharSet() const { return eCharSet; }
+ void SetCharSet( rtl_TextEncoding nVal ) { eCharSet = nVal; }
+
+ sal_uInt16 GetLanguage() const { return nLanguage; }
+ void SetLanguage( sal_uInt16 nVal ) { nLanguage = nVal; }
+
+ LineEnd GetParaFlags() const { return eCRLF_Flag; }
+ void SetParaFlags( LineEnd eVal ) { eCRLF_Flag = eVal; }
+
+ void Reset()
+ {
+ sFont.Erase();
+ eCRLF_Flag = GetSystemLineEnd();
+ eCharSet = ::gsl_getSystemTextEncoding();
+ nLanguage = 0;
+ }
+ // for the automatic conversion (mail/news/...)
+ void ReadUserData( const String& );
+ void WriteUserData( String& );
+
+ SwAsciiOptions() { Reset(); }
+};
+
+/**************** SwReader/Reader ************************/
+// Basisklasse der moeglichen Optionen fuer einen speziellen Reader
+class Reader;
+// Ruft den Reader mit seinen Optionen, Dokument, Cursor etc.
+class SwReader;
+// SwRead ist der Pointer auf die Read-Optionen-Basisklasse
+typedef Reader *SwRead;
+
+class SwgReaderOption
+{
+ SwAsciiOptions aASCIIOpts;
+ union
+ {
+ sal_Bool bFmtsOnly;
+ struct
+ {
+ sal_Bool bFrmFmts: 1;
+ sal_Bool bPageDescs: 1;
+ sal_Bool bTxtFmts: 1;
+ sal_Bool bNumRules: 1;
+ sal_Bool bMerge:1;
+ } Fmts;
+ } What;
+
+public:
+ void ResetAllFmtsOnly() { What.bFmtsOnly = 0; }
+ sal_Bool IsFmtsOnly() const { return What.bFmtsOnly; }
+
+ sal_Bool IsFrmFmts() const { return What.Fmts.bFrmFmts; }
+ void SetFrmFmts( const sal_Bool bNew) { What.Fmts.bFrmFmts = bNew; }
+
+ sal_Bool IsPageDescs() const { return What.Fmts.bPageDescs; }
+ void SetPageDescs( const sal_Bool bNew) { What.Fmts.bPageDescs = bNew; }
+
+ sal_Bool IsTxtFmts() const { return What.Fmts.bTxtFmts; }
+ void SetTxtFmts( const sal_Bool bNew) { What.Fmts.bTxtFmts = bNew; }
+
+ sal_Bool IsNumRules() const { return What.Fmts.bNumRules; }
+ void SetNumRules( const sal_Bool bNew) { What.Fmts.bNumRules = bNew; }
+
+ sal_Bool IsMerge() const { return What.Fmts.bMerge; }
+ void SetMerge( const sal_Bool bNew ) { What.Fmts.bMerge = bNew; }
+
+ const SwAsciiOptions& GetASCIIOpts() const { return aASCIIOpts; }
+ void SetASCIIOpts( const SwAsciiOptions& rOpts ) { aASCIIOpts = rOpts; }
+ void ResetASCIIOpts() { aASCIIOpts.Reset(); }
+
+ SwgReaderOption()
+ { ResetAllFmtsOnly(); aASCIIOpts.Reset(); }
+};
+
+class SwReader: public SwDocFac
+{
+ SvStream* pStrm;
+ SotStorageRef pStg;
+ com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
+ SfxMedium* pMedium; // wer ein Medium haben will (W4W)
+
+ SwPaM* pCrsr;
+ String aFileName;
+ String sBaseURL;
+
+public:
+ /*
+ * Initiales Einlesen. Dokument wird erst beim Read(..) angelegt.
+ * JP 25.04.95: oder falls es mitgegeben wird, in dieses.
+ * Sonderfall fuer Load mit Sw3Reader
+ */
+ //SwReader( SotStorage&, const String& rFilename, SwDoc *pDoc = 0 );
+ //SwReader( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFilename, SwDoc *pDoc = 0 );
+ SwReader( SfxMedium&, const String& rFilename, SwDoc *pDoc = 0 );
+ /*
+ * In ein existierendes Dokument einlesen, Dokument und
+ * Position im Dokument werden aus dem SwPaM uebernommen.
+ */
+ SwReader( SvStream&, const String& rFilename, const String& rBaseURL, SwPaM& );
+ //SwReader( SotStorage&, const String& rFilename, SwPaM& );
+ SwReader( SfxMedium&, const String& rFilename, SwPaM& );
+ SwReader( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFilename, SwPaM& );
+
+ /*
+ * Nur SwReader::Read(...) ist die Export-Schnittstelle!!!
+ */
+ sal_Bool NeedsPasswd( const Reader& );
+ sal_Bool CheckPasswd( const String&, const Reader& );
+ sal_uLong Read( const Reader& );
+
+ // ask for glossaries
+ sal_Bool HasGlossaries( const Reader& );
+ sal_Bool ReadGlossaries( const Reader&, SwTextBlocks&, sal_Bool bSaveRelFiles );
+
+ const String& GetBaseURL() const { return sBaseURL;}
+
+protected:
+ void SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
+};
+
+
+
+/* */
+/**************** SPEZIELLE Reader ************************/
+
+// spezielle - Reader koennen beides sein !! (Excel, W4W, .. )
+#define SW_STREAM_READER 1
+#define SW_STORAGE_READER 2
+
+class SW_DLLPUBLIC Reader
+{
+ friend class SwReader;
+ SwDoc* pTemplate;
+ String aTemplateNm;
+ //String sBaseURL;
+
+ Date aDStamp;
+ Time aTStamp;
+ DateTime aChkDateTime;
+
+protected:
+ SvStream* pStrm;
+ SotStorageRef pStg;
+ com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
+ SfxMedium* pMedium; // wer ein Medium haben will (W4W)
+
+ SwgReaderOption aOpt;
+ sal_Bool bInsertMode : 1;
+ sal_Bool bTmplBrowseMode : 1;
+ sal_Bool bReadUTF8: 1; // Stream als UTF-8 interpretieren
+ sal_Bool bBlockMode: 1;
+ sal_Bool bOrganizerMode : 1;
+ sal_Bool bHasAskTemplateName : 1;
+ sal_Bool bIgnoreHTMLComments : 1;
+
+ virtual String GetTemplateName() const;
+
+public:
+ Reader();
+ virtual ~Reader();
+
+ virtual int GetReaderType();
+ SwgReaderOption& GetReaderOpt() { return aOpt; }
+
+ virtual void SetFltName( const String& rFltNm );
+ static void SetNoOutlineNum( SwDoc& rDoc );
+
+ // den Item-Set eines Frm-Formats an das alte Format anpassen
+ static void ResetFrmFmtAttrs( SfxItemSet &rFrmSet );
+
+ // die Rahmen-/Grafik-/OLE-Vorlagen an das alte Format (ohne
+ // Umrandung etc.) anpassen
+ static void ResetFrmFmts( SwDoc& rDoc );
+
+ // Die Filter-Vorlage laden, setzen und wieder freigeben
+ SwDoc* GetTemplateDoc();
+ sal_Bool SetTemplate( SwDoc& rDoc );
+ void ClearTemplate();
+ void SetTemplateName( const String& rDir );
+ void MakeHTMLDummyTemplateDoc();
+
+ sal_Bool IsReadUTF8() const { return bReadUTF8; }
+ void SetReadUTF8( sal_Bool bSet ) { bReadUTF8 = bSet; }
+
+ sal_Bool IsBlockMode() const { return bBlockMode; }
+ void SetBlockMode( sal_Bool bSet ) { bBlockMode = bSet; }
+
+ sal_Bool IsOrganizerMode() const { return bOrganizerMode; }
+ void SetOrganizerMode( sal_Bool bSet ) { bOrganizerMode = bSet; }
+
+ void SetIgnoreHTMLComments( sal_Bool bSet ) { bIgnoreHTMLComments = bSet; }
+
+ virtual sal_Bool HasGlossaries() const;
+ virtual sal_Bool ReadGlossaries( SwTextBlocks&, sal_Bool bSaveRelFiles ) const;
+
+ // read the sections of the document, which is equal to the medium.
+ // returns the count of it
+ virtual sal_uInt16 GetSectionList( SfxMedium& rMedium,
+ SvStrings& rStrings ) const;
+
+ SotStorageRef getSotStorageRef() { return pStg; };
+ void setSotStorageRef(SotStorageRef pStgRef) { pStg = pStgRef; };
+
+private:
+ virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &)=0;
+
+ // alle die die Streams / Storages nicht geoeffnet brauchen,
+ // muessen die Methode ueberladen (W4W!!)
+ virtual int SetStrmStgPtr();
+};
+
+class AsciiReader: public Reader
+{
+ friend class SwReader;
+ virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
+public:
+ AsciiReader(): Reader() {}
+};
+
+/*class SwgReader: public Reader
+{
+ virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
+};
+*/
+class SW_DLLPUBLIC StgReader : public Reader
+{
+ String aFltName;
+
+protected:
+ sal_uLong OpenMainStream( SotStorageStreamRef& rRef, sal_uInt16& rBuffSize );
+
+public:
+ virtual int GetReaderType();
+ const String& GetFltName() { return aFltName; }
+ virtual void SetFltName( const String& r );
+};
+
+
+/*class Sw3Reader : public StgReader
+{
+ Sw3Io* pIO;
+ virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
+public:
+ Sw3Reader() : pIO( 0 ) {}
+
+ void SetSw3Io( Sw3Io* pIo ) { pIO = pIo; }
+
+ // read the sections of the document, which is equal to the medium.
+ // returns the count of it
+ virtual sal_uInt16 GetSectionList( SfxMedium& rMedium,
+ SvStrings& rStrings ) const;
+};*/
+
+/* */
+////////////////////////////////////////////////////////////////////////////
+
+// Der uebergebene Stream muss dynamisch angelegt werden und
+// vor dem Loeschen der Instanz per Stream() angefordert
+// und geloescht werden!
+
+class SwImpBlocks;
+
+class SW_DLLPUBLIC SwTextBlocks
+{
+// friend class Sw2TextBlocks;
+// friend class Sw3IoImp;
+ SwImpBlocks* pImp;
+ sal_uLong nErr;
+
+public:
+ SwTextBlocks( const String& );
+ ~SwTextBlocks();
+
+ void Flush(){}
+
+ SwDoc* GetDoc();
+ void ClearDoc(); // Doc-Inhalt loeschen
+ const String& GetName();
+ void SetName( const String& );
+ sal_uLong GetError() const { return nErr; }
+
+ String GetBaseURL() const;
+ void SetBaseURL( const String& rURL );
+
+ sal_Bool IsOld() const;
+ sal_uLong ConvertToNew(); // Textbausteine konvertieren
+
+ sal_uInt16 GetCount() const; // Anzahl Textbausteine ermitteln
+ sal_uInt16 GetIndex( const String& ) const; // Index fuer Kurznamen ermitteln
+ sal_uInt16 GetLongIndex( const String& ) const; //Index fuer Langnamen ermitteln
+ const String& GetShortName( sal_uInt16 ) const; // Kurzname fuer Index zurueck
+ const String& GetLongName( sal_uInt16 ) const; // Langname fuer Index zurueck
+
+ sal_Bool Delete( sal_uInt16 ); // Loeschen
+ sal_uInt16 Rename( sal_uInt16, const String*, const String* ); // Umbenennen
+ sal_uLong CopyBlock( SwTextBlocks& rSource, String& rSrcShort,
+ const String& rLong ); // Block kopieren
+
+ sal_Bool BeginGetDoc( sal_uInt16 ); // Textbaustein einlesen
+ void EndGetDoc(); // Textbaustein wieder loslassen
+
+ sal_Bool BeginPutDoc( const String&, const String& ); // Speichern Beginn
+ sal_uInt16 PutDoc(); // Speichern Ende
+
+ sal_uInt16 PutText( const String&, const String&, const String& ); // Speichern( Kurzn., Text)
+
+ sal_Bool IsOnlyTextBlock( sal_uInt16 ) const;
+ sal_Bool IsOnlyTextBlock( const String& rShort ) const;
+
+ const String& GetFileName() const; // Dateiname von pImp
+ sal_Bool IsReadOnly() const; // ReadOnly-Flag von pImp
+
+ sal_Bool GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl );
+ sal_Bool SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTbl );
+
+ sal_Bool StartPutMuchBlockEntries();
+ void EndPutMuchBlockEntries();
+};
+
+// BEGIN source/filter/basflt/fltini.cxx
+
+extern void _InitFilter();
+extern void _FinitFilter();
+
+extern SwRead ReadAscii, /*ReadSwg, ReadSw3, */ReadHTML, ReadXML;
+
+//SW_DLLPUBLIC SwRead SwGetReaderSw3();
+SW_DLLPUBLIC SwRead SwGetReaderXML();
+
+// END source/filter/basflt/fltini.cxx
+
+
+extern sal_Bool SetHTMLTemplate( SwDoc &rDoc ); //Fuer Vorlagen aus HTML.vor laden shellio.cxx
+
+
+/* */
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+ * Schreiben, Writer
+ */
+
+
+/* Basis-Klasse aller Writer */
+
+class IDocumentSettingAccess;
+class IDocumentStylePoolAccess;
+
+class SW_DLLPUBLIC Writer
+ : public SvRefBase
+ , private ::boost::noncopyable
+{
+ SwAsciiOptions aAscOpts;
+ String sBaseURL;
+
+ void _AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont );
+ void _AddFontItems( SfxItemPool& rPool, sal_uInt16 nWhichId );
+
+ ::std::auto_ptr<Writer_Impl> m_pImpl;
+
+protected:
+
+ SwPaM* pOrigPam; // der letze zu bearbeitende Pam
+ const String* pOrigFileName;
+
+ void ResetWriter();
+ sal_Bool CopyNextPam( SwPaM ** );
+
+ void PutNumFmtFontsInAttrPool();
+ void PutEditEngFontsInAttrPool( sal_Bool bIncl_CJK_CTL = sal_True );
+ void PutCJKandCTLFontsInAttrPool();
+
+ virtual sal_uLong WriteStream() = 0;
+ void SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
+
+ IDocumentSettingAccess* getIDocumentSettingAccess();
+ const IDocumentSettingAccess* getIDocumentSettingAccess() const;
+
+ IDocumentStylePoolAccess* getIDocumentStylePoolAccess();
+ const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
+
+public:
+ SwDoc* pDoc;
+ SwPaM* pCurPam;
+ sal_Bool bWriteAll : 1;
+ sal_Bool bShowProgress : 1;
+ sal_Bool bWriteClipboardDoc : 1;
+ sal_Bool bWriteOnlyFirstTable : 1;
+ sal_Bool bASCII_ParaAsCR : 1;
+ sal_Bool bASCII_ParaAsBlanc : 1;
+ sal_Bool bASCII_NoLastLineEnd : 1;
+ sal_Bool bUCS2_WithStartChar : 1;
+ sal_Bool bExportPargraphNumbering : 1;
+
+ sal_Bool bBlock : 1;
+ sal_Bool bOrganizerMode : 1;
+
+ Writer();
+ virtual ~Writer();
+
+ virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 );
+ sal_uLong Write( SwPaM&, SvStream&, const String* = 0 );
+ virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 );
+ virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 );
+
+ virtual void SetPasswd( const String& );
+ virtual void SetVersion( const String&, long );
+ virtual sal_Bool IsStgWriter() const;
+// virtual sal_Bool IsSw3Writer() const;
+
+ void SetShowProgress( sal_Bool bFlag = sal_False ) { bShowProgress = bFlag; }
+
+ const String* GetOrigFileName() const { return pOrigFileName; }
+
+ const SwAsciiOptions& GetAsciiOptions() const { return aAscOpts; }
+ void SetAsciiOptions( const SwAsciiOptions& rOpt ) { aAscOpts = rOpt; }
+
+ const String& GetBaseURL() const { return sBaseURL;}
+
+ // suche die naechste Bookmark-Position aus der Bookmark-Tabelle
+ sal_Int32 FindPos_Bkmk( const SwPosition& rPos ) const;
+ // build a bookmark table, which is sort by the node position. The
+ // OtherPos of the bookmarks also inserted.
+ void CreateBookmarkTbl();
+ // search alle Bookmarks in the range and return it in the Array
+ sal_uInt16 GetBookmarks( const SwCntntNode& rNd,
+ xub_StrLen nStt, xub_StrLen nEnd,
+ SvPtrarr& rArr );
+
+ // lege einen neuen PaM an der Position an
+ static SwPaM * NewSwPaM(SwDoc & rDoc,
+ sal_uLong const nStartIdx, sal_uLong const nEndIdx);
+
+ // kopiere ggfs. eine lokale Datei ins Internet
+ sal_Bool CopyLocalFileToINet( String& rFileNm );
+
+ // Stream-spezifische Routinen, im Storage-Writer NICHT VERWENDEN!
+
+ // Optimierung der Ausgabe auf den Stream.
+ SvStream& OutLong( SvStream& rStrm, long nVal );
+ SvStream& OutULong( SvStream& rStrm, sal_uLong nVal );
+
+ // Hex-Zahl ausgeben, default ist 2.stellige Zahl
+ SvStream& OutHex( SvStream& rStrm, sal_uLong nHex, sal_uInt8 nLen = 2 );
+ // 4-st. Hex-Zahl ausgeben
+ inline SvStream& OutHex4( SvStream& rStrm, sal_uInt16 nHex )
+ { return OutHex( rStrm, nHex, 4 ); }
+
+ inline SvStream& OutHex( sal_uInt16 nHex, sal_uInt8 nLen = 2 ) { return OutHex( Strm(), nHex, nLen ); }
+ inline SvStream& OutHex4( sal_uInt16 nHex ) { return OutHex( Strm(), nHex, 4 ); }
+ inline SvStream& OutLong( long nVal ) { return OutLong( Strm(), nVal ); }
+ inline SvStream& OutULong( sal_uLong nVal ) { return OutULong( Strm(), nVal ); }
+
+ void SetStream(SvStream *const pStream);
+ SvStream& Strm();
+
+ void SetOrganizerMode( sal_Bool bSet ) { bOrganizerMode = bSet; }
+};
+
+#ifndef SW_DECL_WRITER_DEFINED
+#define SW_DECL_WRITER_DEFINED
+SV_DECL_REF(Writer)
+#endif
+SV_IMPL_REF(Writer)
+
+// Basisklasse fuer alle Storage-Writer
+class SW_DLLPUBLIC StgWriter : public Writer
+{
+protected:
+ String aFltName;
+ SotStorageRef pStg;
+ com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
+
+ // Fehler beim Aufruf erzeugen
+ virtual sal_uLong WriteStream();
+ virtual sal_uLong WriteStorage() = 0;
+ virtual sal_uLong WriteMedium( SfxMedium& ) = 0;
+
+ using Writer::Write;
+
+public:
+ StgWriter() : Writer() {}
+
+ virtual sal_Bool IsStgWriter() const;
+
+ virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 );
+ virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 );
+
+ SotStorage& GetStorage() const { return *pStg; }
+};
+
+/*class Sw3Writer : public StgWriter
+{
+ Sw3Io* pIO;
+ sal_Bool bSaveAs : 1;
+
+ virtual sal_uLong WriteStorage();
+ virtual sal_uLong WriteMedium( SfxMedium& );
+
+public:
+ Sw3Writer() : pIO( 0 ), bSaveAs( sal_False ) {}
+
+ virtual sal_Bool IsSw3Writer() const;
+};
+
+*/
+
+// Schnittstellenklasse fuer den allgemeinen Zugriff auf die
+// speziellen Writer
+
+class SwWriter
+{
+ SvStream* pStrm;
+ SotStorageRef pStg;
+ com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
+ SfxMedium* pMedium;
+
+ SwPaM* pOutPam;
+ SwCrsrShell *pShell;
+ SwDoc &rDoc;
+
+ //String sBaseURL;
+
+ sal_Bool bWriteAll;
+
+public:
+ sal_uLong Write( WriterRef& rxWriter, const String* = 0);
+
+ SwWriter( SvStream&, SwCrsrShell &,sal_Bool bWriteAll = sal_False );
+ SwWriter( SvStream&, SwDoc & );
+ SwWriter( SvStream&, SwPaM &, sal_Bool bWriteAll = sal_False );
+
+// SwWriter( SotStorage&, SwCrsrShell &,sal_Bool bWriteAll = sal_False );
+ SwWriter( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, SwDoc& );
+// SwWriter( SotStorage&, SwPaM&, sal_Bool bWriteAll = sal_False );
+
+ SwWriter( SfxMedium&, SwCrsrShell &,sal_Bool bWriteAll = sal_False );
+ SwWriter( SfxMedium&, SwDoc & );
+// SwWriter( SfxMedium&, SwPaM&, sal_Bool bWriteAll = sal_False );
+
+ //const String& GetBaseURL() const { return sBaseURL;}
+};
+
+
+/* */
+/////////////////////////////////////////////////////////////////////////////
+
+typedef Reader* (*FnGetReader)();
+typedef void (*FnGetWriter)(const String&, const String& rBaseURL, WriterRef&);
+sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, sal_Bool, const String& );
+sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
+
+struct SwReaderWriterEntry
+{
+ Reader* pReader;
+ FnGetReader fnGetReader;
+ FnGetWriter fnGetWriter;
+ sal_Bool bDelReader;
+
+ SwReaderWriterEntry( const FnGetReader fnReader, const FnGetWriter fnWriter, sal_Bool bDel )
+ : pReader( NULL ), fnGetReader( fnReader ), fnGetWriter( fnWriter ), bDelReader( bDel )
+ {}
+
+ /// Get access to the reader
+ Reader* GetReader();
+
+ /// Get access to the writer
+ void GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const;
+};
+
+namespace SwReaderWriter
+{
+ /// Return reader based on ReaderWriterEnum
+ Reader* GetReader( ReaderWriterEnum eReader );
+
+ /// Return reader based on the name
+ Reader* GetReader( const String& rFltName );
+
+ /// Return writer based on the name
+ void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xWrt );
+}
+
+void GetRTFWriter( const String&, const String&, WriterRef& );
+void GetASCWriter( const String&, const String&, WriterRef& );
+//void GetSw3Writer( const String&, const String&, WriterRef& );
+void GetHTMLWriter( const String&, const String&, WriterRef& );
+void GetXMLWriter( const String&, const String&, WriterRef& );
+void GetWW8Writer( const String&, const String&, WriterRef& );
+
+#endif
diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx
new file mode 100644
index 000000000000..02f9742016ad
--- /dev/null
+++ b/sw/inc/shellres.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SHELLRES_HXX
+#define _SHELLRES_HXX
+
+
+#include <tools/string.hxx>
+
+#ifndef _BITMAP_HXX //autogen
+#include <vcl/bitmap.hxx>
+#endif
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#endif
+
+struct SW_DLLPUBLIC ShellResource : public Resource
+{
+ String aPostItAuthor;
+ String aPostItPage;
+ String aPostItLine;
+
+ // Calc Fehlerstrings
+ String aCalc_Syntax;
+ String aCalc_ZeroDiv;
+ String aCalc_Brack;
+ String aCalc_Pow;
+ String aCalc_VarNFnd;
+ String aCalc_Overflow;
+ String aCalc_WrongTime;
+ String aCalc_Default;
+ String aCalc_Error;
+
+ // fuers GetRefFeld - oben/unten
+ String aGetRefFld_Up;
+ String aGetRefFld_Down;
+ // --> OD 2007-09-13 #i81002#
+ // for GetRefField - referenced item not found
+ String aGetRefFld_RefItemNotFound;
+ // <--
+ // fuer dynamisches Menu - String "alle"
+ String aStrAllPageHeadFoot;
+ // fuer einige Listboxen - String "keine"
+ String aStrNone;
+ // fuer Felder, die Fixiert sind
+ String aFixedStr;
+ // custom fields of type css::util::Duration
+ String sDurationFormat;
+
+ //names of TOXs
+ String aTOXIndexName;
+ String aTOXUserName;
+ String aTOXContentName;
+ String aTOXIllustrationsName;
+ String aTOXObjectsName;
+ String aTOXTablesName;
+ String aTOXAuthoritiesName;
+
+ String aHyperlinkClick;
+
+ SvStringsDtor aDocInfoLst;
+
+ // Fly-Anker Bmps
+// Bitmap aAnchorBmp;
+// Bitmap aDragAnchorBmp;
+
+ // die AutoFormat-Redline-Kommentare
+ inline const SvStringsDtor& GetAutoFmtNameLst() const;
+
+ // returns for the specific filter the new names of pagedescs
+ // This method is for the old code of the specific filters with
+ // now localized names
+ String GetPageDescName( sal_uInt16 nNo, sal_Bool bFirst = sal_False,
+ sal_Bool bFollow = sal_False );
+
+ ShellResource();
+ ~ShellResource();
+
+private:
+ void _GetAutoFmtNameLst() const;
+ SvStringsDtor *pAutoFmtNameLst;
+ String sPageDescFirstName;
+ String sPageDescFollowName;
+ String sPageDescName;
+};
+
+inline const SvStringsDtor& ShellResource::GetAutoFmtNameLst() const
+{
+ if( !pAutoFmtNameLst )
+ _GetAutoFmtNameLst();
+ return *pAutoFmtNameLst;
+}
+
+
+#endif //_SHELLRES_HXX
diff --git a/sw/inc/sortopt.hxx b/sw/inc/sortopt.hxx
new file mode 100644
index 000000000000..dbb58486f879
--- /dev/null
+++ b/sw/inc/sortopt.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SORTOPT_HXX
+#define _SORTOPT_HXX
+
+
+#include <svl/svarray.hxx>
+#include <tools/string.hxx>
+#include "swdllapi.h"
+
+enum SwSortOrder { SRT_ASCENDING, SRT_DESCENDING };
+enum SwSortDirection { SRT_COLUMNS, SRT_ROWS };
+
+/*--------------------------------------------------------------------
+ Beschreibung: SortierSchluessel
+ --------------------------------------------------------------------*/
+struct SW_DLLPUBLIC SwSortKey
+{
+ SwSortKey();
+ SwSortKey( sal_uInt16 nId, const String& rSrtType, SwSortOrder eOrder );
+ SwSortKey( const SwSortKey& rOld );
+
+ String sSortType;
+ SwSortOrder eSortOrder;
+ sal_uInt16 nColumnId;
+ sal_Bool bIsNumeric;
+};
+
+SV_DECL_PTRARR(SwSortKeys, SwSortKey*, 3, 1)
+
+struct SW_DLLPUBLIC SwSortOptions
+{
+ SwSortOptions();
+ ~SwSortOptions();
+ SwSortOptions(const SwSortOptions& rOpt);
+
+ SwSortKeys aKeys;
+ SwSortDirection eDirection;
+ sal_Unicode cDeli;
+ sal_uInt16 nLanguage;
+ sal_Bool bTable;
+ sal_Bool bIgnoreCase;
+};
+
+#endif // _SORTOPT_HXX
diff --git a/sw/inc/splargs.hxx b/sw/inc/splargs.hxx
new file mode 100644
index 000000000000..6de36a6ee245
--- /dev/null
+++ b/sw/inc/splargs.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SPLARGS_HXX
+#define _SPLARGS_HXX
+
+#include <i18npool/lang.h>
+#include <tools/solar.h>
+#include <tools/gen.hxx>
+#include <limits.h> // USHRT_MAX
+#include <tools/string.hxx>
+
+class SwTxtNode;
+class SwIndex;
+class SpellCheck;
+class Font;
+#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
+
+/*************************************************************************
+ * struct SwArgsBase
+ *************************************************************************/
+
+
+struct SwArgsBase // used for text conversion (Hangul/Hanja, ...)
+{
+ SwTxtNode *pStartNode;
+ SwIndex *pStartIdx;
+ SwTxtNode *pEndNode;
+ SwIndex *pEndIdx;
+
+ SwArgsBase(
+ SwTxtNode* pStart, SwIndex& rStart,
+ SwTxtNode* pEnd, SwIndex& rEnd )
+ : pStartNode( pStart ), pStartIdx( &rStart ),
+ pEndNode( pEnd ), pEndIdx( &rEnd )
+ {}
+
+ void SetStart(SwTxtNode* pStart, SwIndex& rStart )
+ {
+ pStartNode = pStart; pStartIdx = &rStart ;
+ }
+
+ void SetEnd( SwTxtNode* pEnd, SwIndex& rEnd )
+ {
+ pEndNode = pEnd; pEndIdx = &rEnd ;
+ }
+};
+
+/*************************************************************************
+ * struct SwConversionArgs
+ * used for text conversion (Hangul/Hanja, Simplified/Traditional Chinese, ...)
+ *************************************************************************/
+
+struct SwConversionArgs : SwArgsBase
+{
+ rtl::OUString aConvText; // convertible text found
+ LanguageType nConvSrcLang; // (source) language to look for
+ LanguageType nConvTextLang; // language of aConvText (if the latter one was found)
+
+ // used for chinese translation
+ LanguageType nConvTargetLang; // target language of text to be changed
+ const Font *pTargetFont; // target font of text to be changed
+ // explicitly enables or disables application of the above two
+ sal_Bool bAllowImplicitChangesForNotConvertibleText;
+
+ SwConversionArgs( LanguageType nLang,
+ SwTxtNode* pStart, SwIndex& rStart,
+ SwTxtNode* pEnd, SwIndex& rEnd )
+ : SwArgsBase( pStart, rStart, pEnd, rEnd ),
+ nConvSrcLang( nLang ),
+ nConvTextLang( LANGUAGE_NONE ),
+ nConvTargetLang( LANGUAGE_NONE ),
+ pTargetFont( NULL ),
+ bAllowImplicitChangesForNotConvertibleText( sal_False )
+ {}
+};
+
+/*************************************************************************
+ * struct SwSpellArgs
+ *************************************************************************/
+
+struct SwSpellArgs : SwArgsBase
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpeller;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt;
+
+ bool bIsGrammarCheck;
+
+ SwSpellArgs(::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &rxSplChk,
+ SwTxtNode* pStart, SwIndex& rStart,
+ SwTxtNode* pEnd, SwIndex& rEnd,
+ bool bGrammar )
+ : SwArgsBase( pStart, rStart, pEnd, rEnd ),
+ xSpeller( rxSplChk ),
+ bIsGrammarCheck( bGrammar )
+ {}
+};
+
+/*************************************************************************
+ * class SwInterHyphInfo
+ *************************************************************************/
+
+// Parameter-Klasse fuer Hyphenate
+// docedt.cxx: SwDoc::Hyphenate()
+// txtedt.cxx: SwTxtNode::Hyphenate()
+// txthyph.cxx: SwTxtFrm::Hyphenate()
+
+class SwInterHyphInfo
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord > xHyphWord;
+ const Point aCrsrPos;
+ sal_Bool bAuto : 1;
+ sal_Bool bNoLang : 1;
+ sal_Bool bCheck : 1;
+public:
+ xub_StrLen nStart;
+ xub_StrLen nLen;
+ xub_StrLen nWordStart;
+ xub_StrLen nWordLen;
+ xub_StrLen nHyphPos;
+ sal_uInt16 nMinTrail;
+
+ inline SwInterHyphInfo( const Point &rCrsrPos,
+ const sal_uInt16 nStartPos = 0,
+ const sal_uInt16 nLength = USHRT_MAX )
+ : aCrsrPos( rCrsrPos ),
+ bAuto(sal_False), bNoLang(sal_False), bCheck(sal_False),
+ nStart(nStartPos), nLen(nLength),
+ nWordStart(0), nWordLen(0),
+ nHyphPos(0), nMinTrail(0)
+ { }
+ inline xub_StrLen GetEnd() const
+ { return STRING_LEN == nLen ? nLen : nStart + nLen; }
+ inline const Point *GetCrsrPos() const
+ { return aCrsrPos.X() || aCrsrPos.Y() ? &aCrsrPos : 0; }
+ inline sal_Bool IsCheck() const { return bCheck; }
+ inline void SetCheck( const sal_Bool bNew ) { bCheck = bNew; }
+ inline void SetNoLang( const sal_Bool bNew ) { bNoLang = bNew; }
+
+ inline void
+ SetHyphWord(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord > &rxHW)
+ { xHyphWord = rxHW; }
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord >
+ GetHyphWord() { return xHyphWord; }
+};
+
+
+#endif
diff --git a/sw/inc/statstr.hrc b/sw/inc/statstr.hrc
new file mode 100644
index 000000000000..0c611051ba01
--- /dev/null
+++ b/sw/inc/statstr.hrc
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _STATSTR_HRC
+#define _STATSTR_HRC
+
+#include "rcid.hrc"
+
+#define STR_STATSTR_W4WREAD (RC_STATLIN_STR + 0)
+#define STR_STATSTR_W4WWRITE (RC_STATLIN_STR + 1)
+#define STR_STATSTR_SWGREAD (RC_STATLIN_STR + 2)
+#define STR_STATSTR_SWGWRITE (RC_STATLIN_STR + 3)
+#define STR_STATSTR_REFORMAT (RC_STATLIN_STR + 4)
+#define STR_STATSTR_AUTOFORMAT (RC_STATLIN_STR + 5)
+#define STR_STATSTR_IMPGRF (RC_STATLIN_STR + 6)
+#define STR_STATSTR_SEARCH (RC_STATLIN_STR + 7)
+#define STR_STATSTR_FORMAT (RC_STATLIN_STR + 8)
+#define STR_STATSTR_PRINT (RC_STATLIN_STR + 9)
+#define STR_STATSTR_LAYOUTINIT (RC_STATLIN_STR + 10)
+#define STR_STATSTR_LETTER (RC_STATLIN_STR + 11)
+#define STR_STATSTR_SPELL (RC_STATLIN_STR + 12)
+#define STR_STATSTR_HYPHEN (RC_STATLIN_STR + 13)
+#define STR_STATSTR_TOX_INSERT (RC_STATLIN_STR + 14)
+#define STR_STATSTR_TOX_UPDATE (RC_STATLIN_STR + 15)
+#define STR_STATSTR_SUMMARY (RC_STATLIN_STR + 16)
+#define STR_STATSTR_SWGPRTOLENOTIFY (RC_STATLIN_STR + 17)
+
+#endif
+
+
+
diff --git a/sw/inc/stringhash.hxx b/sw/inc/stringhash.hxx
new file mode 100644
index 000000000000..12c7dc28b857
--- /dev/null
+++ b/sw/inc/stringhash.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _STRINGHASH_HXX
+#define _STRINGHASH_HXX
+
+#include <tools/string.hxx>
+
+struct StringEq
+{
+ sal_Bool operator() ( const String *r1,
+ const String *r2) const
+ {
+ return r1->Equals(*r2);
+ }
+};
+
+struct StringEqRef
+{
+ sal_Bool operator() (const String &r1, const String &r2) const
+ {
+ return r1.Equals(r2);
+ }
+};
+
+struct StringHash
+{
+ size_t operator() ( const String *rString) const
+ {
+ sal_Int32 h, nLen;
+ h = nLen = rString->Len();
+ const sal_Unicode *pStr = rString->GetBuffer();
+
+ if ( nLen < 16 )
+ while ( nLen-- > 0 )
+ h = (h*37) + *(pStr++);
+ else
+ {
+ sal_Int32 nSkip;
+ const sal_Unicode* pEndStr = pStr+nLen-5;
+
+ /* only sample some characters */
+ /* the first 3, some characters between, and the last 5 */
+ h = (h*39) + *(pStr++);
+ h = (h*39) + *(pStr++);
+ h = (h*39) + *(pStr++);
+
+ nSkip = nLen / nLen < 32 ? 4 : 8;
+ nLen -= 8;
+ while ( nLen > 0 )
+ {
+ h = (h*39) + ( *pStr );
+ pStr += nSkip;
+ nLen -= nSkip;
+ }
+
+ h = (h*39) + *(pEndStr++);
+ h = (h*39) + *(pEndStr++);
+ h = (h*39) + *(pEndStr++);
+ h = (h*39) + *(pEndStr++);
+ h = (h*39) + *(pEndStr++);
+ }
+ return h;
+ }
+
+ size_t operator() (const String & rStr) const
+ {
+ return (*this)(&rStr);
+ }
+};
+
+struct StringHashRef
+{
+ size_t operator () (const String &rStr) const
+ {
+ StringHash aStrHash;
+
+ return aStrHash(&rStr);
+ }
+};
+#endif // _STRINGHASH_HXX
diff --git a/sw/inc/sw_primitivetypes2d.hxx b/sw/inc/sw_primitivetypes2d.hxx
new file mode 100644
index 000000000000..12e245791f4c
--- /dev/null
+++ b/sw/inc/sw_primitivetypes2d.hxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 INCLUDED_SW_PRIMITIVETYPES2D_HXX
+#define INCLUDED_SW_PRIMITIVETYPES2D_HXX
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SW| 0)
+#define PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE (PRIMITIVE2D_ID_RANGE_SW| 1)
+#define PRIMITIVE2D_ID_SWSIDEBARSHADOWPRIMITIVE (PRIMITIVE2D_ID_RANGE_SW| 2)
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_SW_PRIMITIVETYPES2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
new file mode 100644
index 000000000000..2768cc50bc82
--- /dev/null
+++ b/sw/inc/swabstdlg.hxx
@@ -0,0 +1,498 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_ABSTDLG_HXX
+#define _SW_ABSTDLG_HXX
+
+// include ---------------------------------------------------------------
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <sfx2/sfxdlg.hxx>
+#include <svx/svxdlg.hxx>
+#include <vcl/syswin.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include "swunodef.hxx"
+#include "itabenum.hxx"
+
+class SfxViewFrame;
+class SfxBindings;
+class SfxItemSet;
+class ResId;
+class Window;
+class String;
+class SfxItemPool;
+class SfxStyleSheetBase;
+class SwGlossaryHdl;
+class SwField;
+
+class SwLabFmtPage;
+class SwLabRec;
+class SwAsciiOptions;
+class SwDocShell;
+class SvStream;
+class SwWrtShell;
+class SfxRequest;
+class SwView;
+class SwTableAutoFmt;
+class SwTOXMgr;
+class SwForm;
+struct CurTOXType;
+class SwTOXDescription;
+class SwTOXBase;
+class SwSectionData;
+struct SwDBData;
+class SwField;
+class Printer;
+class SwLabItem;
+class SwNewDBMgr;
+class SwTableFUNC;
+class SwChildWinWrapper;
+struct SfxChildWinInfo;
+class SwTOXMark;
+struct SwDocStat;
+#include <cnttab.hxx> //add for struct CurTOXType
+
+namespace com{namespace sun{namespace star{
+ namespace frame{
+ class XFrame;
+ }
+ namespace sdbcx{
+ class XColumnsSupplier;
+ }
+ namespace sdbc{
+ class XDataSource;
+ class XConnection;
+ class XResultSet;
+ }
+}}}
+
+typedef void (*SwLabDlgMethod) (::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& xModel, const SwLabItem& rItem);
+
+typedef String (*GlossaryGetCurrGroup)();
+typedef void (*GlossarySetActGroup)(const String& rNewGroup);
+
+class AbstractGlossaryDlg : public VclAbstractDialog //add for SwGlossaryDlg
+{
+public:
+ virtual String GetCurrGrpName() const = 0;
+ virtual String GetCurrShortName() const = 0;
+};
+
+class AbstractFldInputDlg : public VclAbstractDialog //add for SwFldInputDlg
+{
+public:
+ //from class SalFrame
+ virtual void SetWindowState( const ByteString& rStr ) = 0;
+ virtual ByteString GetWindowState( sal_uLong nMask = WINDOWSTATE_MASK_ALL ) const = 0;
+};
+
+class AbstractInsFootNoteDlg : public VclAbstractDialog //add for SwInsFootNoteDlg
+{
+public:
+ virtual String GetFontName() = 0;
+ virtual sal_Bool IsEndNote() = 0;
+ virtual String GetStr() = 0;
+ //from class Window
+ virtual void SetHelpId( const rtl::OString& sHelpId ) = 0;
+ virtual void SetText( const XubString& rStr ) = 0;
+};
+
+class AbstractInsertGrfRulerDlg : public VclAbstractDialog //add for SwInsertGrfRulerDlg
+{
+public:
+ virtual String GetGraphicName() = 0;
+ virtual sal_Bool IsSimpleLine() = 0;
+ virtual sal_Bool HasImages() const = 0;
+};
+
+class AbstractInsTableDlg : public VclAbstractDialog //add for SwInsTableDlg
+{
+public:
+ virtual void GetValues( String& rName, sal_uInt16& rRow, sal_uInt16& rCol,
+ SwInsertTableOptions& rInsTblFlags, String& rTableAutoFmtName,
+ SwTableAutoFmt *& prTAFmt ) = 0;
+};
+
+class AbstractJavaEditDialog : public VclAbstractDialog //add for SwJavaEditDialog
+{
+public:
+ virtual String GetText() = 0;
+ virtual String GetType() = 0;
+ virtual sal_Bool IsUrl() = 0;
+ virtual sal_Bool IsNew() = 0;
+ virtual sal_Bool IsUpdate() = 0;
+};
+
+class AbstractMailMergeDlg : public VclAbstractDialog //add for SwMailMergeDlg
+{
+public:
+ virtual sal_uInt16 GetMergeType() = 0;
+ virtual const ::rtl::OUString& GetSaveFilter() const = 0;
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > GetSelection() const = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> GetResultSet() const = 0;
+};
+class AbstractMailMergeCreateFromDlg : public VclAbstractDialog //add for SwMailMergeCreateFromDlg
+{
+public:
+ virtual sal_Bool IsThisDocument() const = 0;
+};
+class AbstractMailMergeFieldConnectionsDlg : public VclAbstractDialog //add for SwMailMergeFieldConnectionsDlg
+{
+public:
+ virtual sal_Bool IsUseExistingConnections() const = 0;
+};
+
+class AbstractMultiTOXTabDialog : public VclAbstractDialog //add for SwMultiTOXTabDialog
+{
+public:
+ virtual SwForm* GetForm(CurTOXType eType) = 0;
+ virtual CurTOXType GetCurrentTOXType() const = 0;
+ virtual SwTOXDescription& GetTOXDescription(CurTOXType eTOXTypes) = 0;
+ //from SfxTabDialog
+ virtual const SfxItemSet* GetOutputItemSet() const = 0;
+};
+
+class AbstractEditRegionDlg : public VclAbstractDialog //add for SwEditRegionDlg
+{
+public:
+ virtual void SelectSection(const String& rSectionName) = 0;
+};
+class AbstractInsertSectionTabDialog : public VclAbstractDialog //add for SwInsertSectionTabDialog
+{
+public:
+ virtual void SetSectionData(SwSectionData const& rSect) = 0;
+};
+
+class AbstractSwWordCountDialog : public VclAbstractDialog
+{
+public:
+ virtual void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc) = 0;
+};
+
+class AbstractSwInsertAbstractDlg : public VclAbstractDialog // add for SwInsertAbstractDlg
+{
+public:
+ virtual sal_uInt8 GetLevel() const = 0;
+ virtual sal_uInt8 GetPara() const = 0;
+};
+
+class AbstractSwAsciiFilterDlg : public VclAbstractDialog // add for SwAsciiFilterDlg
+{
+public:
+ virtual void FillOptions( SwAsciiOptions& rOptions ) = 0;
+
+};
+
+class AbstractSwBreakDlg : public VclAbstractDialog // add for SwBreakDlg
+{
+public:
+ virtual String GetTemplateName() = 0;
+ virtual sal_uInt16 GetKind() = 0;
+ virtual sal_uInt16 GetPageNumber() = 0;
+
+};
+
+class AbstractSplitTableDialog : public VclAbstractDialog // add for
+{
+public:
+ virtual sal_uInt16 GetSplitMode() = 0;
+};
+
+class AbstractSwConvertTableDlg : public VclAbstractDialog // add for SwConvertTableDlg
+{
+public:
+ virtual void GetValues( sal_Unicode& rDelim,
+ SwInsertTableOptions& rInsTblFlags,
+ SwTableAutoFmt *& prTAFmt ) = 0;
+};
+
+class AbstractSwInsertDBColAutoPilot : public VclAbstractDialog // add for SwInsertDBColAutoPilot
+{
+public:
+
+ virtual void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet) = 0;
+};
+
+class AbstractDropDownFieldDialog : public VclAbstractDialog //add for DropDownFieldDialog
+{
+public:
+ virtual ByteString GetWindowState( sal_uLong nMask = WINDOWSTATE_MASK_ALL ) const = 0; //this method inherit from SystemWindow
+ virtual void SetWindowState( const ByteString& rStr ) =0;//this method inherit from SystemWindow
+};
+
+class AbstarctSwLabDlg : public SfxAbstractTabDialog //add for SwLabDlg
+{
+public:
+ virtual const String& GetBusinessCardStr() const = 0;
+ virtual Printer *GetPrt() =0;
+};
+
+class AbstarctSwSelGlossaryDlg : public VclAbstractDialog //add for SwSelGlossaryDlg
+{
+public:
+ virtual void InsertGlos(const String &rRegion, const String &rGlosName) = 0; // inline
+ virtual sal_uInt16 GetSelectedIdx() const = 0; // inline
+ virtual void SelectEntryPos(sal_uInt16 nIdx) = 0; // inline
+};
+
+class AbstractSwSplitTableDlg :public VclAbstractDialog //add for SwSplitTableDlg
+{
+public:
+ virtual sal_Bool IsHorizontal() const = 0;
+ virtual sal_Bool IsProportional() const = 0;
+ virtual long GetCount() const = 0;
+};
+
+class AbstractSwAutoFormatDlg : public VclAbstractDialog //add for SwAutoFormatDlg
+{
+public:
+ virtual void FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const = 0;
+};
+
+class AbstractSwFldDlg : public SfxAbstractTabDialog //add for SwFldDlg
+{
+public:
+ virtual void Start( sal_Bool bShow = sal_True ) = 0; //this method from sfxtabdialog
+ virtual void Initialize(SfxChildWinInfo *pInfo) = 0;
+ virtual void ReInitDlg() = 0;
+ virtual void ActivateDatabasePage() = 0;
+ virtual void ShowPage( sal_uInt16 nId ) = 0;// this method from SfxTabDialog
+ virtual Window * GetWindow() = 0; //this method is added for return a Window type pointer
+};
+
+class AbstractSwRenameXNamedDlg : public VclAbstractDialog //add for SwRenameXNamedDlg
+{
+public:
+ virtual void SetForbiddenChars( const String& rSet ) = 0;
+ virtual void SetAlternativeAccess(
+ STAR_REFERENCE( container::XNameAccess ) & xSecond,
+ STAR_REFERENCE( container::XNameAccess ) & xThird ) = 0;
+};
+
+class AbstractSwModalRedlineAcceptDlg : public VclAbstractDialog //add for SwModalRedlineAcceptDlg
+{
+public:
+ virtual void AcceptAll( sal_Bool bAccept ) = 0;
+};
+
+class AbstractMarkFloatDlg : public VclAbstractDialog //add for SwIndexMarkFloatDlg & SwAuthMarkFloatDlg
+{
+public:
+ virtual void ReInitDlg(SwWrtShell& rWrtShell) = 0;
+ virtual Window * GetWindow() = 0; //this method is added for return a Window type pointer
+};
+
+#define RET_LOAD_DOC 100
+#define RET_EDIT_DOC 101
+#define RET_EDIT_RESULT_DOC 102
+#define RET_TARGET_CREATED 103
+#define RET_REMOVE_TARGET 104
+
+class SwView;
+class SwMailMergeConfigItem;
+
+class AbstractMailMergeWizard : public VclAbstractDialog2
+{
+public:
+ virtual void SetReloadDocument(const String& rURL) = 0;
+ virtual const String& GetReloadDocument() const = 0;
+ virtual sal_Bool ShowPage( sal_uInt16 nLevel ) = 0;
+ virtual sal_uInt16 GetRestartPage() const = 0;
+};
+
+
+//-------Swabstract fractory
+class SwAbstractDialogFactory
+{
+public:
+ static SwAbstractDialogFactory* Create();
+
+ virtual SfxAbstractDialog* CreateSfxDialog( Window* pParent, //add for SvxMeasureDialog & SvxConnectionDialog
+ const SfxItemSet& rAttr,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame,
+ sal_uInt32 nResId
+ ) = 0;
+ virtual AbstractSwWordCountDialog* CreateSwWordCountDialog( Window* pWindow ) = 0;
+ virtual AbstractSwInsertAbstractDlg * CreateSwInsertAbstractDlg ( Window* pParent, int nResId) = 0; // add for SwInsertAbstractDlg
+ virtual AbstractSwAsciiFilterDlg* CreateSwAsciiFilterDlg ( Window* pParent, SwDocShell& rDocSh,
+ SvStream* pStream, int nResId ) = 0;// add for SwAsciiFilterDlg
+ virtual VclAbstractDialog * CreateSwInsertBookmarkDlg( Window *pParent, SwWrtShell &rSh, SfxRequest& rReq, int nResId ) = 0;// add for SwInsertBookmarkDlg
+
+ virtual AbstractSwBreakDlg * CreateSwBreakDlg( Window *pParent, SwWrtShell &rSh,int nResId ) = 0; // add for SwBreakDlg
+ virtual VclAbstractDialog * CreateSwChangeDBDlg( SwView& rVw, int nResId ) = 0; //add for SwChangeDBDlg
+ virtual SfxAbstractTabDialog * CreateSwCharDlg( Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, int nResId, // add for SwCharDlg
+ const String* pFmtStr = 0, sal_Bool bIsDrwTxtDlg = sal_False) = 0;
+ virtual AbstractSwConvertTableDlg* CreateSwConvertTableDlg ( SwView& rView , int nResId, bool bToTable) = 0; //add for SwConvertTableDlg
+ virtual VclAbstractDialog * CreateSwCaptionDialog ( Window *pParent, SwView &rV,int nResId) = 0; //add for SwCaptionDialog
+
+ virtual AbstractSwInsertDBColAutoPilot* CreateSwInsertDBColAutoPilot( SwView& rView, // add for SwInsertDBColAutoPilot
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
+ com::sun::star::uno::Reference<com::sun::star::sdbcx::XColumnsSupplier> xColSupp,
+ const SwDBData& rData, int nResId) = 0;
+ virtual SfxAbstractTabDialog * CreateSwFootNoteOptionDlg( Window *pParent, SwWrtShell &rSh,int nResId) = 0;//add for SwFootNoteOptionDlg
+
+ virtual AbstractDropDownFieldDialog * CreateDropDownFieldDialog ( Window *pParent, SwWrtShell &rSh, //add for DropDownFieldDialog
+ SwField* pField,int nResId, sal_Bool bNextButton = sal_False ) = 0;
+ virtual SfxAbstractTabDialog* CreateSwEnvDlg ( Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, sal_Bool bInsert,int nResId ) = 0; //add for SwEnvDlg
+
+
+ virtual AbstarctSwLabDlg* CreateSwLabDlg ( Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg
+ SwNewDBMgr* pNewDBMgr, sal_Bool bLabel,int nResId ) = 0;
+
+ virtual SwLabDlgMethod GetSwLabDlgStaticMethod () =0;//add for SwLabDlg
+
+ virtual SfxAbstractTabDialog* CreateSwParaDlg ( Window *pParent, //add for SwParaDlg
+ SwView& rVw,
+ const SfxItemSet& rCoreSet,
+ sal_uInt8 nDialogMode,
+ int nResId,
+ const String *pCollName = 0,
+ sal_Bool bDraw = sal_False,
+ sal_uInt16 nDefPage = 0) = 0;
+
+ virtual AbstarctSwSelGlossaryDlg * CreateSwSelGlossaryDlg ( Window * pParent, const String &rShortName, int nResId ) = 0; //add for SwSelGlossaryDlg
+
+ virtual VclAbstractDialog * CreateVclAbstractDialog ( Window * pParent, SwWrtShell &rSh, int nResId ) = 0; //add for SwTableHeightDlg SwSortDlg
+ virtual AbstractSplitTableDialog * CreateSplitTblDialog ( Window * pParent, SwWrtShell &rSh ) = 0; //add for SwSplitTblDlg
+
+ virtual AbstractSwAutoFormatDlg * CreateSwAutoFormatDlg( Window* pParent, SwWrtShell* pShell, //add for SwAutoFormatDlg
+ int nResId,
+ sal_Bool bSetAutoFmt = sal_True,
+ const SwTableAutoFmt* pSelFmt = 0 ) = 0;
+ virtual SfxAbstractDialog * CreateSwBorderDlg ( Window* pParent, SfxItemSet& rSet, sal_uInt16 nType, int nResId ) = 0;//add for SwBorderDlg
+ virtual SfxAbstractDialog * CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, sal_Bool bDrawMode, int nResId ) = 0; //add for SwWrapDlg
+
+ virtual VclAbstractDialog * CreateSwTableWidthDlg ( Window *pParent, SwTableFUNC &rFnc , int nResId ) = 0; //add for SwTableWidthDlg
+ virtual SfxAbstractTabDialog* CreateSwTableTabDlg( Window* pParent, SfxItemPool& Pool,
+ const SfxItemSet* pItemSet, SwWrtShell* pSh,int nResId ) = 0; //add for SwTableTabDlg
+
+ virtual AbstractSwFldDlg * CreateSwFldDlg ( SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent, int nResId ) = 0; //add for SwFldDlg
+ virtual SfxAbstractDialog* CreateSwFldEditDlg ( SwView& rVw, int nResId ) = 0; //add for SwFldEditDlg
+ virtual AbstractSwRenameXNamedDlg * CreateSwRenameXNamedDlg( Window* pParent, //add for SwRenameXNamedDlg
+ STAR_REFERENCE( container::XNamed ) & xNamed,
+ STAR_REFERENCE( container::XNameAccess ) & xNameAccess, int nResId ) = 0;
+ virtual AbstractSwModalRedlineAcceptDlg * CreateSwModalRedlineAcceptDlg ( Window *pParent, int nResId ) = 0; //add for SwModalRedlineAcceptDlg
+
+ virtual VclAbstractDialog* CreateSwVclDialog( int nResId, Window* pParent, sal_Bool& rWithPrev ) = 0; //add for SwMergeTblDlg
+ virtual SfxAbstractTabDialog* CreateFrmTabDialog( int nResId,
+ SfxViewFrame *pFrame, Window *pParent,
+ const SfxItemSet& rCoreSet,
+ sal_Bool bNewFrm = sal_True,
+ sal_uInt16 nResType = DLG_FRM_STD,
+ sal_Bool bFmt = sal_False,
+ sal_uInt16 nDefPage = 0,
+ const String* pFmtStr = 0) = 0; //add for SwFrmDlg
+ virtual SfxAbstractTabDialog* CreateTemplateDialog( int nResId,
+ Window* pParent,
+ SfxStyleSheetBase& rBase,
+ sal_uInt16 nRegion,
+ sal_Bool bColumn = sal_False,
+ SwWrtShell* pActShell = 0,
+ sal_Bool bNew = sal_False ) = 0; //add for SwTemplateDlg
+ virtual AbstractGlossaryDlg* CreateGlossaryDlg( int nResId,
+ SfxViewFrame* pViewFrame,
+ SwGlossaryHdl* pGlosHdl,
+ SwWrtShell *pWrtShell) = 0; //add for SwGlossaryDlg
+ virtual AbstractFldInputDlg* CreateFldInputDlg( int nResId,
+ Window *pParent, SwWrtShell &rSh,
+ SwField* pField, sal_Bool bNextButton = sal_False ) = 0; //add for SwFldInputDlg
+ virtual AbstractInsFootNoteDlg* CreateInsFootNoteDlg( int nResId,
+ Window * pParent, SwWrtShell &rSh, sal_Bool bEd = sal_False) = 0; //add for SwInsFootNoteDlg
+ virtual VclAbstractDialog * CreateVclSwViewDialog( int nResId,
+ SwView& rView, sal_Bool bCol = sal_False ) = 0; //add for SwInsRowColDlg, SwLineNumberingDlg
+ virtual AbstractInsertGrfRulerDlg* CreateInsertGrfRulerDlg( int nResId,
+ Window * pParent ) = 0; //add for SwInsertGrfRulerDlg
+ virtual AbstractInsTableDlg* CreateInsTableDlg( int nResId,
+ SwView& rView ) = 0; //add for SwInsTableDlg
+ virtual AbstractJavaEditDialog* CreateJavaEditDialog( int nResId,
+ Window* pParent, SwWrtShell* pWrtSh ) = 0; //add for SwJavaEditDialog
+ virtual AbstractMailMergeDlg* CreateMailMergeDlg( int nResId,
+ Window* pParent, SwWrtShell& rSh,
+ const String& rSourceName,
+ const String& rTblName,
+ sal_Int32 nCommandType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& xConnection,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >* pSelection = 0 ) = 0; //add for SwMailMergeDlg
+ virtual AbstractMailMergeCreateFromDlg* CreateMailMergeCreateFromDlg( int nResId,
+ Window* pParent ) = 0; //add for SwMailMergeCreateFromDlg
+ virtual AbstractMailMergeFieldConnectionsDlg* CreateMailMergeFieldConnectionsDlg( int nResId,
+ Window* pParent ) = 0; //add for SwMailMergeFieldConnectionsDlg
+ virtual VclAbstractDialog* CreateMultiTOXMarkDlg( int nResId,
+ Window* pParent, SwTOXMgr &rTOXMgr ) = 0; //add for SwMultiTOXMarkDlg
+ virtual SfxAbstractTabDialog* CreateSwTabDialog( int nResId,
+ Window* pParent,
+ const SfxItemSet* pSwItemSet,
+ SwWrtShell &) = 0; //add for SwSvxNumBulletTabDialog, SwOutlineTabDialog
+ virtual AbstractMultiTOXTabDialog* CreateMultiTOXTabDialog( int nResId,
+ Window* pParent, const SfxItemSet& rSet,
+ SwWrtShell &rShell,
+ SwTOXBase* pCurTOX, sal_uInt16 nToxType = USHRT_MAX,
+ sal_Bool bGlobal = sal_False) = 0; //add for SwMultiTOXTabDialog
+ virtual AbstractEditRegionDlg* CreateEditRegionDlg( int nResId,
+ Window* pParent, SwWrtShell& rWrtSh ) = 0; //add for SwEditRegionDlg
+ virtual AbstractInsertSectionTabDialog* CreateInsertSectionTabDialog( int nResId,
+ Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh ) = 0; //add for SwInsertSectionTabDialog
+ virtual AbstractMarkFloatDlg* CreateIndexMarkFloatDlg( int nResId,
+ SfxBindings* pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent,
+ SfxChildWinInfo* pInfo,
+ sal_Bool bNew=sal_True) = 0; //add for SwIndexMarkFloatDlg
+ virtual AbstractMarkFloatDlg* CreateAuthMarkFloatDlg( int nResId,
+ SfxBindings* pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent,
+ SfxChildWinInfo* pInfo,
+ sal_Bool bNew=sal_True) = 0; //add for SwAuthMarkFloatDlg
+ virtual VclAbstractDialog * CreateIndexMarkModalDlg( int nResId,
+ Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark ) = 0; //add for SwIndexMarkModalDlg
+
+ virtual AbstractMailMergeWizard* CreateMailMergeWizard(SwView& rView, SwMailMergeConfigItem& rConfigItem) = 0;
+
+ //add for static func in SwGlossaryDlg
+ virtual GlossaryGetCurrGroup GetGlossaryCurrGroupFunc( sal_uInt16 nId ) = 0;
+ virtual GlossarySetActGroup SetGlossaryActGroupFunc( sal_uInt16 nId ) = 0;
+
+ // for tabpage
+ virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) = 0;
+ virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ) = 0;
+};
+
+#endif
diff --git a/sw/inc/swacorr.hxx b/sw/inc/swacorr.hxx
new file mode 100644
index 000000000000..c83bc740ea0a
--- /dev/null
+++ b/sw/inc/swacorr.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWACORR_HXX
+#define _SWACORR_HXX
+
+#include <editeng/svxacorr.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/embed/XStorage.hpp>
+
+class SwAutoCorrect : public SvxAutoCorrect
+{
+ using SvxAutoCorrect::PutText;
+
+protected:
+ // - return den Ersetzungstext (nur fuer SWG-Format, alle anderen
+ // koennen aus der Wortliste herausgeholt werden!)
+ // rShort ist der Stream-Name - gecryptet!
+ virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& , const String& rFileName, const String& rShort, String& rLong );
+
+ // - Text mit Attributierung (kann nur der SWG - SWG-Format!)
+ // rShort ist der Stream-Name - gecryptet!
+ virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFileName, const String& rShort, SfxObjectShell& ,
+ String& );
+
+public:
+ TYPEINFO();
+
+ SwAutoCorrect( const SvxAutoCorrect& rACorr );
+ virtual ~SwAutoCorrect();
+};
+
+
+#endif
+
diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx
new file mode 100644
index 000000000000..cc2f1532a6fc
--- /dev/null
+++ b/sw/inc/swatrset.hxx
@@ -0,0 +1,353 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWATRSET_HXX
+#define _SWATRSET_HXX
+#include <tools/solar.h>
+#include <tools/mempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
+#include <swdllapi.h>
+
+class SwModify;
+class SwDoc;
+class OutputDevice;
+class IDocumentSettingAccess;
+class SfxBoolItem;
+class SvxPostureItem;
+class SvxWeightItem;
+class SvxShadowedItem;
+class SvxAutoKernItem;
+class SvxWordLineModeItem;
+class SvxContourItem;
+class SvxKerningItem;
+class SvxUnderlineItem;
+class SvxOverlineItem;
+class SvxCrossedOutItem;
+class SvxFontHeightItem;
+class SvxPropSizeItem;
+class SvxFontItem;
+class SvxColorItem;
+class SvxCharSetColorItem;
+class SvxLanguageItem;
+class SvxEscapementItem;
+class SvxCaseMapItem;
+class SvxNoHyphenItem;
+class SvxBlinkItem;
+class SvxEmphasisMarkItem;
+class SvxTwoLinesItem;
+class SvxCharScaleWidthItem;
+class SvxCharRotateItem;
+class SvxCharReliefItem;
+class SvxCharHiddenItem;
+
+// Frame-Attribute
+class SwFmtFillOrder;
+class SwFmtFrmSize;
+class SvxPaperBinItem;
+class SvxLRSpaceItem;
+class SvxULSpaceItem;
+class SwFmtCntnt;
+class SwFmtHeader;
+class SwFmtFooter;
+class SvxPrintItem;
+class SvxOpaqueItem;
+class SvxProtectItem;
+class SwFmtSurround;
+class SwFmtVertOrient;
+class SwFmtHoriOrient;
+class SwFmtAnchor;
+class SvxBoxItem;
+class SvxBrushItem;
+class SvxShadowItem;
+class SwFmtPageDesc;
+class SvxFmtBreakItem;
+class SwFmtCol;
+class SvxMacroItem;
+class SvxFmtKeepItem;
+class SwFmtURL;
+class SwFmtLineNumber;
+class SwFmtEditInReadonly;
+class SwFmtLayoutSplit;
+class SwFmtRowSplit;
+class SwFmtChain;
+class SwFmtFtnAtTxtEnd;
+class SwFmtEndAtTxtEnd;
+class SwFmtNoBalancedColumns;
+class SvxFrameDirectionItem;
+class SwTextGridItem;
+class SwHeaderAndFooterEatSpacingItem;
+// OD 18.09.2003 #i18732#
+class SwFmtFollowTextFlow;
+// OD 2004-05-05 #i28701#
+class SwFmtWrapInfluenceOnObjPos;
+
+// Grafik-Attribute
+class SwMirrorGrf;
+class SwCropGrf;
+class SwRotationGrf;
+class SwLuminanceGrf;
+class SwContrastGrf;
+class SwChannelRGrf;
+class SwChannelGGrf;
+class SwChannelBGrf;
+class SwGammaGrf;
+class SwInvertGrf;
+class SwTransparencyGrf;
+class SwDrawModeGrf;
+
+// Paragraph-Attribute
+class SvxLineSpacingItem;
+class SvxAdjustItem;
+class SvxFmtSplitItem;
+class SwRegisterItem;
+class SwNumRuleItem;
+class SvxWidowsItem;
+class SvxOrphansItem;
+class SvxTabStopItem;
+class SvxHyphenZoneItem;
+class SwFmtDrop;
+class SvxScriptSpaceItem;
+class SvxHangingPunctuationItem;
+class SvxForbiddenRuleItem;
+class SvxParaVertAlignItem;
+class SvxParaGridItem;
+class SwParaConnectBorderItem;
+
+// TabellenBox-Attribute
+class SwTblBoxNumFormat;
+class SwTblBoxFormula;
+class SwTblBoxValue;
+
+class SwAttrPool : public SfxItemPool
+{
+ friend void _InitCore(); // fuers anlegen/zerstoeren der
+ friend void _FinitCore(); // Versionsmaps
+ static sal_uInt16* pVersionMap1;
+ static sal_uInt16* pVersionMap2;
+ static sal_uInt16* pVersionMap3;
+ static sal_uInt16* pVersionMap4;
+ // OD 2004-01-21 #i18732# - due to extension of attribute set a new version
+ // map for binary filter is necessary (version map 5).
+ static sal_uInt16* pVersionMap5;
+ static sal_uInt16* pVersionMap6;
+
+ SwDoc* pDoc;
+
+public:
+ SwAttrPool( SwDoc* pDoc );
+protected:
+ virtual ~SwAttrPool();
+public:
+
+ SwDoc* GetDoc() { return pDoc; }
+ const SwDoc* GetDoc() const { return pDoc; }
+
+ static sal_uInt16* GetVersionMap1() { return pVersionMap1; }
+ static sal_uInt16* GetVersionMap2() { return pVersionMap2; }
+ static sal_uInt16* GetVersionMap3() { return pVersionMap3; }
+ static sal_uInt16* GetVersionMap6() { return pVersionMap4; }
+};
+
+
+class SW_DLLPUBLIC SwAttrSet : public SfxItemSet
+{
+ // Pointer fuers Modify-System
+ SwAttrSet *pOldSet, *pNewSet;
+
+ // Notification-Callback
+ virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew );
+
+ void PutChgd( const SfxPoolItem& rI ) { SfxItemSet::PutDirect( rI ); }
+public:
+ SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
+ SwAttrSet( SwAttrPool&, const sal_uInt16* nWhichPairTable );
+ SwAttrSet( const SwAttrSet& );
+
+ virtual SfxItemSet* Clone(sal_Bool bItems = sal_True, SfxItemPool *pToPool = 0) const;
+
+ int Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew );
+ int Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
+
+ // ein Item oder einen Bereich loeschen
+ sal_uInt16 ClearItem_BC( sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew );
+ sal_uInt16 ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
+ SwAttrSet* pOld = 0, SwAttrSet* pNew = 0 );
+
+ int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
+
+ void GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText ) const;
+
+ SwAttrPool* GetPool() const { return (SwAttrPool*)SfxItemSet::GetPool(); }
+
+ // kopiere die Attribute ggfs. ueber Dokumentgrenzen
+ void CopyToModify( SwModify& rMod ) const;
+
+ // ----------------------------------------------------------------
+ // Sonderbehandlung fuer einige Attribute
+ // Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen:
+ // - SwFmtDropCaps
+ // - SwFmtPageDesc
+ // (Wird beim Einfuegen in Formate/Nodes gerufen)
+ // Second version is for the SwAttrSet handles of SwCntntNode.
+ bool SetModifyAtAttr( const SwModify* pModify );
+
+ // Das Doc wird jetzt am SwAttrPool gesetzt. Dadurch hat man es immer
+ // im Zugriff.
+ const SwDoc *GetDoc() const { return GetPool()->GetDoc(); }
+ SwDoc *GetDoc() { return GetPool()->GetDoc(); }
+
+ // GetMethoden: das Bool gibt an, ob nur im Set (sal_False) oder auch in
+ // den Parents gesucht werden soll. Wird nichts gefunden,
+ // wird das deflt. Attribut returnt.
+ // Charakter-Attribute - impl. steht im charatr.hxx
+ // AMA 12.10.94: Umstellung von SwFmt... auf Svx...
+ inline const SvxPostureItem &GetPosture( sal_Bool = sal_True ) const;
+ inline const SvxWeightItem &GetWeight( sal_Bool = sal_True ) const;
+ inline const SvxShadowedItem &GetShadowed( sal_Bool = sal_True ) const;
+ inline const SvxAutoKernItem &GetAutoKern( sal_Bool = sal_True ) const;
+ inline const SvxWordLineModeItem &GetWordLineMode( sal_Bool = sal_True ) const;
+ inline const SvxContourItem &GetContour( sal_Bool = sal_True ) const;
+ inline const SvxKerningItem &GetKerning( sal_Bool = sal_True ) const;
+ inline const SvxUnderlineItem &GetUnderline( sal_Bool = sal_True ) const;
+ inline const SvxOverlineItem &GetOverline( sal_Bool = sal_True ) const;
+ inline const SvxCrossedOutItem &GetCrossedOut( sal_Bool = sal_True ) const;
+ inline const SvxFontHeightItem &GetSize( sal_Bool = sal_True ) const;
+ inline const SvxPropSizeItem &GetPropSize( sal_Bool = sal_True ) const;
+ inline const SvxFontItem &GetFont( sal_Bool = sal_True ) const;
+ inline const SvxColorItem &GetColor( sal_Bool = sal_True ) const;
+ inline const SvxCharSetColorItem &GetCharSetColor( sal_Bool = sal_True ) const;
+ inline const SvxLanguageItem &GetLanguage( sal_Bool = sal_True ) const;
+ inline const SvxEscapementItem &GetEscapement( sal_Bool = sal_True ) const;
+ inline const SvxCaseMapItem &GetCaseMap( sal_Bool = sal_True ) const;
+ inline const SvxNoHyphenItem &GetNoHyphenHere( sal_Bool = sal_True ) const;
+ inline const SvxBlinkItem &GetBlink( sal_Bool = sal_True ) const;
+ inline const SvxBrushItem &GetChrBackground( sal_Bool = sal_True ) const;
+ inline const SvxFontItem &GetCJKFont( sal_Bool = sal_True ) const;
+ inline const SvxFontHeightItem &GetCJKSize( sal_Bool = sal_True ) const;
+ inline const SvxLanguageItem &GetCJKLanguage( sal_Bool = sal_True ) const;
+ inline const SvxPostureItem &GetCJKPosture( sal_Bool = sal_True ) const;
+ inline const SvxWeightItem &GetCJKWeight( sal_Bool = sal_True ) const;
+ inline const SvxFontItem &GetCTLFont( sal_Bool = sal_True ) const;
+ inline const SvxFontHeightItem &GetCTLSize( sal_Bool = sal_True ) const;
+ inline const SvxLanguageItem &GetCTLLanguage( sal_Bool = sal_True ) const;
+ inline const SvxPostureItem &GetCTLPosture( sal_Bool = sal_True ) const;
+ inline const SvxWeightItem &GetCTLWeight( sal_Bool = sal_True ) const;
+ inline const SfxBoolItem &GetWritingDirection( sal_Bool = sal_True ) const;
+ inline const SvxEmphasisMarkItem &GetEmphasisMark( sal_Bool = sal_True ) const;
+ inline const SvxTwoLinesItem &Get2Lines( sal_Bool = sal_True ) const;
+ inline const SvxCharScaleWidthItem &GetCharScaleW( sal_Bool = sal_True ) const;
+ inline const SvxCharRotateItem &GetCharRotate( sal_Bool = sal_True ) const;
+ inline const SvxCharReliefItem &GetCharRelief( sal_Bool = sal_True ) const;
+ inline const SvxCharHiddenItem &GetCharHidden( sal_Bool = sal_True ) const;
+
+ // Frame-Attribute - impl. steht im frmatr.hxx
+ inline const SwFmtFillOrder &GetFillOrder( sal_Bool = sal_True ) const;
+ inline const SwFmtFrmSize &GetFrmSize( sal_Bool = sal_True ) const;
+ inline const SvxPaperBinItem &GetPaperBin( sal_Bool = sal_True ) const;
+ inline const SvxLRSpaceItem &GetLRSpace( sal_Bool = sal_True ) const;
+ inline const SvxULSpaceItem &GetULSpace( sal_Bool = sal_True ) const;
+ inline const SwFmtCntnt &GetCntnt( sal_Bool = sal_True ) const;
+ inline const SwFmtHeader &GetHeader( sal_Bool = sal_True ) const;
+ inline const SwFmtFooter &GetFooter( sal_Bool = sal_True ) const;
+ inline const SvxPrintItem &GetPrint( sal_Bool = sal_True ) const;
+ inline const SvxOpaqueItem &GetOpaque( sal_Bool = sal_True ) const;
+ inline const SvxProtectItem &GetProtect( sal_Bool = sal_True ) const;
+ inline const SwFmtSurround &GetSurround( sal_Bool = sal_True ) const;
+ inline const SwFmtVertOrient &GetVertOrient( sal_Bool = sal_True ) const;
+ inline const SwFmtHoriOrient &GetHoriOrient( sal_Bool = sal_True ) const;
+ inline const SwFmtAnchor &GetAnchor( sal_Bool = sal_True ) const;
+ inline const SvxBoxItem &GetBox( sal_Bool = sal_True ) const;
+ inline const SvxFmtKeepItem &GetKeep( sal_Bool = sal_True ) const;
+ inline const SvxBrushItem &GetBackground( sal_Bool = sal_True ) const;
+ inline const SvxShadowItem &GetShadow( sal_Bool = sal_True ) const;
+ inline const SwFmtPageDesc &GetPageDesc( sal_Bool = sal_True ) const;
+ inline const SvxFmtBreakItem &GetBreak( sal_Bool = sal_True ) const;
+ inline const SwFmtCol &GetCol( sal_Bool = sal_True ) const;
+ inline const SvxMacroItem &GetMacro( sal_Bool = sal_True ) const;
+ inline const SwFmtURL &GetURL( sal_Bool = sal_True ) const;
+ inline const SwFmtEditInReadonly &GetEditInReadonly( sal_Bool = sal_True ) const;
+ inline const SwFmtLayoutSplit &GetLayoutSplit( sal_Bool = sal_True ) const;
+ inline const SwFmtRowSplit &GetRowSplit( sal_Bool = sal_True ) const;
+ inline const SwFmtChain &GetChain( sal_Bool = sal_True ) const;
+ inline const SwFmtLineNumber &GetLineNumber( sal_Bool = sal_True ) const;
+ inline const SwFmtFtnAtTxtEnd &GetFtnAtTxtEnd( sal_Bool = sal_True ) const;
+ inline const SwFmtEndAtTxtEnd &GetEndAtTxtEnd( sal_Bool = sal_True ) const;
+ inline const SwFmtNoBalancedColumns &GetBalancedColumns( sal_Bool = sal_True ) const;
+ inline const SvxFrameDirectionItem &GetFrmDir( sal_Bool = sal_True ) const;
+ inline const SwTextGridItem &GetTextGrid( sal_Bool = sal_True ) const;
+ inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( sal_Bool = sal_True ) const;
+ // OD 18.09.2003 #i18732#
+ inline const SwFmtFollowTextFlow &GetFollowTextFlow(sal_Bool = sal_True) const;
+ // OD 2004-05-05 #i28701#
+ inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const;
+
+ // Grafik-Attribute - impl. steht im grfatr.hxx
+ inline const SwMirrorGrf &GetMirrorGrf( sal_Bool = sal_True ) const;
+ inline const SwCropGrf &GetCropGrf( sal_Bool = sal_True ) const;
+ inline const SwRotationGrf &GetRotationGrf(sal_Bool = sal_True ) const;
+ inline const SwLuminanceGrf &GetLuminanceGrf(sal_Bool = sal_True ) const;
+ inline const SwContrastGrf &GetContrastGrf(sal_Bool = sal_True ) const;
+ inline const SwChannelRGrf &GetChannelRGrf(sal_Bool = sal_True ) const;
+ inline const SwChannelGGrf &GetChannelGGrf(sal_Bool = sal_True ) const;
+ inline const SwChannelBGrf &GetChannelBGrf(sal_Bool = sal_True ) const;
+ inline const SwGammaGrf &GetGammaGrf(sal_Bool = sal_True ) const;
+ inline const SwInvertGrf &GetInvertGrf(sal_Bool = sal_True ) const;
+ inline const SwTransparencyGrf &GetTransparencyGrf(sal_Bool = sal_True ) const;
+ inline const SwDrawModeGrf &GetDrawModeGrf(sal_Bool = sal_True ) const;
+
+ // Paragraph-Attribute - impl. steht im paratr.hxx
+ inline const SvxLineSpacingItem &GetLineSpacing( sal_Bool = sal_True ) const;
+ inline const SvxAdjustItem &GetAdjust( sal_Bool = sal_True ) const;
+ inline const SvxFmtSplitItem &GetSplit( sal_Bool = sal_True ) const;
+ inline const SwRegisterItem &GetRegister( sal_Bool = sal_True ) const;
+ inline const SwNumRuleItem &GetNumRule( sal_Bool = sal_True ) const;
+ inline const SvxWidowsItem &GetWidows( sal_Bool = sal_True ) const;
+ inline const SvxOrphansItem &GetOrphans( sal_Bool = sal_True ) const;
+ inline const SvxTabStopItem &GetTabStops( sal_Bool = sal_True ) const;
+ inline const SvxHyphenZoneItem &GetHyphenZone( sal_Bool = sal_True ) const;
+ inline const SwFmtDrop &GetDrop( sal_Bool = sal_True ) const;
+ inline const SvxScriptSpaceItem &GetScriptSpace(sal_Bool = sal_True) const;
+ inline const SvxHangingPunctuationItem &GetHangingPunctuation(sal_Bool = sal_True) const;
+ inline const SvxForbiddenRuleItem &GetForbiddenRule(sal_Bool = sal_True) const;
+ inline const SvxParaVertAlignItem &GetParaVertAlign(sal_Bool = sal_True) const;
+ inline const SvxParaGridItem &GetParaGrid(sal_Bool = sal_True) const;
+ inline const SwParaConnectBorderItem &GetParaConnectBorder(sal_Bool = sal_True ) const;
+
+ // TabellenBox-Attribute - impl. steht im cellatr.hxx
+ inline const SwTblBoxNumFormat &GetTblBoxNumFmt( sal_Bool = sal_True ) const;
+ inline const SwTblBoxFormula &GetTblBoxFormula( sal_Bool = sal_True ) const;
+ inline const SwTblBoxValue &GetTblBoxValue( sal_Bool = sal_True ) const;
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwAttrSet)
+};
+
+//Helper for filters to find true lineheight of a font
+SW_DLLPUBLIC long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
+ const SwAttrSet &rSet,
+ const OutputDevice &rOut, sal_Int16 nScript);
+#endif
diff --git a/sw/inc/swbaslnk.hxx b/sw/inc/swbaslnk.hxx
new file mode 100644
index 000000000000..46fbb36df723
--- /dev/null
+++ b/sw/inc/swbaslnk.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWBASLNK_HXX
+#define _SWBASLNK_HXX
+
+#include <sfx2/lnkbase.hxx>
+
+class SwNode;
+class SwCntntNode;
+class ReReadThread;
+long GrfNodeChanged( void* pLink, void* pCaller );
+
+class SwBaseLink : public ::sfx2::SvBaseLink
+{
+ friend long GrfNodeChanged( void* pLink, void* pCaller );
+
+ SwCntntNode* pCntntNode;
+ sal_Bool bSwapIn : 1;
+ sal_Bool bNoDataFlag : 1;
+ sal_Bool bIgnoreDataChanged : 1;
+ ReReadThread* m_pReReadThread;
+
+protected:
+ SwBaseLink(): m_pReReadThread(0) {}
+
+ SwBaseLink( const String& rNm, sal_uInt16 nObjectType, ::sfx2::SvLinkSource* pObj,
+ SwCntntNode* pNode = 0 )
+ : ::sfx2::SvBaseLink( rNm, nObjectType, pObj ), pCntntNode( pNode ),
+ bSwapIn( sal_False ), bNoDataFlag( sal_False ), bIgnoreDataChanged( sal_False ),
+ m_pReReadThread(0)
+ {}
+
+public:
+ TYPEINFO();
+
+ SwBaseLink( sal_uInt16 nMode, sal_uInt16 nFormat, SwCntntNode* pNode = 0 )
+ : ::sfx2::SvBaseLink( nMode, nFormat ), pCntntNode( pNode ),
+ bSwapIn( sal_False ), bNoDataFlag( sal_False ), bIgnoreDataChanged( sal_False ),
+ m_pReReadThread(0)
+ {}
+ virtual ~SwBaseLink();
+
+ virtual void DataChanged( const String& rMimeType,
+ const ::com::sun::star::uno::Any & rValue );
+
+ virtual void Closed();
+
+ virtual const SwNode* GetAnchor() const;
+
+ SwCntntNode *GetCntntNode() { return pCntntNode; }
+
+ // nur fuer Grafiken
+ sal_Bool SwapIn( sal_Bool bWaitForData = sal_False, sal_Bool bNativFormat = sal_False );
+
+ sal_Bool Connect() { return 0 != SvBaseLink::GetRealObject(); }
+
+ // nur fuer Grafik-Links ( zum Umschalten zwischen DDE / Grf-Link)
+ void SetObjType( sal_uInt16 nType ) { SvBaseLink::SetObjType( nType ); }
+
+ sal_Bool IsRecursion( const SwBaseLink* pChkLnk ) const;
+ virtual sal_Bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, xub_StrLen nStt = 0,
+ xub_StrLen nEnd = STRING_NOTFOUND ) const;
+
+ void SetNoDataFlag() { bNoDataFlag = sal_True; }
+ sal_Bool ChkNoDataFlag() { sal_Bool bRet = bNoDataFlag; bNoDataFlag = sal_False; return bRet; }
+ sal_Bool IsNoDataFlag() const { return bNoDataFlag; }
+};
+
+
+#endif
+
diff --git a/sw/inc/swcalwrp.hxx b/sw/inc/swcalwrp.hxx
new file mode 100644
index 000000000000..f7def58ab211
--- /dev/null
+++ b/sw/inc/swcalwrp.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWCALWRP_HXX
+#define _SWCALWRP_HXX
+
+#include <i18npool/lang.h>
+#include <tools/string.hxx>
+#include <unotools/calendarwrapper.hxx>
+#include <salhelper/singletonref.hxx>
+
+class SwCalendarWrapper : public CalendarWrapper
+{
+ String sUniqueId;
+ sal_uInt16 nLang;
+
+public:
+ SwCalendarWrapper( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xMSF = ::comphelper::getProcessServiceFactory() )
+ : CalendarWrapper( xMSF ), nLang( LANGUAGE_SYSTEM )
+ {}
+
+ void LoadDefaultCalendar( sal_uInt16 nLang );
+};
+
+
+salhelper::SingletonRef<SwCalendarWrapper>* s_getCalendarWrapper();
+
+
+#endif
+
diff --git a/sw/inc/swcli.hxx b/sw/inc/swcli.hxx
new file mode 100644
index 000000000000..86a42512475f
--- /dev/null
+++ b/sw/inc/swcli.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWCLI_HXX
+#define _SWCLI_HXX
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+
+#include <svtools/embedhlp.hxx>
+
+#ifndef _SFX_CLIENTSH_HXX //autogen
+#include <sfx2/ipclient.hxx>
+#endif
+
+class SwView;
+class SwEditWin;
+
+class SwOleClient : public SfxInPlaceClient
+{
+ sal_Bool bInDoVerb;
+ sal_Bool bOldCheckForOLEInCaption;
+
+ virtual void ObjectAreaChanged();
+ virtual void RequestNewObjectArea( Rectangle& );
+ virtual void ViewChanged();
+ virtual void MakeVisible();
+
+public:
+ SwOleClient( SwView *pView, SwEditWin *pWin, const svt::EmbeddedObjectRef& );
+
+ void SetInDoVerb( sal_Bool bFlag ) { bInDoVerb = bFlag; }
+
+ sal_Bool IsCheckForOLEInCaption() const { return bOldCheckForOLEInCaption; }
+
+ virtual void FormatChanged();
+};
+
+#endif
diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h
new file mode 100644
index 000000000000..8d3fe63b75bb
--- /dev/null
+++ b/sw/inc/swcommands.h
@@ -0,0 +1,434 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_SWCOMMANDS_HRC
+#define SW_SWCOMMANDS_HRC
+
+#define CMD_SID_CREATE_SW_DRAWVIEW ".uno:CreateSWDrawView"
+#define CMD_FN_REDLINE_ACCEPT ".uno:AcceptTrackedChanges"
+#define CMD_FN_REDLINE_ON ".uno:TrackChanges"
+#define CMD_FN_ADD_UNKNOWN ".uno:AddAllUnknownWords"
+#define CMD_FN_FRAME_ALIGN_VERT_BOTTOM ".uno:AlignBottom"
+#define CMD_FN_FRAME_ALIGN_VERT_CHAR_BOTTOM ".uno:AlignCharBottom"
+#define CMD_FN_FRAME_ALIGN_VERT_CHAR_TOP ".uno:AlignCharTop"
+#define CMD_FN_FRAME_ALIGN_HORZ_CENTER ".uno:AlignHorizontalCenter"
+#define CMD_FN_FRAME_ALIGN_HORZ_LEFT ".uno:AlignLeft"
+#define CMD_FN_FRAME_ALIGN_HORZ_RIGHT ".uno:AlignRight"
+#define CMD_FN_FRAME_ALIGN_VERT_ROW_BOTTOM ".uno:AlignRowBottom"
+#define CMD_FN_FRAME_ALIGN_VERT_ROW_TOP ".uno:AlignRowTop"
+#define CMD_FN_FRAME_ALIGN_VERT_TOP ".uno:AlignTop"
+#define CMD_FN_FRAME_ALIGN_VERT_CENTER ".uno:AlignVerticalCenter"
+#define CMD_FN_FRAME_ALIGN_VERT_CHAR_CENTER ".uno:AlignVerticalCharCenter"
+#define CMD_FN_FRAME_ALIGN_VERT_ROW_CENTER ".uno:AlignVerticalRowCenter"
+#define CMD_FN_EDIT_AUTH_ENTRY_DLG ".uno:AuthoritiesEntryDialog"
+#define CMD_FN_AUTOFORMAT_APPLY ".uno:AutoFormatApply"
+#define CMD_FN_AUTOFORMAT_REDLINE_APPLY ".uno:AutoFormatRedlineApply"
+#define CMD_FN_TABLE_AUTOSUM ".uno:AutoSum"
+#define CMD_SID_ATTR_CHAR_COLOR_BACKGROUND ".uno:BackColor"
+#define CMD_FN_FORMAT_BACKGROUND_DLG ".uno:BackgroundDialog"
+#define CMD_FN_BACKSPACE ".uno:SwBackspace"
+#define CMD_FN_FORMAT_BORDER_DLG ".uno:BorderDialog"
+#define CMD_FN_NUMBER_BULLETS ".uno:BulletsAndNumberingDialog"
+#define CMD_FN_CALC_TABLE ".uno:Calc"
+#define CMD_FN_CALCULATE ".uno:CalculateSel"
+#define CMD_FN_TABLE_VERT_BOTTOM ".uno:CellVertBottom"
+#define CMD_FN_TABLE_VERT_CENTER ".uno:CellVertCenter"
+#define CMD_FN_TABLE_VERT_NONE ".uno:CellVertTop"
+#define CMD_FN_FRAME_CHAIN ".uno:ChainFrames"
+#define CMD_FN_CHANGE_DBFIELD ".uno:ChangeDatabaseField"
+#define CMD_FN_NUMBERING_OUTLINE_DLG ".uno:ChapterNumberingDialog"
+#define CMD_SID_ATTR_CHAR_COLOR_BACKGROUND_EXT ".uno:CharBackgroundExt"
+#define CMD_SID_ATTR_CHAR_COLOR_EXT ".uno:CharColorExt"
+#define CMD_FN_CHAR_LEFT_SEL ".uno:CharLeftSel"
+#define CMD_FN_CHAR_RIGHT_SEL ".uno:CharRightSel"
+#define CMD_FN_CLOSE_PAGEPREVIEW ".uno:ClosePreview"
+#define CMD_FN_REDLINE_COMMENT ".uno:CommentChangeTracking"
+#define CMD_FN_VIEW_META_CHARS ".uno:ControlCodes"
+#define CMD_FN_CONVERT_TEXT_TABLE ".uno:ConvertTableText"
+#define CMD_FN_ABSTRACT_NEWDOC ".uno:CreateAbstract"
+#define CMD_FN_DEC_INDENT_OFFSET ".uno:DecrementIndentValue"
+#define CMD_FN_NUM_BULLET_DOWN ".uno:DecrementLevel"
+#define CMD_FN_NUM_BULLET_OUTLINE_DOWN ".uno:DecrementSubLevels"
+#define CMD_FN_TABLE_DELETE_COL ".uno:DeleteColumns"
+#define CMD_FN_TABLE_DELETE_ROW ".uno:DeleteRows"
+#define CMD_FN_DELETE_WHOLE_LINE ".uno:DelLine"
+#define CMD_FN_DELETE_LINE ".uno:DelToEndOfLine"
+#define CMD_FN_DELETE_PARA ".uno:DelToEndOfPara"
+#define CMD_FN_DELETE_SENT ".uno:DelToEndOfSentence"
+#define CMD_FN_DELETE_WORD ".uno:DelToEndOfWord"
+#define CMD_FN_DELETE_BACK_LINE ".uno:DelToStartOfLine"
+#define CMD_FN_DELETE_BACK_PARA ".uno:DelToStartOfPara"
+#define CMD_FN_DELETE_BACK_SENT ".uno:DelToStartOfSentence"
+#define CMD_FN_DELETE_BACK_WORD ".uno:DelToStartOfWord"
+#define CMD_FN_TABLE_BALANCE_CELLS ".uno:DistributeColumns"
+#define CMD_FN_TABLE_BALANCE_ROWS ".uno:DistributeRows"
+#define CMD_FN_EDIT_CURRENT_TOX ".uno:EditCurIndex"
+#define CMD_FN_GLOSSARY_DLG ".uno:EditGlossary"
+#define CMD_FN_EDIT_HYPERLINK ".uno:EditHyperlink"
+#define CMD_FN_EDIT_REGION ".uno:EditRegion"
+#define CMD_FN_END_OF_DOCUMENT_SEL ".uno:EndOfDocumentSel"
+#define CMD_FN_END_OF_LINE_SEL ".uno:EndOfLineSel"
+#define CMD_FN_END_OF_PARA_SEL ".uno:EndOfParaSel"
+#define CMD_FN_TABLE_SELECT_COL ".uno:EntireColumn"
+#define CMD_FN_TABLE_SELECT_ROW ".uno:EntireRow"
+#define CMD_FN_ESCAPE ".uno:Escape"
+#define CMD_FN_EXECUTE_MACROFIELD ".uno:ExecuteMacroField"
+#define CMD_FN_EXPAND_GLOSSARY ".uno:ExpandGlossary"
+#define CMD_FN_EDIT_FIELD ".uno:FieldDialog"
+#define CMD_FN_VIEW_FIELDNAME ".uno:Fieldnames"
+#define CMD_FN_VIEW_FIELDS ".uno:Fields"
+#define CMD_FN_FLIP_HORZ_GRAFIC ".uno:FlipHorizontal"
+#define CMD_FN_FLIP_VERT_GRAFIC ".uno:FlipVertical"
+#define CMD_SID_ATTR_CHAR_COLOR2 ".uno:FontColor"
+#define CMD_FN_FORMAT_FOOTNOTE_DLG ".uno:FootnoteDialog"
+#define CMD_FN_EDIT_FOOTNOTE ".uno:EditFootnote"
+#define CMD_FN_FORMAT_COLUMN ".uno:FormatColumns"
+#define CMD_FN_FORMAT_DROPCAPS ".uno:FormatDropcap"
+#define CMD_FN_FORMAT_FRAME_DLG ".uno:FrameDialog"
+#define CMD_FN_LINE_DOWN ".uno:GoDown"
+#define CMD_FN_CHAR_LEFT ".uno:GoLeft"
+#define CMD_FN_CHAR_RIGHT ".uno:GoRight"
+#define CMD_FN_FRAME_TO_ANCHOR ".uno:GoToAnchor"
+#define CMD_FN_END_TABLE ".uno:GoToEnd"
+#define CMD_FN_END_OF_COLUMN ".uno:GoToEndOfColumn"
+#define CMD_FN_END_OF_DOCUMENT ".uno:GoToEndOfDoc"
+#define CMD_FN_END_OF_LINE ".uno:GoToEndOfLine"
+#define CMD_FN_END_OF_NEXT_COLUMN ".uno:GoToEndOfNextColumn"
+#define CMD_FN_END_OF_NEXT_PAGE ".uno:GoToEndOfNextPage"
+#define CMD_FN_END_OF_NEXT_PAGE_SEL ".uno:GoToEndOfNextPageSel"
+#define CMD_FN_END_OF_PAGE ".uno:GoToEndOfPage"
+#define CMD_FN_END_OF_PAGE_SEL ".uno:GoToEndOfPageSel"
+#define CMD_FN_END_OF_PARA ".uno:GoToEndOfPara"
+#define CMD_FN_END_OF_PREV_COLUMN ".uno:GoToEndOfPrevColumn"
+#define CMD_FN_END_OF_PREV_PAGE ".uno:GoToEndOfPrevPage"
+#define CMD_FN_END_OF_PREV_PAGE_SEL ".uno:GoToEndOfPrevPageSel"
+#define CMD_FN_NEXT_TOXMARK ".uno:GotoNextIndexMark"
+#define CMD_FN_GOTO_NEXT_INPUTFLD ".uno:GotoNextInputField"
+#define CMD_FN_GOTO_NEXT_OBJ ".uno:GotoNextObject"
+#define CMD_FN_NEXT_PARA ".uno:GoToNextPara"
+#define CMD_FN_GOTO_NEXT_MARK ".uno:GotoNextPlacemarker"
+#define CMD_FN_NEXT_SENT ".uno:GoToNextSentence"
+#define CMD_FN_NEXT_SENT_SEL ".uno:GotoNextSentenceSel"
+#define CMD_FN_NEXT_TBLFML ".uno:GotoNextTableFormula"
+#define CMD_FN_NEXT_WORD ".uno:GoToNextWord"
+#define CMD_FN_NEXT_TBLFML_ERR ".uno:GotoNextWrongTableFormula"
+#define CMD_FN_NAVIGATION_PI_GOTO_PAGE ".uno:GotoPage"
+#define CMD_FN_PREV_TOXMARK ".uno:GotoPrevIndexMark"
+#define CMD_FN_GOTO_PREV_INPUTFLD ".uno:GotoPrevInputField"
+#define CMD_FN_GOTO_PREV_OBJ ".uno:GotoPrevObject"
+#define CMD_FN_PREV_PARA ".uno:GoToPrevPara"
+#define CMD_FN_GOTO_PREV_MARK ".uno:GotoPrevPlacemarker"
+#define CMD_FN_PREV_SENT ".uno:GoToPrevSentence"
+#define CMD_FN_PREV_SENT_SEL ".uno:GotoPrevSentenceSel"
+#define CMD_FN_PREV_TBLFML ".uno:GotoPrevTableFormula"
+#define CMD_FN_PREV_WORD ".uno:GoToPrevWord"
+#define CMD_FN_PREV_TBLFML_ERR ".uno:GotoPrevWrongTableFormula"
+#define CMD_FN_START_TABLE ".uno:GoToStartOfTable"
+#define CMD_FN_START_OF_COLUMN ".uno:GoToStartOfColumn"
+#define CMD_FN_START_OF_DOCUMENT ".uno:GoToStartOfDoc"
+#define CMD_FN_START_OF_LINE ".uno:GoToStartOfLine"
+#define CMD_FN_START_OF_NEXT_COLUMN ".uno:GoToStartOfNextColumn"
+#define CMD_FN_START_OF_NEXT_PAGE ".uno:GoToStartOfNextPage"
+#define CMD_FN_START_OF_NEXT_PAGE_SEL ".uno:GoToStartOfNextPageSel"
+#define CMD_FN_START_OF_PAGE ".uno:GoToStartOfPage"
+#define CMD_FN_START_OF_PAGE_SEL ".uno:GoToStartOfPageSel"
+#define CMD_FN_START_OF_PARA ".uno:GoToStartOfPara"
+#define CMD_FN_START_OF_PREV_COLUMN ".uno:GoToStartOfPrevColumn"
+#define CMD_FN_START_OF_PREV_PAGE ".uno:GoToStartOfPrevPage"
+#define CMD_FN_START_OF_PREV_PAGE_SEL ".uno:GoToStartOfPrevPageSel"
+#define CMD_FN_LINE_UP ".uno:GoUp"
+#define CMD_FN_VIEW_GRAPHIC ".uno:Graphic"
+#define CMD_FN_FORMAT_GRAFIC_DLG ".uno:GraphicDialog"
+#define CMD_FN_SAVE_GRAPHIC ".uno:SaveGraphic"
+#define CMD_FN_GROW_FONT_SIZE ".uno:Grow"
+#define CMD_FN_HSCROLLBAR ".uno:HScroll"
+#define CMD_SID_HTML_MODE ".uno:HtmlMode"
+#define CMD_FN_HYPHENATE_OPT_DLG ".uno:Hyphenate"
+#define CMD_FN_INC_INDENT_OFFSET ".uno:IncrementIndentValue"
+#define CMD_FN_NUM_BULLET_UP ".uno:IncrementLevel"
+#define CMD_FN_NUM_BULLET_OUTLINE_UP ".uno:IncrementSubLevels"
+#define CMD_FN_EDIT_IDX_ENTRY_DLG ".uno:IndexEntryDialog"
+#define CMD_FN_IDX_MARK_TO_IDX ".uno:IndexMarkToIndex"
+#define CMD_FN_POSTIT ".uno:InsertAnnotation"
+#define CMD_FN_INSERT_FLD_AUTHOR ".uno:InsertAuthorField"
+#define CMD_FN_INSERT_AUTH_ENTRY_DLG ".uno:InsertAuthoritiesEntry"
+#define CMD_FN_INSERT_BOOKMARK ".uno:InsertBookmark"
+#define CMD_FN_INSERT_BREAK_DLG ".uno:InsertBreak"
+#define CMD_FN_INSERT_CAPTION ".uno:InsertCaptionDialog"
+#define CMD_FN_INSERT_COLUMN_BREAK ".uno:InsertColumnBreak"
+#define CMD_FN_TABLE_INSERT_COL_DLG ".uno:InsertColumnDialog"
+#define CMD_FN_TABLE_INSERT_COL ".uno:InsertColumns"
+#define CMD_FN_INSERT_REGION ".uno:InsertSection"
+#define CMD_FN_INSERT_CTRL ".uno:InsertCtrl"
+#define CMD_FN_INSERT_FLD_DATE ".uno:InsertDateField"
+#define CMD_FN_INSERT_ENDNOTE ".uno:InsertEndnote"
+#define CMD_FN_ENVELOP ".uno:InsertEnvelope"
+#define CMD_FN_INSERT_FIELD ".uno:InsertField"
+#define CMD_FN_INSERT_FIELD_CTRL ".uno:InsertFieldCtrl"
+#define CMD_FN_INSERT_FOOTNOTE_DLG ".uno:InsertFootnoteDialog"
+#define CMD_FN_INSERT_FOOTNOTE ".uno:InsertFootnote"
+#define CMD_FN_EDIT_FORMULA ".uno:InsertFormula"
+#define CMD_FN_INSERT_FRAME ".uno:InsertFrame"
+#define CMD_FN_INSERT_FRAME_INTERACT ".uno:InsertFrameInteract"
+#define CMD_FN_INSERT_FRAME_INTERACT_NOCOL ".uno:InsertFrameInteractNoColumns"
+#define CMD_FN_INSERT_HRULER ".uno:InsertGraphicRuler"
+#define CMD_FN_INSERT_HYPERLINK ".uno:InsertHyperlinkDlg"
+#define CMD_FN_INSERT_IDX_ENTRY_DLG ".uno:InsertIndexesEntry"
+#define CMD_FN_INSERT_LINEBREAK ".uno:InsertLinebreak"
+#define CMD_FN_INSERT_MULTI_TOX ".uno:InsertMultiIndex"
+#define CMD_FN_NUM_BULLET_NONUM ".uno:InsertNeutralParagraph"
+#define CMD_FN_INSERT_OBJ_CTRL ".uno:InsertObjCtrl"
+#define CMD_FN_INSERT_OBJECT_DLG ".uno:InsertObjectDialog"
+#define CMD_FN_INSERT_SMA ".uno:InsertObjectStarMath"
+#define CMD_FN_INSERT_PAGEBREAK ".uno:InsertPagebreak"
+#define CMD_FN_INSERT_FLD_PGCOUNT ".uno:InsertPageCountField"
+#define CMD_FN_INSERT_PAGEFOOTER ".uno:InsertPageFooter"
+#define CMD_FN_INSERT_PAGEHEADER ".uno:InsertPageHeader"
+#define CMD_FN_INSERT_FLD_PGNUMBER ".uno:InsertPageNumberField"
+#define CMD_FN_INSERT_BREAK ".uno:InsertPara"
+#define CMD_FN_INSERT_REF_FIELD ".uno:InsertReferenceField"
+#define CMD_FN_TABLE_INSERT_ROW_DLG ".uno:InsertRowDialog"
+#define CMD_FN_TABLE_INSERT_ROW ".uno:InsertRows"
+#define CMD_FN_JAVAEDIT ".uno:InsertScript"
+#define CMD_FN_INSERT_TABLE ".uno:InsertTable"
+#define CMD_FN_INSERT_FLD_TIME ".uno:InsertTimeField"
+#define CMD_FN_INSERT_FLD_TITLE ".uno:InsertTitleField"
+#define CMD_FN_INSERT_FLD_TOPIC ".uno:InsertTopicField"
+#define CMD_FN_NUM_BULLET_NEXT ".uno:JumpDownThisLevel"
+#define CMD_FN_END_DOC_DIRECT ".uno:JumpToEndOfDoc"
+#define CMD_FN_TO_FOOTER ".uno:JumpToFooter"
+#define CMD_FN_FOOTNOTE_TO_ANCHOR ".uno:JumpToFootnoteOrAnchor"
+#define CMD_FN_TO_HEADER ".uno:JumpToHeader"
+#define CMD_FN_NEXT_BOOKMARK ".uno:JumpToNextBookmark"
+#define CMD_FN_NEXT_FOOTNOTE ".uno:JumpToNextFootnote"
+#define CMD_FN_CNTNT_TO_NEXT_FRAME ".uno:JumpToNextFrame"
+#define CMD_FN_GOTO_NEXT_REGION ".uno:JumpToNextRegion"
+#define CMD_FN_NEXT_TABLE ".uno:JumpToNextTable"
+#define CMD_FN_PREV_BOOKMARK ".uno:JumpToPrevBookmark"
+#define CMD_FN_PREV_FOOTNOTE ".uno:JumpToPrevFootnote"
+#define CMD_FN_GOTO_PREV_REGION ".uno:JumpToPrevRegion"
+#define CMD_FN_PREV_TABLE ".uno:JumpToPrevTable"
+#define CMD_FN_GOTO_REFERENCE ".uno:JumpToReference"
+#define CMD_FN_START_DOC_DIRECT ".uno:JumpToStartOfDoc"
+#define CMD_FN_NUM_BULLET_PREV ".uno:JumpUpThisLevel"
+#define CMD_FN_LINE_DOWN_SEL ".uno:LineDownSel"
+#define CMD_FN_LINE_NUMBERING_DLG ".uno:LineNumberingDialog"
+#define CMD_FN_LINE_UP_SEL ".uno:LineUpSel"
+#define CMD_FN_EDIT_LINK_DLG ".uno:LinkDialog"
+#define CMD_SID_TEMPLATE_LOAD ".uno:LoadStyles"
+#define CMD_FN_VIEW_MARKS ".uno:Marks"
+#define CMD_FN_TABLE_MERGE_CELLS ".uno:MergeCells"
+#define CMD_FN_QRY_MERGE ".uno:MergeDialog"
+#define CMD_FN_MAILMERGE_WIZARD ".uno:MailMergeWizard"
+#define CMD_FN_TABLE_MERGE_TABLE ".uno:MergeTable"
+#define CMD_FN_FORMAT_APPLY_HEAD1 ".uno:ApplyStyleHead1"
+#define CMD_FN_FORMAT_APPLY_HEAD2 ".uno:ApplyStyleHead2"
+#define CMD_FN_FORMAT_APPLY_HEAD3 ".uno:ApplyStyleHead3"
+#define CMD_FN_FORMAT_APPLY_DEFAULT ".uno:ApplyStyleDefault"
+#define CMD_FN_FORMAT_APPLY_TEXTBODY ".uno:ApplyStyleTextbody"
+#define CMD_FN_GRAPHIC_MIRROR_ON_EVEN_PAGES ".uno:MirrorGraphicOnEvenPages"
+#define CMD_FN_FRAME_MIRROR_ON_EVEN_PAGES ".uno:MirrorOnEvenPages"
+#define CMD_FN_NUM_BULLET_MOVEDOWN ".uno:MoveDown"
+#define CMD_FN_NUM_BULLET_OUTLINE_MOVEDOWN ".uno:MoveDownSubItems"
+#define CMD_FN_NUM_BULLET_MOVEUP ".uno:MoveUp"
+#define CMD_FN_NUM_BULLET_OUTLINE_MOVEUP ".uno:MoveUpSubItems"
+#define CMD_FN_TITLE_DESCRIPTION_SHAPE ".uno:ObjectTitleDescription"
+#define CMD_FN_NAME_SHAPE ".uno:NameGroup"
+#define CMD_FN_NEW_GLOBAL_DOC ".uno:NewGlobalDoc"
+#define CMD_FN_NEW_HTML_DOC ".uno:NewHtmlDoc"
+#define CMD_FN_NUMBER_FORMAT ".uno:NumberFormat"
+#define CMD_FN_NUMBER_CURRENCY ".uno:NumberFormatCurrency"
+#define CMD_FN_NUMBER_DATE ".uno:NumberFormatDate"
+#define CMD_FN_NUMBER_TWODEC ".uno:NumberFormatDecimal"
+#define CMD_FN_NUMBER_PERCENT ".uno:NumberFormatPercent"
+#define CMD_FN_NUMBER_SCIENTIFIC ".uno:NumberFormatScientific"
+#define CMD_FN_NUMBER_STANDARD ".uno:NumberFormatStandard"
+#define CMD_FN_NUMBER_TIME ".uno:NumberFormatTime"
+#define CMD_FN_NUMBER_NEWSTART ".uno:NumberingStart"
+#define CMD_FN_NUM_OR_NONUM ".uno:NumberOrNoNumber"
+#define CMD_FN_FRAME_DOWN ".uno:ObjectBackOne"
+#define CMD_FN_FRAME_UP ".uno:ObjectForwardOne"
+#define CMD_FN_AUTOFORMAT_AUTO ".uno:OnlineAutoFormat"
+#define CMD_FN_OPTIMIZE_TABLE ".uno:OptimizeTable"
+#define CMD_FN_FORMAT_PAGE_COLUMN_DLG ".uno:PageColumnDialog"
+#define CMD_FN_FORMAT_PAGE_DLG ".uno:PageDialog"
+#define CMD_FN_PAGEDOWN ".uno:PageDown"
+#define CMD_FN_PAGEDOWN_SEL ".uno:PageDownSel"
+#define CMD_FN_CHANGE_PAGENUM ".uno:PageOffset"
+#define CMD_FN_SET_PAGE_STYLE ".uno:PageStyleApply"
+#define CMD_FN_STAT_TEMPLATE ".uno:PageStyleName"
+#define CMD_FN_PAGEUP ".uno:PageUp"
+#define CMD_FN_PAGEUP_SEL ".uno:PageUpSel"
+#define CMD_FN_PREVIEW_ZOOM ".uno:PreviewZoom"
+#define CMD_FN_PRINT_LAYOUT ".uno:PrintLayout"
+#define CMD_FN_PRINT_PAGEPREVIEW ".uno:PrintPagePreView"
+#define CMD_FN_TABLE_SET_READ_ONLY_CELLS ".uno:Protect"
+#define CMD_FN_REDLINE_PROTECT ".uno:ProtectTraceChangeMode"
+#define CMD_FN_REFRESH_VIEW ".uno:RefreshView"
+#define CMD_FN_NUM_BULLET_OFF ".uno:RemoveBullets"
+#define CMD_FN_REMOVE_CUR_TOX ".uno:RemoveTableOf"
+#define CMD_FN_REPAGINATE ".uno:Repaginate"
+#define CMD_FN_REPEAT_SEARCH ".uno:RepeatSearch"
+#define CMD_FN_FORMAT_RESET ".uno:ResetAttributes"
+#define CMD_FN_TABLE_UNSET_READ_ONLY ".uno:ResetTableProtection"
+#define CMD_FN_RULER ".uno:Ruler"
+#define CMD_FN_QRY_INSERT ".uno:SbaInsert"
+#define CMD_FN_QRY_INSERT_FIELD ".uno:SbaInsertField"
+#define CMD_FN_QRY_MERGE_FIELD ".uno:SbaMerge"
+#define CMD_FN_SCROLL_NAVIGATION ".uno:ScrollNavigation"
+#define CMD_FN_SCROLL_NEXT_PREV ".uno:ScrollNextPrev"
+#define CMD_FN_TABLE_SELECT_ALL ".uno:SelectTable"
+#define CMD_FN_STAT_SELMODE ".uno:SelectionMode"
+#define CMD_FN_SELECT_PARA ".uno:SelectText"
+#define CMD_FN_SELECT_WORD ".uno:SelectWord"
+#define CMD_FN_ABSTRACT_STARIMPRESS ".uno:SendAbstractToStarImpress"
+#define CMD_FN_OUTLINE_TO_CLIPBOARD ".uno:SendOutlineToClipboard"
+#define CMD_FN_OUTLINE_TO_IMPRESS ".uno:SendOutlineToStarImpress"
+#define CMD_FN_TOOL_ANKER_AT_CHAR ".uno:SetAnchorAtChar"
+#define CMD_FN_TOOL_ANKER_CHAR ".uno:SetAnchorToChar"
+#define CMD_FN_TOOL_ANKER_FRAME ".uno:SetAnchorToFrame"
+#define CMD_FN_TOOL_ANKER_PAGE ".uno:SetAnchorToPage"
+#define CMD_FN_TOOL_ANKER_PARAGRAPH ".uno:SetAnchorToPara"
+#define CMD_FN_TABLE_SET_COL_WIDTH ".uno:SetColumnWidth"
+#define CMD_FN_SET_EXT_MODE ".uno:SetExtSelection"
+#define CMD_FN_SET_ADD_MODE ".uno:SetMultiSelection"
+#define CMD_FN_TABLE_ADJUST_CELLS ".uno:SetOptimalColumnWidth"
+#define CMD_FN_TABLE_OPTIMAL_HEIGHT ".uno:SetOptimalRowHeight"
+#define CMD_FN_TABLE_SET_ROW_HEIGHT ".uno:SetRowHeight"
+#define CMD_FN_SHADOWCURSOR ".uno:ShadowCursor"
+#define CMD_FN_SHIFT_BACKSPACE ".uno:ShiftBackspace"
+#define CMD_FN_SHOW_MULTIPLE_PAGES ".uno:ShowMultiplePages"
+#define CMD_FN_VIEW_NOTES ".uno:ShowAnnotations"
+#define CMD_FN_VIEW_HIDDEN_PARA ".uno:ShowHiddenParagraphs"
+#define CMD_FN_REDLINE_SHOW ".uno:ShowTrackedChanges"
+#define CMD_FN_SHOW_TWO_PAGES ".uno:ShowTwoPages"
+#define CMD_FN_SHOW_BOOKVIEW ".uno:ShowBookview"
+#define CMD_FN_SHRINK_FONT_SIZE ".uno:Shrink"
+#define CMD_FN_SORTING_DLG ".uno:SortDialog"
+#define CMD_FN_TABLE_SPLIT_CELLS ".uno:SplitCell"
+#define CMD_FN_TABLE_SPLIT_TABLE ".uno:SplitTable"
+#define CMD_FN_AUTO_CORRECT ".uno:StartAutoCorrect"
+#define CMD_FN_START_OF_DOCUMENT_SEL ".uno:StartOfDocumentSel"
+#define CMD_FN_START_OF_LINE_SEL ".uno:StartOfLineSel"
+#define CMD_FN_START_OF_PARA_SEL ".uno:StartOfParaSel"
+#define CMD_FN_STAT_BOOKMARK ".uno:StateBookmark"
+#define CMD_FN_STAT_PAGE ".uno:StatePageNumber"
+#define CMD_FN_STAT_ZOOM ".uno:StateZoom"
+#define CMD_FN_SET_SUB_SCRIPT ".uno:SubScript"
+#define CMD_FN_SET_SUPER_SCRIPT ".uno:SuperScript"
+#define CMD_FN_SBA_BRW_INSERT ".uno:SwBrwInsert"
+#define CMD_FN_SBA_BRW_MERGE ".uno:SwMailMerge"
+#define CMD_FN_SBA_BRW_UPDATE ".uno:SwUpdate"
+#define CMD_FN_SYNC_LABELS ".uno:SynchronizeLabelsDlg"
+#define CMD_FN_VIEW_TABLEGRID ".uno:TableBoundaries"
+#define CMD_FN_FORMAT_TABLE_DLG ".uno:TableDialog"
+#define CMD_FN_TABLE_MODE_FIX ".uno:TableModeFix"
+#define CMD_FN_TABLE_MODE_FIX_PROP ".uno:TableModeFixProp"
+#define CMD_FN_TABLE_MODE_VARIABLE ".uno:TableModeVariable"
+#define CMD_FN_NUM_FORMAT_TABLE_DLG ".uno:TableNumberFormatDialog"
+#define CMD_FN_SET_MODOPT_TBLNUMFMT ".uno:TableNumberRecognition"
+#define CMD_FN_DRAWTEXT_ATTR_DLG ".uno:TextAttributes"
+#define CMD_FN_DRAW_WRAP_DLG ".uno:TextWrap"
+#define CMD_FN_THESAURUS_DLG ".uno:ThesaurusDialog"
+#define CMD_FN_TOOL_ANKER ".uno:ToggleAnchorType"
+#define CMD_FN_TOOL_HIERARCHIE ".uno:ToggleObjectLayer"
+#define CMD_FN_UNDERLINE_DOUBLE ".uno:UnderlineDouble"
+#define CMD_FN_FRAME_UNCHAIN ".uno:UnhainFrames"
+#define CMD_FN_TABLE_UNSET_READ_ONLY_CELLS ".uno:UnsetCellsReadOnly"
+#define CMD_FN_UPDATE_ALL ".uno:UpdateAll"
+#define CMD_FN_UPDATE_TOX ".uno:UpdateAllIndexes"
+#define CMD_FN_UPDATE_ALL_LINKS ".uno:UpdateAllLinks"
+#define CMD_FN_UPDATE_CHARTS ".uno:UpdateCharts"
+#define CMD_FN_UPDATE_CUR_TOX ".uno:UpdateCurIndex"
+#define CMD_FN_UPDATE_FIELDS ".uno:UpdateFields"
+#define CMD_FN_UPDATE_INPUTFIELDS ".uno:UpdateInputFields"
+#define CMD_FN_VIEW_BOUNDS ".uno:ViewBounds"
+#define CMD_FN_VLINEAL ".uno:VRuler"
+#define CMD_FN_VSCROLLBAR ".uno:VScroll"
+#define CMD_FN_PREV_WORD_SEL ".uno:WordLeftSel"
+#define CMD_FN_NEXT_WORD_SEL ".uno:WordRightSel"
+#define CMD_FN_WRAP_ANCHOR_ONLY ".uno:WrapAnchorOnly"
+#define CMD_FN_FRAME_WRAP_CONTOUR ".uno:WrapContour"
+#define CMD_FN_FRAME_WRAP_IDEAL ".uno:WrapIdeal"
+#define CMD_FN_FRAME_WRAP_LEFT ".uno:WrapLeft"
+#define CMD_FN_FRAME_NOWRAP ".uno:WrapOff"
+#define CMD_FN_FRAME_WRAP ".uno:WrapOn"
+#define CMD_FN_FRAME_WRAP_RIGHT ".uno:WrapRight"
+#define CMD_FN_FRAME_WRAPTHRU ".uno:WrapThrough"
+#define CMD_FN_FRAME_WRAPTHRU_TRANSP ".uno:WrapThroughTransparent"
+#define CMD_FN_INSERT_STRING ".uno:InsertText"
+#define CMD_SID_ATTR_PARA_NUMRULE ".uno:NumRule"
+#define CMD_SID_ATTR_PARA_OUTLINE_LEVEL ".uno:OutlineLevel"
+#define CMD_FN_NUMBER_NEWSTART_AT ".uno:NumNewStartAt"
+#define CMD_FN_FORMAT_LINENUMBER ".uno:LineNumber"
+#define CMD_SID_ATTR_PARA_PAGENUM ".uno:PageNumber"
+#define CMD_SID_ATTR_PARA_REGISTER ".uno:RegisterTrue"
+#define CMD_FN_TO_FOOTNOTE_AREA ".uno:JumpToFootnoteArea"
+#define CMD_FN_TXTATR_INET ".uno:HyperlinkAttributes"
+#define CMD_FN_INSERT_GLOSSARY ".uno:InsertGlossary"
+#define CMD_FN_NEW_GLOSSARY ".uno:NewGlossary"
+#define CMD_FN_SET_ACT_GLOSSARY ".uno:SetActGlossaryGroup"
+#define CMD_FN_DELETE_BOOKMARK ".uno:DeleteBookmark"
+#define CMD_FN_DROP_TEXT ".uno:SetDropCapText"
+#define CMD_FN_DROP_CHAR_STYLE_NAME ".uno:SetDropCapCharStyleName"
+#define CMD_FN_READONLY_SELECTION_MODE ".uno:SelectTextMode"
+#define CMD_FN_INSERT_DBFIELD ".uno:InsertDBField"
+#define CMD_FN_GOTO_NEXT_CELL ".uno:JumpToNextCell"
+#define CMD_FN_GOTO_PREV_CELL ".uno:JumpToPrevCell"
+#define CMD_FN_INSERT_FIELD_DATA_ONLY ".uno:InsertFieldDataOnly"
+#define CMD_SID_ATTR_BRUSH_ROW ".uno:TableRowBackground"
+#define CMD_SID_ATTR_BRUSH_TABLE ".uno:TableBackground"
+#define CMD_FN_TABLE_ROW_SPLIT ".uno:RowSplit"
+#define CMD_FN_MAILMERGE_CHILDWINDOW ".uno:MailmergeChildWindow"
+#define CMD_FN_WORDCOUNT_DIALOG ".uno:WordCountDialog"
+#define CMD_FN_MAILMERGE_SENDMAIL_CHILDWINDOW ".uno:SendMailChildWindow"
+#define CMD_FN_TABLE_DELETE_TABLE ".uno:DeleteTable"
+#define CMD_FN_TABLE_SELECT_CELL ".uno:EntireCell"
+#define CMD_FN_CONVERT_TABLE_TO_TEXT ".uno:ConvertTableToText"
+#define CMD_FN_CONVERT_TEXT_TO_TABLE ".uno:ConvertTextToTable"
+#define CMD_FN_TABLE_HEADLINE_REPEAT ".uno:HeadingRowsRepeat"
+#define CMD_FN_TABLE_SORT_DIALOG ".uno:TableSort"
+#define CMD_FN_XFORMS_DESIGN_MODE ".uno:SwitchXFormsDesignMode"
+#define CMD_FN_REMOVE_DIRECT_CHAR_FORMATS ".uno:RemoveDirectCharFormats"
+#define CMD_FN_NUM_CONTINUE ".uno:ContinueNumbering"
+#define CMD_FN_SELECTION_MODE_DEFAULT ".uno:SelectionModeDefault"
+#define CMD_FN_DELETE_NOTE ".uno:DeleteNote"
+#define CMD_FN_REPLY ".uno:ReplyNote"
+#define CMD_FN_DELETE_COMMENT ".uno:DeleteComment"
+#define CMD_FN_DELETE_NOTE_AUTHOR ".uno:DeleteAuthor"
+#define CMD_FN_DELETE_ALL_NOTES ".uno:DeleteAllNotes"
+#define CMD_FN_HIDE_NOTE ".uno:HideNote"
+#define CMD_FN_HIDE_NOTE_AUTHOR ".uno:HideAuthor"
+#define CMD_SID_ATTR_VIEWLAYOUT ".uno:ViewLayout"
+#define CMD_FN_HIDE_ALL_NOTES ".uno:HideAllNotes"
+#define CMD_FN_SELECTION_MODE_BLOCK ".uno:SelectionModeBlock"
+#define CMD_FN_SPELL_GRAMMAR_DIALOG ".uno:SpellingAndGrammarDialog"
+#define CMD_FN_REDLINE_ACCEPT_DIRECT ".uno:AcceptTracedChange"
+#define CMD_FN_REDLINE_REJECT_DIRECT ".uno:RejectTracedChange"
+#define CMD_FN_REMOVE_HYPERLINK ".uno:RemoveHyperlink"
+#define CMD_FN_COPY_HYPERLINK_LOCATION ".uno:CopyHyperlinkLocation"
+
+#endif
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
new file mode 100644
index 000000000000..925e6522a120
--- /dev/null
+++ b/sw/inc/swcrsr.hxx
@@ -0,0 +1,308 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWCRSR_HXX
+#define _SWCRSR_HXX
+
+#include <com/sun/star/i18n/WordType.hpp>
+
+#include <pam.hxx>
+#include <tblsel.hxx>
+#include <cshtyp.hxx>
+
+
+struct _SwCursor_SavePos;
+
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
+
+
+// ein Basis-Struktur fuer die Parameter der Find-Methoden
+// return - Werte vom Found-Aufruf.
+const int FIND_NOT_FOUND = 0;
+const int FIND_FOUND = 1;
+const int FIND_NO_RING = 2;
+
+struct SwFindParas
+{
+ virtual int Find( SwPaM*, SwMoveFn, const SwPaM*, sal_Bool ) = 0;
+ virtual int IsReplaceMode() const = 0;
+};
+
+typedef sal_uInt16 SwCursorSelOverFlags;
+namespace nsSwCursorSelOverFlags
+{
+ const SwCursorSelOverFlags SELOVER_NONE = 0x00;
+ const SwCursorSelOverFlags SELOVER_CHECKNODESSECTION = 0x01;
+ const SwCursorSelOverFlags SELOVER_TOGGLE = 0x02;
+ const SwCursorSelOverFlags SELOVER_ENABLEREVDIREKTION = 0x04;
+ const SwCursorSelOverFlags SELOVER_CHANGEPOS = 0x08;
+}
+
+class SwCursor : public SwPaM
+{
+ friend class SwCrsrSaveState;
+
+ _SwCursor_SavePos* pSavePos;
+ long mnRowSpanOffset; // required for travelling in tabs with rowspans
+ sal_uInt8 nCursorBidiLevel; // bidi level of the cursor
+ bool mbColumnSelection; // true: cursor is aprt of a column selection
+
+ sal_uLong FindAll( SwFindParas& , SwDocPositions, SwDocPositions, FindRanges, sal_Bool& bCancel );
+
+ using SwPaM::Find;
+
+protected:
+ virtual _SwCursor_SavePos* CreateNewSavePos() const;
+ void SaveState();
+ void RestoreState();
+
+ const _SwCursor_SavePos* GetSavePos() const { return pSavePos; }
+
+ virtual const SwCntntFrm* DoSetBidiLevelLeftRight(
+ sal_Bool & io_rbLeft, sal_Bool bVisualAllowed, sal_Bool bInsertCrsr);
+ virtual void DoSetBidiLevelUpDown();
+ virtual bool IsSelOvrCheck(int eFlags);
+
+public:
+ // single argument ctors shall be explicit.
+ SwCursor( const SwPosition &rPos, SwPaM* pRing, bool bColumnSel );
+ virtual ~SwCursor();
+
+ // @@@ semantic: no copy ctor.
+ SwCursor( SwCursor& rCpy);
+
+public:
+
+ virtual SwCursor* Create( SwPaM* pRing = 0 ) const;
+
+ virtual short MaxReplaceArived(); //returns RET_YES/RET_CANCEL/RET_NO
+ virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
+
+ void FillFindPos( SwDocPositions ePos, SwPosition& rPos ) const;
+ SwMoveFnCollection* MakeFindRange( SwDocPositions, SwDocPositions,
+ SwPaM* ) const;
+
+
+ sal_uLong Find( const com::sun::star::util::SearchOptions& rSearchOpt,
+ sal_Bool bSearchInNotes,
+ SwDocPositions nStart, SwDocPositions nEnde,
+ sal_Bool& bCancel,
+ FindRanges = FND_IN_BODY,
+ int bReplace = sal_False );
+ sal_uLong Find( const SwTxtFmtColl& rFmtColl,
+ SwDocPositions nStart, SwDocPositions nEnde,
+ sal_Bool& bCancel,
+ FindRanges = FND_IN_BODY,
+ const SwTxtFmtColl* pReplFmt = 0 );
+ sal_uLong Find( const SfxItemSet& rSet, sal_Bool bNoCollections,
+ SwDocPositions nStart, SwDocPositions nEnde,
+ sal_Bool& bCancel,
+ FindRanges = FND_IN_BODY,
+ const com::sun::star::util::SearchOptions* pSearchOpt = 0,
+ const SfxItemSet* rReplSet = 0 );
+
+ // UI versions
+ sal_Bool IsStartWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const;
+ sal_Bool IsEndWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const;
+ sal_Bool IsInWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const;
+ sal_Bool IsStartEndSentence( bool bEnd ) const;
+ sal_Bool GoStartWord();
+ sal_Bool GoEndWord();
+ sal_Bool GoNextWord();
+ sal_Bool GoPrevWord();
+ sal_Bool SelectWord( ViewShell* pViewShell, const Point* pPt = 0 );
+
+ // API versions of above functions (will be used with a different
+ // WordType for the break iterator)
+ sal_Bool IsStartWordWT( sal_Int16 nWordType ) const;
+ sal_Bool IsEndWordWT( sal_Int16 nWordType ) const;
+ sal_Bool IsInWordWT( sal_Int16 nWordType ) const;
+ sal_Bool GoStartWordWT( sal_Int16 nWordType );
+ sal_Bool GoEndWordWT( sal_Int16 nWordType );
+ sal_Bool GoNextWordWT( sal_Int16 nWordType );
+ sal_Bool GoPrevWordWT( sal_Int16 nWordType );
+ sal_Bool SelectWordWT( ViewShell* pViewShell, sal_Int16 nWordType, const Point* pPt = 0 );
+
+ enum SentenceMoveType
+ {
+ NEXT_SENT,
+ PREV_SENT,
+ START_SENT,
+ END_SENT
+ };
+ sal_Bool GoSentence(SentenceMoveType eMoveType);
+ sal_Bool GoNextSentence(){return GoSentence(NEXT_SENT);}
+ sal_Bool GoEndSentence(){return GoSentence(END_SENT);}
+ sal_Bool GoPrevSentence(){return GoSentence(PREV_SENT);}
+ sal_Bool GoStartSentence(){return GoSentence(START_SENT);}
+ sal_Bool ExpandToSentenceBorders();
+
+ virtual sal_Bool LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode,
+ sal_Bool bAllowVisual, sal_Bool bSkipHidden, sal_Bool bInsertCrsr );
+ sal_Bool UpDown( sal_Bool bUp, sal_uInt16 nCnt, Point* pPt, long nUpDownX );
+ sal_Bool LeftRightMargin( sal_Bool bLeftMargin, sal_Bool bAPI = sal_False );
+ sal_Bool IsAtLeftRightMargin( sal_Bool bLeftMargin, sal_Bool bAPI = sal_False ) const;
+ sal_Bool SttEndDoc( sal_Bool bSttDoc );
+ sal_Bool GoPrevNextCell( sal_Bool bNext, sal_uInt16 nCnt );
+
+ sal_Bool Left( sal_uInt16 nCnt, sal_uInt16 nMode, sal_Bool bAllowVisual, sal_Bool bSkipHidden )
+ { return LeftRight( sal_True, nCnt, nMode, bAllowVisual, bSkipHidden, sal_False ); }
+ sal_Bool Right( sal_uInt16 nCnt, sal_uInt16 nMode, sal_Bool bAllowVisual, sal_Bool bSkipHidden )
+ { return LeftRight( sal_False, nCnt, nMode, bAllowVisual, bSkipHidden, sal_False ); }
+ sal_Bool GoNextCell( sal_uInt16 nCnt = 1 ) { return GoPrevNextCell( sal_True, nCnt ); }
+ sal_Bool GoPrevCell( sal_uInt16 nCnt = 1 ) { return GoPrevNextCell( sal_False, nCnt ); }
+ virtual sal_Bool GotoTable( const String& rName );
+ sal_Bool GotoTblBox( const String& rName );
+ sal_Bool GotoRegion( const String& rName );
+ sal_Bool GotoFtnAnchor();
+ sal_Bool GotoFtnTxt();
+ sal_Bool GotoNextFtnAnchor();
+ sal_Bool GotoPrevFtnAnchor();
+ sal_Bool GotoNextFtnCntnt();
+ sal_Bool GotoPrevFtnCntnt();
+
+ sal_Bool MovePara( SwWhichPara, SwPosPara );
+ sal_Bool MoveSection( SwWhichSection, SwPosSection );
+ sal_Bool MoveTable( SwWhichTable, SwPosTable );
+ sal_Bool MoveRegion( SwWhichRegion, SwPosRegion );
+
+
+ // gibt es eine Selection vom Content in die Tabelle
+ // Return Wert gibt an, ob der Crsr auf der alten Position verbleibt
+ virtual sal_Bool IsSelOvr( int eFlags =
+ ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ));
+ virtual sal_Bool IsInProtectTable( sal_Bool bMove = sal_False,
+ sal_Bool bChgCrsr = sal_True );
+ sal_Bool IsNoCntnt() const;
+
+ void RestoreSavePos(); // Point auf die SavePos setzen
+
+ // sal_True: an die Position kann der Cursor gesetzt werden
+ virtual sal_Bool IsAtValidPos( sal_Bool bPoint = sal_True ) const;
+
+ // darf der Cursor in ReadOnlyBereiche?
+ virtual bool IsReadOnlyAvailable() const;
+
+ virtual sal_Bool IsSkipOverProtectSections() const;
+ virtual sal_Bool IsSkipOverHiddenSections() const;
+
+ sal_uInt8 GetCrsrBidiLevel() const { return nCursorBidiLevel; }
+ void SetCrsrBidiLevel( sal_uInt8 nNewLevel ) { nCursorBidiLevel = nNewLevel; }
+
+ bool IsColumnSelection() const { return mbColumnSelection; }
+ void SetColumnSelection( bool bNew ) { mbColumnSelection = bNew; }
+
+ long GetCrsrRowSpanOffset() const { return mnRowSpanOffset; }
+ void SetCrsrRowSpanOffset( long nNew ) { mnRowSpanOffset = nNew; }
+
+ DECL_FIXEDMEMPOOL_NEWDEL( SwCursor )
+};
+
+
+class SwCrsrSaveState
+{
+ SwCursor& rCrsr;
+public:
+ SwCrsrSaveState( SwCursor& rC ) : rCrsr( rC ) { rC.SaveState(); }
+ ~SwCrsrSaveState() { rCrsr.RestoreState(); }
+};
+
+struct _SwCursor_SavePos
+{
+ sal_uLong nNode;
+ xub_StrLen nCntnt;
+ _SwCursor_SavePos* pNext;
+
+ _SwCursor_SavePos( const SwCursor& rCrsr )
+ : nNode( rCrsr.GetPoint()->nNode.GetIndex() ),
+ nCntnt( rCrsr.GetPoint()->nContent.GetIndex() ),
+ pNext( 0 )
+ {}
+ virtual ~_SwCursor_SavePos() {}
+
+ DECL_FIXEDMEMPOOL_NEWDEL( _SwCursor_SavePos )
+};
+
+
+
+class SwTableCursor : public virtual SwCursor
+{
+
+protected:
+ sal_uLong nTblPtNd, nTblMkNd;
+ xub_StrLen nTblPtCnt, nTblMkCnt;
+ SwSelBoxes aSelBoxes;
+ sal_Bool bChg : 1;
+ sal_Bool bParked : 1; // Tabellen-Cursor wurde geparkt
+
+ virtual bool IsSelOvrCheck(int eFlags);
+
+public:
+ SwTableCursor( const SwPosition &rPos, SwPaM* pRing = 0 );
+ SwTableCursor( SwTableCursor& );
+ virtual ~SwTableCursor();
+
+ virtual sal_Bool LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode,
+ sal_Bool bAllowVisual, sal_Bool bSkipHidden, sal_Bool bInsertCrsr );
+ virtual sal_Bool GotoTable( const String& rName );
+
+ void InsertBox( const SwTableBox& rTblBox );
+ void DeleteBox( sal_uInt16 nPos ) { aSelBoxes.Remove( nPos ); bChg = sal_True; }
+ sal_uInt16 GetBoxesCount() const { return aSelBoxes.Count(); }
+ const SwSelBoxes& GetBoxes() const { return aSelBoxes; }
+
+ // Baut fuer alle Boxen die Cursor auf
+ SwCursor* MakeBoxSels( SwCursor* pAktCrsr );
+ // sind irgendwelche Boxen mit einem Schutz versehen?
+ sal_Bool HasReadOnlyBoxSel() const;
+
+ // wurde der TabelleCursor veraendert ? Wenn ja speicher gleich
+ // die neuen Werte.
+ sal_Bool IsCrsrMovedUpdt();
+ // wurde der TabelleCursor veraendert ?
+ sal_Bool IsCrsrMoved() const
+ {
+ return nTblMkNd != GetMark()->nNode.GetIndex() ||
+ nTblPtNd != GetPoint()->nNode.GetIndex() ||
+ nTblMkCnt != GetMark()->nContent.GetIndex() ||
+ nTblPtCnt != GetPoint()->nContent.GetIndex();
+ }
+
+ sal_Bool IsChgd() const { return bChg; }
+
+ // Parke den Tabellen-Cursor auf dem StartNode der Boxen.
+ void ParkCrsr();
+
+ bool NewTableSelection();
+ void ActualizeSelection( const SwSelBoxes &rBoxes );
+};
+
+#endif
+
diff --git a/sw/inc/swdbdata.hxx b/sw/inc/swdbdata.hxx
new file mode 100644
index 000000000000..a19cd67e8783
--- /dev/null
+++ b/sw/inc/swdbdata.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWDBDATA_HXX
+#define _SWDBDATA_HXX
+
+#include <tools/solar.h>
+#include <rtl/ustring.hxx>
+
+// contains the description of a data source
+struct SwDBData
+{
+ ::rtl::OUString sDataSource;
+ ::rtl::OUString sCommand; //table, query or statement
+ sal_Int32 nCommandType; //com::sun::star::sdb::CommandType
+ SwDBData() :
+ nCommandType(0){}
+
+ sal_Bool operator !=(const SwDBData& rCmp) const
+ {return rCmp.sDataSource != sDataSource || rCmp.sCommand != sCommand || rCmp.nCommandType != nCommandType;}
+ sal_Bool operator ==(const SwDBData& rCmp) const
+ {return rCmp.sDataSource == sDataSource && rCmp.sCommand == sCommand && rCmp.nCommandType == nCommandType;}
+};
+
+#endif
+
diff --git a/sw/inc/swdbtoolsclient.hxx b/sw/inc/swdbtoolsclient.hxx
new file mode 100644
index 000000000000..067e58cbcf52
--- /dev/null
+++ b/sw/inc/swdbtoolsclient.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWDBTOOLSCLIENT_HXX
+#define _SWDBTOOLSCLIENT_HXX
+
+#include <connectivity/virtualdbtools.hxx>
+#include <osl/mutex.hxx>
+#include <osl/module.h>
+#include "swdllapi.h"
+
+/* -----------------------------30.08.2001 11:01------------------------------
+ Client to use the dbtools library as load-on-call
+ ---------------------------------------------------------------------------*/
+class SW_DLLPUBLIC SwDbtoolsClient
+{
+private:
+ ::rtl::Reference< ::connectivity::simple::IDataAccessTools > m_xDataAccessTools;
+ ::rtl::Reference< ::connectivity::simple::IDataAccessTypeConversion > m_xAccessTypeConversion;
+ ::rtl::Reference< ::connectivity::simple::IDataAccessToolsFactory > m_xDataAccessFactory;
+
+ SW_DLLPRIVATE static void registerClient();
+ SW_DLLPRIVATE static void revokeClient();
+ SW_DLLPRIVATE void getFactory();
+
+ SW_DLLPRIVATE ::rtl::Reference< ::connectivity::simple::IDataAccessTools > getDataAccessTools();
+ SW_DLLPRIVATE ::rtl::Reference< ::connectivity::simple::IDataAccessTypeConversion > getAccessTypeConversion();
+
+public:
+ SwDbtoolsClient();
+ ~SwDbtoolsClient();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
+ const ::rtl::OUString& _rsRegisteredName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
+ );
+
+ sal_Int32 getDefaultNumberFormat(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _rxTypes,
+ const ::com::sun::star::lang::Locale& _rLocale
+ );
+
+ ::rtl::OUString getFormattedValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& _rxFormatter,
+ const ::com::sun::star::lang::Locale& _rLocale,
+ const ::com::sun::star::util::Date& _rNullDate
+ );
+};
+
+#endif
+
diff --git a/sw/inc/swddetbl.hxx b/sw/inc/swddetbl.hxx
new file mode 100644
index 000000000000..a06f8b08e073
--- /dev/null
+++ b/sw/inc/swddetbl.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWDDETBL_HXX
+#define _SWDDETBL_HXX
+
+#include "swtable.hxx"
+
+class SwDDEFieldType;
+
+class SwDDETable : public SwTable
+{
+ SwDepend aDepend;
+public:
+ TYPEINFO();
+ // Constructor movet alle Lines/Boxen aus der SwTable zu sich.
+ // Die SwTable ist danach Leer und muss geloescht werden.
+ SwDDETable( SwTable& rTable, SwDDEFieldType* pDDEType,
+ sal_Bool bUpdate = sal_True );
+ ~SwDDETable();
+
+ void ChangeContent();
+ sal_Bool NoDDETable();
+
+ SwDDEFieldType* GetDDEFldType();
+ inline const SwDDEFieldType* GetDDEFldType() const;
+protected:
+ virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
+ virtual void SwClientNotify( const SwModify&, const SfxHint& );
+};
+
+
+// ----------- Inlines -----------------------------
+
+inline const SwDDEFieldType* SwDDETable::GetDDEFldType() const
+{
+ return ((SwDDETable*)this)->GetDDEFldType();
+}
+
+#endif
diff --git a/sw/inc/swdll.hxx b/sw/inc/swdll.hxx
new file mode 100644
index 000000000000..dd033fdea760
--- /dev/null
+++ b/sw/inc/swdll.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_SWDLL_HXX
+#define SW_SWDLL_HXX
+
+class StatusBar;
+
+#include <sfx2/sfxdefs.hxx>
+#include <sfx2/module.hxx>
+
+#include <tools/shl.hxx>
+
+//-------------------------------------------------------------------------
+
+class SwDLL
+
+/* [Description]
+
+ This class is a wrapper for a Load-On-Demand-DLL. One instance
+ per SfxApplication will be created for the runtime of
+ SfxApplication-subclass::Main().
+
+ Remember: Do export this class! It is used by the application.
+*/
+
+{
+
+ static void RegisterFactories();
+ static void RegisterInterfaces();
+ static void RegisterControls();
+public:
+ // Ctor/Dtor must be linked to the application
+ SwDLL();
+ ~SwDLL();
+
+ static void Init(); // called directly after loading the DLL
+ static void Exit(); // called directly befor unloading the DLL
+};
+
+//-------------------------------------------------------------------------
+
+#define SW_DLL() ( *(SwModule**) GetAppData(SHL_WRITER) )
+
+#endif
+
diff --git a/sw/inc/swdllapi.h b/sw/inc/swdllapi.h
new file mode 100644
index 000000000000..f4c9e30020e6
--- /dev/null
+++ b/sw/inc/swdllapi.h
@@ -0,0 +1,13 @@
+#ifndef INCLUDED_SWDLLAPI_H
+#define INCLUDED_SWDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(SW_DLLIMPLEMENTATION)
+#define SW_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SW_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SW_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_SWDLLAPI_H */
diff --git a/sw/inc/swerror.h b/sw/inc/swerror.h
new file mode 100644
index 000000000000..74755e45b74b
--- /dev/null
+++ b/sw/inc/swerror.h
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWSWERROR_H
+#define _SWSWERROR_H
+
+#include <tools/errcode.hxx>
+
+#define ERROR_SW_BASE (ERRCODE_AREA_SW)
+#define ERROR_SW_READ_BASE (ERROR_SW_BASE | ERRCODE_CLASS_READ)
+#define ERROR_SW_WRITE_BASE (ERROR_SW_BASE | ERRCODE_CLASS_WRITE)
+
+#define WARN_SW_BASE (ERRCODE_AREA_SW | ERRCODE_WARNING_MASK)
+#define WARN_SW_READ_BASE (WARN_SW_BASE | ERRCODE_CLASS_READ )
+#define WARN_SW_WRITE_BASE (WARN_SW_BASE | ERRCODE_CLASS_WRITE )
+
+
+// Import Fehler
+#define ERR_SWG_FILE_FORMAT_ERROR (ERROR_SW_READ_BASE | 1 )
+#define ERR_SWG_READ_ERROR (ERROR_SW_READ_BASE | 2 )
+
+#define ERR_SW6_INPUT_FILE (ERROR_SW_READ_BASE | 4 )
+#define ERR_SW6_NOWRITER_FILE (ERROR_SW_READ_BASE | 5 )
+#define ERR_SW6_UNEXPECTED_EOF (ERROR_SW_READ_BASE | 6 )
+#define ERR_SW6_PASSWD (ERROR_SW_READ_BASE | 7 )
+
+#define ERR_WW6_NO_WW6_FILE_ERR (ERROR_SW_READ_BASE | 8 )
+#define ERR_WW6_FASTSAVE_ERR (ERROR_SW_READ_BASE | 9 )
+
+#define ERR_FORMAT_ROWCOL (ERROR_SW_READ_BASE | 12)
+
+#define ERR_SWG_NEW_VERSION (ERROR_SW_READ_BASE | 13)
+#define ERR_WW8_NO_WW8_FILE_ERR (ERROR_SW_READ_BASE | 14)
+
+#define ERR_FORMAT_FILE_ROWCOL (ERROR_SW_READ_BASE | 15)
+
+// Export Fehler
+#define ERR_SWG_WRITE_ERROR (ERROR_SW_WRITE_BASE | 30 )
+#define ERR_SWG_OLD_GLOSSARY (ERROR_SW_WRITE_BASE | 31 )
+#define ERR_WRITE_ERROR_FILE (ERROR_SW_WRITE_BASE | 35 )
+
+// Import/Export Fehler
+#define ERR_SWG_INTERNAL_ERROR (ERROR_SW_BASE | 50 )
+
+#define ERR_TXTBLOCK_NEWFILE_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_LOCKING | 55 )
+
+// weitere Fehler und Fehlerklassen
+#define ERR_AUTOPATH_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_PATH | 55 )
+#define ERR_TBLSPLIT_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_NONE| 56 )
+#define ERR_TBLINSCOL_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_NONE| 57 )
+#define ERR_TBLDDECHG_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_NONE| 58 )
+
+// ----- Warnings ---------------------------
+
+// Import - Warnings
+#define WARN_SWG_NO_DRAWINGS (WARN_SW_READ_BASE | 70 )
+#define WARN_WW6_FASTSAVE_ERR (WARN_SW_READ_BASE | 71 )
+// continued below
+
+// Import & Export - Warnings
+#define WARN_SWG_FEATURES_LOST (WARN_SW_BASE | 72 )
+#define WARN_SWG_OLE (WARN_SW_BASE | 73 )
+#define WARN_SWG_POOR_LOAD (WARN_SW_BASE | 74 )
+
+// Export warnings
+#define WARN_SWG_HTML_NO_MACROS (WARN_SW_WRITE_BASE |75)
+#define WARN_WRITE_ERROR_FILE (WARN_SW_WRITE_BASE |76)
+
+// More Import & Export - Warnings
+#define WARN_FORMAT_FILE_ROWCOL (WARN_SW_READ_BASE | 77)
+
+#ifndef __RSC
+
+inline FASTBOOL IsWarning( sal_uLong nErr )
+{
+ return 0 != ( nErr & ERRCODE_WARNING_MASK & nErr );
+}
+
+inline FASTBOOL IsError( sal_uLong nErr )
+{
+ return nErr && 0 == ( ERRCODE_WARNING_MASK & nErr );
+}
+
+#endif
+
+
+#endif
+
diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx
new file mode 100644
index 000000000000..4194042d2327
--- /dev/null
+++ b/sw/inc/swevent.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWEVENT_HXX
+#define _SWEVENT_HXX
+
+// #include *****************************************************************
+
+#include <tools/solar.h>
+#include <sfx2/sfx.hrc>
+
+#define SW_EVENT_OBJECT_SELECT ( EVENT_APP_START + 0 )
+#define SW_EVENT_START_INS_GLOSSARY ( EVENT_APP_START + 1 )
+#define SW_EVENT_END_INS_GLOSSARY ( EVENT_APP_START + 2 )
+#define SW_EVENT_MAIL_MERGE ( EVENT_APP_START + 3 )
+#define SW_EVENT_FRM_KEYINPUT_ALPHA ( EVENT_APP_START + 4 )
+#define SW_EVENT_FRM_KEYINPUT_NOALPHA ( EVENT_APP_START + 5 )
+#define SW_EVENT_FRM_RESIZE ( EVENT_APP_START + 6 )
+#define SW_EVENT_FRM_MOVE ( EVENT_APP_START + 7 )
+#define SW_EVENT_PAGE_COUNT ( EVENT_APP_START + 8 )
+#define SW_EVENT_MAIL_MERGE_END ( EVENT_APP_START + 9 )
+#define SW_EVENT_FIELD_MERGE ( EVENT_APP_START + 10 )
+#define SW_EVENT_FIELD_MERGE_FINISHED ( EVENT_APP_START + 11 )
+#define SW_EVENT_LAYOUT_FINISHED ( EVENT_APP_START + 12 )
+
+#define STR_SW_EVENT_PAGE_COUNT 0
+#define STR_SW_EVENT_MAIL_MERGE 1
+#define STR_SW_EVENT_MAIL_MERGE_END 2
+#define STR_SW_EVENT_FIELD_MERGE 3
+#define STR_SW_EVENT_FIELD_MERGE_FINISHED 4
+#define STR_SW_EVENT_LAYOUT_FINISHED 5
+#define STR_SW_EVENT_OBJECT_SELECT 6
+#define STR_SW_EVENT_START_INS_GLOSSARY 7
+#define STR_SW_EVENT_END_INS_GLOSSARY 8
+#define STR_SW_EVENT_FRM_KEYINPUT_ALPHA 9
+#define STR_SW_EVENT_FRM_KEYINPUT_NOALPHA 10
+#define STR_SW_EVENT_FRM_RESIZE 11
+#define STR_SW_EVENT_FRM_MOVE 12
+
+class SwFrmFmt;
+class SwFmtINetFmt;
+class IMapObject;
+
+// enum fuer Objecte die Events ins Basic oder in JavaScript Callen
+enum SwCallEventObjectType
+{
+ EVENT_OBJECT_NONE = 0, // Null ist garnichts
+ EVENT_OBJECT_IMAGE,
+ EVENT_OBJECT_INETATTR,
+ EVENT_OBJECT_URLITEM,
+ EVENT_OBJECT_IMAGEMAP
+};
+
+// structur fuer den Austausch zwischen UI/CORE
+
+struct SwCallMouseEvent
+{
+ SwCallEventObjectType eType;
+ union
+ {
+ // EVENT_OBJECT_IMAGE/EVENT_OBJECT_URLITEM
+ const SwFrmFmt* pFmt;
+
+ // EVENT_OBJECT_INETATTR
+ const SwFmtINetFmt* pINetAttr;
+
+ // EVENT_OBJECT_IMAGEMAP
+ struct
+ {
+ const SwFrmFmt* pFmt;
+ const IMapObject* pIMapObj;
+ } IMAP;
+ } PTR;
+
+ SwCallMouseEvent()
+ : eType( EVENT_OBJECT_NONE )
+ { PTR.pFmt = 0; PTR.IMAP.pIMapObj = 0; }
+
+ void Set( SwCallEventObjectType eTyp, const SwFrmFmt* pFmt )
+ { eType = eTyp; PTR.pFmt = pFmt; PTR.IMAP.pIMapObj = 0; }
+
+ void Set( const SwFrmFmt* pFmt, const IMapObject* pIMapObj )
+ { eType = EVENT_OBJECT_IMAGEMAP; PTR.pFmt = pFmt; PTR.IMAP.pIMapObj = pIMapObj; }
+
+ void Set( const SwFmtINetFmt* pINetAttr )
+ { eType = EVENT_OBJECT_INETATTR; PTR.pINetAttr = pINetAttr; PTR.IMAP.pIMapObj = 0; }
+
+ int operator==( const SwCallMouseEvent& rEvent ) const
+ {
+ return eType == rEvent.eType &&
+ PTR.pFmt == rEvent.PTR.pFmt &&
+ PTR.IMAP.pIMapObj == rEvent.PTR.IMAP.pIMapObj;
+ }
+ int operator!=( const SwCallMouseEvent& rEvent ) const
+ { return !( *this == rEvent ); }
+
+ void Clear()
+ { eType = EVENT_OBJECT_NONE; PTR.pFmt = 0; PTR.IMAP.pIMapObj = 0; }
+
+ sal_Bool HasEvent() const { return EVENT_OBJECT_NONE != eType; }
+};
+
+
+#endif
+
diff --git a/sw/inc/swfltopt.hxx b/sw/inc/swfltopt.hxx
new file mode 100644
index 000000000000..50f645db8cfb
--- /dev/null
+++ b/sw/inc/swfltopt.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWFTLOPT_HXX
+#define _SWFTLOPT_HXX
+
+#include <unotools/configitem.hxx>
+
+class SW_DLLPUBLIC SwFilterOptions : public utl::ConfigItem
+{
+public:
+ SwFilterOptions( sal_uInt16 nCnt, const sal_Char** ppNames,
+ sal_uInt32* pValues );
+
+ void GetValues( sal_uInt16 nCnt, const sal_Char** ppNames,
+ sal_uInt32* pValues );
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+};
+
+#endif
diff --git a/sw/inc/swgstr.hxx b/sw/inc/swgstr.hxx
new file mode 100644
index 000000000000..8b65028166a3
--- /dev/null
+++ b/sw/inc/swgstr.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWGSTR_HXX
+#define _SWGSTR_HXX
+
+#include <tools/stream.hxx>
+
+typedef long long3; // Zur Dokumentation: 3-byte-Longs
+
+#define MAX_BEGIN 64 // Maximale Blockschachtelung
+#define PASSWDLEN 16 // Maximale Passwortlaenge
+
+// Neue Version mit SvStreams
+
+// Passwort- und Codierungs-Funktionalitaet
+
+class swcrypter {
+protected:
+ sal_Char cPasswd[ PASSWDLEN ]; // Passwort-Puffer
+ sal_Bool bPasswd; // sal_True wenn mit Passwort
+ void encode( sal_Char*, sal_uInt16 ); // Puffer codieren/decodieren
+public:
+ swcrypter();
+ sal_Bool setpasswd( const String& ); // Passwort setzen
+ void copypasswd( const sal_Char* ); // Passwort direkt setzen
+ const sal_Char* getpasswd() { return cPasswd; }
+};
+
+// Reader/Writer-Stream-Basisklasse mit Pufferverwaltung fuer Texte
+// und Spezial-I/O fuer 3-Byte-Longs
+
+class swstreambase : public swcrypter {
+protected:
+ SvStream* pStrm; // eigentlicher Stream
+ sal_Char* pBuf; // Zwischenpuffer
+ sal_uInt16 nBuflen; // Laenge des Zwischenpuffers
+ short nLong; // Long-Laenge (3 oder 4)
+ sal_Bool bTempStrm; // sal_True: Stream loeschen
+ void checkbuf( sal_uInt16 ); // Testen der Pufferlaenge
+
+ swstreambase( SvStream& );
+
+ swstreambase( const swstreambase& );
+ int operator=( const swstreambase& );
+public:
+ ~swstreambase();
+ SvStream& Strm() { return *pStrm; }
+ void clear(); // Puffer loeschen
+
+ // Zusatzfunktionen zur I/O von LONGs als 3-Byte-Zahlen
+
+ void long3() { nLong = 3; }
+ void long4() { nLong = 4; }
+
+ // Alias- und Hilfsfunktionen
+
+ void seek( long nPos ) { pStrm->Seek( nPos ); }
+ long tell() { return pStrm->Tell(); }
+ long filesize(); // Dateigroesse
+
+ void setbad();
+ int good() { return ( pStrm->GetError() == SVSTREAM_OK ); }
+ int operator!() { return ( pStrm->GetError() != SVSTREAM_OK ); }
+ int eof() { return pStrm->IsEof(); }
+
+ sal_uInt8 get();
+ void get( void* p, sal_uInt16 n ) { pStrm->Read( (sal_Char*) p, n ); }
+
+ inline swstreambase& operator>>( sal_Char& );
+ inline swstreambase& operator>>( sal_uInt8& );
+ inline swstreambase& operator>>( short& );
+ inline swstreambase& operator>>( sal_uInt16& );
+ swstreambase& operator>>( long& );
+ inline swstreambase& operator>>( sal_uLong& );
+};
+
+inline swstreambase& swstreambase::operator>>( sal_Char& c )
+{
+ *pStrm >> c; return *this;
+}
+
+inline swstreambase& swstreambase::operator>>( sal_uInt8& c )
+{
+ *pStrm >> c; return *this;
+}
+
+inline swstreambase& swstreambase::operator>>( short& c )
+{
+ *pStrm >> c; return *this;
+}
+
+inline swstreambase& swstreambase::operator>>( sal_uInt16& c )
+{
+ *pStrm >> c; return *this;
+}
+
+inline swstreambase& swstreambase::operator>>( sal_uLong& c )
+{
+ return *this >> (long&) c;
+}
+
+class swistream : public swstreambase {
+ sal_uInt8 cType; // Record-Typ
+ sal_uLong nOffset; // Record-Offset-Portion
+public:
+ swistream( SvStream& );
+
+ sal_uInt8 peek(); // 1 Byte testen
+ sal_uInt8 next(); // Blockstart
+ sal_uInt8 cur() { return cType; } // aktueller Block
+ sal_uInt8 skipnext(); // Record ueberspringen
+ void undonext(); // next() rueckgaengig machen
+ long getskip() { return nOffset; }
+ void skip( long = -1L ); // Block ueberspringen
+ sal_Char* text(); // Textstring lesen (nach BEGIN)
+ long size(); // aktuelle Record-Laenge
+
+private:
+ swistream( const swistream& );
+ int operator=( const swistream& );
+};
+
+
+#endif
diff --git a/sw/inc/swhints.hxx b/sw/inc/swhints.hxx
new file mode 100644
index 000000000000..c4a29135abcb
--- /dev/null
+++ b/sw/inc/swhints.hxx
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_HINTS_HXX
+#define SW_HINTS_HXX
+
+#include <svl/smplhint.hxx>
+
+#define SW_BROADCASTID_START SFX_HINT_USER00
+#define SW_BROADCAST_DRAWVIEWS_CREATED SW_BROADCASTID_START
+
+
+#endif
diff --git a/sw/inc/switerator.hxx b/sw/inc/switerator.hxx
new file mode 100755
index 000000000000..be729771b54b
--- /dev/null
+++ b/sw/inc/switerator.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWITERATOR_HXX
+#define _SWITERATOR_HXX
+
+#include <calbck.hxx>
+#include <tools/debug.hxx>
+
+template< class TElementType, class TSource > class SwIterator
+{
+ SwClientIter aClientIter;
+public:
+
+ SwIterator( const TSource& rSrc ) : aClientIter(rSrc) { DBG_ASSERT( TElementType::IsOf( TYPE(SwClient) ), "Incompatible types!" ); }
+ TElementType* First() { SwClient* p = aClientIter.First(TYPE(TElementType)); return PTR_CAST(TElementType,p); }
+ TElementType* Last() { SwClient* p = aClientIter.Last( TYPE(TElementType)); return PTR_CAST(TElementType,p); }
+ TElementType* Next() { SwClient* p = aClientIter.Next(); return PTR_CAST(TElementType,p); }
+ TElementType* Previous() { SwClient* p = aClientIter.Previous(); return PTR_CAST(TElementType,p); }
+ static TElementType* FirstElement( const TSource& rMod ) { SwClient* p = SwClientIter(rMod).First(TYPE(TElementType)); return PTR_CAST(TElementType,p); }
+ bool IsChanged() { return aClientIter.IsChanged(); }
+};
+
+#endif
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
new file mode 100644
index 000000000000..2682d2c9eaf1
--- /dev/null
+++ b/sw/inc/swmodule.hxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWMODULE_HXX
+#define _SWMODULE_HXX
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+#include <tools/fldunit.hxx>
+#include <svl/lstner.hxx>
+#include <unotools/options.hxx>
+#include <sfx2/module.hxx>
+
+#include <tools/shl.hxx>
+#include <svl/lstner.hxx>
+#include "swdllapi.h"
+#include "shellid.hxx"
+#include <fldupde.hxx>
+#include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp>
+#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
+
+class SvStringsDtor;
+class Color;
+class SfxItemSet;
+class SfxRequest;
+class SfxErrorHandler;
+class SwDBConfig;
+class SwModuleOptions;
+class SwMasterUsrPref;
+class SwViewOption;
+class SwView;
+class SwWrtShell;
+class SwPrintOptions;
+class SwChapterNumRules;
+class SwStdFontConfig;
+class SwNavigationConfig;
+class SwTransferable;
+class SwToolbarConfigItem;
+class SwAttrPool;
+namespace svtools{ class ColorConfig;}
+class SvtAccessibilityOptions;
+class SvtCTLOptions;
+class SvtUserOptions;
+class SvtUndoOptions;
+
+struct SwDBData;
+#define VIEWOPT_DEST_VIEW 0
+#define VIEWOPT_DEST_TEXT 1
+#define VIEWOPT_DEST_WEB 2
+#define VIEWOPT_DEST_VIEW_ONLY 3 //ViewOptions werden nur an der ::com::sun::star::sdbcx::View, nicht an der Appl. gesetzt
+
+namespace com{ namespace sun{ namespace star{ namespace scanner{
+ class XScannerManager;
+}}}}
+
+class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::ConfigurationListener
+{
+ String sActAuthor;
+
+ // ConfigItems
+ SwModuleOptions* pModuleConfig;
+ SwMasterUsrPref* pUsrPref;
+ SwMasterUsrPref* pWebUsrPref;
+ SwPrintOptions* pPrtOpt;
+ SwPrintOptions* pWebPrtOpt;
+ SwChapterNumRules* pChapterNumRules;
+ SwStdFontConfig* pStdFontConfig;
+ SwNavigationConfig* pNavigationConfig;
+ SwToolbarConfigItem*pToolbarConfig; //fuer gestackte Toolbars, welche
+ SwToolbarConfigItem*pWebToolbarConfig; //war sichtbar?
+ SwDBConfig* pDBConfig;
+ svtools::ColorConfig* pColorConfig;
+ SvtAccessibilityOptions* pAccessibilityOptions;
+ SvtCTLOptions* pCTLOptions;
+ SvtUserOptions* pUserOptions;
+ SvtUndoOptions* pUndoOptions;
+
+ SfxErrorHandler* pErrorHdl;
+
+ SwAttrPool *pAttrPool;
+
+ // Die aktuelle View wird hier gehalten um nicht ueber
+ // GetActiveView arbeiten zu muessen
+ // Die View ist solange gueltig bis Sie im Activate
+ // zerstoert oder ausgetauscht wird
+ SwView* pView;
+
+ // Liste aller Redline-Autoren
+ SvStringsDtor* pAuthorNames;
+
+ // DictionaryList listener to trigger spellchecking or hyphenation
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener > xLngSvcEvtListener;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::scanner::XScannerManager > m_xScannerManager;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser;
+
+ sal_Bool bAuthorInitialised : 1;
+ sal_Bool bEmbeddedLoadSave : 1;
+
+ // Hint abfangen fuer DocInfo
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
+
+protected:
+ // Briefumschlaege, Etiketten
+ void InsertEnv(SfxRequest&);
+ void InsertLab(SfxRequest&, sal_Bool bLabel);
+
+public:
+ // public Data - used for internal Clipboard / Drag & Drop / XSelection
+ SwTransferable *pDragDrop, *pXSelection;
+
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SW_INTERFACE_MODULE)
+
+ // dieser Ctor nur fuer SW-Dll
+ SwModule( SfxObjectFactory* pFact,
+ SfxObjectFactory* pWebFact,
+ SfxObjectFactory* pGlobalFact );
+
+ ~SwModule();
+
+ // View setzen nur fuer internen Gebrauch,
+ // aus techn. Gruenden public
+ //
+ inline void SetView(SwView* pVw) { pView = pVw; }
+ inline SwView* GetView() { return pView; }
+
+ //Die Handler fuer die Slots
+ void StateOther(SfxItemSet &); // andere
+
+ void ExecOther(SfxRequest &); // Felder, Formel ..
+
+ // Benutzereinstellungen modifizieren
+ const SwMasterUsrPref *GetUsrPref(sal_Bool bWeb) const;
+ const SwViewOption* GetViewOption(sal_Bool bWeb);
+ void ApplyUsrPref(const SwViewOption &, SwView*,
+ sal_uInt16 nDest = VIEWOPT_DEST_VIEW );
+ void ApplyUserMetric( FieldUnit eMetric, sal_Bool bWeb );
+ void ApplyRulerMetric( FieldUnit eMetric, sal_Bool bHorizontal, sal_Bool bWeb );
+ void ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags);
+ void ApplyLinkMode(sal_Int32 nNewLinkMode);
+
+ //default page mode for text grid
+ void ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode);
+
+ // ConfigItems erzeugen
+ SwModuleOptions* GetModuleConfig() { return pModuleConfig;}
+ SwPrintOptions* GetPrtOptions(sal_Bool bWeb);
+ SwChapterNumRules* GetChapterNumRules();
+ SwStdFontConfig* GetStdFontConfig() { return pStdFontConfig; }
+ SwNavigationConfig* GetNavigationConfig();
+ SwToolbarConfigItem*GetToolbarConfig() { return pToolbarConfig; }
+ SwToolbarConfigItem*GetWebToolbarConfig() { return pWebToolbarConfig; }
+ SwDBConfig* GetDBConfig();
+ svtools::ColorConfig& GetColorConfig();
+ SvtAccessibilityOptions& GetAccessibilityOptions();
+ SvtCTLOptions& GetCTLOptions();
+ SvtUserOptions& GetUserOptions();
+ SvtUndoOptions& GetUndoOptions();
+
+ // Ueber Sichten iterieren
+ static SwView* GetFirstView();
+ static SwView* GetNextView(SwView*);
+
+ sal_Bool IsEmbeddedLoadSave() const { return bEmbeddedLoadSave; }
+ void SetEmbeddedLoadSave( sal_Bool bFlag ) { bEmbeddedLoadSave = bFlag; }
+
+ void ShowDBObj( SwView& rView, const SwDBData& rData, sal_Bool bOnlyIfAvailable = sal_False);
+
+ // Tabellenmodi
+ sal_Bool IsInsTblFormatNum(sal_Bool bHTML) const;
+ sal_Bool IsInsTblChangeNumFormat(sal_Bool bHTML) const;
+ sal_Bool IsInsTblAlignNum(sal_Bool bHTML) const;
+
+ // Redlining
+ sal_uInt16 GetRedlineAuthor();
+ const String& GetRedlineAuthor(sal_uInt16 nPos);
+ sal_uInt16 InsertRedlineAuthor(const String& rAuthor);
+
+ void GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
+ void GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
+ void GetFormatAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
+
+ sal_uInt16 GetRedlineMarkPos();
+ const Color& GetRedlineMarkColor();
+
+ // returne den definierten DocStat - WordDelimiter
+ const String& GetDocStatWordDelim() const;
+
+ // Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
+ sal_uInt16 GetMetric( sal_Bool bWeb ) const;
+
+ // Update-Stati durchreichen
+ sal_uInt16 GetLinkUpdMode( sal_Bool bWeb ) const;
+ SwFldUpdateFlags GetFldUpdateFlags( sal_Bool bWeb ) const;
+
+ //virtuelle Methoden fuer den Optionendialog
+ virtual SfxItemSet* CreateItemSet( sal_uInt16 nId );
+ virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
+ virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );
+
+ //hier wird der Pool angelegt und an der SfxShell gesetzt
+ void InitAttrPool();
+ //Pool loeschen bevor es zu spaet ist
+ void RemoveAttrPool();
+
+ // Invalidiert ggf. OnlineSpell-WrongListen
+ void CheckSpellChanges( sal_Bool bOnlineSpelling,
+ sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain, sal_Bool bSmartTags );
+
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >
+ GetLngSvcEvtListener();
+ inline void SetLngSvcEvtListener( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr);
+ void CreateLngSvcEvtListener();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::scanner::XScannerManager >
+ GetScannerManager();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLanguageGuessing >
+ GetLanguageGuesser();
+};
+
+
+inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >
+ SwModule::GetLngSvcEvtListener()
+{
+ return xLngSvcEvtListener;
+}
+
+inline void SwModule::SetLngSvcEvtListener(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr)
+{
+ xLngSvcEvtListener = xLstnr;
+}
+
+
+/*-----------------08.07.97 10.33-------------------
+ Zugriff auf das SwModule, die ::com::sun::star::sdbcx::View und die Shell
+--------------------------------------------------*/
+
+#define SW_MOD() ( *(SwModule**) GetAppData(SHL_WRITER))
+
+SW_DLLPUBLIC SwView* GetActiveView();
+SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
+
+#endif
diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx
new file mode 100644
index 000000000000..1cf85bfd5c42
--- /dev/null
+++ b/sw/inc/swrect.hxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWRECT_HXX
+#define _SWRECT_HXX
+#include "errhdl.hxx"
+#include <tools/gen.hxx>
+class SvStream;
+
+class SwRect
+{
+ Point m_Point;
+ Size m_Size;
+
+
+public:
+ inline SwRect();
+ inline SwRect( const SwRect &rRect );
+ inline SwRect( const Point& rLT, const Size& rSize );
+ inline SwRect( const Point& rLT, const Point& rRB );
+ inline SwRect( long X, long Y, long Width, long Height );
+
+ //SV-SS z.B. SwRect( pWin->GetClipRect() );
+ SwRect( const Rectangle &rRect );
+
+ //Set-Methoden
+ inline void Chg( const Point& rNP, const Size &rNS );
+ inline void Pos( const Point& rNew );
+ inline void Pos( const long nNewX, const long nNewY );
+ inline void SSize( const Size& rNew );
+ inline void SSize( const long nHeight, const long nWidth );
+ inline void Width( long nNew );
+ inline void Height( long nNew );
+ inline void Left( const long nLeft );
+ inline void Right( const long nRight );
+ inline void Top( const long nTop );
+ inline void Bottom( const long nBottom );
+
+ //Get-Methoden
+ inline const Point &Pos() const;
+ inline const Size &SSize() const;
+ inline long Width() const;
+ inline long Height() const;
+ inline long Left() const;
+ inline long Right() const;
+ inline long Top() const;
+ inline long Bottom() const;
+
+ //Damit Layoutseitig per Memberpointer auf die Member von Pos und SSize
+ //zugegriffen werden kann.
+ inline Point &Pos();
+ inline Size &SSize();
+
+ Point Center() const;
+
+ void Justify();
+
+ SwRect &Union( const SwRect& rRect );
+ SwRect &Intersection( const SwRect& rRect );
+ //Wie Intersection nur wird davon ausgegangen, dass die Rects ueberlappen!
+ SwRect &_Intersection( const SwRect &rRect );
+ inline SwRect GetIntersection( const SwRect& rRect ) const;
+
+ sal_Bool IsInside( const Point& rPOINT ) const;
+ sal_Bool IsNear(const Point& rPoint, long nTolerance ) const;
+ sal_Bool IsInside( const SwRect& rRect ) const;
+ sal_Bool IsOver( const SwRect& rRect ) const;
+ inline sal_Bool HasArea() const;
+ inline sal_Bool IsEmpty() const;
+ inline void Clear();
+
+ inline SwRect &operator = ( const SwRect &rRect );
+
+ inline sal_Bool operator == ( const SwRect& rRect ) const;
+ inline sal_Bool operator != ( const SwRect& rRect ) const;
+
+ inline SwRect &operator+=( const Point &rPt );
+ inline SwRect &operator-=( const Point &rPt );
+
+ inline SwRect &operator+=( const Size &rSz );
+ inline SwRect &operator-=( const Size &rSz );
+
+ //SV-SS z.B. pWin->DrawRect( aSwRect.SVRect() );
+ inline Rectangle SVRect() const;
+
+ //Zortech wuerde hier fehlerhaften Code erzeugen.
+// inline operator SRectangle() const;
+// inline operator Rectangle() const { return Rectangle( aPos, aSize ); }
+
+ // Ausgabeoperator fuer die Debugging-Gemeinde
+ friend SvStream &operator<<( SvStream &rStream, const SwRect &rRect );
+
+
+ void _Top( const long nTop );
+ void _Bottom( const long nBottom );
+ void _Left( const long nLeft );
+ void _Right( const long nRight );
+ void _Width( const long nNew );
+ void _Height( const long nNew );
+ long _Top() const;
+ long _Bottom() const;
+ long _Left() const;
+ long _Right() const;
+ long _Width() const;
+ long _Height() const;
+ void SubTop( const long nSub );
+ void AddBottom( const long nAdd );
+ void SubLeft( const long nSub );
+ void AddRight( const long nAdd );
+ void AddWidth( const long nAdd );
+ void AddHeight( const long nAdd );
+ void SetPosX( const long nNew );
+ void SetPosY( const long nNew );
+ void SetLeftAndWidth( long nLeft, long nNew );
+ void SetTopAndHeight( long nTop, long nNew );
+ void SetRightAndWidth( long nRight, long nNew );
+ void SetBottomAndHeight( long nBottom, long nNew );
+ void SetUpperLeftCorner( const Point& rNew );
+ void SetUpperRightCorner( const Point& rNew );
+ void SetLowerLeftCorner( const Point& rNew );
+ const Size _Size() const;
+ const Point TopLeft() const;
+ const Point TopRight() const;
+ const Point BottomLeft() const;
+ const Point BottomRight() const;
+ const Size SwappedSize() const;
+ long GetLeftDistance( long ) const;
+ long GetBottomDistance( long ) const;
+ long GetRightDistance( long ) const;
+ long GetTopDistance( long ) const;
+ sal_Bool OverStepLeft( long ) const;
+ sal_Bool OverStepBottom( long ) const;
+ sal_Bool OverStepTop( long ) const;
+ sal_Bool OverStepRight( long ) const;
+};
+
+// Implementation in in swrect.cxx
+extern SvStream &operator<<( SvStream &rStream, const SwRect &rRect );
+
+typedef void (SwRect:: *SwRectSet)( const long nNew );
+typedef long (SwRect:: *SwRectGet)() const;
+typedef const Point (SwRect:: *SwRectPoint)() const;
+typedef const Size (SwRect:: *SwRectSize)() const;
+typedef sal_Bool (SwRect:: *SwRectMax)( long ) const;
+typedef long (SwRect:: *SwRectDist)( long ) const;
+typedef void (SwRect:: *SwRectSetTwice)( long, long );
+typedef void (SwRect:: *SwRectSetPos)( const Point& );
+
+//---------------------------------- Set-Methoden
+inline void SwRect::Chg( const Point& rNP, const Size &rNS )
+{
+ m_Point = rNP;
+ m_Size = rNS;
+}
+inline void SwRect::Pos( const Point& rNew )
+{
+ m_Point = rNew;
+}
+inline void SwRect::Pos( const long nNewX, const long nNewY )
+{
+ m_Point.setX(nNewX);
+ m_Point.setY(nNewY);
+}
+inline void SwRect::SSize( const Size& rNew )
+{
+ m_Size = rNew;
+}
+inline void SwRect::SSize( const long nNewHeight, const long nNewWidth )
+{
+ m_Size.setWidth(nNewWidth);
+ m_Size.setHeight(nNewHeight);
+}
+inline void SwRect::Width( long nNew )
+{
+ m_Size.setWidth(nNew);
+}
+inline void SwRect::Height( long nNew )
+{
+ m_Size.setHeight(nNew);
+}
+inline void SwRect::Left( const long nLeft )
+{
+ m_Size.Width() += m_Point.getX() - nLeft;
+ m_Point.setX(nLeft);
+}
+inline void SwRect::Right( const long nRight )
+{
+ m_Size.setWidth(nRight - m_Point.getX() + 1);
+}
+inline void SwRect::Top( const long nTop )
+{
+ m_Size.Height() += m_Point.getY() - nTop;
+ m_Point.setY(nTop);
+}
+inline void SwRect::Bottom( const long nBottom )
+{
+ m_Size.setHeight(nBottom - m_Point.getY() + 1);
+}
+
+//----------------------------------- Get-Methoden
+inline const Point &SwRect::Pos() const
+{
+ return m_Point;
+}
+inline Point &SwRect::Pos()
+{
+ return m_Point;
+}
+inline const Size &SwRect::SSize() const
+{
+ return m_Size;
+}
+inline Size &SwRect::SSize()
+{
+ return m_Size;
+}
+inline long SwRect::Width() const
+{
+ return m_Size.Width();
+}
+inline long SwRect::Height() const
+{
+ return m_Size.Height();
+}
+inline long SwRect::Left() const
+{
+ return m_Point.X();
+}
+inline long SwRect::Right() const
+{
+ return m_Size.getWidth() ? m_Point.getX() + m_Size.getWidth() - 1 : m_Point.getX();
+}
+inline long SwRect::Top() const
+{
+ return m_Point.Y();
+}
+inline long SwRect::Bottom() const
+{
+ return m_Size.getHeight() ? m_Point.getY() + m_Size.getHeight() - 1 : m_Point.getY();
+}
+
+//----------------------------------- operatoren
+inline SwRect &SwRect::operator = ( const SwRect &rRect )
+{
+ m_Point = rRect.m_Point;
+ m_Size = rRect.m_Size;
+ return *this;
+}
+inline sal_Bool SwRect::operator == ( const SwRect& rRect ) const
+{
+ return (m_Point == rRect.m_Point && m_Size == rRect.m_Size);
+}
+inline sal_Bool SwRect::operator != ( const SwRect& rRect ) const
+{
+ return (m_Point != rRect.m_Point || m_Size != rRect.m_Size);
+}
+
+inline SwRect &SwRect::operator+=( const Point &rPt )
+{
+ m_Point += rPt;
+ return *this;
+}
+inline SwRect &SwRect::operator-=( const Point &rPt )
+{
+ m_Point -= rPt;
+ return *this;
+}
+
+inline SwRect &SwRect::operator+=( const Size &rSz )
+{
+ m_Size.Width() += rSz.Width();
+ m_Size.Height() += rSz.Height();
+ return *this;
+}
+inline SwRect &SwRect::operator-=( const Size &rSz )
+{
+ m_Size.Width() -= rSz.Width();
+ m_Size.Height() -= rSz.Height();
+ return *this;
+}
+
+
+//--------------------------- Sonstiges
+inline Rectangle SwRect::SVRect() const
+{
+ ASSERT( !IsEmpty(), "SVRect() without Width or Height" );
+ return Rectangle( m_Point.getX(), m_Point.getY(),
+ m_Point.getX() + m_Size.getWidth() - 1, //Right()
+ m_Point.getY() + m_Size.getHeight() - 1 ); //Bottom()
+}
+
+inline SwRect SwRect::GetIntersection( const SwRect& rRect ) const
+{
+ return SwRect( *this ).Intersection( rRect );
+}
+
+inline sal_Bool SwRect::HasArea() const
+{
+ return !IsEmpty();
+}
+inline sal_Bool SwRect::IsEmpty() const
+{
+ return !(m_Size.getHeight() && m_Size.getWidth());
+}
+inline void SwRect::Clear()
+{
+ m_Point.setX(0);
+ m_Point.setY(0);
+ m_Size.setWidth(0);
+ m_Size.setHeight(0);
+}
+
+//-------------------------- CToren
+inline SwRect::SwRect() :
+ m_Point( 0, 0 ),
+ m_Size( 0, 0 )
+{
+}
+inline SwRect::SwRect( const SwRect &rRect ) :
+ m_Point( rRect.m_Point ),
+ m_Size( rRect.m_Size )
+{
+}
+inline SwRect::SwRect( const Point& rLT, const Size& rSize ) :
+ m_Point( rLT ),
+ m_Size( rSize )
+{
+}
+inline SwRect::SwRect( const Point& rLT, const Point& rRB ) :
+ m_Point( rLT ),
+ m_Size( rRB.X() - rLT.X() + 1, rRB.Y() - rLT.Y() + 1 )
+{
+}
+inline SwRect::SwRect( long X, long Y, long W, long H ) :
+ m_Point( X, Y ),
+ m_Size( W, H )
+{
+}
+
+
+#endif //_SWRECT_HXX
diff --git a/sw/inc/swregion.hxx b/sw/inc/swregion.hxx
new file mode 100644
index 000000000000..5693622409aa
--- /dev/null
+++ b/sw/inc/swregion.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWREGION_HXX
+#define _SWREGION_HXX
+
+#include <svl/svarray.hxx>
+
+#include "swrect.hxx"
+
+SV_DECL_VARARR( SwRects, SwRect, 20, 8 )
+
+class SwRegionRects : public SwRects
+{
+ SwRect aOrigin; // die Kopie des StartRects
+
+ inline void InsertRect( const SwRect &rRect, const sal_uInt16 nPos, sal_Bool &rDel);
+
+public:
+ SwRegionRects( const SwRect& rStartRect, sal_uInt16 nInit = 20,
+ sal_uInt16 nGrow = 8 );
+ // Zum Ausstanzen aus aOrigin.
+ void operator-=( const SwRect& rRect );
+
+ // Aus Loechern werden Flaechen, aus Flaechen werden Loecher.
+ void Invert();
+ // Benachbarte Rechtecke zusammenfassen.
+ void Compress( sal_Bool bFuzzy = sal_True );
+
+ inline const SwRect &GetOrigin() const { return aOrigin; }
+ inline void ChangeOrigin( const SwRect &rRect ) { aOrigin = rRect; }
+};
+
+#endif //_SWREGION_HXX
diff --git a/sw/inc/swserv.hxx b/sw/inc/swserv.hxx
new file mode 100644
index 000000000000..797c57db44d7
--- /dev/null
+++ b/sw/inc/swserv.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWSERV_HXX
+#define _SWSERV_HXX
+
+#include <sfx2/linksrc.hxx>
+#include <IMark.hxx>
+
+class SwSectionNode;
+class SwBaseLink;
+class SwTableNode;
+struct SwPosition;
+class SwPaM;
+
+class SwServerObject : public ::sfx2::SvLinkSource
+{
+ using sfx2::SvLinkSource::SendDataChanged;
+
+protected:
+ enum ServerModes { BOOKMARK_SERVER, TABLE_SERVER, SECTION_SERVER, NONE_SERVER } eType;
+ union {
+ ::sw::mark::IMark* pBkmk;
+ SwTableNode* pTblNd;
+ SwSectionNode* pSectNd;
+ } CNTNT_TYPE;
+
+ SwServerObject();
+
+public:
+ SwServerObject( ::sw::mark::IMark& rBookmark )
+ : eType( BOOKMARK_SERVER )
+ {
+ CNTNT_TYPE.pBkmk = &rBookmark;
+ }
+ SwServerObject( SwTableNode& rTableNd )
+ : eType( TABLE_SERVER )
+ {
+ CNTNT_TYPE.pTblNd = &rTableNd;
+ }
+ SwServerObject( SwSectionNode& rSectNd )
+ : eType( SECTION_SERVER )
+ {
+ CNTNT_TYPE.pSectNd = &rSectNd;
+ }
+ virtual ~SwServerObject();
+
+ virtual sal_Bool GetData( ::com::sun::star::uno::Any & rData,
+ const String & rMimeType,
+ sal_Bool bSynchron = sal_False );
+
+ sal_Bool SetData( const String & rMimeType,
+ const ::com::sun::star::uno::Any& rData );
+
+ virtual void SendDataChanged( const SwPosition& rPos );
+ virtual void SendDataChanged( const SwPaM& rRange );
+
+ sal_Bool IsLinkInServer( const SwBaseLink* ) const;
+
+ void SetNoServer();
+ void SetDdeBookmark( ::sw::mark::IMark& rBookmark);
+};
+
+#ifndef SW_DECL_SWSERVEROBJECT_DEFINED
+#define SW_DECL_SWSERVEROBJECT_DEFINED
+SV_DECL_REF( SwServerObject )
+#endif
+
+#endif // _SWSERV_HXX
+
diff --git a/sw/inc/swstyle.h b/sw/inc/swstyle.h
new file mode 100644
index 000000000000..cd266fb3d68d
--- /dev/null
+++ b/sw/inc/swstyle.h
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWSTYLE_H
+#define _SWSTYLE_H
+
+
+#define SWSTYLEBIT_TEXT 0x0001
+#define SWSTYLEBIT_CHAPTER 0x0002
+#define SWSTYLEBIT_LIST 0x0004
+#define SWSTYLEBIT_IDX 0x0008
+#define SWSTYLEBIT_EXTRA 0x0010
+#define SWSTYLEBIT_HTML 0x0020
+#define SWSTYLEBIT_CONDCOLL 0x0040
+
+
+#endif
+
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
new file mode 100644
index 000000000000..80e54c7e7468
--- /dev/null
+++ b/sw/inc/swtable.hxx
@@ -0,0 +1,494 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWTABLE_HXX
+#define _SWTABLE_HXX
+#include <tools/mempool.hxx>
+#include <tools/ref.hxx>
+#include <svl/svarray.hxx>
+#include <tblenum.hxx>
+#include <swtypes.hxx>
+#include <calbck.hxx>
+#include <swrect.hxx>
+#ifndef DBG_UTIL
+#include <node.hxx> // fuer StartNode->GetMyIndex
+#else
+class SwStartNode;
+#include <memory>
+#include <boost/noncopyable.hpp>
+#endif
+
+class SwFmt;
+class Color;
+class SwFrmFmt;
+class SwTableFmt;
+class SwTableLineFmt;
+class SwTableBoxFmt;
+class SwHTMLTableLayout;
+class SwTableLine;
+class SwTableBox;
+class SwTableNode;
+class SwTabCols;
+class SwDoc;
+class SwSelBoxes;
+class SwTblCalcPara;
+class SwChartLines;
+struct SwPosition;
+class SwNodeIndex;
+class SwNode;
+class SfxPoolItem;
+class SwUndoTblMerge;
+class SwUndo;
+class SwPaM;
+class SwTableBox_Impl;
+class SwUndoTblCpyTbl;
+class SwBoxSelection;
+struct SwSaveRowSpan;
+struct Parm;
+
+#ifndef SW_DECL_SWSERVEROBJECT_DEFINED
+#define SW_DECL_SWSERVEROBJECT_DEFINED
+SV_DECL_REF( SwServerObject )
+#endif
+
+SV_DECL_PTRARR_DEL(SwTableLines, SwTableLine*, 10, 20)
+SV_DECL_PTRARR_DEL(SwTableBoxes, SwTableBox*, 25, 50)
+
+// speicher die Inhaltstragenden Box-Pointer zusaetzlich in einem
+// sortierten Array (fuers rechnen in der Tabelle)
+typedef SwTableBox* SwTableBoxPtr;
+SV_DECL_PTRARR_SORT( SwTableSortBoxes, SwTableBoxPtr, 25, 50 )
+typedef SwTableLine* SwTableLinePtr;
+
+class SW_DLLPUBLIC SwTable: public SwClient //Client vom FrmFmt
+{
+
+
+protected:
+ SwTableLines aLines;
+ SwTableSortBoxes aSortCntBoxes;
+ SwServerObjectRef refObj; // falls DataServer -> Pointer gesetzt
+
+ SwHTMLTableLayout *pHTMLLayout;
+
+ // Usually, the table node of a SwTable can be accessed by getting a box
+ // out of aSortCntBoxes, which know their SwStartNode. But in some rare
+ // cases, we need to know the table node of a SwTable, before the table
+ // boxes have been build (SwTableNode::MakeCopy with tables in tables).
+ SwTableNode* pTableNode;
+
+//SOLL das fuer jede Tabelle einstellbar sein?
+ TblChgMode eTblChgMode;
+
+ sal_uInt16 nGrfsThatResize; // Anzahl der Grfs, die beim HTML-Import
+ // noch ein Resize der Tbl. anstossen
+ sal_uInt16 nRowsToRepeat; // number of rows to repeat on every page
+
+ sal_Bool bModifyLocked :1;
+ sal_Bool bNewModel :1; // sal_False: old SubTableModel; sal_True: new RowSpanModel
+#ifdef DBG_UTIL
+ bool bDontChangeModel; // This is set by functions (like Merge()) to forbid a laet model change
+#endif
+
+ sal_Bool IsModifyLocked(){ return bModifyLocked;}
+
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
+
+public:
+ enum SearchType
+ {
+ SEARCH_NONE, // Default: expand to rectangle
+ SEARCH_ROW, // row selection
+ SEARCH_COL // column selection
+ };
+
+ TYPEINFO();
+
+ // single argument ctors shall be explicit.
+ explicit SwTable( SwTableFmt* );
+ virtual ~SwTable();
+
+ // @@@ public copy ctor, but no copy assignment?
+ SwTable( const SwTable& rTable ); // kein Copy der Lines !!
+private:
+ // @@@ public copy ctor, but no copy assignment?
+ SwTable & operator= (const SwTable &);
+ // no default ctor.
+ SwTable();
+ sal_Bool OldMerge( SwDoc*, const SwSelBoxes&, SwTableBox*, SwUndoTblMerge* );
+ sal_Bool OldSplitRow( SwDoc*, const SwSelBoxes&, sal_uInt16, sal_Bool );
+ sal_Bool NewMerge( SwDoc*, const SwSelBoxes&, const SwSelBoxes& rMerged,
+ SwTableBox*, SwUndoTblMerge* );
+ sal_Bool NewSplitRow( SwDoc*, const SwSelBoxes&, sal_uInt16, sal_Bool );
+ SwBoxSelection* CollectBoxSelection( const SwPaM& rPam ) const;
+ void InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
+ sal_Bool _InsertRow( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, sal_Bool bBehind );
+ sal_Bool NewInsertCol( SwDoc*, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool );
+ void _FindSuperfluousRows( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* );
+ void AdjustWidths( const long nOld, const long nNew );
+ void NewSetTabCols( Parm &rP, const SwTabCols &rNew, const SwTabCols &rOld,
+ const SwTableBox *pStart, sal_Bool bCurRowOnly );
+
+public:
+
+ SwHTMLTableLayout *GetHTMLTableLayout() { return pHTMLLayout; }
+ const SwHTMLTableLayout *GetHTMLTableLayout() const { return pHTMLLayout; }
+ void SetHTMLTableLayout( SwHTMLTableLayout *p ); //Eigentumsuebergang!
+
+ sal_uInt16 IncGrfsThatResize() { return ++nGrfsThatResize; }
+ sal_uInt16 DecGrfsThatResize() { return nGrfsThatResize ? --nGrfsThatResize : 0; }
+
+ void LockModify() { bModifyLocked = sal_True; } //Muessen _immer_ paarig
+ void UnlockModify() { bModifyLocked = sal_False;} //benutzt werden!
+
+ void SetTableModel( sal_Bool bNew ){ bNewModel = bNew; }
+ sal_Bool IsNewModel() const { return bNewModel; }
+
+ sal_uInt16 GetRowsToRepeat() const { return Min( GetTabLines().Count(), nRowsToRepeat ); }
+ sal_uInt16 _GetRowsToRepeat() const { return nRowsToRepeat; }
+ void SetRowsToRepeat( sal_uInt16 nNumOfRows ) { nRowsToRepeat = nNumOfRows; }
+
+ bool IsHeadline( const SwTableLine& rLine ) const;
+
+ SwTableLines &GetTabLines() { return aLines; }
+ const SwTableLines &GetTabLines() const { return aLines; }
+
+ SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+ SwTableFmt* GetTableFmt() const { return (SwTableFmt*)GetRegisteredIn(); }
+
+ void GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart,
+ sal_Bool bHidden = sal_False, sal_Bool bCurRowOnly = sal_False ) const;
+ void SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld,
+ const SwTableBox *pStart, sal_Bool bCurRowOnly );
+
+// The following functions are for new table model only...
+ void CreateSelection( const SwPaM& rPam, SwSelBoxes& rBoxes,
+ const SearchType eSearchType, bool bProtect ) const;
+ void CreateSelection( const SwNode* pStart, const SwNode* pEnd,
+ SwSelBoxes& rBoxes, const SearchType eSearchType, bool bProtect ) const;
+ void ExpandSelection( SwSelBoxes& rBoxes ) const;
+ // When a table is splitted into two tables, the row spans which overlaps
+ // the split have to be corrected and stored for undo
+ // SwSavRowSpan is the structure needed by Undo to undo the split operation
+ // CleanUpRowSpan corrects the (top of the) second table and delviers the structure
+ // for Undo
+ SwSaveRowSpan* CleanUpTopRowSpan( sal_uInt16 nSplitLine );
+ // RestoreRowSpan is called by Undo to restore the old row span values
+ void RestoreRowSpan( const SwSaveRowSpan& );
+ // CleanUpBottomRowSpan corrects the overhanging row spans at the end of the first table
+ void CleanUpBottomRowSpan( sal_uInt16 nDelLines );
+
+
+// The following functions are "pseudo-virtual", i.e. they are different for old and new table model
+// It's not allowed to change the table model after the first call of one of these functions.
+
+ sal_Bool Merge( SwDoc* pDoc, const SwSelBoxes& rBoxes, const SwSelBoxes& rMerged,
+ SwTableBox* pMergeBox, SwUndoTblMerge* pUndo = 0 )
+ {
+#ifdef DBG_UTIL
+ bDontChangeModel = true;
+#endif
+ return bNewModel ? NewMerge( pDoc, rBoxes, rMerged, pMergeBox, pUndo ) :
+ OldMerge( pDoc, rBoxes, pMergeBox, pUndo );
+ }
+ sal_Bool SplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt=1,
+ sal_Bool bSameHeight = sal_False )
+ {
+#ifdef DBG_UTIL
+ bDontChangeModel = true;
+#endif
+ return bNewModel ? NewSplitRow( pDoc, rBoxes, nCnt, bSameHeight ) :
+ OldSplitRow( pDoc, rBoxes, nCnt, bSameHeight );
+ }
+ bool PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
+ SwSelBoxes& rMerged, SwTableBox** ppMergeBox, SwUndoTblMerge* pUndo );
+ void ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax ) const;
+ void PrepareDeleteCol( long nMin, long nMax );
+
+ sal_Bool InsertCol( SwDoc*, const SwSelBoxes& rBoxes,
+ sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
+ sal_Bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes,
+ sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
+ sal_Bool AppendRow( SwDoc* pDoc, sal_uInt16 nCnt = 1 );
+ void PrepareDelBoxes( const SwSelBoxes& rBoxes );
+ sal_Bool DeleteSel( SwDoc*, const SwSelBoxes& rBoxes, const SwSelBoxes* pMerged,
+ SwUndo* pUndo, const sal_Bool bDelMakeFrms, const sal_Bool bCorrBorder );
+ sal_Bool SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt=1 );
+ sal_Bool Merge( const SwSelBoxes& rBoxes,
+ SwTableBox* pMergeBox, SwUndoTblMerge* = 0 );
+
+ void FindSuperfluousRows( SwSelBoxes& rBoxes )
+ { _FindSuperfluousRows( rBoxes, 0, 0 ); }
+ void CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const;
+
+ SwTableSortBoxes& GetTabSortBoxes() { return aSortCntBoxes; }
+ const SwTableSortBoxes& GetTabSortBoxes() const { return aSortCntBoxes; }
+
+ // lese die 1. Nummer und loesche sie aus dem String
+ // (wird von GetTblBox und SwTblFld benutzt)
+ // --> OD 2007-08-03 #i80314#
+ // add 3rd parameter in order to control validation check on <rStr>
+ static sal_uInt16 _GetBoxNum( String& rStr,
+ sal_Bool bFirst = sal_False,
+ const bool bPerformValidCheck = false );
+ // <--
+ // suche die Inhaltstragende Box mit dem Namen
+ // --> OD 2007-08-03 #i80314#
+ // add 2nd parameter in order to control validation check in called method
+ // <_GetBoxNum(..)>
+ const SwTableBox* GetTblBox( const String& rName,
+ const bool bPerformValidCheck = false ) const;
+ // <--
+ // kopiere die selektierten Boxen in ein anderes Dokument.
+ sal_Bool MakeCopy( SwDoc*, const SwPosition&, const SwSelBoxes&,
+ sal_Bool bCpyNds = sal_True, sal_Bool bCpyName = sal_False ) const;
+ // kopiere die Tabelle in diese. (die Logik steht im TBLRWCL.CXX)
+ sal_Bool InsTable( const SwTable& rCpyTbl, const SwNodeIndex&,
+ SwUndoTblCpyTbl* pUndo = 0 );
+ sal_Bool InsTable( const SwTable& rCpyTbl, const SwSelBoxes&,
+ SwUndoTblCpyTbl* pUndo = 0 );
+ sal_Bool InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes&,
+ SwUndoTblCpyTbl* pUndo );
+ // kopiere die Headline (mit Inhalt!) der Tabelle in eine andere
+ sal_Bool CopyHeadlineIntoTable( SwTableNode& rTblNd );
+
+ // erfrage die Box, dessen Start-Index auf nBoxStt steht
+ SwTableBox* GetTblBox( sal_uLong nSttIdx );
+ const SwTableBox* GetTblBox( sal_uLong nSttIdx ) const
+ { return ((SwTable*)this)->GetTblBox( nSttIdx ); }
+
+ // returnt sal_True wenn sich in der Tabelle Verschachtelungen befinden
+ sal_Bool IsTblComplex() const;
+
+ //returnt sal_True wenn die Tabelle oder Selektion ausgeglichen ist
+ sal_Bool IsTblComplexForChart( const String& rSel,
+ SwChartLines* pGetCLines = 0 ) const;
+
+ // suche alle Inhaltstragenden-Boxen der Grundline in der diese Box
+ // steht. rBoxes auch als Return-Wert, um es gleich weiter zu benutzen
+ //JP 31.01.97: bToTop = sal_True -> hoch bis zur Grundline,
+ // sal_False-> sonst nur die Line der Box
+ SwSelBoxes& SelLineFromBox( const SwTableBox* pBox,
+ SwSelBoxes& rBoxes, sal_Bool bToTop = sal_True ) const;
+ // erfrage vom Client Informationen
+ virtual sal_Bool GetInfo( SfxPoolItem& ) const;
+
+ // suche im Format nach der angemeldeten Tabelle
+ static SwTable * FindTable( SwFrmFmt const*const pFmt );
+
+ // Struktur ein wenig aufraeumen
+ void GCLines();
+
+ // returns the table node via aSortCntBoxes or pTableNode
+ SwTableNode* GetTableNode() const;
+ void SetTableNode( SwTableNode* pNode ) { pTableNode = pNode; }
+
+ // Daten Server-Methoden
+ void SetRefObject( SwServerObject* );
+ const SwServerObject* GetObject() const { return &refObj; }
+ SwServerObject* GetObject() { return &refObj; }
+
+ //Daten fuer das Chart fuellen.
+ void UpdateCharts() const;
+
+ TblChgMode GetTblChgMode() const { return eTblChgMode; }
+ void SetTblChgMode( TblChgMode eMode ) { eTblChgMode = eMode; }
+
+ sal_Bool SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
+ SwTwips nAbsDiff, SwTwips nRelDiff, SwUndo** ppUndo );
+ sal_Bool SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
+ SwTwips nAbsDiff, SwTwips nRelDiff, SwUndo** ppUndo );
+ void RegisterToFormat( SwFmt& rFmt );
+#ifdef DBG_UTIL
+ void CheckConsistency() const;
+#endif
+};
+
+class SW_DLLPUBLIC SwTableLine: public SwClient // Client vom FrmFmt
+{
+ SwTableBoxes aBoxes;
+ SwTableBox *pUpper;
+
+public:
+ TYPEINFO();
+
+ SwTableLine() : pUpper(0) {}
+
+ SwTableLine( SwTableLineFmt*, sal_uInt16 nBoxes, SwTableBox *pUp );
+ virtual ~SwTableLine();
+
+ SwTableBoxes &GetTabBoxes() { return aBoxes; }
+ const SwTableBoxes &GetTabBoxes() const { return aBoxes; }
+
+ SwTableBox *GetUpper() { return pUpper; }
+ const SwTableBox *GetUpper() const { return pUpper; }
+ void SetUpper( SwTableBox *pNew ) { pUpper = pNew; }
+
+
+ SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+
+ //Macht ein eingenes FrmFmt wenn noch mehr Lines von ihm abhaengen.
+ SwFrmFmt* ClaimFrmFmt();
+ void ChgFrmFmt( SwTableLineFmt* pNewFmt );
+
+ // suche nach der naechsten/vorherigen Box mit Inhalt
+ SwTableBox* FindNextBox( const SwTable&, const SwTableBox* =0,
+ sal_Bool bOvrTblLns=sal_True ) const;
+ SwTableBox* FindPreviousBox( const SwTable&, const SwTableBox* =0,
+ sal_Bool bOvrTblLns=sal_True ) const;
+
+ SwTwips GetTableLineHeight( bool& bLayoutAvailable ) const;
+
+ bool hasSoftPageBreak() const;
+ void RegisterToFormat( SwFmt& rFmt );
+};
+
+class SW_DLLPUBLIC SwTableBox: public SwClient //Client vom FrmFmt
+{
+ friend class SwNodes; // um den Index umzusetzen !
+ friend void DelBoxNode(SwTableSortBoxes&); // um den StartNode* zu loeschen !
+ friend class SwXMLTableContext;
+
+ //nicht (mehr) implementiert.
+ SwTableBox( const SwTableBox & );
+ SwTableBox &operator=( const SwTableBox &); //gibts nicht.
+
+ SwTableLines aLines;
+ const SwStartNode * pSttNd;
+ SwTableLine *pUpper;
+ SwTableBox_Impl* pImpl;
+
+ // falls das Format schon Formeln/Values enthaelt, muss ein neues
+ // fuer die neue Box erzeugt werden.
+ SwTableBoxFmt* CheckBoxFmt( SwTableBoxFmt* );
+
+public:
+ TYPEINFO();
+
+ SwTableBox() : pSttNd(0), pUpper(0), pImpl(0) {}
+
+ SwTableBox( SwTableBoxFmt*, sal_uInt16 nLines, SwTableLine *pUp = 0 );
+ SwTableBox( SwTableBoxFmt*, const SwStartNode&, SwTableLine *pUp = 0 );
+ SwTableBox( SwTableBoxFmt*, const SwNodeIndex&, SwTableLine *pUp = 0 );
+ virtual ~SwTableBox();
+
+ SwTableLines &GetTabLines() { return aLines; }
+ const SwTableLines &GetTabLines() const { return aLines; }
+
+ SwTableLine *GetUpper() { return pUpper; }
+ const SwTableLine *GetUpper() const { return pUpper; }
+ void SetUpper( SwTableLine *pNew ) { pUpper = pNew; }
+
+ SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+
+ //Macht ein eingenes FrmFmt wenn noch mehr Boxen von ihm abhaengen.
+ SwFrmFmt* ClaimFrmFmt();
+ void ChgFrmFmt( SwTableBoxFmt *pNewFmt );
+
+ const SwStartNode *GetSttNd() const { return pSttNd; }
+ sal_uLong GetSttIdx() const
+#ifndef DBG_UTIL
+ { return pSttNd ? pSttNd->GetIndex() : 0; }
+#else
+ ;
+#endif
+
+ // suche nach der naechsten/vorherigen Box mit Inhalt
+ SwTableBox* FindNextBox( const SwTable&, const SwTableBox* =0,
+ sal_Bool bOvrTblLns=sal_True ) const;
+ SwTableBox* FindPreviousBox( const SwTable&, const SwTableBox* =0,
+ sal_Bool bOvrTblLns=sal_True ) const;
+ // gebe den Namen dieser Box zurueck. Dieser wird dynamisch bestimmt
+ // und ergibt sich aus der Position in den Lines/Boxen/Tabelle
+ String GetName() const;
+ // gebe den "Wert" der Box zurueck (fuers rechnen in der Tabelle)
+ double GetValue( SwTblCalcPara& rPara ) const;
+
+ sal_Bool IsInHeadline( const SwTable* pTbl = 0 ) const;
+
+ // enthaelt die Box Inhalt, der als Nummer formatiert werden kann?
+ sal_Bool HasNumCntnt( double& rNum, sal_uInt32& rFmtIndex,
+ sal_Bool& rIsEmptyTxtNd ) const;
+ sal_uLong IsValidNumTxtNd( sal_Bool bCheckAttr = sal_True ) const;
+ // teste ob der BoxInhalt mit der Nummer uebereinstimmt, wenn eine
+ // Tabellenformel gesetzt ist. (fuers Redo des Change vom NumFormat!)
+ sal_Bool IsNumberChanged() const;
+
+ // ist das eine FormelBox oder eine Box mit numerischen Inhalt (AutoSum)
+ // Was es ist, besagt der ReturnWert - die WhichId des Attributes
+ // Leere Boxen haben den ReturnWert USHRT_MAX !!
+ sal_uInt16 IsFormulaOrValueBox() const;
+
+ // Loading of a document requires an actualisation of cells with values
+ void ActualiseValueBox();
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwTableBox)
+
+ // zugriff auf interne Daten - z.Z. benutzt fuer den NumFormatter
+ inline const Color* GetSaveUserColor() const;
+ inline const Color* GetSaveNumFmtColor() const;
+ inline void SetSaveUserColor(const Color* p );
+ inline void SetSaveNumFmtColor( const Color* p );
+
+ long getRowSpan() const;
+ void setRowSpan( long nNewRowSpan );
+ bool getDummyFlag() const;
+ void setDummyFlag( bool bDummy );
+
+ SwTableBox& FindStartOfRowSpan( const SwTable&, sal_uInt16 nMaxStep = USHRT_MAX );
+ const SwTableBox& FindStartOfRowSpan( const SwTable& rTable,
+ sal_uInt16 nMaxStep = USHRT_MAX ) const
+ { return const_cast<SwTableBox*>(this)->FindStartOfRowSpan( rTable, nMaxStep ); }
+
+ SwTableBox& FindEndOfRowSpan( const SwTable&, sal_uInt16 nMaxStep = USHRT_MAX );
+ const SwTableBox& FindEndOfRowSpan( const SwTable& rTable,
+ sal_uInt16 nMaxStep = USHRT_MAX ) const
+ { return const_cast<SwTableBox*>(this)->FindEndOfRowSpan( rTable, nMaxStep ); }
+ void RegisterToFormat( SwFmt& rFmt ) ;
+ void ForgetFrmFmt();
+};
+
+class SwCellFrm;
+class SW_DLLPUBLIC SwTableCellInfo : public ::boost::noncopyable
+{
+ struct Impl;
+ ::std::auto_ptr<Impl> m_pImpl;
+
+ const SwCellFrm * getCellFrm() const ;
+
+public:
+ SwTableCellInfo(const SwTable * pTable);
+ ~SwTableCellInfo();
+
+ bool getNext();
+ SwRect getRect() const;
+ const SwTableBox * getTableBox() const;
+};
+
+#endif //_SWTABLE_HXX
diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
new file mode 100644
index 000000000000..86ace11c4e6b
--- /dev/null
+++ b/sw/inc/swtblfmt.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWTBLFMT_HXX
+#define _SWTBLFMT_HXX
+
+#include <frmfmt.hxx>
+
+class SwDoc;
+
+class SW_DLLPUBLIC SwTableFmt : public SwFrmFmt
+{
+ friend class SwDoc;
+
+protected:
+ SwTableFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+ SwFrmFmt *pDrvdFrm )
+ : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FRMFMT, aTableSetRange )
+ {}
+ SwTableFmt( SwAttrPool& rPool, const String &rFmtNm,
+ SwFrmFmt *pDrvdFrm )
+ : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FRMFMT, aTableSetRange )
+ {}
+
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwTableFmt)
+};
+
+class SwTableLineFmt : public SwFrmFmt
+{
+ friend class SwDoc;
+
+protected:
+ SwTableLineFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+ SwFrmFmt *pDrvdFrm )
+ : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FRMFMT, aTableLineSetRange )
+ {}
+ SwTableLineFmt( SwAttrPool& rPool, const String &rFmtNm,
+ SwFrmFmt *pDrvdFrm )
+ : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FRMFMT, aTableLineSetRange )
+ {}
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwTableLineFmt)
+};
+
+class SW_DLLPUBLIC SwTableBoxFmt : public SwFrmFmt
+{
+ friend class SwDoc;
+
+protected:
+ SwTableBoxFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+ SwFrmFmt *pDrvdFrm )
+ : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FRMFMT, aTableBoxSetRange )
+ {}
+ SwTableBoxFmt( SwAttrPool& rPool, const String &rFmtNm,
+ SwFrmFmt *pDrvdFrm )
+ : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FRMFMT, aTableBoxSetRange )
+ {}
+
+ // zum Erkennen von Veraenderungen (haupts. TableBoxAttribute)
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue );
+
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwTableBoxFmt)
+};
+
+
+#endif
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
new file mode 100644
index 000000000000..f09494d3d454
--- /dev/null
+++ b/sw/inc/swtypes.hxx
@@ -0,0 +1,340 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWTYPES_HXX
+#define _SWTYPES_HXX
+#include <tools/solar.h>
+#include <SwGetPoolIdFromName.hxx>
+
+#ifndef INCLUDED_LIMITS_H
+#include <limits.h> //fuer LONG_MAX
+#define INCLUDED_LIMITS_H
+#endif
+
+#ifdef PM20
+#include <stdlib.h>
+#endif
+#include <com/sun/star/uno/Reference.h>
+#include "swdllapi.h"
+#include <i18npool/lang.h>
+// wenn das hier geaendert wird, dann auch im globals.hrc aendern!!!
+//#define SW_FILEFORMAT_40 SOFFICE_FILEFORMAT_40
+
+namespace com { namespace sun { namespace star {
+ namespace linguistic2{
+ class XDictionaryList;
+ class XSpellChecker1;
+ class XHyphenator;
+ class XThesaurus;
+ }
+ namespace beans{
+ class XPropertySet;
+ }
+}}}
+namespace utl{
+ class TransliterationWrapper;
+}
+
+class Size;
+class ResMgr;
+class UniString;
+class ByteString;
+class SwPathFinder;
+class Graphic;
+class OutputDevice;
+class CharClass;
+class LocaleDataWrapper;
+class CollatorWrapper;
+
+typedef long SwTwips;
+#define INVALID_TWIPS LONG_MAX
+#define TWIPS_MAX (LONG_MAX - 1)
+
+#define MM50 283 // 1/2 cm in TWIPS
+// --> OD 2004-06-18 #i19922# - constant for minimal page header/footer height of 1mm
+const SwTwips cMinHdFtHeight = 56;
+
+#define MINFLY 23 //Minimalgroesse fuer FlyFrms
+#define MINLAY 23 //Minimalgroesse anderer Frms
+
+// Default-Spaltenabstand zweier Textspalten entspricht 0.3 cm
+#define DEF_GUTTER_WIDTH (MM50 / 5 * 3)
+
+//Minimale Distance (Abstand zum Text) fuer das BorderAttribut, damit
+//die aligned'en Linien nicht geplaettet werden.
+//28 Twips == 0,4mm
+#define MIN_BORDER_DIST 28
+
+ /* minimaler Dokmentrand */
+const SwTwips lMinBorder = 1134;
+
+//Die Wiesenbreite links neben und ueber dem Dokument.
+//Die halbe Wiesenbreite ist der Abstand zwischen den Seiten.
+#define DOCUMENTBORDER 568L
+#define GAPBETWEENPAGES 284L
+
+//initiale UndoActionCount
+#define UNDO_ACTION_COUNT 20
+
+// Konstante Strings
+SW_DLLPUBLIC extern UniString aEmptyStr; // ""
+extern ByteString aEmptyByteStr; // ""
+SW_DLLPUBLIC extern UniString aDotStr; // '.'
+
+//Zum Einfuegen von Beschriftungen (wie bzw. wo soll eingefuegt werden).
+//Hier weil ein eigenes hxx nicht lohnt und es sonst nirgendwo so recht
+//hinpasst.
+enum SwLabelType
+{
+ LTYPE_TABLE, //Beschriftung einer Tabelle
+ LTYPE_OBJECT, //Beschriftung von Grafik oder OLE
+ LTYPE_FLY, //Beschriftung eines (Text-)Rahmens
+ LTYPE_DRAW //Beschriftung eines Zeichen-Objektes
+};
+
+
+const sal_uInt8 OLD_MAXLEVEL = 5;
+const sal_uInt8 MAXLEVEL = 10; //Ehemals numrule.hxx
+const sal_uInt8 NO_NUM = 200; //Ehemals numrule.hxx
+//const sal_uInt8 NO_NUMBERING = 201; //Ehemals numrule.hxx //#outline level,removed by zhaojianwei
+//const sal_uInt8 NO_INIT = 202; //Ehemals numrule.hxx
+
+// fuer Absaetze mit NO_NUM aber auf unterschiedlichen Leveln
+// DAMIT entfaellt das NO_NUM !!!!
+const sal_uInt8 NO_NUMLEVEL = 0x20; // wird mit den Levels verodert
+
+
+/*
+ * Nette Funktionen als MACRO oder inline
+ */
+
+/* ein KiloByte sind 1024 Byte */
+#define KB 1024
+
+#define SET_CURR_SHELL( shell ) CurrShell aCurr( shell )
+
+// pPathFinder wird von der UI initialisiert. Die Klasse liefert alle
+// benoetigten Pfade.
+extern SwPathFinder *pPathFinder;
+
+// Werte fuer die Einzuege an der Nummerierung und BulletListe
+// (fuer die weiteren Ebenen sind die Werte mit den Ebenen+1 zu
+// multiplizieren; Ebenen 0..4 !!!)
+
+// -> #i30312#
+const sal_uInt16 lBullIndent = 1440/4;
+const short lBullFirstLineOffset = -lBullIndent;
+const sal_uInt16 lNumIndent = 1440/4;
+const short lNumFirstLineOffset = -lNumIndent;
+const short lOutlineMinTextDistance = 216; // 0.15 inch = 0.38 cm
+// <- #i30312#
+
+// Anzahl der SystemField-Types vom SwDoc
+#define INIT_FLDTYPES 32
+// Anzahl der vordefinierten Seq-Feldtypen. Es handelt sich dabei
+// immer um die letzen Felder vor INIT_FLDTYPES
+#define INIT_SEQ_FLDTYPES 4
+
+//Die ehemaligen Rendevouz-Ids leben weiter:
+//Es gibt Ids fuer die Anker (SwFmtAnchor) und ein paar weitere die nur fuer
+//Schnittstellen Bedeutung haben (SwDoc).
+enum RndStdIds
+{
+ FLY_AT_PARA, // anchored at paragraph
+ FLY_AS_CHAR, // anchored as character
+ FLY_AT_PAGE, // anchored at page
+ FLY_AT_FLY, // anchored at frame
+ FLY_AT_CHAR, // anchored at character
+ //Der Rest wird nur fuer SS benutzt.
+ RND_STD_HEADER,
+ RND_STD_FOOTER,
+ RND_STD_HEADERL,
+ RND_STD_HEADERR,
+ RND_STD_FOOTERL,
+ RND_STD_FOOTERR,
+
+ RND_DRAW_OBJECT // ein Draw-Object !! nur fuer die SwDoc-Schnittstelle!
+};
+
+
+extern ResMgr* pSwResMgr; // steht in swapp0.cxx
+#define SW_RES(i) ResId(i,*pSwResMgr)
+#define SW_RESSTR(i) UniString(ResId(i,*pSwResMgr))
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > GetSpellChecker();
+::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > GetHyphenator();
+::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XThesaurus > GetThesaurus();
+::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > GetLinguPropertySet();
+
+// reutns the twip size of this graphic
+SW_DLLPUBLIC Size GetGraphicSizeTwip( const Graphic&, OutputDevice* pOutDev );
+
+
+// Seperator fuer Sprunge im Dokument auf verschiedene Inhalttype
+const sal_Unicode cMarkSeperator = '|';
+extern const sal_Char* __FAR_DATA pMarkToTable; // Strings stehen
+extern const sal_Char* __FAR_DATA pMarkToFrame; // im Init.cxx
+extern const sal_Char* __FAR_DATA pMarkToRegion;
+SW_DLLPUBLIC extern const sal_Char* __FAR_DATA pMarkToOutline;
+extern const sal_Char* __FAR_DATA pMarkToText;
+extern const sal_Char* __FAR_DATA pMarkToGraphic;
+extern const sal_Char* __FAR_DATA pMarkToOLE;
+
+#ifndef DB_DELIM // Ist in OFA definiert!!!
+#define DB_DELIM ((sal_Unicode)0xff) // Datenbank <-> Tabellen-Trenner
+#endif
+
+
+typedef sal_uInt16 SetAttrMode;
+
+namespace nsSetAttrMode
+{
+ const SetAttrMode SETATTR_DEFAULT = 0x0000; // default
+ const SetAttrMode SETATTR_DONTEXPAND = 0x0001; // TextAttribute nicht weiter expand.
+ const SetAttrMode SETATTR_DONTREPLACE = 0x0002; // kein anderes TextAttrib verdraengen
+
+ const SetAttrMode SETATTR_NOTXTATRCHR = 0x0004; // bei Attr ohne Ende kein 0xFF einfuegen
+ const SetAttrMode SETATTR_NOHINTADJUST = 0x0008; // keine Zusammenfassung von Bereichen.
+ const SetAttrMode SETATTR_NOFORMATATTR = 0x0010; // nicht zum FormatAttribut umwandeln
+ const SetAttrMode SETATTR_DONTCHGNUMRULE = 0x0020; // nicht die NumRule veraendern
+ const SetAttrMode SETATTR_APICALL = 0x0040; // called from API (all UI related
+ // functionality will be disabled)
+ /// force hint expand (only matters for hints with CH_TXTATR)
+ const SetAttrMode SETATTR_FORCEHINTEXPAND= 0x0080;
+ /// the inserted item is a copy -- intended for use in ndtxt.cxx
+ const SetAttrMode SETATTR_IS_COPY = 0x0100;
+}
+
+//Umrechnung Twip<-> 1/100 mm fuer UNO
+
+#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
+#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L))
+#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L))
+
+#define SW_ISPRINTABLE( c ) ( c >= ' ' && 127 != c )
+
+#ifndef SW_CONSTASCII_DECL
+#define SW_CONSTASCII_DECL( n, s ) n[sizeof(s)]
+#endif
+#ifndef SW_CONSTASCII_DEF
+#define SW_CONSTASCII_DEF( n, s ) n[sizeof(s)] = s
+#endif
+
+
+#define CHAR_HARDBLANK ((sal_Unicode)0x00A0)
+#define CHAR_HARDHYPHEN ((sal_Unicode)0x2011)
+#define CHAR_SOFTHYPHEN ((sal_Unicode)0x00AD)
+#define CHAR_RLM ((sal_Unicode)0x200F)
+#define CHAR_LRM ((sal_Unicode)0x200E)
+#define CHAR_ZWSP ((sal_Unicode)0x200B)
+#define CHAR_ZWNBSP ((sal_Unicode)0x2060)
+
+
+// returns the APP - CharClass instance - used for all ToUpper/ToLower/...
+SW_DLLPUBLIC CharClass& GetAppCharClass();
+SW_DLLPUBLIC LanguageType GetAppLanguage();
+
+
+#if 0
+// I18N doesn't get this right, can't specify more than one to ignore
+#define SW_COLLATOR_IGNORES ( \
+ ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE | \
+ ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_KANA | \
+ ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_WIDTH )
+#else
+#define SW_COLLATOR_IGNORES ( \
+ ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
+#endif
+
+SW_DLLPUBLIC CollatorWrapper& GetAppCollator();
+SW_DLLPUBLIC CollatorWrapper& GetAppCaseCollator();
+
+SW_DLLPUBLIC const ::utl::TransliterationWrapper& GetAppCmpStrIgnore();
+
+// --> OD 2004-06-30 #i28701# - moved from <frame.hxx>
+//fuer Prepare() zur Benachrichtigung des Inhaltes durch das Layout auf
+//dem kurzen Dienstweg.
+//Der Inhalt sorgt dafuer, dass beim naechsten Aufruf von ::Format() das
+//minimal notwendige berechnet wird.
+enum PrepareHint
+{
+ PREP_BEGIN, //BEGIN
+ PREP_CLEAR = PREP_BEGIN,//Komplett neuformatieren.
+ PREP_WIDOWS_ORPHANS, //Nur Witwen- und Waisen-Regelung pruefen und ggf.
+ //Aufspalten.
+ PREP_FIXSIZE_CHG, //Die FixSize hat sich veraendert.
+ PREP_FOLLOW_FOLLOWS, //Follow ist jetzt moeglicherweise direkter
+ //Nachbar.
+ PREP_ADJUST_FRM, //Groesse per Grow/Shrink Ausrichten ohne zu
+ //Formatieren.
+ PREP_FLY_CHGD, //Ein FlyFrm hat sich (Groesse) veraendert.
+ PREP_FLY_ATTR_CHG, //Ein FlyFrm hat seine Attribute veraendert
+ //(z.B. Umlauf)
+ PREP_FLY_ARRIVE, //Ein FlyFrm ueberlappt den Bereich jetzt neu.
+ PREP_FLY_LEAVE, //Ein FlyFrm hat den Bereich verlassen.
+ PREP_FTN, //Fussnoten-Invalidierung
+ PREP_POS_CHGD, //Position des Frm hat sich verandert
+ //(Zum Fly-Umbruch pruefen). Im void* des Prepare()
+ //wird ein sal_Bool& uebergeben, dieser zeigt mit sal_True,
+ //dass ein Format ausgefuehrt wurde.
+ PREP_UL_SPACE, //UL-Space hat sich veraendert, TxtFrms muessen
+ //den Zeilenabstand neu kalkulieren.
+ PREP_MUST_FIT, //Frm passen machen (aufspalten) auch wenn die
+ //Attribute es nicht erlauben (z.B. zusammenhalten).
+ PREP_WIDOWS, // Ein Follow stellt fest, dass in ihm die Orphans-
+ // regel zuschlaegt und verschickt an seinen
+ // Vorgaenger (Master/Follow) ein PREP_WIDOWS
+ PREP_QUOVADIS, // Wenn eine Fussnote _zwischen_ zwei Absaetzen
+ // aufgespalten werden muss, dann muss der
+ // letzte auf der Seite noch ein QUOVADIS bekommen
+ // damit er den Text hineinformatiert.
+ PREP_BOSS_CHGD, // Wenn ein Frm die Spalte/Seite wechselt, wird dieses
+ // Zusatzprepare zum POS_CHGD im MoveFwd/Bwd
+ // verschickt (Ftn-Nummern joinen etc.)
+ // Die Richtung wird ueber pVoid mitgeteilt:
+ // MoveFwd: pVoid == 0
+ // MoveBwd: pVoid == pOldPage
+ PREP_SWAP, //Grafiken Swappen, fuer Grafiken im sichtbaren
+ //Bereich.
+ PREP_REGISTER, //Registerhaltige Frames invalidieren
+ PREP_FTN_GONE, //Ein Follow verliert eine Fussnote, ggf. kann seine erste
+ //Zeile hochrutschen
+ PREP_MOVEFTN, //eine Fussnote wechselt die Seite, der Inhalt bekommt
+ //zunaechst eine Hoehe von Null, damit nicht zuviel
+ //Unruhe entsteht. Beim Formatieren prueft er, ob er
+ //ueberhaupt passt und wechselt ggf. unbemerkt wieder
+ //die Seite.
+ PREP_ERGOSUM, //wg. Bewegung in FtnFrms QuoVadis/ErgoSum pruefen
+ PREP_END //END
+};
+// <--
+
+#endif
diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx
new file mode 100644
index 000000000000..3506a7e176b9
--- /dev/null
+++ b/sw/inc/swundo.hxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 SWUNDO_HXX
+#define SWUNDO_HXX
+
+#include <vector>
+
+#include <rtl/ustring.hxx>
+
+
+typedef ::std::vector< ::rtl::OUString > SwUndoComments_t;
+
+
+// die Ids fuer StdAktionen
+enum SwUndoId
+{
+ UNDO_EMPTY = 0,
+ UNDO_STD_BEGIN = 1,
+ UNDO_START = UNDO_STD_BEGIN, // 1
+ UNDO_END, // 2
+ REPEAT_START, // alle UndoIds zwischen REPEAT_START und
+ // REPEAT_END sind Repeat-Faehig !!
+ UNDO_DELETE = REPEAT_START, // 3
+ UNDO_INSERT, // 4
+ UNDO_OVERWRITE, // 5
+ UNDO_SPLITNODE, // 6
+ UNDO_INSATTR, // 7
+ UNDO_SETFMTCOLL, // 8
+ UNDO_RESETATTR, // 9
+ UNDO_INSFMTATTR, // 10
+ UNDO_INSDOKUMENT, // 11
+ UNDO_COPY, // 12
+ UNDO_INSTABLE, // 13
+ UNDO_TABLETOTEXT, // 14
+ UNDO_TEXTTOTABLE, // 15
+ UNDO_SORT_TXT, // 16
+ UNDO_INSLAYFMT, // 17
+ UNDO_TABLEHEADLINE, // 18
+ UNDO_INSSECTION, // 19
+ UNDO_OUTLINE_LR, // 20
+ UNDO_OUTLINE_UD, // 21
+ UNDO_INSNUM, // 22
+ UNDO_NUMUP, // 23
+ UNDO_MOVENUM, // 24
+ UNDO_INSDRAWFMT, // 25
+ UNDO_NUMORNONUM, // 26
+ UNDO_INC_LEFTMARGIN, // 27
+ UNDO_DEC_LEFTMARGIN, // 28
+ UNDO_INSERTLABEL, // 29
+ UNDO_SETNUMRULESTART, // 30
+ UNDO_CHGFTN, // 31
+ UNDO_REDLINE, // 32
+ UNDO_ACCEPT_REDLINE, // 33
+ UNDO_REJECT_REDLINE, // 34
+ UNDO_SPLIT_TABLE, // 35
+ UNDO_DONTEXPAND, // 36
+ UNDO_AUTOCORRECT, // 37
+ UNDO_MERGE_TABLE, // 38
+ UNDO_TRANSLITERATE, // 39
+
+ // -> #111827#
+ UNDO_PASTE_CLIPBOARD, // 40
+ UNDO_TYPING, // 41
+ // <- #111827#
+ UNDO_REPEAT_DUMMY_6, // 42
+ UNDO_REPEAT_DUMMY_7, // 43
+ UNDO_REPEAT_DUMMY_8, // 44
+ UNDO_REPEAT_DUMMY_9, // 45
+ REPEAT_END,
+
+ UNDO_MOVE = REPEAT_END, // 46
+ UNDO_INSGLOSSARY, // 47
+ UNDO_DELBOOKMARK, // 48
+ UNDO_INSBOOKMARK, // 49
+ UNDO_SORT_TBL, // 50
+ UNDO_DELLAYFMT, // 51
+ UNDO_AUTOFORMAT, // 52
+ UNDO_REPLACE, // 53
+ UNDO_DELSECTION, // 54
+ UNDO_CHGSECTION, // 55
+ UNDO_CHGSECTIONPASSWD, // 56
+ UNDO_SETDEFTATTR, // 57
+ UNDO_DELNUM, // 58
+ UNDO_DRAWUNDO, // 59
+ UNDO_DRAWGROUP, // 60
+ UNDO_DRAWUNGROUP, // 61
+ UNDO_DRAWDELETE, // 62
+ UNDO_REREAD, // 63
+ UNDO_DELGRF, // 64
+ UNDO_DELOLE, // 65
+ UNDO_TABLE_ATTR, // 66
+ UNDO_TABLE_AUTOFMT, // 67
+ UNDO_TABLE_INSCOL, // 68
+ UNDO_TABLE_INSROW, // 69
+ UNDO_TABLE_DELBOX, // 70
+ UNDO_TABLE_SPLIT, // 71
+ UNDO_TABLE_MERGE, // 72
+ UNDO_TBLNUMFMT, // 73
+ UNDO_INSTOX, // 74
+ UNDO_CLEARTOXRANGE, // 75
+ UNDO_TBLCPYTBL, // 76
+ UNDO_CPYTBL, // 77
+ UNDO_INS_FROM_SHADOWCRSR, // 78
+ UNDO_CHAINE, // 79
+ UNDO_UNCHAIN, // 80
+ UNDO_FTNINFO, // 81
+ UNDO_ENDNOTEINFO, // 82
+ UNDO_COMPAREDOC, // 83
+ UNDO_SETFLYFRMFMT, // 84
+ UNDO_SETRUBYATTR, // 85
+
+ UNDO_TMPAUTOCORR, // 86 #102505#
+ UNDO_TOXCHANGE, // 87
+ UNDO_CREATE_PAGEDESC, // 88
+ UNDO_CHANGE_PAGEDESC, // 89
+ UNDO_DELETE_PAGEDESC, // 90
+ UNDO_HEADER_FOOTER, // 91 #i7983#
+ UNDO_FIELD, // 92 #111840#
+ UNDO_TXTFMTCOL_CREATE, // 93
+ UNDO_TXTFMTCOL_DELETE, // 94
+ UNDO_TXTFMTCOL_RENAME, // 95
+ UNDO_CHARFMT_CREATE, // 96
+ UNDO_CHARFMT_DELETE, // 97
+ UNDO_CHARFMT_RENAME, // 98
+ UNDO_FRMFMT_CREATE, // 99
+ UNDO_FRMFMT_DELETE, // 100
+ UNDO_FRMFMT_RENAME, // 101
+ UNDO_NUMRULE_CREATE,// 102
+ UNDO_NUMRULE_DELETE,// 103
+ UNDO_NUMRULE_RENAME,// 104
+ UNDO_BOOKMARK_RENAME, // 105
+ UNDO_INDEX_ENTRY_INSERT, // 106
+ UNDO_INDEX_ENTRY_DELETE, // 107
+ UNDO_COL_DELETE, // 108
+ UNDO_ROW_DELETE, // 109
+ UNDO_RENAME_PAGEDESC, // 110
+ UNDO_NUMDOWN, // 111
+ // --> OD 2009-07-16 #i73249#
+ UNDO_FLYFRMFMT_TITLE, // 112
+ UNDO_FLYFRMFMT_DESCRIPTION, // 113
+ // <--
+ UNDO_STD_END= UNDO_FLYFRMFMT_DESCRIPTION,
+
+ // UI undo ID's...
+ UNDO_UI_REPLACE = UNDO_STD_END + 1,
+ UNDO_UI_INSERT_PAGE_BREAK,
+ UNDO_UI_INSERT_COLUMN_BREAK,
+ UNDO_UI_PLAY_MACRO,
+ UNDO_UI_INSERT_ENVELOPE,
+ UNDO_UI_DRAG_AND_COPY,
+ UNDO_UI_DRAG_AND_MOVE,
+ UNDO_UI_INSERT_RULER,
+ UNDO_UI_INSERT_CHART,
+ UNDO_UI_INSERT_FOOTNOTE,
+ UNDO_UI_INSERT_URLBTN,
+ UNDO_UI_INSERT_URLTXT,
+ UNDO_UI_DELETE_INVISIBLECNTNT,
+ UNDO_UI_REPLACE_STYLE
+};
+
+
+#endif
diff --git a/sw/inc/swunodef.hxx b/sw/inc/swunodef.hxx
new file mode 100644
index 000000000000..e63514e11f1a
--- /dev/null
+++ b/sw/inc/swunodef.hxx
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWUNODEF_HXX
+#define _SWUNODEF_HXX
+
+#define STAR_NMSPC ::com::sun::star
+#define UNO_NMSPC STAR_NMSPC::uno
+#define CLIP_NMSPC STAR_NMSPC::datatransfer::clipboard
+
+#define STAR_REFERENCE(aType) UNO_NMSPC::Reference< STAR_NMSPC::aType >
+
+#endif
diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx
new file mode 100644
index 000000000000..f2623f48aa3b
--- /dev/null
+++ b/sw/inc/swunohelper.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWUNOHELPER_HXX
+#define _SWUNOHELPER_HXX
+
+#include <tools/solar.h>
+#include <sal/types.h>
+#include "swdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class Any;
+ }
+}}}
+
+class String;
+class SvStrings;
+class SvPtrarr;
+
+namespace SWUnoHelper {
+
+// calls over the compherl the getEnumAsInt32 function and handle the
+// exceptions.
+sal_Int32 GetEnumAsInt32( const com::sun::star::uno::Any& rVal );
+
+
+// methods for UCB actions:
+ // delete the file under this URL
+SW_DLLPUBLIC sal_Bool UCB_DeleteFile( const String& rURL );
+
+ // copy/move the file to a new location
+sal_Bool UCB_CopyFile( const String& rURL, const String& rNewURL,
+ sal_Bool bCopyIsMove = sal_False );
+
+ // is the URL on the current system case sentive?
+SW_DLLPUBLIC sal_Bool UCB_IsCaseSensitiveFileName( const String& rURL );
+
+ // is the URL readonly?
+SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const String& rURL );
+
+ // get a list of files from the folder of the URL
+ // options: pExtension = 0 -> all, else this specific extension
+ // pDateTime != 0 -> returns also the modified date/time of
+ // the files in a SvPtrarr -->
+ // !! objects must be deleted from the caller!!
+sal_Bool UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList,
+ const String* pExtension = 0,
+ SvPtrarr* pDateTimeList = 0 );
+
+ // is the URL an existing file?
+SW_DLLPUBLIC sal_Bool UCB_IsFile( const String& rURL );
+
+ // is the URL a existing directory?
+sal_Bool UCB_IsDirectory( const String& rURL );
+}
+
+#endif
diff --git a/sw/inc/swurl.hxx b/sw/inc/swurl.hxx
new file mode 100644
index 000000000000..07f4b0631d78
--- /dev/null
+++ b/sw/inc/swurl.hxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWURL_HXX
+#define _SWURL_HXX
+
+#include <tools/solar.h>
+
+
+class UniString;
+class ViewShell;
+
+#define URLLOAD_NOFILTER 0x0000
+#define URLLOAD_NEWVIEW 0x8000
+
+
+void LoadURL( const UniString& rName, ViewShell* pSh,
+ sal_uInt16 nFilter = URLLOAD_NOFILTER,
+ const UniString *pTargetFrameName = 0 );
+
+
+
+#endif
diff --git a/sw/inc/swwait.hxx b/sw/inc/swwait.hxx
new file mode 100644
index 000000000000..19fb6cfb40a3
--- /dev/null
+++ b/sw/inc/swwait.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWWAIT_HXX
+#define _SWWAIT_HXX
+
+#include <tools/solar.h>
+#include "swdllapi.h"
+
+class SwDocShell;
+
+class SW_DLLPUBLIC SwWait
+{
+ SwDocShell &rDoc;
+ sal_Bool bLock;
+public:
+ SwWait( SwDocShell &rDocShell, sal_Bool bLockDispatcher );
+ ~SwWait();
+};
+
+#endif
diff --git a/sw/inc/tabcol.hxx b/sw/inc/tabcol.hxx
new file mode 100644
index 000000000000..abbb7dcf9933
--- /dev/null
+++ b/sw/inc/tabcol.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TABCOL_HXX
+#define _TABCOL_HXX
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_LONGS
+#define _SVSTDARR_BOOLS
+#include <svl/svstdarr.hxx>
+#endif
+
+#ifndef INCLUDED_VECTOR
+#include <vector>
+#define INCLUDED_VECTOR
+#endif
+#include "swdllapi.h"
+
+struct SwTabColsEntry
+{
+ long nPos;
+ long nMin;
+ long nMax;
+ sal_Bool bHidden; //Fuer jeden Eintrag ein Flag, Hidden oder nicht.
+ //Wenn das Flag Hidden sal_True ist liegt der Spalten-
+ //trenner nicht in der aktuellen Zeile; er muss
+ //mit gepflegt werden, darf aber nicht angezeigt
+ //werden.
+};
+
+typedef std::vector< SwTabColsEntry > SwTabColsEntries;
+
+class SW_DLLPUBLIC SwTabCols
+{
+ long nLeftMin, //Linker aeusserer Rand (Bezugspunkt) in
+ //Dokumentkordinaten.
+ //Alle anderen Werte relativ zu diesem Punkt!
+ nLeft, //Linker Rand der Tabelle.
+ nRight, //Rechter Rand der Tabelle.
+ nRightMax; //Maximaler rechter Rand der Tabelle.
+
+ bool bLastRowAllowedToChange; // if the last row of the table frame
+ // is split across pages, it may not
+ // change its size
+
+ SwTabColsEntries aData;
+
+ //fuer den CopyCTor
+ const SwTabColsEntries& GetData() const { return aData; }
+
+public:
+ SwTabCols( sal_uInt16 nSize = 0 );
+ SwTabCols( const SwTabCols& );
+ SwTabCols &operator=( const SwTabCols& );
+ sal_Bool operator==( const SwTabCols& rCmp ) const;
+ long& operator[]( sal_uInt16 nPos ) { return aData[nPos].nPos; }
+ long operator[]( sal_uInt16 nPos ) const { return aData[nPos].nPos; }
+ sal_uInt16 Count() const { return sal::static_int_cast< sal_uInt16 >(aData.size()); }
+
+ sal_Bool IsHidden( sal_uInt16 nPos ) const { return aData[nPos].bHidden; }
+ void SetHidden( sal_uInt16 nPos, sal_Bool bValue ) { aData[nPos].bHidden = bValue; }
+
+ void Insert( long nValue, sal_Bool bValue, sal_uInt16 nPos );
+ void Insert( long nValue, long nMin, long nMax, sal_Bool bValue, sal_uInt16 nPos );
+ void Remove( sal_uInt16 nPos, sal_uInt16 nAnz = 1 );
+
+ const SwTabColsEntry& GetEntry( sal_uInt16 nPos ) const { return aData[nPos]; }
+ SwTabColsEntry& GetEntry( sal_uInt16 nPos ) { return aData[nPos]; }
+
+ long GetLeftMin() const { return nLeftMin; }
+ long GetLeft() const { return nLeft; }
+ long GetRight() const { return nRight; }
+ long GetRightMax()const { return nRightMax;}
+
+ void SetLeftMin ( long nNew ) { nLeftMin = nNew; }
+ void SetLeft ( long nNew ) { nLeft = nNew; }
+ void SetRight ( long nNew ) { nRight = nNew; }
+ void SetRightMax( long nNew ) { nRightMax = nNew;}
+
+ bool IsLastRowAllowedToChange() const { return bLastRowAllowedToChange; }
+ void SetLastRowAllowedToChange( bool bNew ) { bLastRowAllowedToChange = bNew; }
+};
+
+#endif //_TABCOL_HXX
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
new file mode 100644
index 000000000000..99324909e20c
--- /dev/null
+++ b/sw/inc/tblafmt.hxx
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TBLAFMT_HXX
+#define _TBLAFMT_HXX
+/*************************************************************************
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+JP 20.07.95:
+
+ Die akt. Struktur der Autoformatierung darf nicht mehr veraendert werden.
+ Diese wird durch unterschiedlichen Code vom StartWriter und vom StarCalc
+ eingelesen/geschrieben.
+ Sollte sich doch mal eine Aenderung nicht vermeiden lassen, dann auf
+ jedenfall in beiden Applikationen aendern.
+
+ The structure of table auto formatting should not changed. It is used
+ by different code of Writer and Calc. If a change is necessary, the
+ source code of both applications must be changed!
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+**************************************************************************/
+
+#include <svl/svarray.hxx>
+#include "hintids.hxx" //_immmer_ vor den solar-items!
+#include <svx/algitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#ifndef _SVX_CNTRTITEM_HXX //autogen
+#include <editeng/cntritem.hxx>
+#endif
+#include <editeng/shdditem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/rotmodit.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/bolnitem.hxx>
+#include "swdllapi.h"
+
+struct SwAfVersions;
+
+class SvNumberFormatter;
+
+class SwBoxAutoFmt
+{
+ // common attributes of Calc and Writer
+ // --- from 641 on: CJK and CTL font settings
+ SvxFontItem aFont;
+ SvxFontHeightItem aHeight;
+ SvxWeightItem aWeight;
+ SvxPostureItem aPosture;
+
+ SvxFontItem aCJKFont;
+ SvxFontHeightItem aCJKHeight;
+ SvxWeightItem aCJKWeight;
+ SvxPostureItem aCJKPosture;
+
+ SvxFontItem aCTLFont;
+ SvxFontHeightItem aCTLHeight;
+ SvxWeightItem aCTLWeight;
+ SvxPostureItem aCTLPosture;
+
+ SvxUnderlineItem aUnderline;
+ SvxOverlineItem aOverline;
+ SvxCrossedOutItem aCrossedOut;
+ SvxContourItem aContour;
+ SvxShadowedItem aShadowed;
+ SvxColorItem aColor;
+ SvxBoxItem aBox;
+ SvxLineItem aTLBR;
+ SvxLineItem aBLTR;
+ SvxBrushItem aBackground;
+
+ // Writer specific
+ SvxAdjustItem aAdjust;
+
+ // Calc specific
+ SvxHorJustifyItem aHorJustify;
+ SvxVerJustifyItem aVerJustify;
+ SfxBoolItem aStacked;
+ SvxMarginItem aMargin;
+ SfxBoolItem aLinebreak;
+ SfxInt32Item aRotateAngle;
+ SvxRotateModeItem aRotateMode;
+
+ // number format
+ String sNumFmtString;
+ LanguageType eSysLanguage, eNumFmtLanguage;
+
+public:
+ SwBoxAutoFmt();
+ SwBoxAutoFmt( const SwBoxAutoFmt& rNew );
+ ~SwBoxAutoFmt();
+
+ int operator==( const SwBoxAutoFmt& rCmp ) const;
+ SwBoxAutoFmt& operator=( const SwBoxAutoFmt& rNew );
+
+ // die Get-Methoden
+ const SvxFontItem &GetFont() const { return aFont; }
+ const SvxFontHeightItem &GetHeight() const { return aHeight; }
+ const SvxWeightItem &GetWeight() const { return aWeight; }
+ const SvxPostureItem &GetPosture() const { return aPosture; }
+ const SvxFontItem &GetCJKFont() const { return aCJKFont; }
+ const SvxFontHeightItem &GetCJKHeight() const { return aCJKHeight; }
+ const SvxWeightItem &GetCJKWeight() const { return aCJKWeight; }
+ const SvxPostureItem &GetCJKPosture() const { return aCJKPosture; }
+ const SvxFontItem &GetCTLFont() const { return aCTLFont; }
+ const SvxFontHeightItem &GetCTLHeight() const { return aCTLHeight; }
+ const SvxWeightItem &GetCTLWeight() const { return aCTLWeight; }
+ const SvxPostureItem &GetCTLPosture() const { return aCTLPosture; }
+ const SvxUnderlineItem &GetUnderline() const { return aUnderline; }
+ const SvxOverlineItem &GetOverline() const { return aOverline; }
+ const SvxCrossedOutItem &GetCrossedOut() const { return aCrossedOut; }
+ const SvxContourItem &GetContour() const { return aContour; }
+ const SvxShadowedItem &GetShadowed() const { return aShadowed; }
+ const SvxColorItem &GetColor() const { return aColor; }
+ const SvxAdjustItem &GetAdjust() const { return aAdjust; }
+ const SvxBoxItem &GetBox() const { return aBox; }
+ const SvxLineItem &GetTLBR() const { return aTLBR; }
+ const SvxLineItem &GetBLTR() const { return aBLTR; }
+ const SvxBrushItem &GetBackground() const { return aBackground; }
+ void GetValueFormat( String& rFmt, LanguageType& rLng, LanguageType& rSys ) const
+ { rFmt = sNumFmtString; rLng = eNumFmtLanguage; rSys = eSysLanguage; }
+
+ // die SetMethoden
+ void SetFont( const SvxFontItem& rNew ) { aFont = rNew; }
+ void SetHeight( const SvxFontHeightItem& rNew ) { aHeight = rNew; }
+ void SetWeight( const SvxWeightItem& rNew ) { aWeight = rNew; }
+ void SetPosture( const SvxPostureItem& rNew ) { aPosture = rNew; }
+ void SetCJKFont( const SvxFontItem& rNew ) { aCJKFont = rNew; }
+ void SetCJKHeight( const SvxFontHeightItem& rNew ) { aCJKHeight = rNew; }
+ void SetCJKWeight( const SvxWeightItem& rNew ) { aCJKWeight = rNew; }
+ void SetCJKPosture( const SvxPostureItem& rNew ) { aCJKPosture = rNew; }
+ void SetCTLFont( const SvxFontItem& rNew ) { aCTLFont = rNew; }
+ void SetCTLHeight( const SvxFontHeightItem& rNew ) { aCTLHeight = rNew; }
+ void SetCTLWeight( const SvxWeightItem& rNew ) { aCTLWeight = rNew; }
+ void SetCTLPosture( const SvxPostureItem& rNew ) { aCTLPosture = rNew; }
+ void SetUnderline( const SvxUnderlineItem& rNew ) { aUnderline = rNew; }
+ void SetOverline( const SvxOverlineItem& rNew ) { aOverline = rNew; }
+ void SetCrossedOut( const SvxCrossedOutItem& rNew ) { aCrossedOut = rNew; }
+ void SetContour( const SvxContourItem& rNew ) { aContour = rNew; }
+ void SetShadowed( const SvxShadowedItem& rNew ) { aShadowed = rNew; }
+ void SetColor( const SvxColorItem& rNew ) { aColor = rNew; }
+ void SetAdjust( const SvxAdjustItem& rNew )
+ {
+ aAdjust.SetAdjust( rNew.GetAdjust() );
+ aAdjust.SetOneWord( rNew.GetOneWord() );
+ aAdjust.SetLastBlock( rNew.GetLastBlock() );
+ }
+ void SetBox( const SvxBoxItem& rNew ) { aBox = rNew; }
+ void SetBackground( const SvxBrushItem& rNew ) { aBackground = rNew; }
+ void SetValueFormat( const String& rFmt, LanguageType eLng, LanguageType eSys )
+ { sNumFmtString = rFmt; eNumFmtLanguage = eLng; eSysLanguage = eSys; }
+
+ sal_Bool Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer );
+ sal_Bool Save( SvStream& rStream ) const;
+ sal_Bool SaveVerionNo( SvStream& rStream ) const;
+
+#ifdef READ_OLDVERS
+ // lade alte Version
+ sal_Bool LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] );
+#endif
+};
+
+class SW_DLLPUBLIC SwTableAutoFmt
+{
+ friend void _FinitCore(); // zum Zerstoeren des dflt. Pointers
+ static SwBoxAutoFmt* pDfltBoxAutoFmt;
+
+ String aName;
+ sal_uInt16 nStrResId;
+
+ // common flags of Calc and Writer
+ sal_Bool bInclFont : 1;
+ sal_Bool bInclJustify : 1;
+ sal_Bool bInclFrame : 1;
+ sal_Bool bInclBackground : 1;
+ sal_Bool bInclValueFormat : 1;
+
+ // Calc specific flags
+ sal_Bool bInclWidthHeight : 1;
+
+ SwBoxAutoFmt* aBoxAutoFmt[ 16 ];
+
+public:
+ SwTableAutoFmt( const String& rName );
+ SwTableAutoFmt( const SwTableAutoFmt& rNew );
+ ~SwTableAutoFmt();
+
+ SwTableAutoFmt& operator=( const SwTableAutoFmt& rNew );
+
+ void SetBoxFmt( const SwBoxAutoFmt& rNew, sal_uInt8 nPos );
+ const SwBoxAutoFmt& GetBoxFmt( sal_uInt8 nPos ) const;
+
+ void SetName( const String& rNew ) { aName = rNew; nStrResId = USHRT_MAX; }
+ const String& GetName() const { return aName; }
+
+ enum UpdateFlags { UPDATE_CHAR = 1, UPDATE_BOX = 2, UPDATE_ALL = 3 };
+ SwBoxAutoFmt& UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet,
+ UpdateFlags eFlags, SvNumberFormatter* );
+ void UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet, UpdateFlags eFlags,
+ SvNumberFormatter* ) const ;
+
+ sal_Bool IsFont() const { return bInclFont; }
+ sal_Bool IsJustify() const { return bInclJustify; }
+ sal_Bool IsFrame() const { return bInclFrame; }
+ sal_Bool IsBackground() const { return bInclBackground; }
+ sal_Bool IsValueFormat() const { return bInclValueFormat; }
+
+ void SetFont( const sal_Bool bNew ) { bInclFont = bNew; }
+ void SetJustify( const sal_Bool bNew ) { bInclJustify = bNew; }
+ void SetFrame( const sal_Bool bNew ) { bInclFrame = bNew; }
+ void SetBackground( const sal_Bool bNew ) { bInclBackground = bNew; }
+ void SetValueFormat( const sal_Bool bNew ) { bInclValueFormat = bNew; }
+ void SetWidthHeight( const sal_Bool bNew ) { bInclWidthHeight = bNew; }
+
+ sal_Bool Load( SvStream& rStream, const SwAfVersions& );
+ sal_Bool Save( SvStream& rStream ) const;
+
+#ifdef READ_OLDVERS
+ // lade alte Version
+ sal_Bool LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] );
+#endif
+};
+
+typedef SwTableAutoFmt* SwTableAutoFmtPtr ;
+SV_DECL_PTRARR_DEL( _SwTableAutoFmtTbl, SwTableAutoFmtPtr, 1, 5 )
+
+class SW_DLLPUBLIC SwTableAutoFmtTbl : public _SwTableAutoFmtTbl
+{
+ SW_DLLPRIVATE sal_Bool Load( SvStream& rStream );
+ SW_DLLPRIVATE sal_Bool Save( SvStream& rStream ) const;
+
+public:
+ SwTableAutoFmtTbl();
+
+ sal_Bool Load();
+ sal_Bool Save() const;
+};
+
+#endif
diff --git a/sw/inc/tblenum.hxx b/sw/inc/tblenum.hxx
new file mode 100644
index 000000000000..e5ca58c3df78
--- /dev/null
+++ b/sw/inc/tblenum.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TBLENUM_HXX
+#define _TBLENUM_HXX
+
+//fuers aendern der Tabellen/Spalten/Zeilen Breiten/Hoehen
+typedef sal_uInt16 TblChgWidthHeightType;
+
+namespace nsTblChgWidthHeightType
+{
+ const TblChgWidthHeightType WH_COL_LEFT = 0;
+ const TblChgWidthHeightType WH_COL_RIGHT = 1;
+ const TblChgWidthHeightType WH_ROW_TOP = 2;
+ const TblChgWidthHeightType WH_ROW_BOTTOM = 3;
+ const TblChgWidthHeightType WH_CELL_LEFT = 4;
+ const TblChgWidthHeightType WH_CELL_RIGHT = 5;
+ const TblChgWidthHeightType WH_CELL_TOP = 6;
+ const TblChgWidthHeightType WH_CELL_BOTTOM = 7;
+
+
+ // folgende koennen hinein verodert werden
+ const TblChgWidthHeightType WH_FLAG_INSDEL = 0x4000; // Insert/Del-Modus: das Bigger-Flag
+ // besagt was passiert:
+ // bBigger -> Box wird entfernt
+ // !bBigger-> Box wird eingefuegt
+ const TblChgWidthHeightType WH_FLAG_BIGGER = 0x8000; // Box wird groesser -> sonst kleiner
+}
+
+enum TblChgMode
+{
+ TBLFIX_CHGABS, // Tabelle feste Breite, den Nachbar andern
+ TBLFIX_CHGPROP, // Tabelle feste Breite, alle Nachbarn aendern
+ TBLVAR_CHGABS // Tabelle variable, alle Nachbarn aendern
+};
+
+
+enum SplitTbl_HeadlineOption
+{
+ HEADLINE_NONE = 0, // lasse alles wie es ist
+ HEADLINE_BORDERCOPY, // von der davor obere Line der vorhergehen Line
+ HEADLINE_CNTNTCOPY, // kopiere die 1. Line komplett mit Inhalt
+ HEADLINE_BOXATTRCOPY, // kopiere von der 1. Line die Box Attribute
+ HEADLINE_BOXATRCOLLCOPY // kopiere von der 1. Line die Box Attribute
+ // und die Absatzvorlagen
+};
+
+enum TableMergeErr
+{
+ TBLMERGE_OK,
+ TBLMERGE_NOSELECTION,
+ TBLMERGE_TOOCOMPLEX
+};
+
+
+#endif
diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx
new file mode 100644
index 000000000000..f284c1597ed9
--- /dev/null
+++ b/sw/inc/tblsel.hxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TBLSEL_HXX
+#define _TBLSEL_HXX
+
+#include <svl/svarray.hxx>
+#include <swtable.hxx>
+#include <swrect.hxx>
+#include "swdllapi.h"
+
+class SwCrsrShell;
+class SwCursor;
+class SwTableCursor;
+class SwFrm;
+class SwTabFrm;
+class SwTableBox;
+class SwTableLine;
+class SwLayoutFrm;
+class SwPaM;
+class SwNode;
+class SwTable;
+class SwUndoTblMerge;
+class SwCellFrm;
+
+SV_DECL_PTRARR( SwCellFrms, SwCellFrm*, 16, 16 )
+SV_DECL_PTRARR_SORT( SwSelBoxes, SwTableBoxPtr, 10, 20 )
+
+
+//Sucht alle Boxen zusammen, die in der Tabelle selektiert sind.
+//Je nach enum-Parameter wird die Selektion in der angegebenen Richtung
+//erweitert.
+//Die Boxen werden ueber das Layout zusammengsucht, es wird auch bei
+//aufgespaltenen Tabellen korrekt gearbeitet (siehe: MakeSelUnions()).
+typedef sal_uInt16 SwTblSearchType;
+namespace nsSwTblSearchType
+{
+ const SwTblSearchType TBLSEARCH_NONE = 0x1; // keine Erweiterung
+ const SwTblSearchType TBLSEARCH_ROW = 0x2; // erweiter auf Zeilen
+ const SwTblSearchType TBLSEARCH_COL = 0x3; // erweiter auf Spalten
+
+ // als Flag zu den anderen Werten!!
+ const SwTblSearchType TBLSEARCH_PROTECT = 0x8; // auch geschuetzte Boxen einsammeln
+ const SwTblSearchType TBLSEARCH_NO_UNION_CORRECT = 0x10; // die zusammenges. Union nicht korrigieren
+}
+
+SW_DLLPUBLIC void GetTblSel( const SwCrsrShell& rShell, SwSelBoxes& rBoxes,
+ const SwTblSearchType = nsSwTblSearchType::TBLSEARCH_NONE );
+
+void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes,
+ const SwTblSearchType = nsSwTblSearchType::TBLSEARCH_NONE );
+
+//wie vor, jedoch wird nicht von der Selektion sondern von den
+//Start- EndFrms ausgegangen.
+void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd,
+ SwSelBoxes& rBoxes, SwCellFrms* pCells,
+ const SwTblSearchType = nsSwTblSearchType::TBLSEARCH_NONE );
+
+// Desgleichen nocheinmal direkt per PaM's
+void GetTblSelCrs( const SwCrsrShell& rShell, SwSelBoxes& rBoxes );
+void GetTblSelCrs( const SwTableCursor& rTblCrsr, SwSelBoxes& rBoxes );
+
+// suche fuer eine AutoSumme die beteiligten Boxen zusammen
+sal_Bool GetAutoSumSel( const SwCrsrShell&, SwCellFrms& );
+
+// check if the SelBoxes contains protected Boxes
+sal_Bool HasProtectedCells( const SwSelBoxes& rBoxes );
+
+// teste, ob die Selektion ausgeglichen ist
+SV_DECL_PTRARR( SwChartBoxes, SwTableBoxPtr, 16, 16)
+SV_DECL_PTRARR_DEL( SwChartLines, SwChartBoxes*, 25, 50)
+
+sal_Bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd,
+ SwChartLines* pGetCLines = 0 );
+
+// teste ob die Celle in die SSelection gehoert
+// (wurde eine Funktion, damit GetTblSel() und MakeTblCrsr() immer
+// das "gleiche Verstaendnis" fuer die Selektion haben)
+sal_Bool IsFrmInTblSel( const SwRect& rUnion, const SwFrm* pCell );
+
+// bestimme die Boxen, die zusammen gefasst werden sollen.
+// Dabei wird auf Layout Basis das Rechteck "angepasst". D.H. es
+// werden Boxen zugefuegt wenn welche an den Seiten ueberlappen
+// Zusaetzlich wird die neue Box erzeugt und mit dem entsprechenden
+// Inhalt gefuellt.
+void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
+ SwTableBox** ppMergeBox, SwUndoTblMerge* pUndo = 0 );
+
+// teste ob die selektierten Boxen ein gueltiges Merge erlauben
+sal_uInt16 CheckMergeSel( const SwPaM& rPam );
+sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes );
+
+sal_Bool IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam );
+
+// teste ob ein Split oder InsertCol dazu fuehrt, das eine Box
+// kleiner als MINLAY wird.
+sal_Bool CheckSplitCells( const SwCrsrShell& rShell, sal_uInt16 nDiv,
+ const SwTblSearchType = nsSwTblSearchType::TBLSEARCH_NONE );
+sal_Bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv,
+ const SwTblSearchType = nsSwTblSearchType::TBLSEARCH_NONE );
+
+//Fuer das Arbeiten auf TabSelektion auch fuer aufgespaltene Tabellen.
+class SwSelUnion
+{
+ SwRect aUnion; //Das die Sel umschliessende Rechteck.
+ SwTabFrm *pTable; //Die (Follow-)Table zu der Union.
+
+public:
+ SwSelUnion( const SwRect &rRect, SwTabFrm *pTab ) :
+ aUnion( rRect ), pTable( pTab ) {}
+
+ const SwRect& GetUnion() const { return aUnion; }
+ SwRect& GetUnion() { return aUnion; }
+ const SwTabFrm *GetTable() const { return pTable; }
+ SwTabFrm *GetTable() { return pTable; }
+};
+
+SV_DECL_PTRARR_DEL( SwSelUnions, SwSelUnion*, 10, 20 )
+
+//Ermittelt die von einer Tabellenselektion betroffenen Tabellen und die
+//Union-Rechteckte der Selektionen - auch fuer aufgespaltene Tabellen.
+//Wenn ein Parameter != nsSwTblSearchType::TBLSEARCH_NONE uebergeben wird, so wird die
+//Selektion in der angegebenen Richtung erweitert.
+void MakeSelUnions( SwSelUnions&, const SwLayoutFrm *pStart,
+ const SwLayoutFrm *pEnd,
+ const SwTblSearchType = nsSwTblSearchType::TBLSEARCH_NONE );
+
+
+// -------------------------------------------------------------------
+// Diese Klassen kopieren die aktuelle Tabellen-Selektion (rBoxes)
+// unter Beibehaltung der Tabellen-Strubktur in eine eigene Struktur
+
+class _FndBox;
+class _FndLine;
+
+SV_DECL_PTRARR_DEL( _FndBoxes, _FndBox*, 10, 20 )
+SV_DECL_PTRARR_DEL( _FndLines, _FndLine*,10, 20 )
+
+class _FndBox
+{
+ SwTableBox* pBox;
+ _FndLines aLines;
+ _FndLine* pUpper;
+
+ SwTableLine *pLineBefore; //Zum Loeschen/Restaurieren des Layouts.
+ SwTableLine *pLineBehind;
+
+public:
+ _FndBox( SwTableBox* pB, _FndLine* pFL ) :
+ pBox(pB), pUpper(pFL), pLineBefore( 0 ), pLineBehind( 0 ) {}
+
+ const _FndLines& GetLines() const { return aLines; }
+ _FndLines& GetLines() { return aLines; }
+ const SwTableBox* GetBox() const { return pBox; }
+ SwTableBox* GetBox() { return pBox; }
+ const _FndLine* GetUpper() const { return pUpper; }
+ _FndLine* GetUpper() { return pUpper; }
+
+ void SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable );
+ void SetTableLines( const SwTable &rTable );
+ void DelFrms ( SwTable &rTable );
+ void MakeFrms( SwTable &rTable );
+ void MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber,
+ const sal_Bool bBehind );
+ sal_Bool AreLinesToRestore( const SwTable &rTable ) const;
+
+ void ClearLineBehind() { pLineBehind = 0; }
+};
+
+
+class _FndLine
+{
+ SwTableLine* pLine;
+ _FndBoxes aBoxes;
+ _FndBox* pUpper;
+public:
+ _FndLine(SwTableLine* pL, _FndBox* pFB=0) : pLine(pL), pUpper(pFB) {}
+ const _FndBoxes& GetBoxes() const { return aBoxes; }
+ _FndBoxes& GetBoxes() { return aBoxes; }
+ const SwTableLine* GetLine() const { return pLine; }
+ SwTableLine* GetLine() { return pLine; }
+ const _FndBox* GetUpper() const { return pUpper; }
+ _FndBox* GetUpper() { return pUpper; }
+
+ void SetUpper( _FndBox* pUp ) { pUpper = pUp; }
+};
+
+
+struct _FndPara
+{
+ const SwSelBoxes& rBoxes;
+ _FndLine* pFndLine;
+ _FndBox* pFndBox;
+
+ _FndPara( const SwSelBoxes& rBxs, _FndBox* pFB )
+ : rBoxes(rBxs), pFndLine(0), pFndBox(pFB) {}
+ _FndPara( const _FndPara& rPara, _FndBox* pFB )
+ : rBoxes(rPara.rBoxes), pFndLine(rPara.pFndLine), pFndBox(pFB) {}
+ _FndPara( const _FndPara& rPara, _FndLine* pFL )
+ : rBoxes(rPara.rBoxes), pFndLine(pFL), pFndBox(rPara.pFndBox) {}
+};
+
+sal_Bool _FndBoxCopyCol( const SwTableBox*& rpBox, void* pPara );
+SW_DLLPUBLIC sal_Bool _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara );
+
+
+#endif // _TBLSEL_HXX
diff --git a/sw/inc/tgrditem.hxx b/sw/inc/tgrditem.hxx
new file mode 100644
index 000000000000..267aeacb7793
--- /dev/null
+++ b/sw/inc/tgrditem.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_TGRDITEM_HXX
+#define SW_TGRDITEM_HXX
+
+#include <tools/color.hxx>
+#include <svl/poolitem.hxx>
+#include "swdllapi.h"
+#include <hintids.hxx>
+#include <format.hxx>
+
+class IntlWrapper;
+
+enum SwTextGrid { GRID_NONE, GRID_LINES_ONLY, GRID_LINES_CHARS };
+
+class SW_DLLPUBLIC SwTextGridItem : public SfxPoolItem
+{
+ Color aColor;
+ sal_uInt16 nLines;
+ sal_uInt16 nBaseHeight, nRubyHeight;
+ SwTextGrid eGridType;
+ sal_Bool bRubyTextBelow;
+ sal_Bool bPrintGrid;
+ sal_Bool bDisplayGrid;
+
+ //for textgrid enhancement
+ sal_uInt16 nBaseWidth;
+ sal_Bool bSnapToChars;
+ sal_Bool bSquaredMode;
+public:
+ SwTextGridItem();
+ virtual ~SwTextGridItem();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ SwTextGridItem& operator=( const SwTextGridItem& );
+
+ const Color& GetColor() const { return aColor; }
+ void SetColor( const Color& rCol ) { aColor = rCol; }
+
+ sal_uInt16 GetLines() const { return nLines; }
+ void SetLines( sal_uInt16 nNew ) { nLines = nNew; }
+
+ sal_uInt16 GetBaseHeight() const { return nBaseHeight; }
+ void SetBaseHeight( sal_uInt16 nNew ) { nBaseHeight = nNew; }
+
+ sal_uInt16 GetRubyHeight() const { return nRubyHeight; }
+ void SetRubyHeight( sal_uInt16 nNew ) { nRubyHeight = nNew; }
+
+ SwTextGrid GetGridType() const { return eGridType; }
+ void SetGridType( SwTextGrid eNew ) { eGridType = eNew; }
+
+ sal_Bool IsRubyTextBelow() const { return bRubyTextBelow; }
+ sal_Bool GetRubyTextBelow() const { return bRubyTextBelow; }
+ void SetRubyTextBelow( sal_Bool bNew ) { bRubyTextBelow = bNew; }
+
+ sal_Bool IsPrintGrid() const { return bPrintGrid; }
+ sal_Bool GetPrintGrid() const { return bPrintGrid; }
+ void SetPrintGrid( sal_Bool bNew ) { bPrintGrid = bNew; }
+
+ sal_Bool IsDisplayGrid() const { return bDisplayGrid; }
+ sal_Bool GetDisplayGrid() const { return bDisplayGrid; }
+ void SetDisplayGrid( sal_Bool bNew ) { bDisplayGrid = bNew; }
+
+ //for textgrid enhancement
+ sal_uInt16 GetBaseWidth() const { return nBaseWidth;}
+ void SetBaseWidth( sal_uInt16 nNew ) { nBaseWidth = nNew; }
+
+ sal_Bool IsSnapToChars() const { return bSnapToChars; }
+ sal_Bool GetSnapToChars() const { return bSnapToChars; }
+ void SetSnapToChars( sal_Bool bNew ) { bSnapToChars = bNew; }
+
+ sal_Bool IsSquaredMode() const { return bSquaredMode; }
+ sal_Bool GetSquaredMode() const { return bSquaredMode; }
+ void SetSquaredMode( sal_Bool bNew ) { bSquaredMode = bNew; }
+ void SwitchPaperMode(sal_Bool bNew );
+
+ void Init();
+};
+
+inline const SwTextGridItem &SwAttrSet::GetTextGrid(sal_Bool bInP) const
+ { return (const SwTextGridItem&)Get( RES_TEXTGRID, bInP ); }
+inline const SwTextGridItem &SwFmt::GetTextGrid(sal_Bool bInP) const
+ { return (const SwTextGridItem&)aSet.Get( RES_TEXTGRID, bInP ); }
+
+#endif
+
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
new file mode 100644
index 000000000000..88e5cea8a8fb
--- /dev/null
+++ b/sw/inc/tox.hxx
@@ -0,0 +1,797 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_TOX_HXX
+#define SW_TOX_HXX
+
+#include <cppuhelper/weakref.hxx>
+
+#include <i18npool/lang.h>
+#include <tools/string.hxx>
+
+#include <editeng/svxenum.hxx>
+#include <svl/svarray.hxx>
+#include <svl/poolitem.hxx>
+#include "swdllapi.h"
+#include <swtypes.hxx>
+#include <toxe.hxx>
+#include <calbck.hxx>
+#include <errhdl.hxx>
+
+#ifndef INCLUDED_VECTOR
+#include <vector> // #i21237#
+#define INCLUDED_VECTOR
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XDocumentIndexMark; }
+} } }
+
+class SwTOXType;
+class SwTOXMark;
+class SwTxtTOXMark;
+class SwDoc;
+
+SV_DECL_PTRARR(SwTOXMarks, SwTOXMark*, 0, 10)
+
+/*--------------------------------------------------------------------
+ Description: Entry of content index, alphabetical index or user defined index
+ --------------------------------------------------------------------*/
+
+#define IVER_TOXMARK_STRPOOL ((sal_uInt16)1)
+#define IVER_TOXMARK_NEWTOX ((sal_uInt16)2)
+
+class SW_DLLPUBLIC SwTOXMark
+ : public SfxPoolItem
+ , public SwModify
+{
+ friend void _InitCore();
+ friend class SwTxtTOXMark;
+
+ String aAltText; // Der Text des Eintrages ist unterschiedlich
+ String aPrimaryKey, aSecondaryKey;
+
+ // three more strings for phonetic sorting
+ String aTextReading;
+ String aPrimaryKeyReading;
+ String aSecondaryKeyReading;
+
+ SwTxtTOXMark* pTxtAttr;
+
+ sal_uInt16 nLevel;
+ sal_Bool bAutoGenerated : 1; // generated using a concordance file
+ sal_Bool bMainEntry : 1; // main entry emphasized by character style
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::text::XDocumentIndexMark> m_wXDocumentIndexMark;
+
+ SwTOXMark(); // to create the dflt. atr. in _InitCore
+
+protected:
+ // SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
+
+public:
+ TYPEINFO(); // rtti
+
+ // single argument ctors shall be explicit.
+ explicit SwTOXMark( const SwTOXType* pTyp );
+ virtual ~SwTOXMark();
+
+ SwTOXMark( const SwTOXMark& rCopy );
+ SwTOXMark& operator=( const SwTOXMark& rCopy );
+
+ // "pure virtual methods" of SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ void InvalidateTOXMark();
+
+ String GetText() const;
+
+ inline sal_Bool IsAlternativeText() const;
+ inline const String& GetAlternativeText() const;
+
+ inline void SetAlternativeText( const String& rAlt );
+
+ // content or user defined index
+ inline void SetLevel(sal_uInt16 nLevel);
+ inline sal_uInt16 GetLevel() const;
+
+ // for alphabetical index only
+ inline void SetPrimaryKey(const String& rStr );
+ inline void SetSecondaryKey(const String& rStr);
+ inline void SetTextReading(const String& rStr);
+ inline void SetPrimaryKeyReading(const String& rStr );
+ inline void SetSecondaryKeyReading(const String& rStr);
+
+ inline const String& GetPrimaryKey() const;
+ inline const String& GetSecondaryKey() const;
+ inline const String& GetTextReading() const;
+ inline const String& GetPrimaryKeyReading() const;
+ inline const String& GetSecondaryKeyReading() const;
+
+ sal_Bool IsAutoGenerated() const {return bAutoGenerated;}
+ void SetAutoGenerated(sal_Bool bSet) {bAutoGenerated = bSet;}
+
+ sal_Bool IsMainEntry() const {return bMainEntry;}
+ void SetMainEntry(sal_Bool bSet) { bMainEntry = bSet;}
+
+ inline const SwTOXType* GetTOXType() const;
+
+ const SwTxtTOXMark* GetTxtTOXMark() const { return pTxtAttr; }
+ SwTxtTOXMark* GetTxtTOXMark() { return pTxtAttr; }
+
+ SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::text::XDocumentIndexMark> const& GetXTOXMark() const
+ { return m_wXDocumentIndexMark; }
+ SW_DLLPRIVATE void SetXTOXMark(::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XDocumentIndexMark> const& xMark)
+ { m_wXDocumentIndexMark = xMark; }
+ void DeRegister() { GetRegisteredInNonConst()->Remove( this ); }
+ void RegisterToTOXType( SwTOXType& rMark );
+ static void InsertTOXMarks( SwTOXMarks& aMarks, const SwTOXType& rType );
+};
+
+/*--------------------------------------------------------------------
+ Description: index types
+ --------------------------------------------------------------------*/
+
+class SwTOXType : public SwModify
+{
+public:
+ SwTOXType(TOXTypes eTyp, const String& aName);
+
+ // @@@ public copy ctor, but no copy assignment?
+ SwTOXType(const SwTOXType& rCopy);
+
+ inline const String& GetTypeName() const;
+ inline TOXTypes GetType() const;
+
+private:
+ String aName;
+ TOXTypes eType;
+
+ // @@@ public copy ctor, but no copy assignment?
+ SwTOXType & operator= (const SwTOXType &);
+};
+
+/*--------------------------------------------------------------------
+ Description: Structure of the index lines
+ --------------------------------------------------------------------*/
+
+#define FORM_TITLE 0
+#define FORM_ALPHA_DELIMITTER 1
+#define FORM_PRIMARY_KEY 2
+#define FORM_SECONDARY_KEY 3
+#define FORM_ENTRY 4
+
+/*
+ Pattern structure
+
+ <E#> - entry number <E# CharStyleName,PoolId>
+ <ET> - entry text <ET CharStyleName,PoolId>
+ <E> - entry text and number <E CharStyleName,PoolId>
+ <T> - tab stop <T,,Position,Adjust>
+ <C> - chapter info n = {0, 1, 2, 3, 4 } values of SwChapterFormat <C CharStyleName,PoolId>
+ <TX> - text token <X CharStyleName,PoolId, TOX_STYLE_DELIMITERTextContentTOX_STYLE_DELIMITER>
+ <#> - Page number <# CharStyleName,PoolId>
+ <LS> - Link start <LS>
+ <LE> - Link end <LE>
+ <A00> - Authority entry field <A02 CharStyleName, PoolId>
+ */
+
+// These enum values are stored and must not be changed!
+enum FormTokenType
+{
+ TOKEN_ENTRY_NO,
+ TOKEN_ENTRY_TEXT,
+ TOKEN_ENTRY,
+ TOKEN_TAB_STOP,
+ TOKEN_TEXT,
+ TOKEN_PAGE_NUMS,
+ TOKEN_CHAPTER_INFO,
+ TOKEN_LINK_START,
+ TOKEN_LINK_END,
+ TOKEN_AUTHORITY,
+ TOKEN_END
+};
+
+struct SW_DLLPUBLIC SwFormToken
+{
+ String sText;
+ String sCharStyleName;
+ SwTwips nTabStopPosition;
+ FormTokenType eTokenType;
+ sal_uInt16 nPoolId;
+ SvxTabAdjust eTabAlign;
+ sal_uInt16 nChapterFormat; //SwChapterFormat;
+ sal_uInt16 nOutlineLevel;//the maximum permitted outline level in numbering
+ sal_uInt16 nAuthorityField; //enum ToxAuthorityField
+ sal_Unicode cTabFillChar;
+ sal_Bool bWithTab; // sal_True: do generate tab
+ // character only the tab stop
+ // #i21237#
+
+ SwFormToken(FormTokenType eType ) :
+ nTabStopPosition(0),
+ eTokenType(eType),
+ nPoolId(USHRT_MAX),
+ eTabAlign( SVX_TAB_ADJUST_LEFT ),
+ nChapterFormat(0 /*CF_NUMBER*/),
+ nOutlineLevel(MAXLEVEL), //default to maximum outline level
+ nAuthorityField(0 /*AUTH_FIELD_IDENTIFIER*/),
+ cTabFillChar(' '),
+ bWithTab(sal_True) // #i21237#
+ {}
+
+ String GetString() const;
+};
+
+// -> #i21237#
+/**
+ Functor that is true when a given token has a certain token type.
+
+ @param _eType the type to check for
+ @param rToken the token to check
+
+ @retval sal_True the token has the given type
+ @retval sal_False else
+*/
+struct SwFormTokenEqualToFormTokenType
+{
+ FormTokenType eType;
+
+ SwFormTokenEqualToFormTokenType(FormTokenType _eType) : eType(_eType) {}
+ bool operator()(const SwFormToken & rToken)
+ {
+ return rToken.eTokenType == eType;
+ }
+};
+
+/**
+ Functor that appends the string representation of a given token to a string.
+
+ @param _rText string to append the string representation to
+ @param rToken token whose string representation is appended
+*/
+struct SwFormTokenToString
+{
+ String & rText;
+ SwFormTokenToString(String & _rText) : rText(_rText) {}
+ void operator()(const SwFormToken & rToken) { rText += rToken.GetString(); }
+};
+
+/// Vector of tokens.
+typedef std::vector<SwFormToken> SwFormTokens;
+
+/**
+ Helper class that converts vectors of tokens to strings and vice
+ versa.
+ */
+class SW_DLLPUBLIC SwFormTokensHelper
+{
+ /// the tokens
+ SwFormTokens aTokens;
+
+ /**
+ Builds a token from its string representation.
+
+ @sPattern the whole pattern
+ @nCurPatternPos starting position of the token
+
+ @return the token
+ */
+ SW_DLLPRIVATE SwFormToken BuildToken( const String & sPattern,
+ xub_StrLen & nCurPatternPos ) const;
+
+ /**
+ Returns the string of a token.
+
+ @param sPattern the whole pattern
+ @param nStt starting position of the token
+
+ @return the string representation of the token
+ */
+ SW_DLLPRIVATE String SearchNextToken( const String & sPattern,
+ xub_StrLen nStt ) const;
+
+ /**
+ Returns the type of a token.
+
+ @param sToken the string representation of the token
+ @param pTokenLen return parameter the length of the head of the token
+
+ If pTokenLen is non-NULL the length of the token's head is
+ written to *pTokenLen
+
+ @return the type of the token
+ */
+ SW_DLLPRIVATE FormTokenType GetTokenType(const String & sToken,
+ xub_StrLen * pTokenLen) const;
+
+public:
+ /**
+ contructor
+
+ @param rTokens vector of tokens
+ */
+ SwFormTokensHelper(const SwFormTokens & rTokens) : aTokens(rTokens) {}
+
+ /**
+ constructor
+
+ @param rStr string representation of the tokens
+ */
+ SwFormTokensHelper(const String & rStr);
+
+ /**
+ Returns vector of tokens.
+
+ @return vector of tokens
+ */
+ const SwFormTokens & GetTokens() const { return aTokens; }
+};
+// <- #i21237#
+
+class SW_DLLPUBLIC SwForm
+{
+ SwFormTokens aPattern[ AUTH_TYPE_END + 1 ]; // #i21237#
+ String aTemplate[ AUTH_TYPE_END + 1 ];
+
+ TOXTypes eType;
+ sal_uInt16 nFormMaxLevel;
+
+ //sal_uInt16 nFirstTabPos; -> Value in tab token
+// sal_Bool bHasFirstTabPos : 1;
+ sal_Bool bGenerateTabPos : 1;
+ sal_Bool bIsRelTabPos : 1;
+ sal_Bool bCommaSeparated : 1;
+
+public:
+ SwForm( TOXTypes eTOXType = TOX_CONTENT );
+ SwForm( const SwForm& rForm );
+
+ SwForm& operator=( const SwForm& rForm );
+
+ inline void SetTemplate(sal_uInt16 nLevel, const String& rName);
+ inline const String& GetTemplate(sal_uInt16 nLevel) const;
+
+ // #i21237#
+ void SetPattern(sal_uInt16 nLevel, const SwFormTokens& rName);
+ void SetPattern(sal_uInt16 nLevel, const String& rStr);
+ const SwFormTokens& GetPattern(sal_uInt16 nLevel) const;
+
+ // fill tab stop positions from template to pattern
+ // #i21237#
+ void AdjustTabStops(SwDoc& rDoc,
+ sal_Bool bInsertNewTabStops = sal_False);
+
+ inline TOXTypes GetTOXType() const;
+ inline sal_uInt16 GetFormMax() const;
+
+ sal_Bool IsRelTabPos() const { return bIsRelTabPos; }
+ void SetRelTabPos( sal_Bool b ) { bIsRelTabPos = b; }
+
+ sal_Bool IsCommaSeparated() const { return bCommaSeparated;}
+ void SetCommaSeparated( sal_Bool b) { bCommaSeparated = b;}
+
+ static sal_uInt16 GetFormMaxLevel( TOXTypes eType );
+
+ static const sal_Char* aFormEntry; // <E>
+ static sal_uInt8 nFormEntryLen; // 3 characters
+ static const sal_Char* aFormTab; // <T>
+ static sal_uInt8 nFormTabLen; // 3 characters
+ static const sal_Char* aFormPageNums; // <P>
+ static sal_uInt8 nFormPageNumsLen; // 3 characters
+ static const sal_Char* aFormLinkStt; // <LS>
+ static sal_uInt8 nFormLinkSttLen; // 4 characters
+ static const sal_Char* aFormLinkEnd; // <LE>
+ static sal_uInt8 nFormLinkEndLen; // 4 characters
+ static const sal_Char* aFormEntryNum; // <E#>
+ static sal_uInt8 nFormEntryNumLen; // 4 characters
+ static const sal_Char* aFormEntryTxt; // <ET>
+ static sal_uInt8 nFormEntryTxtLen; // 4 characters
+ static const sal_Char* aFormChapterMark; // <C>
+ static sal_uInt8 nFormChapterMarkLen; // 3 characters
+ static const sal_Char* aFormText; // <TX>
+ static sal_uInt8 nFormTextLen; // 4 characters
+ static const sal_Char* aFormAuth; // <Axx> xx - decimal enum value
+ static sal_uInt8 nFormAuthLen; // 3 characters
+};
+
+/*--------------------------------------------------------------------
+ Description: Content to create indexes of
+ --------------------------------------------------------------------*/
+
+typedef sal_uInt16 SwTOXElement;
+namespace nsSwTOXElement
+{
+ const SwTOXElement TOX_MARK = 1;
+ const SwTOXElement TOX_OUTLINELEVEL = 2;
+ const SwTOXElement TOX_TEMPLATE = 4;
+ const SwTOXElement TOX_OLE = 8;
+ const SwTOXElement TOX_TABLE = 16;
+ const SwTOXElement TOX_GRAPHIC = 32;
+ const SwTOXElement TOX_FRAME = 64;
+ const SwTOXElement TOX_SEQUENCE = 128;
+}
+
+typedef sal_uInt16 SwTOIOptions;
+namespace nsSwTOIOptions
+{
+ const SwTOIOptions TOI_SAME_ENTRY = 1;
+ const SwTOIOptions TOI_FF = 2;
+ const SwTOIOptions TOI_CASE_SENSITIVE = 4;
+ const SwTOIOptions TOI_KEY_AS_ENTRY = 8;
+ const SwTOIOptions TOI_ALPHA_DELIMITTER = 16;
+ const SwTOIOptions TOI_DASH = 32;
+ const SwTOIOptions TOI_INITIAL_CAPS = 64;
+}
+
+//which part of the caption is to be displayed
+enum SwCaptionDisplay
+{
+ CAPTION_COMPLETE,
+ CAPTION_NUMBER,
+ CAPTION_TEXT
+};
+
+typedef sal_uInt16 SwTOOElements;
+namespace nsSwTOOElements
+{
+ const SwTOOElements TOO_MATH = 0x01;
+ const SwTOOElements TOO_CHART = 0x02;
+ const SwTOOElements TOO_CALC = 0x08;
+ const SwTOOElements TOO_DRAW_IMPRESS = 0x10;
+// const SwTOOElements TOO_IMPRESS = 0x20;
+ const SwTOOElements TOO_OTHER = 0x80;
+}
+
+#define TOX_STYLE_DELIMITER ((sal_Unicode)0x01) //JP 19.07.00: use a control char
+
+/*--------------------------------------------------------------------
+ Description: Class for all indexes
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwTOXBase : public SwClient
+{
+ SwForm aForm; // description of the lines
+ String aName; // unique name
+ String aTitle; // title
+
+ String sMainEntryCharStyle; // name of the character style applied to main index entries
+
+ String aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER
+ String sSequenceName; // FieldTypeName of a caption sequence
+
+ LanguageType eLanguage;
+ String sSortAlgorithm;
+
+ union {
+ sal_uInt16 nLevel; // consider outline levels
+ sal_uInt16 nOptions; // options of alphabetical index
+ } aData;
+
+ sal_uInt16 nCreateType; // sources to create the index from
+ sal_uInt16 nOLEOptions; // OLE sources
+ SwCaptionDisplay eCaptionDisplay; //
+ sal_Bool bProtected : 1; // index protected ?
+ sal_Bool bFromChapter : 1; // create from chapter or document
+ sal_Bool bFromObjectNames : 1; // create a table or object index
+ // from the names rather than the caption
+ sal_Bool bLevelFromChapter : 1; // User index: get the level from the source chapter
+public:
+ SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm,
+ sal_uInt16 nCreaType, const String& rTitle );
+ SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = 0 );
+ virtual ~SwTOXBase();
+
+ virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
+
+ // a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
+ // If not, so create it an copy all other used things. The return is this
+ SwTOXBase& CopyTOXBase( SwDoc*, const SwTOXBase& );
+
+ const SwTOXType* GetTOXType() const; //
+
+ sal_uInt16 GetCreateType() const; // creation types
+
+ const String& GetTOXName() const {return aName;}
+ void SetTOXName(const String& rSet) {aName = rSet;}
+
+ const String& GetTitle() const; // Title
+ const String& GetTypeName() const; // Name
+ const SwForm& GetTOXForm() const; // description of the lines
+
+ void SetCreate(sal_uInt16);
+ void SetTitle(const String& rTitle);
+ void SetTOXForm(const SwForm& rForm);
+
+ TOXTypes GetType() const;
+
+ const String& GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
+ void SetMainEntryCharStyle(const String& rSet) {sMainEntryCharStyle = rSet;}
+
+ // content index only
+ inline void SetLevel(sal_uInt16); // consider outline level
+ inline sal_uInt16 GetLevel() const;
+
+ // alphabetical index only
+ inline sal_uInt16 GetOptions() const; // alphabetical index options
+ inline void SetOptions(sal_uInt16 nOpt);
+
+ // index of objects
+ sal_uInt16 GetOLEOptions() const {return nOLEOptions;}
+ void SetOLEOptions(sal_uInt16 nOpt) {nOLEOptions = nOpt;}
+
+ // index of objects
+
+ // user defined index only
+ inline void SetTemplateName(const String& rName); // Absatzlayout beachten
+
+ const String& GetStyleNames(sal_uInt16 nLevel) const
+ {
+ DBG_ASSERT( nLevel < MAXLEVEL, "Which level?");
+ return aStyleNames[nLevel];
+ }
+ void SetStyleNames(const String& rSet, sal_uInt16 nLevel)
+ {
+ DBG_ASSERT( nLevel < MAXLEVEL, "Which level?");
+ aStyleNames[nLevel] = rSet;
+ }
+ sal_Bool IsFromChapter() const { return bFromChapter;}
+ void SetFromChapter(sal_Bool bSet) { bFromChapter = bSet;}
+
+ sal_Bool IsFromObjectNames() const {return bFromObjectNames;}
+ void SetFromObjectNames(sal_Bool bSet) {bFromObjectNames = bSet;}
+
+ sal_Bool IsLevelFromChapter() const {return bLevelFromChapter;}
+ void SetLevelFromChapter(sal_Bool bSet) {bLevelFromChapter = bSet;}
+
+ sal_Bool IsProtected() const { return bProtected; }
+ void SetProtected(sal_Bool bSet) { bProtected = bSet; }
+
+ const String& GetSequenceName() const {return sSequenceName;}
+ void SetSequenceName(const String& rSet) {sSequenceName = rSet;}
+
+ SwCaptionDisplay GetCaptionDisplay() const { return eCaptionDisplay;}
+ void SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;}
+
+ sal_Bool IsTOXBaseInReadonly() const;
+
+ const SfxItemSet* GetAttrSet() const;
+ void SetAttrSet( const SfxItemSet& );
+
+ LanguageType GetLanguage() const {return eLanguage;}
+ void SetLanguage(LanguageType nLang) {eLanguage = nLang;}
+
+ const String& GetSortAlgorithm()const {return sSortAlgorithm;}
+ void SetSortAlgorithm(const String& rSet) {sSortAlgorithm = rSet;}
+ // #i21237#
+ void AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop);
+ SwTOXBase& operator=(const SwTOXBase& rSource);
+ void RegisterToTOXType( SwTOXType& rMark );
+};
+
+
+/*--------------------------------------------------------------------
+ Description: Inlines
+ --------------------------------------------------------------------*/
+
+//
+//SwTOXMark
+//
+inline const String& SwTOXMark::GetAlternativeText() const
+ { return aAltText; }
+
+inline const SwTOXType* SwTOXMark::GetTOXType() const
+ { return (SwTOXType*)GetRegisteredIn(); }
+
+inline sal_Bool SwTOXMark::IsAlternativeText() const
+ { return aAltText.Len() > 0; }
+
+inline void SwTOXMark::SetAlternativeText(const String& rAlt)
+{
+ aAltText = rAlt;
+}
+
+inline void SwTOXMark::SetLevel( sal_uInt16 nLvl )
+{
+ ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
+ nLevel = nLvl;
+}
+
+inline void SwTOXMark::SetPrimaryKey( const String& rKey )
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ aPrimaryKey = rKey;
+}
+
+inline void SwTOXMark::SetSecondaryKey( const String& rKey )
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ aSecondaryKey = rKey;
+}
+
+inline void SwTOXMark::SetTextReading( const String& rTxt )
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ aTextReading = rTxt;
+}
+
+inline void SwTOXMark::SetPrimaryKeyReading( const String& rKey )
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ aPrimaryKeyReading = rKey;
+}
+
+inline void SwTOXMark::SetSecondaryKeyReading( const String& rKey )
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ aSecondaryKeyReading = rKey;
+}
+
+inline sal_uInt16 SwTOXMark::GetLevel() const
+{
+ ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
+ return nLevel;
+}
+
+inline const String& SwTOXMark::GetPrimaryKey() const
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ return aPrimaryKey;
+}
+
+inline const String& SwTOXMark::GetSecondaryKey() const
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ return aSecondaryKey;
+}
+
+inline const String& SwTOXMark::GetTextReading() const
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ return aTextReading;
+}
+
+inline const String& SwTOXMark::GetPrimaryKeyReading() const
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ return aPrimaryKeyReading;
+}
+
+inline const String& SwTOXMark::GetSecondaryKeyReading() const
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ return aSecondaryKeyReading;
+}
+
+//
+//SwForm
+//
+inline void SwForm::SetTemplate(sal_uInt16 nLevel, const String& rTemplate)
+{
+ ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
+ aTemplate[nLevel] = rTemplate;
+}
+
+inline const String& SwForm::GetTemplate(sal_uInt16 nLevel) const
+{
+ ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
+ return aTemplate[nLevel];
+}
+
+inline TOXTypes SwForm::GetTOXType() const
+{
+ return eType;
+}
+
+inline sal_uInt16 SwForm::GetFormMax() const
+{
+ return nFormMaxLevel;
+}
+
+
+//
+//SwTOXType
+//
+inline const String& SwTOXType::GetTypeName() const
+ { return aName; }
+
+inline TOXTypes SwTOXType::GetType() const
+ { return eType; }
+
+//
+// SwTOXBase
+//
+inline const SwTOXType* SwTOXBase::GetTOXType() const
+ { return (SwTOXType*)GetRegisteredIn(); }
+
+inline sal_uInt16 SwTOXBase::GetCreateType() const
+ { return nCreateType; }
+
+inline const String& SwTOXBase::GetTitle() const
+ { return aTitle; }
+
+inline const String& SwTOXBase::GetTypeName() const
+ { return GetTOXType()->GetTypeName(); }
+
+inline const SwForm& SwTOXBase::GetTOXForm() const
+ { return aForm; }
+
+inline void SwTOXBase::AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop)
+{
+ aForm.AdjustTabStops(rDoc, bDefaultRightTabStop);
+}
+
+inline void SwTOXBase::SetCreate(sal_uInt16 nCreate)
+ { nCreateType = nCreate; }
+
+inline void SwTOXBase::SetTOXForm(const SwForm& rForm)
+ { aForm = rForm; }
+
+inline TOXTypes SwTOXBase::GetType() const
+ { return GetTOXType()->GetType(); }
+
+inline void SwTOXBase::SetLevel(sal_uInt16 nLev)
+{
+ ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
+ aData.nLevel = nLev;
+}
+
+inline sal_uInt16 SwTOXBase::GetLevel() const
+{
+ ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
+ return aData.nLevel;
+}
+
+inline void SwTOXBase::SetTemplateName(const String& rName)
+{
+// ASSERT(GetTOXType()->GetType() == TOX_USER, "Falscher Feldtyp");
+// ASSERT(aData.pTemplateName, "pTemplateName == 0");
+// (*aData.pTemplateName) = rName;
+ DBG_WARNING("SwTOXBase::SetTemplateName obsolete");
+ aStyleNames[0] = rName;
+
+}
+
+inline sal_uInt16 SwTOXBase::GetOptions() const
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ return aData.nOptions;
+}
+
+inline void SwTOXBase::SetOptions(sal_uInt16 nOpt)
+{
+ ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
+ aData.nOptions = nOpt;
+}
+
+
+#endif // SW_TOX_HXX
diff --git a/sw/inc/toxe.hxx b/sw/inc/toxe.hxx
new file mode 100644
index 000000000000..064c2e0aac9f
--- /dev/null
+++ b/sw/inc/toxe.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TOXE_HXX
+#define _TOXE_HXX
+
+enum SwTOXSearch
+{
+ TOX_NXT,
+ TOX_PRV,
+ TOX_SAME_NXT,
+ TOX_SAME_PRV
+};
+
+enum SwTOIKeyType
+{
+ TOI_PRIMARY,
+ TOI_SECONDARY
+};
+
+enum TOXTypes
+{
+ TOX_INDEX,
+ TOX_USER,
+ TOX_CONTENT,
+ TOX_ILLUSTRATIONS,
+ TOX_OBJECTS,
+ TOX_TABLES,
+ TOX_AUTHORITIES
+};
+// this enum contains all types of sources
+enum ToxAuthorityType
+{
+ //BiBTeX - fields
+ AUTH_TYPE_ARTICLE,
+ AUTH_TYPE_BOOK,
+ AUTH_TYPE_BOOKLET,
+ AUTH_TYPE_CONFERENCE,
+ AUTH_TYPE_INBOOK,
+ AUTH_TYPE_INCOLLECTION,
+ AUTH_TYPE_INPROCEEDINGS,
+ AUTH_TYPE_JOURNAL,
+ AUTH_TYPE_MANUAL,
+ AUTH_TYPE_MASTERSTHESIS,
+ AUTH_TYPE_MISC,
+ AUTH_TYPE_PHDTHESIS,
+ AUTH_TYPE_PROCEEDINGS,
+ AUTH_TYPE_TECHREPORT,
+ AUTH_TYPE_UNPUBLISHED,
+ //additional types
+ AUTH_TYPE_EMAIL,
+ AUTH_TYPE_WWW,
+ AUTH_TYPE_CUSTOM1,
+ AUTH_TYPE_CUSTOM2,
+ AUTH_TYPE_CUSTOM3,
+ AUTH_TYPE_CUSTOM4,
+ AUTH_TYPE_CUSTOM5,
+ AUTH_TYPE_END
+};
+
+//this enum contains the fields of an authority entry
+enum ToxAuthorityField
+{
+ AUTH_FIELD_IDENTIFIER,
+ AUTH_FIELD_AUTHORITY_TYPE, //ToxAuthorityType
+ //BibTex types
+ AUTH_FIELD_ADDRESS,
+ AUTH_FIELD_ANNOTE,
+ AUTH_FIELD_AUTHOR,
+ AUTH_FIELD_BOOKTITLE,
+ AUTH_FIELD_CHAPTER,
+ AUTH_FIELD_EDITION,
+ AUTH_FIELD_EDITOR,
+ AUTH_FIELD_HOWPUBLISHED,
+ AUTH_FIELD_INSTITUTION,
+ AUTH_FIELD_JOURNAL,
+// AUTH_FIELD_KEY, // BiBTeX - Field
+ AUTH_FIELD_MONTH,
+ AUTH_FIELD_NOTE,
+ AUTH_FIELD_NUMBER,
+ AUTH_FIELD_ORGANIZATIONS,
+ AUTH_FIELD_PAGES,
+ AUTH_FIELD_PUBLISHER,
+ AUTH_FIELD_SCHOOL,
+ AUTH_FIELD_SERIES,
+ AUTH_FIELD_TITLE,
+ AUTH_FIELD_REPORT_TYPE,
+ AUTH_FIELD_VOLUME,
+ AUTH_FIELD_YEAR,
+ //additional types
+ AUTH_FIELD_URL,
+ AUTH_FIELD_CUSTOM1,
+ AUTH_FIELD_CUSTOM2,
+ AUTH_FIELD_CUSTOM3,
+ AUTH_FIELD_CUSTOM4,
+ AUTH_FIELD_CUSTOM5,
+ AUTH_FIELD_ISBN,
+ AUTH_FIELD_END
+};
+
+
+#endif
diff --git a/sw/inc/toxinit.hxx b/sw/inc/toxinit.hxx
new file mode 100644
index 000000000000..8546f04b830c
--- /dev/null
+++ b/sw/inc/toxinit.hxx
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOXINIT_HXX
+#define _TOXINIT_HXX
+
+class UniString;
+
+void SetTOUTableStr(const UniString& rStr);
+void SetTOUGraphicStr(const UniString& rStr);
+void SetTOUOLEStr(const UniString& rStr);
+
+
+#endif // _TOXINIT_HXX
diff --git a/sw/inc/toxwrap.hxx b/sw/inc/toxwrap.hxx
new file mode 100644
index 000000000000..f38cd15c877c
--- /dev/null
+++ b/sw/inc/toxwrap.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOXWRAP_HXX
+#define _TOXWRAP_HXX
+
+#include <tools/solar.h>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <swunodef.hxx>
+#include "swdllapi.h"
+
+namespace com { namespace sun { namespace star {
+namespace i18n {
+ class XExtendedIndexEntrySupplier;
+}
+namespace lang {
+ class XMultiServiceFactory;
+}
+}}}
+
+
+class String;
+
+class SW_DLLPUBLIC IndexEntrySupplierWrapper
+{
+ STAR_NMSPC::lang::Locale aLcl;
+ STAR_NMSPC::uno::Reference < com::sun::star::i18n::XExtendedIndexEntrySupplier > xIES;
+
+public:
+ IndexEntrySupplierWrapper();
+ ~IndexEntrySupplierWrapper();
+
+ void SetLocale( const STAR_NMSPC::lang::Locale& rLocale ) { aLcl = rLocale; }
+
+ String GetIndexKey( const String& rTxt, const String& rTxtReading,
+ const STAR_NMSPC::lang::Locale& rLocale ) const;
+
+ String GetFollowingText( sal_Bool bMorePages ) const;
+
+ STAR_NMSPC::uno::Sequence< ::rtl::OUString >
+ GetAlgorithmList( const STAR_NMSPC::lang::Locale& rLcl ) const;
+
+ sal_Bool LoadAlgorithm( const STAR_NMSPC::lang::Locale& rLcl,
+ const String& sSortAlgorithm, long nOptions ) const;
+
+ sal_Int16 CompareIndexEntry( const String& rTxt1, const String& rTxtReading1,
+ const STAR_NMSPC::lang::Locale& rLcl1,
+ const String& rTxt2, const String& rTxtReading2,
+ const STAR_NMSPC::lang::Locale& rLcl2 ) const;
+};
+
+#endif
diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx
new file mode 100644
index 000000000000..4829b1bcb012
--- /dev/null
+++ b/sw/inc/txatbase.hxx
@@ -0,0 +1,244 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TXATBASE_HXX
+#define _TXATBASE_HXX
+
+#include <tools/solar.h>
+#include <svl/poolitem.hxx>
+#include <hintids.hxx>
+#include <errhdl.hxx>
+
+#include <boost/utility.hpp>
+
+
+class SfxItemPool;
+class SvXMLAttrContainerItem;
+class SwFmtRuby;
+class SwFmtCharFmt;
+class SwFmtAutoFmt;
+class SwFmtINetFmt;
+class SwFmtFld;
+class SwFmtFtn;
+class SwFmtFlyCnt;
+class SwTOXMark;
+class SwFmtRefMark;
+class SwFmtMeta;
+
+
+class SwTxtAttr : private boost::noncopyable
+{
+private:
+ SfxPoolItem * const m_pAttr;
+ xub_StrLen m_nStart;
+ bool m_bDontExpand : 1;
+ bool m_bLockExpandFlag : 1;
+
+ bool m_bDontMoveAttr : 1; // refmarks, toxmarks
+ bool m_bCharFmtAttr : 1; // charfmt, inet
+ bool m_bOverlapAllowedAttr : 1; // refmarks, toxmarks
+ bool m_bPriorityAttr : 1; // attribute has priority (redlining)
+ bool m_bDontExpandStart : 1; // don't expand start at paragraph start (ruby)
+ bool m_bNesting : 1; // SwTxtAttrNesting
+ bool m_bHasDummyChar : 1; // without end + meta
+
+protected:
+ SwTxtAttr( SfxPoolItem& rAttr, xub_StrLen nStart );
+ virtual ~SwTxtAttr();
+
+ void SetLockExpandFlag( bool bFlag ) { m_bLockExpandFlag = bFlag; }
+ void SetDontMoveAttr( bool bFlag ) { m_bDontMoveAttr = bFlag; }
+ void SetCharFmtAttr( bool bFlag ) { m_bCharFmtAttr = bFlag; }
+ void SetOverlapAllowedAttr( bool bFlag ){ m_bOverlapAllowedAttr = bFlag; }
+ void SetDontExpandStartAttr(bool bFlag) { m_bDontExpandStart = bFlag; }
+ void SetNesting(const bool bFlag) { m_bNesting = bFlag; }
+ void SetHasDummyChar(const bool bFlag) { m_bHasDummyChar = bFlag; }
+
+public:
+
+ /// destroy instance
+ static void Destroy( SwTxtAttr * pToDestroy, SfxItemPool& rPool );
+
+ /// start position
+ xub_StrLen* GetStart() { return & m_nStart; }
+ const xub_StrLen* GetStart() const { return & m_nStart; }
+
+ /// end position
+ virtual xub_StrLen* GetEnd();
+ inline const xub_StrLen* GetEnd() const;
+ /// end (if available), else start
+ inline const xub_StrLen* GetAnyEnd() const;
+
+ inline void SetDontExpand( bool bDontExpand );
+ bool DontExpand() const { return m_bDontExpand; }
+ bool IsLockExpandFlag() const { return m_bLockExpandFlag; }
+ bool IsDontMoveAttr() const { return m_bDontMoveAttr; }
+ bool IsCharFmtAttr() const { return m_bCharFmtAttr; }
+ bool IsOverlapAllowedAttr() const { return m_bOverlapAllowedAttr; }
+ bool IsPriorityAttr() const { return m_bPriorityAttr; }
+ void SetPriorityAttr( bool bFlag ) { m_bPriorityAttr = bFlag; }
+ bool IsDontExpandStartAttr() const { return m_bDontExpandStart; }
+ bool IsNesting() const { return m_bNesting; }
+ bool HasDummyChar() const { return m_bHasDummyChar; }
+
+ inline const SfxPoolItem& GetAttr() const;
+ inline SfxPoolItem& GetAttr();
+ inline sal_uInt16 Which() const { return GetAttr().Which(); }
+
+ virtual int operator==( const SwTxtAttr& ) const;
+
+ inline const SwFmtCharFmt &GetCharFmt() const;
+ inline const SwFmtAutoFmt &GetAutoFmt() const;
+ inline const SwFmtFld &GetFld() const;
+ inline const SwFmtFtn &GetFtn() const;
+ inline const SwFmtFlyCnt &GetFlyCnt() const;
+ inline const SwTOXMark &GetTOXMark() const;
+ inline const SwFmtRefMark &GetRefMark() const;
+ inline const SwFmtINetFmt &GetINetFmt() const;
+ inline const SwFmtRuby &GetRuby() const;
+ inline const SwFmtMeta &GetMeta() const;
+
+};
+
+class SwTxtAttrEnd : public SwTxtAttr
+{
+protected:
+ xub_StrLen m_nEnd;
+
+public:
+ SwTxtAttrEnd( SfxPoolItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
+
+ using SwTxtAttr::GetEnd;
+ virtual xub_StrLen* GetEnd();
+};
+
+
+// --------------- Inline Implementierungen ------------------------
+
+inline const xub_StrLen* SwTxtAttr::GetEnd() const
+{
+ return const_cast<SwTxtAttr * >(this)->GetEnd();
+}
+
+inline const xub_StrLen* SwTxtAttr::GetAnyEnd() const
+{
+ const xub_StrLen* pEnd = GetEnd();
+ return pEnd ? pEnd : GetStart();
+}
+
+inline const SfxPoolItem& SwTxtAttr::GetAttr() const
+{
+ ASSERT( m_pAttr, "SwTxtAttr: where is my attribute?" );
+ return *m_pAttr;
+}
+
+inline SfxPoolItem& SwTxtAttr::GetAttr()
+{
+ return const_cast<SfxPoolItem&>(
+ const_cast<const SwTxtAttr*>(this)->GetAttr());
+}
+
+inline void SwTxtAttr::SetDontExpand( bool bDontExpand )
+{
+ if ( !m_bLockExpandFlag )
+ {
+ m_bDontExpand = bDontExpand;
+ }
+}
+
+//------------------------------------------------------------------------
+
+inline const SwFmtCharFmt& SwTxtAttr::GetCharFmt() const
+{
+ ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_CHARFMT,
+ "Wrong attribute" );
+ return (const SwFmtCharFmt&)(*m_pAttr);
+}
+
+inline const SwFmtAutoFmt& SwTxtAttr::GetAutoFmt() const
+{
+ ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_AUTOFMT,
+ "Wrong attribute" );
+ return (const SwFmtAutoFmt&)(*m_pAttr);
+}
+
+inline const SwFmtFld& SwTxtAttr::GetFld() const
+{
+ ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_FIELD,
+ "Wrong attribute" );
+ return (const SwFmtFld&)(*m_pAttr);
+}
+
+inline const SwFmtFtn& SwTxtAttr::GetFtn() const
+{
+ ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_FTN, "Wrong attribute" );
+ return (const SwFmtFtn&)(*m_pAttr);
+}
+
+inline const SwFmtFlyCnt& SwTxtAttr::GetFlyCnt() const
+{
+ ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_FLYCNT,
+ "Wrong attribute" );
+ return (const SwFmtFlyCnt&)(*m_pAttr);
+}
+
+inline const SwTOXMark& SwTxtAttr::GetTOXMark() const
+{
+ ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_TOXMARK,
+ "Wrong attribute" );
+ return (const SwTOXMark&)(*m_pAttr);
+}
+
+inline const SwFmtRefMark& SwTxtAttr::GetRefMark() const
+{
+ ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_REFMARK,
+ "Wrong attribute" );
+ return (const SwFmtRefMark&)(*m_pAttr);
+}
+
+inline const SwFmtINetFmt& SwTxtAttr::GetINetFmt() const
+{
+ ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_INETFMT,
+ "Wrong attribute" );
+ return (const SwFmtINetFmt&)(*m_pAttr);
+}
+
+inline const SwFmtRuby& SwTxtAttr::GetRuby() const
+{
+ ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_CJK_RUBY,
+ "Wrong attribute" );
+ return (const SwFmtRuby&)(*m_pAttr);
+}
+
+inline const SwFmtMeta& SwTxtAttr::GetMeta() const
+{
+ ASSERT( m_pAttr && (m_pAttr->Which() == RES_TXTATR_META ||
+ m_pAttr->Which() == RES_TXTATR_METAFIELD),
+ "Wrong attribute" );
+ return (const SwFmtMeta&)(*m_pAttr);
+}
+
+#endif
diff --git a/sw/inc/txatritr.hxx b/sw/inc/txatritr.hxx
new file mode 100644
index 000000000000..6c6b354a7b59
--- /dev/null
+++ b/sw/inc/txatritr.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TXATRITR_HXX
+#define _TXATRITR_HXX
+
+#include <tools/solar.h>
+#include <sal/types.h>
+#include <svl/svarray.hxx>
+#include <editeng/langitem.hxx>
+#include <hintids.hxx>
+
+class String;
+class SwTxtNode;
+class SwTxtAttr;
+class SfxPoolItem;
+
+
+class SwScriptIterator
+{
+ const String& rText;
+ xub_StrLen nChgPos;
+ sal_uInt16 nCurScript;
+ sal_Bool bForward;
+
+public:
+ SwScriptIterator( const String& rStr, xub_StrLen nStart = 0,
+ sal_Bool bFrwrd = sal_True );
+
+ sal_Bool Next();
+
+ sal_uInt16 GetCurrScript() const { return nCurScript; }
+ xub_StrLen GetScriptChgPos() const { return nChgPos; }
+ const String& GetText() const { return rText; }
+};
+
+
+class SwTxtAttrIterator
+{
+ SwScriptIterator aSIter;
+ SvPtrarr aStack;
+ const SwTxtNode& rTxtNd;
+ const SfxPoolItem *pParaItem, *pCurItem;
+ xub_StrLen nChgPos;
+ sal_uInt16 nAttrPos, nWhichId;
+ sal_Bool bIsUseGetWhichOfScript;
+
+ void AddToStack( const SwTxtAttr& rAttr );
+ void SearchNextChg();
+
+public:
+ SwTxtAttrIterator( const SwTxtNode& rTxtNd, sal_uInt16 nWhichId,
+ xub_StrLen nStart = 0, sal_Bool bUseGetWhichOfScript = sal_True );
+
+ sal_Bool Next();
+
+ const SfxPoolItem& GetAttr() const { return *pCurItem; }
+ xub_StrLen GetChgPos() const { return nChgPos; }
+};
+
+
+class SwLanguageIterator : public SwTxtAttrIterator
+{
+public:
+ SwLanguageIterator( const SwTxtNode& rTxtNode, xub_StrLen nStart = 0,
+ sal_uInt16 nWhich = RES_CHRATR_LANGUAGE,
+ sal_Bool bUseGetWhichOfScript = sal_True )
+ : SwTxtAttrIterator( rTxtNode, nWhich, nStart, bUseGetWhichOfScript )
+ {}
+
+ sal_uInt16 GetLanguage() const
+ { return ((SvxLanguageItem&)GetAttr()).GetValue(); }
+};
+
+
+#endif
diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx
new file mode 100644
index 000000000000..cd16a93bd09b
--- /dev/null
+++ b/sw/inc/txtatr.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TXTATR_HXX
+#define _TXTATR_HXX
+
+#include <txatbase.hxx> // SwTxtAttr/SwTxtAttrEnd
+#include <calbck.hxx>
+
+
+class SwTxtNode; // fuer SwTxtFld
+class SwCharFmt;
+
+namespace sw {
+ class MetaFieldManager;
+}
+
+
+// ATT_CHARFMT *********************************************
+
+class SwTxtCharFmt : public SwTxtAttrEnd
+{
+ SwTxtNode * m_pTxtNode;
+ sal_uInt16 m_nSortNumber;
+
+public:
+ SwTxtCharFmt( SwFmtCharFmt& rAttr, xub_StrLen nStart, xub_StrLen nEnd );
+ virtual ~SwTxtCharFmt( );
+
+ // werden vom SwFmtCharFmt hierher weitergeleitet (no derivation from SwClient!)
+ void ModifyNotification( const SfxPoolItem*, const SfxPoolItem* );
+ bool GetInfo( SfxPoolItem& rInfo ) const;
+
+ // get and set TxtNode pointer
+ void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
+
+ void SetSortNumber( sal_uInt16 nSortNumber ) { m_nSortNumber = nSortNumber; }
+ sal_uInt16 GetSortNumber() const { return m_nSortNumber; }
+};
+
+
+// ******************************
+
+class SwTxtAttrNesting : public SwTxtAttrEnd
+{
+protected:
+ SwTxtAttrNesting( SfxPoolItem & i_rAttr,
+ const xub_StrLen i_nStart, const xub_StrLen i_nEnd );
+ virtual ~SwTxtAttrNesting();
+};
+
+class SwTxtMeta : public SwTxtAttrNesting
+{
+private:
+ SwTxtMeta( SwFmtMeta & i_rAttr,
+ const xub_StrLen i_nStart, const xub_StrLen i_nEnd );
+
+public:
+ static SwTxtMeta * CreateTxtMeta(
+ ::sw::MetaFieldManager & i_rTargetDocManager,
+ SwTxtNode *const i_pTargetTxtNode,
+ SwFmtMeta & i_rAttr,
+ xub_StrLen const i_nStart, xub_StrLen const i_nEnd,
+ bool const i_bIsCopy);
+
+ virtual ~SwTxtMeta();
+
+ void ChgTxtNode(SwTxtNode * const pNode);
+};
+
+
+// ******************************
+
+class SW_DLLPUBLIC SwTxtRuby : public SwTxtAttrNesting, public SwClient
+{
+ SwTxtNode* m_pTxtNode;
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+public:
+ SwTxtRuby( SwFmtRuby& rAttr, xub_StrLen nStart, xub_StrLen nEnd );
+ virtual ~SwTxtRuby();
+ TYPEINFO();
+
+ virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
+
+ SW_DLLPRIVATE void InitRuby(SwTxtNode & rNode);
+
+ /// get and set TxtNode pointer
+ const SwTxtNode* GetpTxtNode() const { return m_pTxtNode; }
+ inline const SwTxtNode& GetTxtNode() const;
+ void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
+
+ SwCharFmt* GetCharFmt();
+ const SwCharFmt* GetCharFmt() const
+ { return (const_cast<SwTxtRuby*>(this))->GetCharFmt(); }
+};
+
+// --------------- Inline Implementierungen ------------------------
+
+inline const SwTxtNode& SwTxtRuby::GetTxtNode() const
+{
+ ASSERT( m_pTxtNode, "SwTxtRuby: where is my TxtNode?" );
+ return *m_pTxtNode;
+}
+
+#endif
diff --git a/sw/inc/txtflcnt.hxx b/sw/inc/txtflcnt.hxx
new file mode 100644
index 000000000000..8a9dfecb422b
--- /dev/null
+++ b/sw/inc/txtflcnt.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TXTFLCNT_HXX
+#define _TXTFLCNT_HXX
+
+#include <txatbase.hxx>
+
+class SwFlyInCntFrm;
+class SwFrm;
+class SwTxtNode;
+class SwDoc;
+
+// SWTXT_FLYCNT ********************************
+// Attribut fuer zeilengebundene Frames (ohne Endindex)
+
+class SwTxtFlyCnt : public SwTxtAttr
+{
+ SwFlyInCntFrm *_GetFlyFrm( const SwFrm *pCurrFrm );
+
+public:
+ SwTxtFlyCnt( SwFmtFlyCnt& rAttr, xub_StrLen nStart );
+
+ // Setzt den Anker im pFmt und
+ void SetAnchor( const SwTxtNode *pNode );
+
+ inline SwFlyInCntFrm *GetFlyFrm( const SwFrm *pCurrFrm );
+ inline const SwFlyInCntFrm *GetFlyFrm( const SwFrm *pCurrFrm ) const;
+
+ // erzeugt sich ein neues FlyFrameFormat
+ void CopyFlyFmt( SwDoc* pDoc );
+};
+
+inline SwFlyInCntFrm *SwTxtFlyCnt::GetFlyFrm( const SwFrm *pCurrFrm )
+{
+ return _GetFlyFrm( pCurrFrm );
+}
+
+inline const SwFlyInCntFrm *SwTxtFlyCnt::GetFlyFrm( const SwFrm *pCurrFrm ) const
+{
+ return (const_cast<SwTxtFlyCnt*>(this))->_GetFlyFrm( pCurrFrm );
+}
+
+#endif
+
diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx
new file mode 100644
index 000000000000..6dd556a84436
--- /dev/null
+++ b/sw/inc/txtfld.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TXTFLD_HXX
+#define _TXTFLD_HXX
+
+#include <txatbase.hxx>
+#include <tools/string.hxx>
+#include <pam.hxx>
+
+class SwTxtNode;
+
+// ATT_FLD ***********************************
+
+class SwTxtFld : public SwTxtAttr
+{
+ mutable String m_aExpand;
+ SwTxtNode * m_pTxtNode;
+
+public:
+ SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart);
+ virtual ~SwTxtFld();
+
+ void CopyFld( SwTxtFld *pDest ) const;
+ void Expand() const;
+ inline void ExpandAlways();
+
+ // get and set TxtNode pointer
+ SwTxtNode* GetpTxtNode() const { return m_pTxtNode; }
+ inline SwTxtNode& GetTxtNode() const;
+ void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
+ // enable notification that field content has changed and needs reformatting
+ void NotifyContentChange(SwFmtFld& rFmtFld);
+
+ // #111840#
+ /**
+ Returns position of this field.
+
+ @return position of this field. Has to be deleted explicitly.
+ */
+// SwPosition * GetPosition() const;
+};
+
+inline SwTxtNode& SwTxtFld::GetTxtNode() const
+{
+ ASSERT( m_pTxtNode, "SwTxtFld:: where is my TxtNode?" );
+ return *m_pTxtNode;
+}
+
+inline void SwTxtFld::ExpandAlways()
+{
+ m_aExpand += ' ';
+ Expand();
+}
+
+#endif
+
diff --git a/sw/inc/txtftn.hxx b/sw/inc/txtftn.hxx
new file mode 100644
index 000000000000..e8c7c77e8f86
--- /dev/null
+++ b/sw/inc/txtftn.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TXTFTN_HXX
+#define _TXTFTN_HXX
+
+#include <txatbase.hxx>
+
+class SwNodeIndex;
+class SwTxtNode;
+class SwNodes;
+class SwDoc;
+class SwFrm;
+
+// ATT_FTN **********************************************************
+
+class SW_DLLPUBLIC SwTxtFtn : public SwTxtAttr
+{
+ SwNodeIndex * m_pStartNode;
+ SwTxtNode * m_pTxtNode;
+ sal_uInt16 m_nSeqNo;
+
+public:
+ SwTxtFtn( SwFmtFtn& rAttr, xub_StrLen nStart );
+ virtual ~SwTxtFtn();
+
+ inline SwNodeIndex *GetStartNode() const { return m_pStartNode; }
+ void SetStartNode( const SwNodeIndex *pNode, sal_Bool bDelNodes = sal_True );
+ void SetNumber( const sal_uInt16 nNumber, const String* = 0 );
+ void CopyFtn(SwTxtFtn & rDest, SwTxtNode & rDestNode) const;
+
+ // get and set TxtNode pointer
+ inline const SwTxtNode& GetTxtNode() const;
+ void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
+
+ // lege eine neue leere TextSection fuer diese Fussnote an
+ void MakeNewTextSection( SwNodes& rNodes );
+
+ // loesche die FtnFrame aus der Seite
+ void DelFrms( const SwFrm* );
+ // bedingten Absatzvorlagen checken
+ void CheckCondColl();
+
+ // fuer die Querverweise auf Fussnoten
+ sal_uInt16 SetSeqRefNo();
+ void SetSeqNo( sal_uInt16 n ) { m_nSeqNo = n; } // for Readers
+ sal_uInt16 GetSeqRefNo() const { return m_nSeqNo; }
+
+ static void SetUniqueSeqRefNo( SwDoc& rDoc );
+};
+
+inline const SwTxtNode& SwTxtFtn::GetTxtNode() const
+{
+ ASSERT( m_pTxtNode, "SwTxtFtn: where is my TxtNode?" );
+ return *m_pTxtNode;
+}
+
+#endif
+
diff --git a/sw/inc/txtinet.hxx b/sw/inc/txtinet.hxx
new file mode 100644
index 000000000000..5ea0df9fe3b2
--- /dev/null
+++ b/sw/inc/txtinet.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TXTINET_HXX
+#define _TXTINET_HXX
+
+#include <txatbase.hxx>
+#include <txtatr.hxx>
+#include <calbck.hxx>
+
+class SwTxtNode;
+class SwCharFmt;
+
+// ATT_INETFMT *********************************************
+
+class SW_DLLPUBLIC SwTxtINetFmt : public SwTxtAttrNesting, public SwClient
+{
+ SwTxtNode * m_pTxtNode;
+ bool m_bVisited : 1; // visited link?
+ bool m_bVisitedValid : 1; // is m_bVisited valid?
+
+protected:
+virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwTxtINetFmt( SwFmtINetFmt& rAttr, xub_StrLen nStart, xub_StrLen nEnd );
+ virtual ~SwTxtINetFmt();
+ TYPEINFO();
+
+ virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
+
+ SW_DLLPRIVATE void InitINetFmt(SwTxtNode & rNode);
+
+ // get and set TxtNode pointer
+ const SwTxtNode* GetpTxtNode() const { return m_pTxtNode; }
+ inline const SwTxtNode& GetTxtNode() const;
+ void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
+
+ SwCharFmt* GetCharFmt();
+ const SwCharFmt* GetCharFmt() const
+ { return const_cast<SwTxtINetFmt*>(this)->GetCharFmt(); }
+
+ bool IsVisited() const { return m_bVisited; }
+ void SetVisited( bool bNew ) { m_bVisited = bNew; }
+
+ bool IsVisitedValid() const { return m_bVisitedValid; }
+ void SetVisitedValid( bool bNew ) { m_bVisitedValid = bNew; }
+
+ sal_Bool IsProtect() const;
+};
+
+inline const SwTxtNode& SwTxtINetFmt::GetTxtNode() const
+{
+ ASSERT( m_pTxtNode, "SwTxtINetFmt: where is my TxtNode?" );
+ return *m_pTxtNode;
+}
+
+#endif
+
diff --git a/sw/inc/txtrfmrk.hxx b/sw/inc/txtrfmrk.hxx
new file mode 100644
index 000000000000..d5deb2830eac
--- /dev/null
+++ b/sw/inc/txtrfmrk.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TXTRFMRK_HXX
+#define _TXTRFMRK_HXX
+
+#include <txatbase.hxx>
+
+class SwTxtNode;
+
+// SWTXT_REFMARK *************************************
+// Attribut fuer Inhalts-/Positions-Referenzen im Text
+
+class SwTxtRefMark : public SwTxtAttrEnd
+{
+ SwTxtNode * m_pTxtNode;
+ xub_StrLen * m_pEnd; // end is optional (point reference)
+
+public:
+ SwTxtRefMark( SwFmtRefMark& rAttr,
+ xub_StrLen const nStart, xub_StrLen const*const pEnd = 0);
+
+ virtual xub_StrLen * GetEnd(); // SwTxtAttr
+ inline const xub_StrLen * GetEnd() const { return m_pEnd; }
+
+ // get and set TxtNode pointer
+ inline const SwTxtNode& GetTxtNode() const;
+ void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
+};
+
+inline const SwTxtNode& SwTxtRefMark::GetTxtNode() const
+{
+ ASSERT( m_pTxtNode, "SwTxtRefMark: where is my TxtNode?" );
+ return *m_pTxtNode;
+}
+
+#endif
+
diff --git a/sw/inc/txttxmrk.hxx b/sw/inc/txttxmrk.hxx
new file mode 100644
index 000000000000..311432d9287b
--- /dev/null
+++ b/sw/inc/txttxmrk.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TXTTXMRK_HXX
+#define _TXTTXMRK_HXX
+
+#include <txatbase.hxx>
+
+class SwTxtNode;
+class SwDoc;
+
+// SWTXT_TOXMARK *******************************
+// Attribut fuer die Verzeichnisse
+
+class SwTxtTOXMark : public SwTxtAttrEnd
+{
+ SwTxtNode * m_pTxtNode;
+ xub_StrLen * m_pEnd; // 0 if SwTOXMark without AlternativeText
+
+public:
+ SwTxtTOXMark( SwTOXMark& rAttr,
+ xub_StrLen const nStart, xub_StrLen const*const pEnd = 0);
+ virtual ~SwTxtTOXMark();
+
+ virtual xub_StrLen *GetEnd(); // SwTxtAttr
+ inline const xub_StrLen* GetEnd() const { return m_pEnd; }
+
+ void CopyTOXMark( SwDoc* pDestDoc );
+
+ // get and set TxtNode pointer
+ inline const SwTxtNode* GetpTxtNd() const { return m_pTxtNode; }
+ inline const SwTxtNode& GetTxtNode() const;
+ void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
+};
+
+inline const SwTxtNode& SwTxtTOXMark::GetTxtNode() const
+{
+ ASSERT( m_pTxtNode, "SwTxtTOXMark: where is my TxtNode?" );
+ return *m_pTxtNode;
+}
+
+#endif
+
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
new file mode 100644
index 000000000000..9d447c18034f
--- /dev/null
+++ b/sw/inc/undobj.hxx
@@ -0,0 +1,335 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_UNDOBJ_HXX
+#define SW_UNDOBJ_HXX
+
+#include <vector>
+
+#include <boost/shared_ptr.hpp>
+
+#include <svl/undo.hxx>
+
+#include <SwRewriter.hxx>
+#include <swundo.hxx>
+
+
+class SwHistory;
+class SwIndex;
+class SwPaM;
+struct SwPosition;
+class SwDoc;
+class SwTxtFmtColl;
+class SwFrmFmt;
+class SwNodeIndex;
+class SwNodeRange;
+class SwRedlineData;
+class SwRedlineSaveDatas;
+
+namespace sw {
+ class UndoRedoContext;
+ class RepeatContext;
+}
+
+
+class SwUndo
+ : public SfxUndoAction
+{
+ SwUndoId const m_nId;
+ sal_uInt16 nOrigRedlineMode;
+
+protected:
+ bool bCacheComment;
+ mutable String * pComment;
+
+ void RemoveIdxFromSection( SwDoc&, sal_uLong nSttIdx, sal_uLong* pEndIdx = 0 );
+ void RemoveIdxFromRange( SwPaM& rPam, sal_Bool bMoveNext );
+ void RemoveIdxRel( sal_uLong, const SwPosition& );
+
+ static sal_Bool CanRedlineGroup( SwRedlineSaveDatas& rCurr,
+ const SwRedlineSaveDatas& rCheck,
+ sal_Bool bCurrIsEnd );
+
+ // #111827#
+ /**
+ Returns the rewriter for this object.
+
+ @return the rewriter for this object
+ */
+ virtual SwRewriter GetRewriter() const;
+
+ // return type is sal_uInt16 because this overrides SfxUndoAction::GetId()
+ virtual sal_uInt16 GetId() const { return static_cast<sal_uInt16>(m_nId); }
+
+ // the 4 methods that derived classes have to override
+ // base implementation does nothing
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+ virtual bool CanRepeatImpl( ::sw::RepeatContext & ) const;
+public: // should not be public, but ran into trouble in untbl.cxx
+ virtual void UndoImpl( ::sw::UndoRedoContext & ) = 0;
+ virtual void RedoImpl( ::sw::UndoRedoContext & ) = 0;
+
+private:
+ // SfxUndoAction
+ virtual void Undo();
+ virtual void Redo();
+ virtual void UndoWithContext(SfxUndoContext &);
+ virtual void RedoWithContext(SfxUndoContext &);
+ virtual void Repeat(SfxRepeatTarget &);
+ virtual sal_Bool CanRepeat(SfxRepeatTarget &) const;
+
+public:
+ SwUndo(SwUndoId const nId);
+ virtual ~SwUndo();
+
+ // #111827#
+ /**
+ Returns textual comment for this undo object.
+
+ The textual comment is created from the resource string
+ corresponding to this object's ID. The rewriter of this object
+ is applied to the resource string to get the final comment.
+
+ @return textual comment for this undo object
+ */
+ virtual String GetComment() const;
+
+ // das UndoObject merkt sich, welcher Mode eingeschaltet war.
+ // In Undo/Redo/Repeat wird dann immer auf diesen zurueck geschaltet
+ sal_uInt16 GetRedlineMode() const { return nOrigRedlineMode; }
+ void SetRedlineMode( sal_uInt16 eMode ) { nOrigRedlineMode = eMode; }
+
+ bool IsDelBox() const;
+
+ // sicher und setze die RedlineDaten
+ static sal_Bool FillSaveData( const SwPaM& rRange, SwRedlineSaveDatas& rSData,
+ sal_Bool bDelRange = sal_True, sal_Bool bCopyNext = sal_True );
+ static sal_Bool FillSaveDataForFmt( const SwPaM& , SwRedlineSaveDatas& );
+ static void SetSaveData( SwDoc& rDoc, const SwRedlineSaveDatas& rSData );
+ static sal_Bool HasHiddenRedlines( const SwRedlineSaveDatas& rSData );
+};
+
+typedef sal_uInt16 DelCntntType;
+namespace nsDelCntntType
+{
+ const DelCntntType DELCNT_FTN = 0x01;
+ const DelCntntType DELCNT_FLY = 0x02;
+ const DelCntntType DELCNT_TOC = 0x04;
+ const DelCntntType DELCNT_BKM = 0x08;
+ const DelCntntType DELCNT_ALL = 0x0F;
+ const DelCntntType DELCNT_CHKNOCNTNT = 0x80;
+}
+
+/// will DelCntntIndex destroy a frame anchored at character at rAnchorPos?
+bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
+ SwPosition const & rStart, SwPosition const & rEnd,
+ DelCntntType const nDelCntntType = nsDelCntntType::DELCNT_ALL);
+
+// diese Klasse muss in ein Undo-Object vererbt werden, wenn dieses Inhalt
+// fuers Redo/Undo ... speichert
+class SwUndoSaveCntnt
+{
+protected:
+
+ SwHistory* pHistory;
+
+ // wird fuer das loeschen von Inhalt benoetigt. Fuer das ReDo werden
+ // Inhalte in das UndoNodesArray verschoben. Diese Methoden fuegen
+ // am Ende eines TextNodes ein Trenner fuer die Attribute. Damit werden
+ // Attribute nicht expandiert.
+ // MoveTo.. verschiebt aus dem NodesArray in das UndoNodesArray
+ // MoveFrom.. verschiebt aus dem UndoNodesArray in das NodesArray
+ void MoveToUndoNds( SwPaM& rPam,
+ SwNodeIndex* pNodeIdx = 0, SwIndex* pCntIdx = 0,
+ sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
+ void MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx, xub_StrLen nCntntIdx,
+ SwPosition& rInsPos,
+ sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
+
+ // diese beiden Methoden bewegen den SPoint vom Pam zurueck/vor. Damit
+ // kann fuer ein Undo/Redo ein Bereich aufgespannt werden. (Der
+ // SPoint liegt dann vor dem manipuliertem Bereich !!)
+ // Das Flag gibt an, ob noch vorm SPoint Inhalt steht.
+ sal_Bool MovePtBackward( SwPaM& rPam );
+ void MovePtForward( SwPaM& rPam, sal_Bool bMvBkwrd );
+
+ // vor dem Move ins UndoNodes-Array muss dafuer gesorgt werden, das
+ // die Inhaltstragenden Attribute aus dem Nodes-Array entfernt werden.
+ void DelCntntIndex( const SwPosition& pMark, const SwPosition& pPoint,
+ DelCntntType nDelCntntType = nsDelCntntType::DELCNT_ALL );
+
+public:
+ SwUndoSaveCntnt();
+ ~SwUndoSaveCntnt();
+};
+
+
+// sicher eine vollstaendige Section im Nodes-Array
+class SwUndoSaveSection : private SwUndoSaveCntnt
+{
+ SwNodeIndex *pMvStt;
+ SwRedlineSaveDatas* pRedlSaveData;
+ sal_uLong nMvLen; // Index ins UndoNodes-Array
+ sal_uLong nStartPos;
+
+protected:
+ SwNodeIndex* GetMvSttIdx() const { return pMvStt; }
+ sal_uLong GetMvNodeCnt() const { return nMvLen; }
+
+public:
+ SwUndoSaveSection();
+ ~SwUndoSaveSection();
+
+ void SaveSection( SwDoc* pDoc, const SwNodeIndex& rSttIdx );
+ void SaveSection( SwDoc* pDoc, const SwNodeRange& rRange );
+ void RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx, sal_uInt16 nSectType );
+ void RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos );
+
+ const SwHistory* GetHistory() const { return pHistory; }
+ SwHistory* GetHistory() { return pHistory; }
+};
+
+
+// Diese Klasse speichert den Pam als sal_uInt16's und kann diese wieder zu
+// einem PaM zusammensetzen
+class SwUndRng
+{
+public:
+ sal_uLong nSttNode, nEndNode;
+ xub_StrLen nSttCntnt, nEndCntnt;
+
+ SwUndRng();
+ SwUndRng( const SwPaM& );
+
+ void SetValues( const SwPaM& rPam );
+ void SetPaM( SwPaM&, sal_Bool bCorrToCntnt = sal_False ) const;
+ SwPaM & AddUndoRedoPaM(
+ ::sw::UndoRedoContext &, bool const bCorrToCntnt = false) const;
+};
+
+
+
+class SwUndoInsLayFmt;
+
+// base class for insertion of Document, Glossaries and Copy
+class SwUndoInserts : public SwUndo, public SwUndRng, private SwUndoSaveCntnt
+{
+ SwTxtFmtColl *pTxtFmtColl, *pLastNdColl;
+ SvPtrarr* pFrmFmts;
+ ::std::vector< ::boost::shared_ptr<SwUndoInsLayFmt> > m_FlyUndos;
+ SwRedlineData* pRedlData;
+ sal_Bool bSttWasTxtNd;
+protected:
+ sal_uLong nNdDiff;
+ SwPosition *pPos; // Inhalt fuers Redo
+ sal_uInt16 nSetPos; // Start in der History-Liste
+
+ SwUndoInserts( SwUndoId nUndoId, const SwPaM& );
+public:
+ virtual ~SwUndoInserts();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+
+ // setze den Destination-Bereich nach dem Einlesen.
+ void SetInsertRange( const SwPaM&, sal_Bool bScanFlys = sal_True,
+ sal_Bool bSttWasTxtNd = sal_True );
+};
+
+class SwUndoInsDoc : public SwUndoInserts
+{
+public:
+ SwUndoInsDoc( const SwPaM& );
+};
+
+class SwUndoCpyDoc : public SwUndoInserts
+{
+public:
+ SwUndoCpyDoc( const SwPaM& );
+};
+
+
+
+//--------------------------------------------------------------------
+
+class SwUndoFlyBase : public SwUndo, private SwUndoSaveSection
+{
+protected:
+ SwFrmFmt* pFrmFmt; // das gespeicherte FlyFormat
+ sal_uLong nNdPgPos;
+ xub_StrLen nCntPos; // Seite/am Absatz/im Absatz
+ sal_uInt16 nRndId;
+ sal_Bool bDelFmt; // loesche das gespeicherte Format
+
+ void InsFly(::sw::UndoRedoContext & rContext, bool bShowSel = true);
+ void DelFly( SwDoc* );
+
+ SwUndoFlyBase( SwFrmFmt* pFormat, SwUndoId nUndoId );
+
+ SwNodeIndex* GetMvSttIdx() const { return SwUndoSaveSection::GetMvSttIdx(); }
+ sal_uLong GetMvNodeCnt() const { return SwUndoSaveSection::GetMvNodeCnt(); }
+
+public:
+ virtual ~SwUndoFlyBase();
+
+};
+
+class SwUndoInsLayFmt : public SwUndoFlyBase
+{
+ sal_uLong mnCrsrSaveIndexPara; // Cursor position
+ xub_StrLen mnCrsrSaveIndexPos; // for undo
+public:
+ SwUndoInsLayFmt( SwFrmFmt* pFormat, sal_uLong nNodeIdx, xub_StrLen nCntIdx );
+
+ virtual ~SwUndoInsLayFmt();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+
+ String GetComment() const;
+
+};
+
+class SwUndoDelLayFmt : public SwUndoFlyBase
+{
+ sal_Bool bShowSelFrm;
+public:
+ SwUndoDelLayFmt( SwFrmFmt* pFormat );
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+
+ void RedoForRollback();
+
+ void ChgShowSel( sal_Bool bNew ) { bShowSelFrm = bNew; }
+
+ virtual SwRewriter GetRewriter() const;
+
+};
+
+#endif
diff --git a/sw/inc/unoatxt.hxx b/sw/inc/unoatxt.hxx
new file mode 100644
index 000000000000..01033eb856ec
--- /dev/null
+++ b/sw/inc/unoatxt.hxx
@@ -0,0 +1,306 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOATXT_HXX
+#define _UNOATXT_HXX
+
+#include <com/sun/star/text/XAutoTextGroup.hpp>
+#include <com/sun/star/text/XAutoTextEntry.hpp>
+#include <com/sun/star/text/XAutoTextContainer.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <svl/itemprop.hxx>
+#include <svl/lstner.hxx>
+#include <cppuhelper/implbase3.hxx> // helper for implementations
+#include <cppuhelper/implbase4.hxx> // helper for implementations
+#include <cppuhelper/implbase5.hxx> // helper for implementations
+#include <cppuhelper/implbase6.hxx> // helper for implementations
+#include <svtools/unoevent.hxx>
+class SwTextBlocks;
+class SwGlossaries;
+class SwDoc;
+class SwDocShell;
+class SwXBodyText;
+
+#ifndef SW_DECL_SWDOCSHELL_DEFINED
+#define SW_DECL_SWDOCSHELL_DEFINED
+#include <tools/ref.hxx>
+SV_DECL_REF( SwDocShell )
+#endif
+
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ SAL_CALL SwXAutoTextContainer_createInstance(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw ( ::com::sun::star::uno::Exception );
+
+class SwXAutoTextContainer : public cppu::WeakImplHelper3
+<
+ ::com::sun::star::text::XAutoTextContainer,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::container::XIndexAccess
+>
+{
+ SwGlossaries *pGlossaries;
+
+protected:
+ virtual ~SwXAutoTextContainer(); // ref-counted objects are not to be deleted from outside -> protected dtor
+
+public:
+ SwXAutoTextContainer();
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XAutoTextContainer
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextGroup > SAL_CALL insertNewByName(const rtl::OUString& aGroupName) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeByName(const rtl::OUString& aGroupName) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+/* -----------------26.05.98 15:55-------------------
+ *
+ * --------------------------------------------------*/
+class SwXAutoTextGroup : public cppu::WeakImplHelper6
+<
+ ::com::sun::star::text::XAutoTextGroup,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XUnoTunnel
+>
+{
+ const SfxItemPropertySet* pPropSet;
+ SwGlossaries* pGlossaries;
+ rtl::OUString sName;
+ String m_sGroupName; // prefix m_ to disambiguate from some local vars in the implementation
+
+protected:
+ virtual ~SwXAutoTextGroup(); // ref-counted objects are not to be deleted from outside -> protected dtor
+
+public:
+ SwXAutoTextGroup(const rtl::OUString& rName, SwGlossaries* pGloss/*SwTextBlocks* pGroup*/);
+
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XAutoTextGroup
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getTitles(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL renameByName(const rtl::OUString& aElementName, const rtl::OUString& aNewElementName, const rtl::OUString& aNewElementTitle) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextEntry > SAL_CALL insertNewByName(const rtl::OUString& aName, const rtl::OUString& aTitle, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeByName(const rtl::OUString& aEntryName) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException );
+
+ //XNamed
+ virtual rtl::OUString SAL_CALL getName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setName(const rtl::OUString& Name_) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //
+ void Invalidate();
+};
+
+/* -----------------17.06.98 12:03-------------------
+ *
+ * --------------------------------------------------*/
+class SwXAutoTextEntry
+ :public SfxListener
+ ,public cppu::WeakImplHelper5
+ <
+ ::com::sun::star::text::XAutoTextEntry,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::text::XText,
+ ::com::sun::star::document::XEventsSupplier
+ >
+{
+ SwGlossaries* pGlossaries;
+ String sGroupName;
+ String sEntryName;
+ SwDocShellRef xDocSh;
+ SwXBodyText* pBodyText;
+ com::sun::star::uno::Reference < com::sun::star::lang::XServiceInfo> xBodyText;
+
+ void EnsureBodyText ()
+ {
+ if ( !pBodyText )
+ GetBodyText();
+ }
+ void GetBodyText ();
+
+protected:
+ /** ensure that the current content (which may only be in-memory so far) is flushed to the auto text group file
+
+ <p>If somebody modifies an auto text via this class, then this is not directly reflected to the respective
+ glossaries file (on disk), instead we hold a copy of this text (in [p|x]BodyText). On the other hand,
+ in applyTo, we do not work with this _copy_, but just tell the target for the application to insert
+ the content which we're responsible for - and this target doesn't know about our copy, but only
+ about the persistent version.</br>
+ So we need to ensure that before somebody else does something with our auto text, we flush our
+ (in-memory) copy to disk.</p>
+
+ */
+ void implFlushDocument( bool _bCloseDoc = false );
+
+ // SfxListener overridables
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+protected:
+ virtual ~SwXAutoTextEntry(); // ref-counted objects are not to be deleted from outside -> protected dtor
+
+public:
+ SwXAutoTextEntry(SwGlossaries* , const String& rGroupName, const String& rEntryName);
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XText
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & aTextPosition) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL insertString(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xRange, const rtl::OUString& aString, sal_Bool bAbsorb) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL insertControlCharacter(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL insertTextContent(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xRange, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & xContent, sal_Bool bAbsorb) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeTextContent(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & xContent) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+
+ //XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL getString(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setString(const rtl::OUString& aString) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XAutoTextEntry
+ virtual void SAL_CALL applyTo(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xRange)throw( ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XEventsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw( ::com::sun::star::uno::RuntimeException );
+
+ void Invalidate() {pGlossaries = 0;}
+ const SwGlossaries* GetGlossaries() { return pGlossaries; }
+ const String& GetGroupName() {return sGroupName;}
+ const String& GetEntryName() {return sEntryName;}
+};
+
+
+/** Implement the XNameAccess for the AutoText events */
+class SwAutoTextEventDescriptor : public SvBaseEventDescriptor
+{
+ ::rtl::OUString sSwAutoTextEventDescriptor;
+
+ SwXAutoTextEntry& rAutoTextEntry;
+
+ using SvBaseEventDescriptor::replaceByName;
+ using SvBaseEventDescriptor::getByName;
+
+public:
+ SwAutoTextEventDescriptor( SwXAutoTextEntry& rAutoText );
+
+ ~SwAutoTextEventDescriptor();
+
+ virtual rtl::OUString SAL_CALL getImplementationName(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+protected:
+
+ virtual void replaceByName(
+ const sal_uInt16 nEvent, /// item ID of event
+ const SvxMacro& rMacro) /// event (will be copied)
+ throw(
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void getByName(
+ SvxMacro& rMacro, /// macro to be filled
+ const sal_uInt16 nEvent ) /// item ID of event
+ throw(
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif
diff --git a/sw/inc/unobaseclass.hxx b/sw/inc/unobaseclass.hxx
new file mode 100644
index 000000000000..9e3425e04c90
--- /dev/null
+++ b/sw/inc/unobaseclass.hxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_UNOBASECLASS_HXX
+#define SW_UNOBASECLASS_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+
+class SfxPoolItem;
+class SwClient;
+class SwDoc;
+
+
+typedef ::cppu::WeakImplHelper2
+< ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::container::XEnumeration
+>
+SwSimpleEnumeration_Base;
+
+
+/* -----------------29.04.98 07:35-------------------
+ *
+ * --------------------------------------------------*/
+enum CursorType
+{
+ CURSOR_INVALID,
+ CURSOR_BODY,
+ CURSOR_FRAME,
+ CURSOR_TBLTEXT,
+ CURSOR_FOOTNOTE,
+ CURSOR_HEADER,
+ CURSOR_FOOTER,
+ CURSOR_REDLINE,
+ CURSOR_ALL, // for Search&Replace
+ CURSOR_SELECTION, // create a paragraph enumeration from
+ // a text range or cursor
+ CURSOR_SELECTION_IN_TABLE,
+ CURSOR_META, // meta/meta-field
+};
+
+/*-----------------04.03.98 11:54-------------------
+ Start/EndAction or Start/EndAllAction
+ -------------------------------------------------- */
+class UnoActionContext
+{
+ private:
+ SwDoc * m_pDoc;
+
+ public:
+ UnoActionContext(SwDoc *const pDoc);
+ ~UnoActionContext();
+
+ void InvalidateDocument() { m_pDoc = 0; }
+};
+
+/* -----------------07.07.98 12:03-------------------
+ interrupt Actions for a little while
+ -------------------------------------------------- */
+class UnoActionRemoveContext
+{
+ private:
+ SwDoc *const m_pDoc;
+
+ public:
+ UnoActionRemoveContext(SwDoc *const pDoc);
+ ~UnoActionRemoveContext();
+};
+
+
+::com::sun::star::uno::Sequence< sal_Int8 > CreateUnoTunnelId();
+
+/// helper function for implementing SwClient::Modify
+void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem *pNew);
+
+
+#include <boost/utility.hpp>
+#include <osl/diagnose.h>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+namespace sw {
+
+ template<typename T> class UnoImplPtr
+ : private ::boost::noncopyable
+ {
+ private:
+ T * m_p;
+
+ public:
+ UnoImplPtr(T *const i_p)
+ : m_p(i_p)
+ {
+ OSL_ENSURE(i_p, "UnoImplPtr: null");
+ }
+
+ ~UnoImplPtr()
+ {
+ ::vos::OGuard g(Application::GetSolarMutex());
+ delete m_p; // #i105557#: call dtor with locked solar mutex
+ m_p = 0;
+ }
+
+ T & operator * () const { return *m_p; }
+
+ T * operator ->() const { return m_p; }
+
+ T * get () const { return m_p; }
+ };
+
+ template< class C > C *
+ UnoTunnelGetImplementation(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XUnoTunnel > const & xUnoTunnel)
+ {
+ if (!xUnoTunnel.is()) { return 0; }
+ C *const pC( reinterpret_cast< C* >(
+ ::sal::static_int_cast< sal_IntPtr >(
+ xUnoTunnel->getSomething(C::getUnoTunnelId()))));
+ return pC;
+ }
+
+ template< class C > sal_Int64
+ UnoTunnelImpl(const ::com::sun::star::uno::Sequence< sal_Int8 > & rId,
+ C *const pThis)
+ {
+ if ((rId.getLength() == 16) &&
+ (0 == rtl_compareMemory(C::getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16)))
+ {
+ return ::sal::static_int_cast< sal_Int64 >(
+ reinterpret_cast< sal_IntPtr >(pThis) );
+ }
+ return 0;
+ }
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ GetSupportedServiceNamesImpl(
+ size_t const nServices, char const*const pServices[]);
+ sal_Bool SupportsServiceImpl(
+ size_t const nServices, char const*const pServices[],
+ ::rtl::OUString const & rServiceName);
+
+} // namespace sw
+
+#endif // SW_UNOBASECLASS_HXX
+
diff --git a/sw/inc/unobookmark.hxx b/sw/inc/unobookmark.hxx
new file mode 100644
index 000000000000..a212efd933f3
--- /dev/null
+++ b/sw/inc/unobookmark.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOBOOKMARK_HXX
+#define SW_UNOBOOKMARK_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XFormField.hpp>
+
+#include <cppuhelper/implbase5.hxx>
+
+#include <sfx2/Metadatable.hxx>
+
+#include <unobaseclass.hxx>
+#include <IDocumentMarkAccess.hxx>
+
+
+class SwDoc;
+
+
+typedef ::cppu::ImplInheritanceHelper5
+< ::sfx2::MetadatableMixin
+, ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::container::XNamed
+, ::com::sun::star::text::XTextContent
+> SwXBookmark_Base;
+
+class SwXBookmark
+ : public SwXBookmark_Base
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+protected:
+
+ void attachToRangeEx(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange,
+ IDocumentMarkAccess::MarkType eType)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual void attachToRange(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ const ::sw::mark::IMark* GetBookmark() const;
+
+ virtual ~SwXBookmark();
+
+ /// @param pDoc and pMark != 0, but not & because of ImplInheritanceHelper
+ SwXBookmark(::sw::mark::IMark *const pMark, SwDoc *const pDoc);
+
+public:
+
+ /// descriptor
+ SwXBookmark();
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent>
+ CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark);
+
+ /// @return IMark for this, but only if it lives in pDoc
+ static ::sw::mark::IMark const* GetBookmarkInDoc(SwDoc const*const pDoc,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XUnoTunnel> & xUT);
+
+ // MetadatableMixin
+ virtual ::sfx2::Metadatable* GetCoreObject();
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > GetModel();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName(const ::rtl::OUString& rName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+class SwXFieldmarkParameters
+ : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XNameContainer>
+ , private SwClient
+{
+ public:
+ SwXFieldmarkParameters(::sw::mark::IFieldmark* const pFieldmark)
+ {
+ pFieldmark->Add(this);
+ }
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ // XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
+ protected:
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
+ private:
+ ::sw::mark::IFieldmark::parameter_map_t* getCoreParameters() throw (::com::sun::star::uno::RuntimeException);
+};
+
+typedef cppu::ImplInheritanceHelper1< SwXBookmark,
+ ::com::sun::star::text::XFormField > SwXFieldmark_Base;
+
+class SwXFieldmark
+ : public SwXFieldmark_Base
+{
+
+private:
+
+ bool isReplacementObject;
+
+public:
+
+ SwXFieldmark(bool isReplacementObject,
+ ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0);
+
+ virtual void attachToRange(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getFieldType(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setFieldType(const ::rtl::OUString& description )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getParameters( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // SW_UNOBOOKMARK_HXX
+
diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx
new file mode 100644
index 000000000000..de8a78610bf5
--- /dev/null
+++ b/sw/inc/unochart.hxx
@@ -0,0 +1,432 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOCHART_HXX
+#define _UNOCHART_HXX
+
+#include <map>
+#include <set>
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/data/XDataSequence.hpp>
+#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
+#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
+#include <com/sun/star/chart2/data/DataSequenceRole.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+
+#include <cppuhelper/interfacecontainer.h> //OMultiTypeInterfaceContainerHelper
+#include <cppuhelper/implbase2.hxx> // helper for implementations
+#include <cppuhelper/implbase4.hxx> // helper for implementations
+#include <cppuhelper/implbase6.hxx> // helper for implementations
+#include <cppuhelper/implbase10.hxx> // helper for implementations
+#include <cppuhelper/weakref.hxx>
+
+#include <tools/string.hxx>
+#include <tools/link.hxx>
+#include <vcl/timer.hxx>
+
+#include <calbck.hxx>
+
+
+class SfxItemPropertySet;
+class SwDoc;
+class SwTable;
+class SwTableBox;
+class SwUnoCrsr;
+struct SwRangeDescriptor;
+class SwSelBoxes;
+class SwFrmFmt;
+
+//////////////////////////////////////////////////////////////////////
+
+sal_Bool FillRangeDescriptor( SwRangeDescriptor &rDesc, const String &rCellRangeName );
+
+//////////////////////////////////////////////////////////////////////
+
+class SwChartHelper
+{
+public:
+ static void DoUpdateAllCharts( SwDoc* pDoc );
+};
+
+//////////////////////////////////////////////////////////////////////
+
+class SwChartLockController_Helper
+{
+ SwDoc *pDoc;
+
+ DECL_LINK( DoUnlockAllCharts, Timer * );
+ Timer aUnlockTimer; // timer to unlock chart controllers
+ bool bIsLocked;
+
+
+ // disallow use of d-tor, copy c-tor and assignment operator
+ SwChartLockController_Helper( const SwChartLockController_Helper & );
+ SwChartLockController_Helper & operator = ( const SwChartLockController_Helper & );
+
+ void LockUnlockAllCharts( sal_Bool bLock );
+ void LockAllCharts() { LockUnlockAllCharts( sal_True ); };
+ void UnlockAllCharts() { LockUnlockAllCharts( sal_False ); };
+
+public:
+ SwChartLockController_Helper( SwDoc *pDocument );
+ ~SwChartLockController_Helper();
+
+ void StartOrContinueLocking();
+ void Disconnect();
+};
+
+//////////////////////////////////////////////////////////////////////
+
+typedef cppu::WeakImplHelper4
+<
+ ::com::sun::star::chart2::data::XDataProvider,
+ ::com::sun::star::chart2::data::XRangeXMLConversion,
+ ::com::sun::star::lang::XComponent,
+ ::com::sun::star::lang::XServiceInfo
+>
+SwChartDataProviderBaseClass;
+
+class SwChartDataProvider :
+ public SwChartDataProviderBaseClass,
+ public SwClient
+{
+
+ // used to keep weak-references to all data-sequences of a single table
+ // see set definition below...
+ struct lt_DataSequenceRef
+ {
+ bool operator()( ::com::sun::star::uno::WeakReference< ::com::sun::star::chart2::data::XDataSequence > xWRef1, ::com::sun::star::uno::WeakReference< ::com::sun::star::chart2::data::XDataSequence > xWRef2 ) const
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > xRef1( xWRef1 );
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > xRef2( xWRef2 );
+ return xRef1.get() < xRef2.get();
+ }
+ };
+ typedef std::set< ::com::sun::star::uno::WeakReference < ::com::sun::star::chart2::data::XDataSequence >, lt_DataSequenceRef > Set_DataSequenceRef_t;
+
+ // map of data-sequence sets for each table
+ struct lt_SwTable_Ptr
+ {
+ bool operator()( const SwTable *p1, const SwTable *p2 ) const
+ {
+ return p1 < p2;
+ }
+ };
+ typedef std::map< const SwTable *, Set_DataSequenceRef_t, lt_SwTable_Ptr > Map_Set_DataSequenceRef_t;
+
+
+ // map of all data-sequences provided directly or indirectly (e.g. via
+ // data-source) by this object. Since there is only one object of this type
+ // for each document it should hold references to all used data-sequences for
+ // all tables of the document.
+ mutable Map_Set_DataSequenceRef_t aDataSequences;
+
+ ::cppu::OInterfaceContainerHelper aEvtListeners;
+ const SwDoc * pDoc;
+ sal_Bool bDisposed;
+
+
+ // disallow use of c-tor and assignment operator
+ SwChartDataProvider( const SwChartDataProvider & );
+ SwChartDataProvider & operator = ( const SwChartDataProvider & );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > SAL_CALL Impl_createDataSource( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments, sal_Bool bTestOnly = sal_False ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL Impl_createDataSequenceByRangeRepresentation( const ::rtl::OUString& aRangeRepresentation, sal_Bool bTestOnly = sal_False ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ rtl::OUString GetBrokenCellRangeForExport( const rtl::OUString &rCellRangeRepresentation );
+
+protected:
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwChartDataProvider( const SwDoc* pDoc );
+ virtual ~SwChartDataProvider();
+
+ // XDataProvider
+ virtual ::sal_Bool SAL_CALL createDataSourcePossible( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > SAL_CALL createDataSource( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible( const ::rtl::OUString& aRangeRepresentation ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation( const ::rtl::OUString& aRangeRepresentation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XRangeXMLConversion
+ virtual ::rtl::OUString SAL_CALL convertRangeToXML( const ::rtl::OUString& aRangeRepresentation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL convertRangeFromXML( const ::rtl::OUString& aXMLRange ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+
+ void AddDataSequence( const SwTable &rTable, ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > &rxDataSequence );
+ void RemoveDataSequence( const SwTable &rTable, ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > &rxDataSequence );
+
+ // will send modifdied events for all data-sequences of the table
+ void InvalidateTable( const SwTable *pTable );
+ sal_Bool DeleteBox( const SwTable *pTable, const SwTableBox &rBox );
+ void DisposeAllDataSequences( const SwTable *pTable );
+
+ // functionality needed to get notified about new added rows/cols
+ void AddRowCols( const SwTable &rTable, const SwSelBoxes& rBoxes, sal_uInt16 nLines, sal_Bool bBehind );
+};
+
+//////////////////////////////////////////////////////////////////////
+
+typedef cppu::WeakImplHelper2
+<
+ ::com::sun::star::chart2::data::XDataSource,
+ ::com::sun::star::lang::XServiceInfo
+>
+SwChartDataSourceBaseClass;
+
+class SwChartDataSource :
+ public SwChartDataSourceBaseClass
+{
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::chart2::data::XLabeledDataSequence > > aLDS;
+
+ // disallow use of c-tor and assignment operator
+ SwChartDataSource( const SwChartDataSource & );
+ SwChartDataSource & operator = ( const SwChartDataSource & );
+
+public:
+ SwChartDataSource( const com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::chart2::data::XLabeledDataSequence > > &rLDS );
+ virtual ~SwChartDataSource();
+
+ // XDataSource
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+//////////////////////////////////////////////////////////////////////
+
+typedef cppu::WeakImplHelper10
+<
+ ::com::sun::star::chart2::data::XDataSequence,
+ ::com::sun::star::chart2::data::XTextualDataSequence,
+ ::com::sun::star::chart2::data::XNumericalDataSequence,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::util::XModifiable,
+ ::com::sun::star::lang::XEventListener,
+ ::com::sun::star::lang::XComponent
+>
+SwChartDataSequenceBaseClass;
+
+class SwChartDataSequence :
+ public SwChartDataSequenceBaseClass,
+ public SwClient
+{
+ ::cppu::OInterfaceContainerHelper aEvtListeners;
+ ::cppu::OInterfaceContainerHelper aModifyListeners;
+ ::com::sun::star::chart2::data::DataSequenceRole aRole;
+
+ String aRowLabelText;
+ String aColLabelText;
+
+ // holds a reference to the data-provider to guarantee it's lifetime last as
+ // long as the pointer may be used.
+ ::com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider > xDataProvider;
+ SwChartDataProvider * pDataProvider;
+
+ SwUnoCrsr* pTblCrsr; // cursor spanned over cells to use
+ SwDepend aCursorDepend; //the cursor is removed after the doc has been removed
+
+ const SfxItemPropertySet* _pPropSet;
+
+ sal_Bool bDisposed;
+
+ // disallow use of c-tor and assignment operator
+ SwChartDataSequence( const SwChartDataSequence &rObj );
+ SwChartDataSequence & operator = ( const SwChartDataSequence & );
+
+protected:
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwChartDataSequence( SwChartDataProvider &rProvider,
+ SwFrmFmt &rTblFmt,
+ SwUnoCrsr *pTableCursor );
+ virtual ~SwChartDataSequence();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XDataSequence
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getData( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL generateLabel( ::com::sun::star::chart2::data::LabelOrigin eLabelOrigin ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XTextualDataSequence
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XNumericalDataSequence
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getNumericalData( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XModifiable
+ virtual ::sal_Bool SAL_CALL isModified( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setModified( ::sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+ // XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+ sal_Bool DeleteBox( const SwTableBox &rBox );
+
+ void FillRangeDesc( SwRangeDescriptor &rRangeDesc ) const;
+ bool ExtendTo( bool bExtendCol, sal_Int32 nFirstNew, sal_Int32 nCount );
+};
+
+//////////////////////////////////////////////////////////////////////
+
+typedef cppu::WeakImplHelper6
+<
+ ::com::sun::star::chart2::data::XLabeledDataSequence,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::util::XModifyListener,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::lang::XComponent
+>
+SwChartLabeledDataSequenceBaseClass;
+
+class SwChartLabeledDataSequence :
+ public SwChartLabeledDataSequenceBaseClass
+{
+ ::cppu::OInterfaceContainerHelper aEvtListeners;
+ ::cppu::OInterfaceContainerHelper aModifyListeners;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > xData;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > xLabels;
+
+ sal_Bool bDisposed;
+
+ // disallow use of c-tor and assignment operator
+ SwChartLabeledDataSequence( const SwChartLabeledDataSequence & );
+ SwChartLabeledDataSequence & operator = ( const SwChartLabeledDataSequence & );
+
+ void SetDataSequence( ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& rxDest, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& rxSource );
+
+
+public:
+ SwChartLabeledDataSequence();
+ virtual ~SwChartLabeledDataSequence();
+
+ // XLabeledDataSequence
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL getValues( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setValues( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSequence ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL getLabel( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLabel( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSequence ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+//////////////////////////////////////////////////////////////////////
+
+#endif
+
diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx
new file mode 100644
index 000000000000..8b799ad98b9b
--- /dev/null
+++ b/sw/inc/unocoll.hxx
@@ -0,0 +1,581 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOCOLL_HXX
+#define _UNOCOLL_HXX
+#include <tools/solar.h>
+#include <flyenum.hxx>
+#include <vcl/timer.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <tools/string.hxx>
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <cppuhelper/implbase2.hxx> // helper for implementations
+#include <cppuhelper/implbase3.hxx> // helper for implementations
+#include <cppuhelper/implbase4.hxx> // helper for implementations
+#include <IMark.hxx>
+#include <unobaseclass.hxx>
+#include "swdllapi.h"
+/***************************************************
+ ***************************************************
+ *
+ ***************************************************/
+class SwDoc;
+class SwFrmFmt;
+namespace com{namespace sun {namespace star {namespace text
+{
+ class XTextTable;
+ class XTextSection;
+ class XFootnote;
+}}}}
+class SwXFrame;
+class SwFrmFmt;
+class SwFmtFtn;
+class XBookmark;
+class SwXReferenceMark;
+class SwSectionFmt;
+class SwFmtRefMark;
+class SwXReferenceMark;
+class SwXBookmark;
+/*-----------------11.03.98 11:19-------------------
+
+--------------------------------------------------*/
+class SwUnoCollection
+{
+ SwDoc* pDoc;
+ sal_Bool bObjectValid;
+
+ public:
+ SwUnoCollection(SwDoc* p) :
+ pDoc(p),
+ bObjectValid(sal_True){}
+
+ virtual void Invalidate();
+ sal_Bool IsValid() const {return bObjectValid;}
+
+
+ SwDoc* GetDoc() const {return pDoc;}
+};
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+#define SW_SERVICE_TYPE_TEXTTABLE 0
+#define SW_SERVICE_TYPE_TEXTFRAME 1
+#define SW_SERVICE_TYPE_GRAPHIC 2
+#define SW_SERVICE_TYPE_OLE 3
+#define SW_SERVICE_TYPE_BOOKMARK 4
+#define SW_SERVICE_TYPE_FOOTNOTE 5
+#define SW_SERVICE_TYPE_ENDNOTE 6
+#define SW_SERVICE_TYPE_INDEXMARK 7
+#define SW_SERVICE_TYPE_INDEX 8
+#define SW_SERVICE_REFERENCE_MARK 9
+#define SW_SERVICE_STYLE_CHARACTER_STYLE 10
+#define SW_SERVICE_STYLE_PARAGRAPH_STYLE 11
+#define SW_SERVICE_STYLE_FRAME_STYLE 12
+#define SW_SERVICE_STYLE_PAGE_STYLE 13
+#define SW_SERVICE_STYLE_NUMBERING_STYLE 14
+#define SW_SERVICE_CONTENT_INDEX_MARK 15
+#define SW_SERVICE_CONTENT_INDEX 16
+#define SW_SERVICE_USER_INDEX_MARK 17
+#define SW_SERVICE_USER_INDEX 18
+#define SW_SERVICE_TEXT_SECTION 19
+#define SW_SERVICE_FIELDTYPE_DATETIME 20
+#define SW_SERVICE_FIELDTYPE_USER 21
+#define SW_SERVICE_FIELDTYPE_SET_EXP 22
+#define SW_SERVICE_FIELDTYPE_GET_EXP 23
+#define SW_SERVICE_FIELDTYPE_FILE_NAME 24
+#define SW_SERVICE_FIELDTYPE_PAGE_NUM 25
+#define SW_SERVICE_FIELDTYPE_AUTHOR 26
+#define SW_SERVICE_FIELDTYPE_CHAPTER 27
+#define SW_SERVICE_FIELDTYPE_DUMMY_0 28
+#define SW_SERVICE_FIELDTYPE_GET_REFERENCE 29
+#define SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT 30
+#define SW_SERVICE_FIELDTYPE_ANNOTATION 31
+#define SW_SERVICE_FIELDTYPE_INPUT 32
+#define SW_SERVICE_FIELDTYPE_MACRO 33
+#define SW_SERVICE_FIELDTYPE_DDE 34
+#define SW_SERVICE_FIELDTYPE_HIDDEN_PARA 35
+#define SW_SERVICE_FIELDTYPE_DOC_INFO 36
+#define SW_SERVICE_FIELDTYPE_TEMPLATE_NAME 37
+#define SW_SERVICE_FIELDTYPE_USER_EXT 38
+#define SW_SERVICE_FIELDTYPE_REF_PAGE_SET 39
+#define SW_SERVICE_FIELDTYPE_REF_PAGE_GET 40
+#define SW_SERVICE_FIELDTYPE_JUMP_EDIT 41
+#define SW_SERVICE_FIELDTYPE_SCRIPT 42
+#define SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET 43
+#define SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET 44
+#define SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM 45
+#define SW_SERVICE_FIELDTYPE_DATABASE 46
+#define SW_SERVICE_FIELDTYPE_DATABASE_NAME 47
+#define SW_SERVICE_FIELDTYPE_TABLE_FORMULA 48
+#define SW_SERVICE_FIELDTYPE_PAGE_COUNT 49
+#define SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT 50
+#define SW_SERVICE_FIELDTYPE_WORD_COUNT 51
+#define SW_SERVICE_FIELDTYPE_CHARACTER_COUNT 52
+#define SW_SERVICE_FIELDTYPE_TABLE_COUNT 53
+#define SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT 54
+#define SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT 55
+#define SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR 56
+#define SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME 57
+#define SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME 58
+#define SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION 59
+#define SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR 60
+#define SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME 61
+#define SW_SERVICE_FIELDTYPE_DUMMY_O 62
+#define SW_SERVICE_FIELDTYPE_DUMMY_1 63
+#define SW_SERVICE_FIELDTYPE_DUMMY_2 64
+#define SW_SERVICE_FIELDTYPE_DUMMY_3 65
+#define SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM 66
+#define SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR 67
+#define SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME 68
+#define SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS 69
+#define SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT 70
+#define SW_SERVICE_FIELDTYPE_DOCINFO_TITLE 71
+#define SW_SERVICE_FIELDTYPE_DOCINFO_REVISION 72
+#define SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY 73
+#define SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS 74
+#define SW_SERVICE_FIELDTYPE_DROPDOWN 75
+#define SW_SERVICE_FIELDTYPE_METAFIELD 76
+#define SW_SERVICE_FIELDTYPE_DUMMY_4 77
+#define SW_SERVICE_FIELDTYPE_DUMMY_5 78
+#define SW_SERVICE_FIELDTYPE_DUMMY_6 79
+#define SW_SERVICE_FIELDTYPE_DUMMY_7 80
+#define SW_SERVICE_FIELDMASTER_USER 81
+#define SW_SERVICE_FIELDMASTER_DDE 82
+#define SW_SERVICE_FIELDMASTER_SET_EXP 83
+#define SW_SERVICE_FIELDMASTER_DATABASE 84
+#define SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY 85
+#define SW_SERVICE_FIELDMASTER_DUMMY2 86
+#define SW_SERVICE_FIELDMASTER_DUMMY3 87
+#define SW_SERVICE_FIELDMASTER_DUMMY4 88
+#define SW_SERVICE_FIELDMASTER_DUMMY5 89
+#define SW_SERVICE_INDEX_ILLUSTRATIONS 90
+#define SW_SERVICE_INDEX_OBJECTS 91
+#define SW_SERVICE_INDEX_TABLES 92
+#define SW_SERVICE_INDEX_BIBLIOGRAPHY 93
+#define SW_SERVICE_PARAGRAPH 94
+#define SW_SERVICE_FIELDTYPE_INPUT_USER 95
+#define SW_SERVICE_FIELDTYPE_HIDDEN_TEXT 96
+#define SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE 97
+#define SW_SERVICE_NUMBERING_RULES 98
+#define SW_SERVICE_TEXT_COLUMNS 99
+#define SW_SERVICE_INDEX_HEADER_SECTION 100
+#define SW_SERVICE_DEFAULTS 101
+#define SW_SERVICE_IMAP_RECTANGLE 102
+#define SW_SERVICE_IMAP_CIRCLE 103
+#define SW_SERVICE_IMAP_POLYGON 104
+#define SW_SERVICE_TYPE_TEXT_GRAPHIC 105
+#define SW_SERVICE_CHART2_DATA_PROVIDER 106
+#define SW_SERVICE_TYPE_FIELDMARK 107
+#define SW_SERVICE_TYPE_FORMFIELDMARK 108
+#define SW_SERVICE_TYPE_META 109
+
+#define SW_SERVICE_LAST SW_SERVICE_TYPE_META
+
+#define SW_SERVICE_INVALID USHRT_MAX
+
+//
+// case-corrected versions of service-names (see #i67811)
+//
+#define CSS_TEXT_TEXTFIELD_DATE_TIME "com.sun.star.text.textfield.DateTime"
+#define CSS_TEXT_TEXTFIELD_USER "com.sun.star.text.textfield.User"
+#define CSS_TEXT_TEXTFIELD_SET_EXPRESSION "com.sun.star.text.textfield.SetExpression"
+#define CSS_TEXT_TEXTFIELD_GET_EXPRESSION "com.sun.star.text.textfield.GetExpression"
+#define CSS_TEXT_TEXTFIELD_FILE_NAME "com.sun.star.text.textfield.FileName"
+#define CSS_TEXT_TEXTFIELD_PAGE_NUMBER "com.sun.star.text.textfield.PageNumber"
+#define CSS_TEXT_TEXTFIELD_AUTHOR "com.sun.star.text.textfield.Author"
+#define CSS_TEXT_TEXTFIELD_CHAPTER "com.sun.star.text.textfield.Chapter"
+#define CSS_TEXT_TEXTFIELD_GET_REFERENCE "com.sun.star.text.textfield.GetReference"
+#define CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT "com.sun.star.text.textfield.ConditionalText"
+#define CSS_TEXT_TEXTFIELD_ANNOTATION "com.sun.star.text.textfield.Annotation"
+#define CSS_TEXT_TEXTFIELD_INPUT "com.sun.star.text.textfield.Input"
+#define CSS_TEXT_TEXTFIELD_MACRO "com.sun.star.text.textfield.Macro"
+#define CSS_TEXT_TEXTFIELD_DDE "com.sun.star.text.textfield.DDE"
+#define CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH "com.sun.star.text.textfield.HiddenParagraph"
+#define CSS_TEXT_TEXTFIELD_TEMPLATE_NAME "com.sun.star.text.textfield.TemplateName"
+#define CSS_TEXT_TEXTFIELD_EXTENDED_USER "com.sun.star.text.textfield.ExtendedUser"
+#define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_SET "com.sun.star.text.textfield.ReferencePageSet"
+#define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_GET "com.sun.star.text.textfield.ReferencePageGet"
+#define CSS_TEXT_TEXTFIELD_JUMP_EDIT "com.sun.star.text.textfield.JumpEdit"
+#define CSS_TEXT_TEXTFIELD_SCRIPT "com.sun.star.text.textfield.Script"
+#define CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET "com.sun.star.text.textfield.DatabaseNextSet"
+#define CSS_TEXT_TEXTFIELD_DATABASE_NUMBER_OF_SET "com.sun.star.text.textfield.DatabaseNumberOfSet"
+#define CSS_TEXT_TEXTFIELD_DATABASE_SET_NUMBER "com.sun.star.text.textfield.DatabaseSetNumber"
+#define CSS_TEXT_TEXTFIELD_DATABASE "com.sun.star.text.textfield.Database"
+#define CSS_TEXT_TEXTFIELD_DATABASE_NAME "com.sun.star.text.textfield.DatabaseName"
+#define CSS_TEXT_TEXTFIELD_TABLE_FORMULA "com.sun.star.text.textfield.TableFormula"
+#define CSS_TEXT_TEXTFIELD_PAGE_COUNT "com.sun.star.text.textfield.PageCount"
+#define CSS_TEXT_TEXTFIELD_PARAGRAPH_COUNT "com.sun.star.text.textfield.ParagraphCount"
+#define CSS_TEXT_TEXTFIELD_WORD_COUNT "com.sun.star.text.textfield.WordCount"
+#define CSS_TEXT_TEXTFIELD_CHARACTER_COUNT "com.sun.star.text.textfield.CharacterCount"
+#define CSS_TEXT_TEXTFIELD_TABLE_COUNT "com.sun.star.text.textfield.TableCount"
+#define CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT "com.sun.star.text.textfield.GraphicObjectCount"
+#define CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT "com.sun.star.text.textfield.EmbeddedObjectCount"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_AUTHOR "com.sun.star.text.textfield.docinfo.ChangeAuthor"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_DATE_TIME "com.sun.star.text.textfield.docinfo.ChangeDateTime"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME "com.sun.star.text.textfield.docinfo.EditTime"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION "com.sun.star.text.textfield.docinfo.Description"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR "com.sun.star.text.textfield.docinfo.CreateAuthor"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_DATE_TIME "com.sun.star.text.textfield.docinfo.CreateDateTime"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR "com.sun.star.text.textfield.docinfo.PrintAuthor"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_DATE_TIME "com.sun.star.text.textfield.docinfo.PrintDateTime"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_KEY_WORDS "com.sun.star.text.textfield.docinfo.KeyWords"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_SUBJECT "com.sun.star.text.textfield.docinfo.Subject"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_TITLE "com.sun.star.text.textfield.docinfo.Title"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_REVISION "com.sun.star.text.textfield.docinfo.Revision"
+#define CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM "com.sun.star.text.textfield.docinfo.Custom"
+#define CSS_TEXT_TEXTFIELD_BIBLIOGRAPHY "com.sun.star.text.textfield.Bibliography"
+#define CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS "com.sun.star.text.textfield.CombinedCharacters"
+#define CSS_TEXT_TEXTFIELD_DROP_DOWN "com.sun.star.text.textfield.DropDown"
+#define CSS_TEXT_TEXTFIELD_INPUT_USER "com.sun.star.text.textfield.InputUser"
+#define CSS_TEXT_TEXTFIELD_HIDDEN_TEXT "com.sun.star.text.textfield.HiddenText"
+#define CSS_TEXT_FIELDMASTER_USER "com.sun.star.text.fieldmaster.User"
+#define CSS_TEXT_FIELDMASTER_DDE "com.sun.star.text.fieldmaster.DDE"
+#define CSS_TEXT_FIELDMASTER_SET_EXPRESSION "com.sun.star.text.fieldmaster.SetExpression"
+#define CSS_TEXT_FIELDMASTER_DATABASE "com.sun.star.text.fieldmaster.Database"
+#define CSS_TEXT_FIELDMASTER_BIBLIOGRAPHY "com.sun.star.text.fieldmaster.Bibliography"
+
+
+class SwXServiceProvider
+{
+public:
+ static rtl::OUString GetProviderName(sal_uInt16 nObjectType);
+ static sal_uInt16 GetProviderType(const rtl::OUString& rServiceName);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > MakeInstance(sal_uInt16 nObjectType, SwDoc* pDoc);
+ static ::com::sun::star::uno::Sequence<rtl::OUString> GetAllServiceNames();
+
+};
+/*-----------------11.12.97 09:38-------------------
+
+--------------------------------------------------*/
+typedef
+cppu::WeakImplHelper3
+<
+ ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::lang::XServiceInfo
+>
+SwCollectionBaseClass;
+class SW_DLLPUBLIC SwXTextTables : public SwCollectionBaseClass,
+ public SwUnoCollection
+{
+protected:
+ virtual ~SwXTextTables();
+public:
+ SwXTextTables(SwDoc* pDoc);
+
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ static ::com::sun::star::text::XTextTable* GetObject( SwFrmFmt& rFmt );
+};
+
+typedef
+cppu::WeakImplHelper4
+<
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::lang::XServiceInfo
+> SwXFramesBaseClass;
+
+class SwXFrames : public SwXFramesBaseClass,
+ public SwUnoCollection
+{
+ const FlyCntType eType;
+protected:
+ virtual ~SwXFrames();
+public:
+ SwXFrames(SwDoc* pDoc, FlyCntType eSet);
+
+ //XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ FlyCntType GetType()const{return eType;}
+ static SwXFrame* GetObject( SwFrmFmt& rFmt, FlyCntType eType );
+
+};
+
+/*-----------------20.02.98 10:51-------------------
+
+--------------------------------------------------*/
+class SwXTextFrames : public SwXFrames
+{
+protected:
+ virtual ~SwXTextFrames();
+public:
+ SwXTextFrames(SwDoc* pDoc);
+
+
+// SMART_UNO_DECLARATION( SwXTextFrames, UsrObject );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+/*-----------------20.02.98 10:55-------------------
+
+--------------------------------------------------*/
+class SwXTextGraphicObjects : public SwXFrames
+{
+protected:
+ virtual ~SwXTextGraphicObjects();
+public:
+ SwXTextGraphicObjects(SwDoc* pDoc);
+
+
+// SMART_UNO_DECLARATION( SwXTextGraphicObjects, UsrObject );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+/*-----------------20.02.98 10:57-------------------
+
+--------------------------------------------------*/
+class SwXTextEmbeddedObjects : public SwXFrames
+{
+protected:
+ virtual ~SwXTextEmbeddedObjects();
+public:
+ SwXTextEmbeddedObjects(SwDoc* pDoc);
+
+
+// SMART_UNO_DECLARATION( SwXTextEmbeddedObjects, UsrObject );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+/*-----------------12.02.98 07:58-------------------
+
+--------------------------------------------------*/
+class SwXTextSections : public SwCollectionBaseClass,
+ public SwUnoCollection
+{
+protected:
+ virtual ~SwXTextSections();
+public:
+ SwXTextSections(SwDoc* pDoc);
+
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextSection> GetObject( SwSectionFmt& rFmt );
+};
+/*-----------------12.02.98 07:51-------------------
+
+--------------------------------------------------*/
+class SwXBookmarks : public SwCollectionBaseClass,
+ public SwUnoCollection
+{
+ protected:
+ virtual ~SwXBookmarks();
+ public:
+ SwXBookmarks(SwDoc* pDoc);
+
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+class SwXNumberingRulesCollection : public cppu::WeakImplHelper1
+<
+ ::com::sun::star::container::XIndexAccess
+>,
+ public SwUnoCollection
+{
+protected:
+ virtual ~SwXNumberingRulesCollection();
+
+public:
+ SwXNumberingRulesCollection( SwDoc* pDoc );
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/*-----------------12.02.98 08:01-------------------
+
+--------------------------------------------------*/
+
+typedef
+cppu::WeakImplHelper2
+<
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::lang::XServiceInfo
+>
+SwSimpleIndexAccessBaseClass;
+
+class SwXFootnotes : public SwSimpleIndexAccessBaseClass,
+ public SwUnoCollection
+{
+ const bool m_bEndnote;
+
+protected:
+ virtual ~SwXFootnotes();
+public:
+ SwXFootnotes(sal_Bool bEnd, SwDoc* pDoc);
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote> GetObject( SwDoc& rDoc, const SwFmtFtn& rFmt );
+};
+
+/* -----------------27.08.98 13:10-------------------
+ *
+ * --------------------------------------------------*/
+class SwXReferenceMarks : public SwCollectionBaseClass,
+ public SwUnoCollection
+{
+protected:
+ virtual ~SwXReferenceMarks();
+public:
+ SwXReferenceMarks(SwDoc* pDoc);
+
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ static SwXReferenceMark* GetObject( SwDoc* pDoc, const SwFmtRefMark* pMark );
+};
+
+#endif
+
+
+
+
+
+
diff --git a/sw/inc/unocore.hrc b/sw/inc/unocore.hrc
new file mode 100644
index 000000000000..428229d88968
--- /dev/null
+++ b/sw/inc/unocore.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOCORE_HRC
+#define _UNOCORE_HRC
+
+#include "rcid.hrc"
+
+#define STR_CHART2_ROW_LABEL_TEXT (RC_UNOCORE_BEGIN + 1)
+#define STR_CHART2_COL_LABEL_TEXT (RC_UNOCORE_BEGIN + 2)
+#define STR_STYLE_FAMILY_CHARACTER (RC_UNOCORE_BEGIN + 3)
+#define STR_STYLE_FAMILY_PARAGRAPH (RC_UNOCORE_BEGIN + 4)
+#define STR_STYLE_FAMILY_FRAME (RC_UNOCORE_BEGIN + 5)
+#define STR_STYLE_FAMILY_PAGE (RC_UNOCORE_BEGIN + 6)
+#define STR_STYLE_FAMILY_NUMBERING (RC_UNOCORE_BEGIN + 7)
+
+#define UNOCORE_ACT_END STR_STYLE_FAMILY_NUMBERING
+
+#if UNOCORE_ACT_END > RC_UNOCORE_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
+
diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx
new file mode 100644
index 000000000000..05738f4fd3c4
--- /dev/null
+++ b/sw/inc/unocrsr.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOCRSR_HXX
+#define _UNOCRSR_HXX
+#include <swcrsr.hxx>
+#include <calbck.hxx>
+
+
+class SwUnoCrsr : public virtual SwCursor, public SwModify
+{
+ sal_Bool bRemainInSection : 1;
+ sal_Bool bSkipOverHiddenSections : 1;
+ sal_Bool bSkipOverProtectSections : 1;
+
+public:
+ SwUnoCrsr( const SwPosition &rPos, SwPaM* pRing = 0 );
+ virtual ~SwUnoCrsr();
+
+protected:
+
+ virtual const SwCntntFrm* DoSetBidiLevelLeftRight(
+ sal_Bool & io_rbLeft, sal_Bool bVisualAllowed, sal_Bool bInsertCrsr);
+ virtual void DoSetBidiLevelUpDown();
+
+public:
+
+// virtual SwCursor* Create( SwPaM* pRing = 0 ) const;
+
+ // gibt es eine Selection vom Content in die Tabelle
+ // Return Wert gibt an, ob der Crsr auf der alten Position verbleibt
+ virtual sal_Bool IsSelOvr( int eFlags =
+ ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ));
+
+ virtual bool IsReadOnlyAvailable() const;
+
+ sal_Bool IsRemainInSection() const { return bRemainInSection; }
+ void SetRemainInSection( sal_Bool bFlag ) { bRemainInSection = bFlag; }
+
+ virtual sal_Bool IsSkipOverProtectSections() const
+ { return bSkipOverProtectSections; }
+ void SetSkipOverProtectSections( sal_Bool bFlag )
+ { bSkipOverProtectSections = bFlag; }
+
+ virtual sal_Bool IsSkipOverHiddenSections() const
+ { return bSkipOverHiddenSections; }
+ void SetSkipOverHiddenSections( sal_Bool bFlag )
+ { bSkipOverHiddenSections = bFlag; }
+
+ // make copy of cursor
+ virtual SwUnoCrsr * Clone() const;
+
+ DECL_FIXEDMEMPOOL_NEWDEL( SwUnoCrsr )
+};
+
+
+
+class SwUnoTableCrsr : public virtual SwUnoCrsr, public virtual SwTableCursor
+{
+ // die Selection hat die gleiche Reihenfolge wie die
+ // TabellenBoxen. D.h., wird aus dem einen Array an einer Position
+ // etwas geloescht, dann muss es auch im anderen erfolgen!!
+ SwCursor aTblSel;
+
+ using SwTableCursor::MakeBoxSels;
+
+public:
+ SwUnoTableCrsr( const SwPosition& rPos );
+ virtual ~SwUnoTableCrsr();
+
+// virtual SwCursor* Create( SwPaM* pRing = 0 ) const;
+
+ // gibt es eine Selection vom Content in die Tabelle
+ // Return Wert gibt an, ob der Crsr auf der alten Position verbleibt
+ virtual sal_Bool IsSelOvr( int eFlags =
+ ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ));
+
+ virtual SwUnoTableCrsr * Clone() const;
+
+ void MakeBoxSels();
+
+ SwCursor& GetSelRing() { return aTblSel; }
+ const SwCursor& GetSelRing() const { return aTblSel; }
+};
+
+
+
+#endif
diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx
new file mode 100644
index 000000000000..f2f8ca922b8c
--- /dev/null
+++ b/sw/inc/unocrsrhelper.hxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOCRSRHELPER_HXX
+#define _UNOCRSRHELPER_HXX
+
+#include <map>
+
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <swtypes.hxx>
+#include <pam.hxx>
+
+
+class String;
+class SfxItemSet;
+class SfxItemPropertySet;
+struct SfxItemPropertySimpleEntry;
+class SwTxtNode;
+class SwPaM;
+class SwCursor;
+class SwUnoCrsr;
+class SwFmtColl;
+struct SwSortOptions;
+class SwDoc;
+
+namespace com{ namespace sun{ namespace star{
+ namespace uno{
+ class Any;
+ }
+ namespace beans{
+ struct PropertyValue;
+ }
+ namespace text {
+ class XTextContent;
+ }
+}}}
+
+/* -----------------03.12.98 12:16-------------------
+ *
+ * --------------------------------------------------*/
+enum SwGetPropertyStatesCaller
+{
+ SW_PROPERTY_STATE_CALLER_DEFAULT,
+ SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION,
+ SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY,
+ SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT
+};
+
+/* -----------------------------14.12.00 15:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+namespace SwUnoCursorHelper
+{
+ // keep Any's mapped by (WhichId << 16 ) + (MemberId)
+ typedef std::map< sal_uInt32, com::sun::star::uno::Any *> AnyMapHelper_t;
+ class SwAnyMapHelper : public AnyMapHelper_t
+ {
+ public:
+ ~SwAnyMapHelper();
+
+ void SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const com::sun::star::uno::Any& rAny );
+ bool FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const com::sun::star::uno::Any*& pAny );
+ };
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
+ GetNestedTextContent(SwTxtNode & rTextNode, xub_StrLen const nIndex,
+ bool const bParent);
+
+ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
+ , SwPaM& rPam
+ , com::sun::star::uno::Any *pAny
+ , com::sun::star::beans::PropertyState& eState
+ , const SwTxtNode* pNode = 0 );
+
+ void GetCurPageStyle(SwPaM& rPaM, String &rString);
+
+ inline sal_Bool IsStartOfPara(SwPaM& rUnoCrsr)
+ { return rUnoCrsr.GetPoint()->nContent == 0;}
+ inline sal_Bool IsEndOfPara(SwPaM& rUnoCrsr)
+ { return rUnoCrsr.GetCntntNode() &&
+ rUnoCrsr.GetPoint()->nContent == rUnoCrsr.GetCntntNode()->Len();}
+
+ void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam);
+ void InsertFile(SwUnoCrsr* pUnoCrsr,
+ const String& rURL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rOptions
+ ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::io::IOException, com::sun::star::uno::RuntimeException );
+
+ void getNumberingProperty(
+ SwPaM& rPam,
+ com::sun::star::beans::PropertyState& eState,
+ com::sun::star::uno::Any *pAny );
+
+ void setNumberingProperty(
+ const com::sun::star::uno::Any& rValue,
+ SwPaM& rPam);
+
+ sal_Int16 IsNodeNumStart(
+ SwPaM& rPam,
+ com::sun::star::beans::PropertyState& eState);
+
+ sal_Bool DocInsertStringSplitCR( SwDoc &rDoc,
+ const SwPaM &rNewCursor, const String &rText,
+ const bool bForceExpandHints );
+ void makeRedline( SwPaM& rPaM, const ::rtl::OUString& RedlineType,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& RedlineProperties )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+
+ /// @param bTableMode: attributes should be applied to a table selection
+ void SetCrsrAttr(SwPaM & rPam, const SfxItemSet & rSet,
+ const SetAttrMode nAttrMode,
+ const bool bTableMode = false);
+ void GetCrsrAttr(SwPaM & rPam, SfxItemSet & rSet,
+ const bool bOnlyTxtAttr = false,
+ const bool bGetFromChrFmt = true);
+ void GetTextFromPam(SwPaM & rPam, ::rtl::OUString & rBuffer);
+ SwFmtColl * GetCurTxtFmtColl(SwPaM & rPam, const bool bConditional);
+
+ void SelectPam(SwPaM & rPam, const bool bExpand);
+ void SetString(SwCursor & rCursor, const ::rtl::OUString & rString);
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ CreateSortDescriptor(const bool bFromTable);
+ sal_Bool ConvertSortProperties(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rDescriptor,
+ SwSortOptions & rSortOpt);
+
+ /// @param bTableMode: attributes should be applied to a table selection
+ void SetPropertyValue(
+ SwPaM& rPaM,
+ const SfxItemPropertySet & rPropSet,
+ const ::rtl::OUString & rPropertyName,
+ const ::com::sun::star::uno::Any & rValue,
+ const SetAttrMode nAttrMode = nsSetAttrMode::SETATTR_DEFAULT,
+ const bool bTableMode = false)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any GetPropertyValue(
+ SwPaM& rPaM,
+ const SfxItemPropertySet & rPropSet,
+ const ::rtl::OUString & rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyState > GetPropertyStates(
+ SwPaM & rPaM,
+ const SfxItemPropertySet & rPropSet,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames,
+ const SwGetPropertyStatesCaller eCaller =
+ SW_PROPERTY_STATE_CALLER_DEFAULT)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::beans::PropertyState GetPropertyState(
+ SwPaM & rPaM,
+ const SfxItemPropertySet & rPropSet,
+ const ::rtl::OUString & rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ void SetPropertyToDefault(
+ SwPaM & rPaM,
+ const SfxItemPropertySet & rPropSet,
+ const ::rtl::OUString & rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any GetPropertyDefault(
+ SwPaM & rPaM,
+ const SfxItemPropertySet & rPropSet,
+ const ::rtl::OUString & rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ bool SetPageDesc(
+ const ::com::sun::star::uno::Any& rValue,
+ SwDoc & rDoc, SfxItemSet & rSet);
+ void SetTxtFmtColl(const ::com::sun::star::uno::Any & rAny, SwPaM & rPaM)
+ throw (::com::sun::star::lang::IllegalArgumentException);
+ bool SetCursorPropertyValue(
+ SfxItemPropertySimpleEntry const& rEntry,
+ ::com::sun::star::uno::Any const& rValue,
+ SwPaM & rPam, SfxItemSet & rItemSet)
+ throw (::com::sun::star::lang::IllegalArgumentException);
+
+} // namespace SwUnoCursorHelper
+
+#endif
diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx
new file mode 100644
index 000000000000..b1307f9678a0
--- /dev/null
+++ b/sw/inc/unodraw.hxx
@@ -0,0 +1,353 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNODRAW_HXX
+#define _UNODRAW_HXX
+
+#include <svx/fmdpage.hxx>
+#include <calbck.hxx>
+#include <frmfmt.hxx>
+#include <com/sun/star/text/XTextContent.hpp>
+// --> OD 2009-01-13 #i59051#
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+// <--
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <cppuhelper/implbase3.hxx> // helper for implementations
+#include <cppuhelper/implbase4.hxx> // helper for implementations
+// --> OD 2004-07-22 #i31698#
+#include <cppuhelper/implbase6.hxx> // helper for implementations
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+// <--
+#include <svl/itemprop.hxx>
+
+class SdrMarkList;
+class SdrView;
+class SwDoc;
+/******************************************************************************
+ *
+ ******************************************************************************/
+class SwFmDrawPage : public SvxFmDrawPage
+{
+ SdrPageView* pPageView;
+protected:
+
+ // Erzeugen eines SdrObjects anhand einer Description. Kann von
+ // abgeleiteten Klassen dazu benutzt werden, eigene ::com::sun::star::drawing::Shapes zu
+ // unterstuetzen (z.B. Controls)
+ virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape ) throw ();
+
+public:
+ SwFmDrawPage( SdrPage* pPage );
+ virtual ~SwFmDrawPage() throw ();
+
+ const SdrMarkList& PreGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > & xShapes);
+ void PreUnGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > xShapeGroup);
+// void PostGroup(); ?? wird es noch gebraucht ??
+
+ SdrView* GetDrawView() {return mpView;}
+ SdrPageView* GetPageView();
+ void RemovePageView();
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetInterface( SdrObject* pObj );
+
+ // Die folgende Methode wird gerufen, wenn ein SvxShape-Objekt angelegt
+ // werden soll. abgeleitete Klassen koennen hier eine Ableitung oder
+ // ein ein SvxShape aggregierendes Objekt anlegen.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw ();
+};
+
+typedef cppu::WeakAggImplHelper4
+<
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::drawing::XDrawPage,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::drawing::XShapeGrouper
+>
+SwXDrawPageBaseClass;
+class SwXDrawPage : public SwXDrawPageBaseClass
+{
+ SwDoc* pDoc;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > xPageAgg;
+ SwFmDrawPage* pDrawPage;
+public:
+ SwXDrawPage(SwDoc* pDoc);
+ ~SwXDrawPage();
+
+ //XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XShapes
+ virtual void SAL_CALL add(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL remove(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XShapeGrouper
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > SAL_CALL group(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > & xShapes) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL ungroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > & aGroup) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ SwFmDrawPage* GetSvxPage();
+ // renamed and outlined to detect where it's called
+ void InvalidateSwDoc(); // {pDoc = 0;}
+};
+/* -----------------22.01.99 10:20-------------------
+ *
+ * --------------------------------------------------*/
+class SwShapeDescriptor_Impl;
+class SwXGroupShape;
+typedef
+cppu::WeakAggImplHelper6
+<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::beans::XPropertyState,
+ ::com::sun::star::text::XTextContent,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel,
+ // --> OD 2004-07-22 #i31698#
+ ::com::sun::star::drawing::XShape
+ // <--
+>
+SwXShapeBaseClass;
+class SwXShape : public SwXShapeBaseClass,
+ public SwClient
+{
+ friend class SwHTMLImageWatcher;
+ friend class SwHTMLParser;
+ friend class SwXGroupShape;
+ friend class SwXDrawPage;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > xShapeAgg;
+ // --> OD 2004-07-23 #i31698# - reference to <XShape>, determined in the
+ // constructor by <queryAggregation> at <xShapeAgg>.
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
+ // <--
+
+ const SfxItemPropertySet* m_pPropSet;
+ const SfxItemPropertyMapEntry* m_pPropertyMapEntries;
+ com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId;
+
+ SwShapeDescriptor_Impl* pImpl;
+
+ sal_Bool m_bDescriptor;
+
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+
+ SvxShape* GetSvxShape();
+
+ /** method to determine top group object
+
+ OD 2004-08-03 #i31698#
+
+ @author OD
+ */
+ SdrObject* _GetTopGroupObj( SvxShape* _pSvxShape = 0L );
+
+ /** method to determine position according to the positioning attributes
+
+ OD 2004-08-03 #i31698#
+
+ @author OD
+ */
+ com::sun::star::awt::Point _GetAttrPosition();
+
+ /** method to convert the position (translation) of the drawing object to
+ the layout direction horizontal left-to-right.
+
+ OD 2004-07-27 #i31698#
+
+ @author OD
+ */
+ ::com::sun::star::awt::Point _ConvertPositionToHoriL2R(
+ const ::com::sun::star::awt::Point _aObjPos,
+ const ::com::sun::star::awt::Size _aObjSize );
+
+ /** method to convert the transformation of the drawing object to the layout
+ direction, the drawing object is in
+
+ OD 2004-07-27 #i31698#
+
+ @author OD
+ */
+ ::com::sun::star::drawing::HomogenMatrix3 _ConvertTransformationToLayoutDir(
+ ::com::sun::star::drawing::HomogenMatrix3 _aMatrixInHoriL2R );
+
+ /** method to adjust the positioning properties
+
+ OD 2004-08-02 #i31698#
+
+ @author OD
+
+ @param _aPosition
+ input parameter - point representing the new shape position. The position
+ has to be given in the layout direction the shape is in and relative to
+ its position alignment areas.
+ */
+ void _AdjustPositionProperties( const ::com::sun::star::awt::Point _aPosition );
+
+ /** method to convert start or end position of the drawing object to the
+ Writer specific position, which is the attribute position in layout direction
+
+ OD 2009-01-12 #i59051#
+
+ @author OD
+ */
+ ::com::sun::star::awt::Point _ConvertStartOrEndPosToLayoutDir(
+ const ::com::sun::star::awt::Point& aStartOrEndPos );
+
+ /** method to convert PolyPolygonBezier of the drawing object to the
+ Writer specific position, which is the attribute position in layout direction
+
+ OD 2009-01-13 #i59051#
+
+ @author OD
+ */
+ ::com::sun::star::drawing::PolyPolygonBezierCoords _ConvertPolyPolygonBezierToLayoutDir(
+ const ::com::sun::star::drawing::PolyPolygonBezierCoords& aPath );
+
+ /** method to get property from aggregation object
+
+ OD 2004-10-28 #i36248#
+
+ @author OD
+ */
+ ::com::sun::star::uno::Any _getPropAtAggrObj( const ::rtl::OUString& _rPropertyName )
+ throw( ::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ~SwXShape();
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwXShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape);
+
+
+ TYPEINFO();
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XTextContent
+ virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XComponent
+ virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // --> OD 2004-07-22 #i31698# XShape
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+ // <--
+ // --> OD 2004-07-22 #i31698# XShapeDescriptor - superclass of XShape
+ virtual ::rtl::OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException);
+ // <--
+
+ SwShapeDescriptor_Impl* GetDescImpl() {return pImpl;}
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > GetAggregationInterface() {return xShapeAgg;}
+
+ // helper
+ static void AddExistingShapeToFmt( SdrObject& _rObj );
+};
+/* -----------------------------31.05.01 09:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwXGroupShape :
+ public SwXShape,
+ public ::com::sun::star::drawing::XShapes
+{
+protected:
+ virtual ~SwXGroupShape();
+public:
+ SwXGroupShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape);
+
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw();
+ virtual void SAL_CALL release( ) throw();
+
+ //XShapes
+ virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+};
+#endif
+
+
diff --git a/sw/inc/unoevent.hxx b/sw/inc/unoevent.hxx
new file mode 100644
index 000000000000..6a9087519e68
--- /dev/null
+++ b/sw/inc/unoevent.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOEVENT_HXX
+#define _UNOEVENT_HXX
+
+#include <svtools/unoevent.hxx>
+#include <svl/macitem.hxx>
+
+
+class SvxMacroItem;
+class SvxMacro;
+class SwXFrame;
+class SwXTextFrame;
+class SwXTextGraphicObject;
+class SwXTextEmbeddedObject;
+class SwXFrameStyle;
+class SwFmtINetFmt;
+
+
+
+class SwHyperlinkEventDescriptor : public SvDetachedEventDescriptor
+{
+ const ::rtl::OUString sImplName;
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+protected:
+ virtual ~SwHyperlinkEventDescriptor();
+public:
+
+ SwHyperlinkEventDescriptor();
+
+
+
+ void copyMacrosFromINetFmt(const SwFmtINetFmt& aFmt);
+ void copyMacrosIntoINetFmt(SwFmtINetFmt& aFmt);
+
+ void copyMacrosFromNameReplace(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameReplace> & xReplace);
+};
+
+
+
+// SwEventDescriptor for
+// 1) SwXTextFrame
+// 2) SwXGraphicObject
+// 3) SwXEmbeddedObject
+// All these objects are an SwXFrame, so they can use a common implementation
+class SwFrameEventDescriptor : public SvEventDescriptor
+{
+ ::rtl::OUString sSwFrameEventDescriptor;
+
+ SwXFrame& rFrame;
+
+public:
+ SwFrameEventDescriptor( SwXTextFrame& rFrameRef );
+ SwFrameEventDescriptor( SwXTextGraphicObject& rGraphicRef );
+ SwFrameEventDescriptor( SwXTextEmbeddedObject& rObjectRef );
+
+ ~SwFrameEventDescriptor();
+
+ virtual rtl::OUString SAL_CALL getImplementationName(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+protected:
+ virtual void setMacroItem(const SvxMacroItem& rItem);
+ virtual const SvxMacroItem& getMacroItem();
+ virtual sal_uInt16 getMacroItemWhich() const;
+};
+
+class SwFrameStyleEventDescriptor : public SvEventDescriptor
+{
+ ::rtl::OUString sSwFrameStyleEventDescriptor;
+
+ SwXFrameStyle& rStyle;
+
+public:
+ SwFrameStyleEventDescriptor( SwXFrameStyle& rStyleRef );
+
+ ~SwFrameStyleEventDescriptor();
+
+ virtual rtl::OUString SAL_CALL getImplementationName(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+protected:
+ virtual void setMacroItem(const SvxMacroItem& rItem);
+ virtual const SvxMacroItem& getMacroItem();
+ virtual sal_uInt16 getMacroItemWhich() const;
+};
+
+
+#endif
diff --git a/sw/inc/unoevtlstnr.hxx b/sw/inc/unoevtlstnr.hxx
new file mode 100644
index 000000000000..3b56ff6c3d33
--- /dev/null
+++ b/sw/inc/unoevtlstnr.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOEVTLSTNR_HXX
+#define _UNOEVTLSTNR_HXX
+
+#include <svl/svarray.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+namespace com{namespace sun{namespace star{
+ namespace lang
+ {
+ class XEventListener;
+ }
+}}}
+/* -----------------22.04.99 11:18-------------------
+ * Verwaltung der EventListener
+ * --------------------------------------------------*/
+typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > * XEventListenerPtr;
+SV_DECL_PTRARR(SwEvtLstnrArray, XEventListenerPtr, 4, 4)
+
+class SwEventListenerContainer
+{
+ protected:
+ SwEvtLstnrArray* pListenerArr;
+ ::com::sun::star::uno::XInterface* pxParent;
+ public:
+ SwEventListenerContainer( ::com::sun::star::uno::XInterface* pxParent);
+ ~SwEventListenerContainer();
+
+ void AddListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & rxListener);
+ sal_Bool RemoveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & rxListener);
+ void Disposing();
+};
+#endif
diff --git a/sw/inc/unofield.hxx b/sw/inc/unofield.hxx
new file mode 100644
index 000000000000..02b57aff8c17
--- /dev/null
+++ b/sw/inc/unofield.hxx
@@ -0,0 +1,321 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOFIELD_HXX
+#define _UNOFIELD_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/text/XDependentTextField.hpp>
+
+#include <cppuhelper/implbase5.hxx>
+
+#include <calbck.hxx>
+#include <unocoll.hxx>
+#include <RefreshListenerContainer.hxx>
+
+
+class SwFieldType;
+class SwDoc;
+class SwFmtFld;
+class SwField;
+class SwSetExpField;
+class SwTextAPIObject;
+
+/* -----------------04.12.98 12:49-------------------
+ *
+ * --------------------------------------------------*/
+class SwXFieldMaster : public cppu::WeakImplHelper4
+<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::lang::XComponent
+>,
+ public SwClient
+{
+ SwEventListenerContainer aLstnrCntnr;
+ sal_uInt16 nResTypeId;
+ SwDoc* m_pDoc;
+
+ sal_Bool m_bIsDescriptor;
+
+ String sParam1; //Content / Database / NumberingSeparator
+ String sParam2; // - /DataTablename
+ String sParam3; // - /DataFieldName
+ String sParam4;
+ String sParam5; // - /DataBaseURL
+ String sParam6; // - /DataBaseResource
+ double fParam1; // Value / -
+ sal_Int8 nParam1; // ChapterNumberingLevel
+ sal_Bool bParam1; // IsExpression
+ sal_Int32 nParam2;
+
+protected:
+ virtual ~SwXFieldMaster();
+ //SwClient
+virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+
+ SwXFieldMaster(SwDoc* pDoc, sal_uInt16 nResId);
+ SwXFieldMaster(SwFieldType& rType, SwDoc* pDoc);
+
+
+ TYPEINFO();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XComponent
+ virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ static rtl::OUString GetProgrammaticName(const SwFieldType& rType, SwDoc& rDoc);
+ static rtl::OUString LocalizeFormula(const SwSetExpField& rFld, const rtl::OUString& rFormula, sal_Bool bQuery);
+
+ SwFieldType* GetFldType(sal_Bool bDontCreate = sal_False) const;
+ SwDoc* GetDoc() {return m_pDoc;}
+
+ sal_Bool IsDescriptor()const {return m_bIsDescriptor;}
+ sal_uInt16 GetResId() const {return nResTypeId;}
+};
+
+struct SwFieldProperties_Impl;
+class SwXTextField : public cppu::WeakImplHelper5
+<
+ ::com::sun::star::text::XDependentTextField,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::util::XUpdatable
+>,
+ public SwClient
+{
+ SwEventListenerContainer aLstnrCntnr;
+ const SwFmtFld* pFmtFld;
+ SwDoc* m_pDoc;
+ SwTextAPIObject* m_pTextObject;
+
+ sal_Bool m_bIsDescriptor;
+ SwClient m_aFieldTypeClient; // required to access field master of not yet inserted fields
+ sal_Bool m_bCallUpdate;
+ sal_uInt16 m_nServiceId;
+ SwFieldProperties_Impl* m_pProps;
+ String m_sTypeName;
+
+
+ //SwFieldType* GetFldType() const { return (SwFieldType*)GetRegisteredIn(); }
+ SwDoc* GetDoc() {return m_pDoc;}
+protected:
+ virtual ~SwXTextField();
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwXTextField(sal_uInt16 nServiceId, SwDoc* pDoc=0);
+ SwXTextField(const SwFmtFld& rFmt, SwDoc* pDoc);
+
+
+ TYPEINFO();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XDependentTextField
+ virtual void SAL_CALL attachTextFieldMaster(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xFieldMaster) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getTextFieldMaster(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XTextField
+ virtual rtl::OUString SAL_CALL getPresentation(sal_Bool bShowCommand) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XTextContent
+ virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XComponent
+ virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XUpdatable
+ virtual void SAL_CALL update( ) throw (::com::sun::star::uno::RuntimeException);
+
+ void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ const SwField* GetField() const;
+ const SwFmtFld* GetFldFmt(){return GetField() ? pFmtFld : 0; };
+
+ void Invalidate();
+
+ /// @return an SwXTextField, either an already existing one or a new one
+ static SwXTextField* CreateSwXTextField(SwDoc & rDoc, SwFmtFld const& rFmt);
+};
+
+
+typedef
+cppu::WeakImplHelper2
+<
+ ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::lang::XServiceInfo
+>
+SwXTextFieldMastersBaseClass;
+class SwXTextFieldMasters : public SwXTextFieldMastersBaseClass,
+ public SwUnoCollection
+{
+protected:
+ virtual ~SwXTextFieldMasters();
+public:
+ SwXTextFieldMasters(SwDoc* pDoc);
+
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+
+ static sal_Bool getInstanceName(const SwFieldType& rFldType, String& rName);
+};
+
+/* -----------------21.12.98 10:26-------------------
+ *
+ * --------------------------------------------------*/
+typedef
+cppu::WeakImplHelper3
+<
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::util::XRefreshable
+>
+SwXTextFieldTypesBaseClass;
+class SwXTextFieldTypes : public SwXTextFieldTypesBaseClass,
+ public SwUnoCollection
+{
+ SwRefreshListenerContainer aRefreshCont;
+protected:
+ virtual ~SwXTextFieldTypes();
+public:
+ SwXTextFieldTypes(SwDoc* pDoc);
+
+
+ //XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::util::XRefreshable
+ virtual void SAL_CALL refresh( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // SwUnoCollection
+ virtual void Invalidate();
+};
+
+class SwXFieldEnumeration : public cppu::WeakImplHelper2
+<
+ ::com::sun::star::container::XEnumeration,
+ ::com::sun::star::lang::XServiceInfo
+>,
+ public SwClient
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > > aItems;
+ sal_Int32 nNextIndex; // index of next element to be returned
+
+ SwDoc* pDoc;
+
+protected:
+ virtual ~SwXFieldEnumeration();
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+public:
+ SwXFieldEnumeration(SwDoc* pDoc);
+
+ //XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement(void) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+};
+#endif
+
+
+
diff --git a/sw/inc/unoflatpara.hxx b/sw/inc/unoflatpara.hxx
new file mode 100644
index 000000000000..0662be96fdd6
--- /dev/null
+++ b/sw/inc/unoflatpara.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOFLATPARA_HXX
+#define _UNOFLATPARA_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/text/XFlatParagraph.hpp>
+#include <com/sun/star/text/XFlatParagraphIterator.hpp>
+#include <calbck.hxx>
+#include <modeltoviewhelper.hxx>
+#include <unotextmarkup.hxx>
+
+#include <set>
+
+namespace css = com::sun::star;
+
+namespace com { namespace sun { namespace star { namespace container {
+ class XStringKeyMap;
+} } } }
+
+class SwTxtNode;
+class SwDoc;
+
+/******************************************************************************
+ * SwXFlatParagraph
+ ******************************************************************************/
+
+class SwXFlatParagraph:
+ public ::cppu::WeakImplHelper2
+ <
+ css::text::XFlatParagraph,
+ css::lang::XUnoTunnel
+ >,
+ public SwXTextMarkup
+{
+public:
+ SwXFlatParagraph( SwTxtNode& rTxtNode, rtl::OUString aExpandText, const ModelToViewHelper::ConversionMap* pConversionMap );
+ virtual ~SwXFlatParagraph();
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw();
+ virtual void SAL_CALL release( ) throw();
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // text::XTextMarkup:
+ virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL commitTextMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) throw (css::uno::RuntimeException);
+
+ // text::XFlatParagraph:
+ virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isModified() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setChecked(::sal_Int32 nType, ::sal_Bool bVal) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isChecked(::sal_Int32 nType) throw (css::uno::RuntimeException);
+ virtual css::lang::Locale SAL_CALL getLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
+ virtual css::lang::Locale SAL_CALL getPrimaryLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
+ virtual void SAL_CALL changeText(::sal_Int32 nPos, ::sal_Int32 nLen, const ::rtl::OUString & aNewText, const css::uno::Sequence< css::beans::PropertyValue > & aAttributes) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
+ virtual void SAL_CALL changeAttributes(::sal_Int32 nPos, ::sal_Int32 nLen, const css::uno::Sequence< css::beans::PropertyValue > & aAttributes) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
+ virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getLanguagePortions() throw (css::uno::RuntimeException);
+
+ const SwTxtNode* getTxtNode() const;
+
+ static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& rId)
+ throw (css::uno::RuntimeException);
+
+private:
+ SwXFlatParagraph( const SwXFlatParagraph & ); // not defined
+ SwXFlatParagraph & operator = ( const SwXFlatParagraph & ); // not defined
+
+ rtl::OUString maExpandText;
+};
+
+/******************************************************************************
+ * SwXFlatParagraphIterator
+ ******************************************************************************/
+
+class SwXFlatParagraphIterator:
+ public ::cppu::WeakImplHelper1
+ <
+ css::text::XFlatParagraphIterator
+ >,
+ public SwClient // to get notified when doc is closed...
+{
+public:
+ SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType, sal_Bool bAutomatic );
+ virtual ~SwXFlatParagraphIterator();
+
+ // text::XFlatParagraphIterator:
+ virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getFirstPara() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getNextPara() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getLastPara() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getParaBefore(const css::uno::Reference< css::text::XFlatParagraph > & xPara) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
+ virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getParaAfter(const css::uno::Reference< css::text::XFlatParagraph > & xPara) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
+
+protected:
+ // SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
+
+private:
+ SwXFlatParagraphIterator( const SwXFlatParagraphIterator & ); // not defined
+ SwXFlatParagraphIterator & operator =(const SwXFlatParagraphIterator & ); // not defined
+
+ // container to hold the 'hard' references as long as necessary and valid
+ std::set< css::uno::Reference< css::text::XFlatParagraph > > m_aFlatParaList;
+
+ SwDoc* mpDoc;
+ const sal_Int32 mnType;
+ const sal_Bool mbAutomatic;
+
+ sal_uLong mnCurrentNode; // used for non-automatic mode
+ sal_uLong mnStartNode; // used for non-automatic mode
+ sal_uLong mnEndNode; // used for non-automatic mode
+ sal_Bool mbWrapped; // used for non-automatic mode
+};
+
+#endif
diff --git a/sw/inc/unofootnote.hxx b/sw/inc/unofootnote.hxx
new file mode 100644
index 000000000000..784a72098e87
--- /dev/null
+++ b/sw/inc/unofootnote.hxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOFOOTNOTE_HXX
+#define SW_UNOFOOTNOTE_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+
+#include <cppuhelper/implbase5.hxx>
+
+#include <unotext.hxx>
+
+
+class SwDoc;
+class SwModify;
+class SwFmtFtn;
+
+
+/*-----------------12.02.98 08:01-------------------
+
+--------------------------------------------------*/
+typedef ::cppu::WeakImplHelper5
+< ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::container::XEnumerationAccess
+, ::com::sun::star::text::XFootnote
+> SwXFootnote_Base;
+
+class SwXFootnote
+ : public SwXFootnote_Base
+ , public SwXText
+{
+
+private:
+
+ friend class SwXFootnotes;
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+
+protected:
+
+ virtual const SwStartNode *GetStartNode() const;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor >
+ CreateCursor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ~SwXFootnote();
+
+ SwXFootnote(SwDoc & rDoc, const SwFmtFtn & rFmt);
+
+public:
+
+ SwXFootnote(const bool bEndnote);
+
+ static SwXFootnote *
+ CreateXFootnote(SwDoc & rDoc, SwFmtFtn const& rFootnoteFmt);
+ /// may return 0
+ static SwXFootnote *
+ GetXFootnote(SwModify const& rUnoCB, SwFmtFtn const& rFootnoteFmt);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createEnumeration()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XFootnote
+ virtual ::rtl::OUString SAL_CALL getLabel()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLabel(const ::rtl::OUString& rLabel)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XSimpleText
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor > SAL_CALL
+ createTextCursor()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor > SAL_CALL
+ createTextCursorByRange(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextPosition)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // SW_UNOFOOTNOTE_HXX
+
diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx
new file mode 100644
index 000000000000..297cb561cf88
--- /dev/null
+++ b/sw/inc/unoframe.hxx
@@ -0,0 +1,370 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOFRAME_HXX
+#define _UNOFRAME_HXX
+
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase6.hxx>
+
+#include <sfx2/objsh.hxx>
+
+#include <flyenum.hxx>
+#include <frmfmt.hxx>
+#include <unoevtlstnr.hxx>
+#include <unotext.hxx>
+
+
+class SfxItemPropertSet;
+class SdrObject;
+class SwDoc;
+class SwFmt;
+class SwFlyFrmFmt;
+
+class BaseFrameProperties_Impl;
+class SwXFrame : public cppu::WeakImplHelper6
+<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::beans::XPropertyState,
+ ::com::sun::star::drawing::XShape,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XUnoTunnel
+>,
+ public SwClient
+{
+ SwEventListenerContainer aLstnrCntnr;
+ const SfxItemPropertySet* m_pPropSet;
+ SwDoc* m_pDoc;
+
+ const FlyCntType eType;
+
+ // Descriptor-interface
+ BaseFrameProperties_Impl* pProps;
+ sal_Bool bIsDescriptor;
+ String sName;
+
+ SwPaM* m_pCopySource;
+
+protected:
+ com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxStyleData;
+ com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxStyleFamily;
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+ virtual ~SwXFrame();
+public:
+ SwXFrame(FlyCntType eSet,
+ const SfxItemPropertySet* pPropSet,
+ SwDoc *pDoc ); //Descriptor-If
+ SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet,
+ const SfxItemPropertySet* pPropSet);
+
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ TYPEINFO();
+
+ //XNamed
+ virtual rtl::OUString SAL_CALL getName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setName(const rtl::OUString& Name_) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XShape
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+ //XShapeDescriptor
+ virtual rtl::OUString SAL_CALL getShapeType(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //Basisimplementierung
+ //XComponent
+ virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ void attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ SwFrmFmt* GetFrmFmt() const
+ {
+ return PTR_CAST ( SwFrmFmt, GetRegisteredIn() );
+ }
+ FlyCntType GetFlyCntType()const {return eType;}
+
+ sal_Bool IsDescriptor() const {return bIsDescriptor;}
+ void ResetDescriptor();
+ //copy text from a given source PaM
+ void SetSelection(SwPaM& rCopySource);
+ static SW_DLLPUBLIC SdrObject *GetOrCreateSdrObject( SwFlyFrmFmt *pFmt );
+};
+
+typedef cppu::WeakImplHelper3
+<
+ ::com::sun::star::text::XTextFrame,
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::document::XEventsSupplier
+>
+SwXTextFrameBaseClass;
+
+class SwXTextFrame : public SwXTextFrameBaseClass,
+ public SwXText,
+ public SwXFrame
+{
+ const SfxItemPropertSet* _pPropSet;
+
+protected:
+ virtual const SwStartNode *GetStartNode() const;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor >
+ CreateCursor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ~SwXTextFrame();
+public:
+ SwXTextFrame(SwDoc *pDoc);
+ SwXTextFrame(SwFrmFmt& rFmt);
+
+ // FIXME: EVIL HACK: make available for SwXFrame::attachToRange
+ void SetDoc(SwDoc *const pDoc) { SwXText::SetDoc(pDoc); };
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw();
+ virtual void SAL_CALL release( ) throw();
+
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XTextFrame
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XText
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & aTextPosition) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XEnumerationAccess - frueher XParagraphEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XTextContent
+ virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XComponent
+ virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XEventsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ void * SAL_CALL operator new( size_t ) throw();
+ void SAL_CALL operator delete( void * ) throw();
+};
+
+typedef cppu::WeakImplHelper2
+<
+ ::com::sun::star::text::XTextContent,
+ ::com::sun::star::document::XEventsSupplier
+>
+SwXTextGraphicObjectBaseClass;
+class SwXTextGraphicObject : public SwXTextGraphicObjectBaseClass,
+ public SwXFrame
+{
+protected:
+ virtual ~SwXTextGraphicObject();
+public:
+ SwXTextGraphicObject( SwDoc *pDoc );
+ SwXTextGraphicObject(SwFrmFmt& rFmt);
+
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw();
+ virtual void SAL_CALL release( ) throw();
+
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XTextContent
+ virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XComponent
+ virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XEventsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException);
+ void * SAL_CALL operator new( size_t ) throw();
+ void SAL_CALL operator delete( void * ) throw();
+};
+/*-----------------20.02.98 11:28-------------------
+
+--------------------------------------------------*/
+class SwOLENode;
+typedef cppu::WeakImplHelper3
+<
+ ::com::sun::star::text::XTextContent,
+ ::com::sun::star::document::XEmbeddedObjectSupplier2,
+ ::com::sun::star::document::XEventsSupplier
+>SwXTextEmbeddedObjectBaseClass;
+
+class SwXTextEmbeddedObject : public SwXTextEmbeddedObjectBaseClass,
+ public SwXFrame
+{
+protected:
+ virtual ~SwXTextEmbeddedObject();
+
+public:
+ SwXTextEmbeddedObject( SwDoc *pDoc );
+ SwXTextEmbeddedObject(SwFrmFmt& rFmt);
+
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw();
+ virtual void SAL_CALL release( ) throw();
+
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XTextContent
+ virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XComponent
+ virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XEmbeddedObjectSupplier2
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL getEmbeddedObject(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > SAL_CALL getExtendedControlOverEmbeddedObject(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::sal_Int64 SAL_CALL getAspect() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAspect( ::sal_Int64 _aspect ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL getReplacementGraphic() throw (::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XEventsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException);
+ void * SAL_CALL operator new( size_t ) throw();
+ void SAL_CALL operator delete( void * ) throw();
+};
+
+
+
+class SwXOLEListener : public cppu::WeakImplHelper1
+<
+ ::com::sun::star::util::XModifyListener
+>,
+ public SwClient
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xOLEModel;
+// SfxObjectShell* GetObjShell( const SwFmt& rFmt,
+// SwOLENode** ppNd = 0 ) const;
+ SwFmt* GetFmt() const { return (SwFmt*)GetRegisteredIn(); }
+public:
+ SwXOLEListener(SwFmt& rOLEFmt, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xOLE);
+ ~SwXOLEListener();
+ TYPEINFO();
+
+// ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::util::XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+};
+
+
+
+#endif
+
diff --git a/sw/inc/unoidx.hxx b/sw/inc/unoidx.hxx
new file mode 100644
index 000000000000..fe42330685a6
--- /dev/null
+++ b/sw/inc/unoidx.hxx
@@ -0,0 +1,375 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOIDX_HXX
+#define _UNOIDX_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/text/XDocumentIndexMark.hpp>
+#include <com/sun/star/text/XDocumentIndex.hpp>
+
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase5.hxx>
+
+#include <sfx2/Metadatable.hxx>
+
+#include <unocoll.hxx>
+#include <toxe.hxx>
+
+
+class SwTOXBaseSection;
+class SwTOXMark;
+class SwTOXType;
+
+/* -----------------07.12.98 10:08-------------------
+ *
+ * --------------------------------------------------*/
+
+typedef ::cppu::ImplInheritanceHelper5
+< ::sfx2::MetadatableMixin
+, ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::container::XNamed
+, ::com::sun::star::text::XDocumentIndex
+> SwXDocumentIndex_Base;
+
+class SwXDocumentIndex
+ : public SwXDocumentIndex_Base
+{
+
+private:
+
+ class StyleAccess_Impl;
+ class TokenAccess_Impl;
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ virtual ~SwXDocumentIndex();
+
+ SwXDocumentIndex(SwTOXBaseSection const&, SwDoc &);
+
+public:
+
+ /// descriptor
+ SwXDocumentIndex(const TOXTypes eToxType, SwDoc& rDoc);
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XDocumentIndex>
+ CreateXDocumentIndex(SwDoc & rDoc, SwTOXBaseSection const& rSection);
+
+ // MetadatableMixin
+ virtual ::sfx2::Metadatable* GetCoreObject();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ GetModel();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName(const ::rtl::OUString& rName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // XDocumentIndex
+ virtual ::rtl::OUString SAL_CALL getServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL update()
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+/* -----------------07.12.98 10:08-------------------
+ *
+ * --------------------------------------------------*/
+typedef ::cppu::WeakImplHelper4
+< ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::text::XDocumentIndexMark
+> SwXDocumentIndexMark_Base;
+
+class SwXDocumentIndexMark
+ : public SwXDocumentIndexMark_Base
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ virtual ~SwXDocumentIndexMark();
+
+ SwXDocumentIndexMark(SwDoc & rDoc,
+ SwTOXType & rType, SwTOXMark & rMark);
+
+public:
+
+ /// descriptor
+ SwXDocumentIndexMark(const TOXTypes eToxType);
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XDocumentIndexMark>
+ CreateXDocumentIndexMark(SwDoc & rDoc,
+ SwTOXType & rType, SwTOXMark & rMark);
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XDocumentIndexMark
+ virtual rtl::OUString SAL_CALL getMarkEntry()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMarkEntry(const rtl::OUString& rIndexEntry)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+/* -----------------05.05.99 12:27-------------------
+ *
+ * --------------------------------------------------*/
+class SwXDocumentIndexes
+ : public SwCollectionBaseClass
+ , public SwUnoCollection
+{
+
+private:
+
+ virtual ~SwXDocumentIndexes();
+
+public:
+
+ SwXDocumentIndexes(SwDoc *const pDoc);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(
+ const ::rtl::OUString& rName)
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getElementNames() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& rName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif
+
diff --git a/sw/inc/unomailmerge.hxx b/sw/inc/unomailmerge.hxx
new file mode 100644
index 000000000000..d7f19640ab09
--- /dev/null
+++ b/sw/inc/unomailmerge.hxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOMAILMERGE_HXX_
+#define _UNOMAILMERGE_HXX_
+
+#include <functional>
+#include <cppuhelper/implbase5.hxx> // WeakImplHelper4
+#include <cppuhelper/interfacecontainer.hxx> // OMultiTypeInterfaceContainerHelperVar
+#include <unotools/configitem.hxx> // !! needed for OMultiTypeInterfaceContainerHelperVar !!
+
+
+#include <com/sun/star/task/XJob.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/text/XMailMergeBroadcaster.hpp>
+#include <svl/itemprop.hxx>
+#include <sfx2/objsh.hxx>
+
+#include <functional>
+
+namespace com { namespace sun { namespace star {
+
+ namespace sdbc {
+ class XResultSet;
+ class XConnection;
+ }
+ namespace frame {
+ class XModel;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+ namespace text {
+ class XMailMergeListener;
+ struct MailMergeEvent;
+ }
+ namespace beans{
+ struct PropertyValue;
+ }
+
+}}}
+
+namespace rtl {
+ class OUString;
+}
+
+///////////////////////////////////////////////////////////////////////////
+
+// uses templates from <cppuhelper/interfacecontainer.h>
+// and <unotools/configitem.hxx>
+
+// helper function call class
+struct PropHashType_Impl
+{
+ size_t operator()(const sal_Int32 &s) const { return s; }
+};
+
+typedef cppu::OMultiTypeInterfaceContainerHelperVar
+ <
+ sal_Int32,
+ PropHashType_Impl,
+ std::equal_to< sal_Int32 >
+ > OPropertyListenerContainerHelper;
+
+////////////////////////////////////////////////////////////
+
+class SwXMailMerge :
+ public cppu::WeakImplHelper5
+ <
+ com::sun::star::task::XJob,
+ com::sun::star::beans::XPropertySet,
+ com::sun::star::text::XMailMergeBroadcaster,
+ com::sun::star::lang::XComponent,
+ com::sun::star::lang::XServiceInfo
+ >
+{
+ cppu::OInterfaceContainerHelper aEvtListeners;
+ cppu::OInterfaceContainerHelper aMergeListeners;
+ OPropertyListenerContainerHelper aPropListeners;
+
+ //SfxItemPropertySet aPropSet;
+ const SfxItemPropertySet* pPropSet;
+
+ SfxObjectShellRef xDocSh; // the document
+
+ String aTmpFileName;
+
+ // properties of mail merge service
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any > aSelection;
+ com::sun::star::uno::Reference< com::sun::star::sdbc::XResultSet > xResultSet;
+ com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > xConnection;
+ com::sun::star::uno::Reference< com::sun::star::frame::XModel > xModel;
+ rtl::OUString aDataSourceName;
+ rtl::OUString aDataCommand;
+ rtl::OUString aFilter;
+ rtl::OUString aDocumentURL;
+ rtl::OUString aOutputURL;
+ rtl::OUString aFileNamePrefix;
+ sal_Int32 nDataCommandType;
+ sal_Int16 nOutputType;
+ sal_Bool bEscapeProcessing;
+ sal_Bool bSinglePrintJobs;
+ sal_Bool bFileNameFromColumn;
+
+
+ ::rtl::OUString sInServerPassword;
+ ::rtl::OUString sOutServerPassword;
+ ::rtl::OUString sSubject;
+ ::rtl::OUString sAddressFromColumn;
+ ::rtl::OUString sMailBody;
+ ::rtl::OUString sAttachmentName;
+ ::rtl::OUString sAttachmentFilter;
+ com::sun::star::uno::Sequence< ::rtl::OUString > aCopiesTo;
+ com::sun::star::uno::Sequence< ::rtl::OUString > aBlindCopiesTo;
+ sal_Bool bSendAsHTML;
+ sal_Bool bSendAsAttachment;
+
+ com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aPrintSettings;
+
+ sal_Bool bSaveAsSingleFile;
+ ::rtl::OUString sSaveFilter;
+ ::rtl::OUString sSaveFilterOptions;
+ com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSaveFilterData;
+
+
+
+ sal_Bool bDisposing;
+
+
+ void launchEvent( const com::sun::star::beans::PropertyChangeEvent &rEvt ) const;
+
+ // disallow use of copy-constructor and assignment-operator for now
+ SwXMailMerge( const SwXMailMerge & );
+ SwXMailMerge & operator = ( const SwXMailMerge & );
+protected:
+ virtual ~SwXMailMerge();
+public:
+ SwXMailMerge();
+
+
+ void LaunchMailMergeEvent( const com::sun::star::text::MailMergeEvent &rData ) const;
+
+ // XJob
+ virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMailMergeBroadcaster
+ virtual void SAL_CALL addMailMergeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XMailMergeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeMailMergeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XMailMergeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+
+extern com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames() throw();
+extern rtl::OUString SAL_CALL SwXMailMerge_getImplementationName() throw();
+extern com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SwXMailMerge_createInstance(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( com::sun::star::uno::Exception );
+
+////////////////////////////////////////////////////////////
+
+#endif
+
+
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
new file mode 100644
index 000000000000..6f085bf0d26a
--- /dev/null
+++ b/sw/inc/unomap.hxx
@@ -0,0 +1,351 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOMAP_HXX
+#define _UNOMAP_HXX
+
+#include <svl/itemprop.hxx>
+
+#define PROPERTY_NONE 0
+
+#define PROPERTY_MAP_TEXT_CURSOR 0
+#define PROPERTY_MAP_CHAR_STYLE 1
+#define PROPERTY_MAP_PARA_STYLE 2
+#define PROPERTY_MAP_FRAME_STYLE 3
+#define PROPERTY_MAP_PAGE_STYLE 4
+#define PROPERTY_MAP_NUM_STYLE 5
+#define PROPERTY_MAP_SECTION 6
+#define PROPERTY_MAP_TEXT_TABLE 7
+#define PROPERTY_MAP_TABLE_CELL 8
+#define PROPERTY_MAP_TABLE_RANGE 9
+#define PROPERTY_MAP_TEXT_SEARCH 10
+#define PROPERTY_MAP_TEXT_FRAME 11
+#define PROPERTY_MAP_TEXT_GRAPHIC 12
+#define PROPERTY_MAP_TEXT_SHAPE 13
+#define PROPERTY_MAP_INDEX_USER 14
+#define PROPERTY_MAP_INDEX_CNTNT 15
+#define PROPERTY_MAP_INDEX_IDX 16
+#define PROPERTY_MAP_USER_MARK 17
+#define PROPERTY_MAP_CNTIDX_MARK 18
+#define PROPERTY_MAP_INDEX_MARK 19
+#define PROPERTY_MAP_TEXT_TABLE_ROW 20
+#define PROPERTY_MAP_TEXT_SHAPE_DESCRIPTOR 21
+#define PROPERTY_MAP_TEXT_TABLE_CURSOR 22
+#define PROPERTY_MAP_BOOKMARK 23
+#define PROPERTY_MAP_PARAGRAPH_EXTENSIONS 24
+#define PROPERTY_MAP_INDEX_ILLUSTRATIONS 25
+#define PROPERTY_MAP_INDEX_OBJECTS 26
+#define PROPERTY_MAP_INDEX_TABLES 27
+#define PROPERTY_MAP_BIBLIOGRAPHY 28
+#define PROPERTY_MAP_TEXT_DOCUMENT 29
+#define PROPERTY_MAP_LINK_TARGET 30
+#define PROPERTY_MAP_AUTO_TEXT_GROUP 31
+#define PROPERTY_MAP_TEXTPORTION_EXTENSIONS 34
+#define PROPERTY_MAP_FOOTNOTE 35
+#define PROPERTY_MAP_TEXT_COLUMS 36
+#define PROPERTY_MAP_PARAGRAPH 37
+#define PROPERTY_MAP_EMBEDDED_OBJECT 38
+#define PROPERTY_MAP_REDLINE 39
+#define PROPERTY_MAP_TEXT_DEFAULT 40
+
+#define PROPERTY_MAP_FLDTYP_DATETIME 41
+#define PROPERTY_MAP_FLDTYP_USER 42
+#define PROPERTY_MAP_FLDTYP_SET_EXP 43
+#define PROPERTY_MAP_FLDTYP_GET_EXP 44
+#define PROPERTY_MAP_FLDTYP_FILE_NAME 45
+#define PROPERTY_MAP_FLDTYP_PAGE_NUM 46
+#define PROPERTY_MAP_FLDTYP_AUTHOR 47
+#define PROPERTY_MAP_FLDTYP_CHAPTER 48
+#define PROPERTY_MAP_FLDTYP_GET_REFERENCE 49
+#define PROPERTY_MAP_FLDTYP_CONDITIONED_TEXT 50
+#define PROPERTY_MAP_FLDTYP_HIDDEN_TEXT 51
+#define PROPERTY_MAP_FLDTYP_ANNOTATION 52
+#define PROPERTY_MAP_FLDTYP_INPUT 53
+#define PROPERTY_MAP_FLDTYP_MACRO 54
+#define PROPERTY_MAP_FLDTYP_DDE 55
+#define PROPERTY_MAP_FLDTYP_HIDDEN_PARA 56
+#define PROPERTY_MAP_FLDTYP_DOC_INFO 57
+#define PROPERTY_MAP_FLDTYP_TEMPLATE_NAME 58
+#define PROPERTY_MAP_FLDTYP_USER_EXT 59
+#define PROPERTY_MAP_FLDTYP_REF_PAGE_SET 60
+#define PROPERTY_MAP_FLDTYP_REF_PAGE_GET 61
+#define PROPERTY_MAP_FLDTYP_JUMP_EDIT 62
+#define PROPERTY_MAP_FLDTYP_SCRIPT 63
+#define PROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET 64
+#define PROPERTY_MAP_FLDTYP_DATABASE_NUM_SET 65
+#define PROPERTY_MAP_FLDTYP_DATABASE_SET_NUM 66
+#define PROPERTY_MAP_FLDTYP_DATABASE 67
+#define PROPERTY_MAP_FLDTYP_DATABASE_NAME 68
+#define PROPERTY_MAP_FLDTYP_DOCSTAT 69
+#define PROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR 70
+#define PROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME 71
+#define PROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME 72
+#define PROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME 73
+#define PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME 74
+#define PROPERTY_MAP_FLDTYP_DOCINFO_MISC 75
+#define PROPERTY_MAP_FLDTYP_DOCINFO_REVISION 76
+#define PROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS 77
+#define PROPERTY_MAP_FLDTYP_DUMMY_0 78
+#define PROPERTY_MAP_FLDTYP_TABLE_FORMULA 79
+#define PROPERTY_MAP_FLDMSTR_USER 80
+#define PROPERTY_MAP_FLDMSTR_DDE 81
+#define PROPERTY_MAP_FLDMSTR_SET_EXP 82
+#define PROPERTY_MAP_FLDMSTR_DATABASE 83
+#define PROPERTY_MAP_FLDMSTR_DUMMY0 84
+#define PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY 85
+#define PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY 86
+#define PROPERTY_MAP_TEXT 87
+#define PROPERTY_MAP_REDLINE_PORTION 88
+#define PROPERTY_MAP_MAILMERGE 89
+#define PROPERTY_MAP_FLDTYP_DROPDOWN 90
+#define PROPERTY_MAP_CHART2_DATA_SEQUENCE 91
+#define PROPERTY_MAP_TEXT_VIEW 92
+#define PROPERTY_MAP_CONDITIONAL_PARA_STYLE 93
+#define PROPERTY_MAP_CHAR_AUTO_STYLE 94
+#define PROPERTY_MAP_RUBY_AUTO_STYLE 95
+#define PROPERTY_MAP_PARA_AUTO_STYLE 96
+#define PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM 97
+#define PROPERTY_MAP_METAFIELD 98
+//IAccessibility2 Implementation 2009-----
+#define PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE 99
+//-----IAccessibility2 Implementation 2009
+#define PROPERTY_MAP_END 100
+
+//S&E
+#define WID_WORDS 0
+#define WID_BACKWARDS 1
+#define WID_REGULAR_EXPRESSION 2
+#define WID_CASE_SENSITIVE 3
+#define WID_IN_SELECTION 4
+#define WID_STYLES 5
+#define WID_SIMILARITY 6
+#define WID_SIMILARITY_RELAX 7
+#define WID_SIMILARITY_EXCHANGE 8
+#define WID_SIMILARITY_ADD 9
+#define WID_SIMILARITY_REMOVE 10
+#define WID_SEARCH_ALL 11
+
+//Sections
+#define WID_SECT_CONDITION 8000
+#define WID_SECT_DDE_TYPE 8001
+#define WID_SECT_DDE_FILE 8002
+#define WID_SECT_DDE_ELEMENT 8003
+#define WID_SECT_LINK 8004
+#define WID_SECT_VISIBLE 8005
+#define WID_SECT_PROTECTED 8006
+#define WID_SECT_REGION 8007
+#define WID_SECT_DDE_AUTOUPDATE 8008
+#define WID_SECT_DOCUMENT_INDEX 8009
+#define WID_SECT_IS_GLOBAL_DOC_SECTION 8010
+#define WID_SECT_PASSWORD 8011
+#define WID_SECT_CURRENTLY_VISIBLE 8012
+#define WID_SECT_EDIT_IN_READONLY 8013
+
+
+//Verzeichnisse
+#define WID_PRIMARY_KEY 1000
+#define WID_SECONDARY_KEY 1001
+#define WID_ALT_TEXT 1002
+#define WID_IDX_TITLE 1003
+#define WID_LEVEL 1004
+#define WID_CREATE_FROM_MARKS 1005
+#define WID_CREATE_FROM_OUTLINE 1006
+#define WID_MAIN_ENTRY 1007
+#define WID_CREATE_FROM_CHAPTER 1008
+#define WID_CREATE_FROM_LABELS 1009
+#define WID_USE_ALPHABETICAL_SEPARATORS 1010
+#define WID_USE_KEY_AS_ENTRY 1011
+#define WID_USE_COMBINED_ENTRIES 1012
+#define WID_IS_CASE_SENSITIVE 1013
+#define WID_USE_P_P 1014
+#define WID_USE_DASH 1015
+#define WID_USE_UPPER_CASE 1016
+#define WID_INDEX_AUTO_MARK_FILE_U_R_L 1017
+#define WID_LABEL_CATEGORY 1018
+#define WID_LABEL_DISPLAY_TYPE 1019
+#define WID_USE_LEVEL_FROM_SOURCE 1020
+#define WID_LEVEL_FORMAT 1021
+#define WID_LEVEL_PARAGRAPH_STYLES 1022
+#define WID_RECALC_TAB_STOPS 1023
+//#define WID_??? 1024
+#define WID_MAIN_ENTRY_CHARACTER_STYLE_NAME 1025
+#define WID_CREATE_FROM_TABLES 1026
+#define WID_CREATE_FROM_TEXT_FRAMES 1027
+#define WID_CREATE_FROM_GRAPHIC_OBJECTS 1028
+#define WID_CREATE_FROM_EMBEDDED_OBJECTS 1029
+#define WID_CREATE_FROM_STAR_MATH 1030
+#define WID_PROTECTED 1031
+
+#define WID_CREATE_FROM_STAR_CHART 1032
+#define WID_CREATE_FROM_STAR_CALC 1033
+#define WID_CREATE_FROM_STAR_DRAW 1034
+#define WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS 1035
+#define WID_USER_IDX_NAME 1036
+#define WID_PARA_HEAD 1037
+#define WID_PARA_SEP 1038
+#define WID_PARA_LEV1 1039
+#define WID_PARA_LEV2 1040
+#define WID_PARA_LEV3 1041
+#define WID_PARA_LEV4 1042
+#define WID_PARA_LEV5 1043
+#define WID_PARA_LEV6 1044
+#define WID_PARA_LEV7 1045
+#define WID_PARA_LEV8 1046
+#define WID_PARA_LEV9 1047
+#define WID_PARA_LEV10 1048
+#define WID_IS_COMMA_SEPARATED 1049
+#define WID_INDEX_MARKS 1050
+#define WID_IS_RELATIVE_TABSTOPS 1051
+#define WID_CREATE_FROM_PARAGRAPH_STYLES 1052
+#define WID_IDX_CONTENT_SECTION 1053
+#define WID_IDX_HEADER_SECTION 1054
+#define WID_IDX_LOCALE 1055
+#define WID_IDX_SORT_ALGORITHM 1056
+#define WID_IDX_NAME 1057
+
+#define WID_TEXT_READING 1058
+#define WID_PRIMARY_KEY_READING 1059
+#define WID_SECONDARY_KEY_READING 1060
+
+//text document
+#define WID_DOC_CHAR_COUNT 1000
+#define WID_DOC_PARA_COUNT 1001
+#define WID_DOC_WORD_COUNT 1002
+#define WID_DOC_WORD_SEPARATOR 1003
+#define WID_DOC_CHANGES_SHOW 1004
+#define WID_DOC_CHANGES_RECORD 1005
+#define WID_DOC_AUTO_MARK_URL 1006
+#define WID_DOC_HIDE_TIPS 1007
+#define WID_DOC_REDLINE_DISPLAY 1008
+#define WID_DOC_FORBIDDEN_CHARS 1009
+#define WID_DOC_CHANGES_PASSWORD 1010
+#define WID_DOC_TWO_DIGIT_YEAR 1011
+#define WID_DOC_AUTOMATIC_CONTROL_FOCUS 1012
+#define WID_DOC_APPLY_FORM_DESIGN_MODE 1013
+#define WID_DOC_BASIC_LIBRARIES 1014
+#define WID_DOC_RUNTIME_UID 1015
+#define WID_DOC_LOCK_UPDATES 1016
+#define WID_DOC_HAS_VALID_SIGNATURES 1017
+#define WID_DOC_BUILDID 1024
+#define WID_DOC_ISTEMPLATEID 1025
+// --> OD 2006-03-21 #b6375613#
+#define WID_APPLY_WORKAROUND_FOR_B6375613 1070
+// <--
+
+//MailMerge
+#define WID_SELECTION 1071
+#define WID_RESULT_SET 1072
+#define WID_CONNECTION 1073
+#define WID_MODEL 1074
+#define WID_DATA_SOURCE_NAME 1075
+#define WID_DATA_COMMAND 1076
+#define WID_FILTER 1077
+#define WID_DOCUMENT_URL 1078
+#define WID_OUTPUT_URL 1079
+#define WID_DATA_COMMAND_TYPE 1080
+#define WID_OUTPUT_TYPE 1081
+#define WID_ESCAPE_PROCESSING 1082
+#define WID_SINGLE_PRINT_JOBS 1083
+#define WID_FILE_NAME_FROM_COLUMN 1084
+#define WID_FILE_NAME_PREFIX 1085
+#define WID_MAIL_SUBJECT 1086
+#define WID_ADDRESS_FROM_COLUMN 1087
+#define WID_SEND_AS_HTML 1088
+#define WID_SEND_AS_ATTACHMENT 1089
+#define WID_MAIL_BODY 1090
+#define WID_ATTACHMENT_NAME 1091
+#define WID_ATTACHMENT_FILTER 1092
+#define WID_PRINT_OPTIONS 1093
+#define WID_SAVE_AS_SINGLE_FILE 1094
+#define WID_SAVE_FILTER 1095
+#define WID_COPIES_TO 1096
+#define WID_BLIND_COPIES_TO 1097
+#define WID_IN_SERVER_PASSWORD 1098
+#define WID_OUT_SERVER_PASSWORD 1099
+#define WID_SAVE_FILTER_OPTIONS 1100
+#define WID_SAVE_FILTER_DATA 1101
+
+#define WID_PAGE_COUNT 1100
+#define WID_LINE_COUNT 1101
+#define WID_IS_CONSTANT_SPELLCHECK 1102
+#define WID_IS_HIDE_SPELL_MARKS 1103 /* deprecated #i91949 */
+
+#define WID_LAYOUT_SIZE 1104
+#define WID_DOC_DIALOG_LIBRARIES 1105
+#define WID_DOC_VBA_DOCOBJ 1106
+
+
+//AutoText
+#define WID_GROUP_PATH 0
+#define WID_GROUP_TITLE 1
+
+//NumberingRules
+#define WID_IS_AUTOMATIC 0
+#define WID_CONTINUOUS 1
+#define WID_RULE_NAME 2
+#define WID_IS_ABS_MARGINS 3
+#define WID_IS_OUTLINE 4
+#define WID_DEFAULT_LIST_ID 5
+
+//TextColumns
+#define WID_TXTCOL_LINE_WIDTH 0
+#define WID_TXTCOL_LINE_COLOR 1
+#define WID_TXTCOL_LINE_REL_HGT 2
+#define WID_TXTCOL_LINE_ALIGN 3
+#define WID_TXTCOL_LINE_IS_ON 4
+#define WID_TXTCOL_IS_AUTOMATIC 5
+#define WID_TXTCOL_AUTO_DISTANCE 6
+
+/* -----------------04.07.98 11:41-------------------
+ *
+ * --------------------------------------------------*/
+class SwItemPropertySet : public SfxItemPropertySet
+{
+protected:
+ virtual sal_Bool FillItem(SfxItemSet& rSet, sal_uInt16 nWhich, sal_Bool bGetProperty) const;
+public:
+ SwItemPropertySet( const SfxItemPropertyMapEntry *pMap ) :
+ SfxItemPropertySet( pMap ){}
+};
+/* -----------------04.07.98 11:41-------------------
+ *
+ * --------------------------------------------------*/
+class SwUnoPropertyMapProvider
+{
+ SfxItemPropertyMapEntry* aMapEntriesArr[PROPERTY_MAP_END];
+ SfxItemPropertySet* aPropertySetArr[PROPERTY_MAP_END];
+
+public:
+ SwUnoPropertyMapProvider();
+ ~SwUnoPropertyMapProvider();
+
+ const SfxItemPropertyMapEntry* GetPropertyMapEntries(sal_uInt16 PropertyId);
+ const SfxItemPropertySet* GetPropertySet( sal_uInt16 PropertyId );
+
+};
+
+extern SwUnoPropertyMapProvider aSwMapProvider;
+#endif
diff --git a/sw/inc/unomid.h b/sw/inc/unomid.h
new file mode 100644
index 000000000000..8f35f4146c59
--- /dev/null
+++ b/sw/inc/unomid.h
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_UNOMID_HXX
+#define SW_UNOMID_HXX
+
+#define C2S(cChar) String::CreateFromAscii( cChar )
+#define C2U(cChar) rtl::OUString::createFromAscii( cChar )
+
+#define MID_MIRROR_VERT 0
+#define MID_MIRROR_HORZ_EVEN_PAGES 1
+#define MID_MIRROR_HORZ_ODD_PAGES 2
+
+#define MID_PAGEDESC_PAGEDESCNAME 0
+#define MID_PAGEDESC_PAGENUMOFFSET 1
+
+#define MID_SURROUND_SURROUNDTYPE 0
+#define MID_SURROUND_ANCHORONLY 1
+#define MID_SURROUND_CONTOUR 2
+#define MID_SURROUND_CONTOUROUTSIDE 3
+
+#define MID_VERTORIENT_ORIENT 0
+#define MID_VERTORIENT_RELATION 1
+#define MID_VERTORIENT_POSITION 2
+
+#define MID_HORIORIENT_ORIENT 0
+#define MID_HORIORIENT_RELATION 1
+#define MID_HORIORIENT_POSITION 2
+#define MID_HORIORIENT_PAGETOGGLE 3
+
+#define MID_ANCHOR_ANCHORTYPE 0
+#define MID_ANCHOR_PAGENUM 1
+#define MID_ANCHOR_ANCHORFRAME 2
+
+#define MID_URL_HYPERLINKFORMAT 0
+#define MID_URL_HYPERLINKNAME 1
+#define MID_URL_CLIENTMAP 2
+#define MID_URL_SERVERMAP 3
+#define MID_URL_URL 4
+#define MID_URL_TARGET 5
+#define MID_URL_VISITED_FMT 6
+#define MID_URL_UNVISITED_FMT 7
+#define MID_URL_HYPERLINKEVENTS 8
+
+#define MID_CHAIN_PREVNAME 0
+#define MID_CHAIN_NEXTNAME 1
+
+#define MID_LINENUMBER_COUNT 0
+#define MID_LINENUMBER_STARTVALUE 1
+
+#define MID_DROPCAP_FORMAT 0
+#define MID_DROPCAP_WHOLE_WORD 1
+#define MID_DROPCAP_CHAR_STYLE_NAME 2
+#define MID_DROPCAP_LINES 3
+#define MID_DROPCAP_COUNT 4
+#define MID_DROPCAP_DISTANCE 5
+
+#define MID_FRMSIZE_SIZE 0
+#define MID_FRMSIZE_REL_HEIGHT 1
+#define MID_FRMSIZE_REL_WIDTH 2
+
+#define MID_FRMSIZE_WIDTH 4
+#define MID_FRMSIZE_HEIGHT 5
+#define MID_FRMSIZE_SIZE_TYPE 6
+#define MID_FRMSIZE_IS_AUTO_HEIGHT 7
+/* XML only */
+#define MID_FRMSIZE_MIN_HEIGHT 8
+#define MID_FRMSIZE_FIX_HEIGHT 9
+#define MID_FRMSIZE_COL_WIDTH 10
+#define MID_FRMSIZE_REL_COL_WIDTH 11
+/* UNO */
+#define MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT 12
+#define MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH 13
+#define MID_FRMSIZE_WIDTH_TYPE 14
+
+#define MID_COLUMNS 0
+#define MID_COLUMN_SEPARATOR_LINE 1
+
+//SwFmtFtnAtTxtEnd
+#define MID_COLLECT 0
+#define MID_RESTART_NUM 1
+#define MID_NUM_START_AT 2
+#define MID_OWN_NUM 3
+#define MID_NUM_TYPE 4
+#define MID_PREFIX 5
+#define MID_SUFFIX 6
+
+//page style footnote
+#define MID_FTN_HEIGHT 0
+#define MID_LINE_WEIGHT 1
+#define MID_LINE_COLOR 2
+#define MID_LINE_RELWIDTH 3
+#define MID_LINE_ADJUST 4
+#define MID_LINE_TEXT_DIST 5
+#define MID_LINE_FOOTNOTE_DIST 6
+
+//SwFmtRuby
+#define MID_RUBY_TEXT 0
+#define MID_RUBY_ADJUST 1
+#define MID_RUBY_CHARSTYLE 2
+#define MID_RUBY_ABOVE 3
+
+//SwTextGridItem
+#define MID_GRID_COLOR 0
+#define MID_GRID_LINES 1
+#define MID_GRID_BASEHEIGHT 2
+#define MID_GRID_RUBYHEIGHT 3
+#define MID_GRID_TYPE 4
+#define MID_GRID_RUBY_BELOW 5
+#define MID_GRID_PRINT 6
+#define MID_GRID_DISPLAY 7
+#define MID_GRID_BASEWIDTH 8
+#define MID_GRID_SNAPTOCHARS 9
+#define MID_GRID_STANDARD_MODE 10
+
+//SwEnvItem
+#define MID_ENV_ADDR_TEXT 1
+#define MID_ENV_SEND 2
+#define MID_SEND_TEXT 3
+#define MID_ENV_ADDR_FROM_LEFT 4
+#define MID_ENV_ADDR_FROM_TOP 5
+#define MID_ENV_SEND_FROM_LEFT 6
+#define MID_ENV_SEND_FROM_TOP 7
+#define MID_ENV_WIDTH 8
+#define MID_ENV_HEIGHT 9
+#define MID_ENV_ALIGN 10
+#define MID_ENV_PRINT_FROM_ABOVE 11
+#define MID_ENV_SHIFT_RIGHT 12
+#define MID_ENV_SHIFT_DOWN 13
+
+// OD 2004-05-04 #i28701# - SwFmtWrapInfluenceOnObjPos
+#define MID_WRAP_INFLUENCE 0
+
+#endif
diff --git a/sw/inc/unomod.hxx b/sw/inc/unomod.hxx
new file mode 100644
index 000000000000..b65ae69d49fe
--- /dev/null
+++ b/sw/inc/unomod.hxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOMOD_HXX
+#define _UNOMOD_HXX
+
+#include <com/sun/star/text/XModule.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/view/XPrintSettingsSupplier.hpp>
+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <cppuhelper/implbase2.hxx> // helper for implementations
+#include <cppuhelper/implbase3.hxx> // helper for implementations
+#include <cppuhelper/implbase4.hxx> // helper for implementations
+#include <comphelper/ChainablePropertySet.hxx>
+#include <comphelper/SettingsHelper.hxx>
+#include <usrpref.hxx>
+
+class SwView;
+class SwViewOption;
+class SwPrintData;
+class SwDoc;
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+/*-----------------15.03.98 13:21-------------------
+
+--------------------------------------------------*/
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SwXModule_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
+
+class SwXModule : public cppu::WeakImplHelper4
+<
+ ::com::sun::star::text::XModule,
+ ::com::sun::star::view::XViewSettingsSupplier,
+ ::com::sun::star::view::XPrintSettingsSupplier,
+ ::com::sun::star::lang::XServiceInfo
+>
+{
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxViewSettings;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxPrintSettings;
+
+protected:
+ virtual ~SwXModule();
+public:
+ SwXModule();
+
+
+ //XViewSettings
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getViewSettings(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ //XPrintSettings
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getPrintSettings(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+};
+
+enum SwXPrintSettingsType
+{
+ PRINT_SETTINGS_MODULE,
+ PRINT_SETTINGS_WEB,
+ PRINT_SETTINGS_DOCUMENT
+};
+
+class SwXPrintSettings : public comphelper::ChainableHelperNoState
+{
+ friend class SwXDocumentSettings;
+protected:
+ SwXPrintSettingsType meType;
+ SwPrintData * mpPrtOpt;
+ SwDoc *mpDoc;
+
+ virtual void _preSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _postSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+
+ virtual void _preGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _postGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+
+ virtual ~SwXPrintSettings()
+ throw();
+public:
+ SwXPrintSettings( SwXPrintSettingsType eType, SwDoc * pDoc = NULL );
+
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+};
+/*-----------------15.03.98 13:21-------------------
+
+--------------------------------------------------*/
+class SwXViewSettings : public comphelper::ChainableHelperNoState
+{
+
+ friend class SwXDocumentSettings;
+protected:
+ SwView* pView;
+ SwViewOption* mpViewOption;
+ const SwViewOption* mpConstViewOption;
+ sal_Bool bObjectValid:1, bWeb:1, mbApplyZoom;
+
+ sal_Int32 eHRulerUnit;
+ sal_Bool mbApplyHRulerMetric;
+ sal_Int32 eVRulerUnit;
+ sal_Bool mbApplyVRulerMetric;
+
+ virtual void _preSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _postSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+
+ virtual void _preGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _postGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+
+ virtual ~SwXViewSettings()
+ throw();
+public:
+ SwXViewSettings(sal_Bool bWeb, SwView* pView);
+
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ sal_Bool IsValid() const {return bObjectValid;}
+ void Invalidate() {bObjectValid = sal_False;}
+};
+/* -----------------24.09.98 10:47-------------------
+ *
+ * --------------------------------------------------*/
+/*class SwXTerminateListener : public ::com::sun::star::frame::XTerminateListener,
+ public UsrObject
+{
+public:
+ SwXTerminateListener();
+ virtual ~SwXTerminateListener();
+
+ SMART_UNO_DECLARATION( SwXTerminateListener, UsrObject );
+
+ virtual UString getClassName();
+// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
+// virtual ::com::sun::star::uno::XInterface * queryInterface( ::com::sun::star::uno::Uik aUik);
+
+// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
+// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > > getIdlClasses(void);
+
+
+ //XTerminateListener
+ virtual void queryTermination(const ::com::sun::star::lang::EventObject& aEvent);
+ virtual void notifyTermination(const ::com::sun::star::lang::EventObject& aEvent);
+
+ //XEventListener
+ virtual void disposing(const ::com::sun::star::lang::EventObject& Source);
+};
+
+*/
+#endif
diff --git a/sw/inc/unoparaframeenum.hxx b/sw/inc/unoparaframeenum.hxx
new file mode 100644
index 000000000000..90b1f8141902
--- /dev/null
+++ b/sw/inc/unoparaframeenum.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOPARAFRAMEENUM_HXX
+#define SW_UNOPARAFRAMEENUM_HXX
+
+#include <deque>
+
+#include <boost/shared_ptr.hpp>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+#include <unobaseclass.hxx>
+
+
+class SwDepend;
+class SwNodeIndex;
+class SwPaM;
+class SwFrmFmt;
+
+
+struct FrameDependSortListEntry
+{
+ xub_StrLen nIndex;
+ sal_uInt32 nOrder;
+ ::boost::shared_ptr<SwDepend> pFrameDepend;
+
+ FrameDependSortListEntry (xub_StrLen const i_nIndex,
+ sal_uInt32 const i_nOrder, SwDepend * const i_pDepend)
+ : nIndex(i_nIndex), nOrder(i_nOrder), pFrameDepend(i_pDepend) { }
+};
+
+typedef ::std::deque< FrameDependSortListEntry >
+ FrameDependSortList_t;
+
+typedef ::std::deque< ::boost::shared_ptr<SwDepend> >
+ FrameDependList_t;
+
+
+// OD 2004-05-07 #i28701# - adjust 4th parameter
+void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
+ FrameDependSortList_t & rFrames,
+ const bool _bAtCharAnchoredObjs );
+
+
+/* -----------------23.03.99 12:57-------------------
+ *
+ * --------------------------------------------------*/
+
+enum ParaFrameMode
+{
+ PARAFRAME_PORTION_PARAGRAPH,
+ PARAFRAME_PORTION_CHAR,
+ PARAFRAME_PORTION_TEXTRANGE,
+};
+
+typedef ::cppu::WeakImplHelper2
+< ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::container::XEnumeration
+> SwXParaFrameEnumeration_Base;
+
+class SwXParaFrameEnumeration
+ : public SwXParaFrameEnumeration_Base
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ virtual ~SwXParaFrameEnumeration();
+
+public:
+
+ SwXParaFrameEnumeration(const SwPaM& rPaM,
+ const enum ParaFrameMode eParaFrameMode, SwFrmFmt *const pFmt = 0);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // SW_UNOPARAFRAMEENUM_HXX
+
diff --git a/sw/inc/unoparagraph.hxx b/sw/inc/unoparagraph.hxx
new file mode 100644
index 000000000000..5093efaf65a3
--- /dev/null
+++ b/sw/inc/unoparagraph.hxx
@@ -0,0 +1,365 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOPARAGRAPH_HXX
+#define SW_UNOPARAGRAPH_HXX
+
+#include <memory>
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+
+#include <cppuhelper/implbase10.hxx>
+
+#include <sfx2/Metadatable.hxx>
+
+#include <unobaseclass.hxx>
+
+
+struct SwPosition;
+class SwPaM;
+class SwUnoCrsr;
+class SwStartNode;
+class SwTxtNode;
+class SwTable;
+class SwXText;
+
+
+/*-----------------07.04.98 08:15-------------------
+
+--------------------------------------------------*/
+typedef ::cppu::ImplInheritanceHelper10
+< ::sfx2::MetadatableMixin
+, ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::beans::XPropertyState
+, ::com::sun::star::beans::XMultiPropertySet
+, ::com::sun::star::beans::XTolerantMultiPropertySet
+, ::com::sun::star::container::XEnumerationAccess
+, ::com::sun::star::container::XContentEnumerationAccess
+, ::com::sun::star::text::XTextContent
+, ::com::sun::star::text::XTextRange
+> SwXParagraph_Base;
+
+class SwXParagraph
+ : public SwXParagraph_Base
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ virtual ~SwXParagraph();
+
+ SwXParagraph(::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XText > const & xParent,
+ SwTxtNode & rTxtNode,
+ const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = - 1);
+
+public:
+
+ /// descriptor
+ SwXParagraph();
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent>
+ CreateXParagraph(SwDoc & rDoc, SwTxtNode& rTxtNode,
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText>
+ const& xParentText = 0,
+ const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = - 1);
+
+ const SwTxtNode * GetTxtNode() const;
+ bool IsDescriptor() const;
+ /// make rPaM select the paragraph
+ bool SelectPaM(SwPaM & rPaM);
+ /// for SwXText
+ void attachToText(SwXText & rParent, SwTxtNode & rTxtNode);
+
+ // MetadatableMixin
+ virtual ::sfx2::Metadatable* GetCoreObject();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ GetModel();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL
+ getPropertyState(const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyState > SAL_CALL
+ getPropertyStates(
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& rPropertyNames)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rValues)
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ SAL_CALL getPropertyValues(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTolerantMultiPropertySet
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL
+ setPropertyValuesTolerant(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rValues)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL
+ getPropertyValuesTolerant(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL
+ getDirectPropertyValuesTolerant(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createEnumeration()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XContentEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createContentEnumeration(const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getAvailableServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ SAL_CALL getText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getStart()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getEnd()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getString()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString(const ::rtl::OUString& rString)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+
+/*-----------------07.04.98 08:10-------------------
+
+--------------------------------------------------*/
+class SwXParagraphEnumeration
+ : public SwSimpleEnumeration_Base
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ virtual ~SwXParagraphEnumeration();
+
+public:
+
+ /// takes ownership of cursor
+ SwXParagraphEnumeration(
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ const & xParent,
+ ::std::auto_ptr<SwUnoCrsr> pCursor,
+ const CursorType eType,
+ SwStartNode const*const pStartNode = 0,
+ SwTable const*const pTable = 0);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // SW_UNOPARAGRAPH_HXX
+
diff --git a/sw/inc/unoport.hxx b/sw/inc/unoport.hxx
new file mode 100644
index 000000000000..bb48c64b208b
--- /dev/null
+++ b/sw/inc/unoport.hxx
@@ -0,0 +1,322 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOPORT_HXX
+#define _UNOPORT_HXX
+
+#include <unocrsr.hxx>
+#include <unoevtlstnr.hxx>
+#include <calbck.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase8.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <svl/itemprop.hxx>
+
+#include <memory>
+#include <deque>
+
+
+class SwFmtFld;
+class SwFrmFmt;
+class SwTxtRuby;
+
+
+typedef ::std::deque<
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > >
+ TextRangeList_t;
+
+
+/* -----------------29.05.98 14:42-------------------
+ *
+ * --------------------------------------------------*/
+enum SwTextPortionType
+{
+ PORTION_TEXT,
+ PORTION_FIELD,
+ PORTION_FRAME,
+ PORTION_FOOTNOTE,
+// obsolete! PORTION_CONTROL_CHAR,
+ PORTION_REFMARK_START,
+ PORTION_REFMARK_END,
+ PORTION_TOXMARK_START,
+ PORTION_TOXMARK_END,
+ PORTION_BOOKMARK_START,
+ PORTION_BOOKMARK_END,
+ PORTION_REDLINE_START,
+ PORTION_REDLINE_END,
+ PORTION_RUBY_START,
+ PORTION_RUBY_END,
+ PORTION_SOFT_PAGEBREAK,
+ PORTION_META,
+ PORTION_FIELD_START,
+ PORTION_FIELD_END,
+ PORTION_FIELD_START_END
+};
+
+
+class SwXTextPortion : public cppu::WeakImplHelper8
+<
+ ::com::sun::star::beans::XTolerantMultiPropertySet,
+ ::com::sun::star::beans::XMultiPropertySet,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::text::XTextRange,
+ ::com::sun::star::beans::XPropertyState,
+ ::com::sun::star::container::XContentEnumerationAccess,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::lang::XServiceInfo
+>,
+ public SwClient
+{
+private:
+
+ SwEventListenerContainer m_ListenerContainer;
+ const SfxItemPropertySet * m_pPropSet;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ m_xParentText;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
+ m_xRefMark;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
+ m_xTOXMark;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
+ m_xBookmark;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote >
+ m_xFootnote;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField >
+ m_xTextField;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
+ m_xMeta;
+ ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyText;
+ ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyStyle;
+ ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyAdjust;
+ ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyIsAbove;
+
+ const SwDepend m_FrameDepend;
+ SwFrmFmt * m_pFrameFmt;
+ const SwTextPortionType m_ePortionType;
+
+ bool m_bIsCollapsed;
+
+ SwFmtFld * GetFldFmt(bool bInit = false);
+
+ void init(const SwUnoCrsr* pPortionCursor);
+
+protected:
+
+ void SAL_CALL SetPropertyValues_Impl(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ void GetPropertyValues( const ::rtl::OUString *pPropertyNames,
+ ::com::sun::star::uno::Any *pValues,
+ sal_Int32 nLength );
+
+ void GetPropertyValue( ::com::sun::star::uno::Any &rVal,
+ const SfxItemPropertySimpleEntry& rEntry, SwUnoCrsr *pUnoCrsr, SfxItemSet *&pSet );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL GetPropertyValuesTolerant_Impl(
+ const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames,
+ sal_Bool bDirectValuesOnly ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ~SwXTextPortion();
+
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > const& rParent, SwTextPortionType eType );
+ SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > const& rParent, SwFrmFmt& rFmt );
+
+ // for Ruby
+ SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
+ SwTxtRuby const& rAttr,
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ const& xParent,
+ sal_Bool bIsEnd );
+
+ //XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw( ::com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL getString() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setString(const rtl::OUString& aString) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XTolerantMultiPropertySet
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL setPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL getPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL getDirectPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertySet
+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XTextContent
+ virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XComponent
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ //XContentEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createContentEnumeration(const rtl::OUString& aServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getAvailableServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ void SetRefMark( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > xMark)
+ { m_xRefMark = xMark; }
+
+ void SetTOXMark( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > xMark)
+ { m_xTOXMark = xMark; }
+
+ void SetBookmark( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > xMark)
+ { m_xBookmark = xMark; }
+
+ void SetFootnote( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XFootnote > xNote)
+ { m_xFootnote = xNote; }
+
+ void SetTextField( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextField> xField)
+ { m_xTextField = xField; }
+
+ void SetMeta( ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > xMeta)
+ { m_xMeta = xMeta; }
+
+ bool IsCollapsed() const { return m_bIsCollapsed; }
+ void SetCollapsed(bool bSet) { m_bIsCollapsed = bSet;}
+
+ SwTextPortionType GetTextPortionType() const { return m_ePortionType; }
+
+ SwUnoCrsr* GetCursor() const
+ {return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));}
+};
+
+/* -----------------29.05.98 14:42-------------------
+ *
+ * --------------------------------------------------*/
+class SwXTextPortionEnumeration
+ : public ::cppu::WeakImplHelper3
+ < ::com::sun::star::container::XEnumeration
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XUnoTunnel
+ >
+ , public SwClient
+{
+ TextRangeList_t m_Portions; // contains all portions, filled by ctor
+
+ SwUnoCrsr* GetCursor() const
+ {return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));}
+
+protected:
+ virtual ~SwXTextPortionEnumeration();
+
+public:
+ SwXTextPortionEnumeration(SwPaM& rParaCrsr,
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ const & xParent,
+ const sal_Int32 nStart, const sal_Int32 nEnd );
+
+ SwXTextPortionEnumeration(SwPaM& rParaCrsr,
+ TextRangeList_t const & rPortions );
+
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ //XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
+ throw( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException );
+protected:
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+};
+
+#endif
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
new file mode 100644
index 000000000000..d0edd92e8e06
--- /dev/null
+++ b/sw/inc/unoprnms.hxx
@@ -0,0 +1,842 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOPRNMS_HXX
+#define _UNOPRNMS_HXX
+
+
+#include <sal/types.h>
+#include <tools/solar.h>
+#include "swdllapi.h"
+
+enum SwPropNameIds
+{
+/* 0001 */ SW_PROPNAME_BEGIN = 1,
+
+/* 0001 */ UNO_NAME_FOLLOW_STYLE = SW_PROPNAME_BEGIN,
+/* 0002 */ UNO_NAME_IS_PHYSICAL,
+/* 0003 */ UNO_NAME_IS_AUTO_UPDATE,
+/* 0004 */ UNO_NAME_DISPLAY_NAME,
+/* 0005 */ UNO_NAME_PARA_GRAPHIC_URL,
+/* 0006 */ UNO_NAME_PARA_GRAPHIC_FILTER,
+/* 0007 */ UNO_NAME_HEADER_GRAPHIC_URL,
+/* 0008 */ UNO_NAME_HEADER_GRAPHIC_FILTER,
+/* 0009 */ UNO_NAME_FOOTER_GRAPHIC_URL,
+/* 0010 */ UNO_NAME_FOOTER_GRAPHIC_FILTER,
+/* 0011 */ UNO_NAME_BACK_GRAPHIC_URL,
+/* 0012 */ UNO_NAME_BACK_GRAPHIC_FILTER,
+/* 0013 */ UNO_NAME_BACK_GRAPHIC_LOCATION,
+/* 0014 */ UNO_NAME_BACK_GRAPHIC_BITMAP,
+/* 0015 */ UNO_NAME_GRAPHIC_URL,
+/* 0016 */ UNO_NAME_GRAPHIC_FILTER,
+/* 0017 */ UNO_NAME_GRAPHIC_LOCATION,
+/* 0018 */ UNO_NAME_GRAPHIC_SIZE,
+/* 0019 */ UNO_NAME_GRAPHIC_BITMAP,
+/* 0020 */ UNO_NAME_BULLET_FONT,
+/* 0021 */ UNO_NAME_PARA_GRAPHIC_LOCATION,
+/* 0022 */ UNO_NAME_HEADER_GRAPHIC_LOCATION,
+/* 0023 */ UNO_NAME_FOOTER_GRAPHIC_LOCATION,
+/* 0024 */ UNO_NAME_PARA_LEFT_PARA_MARGIN,
+/* 0025 */ UNO_NAME_PARA_RIGHT_PARA_MARGIN,
+/* 0026 */ UNO_NAME_PARA_LEFT_MARGIN,
+/* 0027 */ UNO_NAME_PARA_RIGHT_MARGIN,
+/* 0028 */ UNO_NAME_PARA_LEFT_MARGIN_RELATIVE,
+/* 0029 */ UNO_NAME_PARA_RIGHT_MARGIN_RELATIVE,
+/* 0030 */ UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT,
+/* 0031 */ UNO_NAME_PARA_FIRST_LINE_INDENT,
+/* 0032 */ UNO_NAME_PARA_FIRST_LINE_INDENT_RELATIVE,
+/* 0033 */ UNO_NAME_PARA_IS_HYPHENATION,
+/* 0034 */ UNO_NAME_PARA_HYPHENATION_MAX_LEADING_CHARS,
+/* 0035 */ UNO_NAME_PARA_HYPHENATION_MAX_TRAILING_CHARS,
+/* 0036 */ UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS,
+/* 0037 */ UNO_NAME_LEFT_MARGIN,
+/* 0038 */ UNO_NAME_RIGHT_MARGIN,
+/* 0039 */ UNO_NAME_HEADER_LEFT_MARGIN,
+/* 0040 */ UNO_NAME_HEADER_RIGHT_MARGIN,
+/* 0041 */ UNO_NAME_FOOTER_LEFT_MARGIN,
+/* 0042 */ UNO_NAME_FOOTER_RIGHT_MARGIN,
+/* 0043 */ UNO_NAME_TEXT_RANGE,
+/* 0044 */ UNO_NAME_NAME,
+/* 0045 */ UNO_NAME_NUMBERING_ALIGNMENT,
+/* 0046 */ UNO_NAME_BULLET_FONT_NAME,
+/* 0047 */ UNO_NAME_BULLET_ID,
+/* 0048 */ UNO_NAME_CHAR_STYLE_NAME,
+/* 0049 */ UNO_NAME_ANCHOR_CHAR_STYLE_NAME,
+/* 0050 */ UNO_NAME_SUFFIX,
+/* 0051 */ UNO_NAME_PREFIX,
+/* 0052 */ UNO_NAME_PARENT_NUMBERING,
+/* 0053 */ UNO_NAME_START_WITH,
+/* 0054 */ UNO_NAME_CHAR_FONT_NAME,
+/* 0055 */ UNO_NAME_CHAR_FONT_STYLE_NAME,
+/* 0056 */ UNO_NAME_CHAR_FONT_FAMILY,
+/* 0057 */ UNO_NAME_CHAR_FONT_CHAR_SET,
+/* 0058 */ UNO_NAME_CHAR_FONT_PITCH,
+/* 0059 */ UNO_NAME_CHAR_POSTURE,
+/* 0060 */ UNO_NAME_CHAR_WEIGHT,
+/* 0061 */ UNO_NAME_CHAR_HEIGHT,
+/* 0062 */ UNO_NAME_CHAR_LOCALE,
+/* 0063 */ UNO_NAME_CHAR_FONT_NAME_ASIAN,
+/* 0064 */ UNO_NAME_CHAR_FONT_STYLE_NAME_ASIAN,
+/* 0065 */ UNO_NAME_CHAR_FONT_FAMILY_ASIAN,
+/* 0066 */ UNO_NAME_CHAR_FONT_CHAR_SET_ASIAN,
+/* 0067 */ UNO_NAME_CHAR_FONT_PITCH_ASIAN,
+/* 0068 */ UNO_NAME_CHAR_POSTURE_ASIAN,
+/* 0069 */ UNO_NAME_CHAR_WEIGHT_ASIAN,
+/* 0070 */ UNO_NAME_CHAR_HEIGHT_ASIAN,
+/* 0071 */ UNO_NAME_CHAR_LOCALE_ASIAN,
+/* 0072 */ UNO_NAME_CHAR_FONT_NAME_COMPLEX,
+/* 0073 */ UNO_NAME_CHAR_FONT_STYLE_NAME_COMPLEX,
+/* 0074 */ UNO_NAME_CHAR_FONT_FAMILY_COMPLEX,
+/* 0075 */ UNO_NAME_CHAR_FONT_CHAR_SET_COMPLEX,
+/* 0076 */ UNO_NAME_CHAR_FONT_PITCH_COMPLEX,
+/* 0077 */ UNO_NAME_CHAR_POSTURE_COMPLEX,
+/* 0078 */ UNO_NAME_CHAR_WEIGHT_COMPLEX,
+/* 0079 */ UNO_NAME_CHAR_HEIGHT_COMPLEX,
+/* 0080 */ UNO_NAME_CHAR_LOCALE_COMPLEX,
+/* 0081 */ UNO_NAME_CHAR_AUTO_KERNING,
+/* 0082 */ UNO_NAME_CHAR_UNDERLINE,
+/* 0083 */ UNO_NAME_CHAR_UNDERLINE_COLOR,
+/* 0084 */ UNO_NAME_CHAR_UNDERLINE_HAS_COLOR,
+/* 0085 */ UNO_NAME_CHAR_ESCAPEMENT,
+/* 0086 */ UNO_NAME_CHAR_CASE_MAP,
+/* 0087 */ UNO_NAME_CHAR_SHADOWED,
+/* 0088 */ UNO_NAME_CHAR_STRIKEOUT,
+/* 0089 */ UNO_NAME_CHAR_CROSSED_OUT,
+/* 0090 */ UNO_NAME_CHAR_NO_HYPHENATION,
+/* 0091 */ UNO_NAME_CHAR_AUTO_ESCAPEMENT,
+/* 0092 */ UNO_NAME_CHAR_PROP_HEIGHT,
+/* 0093 */ UNO_NAME_CHAR_DIFF_HEIGHT,
+/* 0094 */ UNO_NAME_CHAR_PROP_HEIGHT_ASIAN,
+/* 0095 */ UNO_NAME_CHAR_DIFF_HEIGHT_ASIAN,
+/* 0096 */ UNO_NAME_CHAR_PROP_HEIGHT_COMPLEX,
+/* 0097 */ UNO_NAME_CHAR_DIFF_HEIGHT_COMPLEX,
+/* 0098 */ UNO_NAME_CHAR_ESCAPEMENT_HEIGHT,
+/* 0099 */ UNO_NAME_CHAR_COLOR,
+
+/* 0100 */ UNO_NAME_CHAR_FLASH,
+/* 0101 */ UNO_NAME_CHAR_KERNING,
+/* 0102 */ UNO_NAME_CHAR_BACK_COLOR,
+/* 0103 */ UNO_NAME_CHAR_BACK_TRANSPARENT,
+/* 0104 */ UNO_NAME_CHAR_COMBINE_IS_ON,
+/* 0105 */ UNO_NAME_CHAR_COMBINE_PREFIX,
+/* 0106 */ UNO_NAME_CHAR_COMBINE_SUFFIX,
+/* 0107 */ UNO_NAME_CHAR_EMPHASIS,
+/* 0108 */ UNO_NAME_PARA_LINE_SPACING,
+/* 0109 */ UNO_NAME_PARA_TOP_MARGIN,
+/* 0110 */ UNO_NAME_PARA_BOTTOM_MARGIN,
+/* 0111 */ UNO_NAME_PARA_TOP_MARGIN_RELATIVE,
+/* 0112 */ UNO_NAME_PARA_BOTTOM_MARGIN_RELATIVE,
+/* 0113 */ UNO_NAME_PARA_EXPAND_SINGLE_WORD,
+/* 0114 */ UNO_NAME_END_NOTICE,
+/* 0115 */ UNO_NAME_EMBEDDED_OBJECTS,
+/* 0116 */ UNO_NAME_ALPHABETICAL_SEPARATORS,
+/* 0117 */ UNO_NAME_BACKGROUND_COLOR,
+/* 0118 */ UNO_NAME_BEGIN_NOTICE,
+/* 0119 */ UNO_NAME_CASE_SENSITIVE,
+/* 0120 */ UNO_NAME_FRAME_STYLE_NAME,
+/* 0121 */ UNO_NAME_NUMBERING_STYLE_NAME,
+/* 0122 */ UNO_NAME_NUMBERING_LEVEL,
+/* 0123 */ UNO_NAME_NUMBERING_START_VALUE,
+/* 0124 */ UNO_NAME_NUMBERING_IS_NUMBER,
+/* 0125 */ UNO_NAME_COMBINE_ENTRIES,
+/* 0126 */ UNO_NAME_COUNT_LINES_IN_FRAMES,
+/* 0127 */ UNO_NAME_DDE_COMMAND_TYPE,
+/* 0128 */ UNO_NAME_DDE_COMMAND_FILE,
+/* 0129 */ UNO_NAME_DDE_COMMAND_ELEMENT,
+/* 0130 */ UNO_NAME_IS_AUTOMATIC_UPDATE,
+/* 0131 */ UNO_NAME_DEFAULT_TABSTOP_DISTANCE,
+/* 0132 */ UNO_NAME_DISTANCE,
+/* 0133 */ UNO_NAME_DROP_CAP_FORMAT,
+/* 0134 */ UNO_NAME_DROP_CAP_WHOLE_WORD,
+/* 0135 */ UNO_NAME_DROP_CAP_CHAR_STYLE_NAME,
+/* 0136 */ UNO_NAME_FILE_LINK,
+/* 0137 */ UNO_NAME_GRAPHIC,
+/* 0138 */ UNO_NAME_GRAPHICS,
+/* 0139 */ UNO_NAME_IS_PROTECTED,
+/* 0140 */ UNO_NAME_KEY_AS_ENTRY,
+/* 0141 */ UNO_NAME_PARA_KEEP_TOGETHER,
+/* 0142 */ UNO_NAME_KEEP_TOGETHER,
+/* 0143 */ UNO_NAME_IS_LANDSCAPE,
+/* 0144 */ UNO_NAME_SEPARATOR_TEXT,
+/* 0145 */ UNO_NAME_MARKS,
+/* 0146 */ UNO_NAME_NUMBER_POSITION,
+/* 0147 */ UNO_NAME_OUTLINES,
+/* 0148 */ UNO_NAME_PAGE_STYLE_NAME,
+/* 0149 */ UNO_NAME_PAGE_STYLE_LAYOUT,
+/* 0150 */ UNO_NAME_PARA_STYLES,
+/* 0151 */ UNO_NAME_PARA_ADJUST,
+/* 0152 */ UNO_NAME_PARA_REGISTER_MODE_ACTIVE,
+/* 0153 */ UNO_NAME_PARA_STYLE_NAME,
+/* 0154 */ UNO_NAME_PARA_LAST_LINE_ADJUST,
+/* 0155 */ UNO_NAME_PARA_LINE_NUMBER_COUNT,
+/* 0156 */ UNO_NAME_PARA_LINE_NUMBER_START_VALUE,
+/* 0157 */ UNO_NAME_BACK_COLOR,
+/* 0158 */ UNO_NAME_PARA_BACK_COLOR,
+/* 0159 */ UNO_NAME_PARA_WIDOWS,
+/* 0160 */ UNO_NAME_PARA_ORPHANS,
+/* 0161 */ UNO_NAME_PARA_BACK_TRANSPARENT,
+/* 0162 */ UNO_NAME_POSITION_END_OF_DOC,
+/* 0163 */ UNO_NAME_POSITION_PROTECTED,
+/* 0164 */ UNO_NAME_ALTERNATIVE_TEXT,
+/* 0165 */ UNO_NAME_PRIMARY_KEY,
+/* 0166 */ UNO_NAME_PRINT_TABLES,
+/* 0167 */ UNO_NAME_PRINT_GRAPHICS,
+/* 0168 */ UNO_NAME_PRINT_REVERSED,
+/* 0169 */ UNO_NAME_PRINT_PROSPECT,
+/* 0170 */ UNO_NAME_PRINT_CONTROLS,
+/* 0171 */ UNO_NAME_PRINT_DRAWINGS,
+/* 0172 */ UNO_NAME_PRINT_RIGHT_PAGES,
+/* 0173 */ UNO_NAME_PRINT_LEFT_PAGES,
+/* 0174 */ UNO_NAME_PRINT_BLACK_FONTS,
+/* 0175 */ UNO_NAME_PRINTER_PAPER_TRAY,
+/* 0176 */ UNO_NAME_PRINT_PAGE_BACKGROUND,
+/* 0177 */ UNO_NAME_PRINT_ANNOTATION_MODE,
+/* 0178 */ UNO_NAME_PRINT_FAX_NAME,
+/* 0179 */ UNO_NAME_PRINT_PAPER_FROM_SETUP,
+/* 0180 */ UNO_NAME_REGISTER_MODE_ACTIVE,
+/* 0181 */ UNO_NAME_RELATIVE_WIDTH,
+/* 0182 */ UNO_NAME_RELATIVE_HEIGHT,
+/* 0183 */ UNO_NAME_REPEAT_HEADLINE,
+/* 0184 */ UNO_NAME_SEARCH_STYLES,
+/* 0185 */ UNO_NAME_SEARCH_BACKWARDS,
+/* 0186 */ UNO_NAME_SEARCH_SIMILARITY,
+/* 0187 */ UNO_NAME_SEARCH_IN_SELECTION,
+/* 0188 */ UNO_NAME_SEARCH_CASE_SENSITIVE,
+/* 0189 */ UNO_NAME_SEARCH_SIMILARITY_ADD,
+/* 0190 */ UNO_NAME_SEARCH_SIMILARITY_RELAX,
+/* 0191 */ UNO_NAME_SEARCH_SIMILARITY_REMOVE,
+/* 0192 */ UNO_NAME_SEARCH_REGULAR_EXPRESSION,
+/* 0193 */ UNO_NAME_SEARCH_SIMILARITY_EXCHANGE,
+/* 0194 */ UNO_NAME_SECONDARY_KEY,
+/* 0195 */ UNO_NAME_SEPARATOR_INTERVAL,
+/* 0196 */ UNO_NAME_SHOW_BREAKS,
+/* 0197 */ UNO_NAME_SHOW_SPACES,
+/* 0198 */ UNO_NAME_SHOW_TABLES,
+/* 0199 */ UNO_NAME_SHOW_GRAPHICS,
+
+/* 0200 */ UNO_NAME_SHOW_DRAWINGS,
+/* 0201 */ UNO_NAME_SHOW_TABSTOPS,
+/* 0202 */ UNO_NAME_SHOW_VERT_RULER,
+/* 0203 */ UNO_NAME_SHOW_PARA_BREAKS,
+/* 0204 */ UNO_NAME_SHOW_HIDDEN_TEXT,
+/* 0205 */ UNO_NAME_SHOW_ANNOTATIONS,
+/* 0206 */ UNO_NAME_SHOW_SOFT_HYPHENS,
+/* 0207 */ UNO_NAME_SHOW_VERT_SCROLL_BAR,
+/* 0208 */ UNO_NAME_SHOW_HORI_SCROLL_BAR,
+/* 0209 */ UNO_NAME_SHOW_FIELD_COMMANDS,
+/* 0210 */ UNO_NAME_SHOW_TEXT_BOUNDARIES,
+/* 0211 */ UNO_NAME_SHOW_PROTECTED_SPACES,
+/* 0212 */ UNO_NAME_SHOW_TABLE_BOUNDARIES,
+/* 0213 */ UNO_NAME_SHOW_HIDDEN_PARAGRAPHS,
+/* 0214 */ UNO_NAME_SHOW_INDEX_MARK_BACKGROUND,
+/* 0215 */ UNO_NAME_SHOW_FOOTNOTE_BACKGROUND,
+/* 0216 */ UNO_NAME_SHOW_TEXT_FIELD_BACKGROUND,
+/* 0217 */ UNO_NAME_IS_SYNC_WIDTH_TO_HEIGHT,
+/* 0218 */ UNO_NAME_IS_SYNC_HEIGHT_TO_WIDTH,
+/* 0219 */ UNO_NAME_SIZE_PROTECTED,
+/* 0220 */ UNO_NAME_SMOOTH_SCROLLING,
+/* 0221 */ UNO_NAME_SOLID_MARK_HANDLES,
+/* 0222 */ UNO_NAME_TABLES,
+/* 0223 */ UNO_NAME_TEXT_FRAMES,
+/* 0224 */ UNO_NAME_TEXT_COLUMNS,
+/* 0225 */ UNO_NAME_BACK_TRANSPARENT,
+/* 0226 */ UNO_NAME_USE_PP,
+/* 0227 */ UNO_NAME_USER_METRIC,
+/* 0228 */ UNO_NAME_ANCHOR_TYPE,
+/* 0229 */ UNO_NAME_ANCHOR_TYPES,
+/* 0230 */ UNO_NAME_ANCHOR_PAGE_NO,
+/* 0231 */ UNO_NAME_ANCHOR_FRAME,
+/* 0232 */ UNO_NAME_AUTHOR,
+/* 0233 */ UNO_NAME_BREAK_TYPE,
+/* 0234 */ UNO_NAME_CHAIN_NEXT_NAME,
+/* 0235 */ UNO_NAME_CHAIN_PREV_NAME,
+/* 0236 */ UNO_NAME_CHAPTER_FORMAT,
+/* 0237 */ UNO_NAME_CLIENT_MAP,
+/* 0238 */ UNO_NAME_CONDITION,
+/* 0239 */ UNO_NAME_CONTENT,
+/* 0240 */ UNO_NAME_CHAR_CONTOURED,
+/* 0241 */ UNO_NAME_CONTOUR_OUTSIDE,
+/* 0242 */ UNO_NAME_CONTENT_PROTECTED,
+/* 0243 */ UNO_NAME_COUNT_EMPTY_LINES,
+/* 0244 */ UNO_NAME_RESTART_AT_EACH_PAGE,
+/* 0245 */ UNO_NAME_DATA_BASE_NAME,
+/* 0246 */ UNO_NAME_DATA_TABLE_NAME,
+/* 0247 */ UNO_NAME_DATA_COMMAND_TYPE,
+/* 0248 */ UNO_NAME_DATA_COLUMN_NAME,
+/* 0249 */ UNO_NAME_IS_DATA_BASE_FORMAT,
+/* 0250 */ UNO_NAME_DATE,
+/* 0251 */ UNO_NAME_IS_DATE,
+/* 0252 */ UNO_NAME_EDIT_IN_READONLY,
+/* 0253 */ UNO_NAME_FALSE_CONTENT,
+/* 0254 */ UNO_NAME_FILE_FORMAT,
+/* 0255 */ UNO_NAME_IS_FIXED,
+/* 0256 */ UNO_NAME_FOOTNOTE_COUNTING,
+/* 0257 */ UNO_NAME_FORMULA,
+/* 0258 */ UNO_NAME_FRAME_NAME,
+/* 0259 */ UNO_NAME_GRAPHIC_NAME,
+/* 0260 */ UNO_NAME_FULL_NAME,
+/* 0261 */ UNO_NAME_HEIGHT,
+/* 0262 */ UNO_NAME_IS_AUTO_HEIGHT,
+/* 0263 */ UNO_NAME_SIZE_TYPE,
+/* 0264 */ UNO_NAME_HINT,
+/* 0265 */ UNO_NAME_HORI_ORIENT,
+/* 0266 */ UNO_NAME_HORI_MIRRORED_ON_EVEN_PAGES,
+/* 0267 */ UNO_NAME_HORI_MIRRORED_ON_ODD_PAGES,
+/* 0268 */ UNO_NAME_HORI_ORIENT_RELATION,
+/* 0269 */ UNO_NAME_HORI_ORIENT_POSITION,
+/* 0270 */ UNO_NAME_HYPER_LINK_U_R_L,
+/* 0271 */ UNO_NAME_HYPER_LINK_TARGET,
+/* 0272 */ UNO_NAME_HYPER_LINK_NAME,
+/* 0273 */ UNO_NAME_HYPER_LINK_EVENTS,
+/* 0274 */ UNO_NAME_INFO_TYPE,
+/* 0275 */ UNO_NAME_INFO_FORMAT,
+/* 0276 */ UNO_NAME_IS_INPUT,
+/* 0277 */ UNO_NAME_LEVEL,
+/* 0278 */ UNO_NAME_INTERVAL,
+/* 0279 */ UNO_NAME_LINK_REGION,
+/* 0280 */ UNO_NAME_MACRO_NAME,
+/* 0281 */ UNO_NAME_SPLIT,
+/* 0282 */ UNO_NAME_PARA_SPLIT,
+/* 0283 */ UNO_NAME_NUMBER_FORMAT,
+/* 0284 */ UNO_NAME_NUMBERING_TYPE,
+/* 0285 */ UNO_NAME_NUMBERING_RULES,
+/* 0286 */ UNO_NAME_OFFSET,
+/* 0287 */ UNO_NAME_ON,
+/* 0288 */ UNO_NAME_OPAQUE,
+/* 0289 */ UNO_NAME_PAGE_TOGGLE,
+/* 0290 */ UNO_NAME_PAGE_DESC_NAME,
+/* 0291 */ UNO_NAME_PAGE_NUMBER_OFFSET,
+/* 0292 */ UNO_NAME_PLACEHOLDER,
+/* 0293 */ UNO_NAME_PLACEHOLDER_TYPE,
+/* 0294 */ UNO_NAME_PRINT,
+/* 0295 */ UNO_NAME_REFERENCE_FIELD_PART,
+/* 0296 */ UNO_NAME_REFERENCE_FIELD_SOURCE,
+/* 0297 */ UNO_NAME_REGISTER_PARAGRAPH_STYLE,
+/* 0298 */ UNO_NAME_SCRIPT_TYPE,
+/* 0299 */ UNO_NAME_SEARCH_ALL,
+
+/* 0300 */ UNO_NAME_SEARCH_WORDS,
+/* 0301 */ UNO_NAME_SEQUENCE_VALUE,
+/* 0302 */ UNO_NAME_SERVER_MAP,
+/* 0303 */ UNO_NAME_IMAGE_MAP,
+/* 0304 */ UNO_NAME_SET_NUMBER,
+/* 0305 */ UNO_NAME_SHADOW_FORMAT,
+/* 0306 */ UNO_NAME_SHOW_HORI_RULER,
+/* 0307 */ UNO_NAME_SIZE,
+/* 0308 */ UNO_NAME_ACTUAL_SIZE,
+/* 0309 */ UNO_NAME_SOURCE_NAME,
+/* 0310 */ UNO_NAME_START_AT,
+/* 0311 */ UNO_NAME_STATISTIC_TYPE_ID,
+/* 0312 */ UNO_NAME_SUB_TYPE,
+/* 0313 */ UNO_NAME_SURROUND,
+/* 0314 */ UNO_NAME_IS_EXPRESSION,
+/* 0315 */ UNO_NAME_IS_SHOW_FORMULA,
+/* 0316 */ UNO_NAME_TEXT_WRAP,
+/* 0317 */ UNO_NAME_SURROUND_CONTOUR,
+/* 0318 */ UNO_NAME_SURROUND_ANCHORONLY,
+/* 0319 */ UNO_NAME_TABLE_NAME,
+/* 0320 */ UNO_NAME_TABSTOPS,
+/* 0321 */ UNO_NAME_TITLE,
+/* 0322 */ UNO_NAME_TOP_MARGIN,
+/* 0323 */ UNO_NAME_BOTTOM_MARGIN,
+/* 0324 */ UNO_NAME_TRUE_CONTENT,
+/* 0325 */ UNO_NAME_URL_CONTENT,
+/* 0326 */ UNO_NAME_USERTEXT,
+/* 0327 */ UNO_NAME_USER_DATA_TYPE,
+/* 0328 */ UNO_NAME_VALUE,
+/* 0329 */ UNO_NAME_VARIABLE_NAME,
+/* 0330 */ UNO_NAME_VARIABLE_SUBTYPE,
+/* 0331 */ UNO_NAME_VERT_ORIENT,
+/* 0332 */ UNO_NAME_VERT_MIRRORED,
+/* 0333 */ UNO_NAME_VERT_ORIENT_POSITION,
+/* 0334 */ UNO_NAME_VERT_ORIENT_RELATION,
+/* 0335 */ UNO_NAME_IS_VISIBLE,
+/* 0336 */ UNO_NAME_WIDTH,
+/* 0337 */ UNO_NAME_CHAR_WORD_MODE,
+/* 0338 */ UNO_NAME_GRAPHIC_CROP,
+/* 0339 */ UNO_NAME_CHARACTER_FORMAT_NONE,
+/* 0340 */ UNO_NAME_TEXT_POSITION,
+/* 0341 */ UNO_NAME_DOCUMENT_INDEX_MARK,
+/* 0342 */ UNO_NAME_DOCUMENT_INDEX,
+/* 0343 */ UNO_NAME_IS_GLOBAL_DOCUMENT_SECTION,
+/* 0344 */ UNO_NAME_TEXT_FIELD,
+/* 0345 */ UNO_NAME_BOOKMARK,
+/* 0346 */ UNO_NAME_TEXT_TABLE,
+/* 0347 */ UNO_NAME_CELL,
+/* 0348 */ UNO_NAME_TEXT_FRAME,
+/* 0349 */ UNO_NAME_REFERENCE_MARK,
+/* 0350 */ UNO_NAME_TEXT_SECTION,
+/* 0351 */ UNO_NAME_FOOTNOTE,
+/* 0352 */ UNO_NAME_ENDNOTE,
+/* 0353 */ UNO_NAME_CHART_ROW_AS_LABEL,
+/* 0354 */ UNO_NAME_CHART_COLUMN_AS_LABEL,
+/* 0355 */ UNO_NAME_TABLE_COLUMS,
+/* 0356 */ UNO_NAME_LEFT_BORDER,
+/* 0357 */ UNO_NAME_RIGHT_BORDER,
+/* 0358 */ UNO_NAME_TOP_BORDER,
+/* 0359 */ UNO_NAME_BOTTOM_BORDER,
+/* 0360 */ UNO_NAME_BORDER_DISTANCE,
+/* 0361 */ UNO_NAME_LEFT_BORDER_DISTANCE,
+/* 0362 */ UNO_NAME_RIGHT_BORDER_DISTANCE,
+/* 0363 */ UNO_NAME_TOP_BORDER_DISTANCE,
+/* 0364 */ UNO_NAME_BOTTOM_BORDER_DISTANCE,
+/* 0365 */ UNO_NAME_TABLE_BORDER,
+/* 0366 */ UNO_NAME_TABLE_COLUMN_SEPARATORS,
+/* 0367 */ UNO_NAME_TABLE_COLUMN_RELATIVE_SUM,
+/* 0368 */ UNO_NAME_HEADER_TEXT,
+/* 0369 */ UNO_NAME_HEADER_TEXT_LEFT,
+/* 0370 */ UNO_NAME_HEADER_TEXT_RIGHT,
+/* 0371 */ UNO_NAME_FOOTER_TEXT,
+/* 0372 */ UNO_NAME_FOOTER_TEXT_LEFT,
+/* 0373 */ UNO_NAME_FOOTER_TEXT_RIGHT,
+/* 0374 */ UNO_NAME_HEADER_BACK_COLOR,
+/* 0375 */ UNO_NAME_HEADER_GRAPHIC,
+/* 0376 */ UNO_NAME_HEADER_BACK_TRANSPARENT,
+/* 0377 */ UNO_NAME_HEADER_LEFT_BORDER,
+/* 0378 */ UNO_NAME_HEADER_RIGHT_BORDER,
+/* 0379 */ UNO_NAME_HEADER_TOP_BORDER,
+/* 0380 */ UNO_NAME_HEADER_BOTTOM_BORDER,
+/* 0381 */ UNO_NAME_HEADER_BORDER_DISTANCE,
+/* 0382 */ UNO_NAME_HEADER_SHADOW_FORMAT,
+/* 0383 */ UNO_NAME_HEADER_BODY_DISTANCE,
+/* 0384 */ UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT,
+/* 0385 */ UNO_NAME_HEADER_IS_SHARED,
+/* 0386 */ UNO_NAME_HEADER_HEIGHT,
+/* 0387 */ UNO_NAME_HEADER_IS_ON,
+/* 0388 */ UNO_NAME_FOOTER_BACK_COLOR,
+/* 0389 */ UNO_NAME_FOOTER_GRAPHIC,
+/* 0390 */ UNO_NAME_FOOTER_BACK_TRANSPARENT,
+/* 0391 */ UNO_NAME_FOOTER_LEFT_BORDER,
+/* 0392 */ UNO_NAME_FOOTER_RIGHT_BORDER,
+/* 0393 */ UNO_NAME_FOOTER_TOP_BORDER,
+/* 0394 */ UNO_NAME_FOOTER_BOTTOM_BORDER,
+/* 0395 */ UNO_NAME_FOOTER_BORDER_DISTANCE,
+/* 0396 */ UNO_NAME_FOOTER_SHADOW_FORMAT,
+/* 0397 */ UNO_NAME_FOOTER_BODY_DISTANCE,
+/* 0398 */ UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT,
+/* 0399 */ UNO_NAME_FOOTER_IS_SHARED,
+
+/* 0400 */ UNO_NAME_FOOTER_HEIGHT,
+/* 0401 */ UNO_NAME_FOOTER_IS_ON,
+/* 0402 */ UNO_NAME_OVERWRITE_STYLES,
+/* 0403 */ UNO_NAME_LOAD_NUMBERING_STYLES,
+/* 0404 */ UNO_NAME_LOAD_PAGE_STYLES,
+/* 0405 */ UNO_NAME_LOAD_FRAME_STYLES,
+/* 0406 */ UNO_NAME_LOAD_TEXT_STYLES,
+/* 0407 */ UNO_NAME_FILE_NAME,
+/* 0408 */ UNO_NAME_FILTER_NAME,
+/* 0409 */ UNO_NAME_FILTER_OPTION,
+/* 0410 */ UNO_NAME_PASSWORD,
+/* 0411 */ UNO_NAME_COPY_COUNT,
+/* 0412 */ UNO_NAME_COLLATE,
+/* 0413 */ UNO_NAME_SORT,
+/* 0414 */ UNO_NAME_PAGES,
+/* 0415 */ UNO_NAME_FIRST_LINE_OFFSET,
+/* 0416 */ UNO_NAME_SYMBOL_TEXT_DISTANCE,
+/* 0417 */ UNO_NAME_USER_INDEX_NAME,
+/* 0418 */ UNO_NAME_REVISION,
+/* 0419 */ UNO_NAME_UNVISITED_CHAR_STYLE_NAME,
+/* 0420 */ UNO_NAME_VISITED_CHAR_STYLE_NAME,
+/* 0421 */ UNO_NAME_PARAGRAPH_COUNT,
+/* 0422 */ UNO_NAME_WORD_COUNT,
+/* 0423 */ UNO_NAME_WORD_SEPARATOR,
+/* 0424 */ UNO_NAME_CHARACTER_COUNT,
+/* 0425 */ UNO_NAME_ZOOM_VALUE,
+/* 0426 */ UNO_NAME_ZOOM_TYPE,
+/* 0427 */ UNO_NAME_CREATE_FROM_MARKS,
+/* 0428 */ UNO_NAME_CREATE_FROM_OUTLINE,
+/* 0429 */ UNO_NAME_PARAGRAPH_STYLE_NAMES,
+/* 0430 */ UNO_NAME_CREATE_FROM_CHAPTER,
+/* 0431 */ UNO_NAME_CREATE_FROM_LABELS,
+/* 0432 */ UNO_NAME_USE_ALPHABETICAL_SEPARATORS,
+/* 0433 */ UNO_NAME_USE_KEY_AS_ENTRY,
+/* 0434 */ UNO_NAME_USE_COMBINED_ENTRIES,
+/* 0435 */ UNO_NAME_IS_CASE_SENSITIVE,
+/* 0436 */ UNO_NAME_USE_P_P,
+/* 0437 */ UNO_NAME_USE_DASH,
+/* 0438 */ UNO_NAME_USE_UPPER_CASE,
+/* 0439 */ UNO_NAME_LABEL_CATEGORY,
+/* 0440 */ UNO_NAME_LABEL_DISPLAY_TYPE,
+/* 0441 */ UNO_NAME_USE_LEVEL_FROM_SOURCE,
+/* 0442 */ UNO_NAME_LEVEL_FORMAT,
+/* 0443 */ UNO_NAME_LEVEL_PARAGRAPH_STYLES,
+/* 0444 */ UNO_NAME_RECALC_TAB_STOPS,
+/* 0445 */ UNO_NAME_MAIN_ENTRY_CHARACTER_STYLE_NAME,
+/* 0446 */ UNO_NAME_CREATE_FROM_TABLES,
+/* 0447 */ UNO_NAME_CREATE_FROM_TEXT_FRAMES,
+/* 0448 */ UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS,
+/* 0449 */ UNO_NAME_CREATE_FROM_EMBEDDED_OBJECTS,
+/* 0450 */ UNO_NAME_CREATE_FROM_STAR_MATH,
+/* 0451 */ UNO_NAME_CREATE_FROM_STAR_CHART,
+/* 0452 */ UNO_NAME_CREATE_FROM_STAR_CALC,
+/* 0453 */ UNO_NAME_CREATE_FROM_STAR_DRAW,
+/* 0454 */ UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS,
+/* 0455 */ UNO_NAME_INDEX_AUTO_MARK_FILE_U_R_L,
+/* 0456 */ UNO_NAME_IS_COMMA_SEPARATED,
+/* 0457 */ UNO_NAME_IS_RELATIVE_TABSTOPS,
+/* 0458 */ UNO_NAME_CREATE_FROM_LEVEL_PARAGRAPH_STYLES,
+/* 0459 */ UNO_NAME_SHOW_CHANGES,
+/* 0460 */ UNO_NAME_RECORD_CHANGES,
+/* 0461 */ UNO_LINK_DISPLAY_NAME,
+/* 0462 */ UNO_LINK_DISPLAY_BITMAP,
+/* 0463 */ UNO_NAME_HEADING_STYLE_NAME,
+/* 0464 */ UNO_NAME_SHOW_ONLINE_LAYOUT,
+/* 0465 */ UNO_NAME_USER_DEFINED_ATTRIBUTES,
+/* 0466 */ UNO_NAME_TEXT_USER_DEFINED_ATTRIBUTES,
+/* 0467 */ UNO_NAME_FILE_PATH,
+/* 0468 */ UNO_NAME_PARA_CHAPTER_NUMBERING_LEVEL,
+/* 0469 */ UNO_NAME_PARA_CONDITIONAL_STYLE_NAME,
+/* 0470 */ UNO_NAME_CHAPTER_NUMBERING_LEVEL,
+/* 0471 */ UNO_NAME_NUMBERING_SEPARATOR,
+/* 0472 */ UNO_NAME_IS_CONTINUOUS_NUMBERING,
+/* 0473 */ UNO_NAME_IS_AUTOMATIC,
+/* 0474 */ UNO_NAME_IS_ABSOLUTE_MARGINS,
+/* 0475 */ UNO_NAME_CATEGORY,
+/* 0476 */ UNO_NAME_DEPENDENT_TEXT_FIELDS,
+/* 0477 */ UNO_NAME_CURRENT_PRESENTATION,
+/* 0478 */ UNO_NAME_ADJUST,
+/* 0479 */ UNO_NAME_INSTANCE_NAME,
+/* 0480 */ UNO_NAME_TEXT_PORTION_TYPE,
+/* 0481 */ UNO_NAME_CONTROL_CHARACTER,
+/* 0482 */ UNO_NAME_IS_COLLAPSED,
+/* 0483 */ UNO_NAME_IS_START,
+/* 0484 */ UNO_NAME_SEQUENCE_NUMBER,
+/* 0485 */ UNO_NAME_REFERENCE_ID,
+/* 0486 */ UNO_NAME_HEADER_LEFT_BORDER_DISTANCE,
+/* 0487 */ UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE,
+/* 0488 */ UNO_NAME_HEADER_TOP_BORDER_DISTANCE,
+/* 0489 */ UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE,
+/* 0490 */ UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE,
+/* 0491 */ UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE,
+/* 0492 */ UNO_NAME_FOOTER_TOP_BORDER_DISTANCE,
+/* 0493 */ UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE,
+/* 0494 */ UNO_NAME_PARA_IS_NUMBERING_RESTART,
+/* 0495 */ UNO_NAME_HIDE_FIELD_TIPS,
+/* 0496 */ UNO_NAME_HEADER_USER_DEFINED_ATTRIBUTES,
+/* 0497 */ UNO_NAME_FOOTER_USER_DEFINED_ATTRIBUTES,
+/* 0498 */ UNO_NAME_PARA_SHADOW_FORMAT,
+/* 0499 */ UNO_NAME_CONTOUR_POLY_POLYGON,
+
+/* 0500 */ UNO_NAME_IS_PIXEL_CONTOUR,
+/* 0501 */ UNO_NAME_IS_AUTOMATIC_CONTOUR,
+/* 0502 */ UNO_NAME_SEPARATOR_LINE_WIDTH,
+/* 0503 */ UNO_NAME_SEPARATOR_LINE_COLOR,
+/* 0504 */ UNO_NAME_SEPARATOR_LINE_RELATIVE_HEIGHT,
+/* 0505 */ UNO_NAME_SEPARATOR_LINE_VERTIVAL_ALIGNMENT,
+/* 0506 */ UNO_NAME_SEPARATOR_LINE_IS_ON,
+/* 0507 */ UNO_NAME_IS_SKIP_HIDDEN_TEXT,
+/* 0508 */ UNO_NAME_IS_SKIP_PROTECTED_TEXT,
+/* 0509 */ UNO_NAME_DOCUMENT_INDEX_MARKS,
+/* 0510 */ UNO_NAME_FOOTNOTE_IS_COLLECT_AT_TEXT_END,
+/* 0511 */ UNO_NAME_FOOTNOTE_IS_RESTART_NUMBERING,
+/* 0512 */ UNO_NAME_FOOTNOTE_RESTART_NUMBERING_AT,
+/* 0513 */ UNO_NAME_FOOTNOTE_IS_OWN_NUMBERING,
+/* 0514 */ UNO_NAME_FOOTNOTE_NUMBERING_TYPE,
+/* 0515 */ UNO_NAME_FOOTNOTE_NUMBERING_PREFIX,
+/* 0516 */ UNO_NAME_FOOTNOTE_NUMBERING_SUFFIX,
+/* 0517 */ UNO_NAME_ENDNOTE_IS_COLLECT_AT_TEXT_END,
+/* 0518 */ UNO_NAME_ENDNOTE_IS_RESTART_NUMBERING,
+/* 0519 */ UNO_NAME_ENDNOTE_RESTART_NUMBERING_AT,
+/* 0520 */ UNO_NAME_ENDNOTE_IS_OWN_NUMBERING,
+/* 0521 */ UNO_NAME_ENDNOTE_NUMBERING_TYPE,
+/* 0522 */ UNO_NAME_ENDNOTE_NUMBERING_PREFIX,
+/* 0523 */ UNO_NAME_ENDNOTE_NUMBERING_SUFFIX,
+/* 0524 */ UNO_NAME_BRACKET_BEFORE,
+/* 0525 */ UNO_NAME_BRACKET_AFTER,
+/* 0526 */ UNO_NAME_IS_NUMBER_ENTRIES,
+/* 0527 */ UNO_NAME_IS_SORT_BY_POSITION,
+/* 0528 */ UNO_NAME_SORT_KEYS,
+/* 0529 */ UNO_NAME_IS_SORT_ASCENDING,
+/* 0530 */ UNO_NAME_SORT_KEY,
+/* 0531 */ UNO_NAME_FIELDS,
+/* 0532 */ UNO_NAME_DATE_TIME_VALUE,
+/* 0533 */ UNO_NAME_IS_ON,
+/* 0534 */ UNO_NAME_Z_ORDER,
+/* 0535 */ UNO_NAME_CONTENT_SECTION,
+/* 0536 */ UNO_NAME_HEADER_SECTION,
+/* 0537 */ UNO_NAME_PARA_IS_HANGING_PUNCTUATION,
+/* 0538 */ UNO_NAME_PARA_IS_CHARACTER_DISTANCE,
+/* 0539 */ UNO_NAME_PARA_IS_FORBIDDEN_RULES,
+/* 0540 */ UNO_NAME_PARA_VERT_ALIGNMENT,
+/* 0541 */ UNO_NAME_IS_MAIN_ENTRY,
+/* 0542 */ UNO_NAME_GRAPHIC_ROTATION,
+/* 0543 */ UNO_NAME_ADJUST_LUMINANCE,
+/* 0544 */ UNO_NAME_ADJUST_CONTRAST,
+/* 0545 */ UNO_NAME_ADJUST_RED,
+/* 0546 */ UNO_NAME_ADJUST_GREEN,
+/* 0547 */ UNO_NAME_ADJUST_BLUE,
+/* 0548 */ UNO_NAME_GAMMA,
+/* 0549 */ UNO_NAME_GRAPHIC_IS_INVERTED,
+/* 0550 */ UNO_NAME_TRANSPARENCY,
+/* 0551 */ UNO_NAME_GRAPHIC_COLOR_MODE,
+/* 0552 */ UNO_NAME_REDLINE_AUTHOR,
+/* 0553 */ UNO_NAME_REDLINE_DATE_TIME,
+/* 0554 */ UNO_NAME_REDLINE_COMMENT,
+/* 0555 */ UNO_NAME_REDLINE_TYPE,
+/* 0556 */ UNO_NAME_REDLINE_SUCCESSOR_DATA,
+/* 0557 */ UNO_NAME_REDLINE_IDENTIFIER,
+/* 0558 */ UNO_NAME_IS_IN_HEADER_FOOTER,
+/* 0559 */ UNO_NAME_START_REDLINE,
+/* 0560 */ UNO_NAME_END_REDLINE,
+/* 0561 */ UNO_NAME_REDLINE_START,
+/* 0562 */ UNO_NAME_REDLINE_END,
+/* 0563 */ UNO_NAME_REDLINE_TEXT,
+/* 0564 */ UNO_NAME_REDLINE_DISPLAY_TYPE,
+/* 0565 */ UNO_NAME_FORBIDDEN_CHARACTERS,
+/* 0566 */ UNO_NAME_RUBY_BASE_TEXT,
+/* 0567 */ UNO_NAME_RUBY_TEXT,
+/* 0568 */ UNO_NAME_RUBY_ADJUST,
+/* 0569 */ UNO_NAME_RUBY_CHAR_STYLE_NAME,
+/* 0570 */ UNO_NAME_RUBY_IS_ABOVE,
+/* 0571 */ UNO_NAME_FOOTNOTE_HEIGHT,
+/* 0572 */ UNO_NAME_FOOTNOTE_LINE_WEIGHT,
+/* 0573 */ UNO_NAME_FOOTNOTE_LINE_COLOR,
+/* 0574 */ UNO_NAME_FOOTNOTE_LINE_RELATIVE_WIDTH,
+/* 0575 */ UNO_NAME_FOOTNOTE_LINE_ADJUST,
+/* 0576 */ UNO_NAME_FOOTNOTE_LINE_TEXT_DISTANCE,
+/* 0577 */ UNO_NAME_FOOTNOTE_LINE_DISTANCE,
+/* 0578 */ UNO_NAME_CHAR_ROTATION,
+/* 0579 */ UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE,
+/* 0580 */ UNO_NAME_CHAR_SCALE_WIDTH,
+/* 0581 */ UNO_NAME_TAB_STOP_DISTANCE,
+/* 0582 */ UNO_NAME_IS_WIDTH_RELATIVE,
+/* 0583 */ UNO_NAME_CHAR_RELIEF,
+/* 0584 */ UNO_NAME_IS_HIDDEN,
+/* 0585 */ UNO_NAME_IS_CONDITION_TRUE,
+/* 0586 */ UNO_NAME_TWO_DIGIT_YEAR,
+/* 0587 */ UNO_NAME_PROTECTION_KEY,
+/* 0588 */ UNO_NAME_REDLINE_PROTECTION_KEY,
+/* 0589 */ UNO_NAME_AUTOMATIC_DISTANCE,
+/* 0590 */ UNO_NAME_AUTOMATIC_CONTROL_FOCUS,
+/* 0591 */ UNO_NAME_APPLY_FORM_DESIGN_MODE,
+/* 0592 */ UNO_NAME_LOCALE,
+/* 0593 */ UNO_NAME_SORT_ALGORITHM,
+/* 0594 */ UNO_NAME_FRAME_HEIGHT_ABSOLUTE,
+/* 0596 */ UNO_NAME_FRAME_HEIGHT_PERCENT,
+/* 0597 */ UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT,
+/* 0598 */ UNO_NAME_FRAME_WIDTH_ABSOLUTE,
+/* 0599 */ UNO_NAME_FRAME_WIDTH_PERCENT,
+/* 0600 */ UNO_NAME_PARA_STYLEHEADING,
+/* 0601 */ UNO_NAME_PARA_STYLELEVEL1,
+/* 0602 */ UNO_NAME_PARA_STYLELEVEL10,
+/* 0603 */ UNO_NAME_PARA_STYLELEVEL2,
+/* 0604 */ UNO_NAME_PARA_STYLELEVEL3,
+/* 0605 */ UNO_NAME_PARA_STYLELEVEL4,
+/* 0606 */ UNO_NAME_PARA_STYLELEVEL5,
+/* 0607 */ UNO_NAME_PARA_STYLELEVEL6,
+/* 0608 */ UNO_NAME_PARA_STYLELEVEL7,
+/* 0609 */ UNO_NAME_PARA_STYLELEVEL8,
+/* 0610 */ UNO_NAME_PARA_STYLELEVEL9,
+/* 0611 */ UNO_NAME_PARA_STYLESEPARATOR,
+/* 0612 */ UNO_NAME_MACRO_LIBRARY,
+/* 0613 */ UNO_NAME_CELL_NAME,
+/* 0614 */ UNO_NAME_PARA_USER_DEFINED_ATTRIBUTES,
+/* 0615 */ UNO_NAME_MERGE_LAST_PARA,
+/* 0616 */ UNO_NAME_WRITING_MODE,
+/* 0617 */ UNO_NAME_GRID_COLOR,
+/* 0618 */ UNO_NAME_GRID_LINES,
+/* 0619 */ UNO_NAME_GRID_BASE_HEIGHT,
+/* 0620 */ UNO_NAME_GRID_RUBY_HEIGHT,
+/* 0621 */ UNO_NAME_GRID_MODE,
+/* 0622 */ UNO_NAME_GRID_RUBY_BELOW,
+/* 0623 */ UNO_NAME_GRID_PRINT,
+/* 0624 */ UNO_NAME_GRID_DISPLAY,
+/* 0625 */ UNO_NAME_SNAP_TO_GRID,
+/* 0626 */ UNO_NAME_DONT_BALANCE_TEXT_COLUMNS,
+/* 0627 */ UNO_NAME_IS_CURRENTLY_VISIBLE,
+/* 0628 */ UNO_NAME_ANCHOR_POSITION,
+/* 0629 */ UNO_NAME_TEXT_READING,
+/* 0630 */ UNO_NAME_PRIMARY_KEY_READING,
+/* 0631 */ UNO_NAME_SECONDARY_KEY_READING,
+/* 0632 */ UNO_NAME_BACK_GRAPHIC_TRANSPARENCY,
+/* 0633 */ UNO_NAME_BACK_COLOR_R_G_B,
+/* 0634 */ UNO_NAME_BACK_COLOR_TRANSPARENCY,
+/* 0635 */ UNO_NAME_HEADER_DYNAMIC_SPACING,
+/* 0636 */ UNO_NAME_FOOTER_DYNAMIC_SPACING,
+/* 0637 */ UNO_NAME_BASIC_LIBRARIES,
+/* 0638 */ UNO_NAME_IS_FIXED_LANGUAGE,
+/* 0639 */ UNO_NAME_SELECTION,
+/* 0640 */ UNO_NAME_RESULT_SET,
+/* 0641 */ UNO_NAME_CONNECTION,
+/* 0642 */ UNO_NAME_MODEL,
+/* 0643 */ UNO_NAME_DATA_SOURCE_NAME,
+/* 0644 */ UNO_NAME_DATA_COMMAND,
+/* 0645 */ UNO_NAME_FILTER,
+/* 0646 */ UNO_NAME_DOCUMENT_URL,
+/* 0647 */ UNO_NAME_OUTPUT_URL,
+/* 0648 */ UNO_NAME_OUTPUT_TYPE,
+/* 0649 */ UNO_NAME_ESCAPE_PROCESSING,
+/* 0650 */ UNO_NAME_SINGLE_PRINT_JOBS,
+/* 0651 */ UNO_NAME_FILE_NAME_FROM_COLUMN,
+/* 0652 */ UNO_NAME_FILE_NAME_PREFIX,
+/* 0653 */ UNO_NAME_CHAR_STYLE_NAMES,
+/* 0654 */ UNO_NAME_DAD_COMMAND, /* DAD = DataAccessDescriptor (see com.sun.star.sdb.DataAccessDescriptor) */
+/* 0655 */ UNO_NAME_DAD_COMMAND_TYPE,
+/* 0656 */ UNO_NAME_CLSID,
+/* 0657 */ UNO_NAME_COMPONENT,
+/* 0658 */ UNO_NAME_SECT_LEFT_MARGIN,
+/* 0659 */ UNO_NAME_SECT_RIGHT_MARGIN,
+/* 0660 */ UNO_NAME_PARA_IS_CONNECT_BORDER,
+/* 0661 */ UNO_NAME_ITEMS,
+/* 0662 */ UNO_NAME_SELITEM,
+/* 0663 */ UNO_NAME_IS_SPLIT_ALLOWED,
+/* 0664 */ UNO_NAME_CHAR_HIDDEN,
+// OD 18.09.2003 #i18732#
+/* 0665 */ UNO_NAME_IS_FOLLOWING_TEXT_FLOW,
+/* 0666 */ UNO_NAME_WIDTH_TYPE,
+/* 0667 */ UNO_NAME_SCRIPT_URL,
+/* 0668 */ UNO_NAME_RUNTIME_UID,
+/* 0669 */ UNO_NAME_COLLAPSING_BORDERS,
+// OD 2004-05-05 #i28701#
+/* 0670 */ UNO_NAME_WRAP_INFLUENCE_ON_POSITION,
+/* 0671 */ UNO_NAME_DATA_BASE_URL,
+/* 0672 */ UNO_NAME_DATA_BASE_RESOURCE,
+// --> OD 2004-08-06 #i28749#
+/* 0673 */ UNO_NAME_TRANSFORMATION_IN_HORI_L2R,
+/* 0674 */ UNO_NAME_POSITION_LAYOUT_DIR,
+// <--
+/* 0675 */ UNO_NAME_NUMBERING_IS_OUTLINE,
+///* 0676 */ UNO_NAME_DEFAULT_OUTLINE_LEVEL, //#outline level, removed by zhaojianwei
+// --> OD 2004-10-28 #i36248#
+/* 0677 */ UNO_NAME_STARTPOSITION_IN_HORI_L2R,
+/* 0678 */ UNO_NAME_ENDPOSITION_IN_HORI_L2R,
+// <--
+// --> OS 2004-12-13 #30916#
+/* 0679 */ UNO_NAME_SUBJECT,
+/* 0680 */ UNO_NAME_ADDRESS_FROM_COLUMN,
+/* 0681 */ UNO_NAME_SEND_AS_HTML,
+/* 0682 */ UNO_NAME_SEND_AS_ATTACHMENT,
+/* 0683 */ UNO_NAME_MAIL_BODY,
+/* 0684 */ UNO_NAME_ATTACHMENT_NAME,
+/* 0685 */ UNO_NAME_ATTACHMENT_FILTER,
+/* 0686 */ UNO_NAME_PRINT_OPTIONS,
+/* 0687 */ UNO_NAME_SAVE_AS_SINGLE_FILE,
+/* 0688 */ UNO_NAME_SAVE_FILTER,
+/* 0689 */ UNO_NAME_COPIES_TO,
+/* 0690 */ UNO_NAME_BLIND_COPIES_TO,
+/* 0691 */ UNO_NAME_IN_SERVER_PASSWORD,
+/* 0692 */ UNO_NAME_OUT_SERVER_PASSWORD,
+// <--
+/* 0693 */ UNO_NAME_SAVE_FILTER_OPTIONS,
+/* 0694 */ UNO_NAME_SAVE_FILTER_DATA,
+/* 0695 */ UNO_NAME_LOCK_UPDATES,
+// --> TL 2005-02-14 #i37766#
+/* 0696 */ UNO_NAME_PAGE_COUNT,
+/* 0697 */ UNO_NAME_LINE_COUNT,
+/* 0698 */ UNO_NAME_IS_CONSTANT_SPELLCHECK,
+/* 0699 */ UNO_NAME_IS_HIDE_SPELL_MARKS, // deprecated #i91949
+// <--
+/* 0700 */ UNO_NAME_IS_FIELD_USED,
+/* 0701 */ UNO_NAME_IS_FIELD_DISPLAYED,
+/* 0702 */ UNO_NAME_BUILDID,
+/* 0703 */ UNO_NAME_PARA_STYLE_CONDITIONS,
+// --> FME 2005-12-13 #b6354161# Print empty pages
+/* 0704 */ UNO_NAME_PRINT_EMPTY_PAGES,
+// <--
+// --> BM 2006 New Chart (chart2)
+/* 0705 */ UNO_NAME_ROLE,
+// <--
+/* 0706 */ UNO_NAME_FIELD_CODE,
+/* 0707 */ UNO_NAME_HAS_VALID_SIGNATURES,
+// --> AMA #i65476# automatic styles
+/* 0708 */ UNO_NAME_CHAR_AUTO_STYLE_NAME,
+/* 0709 */ UNO_NAME_PARA_AUTO_STYLE_NAME,
+// --> OD 2006-03-21 #b6375613#
+/* 0710 */ UNO_NAME_APPLY_WORKAROUND_FOR_B6375613,
+/* 0711 */ UNO_NAME_LAYOUT_SIZE,
+// --> HB #144146#
+/* 0712 */ UNO_NAME_HELP,
+/* 0713 */ UNO_NAME_TOOLTIP,
+// --> #i73329# / 2007-01-11 / frank.schoenheit@sun.com
+/* 0714 */ UNO_NAME_DIALOG_LIBRARIES,
+/* 0715 */ UNO_NAME_HEADER_ROW_COUNT,
+/* 0716 */ UNO_NAME_INPUT,
+/* 0717 */ UNO_NAME_ROW_SPAN,
+// --> OD 2008-01-15 #newlistlevelattrs#
+/* 0718 */ UNO_NAME_POSITION_AND_SPACE_MODE,
+/* 0719 */ UNO_NAME_LABEL_FOLLOWED_BY,
+/* 0720 */ UNO_NAME_LISTTAB_STOP_POSITION,
+/* 0721 */ UNO_NAME_FIRST_LINE_INDENT,
+/* 0722 */ UNO_NAME_INDENT_AT,
+// --> #i52420# / 2008-02-07 / beppec56@openoffice.org
+/* 0723 */ UNO_NAME_CHAPTER_LEVEL,
+// --> 2007-03-27 text grid enhancement for better CJK support
+/* 0724 */ UNO_NAME_GRID_BASE_WIDTH,
+/* 0725 */ UNO_NAME_GRID_SNAP_TO_CHARS,
+/* 0726 */ UNO_NAME_GRID_STANDARD_PAGE_MODE,
+/* 0727 */ UNO_NAME_TABLE_BORDER_DISTANCES,
+// --> OD 2008-04-22 #refactorlists#
+/* 0728 */ UNO_NAME_LIST_ID,
+/* 0729 */ UNO_NAME_DEFAULT_LIST_ID,
+// <--
+/* 0730 */ UNO_NAME_STREAM_NAME,
+// --> OD 2008-11-26 #158694#
+/* 0731 */ UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE,
+/* 0732 */ UNO_NAME_PARA_LIST_LABEL_STRING,
+// <--
+/* 0733 */ UNO_NAME_CHAR_OVERLINE,
+/* 0734 */ UNO_NAME_CHAR_OVERLINE_COLOR,
+/* 0735 */ UNO_NAME_CHAR_OVERLINE_HAS_COLOR,
+/* 0736 */ UNO_NAME_OUTLINE_LEVEL, //#outline level,add<-zhaojianwei outlinelevel
+// --> OD 2009-07-13 #i73249#
+/* 0737 */ UNO_NAME_DESCRIPTION,
+// <--
+/* 0738 */ UNO_NAME_META, // #i91565#
+/* 0739 */ UNO_NAME_NESTED_TEXT_CONTENT, // #i109601#
+/* 0740 */ UNO_NAME_EMBEDDED_OBJECT,
+/* 0741 */ SW_PROPNAME_END
+};
+
+
+struct SwPropNameLen
+{
+ const char* pName;
+ sal_uInt16 nNameLen;
+ operator const char*() const { return pName; }
+};
+
+
+
+typedef const SwPropNameLen SwPropNameTab[ SW_PROPNAME_END - SW_PROPNAME_BEGIN ];
+extern const SwPropNameTab aPropNameTab;
+
+// !!! function must not(!) be inline because it is called via the below !!!
+// !!! listed macros from the swui DLL and that can not access the !!!
+// !!! array aPropNameTab which is located in a different DLL. !!!
+SW_DLLPUBLIC const SwPropNameLen& GetPropName( sal_uInt16 nId );
+SW_DLLPUBLIC const SwPropNameLen& SwGetPropName( sal_uInt16 nId );
+
+#define SW_PROP_NAME(nId) \
+ GetPropName( nId ).pName, GetPropName( nId ).nNameLen
+
+#define SW_PRPNM_EQLASCI(nId) \
+ GetPropName( nId ).pName, 0, GetPropName( nId ).nNameLen
+
+#define SW_PROP_NAME_STR(nId) \
+ GetPropName( nId ).pName
+
+
+#endif
diff --git a/sw/inc/unoredline.hxx b/sw/inc/unoredline.hxx
new file mode 100644
index 000000000000..cda88eb01aa7
--- /dev/null
+++ b/sw/inc/unoredline.hxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOREDLINE_HXX
+#define _UNOREDLINE_HXX
+
+#include <unoport.hxx>
+#include <unotext.hxx>
+
+
+class SwRedline;
+
+/* -----------------------------19.12.00 11:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+/**
+ * SwXRedlineText provides an XText which may be used to write
+ * directly into a redline node. It got implemented to enable XML
+ * import of redlines and should not be used directly via the API.
+ */
+class SwXRedlineText :
+ public SwXText,
+ public cppu::OWeakObject,
+ public ::com::sun::star::container::XEnumerationAccess
+{
+ SwNodeIndex aNodeIndex;
+ virtual const SwStartNode *GetStartNode() const;
+
+public:
+ SwXRedlineText(SwDoc* pDoc, SwNodeIndex aNodeIndex);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw(){OWeakObject::acquire();}
+ virtual void SAL_CALL release( ) throw(){OWeakObject::release();}
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XText
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & aTextPosition) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess (via XEnumerationAccess)
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+};
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwXRedlinePortion : public SwXTextPortion
+{
+ const SwRedline* pRedline;
+
+ void Validate() throw( ::com::sun::star::uno::RuntimeException );
+
+ using SwXTextPortion::GetPropertyValue;
+
+public:
+ SwXRedlinePortion( const SwRedline* pRed,
+ const SwUnoCrsr* pPortionCrsr,
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParent,
+ sal_Bool bIsStart);
+
+ ~SwXRedlinePortion();
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ static ::com::sun::star::uno::Any GetPropertyValue( const ::rtl::OUString& PropertyName, const SwRedline& rRedline ) throw();
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > CreateRedlineProperties( const SwRedline& rRedline, sal_Bool bIsStart ) throw();
+
+};
+/* -----------------------------11.01.01 16:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+typedef
+cppu::WeakImplHelper1
+<
+ ::com::sun::star::container::XEnumerationAccess
+>
+SwXRedlineBaseClass;
+class SwXRedline :
+ public SwXRedlineBaseClass,
+ public SwXText,
+ public SwClient
+{
+ SwDoc* pDoc;
+ SwRedline* pRedline;
+public:
+ SwXRedline(SwRedline& rRedline, SwDoc& rDoc);
+ ~SwXRedline();
+
+ TYPEINFO();
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw(){OWeakObject::acquire();}
+ virtual void SAL_CALL release( ) throw(){OWeakObject::release();}
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XText
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & aTextPosition) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ const SwRedline* GetRedline() const {return pRedline;}
+protected:
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+};
+#endif
diff --git a/sw/inc/unoredlines.hxx b/sw/inc/unoredlines.hxx
new file mode 100644
index 000000000000..c0ce98d80336
--- /dev/null
+++ b/sw/inc/unoredlines.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOREDLINES_HXX
+#define _UNOREDLINES_HXX
+
+#include <unocoll.hxx>
+#include <unobaseclass.hxx>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+
+class SwRedline;
+namespace com{ namespace sun{ namespace star{
+ namespace beans{
+ class XPropertySet;
+ }
+}}}
+typedef
+cppu::WeakImplHelper3
+<
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::lang::XServiceInfo
+>
+SwRedlinesBaseClass;
+class SwXRedlines : public SwRedlinesBaseClass,
+ public SwUnoCollection
+{
+protected:
+ virtual ~SwXRedlines();
+public:
+ SwXRedlines(SwDoc* pDoc);
+
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XEnumerationAccess - frueher XParagraphEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ static ::com::sun::star::beans::XPropertySet* GetObject( SwRedline& rRedline, SwDoc& rDoc );
+};
+/* -----------------------------12.01.01 14:58--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwXRedlineEnumeration
+ : public SwSimpleEnumeration_Base
+ , public SwClient
+{
+ SwDoc* pDoc;
+ sal_uInt16 nCurrentIndex;
+protected:
+ virtual ~SwXRedlineEnumeration();
+public:
+ SwXRedlineEnumeration(SwDoc& rDoc);
+
+
+ //XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement(void) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+protected:
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+};
+
+
+#endif
+
diff --git a/sw/inc/unorefmark.hxx b/sw/inc/unorefmark.hxx
new file mode 100644
index 000000000000..ba8ca8e8b45c
--- /dev/null
+++ b/sw/inc/unorefmark.hxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOREFMARK_HXX
+#define SW_UNOREFMARK_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+
+#include <cppuhelper/implbase5.hxx>
+
+#include <unobaseclass.hxx>
+
+
+class SwDoc;
+class SwModify;
+class SwFmtRefMark;
+
+
+/* -----------------27.08.98 15:11-------------------
+ *
+ * --------------------------------------------------*/
+typedef ::cppu::WeakImplHelper5
+< ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::container::XNamed
+, ::com::sun::star::text::XTextContent
+> SwXReferenceMark_Base;
+
+class SwXReferenceMark
+ : public SwXReferenceMark_Base
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ virtual ~SwXReferenceMark();
+
+public:
+
+ SwXReferenceMark(SwDoc *const pDoc, const SwFmtRefMark *const pMark);
+
+ static SwXReferenceMark *
+ CreateXReferenceMark(SwDoc & rDoc, SwFmtRefMark const& rMarkFmt);
+ /// may return 0
+ static SwXReferenceMark *
+ GetReferenceMark(SwModify const& rUnoCB, SwFmtRefMark const& rMarkFmt);
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName(const ::rtl::OUString& rName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // SW_UNOREFMARK_HXX
+
diff --git a/sw/inc/unosection.hxx b/sw/inc/unosection.hxx
new file mode 100644
index 000000000000..e54bdd5775af
--- /dev/null
+++ b/sw/inc/unosection.hxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOSECTION_HXX
+#define SW_UNOSECTION_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextSection.hpp>
+
+#include <cppuhelper/implbase7.hxx>
+
+#include <sfx2/Metadatable.hxx>
+
+#include <unobaseclass.hxx>
+
+
+class SwSectionFmt;
+
+
+/*-----------------09.03.98 13:57-------------------
+
+--------------------------------------------------*/
+
+
+struct SwTextSectionProperties_Impl;
+
+typedef ::cppu::ImplInheritanceHelper7
+< ::sfx2::MetadatableMixin
+, ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::beans::XPropertyState
+, ::com::sun::star::beans::XMultiPropertySet
+, ::com::sun::star::container::XNamed
+, ::com::sun::star::text::XTextSection
+> SwXTextSection_Base;
+
+class SwXTextSection
+ : public SwXTextSection_Base
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ SwXTextSection(SwSectionFmt *const pFmt, const bool bIndexHeader = false);
+
+ virtual ~SwXTextSection();
+
+public:
+
+ SwSectionFmt* GetFmt() const;
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextSection >
+ CreateXTextSection(SwSectionFmt *const pFmt = 0,
+ const bool bIndexHeader = false);
+
+ // MetadatableMixin
+ virtual ::sfx2::Metadatable* GetCoreObject();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ GetModel();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL
+ getPropertyState(const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyState > SAL_CALL
+ getPropertyStates(
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& rPropertyNames)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rValues)
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ SAL_CALL getPropertyValues(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName(const ::rtl::OUString& rName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextSection
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextSection > SAL_CALL
+ getParentSection()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextSection > > SAL_CALL
+ getChildSections()
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // SW_UNOSECTION_HXX
+
diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx
new file mode 100644
index 000000000000..92f52d5ad190
--- /dev/null
+++ b/sw/inc/unosett.hxx
@@ -0,0 +1,327 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOSETT_HXX
+#define _UNOSETT_HXX
+
+#include <swtypes.hxx>
+#include <calbck.hxx>
+#include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <tools/string.hxx>
+#include <svl/itemprop.hxx>
+
+class SwDoc;
+class SwFmtCol;
+class SwDocShell;
+class SwNumRule;
+/******************************************************************************
+ *
+ ******************************************************************************/
+/* -----------------04.05.98 12:28-------------------
+ *
+ * --------------------------------------------------*/
+class SwXFootnoteProperties : public cppu::WeakAggImplHelper2
+<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo
+>
+{
+ SwDoc* pDoc;
+ const SfxItemPropertySet* m_pPropertySet;
+protected:
+ virtual ~SwXFootnoteProperties();
+public:
+ SwXFootnoteProperties(SwDoc* pDoc);
+
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ void Invalidate() {pDoc = 0;}
+};
+
+/* -----------------04.05.98 12:28-------------------
+ *
+ * --------------------------------------------------*/
+class SwXEndnoteProperties : public cppu::WeakAggImplHelper2
+<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo
+>
+{
+ SwDoc* pDoc;
+ const SfxItemPropertySet* m_pPropertySet;
+protected:
+ virtual ~SwXEndnoteProperties();
+public:
+ SwXEndnoteProperties(SwDoc* pDoc);
+
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ void Invalidate() {pDoc = 0;}
+};
+
+/* -----------------04.05.98 12:28-------------------
+ *
+ * --------------------------------------------------*/
+class SwXLineNumberingProperties : public cppu::WeakAggImplHelper2
+<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo
+>
+{
+ SwDoc* pDoc;
+ const SfxItemPropertySet* m_pPropertySet;
+protected:
+ virtual ~SwXLineNumberingProperties();
+public:
+ SwXLineNumberingProperties(SwDoc* pDoc);
+
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ void Invalidate() {pDoc = 0;}
+};
+
+/* -----------------25.05.98 08:21-------------------
+ *
+ * --------------------------------------------------*/
+class SwXNumberingRules : public cppu::WeakAggImplHelper5
+<
+ ::com::sun::star::container::XIndexReplace,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo
+>,
+ public SwClient
+{
+ String sNewCharStyleNames[MAXLEVEL];
+ String sNewBulletFontNames[MAXLEVEL];
+ String sCreatedNumRuleName; //connects to a numbering in SwDoc
+ SwDoc* pDoc; // wird nur fuers anmelden gebraucht
+ SwDocShell* pDocShell; //nur, wenn als ChapterNumbering verwendet
+ SwNumRule* pNumRule;
+ const SfxItemPropertySet* m_pPropertySet;
+ sal_Bool bOwnNumRuleCreated;
+ static String sInvalidStyle;
+protected:
+ virtual ~SwXNumberingRules();
+
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwXNumberingRules(SwDocShell& rDocSh); // chapter numbering
+ SwXNumberingRules(const SwNumRule& rRule); // NumRule for paragraphs, numbering styles
+ SwXNumberingRules(SwDoc& rDoc); //create a new instance
+
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ //XIndexReplace
+ virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XNamed
+ virtual rtl::OUString SAL_CALL getName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setName(const rtl::OUString& Name_) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue>
+ GetNumberingRuleByIndex(const SwNumRule& rNumRule, sal_Int32 nIndex)const;
+ void SetNumberingRuleByIndex(SwNumRule& rNumRule,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rProperties, sal_Int32 nIndex)
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+
+ const String* GetNewCharStyleNames() const {return sNewCharStyleNames;}
+ const String* GetBulletFontNames() const {return sNewBulletFontNames;}
+ const SwNumRule* GetNumRule() {return pNumRule;}
+
+ static const String& GetInvalidStyle();
+ void Invalidate() {pDocShell = 0;}
+ const String& GetCreatedNumRuleName() const{return sCreatedNumRuleName; }
+};
+/*-----------------12.02.98 08:27-------------------
+
+--------------------------------------------------*/
+class SwXChapterNumbering : public SwXNumberingRules
+{
+protected:
+ virtual ~SwXChapterNumbering();
+public:
+ SwXChapterNumbering(SwDocShell& rDocSh);
+
+
+ void Invalidate() {SwXNumberingRules::Invalidate();}
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+/* -----------------27.05.98 15:44-------------------
+ *
+ * --------------------------------------------------*/
+class SwXTextColumns : public cppu::WeakAggImplHelper4
+<
+
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::text::XTextColumns,
+ ::com::sun::star::lang::XServiceInfo
+>
+{
+ sal_Int32 nReference;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::text::TextColumn> aTextColumns;
+ sal_Bool bIsAutomaticWidth;
+ sal_Int32 nAutoDistance;
+
+ const SfxItemPropertySet* m_pPropSet;
+
+ //separator line
+ sal_Int32 nSepLineWidth;
+ sal_Int32 nSepLineColor;
+ sal_Int8 nSepLineHeightRelative;
+ sal_Int8 nSepLineVertAlign;//style::VerticalAlignment
+ sal_Bool bSepLineIsOn;
+protected:
+ virtual ~SwXTextColumns();
+public:
+ SwXTextColumns(sal_uInt16 nColCount);
+ SwXTextColumns(const SwFmtCol& rFmtCol);
+
+
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XTextColumns
+ virtual sal_Int32 SAL_CALL getReferenceValue( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getColumnCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnCount( sal_Int16 nColumns ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::text::TextColumn > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumns( const ::com::sun::star::uno::Sequence< ::com::sun::star::text::TextColumn >& Columns ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ sal_Int32 GetSepLineWidth() const {return nSepLineWidth;}
+ sal_Int32 GetSepLineColor() const {return nSepLineColor;}
+ sal_Int8 GetSepLineHeightRelative() const {return nSepLineHeightRelative;}
+ sal_Int8 GetSepLineVertAlign() const {return nSepLineVertAlign;}
+ sal_Bool GetSepLineIsOn() const {return bSepLineIsOn;}
+
+ sal_Bool IsAutomaticWidth() const {return bIsAutomaticWidth;}
+};
+#endif
+
+
diff --git a/sw/inc/unosrch.hxx b/sw/inc/unosrch.hxx
new file mode 100644
index 000000000000..a4021761925f
--- /dev/null
+++ b/sw/inc/unosrch.hxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOSRCH_HXX
+#define _UNOSRCH_HXX
+
+#include <com/sun/star/util/XPropertyReplace.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase3.hxx> // helper for implementations
+#include <tools/string.hxx>
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+class SfxItemPropertySet;
+class SwXTextDocument;
+class SwSearchProperties_Impl;
+class SfxItemSet;
+
+namespace com{namespace sun{namespace star{namespace util{
+ struct SearchOptions;
+}}}}
+
+
+/*-----------------19.12.97 12:58-------------------
+
+--------------------------------------------------*/
+class SwXTextSearch : public cppu::WeakImplHelper3
+<
+ ::com::sun::star::util::XPropertyReplace,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel
+>
+{
+ friend class SwXTextDocument;
+
+ String sSearchText;
+ String sReplaceText;
+
+ SwSearchProperties_Impl* pSearchProperties;
+ SwSearchProperties_Impl* pReplaceProperties;
+
+
+ const SfxItemPropertySet* m_pPropSet;
+ sal_Bool bAll : 1;
+ sal_Bool bWord : 1;
+ sal_Bool bBack : 1;
+ sal_Bool bExpr : 1;
+ sal_Bool bCase : 1;
+// sal_Bool bInSel: 1; // wie geht Suchen in Selektionen?
+ sal_Bool bStyles:1;
+ sal_Bool bSimilarity : 1;
+ sal_Bool bLevRelax :1;
+ sal_Int16 nLevExchange;
+ sal_Int16 nLevAdd;
+ sal_Int16 nLevRemove;
+
+ sal_Bool bIsValueSearch :1;
+protected:
+ virtual ~SwXTextSearch();
+public:
+ SwXTextSearch();
+
+
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XSearchDescriptor
+ virtual ::rtl::OUString SAL_CALL getSearchString( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSearchString( const ::rtl::OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XReplaceDescriptor
+ virtual ::rtl::OUString SAL_CALL getReplaceString(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setReplaceString(const ::rtl::OUString& aReplaceString) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XPropertyReplace
+ virtual sal_Bool SAL_CALL getValueSearch(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setValueSearch(sal_Bool ValueSearch_) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > SAL_CALL getSearchAttributes(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setSearchAttributes(const ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& aSearchAttribs) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > SAL_CALL getReplaceAttributes(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setReplaceAttributes(const ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& aSearchAttribs) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ void FillSearchItemSet(SfxItemSet& rSet) const;
+ void FillReplaceItemSet(SfxItemSet& rSet) const;
+
+ sal_Bool HasSearchAttributes() const;
+ sal_Bool HasReplaceAttributes() const;
+
+ void FillSearchOptions( ::com::sun::star::util::SearchOptions&
+ rSearchOpt ) const;
+};
+
+#endif
+
diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx
new file mode 100644
index 000000000000..080d2e03bc4b
--- /dev/null
+++ b/sw/inc/unostyle.hxx
@@ -0,0 +1,472 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOSTYLE_HXX
+#define _UNOSTYLE_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <svl/style.hxx>
+#include <svl/lstner.hxx>
+#include <unocoll.hxx>
+#include <unomap.hxx>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/style/XStyleLoader.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <cppuhelper/implbase7.hxx>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <calbck.hxx>
+
+
+#include <com/sun/star/style/XAutoStyleFamily.hpp>
+#include <com/sun/star/style/XAutoStyles.hpp>
+#include <com/sun/star/style/XAutoStyle.hpp>
+
+#include <istyleaccess.hxx>
+
+class SwDocShell;
+class SfxItemPropertySet;
+class SwXStyle;
+class SwStyleProperties_Impl;
+class SwAutoStylesEnumImpl;
+class IStyleAccess;
+class SfxItemSet;
+typedef boost::shared_ptr<SfxItemSet> SfxItemSet_Pointer_t;
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+/*-----------------12.02.98 08:27-------------------
+
+--------------------------------------------------*/
+class SwXStyleFamilies : public cppu::WeakImplHelper4
+<
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::style::XStyleLoader
+>,
+ public SwUnoCollection
+{
+ SwDocShell* pDocShell;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > * pxCharStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > * pxParaStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > * pxFrameStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > * pxPageStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > * pxNumberingStyles;
+protected:
+ virtual ~SwXStyleFamilies();
+public:
+ SwXStyleFamilies(SwDocShell& rDocShell);
+
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XStyleLoader
+ virtual void SAL_CALL loadStylesFromURL(const rtl::OUString& rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aOptions) throw( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getStyleLoaderOptions(void) throw( ::com::sun::star::uno::RuntimeException );
+
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+};
+
+/* -----------------26.05.98 10:56-------------------
+ *
+ * --------------------------------------------------*/
+class SwXStyleFamily : public cppu::WeakImplHelper4
+<
+ ::com::sun::star::container::XNameContainer,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::beans::XPropertySet
+>,
+ public SfxListener
+{
+ SfxStyleFamily eFamily; // Familie
+ SfxStyleSheetBasePool* pBasePool;
+// const SfxItemPropertyMap* _pPropMap;
+ SwDocShell* pDocShell;
+
+ SwXStyle* _FindStyle(const String& rStyleName) const;
+public:
+ SwXStyleFamily(SwDocShell* pDocShell, sal_uInt16 nFamily);
+ ~SwXStyleFamily();
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XNameContainer
+ virtual void SAL_CALL insertByName(const rtl::OUString& Name, const ::com::sun::star::uno::Any& Element) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL replaceByName(const rtl::OUString& Name, const ::com::sun::star::uno::Any& Element) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+};
+/* -----------------20.05.98 09:51-------------------
+ *
+ * --------------------------------------------------*/
+class SwXStyle : public cppu::WeakImplHelper7
+<
+ ::com::sun::star::style::XStyle,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::beans::XMultiPropertySet,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::beans::XPropertyState,
+ ::com::sun::star::beans::XMultiPropertyStates
+>,
+ public SfxListener,
+ public SwClient
+{
+ friend class SwXStyleFamily;
+ SwDoc* m_pDoc;
+ String sStyleName;
+ SfxStyleSheetBasePool* pBasePool;
+ SfxStyleFamily eFamily; // fuer Notify
+
+ sal_Bool bIsDescriptor : 1;
+ sal_Bool bIsConditional : 1;
+ String sParentStyleName;
+ SwStyleProperties_Impl* pPropImpl;
+
+ void ApplyDescriptorProperties();
+protected:
+ void Invalidate();
+
+ const SfxStyleSheetBasePool* GetBasePool() const {return pBasePool;}
+ SfxStyleSheetBasePool* GetBasePool() {return pBasePool;}
+
+ void SetStyleName(const String& rSet){ sStyleName = rSet;}
+ SwStyleProperties_Impl* GetPropImpl(){return pPropImpl;}
+ com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxStyleData;
+ com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxStyleFamily;
+
+ void SAL_CALL SetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+public:
+ SwXStyle(SwDoc* pDoc, SfxStyleFamily eFam = SFX_STYLE_FAMILY_PARA, sal_Bool bConditional = sal_False);
+ SwXStyle(SfxStyleSheetBasePool& rPool, SfxStyleFamily eFam,
+ SwDoc* pDoc,
+ const String& rStyleName);//,
+ //const SfxItemPropertyMap* _pMap);
+ ~SwXStyle();
+
+ TYPEINFO();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XNamed
+ virtual rtl::OUString SAL_CALL getName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setName(const rtl::OUString& Name_) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XStyle
+ virtual sal_Bool SAL_CALL isUserDefined(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL isInUse(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL getParentStyle(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setParentStyle(const rtl::OUString& aParentStyle) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException );
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertySet
+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertyStates
+ //virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ const String& GetStyleName() const { return sStyleName;}
+ SfxStyleFamily GetFamily() const {return eFamily;}
+
+ sal_Bool IsDescriptor() const {return bIsDescriptor;}
+ sal_Bool IsConditional() const { return bIsConditional;}
+ const String& GetParentStyleName() const { return sParentStyleName;}
+ void SetDoc(SwDoc* pDc, SfxStyleSheetBasePool* pPool)
+ {
+ bIsDescriptor = sal_False; m_pDoc = pDc;
+ pBasePool = pPool;
+ StartListening(*pBasePool);
+ }
+ SwDoc* GetDoc() const { return m_pDoc; }
+};
+/* -----------------------------15.12.00 14:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwXFrameStyle : public SwXStyle,
+ public com::sun::star::document::XEventsSupplier
+{
+public:
+ SwXFrameStyle(SfxStyleSheetBasePool& rPool,
+ SwDoc* pDoc,
+ const String& rStyleName) :
+ SwXStyle(rPool, SFX_STYLE_FAMILY_FRAME, pDoc, rStyleName){}
+ SwXFrameStyle( SwDoc *pDoc );
+ ~SwXFrameStyle();
+
+ virtual void SAL_CALL acquire( ) throw(){SwXStyle::acquire();}
+ virtual void SAL_CALL release( ) throw(){SwXStyle::release();}
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException);
+
+ friend class SwFrameStyleEventDescriptor;
+};
+/* -----------------24.08.98 16:04-------------------
+ *
+ * --------------------------------------------------*/
+class SwXPageStyle : public SwXStyle
+{
+ SwDocShell* pDocShell;
+
+protected:
+ void SAL_CALL SetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ SwXPageStyle(SfxStyleSheetBasePool& rPool, SwDocShell* pDocSh, SfxStyleFamily eFam,
+ const String& rStyleName);//,
+ //const SfxItemPropertyMap* _pMap);
+ SwXPageStyle(SwDocShell* pDocSh);
+ ~SwXPageStyle();
+
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
+
+};
+/*-- 19.05.2006 11:20:22---------------------------------------------------
+ access to all automatic style families
+ -----------------------------------------------------------------------*/
+class SwXAutoStyles :
+ public cppu::WeakImplHelper1< ::com::sun::star::style::XAutoStyles >,
+ public SwUnoCollection
+{
+ SwDocShell *pDocShell;
+ ::com::sun::star::uno::Reference< ::com::sun::star::style::XAutoStyleFamily > xAutoCharStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::style::XAutoStyleFamily > xAutoRubyStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::style::XAutoStyleFamily > xAutoParaStyles;
+ ::com::sun::star::uno::Reference< ::com::sun::star::style::XAutoStyleFamily > xAutoNotxtStyles;
+ virtual ~SwXAutoStyles();
+
+public:
+ SwXAutoStyles(SwDocShell& rDocShell);
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
+
+};
+/*-- 19.05.2006 11:20:12---------------------------------------------------
+ access to a family of automatic styles (character or paragraph or ...)
+ -----------------------------------------------------------------------*/
+class SwXAutoStyleFamily : public cppu::WeakImplHelper1< com::sun::star::style::XAutoStyleFamily >,
+ public SwClient
+{
+ SwDocShell *pDocShell;
+ IStyleAccess::SwAutoStyleFamily eFamily;
+
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwXAutoStyleFamily(SwDocShell* pDocShell, IStyleAccess::SwAutoStyleFamily eFamily);
+ virtual ~SwXAutoStyleFamily();
+
+ //XAutoStyleFamily
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::style::XAutoStyle > SAL_CALL insertStyle( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Values ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+};
+class SwXAutoStylesEnumerator : public cppu::WeakImplHelper1< ::com::sun::star::container::XEnumeration >,
+ public SwClient
+{
+ SwAutoStylesEnumImpl *pImpl;
+public:
+ SwXAutoStylesEnumerator( SwDoc* pDoc, IStyleAccess::SwAutoStyleFamily eFam );
+ virtual ~SwXAutoStylesEnumerator();
+
+ //XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+};
+
+/*-- 19.05.2006 11:20:02---------------------------------------------------
+ an automatic style
+ -----------------------------------------------------------------------*/
+
+class SwXAutoStyle : public cppu::WeakImplHelper3
+<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::beans::XPropertyState,
+ ::com::sun::star::style::XAutoStyle
+>,
+ public SwClient
+{
+ SfxItemSet_Pointer_t pSet;
+ IStyleAccess::SwAutoStyleFamily eFamily;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+public:
+
+ SwXAutoStyle( SwDoc* pDoc, SfxItemSet_Pointer_t pInitSet, IStyleAccess::SwAutoStyleFamily eFam );
+ virtual ~SwXAutoStyle();
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertySet
+ // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertyStates
+ // virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // Special
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getProperties() throw (::com::sun::star::uno::RuntimeException);
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+};
+#endif
+
+
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
new file mode 100644
index 000000000000..b875a8798f0f
--- /dev/null
+++ b/sw/inc/unotbl.hxx
@@ -0,0 +1,623 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOTBL_HXX
+#define _UNOTBL_HXX
+
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/util/XSortable.hpp>
+#include <com/sun/star/chart/XChartData.hpp>
+#include <com/sun/star/chart/XChartDataArray.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#include <com/sun/star/text/XTextTableCursor.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/sheet/XCellRangeData.hpp>
+#include <com/sun/star/table/XAutoFormattable.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <cppuhelper/implbase10.hxx>
+
+#include <comphelper/uno3.hxx>
+#include <tools/string.hxx>
+
+#include <calbck.hxx>
+#include <TextCursorHelper.hxx>
+#include <unoevtlstnr.hxx>
+#include <unotext.hxx>
+
+
+class SwUnoCrsr;
+class SwTable;
+class SwTableBox;
+class SwTableLine;
+class SwTableCursor;
+class SwTableBoxFmt;
+class SwChartDataProvider;
+class SwFrmFmt;
+
+
+/* -----------------------------22.09.00 11:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwChartEventListenerContainer : public SwEventListenerContainer
+{
+ public:
+ SwChartEventListenerContainer( ::com::sun::star::uno::XInterface* pxParentL) :
+ SwEventListenerContainer(pxParentL){}
+ void ChartDataChanged();
+};
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+typedef
+cppu::WeakImplHelper4
+<
+ ::com::sun::star::table::XCell,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::container::XEnumerationAccess
+>
+SwXCellBaseClass;
+class SwXCell : public SwXCellBaseClass,
+ public SwXText,
+ public SwClient
+{
+ friend void lcl_setString( SwXCell &rCell, const rtl::OUString &rTxt,
+ sal_Bool bKeepNumberFmt = sal_False );
+ friend double lcl_getValue( SwXCell &rCell );
+ friend void lcl_setValue( SwXCell &rCell, double nVal );
+
+
+ const SfxItemPropertySet* m_pPropSet;
+ SwTableBox* pBox; // only set in non-XML import
+ const SwStartNode* pStartNode; // only set in XML import
+
+ // table position where pBox was found last
+ sal_uInt16 nFndPos;
+
+protected:
+ virtual const SwStartNode *GetStartNode() const;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor >
+ CreateCursor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ bool IsValid() const;
+
+ virtual ~SwXCell();
+
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, sal_uInt16 nPos=USHRT_MAX );
+ SwXCell(SwFrmFmt* pTblFmt, const SwStartNode& rStartNode); // XML import interface
+
+
+ TYPEINFO();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw();
+ virtual void SAL_CALL release( ) throw();
+
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XCell
+ virtual ::rtl::OUString SAL_CALL getFormula( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFormula( const ::rtl::OUString& aFormula ) throw(::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setValue( double nValue ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::table::CellContentType SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getError( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XText
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & aTextPosition) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setString(const rtl::OUString& aString) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XEnumerationAccess - frueher XParagraphEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ SwTableBox* GetTblBox()const {return pBox;}
+ static SwXCell* CreateXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, SwTable *pTbl = 0 );
+ SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox);
+
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+};
+/* -----------------27.06.98 15:40-------------------
+ *
+ * --------------------------------------------------*/
+class SwXTextTableRow : public cppu::WeakImplHelper2
+<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo
+>,
+ public SwClient
+{
+ const SfxItemPropertySet* m_pPropSet;
+ SwTableLine* pLine;
+
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+protected:
+ virtual ~SwXTextTableRow();
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+ SwXTextTableRow(SwFrmFmt* pFmt, SwTableLine* pLine);
+
+
+ TYPEINFO();
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ const SwTableLine* GetTblRow() const {return pLine;}
+ static SwTableLine* FindLine(SwTable* pTable, SwTableLine* pLine);
+};
+/* -----------------20.07.98 13:03-------------------
+ *
+ * --------------------------------------------------*/
+typedef cppu::WeakImplHelper3<
+ ::com::sun::star::text::XTextTableCursor,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::beans::XPropertySet
+ > SwXTextTableCursor_Base;
+class SW_DLLPUBLIC SwXTextTableCursor : public SwXTextTableCursor_Base
+ ,public SwClient
+ ,public OTextCursorHelper
+{
+ SwDepend aCrsrDepend;
+ const SfxItemPropertySet* m_pPropSet;
+
+ // SwUnoCrsr* GetCrsr() const { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); }
+
+protected:
+ virtual ~SwXTextTableCursor();
+public:
+ SwXTextTableCursor(SwFrmFmt* pFmt, SwTableBox* pBox);
+ SwXTextTableCursor(SwFrmFmt& rTableFmt,
+ const SwTableCursor* pTableSelection);
+
+
+ DECLARE_XINTERFACE()
+
+ //XTextTableCursor
+ virtual ::rtl::OUString SAL_CALL getRangeName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoCellByName( const ::rtl::OUString& aCellName, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL goUp( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL goDown( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoStart( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL mergeRange( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL splitRange( sal_Int16 Count, sal_Bool Horizontal ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+ // ITextCursorHelper
+ virtual const SwPaM* GetPaM() const;
+ virtual SwPaM* GetPaM();
+ virtual const SwDoc* GetDoc() const;
+ virtual SwDoc* GetDoc();
+
+ const SwUnoCrsr* GetCrsr() const;
+ SwUnoCrsr* GetCrsr();
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+};
+
+/*-----------------11.12.97 09:38-------------------
+
+--------------------------------------------------*/
+struct SwRangeDescriptor
+{
+ sal_Int32 nTop;
+ sal_Int32 nLeft;
+ sal_Int32 nBottom;
+ sal_Int32 nRight;
+
+ void Normalize();
+};
+
+class SwTableProperties_Impl;
+class SwXTextTable : public cppu::WeakImplHelper10
+<
+ ::com::sun::star::text::XTextTable,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::table::XCellRange,
+ ::com::sun::star::chart::XChartDataArray,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::table::XAutoFormattable,
+ ::com::sun::star::util::XSortable,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::sheet::XCellRangeData
+>,
+ public SwClient
+{
+ SwEventListenerContainer aLstnrCntnr;
+ SwChartEventListenerContainer aChartLstnrCntnr;
+ const SfxItemPropertySet* m_pPropSet;
+
+ // Descriptor-interface
+ SwTableProperties_Impl* pTableProps;
+ String m_sTableName;
+ sal_Bool bIsDescriptor;
+ unsigned short nRows;
+ unsigned short nColumns;
+
+
+ sal_Bool bFirstRowAsLabel :1;
+ sal_Bool bFirstColumnAsLabel :1;
+protected:
+ virtual ~SwXTextTable();
+public:
+ SwXTextTable();
+ SwXTextTable(SwFrmFmt& rFrmFmt);
+
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ TYPEINFO();
+
+ //XTextTable
+ virtual void SAL_CALL initialize( sal_Int32 nRows, sal_Int32 nColumns ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableRows > SAL_CALL getRows( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableColumns > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByName( const ::rtl::OUString& aCellName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getCellNames( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextTableCursor > SAL_CALL createCursorByCellName( const ::rtl::OUString& aCellName ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XTextContent
+ virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XComponent
+ virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XCellRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw(com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const ::rtl::OUString& aRange ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XChartDataArray
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL getData( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& aData ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowDescriptions( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRowDescriptions ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getColumnDescriptions( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aColumnDescriptions ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XChartData
+ virtual void SAL_CALL addChartDataChangeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getNotANumber( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XSortable
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL createSortDescriptor(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL sort(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xDescriptor) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XAutoFormattable
+ virtual void SAL_CALL autoFormat(const rtl::OUString& aName) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XNamed
+ virtual rtl::OUString SAL_CALL getName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setName(const rtl::OUString& Name_) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XCellRangeData
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL getDataArray( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDataArray( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aArray ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ sal_uInt16 getRowCount(void);
+ sal_uInt16 getColumnCount(void);
+ ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > GetRangeByName(SwFrmFmt* pFmt, SwTable* pTable,
+ const String& sTLName, const String& sBRName,
+ SwRangeDescriptor& rDesc);
+
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+};
+
+/* -----------------27.04.98 16:41-------------------
+ *
+ * --------------------------------------------------*/
+class SwXCellRange : public cppu::WeakImplHelper7
+<
+ ::com::sun::star::table::XCellRange,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::chart::XChartDataArray,
+ ::com::sun::star::util::XSortable,
+ ::com::sun::star::sheet::XCellRangeData
+>,
+ public SwClient
+{
+ SwDepend aCursorDepend; //the cursor is removed after the doc has been removed
+ SwChartEventListenerContainer aChartLstnrCntnr;
+
+ SwRangeDescriptor aRgDesc;
+ const SfxItemPropertySet* m_pPropSet;
+
+ SwUnoCrsr* pTblCrsr;
+
+ sal_Bool bFirstRowAsLabel :1;
+ sal_Bool bFirstColumnAsLabel :1;
+
+public:
+ SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt, SwRangeDescriptor& rDesc);
+ ~SwXCellRange();
+
+ TYPEINFO();
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ //XCellRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw(com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const ::rtl::OUString& aRange ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XChartData
+ virtual void SAL_CALL addChartDataChangeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getNotANumber( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XChartDataArray
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL getData( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& aData ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowDescriptions( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRowDescriptions ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getColumnDescriptions( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aColumnDescriptions ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XSortable
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL createSortDescriptor(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL sort(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xDescriptor) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XCellRangeData
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL getDataArray( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDataArray( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aArray ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+ sal_uInt16 getRowCount(void);
+ sal_uInt16 getColumnCount(void);
+
+ const SwUnoCrsr* GetTblCrsr() const;
+
+ // for SwChartDataSequence
+ void GetDataSequence(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > *pAnySeq,
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > *pTxtSeq,
+ ::com::sun::star::uno::Sequence< double > *pDblSeq,
+ sal_Bool bForceNumberResults = sal_False ) throw (::com::sun::star::uno::RuntimeException);
+
+};
+/* -----------------03.02.99 07:31-------------------
+ *
+ * --------------------------------------------------*/
+class SwXTableRows : public cppu::WeakImplHelper2
+<
+ ::com::sun::star::table::XTableRows,
+ ::com::sun::star::lang::XServiceInfo
+>,
+ public SwClient
+
+{
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+protected:
+ virtual ~SwXTableRows();
+public:
+ SwXTableRows(SwFrmFmt& rFrmFmt);
+
+
+ TYPEINFO();
+
+// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
+// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > > getIdlClasses(void) throw( ::com::sun::star::uno::RuntimeException );
+
+// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
+// virtual sal_Bool queryInterface( ::com::sun::star::uno::Uik aUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rOut );
+
+// SMART_UNO_DECLARATION( SwXTableRows, UsrObject );
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XTableRows
+ virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+};
+
+/* -----------------03.02.99 07:31-------------------
+ *
+ * --------------------------------------------------*/
+class SwXTableColumns : public cppu::WeakImplHelper2
+<
+ ::com::sun::star::table::XTableColumns,
+ ::com::sun::star::lang::XServiceInfo
+>,
+ public SwClient
+
+{
+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+protected:
+ virtual ~SwXTableColumns();
+public:
+ SwXTableColumns(SwFrmFmt& rFrmFmt);
+
+
+ TYPEINFO();
+// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
+// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > > getIdlClasses(void) throw( ::com::sun::star::uno::RuntimeException );
+
+// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
+// virtual sal_Bool queryInterface( ::com::sun::star::uno::Uik aUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rOut );
+
+// SMART_UNO_DECLARATION( SwXTableColumns, UsrObject );
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ //XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XTableColumns
+ virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+};
+
+#endif
+
+
+
+
diff --git a/sw/inc/unotext.hxx b/sw/inc/unotext.hxx
new file mode 100644
index 000000000000..908c48aac4ac
--- /dev/null
+++ b/sw/inc/unotext.hxx
@@ -0,0 +1,346 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOTEXT_HXX
+#define SW_UNOTEXT_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextCopy.hpp>
+#include <com/sun/star/text/XTextRangeCompare.hpp>
+#include <com/sun/star/text/XRelativeTextContentInsert.hpp>
+#include <com/sun/star/text/XRelativeTextContentRemove.hpp>
+#include <com/sun/star/text/XTextAppendAndConvert.hpp>
+
+#include <unobaseclass.hxx>
+
+
+namespace com { namespace sun { namespace star {
+ namespace text {
+ class XTextContent;
+ }
+} } }
+
+class SfxItemPropertySet;
+class SwDoc;
+class SwStartNode;
+class SwPaM;
+class OTextCursorHelper;
+class SwXTextRange;
+
+
+/* -----------------03.12.98 12:22-------------------
+ *
+ * --------------------------------------------------*/
+
+class SwXText
+ : public ::com::sun::star::lang::XTypeProvider
+ , public ::com::sun::star::lang::XUnoTunnel
+ , public ::com::sun::star::beans::XPropertySet
+ , public ::com::sun::star::text::XTextAppendAndConvert
+ , public ::com::sun::star::text::XTextCopy
+ , public ::com::sun::star::text::XTextRangeCompare
+ , public ::com::sun::star::text::XRelativeTextContentInsert
+ , public ::com::sun::star::text::XRelativeTextContentRemove
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ virtual void PrepareForAttach(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xRange,
+ SwPaM const & rPam);
+ virtual bool CheckForOwnMemberMeta(
+ const SwPaM & rPam, const bool bAbsorb)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+protected:
+
+ bool IsValid() const;
+ void Invalidate();
+ void SetDoc(SwDoc *const pDoc);
+
+ virtual ~SwXText();
+
+public: /*not protected because C++ is retarded*/
+ virtual const SwStartNode *GetStartNode() const;
+
+public:
+
+ SwXText(SwDoc *const pDoc, const enum CursorType eType);
+
+ const SwDoc* GetDoc() const;
+ SwDoc* GetDoc();
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor >
+ CreateCursor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ SAL_CALL getText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getStart()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getEnd()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getString()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString(const ::rtl::OUString& rString)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XSimpleText
+ virtual void SAL_CALL insertString(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xRange,
+ const ::rtl::OUString& aString, sal_Bool bAbsorb)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertControlCharacter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xRange,
+ sal_Int16 nControlCharacter, sal_Bool bAbsorb)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XText
+ virtual void SAL_CALL insertTextContent(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xRange,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > & xContent,
+ sal_Bool bAbsorb)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTextContent(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > & xContent)
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XParagraphAppend
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL
+ appendParagraph(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >&
+ rCharacterAndParagraphProperties)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL
+ finishParagraph(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >&
+ rCharacterAndParagraphProperties)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XTextPortionAppend
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL
+ appendTextPortion(
+ const ::rtl::OUString& rText,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >&
+ rCharacterAndParagraphProperties)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XTextContentAppend
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL
+ appendTextContent(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent >& xTextContent,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >&
+ rCharacterAndParagraphProperties)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XTextConvert
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent > SAL_CALL
+ convertToTextFrame(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange >& xStart,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange >& xEnd,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& xFrameProperties)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextTable > SAL_CALL
+ convertToTable(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > > > > const&
+ rTableRanges,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > > > const&
+ rCellProperties,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > > const&
+ rRowProperties,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > const&
+ rTableProperties)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XTextCopy
+ virtual void SAL_CALL copyText(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCopy >& xSource )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextRangeCompare
+ sal_Int16 SAL_CALL compareRegionStarts(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange >& xR1,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange >& xR2)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL compareRegionEnds(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange >& xR1,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange >& xR2)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XRelativeTextContentInsert
+ virtual void SAL_CALL insertTextContentBefore(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent>& xNewContent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent>& xSuccessor)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertTextContentAfter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent>& xNewContent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent>& xPredecessor)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XRelativeTextContentRemove
+ virtual void SAL_CALL removeTextContentBefore(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent>& xSuccessor)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTextContentAfter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextContent>& xPredecessor)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+};
+
+#endif // SW_UNOTEXT_HXX
+
diff --git a/sw/inc/unotextbodyhf.hxx b/sw/inc/unotextbodyhf.hxx
new file mode 100644
index 000000000000..dd5fa736fe17
--- /dev/null
+++ b/sw/inc/unotextbodyhf.hxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOTEXTBODYHF_HXX
+#define SW_UNOTEXTBODYHF_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+#include <unotext.hxx>
+
+
+class SwDoc;
+class SwFrmFmt;
+class SwXTextCursor;
+
+
+typedef ::cppu::WeakAggImplHelper2
+< ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::container::XEnumerationAccess
+> SwXBodyText_Base;
+
+class SwXBodyText
+ : public SwXBodyText_Base
+ , public SwXText
+{
+
+protected:
+
+ virtual ~SwXBodyText();
+
+public:
+
+ SwXBodyText(SwDoc *const pDoc);
+
+ SwXTextCursor * CreateTextCursor(const bool bIgnoreTables = false);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // XAggregation
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(
+ const ::com::sun::star::uno::Type& rType)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createEnumeration()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XSimpleText
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor > SAL_CALL
+ createTextCursor()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor > SAL_CALL
+ createTextCursorByRange(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextPosition)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+
+/* -----------------25.08.98 11:02-------------------
+ *
+ * --------------------------------------------------*/
+typedef ::cppu::WeakImplHelper2
+< ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::container::XEnumerationAccess
+> SwXHeadFootText_Base;
+
+class SwXHeadFootText
+ : public SwXHeadFootText_Base
+ , public SwXText
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+protected:
+
+ virtual const SwStartNode *GetStartNode() const;
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor >
+ CreateCursor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ~SwXHeadFootText();
+
+ SwXHeadFootText(SwFrmFmt & rHeadFootFmt, const bool bIsHeader);
+
+public:
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ CreateXHeadFootText(SwFrmFmt & rHeadFootFmt, const bool bIsHeader);
+ static bool IsXHeadFootText(SwClient *const pClient);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createEnumeration()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XSimpleText
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor > SAL_CALL
+ createTextCursor()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextCursor > SAL_CALL
+ createTextCursorByRange(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextPosition)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // SW_UNOTEXTBODYHF_HXX
+
diff --git a/sw/inc/unotextcursor.hxx b/sw/inc/unotextcursor.hxx
new file mode 100644
index 000000000000..fe04602377c0
--- /dev/null
+++ b/sw/inc/unotextcursor.hxx
@@ -0,0 +1,347 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOTEXTCURSOR_HXX
+#define SW_UNOTEXTCURSOR_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/util/XSortable.hpp>
+#include <com/sun/star/document/XDocumentInsertable.hpp>
+#include <com/sun/star/text/XSentenceCursor.hpp>
+#include <com/sun/star/text/XWordCursor.hpp>
+#include <com/sun/star/text/XParagraphCursor.hpp>
+#include <com/sun/star/text/XRedline.hpp>
+
+#include <cppuhelper/implbase12.hxx>
+
+#include <comphelper/uno3.hxx>
+
+#include <unobaseclass.hxx>
+#include <TextCursorHelper.hxx>
+
+
+class SwDoc;
+struct SwPosition;
+class SwUnoCrsr;
+
+
+typedef ::cppu::WeakImplHelper12
+< ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::beans::XPropertyState
+, ::com::sun::star::beans::XMultiPropertyStates
+, ::com::sun::star::container::XEnumerationAccess
+, ::com::sun::star::container::XContentEnumerationAccess
+, ::com::sun::star::util::XSortable
+, ::com::sun::star::document::XDocumentInsertable
+, ::com::sun::star::text::XSentenceCursor
+, ::com::sun::star::text::XWordCursor
+, ::com::sun::star::text::XParagraphCursor
+, ::com::sun::star::text::XRedline
+> SwXTextCursor_Base;
+
+class SwXTextCursor
+ : public SwXTextCursor_Base
+ , public OTextCursorHelper
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ virtual ~SwXTextCursor();
+
+public:
+
+ SwXTextCursor(
+ SwDoc & rDoc,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XText > const& xParent,
+ const enum CursorType eType,
+ SwPosition const& rPos,
+ SwPosition const*const pMark = 0);
+ SwXTextCursor(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XText > const& xParent,
+ SwPaM const& rSourceCursor,
+ const enum CursorType eType = CURSOR_ALL);
+
+ SwUnoCrsr * GetCursor();
+ const SwUnoCrsr * GetCursor() const;
+
+ bool IsAtEndOfMeta() const;
+
+ void DeleteAndInsert(::rtl::OUString const& rText,
+ const bool bForceExpandHints);
+
+ // OTextCursorHelper
+ virtual const SwPaM* GetPaM() const;
+ virtual SwPaM* GetPaM();
+ virtual const SwDoc* GetDoc() const;
+ virtual SwDoc* GetDoc();
+
+ DECLARE_XINTERFACE()
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL
+ getPropertyState(const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyState > SAL_CALL
+ getPropertyStates(
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& rPropertyNames)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertyStates
+ virtual void SAL_CALL setAllPropertiesToDefault()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ SAL_CALL getPropertyDefaults(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
+ rPropertyNames)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createEnumeration()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XContentEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createContentEnumeration(const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getAvailableServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XSortable
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > SAL_CALL
+ createSortDescriptor()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL sort(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& xDescriptor)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XDocumentInsertable
+ virtual void SAL_CALL insertDocumentFromURL(
+ const ::rtl::OUString& rURL,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rOptions)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ SAL_CALL getText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getStart()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getEnd()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getString()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString(const ::rtl::OUString& rString)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextCursor
+ virtual void SAL_CALL collapseToStart()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL collapseToEnd()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isCollapsed()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL goLeft(sal_Int16 nCount, sal_Bool bExpand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL goRight(sal_Int16 nCount, sal_Bool bExpand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoStart(sal_Bool bExpand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoEnd(sal_Bool bExpand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoRange(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange >& xRange,
+ sal_Bool bExpand)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XWordCursor
+ virtual sal_Bool SAL_CALL isStartOfWord()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isEndOfWord()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoNextWord(sal_Bool bExpand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoPreviousWord(sal_Bool bExpand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoEndOfWord(sal_Bool bExpand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoStartOfWord(sal_Bool bExpand)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XSentenceCursor
+ virtual sal_Bool SAL_CALL isStartOfSentence()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isEndOfSentence()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoNextSentence(sal_Bool Expand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoPreviousSentence(sal_Bool Expand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoStartOfSentence(sal_Bool Expand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoEndOfSentence(sal_Bool Expand)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XParagraphCursor
+ virtual sal_Bool SAL_CALL isStartOfParagraph()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isEndOfParagraph()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoStartOfParagraph(sal_Bool Expand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoEndOfParagraph(sal_Bool Expand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoNextParagraph(sal_Bool Expand)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL gotoPreviousParagraph(sal_Bool Expand)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XRedline
+ virtual void SAL_CALL makeRedline(
+ const ::rtl::OUString& rRedlineType,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& RedlineProperties)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // SW_UNOTEXTCURSOR_HXX
+
diff --git a/sw/inc/unotextmarkup.hxx b/sw/inc/unotextmarkup.hxx
new file mode 100644
index 000000000000..7d48595e8e3b
--- /dev/null
+++ b/sw/inc/unotextmarkup.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOTEXTMARKUP_HXX
+#define _UNOTEXTMARKUP_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/text/XTextMarkup.hpp>
+#include <com/sun/star/text/XMultiTextMarkup.hpp>
+#include <calbck.hxx>
+#include <modeltoviewhelper.hxx>
+
+#include <map>
+
+namespace com { namespace sun { namespace star { namespace container {
+ class XStringKeyMap;
+} } } }
+
+class SwTxtNode;
+class SfxPoolItem;
+
+/** Implementation of the css::text::XTextMarkup interface
+ */
+class SwXTextMarkup:
+ public ::cppu::WeakImplHelper2
+ <
+ ::com::sun::star::text::XTextMarkup,
+ ::com::sun::star::text::XMultiTextMarkup
+ >,
+ public SwClient
+{
+public:
+ SwXTextMarkup( SwTxtNode& rTxtNode, const ModelToViewHelper::ConversionMap* pConversionMap );
+ virtual ~SwXTextMarkup();
+
+ // ::com::sun::star::text::XTextMarkup:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL commitTextMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XMultiTextMarkup:
+ virtual void SAL_CALL commitMultiTextMarkup( const ::com::sun::star::uno::Sequence< ::com::sun::star::text::TextMarkupDescriptor >& aMarkups ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ SwXTextMarkup( const SwXTextMarkup & ); // not defined
+ SwXTextMarkup & operator =( const SwXTextMarkup & ); // not defined
+
+protected:
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+ SwTxtNode* mpTxtNode;
+ const ModelToViewHelper::ConversionMap* mpConversionMap;
+
+};
+
+
+/** Implementation of the ::com::sun::star::container::XStringKeyMap interface
+ */
+class SwXStringKeyMap:
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::container::XStringKeyMap>
+{
+public:
+ SwXStringKeyMap();
+
+ // ::com::sun::star::container::XStringKeyMap:
+ virtual ::com::sun::star::uno::Any SAL_CALL getValue(const ::rtl::OUString & aKey) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException);
+ virtual ::sal_Bool SAL_CALL hasValue(const ::rtl::OUString & aKey) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertValue(const ::rtl::OUString & aKey, const ::com::sun::star::uno::Any & aValue) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException);
+ virtual ::sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
+
+private:
+ SwXStringKeyMap(SwXStringKeyMap &); // not defined
+ void operator =(SwXStringKeyMap &); // not defined
+
+ virtual ~SwXStringKeyMap() {}
+
+ std::map< rtl::OUString, ::com::sun::star::uno::Any > maMap;
+};
+
+#endif
+
+
diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx
new file mode 100644
index 000000000000..4a10c7acf513
--- /dev/null
+++ b/sw/inc/unotextrange.hxx
@@ -0,0 +1,338 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOTEXTRANGE_HXX
+#define SW_UNOTEXTRANGE_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XRedline.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase8.hxx>
+
+#include <pam.hxx>
+#include <unobaseclass.hxx>
+
+
+class SwDoc;
+struct SwPosition;
+class SwPaM;
+class SwUnoCrsr;
+class SwFrmFmt;
+
+/* -----------------29.04.98 07:35-------------------
+ *
+ * --------------------------------------------------*/
+class SwUnoInternalPaM
+ : public SwPaM
+{
+
+private:
+ SwUnoInternalPaM(const SwUnoInternalPaM&);
+
+public:
+ SwUnoInternalPaM(SwDoc& rDoc);
+ virtual ~SwUnoInternalPaM();
+
+ SwUnoInternalPaM& operator=(const SwPaM& rPaM);
+};
+
+
+namespace sw {
+
+ void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget);
+
+ bool XTextRangeToSwPaM(SwUnoInternalPaM& rToFill,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos);
+
+ bool GetDefaultTextContentValue(::com::sun::star::uno::Any& rAny,
+ const ::rtl::OUString& rPropertyName, sal_uInt16 nWID = 0);
+
+} // namespace sw
+
+
+typedef ::cppu::WeakImplHelper8
+< ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::beans::XPropertyState
+, ::com::sun::star::container::XEnumerationAccess
+, ::com::sun::star::container::XContentEnumerationAccess
+, ::com::sun::star::text::XTextRange
+, ::com::sun::star::text::XRedline
+> SwXTextRange_Base;
+
+class SW_DLLPUBLIC SwXTextRange
+ : public SwXTextRange_Base
+{
+
+private:
+
+ friend class SwXText;
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ enum RangePosition
+ {
+ RANGE_IN_TEXT, // "ordinary" ::com::sun::star::text::TextRange
+ RANGE_IN_CELL, // position created with a cell that has no uno object
+ RANGE_IS_TABLE, // anchor of a table
+ };
+
+ void SetPositions(SwPaM const& rPam);
+ //TODO: new exception type for protected content
+ void DeleteAndInsert(
+ const ::rtl::OUString& rText, const bool bForceExpandHints)
+ throw (::com::sun::star::uno::RuntimeException);
+ void Invalidate();
+
+ virtual ~SwXTextRange();
+
+public:
+
+ SwXTextRange(SwPaM& rPam,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XText > & xParent,
+ const enum RangePosition eRange = RANGE_IN_TEXT);
+ // only for RANGE_IS_TABLE
+ SwXTextRange(SwFrmFmt& rTblFmt);
+
+ const SwDoc* GetDoc() const;
+ SwDoc* GetDoc();
+ bool GetPositions(SwPaM & rToFill) const;
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > CreateXTextRange(
+ SwDoc & rDoc,
+ const SwPosition& rPos, const SwPosition *const pMark);
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL
+ getPropertyState(const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyState > SAL_CALL
+ getPropertyStates(
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& rPropertyNames)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createEnumeration()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XContentEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createContentEnumeration(const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getAvailableServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ SAL_CALL getText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getStart()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getEnd()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getString()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString(const ::rtl::OUString& rString)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XRedline
+ virtual void SAL_CALL makeRedline(
+ const ::rtl::OUString& rRedlineType,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& RedlineProperties)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+};
+
+/* -----------------15.05.98 08:29-------------------
+ *
+ * --------------------------------------------------*/
+
+typedef ::cppu::WeakImplHelper3
+< ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::container::XIndexAccess
+> SwXTextRanges_Base;
+
+class SwXTextRanges
+ : public SwXTextRanges_Base
+{
+
+private:
+
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
+ virtual ~SwXTextRanges();
+
+public:
+
+ SwXTextRanges(SwPaM *const pCrsr);
+
+ const SwUnoCrsr* GetCursor() const;
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // SW_UNOTEXTRANGE_HXX
+
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
new file mode 100644
index 000000000000..bb5168a16c1c
--- /dev/null
+++ b/sw/inc/unotxdoc.hxx
@@ -0,0 +1,611 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _UNOTXDOC_HXX
+#define _UNOTXDOC_HXX
+
+#include "swdllapi.h"
+#include <svl/svarray.hxx>
+#include <sfx2/sfxbasemodel.hxx>
+
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XAutoStylesSupplier.hpp>
+#include <com/sun/star/document/XLinkTargetSupplier.hpp>
+#include <com/sun/star/document/XRedlinesSupplier.hpp>
+#include <com/sun/star/text/XNumberingRulesSupplier.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
+#include <com/sun/star/text/XEndnotesSupplier.hpp>
+#include <com/sun/star/text/XEndnotesSettingsSupplier.hpp>
+#include <com/sun/star/text/XTextSectionsSupplier.hpp>
+#include <com/sun/star/text/XLineNumberingProperties.hpp>
+#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
+#include <com/sun/star/text/XPagePrintable.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
+#include <com/sun/star/text/XBookmarksSupplier.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
+#include <com/sun/star/text/XReferenceMarksSupplier.hpp>
+#include <com/sun/star/text/XTextFramesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/util/XReplaceable.hpp>
+#include <com/sun/star/util/XReplaceDescriptor.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/util/XLinkUpdate.hpp>
+#include <com/sun/star/view/XRenderable.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/xforms/XFormsSupplier.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
+#include <com/sun/star/document/XDocumentLanguages.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <svl/itemprop.hxx>
+#include <svx/fmdmod.hxx>
+#include <editeng/UnoForbiddenCharsTable.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx> // helper for implementations
+#include <cppuhelper/implbase4.hxx> // helper for implementations
+#include <RefreshListenerContainer.hxx>
+
+#include <viewopt.hxx>
+
+#define __IFC32 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, Ifc14, Ifc15, Ifc16, \
+Ifc17, Ifc18, Ifc19, Ifc20, Ifc21, Ifc22, Ifc23, Ifc24, Ifc25, Ifc26, Ifc27, Ifc28, Ifc29, Ifc30, Ifc31, Ifc32
+
+#define __CLASS_IFC32 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, \
+class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13, class Ifc14, class Ifc15, class Ifc16, \
+class Ifc17, class Ifc18, class Ifc19, class Ifc20, class Ifc21, class Ifc22, class Ifc23, class Ifc24,\
+class Ifc25, class Ifc26, class Ifc27, class Ifc28, class Ifc29, class Ifc30, class Ifc31 , class Ifc32
+
+#define __PUBLIC_IFC32 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, \
+public Ifc13, public Ifc14, public Ifc15, public Ifc16, public Ifc17, public Ifc18, \
+public Ifc19, public Ifc20, public Ifc21, public Ifc22, public Ifc23, public Ifc24, \
+public Ifc25, public Ifc26, public Ifc27, public Ifc28, public Ifc29, public Ifc30, \
+public Ifc31, public Ifc32
+#include <cppuhelper/implbase_ex.hxx>
+#include <cppuhelper/implbase_ex_pre.hxx>
+#define __IFC_EX_TYPE_INIT32( class_cast ) \
+ __IFC_EX_TYPE_INIT( class_cast, 1 ), __IFC_EX_TYPE_INIT( class_cast, 2 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 3 ), __IFC_EX_TYPE_INIT( class_cast, 4 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 5 ), __IFC_EX_TYPE_INIT( class_cast, 6 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 7 ), __IFC_EX_TYPE_INIT( class_cast, 8 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 9 ), __IFC_EX_TYPE_INIT( class_cast, 10 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 11 ), __IFC_EX_TYPE_INIT( class_cast, 12 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 13 ), __IFC_EX_TYPE_INIT( class_cast, 14 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 15 ), __IFC_EX_TYPE_INIT( class_cast, 16 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 17 ), __IFC_EX_TYPE_INIT( class_cast, 18 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 19 ), __IFC_EX_TYPE_INIT( class_cast, 20 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 21 ), __IFC_EX_TYPE_INIT( class_cast, 22 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 23 ), __IFC_EX_TYPE_INIT( class_cast, 24 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 25 ), __IFC_EX_TYPE_INIT( class_cast, 26 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 27 ), __IFC_EX_TYPE_INIT( class_cast, 28 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 29 ), __IFC_EX_TYPE_INIT( class_cast, 30 ), \
+ __IFC_EX_TYPE_INIT( class_cast, 31 ), __IFC_EX_TYPE_INIT( class_cast, 32)
+#include <cppuhelper/implbase_ex_post.hxx>
+
+__DEF_IMPLHELPER_EX( 32 )
+
+namespace css = ::com::sun::star;
+
+class SwDoc;
+class SwDocShell;
+class UnoActionContext;
+class SwXBodyText;
+class SwXDrawPage;
+class SwUnoCrsr;
+class SwXDocumentPropertyHelper;
+class SfxViewFrame;
+class SwPrintUIOptions;
+class SwPrintData;
+class SwRenderData;
+class ViewShell;
+
+typedef UnoActionContext* UnoActionContextPtr;
+SV_DECL_PTRARR(ActionContextArr, UnoActionContextPtr, 4, 4)
+
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+
+
+typedef cppu::WeakImplHelper32
+<
+ css::text::XTextDocument,
+ css::text::XLineNumberingProperties,
+ css::text::XChapterNumberingSupplier,
+ css::text::XNumberingRulesSupplier,
+ css::text::XFootnotesSupplier,
+ css::text::XEndnotesSupplier,
+ css::util::XReplaceable,
+ css::text::XPagePrintable,
+ css::text::XReferenceMarksSupplier,
+ css::text::XTextTablesSupplier,
+ css::text::XTextFramesSupplier,
+ css::text::XBookmarksSupplier,
+ css::text::XTextSectionsSupplier,
+ css::text::XTextGraphicObjectsSupplier,
+ css::text::XTextEmbeddedObjectsSupplier,
+ css::text::XTextFieldsSupplier,
+ css::style::XStyleFamiliesSupplier,
+ css::style::XAutoStylesSupplier,
+ css::lang::XServiceInfo,
+ css::drawing::XDrawPageSupplier,
+ css::text::XDocumentIndexesSupplier,
+ css::beans::XPropertySet,
+ css::beans::XPropertyState,
+ css::document::XLinkTargetSupplier,
+ css::document::XRedlinesSupplier,
+ css::util::XRefreshable,
+ css::util::XLinkUpdate,
+ css::view::XRenderable,
+ css::xforms::XFormsSupplier,
+ css::text::XFlatParagraphIteratorProvider,
+ css::document::XDocumentLanguages,
+ css::util::XCloneable
+>
+SwXTextDocumentBaseClass;
+
+class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass,
+ public SvxFmMSFactory,
+ public SfxBaseModel
+{
+ ActionContextArr aActionArr;
+ SwRefreshListenerContainer aRefreshCont;
+
+ const SfxItemPropertySet* pPropSet;
+
+ SwDocShell* pDocShell;
+ sal_Bool bObjectValid;
+
+ SwXDrawPage* pDrawPage;
+ css::uno::Reference< css::drawing::XDrawPage > * pxXDrawPage;
+
+ css::uno::Reference< css::text::XText > xBodyText;
+ SwXBodyText* pBodyText;
+ css::uno::Reference< css::uno::XAggregation > xNumFmtAgg;
+
+ css::uno::Reference< css::container::XIndexAccess > * pxXNumberingRules;
+ css::uno::Reference< css::container::XIndexAccess > * pxXFootnotes;
+ css::uno::Reference< css::beans::XPropertySet > * pxXFootnoteSettings;
+ css::uno::Reference< css::container::XIndexAccess > * pxXEndnotes;
+ css::uno::Reference< css::beans::XPropertySet > * pxXEndnoteSettings;
+ css::uno::Reference< css::container::XNameAccess > * pxXReferenceMarks;
+ css::uno::Reference< css::container::XEnumerationAccess > * pxXTextFieldTypes;
+ css::uno::Reference< css::container::XNameAccess > * pxXTextFieldMasters;
+ css::uno::Reference< css::container::XNameAccess > * pxXTextSections;
+ css::uno::Reference< css::container::XNameAccess > * pxXBookmarks;
+ css::uno::Reference< css::container::XNameAccess > * pxXTextTables;
+ css::uno::Reference< css::container::XNameAccess > * pxXTextFrames;
+ css::uno::Reference< css::container::XNameAccess > * pxXGraphicObjects;
+ css::uno::Reference< css::container::XNameAccess > * pxXEmbeddedObjects;
+ css::uno::Reference< css::container::XNameAccess > * pxXStyleFamilies;
+ mutable css::uno::Reference< css::style::XAutoStyles > * pxXAutoStyles;
+ css::uno::Reference< css::container::XIndexReplace > * pxXChapterNumbering;
+ css::uno::Reference< css::container::XIndexAccess > * pxXDocumentIndexes;
+
+ css::uno::Reference< css::beans::XPropertySet > * pxXLineNumberingProperties;
+ css::uno::Reference< css::container::XNameAccess > * pxLinkTargetSupplier;
+ css::uno::Reference< css::container::XEnumerationAccess >* pxXRedlines;
+ css::uno::Reference< css::container::XNameContainer> xXFormsContainer;
+
+ //temporary frame to enable PDF export if no valid view is available
+ SfxViewFrame* m_pHiddenViewFrame;
+ css::uno::Reference< css::uno::XInterface> xPropertyHelper;
+ SwXDocumentPropertyHelper* pPropertyHelper;
+
+ SwPrintUIOptions * m_pPrintUIOptions;
+ SwRenderData * m_pRenderData;
+
+ void GetBodyText();
+ void GetNumberFormatter();
+
+ // used for XRenderable implementation
+ SfxViewShell * GuessViewShell( /* out */ bool &rbIsSwSrcView, const css::uno::Reference< css::frame::XController > xController = css::uno::Reference< css::frame::XController >() );
+ SwDoc * GetRenderDoc( SfxViewShell *&rpView, const css::uno::Any& rSelection, bool bIsPDFExport );
+ SfxViewShell * GetRenderView( bool &rbIsSwSrcView, const css::uno::Sequence< css::beans::PropertyValue >& rxOptions, bool bIsPDFExport );
+
+ rtl::OUString maBuildId;
+
+ using SfxBaseModel::addEventListener;
+ using SfxBaseModel::removeEventListener;
+
+protected:
+ virtual ~SwXTextDocument();
+public:
+ SwXTextDocument(SwDocShell* pShell);
+
+ inline void notifyRefreshListeners() { aRefreshCont.Refreshed(); }
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw();
+ virtual void SAL_CALL release( ) throw();
+
+ //XWeak
+ virtual css::uno::Reference< css::uno::XAdapter > SAL_CALL queryAdapter( ) throw(css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException);
+
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) throw(css::uno::RuntimeException);
+
+ //XTextDocument
+ virtual css::uno::Reference< css::text::XText > SAL_CALL getText(void) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL reformat(void) throw( css::uno::RuntimeException );
+
+ //XModel
+ virtual sal_Bool SAL_CALL attachResource( const ::rtl::OUString& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) throw(css::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getURL( ) throw(css::uno::RuntimeException);
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs( ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL connectController( const css::uno::Reference< css::frame::XController >& xController ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL disconnectController( const css::uno::Reference< css::frame::XController >& xController ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL lockControllers( ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL unlockControllers( ) throw(css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasControllersLocked( ) throw(css::uno::RuntimeException);
+ virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController( ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& xController ) throw(css::container::NoSuchElementException, css::uno::RuntimeException);
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection( ) throw(css::uno::RuntimeException);
+
+ //XComponent
+ virtual void SAL_CALL dispose(void) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) throw( css::uno::RuntimeException );
+
+ //XCloseable
+ virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) throw (css::util::CloseVetoException, css::uno::RuntimeException);
+
+ //XLineNumberingProperties
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getLineNumberingProperties(void) throw( css::uno::RuntimeException );
+
+ //XChapterNumberingSupplier
+ virtual css::uno::Reference< css::container::XIndexReplace > SAL_CALL getChapterNumberingRules(void) throw( css::uno::RuntimeException );
+
+ //XNumberingRulesSupplier
+ virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getNumberingRules() throw (css::uno::RuntimeException);
+
+ //XFootnotesSupplier
+ virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getFootnotes(void) throw( css::uno::RuntimeException );
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getFootnoteSettings(void) throw( css::uno::RuntimeException );
+
+ //XEndnotesSupplier
+ virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getEndnotes(void) throw( css::uno::RuntimeException );
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getEndnoteSettings(void) throw( css::uno::RuntimeException );
+
+ //XReplaceable
+ virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL createReplaceDescriptor(void) throw( css::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL replaceAll(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) throw( css::uno::RuntimeException );
+
+ //XSearchable
+ virtual css::uno::Reference< css::util::XSearchDescriptor > SAL_CALL createSearchDescriptor(void) throw( css::uno::RuntimeException );
+ virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL findAll(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) throw( css::uno::RuntimeException );
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findFirst(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) throw( css::uno::RuntimeException );
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findNext(const css::uno::Reference< css::uno::XInterface > & xStartAt, const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) throw( css::uno::RuntimeException );
+
+ //XPagePrintable
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPagePrintSettings(void) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL setPagePrintSettings(const css::uno::Sequence< css::beans::PropertyValue >& aSettings) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL printPages(const css::uno::Sequence< css::beans::PropertyValue >& xOptions) throw( css::lang::IllegalArgumentException, css::uno::RuntimeException );
+
+ //XReferenceMarksSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getReferenceMarks(void) throw( css::uno::RuntimeException );
+
+ // css::text::XTextFieldsSupplier
+ virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTextFields(void) throw( css::uno::RuntimeException );
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFieldMasters(void) throw( css::uno::RuntimeException );
+
+ // css::text::XTextEmbeddedObjectsSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getEmbeddedObjects(void) throw( css::uno::RuntimeException );
+
+// // css::text::XTextShapesSupplier
+// virtual css::uno::Reference< css::container::XIndexAccess > getShapes(void) throw( css::uno::RuntimeException );
+
+ // css::text::XBookmarksSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getBookmarks(void) throw( css::uno::RuntimeException );
+
+ // css::text::XTextSectionsSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextSections(void) throw( css::uno::RuntimeException );
+
+ // css::text::XTextTablesSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextTables(void) throw( css::uno::RuntimeException );
+
+ // css::text::XTextGraphicObjectsSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGraphicObjects(void) throw( css::uno::RuntimeException );
+
+ // css::text::XTextFramesSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFrames(void) throw( css::uno::RuntimeException );
+
+ //XStyleFamiliesSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getStyleFamilies(void) throw( css::uno::RuntimeException );
+
+ //XAutoStylesSupplier
+ virtual css::uno::Reference< css::style::XAutoStyles > SAL_CALL getAutoStyles( ) throw (css::uno::RuntimeException);
+
+ //XMultiServiceFactory
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const rtl::OUString& ServiceSpecifier)
+ throw( css::uno::Exception, css::uno::RuntimeException );
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const rtl::OUString& ServiceSpecifier,
+ const css::uno::Sequence< css::uno::Any >& Arguments)
+ throw( css::uno::Exception, css::uno::RuntimeException );
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAvailableServiceNames(void)
+ throw( css::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( css::uno::RuntimeException );
+
+ // css::drawing::XDrawPageSupplier
+ virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage(void) throw( css::uno::RuntimeException );
+
+ // css::text::XDocumentIndexesSupplier
+ virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getDocumentIndexes(void) throw( css::uno::RuntimeException );
+
+ //XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw(css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ //XPropertyState
+ virtual css::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& rPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException);
+ virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< ::rtl::OUString >& rPropertyNames ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& rPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ //XLinkTargetSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks(void) throw( css::uno::RuntimeException );
+
+ //XRedlinesSupplier
+ virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getRedlines( ) throw(css::uno::RuntimeException);
+
+ // css::util::XRefreshable
+ virtual void SAL_CALL refresh(void) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > & l) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > & l) throw( css::uno::RuntimeException );
+
+ // css::util::XLinkUpdate,
+ virtual void SAL_CALL updateLinks( ) throw(css::uno::RuntimeException);
+
+ // css::view::XRenderable
+ virtual sal_Int32 SAL_CALL getRendererCount( const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+ virtual void SAL_CALL render( sal_Int32 nRenderer, const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ // css::xforms::XFormsSupplier
+ virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getXForms( ) throw (css::uno::RuntimeException);
+
+ // css::document::XDocumentLanguages
+ virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getDocumentLanguages( ::sal_Int16 nScriptTypes, ::sal_Int16 nCount ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ // css::text::XFlatParagraphIteratorProvider:
+ virtual css::uno::Reference< css::text::XFlatParagraphIterator > SAL_CALL getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic ) throw (css::uno::RuntimeException);
+
+ // ::com::sun::star::util::XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
+
+
+ //
+ void Invalidate();
+ void Reactivate(SwDocShell* pNewDocShell);
+ SwXDocumentPropertyHelper * GetPropertyHelper ();
+ sal_Bool IsValid() const {return bObjectValid;}
+
+ void InitNewDoc();
+
+ SwUnoCrsr* CreateCursorForSearch(css::uno::Reference< css::text::XTextCursor > & xCrsr);
+ SwUnoCrsr* FindAny(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc,
+ css::uno::Reference< css::text::XTextCursor > & xCrsr, sal_Bool bAll,
+ sal_Int32& nResult,
+ css::uno::Reference< css::uno::XInterface > xLastResult);
+
+ SwXDrawPage* GetDrawPage();
+ SwDocShell* GetDocShell() {return pDocShell;}
+
+
+ void * SAL_CALL operator new( size_t ) throw();
+ void SAL_CALL operator delete( void * ) throw();
+
+};
+/* -----------------25.10.99 11:02-------------------
+
+ --------------------------------------------------*/
+class SwXLinkTargetSupplier : public cppu::WeakImplHelper2
+<
+ css::container::XNameAccess,
+ css::lang::XServiceInfo
+>
+{
+ SwXTextDocument* pxDoc;
+ String sTables;
+ String sFrames;
+ String sGraphics;
+ String sOLEs;
+ String sSections;
+ String sOutlines;
+ String sBookmarks;
+
+public:
+ SwXLinkTargetSupplier(SwXTextDocument& rxDoc);
+ ~SwXLinkTargetSupplier();
+
+ //XNameAccess
+ virtual css::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException );
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( css::uno::RuntimeException );
+
+ //XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType( ) throw(css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(css::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( css::uno::RuntimeException );
+
+ //
+ void Invalidate() {pxDoc = 0;}
+};
+/* -----------------26.10.99 09:05-------------------
+
+ --------------------------------------------------*/
+class SwXLinkNameAccessWrapper : public cppu::WeakImplHelper4
+<
+ css::beans::XPropertySet,
+ css::container::XNameAccess,
+ css::lang::XServiceInfo,
+ css::document::XLinkTargetSupplier
+>
+{
+ css::uno::Reference< css::container::XNameAccess > xRealAccess;
+ const SfxItemPropertySet* pPropSet;
+ const String sLinkSuffix;
+ const String sLinkDisplayName;
+ css::uno::Reference< css::text::XTextDocument > xDoc;
+ SwXTextDocument* pxDoc;
+
+
+public:
+ SwXLinkNameAccessWrapper(css::uno::Reference< css::container::XNameAccess > xAccess,
+ const String& rLinkDisplayName, String sSuffix);
+ SwXLinkNameAccessWrapper(SwXTextDocument& rxDoc,
+ const String& rLinkDisplayName, String sSuffix);
+ ~SwXLinkNameAccessWrapper();
+
+ //XNameAccess
+ virtual css::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException );
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( css::uno::RuntimeException );
+
+ //XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType( ) throw(css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(css::uno::RuntimeException);
+
+ //XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw(css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ //XLinkTargetSupplier
+ virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks(void) throw( css::uno::RuntimeException );
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( css::uno::RuntimeException );
+
+};
+/* -----------------26.10.99 15:46-------------------
+
+ --------------------------------------------------*/
+class SwXOutlineTarget : public cppu::WeakImplHelper2
+<
+ css::beans::XPropertySet,
+ css::lang::XServiceInfo
+>
+{
+ const SfxItemPropertySet* pPropSet;
+ String sOutlineText;
+
+public:
+ SwXOutlineTarget(const String& rOutlineText);
+ ~SwXOutlineTarget();
+
+ //XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw(css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( css::uno::RuntimeException );
+};
+#endif
+
+class SwXDocumentPropertyHelper : public SvxUnoForbiddenCharsTable
+{
+ css::uno::Reference < css::uno::XInterface > xDashTable;
+ css::uno::Reference < css::uno::XInterface > xGradientTable;
+ css::uno::Reference < css::uno::XInterface > xHatchTable;
+ css::uno::Reference < css::uno::XInterface > xBitmapTable;
+ css::uno::Reference < css::uno::XInterface > xTransGradientTable;
+ css::uno::Reference < css::uno::XInterface > xMarkerTable;
+ css::uno::Reference < css::uno::XInterface > xDrawDefaults;
+
+ SwDoc* m_pDoc;
+public:
+ SwXDocumentPropertyHelper(SwDoc& rDoc);
+ ~SwXDocumentPropertyHelper();
+ css::uno::Reference<css::uno::XInterface> GetDrawTable(short nWhich);
+ void Invalidate();
+
+ virtual void onChange();
+};
+
+
+/*-- 06.01.2004 15:08:34---------------------------------------------------
+ The class SwViewOptionAdjust_Impl is used to adjust the SwViewOption of
+ the current ViewShell so that fields are not printed as commands and
+ hidden characters are always invisible. Hidden text and place holders
+ should be printed according to the current print options.
+ After printing the view options are restored
+ -----------------------------------------------------------------------*/
+class SwViewOptionAdjust_Impl
+{
+ ViewShell & m_rShell;
+ SwViewOption m_aOldViewOptions;
+// SwViewOption m_aRenderViewOptions; // view options to use when rendering for PDF export or printing
+// bool m_bRestoreViewOptions;
+
+public:
+ SwViewOptionAdjust_Impl( ViewShell& rSh, const SwViewOption &rViewOptions );
+ ~SwViewOptionAdjust_Impl();
+ void AdjustViewOptions( SwPrintData const* const pPrtOptions );
+ bool checkShell( const ViewShell& rCompare ) const
+ { return &rCompare == &m_rShell; }
+};
+
+
diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx
new file mode 100644
index 000000000000..11d1db177c84
--- /dev/null
+++ b/sw/inc/usrfld.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_USRFLD_HXX
+#define SW_USRFLD_HXX
+
+#include "swdllapi.h"
+#include "fldbas.hxx"
+
+class SfxPoolItem;
+class SwCalc;
+class SwDoc;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Benutzerfelder
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwUserFieldType : public SwValueFieldType
+{
+ sal_Bool bValidValue : 1;
+ sal_Bool bDeleted : 1;
+ double nValue;
+ String aName;
+ String aContent;
+ sal_uInt16 nType;
+
+public:
+ SwUserFieldType( SwDoc* pDocPtr, const String& );
+
+ virtual const String& GetName() const;
+ virtual SwFieldType* Copy() const;
+
+ String Expand(sal_uInt32 nFmt, sal_uInt16 nSubType, sal_uInt16 nLng);
+
+ String GetContent( sal_uInt32 nFmt = 0 );
+ void SetContent( const String& rStr, sal_uInt32 nFmt = 0 );
+
+ inline sal_Bool IsValid() const;
+ inline void ChgValid( sal_Bool bNew );
+
+ double GetValue(SwCalc& rCalc); // Member nValue neu berrechnen
+ inline double GetValue() const;
+ inline void SetValue(const double nVal);
+
+ inline sal_uInt16 GetType() const;
+ inline void SetType(sal_uInt16);
+
+ sal_Bool IsDeleted() const { return bDeleted; }
+ void SetDeleted( sal_Bool b ) { bDeleted = b; }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nMId ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nMId );
+
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
+};
+
+inline sal_Bool SwUserFieldType::IsValid() const
+ { return bValidValue; }
+
+inline void SwUserFieldType::ChgValid( sal_Bool bNew )
+ { bValidValue = bNew; }
+
+inline double SwUserFieldType::GetValue() const
+ { return nValue; }
+
+inline void SwUserFieldType::SetValue(const double nVal)
+ { nValue = nVal; }
+
+inline sal_uInt16 SwUserFieldType::GetType() const
+ { return nType; }
+
+inline void SwUserFieldType::SetType(sal_uInt16 nSub)
+{
+ nType = nSub;
+ EnableFormat(!(nSub & nsSwGetSetExpType::GSE_STRING));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Benutzerfelder
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwUserField : public SwValueField
+{
+ sal_uInt16 nSubType;
+
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
+
+public:
+ SwUserField(SwUserFieldType*, sal_uInt16 nSub = 0, sal_uInt32 nFmt = 0);
+
+ virtual sal_uInt16 GetSubType() const;
+ virtual void SetSubType(sal_uInt16 nSub);
+
+ virtual double GetValue() const;
+ virtual void SetValue( const double& rVal );
+
+ virtual String GetFieldName() const;
+
+ // Name kann nicht geaendert werden
+ virtual const String& GetPar1() const;
+
+ // Inhalt
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId );
+};
+
+#endif // SW_USRFLD_HXX
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
new file mode 100644
index 000000000000..c290f1ed9c99
--- /dev/null
+++ b/sw/inc/viewopt.hxx
@@ -0,0 +1,615 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _VIEWOPT_HXX
+#define _VIEWOPT_HXX
+#include <tools/gen.hxx>
+#include <tools/string.hxx>
+#include <tools/color.hxx>
+
+#include <svx/zoomitem.hxx>
+#include "swdllapi.h"
+#include "authratr.hxx"
+
+class SwRect;
+class Window;
+class OutputDevice;
+class ViewShell;
+class SwDocShell;
+namespace svtools{ class ColorConfig;}
+
+//#define VIEWOPT_1_IDLE 0x00000001L no longer used, see new member 'bIdle'
+#define VIEWOPT_1_TAB 0x00000002L
+#define VIEWOPT_1_BLANK 0x00000004L
+#define VIEWOPT_1_HARDBLANK 0x00000008L
+#define VIEWOPT_1_PARAGRAPH 0x00000010L
+#define VIEWOPT_1_LINEBREAK 0x00000020L
+#define VIEWOPT_1_PAGEBREAK 0x00000040L
+#define VIEWOPT_1_COLUMNBREAK 0x00000080L
+#define VIEWOPT_1_SOFTHYPH 0x00000100L
+
+#define VIEWOPT_1_REF 0x00000400L
+#define VIEWOPT_1_FLDNAME 0x00000800L
+//#define 0x00001000L
+//#define 0x00002000L
+#define VIEWOPT_1_POSTITS 0x00004000L
+#define VIEWOPT_1_FLD_HIDDEN 0x00008000L
+#define VIEWOPT_1_CHAR_HIDDEN 0x00010000L
+#define VIEWOPT_1_GRAPHIC 0x00020000L
+#define VIEWOPT_1_TABLE 0x00040000L
+#define VIEWOPT_1_DRAW 0x00080000L
+#define VIEWOPT_1_CONTROL 0x00100000L
+//#define 0x00200000L
+#define VIEWOPT_1_CROSSHAIR 0x00400000L
+#define VIEWOPT_1_SNAP 0x00800000L
+#define VIEWOPT_1_SYNCHRONIZE 0x01000000L
+#define VIEWOPT_1_GRIDVISIBLE 0x02000000L
+#define VIEWOPT_1_ONLINESPELL 0x04000000L
+//#define VIEWOPT_1_HIDESPELL 0x08000000L /* removed #i91949 */
+#define VIEWOPT_1_RESERVED1 0x10000000L
+#define VIEWOPT_1_VIEWMETACHARS 0x20000000L
+#define VIEWOPT_1_PAGEBACK 0x40000000L
+#define VIEWOPT_1_SOLIDMARKHDL 0x80000000L
+
+#define VIEWOPT_CORE2_BLACKFONT 0x00000001L
+#define VIEWOPT_CORE2_HIDDENPARA 0x00000002L
+#define VIEWOPT_CORE2_SMOOTHSCROLL 0x00000004L
+#define VIEWOPT_CORE2_CRSR_IN_PROT 0x00000008L
+#define VIEWOPT_CORE2_PDF_EXPORT 0x00000010L
+#define VIEWOPT_CORE2_PRINTING 0x00000020L
+#define VIEWOPT_CORE2_BIGMARKHDL 0x00000040L
+
+#define VIEWOPT_2_UNUSED1 0x00000100L
+#define VIEWOPT_2_UNUSED2 0x00000200L
+#define VIEWOPT_2_H_RULER 0x00000400L
+#define VIEWOPT_2_VSCROLLBAR 0x00000800L
+#define VIEWOPT_2_HSCROLLBAR 0x00001000L
+#define VIEWOPT_2_STATUSLINE 0x00002000L
+#define VIEWOPT_2_V_RULER 0x00004000L
+#define VIEWOPT_2_ANY_RULER 0x00008000L
+#define VIEWOPT_2_MODIFIED 0x00010000L
+#define VIEWOPT_2_KEEPASPECTRATIO 0x00020000L
+#define VIEWOPT_2_GRFKEEPZOOM 0x00040000L
+#define VIEWOPT_2_PREVENT_TIPS 0x00100000L
+#define VIEWOPT_2_RESERVED3 0x00200000L
+#define VIEWOPT_2_RESERVED4 0x00400000L
+#define VIEWOPT_2_PRTFORMAT 0x00800000L
+#define VIEWOPT_2_SHADOWCRSR 0x01000000L
+#define VIEWOPT_2_V_RULER_RIGHT 0x02000000L
+
+//Tabellenhintergrund
+#define TBL_DEST_CELL 0
+#define TBL_DEST_ROW 1
+#define TBL_DEST_TBL 2
+
+//Appearance flags
+#define VIEWOPT_DOC_BOUNDARIES 0x0001
+#define VIEWOPT_OBJECT_BOUNDARIES 0x0002
+#define VIEWOPT_TABLE_BOUNDARIES 0x0004
+#define VIEWOPT_INDEX_SHADINGS 0x0008
+#define VIEWOPT_LINKS 0x0010
+#define VIEWOPT_VISITED_LINKS 0x0020
+#define VIEWOPT_FIELD_SHADINGS 0x0040
+#define VIEWOPT_SECTION_BOUNDARIES 0x0080
+
+// Implementierung in core/text/txtpaint.cxx
+extern void SyncVout( const OutputDevice *pOut );
+
+class SwViewOption
+{
+ static Color aDocColor; // color of document boundaries
+ static Color aDocBoundColor; // color of document boundaries
+ static Color aObjectBoundColor; // color of object boundaries
+ static Color aAppBackgroundColor; // application background
+ static Color aTableBoundColor; // color of table boundaries
+ static Color aFontColor;
+ static Color aIndexShadingsColor; // background color of indexes
+ static Color aLinksColor;
+ static Color aVisitedLinksColor;
+ static Color aDirectCursorColor;
+ static Color aTextGridColor;
+ static Color aSpellColor; // mark color of online spell checking
+ static Color aSmarttagColor;
+ static Color aFieldShadingsColor;
+ static Color aSectionBoundColor;
+ static Color aPageBreakColor;
+ static Color aScriptIndicatorColor;
+
+ static sal_Int32 nAppearanceFlags; //
+protected:
+ static sal_uInt16 nPixelTwips;// 1 Pixel == ? Twips
+
+ String sSymbolFont; // Symbolzeichensatz
+ sal_uInt32 nCoreOptions; // Bits fuer die ViewShell
+ sal_uInt32 nCore2Options; // Bits fuer die ViewShell
+ sal_uInt32 nUIOptions; // UI-Bits
+ Color aRetoucheColor; // DefaultBackground fuer BrowseView
+ Size aSnapSize; // Beschreibt hori. wie vert. Snap
+ sal_uInt16 mnViewLayoutColumns;// # columns for edit view
+ short nDivisionX; // Rasterunterteilung
+ short nDivisionY;
+ sal_uInt8 nPagePrevRow; // Page Preview Row/Columns
+ sal_uInt8 nPagePrevCol; // Page Preview Row/Columns
+ sal_uInt8 nShdwCrsrFillMode; // FillMode fuer den ShadowCrsr
+ sal_Bool bReadonly : 1; // Readonly-Doc
+ sal_Bool bStarOneSetting : 1;// prevent from UI automatics (no scrollbars in readonly documents)
+ sal_Bool bIsPagePreview : 1; // the preview mustn't print field/footnote/... shadings
+ sal_Bool bSelectionInReadonly : 1; //determines whether selection is switched on in readonly documents
+ sal_Bool mbFormView : 1;
+ sal_Bool mbBrowseMode : 1; //swmod 080130
+ sal_Bool mbBookView : 1; // view mode for page preview
+ sal_Bool mbViewLayoutBookMode : 1; // book view mode for edit view
+ sal_Bool bShowPlaceHolderFields : 1; //only used in printing!
+ mutable bool bIdle;
+
+ // Maszstab
+ sal_uInt16 nZoom; // Angaben in Prozent
+ SvxZoomType eZoom; // 'enum' fuer Zoom
+
+ sal_uInt8 nTblDest; // Ziel fuer Tabellenhintergrund
+
+#ifdef DBG_UTIL
+ // korrespondieren zu den Angaben in ui/config/cfgvw.src
+ sal_Bool bTest1 :1; // Test-Flag "Layout not loading"
+ sal_Bool bTest2 :1; // Test-Flag "WYSIWYG++"
+ sal_Bool bTest3 :1; // Test-Flag ""
+ sal_Bool bTest4 :1; // Test-Flag "WYSIWYG debug"
+ sal_Bool bTest5 :1; // Test-Flag "No idle format"
+ sal_Bool bTest6 :1; // Test-Flag "No screen adj"
+ sal_Bool bTest7 :1; // Test-Flag "win format"
+ sal_Bool bTest8 :1; // Test-Flag ""
+ static sal_Bool bTest9; // Test-Flag "DrawingLayerNotLoading"
+ sal_Bool bTest10 :1; // Test-Flag "Format by Input"
+#endif
+
+public:
+ SwViewOption(); // CTOR
+ SwViewOption(const SwViewOption&); //
+ ~SwViewOption(); //
+
+ void Init( Window *pWin ); // Initialisierung der statischen Daten
+
+ sal_uInt16 GetPixelTwips() const { return nPixelTwips; }
+
+ inline sal_uInt32 GetCoreOptions() const {return nCoreOptions;}
+ inline void SetUIOptions( const SwViewOption& );
+
+/*---------------------------------------------------------------------------
+ Optionen aus nCoreOptions
+----------------------------------------------------------------------------*/
+
+ inline sal_Bool IsIdle() const
+ { return bIdle; }
+
+ // logically this is a const function since it does not modify the viewoptions
+ // but only effects idle formatting. Of course that member is already implement
+ // in the wrong place here... Also currently there are many const modifying casts in the code
+ // just to call this function on otherwise const objects. Thus declaring it as const now.
+ inline void SetIdle( sal_Bool b ) const
+ { bIdle = b; }
+
+ inline sal_Bool IsTab(sal_Bool bHard = sal_False) const
+ { return !bReadonly && (nCoreOptions & VIEWOPT_1_TAB) &&
+ ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
+ ? sal_True : sal_False; }
+ inline void SetTab( sal_Bool b ) {
+ (b != 0) ? (nCoreOptions |= VIEWOPT_1_TAB ) : ( nCoreOptions &= ~VIEWOPT_1_TAB); }
+
+ inline sal_Bool IsBlank(sal_Bool bHard = sal_False) const
+ { return !bReadonly && (nCoreOptions & VIEWOPT_1_BLANK) &&
+ ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
+ ? sal_True : sal_False; }
+ inline void SetBlank( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_BLANK ) : ( nCoreOptions &= ~VIEWOPT_1_BLANK); }
+
+ inline sal_Bool IsHardBlank() const
+ { return !bReadonly && nCoreOptions & VIEWOPT_1_HARDBLANK ? sal_True : sal_False; }
+ inline void SetHardBlank( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_HARDBLANK ) : ( nCoreOptions &= ~VIEWOPT_1_HARDBLANK); }
+
+ inline sal_Bool IsParagraph(sal_Bool bHard = sal_False) const
+ { return !bReadonly && (nCoreOptions & VIEWOPT_1_PARAGRAPH) &&
+ ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
+ ? sal_True : sal_False; }
+ inline void SetParagraph( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_PARAGRAPH ) : ( nCoreOptions &= ~VIEWOPT_1_PARAGRAPH); }
+
+ inline sal_Bool IsLineBreak(sal_Bool bHard = sal_False) const
+ { return !bReadonly && (nCoreOptions & VIEWOPT_1_LINEBREAK) &&
+ ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
+ ? sal_True : sal_False; }
+ inline void SetLineBreak( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_LINEBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_LINEBREAK); }
+
+ inline void SetPageBreak( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_PAGEBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_PAGEBREAK); }
+
+ inline void SetColumnBreak( sal_Bool b)
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_COLUMNBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_COLUMNBREAK); }
+
+ inline sal_Bool IsSoftHyph() const
+ { return !bReadonly && (nCoreOptions & VIEWOPT_1_SOFTHYPH) ? sal_True : sal_False; }
+ inline void SetSoftHyph( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_SOFTHYPH ) : ( nCoreOptions &= ~VIEWOPT_1_SOFTHYPH); }
+
+ inline sal_Bool IsFldName() const { return !bReadonly && (nCoreOptions & VIEWOPT_1_FLDNAME) ? sal_True : sal_False; }
+ inline void SetFldName( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_FLDNAME ) : ( nCoreOptions &= ~VIEWOPT_1_FLDNAME); }
+
+ inline sal_Bool IsPostIts() const
+ { return (nCoreOptions & VIEWOPT_1_POSTITS) ? sal_True : sal_False; }
+ inline void SetPostIts( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_POSTITS ) : ( nCoreOptions &= ~VIEWOPT_1_POSTITS); }
+ void PaintPostIts( OutputDevice *pOut, const SwRect &rRect,
+ sal_Bool bIsScript ) const;
+ sal_uInt16 GetPostItsWidth( const OutputDevice *pOut = 0 ) const;
+
+ inline sal_Bool IsShowHiddenChar(sal_Bool bHard = sal_False) const
+ { return !bReadonly && (nCoreOptions & VIEWOPT_1_CHAR_HIDDEN) &&
+ ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
+ ? sal_True : sal_False; }
+
+ inline void SetShowHiddenChar( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_CHAR_HIDDEN ) : ( nCoreOptions &= ~VIEWOPT_1_CHAR_HIDDEN); }
+
+
+ inline sal_Bool IsShowHiddenField() const
+ { return !bReadonly && (nCoreOptions & VIEWOPT_1_FLD_HIDDEN) ? sal_True : sal_False; }
+ inline void SetShowHiddenField( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_FLD_HIDDEN ) : ( nCoreOptions &= ~VIEWOPT_1_FLD_HIDDEN); }
+
+ inline sal_Bool IsGraphic() const
+ { return nCoreOptions & VIEWOPT_1_GRAPHIC ? sal_True : sal_False; }
+ inline void SetGraphic( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_GRAPHIC ) : ( nCoreOptions &= ~VIEWOPT_1_GRAPHIC); }
+
+ inline sal_Bool IsPageBack() const
+ { return nCoreOptions & VIEWOPT_1_PAGEBACK ? sal_True : sal_False; }
+ inline void SetPageBack( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_PAGEBACK) : ( nCoreOptions &= ~VIEWOPT_1_PAGEBACK); }
+
+ inline sal_Bool IsSolidMarkHdl() const
+ { return nCoreOptions & VIEWOPT_1_SOLIDMARKHDL ? sal_True : sal_False; }
+ inline void SetSolidMarkHdl( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_SOLIDMARKHDL) : ( nCoreOptions &= ~VIEWOPT_1_SOLIDMARKHDL); }
+
+ inline sal_Bool IsBigMarkHdl() const
+ { return nCore2Options & VIEWOPT_CORE2_BIGMARKHDL ? sal_True : sal_False;}
+ inline void SetBigMarkHdl(sal_Bool b)
+ { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_BIGMARKHDL ) : (nCore2Options &= ~VIEWOPT_CORE2_BIGMARKHDL);}
+
+ inline sal_Bool IsTable() const
+ { return nCoreOptions & VIEWOPT_1_TABLE ? sal_True : sal_False; }
+ inline void SetTable( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_TABLE ) : ( nCoreOptions &= ~VIEWOPT_1_TABLE); }
+
+ inline sal_Bool IsDraw() const
+ { return nCoreOptions & VIEWOPT_1_DRAW ? sal_True : sal_False; }
+ inline void SetDraw( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_DRAW ) : ( nCoreOptions &= ~VIEWOPT_1_DRAW); }
+
+ inline sal_Bool IsControl() const
+ { return nCoreOptions & VIEWOPT_1_CONTROL ? sal_True : sal_False; }
+ inline void SetControl( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_CONTROL ) : ( nCoreOptions &= ~VIEWOPT_1_CONTROL); }
+
+ inline sal_Bool IsSnap() const
+ { return nCoreOptions & VIEWOPT_1_SNAP ? sal_True : sal_False; }
+ inline void SetSnap( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_SNAP ) : ( nCoreOptions &= ~VIEWOPT_1_SNAP); }
+
+ inline void SetSnapSize( Size &rSz ){ aSnapSize = rSz; }
+ inline const Size &GetSnapSize() const { return aSnapSize; }
+
+ inline sal_Bool IsGridVisible() const
+ { return !bReadonly && (nCoreOptions & VIEWOPT_1_GRIDVISIBLE) ? sal_True : sal_False; }
+ inline void SetGridVisible( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_GRIDVISIBLE ) : ( nCoreOptions &= ~VIEWOPT_1_GRIDVISIBLE); }
+
+ inline sal_Bool IsOnlineSpell() const
+ { return !bReadonly && (nCoreOptions & VIEWOPT_1_ONLINESPELL) ? sal_True : sal_False; }
+ inline void SetOnlineSpell( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_ONLINESPELL ) : ( nCoreOptions &= ~VIEWOPT_1_ONLINESPELL); }
+
+ inline sal_Bool IsViewMetaChars() const
+ { return !bReadonly && (nCoreOptions & VIEWOPT_1_VIEWMETACHARS) ? sal_True : sal_False; }
+ inline void SetViewMetaChars( sal_Bool b)
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_VIEWMETACHARS ) : ( nCoreOptions &= ~VIEWOPT_1_VIEWMETACHARS); }
+
+ inline sal_Bool IsSynchronize() const
+ { return nCoreOptions & VIEWOPT_1_SYNCHRONIZE ? sal_True : sal_False;}
+ inline void SetSynchronize( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_SYNCHRONIZE ) : ( nCoreOptions &= ~VIEWOPT_1_SYNCHRONIZE); }
+
+ inline sal_Bool IsCrossHair() const
+ { return nCoreOptions & VIEWOPT_1_CROSSHAIR ? sal_True : sal_False; }
+ inline void SetCrossHair( sal_Bool b )
+ { (b != 0) ? (nCoreOptions |= VIEWOPT_1_CROSSHAIR ) : ( nCoreOptions &= ~VIEWOPT_1_CROSSHAIR); }
+
+/*---------------------------------------------------------------------------
+ Optionen aus nCore2Options
+----------------------------------------------------------------------------*/
+ inline sal_Bool IsBlackFont() const
+ {return nCore2Options & VIEWOPT_CORE2_BLACKFONT ? sal_True : sal_False;}
+
+ inline void SetBlackFont(sal_Bool b)
+ { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_BLACKFONT) : (nCore2Options &= ~VIEWOPT_CORE2_BLACKFONT);}
+
+ inline sal_Bool IsShowHiddenPara() const
+ {return nCore2Options & VIEWOPT_CORE2_HIDDENPARA ? sal_True : sal_False;}
+
+ inline void SetShowHiddenPara(sal_Bool b)
+ { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_HIDDENPARA) : (nCore2Options &= ~VIEWOPT_CORE2_HIDDENPARA);}
+
+ inline sal_Bool IsSmoothScroll() const
+ {return nCore2Options & VIEWOPT_CORE2_SMOOTHSCROLL ? sal_True : sal_False;}
+
+ inline void SetSmoothScroll(sal_Bool b)
+ { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_SMOOTHSCROLL) : (nCore2Options &= ~VIEWOPT_CORE2_SMOOTHSCROLL);}
+
+ inline sal_Bool IsCursorInProtectedArea() const
+ {return nCore2Options & VIEWOPT_CORE2_CRSR_IN_PROT ? sal_True : sal_False;}
+
+ inline void SetCursorInProtectedArea(sal_Bool b)
+ { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_CRSR_IN_PROT) : (nCore2Options &= ~VIEWOPT_CORE2_CRSR_IN_PROT);}
+
+ inline sal_Bool IsPDFExport() const
+ {return nCore2Options & VIEWOPT_CORE2_PDF_EXPORT ? sal_True : sal_False;}
+
+ inline void SetPDFExport(sal_Bool b)
+ { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_PDF_EXPORT) : (nCore2Options &= ~VIEWOPT_CORE2_PDF_EXPORT);}
+
+ inline sal_Bool IsPrinting() const
+ {return nCore2Options & VIEWOPT_CORE2_PRINTING ? sal_True : sal_False;}
+
+ inline void SetPrinting(sal_Bool b)
+ { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_PRINTING) : (nCore2Options &= ~VIEWOPT_CORE2_PRINTING);}
+
+/*---------------------------------------------------------------------------
+
+----------------------------------------------------------------------------*/
+
+
+ inline short GetDivisionX() const { return nDivisionX; }
+ inline void SetDivisionX( short n ){ nDivisionX = n; }
+ inline short GetDivisionY() const { return nDivisionY; }
+ inline void SetDivisionY( short n ){ nDivisionY = n; }
+
+ inline sal_uInt8 GetPagePrevRow() const { return nPagePrevRow; }
+ inline void SetPagePrevRow( sal_uInt8 n ) { nPagePrevRow = n; }
+ inline sal_uInt8 GetPagePrevCol() const { return nPagePrevCol; }
+ inline void SetPagePrevCol( sal_uInt8 n ) { nPagePrevCol = n; }
+ sal_Bool IsReadonly() const { return bReadonly; }
+ void SetReadonly(sal_Bool bSet) { bReadonly = bSet; }
+
+ sal_Bool IsSelectionInReadonly() const {return bSelectionInReadonly;}
+ void SetSelectionInReadonly(sal_Bool bSet) {bSelectionInReadonly = bSet;}
+
+ sal_Bool IsFormView() const { return mbFormView; }
+ void SetFormView( sal_Bool bSet ) { mbFormView = bSet; }
+ // <--
+
+ inline sal_Bool getBrowseMode() const { return mbBrowseMode; }
+ inline void setBrowseMode(sal_Bool bSet) { mbBrowseMode = bSet; }
+ inline sal_Bool IsPagePrevBookview() const { return mbBookView; }
+ inline void SetPagePrevBookview(sal_Bool bSet) { mbBookView = bSet; }
+
+ sal_Bool IsAutoCompleteWords() const;
+
+ // PAGES01
+ bool IsViewLayoutBookMode() const { return mbViewLayoutBookMode; }
+ void SetViewLayoutBookMode( bool bNew ) { mbViewLayoutBookMode = bNew; }
+ sal_uInt16 GetViewLayoutColumns() const { return mnViewLayoutColumns; }
+ void SetViewLayoutColumns( sal_uInt16 nNew ) { mnViewLayoutColumns = nNew; }
+
+#ifdef DBG_UTIL
+ // korrespondieren zu den Angaben in ui/config/cfgvw.src
+ inline sal_Bool IsTest1() const { return bTest1; }
+ inline void SetTest1( sal_Bool b ) { bTest1 = b; }
+ inline sal_Bool IsTest2() const { return bTest2; }
+ inline void SetTest2( sal_Bool b ) { bTest2 = b; }
+ inline sal_Bool IsTest3() const { return bTest3; }
+ inline void SetTest3( sal_Bool b ) { bTest3 = b; }
+ inline sal_Bool IsTest4() const { return bTest4; }
+ inline void SetTest4( sal_Bool b ) { bTest4 = b; }
+ inline sal_Bool IsTest5() const { return bTest5; }
+ inline void SetTest5( sal_Bool b ) { bTest5 = b; }
+ inline sal_Bool IsTest6() const { return bTest6; }
+ inline void SetTest6( sal_Bool b ) { bTest6 = b; }
+ inline sal_Bool IsTest7() const { return bTest7; }
+ inline void SetTest7( sal_Bool b ) { bTest7 = b; }
+ inline sal_Bool IsTest8() const { return bTest8; }
+ inline void SetTest8( sal_Bool b ) { bTest8 = b; }
+ static inline sal_Bool IsTest9() { return bTest9; }
+ static inline void SetTest9( sal_Bool b ) { bTest9 = b; }
+ inline sal_Bool IsTest10() const { return bTest10; }
+ inline void SetTest10( sal_Bool b ) { bTest10 = b; }
+#endif
+
+ inline sal_uInt16 GetZoom() const { return nZoom; }
+ inline void SetZoom( sal_uInt16 n ){ nZoom = n; }
+
+ void DrawRect( OutputDevice* pOut, const SwRect &rRect, long nCol ) const;
+ void DrawRectPrinter( OutputDevice* pOut, const SwRect& rRect ) const;
+
+ SwViewOption& operator=( const SwViewOption &rOpt );
+ // Vergleichsmethoden
+ sal_Bool IsEqualFlags ( const SwViewOption &rOpt ) const;
+ inline sal_Bool operator == ( const SwViewOption &rOpt ) const;
+ inline sal_Bool operator != ( const SwViewOption &rOpt ) const { return !(*this == rOpt); }
+
+
+/*---------------------------------------------------------------------------
+ Optionen aus nUIOptions
+----------------------------------------------------------------------------*/
+
+ sal_Bool IsViewVScrollBar() const
+ { return nUIOptions & VIEWOPT_2_VSCROLLBAR ? sal_True : sal_False; }
+ sal_Bool IsViewHScrollBar() const
+ { return nUIOptions & VIEWOPT_2_HSCROLLBAR ? sal_True : sal_False; }
+ sal_Bool IsKeepRatio() const
+ { return nUIOptions & VIEWOPT_2_KEEPASPECTRATIO ? sal_True : sal_False; }
+ sal_Bool IsGrfKeepZoom() const
+ { return nUIOptions & VIEWOPT_2_GRFKEEPZOOM ? sal_True : sal_False; }
+ sal_Bool IsPreventTips() const
+ { return nUIOptions & VIEWOPT_2_PREVENT_TIPS ? sal_True : sal_False; }
+ sal_Bool IsPrtFormat() const
+ { return nUIOptions & VIEWOPT_2_PRTFORMAT ? sal_True : sal_False; }
+
+ SvxZoomType GetZoomType() const { return eZoom; }
+
+ sal_uInt8 GetTblDest() const { return nTblDest; }
+
+ void SetViewVScrollBar(sal_Bool b)
+ { b ? (nUIOptions |= VIEWOPT_2_VSCROLLBAR ) : ( nUIOptions &= ~VIEWOPT_2_VSCROLLBAR); }
+ void SetViewHScrollBar(sal_Bool b)
+ { b ? (nUIOptions |= VIEWOPT_2_HSCROLLBAR ) : ( nUIOptions &= ~VIEWOPT_2_HSCROLLBAR); }
+ void SetKeepRatio (sal_Bool b)
+ { b ? (nUIOptions |= VIEWOPT_2_KEEPASPECTRATIO ) : ( nUIOptions &= ~VIEWOPT_2_KEEPASPECTRATIO); }
+ void SetGrfKeepZoom (sal_Bool b)
+ { b ? (nUIOptions |= VIEWOPT_2_GRFKEEPZOOM ) : ( nUIOptions &= ~VIEWOPT_2_GRFKEEPZOOM); }
+ void SetPreventTips( sal_Bool b)
+ { b ? (nUIOptions |= VIEWOPT_2_PREVENT_TIPS) : (nUIOptions &= ~VIEWOPT_2_PREVENT_TIPS); }
+ void SetPrtFormat( sal_Bool b)
+ { b ? (nUIOptions |= VIEWOPT_2_PRTFORMAT) : (nUIOptions &= ~VIEWOPT_2_PRTFORMAT); }
+
+ void SetZoomType (SvxZoomType eZoom_){ eZoom = eZoom_; }
+ void SetTblDest( sal_uInt8 nNew ) { nTblDest = nNew; }
+
+ const String& GetSymbolFont() const {return sSymbolFont;}
+ void SetSymbolFont(const String& sSet) {sSymbolFont = sSet;}
+
+ const Color& GetRetoucheColor() const { return aRetoucheColor;}
+ void SetRetoucheColor(const Color&r) { aRetoucheColor = r; }
+
+ sal_Bool IsViewAnyRuler() const {return 0 != (nUIOptions & VIEWOPT_2_ANY_RULER);}
+ void SetViewAnyRuler(sal_Bool bSet)
+ { bSet ? (nUIOptions |= VIEWOPT_2_ANY_RULER) : (nUIOptions &= ~VIEWOPT_2_ANY_RULER);}
+
+ sal_Bool IsViewHRuler(sal_Bool bDirect = sal_False) const
+ {
+ sal_Bool bRet = sal::static_int_cast< sal_Bool >( bDirect ?
+ 0 != (nUIOptions & VIEWOPT_2_H_RULER) :
+ !bReadonly ?
+ (nUIOptions & (VIEWOPT_2_ANY_RULER|VIEWOPT_2_H_RULER)) == (VIEWOPT_2_ANY_RULER|VIEWOPT_2_H_RULER)
+ : sal_False );
+ return bRet;
+
+ }
+ void SetViewHRuler (sal_Bool b)
+ { b ? (nUIOptions |= VIEWOPT_2_H_RULER ) : ( nUIOptions &= ~VIEWOPT_2_H_RULER);}
+
+ sal_Bool IsViewVRuler(sal_Bool bDirect = sal_False) const
+ {
+ sal_Bool bRet = sal::static_int_cast< sal_Bool >( bDirect ?
+ 0 !=(nUIOptions & VIEWOPT_2_V_RULER) :
+ !bReadonly ?
+ (nUIOptions &
+ (VIEWOPT_2_ANY_RULER|VIEWOPT_2_V_RULER)) == (VIEWOPT_2_ANY_RULER|VIEWOPT_2_V_RULER)
+ : sal_False );
+ return bRet;
+ }
+ void SetViewVRuler (sal_Bool b)
+ { b ? (nUIOptions |= VIEWOPT_2_V_RULER ) : ( nUIOptions &= ~VIEWOPT_2_V_RULER);}
+
+ // ShadowCursor ein schalten/abfragen/Farbe setzen/Modus setzen
+ sal_Bool IsShadowCursor() const
+ { return nUIOptions & VIEWOPT_2_SHADOWCRSR ? sal_True : sal_False; }
+ void SetShadowCursor(sal_Bool b)
+ { b ? (nUIOptions |= VIEWOPT_2_SHADOWCRSR ) : ( nUIOptions &= ~VIEWOPT_2_SHADOWCRSR); }
+
+ //move vertical ruler to the right
+ sal_Bool IsVRulerRight() const
+ { return nUIOptions & VIEWOPT_2_V_RULER_RIGHT ? sal_True : sal_False; }
+ void SetVRulerRight(sal_Bool b)
+ { b ? (nUIOptions |= VIEWOPT_2_V_RULER_RIGHT ) : ( nUIOptions &= ~VIEWOPT_2_V_RULER_RIGHT); }
+
+ sal_Bool IsStarOneSetting() const {return bStarOneSetting; }
+ void SetStarOneSetting(sal_Bool bSet) {bStarOneSetting = bSet; }
+
+ sal_Bool IsPagePreview() const {return bIsPagePreview; }
+ void SetPagePreview(sal_Bool bSet) { bIsPagePreview= bSet; }
+
+ sal_uInt8 GetShdwCrsrFillMode() const { return nShdwCrsrFillMode; }
+ void SetShdwCrsrFillMode( sal_uInt8 nMode ) { nShdwCrsrFillMode = nMode; };
+
+ sal_Bool IsShowPlaceHolderFields() const { return bShowPlaceHolderFields; }
+ void SetShowPlaceHolderFields(sal_Bool bSet) { bShowPlaceHolderFields = bSet; }
+
+ static Color& GetDocColor();
+ static Color& GetDocBoundariesColor();
+ static Color& GetAppBackgroundColor();
+ static Color& GetObjectBoundariesColor();
+ static Color& GetTableBoundariesColor();
+ static Color& GetIndexShadingsColor();
+ static Color& GetLinksColor();
+ static Color& GetVisitedLinksColor();
+ static Color& GetDirectCursorColor();
+ static Color& GetTextGridColor();
+ static Color& GetSpellColor();
+ static Color& GetSmarttagColor();
+ SW_DLLPUBLIC static Color& GetFontColor();
+ static Color& GetFieldShadingsColor();
+ static Color& GetSectionBoundColor();
+ static Color& GetPageBreakColor();
+
+ static sal_Bool IsAppearanceFlag(sal_Int32 nFlag);
+
+ static sal_Bool IsDocBoundaries() {return IsAppearanceFlag(VIEWOPT_DOC_BOUNDARIES);}
+ static sal_Bool IsObjectBoundaries(){return IsAppearanceFlag(VIEWOPT_OBJECT_BOUNDARIES);}
+ static sal_Bool IsTableBoundaries() {return IsAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES );}
+ static sal_Bool IsIndexShadings() {return IsAppearanceFlag(VIEWOPT_INDEX_SHADINGS );}
+ static sal_Bool IsLinks() {return IsAppearanceFlag(VIEWOPT_LINKS );}
+ static sal_Bool IsVisitedLinks() {return IsAppearanceFlag(VIEWOPT_VISITED_LINKS );}
+ static sal_Bool IsFieldShadings() {return IsAppearanceFlag(VIEWOPT_FIELD_SHADINGS);}
+ static sal_Bool IsSectionBoundaries() {return IsAppearanceFlag(VIEWOPT_SECTION_BOUNDARIES);}
+
+ static void SetAppearanceFlag(sal_Int32 nFlag, sal_Bool bSet, sal_Bool bSaveInConfig = sal_False);
+
+ void SetDocBoundaries(sal_Bool bSet) {SetAppearanceFlag(VIEWOPT_DOC_BOUNDARIES, bSet);}
+
+ static void ApplyColorConfigValues(const svtools::ColorConfig& rConfig);
+};
+
+
+inline sal_Bool SwViewOption::operator==( const SwViewOption &rOpt ) const
+{
+ return IsEqualFlags( rOpt ) && nZoom == rOpt.GetZoom();
+}
+
+inline void SwViewOption::SetUIOptions( const SwViewOption& rVOpt )
+{
+ nUIOptions = rVOpt.nUIOptions;
+ nTblDest = rVOpt.nTblDest;
+ nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
+}
+
+
+// Hilfsfunktion zur Ermittlung der HTML-Faehigkeiten
+SW_DLLPUBLIC sal_uInt16 GetHtmlMode(const SwDocShell*);
+
+
+#endif
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
new file mode 100644
index 000000000000..2daf85092b40
--- /dev/null
+++ b/sw/inc/viewsh.hxx
@@ -0,0 +1,645 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VIEWSH_HXX
+#define SW_VIEWSH_HXX
+
+#include <com/sun/star/embed/XClassifiedObject.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <tools/rtti.hxx>
+#include <svl/svarray.hxx>
+#include "swdllapi.h"
+#include <swtypes.hxx>
+#include <ring.hxx>
+#include <swrect.hxx>
+#include <errhdl.hxx>
+#include <boost/shared_ptr.hpp>// swmod 080115
+#include <vcl/mapmod.hxx>
+#include <vcl/print.hxx>
+
+namespace com { namespace sun { namespace star { namespace accessibility {
+ class XAccessible; } } } }
+
+class SfxObjectShellRef;
+class SwDoc;
+class IDocumentSettingAccess;
+class IDocumentDeviceAccess;
+class IDocumentMarkAccess;
+class IDocumentDrawModelAccess;
+class IDocumentRedlineAccess;
+class IDocumentLayoutAccess;
+class IDocumentFieldsAccess;
+class IDocumentContentOperations;
+class IDocumentStylePoolAccess;
+class IDocumentStatistics;
+class IDocumentUndoRedo;
+// --> OD 2007-11-14 #i83479#
+class IDocumentListItems;
+class IDocumentOutlineNodes;
+// <--
+class SfxPrinter;
+class SfxProgress;
+class SwRootFrm;
+class SwNodes;
+class SdrView;
+class SfxItemPool;
+class SfxViewShell;
+class SwViewOption;
+class SwViewImp;
+class SwPrintData;
+class SwPagePreViewPrtData;
+class Window;
+class OutputDevice;
+class SwLayIdle;
+struct ShellResource;
+class SwRegionRects;
+class SwFrm;
+class SvtAccessibilityOptions;
+class SwPagePreviewLayout;
+class SwTxtFrm;
+class BitmapEx;
+
+struct SwAccessibilityOptions;
+class Region;
+class SwPostItMgr;
+class SdrPaintWindow;
+class SwAccessibleMap;
+
+namespace vcl
+{
+ class OldStylePrintAdaptor;
+}
+
+
+//JP 19.07.98: - Bug 52312
+// define fuer Flags, die im CTOR oder den darunter liegenden Schichten
+// benoetigt werden.
+// Zur Zeit wird fuer die DrawPage das PreView Flag benoetigt
+#define VSHELLFLAG_ISPREVIEW ((long)0x1)
+#define VSHELLFLAG_SHARELAYOUT ((long)0x2)//swmod 080125 flag
+typedef boost::shared_ptr<SwRootFrm> SwRootFrmPtr;
+
+class SW_DLLPUBLIC ViewShell : public Ring
+{
+ friend void SetOutDev( ViewShell *pSh, OutputDevice *pOut );
+ friend void SetOutDevAndWin( ViewShell *pSh, OutputDevice *pOut,
+ Window *pWin, sal_uInt16 nZoom );
+
+ friend class SwViewImp;
+ friend class SwLayIdle;
+
+ // OD 12.12.2002 #103492# - for setting visible area for page preview paint
+ friend class SwPagePreviewLayout;
+
+ //Umsetzen der SwVisArea, damit vor dem Drucken sauber formatiert
+ //werden kann.
+ friend void SetSwVisArea( ViewShell *pSh, const SwRect &, sal_Bool bPDFExport = sal_False );
+
+ // --> PB 2007-05-30 #146850#
+ static BitmapEx* pReplaceBmp; // replaced display of still loaded images
+ static BitmapEx* pErrorBmp; // error display of missed images
+ // <--
+
+ static sal_Bool bLstAct; // sal_True wenn Das EndAction der letzten Shell
+ // laeuft; also die EndActions der
+ // anderen Shells auf das Dokument
+ // abgearbeitet sind.
+
+ Point aPrtOffst; //Ofst fuer den Printer,
+ //nicht bedruckbarer Rand.
+ Size aBrowseBorder; //Rand fuer Framedokumente
+ SwRect aInvalidRect;
+
+ SfxViewShell *pSfxViewShell;
+ SwViewImp *pImp; //Core-Interna der ViewShell.
+ //Der Pointer ist niemals 0.
+
+ Window *pWin; // = 0 during printing or pdf export
+ OutputDevice *pOut; // Window, Printer, VirtDev, ...
+ OutputDevice* mpTmpRef; // Temporariy reference device. Is used
+ // during (printer depending) prospect
+ // and page preview printing
+ // (because a scaling has to be set at
+ // the original printer)
+
+ SwViewOption *pOpt;
+ SwAccessibilityOptions* pAccOptions;
+
+
+ sal_Bool bDocSizeChgd :1; //Fuer DocChgNotify(): Neue DocGroesse bei
+ //EndAction an das DocMDI melden.
+ sal_Bool bPaintWorks :1; //Normal Painten wenn sal_True,
+ //Paint merken wenn sal_False
+ sal_Bool bPaintInProgress :1; //Kein zweifaches Paint durchlassen.
+ sal_Bool bViewLocked :1; //Lockt den sichtbaren Bereich,
+ //MakeVisible laeuft dann in's leere.
+ sal_Bool bInEndAction :1; //Fiese unstaende vermeiden, siehe viewsh.cxx
+ sal_Bool bPreView :1; //Ist sal_True wenns eine PreView-ViewShell ist.
+ sal_Bool bFrameView :1; //sal_True wenn es ein (HTML-)Frame ist.
+ sal_Bool bEnableSmooth :1; //Disable des SmoothScroll z.B. fuer
+ //Drag der Scrollbars.
+ sal_Bool bEndActionByVirDev:1; //Paints aus der EndAction immer ueber virtuelles
+
+ //Device (etwa beim Browsen)
+
+ // OD 2004-06-01 #i26791# - boolean, indicating that class in in constructor
+ bool mbInConstructor:1;
+
+ // #i74769#
+ SdrPaintWindow* mpTargetPaintWindow;
+ OutputDevice* mpBufferedOut;
+
+ SwRootFrmPtr pLayout; //swmod 080116
+
+ //Initialisierung, wird von den verschiedenen Konstruktoren gerufen.
+ SW_DLLPRIVATE void Init( const SwViewOption *pNewOpt );
+
+ inline void ResetInvalidRect();
+
+ SW_DLLPRIVATE void Reformat(); //Invalidert das ges. Layout (ApplyViewOption)
+
+ SW_DLLPRIVATE void PaintDesktop( const SwRect & ); // sammeln der Werte fuers
+ // Malen der Wiese und rufen
+ // PaintDesktop gesplittet, dieser Teil wird auch von PreViewPage benutzt
+ SW_DLLPRIVATE void _PaintDesktop( const SwRegionRects &rRegion );
+
+ SW_DLLPRIVATE sal_Bool CheckInvalidForPaint( const SwRect & );//Direkt Paint oder lieber
+ //eine Aktion ausloesen.
+
+ SW_DLLPRIVATE void PrepareForPrint( const SwPrintData &rOptions );
+
+ SW_DLLPRIVATE void ImplApplyViewOptions( const SwViewOption &rOpt );
+
+protected:
+ static ShellResource* pShellRes; // Resourcen fuer die Shell
+ static Window* pCareWindow; // diesem Fenster ausweichen
+
+ SwRect aVisArea; //Die moderne Ausfuerung der VisArea
+ SwDoc *pDoc; //Das Dokument, niemals 0
+
+ sal_uInt16 nStartAction; //ist != 0 wenn mindestens eine ::com::sun::star::chaos::Action laeuft
+ sal_uInt16 nLockPaint; //ist != 0 wenn das Paint gelocked ist.
+
+public:
+ TYPEINFO();
+
+ SwViewImp *Imp() { return pImp; }
+ const SwViewImp *Imp() const { return pImp; }
+
+ const SwNodes& GetNodes() const;
+
+ //Nach Druckerwechsel, vom Doc
+ void InitPrt( OutputDevice *pOutDev );
+
+ //Klammerung von zusammengehoerenden Aktionen.
+ inline void StartAction();
+ void ImplStartAction();
+ inline void EndAction( const sal_Bool bIdleEnd = sal_False );
+ void ImplEndAction( const sal_Bool bIdleEnd = sal_False );
+ sal_uInt16 ActionCount() const { return nStartAction; }
+ sal_Bool ActionPend() const { return nStartAction != 0; }
+ sal_Bool IsInEndAction() const { return bInEndAction; }
+
+ void SetEndActionByVirDev( sal_Bool b ) { bEndActionByVirDev = b; }
+ sal_Bool IsEndActionByVirDev() { return bEndActionByVirDev; }
+
+ // Per UNO wird am RootFrame fuer alle shells der ActionCount kurzfristig
+ // auf Null gesetzt und wieder restauriert
+ void SetRestoreActions(sal_uInt16 nSet);
+ sal_uInt16 GetRestoreActions() const;
+
+ inline sal_Bool HasInvalidRect() const { return aInvalidRect.HasArea(); }
+ void ChgHyphenation() { Reformat(); }
+ void ChgNumberDigits();
+
+ sal_Bool AddPaintRect( const SwRect &rRect );
+
+ void InvalidateWindows( const SwRect &rRect );
+
+ //////////////////////////////////////////////////////////////////////////////
+ // #i72754# set of Pre/PostPaints with lock counter and initial target OutDev
+protected:
+ sal_uInt32 mnPrePostPaintCount;
+ OutputDevice* mpPrePostOutDev;
+ MapMode maPrePostMapMode;
+public:
+ void PrePaint();
+ void DLPrePaint2(const Region& rRegion);
+ void DLPostPaint2(bool bPaintFormLayer);
+ const MapMode& getPrePostMapMode() const { return maPrePostMapMode; }
+ //////////////////////////////////////////////////////////////////////////////
+
+ virtual void Paint(const Rectangle &rRect);
+ sal_Bool IsPaintInProgress() const { return bPaintInProgress; }
+ bool IsDrawingLayerPaintInProgress() const { return 0 != mnPrePostPaintCount; }
+
+ //Benachrichtung, dass sich der sichtbare Bereich geaendert hat.
+ //VisArea wird neu gesetzt, anschliessend wird gescrollt.
+ //Das uebergebene Rect liegt auf Pixelgrenzen,
+ //um Pixelfehler beim Scrollen zu vermeiden.
+ virtual void VisPortChgd( const SwRect & );
+ sal_Bool SmoothScroll( long lXDiff, long lYDiff, const Rectangle* );//Browser
+ void EnableSmooth( sal_Bool b ) { bEnableSmooth = b; }
+
+ const SwRect& VisArea() const { return aVisArea; }
+ //Es wird, wenn notwendig, soweit gescrollt, dass das
+ //uebergebene Rect im sichtbaren Ausschnitt liegt.
+ void MakeVisible( const SwRect & );
+
+ //Bei naechster Gelegenheit die neue Dokuemntgroesse an das UI weiterreichen.
+ void SizeChgNotify();
+ void UISizeNotify(); //Das weiterreichen der aktuellen groesse.
+
+ Point GetPagePos( sal_uInt16 nPageNum ) const;
+
+ sal_uInt16 GetNumPages(); //Anzahl der aktuellen Seiten Layout erfragen.
+ sal_Bool IsDummyPage( sal_uInt16 nPageNum ) const; // An empty page?
+
+ //Invalidierung der ersten Sichtbaren Seite fuer alle Shells im Ring.
+ void SetFirstVisPageInvalid();
+
+ SwRootFrm *GetLayout() const;//swmod 080116
+ sal_Bool IsNewLayout() const; //Wurde das Layout geladen oder neu
+ //erzeugt?
+
+ Size GetDocSize() const;// erfrage die Groesse des Dokuments
+
+ void CalcLayout(); //Durchformatierung des Layouts erzwingen.
+
+ sal_uInt16 GetPageCount() const;
+
+ const Size GetPageSize( sal_uInt16 nPageNum, bool bSkipEmptyPages ) const;
+
+ inline SwDoc *GetDoc() const { return pDoc; } //niemals 0.
+
+ /** Provides access to the document setting interface
+ */
+ const IDocumentSettingAccess* getIDocumentSettingAccess() const;
+ IDocumentSettingAccess* getIDocumentSettingAccess();
+
+ /** Provides access to the document device interface
+ */
+ const IDocumentDeviceAccess* getIDocumentDeviceAccess() const;
+ IDocumentDeviceAccess* getIDocumentDeviceAccess();
+
+ /** Provides access to the document bookmark interface
+ */
+ const IDocumentMarkAccess* getIDocumentMarkAccess() const;
+ IDocumentMarkAccess* getIDocumentMarkAccess();
+
+ /** Provides access to the document draw model interface
+ */
+ const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
+ IDocumentDrawModelAccess* getIDocumentDrawModelAccess();
+
+ /** Provides access to the document redline interface
+ */
+ const IDocumentRedlineAccess* getIDocumentRedlineAccess() const;
+ IDocumentRedlineAccess* getIDocumentRedlineAccess();
+
+ /** Provides access to the document layout interface
+ */
+ const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
+ IDocumentLayoutAccess* getIDocumentLayoutAccess();
+
+ /** Provides access to the document fields administration interface
+ */
+ const IDocumentFieldsAccess* getIDocumentFieldsAccess() const;
+
+ /** Provides access to the content operations interface
+ */
+ IDocumentContentOperations* getIDocumentContentOperations();
+
+ /** Provides access to the document style pool interface
+ */
+ IDocumentStylePoolAccess* getIDocumentStylePoolAccess();
+
+ /** Provides access to the document statistics interface
+ */
+ const IDocumentStatistics* getIDocumentStatistics() const;
+
+ /** Provides access to the document undo/redo interface
+ */
+ IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
+ IDocumentUndoRedo & GetIDocumentUndoRedo();
+
+ // --> OD 2007-11-14 #i83479#
+ const IDocumentListItems* getIDocumentListItemsAccess() const;
+ const IDocumentOutlineNodes* getIDocumentOutlineNodesAccess() const;
+ // <--
+
+ // 1. GetRefDev: Either the printer or the virtual device from the doc
+ // 2. GetWin: Available if we not printing
+ // 3. GetOut: Printer, Window or Virtual device
+ OutputDevice& GetRefDev() const;
+ inline Window* GetWin() const { return pWin; }
+ inline OutputDevice* GetOut() const { return pOut; }
+
+ static inline sal_Bool IsLstEndAction() { return ViewShell::bLstAct; }
+
+ //Andern alle PageDescriptoren
+ void ChgAllPageOrientation( sal_uInt16 eOri );
+ void ChgAllPageSize( Size &rSz );
+
+ // printing of one page.
+ // bIsPDFExport == true is: do PDF Export (no printing!)
+ sal_Bool PrintOrPDFExport( OutputDevice *pOutDev,
+ SwPrintData const& rPrintData,
+ sal_Int32 nRenderer /* offset in vector of pages to print */ );
+
+ // printing of one brochure page
+ void PrintProspect( OutputDevice *pOutDev, const SwPrintData &rPrintData,
+ sal_Int32 nRenderer /* offset in vector of page pairs for prospect printing */ );
+
+ // printing for OLE 2.0
+ static void PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData& rOptions,
+ OutputDevice* pOleOut, const Rectangle& rRect );
+
+ /// fill temporary doc with selected text for Print or PDF export
+ SwDoc * FillPrtDoc( SwDoc* pPrtDoc, const SfxPrinter* pPrt );
+
+ //Wird intern fuer die Shell gerufen die Druckt. Formatiert die Seiten.
+ void CalcPagesForPrint( sal_uInt16 nMax );
+
+ //All about fields.
+ void UpdateFlds(sal_Bool bCloseDB = sal_False);
+ sal_Bool IsAnyFieldInDoc() const;
+ // update all charts, for that exists any table
+ void UpdateAllCharts();
+ sal_Bool HasCharts() const;
+
+ //
+ // DOCUMENT COMPATIBILITY FLAGS START
+ //
+
+ // Sollen Absatzabstaende addiert oder maximiert werden?
+ void SetParaSpaceMax( bool bNew );
+
+ // Sollen Absatzabstaende addiert oder maximiert werden?
+ void SetParaSpaceMaxAtPages( bool bNew );
+
+ // compatible behaviour of tabs
+ void SetTabCompat( bool bNew );
+
+ // font metric attribute "External Leading" should be considered
+ void SetAddExtLeading( bool bNew );
+
+ // formatting by virtual device or printer
+ void SetUseVirDev( bool nNew );
+
+ // OD 2004-02-16 #106629# - adding paragraph and table spacing at bottom
+ // of table cells
+ void SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCells );
+
+ // OD 06.01.2004 #i11859# - former formatting of text lines with
+ // proportional line spacing or not
+ void SetUseFormerLineSpacing( bool _bUseFormerLineSpacing );
+
+ // OD 2004-03-12 #i11860# - former object positioning
+ void SetUseFormerObjectPositioning( bool _bUseFormerObjPos );
+
+ // OD 2004-05-05 #i28701#
+ void SetConsiderWrapOnObjPos( bool _bConsiderWrapOnObjPos );
+
+ // --> FME #108724#
+ void SetUseFormerTextWrapping( bool _bUseFormerTextWrapping );
+
+ // -> PB 2007-06-11 #i45491#
+ void SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesWithManualBreak );
+ // <--
+
+ //
+ // DOCUMENT COMPATIBILITY FLAGS END
+ //
+
+ //Ruft den Idle-Formatierer des Layouts
+ void LayoutIdle();
+
+ inline const SwViewOption *GetViewOptions() const { return pOpt; }
+ virtual void ApplyViewOptions( const SwViewOption &rOpt );
+ void SetUIOptions( const SwViewOption &rOpt );
+ void SetReadonlyOption(sal_Bool bSet); // Readonly-Bit d. ViewOptions setzen
+ void SetPDFExportOption(sal_Bool bSet); // set/reset PDF export mode
+ void SetPrtFormatOption(sal_Bool bSet); // PrtFormat-Bit d. ViewOptions setzen
+ void SetReadonlySelectionOption(sal_Bool bSet);//change the selection mode in readonly docs
+
+ const SwAccessibilityOptions* GetAccessibilityOptions() const { return pAccOptions;}
+
+ static void SetShellRes( ShellResource* pRes ) { pShellRes = pRes; }
+ static ShellResource* GetShellRes();
+
+ static void SetCareWin( Window* pNew );
+ static Window* GetCareWin(ViewShell& rVSh)
+ { return pCareWindow ? pCareWindow : CareChildWin(rVSh); }
+ static Window* CareChildWin(ViewShell& rVSh);
+
+ inline SfxViewShell *GetSfxViewShell() { return pSfxViewShell; }
+ inline void SetSfxViewShell(SfxViewShell *pNew) { pSfxViewShell = pNew; }
+
+ // Selektion der Draw ::com::sun::star::script::Engine geaendert
+ virtual void DrawSelChanged();
+
+ // OD 12.12.2002 #103492#
+ SwPagePreviewLayout* PagePreviewLayout();
+
+ /** adjust view options for page preview
+
+ OD 09.01.2003 #i6467#
+ Because page preview should show the document as it is printed -
+ page preview is print preview -, the view options are adjusted to the
+ same as for printing.
+
+ @param _rPrintOptions
+ input parameter - constant reference to print options, to which the
+ view option will be adjusted.
+ */
+ void AdjustOptionsForPagePreview( SwPrintData const& rPrintOptions );
+
+ sal_Bool IsViewLocked() const { return bViewLocked; }
+ void LockView( sal_Bool b ) { bViewLocked = b; }
+
+ inline void LockPaint();
+ void ImplLockPaint();
+ inline void UnlockPaint( sal_Bool bVirDev = sal_False );
+ void ImplUnlockPaint( sal_Bool bVirDev );
+ sal_Bool IsPaintLocked() const { return nLockPaint != 0; }
+
+ // Abfragen/Erzeugen DrawView + PageView
+ sal_Bool HasDrawView() const;
+ void MakeDrawView();
+
+ //DrawView darf u.U. am UI benutzt werden.
+ SdrView *GetDrawView();
+ const SdrView *GetDrawView() const { return ((ViewShell*)this)->GetDrawView(); }
+
+ //sorge dafuer, das auf jedenfall die MarkListe aktuell ist (Bug 57153)
+ SdrView *GetDrawViewWithValidMarkList();
+
+ // erfrage den Attribut Pool
+ inline const SfxItemPool& GetAttrPool() const;
+ SfxItemPool& GetAttrPool();
+
+ sal_Bool IsPreView() const { return bPreView; }
+
+ sal_Bool IsFrameView() const { return bFrameView; }
+ void SetFrameView( const Size& rBrowseBorder )
+ { bFrameView = sal_True; aBrowseBorder = rBrowseBorder; }
+
+ //Nimmt die notwendigen Invalidierungen vor,
+ //wenn sich der BrowdseModus aendert, bBrowseChgd == sal_True
+ //oder, im BrowseModus, wenn sich die Groessenverhaeltnisse
+ //aendern (bBrowseChgd == sal_False)
+ void CheckBrowseView( sal_Bool bBrowseChgd );
+
+ const Size& GetBrowseBorder() const;
+ sal_Int32 GetBrowseWidth() const;
+ void SetBrowseBorder( const Size& rNew );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ // OD 15.01.2003 #103492# - change method signature due to new page preview
+ // functionality.
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ CreateAccessiblePreview();
+
+ void ShowPreViewSelection( sal_uInt16 nSelPage );
+ void InvalidateAccessibleFocus();
+
+ //apply Accessiblity options
+ void ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions);
+
+ /** invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
+
+ OD 2005-12-01 #i27138#
+
+ @author OD
+
+ @param _pFromTxtFrm
+ input parameter - paragraph frame, for which the relation CONTENT_FLOWS_FROM
+ has to be invalidated.
+ If NULL, no CONTENT_FLOWS_FROM relation has to be invalidated
+
+ @param _pToTxtFrm
+ input parameter - paragraph frame, for which the relation CONTENT_FLOWS_TO
+ has to be invalidated.
+ If NULL, no CONTENT_FLOWS_TO relation has to be invalidated
+ */
+ void InvalidateAccessibleParaFlowRelation( const SwTxtFrm* _pFromTxtFrm,
+ const SwTxtFrm* _pToTxtFrm );
+
+ /** invalidate text selection for paragraphs
+
+ OD 2005-12-12 #i27301#
+
+ @author OD
+ */
+ void InvalidateAccessibleParaTextSelection();
+
+ /** invalidate attributes for paragraphs and paragraph's characters
+
+ OD 2009-01-06 #i88069#
+ OD 2010-02-16 #i104008# - usage also for changes of the attributes of
+ paragraph's characters.
+
+ @author OD
+
+ @param rTxtFrm
+ input parameter - paragraph frame, whose attributes have changed
+ */
+ void InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm );
+
+ SwAccessibleMap* GetAccessibleMap();
+
+ ViewShell( ViewShell&, Window *pWin = 0, OutputDevice *pOut = 0,
+ long nFlags = 0 );
+ ViewShell( SwDoc& rDoc, Window *pWin,
+ const SwViewOption *pOpt = 0, OutputDevice *pOut = 0,
+ long nFlags = 0 );
+ virtual ~ViewShell();
+
+ // --> FME 2004-06-15 #i12836# enhanced pdf export
+ sal_Int32 GetPageNumAndSetOffsetForPDF( OutputDevice& rOut, const SwRect& rRect ) const;
+ // <--
+
+ inline bool IsInConstructor() const { return mbInConstructor; }
+
+ // --> PB 2007-05-30 #146850#
+ static const BitmapEx& GetReplacementBitmap( bool bIsErrorState );
+ static void DeleteReplacementBitmaps();
+ // <--
+
+ const SwPostItMgr* GetPostItMgr() const { return (const_cast<ViewShell*>(this))->GetPostItMgr(); }
+ SwPostItMgr* GetPostItMgr();
+};
+
+//---- class CurrShell verwaltet den globalen ShellPointer -------------------
+
+class CurrShell
+{
+public:
+ ViewShell *pPrev;
+ SwRootFrm *pRoot;
+
+ CurrShell( ViewShell *pNew );
+ ~CurrShell();
+};
+
+inline void ViewShell::ResetInvalidRect()
+{
+ aInvalidRect.Clear();
+}
+
+inline void ViewShell::StartAction()
+{
+ if ( !nStartAction++ )
+ ImplStartAction();
+}
+inline void ViewShell::EndAction( const sal_Bool bIdleEnd )
+{
+ if( 0 == (nStartAction - 1) )
+ ImplEndAction( bIdleEnd );
+ --nStartAction;
+}
+
+inline void ViewShell::LockPaint()
+{
+ if ( !nLockPaint++ )
+ ImplLockPaint();
+}
+inline void ViewShell::UnlockPaint( sal_Bool bVirDev )
+{
+ if ( 0 == --nLockPaint )
+ ImplUnlockPaint( bVirDev );
+}
+inline const SfxItemPool& ViewShell::GetAttrPool() const
+{
+ return ((ViewShell*)this)->GetAttrPool();
+}
+
+
+
+#endif // SW_VIEWSH_HXX
diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx
new file mode 100644
index 000000000000..0dc52572d40e
--- /dev/null
+++ b/sw/inc/viscrs.hxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _VISCRS_HXX
+#define _VISCRS_HXX
+
+#include <vcl/cursor.hxx>
+#include "swcrsr.hxx"
+#include "swrect.hxx"
+#include "swregion.hxx"
+
+class SwCrsrShell;
+class SwShellCrsr;
+
+// -------- Ab hier Klassen / Methoden fuer den nicht Text-Cursor ------
+
+class SwVisCrsr
+#ifdef SW_CRSR_TIMER
+ : private Timer
+#endif
+{
+ friend void _InitCore();
+ friend void _FinitCore();
+
+ sal_Bool bIsVisible : 1;
+ sal_Bool bIsDragCrsr : 1;
+
+#ifdef SW_CRSR_TIMER
+ sal_Bool bTimerOn : 1;
+#endif
+
+ Cursor aTxtCrsr;
+ const SwCrsrShell* pCrsrShell;
+
+#ifdef SW_CRSR_TIMER
+ virtual void Timeout();
+#endif
+ void _SetPosAndShow();
+
+public:
+ SwVisCrsr( const SwCrsrShell * pCShell );
+ ~SwVisCrsr();
+
+ void Show();
+ void Hide();
+
+ sal_Bool IsVisible() const { return bIsVisible; }
+ void SetDragCrsr( sal_Bool bFlag = sal_True ) { bIsDragCrsr = bFlag; }
+
+#ifdef SW_CRSR_TIMER
+ sal_Bool ChgTimerFlag( sal_Bool bTimerOn = sal_True );
+#endif
+};
+
+
+// ------ Ab hier Klassen / Methoden fuer die Selectionen -------
+
+// #i75172# predefines
+namespace sdr { namespace overlay { class OverlayObject; }}
+
+class SwSelPaintRects : public SwRects
+{
+ friend void _InitCore();
+ friend void _FinitCore();
+
+ static long nPixPtX, nPixPtY;
+ static MapMode *pMapMode;
+
+ // die Shell
+ const SwCrsrShell* pCShell;
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void FillRects() = 0;
+
+ // #i75172#
+ sdr::overlay::OverlayObject* mpCursorOverlay;
+
+ // #i75172# access to mpCursorOverlay for swapContent
+ sdr::overlay::OverlayObject* getCursorOverlay() const { return mpCursorOverlay; }
+ void setCursorOverlay(sdr::overlay::OverlayObject* pNew) { mpCursorOverlay = pNew; }
+
+public:
+ SwSelPaintRects( const SwCrsrShell& rCSh );
+ virtual ~SwSelPaintRects();
+
+ // #i75172# in SwCrsrShell::CreateCrsr() the content of SwSelPaintRects is exchanged. To
+ // make a complete swap access to mpCursorOverlay is needed there
+ void swapContent(SwSelPaintRects& rSwap);
+
+ void Show();
+ void Hide();
+ void Invalidate( const SwRect& rRect );
+
+ const SwCrsrShell* GetShell() const { return pCShell; }
+ // check current MapMode of the shell and set possibly the static members.
+ // Optional set the parameters pX, pY
+ static void Get1PixelInLogic( const ViewShell& rSh,
+ long* pX = 0, long* pY = 0 );
+};
+
+
+class SwShellCrsr : public virtual SwCursor, public SwSelPaintRects
+{
+ // Dokument-Positionen der Start/End-Charakter einer SSelection
+ Point aMkPt, aPtPt;
+ const SwPosition* pPt; // fuer Zuordung vom GetPoint() zum aPtPt
+
+ virtual void FillRects(); // fuer Table- und normalen Crsr
+
+ using SwCursor::UpDown;
+
+public:
+ SwShellCrsr( const SwCrsrShell& rCrsrSh, const SwPosition &rPos );
+ SwShellCrsr( const SwCrsrShell& rCrsrSh, const SwPosition &rPos,
+ const Point& rPtPos, SwPaM* pRing = 0 );
+ SwShellCrsr( SwShellCrsr& );
+ virtual ~SwShellCrsr();
+
+ void Show(); // Update und zeige alle Selektionen an
+ void Hide(); // verstecke alle Selektionen
+ void Invalidate( const SwRect& rRect );
+
+ const Point& GetPtPos() const { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); }
+ Point& GetPtPos() { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); }
+ const Point& GetMkPos() const { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); }
+ Point& GetMkPos() { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); }
+ const Point& GetSttPos() const { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); }
+ Point& GetSttPos() { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); }
+ const Point& GetEndPos() const { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); }
+ Point& GetEndPos() { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); }
+
+ virtual void SetMark();
+
+ virtual SwCursor* Create( SwPaM* pRing = 0 ) const;
+
+ virtual short MaxReplaceArived(); //returns RET_YES/RET_CANCEL/RET_NO
+ virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
+
+ sal_Bool UpDown( sal_Bool bUp, sal_uInt16 nCnt = 1 );
+
+ // sal_True: an die Position kann der Cursor gesetzt werden
+ virtual sal_Bool IsAtValidPos( sal_Bool bPoint = sal_True ) const;
+
+#ifdef DBG_UTIL
+// JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung
+// am sichtbaren Cursor
+ virtual sal_Bool IsSelOvr( int eFlags =
+ ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ));
+#endif
+
+ virtual bool IsReadOnlyAvailable() const;
+
+ DECL_FIXEDMEMPOOL_NEWDEL( SwShellCrsr )
+};
+
+
+
+class SwShellTableCrsr : public virtual SwShellCrsr, public virtual SwTableCursor
+{
+ // die Selection hat die gleiche Reihenfolge wie die
+ // TabellenBoxen. D.h., wird aus dem einen Array an einer Position
+ // etwas geloescht, dann muss es auch im anderen erfolgen!!
+
+
+public:
+ SwShellTableCrsr( const SwCrsrShell& rCrsrSh, const SwPosition& rPos );
+ SwShellTableCrsr( const SwCrsrShell& rCrsrSh,
+ const SwPosition &rMkPos, const Point& rMkPt,
+ const SwPosition &rPtPos, const Point& rPtPt );
+ virtual ~SwShellTableCrsr();
+
+ virtual void FillRects(); // fuer Table- und normalen Crsr
+
+ // Pruefe, ob sich der SPoint innerhalb der Tabellen-SSelection befindet
+ sal_Bool IsInside( const Point& rPt ) const;
+
+ virtual void SetMark();
+ virtual SwCursor* Create( SwPaM* pRing = 0 ) const;
+
+ virtual short MaxReplaceArived(); //returns RET_YES/RET_CANCEL/RET_NO
+ virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
+
+ // sal_True: an die Position kann der Cursor gesetzt werden
+ virtual sal_Bool IsAtValidPos( sal_Bool bPoint = sal_True ) const;
+
+#ifdef DBG_UTIL
+// JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung
+// am sichtbaren Cursor
+ virtual sal_Bool IsSelOvr( int eFlags =
+ ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ));
+#endif
+};
+
+
+
+#endif // _VISCRS_HXX
diff --git a/sw/inc/wdocsh.hxx b/sw/inc/wdocsh.hxx
new file mode 100644
index 000000000000..7b97317bc23b
--- /dev/null
+++ b/sw/inc/wdocsh.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWWDOCSH_HXX
+#define _SWWDOCSH_HXX
+#include "swdllapi.h"
+#include "docsh.hxx"
+#include <swdll.hxx>
+
+class SW_DLLPUBLIC SwWebDocShell: public SwDocShell
+{
+ sal_uInt16 nSourcePara; // aktive Zeile in der SourceView
+
+public:
+
+ using SotObject::GetInterface;
+
+ // aber selbst implementieren
+ SFX_DECL_INTERFACE(SW_WEBDOCSHELL)
+ SFX_DECL_OBJECTFACTORY();
+ TYPEINFO();
+
+ SwWebDocShell(SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED);
+ ~SwWebDocShell();
+
+ virtual void FillClass( SvGlobalName * pClassName,
+ sal_uInt32 * pClipFormat,
+ String * pAppName,
+ String * pLongUserName,
+ String * pUserName,
+ sal_Int32 nFileFormat,
+ sal_Bool bTemplate = sal_False ) const;
+ sal_uInt16 GetSourcePara()const
+ {return nSourcePara;}
+ void SetSourcePara(sal_uInt16 nSet) {nSourcePara = nSet;}
+};
+
+#endif
+
+
diff --git a/sw/prj/build.lst b/sw/prj/build.lst
new file mode 100644
index 000000000000..c491c7f4e726
--- /dev/null
+++ b/sw/prj/build.lst
@@ -0,0 +1,2 @@
+sw sw : filter L10N:l10n connectivity OOo:writerperfect vbahelper svx stoc writerfilter LIBXSLT:libxslt NULL
+sw sw\prj nmake - all sw_prj NULL
diff --git a/sw/prj/d.lst b/sw/prj/d.lst
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sw/prj/d.lst
diff --git a/sw/prj/makefile.mk b/sw/prj/makefile.mk
new file mode 100644
index 000000000000..e312a7ccab65
--- /dev/null
+++ b/sw/prj/makefile.mk
@@ -0,0 +1,40 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..
+TARGET=prj
+
+.INCLUDE : settings.mk
+
+.IF "$(VERBOSE)"!=""
+VERBOSEFLAG :=
+.ELSE
+VERBOSEFLAG := -s
+.ENDIF
+
+all:
+ cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog
diff --git a/sw/qa/complex/accessibility/AccessibleRelationSet.java b/sw/qa/complex/accessibility/AccessibleRelationSet.java
new file mode 100644
index 000000000000..a6da2f29115a
--- /dev/null
+++ b/sw/qa/complex/accessibility/AccessibleRelationSet.java
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.accessibility;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleText;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleRelationSet;
+import com.sun.star.awt.XWindow;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.ControlCharacter;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.UnoRuntime;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import util.AccessibilityTools;
+import util.WriterTools;
+import static org.junit.Assert.*;
+
+public class AccessibleRelationSet {
+ private XAccessible para1 = null;
+ private XAccessible para2 = null;
+ private XAccessible para3 = null;
+ private XTextDocument xTextDoc = null;
+ private final static String[] types = {"INVALID","CONTENT_FLOWS_FROM","CONTENT_FLOWS_TO","CONTROLLED_BY","CONTROLLER_FOR","LABEL_FOR","LABELED_BY","MEMBER_OF","SUB_WINDOW_OF"};
+
+ @Test public void contents_flows_to() {
+ XAccessibleRelationSet set = getAccessibleRelation(para1);
+
+ short firstrelation=-1;
+ XAccessibleText atarget=null;
+ if (set != null) {
+ assertEquals(
+ "didn't gain correct count of relations", 1,
+ set.getRelationCount());
+ try {
+ firstrelation = set.getRelation(0).RelationType;
+ Object oTmp = set.getRelation(0).TargetSet[0];
+ atarget = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
+ } catch (IndexOutOfBoundsException e) {
+ fail("Exception when getting relations "+e);
+ }
+ }
+
+ assertEquals(
+ "didn't gain correct relation type for paragraph 0", types[2],
+ types[firstrelation]);
+
+ XAccessibleText paraTxt2 =
+ (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, para2);
+ assertEquals(
+ "didn't gain correct target paragraph", atarget.getText(),
+ paraTxt2.getText());
+ }
+
+ @Test public void contents_flows_from() {
+ XAccessibleRelationSet set = getAccessibleRelation(para2);
+
+ short[] relationtypes = new short[2];
+ XAccessibleText[] atargets = new XAccessibleText[2];
+ if (set != null) {
+ assertEquals(
+ "didn't gain correct count of relations", 2,
+ set.getRelationCount());
+ try {
+ short tmprelation = set.getRelation(0).RelationType;
+ if ( tmprelation == 1 )
+ {
+ Object oTmp = set.getRelation(0).TargetSet[0];
+ atargets[0] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
+ relationtypes[0] = tmprelation;
+ }
+ else if ( tmprelation == 2 )
+ {
+ Object oTmp = set.getRelation(0).TargetSet[0];
+ atargets[1] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
+ relationtypes[1] = tmprelation;
+ }
+ else
+ {
+ fail("didn't gain correct relation type");
+ }
+ tmprelation = set.getRelation(1).RelationType;
+ if ( tmprelation == 1 )
+ {
+ Object oTmp = set.getRelation(1).TargetSet[0];
+ atargets[0] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
+ relationtypes[0] = tmprelation;
+ }
+ else if ( tmprelation == 2 )
+ {
+ Object oTmp = set.getRelation(1).TargetSet[0];
+ atargets[1] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
+ relationtypes[1] = tmprelation;
+ }
+ else
+ {
+ fail("didn't gain correct relation type");
+ }
+ } catch (IndexOutOfBoundsException e) {
+ fail("Exception when getting relations "+e);
+ }
+ }
+
+ assertEquals(
+ "didn't gain correct relation type for paragraph 1", types[1],
+ types[relationtypes[0]]);
+
+ XAccessibleText paraTxt1 =
+ (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, para1);
+ assertEquals(
+ "didn't gain correct target paragraph", atargets[0].getText(),
+ paraTxt1.getText());
+
+ assertEquals(
+ "didn't gain correct relation type for paragraph 3", types[2],
+ types[relationtypes[1]]);
+
+ XAccessibleText paraTxt3 =
+ (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, para3);
+ assertEquals(
+ "didn't gain correct target paragraph", atargets[1].getText(),
+ paraTxt3.getText());
+ }
+
+ @Before public void before()
+ throws com.sun.star.lang.IllegalArgumentException,
+ IndexOutOfBoundsException
+ {
+ XMultiServiceFactory factory = UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ connection.getComponentContext().getServiceManager());
+
+ xTextDoc = WriterTools.createTextDoc(factory);
+
+ XText oText = xTextDoc.getText();
+ XTextCursor oCursor = oText.createTextCursor();
+
+ for (int i=0; i<5; i++){
+ oText.insertString( oCursor,"Paragraph Number: " + i, false);
+ oText.insertControlCharacter(
+ oCursor, ControlCharacter.PARAGRAPH_BREAK, false );
+ }
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xTextDoc);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentWindow(factory, aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.getAccessibleObjectForRole(xRoot, AccessibleRole.DOCUMENT);
+
+ para1 = at.SearchedContext.getAccessibleChild(0);
+ para2 = at.SearchedContext.getAccessibleChild(1);
+ para3 = at.SearchedContext.getAccessibleChild(2);
+ }
+
+ @After public void after() {
+ util.DesktopTools.closeDoc(xTextDoc);
+ }
+
+ public XAccessibleRelationSet getAccessibleRelation(XAccessible xAcc) {
+ XAccessibleContext oObj = (XAccessibleContext)
+ UnoRuntime.queryInterface(XAccessibleContext.class, xAcc);
+
+ XAccessibleRelationSet set = oObj.getAccessibleRelationSet();
+ return set;
+ }
+
+ @BeforeClass public static void setUpConnection() throws Exception {
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/sw/qa/complex/accessibility/makefile.mk b/sw/qa/complex/accessibility/makefile.mk
new file mode 100644
index 000000000000..06e7c6a70408
--- /dev/null
+++ b/sw/qa/complex/accessibility/makefile.mk
@@ -0,0 +1,50 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../../..
+PRJNAME = sw
+TARGET = qa_complex_accessibility
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = complex/accessibility
+JAVATESTFILES = AccessibleRelationSet.java
+JAVAFILES = $(JAVATESTFILES)
+JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+.END
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+.END
diff --git a/sw/qa/complex/checkColor/CheckChangeColor.java b/sw/qa/complex/checkColor/CheckChangeColor.java
new file mode 100755
index 000000000000..a072072e18c8
--- /dev/null
+++ b/sw/qa/complex/checkColor/CheckChangeColor.java
@@ -0,0 +1,89 @@
+package complex.checkColor;
+
+import com.sun.star.awt.Size;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import util.DesktopTools;
+import util.SOfficeFactory;
+import static org.junit.Assert.*;
+
+/**
+ * Created because of complaint on dev@openoffice.org: check the changing of
+ * BackColor and IsLandscape properties on the PageStyle service.
+ */
+public class CheckChangeColor {
+ /**
+ * Check BackColor and IsLandscape properties, wait for an exception: test
+ * is ok if no exception happened.
+ */
+ @Test public void checkChangeColor() throws Exception {
+ // create a supplier to get the Style family collection
+ XStyleFamiliesSupplier xSupplier = ( XStyleFamiliesSupplier ) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, document);
+
+ // get the NameAccess interface from the Style family collection
+ XNameAccess xNameAccess = xSupplier.getStyleFamilies();
+
+ XNameContainer xPageStyleCollection = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xNameAccess.getByName( "PageStyles" ));
+
+ // create a PropertySet to set the properties for the new Pagestyle
+ XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName("Standard") );
+
+ assertEquals(
+ "BackColor", new Any(Type.LONG, 0xFFFFFFFF),
+ Any.complete(xPropertySet.getPropertyValue("BackColor")));
+ assertEquals(
+ "IsLandscape", new Any(Type.BOOLEAN, false),
+ Any.complete(xPropertySet.getPropertyValue("IsLandscape")));
+ assertEquals(
+ "Size", new Type(Size.class),
+ Any.complete(xPropertySet.getPropertyValue("Size")).getType());
+
+ xPropertySet.setPropertyValue("BackColor", 0xFF000000);
+ xPropertySet.setPropertyValue("IsLandscape", true);
+ assertEquals(
+ "BackColor", new Any(Type.LONG, 0xFF000000),
+ Any.complete(xPropertySet.getPropertyValue("BackColor")));
+ assertEquals(
+ "IsLandscape", new Any(Type.BOOLEAN, true),
+ Any.complete(xPropertySet.getPropertyValue("IsLandscape")));
+ }
+
+ @Before public void setUpDocument() throws com.sun.star.uno.Exception {
+ document = SOfficeFactory.getFactory(
+ UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ connection.getComponentContext().getServiceManager())).
+ createTextDoc(null);
+ }
+
+ @After public void tearDownDocument() {
+ DesktopTools.closeDoc(document);
+ }
+
+ private XTextDocument document = null;
+
+ @BeforeClass public static void setUpConnection() throws Exception {
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/sw/qa/complex/checkColor/makefile.mk b/sw/qa/complex/checkColor/makefile.mk
new file mode 100644
index 000000000000..e5b368083ada
--- /dev/null
+++ b/sw/qa/complex/checkColor/makefile.mk
@@ -0,0 +1,50 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../../..
+PRJNAME = sw
+TARGET = qa_complex_checkColor
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = complex/checkColor
+JAVATESTFILES = CheckChangeColor.java
+JAVAFILES = $(JAVATESTFILES)
+JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+.END
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+.END
diff --git a/sw/qa/complex/indeterminateState/CheckIndeterminateState.java b/sw/qa/complex/indeterminateState/CheckIndeterminateState.java
new file mode 100755
index 000000000000..23a6d89ccf51
--- /dev/null
+++ b/sw/qa/complex/indeterminateState/CheckIndeterminateState.java
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.indeterminateState;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.awt.FontWeight;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextRange;
+import com.sun.star.text.XTextViewCursorSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import util.AccessibilityTools;
+import util.DesktopTools;
+import util.SOfficeFactory;
+import static org.junit.Assert.*;
+
+/**
+ */
+public class CheckIndeterminateState {
+ /*
+ * Test the indeterminate state of AccessibleToolBarItem
+ * The used tools are in project qadevOOo/runner
+ */
+ @Test public void checkToolBoxItem() throws Exception {
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, document);
+
+ XController xController = aModel.getCurrentController();
+
+ XText text = document.getText();
+ text.setString("normal");
+ XTextRange end = text.getEnd();
+ end.setString("bold");
+ UnoRuntime.queryInterface(XPropertySet.class, end).setPropertyValue(
+ "CharWeight", FontWeight.BOLD);
+ UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController).
+ getViewCursor().gotoRange(text, false);
+
+ XInterface oObj = null;
+
+ AccessibilityTools at = new AccessibilityTools();
+ XWindow xWindow = at.getCurrentContainerWindow(getFactory(), aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.TOGGLE_BUTTON, "Bold");
+ assertNotNull("Found a TOGGLE_BUTTON", oObj);
+
+ XAccessibleContext oContext = (XAccessibleContext)
+ UnoRuntime.queryInterface(XAccessibleContext.class, oObj);
+
+ XAccessibleStateSet oSet = oContext.getAccessibleStateSet();
+
+ assertTrue("The 'INDETERMINATE' state is not set.",oSet.contains(AccessibleStateType.INDETERMINATE));
+ }
+
+ @Before public void setUpDocument() throws com.sun.star.uno.Exception {
+ document = SOfficeFactory.getFactory(getFactory()).createTextDoc(null);
+ }
+
+ @After public void tearDownDocument() {
+ DesktopTools.closeDoc(document);
+ }
+
+ private XTextDocument document = null;
+
+ @BeforeClass public static void setUpConnection() throws Exception {
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+
+ private static final XMultiServiceFactory getFactory() {
+ return UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ connection.getComponentContext().getServiceManager());
+ }
+}
diff --git a/sw/qa/complex/writer/CheckBookmarks.java b/sw/qa/complex/writer/CheckBookmarks.java
new file mode 100644
index 000000000000..84bfe15ba045
--- /dev/null
+++ b/sw/qa/complex/writer/CheckBookmarks.java
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.writer;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.XNamed;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.XBookmarksSupplier;
+import com.sun.star.text.XSimpleText;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextRange;
+import com.sun.star.uno.UnoRuntime;
+import complexlib.ComplexTestCase;
+import java.math.BigInteger;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+class BookmarkHashes {
+ public BigInteger m_nSetupHash;
+ public BigInteger m_nInsertRandomHash;
+ public BigInteger m_nDeleteRandomHash;
+ public BigInteger m_nLinebreakHash;
+ public BigInteger m_nOdfReloadHash;
+ public BigInteger m_nMsWordReloadHash;
+
+ public void assertExpectation(BookmarkHashes aExpectation) {
+ assertEquals(aExpectation.m_nSetupHash, m_nSetupHash);
+ assertEquals(aExpectation.m_nInsertRandomHash, m_nInsertRandomHash);
+ assertEquals(aExpectation.m_nDeleteRandomHash, m_nDeleteRandomHash);
+ assertEquals(aExpectation.m_nLinebreakHash, m_nLinebreakHash);
+ assertEquals(aExpectation.m_nOdfReloadHash, m_nOdfReloadHash);
+ assertEquals(aExpectation.m_nMsWordReloadHash, m_nMsWordReloadHash);
+ }
+
+ static public java.math.BigInteger getBookmarksHash(XTextDocument xDoc)
+ throws com.sun.star.uno.Exception, java.security.NoSuchAlgorithmException
+ {
+ StringBuffer buffer = new StringBuffer("");
+ XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier)UnoRuntime.queryInterface(
+ XBookmarksSupplier.class,
+ xDoc);
+ XNameAccess xBookmarks = xBookmarksSupplier.getBookmarks();
+ for(String sBookmarkname : xBookmarks.getElementNames()) {
+ Object xBookmark = xBookmarks.getByName(sBookmarkname);
+ XTextContent xBookmarkAsContent = (XTextContent)UnoRuntime.queryInterface(
+ XTextContent.class,
+ xBookmark);
+ buffer.append(sBookmarkname);
+ buffer.append(":");
+ buffer.append(xBookmarkAsContent.getAnchor().getString());
+ buffer.append(";");
+ }
+ java.security.MessageDigest sha1 = java.security.MessageDigest.getInstance("SHA-1");
+ sha1.reset();
+ sha1.update(buffer.toString().getBytes());
+ return new java.math.BigInteger(sha1.digest());
+ }
+}
+
+public class CheckBookmarks {
+ private XMultiServiceFactory m_xMsf = null;
+ private XTextDocument m_xDoc = null;
+ private XTextDocument m_xOdfReloadedDoc = null;
+ private XTextDocument m_xMsWordReloadedDoc = null;
+ private final BookmarkHashes actualHashes = new BookmarkHashes();
+
+ private BookmarkHashes getDEV300m41Expectations() {
+ BookmarkHashes result = new BookmarkHashes();
+ result.m_nSetupHash = new BigInteger("-4b0706744e8452fe1ae9d5e1c28cf70fb6194795",16);
+ result.m_nInsertRandomHash = new BigInteger("25aa0fad3f4881832dcdfe658ec2efa8a1a02bc5",16);
+ result.m_nDeleteRandomHash = new BigInteger("-3ec87e810b46d734677c351ad893bbbf9ea10f55",16);
+ result.m_nLinebreakHash = new BigInteger("3ae08c284ea0d6e738cb43c0a8105e718a633550",16);
+ result.m_nOdfReloadHash = new BigInteger("3ae08c284ea0d6e738cb43c0a8105e718a633550",16);
+ result.m_nMsWordReloadHash = new BigInteger("3ae08c284ea0d6e738cb43c0a8105e718a633550",16);
+ return result;
+ }
+
+ @Test public void checkBookmarks()
+ throws com.sun.star.uno.Exception,
+ com.sun.star.io.IOException,
+ java.security.NoSuchAlgorithmException
+ {
+ actualHashes.assertExpectation(getDEV300m41Expectations());
+ }
+
+ @Before public void setUpDocuments() throws Exception {
+ m_xMsf = UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ connection.getComponentContext().getServiceManager());
+ m_xDoc = util.WriterTools.createTextDoc(m_xMsf);
+ setupBookmarks();
+ actualHashes.m_nSetupHash = BookmarkHashes.getBookmarksHash(m_xDoc);
+ insertRandomParts(200177);
+ actualHashes.m_nInsertRandomHash = BookmarkHashes.getBookmarksHash(m_xDoc);
+ deleteRandomParts(4711);
+ actualHashes.m_nDeleteRandomHash = BookmarkHashes.getBookmarksHash(m_xDoc);
+ insertLinebreaks(007);
+ actualHashes.m_nLinebreakHash = BookmarkHashes.getBookmarksHash(m_xDoc);
+ m_xOdfReloadedDoc = reloadFrom("StarOffice XML (Writer)", "odf");
+ actualHashes.m_nOdfReloadHash = BookmarkHashes.getBookmarksHash(m_xOdfReloadedDoc);
+ m_xMsWordReloadedDoc = reloadFrom("MS Word 97", "doc");
+ actualHashes.m_nMsWordReloadHash = BookmarkHashes.getBookmarksHash(m_xMsWordReloadedDoc);
+ }
+
+ @After public void tearDownDocuments() {
+ util.DesktopTools.closeDoc(m_xDoc);
+ util.DesktopTools.closeDoc(m_xOdfReloadedDoc);
+ util.DesktopTools.closeDoc(m_xMsWordReloadedDoc);
+ }
+
+ @BeforeClass public static void setUpConnection() throws Exception {
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+
+ private void setupBookmarks()
+ throws com.sun.star.uno.Exception
+ {
+ XText xText = m_xDoc.getText();
+ XSimpleText xSimpleText = (XSimpleText)UnoRuntime.queryInterface(
+ XSimpleText.class,
+ xText);
+ for(int nPara=0; nPara<10; ++nPara) {
+ for(int nBookmark=0; nBookmark<100; ++nBookmark){
+ insertBookmark(
+ xText.createTextCursor(),
+ "P" + nPara + "word" + nBookmark,
+ "P" + nPara + "word" + nBookmark);
+ XTextCursor xWordCrsr = xText.createTextCursor();
+ xWordCrsr.setString(" ");
+ }
+ XTextCursor xParaCrsr = xText.createTextCursor();
+ XTextRange xParaCrsrAsRange = (XTextRange)UnoRuntime.queryInterface(
+ XTextRange.class,
+ xParaCrsr);
+ xText.insertControlCharacter(xParaCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
+ }
+ }
+
+ private void insertRandomParts(long seed)
+ throws com.sun.star.uno.Exception
+ {
+ java.util.Random rnd = new java.util.Random(seed);
+ XTextCursor xCrsr = m_xDoc.getText().createTextCursor();
+ for(int i=0; i<600; i++) {
+ xCrsr.goRight((short)rnd.nextInt(100), false);
+ xCrsr.setString(Long.toString(rnd.nextLong()));
+ }
+ }
+
+ private void deleteRandomParts(long seed)
+ throws com.sun.star.uno.Exception
+ {
+ java.util.Random rnd = new java.util.Random(seed);
+ XTextCursor xCrsr = m_xDoc.getText().createTextCursor();
+ for(int i=0; i<600; i++) {
+ xCrsr.goRight((short)rnd.nextInt(100), false);
+ xCrsr.goRight((short)rnd.nextInt(20), true);
+ xCrsr.setString("");
+ }
+ }
+
+ private void insertLinebreaks(long seed)
+ throws com.sun.star.uno.Exception
+ {
+ XText xText = m_xDoc.getText();
+ java.util.Random rnd = new java.util.Random(seed);
+ XTextCursor xCrsr = m_xDoc.getText().createTextCursor();
+ for(int i=0; i<30; i++) {
+ xCrsr.goRight((short)rnd.nextInt(300), false);
+ XTextRange xCrsrAsRange = (XTextRange)UnoRuntime.queryInterface(
+ XTextRange.class,
+ xCrsr);
+ xText.insertControlCharacter(xCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
+ }
+ }
+
+ private void insertBookmark(XTextCursor crsr, String name, String content)
+ throws com.sun.star.uno.Exception
+ {
+ XMultiServiceFactory xDocFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ m_xDoc);
+
+ Object xBookmark = xDocFactory.createInstance("com.sun.star.text.Bookmark");
+ XTextContent xBookmarkAsTextContent = (XTextContent)UnoRuntime.queryInterface(
+ XTextContent.class,
+ xBookmark);
+ crsr.setString(content);
+ XNamed xBookmarkAsNamed = (XNamed)UnoRuntime.queryInterface(
+ XNamed.class,
+ xBookmark);
+ xBookmarkAsNamed.setName(name);
+ m_xDoc.getText().insertTextContent(crsr, xBookmarkAsTextContent, true);
+ }
+
+ private XTextDocument reloadFrom(String sFilter, String sExtension)
+ throws com.sun.star.io.IOException
+ {
+ String sFileUrl = util.utils.getOfficeTemp(m_xMsf) + "/Bookmarktest." + sExtension;
+ try {
+ PropertyValue[] aStoreProperties = new PropertyValue[2];
+ aStoreProperties[0] = new PropertyValue();
+ aStoreProperties[1] = new PropertyValue();
+ aStoreProperties[0].Name = "Override";
+ aStoreProperties[0].Value = true;
+ aStoreProperties[1].Name = "FilterName";
+ aStoreProperties[1].Value = sFilter;
+ XStorable xStorable = (XStorable)UnoRuntime.queryInterface(
+ XStorable.class,
+ m_xDoc);
+ xStorable.storeToURL(sFileUrl, aStoreProperties);
+ return util.WriterTools.loadTextDoc(m_xMsf, sFileUrl);
+ } finally {
+ if(util.utils.fileExists(m_xMsf, sFileUrl))
+ util.utils.deleteFile(m_xMsf, sFileUrl);
+ }
+ }
+}
diff --git a/sw/qa/complex/writer/CheckCrossReferences.java b/sw/qa/complex/writer/CheckCrossReferences.java
new file mode 100644
index 000000000000..cc7fcb1c7e53
--- /dev/null
+++ b/sw/qa/complex/writer/CheckCrossReferences.java
@@ -0,0 +1,291 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+package complex.writer;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.UnoRuntime;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author od138299
+ */
+public class CheckCrossReferences {
+
+ private com.sun.star.container.XEnumeration xParaEnum;
+ private com.sun.star.container.XEnumeration xPortionEnum;
+ private com.sun.star.util.XRefreshable xFldsRefresh;
+
+ public com.sun.star.text.XTextField getNextField()
+ throws com.sun.star.uno.Exception
+ {
+ if ( xPortionEnum != null ) {
+ while ( xPortionEnum.hasMoreElements() ) {
+ com.sun.star.beans.XPropertySet xPortionProps =
+ (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
+ com.sun.star.beans.XPropertySet.class , xPortionEnum.nextElement());
+ final String sPortionType =
+ xPortionProps.getPropertyValue( "TextPortionType" ).toString();
+ if ( sPortionType.equals( "TextField") ) {
+ com.sun.star.text.XTextField xField = (com.sun.star.text.XTextField)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextField.class,
+ xPortionProps.getPropertyValue( "TextField" ) );
+ assertNotNull("Cannot retrieve next field.", xField);
+ return xField;
+ }
+ }
+ }
+
+ while ( xParaEnum.hasMoreElements() ) {
+ com.sun.star.container.XEnumerationAccess aPara =
+ (com.sun.star.container.XEnumerationAccess)UnoRuntime.queryInterface(
+ com.sun.star.container.XEnumerationAccess.class, xParaEnum.nextElement());
+ xPortionEnum = aPara.createEnumeration();
+ while ( xPortionEnum.hasMoreElements() ) {
+ com.sun.star.beans.XPropertySet xPortionProps =
+ (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
+ com.sun.star.beans.XPropertySet.class , xPortionEnum.nextElement());
+ final String sPortionType =
+ xPortionProps.getPropertyValue( "TextPortionType" ).toString();
+ if ( sPortionType.equals( "TextField") ) {
+ com.sun.star.text.XTextField xField = (com.sun.star.text.XTextField)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextField.class,
+ xPortionProps.getPropertyValue( "TextField" ) );
+ assertNotNull("Cannot retrieve next field.", xField);
+ return xField;
+ }
+ }
+ }
+
+ fail("Cannot retrieve next field.");
+ return null; // unreachable
+ }
+
+ public com.sun.star.beans.XPropertySet getFieldProps(
+ com.sun.star.text.XTextField xField ) {
+ com.sun.star.beans.XPropertySet xProps =
+ (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
+ com.sun.star.beans.XPropertySet.class, xField );
+
+ assertNotNull("Cannot retrieve field properties.", xProps);
+
+ return xProps;
+ }
+
+ public void checkField( com.sun.star.text.XTextField xField,
+ com.sun.star.beans.XPropertySet xProps,
+ short nFormat,
+ String aExpectedFldResult )
+ throws com.sun.star.uno.Exception
+ {
+ // set requested format
+ xProps.setPropertyValue("ReferenceFieldPart", new Short(nFormat));
+
+ // refresh fields in order to get new format applied
+ xFldsRefresh.refresh();
+
+ String aFldResult = xField.getPresentation( false );
+ assertEquals( "set reference field format doesn't result in correct field result",
+ aExpectedFldResult, aFldResult);
+ }
+
+ @Test public void checkCrossReferences() throws com.sun.star.uno.Exception {
+ // setup paragraph enumeration
+ {
+ com.sun.star.container.XEnumerationAccess xParaEnumAccess =
+ (com.sun.star.container.XEnumerationAccess)UnoRuntime.queryInterface(
+ com.sun.star.container.XEnumerationAccess.class, document.getText());
+ xParaEnum = xParaEnumAccess.createEnumeration();
+ }
+
+ // get field refresher
+ {
+ com.sun.star.text.XTextFieldsSupplier xFieldSupp =
+ (com.sun.star.text.XTextFieldsSupplier)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextFieldsSupplier.class, document);
+ xFldsRefresh = (com.sun.star.util.XRefreshable)UnoRuntime.queryInterface(
+ com.sun.star.util.XRefreshable.class, xFieldSupp.getTextFields());
+ }
+
+ // check first reference field
+ {
+ // strings for checking
+ final String FldResult1 = "*i*";
+ final String FldResult2 = "+b+*i*";
+ final String FldResult3 = "-1-+b+*i*";
+ final String FldResult4 = "1.";
+ final String FldResult5 = " 1.";
+ final String FldResult6 = "A. 1.";
+
+ // variables for current field
+ com.sun.star.text.XTextField xField = null;
+ com.sun.star.beans.XPropertySet xProps = null;
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult2 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult1 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult3 );
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult1 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult1 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult3 );
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult3 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult1 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult3 );
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult5 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult4 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult6 );
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult4 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult4 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult6 );
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult6 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult4 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult6 );
+ }
+
+ // insert a certain cross-reference bookmark and a reference field to this bookmark
+ {
+ // restart paragraph enumeration
+ com.sun.star.container.XEnumerationAccess xParaEnumAccess =
+ (com.sun.star.container.XEnumerationAccess)UnoRuntime.queryInterface(
+ com.sun.star.container.XEnumerationAccess.class, document.getText());
+ xParaEnum = xParaEnumAccess.createEnumeration();
+
+ // iterate on the paragraphs to find certain paragraph to insert the bookmark
+ com.sun.star.text.XTextRange xParaTextRange = null;
+ while ( xParaEnum.hasMoreElements() ) {
+ xParaTextRange = (com.sun.star.text.XTextRange)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextRange.class, xParaEnum.nextElement());
+ if ( xParaTextRange.getString().equals( "J" ) ) {
+ break;
+ }
+ else {
+ xParaTextRange = null;
+ }
+ }
+ assertNotNull(
+ "Cannot find paragraph to insert cross-reference bookmark.",
+ xParaTextRange);
+
+ // insert bookmark
+ XMultiServiceFactory xFac = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, document);
+ final String cBookmarkName = "__RefNumPara__47114711";
+ com.sun.star.text.XTextContent xBookmark =
+ (com.sun.star.text.XTextContent)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextContent.class,
+ xFac.createInstance( "com.sun.star.text.Bookmark" ) );
+ if ( xBookmark != null ) {
+ com.sun.star.container.XNamed xName =
+ (com.sun.star.container.XNamed)UnoRuntime.queryInterface(
+ com.sun.star.container.XNamed.class, xBookmark );
+ xName.setName( cBookmarkName );
+ xBookmark.attach(xParaTextRange.getStart());
+ }
+
+ // insert reference field, which references the inserted bookmark
+ com.sun.star.text.XTextContent xNewField =
+ (com.sun.star.text.XTextContent)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextContent.class,
+ xFac.createInstance( "com.sun.star.text.TextField.GetReference" ) );
+ if ( xNewField != null ) {
+ com.sun.star.beans.XPropertySet xFieldProps =
+ (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
+ com.sun.star.beans.XPropertySet.class, xNewField );
+ xFieldProps.setPropertyValue( "ReferenceFieldPart", new Short(com.sun.star.text.ReferenceFieldPart.TEXT) );
+ xFieldProps.setPropertyValue( "ReferenceFieldSource", new Short(com.sun.star.text.ReferenceFieldSource.BOOKMARK) );
+ xFieldProps.setPropertyValue( "SourceName", cBookmarkName );
+ com.sun.star.text.XTextRange xFieldTextRange =
+ (com.sun.star.text.XTextRange)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextRange.class, xParaEnum.nextElement());
+ xNewField.attach(xFieldTextRange.getEnd());
+ xFldsRefresh.refresh();
+ }
+
+ // check inserted reference field
+ com.sun.star.text.XTextField xField =
+ (com.sun.star.text.XTextField)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextField.class, xNewField );
+ assertEquals( "inserted reference field doesn't has correct field result",
+ "J", xField.getPresentation( false ) );
+
+ xParaTextRange.getStart().setString( "Hallo new bookmark: " );
+ xFldsRefresh.refresh();
+ assertEquals( "inserted reference field doesn't has correct field result",
+ "Hallo new bookmark: J", xField.getPresentation( false ) );
+ }
+ }
+
+ @Before public void setUpDocument() throws com.sun.star.uno.Exception {
+ document = util.WriterTools.loadTextDoc(
+ UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ connection.getComponentContext().getServiceManager()),
+ TestDocument.getUrl("CheckCrossReferences.odt"));
+ }
+
+ @After public void tearDownDocument() {
+ util.DesktopTools.closeDoc(document);
+ }
+
+ private XTextDocument document = null;
+
+ @BeforeClass public static void setUpConnection() throws Exception {
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/sw/qa/complex/writer/CheckFlies.java b/sw/qa/complex/writer/CheckFlies.java
new file mode 100644
index 000000000000..a65c01ec147d
--- /dev/null
+++ b/sw/qa/complex/writer/CheckFlies.java
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.writer;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.XNamed;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.UnoRuntime;
+import complexlib.ComplexTestCase;
+import java.math.BigInteger;
+import java.util.Collection;
+import java.util.ArrayList;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+public class CheckFlies {
+ @Test public void checkFlies()
+ throws com.sun.star.uno.Exception
+ {
+ com.sun.star.text.XTextFramesSupplier xTFS = (com.sun.star.text.XTextFramesSupplier)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextFramesSupplier.class,
+ document);
+ checkTextFrames(xTFS);
+ com.sun.star.text.XTextGraphicObjectsSupplier xTGOS = (com.sun.star.text.XTextGraphicObjectsSupplier)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextGraphicObjectsSupplier.class,
+ document);
+ checkGraphicFrames(xTGOS);
+ com.sun.star.text.XTextEmbeddedObjectsSupplier xTEOS = (com.sun.star.text.XTextEmbeddedObjectsSupplier)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextEmbeddedObjectsSupplier.class,
+ document);
+ checkEmbeddedFrames(xTEOS);
+ }
+
+ private void checkEmbeddedFrames(com.sun.star.text.XTextEmbeddedObjectsSupplier xTGOS)
+ throws com.sun.star.uno.Exception
+ {
+ Collection<String> vExpectedEmbeddedFrames = new ArrayList<String>();
+ vExpectedEmbeddedFrames.add("Object1");
+ int nEmbeddedFrames = vExpectedEmbeddedFrames.size();
+ com.sun.star.container.XNameAccess xEmbeddedFrames = xTGOS.getEmbeddedObjects();
+ for(String sFrameName : xEmbeddedFrames.getElementNames())
+ {
+ assertTrue(
+ "Unexpected frame name",
+ vExpectedEmbeddedFrames.remove(sFrameName));
+ xEmbeddedFrames.getByName(sFrameName);
+ assertTrue(
+ "Could not find embedded frame by name.",
+ xEmbeddedFrames.hasByName(sFrameName));
+ }
+ assertTrue(
+ "Missing expected embedded frames.",
+ vExpectedEmbeddedFrames.isEmpty());
+ try
+ {
+ xEmbeddedFrames.getByName("Nonexisting embedded frame");
+ fail("Got nonexisting embedded frame");
+ }
+ catch(com.sun.star.container.NoSuchElementException e)
+ {}
+ assertFalse(
+ "Has nonexisting embedded frame",
+ xEmbeddedFrames.hasByName("Nonexisting embedded frame"));
+
+ com.sun.star.container.XIndexAccess xEmbeddedFramesIdx = (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface(
+ com.sun.star.container.XIndexAccess.class,
+ xEmbeddedFrames);
+ assertEquals(
+ "Unexpected number of embedded frames reported.", nEmbeddedFrames,
+ xEmbeddedFramesIdx.getCount());
+ for(int nCurrentFrameIdx = 0; nCurrentFrameIdx < xEmbeddedFramesIdx.getCount(); nCurrentFrameIdx++)
+ {
+ xEmbeddedFramesIdx.getByIndex(nCurrentFrameIdx);
+ }
+ }
+
+ private void checkGraphicFrames(com.sun.star.text.XTextGraphicObjectsSupplier xTGOS)
+ throws com.sun.star.uno.Exception
+ {
+ Collection<String> vExpectedGraphicFrames = new ArrayList<String>();
+ vExpectedGraphicFrames.add("graphics1");
+ int nGraphicFrames = vExpectedGraphicFrames.size();
+ com.sun.star.container.XNameAccess xGraphicFrames = xTGOS.getGraphicObjects();
+ for(String sFrameName : xGraphicFrames.getElementNames())
+ {
+ assertTrue(
+ "Unexpected frame name",
+ vExpectedGraphicFrames.remove(sFrameName));
+ xGraphicFrames.getByName(sFrameName);
+ assertTrue(
+ "Could not find graphics frame by name.",
+ xGraphicFrames.hasByName(sFrameName));
+ }
+ assertTrue(
+ "Missing expected graphics frames.",
+ vExpectedGraphicFrames.isEmpty());
+ try
+ {
+ xGraphicFrames.getByName("Nonexisting graphics frame");
+ fail("Got nonexisting graphics frame");
+ }
+ catch(com.sun.star.container.NoSuchElementException e)
+ {}
+ assertFalse(
+ "Has nonexisting graphics frame",
+ xGraphicFrames.hasByName("Nonexisting graphics frame"));
+
+ com.sun.star.container.XIndexAccess xGraphicFramesIdx = (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface(
+ com.sun.star.container.XIndexAccess.class,
+ xGraphicFrames);
+ assertEquals(
+ "Unexpected number of graphics frames reported.", nGraphicFrames,
+ xGraphicFramesIdx.getCount());
+ for(int nCurrentFrameIdx = 0; nCurrentFrameIdx < xGraphicFramesIdx.getCount(); nCurrentFrameIdx++)
+ {
+ xGraphicFramesIdx.getByIndex(nCurrentFrameIdx);
+ }
+ }
+
+ private void checkTextFrames(com.sun.star.text.XTextFramesSupplier xTFS)
+ throws com.sun.star.uno.Exception
+ {
+ Collection<String> vExpectedTextFrames = new ArrayList<String>();
+ vExpectedTextFrames.add("Frame1");
+ vExpectedTextFrames.add("Frame2");
+
+ int nTextFrames = vExpectedTextFrames.size();
+ com.sun.star.container.XNameAccess xTextFrames = xTFS.getTextFrames();
+ for(String sFrameName : xTextFrames.getElementNames())
+ {
+ assertTrue(
+ "Unexpected frame name",
+ vExpectedTextFrames.remove(sFrameName));
+ xTextFrames.getByName(sFrameName);
+ assertTrue(
+ "Could not find text frame by name.",
+ xTextFrames.hasByName(sFrameName));
+ }
+ assertTrue(
+ "Missing expected text frames.", vExpectedTextFrames.isEmpty());
+ try
+ {
+ xTextFrames.getByName("Nonexisting Textframe");
+ fail("Got nonexisting text frame.");
+ }
+ catch(com.sun.star.container.NoSuchElementException e)
+ {}
+ assertFalse(
+ "Has nonexisting text frame.",
+ xTextFrames.hasByName("Nonexisting text frame"));
+
+ com.sun.star.container.XIndexAccess xTextFramesIdx = (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface(
+ com.sun.star.container.XIndexAccess.class,
+ xTextFrames);
+ assertEquals(
+ "Unexpected number of text frames reported.", nTextFrames,
+ xTextFramesIdx.getCount());
+ for(int nCurrentFrameIdx = 0; nCurrentFrameIdx < xTextFramesIdx.getCount(); nCurrentFrameIdx++)
+ {
+ xTextFramesIdx.getByIndex(nCurrentFrameIdx);
+ }
+ }
+
+ @Before public void setUpDocument() throws com.sun.star.uno.Exception {
+ document = util.WriterTools.loadTextDoc(
+ UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ connection.getComponentContext().getServiceManager()),
+ TestDocument.getUrl("CheckFlies.odt"));
+ }
+
+ @After public void tearDownDocument() {
+ util.DesktopTools.closeDoc(document);
+ }
+
+ private XTextDocument document = null;
+
+ @BeforeClass public static void setUpConnection() throws Exception {
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/sw/qa/complex/writer/CheckIndexedPropertyValues.java b/sw/qa/complex/writer/CheckIndexedPropertyValues.java
new file mode 100755
index 000000000000..c381cd5825c4
--- /dev/null
+++ b/sw/qa/complex/writer/CheckIndexedPropertyValues.java
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.writer;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.XIndexContainer;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.Type;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+/**
+ * Test the com.sun.star.document.IndexedPropertyValues service
+ */
+public class CheckIndexedPropertyValues {
+ @Test public void checkIndexedPropertyValues()
+ throws com.sun.star.uno.Exception
+ {
+ XIndexContainer xCont = UnoRuntime.queryInterface(
+ XIndexContainer.class,
+ (connection.getComponentContext().getServiceManager().
+ createInstanceWithContext(
+ "com.sun.star.document.IndexedPropertyValues",
+ connection.getComponentContext())));
+
+ assertNotNull("XIndexContainer was queried but returned null.", xCont);
+ PropertyValue[] prop1 = new PropertyValue[1];
+ prop1[0] = new PropertyValue();
+ prop1[0].Name = "Jupp";
+ prop1[0].Value = "GoodGuy";
+
+ PropertyValue[] prop2 = new PropertyValue[1];
+ prop2[0] = new PropertyValue();
+ prop2[0].Name = "Horst";
+ prop2[0].Value = "BadGuy";
+
+ Type t = xCont.getElementType();
+ assertEquals("Initial container is not empty", 0, xCont.getCount());
+ xCont.insertByIndex(0, prop1);
+ PropertyValue[]ret = (PropertyValue[])xCont.getByIndex(0);
+ assertEquals(prop1[0].Name, ret[0].Name);
+ assertEquals(prop1[0].Value, ret[0].Value);
+ xCont.replaceByIndex(0, prop2);
+ ret = (PropertyValue[])xCont.getByIndex(0);
+ assertEquals(prop2[0].Name, ret[0].Name);
+ assertEquals(prop2[0].Value, ret[0].Value);
+ xCont.removeByIndex(0);
+ assertTrue("Could not remove PropertyValue.",
+ !xCont.hasElements() && xCont.getCount()==0);
+ xCont.insertByIndex(0, prop1);
+ xCont.insertByIndex(1, prop2);
+ assertTrue("Did not insert PropertyValue.",
+ xCont.hasElements() && xCont.getCount()==2);
+
+ try {
+ xCont.insertByIndex(25, prop2);
+ fail("IllegalArgumentException was not thrown.");
+ }
+ catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ }
+
+ try {
+ xCont.removeByIndex(25);
+ fail("IndexOutOfBoundsException was not thrown.");
+ }
+ catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ }
+
+ try {
+ xCont.insertByIndex(2, "Example String");
+ fail("IllegalArgumentException was not thrown.");
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ @BeforeClass public static void setUpConnection() throws Exception {
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/sw/qa/complex/writer/CheckNamedPropertyValues.java b/sw/qa/complex/writer/CheckNamedPropertyValues.java
new file mode 100755
index 000000000000..b2541954ce9f
--- /dev/null
+++ b/sw/qa/complex/writer/CheckNamedPropertyValues.java
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.writer;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.Type;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class CheckNamedPropertyValues {
+ @Test public void checkNamedPropertyValues()
+ throws com.sun.star.uno.Exception
+ {
+ XNameContainer xCont = UnoRuntime.queryInterface(
+ XNameContainer.class,
+ (connection.getComponentContext().getServiceManager().
+ createInstanceWithContext(
+ "com.sun.star.document.NamedPropertyValues",
+ connection.getComponentContext())));
+
+ assertNotNull("XNameContainer was queried but returned null.", xCont);
+ PropertyValue[] prop1 = new PropertyValue[1];
+ prop1[0] = new PropertyValue();
+ prop1[0].Name = "Jupp";
+ prop1[0].Value = "GoodGuy";
+
+ PropertyValue[] prop2 = new PropertyValue[1];
+ prop2[0] = new PropertyValue();
+ prop2[0].Name = "Horst";
+ prop2[0].Value = "BadGuy";
+
+ Type t = xCont.getElementType();
+ assertFalse("Initial container is not empty.", xCont.hasElements());
+
+ xCont.insertByName("prop1", prop1);
+ PropertyValue[]ret = (PropertyValue[])xCont.getByName("prop1");
+ assertEquals(prop1[0].Name, ret[0].Name);
+ assertEquals(prop1[0].Value, ret[0].Value);
+ xCont.replaceByName("prop1", prop2);
+ ret = (PropertyValue[])xCont.getByName("prop1");
+ assertEquals(prop2[0].Name, ret[0].Name);
+ assertEquals(prop2[0].Value, ret[0].Value);
+ xCont.removeByName("prop1");
+ assertFalse("Could not remove PropertyValue.", xCont.hasElements());
+ xCont.insertByName("prop1", prop1);
+ xCont.insertByName("prop2", prop2);
+ assertTrue("Did not insert PropertyValue.", xCont.hasElements());
+ String[] names = xCont.getElementNames();
+ assertEquals("Not all element names were returned.", 2, names.length);
+ for (int i=0; i<names.length; i++) {
+ assertTrue(
+ "Got a wrong element name",
+ names[i].equals("prop1") || names[i].equals("prop2"));
+ }
+
+ try {
+ xCont.insertByName("prop2", prop1);
+ fail("ElementExistException was not thrown.");
+ }
+ catch(com.sun.star.container.ElementExistException e) {
+ }
+
+ try {
+ xCont.insertByName("prop3", "Example String");
+ fail("IllegalArgumentException was not thrown.");
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ }
+
+ try {
+ xCont.removeByName("prop3");
+ fail("NoSuchElementException was not thrown.");
+ }
+ catch(com.sun.star.container.NoSuchElementException e) {
+ }
+ }
+
+ @BeforeClass public static void setUpConnection() throws Exception {
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/sw/qa/complex/writer/LoadSaveTest.java b/sw/qa/complex/writer/LoadSaveTest.java
new file mode 100644
index 000000000000..a1600488c7bc
--- /dev/null
+++ b/sw/qa/complex/writer/LoadSaveTest.java
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.writer;
+
+import complexlib.ComplexTestCase;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.WrappedTargetRuntimeException;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.Pair;
+import com.sun.star.util.XCloseable;
+import com.sun.star.frame.XStorable;
+import com.sun.star.document.DocumentEvent;
+import com.sun.star.document.XDocumentEventBroadcaster;
+import com.sun.star.document.XDocumentEventListener;
+import com.sun.star.text.XTextDocument;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.File;
+
+/**
+ * a small program to load documents from one directory (recursively)
+ * and store them in another, implemented as a complex test.
+ */
+public class LoadSaveTest extends ComplexTestCase
+{
+ private XMultiServiceFactory m_xMSF = null;
+ private XComponentContext m_xContext = null;
+ private XDocumentEventBroadcaster m_xGEB = null;
+ private String m_TmpDir = null;
+
+ private String m_fileURL = "file://";
+ // these should be parameters or something?
+ private String m_SourceDir = "FIXME";
+ private String m_TargetDir = "/tmp/out";
+
+ public String[] getTestMethodNames() {
+ return new String[] { "testLoadStore" };
+ }
+
+ public void before() throws Exception
+ {
+ m_xMSF = (XMultiServiceFactory) param.getMSF();
+ XPropertySet xPropertySet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, m_xMSF);
+ Object defaultCtx = xPropertySet.getPropertyValue("DefaultContext");
+ m_xContext = (XComponentContext)
+ UnoRuntime.queryInterface(XComponentContext.class, defaultCtx);
+ assure("could not get component context.", m_xContext != null);
+ Object oGEB = m_xMSF.createInstance(
+ "com.sun.star.frame.GlobalEventBroadcaster");
+ m_xGEB = (XDocumentEventBroadcaster)
+ UnoRuntime.queryInterface(XDocumentEventBroadcaster.class, oGEB);
+ assure("could not get global event broadcaster.", m_xGEB != null);
+ m_TmpDir = util.utils.getOfficeTemp/*Dir*/(m_xMSF);
+ log.println("tempdir: " + m_TmpDir);
+ log.println("sourcedir: " + m_SourceDir);
+ log.println("targetdir: " + m_TargetDir);
+ }
+
+ /*
+ public void after()
+ {
+ }
+ */
+
+ public void testLoadStore() throws Exception
+ {
+ Pair<List<String>, List<String>> dirsFiles =
+ getDirAndFileNames(m_SourceDir);
+ makeDirs(m_TargetDir, dirsFiles.First);
+ for (String fileName : dirsFiles.Second)
+ {
+ try {
+ testDoc(fileName);
+ } catch (Exception e) {
+ report(e);
+ }
+ }
+ }
+
+ public void testDoc(String fileName) throws Exception
+ {
+ XComponent xDoc = null;
+ EventListener xListener = new EventListener();
+ try {
+ m_xGEB.addDocumentEventListener(xListener);
+
+ log.println("Loading document: " + fileName + " ...");
+
+ PropertyValue[] loadProps = new PropertyValue[1];
+ loadProps[0] = new PropertyValue();
+ loadProps[0].Name = "ReadOnly";
+ loadProps[0].Value = new Boolean(true);
+
+ String sourceFile = m_fileURL + m_SourceDir + fileName;
+
+ xDoc = util.DesktopTools.loadDoc(m_xMSF, sourceFile, loadProps);
+
+ log.println("... done");
+
+ {
+ // apparently OnLayoutFinished is not sent for every doc???
+ // 10 seconds is evidently not enough for large documents
+ int time = 0;
+ while (!xListener.IsLayoutFinished() && (time < 30000)) {
+ Thread.sleep(100);
+ time += 100;
+ }
+ if (time >= 30000) {
+ log.println("timeout: no OnLayoutFinished received!");
+ }
+ }
+
+ log.println("Storing document: " + fileName + " ...");
+
+ XStorable xStor = (XStorable) UnoRuntime.queryInterface(
+ XStorable.class, xDoc);
+
+ String targetFile = m_fileURL + m_TargetDir + fileName;
+
+ xStor.storeToURL(targetFile, new PropertyValue[0]);
+
+ log.println("... done");
+
+ } finally {
+ if (xDoc != null) {
+ util.DesktopTools.closeDoc(xDoc);
+ }
+ if (xListener != null) {
+ m_xGEB.removeDocumentEventListener(xListener);
+ }
+ }
+ }
+
+ class EventListener implements XDocumentEventListener
+ {
+ boolean m_isLayoutFinished = false;
+ boolean IsLayoutFinished() { return m_isLayoutFinished; }
+ public void documentEventOccured(DocumentEvent Event)
+ {
+// log.println("event: " + Event.EventName);
+ if ("OnLayoutFinished".equals(Event.EventName))
+ {
+ // we only have one doc at any time, so no need to check
+ m_isLayoutFinished = true;
+// log.println("received OnLayoutFinished");
+ }
+ }
+ public void disposing(EventObject Event) { }
+ }
+
+ void report2(Exception e)
+ {
+ if (e instanceof WrappedTargetException)
+ {
+ log.println("Cause:");
+ Exception cause = (Exception)
+ (((WrappedTargetException)e).TargetException);
+ log.println(cause.toString());
+ report2(cause);
+ } else if (e instanceof WrappedTargetRuntimeException) {
+ log.println("Cause:");
+ Exception cause = (Exception)
+ (((WrappedTargetRuntimeException)e).TargetException);
+ log.println(cause.toString());
+ report2(cause);
+ }
+ }
+
+ void report(Exception e) {
+ log.println("Exception occurred:");
+ log.println(e.toString());
+ e.printStackTrace((java.io.PrintWriter) log);
+ report2(e);
+// failed();
+ }
+
+ Pair<List<String>, List<String>> getDirAndFileNames(String dir)
+ {
+ List<String> dirs = new ArrayList<String>();
+ List<String> files = new ArrayList<String>();
+ File root = new File(dir);
+ getDirAndFileNames(root, "", dirs, files);
+ return new Pair<List<String>, List<String>>(dirs, files);
+ }
+
+ void getDirAndFileNames(File file, String relPath,
+ List<String> dirs, List<String> files)
+ {
+ assure("does not exist: " + relPath, file.exists());
+ if (file.isDirectory()) {
+ dirs.add(relPath);
+ File[] subfiles = file.listFiles();
+ for (File subfile : subfiles)
+ {
+ String subfileName =
+ relPath + File.separator + subfile.getName();
+ getDirAndFileNames(subfile, subfileName, dirs, files);
+ }
+ }
+ else if (file.isFile()) {
+ if (file.getName().endsWith(".odt")) {
+ files.add(relPath);
+ }
+ }
+ }
+
+ void makeDirs(String target, List<String> dirs) throws Exception
+ {
+ for (String dir : dirs) {
+ File f = new File(target + dir);
+ if (!f.exists()) {
+ if (!f.mkdir()) {
+ throw new Exception("cannot mkdir: " + target + dir);
+ }
+ }
+ }
+ }
+}
+
diff --git a/sw/qa/complex/writer/TestDocument.java b/sw/qa/complex/writer/TestDocument.java
new file mode 100644
index 000000000000..088c9aede3d6
--- /dev/null
+++ b/sw/qa/complex/writer/TestDocument.java
@@ -0,0 +1,40 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+package complex.writer;
+
+import java.io.File;
+import org.openoffice.test.OfficeFileUrl;
+import org.openoffice.test.Argument;
+
+final class TestDocument {
+ public static String getUrl(String name) {
+ return OfficeFileUrl.getAbsolute(new File(Argument.get("tdoc"), name));
+ }
+
+ private TestDocument() {}
+}
diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java b/sw/qa/complex/writer/TextPortionEnumerationTest.java
new file mode 100755
index 000000000000..114359bc3581
--- /dev/null
+++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java
@@ -0,0 +1,4164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.writer;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.NoSupportException;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.Pair;
+import com.sun.star.beans.StringPair;
+import com.sun.star.container.XNamed;
+import com.sun.star.container.XChild;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XContentEnumerationAccess;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.frame.XStorable;
+import com.sun.star.util.XCloseable;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextRange;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XWordCursor;
+import com.sun.star.text.XSentenceCursor;
+import com.sun.star.text.XParagraphCursor;
+import com.sun.star.text.XFootnote;
+import com.sun.star.text.XTextField;
+import com.sun.star.text.XBookmarksSupplier;
+import com.sun.star.text.XTextSectionsSupplier;
+import com.sun.star.text.XDocumentIndexesSupplier;
+import com.sun.star.text.TextContentAnchorType;
+import static com.sun.star.text.TextContentAnchorType.*;
+import static com.sun.star.text.ControlCharacter.*;
+import com.sun.star.rdf.XMetadatable;
+import com.sun.star.rdf.Statement;
+import com.sun.star.rdf.XDocumentRepository;
+import com.sun.star.rdf.XRepositorySupplier;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Stack;
+
+
+class TreeNodeEnum
+{
+ private Object[] m_Elements;
+ private int m_Pos;
+ TreeNodeEnum(Object[] Elements) { m_Elements = Elements; m_Pos = 0; }
+ boolean hasNext() { return m_Pos < m_Elements.length; }
+ TreeNode next() { return (TreeNode) m_Elements[m_Pos++]; }
+}
+
+/** base class for tree nodes. only instance: root of tree. */
+class TreeNode
+{
+ private List<TreeNode> m_Children;
+ String getType() { return "__ROOT__"; }
+ boolean hasContent() { return false; }
+ boolean isNesting() { return false; }
+ TreeNode dup() { throw new RuntimeException("TreeNode.dup"); }
+ TreeNodeEnum createEnumeration() {
+ return new TreeNodeEnum(m_Children.toArray());
+ }
+ TreeNode() { m_Children = new ArrayList<TreeNode>(); }
+ TreeNode appendChild(TreeNode child)
+ { m_Children.add(child); return this; }
+ public String toString() {
+ return "<" + getType() + ">";
+ }
+}
+
+abstract class MarkNode extends TreeNode
+{
+ boolean m_isPoint;
+ boolean m_isStart = false;
+ String m_Name;
+ boolean isPoint() { return m_isPoint; }
+ boolean isStart() { return m_isStart; }
+ String getName() { return m_Name; }
+ MarkNode(String name) { m_Name = name; m_isPoint = true; }
+ boolean equals(MarkNode other) {
+ return (other.m_Name.equals(m_Name)) && (other.m_isPoint == m_isPoint)
+ && (other.m_isStart == m_isStart);
+ }
+ public String toString() {
+ return super.toString() + "\tname: " + m_Name +
+ "\tisPoint: " + m_isPoint + "\tisStart: " + m_isStart;
+ }
+}
+
+class BookmarkNode extends MarkNode
+{
+ private StringPair m_XmlId;
+ StringPair getXmlId() { return m_XmlId; }
+ BookmarkNode dup() { return new BookmarkNode(getName(), getXmlId()); }
+ BookmarkNode(String name) { this(name, new StringPair()); }
+ BookmarkNode(String name, StringPair xmlid) {
+ super(name); m_XmlId = xmlid;
+ }
+ String getType() { return "Bookmark"; }
+ public boolean equals(Object other) {
+ return (other instanceof BookmarkNode)
+ && super.equals((MarkNode) other)
+ && MetaNode.eq(((BookmarkNode) other).m_XmlId, m_XmlId);
+ }
+ public String toString() {
+ return super.toString()
+ + "\txmlid: " + m_XmlId.First + "#" + m_XmlId.Second;
+ }
+}
+
+class BookmarkStartNode extends BookmarkNode
+{
+ BookmarkStartNode dup() { return new BookmarkStartNode(getName()); }
+ BookmarkStartNode(String name) { this(name, new StringPair()); }
+ BookmarkStartNode(String name, StringPair xmlid) {
+ super(name, xmlid); m_isPoint = false; m_isStart = true;
+ }
+}
+
+class BookmarkEndNode extends BookmarkNode
+{
+ BookmarkEndNode dup() { return new BookmarkEndNode(getName()); }
+ BookmarkEndNode(String name) { this(name, new StringPair()); }
+ BookmarkEndNode(String name, StringPair xmlid) {
+ super(name, xmlid); m_isPoint = false; m_isStart = false;
+ }
+}
+
+class ReferenceMarkNode extends MarkNode
+{
+ ReferenceMarkNode dup() { return new ReferenceMarkNode(getName()); }
+ ReferenceMarkNode(String name) { super(name); }
+ String getType() { return "ReferenceMark"; }
+ public boolean equals(Object other) {
+ return (other instanceof ReferenceMarkNode)
+ && super.equals((MarkNode) other);
+ }
+}
+
+class ReferenceMarkStartNode extends ReferenceMarkNode
+{
+ ReferenceMarkStartNode dup()
+ { return new ReferenceMarkStartNode(getName()); }
+ ReferenceMarkStartNode(String name) {
+ super(name); m_isPoint = false; m_isStart = true;
+ }
+}
+
+class ReferenceMarkEndNode extends ReferenceMarkNode
+{
+ ReferenceMarkEndNode dup()
+ { return new ReferenceMarkEndNode(getName()); }
+ ReferenceMarkEndNode(String name) {
+ super(name); m_isPoint = false; m_isStart = false;
+ }
+}
+
+class DocumentIndexMarkNode extends MarkNode
+{
+ DocumentIndexMarkNode dup()
+ { return new DocumentIndexMarkNode(getName()); }
+ DocumentIndexMarkNode(String name) { super(name); }
+ String getType() { return "DocumentIndexMark"; }
+ public boolean equals(Object other) {
+ return (other instanceof DocumentIndexMarkNode)
+ && super.equals((MarkNode) other);
+ }
+}
+
+class DocumentIndexMarkStartNode extends DocumentIndexMarkNode
+{
+ DocumentIndexMarkStartNode dup()
+ { return new DocumentIndexMarkStartNode(getName()); }
+ DocumentIndexMarkStartNode(String name) {
+ super(name); m_isPoint = false; m_isStart = true;
+ }
+}
+
+class DocumentIndexMarkEndNode extends DocumentIndexMarkNode
+{
+ DocumentIndexMarkEndNode dup()
+ { return new DocumentIndexMarkEndNode(getName()); }
+ DocumentIndexMarkEndNode(String name) {
+ super(name); m_isPoint = false; m_isStart = false;
+ }
+}
+
+abstract class ContentNode extends TreeNode
+{
+ private String m_Content;
+ String getContent() { return m_Content; }
+ boolean hasContent() { return true; }
+ ContentNode(String content) {
+ m_Content = content;
+ }
+ TreeNode appendChild(TreeNode t) {
+ throw new RuntimeException("ContentNode.appendChild");
+ }
+ public String toString() {
+ return super.toString() + "\tcontent: " + m_Content;
+ }
+ boolean equals(ContentNode other) {
+ return (other.m_Content.equals(m_Content));
+ }
+}
+
+class TextNode extends ContentNode
+{
+ TextNode dup() { return new TextNode(getContent()); }
+ TextNode(String content) { super(content); }
+ String getType() { return "Text"; }
+ public boolean equals(Object other) {
+ return (other instanceof TextNode) && super.equals((ContentNode) other);
+ }
+}
+
+class TextFieldNode extends ContentNode
+{
+ TextFieldNode dup() { return new TextFieldNode(getContent()); }
+ TextFieldNode(String content) { super(content); }
+ String getType() { return "TextField"; }
+ public boolean equals(Object other) {
+ return (other instanceof TextFieldNode)
+ && super.equals((ContentNode) other);
+ }
+}
+
+class FrameNode extends TreeNode
+{
+ private String m_Name;
+ private TextContentAnchorType m_Anchor;
+ String getName() { return m_Name; }
+ TextContentAnchorType getAnchor() { return m_Anchor; }
+ FrameNode dup() { return new FrameNode(getName(), getAnchor()); }
+ FrameNode(String name, TextContentAnchorType anchor) {
+ m_Name = name; m_Anchor = anchor;
+ }
+ String getType() { return "Frame"; }
+ public boolean equals(Object other) {
+ return (other instanceof FrameNode)
+ && (((FrameNode) other).m_Name.equals(m_Name))
+ && (((FrameNode) other).m_Anchor == m_Anchor);
+ }
+ public String toString() {
+ return super.toString()
+ + "\tname: " + m_Name + "\tanchor: " + toString(m_Anchor);
+ }
+ static String toString(TextContentAnchorType anchor) {
+ switch (anchor.getValue()) {
+ case AS_CHARACTER_value: return "AS_CHARACTER";
+ case AT_CHARACTER_value: return "AT_CHARACTER";
+ case AT_PARAGRAPH_value: return "AT_PARAGRAPH";
+ case AT_PAGE_value: return "AT_PAGE";
+ case AT_FRAME_value: return "AT_FRAME";
+ default: throw new RuntimeException("unknown anchor");
+ }
+ }
+}
+
+class FootnoteNode extends TreeNode
+{
+ private String m_Label;
+ String getLabel() { return m_Label; }
+ FootnoteNode dup() { return new FootnoteNode(getLabel()); }
+ FootnoteNode(String label) { m_Label = label; }
+ String getType() { return "Footnote"; }
+ public boolean equals(Object other) {
+ return (other instanceof FootnoteNode)
+ && (((FootnoteNode) other).m_Label.equals(m_Label));
+ }
+ public String toString() {
+ return super.toString() + "\tlabel: " + m_Label;
+ }
+}
+
+class ControlCharacterNode extends TreeNode
+{
+ private short m_Char;
+ short getChar() { return m_Char; }
+ ControlCharacterNode dup() { return new ControlCharacterNode(getChar()); }
+ ControlCharacterNode(short c) { m_Char = c; }
+ String getType() { return "ControlCharacter"; }
+ public boolean equals(Object other) {
+ return (other instanceof ControlCharacterNode)
+ && (((ControlCharacterNode) other).m_Char == m_Char);
+ }
+ public String toString() {
+ return super.toString() + "\tchar: " + m_Char;
+ }
+}
+
+class SoftPageBreakNode extends TreeNode
+{
+ String getType() { return "SoftPageBreak"; }
+ public boolean equals(Object other) {
+ return (other instanceof SoftPageBreakNode);
+ }
+}
+
+class HyperlinkNode extends TreeNode
+{
+ private String m_URL;
+ String getURL() { return m_URL; }
+ HyperlinkNode dup() { return new HyperlinkNode(getURL()); }
+ HyperlinkNode(String url) {
+ if (url.length() == 0) throw new RuntimeException("HyperlinkNode");
+ m_URL = url;
+ }
+ String getType() { return "Hyperlink"; }
+ boolean isNesting() { return true; }
+ public boolean equals(Object other) {
+ return (other instanceof HyperlinkNode)
+ && (((HyperlinkNode) other).m_URL.equals(m_URL));
+ }
+ public String toString() {
+ return super.toString() + "\turl: " + m_URL;
+ }
+}
+
+class RubyNode extends TreeNode
+{
+ private String m_Ruby;
+ String getRubyText() { return m_Ruby; }
+ RubyNode dup() { return new RubyNode(getRubyText()); }
+ RubyNode(String ruby) {
+ if (ruby.length() == 0) throw new RuntimeException("RubyNode");
+ m_Ruby = ruby;
+ }
+ String getType() { return "Ruby"; }
+ boolean isNesting() { return true; }
+ public boolean equals(Object other) {
+ return (other instanceof RubyNode)
+ && (((RubyNode) other).m_Ruby.equals(m_Ruby));
+ }
+ public String toString() {
+ return super.toString() + "\trubytext: " + m_Ruby;
+ }
+}
+
+class MetaNode extends TreeNode
+{
+ private StringPair m_XmlId;
+ StringPair getXmlId() { return m_XmlId; }
+ MetaNode dup() { return new MetaNode(getXmlId()); }
+ MetaNode (StringPair xmlid) { m_XmlId = xmlid; }
+ String getType() { return "InContentMetadata"; }
+ boolean isNesting() { return true; }
+ public boolean equals(Object other) {
+ return (other instanceof MetaNode)
+ && eq(((MetaNode) other).m_XmlId, m_XmlId);
+ }
+ static boolean eq(StringPair left, StringPair right)
+ {
+ return left.First.equals(right.First)
+ && left.Second.equals(right.Second);
+ }
+ public String toString() {
+ return super.toString()
+ + "\txmlid: " + m_XmlId.First + "#" + m_XmlId.Second;
+ }
+}
+
+class MetaFieldNode extends MetaNode
+{
+ MetaFieldNode dup() { return new MetaFieldNode(getXmlId()); }
+ MetaFieldNode (StringPair xmlid) { super(xmlid); }
+ String getType() { return "MetadataField"; }
+}
+
+class Range
+{
+ private short m_Start;
+ private short m_End;
+ private TreeNode m_Node;
+ short getStart() { return m_Start; }
+ short getEnd() { return m_End ; }
+ short getExtent() { return (short) (m_End - m_Start); }
+ TreeNode getNode() { return m_Node; }
+ Range(int start, int end, TreeNode node)
+ { m_Start = (short) start; m_End = (short) end; m_Node = node; }
+}
+
+//----------------------------------------------------------------------
+
+/* this is where we nail the pudding to the wall */
+class FuzzyTester
+{
+ private long m_DiffContent = 0;
+ private long m_DiffMissing = 0;
+ private long m_DiffNesting = 0;
+ private long m_DiffSpuriousEmptyText = 0;
+ private long m_DiffSequence = 0; // ignored?
+ private Stack<Pair<TreeNode, TreeNodeEnum>> m_StackExpected;
+ private Stack<Pair<TreeNode, TreeNodeEnum>> m_StackActual;
+ private List<TreeNode> m_BufferExpected;
+ private List<TreeNode> m_BufferActual;
+
+ FuzzyTester() {
+ m_BufferExpected = new ArrayList<TreeNode>();
+ m_BufferActual = new ArrayList<TreeNode>();
+ m_StackExpected = new Stack<Pair<TreeNode, TreeNodeEnum>>();
+ m_StackActual = new Stack<Pair<TreeNode, TreeNodeEnum>>();
+ }
+
+ /** idea: traverse both trees, enumerate nodes, stopping at content nodes.
+ then compare buffers. */
+ void doTest(TreeNode expected, TreeNode actual)
+ {
+ assertEquals("__ROOT__", expected.getType());
+ assertEquals("__ROOT__", actual.getType());
+ m_StackExpected.push(new Pair(expected, expected.createEnumeration()));
+ m_StackActual.push(new Pair(actual, actual.createEnumeration()));
+ do {
+ traverse(m_StackExpected, m_BufferExpected);
+ traverse(m_StackActual, m_BufferActual);
+ //??? root?
+ testBuffer();
+ } while (!m_StackExpected.empty() || !m_StackActual.empty());
+ if (m_DiffSequence != 0) {
+ System.out.println("warning: " + m_DiffSequence
+ + " differences in sequence");
+ }
+ if (m_DiffSpuriousEmptyText != 0) {
+ System.out.println("warning: " + m_DiffSpuriousEmptyText
+ + " spurious empty text nodes");
+ }
+ if (m_DiffNesting != 0) {
+ System.out.println("WARNING: " + m_DiffNesting
+ + " differences in nesting");
+ }
+ assertEquals(0, m_DiffContent);
+ assertEquals(0, m_DiffMissing);
+ }
+
+ private void traverse(Stack<Pair<TreeNode, TreeNodeEnum>> stack,
+ List<TreeNode> buffer)
+ {
+ while (!stack.empty()) {
+ TreeNodeEnum topEnum = stack.peek().Second;
+ if (topEnum.hasNext()) {
+ TreeNode node = topEnum.next();
+ buffer.add(node);
+ TreeNodeEnum nodeEnum = node.createEnumeration();
+ if (nodeEnum.hasNext()) {
+ stack.push(new Pair(node, nodeEnum));
+ }
+ if (node.hasContent()) {
+ if (!((node instanceof TextNode) // spurious empty text?
+ && ((TextNode) node).getContent().length() == 0)) {
+ return; // break here
+ }
+ }
+ } else {
+ buffer.add(stack.peek().First);
+ stack.pop();
+ }
+ }
+ }
+
+ private void testTerminatingNode()
+ {
+ int lenExpected = m_BufferExpected.size();
+ int lenActual = m_BufferActual.size();
+ if (lenExpected == 0 || lenActual == 0)
+ return;
+ TreeNode expected = m_BufferExpected.get(lenExpected - 1);
+ TreeNode actual = m_BufferActual.get(lenActual - 1);
+
+ boolean eRoot = expected.getType().equals("__ROOT__");
+ boolean aRoot = actual.getType().equals("__ROOT__");
+ if (eRoot || aRoot) {
+ if (!(eRoot && aRoot)) {
+ if (aRoot) printMissing(expected);
+ else printUnexpected(actual);
+ m_DiffMissing++;
+ }
+ return;
+ }
+
+ testContentNode((ContentNode) expected, (ContentNode) actual);
+
+ m_BufferExpected.set(lenExpected - 1, null);
+ m_BufferActual.set(lenActual - 1, null);
+ }
+
+ private void testContentNode(ContentNode expected, ContentNode actual)
+ {
+ String contentExpected = expected.getContent();
+ String contentActual = actual.getContent();
+ if (!expected.equals(actual)) {
+ printDiff("text content differs", contentExpected, contentActual);
+ m_DiffContent++;
+ }
+ }
+
+ private void testBuffer()
+ {
+ int lenExpected = m_BufferExpected.size();
+ int lenActual = m_BufferActual.size();
+ for (int i = 0; i < lenExpected - 1; i++ )
+ {
+ TreeNode node = m_BufferExpected.get(i);
+ int j = m_BufferActual.indexOf(node);
+ if (j >= 0) {
+ TreeNode other = m_BufferActual.get(j);
+ if (j != i)
+ {
+ //FIXME how bad is this?
+ printDiff("position differs",
+ String.valueOf(i), String.valueOf(j));
+ // a hacky hack
+ int min = Math.min(i,j);
+ int max = Math.max(Math.min(lenActual - 1, i),j);
+ for (int k = min; k != max; k ++) {
+ TreeNode tmp = m_BufferActual.get(k);
+ if (tmp != null && tmp.isNesting()) {
+ printNesting(node, tmp);
+ m_DiffNesting++;
+ }
+ }
+ m_DiffSequence++;
+ }
+ m_BufferActual.set(j, null);
+ } else {
+//System.out.println("testBuffer:");
+ printMissing(node);
+ m_DiffMissing++;
+ }
+ }
+ for (int j = 0; j < lenActual - 1; j++)
+ {
+ TreeNode node = m_BufferActual.get(j);
+ if (node != null)
+ {
+//System.out.println("testBuffer:");
+ printUnexpected(node);
+ if ((node instanceof TextNode) &&
+ ((TextNode) node).getContent().length() == 0) {
+ m_DiffSpuriousEmptyText++;
+ } else {
+ m_DiffMissing++;
+ }
+ }
+ }
+ testTerminatingNode();
+ m_BufferExpected.clear();
+ m_BufferActual.clear();
+ }
+
+ void printDiff(String prefix, String expected, String actual)
+ {
+ System.out.println(prefix +
+ ":\texpected: " + expected + "\tactual: " + actual);
+ }
+
+ void printNesting(TreeNode node, TreeNode nesting)
+ {
+ System.out.println("node: " + node.toString()
+ + " possibly moved across nesting " + nesting.toString());
+ }
+
+ void printMissing(TreeNode node)
+ {
+ System.out.println(" missing node: " + node.toString());
+
+ }
+
+ void printUnexpected(TreeNode node)
+ {
+ System.out.println("unexpected node: " + node.toString());
+
+ }
+}
+
+
+//----------------------------------------------------------------------
+
+class EnumConverter
+{
+ private Stack<TreeNode> m_Stack;
+
+ EnumConverter() {
+ m_Stack = new Stack<TreeNode>();
+ }
+
+ TreeNode convert(XEnumeration xEnum) throws Exception
+ {
+ TreeNode root = new TreeNode();
+ m_Stack.push(root);
+ TreeNode ret = convertChildren(xEnum);
+ assertTrue("EnumConverter.convert: stack", m_Stack.empty());
+ return ret;
+ }
+
+ TreeNode convertChildren(XEnumeration xEnum) throws Exception
+ {
+ while (xEnum.hasMoreElements()) {
+ TreeNode node;
+ Object xElement = xEnum.nextElement();
+ XTextRange xPortion = (XTextRange)
+ UnoRuntime.queryInterface(XTextRange.class, xElement);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xPortion);
+ String type = (String) xPropSet.getPropertyValue("TextPortionType");
+ if (type.equals("Text")) {
+ String text = xPortion.getString();
+ node = new TextNode(text);
+ String url = (String) xPropSet.getPropertyValue("HyperLinkURL");
+ if (url.length() > 0) {
+ TreeNode temp = node;
+ node = new HyperlinkNode(url);
+ node.appendChild(temp);
+ }
+ } else if (type.equals("TextField")) {
+ Object xField = xPropSet.getPropertyValue("TextField");
+ XServiceInfo xService = (XServiceInfo)
+ UnoRuntime.queryInterface(XServiceInfo.class, xField);
+ if (xService.supportsService(
+ "com.sun.star.text.textfield.MetadataField"))
+ {
+ XMetadatable xMeta = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xField);
+ StringPair xmlid = xMeta.getMetadataReference();
+ node = new MetaFieldNode(xmlid);
+ m_Stack.push(node);
+ XEnumerationAccess xEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,
+ xMeta);
+ XEnumeration xEnumChildren = xEA.createEnumeration();
+ TreeNode node2 = convertChildren(xEnumChildren);
+ assertSame("stack error: meta-field", node2, node);
+ } else {
+ XPropertySet xFieldPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xField);
+ String content = (String)
+ xFieldPropSet.getPropertyValue("Content");
+ boolean isFixed = (Boolean)
+ xFieldPropSet.getPropertyValue("IsFixed");
+ assertTrue("field not fixed?", isFixed);
+ node = new TextFieldNode(content);
+ }
+ } else if (type.equals("Footnote")) {
+ Object xNote = xPropSet.getPropertyValue("Footnote");
+ XFootnote xFootnote = (XFootnote)
+ UnoRuntime.queryInterface(XFootnote.class, xNote);
+ String label = xFootnote.getLabel();
+ node = new FootnoteNode(label);
+ } else if (type.equals("Frame")) {
+ XContentEnumerationAccess xCEA = (XContentEnumerationAccess)
+ UnoRuntime.queryInterface(XContentEnumerationAccess.class,
+ xPortion);
+ XEnumeration xContentEnum = xCEA.createContentEnumeration("");
+ while (xContentEnum.hasMoreElements()) {
+ Object xFrame = xContentEnum.nextElement();
+ XPropertySet xFramePropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xFrame);
+ TextContentAnchorType anchor = (TextContentAnchorType)
+ xFramePropSet.getPropertyValue("AnchorType");
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xFrame);
+ String name = xNamed.getName();
+ node = new FrameNode(name, anchor);
+ m_Stack.peek().appendChild(node);
+ }
+ continue;
+ } else if (type.equals("ControlCharacter")) {
+ short c = (Short)
+ xPropSet.getPropertyValue("ControlCharacter");
+ node = new ControlCharacterNode(c);
+ } else if (type.equals("Bookmark")) {
+ Object xMark = xPropSet.getPropertyValue("Bookmark");
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xMark);
+ String name = xNamed.getName();
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMark);
+ StringPair xmlid = xMetadatable.getMetadataReference();
+ boolean isCollapsed = (Boolean)
+ xPropSet.getPropertyValue("IsCollapsed");
+ if (isCollapsed) {
+ node = new BookmarkNode(name, xmlid);
+ } else {
+ boolean isStart = (Boolean)
+ xPropSet.getPropertyValue("IsStart");
+ if (isStart) {
+ node = new BookmarkStartNode(name, xmlid);
+ } else {
+ node = new BookmarkEndNode(name, xmlid);
+ }
+ }
+ } else if (type.equals("ReferenceMark")) {
+ Object xMark = xPropSet.getPropertyValue("ReferenceMark");
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xMark);
+ String name = xNamed.getName();
+ boolean isCollapsed = (Boolean)
+ xPropSet.getPropertyValue("IsCollapsed");
+ if (isCollapsed) {
+ node = new ReferenceMarkNode(name);
+ } else {
+ boolean isStart = (Boolean)
+ xPropSet.getPropertyValue("IsStart");
+ if (isStart) {
+ node = new ReferenceMarkStartNode(name);
+ } else {
+ node = new ReferenceMarkEndNode(name);
+ }
+ }
+ } else if (type.equals("DocumentIndexMark")) {
+ Object xMark = xPropSet.getPropertyValue("DocumentIndexMark");
+ XPropertySet xMarkSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xMark);
+ String name = (String) xMarkSet.getPropertyValue("PrimaryKey");
+ boolean isCollapsed = (Boolean)
+ xPropSet.getPropertyValue("IsCollapsed");
+ if (isCollapsed) {
+ node = new DocumentIndexMarkNode(name);
+ } else {
+ boolean isStart = (Boolean)
+ xPropSet.getPropertyValue("IsStart");
+ if (isStart) {
+ node = new DocumentIndexMarkStartNode(name);
+ } else {
+ node = new DocumentIndexMarkEndNode(name);
+ }
+ }
+ } else if (type.equals("SoftPageBreak")) {
+ node = new SoftPageBreakNode();
+ } else if (type.equals("Ruby")) {
+ boolean isStart = (Boolean)
+ xPropSet.getPropertyValue("IsStart");
+ if (isStart) {
+ // ARRGH!!! stupid api...
+ // the text is ONLY at the start!
+ String ruby = (String)
+ xPropSet.getPropertyValue("RubyText");
+ node = new RubyNode(ruby);
+ m_Stack.push(node);
+ continue;
+ } else {
+ node = m_Stack.pop();
+ assertTrue("stack error: Ruby expected; is: " +
+ node.toString(), node instanceof RubyNode);
+ }
+ } else if (type.equals("InContentMetadata")) {
+ Object xMeta = xPropSet.getPropertyValue("InContentMetadata");
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMeta);
+ StringPair xmlid = xMetadatable.getMetadataReference();
+ node = new MetaNode(xmlid);
+ m_Stack.push(node);
+ XEnumerationAccess xEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, xMeta);
+ XEnumeration xEnumChildren = xEA.createEnumeration();
+ TreeNode node2 = convertChildren(xEnumChildren);
+ assertSame("stack error: meta", node2, node);
+ } else {
+ throw new RuntimeException("unexpected type: " + type);
+ }
+ m_Stack.peek().appendChild(node);
+ }
+ TreeNode ret = m_Stack.pop();
+ return ret;
+ }
+}
+
+
+//----------------------------------------------------------------------
+
+abstract class Inserter
+{
+ private XMultiServiceFactory m_xDocFactory;
+ XText m_xText;
+ XParagraphCursor m_xCursor;
+
+ Inserter(XTextDocument xDoc)
+ {
+ m_xDocFactory = (XMultiServiceFactory)
+ UnoRuntime.queryInterface(XMultiServiceFactory.class, xDoc);
+ m_xText = xDoc.getText();
+ XTextCursor xCursor = m_xText.createTextCursor();
+ m_xCursor = (XParagraphCursor)
+ UnoRuntime.queryInterface(XParagraphCursor.class, xCursor);
+ }
+
+ void initParagraph() throws Exception
+ {
+ m_xCursor.gotoStartOfParagraph(false);
+ m_xText.insertControlCharacter(m_xCursor, PARAGRAPH_BREAK, false);
+ // we split the first (empty) paragraph, and then insert into the
+ // second (empty) paragraph; this ensures first is always empty!
+ }
+
+ void insertControlCharacter(XTextCursor xCursor, short cchar)
+ throws Exception
+ {
+ m_xText.insertControlCharacter(xCursor, cchar, false);
+ }
+
+ void insertText(XTextCursor xCursor, String text)
+ {
+ xCursor.setString(text);
+ }
+
+ void insertTextField(XTextCursor xCursor, String content) throws Exception
+ {
+ XTextContent xContent = makeTextField(content);
+ xContent.attach(xCursor);
+ }
+
+ XTextContent makeTextField(String content)
+ throws Exception
+ {
+ Object xField =
+ m_xDocFactory.createInstance("com.sun.star.text.textfield.Author");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xField);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xField);
+ xPropSet.setPropertyValue("IsFixed", true);
+ xPropSet.setPropertyValue("FullName", false);
+ xPropSet.setPropertyValue("Content", content);
+ return xContent;
+ }
+
+ void insertFrame(XTextRange xCursor, String name,
+ TextContentAnchorType anchor) throws Exception
+ {
+ XTextContent xContent = makeFrame(name, anchor);
+ xContent.attach(xCursor);
+ }
+
+ XTextContent makeFrame(String name, TextContentAnchorType anchor)
+ throws Exception
+ {
+ Object xFrame =
+ m_xDocFactory.createInstance("com.sun.star.text.TextFrame");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xFrame);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xFrame);
+ xPropSet.setPropertyValue("AnchorType", anchor);
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xContent);
+ xNamed.setName(name);
+ return xContent;
+ }
+
+ void insertFootnote(XTextCursor xCursor, String label) throws Exception
+ {
+ XTextContent xContent = makeFootnote(label);
+ xContent.attach(xCursor);
+ }
+
+ XTextContent makeFootnote(String label) throws Exception
+ {
+ Object xNote =
+ m_xDocFactory.createInstance("com.sun.star.text.Footnote");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xNote);
+ XFootnote xFootnote = (XFootnote)
+ UnoRuntime.queryInterface(XFootnote.class, xNote);
+ xFootnote.setLabel(label);
+ return xContent;
+ }
+
+ void insertBookmark(XTextCursor xCursor, String name, StringPair xmlid)
+ throws Exception
+ {
+ XTextContent xContent = makeBookmark(name);
+ xContent.attach(xCursor);
+ if (!xmlid.First.equals(""))
+ {
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xContent);
+ xMetadatable.setMetadataReference(xmlid);
+ }
+ }
+
+ XTextContent makeBookmark(String name) throws Exception
+ {
+ Object xBookmark =
+ m_xDocFactory.createInstance("com.sun.star.text.Bookmark");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xBookmark);
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xContent);
+ xNamed.setName(name);
+ return xContent;
+ }
+
+ void insertReferenceMark(XTextCursor xCursor, String name) throws Exception
+ {
+ XTextContent xContent = makeReferenceMark(name);
+ xContent.attach(xCursor);
+ }
+
+ XTextContent makeReferenceMark(String name) throws Exception
+ {
+ Object xMark =
+ m_xDocFactory.createInstance("com.sun.star.text.ReferenceMark");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xMark);
+ XNamed xNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xContent);
+ xNamed.setName(name);
+ return xContent;
+ }
+
+ void insertDocumentIndexMark(XTextCursor xCursor, String key)
+ throws Exception
+ {
+ XTextContent xContent = makeDocumentIndexMark(key);
+ xContent.attach(xCursor);
+ }
+
+ XTextContent makeDocumentIndexMark(String key) throws Exception
+ {
+ Object xMark =
+ m_xDocFactory.createInstance("com.sun.star.text.DocumentIndexMark");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xMark);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xMark);
+ xPropSet.setPropertyValue("PrimaryKey", key);
+ return xContent;
+ }
+
+ void insertHyperlink(XTextCursor xCursor, String url) throws Exception
+ {
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xCursor);
+ xPropSet.setPropertyValue("HyperLinkURL", url);
+ }
+
+ void insertRuby(XTextCursor xCursor, String rubytext) throws Exception
+ {
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xCursor);
+ xPropSet.setPropertyValue("RubyText", rubytext);
+ }
+
+ XTextContent insertMeta(XTextCursor xCursor, StringPair xmlid)
+ throws Exception
+ {
+ XTextContent xContent = makeMeta();
+ xContent.attach(xCursor);
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xContent);
+ xMetadatable.setMetadataReference(xmlid);
+ return xContent;
+ }
+
+ XTextContent makeMeta() throws Exception
+ {
+ Object xMeta = m_xDocFactory.createInstance(
+ "com.sun.star.text.InContentMetadata");
+ XTextContent xContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, xMeta);
+ return xContent;
+ }
+
+ XTextField insertMetaField(XTextCursor xCursor, StringPair xmlid)
+ throws Exception
+ {
+ XTextField xContent = makeMetaField();
+ xContent.attach(xCursor);
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xContent);
+ xMetadatable.setMetadataReference(xmlid);
+ return xContent;
+ }
+
+ XTextField makeMetaField() throws Exception
+ {
+ Object xMeta = m_xDocFactory.createInstance(
+ "com.sun.star.text.textfield.MetadataField");
+ XTextField xContent = (XTextField)
+ UnoRuntime.queryInterface(XTextField.class, xMeta);
+ return xContent;
+ }
+
+}
+
+class TreeInserter extends Inserter
+{
+ private Map<String, XTextRange> m_BookmarkStarts;
+ private Map<String, XTextRange> m_ReferenceMarkStarts;
+ private Map<String, XTextRange> m_DocumentIndexMarkStarts;
+ private List<Pair<XTextRange, FrameNode>> m_FrameHints;
+
+ TreeInserter(XTextDocument xDoc)
+ {
+ super(xDoc);
+ m_BookmarkStarts = new HashMap<String, XTextRange>();
+ m_ReferenceMarkStarts = new HashMap<String, XTextRange>();
+ m_DocumentIndexMarkStarts = new HashMap<String, XTextRange>();
+ m_FrameHints = new ArrayList<Pair<XTextRange, FrameNode>>();
+ }
+
+ void insertTree(TreeNode tree) throws Exception
+ {
+ if (!tree.getType().equals("__ROOT__"))
+ throw new RuntimeException("insertTree: test error: no root");
+ initParagraph();
+ insertChildren(tree.createEnumeration());
+ for (int i = 0; i < m_FrameHints.size(); ++i) {
+ Pair<XTextRange, FrameNode> p = m_FrameHints.get(i);
+ insertFrame(p.First, p.Second.getName(), p.Second.getAnchor());
+ }
+ }
+
+ void insertChildren(TreeNodeEnum children) throws Exception
+ {
+ while (children.hasNext()) {
+ m_xCursor.gotoEndOfParagraph(false);
+ TreeNode node = children.next();
+ String type = node.getType();
+ if (type.equals("Bookmark")) {
+ BookmarkNode bkmk = (BookmarkNode) node;
+ String name = bkmk.getName();
+ StringPair id = bkmk.getXmlId();
+ if (bkmk.isPoint()) {
+ insertBookmark(m_xCursor, name, id);
+ } else if (bkmk.isStart()) {
+ m_BookmarkStarts.put(name, m_xCursor.getStart());
+ } else {
+ XTextRange xRange = m_BookmarkStarts.get(name);
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertBookmark(xCursor, name, id);
+ }
+ } else if (type.equals("ReferenceMark")) {
+ ReferenceMarkNode mark = (ReferenceMarkNode) node;
+ String name = mark.getName();
+ if (mark.isPoint()) {
+ insertReferenceMark(m_xCursor, name);
+ } else if (mark.isStart()) {
+ m_ReferenceMarkStarts.put(name, m_xCursor.getStart());
+ } else {
+ XTextRange xRange = m_ReferenceMarkStarts.get(name);
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertReferenceMark(xCursor, name);
+ }
+ } else if (type.equals("DocumentIndexMark")) {
+ DocumentIndexMarkNode mark = (DocumentIndexMarkNode) node;
+ String name = mark.getName();
+ if (mark.isPoint()) {
+ insertDocumentIndexMark(m_xCursor, name);
+ } else if (mark.isStart()) {
+ m_DocumentIndexMarkStarts.put(name, m_xCursor.getStart());
+ } else {
+ XTextRange xRange = m_DocumentIndexMarkStarts.get(name);
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertDocumentIndexMark(xCursor, name);
+ }
+ } else if (type.equals("Hyperlink")) {
+ HyperlinkNode href = (HyperlinkNode) node;
+ XTextRange xRange = m_xCursor.getStart();
+ insertChildren(href.createEnumeration());
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertHyperlink(xCursor, href.getURL());
+ } else if (type.equals("Ruby")) {
+ RubyNode ruby = (RubyNode) node;
+ XTextRange xRange = m_xCursor.getStart();
+ insertChildren(ruby.createEnumeration());
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertRuby(xCursor, ruby.getRubyText());
+ } else if (type.equals("InContentMetadata")) {
+ MetaNode meta = (MetaNode) node;
+ XTextRange xRange = m_xCursor.getStart();
+ insertChildren(meta.createEnumeration());
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertMeta(xCursor, meta.getXmlId());
+ } else if (type.equals("MetadataField")) {
+ MetaFieldNode meta = (MetaFieldNode) node;
+ XTextRange xRange = m_xCursor.getStart();
+ insertChildren(meta.createEnumeration());
+ XParagraphCursor xCursor = mkCursor(xRange);
+ insertMetaField(xCursor, meta.getXmlId());
+ } else if (type.equals("Text")) {
+ TextNode text = (TextNode) node;
+ insertText(m_xCursor, text.getContent());
+ } else if (type.equals("TextField")) {
+ TextFieldNode field = (TextFieldNode) node;
+ insertTextField(m_xCursor, field.getContent());
+ } else if (type.equals("Footnote")) {
+ FootnoteNode note = (FootnoteNode) node;
+ insertFootnote(m_xCursor, note.getLabel());
+ } else if (type.equals("Frame")) {
+ FrameNode frame = (FrameNode) node;
+ if (frame.getAnchor() == AT_CHARACTER) {
+ m_FrameHints.add( new Pair(m_xCursor.getStart(), frame) );
+ } else {
+ insertFrame(m_xCursor, frame.getName(), frame.getAnchor());
+ }
+ } else if (type.equals("ControlCharacter")) {
+ ControlCharacterNode cchar = (ControlCharacterNode) node;
+ insertControlCharacter(m_xCursor, cchar.getChar());
+ } else if (type.equals("SoftPageBreak")) {
+ SoftPageBreakNode spbk = (SoftPageBreakNode) node;
+ throw new RuntimeException("sorry, cannot test SoftPageBreak");
+ } else {
+ throw new RuntimeException("unexpected type: " + type);
+ }
+ }
+ }
+
+ XParagraphCursor mkCursor(XTextRange xRange)
+ {
+ XTextCursor xCursor = m_xText.createTextCursorByRange(xRange);
+ XParagraphCursor xParaCursor = (XParagraphCursor)
+ UnoRuntime.queryInterface(XParagraphCursor.class, xCursor);
+ xParaCursor.gotoEndOfParagraph(true);
+ return xParaCursor;
+ }
+}
+
+
+// FIXME: this does not account for inserted dummy characters!
+class RangeInserter extends Inserter
+{
+ RangeInserter(XTextDocument xDoc) throws Exception
+ { super(xDoc); initParagraph(); }
+
+ /*
+ void insertText(int pos, String text)
+ {
+ m_xCursor.gotoStartOfParagraph(false);
+ m_xCursor.goRight((short) pos, false);
+ insertText(m_xCursor, text);
+ }
+ */
+
+ XTextContent insertRange(Range range) throws Exception
+ {
+ m_xCursor.gotoStartOfParagraph(false);
+ m_xCursor.goRight(range.getStart(), false);
+ m_xCursor.goRight(range.getExtent(), true);
+ return insertNode(m_xCursor, range.getNode());
+ }
+
+ XTextContent insertNode(XParagraphCursor xCursor, TreeNode node)
+ throws Exception
+ {
+ String type = node.getType();
+ if (type.equals("Bookmark")) {
+ BookmarkNode bkmk = (BookmarkNode) node;
+ if (bkmk.isPoint()) throw new RuntimeException("range only");
+ insertBookmark(xCursor, bkmk.getName(), bkmk.getXmlId());
+ } else if (type.equals("ReferenceMark")) {
+ ReferenceMarkNode mark = (ReferenceMarkNode) node;
+ if (mark.isPoint()) throw new RuntimeException("range only");
+ insertReferenceMark(xCursor, mark.getName());
+ } else if (type.equals("DocumentIndexMark")) {
+ DocumentIndexMarkNode mark = (DocumentIndexMarkNode) node;
+ if (mark.isPoint()) throw new RuntimeException("range only");
+ insertDocumentIndexMark(xCursor, mark.getName());
+ } else if (type.equals("Hyperlink")) {
+ HyperlinkNode href = (HyperlinkNode) node;
+ insertHyperlink(xCursor, href.getURL());
+ } else if (type.equals("Ruby")) {
+ RubyNode ruby = (RubyNode) node;
+ insertRuby(xCursor, ruby.getRubyText());
+ } else if (type.equals("InContentMetadata")) {
+ MetaNode meta = (MetaNode) node;
+ return insertMeta(xCursor, meta.getXmlId());
+ } else if (type.equals("MetadataField")) {
+ MetaFieldNode meta = (MetaFieldNode) node;
+ return insertMetaField(xCursor, meta.getXmlId());
+ } else if (type.equals("Text")) {
+ TextNode text = (TextNode) node;
+ insertText(xCursor, text.getContent());
+ } else if (type.equals("TextField")) {
+ TextFieldNode field = (TextFieldNode) node;
+ insertTextField(m_xCursor, field.getContent());
+ } else if (type.equals("Footnote")) {
+ FootnoteNode note = (FootnoteNode) node;
+ insertFootnote(m_xCursor, note.getLabel());
+ } else if (type.equals("Frame")) {
+ FrameNode frame = (FrameNode) node;
+ insertFrame(xCursor, frame.getName(), frame.getAnchor());
+ } else if (type.equals("ControlCharacter")) {
+ ControlCharacterNode cchar = (ControlCharacterNode) node;
+ insertControlCharacter(m_xCursor, cchar.getChar());
+ } else if (type.equals("SoftPageBreak")) {
+ throw new RuntimeException("sorry, cannot test SoftPageBreak");
+ } else {
+ throw new RuntimeException("unexpected type: " + type);
+ }
+ return null;
+ }
+}
+
+
+//----------------------------------------------------------------------
+
+public class TextPortionEnumerationTest
+{
+ private XMultiServiceFactory m_xMSF = null;
+ private XComponentContext m_xContext = null;
+ private XTextDocument m_xDoc = null;
+ private String m_TmpDir = null;
+
+ private int m_Count = 1;
+
+ @Before public void before() throws Exception
+ {
+ m_xMSF = UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ connection.getComponentContext().getServiceManager());
+ XPropertySet xPropertySet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, m_xMSF);
+ Object defaultCtx = xPropertySet.getPropertyValue("DefaultContext");
+ m_xContext = (XComponentContext)
+ UnoRuntime.queryInterface(XComponentContext.class, defaultCtx);
+ assertNotNull("could not get component context.", m_xContext);
+ m_xDoc = util.WriterTools.createTextDoc(m_xMSF);
+ m_TmpDir = util.utils.getOfficeTemp/*Dir*/(m_xMSF);
+ System.out.println("tempdir: " + m_TmpDir);
+ }
+
+ @After public void after()
+ {
+ util.DesktopTools.closeDoc(m_xDoc);
+ }
+
+ @Test public void testText() throws Exception
+ {
+ TreeNode root = new TreeNode();
+ TreeNode text = new TextNode("abc");
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ @Test public void testTextField() throws Exception
+ {
+ String name = mkName("ruby");
+ TreeNode root = new TreeNode();
+ TreeNode txtf = new TextFieldNode("abc");
+ root.appendChild(txtf);
+ doTest(root);
+ }
+
+ /*@Test*/ public void testControlChar() throws Exception
+ {
+//FIXME this is converted to a text portion: ControlCharacter is obsolete
+ TreeNode root = new TreeNode();
+ TreeNode cchr = new ControlCharacterNode(HARD_HYPHEN);
+ root.appendChild(cchr);
+ doTest(root);
+ }
+
+ /*@Test*/ public void testSoftPageBreak() throws Exception
+ {
+//FIXME: insert a soft page break: not done
+ TreeNode root = new TreeNode();
+ TreeNode spbk = new SoftPageBreakNode();
+ TreeNode text = new TextNode("abc");
+ root.appendChild(spbk);
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ @Test public void testFootnote() throws Exception
+ {
+ String name = mkName("ftn");
+ TreeNode root = new TreeNode();
+ TreeNode ftnd = new FootnoteNode(name);
+ root.appendChild(ftnd);
+ doTest(root);
+ }
+
+ @Test public void testFrameAs() throws Exception
+ {
+ String name = mkName("frame");
+ TreeNode root = new TreeNode();
+ TreeNode fram = new FrameNode(name, AS_CHARACTER);
+ root.appendChild(fram);
+ doTest(root);
+ }
+
+ @Test public void testFrameAt() throws Exception
+ {
+ String name = mkName("frame");
+ TreeNode root = new TreeNode();
+// TreeNode text = new TextNode(""); // necessary?
+ TreeNode fram = new FrameNode(name, AT_CHARACTER);
+// root.appendChild(text);
+ root.appendChild(fram);
+ doTest(root);
+ }
+
+ @Test public void testBookmarkPoint() throws Exception
+ {
+ String name = mkName("mark");
+ TreeNode root = new TreeNode();
+ TreeNode bkmk = new BookmarkNode(name);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(bkmk);
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ @Test public void testBookmark() throws Exception
+ {
+ String name = mkName("mark");
+ TreeNode root = new TreeNode();
+ TreeNode bkm1 = new BookmarkStartNode(name);
+ TreeNode text = new TextNode("abc");
+ TreeNode bkm2 = new BookmarkEndNode(name);
+ root.appendChild(bkm1);
+ root.appendChild(text);
+ root.appendChild(bkm2);
+ doTest(root);
+ }
+
+ @Test public void testBookmarkPointXmlId() throws Exception
+ {
+ String name = mkName("mark");
+ StringPair id = mkId("id");
+ TreeNode root = new TreeNode();
+ TreeNode bkmk = new BookmarkNode(name, id);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(bkmk);
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ @Test public void testBookmarkXmlId() throws Exception
+ {
+ String name = mkName("mark");
+ StringPair id = mkId("id");
+ TreeNode root = new TreeNode();
+ TreeNode bkm1 = new BookmarkStartNode(name, id);
+ TreeNode text = new TextNode("abc");
+ TreeNode bkm2 = new BookmarkEndNode(name, id);
+ root.appendChild(bkm1);
+ root.appendChild(text);
+ root.appendChild(bkm2);
+ doTest(root);
+ }
+
+ @Test public void testRefmarkPoint() throws Exception
+ {
+ String name = mkName("refmark");
+ TreeNode root = new TreeNode();
+ TreeNode rfmk = new ReferenceMarkNode(name);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(rfmk);
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ @Test public void testRefmark() throws Exception
+ {
+ String name = mkName("refmark");
+ TreeNode root = new TreeNode();
+ TreeNode rfm1 = new ReferenceMarkStartNode(name);
+ TreeNode text = new TextNode("abc");
+ TreeNode rfm2 = new ReferenceMarkEndNode(name);
+ root.appendChild(rfm1);
+ root.appendChild(text);
+ root.appendChild(rfm2);
+ doTest(root);
+ }
+
+ @Test public void testToxmarkPoint() throws Exception
+ {
+ String name = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ TreeNode txmk = new DocumentIndexMarkNode(name);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(txmk);
+ root.appendChild(text);
+ doTest(root);
+ }
+
+ @Test public void testToxmark() throws Exception
+ {
+ String name = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ TreeNode txm1 = new DocumentIndexMarkStartNode(name);
+ TreeNode text = new TextNode("abc");
+ TreeNode txm2 = new DocumentIndexMarkEndNode(name);
+ root.appendChild(txm1);
+ root.appendChild(text);
+ root.appendChild(txm2);
+ doTest(root);
+ }
+
+ @Test public void testHyperlink() throws Exception
+ {
+ String name = mkName("url");
+ TreeNode root = new TreeNode();
+ TreeNode href = new HyperlinkNode(name);
+ TreeNode text = new TextNode("abc");
+ href.appendChild(text);
+ root.appendChild(href);
+ doTest(root);
+ }
+
+ @Test public void testHyperlinkEmpty() throws Exception
+ {
+ String name = mkName("url");
+ TreeNode root = new TreeNode();
+ TreeNode href = new HyperlinkNode(name);
+ TreeNode text = new TextNode("");
+ href.appendChild(text);
+ root.appendChild(href);
+ doTest(root);
+ }
+
+ @Test public void testRuby() throws Exception
+ {
+ String name = mkName("ruby");
+ TreeNode root = new TreeNode();
+ TreeNode ruby = new RubyNode(name);
+ TreeNode text = new TextNode("abc");
+ ruby.appendChild(text);
+ root.appendChild(ruby);
+ doTest(root);
+ }
+
+ @Test public void testRubyEmpty() throws Exception
+ {
+ // BUG: #i91534#
+ String name = mkName("ruby");
+ TreeNode root = new TreeNode();
+ TreeNode ruby = new RubyNode(name);
+ root.appendChild(ruby);
+ doTest(root);
+ }
+
+ @Test public void testMeta() throws Exception
+ {
+ StringPair id = new StringPair("content.xml", mkName("id"));
+ TreeNode root = new TreeNode();
+ TreeNode meta = new MetaNode(id);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(new TextNode("123"));
+ meta.appendChild(text);
+ root.appendChild(meta);
+ doTest(root);
+ }
+
+ @Test public void testMetaEmpty() throws Exception
+ {
+ StringPair id = new StringPair("content.xml", mkName("id"));
+ TreeNode root = new TreeNode();
+ TreeNode meta = new MetaNode(id);
+// TreeNode text = new TextNode("");
+// meta.appendChild(text);
+ root.appendChild(meta);
+ doTest(root);
+ }
+
+ @Test public void testMetaField() throws Exception
+ {
+ StringPair id = new StringPair("content.xml", mkName("id"));
+ TreeNode root = new TreeNode();
+ TreeNode meta = new MetaFieldNode(id);
+ TreeNode text = new TextNode("abc");
+ root.appendChild(new TextNode("123"));
+ meta.appendChild(text);
+ root.appendChild(meta);
+ doTest(root);
+ }
+
+ @Test public void testMetaFieldEmpty() throws Exception
+ {
+ StringPair id = new StringPair("content.xml", mkName("id"));
+ TreeNode root = new TreeNode();
+ TreeNode meta = new MetaFieldNode(id);
+// TreeNode text = new TextNode("");
+// meta.appendChild(text);
+ root.appendChild(meta);
+ doTest(root);
+ }
+
+ @Test public void testBookmark1() throws Exception
+ {
+ String name1 = mkName("mark");
+ String name2 = mkName("mark");
+ String name3 = mkName("mark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new BookmarkNode(name2) );
+ root.appendChild( new BookmarkStartNode(name3) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new BookmarkEndNode(name3) );
+ doTest(root);
+ }
+
+ @Test public void testBookmark2() throws Exception
+ {
+ String name1 = mkName("mark");
+ String name2 = mkName("mark");
+ String name3 = mkName("mark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkNode(name2) );
+ root.appendChild( new BookmarkStartNode(name3) );
+ root.appendChild( new BookmarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new BookmarkEndNode(name3) );
+ doTest(root);
+ }
+
+ @Test public void testRefMark2() throws Exception
+ {
+ String name1 = mkName("refmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new ReferenceMarkStartNode(name1) );
+ root.appendChild( new TextNode("abc") );
+ // BUG: #i102541# (this is actually not unoportenum's fault)
+ root.appendChild( new ReferenceMarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ doTest(root);
+ }
+
+ @Test public void testRefMark3() throws Exception
+ {
+ // BUG: #i107672# (non-deterministic; depends on pointer ordering)
+ String name1 = mkName("refmark");
+ String name2 = mkName("refmark");
+ String name3 = mkName("refmark");
+ String name4 = mkName("refmark");
+ String name5 = mkName("refmark");
+ String name6 = mkName("refmark");
+ String name7 = mkName("refmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new ReferenceMarkStartNode(name1) );
+ root.appendChild( new ReferenceMarkStartNode(name2) );
+ root.appendChild( new ReferenceMarkStartNode(name3) );
+ root.appendChild( new ReferenceMarkStartNode(name4) );
+ root.appendChild( new ReferenceMarkStartNode(name5) );
+ root.appendChild( new ReferenceMarkStartNode(name6) );
+ root.appendChild( new ReferenceMarkStartNode(name7) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new ReferenceMarkEndNode(name7) );
+ root.appendChild( new ReferenceMarkEndNode(name6) );
+ root.appendChild( new ReferenceMarkEndNode(name5) );
+ root.appendChild( new ReferenceMarkEndNode(name4) );
+ root.appendChild( new ReferenceMarkEndNode(name3) );
+ root.appendChild( new ReferenceMarkEndNode(name2) );
+ root.appendChild( new ReferenceMarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ doTest(root);
+ }
+
+ @Test public void testToxMark2() throws Exception
+ {
+ String name1 = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new DocumentIndexMarkStartNode(name1) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new DocumentIndexMarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ doTest(root);
+ }
+
+ @Test public void testToxMark3() throws Exception
+ {
+ // BUG: #i107672# (non-deterministic; depends on pointer ordering)
+ String name1 = mkName("toxmark");
+ String name2 = mkName("toxmark");
+ String name3 = mkName("toxmark");
+ String name4 = mkName("toxmark");
+ String name5 = mkName("toxmark");
+ String name6 = mkName("toxmark");
+ String name7 = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new DocumentIndexMarkStartNode(name1) );
+ root.appendChild( new DocumentIndexMarkStartNode(name2) );
+ root.appendChild( new DocumentIndexMarkStartNode(name3) );
+ root.appendChild( new DocumentIndexMarkStartNode(name4) );
+ root.appendChild( new DocumentIndexMarkStartNode(name5) );
+ root.appendChild( new DocumentIndexMarkStartNode(name6) );
+ root.appendChild( new DocumentIndexMarkStartNode(name7) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new DocumentIndexMarkEndNode(name7) );
+ root.appendChild( new DocumentIndexMarkEndNode(name6) );
+ root.appendChild( new DocumentIndexMarkEndNode(name5) );
+ root.appendChild( new DocumentIndexMarkEndNode(name4) );
+ root.appendChild( new DocumentIndexMarkEndNode(name3) );
+ root.appendChild( new DocumentIndexMarkEndNode(name2) );
+ root.appendChild( new DocumentIndexMarkEndNode(name1) );
+ root.appendChild( new TextNode("de") );
+ doTest(root);
+ }
+
+ @Test public void testMarks1() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("toxmark");
+ String name3 = mkName("refmark");
+ String name4 = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ root.appendChild( new ReferenceMarkStartNode(name3) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkEndNode(name1) );
+ root.appendChild( new DocumentIndexMarkStartNode(name4) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new DocumentIndexMarkEndNode(name4) );
+ root.appendChild( new ReferenceMarkEndNode(name3) );
+ doTest(root);
+ }
+
+ @Test public void testMarks2() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("refmark");
+ String name3 = mkName("refmark");
+ String name4 = mkName("toxmark");
+ String name5 = mkName("refmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new ReferenceMarkNode(name2) );
+ root.appendChild( new ReferenceMarkStartNode(name3) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new DocumentIndexMarkStartNode(name4) );
+ root.appendChild( new ReferenceMarkStartNode(name5) );
+ // BUG: #i102541# (this is actually not unoportenum's fault)
+ root.appendChild( new ReferenceMarkEndNode(name3) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new DocumentIndexMarkEndNode(name4) );
+ root.appendChild( new BookmarkEndNode(name1) );
+ root.appendChild( new ReferenceMarkEndNode(name5) );
+ doTest(root);
+ }
+
+ @Test public void testMarks3() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("refmark");
+ String name3 = mkName("refmark");
+ String name4 = mkName("toxmark");
+ String name5 = mkName("refmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ root.appendChild( new DocumentIndexMarkStartNode(name3) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new ReferenceMarkStartNode(name4) );
+ root.appendChild( new DocumentIndexMarkStartNode(name5) );
+ root.appendChild( new DocumentIndexMarkEndNode(name3) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new ReferenceMarkEndNode(name4) );
+ root.appendChild( new BookmarkEndNode(name1) );
+ root.appendChild( new DocumentIndexMarkEndNode(name5) );
+ doTest(root);
+ }
+
+ @Test public void testFrameMark1() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkNode(name1) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new FrameNode(name2, AS_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void testFrameMark2() throws Exception
+ {
+ // BUG: #i98530#
+ String name1 = mkName("bookmark");
+ String name2 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkNode(name1) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new FrameNode(name2, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void testFrameMark3() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("bookmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new FrameNode(name1, AS_CHARACTER) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new BookmarkNode(name2) );
+ doTest(root);
+ }
+
+ @Test public void testFrameMark4() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("bookmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new FrameNode(name1, AT_CHARACTER) );
+ root.appendChild( new TextNode("de") );
+ root.appendChild( new BookmarkNode(name2) );
+ doTest(root);
+ }
+
+ @Test public void testFrames1() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("frame");
+ String name3 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name2, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name3, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void testFrames2() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("frame");
+ String name3 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AS_CHARACTER) );
+ root.appendChild( new FrameNode(name2, AS_CHARACTER) );
+ root.appendChild( new FrameNode(name3, AS_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void testFrames3() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("frame");
+ String name3 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name2, AS_CHARACTER) );
+ root.appendChild( new FrameNode(name3, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void testFrames4() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("frame");
+ String name3 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name2, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name3, AS_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void testFrames5() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("frame");
+ String name3 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AS_CHARACTER) );
+ root.appendChild( new FrameNode(name2, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name3, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void testRubyHyperlink1() throws Exception
+ {
+ String name1 = mkName("ruby");
+ String name2 = mkName("url");
+ TreeNode root = new TreeNode();
+ TreeNode ruby = new RubyNode(name1);
+ TreeNode href = new HyperlinkNode(name2);
+ href.appendChild( new TextNode("abc") );
+ ruby.appendChild(href);
+ root.appendChild(ruby);
+ doTest(root);
+ }
+
+ @Test public void testRubyHyperlink2() throws Exception
+ {
+ String name1 = mkName("url");
+ String name2 = mkName("ruby");
+ TreeNode root = new TreeNode();
+ TreeNode href = new HyperlinkNode(name1);
+ TreeNode ruby = new RubyNode(name2);
+ ruby.appendChild( new TextNode("abc") );
+ href.appendChild(ruby);
+ root.appendChild(href);
+ doTest(root);
+ }
+
+ @Test public void testEnd1() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("toxmark");
+ String name3 = mkName("refmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ root.appendChild( new ReferenceMarkNode(name3) );
+ doTest(root);
+ }
+
+ @Test public void testEnd2() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("frame");
+ String name3 = mkName("refmark");
+ String name4 = mkName("frame");
+ String name5 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new BookmarkNode(name1) );
+ root.appendChild( new FrameNode(name2, AT_CHARACTER) );
+ root.appendChild( new ReferenceMarkNode(name3) );
+ root.appendChild( new FrameNode(name4, AT_CHARACTER) );
+ root.appendChild( new FrameNode(name5, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void testEnd3() throws Exception
+ {
+ String name1 = mkName("ftn");
+ String name2 = mkName("toxmark");
+ TreeNode root = new TreeNode();
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new FootnoteNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ doTest(root);
+ }
+
+ @Test public void testEnd4() throws Exception
+ {
+ String name1 = mkName("bookmark");
+ String name2 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkStartNode(name1) );
+ root.appendChild( new TextNode("abc") );
+ root.appendChild( new FrameNode(name2, AS_CHARACTER) );
+ root.appendChild( new BookmarkEndNode(name1) );
+ doTest(root);
+ }
+
+ @Test public void testEnd5() throws Exception
+ {
+ String name1 = mkName("refmark");
+ String name2 = mkName("ruby");
+ TreeNode root = new TreeNode();
+ root.appendChild( new ReferenceMarkStartNode(name1) );
+ root.appendChild( new TextNode("abc") );
+ TreeNode ruby = new RubyNode(name2);
+ ruby.appendChild( new TextFieldNode("de") );
+ root.appendChild(ruby);
+ root.appendChild( new ReferenceMarkEndNode(name1) );
+ doTest(root);
+ }
+
+ @Test public void testEmpty1() throws Exception
+ {
+ String name1 = mkName("refmark");
+ String name2 = mkName("toxmark");
+ String name3 = mkName("bookmark");
+ String name4 = mkName("frame");
+ String name7 = mkName("refmark");
+ String name8 = mkName("toxmark");
+ String name9 = mkName("bookmark");
+ String nameA = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new ReferenceMarkNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ root.appendChild( new BookmarkNode(name3) );
+ root.appendChild( new FrameNode(name4, AT_CHARACTER) );
+ root.appendChild( new ReferenceMarkNode(name7) );
+ root.appendChild( new DocumentIndexMarkNode(name8) );
+ root.appendChild( new BookmarkNode(name9) );
+ root.appendChild( new FrameNode(nameA, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void testEmpty2() throws Exception
+ {
+ String name3 = mkName("bookmark");
+ String name4 = mkName("frame");
+ String name9 = mkName("bookmark");
+ String nameA = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new BookmarkNode(name3) );
+ root.appendChild( new FrameNode(name4, AT_CHARACTER) );
+ root.appendChild( new BookmarkNode(name9) );
+ root.appendChild( new FrameNode(nameA, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void testEmpty3() throws Exception
+ {
+ String name1 = mkName("refmark");
+ String name2 = mkName("toxmark");
+ String name3 = mkName("bookmark");
+ String name4 = mkName("frame");
+ String name5 = mkName("url");
+ String name6 = mkName("ruby");
+ String name7 = mkName("refmark");
+ String name8 = mkName("toxmark");
+ String name9 = mkName("bookmark");
+ String nameA = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new ReferenceMarkNode(name1) );
+ root.appendChild( new DocumentIndexMarkNode(name2) );
+ root.appendChild( new BookmarkNode(name3) );
+ root.appendChild( new FrameNode(name4, AT_CHARACTER) );
+ /* currently empty hyperlinks may get eaten...
+ TreeNode href = new HyperlinkNode(name5);
+ href.appendChild( new TextNode("") );
+ root.appendChild(href);
+ */
+ TreeNode ruby = new RubyNode(name6);
+ root.appendChild(ruby);
+ root.appendChild( new ReferenceMarkNode(name7) );
+ root.appendChild( new DocumentIndexMarkNode(name8) );
+ root.appendChild( new BookmarkNode(name9) );
+ root.appendChild( new FrameNode(nameA, AT_CHARACTER) );
+ doTest(root);
+ }
+
+ @Test public void test1() throws Exception
+ {
+ String name1 = mkName("frame");
+ String name2 = mkName("bookmark");
+ String name3 = mkName("ruby");
+ String name4 = mkName("ftn");
+ String name5 = mkName("frame");
+ TreeNode root = new TreeNode();
+ root.appendChild( new FrameNode(name1, AT_CHARACTER) );
+ root.appendChild( new BookmarkStartNode(name2) );
+ root.appendChild( new TextNode("abc") );
+ TreeNode ruby = new RubyNode(name3);
+ ruby.appendChild( new TextNode("de") );
+ ruby.appendChild( new FootnoteNode(name4) );
+ ruby.appendChild( new BookmarkEndNode(name2) );
+ root.appendChild(ruby);
+ root.appendChild( new TextNode("fg") );
+ root.appendChild( new FrameNode(name5, AT_CHARACTER) );
+ root.appendChild( new TextFieldNode("h") );
+ doTest(root);
+ }
+
+ /* some range tests for the insertion: these are for the current
+ API which treats hyperlinks and rubys not as entities, but as formatting
+ attributes; if these ever become entities, they should not be split!
+ */
+
+ @Test public void testRange1() throws Exception
+ {
+ String name1 = mkName("url");
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("12345");
+ inserter.insertRange(new Range(0, 0, text));
+ TreeNode url1 = new HyperlinkNode(name1);
+ Range range1 = new Range(0, 5, url1);
+ inserter.insertRange(range1);
+ TreeNode root = new TreeNode();
+ root.appendChild( url1 );
+ url1.appendChild( text );
+ doTest(root, false);
+ }
+
+ @Test public void testRangeHyperlinkHyperlink() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode url1 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 4, url1) );
+ // overlap left
+ TreeNode url2 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(0, 2, url2) );
+ TreeNode root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( url1.dup().appendChild( new TextNode("34") ) )
+ .appendChild( new TextNode("56789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode url3 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(3, 7, url3) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( url3.dup().appendChild( new TextNode("4567") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // around
+ TreeNode url4 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(3, 7, url4) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( url4.dup().appendChild( new TextNode("4567") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // inside
+ TreeNode url5 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(4, 6, url5) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( url4.dup().appendChild( new TextNode("4") ) )
+ .appendChild( url5.dup().appendChild( new TextNode("56") ) )
+ .appendChild( url4.dup().appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // empty
+ TreeNode url6 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(7, 7, url6) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( url4.dup().appendChild( new TextNode("4") ) )
+ .appendChild( url5.dup().appendChild( new TextNode("56") ) )
+ .appendChild( url4.dup().appendChild( new TextNode("7") ) )
+// this one gets eaten, but we still need to test inserting it (#i106930#)
+// .appendChild( url6.dup().appendChild( new TextNode("") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ }
+
+ @Test public void testRangeHyperlinkRuby() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode url1 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 4, url1) );
+ // overlap left
+ TreeNode rby2 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 2, rby2) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( url1.dup().appendChild( new TextNode("34") ) )
+ .appendChild( new TextNode("56789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode rby3 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(3, 5, rby3) );
+ root = new TreeNode()
+ .appendChild( rby2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( rby3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // around
+ TreeNode rby4 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(2, 3, rby4) );
+ root = new TreeNode()
+ .appendChild( rby2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( rby4.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( rby3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // inside
+ TreeNode url5 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(6, 9, url5) );
+ TreeNode rby6 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(7, 8, rby6) );
+ root = new TreeNode()
+ .appendChild( rby2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( rby4.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( rby3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6") )
+ .appendChild( url5.dup().appendChild( new TextNode("7") ) )
+ .appendChild( rby6.dup()
+ .appendChild( url5.dup().appendChild( new TextNode("8") ) ) )
+ .appendChild( url5.dup().appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ @Test public void testRangeRubyHyperlink() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(1, 6, rby1) );
+ // overlap left
+ TreeNode url2 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(0, 3, url2) );
+ TreeNode root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby1.dup()
+ .appendChild( url2.dup().appendChild( new TextNode("23") ) )
+ .appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode url3 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(5, 7, url3) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby1.dup()
+ .appendChild( url2.dup().appendChild( new TextNode("23") ) )
+ .appendChild( new TextNode("45") )
+ .appendChild( url3.dup().appendChild( new TextNode("6") ) ) )
+ .appendChild( url3.dup().appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // around (not quite, due to API)
+ TreeNode url4 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 8, url4) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby1.dup()
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("23456") ) ) )
+ .appendChild( url4.dup().appendChild( new TextNode("78") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // inside
+ TreeNode url5 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(3, 5, url5) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby1.dup()
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("23") ) )
+ .appendChild( url5.dup()
+ .appendChild( new TextNode("45") ) )
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("6") ) ) )
+ .appendChild( url4.dup().appendChild( new TextNode("78") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ }
+
+ @Test public void testRangeRubyRuby() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(1, 4, rby1) );
+ // overlap left
+ TreeNode rby2 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 2, rby2) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("34") ) )
+ .appendChild( new TextNode("56789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode rby3 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(3, 7, rby3) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( rby3.dup().appendChild( new TextNode("4567") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // around
+ TreeNode rby4 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(3, 7, rby4) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( rby4.dup().appendChild( new TextNode("4567") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // inside
+ TreeNode rby5 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(4, 6, rby5) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( rby4.dup().appendChild( new TextNode("4") ) )
+ .appendChild( rby5.dup().appendChild( new TextNode("56") ) )
+ .appendChild( rby4.dup().appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ }
+
+ @Test public void testRangeHyperlinkMeta() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode url1 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 4, url1) );
+ // overlap left
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(0, 2, met2) );
+ TreeNode root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( url1.dup().appendChild( new TextNode("34") ) )
+ .appendChild( new TextNode("56789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(4/*-1*/, 6/*-1*/, met3) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( met3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // around
+ TreeNode met4 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3/*-1*/, 4/*-1*/, met4) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( met4.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( met3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // inside
+ TreeNode url5 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(9/*-3*/, 12/*-3*/, url5) );
+ TreeNode met6 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(10/*-3*/, 11/*-3*/, met6) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( met4.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( met3.dup()
+ .appendChild( url1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6") )
+ .appendChild( url5.dup().appendChild( new TextNode("7") ) )
+ .appendChild( met6.dup()
+ .appendChild( url5.dup().appendChild( new TextNode("8") ) ) )
+ .appendChild( url5.dup().appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ @Test public void testRangeRubyMeta() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(1, 4, rby1) );
+ // overlap left
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(0, 2, met2) );
+ TreeNode root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("34") ) )
+ .appendChild( new TextNode("56789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(4/*-1*/, 6/*-1*/, met3) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
+ .appendChild( met3.dup()
+ .appendChild( rby1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // around
+ TreeNode met4 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3/*-1*/, 4/*-1*/, met4) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( met4.dup()
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( met3.dup()
+ .appendChild( rby1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // inside
+ TreeNode rby5 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(9/*-3*/, 12/*-3*/, rby5) );
+ TreeNode met6 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(10/*-3*/, 11/*-3*/, met6) );
+ root = new TreeNode()
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) )
+ .appendChild( met4.dup()
+ .appendChild( rby1.dup().appendChild( new TextNode("3") ) ) )
+ .appendChild( met3.dup()
+ .appendChild( rby1.dup().appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6") )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("7") )
+ .appendChild( met6.dup()
+ .appendChild( new TextNode("8") ) )
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ @Test public void testRangeMetaHyperlink() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode met1 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 6, met1) );
+ // overlap left
+ TreeNode url2 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(0, 4/*-1*/, url2) );
+ TreeNode root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( url2.dup().appendChild( new TextNode("23") ) )
+ .appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode url3 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(6/*-1*/, 8/*-1*/, url3) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( url2.dup().appendChild( new TextNode("23") ) )
+ .appendChild( new TextNode("45") )
+ .appendChild( url3.dup().appendChild( new TextNode("6") ) ) )
+ .appendChild( url3.dup().appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ // around (not quite, due to API)
+ TreeNode url4 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 9/*-1*/, url4) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("23456") ) ) )
+ .appendChild( url4.dup().appendChild( new TextNode("78") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // inside
+ TreeNode url5 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(4/*-1*/, 6/*-1*/, url5) );
+ root = new TreeNode()
+ .appendChild( url2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("23") ) )
+ .appendChild( url5.dup()
+ .appendChild( new TextNode("45") ) )
+ .appendChild( url4.dup()
+ .appendChild( new TextNode("6") ) ) )
+ .appendChild( url4.dup().appendChild( new TextNode("78") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ }
+
+ @Test public void testRangeMetaRuby() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode met1 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 5, met1) );
+ // overlap left
+ TreeNode rby2 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 3/*-1*/, rby2) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( rby2.dup().appendChild( new TextNode("2") ) )
+ .appendChild( new TextNode("345") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode rby3 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(5/*-1*/, 7/*-1*/, rby3) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( rby2.dup().appendChild( new TextNode("2") ) )
+ .appendChild( new TextNode("34") )
+ .appendChild( rby3.dup().appendChild( new TextNode("5") ) ) )
+ .appendChild( rby3.dup().appendChild( new TextNode("6") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // around
+ TreeNode rby4 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(1, 7/*-1*/, rby4) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby4.dup()
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2345") ) )
+ .appendChild( new TextNode("6") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // inside
+ TreeNode met5 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(7/*-1*/, 9/*-1*/, met5) );
+ TreeNode rby6 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(9/*-2*/, 10/*-2*/, rby6) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby4.dup()
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2345") ) )
+ .appendChild( new TextNode("6") ) )
+ .appendChild( met5.dup()
+ .appendChild( new TextNode("7") )
+ .appendChild( rby6.dup()
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // inside, with invalid range that includes the dummy char
+ TreeNode rby7 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(7/*-1*/, 9/*-2*/, rby7) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby4.dup()
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2345") ) )
+ .appendChild( new TextNode("6") ) )
+ .appendChild( met5.dup()
+ .appendChild( rby7.dup()
+ .appendChild( new TextNode("7") ) )
+ .appendChild( rby6.dup()
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // around, at same position as meta
+ TreeNode rby8 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(7/*-1*/, 10/*-2*/, rby8) );
+ root = new TreeNode()
+ .appendChild( rby2.dup().appendChild( new TextNode("1") ) )
+ .appendChild( rby4.dup()
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2345") ) )
+ .appendChild( new TextNode("6") ) )
+ .appendChild( rby8.dup()
+ .appendChild( met5.dup()
+ .appendChild( new TextNode("78") ) ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ }
+
+ @Test public void testRangeMetaMeta() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode met1 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3, 6, met1) );
+ // overlap left
+ TreeNode met2 = new MetaNode( mkId("id") );
+ try {
+ inserter.insertRange( new Range(0, 4, met2) );
+ fail("testRangeMetaMeta: overlap left allowed");
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("123") )
+ .appendChild( met1.dup().appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // overlap right
+ TreeNode met3 = new MetaNode( mkId("id") );
+ try {
+ inserter.insertRange( new Range(5/*-1*/, 8/*-1*/, met3) );
+ fail("testRangeMetaMeta: overlap right allowed");
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+ root = new TreeNode()
+ .appendChild( new TextNode("123") )
+ .appendChild( met1.dup().appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // around
+ TreeNode met4 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3, 7/*-1*/, met4) );
+ root = new TreeNode()
+ .appendChild( new TextNode("123") )
+ .appendChild( met4.dup()
+ .appendChild( met1.dup().appendChild( new TextNode("456") ) ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ // inside
+ TreeNode met5 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(6/*-2*/, 8/*-2*/, met5) );
+ root = new TreeNode()
+ .appendChild( new TextNode("123") )
+ .appendChild( met4.dup()
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("4") )
+ .appendChild( met5.dup()
+ .appendChild( new TextNode("56") ) ) ) )
+ .appendChild( new TextNode("789") );
+ doTest(root, false);
+ }
+
+ @Test public void testRange2() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode met1 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 8, met1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3/*-1*/, 8/*-1*/, met2) );
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(5/*-2*/, 8/*-2*/, met3) );
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("1") )
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2") )
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("3") )
+ .appendChild( met3.dup()
+ .appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("8") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // split ruby at every meta start!
+ TreeNode rby4 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 7/*-3*/, rby4) );
+ root = new TreeNode()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("2") ) )
+ .appendChild( met2.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("3") ) )
+ .appendChild( met3.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("56") ) )
+ .appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("8") ) )
+ .appendChild( new TextNode("9") );
+ doTest(root, false);
+ // split ruby at every meta end!
+ TreeNode rby5 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(8/*-3*/, 12/*-3*/, rby5) );
+ root = new TreeNode()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("1") ) )
+ .appendChild( met1.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("2") ) )
+ .appendChild( met2.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("3") ) )
+ .appendChild( met3.dup()
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("4") ) )
+ .appendChild( new TextNode("5") )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("6") ) ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("7") ) ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ @Test public void testRange3() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 9, rby1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(2, 7, met2) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("12") )
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("34567") ) )
+ .appendChild( new TextNode("89") ) );
+ doTest(root, false);
+ // overwrite outer ruby, split remains at inner meta!
+ TreeNode rby3 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(5/*-1*/, 6/*-1*/, rby3) );
+ root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("12") ) )
+ .appendChild( met2.dup()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("34") ) )
+ .appendChild( rby3.dup()
+ .appendChild( new TextNode("5") ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("67") ) ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("89") ) );
+ doTest(root, false);
+ }
+
+ @Test public void testRange4() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 9, rby1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 8, met2) );
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3/*-1*/, 8/*-1*/, met3) );
+ TreeNode met4 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(5/*-2*/, 8/*-2*/, met4) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("2") )
+ .appendChild( met3.dup()
+ .appendChild( new TextNode("3") )
+ .appendChild( met4.dup()
+ .appendChild( new TextNode("456") ) )
+ .appendChild( new TextNode("7") ) )
+ .appendChild( new TextNode("8") ) )
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ // overwrite outer ruby, split remains at every inner meta!
+ TreeNode rby5 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(7/*-3*/, 8/*-3*/, rby5) );
+ root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("1") ) )
+ .appendChild( met2.dup()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("2") ) )
+ .appendChild( met3.dup()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("3") ) )
+ .appendChild( met4.dup()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("4") ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("5") ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("6") ) ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("7") ) ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ @Test public void testRange5() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode rby1 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(0, 9, rby1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 3, met2) );
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(5/*-1*/, 6/*-1*/, met3) );
+ TreeNode met4 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(8/*-2*/, 10/*-2*/, met4) );
+ TreeNode root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("1") )
+ .appendChild( met2.dup().appendChild( new TextNode("23") ) )
+ .appendChild( new TextNode("4") )
+ .appendChild( met3.dup().appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6") )
+ .appendChild( met4.dup().appendChild( new TextNode("78") ) )
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ // overwrite outer ruby, but split at inner metas!
+ TreeNode rby5 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(3/*-1*/, 10/*-3*/, rby5) );
+ root = new TreeNode()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("1") ) )
+ .appendChild( met2.dup()
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("2") ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("3") ) ) )
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("4") )
+ .appendChild( met3.dup()
+ .appendChild( new TextNode("5") ) )
+ .appendChild( new TextNode("6") ) )
+ .appendChild( met4.dup()
+ .appendChild( rby5.dup()
+ .appendChild( new TextNode("7") ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( rby1.dup()
+ .appendChild( new TextNode("9") ) );
+ doTest(root, false);
+ }
+
+ @Test public void testRange6() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode met1 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(1, 5, met1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3/*-1*/, 6/*-1*/, met2) );
+ TreeNode met3 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(5/*-2*/, 7/*-2*/, met3) );
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("1") )
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2") )
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("3") )
+ .appendChild( met3.dup()
+ .appendChild( new TextNode("45") ) ) ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // split at 3 metas, all at same position
+ TreeNode rby4 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(7/*-3*/, 10/*-3*/, rby4) );
+ root = new TreeNode()
+ .appendChild( new TextNode("1") )
+ .appendChild( met1.dup()
+ .appendChild( new TextNode("2") )
+ .appendChild( met2.dup()
+ .appendChild( new TextNode("3") )
+ .appendChild( met3.dup()
+ .appendChild( new TextNode("4") )
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("5") ) ) ) ) )
+ .appendChild( rby4.dup()
+ .appendChild( new TextNode("67") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ }
+
+ @Test public void testRange7() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ TreeNode url1 = new HyperlinkNode( mkName("url") );
+ inserter.insertRange( new Range(1, 5, url1) );
+ TreeNode met2 = new MetaNode( mkId("id") );
+ inserter.insertRange( new Range(3, 5, met2) );
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup()
+ .appendChild( new TextNode("23") ) )
+ .appendChild( met2.dup()
+ .appendChild( url1.dup()
+ .appendChild( new TextNode("45") ) ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ // this should result in not splitting the hyperlink, but due to API
+ // we can't tell :(
+ TreeNode rby3 = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(5/*-1*/, 8/*-1*/, rby3) );
+ root = new TreeNode()
+ .appendChild( new TextNode("1") )
+ .appendChild( url1.dup()
+ .appendChild( new TextNode("23") ) )
+ .appendChild( met2.dup()
+ .appendChild( url1.dup()
+ .appendChild( new TextNode("4") ) )
+ .appendChild( rby3.dup()
+ .appendChild( url1.dup()
+ .appendChild( new TextNode("5") ) ) ) )
+ .appendChild( rby3.dup()
+ .appendChild( new TextNode("67") ) )
+ .appendChild( new TextNode("89") );
+ doTest(root, false);
+ }
+
+ /* TODO: test partial selection, test UNDO/REDO */
+
+ // #i109601# NestedTextContent and XChild
+ @Test public void testMetaXChild() throws Exception
+ {
+ StringPair id1 = new StringPair("content.xml", mkName("id"));
+ StringPair id2 = new StringPair("content.xml", mkName("id"));
+ StringPair id3 = new StringPair("content.xml", mkName("id"));
+ StringPair id4 = new StringPair("content.xml", mkName("id"));
+ StringPair id5 = new StringPair("content.xml", mkName("id"));
+ StringPair id6 = new StringPair("content.xml", mkName("id"));
+ TreeNode meta1 = new MetaNode(id1);
+ TreeNode meta2 = new MetaNode(id2);
+ TreeNode meta3 = new MetaFieldNode(id3);
+ TreeNode meta4 = new MetaNode(id4);
+ TreeNode meta5 = new MetaNode(id5);
+ TreeNode meta6 = new MetaFieldNode(id6);
+ TreeNode root = new TreeNode()
+ .appendChild( meta1.dup()
+ .appendChild( new TextNode("1") ) )
+ .appendChild( new TextNode("2") )
+ .appendChild( meta2.dup()
+ .appendChild( meta3.dup()
+ .appendChild( new TextNode("34") )
+ .appendChild( meta4.dup()
+ .appendChild( new TextNode("56") ) )
+ .appendChild( meta5.dup() )
+ .appendChild( new TextNode("7") ) ) )
+ .appendChild( new TextNode("8") )
+ .appendChild( meta6.dup()
+ .appendChild( new TextNode("9") ) );
+
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123456789");
+ inserter.insertRange( new Range(0, 0, text) );
+ XTextContent xMeta1 = inserter.insertRange( new Range(0, 1, meta1) );
+ XTextContent xMeta2 = inserter.insertRange( new Range(3, 8, meta2) );
+ XTextContent xMeta3 = inserter.insertRange( new Range(4, 9, meta3) );
+ XTextContent xMeta4 = inserter.insertRange( new Range(7, 9, meta4) );
+ XTextContent xMeta5 = inserter.insertRange( new Range(10, 10, meta5) );
+ XTextContent xMeta6 = inserter.insertRange( new Range(13, 14, meta6) );
+
+ doTest(root, false);
+
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ XParagraphCursor xParagraphCursor = (XParagraphCursor)
+ UnoRuntime.queryInterface(XParagraphCursor.class, xDocTextCursor);
+ xParagraphCursor.gotoNextParagraph(false); // second paragraph
+ // X12XX34X56X78X9
+ // 1 23 4 5 6
+ // 1 452 6
+ // 3
+ StringPair [] nestedTextContent = new StringPair[] {
+ null,
+ id1,
+ id1,
+ null,
+ id2,
+ id3,
+ id3,
+ id3,
+ id4,
+ id4,
+ id4,
+ id5,
+ id3,
+ null,
+ id6,
+ id6,
+ };
+ XPropertySet xPropertySet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xDocTextCursor);
+ for (int i = 0; i < nestedTextContent.length; ++i) {
+ Object oNTC = xPropertySet.getPropertyValue("NestedTextContent");
+ XTextContent xNTC = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, oNTC);
+ if (null == nestedTextContent[i]) {
+ assertNull("unexpected NestedTextContent at: " + i, xNTC);
+ } else {
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xNTC);
+ StringPair xmlid = xMetadatable.getMetadataReference();
+ assertTrue("wrong NestedTextContent at: " + i,
+ MetaNode.eq(nestedTextContent[i], xmlid));
+ }
+ xDocTextCursor.goRight((short)1, false);
+ }
+
+ XChild xChild1 = (XChild)
+ UnoRuntime.queryInterface(XChild.class, xMeta1);
+ XChild xChild2 = (XChild)
+ UnoRuntime.queryInterface(XChild.class, xMeta2);
+ XChild xChild3 = (XChild)
+ UnoRuntime.queryInterface(XChild.class, xMeta3);
+ XChild xChild4 = (XChild)
+ UnoRuntime.queryInterface(XChild.class, xMeta4);
+ XChild xChild5 = (XChild)
+ UnoRuntime.queryInterface(XChild.class, xMeta5);
+ XChild xChild6 = (XChild)
+ UnoRuntime.queryInterface(XChild.class, xMeta6);
+ try {
+ xChild1.setParent(xChild4);
+ fail("setParent(): allowed?");
+ } catch (NoSupportException e) { /* expected */ }
+ assertNull("getParent(): not null", xChild1.getParent());
+ assertNull("getParent(): not null", xChild2.getParent());
+ assertNull("getParent(): not null", xChild6.getParent());
+ {
+ Object xParent3 = xChild3.getParent();
+ assertNotNull("getParent(): null", xParent3);
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xParent3);
+ StringPair xmlid = xMetadatable.getMetadataReference();
+ assertTrue("getParent(): wrong", MetaNode.eq(xmlid, id2));
+ }{
+ Object xParent4 = xChild4.getParent();
+ assertNotNull("getParent(): null", xParent4);
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xParent4);
+ StringPair xmlid = xMetadatable.getMetadataReference();
+ assertTrue("getParent(): wrong", MetaNode.eq(xmlid, id3));
+ }{
+ Object xParent5 = xChild5.getParent();
+ assertNotNull("getParent(): null", xParent5);
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xParent5);
+ StringPair xmlid = xMetadatable.getMetadataReference();
+ assertTrue("getParent(): wrong", MetaNode.eq(xmlid, id3));
+ }
+ }
+
+ /** test SwXMeta XText interface */
+ @Test public void testMetaXText() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("12AB6789");
+ inserter.insertRange( new Range(0, 0, text) );
+ MetaNode meta = new MetaNode( mkId("id") );
+// inserter.insertRange( new Range(3, 5, met2) );
+ XTextContent xMeta = inserter.makeMeta();
+
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ xDocTextCursor.goRight((short)3, false);
+ xDocTextCursor.goRight((short)2, true);
+ xDocText.insertTextContent(xDocTextCursor, xMeta, true);
+// xMeta.attach(xDocTextCursor);
+
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMeta);
+ xMetadatable.setMetadataReference(meta.getXmlId());
+ XText xText = (XText) UnoRuntime.queryInterface(XText.class, xMeta);
+
+ XText xParentText = xText.getText();
+ assertNotNull("getText(): no parent", xParentText);
+
+ XTextRange xStart = xText.getStart();
+ assertNotNull("getStart(): no start", xStart);
+
+ XTextRange xEnd = xText.getEnd();
+ assertNotNull("getEnd(): no end", xEnd);
+
+ xText.setString("45");
+
+ {
+ String string = xText.getString();
+ assertEquals("getString(): invalid string returned",
+ "45", string);
+ }
+
+ XTextCursor xTextCursor = xText.createTextCursor();
+ assertNotNull("createTextCursor(): failed", xTextCursor);
+
+ try {
+ xText.createTextCursorByRange(null);
+ fail("createTextCursorByRange(): null allowed?");
+ } catch (RuntimeException e) { /* expected */ }
+
+ XTextCursor xTextCursorStart = xText.createTextCursorByRange(xStart);
+ assertNotNull("createTextCursorByRange(): failed for start",
+ xTextCursorStart);
+
+ XTextCursor xTextCursorEnd = xText.createTextCursorByRange(xEnd);
+ assertNotNull("createTextCursorByRange(): failed for end",
+ xTextCursorEnd);
+
+ // move outside meta
+ xDocTextCursor.gotoStart(false);
+
+ try {
+ xText.insertString(null, "foo", false);
+ fail("insertString(): null allowed?");
+ } catch (RuntimeException e) { /* expected */ }
+
+ try {
+ xText.insertString(xDocTextCursor, "foo", false);
+ fail("insertString(): cursor outside allowed?");
+ } catch (RuntimeException e) { /* expected */ }
+
+ xStart = xText.getStart();
+ xText.insertString(xStart, "A", false);
+ {
+ String string = xText.getString();
+ assertEquals("getString(): invalid string returned",
+ "A45", string);
+ }
+
+ xText.insertString(xEnd, "B", false);
+ {
+ String string = xText.getString();
+ assertEquals("getString(): invalid string returned",
+ "A45B", string);
+ }
+
+ try {
+ xText.insertControlCharacter(null, HARD_HYPHEN, false);
+ fail("insertControlCharacter(): null allowed?");
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+
+ xStart = xText.getStart();
+ try {
+ xText.insertControlCharacter(xDocTextCursor, HARD_HYPHEN, false);
+ fail("insertControlCharacter(): cursor outside allowed?");
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+
+ xText.insertControlCharacter(xStart, HARD_HYPHEN, false);
+ {
+ String string = xText.getString();
+ assertEquals("getString(): invalid string returned",
+ '\u2011' + "A45B", string);
+ }
+
+ xText.insertControlCharacter(xEnd, HARD_HYPHEN, false);
+ {
+ String string = xText.getString();
+ assertEquals("getString(): invalid string returned",
+ '\u2011' + "A45B" + '\u2011', string);
+ }
+
+ xText.setString("45");
+
+ try {
+ xText.insertTextContent(null, xMeta, false);
+ fail("insertTextContent(): null range allowed?");
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+
+ try {
+ xText.insertTextContent(xStart, null, false);
+ fail("insertTextContent(): null content allowed?");
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+
+ try {
+ xText.insertTextContent(xDocTextCursor, xMeta, false);
+ fail("insertTextContent(): cursor outside allowed?");
+ } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ }
+
+ TextFieldNode field1 = new TextFieldNode( "f1" );
+ TextFieldNode field2 = new TextFieldNode( "f2" );
+ XTextContent xField1 = inserter.makeTextField(field1.getContent());
+ XTextContent xField2 = inserter.makeTextField(field2.getContent());
+
+ xStart = xText.getStart();
+ xText.insertTextContent(xStart, xField1, false);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( meta.dup()
+ .appendChild( field1.dup() )
+ .appendChild( new TextNode("45") ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+
+ xText.insertTextContent(xEnd, xField2, false);
+
+ root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( meta.dup()
+ .appendChild( field1.dup() )
+ .appendChild( new TextNode("45") )
+ .appendChild( field2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+
+ try {
+ xText.removeTextContent(null);
+ fail("removeTextContent(): null content allowed?");
+ } catch (RuntimeException e) { /* expected */ }
+
+ xText.removeTextContent(xField1);
+
+ XTextRange xAnchor = xMeta.getAnchor();
+ assertNotNull("getAnchor(): null", xAnchor);
+
+ // evil test case: insert ruby around meta
+ RubyNode ruby = new RubyNode( mkName("ruby") );
+ inserter.insertRange( new Range(2, 6, ruby) );
+
+ /* prevent caching...
+ root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( ruby.dup()
+ .appendChild( meta.dup()
+ .appendChild( new TextNode("45") )
+ .appendChild( field2.dup() ) ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ */
+
+ XEnumerationAccess xEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, xMeta);
+ XEnumeration xEnum = xEA.createEnumeration();
+ assertNotNull("createEnumeration(): returns null", xEnum);
+ {
+ assertTrue("hasNext(): first missing", xEnum.hasMoreElements());
+ Object xElement = xEnum.nextElement();
+ XTextRange xPortion = (XTextRange)
+ UnoRuntime.queryInterface(XTextRange.class, xElement);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xPortion);
+ String type = (String) xPropSet.getPropertyValue("TextPortionType");
+ assertEquals("first: not text", "Text", type);
+ String txt = xPortion.getString();
+ assertEquals("first: text differs", "45", txt);
+ }
+ {
+ assertTrue("hasNext(): second missing", xEnum.hasMoreElements());
+ Object xElement = xEnum.nextElement();
+ XTextRange xPortion = (XTextRange)
+ UnoRuntime.queryInterface(XTextRange.class, xElement);
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xPortion);
+ String type = (String) xPropSet.getPropertyValue("TextPortionType");
+ assertEquals("second: not text", "TextField", type);
+ }
+ // no ruby end here!!!
+ assertFalse("hasNext(): more elements?", xEnum.hasMoreElements());
+
+ XComponent xComponent = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xMeta);
+ xComponent.dispose();
+
+ try {
+ XTextCursor xCursor = xText.createTextCursor();
+ assertNull("createTextCursor(): succeeds on disposed object?",
+ xCursor);
+ } catch (RuntimeException e) { /* expected */ }
+ }
+
+ /** check that cursor move methods move to positions in the meta,
+ but do not move to positions outside the meta. */
+ @Test public void testMetaXTextCursor() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("Text. 12 More text here.");
+ inserter.insertRange( new Range(0, 0, text) );
+ MetaNode met1 = new MetaNode( mkId("id") );
+ XTextContent xMeta = inserter.makeMeta();
+
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ xDocTextCursor.goRight((short)7, false);
+ xDocTextCursor.goRight((short)2, true);
+ xDocText.insertTextContent(xDocTextCursor, xMeta, true);
+ xDocTextCursor.gotoStart(true);
+
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMeta);
+ xMetadatable.setMetadataReference(met1.getXmlId());
+ XText xText = (XText) UnoRuntime.queryInterface(XText.class, xMeta);
+
+ XTextRange xStart = xText.getStart();
+ assertNotNull("getStart(): no start", xStart);
+ XTextRange xEnd = xText.getEnd();
+ assertNotNull("getEnd(): no end", xEnd);
+
+ XTextCursor xTextCursor = xText.createTextCursor();
+ assertNotNull("createTextCursor(): no cursor", xTextCursor);
+
+ // XTextCursor
+ boolean bSuccess = false;
+ xTextCursor.gotoStart(false);
+ xTextCursor.gotoEnd(false);
+ bSuccess = xTextCursor.goLeft((short)1, false);
+ assertTrue("goLeft(): failed", bSuccess);
+ bSuccess = xTextCursor.goLeft((short)1000, false);
+ assertFalse("goLeft(): succeeded", bSuccess);
+ bSuccess = xTextCursor.goRight((short)1, false);
+ assertTrue("goRight(): failed", bSuccess);
+ bSuccess = xTextCursor.goRight((short)1000, false);
+ assertFalse("goRight(): succeeded", bSuccess);
+ xTextCursor.gotoRange(xStart, false);
+ xTextCursor.gotoRange(xEnd, false);
+ try {
+ xTextCursor.gotoRange(xDocTextCursor, false);
+ fail("gotoRange(): succeeded");
+ } catch (RuntimeException e) { /* expected */ }
+
+ // XWordCursor
+ xText.setString("Two words");
+ xTextCursor.gotoStart(false);
+ XWordCursor xWordCursor = (XWordCursor)
+ UnoRuntime.queryInterface(XWordCursor.class, xTextCursor);
+
+ bSuccess = xWordCursor.gotoNextWord(true);
+ assertTrue("gotoNextWord(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assertEquals("gotoNextWord(): wrong string",
+ "Two ", string);
+ }
+ bSuccess = xWordCursor.gotoNextWord(false);
+ assertFalse("gotoNextWord(): succeeded", bSuccess);
+ xTextCursor.collapseToEnd();
+ bSuccess = xWordCursor.gotoPreviousWord(true);
+ assertTrue("gotoPreviousWord(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assertEquals("gotoPreviousWord(): wrong string",
+ "words", string);
+ }
+ bSuccess = xWordCursor.gotoPreviousWord(false);
+ assertFalse("gotoPreviousWord(): succeeded", bSuccess);
+ bSuccess = xWordCursor.gotoEndOfWord(true);
+ assertTrue("gotoEndOfWord(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assertEquals("gotoEndOfWord(): wrong string",
+ "Two", string);
+ }
+ xTextCursor.gotoEnd(false);
+ bSuccess = xWordCursor.gotoStartOfWord(true);
+ assertTrue("gotoStartOfWord(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assertEquals("gotoStartOfWord(): wrong string",
+ "words", string);
+ }
+ xText.setString("");
+ bSuccess = xWordCursor.gotoEndOfWord(false);
+ assertFalse("gotoEndOfWord(): succeeded", bSuccess);
+ bSuccess = xWordCursor.gotoStartOfWord(false);
+ assertFalse("gotoStartOfWord(): succeeded", bSuccess);
+
+ // XSentenceCursor
+ xText.setString("This is a sentence. Another sentence.");
+ xTextCursor.gotoStart(false);
+ XSentenceCursor xSentenceCursor = (XSentenceCursor)
+ UnoRuntime.queryInterface(XSentenceCursor.class, xTextCursor);
+
+ bSuccess = xSentenceCursor.gotoNextSentence(true);
+ assertTrue("gotoNextSentence(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assertEquals("gotoNextSentence(): wrong string",
+ "This is a sentence. ", string);
+ }
+ bSuccess = xSentenceCursor.gotoNextSentence(false);
+ assertFalse("gotoNextSentence(): succeeded", bSuccess);
+ // FIXME:
+ // the sentence cursor seems to work differently than the word cursor
+ xText.setString("This is a sentence. Another sentence. Sentence 3.");
+ xTextCursor.gotoEnd(false);
+ bSuccess = xSentenceCursor.gotoPreviousSentence(true);
+ assertTrue("gotoPreviousSentence(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assertEquals("gotoPreviousSentence(): wrong string",
+ "Another sentence. Sentence 3.", string);
+ }
+ bSuccess = xSentenceCursor.gotoPreviousSentence(false);
+ assertFalse("gotoPreviousSentence(): succeeded", bSuccess);
+ bSuccess = xSentenceCursor.gotoEndOfSentence(true);
+ assertTrue("gotoEndOfSentence(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assertEquals("gotoEndOfSentence(): wrong string",
+ "This is a sentence.", string);
+ }
+ xTextCursor.gotoEnd(false);
+ bSuccess = xSentenceCursor.gotoStartOfSentence(true);
+ assertTrue("gotoStartOfSentence(): failed", bSuccess);
+ {
+ String string = xTextCursor.getString();
+ assertEquals("gotoStartOfSentence(): wrong string",
+ "Sentence 3.", string);
+ }
+ xText.setString("");
+ bSuccess = xSentenceCursor.gotoEndOfSentence(false);
+ assertFalse("gotoEndOfSentence(): succeeded", bSuccess);
+ bSuccess = xSentenceCursor.gotoStartOfSentence(false);
+ assertFalse("gotoStartOfSentence(): succeeded", bSuccess);
+
+ XParagraphCursor xParagraphCursor = (XParagraphCursor)
+ UnoRuntime.queryInterface(XParagraphCursor.class, xTextCursor);
+
+ // XParagraphCursor (does not make sense)
+ bSuccess = xParagraphCursor.gotoNextParagraph(false);
+ assertFalse("gotoNextParagraph(): succeeded", bSuccess);
+ bSuccess = xParagraphCursor.gotoPreviousParagraph(false);
+ assertFalse("gotoPreviousParagraph(): succeeded", bSuccess);
+ bSuccess = xParagraphCursor.gotoStartOfParagraph(false);
+ assertFalse("gotoStartOfParagraph(): succeeded", bSuccess);
+ bSuccess = xParagraphCursor.gotoEndOfParagraph(false);
+ assertFalse("gotoEndOfParagraph(): succeeded", bSuccess);
+ }
+
+
+ abstract class AttachHelper
+ {
+ abstract boolean isAttribute();
+ abstract TreeNode mkTreeNode();
+ abstract XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception;
+ void postInserted(TreeNode node, XTextContent xContent)
+ throws Exception { }
+ }
+
+ @Test public void testMetaXTextAttachToxMark() throws Exception
+ {
+ doMetaXTextAttach( new AttachHelper()
+ {
+ boolean isAttribute() { return true; }
+ TreeNode mkTreeNode() {
+ return new DocumentIndexMarkNode( mkName("toxmark") );
+ }
+ XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception {
+ return inserter.makeDocumentIndexMark(
+ ((DocumentIndexMarkNode)node).getName());
+ }
+ });
+ }
+
+ @Test public void testMetaXTextAttachRefMark() throws Exception
+ {
+ doMetaXTextAttach( new AttachHelper()
+ {
+ boolean isAttribute() { return true; }
+ TreeNode mkTreeNode() {
+ return new ReferenceMarkNode( mkName("refmark") );
+ }
+ XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception {
+ return inserter.makeReferenceMark(
+ ((ReferenceMarkNode)node).getName());
+ }
+ });
+ }
+
+ @Test public void testMetaXTextAttachTextField() throws Exception
+ {
+ doMetaXTextAttach( new AttachHelper()
+ {
+ boolean isAttribute() { return false; }
+ TreeNode mkTreeNode() {
+ return new TextFieldNode( mkName("field") );
+ }
+ XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception {
+ return inserter.makeTextField(
+ ((TextFieldNode)node).getContent());
+ }
+ });
+ }
+
+ @Test public void testMetaXTextAttachFootnote() throws Exception
+ {
+ doMetaXTextAttach( new AttachHelper()
+ {
+ boolean isAttribute() { return false; }
+ TreeNode mkTreeNode() {
+ return new FootnoteNode( mkName("ftn") );
+ }
+ XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception {
+ return inserter.makeFootnote(
+ ((FootnoteNode)node).getLabel());
+ }
+ });
+ }
+
+ @Test public void testMetaXTextAttachMeta() throws Exception
+ {
+ doMetaXTextAttach( new AttachHelper()
+ {
+ boolean isAttribute() { return true; }
+ TreeNode mkTreeNode() {
+ return new MetaNode( mkId("id") );
+ }
+ XTextContent mkTextContent(Inserter inserter, TreeNode node)
+ throws Exception {
+ return inserter.makeMeta();
+ }
+ void postInserted(TreeNode node, XTextContent xContent)
+ throws Exception {
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xContent);
+ xMetadatable.setMetadataReference(
+ ((MetaNode)node).getXmlId());
+ }
+ });
+ }
+
+ void doMetaXTextAttach(AttachHelper helper) throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("12AB6789");
+ inserter.insertRange( new Range(0, 0, text) );
+ MetaNode met1 = new MetaNode( mkId("id") );
+ XTextContent xMeta = inserter.makeMeta();
+
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ xDocTextCursor.goRight((short)3, false);
+ xDocTextCursor.goRight((short)2, true);
+ xDocText.insertTextContent(xDocTextCursor, xMeta, true);
+
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMeta);
+ xMetadatable.setMetadataReference(met1.getXmlId());
+ XText xText = (XText) UnoRuntime.queryInterface(XText.class, xMeta);
+ XTextRange xStart = null;
+ XTextRange xEnd = null;
+
+ {
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ // insertTextContent with meta getStart()/getEnd()
+ xText.insertTextContent(xStart, xContent1, false);
+ xText.insertTextContent(xEnd , xContent2, false);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ {
+ xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ XTextCursor xTextCursor = xText.createTextCursor();
+ xTextCursor.gotoStart(false);
+
+ // insertTextContent with meta cursor
+ xText.insertTextContent(xTextCursor, xContent1, false);
+ xTextCursor.gotoEnd(false);
+ xText.insertTextContent(xTextCursor, xContent2, false);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ if (!helper.isAttribute())
+ {
+// xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ XTextCursor xTextCursor = xText.createTextCursor();
+ xTextCursor.gotoStart(false);
+ xTextCursor.goRight((short)1, true);
+
+ // insertTextContent with meta cursor and absorb
+ xText.insertTextContent(xTextCursor, xContent1, true);
+ xTextCursor.gotoEnd(false);
+ xTextCursor.goLeft((short)1, true);
+ xText.insertTextContent(xTextCursor, xContent2, true);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ {
+ xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ xDocTextCursor.gotoRange(xStart, false);
+
+ // insertTextContent with document cursor
+ xText.insertTextContent(xDocTextCursor, xContent1, false);
+ xDocTextCursor.gotoRange(xEnd, false);
+ xText.insertTextContent(xDocTextCursor, xContent2, false);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ if (!helper.isAttribute())
+ {
+// xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ xDocTextCursor.gotoRange(xStart, false);
+ xDocTextCursor.goRight((short)1, true);
+
+ // insertTextContent with document cursor and absorb
+ xText.insertTextContent(xDocTextCursor, xContent1, true);
+ xDocTextCursor.gotoRange(xEnd, false);
+ xDocTextCursor.goLeft((short)1, true);
+ xText.insertTextContent(xDocTextCursor, xContent2, true);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ {
+ xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ // attach to range from meta getStart()/getEnd()
+ xContent1.attach(xStart);
+ xContent2.attach(xEnd);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ {
+ xText.setString("AB");
+ xStart = xText.getStart();
+ xEnd = xText.getEnd();
+
+ TreeNode nod1 = helper.mkTreeNode();
+ TreeNode nod2 = helper.mkTreeNode();
+ XTextContent xContent1 = helper.mkTextContent(inserter, nod1);
+ XTextContent xContent2 = helper.mkTextContent(inserter, nod2);
+
+ XTextCursor xTextCursor = xText.createTextCursor();
+ xTextCursor.gotoStart(false);
+
+ // attach to cursor from meta XText
+ xContent1.attach(xTextCursor);
+ xTextCursor.gotoEnd(false);
+ xContent2.attach(xTextCursor);
+
+ helper.postInserted(nod1, xContent1);
+ helper.postInserted(nod2, xContent2);
+
+ TreeNode root = new TreeNode()
+ .appendChild( new TextNode("12") )
+ .appendChild( met1.dup()
+ .appendChild( nod1.dup() )
+ .appendChild( new TextNode("AB") )
+ .appendChild( nod2.dup() ) )
+ .appendChild( new TextNode("6789") );
+ doTest(root, false);
+ }
+ }
+
+ @Test public void testMetaFieldXTextField() throws Exception
+ {
+ com.sun.star.rdf.XRepositorySupplier xModel =
+ (com.sun.star.rdf.XRepositorySupplier) UnoRuntime.queryInterface(
+ com.sun.star.rdf.XRepositorySupplier.class, m_xDoc);
+ com.sun.star.rdf.XRepository xRepo = xModel.getRDFRepository();
+ // for testing just add it to the first graph
+ com.sun.star.rdf.XURI[] Graphs = xRepo.getGraphNames();
+ com.sun.star.rdf.XNamedGraph xGraph = xRepo.getGraph(Graphs[0]);
+ com.sun.star.rdf.XURI xOdfPrefix =
+ com.sun.star.rdf.URI.createKnown(m_xContext,
+ com.sun.star.rdf.URIs.ODF_PREFIX);
+ com.sun.star.rdf.XURI xOdfSuffix =
+ com.sun.star.rdf.URI.createKnown(m_xContext,
+ com.sun.star.rdf.URIs.ODF_SUFFIX);
+ com.sun.star.rdf.XNode xPrefix =
+ com.sun.star.rdf.Literal.create(m_xContext, "foo");
+ com.sun.star.rdf.XNode xSuffix =
+ com.sun.star.rdf.Literal.create(m_xContext, "bar");
+
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("abc");
+ inserter.insertRange( new Range(0, 0, text) );
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ xDocTextCursor.goRight((short)1, false);
+ xDocTextCursor.goRight((short)3, true);
+
+ XTextField xMetaField = inserter.makeMetaField();
+
+ xDocText.insertTextContent(xDocTextCursor, xMetaField, true);
+
+ XMetadatable xMetadatable = (XMetadatable)
+ UnoRuntime.queryInterface(XMetadatable.class, xMetaField);
+ xMetadatable.ensureMetadataReference();
+
+ xGraph.addStatement(xMetadatable, xOdfPrefix, xPrefix);
+ xGraph.addStatement(xMetadatable, xOdfSuffix, xSuffix);
+ assertEquals("getPresentation(): wrong",
+ "fooabcbar", xMetaField.getPresentation(false));
+ inserter.insertRange( new Range(0, 0, text) );
+ }
+
+ @Test public void testMetaFieldXPropertySet() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ TreeNode text = new TextNode("123");
+ inserter.insertRange( new Range(0, 0, text) );
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ xDocTextCursor.goRight((short)1, false);
+ xDocTextCursor.goRight((short)3, true);
+
+ XTextField xMetaField = inserter.makeMetaField();
+
+ xDocText.insertTextContent(xDocTextCursor, xMetaField, true);
+
+ XPropertySet xPropertySet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xMetaField);
+ assertNotNull("PropertySet: not supported?", xPropertySet);
+ XPropertySetInfo xPropertySetInfo = xPropertySet.getPropertySetInfo();
+ assertTrue("hasPropertyByName(\"NumberFormat\"):",
+ xPropertySetInfo.hasPropertyByName("NumberFormat"));
+ assertTrue("hasPropertyByName(\"IsFixedLanguage\"):",
+ xPropertySetInfo.hasPropertyByName("IsFixedLanguage"));
+
+ int def = (Integer) xPropertySet.getPropertyValue("NumberFormat");
+ System.out.println("NumberFormat: default is " + def);
+ short INT = com.sun.star.i18n.NumberFormatIndex.NUMBER_INT;
+ xPropertySet.setPropertyValue("NumberFormat", INT);
+ xPropertySet.setPropertyValue("IsFixedLanguage", true);
+ int format = (Integer) xPropertySet.getPropertyValue("NumberFormat");
+ assertEquals("NumberFormat: failed", INT, format);
+ boolean isFixed = (Boolean)
+ xPropertySet.getPropertyValue("IsFixedLanguage");
+ assertTrue("IsFixedLanguage: failed", isFixed);
+ }
+
+ @Test public void testLoadStore() throws Exception
+ {
+ XTextDocument xComp = null;
+ String filename = "TESTMETA.odt";
+ String file;
+ try {
+ file = TestDocument.getUrl(filename);
+ xComp = doLoad(file);
+ if (xComp != null)
+ {
+ checkLoadMeta(xComp);
+ file = m_TmpDir + filename;
+ doStore(xComp, file);
+ close(xComp);
+ xComp = doLoad(file);
+ checkLoadMeta(xComp);
+ }
+ } finally {
+ close(xComp);
+ }
+ }
+
+ private void doStore(XComponent xComp, String file) throws Exception
+ {
+ System.out.println("Storing test document...");
+
+ XStorable xStor = (XStorable) UnoRuntime.queryInterface(
+ XStorable.class, xComp);
+
+ xStor.storeToURL(file, new PropertyValue[0]);
+
+ System.out.println("...done");
+ }
+
+ public XTextDocument doLoad(String file) throws Exception
+ {
+ XComponent xComp = null;
+
+ System.out.println("Loading test document...");
+
+ PropertyValue[] loadProps = new PropertyValue[1];
+ loadProps[0] = new PropertyValue();
+ loadProps[0].Name = "Hidden";
+ loadProps[0].Value = new Boolean(true);
+
+ xComp = util.DesktopTools.loadDoc(m_xMSF, file, loadProps);
+// xComp = util.DesktopTools.getCLoader(m_xMSF).loadComponentFromURL(file, "_blank", 0, loadProps);
+
+ XTextDocument xTextDoc = (XTextDocument)
+ UnoRuntime.queryInterface(XTextDocument.class, xComp);
+
+ assertNotNull("cannot load: " + file, xTextDoc);
+
+ System.out.println("...done");
+
+ return xTextDoc;
+ }
+
+ public void checkLoadMeta(XTextDocument xTextDoc) throws Exception
+ {
+ XText xText = xTextDoc.getText();
+
+ System.out.println("Checking meta(-field)s in loaded test document...");
+
+ TreeNode root = new TreeNode()
+ .appendChild( new RubyNode("ruby1")
+ .appendChild( new TextNode("1") ) )
+ .appendChild( new MetaNode(mkId_("id1"))
+ .appendChild( new TextNode("2") ) )
+ .appendChild( new MetaFieldNode(mkId_("id2"))
+ .appendChild( new TextNode("3") ) )
+ .appendChild( new RubyNode("ruby2")
+ .appendChild( new MetaNode(mkId_("id3"))
+ .appendChild( new TextNode("4") ) ) )
+ .appendChild( new RubyNode("ruby3")
+ .appendChild( new MetaFieldNode(mkId_("id4"))
+ .appendChild( new TextNode("5") ) ) )
+ .appendChild( new MetaNode(mkId_("id5"))
+ .appendChild( new RubyNode("ruby4")
+ .appendChild( new TextNode("6") ) ) )
+ .appendChild( new MetaFieldNode(mkId_("id6"))
+ .appendChild( new RubyNode("ruby5")
+ .appendChild( new TextNode("7") ) ) )
+ .appendChild( new MetaNode(mkId_("id7"))
+ .appendChild( new MetaNode(mkId_("id8"))
+ .appendChild( new TextNode("8") ) ) )
+ .appendChild( new MetaNode(mkId_("id9"))
+ .appendChild( new MetaFieldNode(mkId_("id10"))
+ .appendChild( new TextNode("9") ) ) )
+ .appendChild( new MetaFieldNode(mkId_("id11"))
+ .appendChild( new MetaNode(mkId_("id12"))
+ .appendChild( new TextNode("10") ) ) )
+ .appendChild( new MetaFieldNode(mkId_("id13"))
+ .appendChild( new MetaFieldNode(mkId_("id14"))
+ .appendChild( new TextNode("11") ) ) )
+ .appendChild( new MetaNode(mkId_("id15"))
+ .appendChild( new RubyNode("ruby6")
+ .appendChild( new MetaFieldNode(mkId_("id16"))
+ .appendChild( new TextNode("12") ) ) ) )
+ .appendChild( new MetaNode(mkId_("")) {
+ public boolean equals(Object other) {
+ return (other instanceof MetaNode);
+ } }
+ .appendChild( new TextNode("13") ) )
+ .appendChild( new TextNode(" X X ") );
+ doTest(xTextDoc, root, false);
+
+ System.out.println("...done");
+ }
+
+ @Test public void testLoadStoreXmlid() throws Exception
+ {
+ XTextDocument xComp = null;
+ String filename = "TESTXMLID.odt";
+ String file;
+ try {
+ file = TestDocument.getUrl(filename);
+ xComp = doLoad(file);
+ if (xComp != null)
+ {
+ checkLoadXmlId(xComp);
+ file = m_TmpDir + filename;
+ doStore(xComp, file);
+ close(xComp);
+ xComp = doLoad(file);
+ checkLoadXmlId(xComp);
+ }
+ } finally {
+ close(xComp);
+ }
+ }
+
+ public void checkLoadXmlId(XTextDocument xTextDoc) throws Exception
+ {
+ XText xText = xTextDoc.getText();
+
+ System.out.println("Checking bookmarks in loaded test document...");
+
+ XRepositorySupplier xRS = (XRepositorySupplier)
+ UnoRuntime.queryInterface(XRepositorySupplier.class, xTextDoc);
+ XDocumentRepository xRepo = (XDocumentRepository)
+ UnoRuntime.queryInterface(XDocumentRepository.class,
+ xRS.getRDFRepository());
+ XBookmarksSupplier xBMS = (XBookmarksSupplier)
+ UnoRuntime.queryInterface(XBookmarksSupplier.class, xTextDoc);
+ XNameAccess xBookmarks = xBMS.getBookmarks();
+ XMetadatable xMark1 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xBookmarks.getByName("mk1"));
+ assertTrue("mark1",
+ eq(xMark1.getMetadataReference(),
+ new StringPair("content.xml", "id90")));
+
+ XMetadatable xMark2 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xBookmarks.getByName("mk2"));
+ Pair<Statement[], Boolean> result = xRepo.getStatementRDFa(xMark2);
+ assertTrue("mark2", (result.First.length == 1)
+ && result.First[0].Subject.getStringValue().equals("uri:foo")
+ && result.First[0].Predicate.getStringValue().equals("uri:bar")
+ && result.First[0].Object.getStringValue().contains("a fooish bar")
+ );
+
+ XMetadatable xMark3 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xBookmarks.getByName("mk3"));
+ assertTrue("mark3",
+ eq(xMark3.getMetadataReference(),
+ new StringPair("content.xml", "id91")));
+
+ System.out.println("...done");
+
+ System.out.println("Checking sections in loaded test document...");
+
+ XTextSectionsSupplier xTSS = (XTextSectionsSupplier)
+ UnoRuntime.queryInterface(XTextSectionsSupplier.class, xTextDoc);
+
+ XNameAccess xSections = xTSS.getTextSections();
+
+ XMetadatable xSection1 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xSections.getByName("Section 1"));
+ assertTrue("idsection1", eq(xSection1.getMetadataReference(),
+ new StringPair("content.xml", "idSection1")));
+
+ XMetadatable xSection2 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xSections.getByName("Section 2"));
+ assertTrue("idSection2", eq(xSection2.getMetadataReference(),
+ new StringPair("content.xml", "idSection2")));
+
+ XMetadatable xSection3 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class,
+ xSections.getByName("Table of Contents1_Head"));
+ assertTrue("idTOCTitle", eq(xSection3.getMetadataReference(),
+ new StringPair("content.xml", "idTOCTitle")));
+
+ XMetadatable xSection4 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class,
+ xSections.getByName("Alphabetical Index1_Head"));
+ assertTrue("idAITitle", eq(xSection4.getMetadataReference(),
+ new StringPair("content.xml", "idAITitle")));
+
+ XMetadatable xSection5 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class,
+ xSections.getByName("Illustration Index1_Head"));
+ assertTrue("idIITitle", eq(xSection5.getMetadataReference(),
+ new StringPair("content.xml", "idIITitle")));
+
+ XMetadatable xSection6 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class,
+ xSections.getByName("Index of Tables1_Head"));
+ assertTrue("idIOTTitle", eq(xSection6.getMetadataReference(),
+ new StringPair("content.xml", "idIOTTitle")));
+
+ XMetadatable xSection7 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class,
+ xSections.getByName("User-Defined1_Head"));
+ assertTrue("idUDTitle", eq(xSection7.getMetadataReference(),
+ new StringPair("content.xml", "idUDTitle")));
+
+ XMetadatable xSection8 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class,
+ xSections.getByName("Table of Objects1_Head"));
+ assertTrue("idTOOTitle", eq(xSection8.getMetadataReference(),
+ new StringPair("content.xml", "idTOOTitle")));
+
+ XMetadatable xSection9 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xSections.getByName("Bibliography1_Head"));
+ assertTrue("idBibTitle", eq(xSection9.getMetadataReference(),
+ new StringPair("content.xml", "idBibTitle")));
+
+ System.out.println("...done");
+
+ System.out.println("Checking indexes in loaded test document...");
+
+ XDocumentIndexesSupplier xDIS = (XDocumentIndexesSupplier)
+ UnoRuntime.queryInterface(XDocumentIndexesSupplier.class, xTextDoc);
+ XIndexAccess xIndexesIA = xDIS.getDocumentIndexes();
+ XNameAccess xIndexes =
+ UnoRuntime.queryInterface(XNameAccess.class, xIndexesIA);
+
+ XMetadatable xIndex1 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xIndexes.getByName("Table of Contents1"));
+ assertTrue("idTOC", eq(xIndex1.getMetadataReference(),
+ new StringPair("content.xml", "idTOC")));
+ XMetadatable xIndex1s = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xSections.getByName("Table of Contents1"));
+ assertTrue("idTOC", eq(xIndex1s.getMetadataReference(),
+ new StringPair("content.xml", "idTOC")));
+
+ XMetadatable xIndex2 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xIndexes.getByName("Alphabetical Index1"));
+ assertTrue("idAI", eq(xIndex2.getMetadataReference(),
+ new StringPair("content.xml", "idAI")));
+ XMetadatable xIndex2s = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xSections.getByName("Alphabetical Index1"));
+ assertTrue("idAI", eq(xIndex2s.getMetadataReference(),
+ new StringPair("content.xml", "idAI")));
+
+ XMetadatable xIndex3 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xIndexes.getByName("Illustration Index1"));
+ assertTrue("idII", eq(xIndex3.getMetadataReference(),
+ new StringPair("content.xml", "idII")));
+ XMetadatable xIndex3s = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xSections.getByName("Illustration Index1"));
+ assertTrue("idII", eq(xIndex3s.getMetadataReference(),
+ new StringPair("content.xml", "idII")));
+
+ XMetadatable xIndex4 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xIndexes.getByName("Index of Tables1"));
+ assertTrue("idIOT", eq(xIndex4.getMetadataReference(),
+ new StringPair("content.xml", "idIOT")));
+ XMetadatable xIndex4s = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xSections.getByName("Index of Tables1"));
+ assertTrue("idIOT", eq(xIndex4s.getMetadataReference(),
+ new StringPair("content.xml", "idIOT")));
+
+ XMetadatable xIndex5 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xIndexes.getByName("User-Defined1"));
+ assertTrue("idUD", eq(xIndex5.getMetadataReference(),
+ new StringPair("content.xml", "idUD")));
+ XMetadatable xIndex5s = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xSections.getByName("User-Defined1"));
+ assertTrue("idUD", eq(xIndex5s.getMetadataReference(),
+ new StringPair("content.xml", "idUD")));
+
+ XMetadatable xIndex6 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xIndexes.getByName("Table of Objects1"));
+ assertTrue("idTOO", eq(xIndex6.getMetadataReference(),
+ new StringPair("content.xml", "idTOO")));
+ XMetadatable xIndex6s = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xSections.getByName("Table of Objects1"));
+ assertTrue("idTOO", eq(xIndex6s.getMetadataReference(),
+ new StringPair("content.xml", "idTOO")));
+
+ XMetadatable xIndex7 = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xIndexes.getByName("Bibliography1"));
+ assertTrue("idBib", eq(xIndex7.getMetadataReference(),
+ new StringPair("content.xml", "idBib")));
+ XMetadatable xIndex7s = (XMetadatable) UnoRuntime.queryInterface(
+ XMetadatable.class, xSections.getByName("Bibliography1"));
+ assertTrue("idBib", eq(xIndex7s.getMetadataReference(),
+ new StringPair("content.xml", "idBib")));
+
+ System.out.println("...done");
+ }
+
+ static void close(XComponent i_comp)
+ {
+ try {
+ XCloseable xClos = (XCloseable) UnoRuntime.queryInterface(
+ XCloseable.class, i_comp);
+ if (xClos != null) xClos.close(true);
+ } catch (Exception e) {
+ }
+ }
+
+ private void doTest(TreeNode intree) throws Exception
+ {
+ doTest(m_xDoc, intree, true);
+ }
+
+ private void doTest(TreeNode intree, boolean insert) throws Exception
+ {
+ doTest(m_xDoc, intree, insert);
+ }
+
+ private void doTest(XTextDocument xDoc, TreeNode intree,
+ boolean insert) throws Exception
+ {
+ dumpTree(intree, "I: ");
+
+ if (insert) {
+ new TreeInserter(xDoc).insertTree(intree);
+ }
+
+//Thread.sleep(10000);
+
+ XText xText = xDoc.getText();
+ XEnumerationAccess xTextEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, xText);
+ XEnumeration xTextEnum = xTextEA.createEnumeration();
+ // skip to right paragraph
+ xTextEnum.nextElement(); // skip first -- always empty!
+ Object xElement = xTextEnum.nextElement(); // second contains test case
+ XEnumerationAccess xEA = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, xElement);
+ XEnumeration xEnum = xEA.createEnumeration();
+ TreeNode outtree = new EnumConverter().convert(xEnum);
+
+ dumpTree(outtree, "O: ");
+
+ new FuzzyTester().doTest(intree, outtree);
+ }
+
+ private void dumpTree(TreeNode tree) { dumpTree(tree, "> "); }
+
+ private void dumpTree(TreeNode tree, String prefix)
+ {
+ System.out.println(prefix + tree.toString());
+ TreeNodeEnum children = tree.createEnumeration();
+ while (children.hasNext()) {
+ TreeNode node = children.next();
+ dumpTree(node, prefix + " ");
+ }
+ }
+
+ private String mkName(String prefix)
+ {
+ return prefix + String.valueOf(m_Count++);
+ }
+
+ private StringPair mkId(String prefix)
+ {
+ return new StringPair("content.xml", mkName(prefix));
+ }
+
+ private StringPair mkId_(String id)
+ {
+ return new StringPair("content.xml", id);
+ }
+
+ static boolean eq(StringPair i_Left, StringPair i_Right)
+ {
+ return ((i_Left.First).equals(i_Right.First)) &&
+ ((i_Left.Second).equals(i_Right.Second));
+ }
+
+ @BeforeClass public static void setUpConnection() throws Exception {
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+}
+
diff --git a/sw/qa/complex/writer/testdocuments/CheckCrossReferences.odt b/sw/qa/complex/writer/testdocuments/CheckCrossReferences.odt
new file mode 100644
index 000000000000..d8102f0356f8
--- /dev/null
+++ b/sw/qa/complex/writer/testdocuments/CheckCrossReferences.odt
Binary files differ
diff --git a/sw/qa/complex/writer/testdocuments/CheckFlies.odt b/sw/qa/complex/writer/testdocuments/CheckFlies.odt
new file mode 100644
index 000000000000..8f42989b3a0d
--- /dev/null
+++ b/sw/qa/complex/writer/testdocuments/CheckFlies.odt
Binary files differ
diff --git a/sw/qa/complex/writer/testdocuments/TESTMETA.odt b/sw/qa/complex/writer/testdocuments/TESTMETA.odt
new file mode 100755
index 000000000000..004af82e5ddf
--- /dev/null
+++ b/sw/qa/complex/writer/testdocuments/TESTMETA.odt
Binary files differ
diff --git a/sw/qa/complex/writer/testdocuments/TESTXMLID.odt b/sw/qa/complex/writer/testdocuments/TESTXMLID.odt
new file mode 100644
index 000000000000..063d392a489f
--- /dev/null
+++ b/sw/qa/complex/writer/testdocuments/TESTXMLID.odt
Binary files differ
diff --git a/sw/qa/core/Test-BigPtrArray.cxx b/sw/qa/core/Test-BigPtrArray.cxx
new file mode 100644
index 000000000000..4e828bb980b9
--- /dev/null
+++ b/sw/qa/core/Test-BigPtrArray.cxx
@@ -0,0 +1,877 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+#define TIMELOG
+
+#include <testshl/simpleheader.hxx>
+#include <bparr.hxx>
+#include <string>
+#include <stdlib.h>
+#include <rtl/logfile.hxx>
+
+#undef ENABLE_DEBUG_OUTPUT
+
+using namespace std;
+
+
+namespace /* private */
+{
+ const int NUM_ENTRIES = 100000;
+
+ class BigPtrEntryMock : public BigPtrEntry
+ {
+ public:
+ BigPtrEntryMock(int count) : count_(count)
+ {
+ }
+
+ ~BigPtrEntryMock()
+ {
+ #ifdef ENABLE_DEBUG_OUTPUT
+ printf("Destructor called (%i)\n", count_);
+ #endif
+ }
+
+ int getCount() const
+ {
+ return count_;
+ }
+
+ void setCount(int newCount)
+ {
+ count_ = newCount;
+ }
+
+ sal_uLong Position() const
+ {
+ return GetPos();
+ }
+
+ private:
+ int count_;
+ };
+
+ sal_Bool AddToCount(const ElementPtr& rElem, void* pArgs)
+ {
+ BigPtrEntryMock* const pbem = static_cast<BigPtrEntryMock* const>(rElem);
+ pbem->setCount(pbem->getCount() + *((int*)pArgs));
+ return true;
+ }
+
+ void dumpBigPtrArray(const BigPtrArray& bparr)
+ {
+ #ifdef ENABLE_DEBUG_OUTPUT
+ for (int i = 0; i < bparr.Count(); i++)
+ printf("bparr[%i,%i]: %i\n", i, static_cast<BigPtrEntryMock*>(bparr[i])->Position(), static_cast<BigPtrEntryMock*>(bparr[i])->getCount());
+
+ printf("\n");
+ #endif
+ }
+
+ void fillBigPtrArray(BigPtrArray& bparr, sal_uLong numEntries)
+ {
+ for (int i = 0; i < numEntries; i++)
+ bparr.Insert(new BigPtrEntryMock(i), bparr.Count());
+ }
+
+ void printMethodName(const char* name)
+ {
+ #ifdef ENABLE_DEBUG_OUTPUT
+ printf(name);
+ #endif
+ }
+
+ bool checkElementPositions(const BigPtrArray& bparr)
+ {
+ for (int i = 0; i < bparr.Count(); i++)
+ {
+ if (static_cast<BigPtrEntryMock*>(bparr[i])->Position() != i)
+ return false;
+ }
+ return true;
+ }
+
+ void releaseBigPtrArrayContent(BigPtrArray& bparr)
+ {
+ for (int i = 0; i < bparr.Count(); i++)
+ delete bparr[i];
+ }
+
+ RTL_LOGFILE_CONTEXT(logFile, "BigPtrArray performance measures" );
+}
+
+class BigPtrArrayUnittest : public CppUnit::TestFixture
+{
+public:
+
+ BigPtrArrayUnittest()
+ {
+ }
+
+ /** Test constructor/destructor
+ The size of the BigPtrArray
+ aka the 'Count' should be 0
+ initially.
+ */
+ void test_ctor()
+ {
+ printMethodName("test_ctor\n");
+
+ BigPtrArray bparr;
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "BigPtrArray ctor failed",
+ bparr.Count() == 0
+ );
+ }
+
+ void test_insert_entries_at_front()
+ {
+ printMethodName("test_insert_entries_at_front\n");
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_insert_entries_at_front");
+
+ BigPtrArray bparr;
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ sal_uLong oldCount = bparr.Count();
+ bparr.Insert(new BigPtrEntryMock(i), 0);
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_entries_at_front failed",
+ (bparr.Count() == oldCount + 1)
+ )
+ }
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_insert_entries_at_front");
+
+ for (int i = 0, j = NUM_ENTRIES - 1; i < NUM_ENTRIES; i++, j--)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_entries_at_front failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == j
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_entries_at_front failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_insert_entries_in_the_middle()
+ {
+ printMethodName("test_insert_entries_in_the_middle\n");
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_insert_entries_in_the_middle");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ sal_uLong oldCount = bparr.Count();
+
+ bparr.Insert(new BigPtrEntryMock(NUM_ENTRIES), bparr.Count() / 2);
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_insert_entries_in_the_middle");
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_entries_in_the_middle failed",
+ (oldCount + 1 == bparr.Count() && static_cast<BigPtrEntryMock*>(bparr[bparr.Count() / 2])->getCount() == NUM_ENTRIES)
+ )
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_entries_in_the_middle failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_insert_at_already_used_index()
+ {
+ printMethodName("test_insert_at_already_used_index\n");
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_insert_at_already_used_index");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ int oldCount = bparr.Count();
+
+ for (int i = 0, j = -5; i < 5; i++, j++)
+ bparr.Insert(new BigPtrEntryMock(j), i);
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_insert_at_already_used_index");
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_at_already_used_index failed",
+ (oldCount + 5 == bparr.Count())
+ )
+
+ for (int i = 0, j = -5; i < bparr.Count(); i++, j++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_at_already_used_index failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == j
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_at_already_used_index failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_insert_at_end()
+ {
+ printMethodName("test_insert_at_end\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ sal_uLong oldCount = bparr.Count();
+ bparr.Insert(new BigPtrEntryMock(NUM_ENTRIES), bparr.Count());
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_at_end failed",
+ (oldCount + 1 == bparr.Count() && static_cast<BigPtrEntryMock*>(bparr[bparr.Count()-1])->getCount() == NUM_ENTRIES)
+ )
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_at_end failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_remove_at_front()
+ {
+ printMethodName("test_remove_at_front\n");
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_remove_at_front");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ sal_uLong oldCount = bparr.Count();
+
+ delete bparr[0]; // release content
+ bparr.Remove(0); // remove item from container
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_front failed (wrong count)",
+ (oldCount - 1 == bparr.Count())
+ )
+
+ for (int j = 0, k = i + 1; j < bparr.Count(); j++, k++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_front failed",
+ static_cast<BigPtrEntryMock*>(bparr[j])->getCount() == k
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_front failed",
+ checkElementPositions(bparr)
+ )
+
+ dumpBigPtrArray(bparr);
+ }
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_remove_at_front");
+ }
+
+ void test_remove_at_back()
+ {
+ printMethodName("test_remove_at_back\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = NUM_ENTRIES - 1; i >= 0; i--)
+ {
+ sal_uLong oldCount = bparr.Count();
+ delete bparr[i];
+ bparr.Remove(i);
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_back failed (wrong count)",
+ (oldCount - 1 == bparr.Count())
+ )
+
+ for (int j = 0; j < bparr.Count(); j++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_back failed",
+ static_cast<BigPtrEntryMock*>(bparr[j])->getCount() == j
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_back failed",
+ checkElementPositions(bparr)
+ )
+
+ dumpBigPtrArray(bparr);
+ }
+ }
+
+ void test_remove_in_the_middle()
+ {
+ printMethodName("test_remove_in_the_middle\n");
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_remove_in_the_middle");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ while (bparr.Count())
+ {
+ sal_uLong oldCount = bparr.Count();
+ int oldElement = static_cast<BigPtrEntryMock*>(bparr[bparr.Count() / 2])->getCount();
+
+ delete bparr[bparr.Count() / 2];
+ bparr.Remove(bparr.Count() / 2);
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_in_the_middle failed (wrong count)",
+ (oldCount - 1 == bparr.Count())
+ )
+
+ for (int i = 0; i < bparr.Count(); i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_in_the_middle failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() != oldElement
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_in_the_middle failed",
+ checkElementPositions(bparr)
+ )
+
+ dumpBigPtrArray(bparr);
+ }
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_remove_in_the_middle");
+ }
+
+ void test_remove_multiple_elements_at_once()
+ {
+ printMethodName("test_remove_multiple_elements_at_once\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ while(bparr.Count())
+ {
+ sal_uLong nRemove = (bparr.Count() > 3) ? 3 : bparr.Count();
+ sal_uLong oldCount = bparr.Count();
+
+ for (int i = 0; i < nRemove; i++)
+ delete bparr[i];
+
+ bparr.Remove(0, nRemove);
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_multiple_elements_at_once failed",
+ (oldCount - nRemove == bparr.Count())
+ )
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_multiple_elements_at_once failed",
+ checkElementPositions(bparr)
+ )
+
+ dumpBigPtrArray(bparr);
+ }
+ }
+
+ void test_remove_all_elements_at_once()
+ {
+ printMethodName("test_remove_all_elements_at_once\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ releaseBigPtrArrayContent(bparr);
+ bparr.Remove(0, bparr.Count());
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_all_elements_at_once failed",
+ bparr.Count() == 0
+ )
+
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_move_elements_from_lower_to_higher_pos()
+ {
+ printMethodName("test_move_elements_from_lower_to_higher_pos\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = 0; i < NUM_ENTRIES - 1; i++)
+ {
+ bparr.Move(i, i + 2);
+ dumpBigPtrArray(bparr);
+ }
+
+ for (int i = 0; i < (NUM_ENTRIES - 1); i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_lower_to_higher_pos failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i + 1)
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_lower_to_higher_pos failed",
+ static_cast<BigPtrEntryMock*>(bparr[NUM_ENTRIES -1])->getCount() == 0
+ )
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_lower_to_higher_pos failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ }
+
+ void test_move_elements_from_higher_to_lower_pos()
+ {
+ printMethodName("test_move_elements_from_higher_to_lower_pos\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = NUM_ENTRIES - 1; i >= 1; i--)
+ {
+ bparr.Move(i, i - 1);
+ dumpBigPtrArray(bparr);
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_higher_to_lower_pos failed",
+ static_cast<BigPtrEntryMock*>(bparr[0])->getCount() == (NUM_ENTRIES - 1)
+ )
+
+ for (int i = 1; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_higher_to_lower_pos failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i - 1)
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_higher_to_lower_pos failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ }
+
+ void test_move_to_same_position()
+ {
+ printMethodName("test_move_to_same_position\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ bparr.Move(i, i);
+ }
+
+ dumpBigPtrArray(bparr);
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_to_same_position failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == i
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_to_same_position failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_replace_elements()
+ {
+ printMethodName("test_replace_elements\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = 0, j = NUM_ENTRIES - 1; i < NUM_ENTRIES; i++, j--)
+ {
+ delete bparr[i];
+ bparr.Replace(i, new BigPtrEntryMock(j));
+ dumpBigPtrArray(bparr);
+ }
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_replace_elements failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (NUM_ENTRIES - i - 1)
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_replace_elements failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ }
+
+ void test_for_each()
+ {
+ printMethodName("test_for_each\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ int addCount = 1;
+ bparr.ForEach(AddToCount, &addCount);
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_each failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i+1)
+ )
+ }
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_for_some1()
+ {
+ printMethodName("test_for_some1\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ int addCount = 1;
+ bparr.ForEach(0, NUM_ENTRIES / 2, AddToCount, &addCount);
+
+ int i = 0;
+ for (/* */; i < NUM_ENTRIES / 2; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_some1 failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i+1)
+ )
+ }
+
+ for (/* */; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_some1 failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i)
+ )
+ }
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_for_some2()
+ {
+ printMethodName("test_for_some2\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ int addCount = 1;
+ bparr.ForEach(NUM_ENTRIES / 2, NUM_ENTRIES, AddToCount, &addCount);
+
+ int i = 0;
+ for (/* */; i < NUM_ENTRIES / 2; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_some2 failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i)
+ )
+ }
+
+ for (/* */; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_some2 failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i+1)
+ )
+ }
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_for_some3()
+ {
+ printMethodName("test_for_some3\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ int addCount = 1;
+ bparr.ForEach(0, 0, AddToCount, &addCount);
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_some3 failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == i
+ )
+ }
+ releaseBigPtrArrayContent(bparr);
+ }
+
+ CPPUNIT_TEST_SUITE(BigPtrArrayUnittest);
+ CPPUNIT_TEST(test_ctor);
+ CPPUNIT_TEST(test_insert_entries_at_front);
+ CPPUNIT_TEST(test_insert_entries_in_the_middle);
+ CPPUNIT_TEST(test_insert_at_already_used_index);
+ CPPUNIT_TEST(test_insert_at_end);
+ CPPUNIT_TEST(test_remove_at_front);
+ CPPUNIT_TEST(test_remove_at_back);
+ CPPUNIT_TEST(test_remove_in_the_middle);
+ CPPUNIT_TEST(test_remove_multiple_elements_at_once);
+ CPPUNIT_TEST(test_remove_all_elements_at_once);
+ CPPUNIT_TEST(test_move_elements_from_lower_to_higher_pos);
+ CPPUNIT_TEST(test_move_elements_from_higher_to_lower_pos);
+ CPPUNIT_TEST(test_replace_elements);
+ CPPUNIT_TEST(test_for_each);
+ CPPUNIT_TEST(test_for_some1);
+ CPPUNIT_TEST(test_for_some2);
+ CPPUNIT_TEST(test_for_some3);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+const char* START = "START: ";
+const char* END = "END: ";
+
+class PerformanceTracer
+{
+public:
+
+public:
+ PerformanceTracer(const string& methodName) :
+ startString_(START),
+ endString_(END)
+ {
+ startString_ += methodName;
+ endString_ += methodName;
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, startString_.c_str());
+ }
+
+ ~PerformanceTracer()
+ {
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, endString_.c_str());
+ }
+
+private:
+ string startString_;
+ string endString_;
+};
+
+class BigPtrArrayPerformanceTest : public CppUnit::TestFixture
+{
+public:
+ BigPtrArrayPerformanceTest()
+ {
+ }
+
+ void test_insert_at_end_1000()
+ { test_insert_at_end("1000"); }
+
+ void test_insert_at_end_10000()
+ { test_insert_at_end("10000"); }
+
+ void test_insert_at_end_100000()
+ { test_insert_at_end("100000"); }
+
+ void test_insert_at_end_1000000()
+ { test_insert_at_end("1000000"); }
+
+ void test_insert_at_front_1000()
+ { test_insert_at_front("1000"); }
+
+ void test_insert_at_front_10000()
+ { test_insert_at_front("10000"); }
+
+ void test_insert_at_front_100000()
+ { test_insert_at_front("100000"); }
+
+ void test_insert_at_front_1000000()
+ { test_insert_at_front("1000000"); }
+
+ CPPUNIT_TEST_SUITE(BigPtrArrayPerformanceTest);
+ CPPUNIT_TEST(test_insert_at_end_1000);
+ CPPUNIT_TEST(test_insert_at_end_10000);
+ CPPUNIT_TEST(test_insert_at_end_100000);
+ CPPUNIT_TEST(test_insert_at_end_1000000);
+ CPPUNIT_TEST(test_insert_at_front_1000);
+ CPPUNIT_TEST(test_insert_at_front_10000);
+ CPPUNIT_TEST(test_insert_at_front_100000);
+ CPPUNIT_TEST(test_insert_at_front_1000000);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void test_insert_at_end(const char* numElements)
+ {
+ char buff[100] = { 0 };
+ strcat(buff, "test_insert_at_end ");
+ strcat(buff, numElements);
+ int n = atoi(numElements);
+ PerformanceTracer tracer(buff);
+ BigPtrArray bparr;
+ for (int i = 0; i < n; i++)
+ bparr.Insert(new BigPtrEntryMock(i), bparr.Count());
+
+ releaseBigPtrArrayContent(bparr);
+ }
+
+ void test_insert_at_front(const char* numElements)
+ {
+ char buff[100] = { 0 };
+ strcat(buff, "test_insert_at_front ");
+ strcat(buff, numElements);
+ int n = atoi(numElements);
+ PerformanceTracer tracer(buff);
+ BigPtrArray bparr;
+ for (int i = 0; i < n; i++)
+ bparr.Insert(new BigPtrEntryMock(i), 0);
+
+ releaseBigPtrArrayContent(bparr);
+ }
+};
+
+
+//#####################################
+// register test suites
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BigPtrArrayUnittest, "BigPtrArrayUnittest");
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BigPtrArrayPerformanceTest, "BigPtrArrayPerformanceTest");
+
+NOADDITIONAL;
+
diff --git a/sw/qa/core/bigpointerarray-new.cxx b/sw/qa/core/bigpointerarray-new.cxx
new file mode 100644
index 000000000000..a769a8e3fae0
--- /dev/null
+++ b/sw/qa/core/bigpointerarray-new.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "bparr.hxx"
+#include <algorithm>
+
+BigPtrArray::BigPtrArray()
+{
+ //container_.reserve(1000);
+}
+
+sal_uLong BigPtrArray::Count() const
+{
+ return container_.size();
+}
+
+void BigPtrArray::Move(sal_uLong fromPos, sal_uLong toPos)
+{
+ DBG_ASSERT(fromPos < container_.size() && toPos < container_.size(), "BigPtrArray.Move precondition violation");
+ Insert(container_[fromPos], toPos);
+ Remove(toPos < fromPos ? fromPos + 1 : fromPos, 1);
+}
+
+void BigPtrArray::ForEach(sal_uLong fromPos, sal_uLong toPos, FnForEach fn, void* pArgs)
+{
+ DBG_ASSERT(fromPos < toPos && fromPos < container_.size() && toPos < container_.size(), "BigPtrArray::ForEach precondition violation");
+ Container_t::const_iterator iter = container_.begin() + fromPos;
+ Container_t::const_iterator iter_end = container_.begin() + toPos;
+ for (/*no init*/; iter != iter_end; ++iter)
+ fn(*iter, pArgs);
+}
+
+void BigPtrArray::ForEach(FnForEach fn, void* pArgs)
+{
+ Container_t::const_iterator iter = container_.begin();
+ Container_t::const_iterator iter_end = container_.end();
+ for ( /*no init*/; iter != iter_end; ++iter)
+ fn(*iter, pArgs);
+}
+
+ElementPtr BigPtrArray::operator[](sal_uLong pos) const
+{
+ DBG_ASSERT(pos < container_.size(), "BigPtrArray::operator[] precondition violation");
+ return container_[pos];
+}
+
+void BigPtrArray::Insert(const ElementPtr& rElem, sal_uLong pos)
+{
+ DBG_ASSERT(pos <= container_.size(), "BigPtrArray::Insert precondition violation");
+
+ rElem->pBigPtrArray_ = this;
+ rElem->pos_ = pos;
+
+ if (pos == container_.size())
+ container_.push_back(rElem);
+ else
+ {
+ container_.insert(container_.begin() + pos, rElem);
+ FixElementIndizes(container_.begin(), container_.end());
+ }
+}
+
+void BigPtrArray::Remove( sal_uLong pos, sal_uLong n )
+{
+ DBG_ASSERT((pos < container_.size()) && ((container_.begin() + pos + n) < container_.end()), "BigPtrArray.Remove precondition violation")
+ container_.erase(container_.begin() + pos, container_.begin() + pos + n);
+ FixElementIndizes(container_.begin(), container_.end());
+}
+
+void BigPtrArray::Replace(sal_uLong pos, const ElementPtr& rElem)
+{
+ DBG_ASSERT(pos < container_.size(), "BigPtrArray::Replace precondition violation");
+ rElem->pBigPtrArray_ = this;
+ rElem->pos_ = pos;
+ container_[pos] = rElem;
+}
+
+void BigPtrArray::FixElementIndizes(Container_t::const_iterator begin, Container_t::const_iterator end) const
+{
+ Container_t::const_iterator iter = begin;
+ for (int i = 0; iter != end; ++iter, i++)
+ (*iter)->pos_ = i;
+}
diff --git a/sw/qa/core/bigpointerarray-new.hxx b/sw/qa/core/bigpointerarray-new.hxx
new file mode 100644
index 000000000000..af6805880fe8
--- /dev/null
+++ b/sw/qa/core/bigpointerarray-new.hxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _BPARR_HXX
+#define _BPARR_HXX
+
+#include <tools/solar.h>
+#include <tools/debug.hxx>
+
+#include <deque>
+
+class BigPtrArray;
+
+/** Base class for container entries
+*/
+class BigPtrEntry
+{
+ friend class BigPtrArray;
+ BigPtrArray* pBigPtrArray_;
+ sal_uLong pos_;
+
+protected:
+ BigPtrEntry() : pBigPtrArray_(0), pos_(0)
+ {}
+
+ virtual ~BigPtrEntry()
+ {}
+
+ sal_uLong GetPos() const
+ {
+ return pos_;
+ }
+
+ BigPtrArray& GetArray() const
+ {
+ return *pBigPtrArray_;
+ }
+};
+
+typedef BigPtrEntry* ElementPtr;
+typedef sal_Bool (*FnForEach)(const ElementPtr&, void* pArgs);
+
+/** A container abstraction
+*/
+class BigPtrArray
+{
+public:
+ typedef std::deque<ElementPtr> Container_t;
+
+public:
+ /**
+ */
+ BigPtrArray();
+
+ /** Return the number of entries inserted
+ into the array
+ */
+ sal_uLong Count() const;
+
+ /** Insert an Element into the array at a certain
+ position
+
+ @param rElem
+ [in] the element
+
+ @param pos
+ [in] the position where to insert the element.
+
+ @pre (pos >= 0 && pos <= BigPtrArray.Count())
+ @post (((oldCount + 1) == BigPtrArray.Count()) && BigPtrArray[pos] == rElem)
+ */
+ void Insert(const ElementPtr& rElem, sal_uLong pos);
+
+ /** Remove a specified number of elements starting at a certain position.
+
+ @param pos
+ [in] the position where to start removing elements
+
+ @param n
+ [in] the number of elements to remove
+
+ @pre (pos < BigPtrArray.Count() && n <= BigPtrArray.Count())
+ @post ((oldCount - n) == BigPtrArray.Count())
+ */
+ void Remove(sal_uLong pos, sal_uLong n = 1);
+
+ /** Move an entry from a certain position to another on.
+
+ @param from
+ [in]
+
+ @param to
+ [in]
+ */
+ void Move(sal_uLong fromPos, sal_uLong toPos);
+
+ /** Replace an entry at a certain position
+
+ @param pos
+ [in] the position of the entry
+
+ @param rElem
+ [in] the new entry
+
+ @pre pos < BigPtrArray.Count()
+ @post (oldCount == BigPtrArray.Count() && BigPtrArray[pos] == rElem)
+ */
+ void Replace(sal_uLong pos, const ElementPtr& rElem);
+
+ /** Get the entry at a certain index
+
+ @param pos
+ [in] the position of the entry
+
+ @pre pos < BigPtrArray.Count()
+ */
+ ElementPtr operator[](sal_uLong pos) const;
+
+ /**
+ */
+ void ForEach(FnForEach fn, void* pArgs = NULL);
+
+ /**
+ */
+ void ForEach(sal_uLong fromPos, sal_uLong toPos, FnForEach fn, void* pArgs = NULL);
+
+private:
+
+ void FixElementIndizes(Container_t::const_iterator begin, Container_t::const_iterator end) const;
+
+private:
+ Container_t container_;
+};
+
+#endif
diff --git a/sw/qa/core/export.exp b/sw/qa/core/export.exp
new file mode 100644
index 000000000000..a13529da5876
--- /dev/null
+++ b/sw/qa/core/export.exp
@@ -0,0 +1 @@
+registerAllTestFunction
diff --git a/sw/qa/core/export.map b/sw/qa/core/export.map
new file mode 100644
index 000000000000..7321bbca16ad
--- /dev/null
+++ b/sw/qa/core/export.map
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+UDK_3_0_0 {
+ global:
+ registerAllTestFunction;
+
+ local:
+ *;
+};
diff --git a/sw/qa/core/performance-jobfile b/sw/qa/core/performance-jobfile
new file mode 100644
index 000000000000..9e33d3c858ba
--- /dev/null
+++ b/sw/qa/core/performance-jobfile
@@ -0,0 +1,9 @@
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_end_1000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_end_10000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_end_100000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_end_1000000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_front_1000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_front_10000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_front_100000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_front_1000000
+
diff --git a/sw/qa/unoapi/Test.java b/sw/qa/unoapi/Test.java
new file mode 100644
index 000000000000..8a5b9b58fb95
--- /dev/null
+++ b/sw/qa/unoapi/Test.java
@@ -0,0 +1,52 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+package org.openoffice.sw.qa.unoapi;
+
+import org.openoffice.Runner;
+import org.openoffice.test.OfficeConnection;
+import org.openoffice.test.Argument;
+import static org.junit.Assert.*;
+
+public final class Test {
+ @org.junit.Before public void setUp() throws Exception {
+ connection.setUp();
+ }
+
+ @org.junit.After public void tearDown()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ @org.junit.Test public void test() {
+ assertTrue(
+ Runner.run(
+ "-sce", Argument.get("sce"), "-xcl", Argument.get("xcl"), "-tdoc",
+ Argument.get("tdoc"), "-cs", connection.getDescription()));
+ }
+
+ private final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/sw/qa/unoapi/knownissues.xcl b/sw/qa/unoapi/knownissues.xcl
new file mode 100644
index 000000000000..99d7c7f12881
--- /dev/null
+++ b/sw/qa/unoapi/knownissues.xcl
@@ -0,0 +1,186 @@
+### i85576 ###
+sw.SwXCellRange::com::sun::star::text::CellRange
+
+### i21166 ###
+sw.SwXCell::com::sun::star::text::CellProperties
+sw.SwXCell::com::sun::star::beans::XPropertySet
+
+### i59143 ###
+sw.SwXTableColumns::com::sun::star::table::XTableColumns
+
+### i85580 ###
+sw.SwXTextView::com::sun::star::view::XSelectionSupplier
+#-> disabled in sw.scw
+
+### i23394 ###
+sw.XMLContentImporter::com::sun::star::xml::sax::XDocumentHandler
+sw.XMLMetaImporter::com::sun::star::xml::sax::XDocumentHandler
+sw.XMLStylesImporter::com::sun::star::xml::sax::XDocumentHandler
+# -> disables in sw.sce
+
+### i23422 ###
+sw.SwXTextViewCursor::com::sun::star::beans::XMultiPropertyStates
+
+### i23623 ###
+sw.SwXStyleFamily::com::sun::star::container::XNameReplace
+
+### i85583 ###
+sw.PageStyle::com::sun::star::style::PageProperties
+
+### i25408 ###
+sw.PageStyle::com::sun::star::style::XStyle
+
+### i85584 ###
+sw.CharacterStyle::com::sun::star::style::CharacterPropertiesAsian
+
+### i25473 ###
+sw.ConditionalParagraphStyle::com::sun::star::beans::XMultiPropertyStates
+sw.ParagraphStyle::com::sun::star::beans::XMultiPropertyStates
+
+### i34456 ###
+sw.SwXTextDocument::com::sun::star::view::XPrintJobBroadcaster
+
+### i37272 ###
+sw.SwXDrawPage::com::sun::star::drawing::XShapeGrouper
+
+### i38584 ###
+sw.SwXParagraph::com::sun::star::beans::XPropertySet
+sw.SwXTextPortion::com::sun::star::beans::XPropertySet
+sw.SwXTextRange::com::sun::star::beans::XPropertySet
+sw.SwXTextViewCursor::com::sun::star::beans::XPropertySet
+sw.SwXTextCursor::com::sun::star::beans::XPropertySet
+
+### i85585 ###
+sw.SwXTextSection::com::sun::star::text::TextSection
+
+### i85586 ###
+sw.SwAccessibleDocumentView::com::sun::star::accessibility::XAccessibleEventBroadcaster
+
+### i58374 ###
+sw.DocumentSettings::com::sun::star::document::Settings
+
+### i85586 ###
+sw.SwXAutoTextGroup::com::sun::star::container::XElementAccess
+
+### i72029 ###
+sw.SwXChapterNumbering::com::sun::star::text::NumberingRules
+
+### i38586 ###
+sw.SwXParagraph::com::sun::star::style::ParagraphProperties
+sw.SwXTextCursor::com::sun::star::style::ParagraphProperties
+sw.SwXTextPortion::com::sun::star::style::ParagraphProperties
+sw.SwXTextRange::com::sun::star::style::ParagraphProperties
+sw.SwXTextViewCursor::com::sun::star::style::ParagraphProperties
+sw.ConditionalParagraphStyle::com::sun::star::style::ParagraphProperties
+sw.ParagraphStyle::com::sun::star::style::ParagraphProperties
+sw.SwXCellRange::com::sun::star::style::ParagraphProperties
+sw.SwXTextDefaults::com::sun::star::style::ParagraphProperties
+sw.SwXTextTableCursor::com::sun::star::style::ParagraphProperties
+
+### i85575 ###
+sw.SwXParagraph::com::sun::star::style::CharacterProperties
+sw.SwXTextCursor::com::sun::star::style::CharacterProperties
+
+### i77882 ###
+sw.SwXTextCursor::com::sun::star::document::XDocumentInsertable
+
+### i85595 ###
+sw.ParagraphStyle::com::sun::star::beans::XMultiPropertySet
+sw.ParagraphStyle::com::sun::star::beans::XPropertySet
+
+### i85596 ###
+sw.SwXFieldMaster::com::sun::star::text::TextFieldMaster
+
+### i85634 ###
+sw.SwAccessibleTableView
+# -> disabled in sw.sce
+
+### i85635 ###
+sw.DocumentSettings::com::sun::star::text::PrintPreviewSettings
+
+### i85638 ###
+sw.SwXTextDocument::com::sun::star::frame::XStorable
+
+### i85640 ###
+sw.SwXMailMerge
+#-> disabled in sw.sce
+
+### i86656 ###
+sw.SwAccessibleDocumentView::com::sun::star::accessibility::XAccessibleComponent
+
+### i86751 ###
+sw.SwAccessibleDocumentPageView::com::sun::star::accessibility::XAccessibleEventBroadcaster
+#-> disabled in sw.sce
+
+### i87978 ###
+sw.DocumentSettings::com::sun::star::beans::XPropertySet
+sw.ConditionalParagraphStyle::com::sun::star::beans::XPropertySet
+
+### i88242 ###
+sw.SwXTextDocument::com::sun::star::view::XPrintable
+sw.SwXTextDocument::com::sun::star::text::XPagePrintable
+
+### i88257 ###
+sw.SwAccessibleTextGraphicObject::com::sun::star::accessibility::XAccessibleImage
+
+### i88262 ###
+sw.SwXTextFrame::com::sun::star::text::BaseFrameProperties
+
+### i88374 ###
+sw.SwXTextTable::com::sun::star::table::XAutoFormattable
+
+### i88310 ###
+sw.SwAccessibleTextGraphicObject::com::sun::star::accessibility::XAccessibleComponent
+
+### i88606 ###
+sw.SwAccessibleTextGraphicObject::com::sun::star::accessibility::XAccessibleContext
+
+### i89021 ###
+sw.SwXTextDefaults
+#-> disabled in sw.sce
+
+### i89022 ###
+sw.SwAccessiblePageView
+#-> disabled in sw.sce
+
+### i89419 ###
+sw.SwXTextEmbeddedObject::com::sun::star::text::BaseFrameProperties
+
+### i91530 ###
+sw.SwXTextPortion::com::sun::star::style::CharacterProperties
+
+### i94977 ###
+sw.SwXTextGraphicObject::com::sun::star::text::BaseFrameProperties
+
+### i109917 ###
+sw.SwXTextDocument::com::sun::star::document::XEventBroadcaster
+
+### i111186 ###
+sw.PageStyle::com::sun::star::beans::XPropertySet
+
+### i111218 ###
+sw.SwAccessibleParagraphView::com::sun::star::accessibility::XAccessibleEventBroadcaster
+
+### i111220 ###
+sw.XMLContentExporter::com::sun::star::document::XFilter
+sw.XMLSettingsExporter::com::sun::star::document::XFilter
+
+### i111273 ###
+sw.SwXTextEmbeddedObject::com::sun::star::document::XEmbeddedObjectSupplier
+
+### i111332 ###
+sw.XMLStylesExporter::com::sun::star::document::XFilter
+
+### i113020 ###
+sw.SwXTextEmbeddedObject::com::sun::star::beans::XPropertySet
+sw.SwXTextGraphicObject::com::sun::star::beans::XPropertySet
+sw.SwXTextFrame::com::sun::star::beans::XPropertySet
+
+### i113136 ###
+sw.SwAccessibleParagraphView::com::sun::star::accessibility::XAccessibleEditableText
+
+### i114205 ###
+sw.SwAccessibleParagraphView::com::sun::star::accessibility::XAccessibleText
+
+### i114889 ###
+sw.SwXTextViewCursor::com::sun::star::view::XScreenCursor
diff --git a/sw/qa/unoapi/makefile.mk b/sw/qa/unoapi/makefile.mk
new file mode 100644
index 000000000000..f5102c2c9c84
--- /dev/null
+++ b/sw/qa/unoapi/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#***********************************************************************/
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../..
+PRJNAME = sw
+TARGET = qa_unoapi
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = org/openoffice/sw/qa/unoapi
+JAVATESTFILES = Test.java
+JAVAFILES = $(JAVATESTFILES)
+JARFILES = OOoRunner.jar ridl.jar test.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+.END
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+.END
diff --git a/sw/qa/unoapi/sw.sce b/sw/qa/unoapi/sw.sce
new file mode 100644
index 000000000000..f6ae766af2d7
--- /dev/null
+++ b/sw/qa/unoapi/sw.sce
@@ -0,0 +1,94 @@
+-o sw.CharacterStyle
+-o sw.ConditionalParagraphStyle
+-o sw.PageStyle
+-o sw.ParagraphStyle
+#i111197 -o sw.SwAccessibleDocumentPageView
+#i86751 -o sw.SwAccessibleDocumentView
+-o sw.SwAccessibleEndnoteView
+#i113142 -o sw.SwAccessibleFooterView
+#i114637 -o sw.SwAccessibleFootnoteView
+#i113142 -o sw.SwAccessibleHeaderView
+#i89022 -o sw.SwAccessiblePageView
+-o sw.SwAccessibleParagraphView
+-o sw.SwAccessibleTableCellView
+#i85634 -o sw.SwAccessibleTableView
+#i111178 -o sw.SwAccessibleTextEmbeddedObject
+#i111178 -o sw.SwAccessibleTextFrameView
+-o sw.SwAccessibleTextGraphicObject
+-o sw.SwXAutoTextContainer
+-o sw.SwXAutoTextEntry
+-o sw.SwXAutoTextGroup
+-o sw.SwXBodyText
+-o sw.SwXBookmark
+-o sw.SwXBookmarks
+-o sw.SwXCell
+-o sw.SwXCellRange
+-o sw.SwXChapterNumbering
+-o sw.SwXDocumentIndex
+-o sw.SwXDocumentIndexMark
+-o sw.SwXDocumentIndexes
+-o sw.SwXDrawPage
+-o sw.SwXEndnoteProperties
+-o sw.SwXFieldEnumeration
+-o sw.SwXFieldMaster
+-o sw.SwXFootnote
+-o sw.SwXFootnoteProperties
+-o sw.SwXFootnoteText
+-o sw.SwXFootnotes
+-o sw.SwXFrames
+-o sw.SwXHeadFootText
+-o sw.SwXLineNumberingProperties
+#i85640 -o sw.SwXMailMerge
+-o sw.SwXModule
+-o sw.SwXNumberingRules
+#i103696 -o sw.SwXParagraph
+-o sw.SwXParagraphEnumeration
+-o sw.SwXPrintSettings
+-o sw.SwXPropertySet
+-o sw.SwXPropertySetInfo
+-o sw.SwXReferenceMark
+-o sw.SwXReferenceMarks
+#i111190 -o sw.SwXShape
+-o sw.SwXStyleFamilies
+-o sw.SwXStyleFamily
+-o sw.SwXTableCellText
+-o sw.SwXTableColumns
+-o sw.SwXTableRows
+-o sw.SwXTextColumns
+-o sw.SwXTextCursor
+#i89021 -o sw.SwXTextDefaults
+-o sw.SwXTextDocument
+-o sw.SwXTextEmbeddedObject
+-o sw.SwXTextEmbeddedObjects
+-o sw.SwXTextField
+-o sw.SwXTextFieldMasters
+-o sw.SwXTextFieldTypes
+-o sw.SwXTextFrame
+-o sw.SwXTextFrameText
+-o sw.SwXTextGraphicObject
+-o sw.SwXTextGraphicObjects
+#i103696 -o sw.SwXTextPortion
+-o sw.SwXTextPortionEnumeration
+-o sw.SwXTextRange
+-o sw.SwXTextRanges
+-o sw.SwXTextSearch
+-o sw.SwXTextSection
+-o sw.SwXTextSections
+-o sw.SwXTextTable
+-o sw.SwXTextTableCursor
+-o sw.SwXTextTableRow
+-o sw.SwXTextTables
+#i85580 -o sw.SwXTextView
+-o sw.SwXTextViewCursor
+-o sw.SwXViewSettings
+-o sw.XMLContentExporter
+#i23394 -o sw.XMLContentImporter
+#i111194-o sw.XMLExporter
+-o sw.XMLImporter
+#i23394 -o sw.XMLMetaExporter
+-o sw.XMLMetaImporter
+-o sw.XMLSettingsExporter
+-o sw.XMLSettingsImporter
+-o sw.XMLStylesExporter
+#i23394 -o sw.XMLStylesImporter
+-o sw.DocumentSettings
diff --git a/sw/qa/unoapi/testdocuments/MailMerge.sxw b/sw/qa/unoapi/testdocuments/MailMerge.sxw
new file mode 100644
index 000000000000..108840535093
--- /dev/null
+++ b/sw/qa/unoapi/testdocuments/MailMerge.sxw
Binary files differ
diff --git a/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sdw b/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sdw
new file mode 100644
index 000000000000..4f5c2e39c030
--- /dev/null
+++ b/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sdw
Binary files differ
diff --git a/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sxw b/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sxw
new file mode 100644
index 000000000000..75c6242f5070
--- /dev/null
+++ b/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sxw
Binary files differ
diff --git a/sw/qa/unoapi/testdocuments/XDocumentInsertable.sxw b/sw/qa/unoapi/testdocuments/XDocumentInsertable.sxw
new file mode 100644
index 000000000000..b1398769d7ac
--- /dev/null
+++ b/sw/qa/unoapi/testdocuments/XDocumentInsertable.sxw
Binary files differ
diff --git a/sw/qa/unoapi/testdocuments/sForm.sxw b/sw/qa/unoapi/testdocuments/sForm.sxw
new file mode 100644
index 000000000000..a4958930c348
--- /dev/null
+++ b/sw/qa/unoapi/testdocuments/sForm.sxw
Binary files differ
diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi
new file mode 100755
index 000000000000..d77df897a95a
--- /dev/null
+++ b/sw/sdi/_annotsh.sdi
@@ -0,0 +1,385 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface _Annotation
+[ Automation = FALSE; ]
+{
+ FN_DELETE_COMMENT
+ [
+ ExecMethod = NoteExec ;
+ StateMethod = GetNoteState ;
+ ]
+
+ FN_DELETE_NOTE_AUTHOR
+ [
+ ExecMethod = NoteExec ;
+ StateMethod = GetNoteState ;
+ ]
+
+ FN_DELETE_ALL_NOTES
+ [
+ ExecMethod = NoteExec ;
+ StateMethod = GetNoteState ;
+ ]
+
+ FN_HIDE_NOTE
+ [
+ ExecMethod = NoteExec ;
+ StateMethod = GetNoteState ;
+ ]
+
+ FN_HIDE_NOTE_AUTHOR
+ [
+ ExecMethod = NoteExec ;
+ StateMethod = GetNoteState ;
+ ]
+
+ FN_HIDE_ALL_NOTES
+ [
+ ExecMethod = NoteExec ;
+ StateMethod = GetNoteState ;
+ ]
+
+ FN_POSTIT
+ [
+ ExecMethod = NoteExec ;
+ StateMethod = GetNoteState ;
+ ]
+
+ FN_REPLY
+ [
+ ExecMethod = NoteExec ;
+ StateMethod = GetNoteState ;
+ ]
+ FN_ESCAPE // api:
+ [
+ ExecMethod = NoteExec ;
+ ]
+
+ SfxVoidItem Cut SID_CUT ( ) // api:
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_COPY // api:
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ ]
+
+ SID_PASTE // api:
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_PASTE_SPECIAL // api:
+ [
+ StateMethod = StateClpbrd ;
+ ExecMethod = ExecClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CLIPBOARD_FORMAT_ITEMS // status(final|play)
+ [
+ StateMethod = StateClpbrd ;
+ ExecMethod = ExecClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_SELECTALL // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = NoState ;
+ ]
+
+ SID_UNDO // api:
+ [
+ ExecMethod = ExecUndo ;
+ StateMethod = StateUndo ;
+
+ ToolBoxConfig , MenuConfig , AccelConfig;
+ ]
+
+ SID_REDO // api:
+ [
+ ExecMethod = ExecUndo ;
+ StateMethod = StateUndo ;
+
+ ]
+
+ SID_REPEAT // api:
+ [
+ ExecMethod = ExecUndo ;
+ StateMethod = StateUndo ;
+ ]
+ SID_GETUNDOSTRINGS
+ [
+ StateMethod = StateUndo ;
+ ]
+
+ SID_GETREDOSTRINGS
+ [
+ StateMethod = StateUndo ;
+ ]
+
+ FN_FORMAT_RESET // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_FOOTNOTE_DLG // status()
+ [
+ ExecMethod = Exec ;
+ ]
+
+ SID_OPEN_XML_FILTERSETTINGS // ole : no, status : ?
+ [
+ ExecMethod = Exec ;
+ ]
+
+ FN_WORDCOUNT_DIALOG
+ [
+ ExecMethod = Exec;
+ ]
+
+ FN_NUMBERING_OUTLINE_DLG // status(final|play)
+ [
+ ExecMethod = Exec ;
+ ]
+
+ SID_CHARMAP // api:
+ [
+ ExecMethod = Exec ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_INSERT_STRING
+ [
+ ExecMethod = Exec ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_FONT // status()
+ [
+ ExecMethod = Exec;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_FONTHEIGHT // status()
+ [
+ ExecMethod = Exec;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_COLOR // api:
+ [
+ ExecMethod = Exec;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_WEIGHT // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_POSTURE // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_UNDERLINE // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_OVERLINE // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_CONTOUR
+ [
+ ExecMethod = Exec;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_SHADOWED
+ [
+ ExecMethod = Exec;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_STRIKEOUT
+ [
+ ExecMethod = Exec;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_LANGUAGE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_ADJUST_LEFT // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_ADJUST_CENTER // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_ADJUST_RIGHT // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_ADJUST_BLOCK // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_LINESPACE_10 // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_LINESPACE_15 // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_LINESPACE_20 // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CHAR_DLG // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_PARA_DLG // api:
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_SET_SUPER_SCRIPT
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_SET_SUB_SCRIPT
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_SEARCH_ITEM // status()
+ [
+ ExecMethod = ExecSearch ;
+ StateMethod = StateSearch ;
+ Export = FALSE;
+ ]
+ FN_REPEAT_SEARCH // status(final|play)
+ [
+ ExecMethod = ExecSearch ;
+ ]
+ FID_SEARCH_NOW // status()
+ [
+ ExecMethod = ExecSearch ;
+ ]
+ SID_SEARCH_OPTIONS // status()
+ [
+ StateMethod = StateSearch ;
+ ]
+ FID_SEARCH_SEARCHSET // status()
+ [
+ ExecMethod = ExecSearch ;
+ ]
+ FID_SEARCH_REPLACESET // status()
+ [
+ ExecMethod = ExecSearch ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ // ab hier Export = FALSE;
+ FID_SEARCH_ON // status()
+ [
+ ExecMethod = ExecSearch ;
+ Export = FALSE;
+ ]
+ FID_SEARCH_OFF // status()
+ [
+ ExecMethod = ExecSearch ;
+ Export = FALSE;
+ ]
+}
diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi
new file mode 100644
index 000000000000..52e59e9e5fed
--- /dev/null
+++ b/sw/sdi/_basesh.sdi
@@ -0,0 +1,525 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface BaseTextSelection
+[
+ Automation = FALSE;
+]
+{
+ SID_ATTR_BRUSH
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_DELETE // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = GetState ;
+ FastCall = FALSE ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_BACKSPACE // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = GetState ;
+ FastCall = FALSE ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_SHIFT_BACKSPACE // status()
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_UNDO // status(final|play)
+ [
+ ExecMethod = ExecUndo ;
+ StateMethod = StateUndo ;
+ ]
+
+ SID_GETUNDOSTRINGS // status(final|play)
+ [
+ StateMethod = StateUndo ;
+ ]
+
+ SID_REDO // status(final|play)
+ [
+ ExecMethod = ExecUndo ;
+ StateMethod = StateUndo ;
+ ]
+
+ SID_GETREDOSTRINGS // status(final|play)
+ [
+ StateMethod = StateUndo ;
+ ]
+
+ SID_REPEAT // status()
+ [
+ ExecMethod = ExecUndo ;
+ StateMethod = StateUndo ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CUT // status(final|play)
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_COPY // status(final|play)
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ ]
+
+ SID_PASTE // status(final|play)
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CLIPBOARD_FORMAT_ITEMS // status(final|play)
+ [
+ StateMethod = StateClpbrd ;
+ ExecMethod = ExecClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_PASTE_UNFORMATTED // status(final|play)
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_PASTE_SPECIAL // status(final|play)
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_REPAGINATE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_CHANGE_DBFIELD
+ [
+ ExecMethod = ExecField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_UPDATE_FIELDS // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_UPDATE_CHARTS // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_UPDATE_ALL // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_UPDATE_INPUTFIELDS // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_FRAME_TO_ANCHOR // status()
+ [
+ /*OS: Datentypen unvertraeglich ?? */
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_GOTO_NEXT_OBJ // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_GOTO_PREV_OBJ // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_GOTO_NEXT_MARK // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_GOTO_PREV_MARK // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_PREV_BOOKMARK // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_NEXT_BOOKMARK // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ SID_GALLERY_FORMATS // status()
+ [
+ Export = FALSE ;
+ ExecMethod = Execute ;
+ ]
+
+ SID_GALLERY_ENABLE_ADDCOPY
+ [
+ Export = FALSE;
+ StateMethod = GetState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BACKGROUND_COLOR // status()
+ [
+ ExecMethod = ExecBckCol ;
+ StateMethod = GetBckColState ;
+ Cachable , AutoUpdate ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_EDIT_REGION // status(final|play)
+ [
+ ExecMethod = EditRegionDialog ;
+ StateMethod = GetState ;
+ ]
+
+ FN_INSERT_REGION // status()
+ [
+ ExecMethod = InsertRegionDialog;
+ StateMethod = GetState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_PAGE_DLG // status(final|play)
+ [
+ ExecMethod = ExecDlg ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_PAGE_COLUMN_DLG // status(final|play)
+ [
+ ExecMethod = ExecDlg ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_CONVERT_TABLE_TO_TEXT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_CONVERT_TEXT_TO_TABLE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_CONVERT_TEXT_TABLE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_FORMAT_BORDER_DLG // status(final|play)
+ [
+ ExecMethod = ExecDlg ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_BORDER_INNER // status()
+ [
+ StateMethod = GetBorderState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_BORDER_OUTER // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetBorderState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BORDER_REDUCED_MODE
+ [
+ StateMethod = GetBorderState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_BACKGROUND_DLG // status(final|play)
+ [
+ ExecMethod = ExecDlg ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SfxBoolItem StyleWatercanMode SID_STYLE_WATERCAN // status()
+ [
+ SfxUInt16Item WatercanStyleModeOnOff
+ (
+ SfxStringItem Param SID_STYLE_WATERCAN ,
+ SfxUInt16Item Family SID_STYLE_FAMILY
+ ) ;
+ ExecMethod = Execute ;
+ StateMethod = StateStyle ;
+ NoRecord;
+ GroupId = GID_TEMPLATE ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_STYLE_UPDATE_BY_EXAMPLE // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = StateStyle ;
+ ]
+
+ SID_STYLE_NEW_BY_EXAMPLE // status(fina|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = StateStyle ;
+ FastCall = TRUE; // fuer Macroausfuehrung!
+ ]
+ SID_STYLE_APPLY // status(fina|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = StateStyle ;
+ FastCall = TRUE;// fuer Macroausfuehrung!
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_STYLE_FAMILY1 // status(fina|play)
+ [
+ StateMethod = StateStyle ;
+ ]
+
+ SID_STYLE_FAMILY2 // status(fina|play)
+ [
+ StateMethod = StateStyle ;
+ ]
+
+ SID_STYLE_FAMILY3 // status(fina|play)
+ [
+ StateMethod = StateStyle ;
+ ]
+
+ SID_STYLE_FAMILY4 // status(fina|play)
+ [
+ StateMethod = StateStyle ;
+ ]
+
+ SID_STYLE_FAMILY5 // status(fina|play)
+ [
+ StateMethod = StateStyle ;
+ ]
+
+ //OS: Selection.Escape gibt es zusaetzlich zu Window.Escape
+
+ FN_ESCAPE // status(final|play|rec)
+ [
+ ExecMethod = Execute ;
+ ]
+
+ SID_IMAP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Toggle = FALSE;
+ ]
+
+ SID_IMAP_EXEC
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+// Methode fuer Rahmen und Objekte
+ FN_TOOL_ANKER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TOOL_ANKER_PARAGRAPH
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TOOL_ANKER_CHAR
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TOOL_ANKER_AT_CHAR
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TOOL_ANKER_FRAME
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_UPDATE_ALL_LINKS // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+/*-----------------22.01.97 09.41-------------------
+// ab hier immer Export = FALSE
+--------------------------------------------------*/
+
+ FN_FRAME_WRAP // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE;
+ ]
+
+ FN_FRAME_WRAP_IDEAL // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE;
+ ]
+
+ FN_FRAME_NOWRAP // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE;
+ ]
+
+ FN_FRAME_WRAPTHRU // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE;
+ ]
+
+ FN_FRAME_WRAPTHRU_TRANSP // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE;
+ ]
+
+ FN_FRAME_WRAP_CONTOUR // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE;
+ ]
+
+ FN_WRAP_ANCHOR_ONLY // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE;
+ ]
+
+ FN_FRAME_WRAP_LEFT // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE;
+ ]
+
+ FN_FRAME_WRAP_RIGHT // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE;
+ ]
+
+
+
+ SID_GALLERY_BG_BRUSH
+ [
+ ExecMethod = ExecuteGallery;
+ StateMethod = GetGalleryState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE;
+ ]
+ SID_ATTR_BORDER_SHADOW // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_XFORMS_DESIGN_MODE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+}
+
diff --git a/sw/sdi/_beziers.sdi b/sw/sdi/_beziers.sdi
new file mode 100644
index 000000000000..37c95d20699c
--- /dev/null
+++ b/sw/sdi/_beziers.sdi
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface _Bezier : Base
+[ Automation = FALSE; ]
+{
+ SID_DELETE
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_BACKSPACE
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_ESCAPE // api:
+ [
+ ExecMethod = Execute;
+ ]
+
+ SID_BEZIER_MOVE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_INSERT
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_DELETE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_CUTLINE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_CONVERT
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_EDGE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_SMOOTH
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_SYMMTR
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_CLOSE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_ELIMINATE_POINTS
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi
new file mode 100644
index 000000000000..ad37160a3c1f
--- /dev/null
+++ b/sw/sdi/_docsh.sdi
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface BaseTextDocument
+[
+ Automation = FALSE;
+]
+{
+ SID_PRINTPREVIEW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_AUTO_CORRECT_DLG
+ [
+ ExecMethod = Execute ;
+ ]
+
+ SID_STYLE_NEW
+ [
+ ExecMethod = ExecStyleSheet ;
+ StateMethod = NoState ;
+ ]
+
+ SID_STYLE_EDIT
+ [
+ ExecMethod = ExecStyleSheet ;
+ StateMethod = NoState ;
+ ]
+
+ SID_STYLE_DELETE
+ [
+ ExecMethod = ExecStyleSheet ;
+ StateMethod = NoState ;
+ ]
+
+ SID_TEMPLATE_LOAD
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ SID_GET_COLORTABLE
+ [
+ ExecMethod = Execute ;
+ ]
+
+ SID_SPELLCHECKER_CHANGED
+ [
+ ExecMethod = Execute ;
+ ]
+
+ SID_MAIL_EXPORT_FINISHED
+ [
+ ExecMethod = Execute;
+ ]
+ //No Export
+ SID_STYLE_FAMILY1
+ [
+ Export = FALSE ;
+ StateMethod = StateStyleSheet ;
+ ]
+
+ SID_STYLE_FAMILY2
+ [
+ Export = FALSE ;
+ StateMethod = StateStyleSheet ;
+ ]
+
+ SID_STYLE_FAMILY3
+ [
+ Export = FALSE ;
+ StateMethod = StateStyleSheet ;
+ ]
+
+ SID_STYLE_FAMILY4
+ [
+ Export = FALSE ;
+ StateMethod = StateStyleSheet ;
+ ]
+ SID_STYLE_FAMILY5
+ [
+ Export = FALSE ;
+ StateMethod = StateStyleSheet ;
+ ]
+
+
+ SID_ATTR_YEAR2000
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ ]
+
+ SID_ATTR_CHAR_FONTLIST
+ [
+ StateMethod = GetState ;
+ ]
+
+ SID_MAIL_PREPAREEXPORT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ ]
+}
+
+
diff --git a/sw/sdi/_drwbase.sdi b/sw/sdi/_drwbase.sdi
new file mode 100644
index 000000000000..d43a2d64512a
--- /dev/null
+++ b/sw/sdi/_drwbase.sdi
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface BaseTextDrawBase
+[
+ Automation = FALSE;
+]
+{
+ FN_DRAW_WRAP_DLG
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_TRANSFORM
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_GROUP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_UNGROUP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ENTER_GROUP
+ [
+ AutoUpdate = TRUE ,
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_LEAVE_GROUP
+ [
+ AutoUpdate = TRUE ,
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_FRAME_TO_TOP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FRAME_TO_BOTTOM
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_UP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_DOWN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_DELETE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ FastCall = FALSE ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_BACKSPACE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ FastCall = FALSE ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_STYLE_CATALOG // ole(no) api(play/rec)
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ // #i68101#
+ FN_TITLE_DESCRIPTION_SHAPE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NAME_SHAPE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
+
diff --git a/sw/sdi/_formsh.sdi b/sw/sdi/_formsh.sdi
new file mode 100644
index 000000000000..76497efed516
--- /dev/null
+++ b/sw/sdi/_formsh.sdi
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+interface BaseTextDrawForm
+[
+ Automation = FALSE;
+]
+{
+ SID_HYPERLINK_SETLINK
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_HYPERLINK_GETLINK
+ [
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
+
diff --git a/sw/sdi/_frmsh.sdi b/sw/sdi/_frmsh.sdi
new file mode 100644
index 000000000000..a83270a6d196
--- /dev/null
+++ b/sw/sdi/_frmsh.sdi
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface BaseTextFrame
+[
+ Automation = FALSE;
+]
+{
+ FN_FRAME_TO_ANCHOR // status()
+ [
+ /*OS: Datentypen unvertraeglich ?? */
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_FRAME_ALIGN_VERT_CENTER // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_VERT_BOTTOM // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_VERT_TOP // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_VERT_ROW_CENTER // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_VERT_ROW_BOTTOM // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_VERT_ROW_TOP // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_VERT_CHAR_CENTER // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_VERT_CHAR_BOTTOM // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_VERT_CHAR_TOP // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_HORZ_CENTER // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_HORZ_RIGHT // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_ALIGN_HORZ_LEFT // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ SID_FRAME_TO_TOP // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FRAME_TO_BOTTOM // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ FN_FRAME_UP // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_DOWN // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_ULSPACE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_LRSPACE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = GID_FRAME;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_FRAME_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FRAME_LINESTYLE // status()
+ [
+ ExecMethod = ExecFrameStyle ;
+ StateMethod = GetLineStyleState ;
+ Export = FALSE; //#44439#
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FRAME_LINECOLOR // status(final|play)
+ [
+ ExecMethod = ExecFrameStyle ;
+ StateMethod = GetLineStyleState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_OBJECT_ALIGN_CENTER // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_OBJECT_ALIGN_RIGHT // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_OBJECT_ALIGN_LEFT // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_OBJECT_ALIGN_UP // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_OBJECT_ALIGN_MIDDLE // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_OBJECT_ALIGN_DOWN // status(play|final)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_FOOTNOTE_DLG // status()
+ [
+ ExecMethod = Execute;
+ ]
+
+ SID_OPEN_XML_FILTERSETTINGS // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ ]
+
+ FN_WORDCOUNT_DIALOG
+ [
+ ExecMethod = Execute;
+ ]
+
+ FN_NUMBERING_OUTLINE_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ ]
+ // --> OD 2009-07-08 #i73249#
+ FN_TITLE_DESCRIPTION_SHAPE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ // <--
+
+
+ /*****************************************************
+
+ Abfragefunktionen fuer ImageMaps
+
+ ****************************************************/
+
+//
+// Slots ohne Export
+
+ FN_INSERT_FRAME
+ [
+ ExecMethod = Execute ;
+ StateMethod = StateInsert ;
+ Export = False;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_BORDER // status()
+ [
+ ExecMethod = ExecFrameStyle ;
+ StateMethod = GetLineStyleState ;
+ GroupId = GID_FRAME;
+ Export = False;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_HYPERLINK_SETLINK // status()
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_HYPERLINK_GETLINK // status()
+ [
+ StateMethod = GetState ;
+ ]
+
+ FN_FRAME_MIRROR_ON_EVEN_PAGES // status(final|play|rec)
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
+
diff --git a/sw/sdi/_grfsh.sdi b/sw/sdi/_grfsh.sdi
new file mode 100644
index 000000000000..3d7fd41af98d
--- /dev/null
+++ b/sw/sdi/_grfsh.sdi
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface BaseTextGraphic
+[
+ Automation = FALSE;
+]
+{
+ FN_FLIP_VERT_GRAFIC // status(final|play)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FLIP_HORZ_GRAFIC // status(final|play)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_GRAFIC_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ FN_SAVE_GRAPHIC // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetAttrState ;
+ ]
+
+ SID_INSERT_GRAPHIC // zeigt auf FN_FORMAT_GRAFIC_DLG
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TWAIN_TRANSFER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_GRAPHIC_MIRROR_ON_EVEN_PAGES // status(final|play|rec)
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_GRAF_LUMINANCE // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_GRAF_CONTRAST // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_GRAF_RED // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_GRAF_GREEN // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_GRAF_BLUE // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_GRAF_GAMMA // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_GRAF_TRANSPARENCE // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_GRAF_INVERT // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_GRAF_MODE // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_GRFFILTER_INVERT // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER_SMOOTH // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER_SHARPEN // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER_REMOVENOISE // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER_SOBEL // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER_MOSAIC // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER_EMBOSS // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER_POSTER // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER_POPART // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER_SEPIA // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GRFFILTER_SOLARIZE // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_COLOR_SETTINGS // status(final|play|rec)
+ [
+ ExecMethod = ExecAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+}
+
diff --git a/sw/sdi/_listsh.sdi b/sw/sdi/_listsh.sdi
new file mode 100644
index 000000000000..eff1c5ee1c2d
--- /dev/null
+++ b/sw/sdi/_listsh.sdi
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface BaseTextList
+[
+ Automation = FALSE
+]
+{
+ FN_NUM_BULLET_DOWN // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUM_BULLET_NEXT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUM_BULLET_NONUM // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUM_BULLET_OFF // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ FN_NUM_BULLET_OUTLINE_DOWN // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUM_BULLET_OUTLINE_MOVEDOWN // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUM_BULLET_OUTLINE_MOVEUP // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUM_BULLET_OUTLINE_UP // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUM_BULLET_PREV // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUM_BULLET_UP // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUM_OR_NONUM // status(play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
diff --git a/sw/sdi/_mediash.sdi b/sw/sdi/_mediash.sdi
new file mode 100644
index 000000000000..a2e2f5535dc8
--- /dev/null
+++ b/sw/sdi/_mediash.sdi
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface BaseTextMedia
+[
+ Automation = FALSE;
+]
+{
+ SID_DELETE
+ [
+ ExecMethod = ExecMedia;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_BACKSPACE
+ [
+ ExecMethod = ExecMedia;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_AVMEDIA_TOOLBOX // status(final|play|rec)
+ [
+ ExecMethod = ExecMedia;
+ StateMethod = GetMediaState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
diff --git a/sw/sdi/_olesh.sdi b/sw/sdi/_olesh.sdi
new file mode 100644
index 000000000000..947ec5b86941
--- /dev/null
+++ b/sw/sdi/_olesh.sdi
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface BaseTextOLEObject
+[
+ Automation = FALSE;
+]
+{
+}
+
+
diff --git a/sw/sdi/_tabsh.sdi b/sw/sdi/_tabsh.sdi
new file mode 100644
index 000000000000..06eccd3d555e
--- /dev/null
+++ b/sw/sdi/_tabsh.sdi
@@ -0,0 +1,409 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface BaseTextTable
+[
+ Automation = FALSE;
+]
+{
+
+ FN_FORMAT_TABLE_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+ SID_ATTR_BRUSH
+ [
+ ExecMethod = Execute ;
+ ]
+ SID_ATTR_BRUSH_ROW
+ [
+ ExecMethod = Execute ;
+ ]
+ SID_ATTR_BRUSH_TABLE
+ [
+ ExecMethod = Execute ;
+ ]
+ FN_NUM_FORMAT_TABLE_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_CALC_TABLE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_TABLE_AUTOSUM // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+
+ FN_TABLE_VERT_NONE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_VERT_CENTER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_VERT_BOTTOM
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_TABLE_SET_COL_WIDTH // status( final|play )
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_ULSPACE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_LRSPACE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = GID_TABLE;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_DELETE_COL // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_DELETE_ROW // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_TABLE_DELETE_TABLE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_GOTO_NEXT_CELL // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_GOTO_PREV_CELL // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+ FN_END_TABLE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_START_TABLE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_TABLE_INSERT_COL // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_INSERT_COL_DLG // status(final|play)
+ [
+ Export = FALSE ;
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_INSERT_ROW // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_INSERT_ROW_DLG // status(final|play)
+ [
+ Export = FALSE ;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_MERGE_CELLS // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_OPTIMIZE_TABLE
+ [
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ StateMethod = GetState ;
+ ]
+
+ FN_TABLE_ADJUST_CELLS // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_BALANCE_CELLS // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_BALANCE_ROWS // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_SELECT_ALL // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_TABLE_SELECT_COL // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+
+ FN_TABLE_SELECT_ROW // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+ FN_TABLE_SELECT_CELL
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_TABLE_SET_ROW_HEIGHT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_TABLE_ROW_SPLIT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_TABLE_OPTIMAL_HEIGHT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_SPLIT_CELLS // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_SPLIT_TABLE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_MERGE_TABLE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_UNSET_READ_ONLY_CELLS // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_AUTOFORMAT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_BORDER // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetFrmBorderState ;
+ GroupId = GID_TABLE;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FRAME_LINESTYLE // status()
+ [
+ ExecMethod = ExecTableStyle ;
+ StateMethod = GetLineStyleState ;
+ Export = FALSE; //#44439#
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FRAME_LINECOLOR // status(play)
+ [
+ ExecMethod = ExecTableStyle ;
+ StateMethod = GetLineStyleState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TABLE_MODE_FIX
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+
+ FN_TABLE_MODE_FIX_PROP
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+
+ FN_TABLE_MODE_VARIABLE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+
+ FN_NUMBER_FORMAT
+ [
+ ExecMethod = ExecNumberFormat;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUMBER_STANDARD
+ [
+ ExecMethod = ExecNumberFormat;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUMBER_TWODEC
+ [
+ ExecMethod = ExecNumberFormat;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUMBER_SCIENTIFIC
+ [
+ ExecMethod = ExecNumberFormat;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUMBER_DATE
+ [
+ ExecMethod = ExecNumberFormat;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUMBER_TIME
+ [
+ ExecMethod = ExecNumberFormat;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUMBER_CURRENCY
+ [
+ ExecMethod = ExecNumberFormat;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUMBER_PERCENT
+ [
+ ExecMethod = ExecNumberFormat;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+// Slots ohne Export
+
+ FN_INSERT_TABLE
+ [
+ Export = FALSE ;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_TABLE_HEADLINE_REPEAT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_TABLE_SELECT_CELL
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_TABLE_DELETE_TABLE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
new file mode 100644
index 000000000000..6ea824eab6cf
--- /dev/null
+++ b/sw/sdi/_textsh.sdi
@@ -0,0 +1,1610 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+interface BaseText
+[
+ Automation = FALSE;
+]
+{
+ FN_NEW_GLOSSARY // status(final|play)
+ [
+ ExecMethod = ExecGlossary ;
+ ]
+ FN_SET_ACT_GLOSSARY // status(final|play)
+ [
+ ExecMethod = ExecGlossary ;
+ ]
+ FN_INSERT_GLOSSARY // status(final|play|record)
+ [
+ ExecMethod = ExecGlossary ;
+ ]
+
+ FN_TXTATR_INET // status()
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_SCALEWIDTH // status()
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_ROTATED // status()
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_BRUSH_CHAR // status()
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_DROPCAPS
+ [
+ ExecMethod = ExecParaAttrArgs ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_PARA_VERTALIGN
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_REGISTER
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_LRSPACE
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_ULSPACE
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_NUMRULE
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ //#outline level,add by zhaojianwei
+ SID_ATTR_PARA_OUTLINE_LEVEL
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]//<-end,zhaojianwei
+
+ SID_ATTR_PARA_PAGENUM
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUMBER_NEWSTART
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUM_CONTINUE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUMBER_NEWSTART_AT
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_LINENUMBER
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_INSERTDOC // status(final|play|rec)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_BOOKMARK // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DELETE_BOOKMARK // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUM_BULLET_MOVEDOWN // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUM_BULLET_MOVEUP // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_EDIT_FORMULA // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_CHARMAP // status(final|play|rec)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_PAGEHEADER // status(final|play|rec)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Export = FALSE;
+ ]
+ FN_INSERT_PAGEFOOTER // status(final|play|rec)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Export = FALSE;
+ ]
+
+ //--------------------------------------------------------------------------
+ FN_INSERT_STRING // status(final|play|rec)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_SOFT_HYPHEN // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_HARDHYPHEN // status()
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_HARD_SPACE // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_RLM
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_LRM
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_ZWSP
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_ZWNBSP
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_BREAK // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_PAGEBREAK // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_LINEBREAK // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_COLUMN_BREAK // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_BREAK_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_AVMEDIA // status(final|play)
+ [
+ ExecMethod = ExecInsert;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_HRULER // status()
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ ]
+ SID_INSERT_DIAGRAM // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_SOUND
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_VIDEO
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_SMA // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_FLOATINGFRAME // status()
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_OBJECT // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_PLUGIN // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_TABLE // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_HYPERLINK_SETLINK // status()
+ [
+ ExecMethod = ExecInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_HYPERLINK_GETLINK // status()
+ [
+ StateMethod = StateInsert ;
+ ]
+ FN_INSERT_HYPERLINK // status()
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_HYPERLINK_DIALOG
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ ]
+ SID_RUBY_DIALOG
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ ]
+ FN_EDIT_HYPERLINK
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_REMOVE_HYPERLINK
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_COPY_HYPERLINK_LOCATION
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_TABLE_UNSET_READ_ONLY // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DELETE_SENT // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DELETE_BACK_SENT // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DELETE_WORD // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DELETE_BACK_WORD // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DELETE_LINE // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DELETE_BACK_LINE // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DELETE_PARA // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DELETE_BACK_PARA // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DELETE_WHOLE_LINE // status(final|play)
+ [
+ ExecMethod = ExecDelete ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_CHAR_LEFT // status(final|play)
+ [
+ ExecMethod = ExecBasicMove ;
+ StateMethod = NoState ;
+ ]
+ FN_CHAR_RIGHT // status(final|play)
+ [
+ ExecMethod = ExecBasicMove ;
+ StateMethod = NoState ;
+ ]
+ FN_LINE_UP // status(final|play)
+ [
+ ExecMethod = ExecBasicMove ;
+ StateMethod = NoState ;
+ ]
+ FN_LINE_DOWN // status(final|play)
+ [
+ ExecMethod = ExecBasicMove ;
+ StateMethod = NoState ;
+ ]
+ FN_SELECT_WORD // status(final|play)
+ [
+ ExecMethod = ExecMove ;
+ StateMethod = NoState ;
+ ]
+ SID_SELECTALL // status(final|play)
+ [
+ ExecMethod = ExecMove ;
+ StateMethod = NoState ;
+ ]
+ //
+ // Goto - Methoden
+ //
+ SID_FM_TOGGLECONTROLFOCUS
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_CNTNT_TO_NEXT_FRAME // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_START_OF_COLUMN // status(final|play)
+ [
+ ExecMethod = ExecMoveCol ;
+ StateMethod = NoState ;
+ ]
+ FN_END_OF_COLUMN // status(final|play)
+ [
+ ExecMethod = ExecMoveCol ;
+ StateMethod = NoState ;
+ ]
+ FN_START_OF_NEXT_COLUMN // status(final|play)
+ [
+ ExecMethod = ExecMoveCol ;
+ StateMethod = NoState ;
+ ]
+ FN_END_OF_NEXT_COLUMN // status(final|play)
+ [
+ ExecMethod = ExecMoveCol ;
+ StateMethod = NoState ;
+ ]
+ FN_START_OF_PREV_COLUMN // status(final|play)
+ [
+ ExecMethod = ExecMoveCol ;
+ StateMethod = NoState ;
+ ]
+ FN_END_OF_PREV_COLUMN // status(final|play)
+ [
+ ExecMethod = ExecMoveCol ;
+ StateMethod = NoState ;
+ ]
+ FN_TO_HEADER // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_TO_FOOTER // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_TO_FOOTNOTE_AREA
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_PREV_TABLE // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_NEXT_TABLE // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_GOTO_PREV_REGION
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_GOTO_NEXT_REGION
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_NEXT_WORD // status(final|play)
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ ]
+ FN_START_OF_PARA // status(final|play)
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ ]
+ FN_END_OF_PARA // status(final|play)
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ ]
+ FN_PREV_PARA // status(final)
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ ]
+ FN_NEXT_PARA // status(final)
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ ]
+ FN_PREV_WORD // status(final|play)
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ ]
+ FN_NEXT_SENT // status(final|play)
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ ]
+ FN_PREV_SENT // status(final|play)
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ ]
+ FN_START_OF_NEXT_PAGE // status(final|play)
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ ]
+ FN_END_OF_NEXT_PAGE // status(final|play)
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ ]
+ FN_START_OF_PREV_PAGE // status(final|play)
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ ]
+ FN_END_OF_PREV_PAGE // status(final|play)
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ ]
+ FN_START_OF_PAGE // status(final|play)
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ ]
+ FN_END_OF_PAGE // status(final|play)
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ ]
+ FN_START_OF_LINE // status(final|play)
+ [
+ ExecMethod = ExecMove ;
+ StateMethod = NoState ;
+ ]
+ FN_END_OF_LINE // status(final|play)
+ [
+ ExecMethod = ExecMove ;
+ StateMethod = NoState ;
+ ]
+ FN_START_OF_DOCUMENT // status(final|play)
+ [
+ ExecMethod = ExecMove ;
+ StateMethod = NoState ;
+ ]
+ FN_END_OF_DOCUMENT // status(final|play)
+ [
+ ExecMethod = ExecMove ;
+ StateMethod = NoState ;
+ ]
+ FN_NEXT_TOXMARK // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc;
+ StateMethod = NoState ;
+ ]
+
+ FN_PREV_TOXMARK // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc;
+ StateMethod = NoState ;
+ ]
+
+ FN_NEXT_TBLFML // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc;
+ StateMethod = NoState ;
+ ]
+
+ FN_PREV_TBLFML // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc;
+ StateMethod = NoState ;
+ ]
+
+ FN_NEXT_TBLFML_ERR // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc;
+ StateMethod = NoState ;
+ ]
+
+ FN_PREV_TBLFML_ERR // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc;
+ StateMethod = NoState ;
+ ]
+
+ //
+ // Get - Properties
+ //
+ FN_AUTOFORMAT_AUTO // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_AUTOFORMAT_APPLY // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_AUTOFORMAT_REDLINE_APPLY // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_AUTO_CORRECT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_SORTING_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_TABLE_SORT_DIALOG
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_NUMBERING_OUTLINE_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+ FN_CALCULATE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_FORMAT_RESET // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_GOTO_REFERENCE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ //Parameter kann noch nicht aufgezeichnet werden
+ FN_NUM_NUMBERING_ON // status(final|play)
+ [
+ ExecMethod = ExecEnterNum ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUMBER_BULLETS // status(final|play)
+ [
+ ExecMethod = ExecEnterNum ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_NUM_BULLET_ON // status(final|play)
+ [
+ ExecMethod = ExecEnterNum ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_FRAME // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_COLUMN // status()
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_INSERT_FOOTNOTE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ /*-----------------24.01.97 07.33-------------------
+ Fussnoten - Befehle
+--------------------------------------------------*/
+
+ FN_INSERT_ENDNOTE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_FORMAT_FOOTNOTE_DLG // status()
+ [
+ ExecMethod = Execute ;
+ ]
+ FN_FOOTNOTE_TO_ANCHOR // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_NEXT_FOOTNOTE // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+ FN_PREV_FOOTNOTE // status(final|play)
+ [
+ ExecMethod = ExecMoveMisc ;
+ StateMethod = NoState ;
+ ]
+
+ FN_INSERT_FOOTNOTE_DLG // status(final|play|rec)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ /*-----------------24.01.97 07.34-------------------
+ Ende Fussnoten
+ --------------------------------------------------*/
+ FN_INSERT_FIELD // status(final|play)
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ AutoUpdate ;
+ ]
+ FN_INSERT_DBFIELD
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_REF_FIELD
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ AutoUpdate ;
+ ]
+ FN_INSERT_FIELD_CTRL
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE ;
+ ]
+ //--------------------------------------------------------------------------
+ FN_INSERT_FLD_PGNUMBER
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ReadOnlyDoc = FALSE ;
+ ]
+ FN_INSERT_FLD_PGCOUNT
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ReadOnlyDoc = FALSE ;
+ ]
+
+ FN_INSERT_FLD_TITLE
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ReadOnlyDoc = FALSE ;
+ ]
+ FN_INSERT_FLD_DATE
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ //--------------------------------------------------------------------------
+ FN_INSERT_FLD_TIME
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ //--------------------------------------------------------------------------
+ FN_INSERT_FLD_AUTHOR
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_GOTO_NEXT_INPUTFLD // status(final|play)
+ [
+ ExecMethod = ExecField ;
+ StateMethod = NoState ;
+ ]
+ FN_GOTO_PREV_INPUTFLD // status(final|play)
+ [
+ ExecMethod = ExecField ;
+ StateMethod = NoState ;
+ ]
+ FN_EXECUTE_MACROFIELD // status()
+ [
+ Export = FALSE ;
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ ]
+ FN_EDIT_FIELD // status(final|play)
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_GLOSSARY_DLG // status()
+ [
+ ExecMethod = ExecGlossary ;
+ StateMethod = GetState ;
+ ]
+ FN_EXPAND_GLOSSARY // status(final|play)
+ [
+ ExecMethod = ExecGlossary ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_POSTIT // status(final|play)
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField;
+ ]
+ FN_DELETE_COMMENT
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField;
+ ]
+ FN_DELETE_NOTE_AUTHOR
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField;
+ ]
+ FN_DELETE_ALL_NOTES
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField;
+ ]
+ FN_HIDE_NOTE
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField;
+ ]
+ FN_HIDE_NOTE_AUTHOR
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField;
+ ]
+ FN_HIDE_ALL_NOTES
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField;
+ ]
+ FN_REDLINE_COMMENT // status(play)
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR|SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+ FN_JAVAEDIT // status(final|play)
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField;
+ ]
+ // Slots mit Export = FALSE
+ //Slots ohne Export
+ FN_CHAR_LEFT_SEL
+ [
+ ExecMethod = ExecBasicMove ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_CHAR_RIGHT_SEL
+ [
+ ExecMethod = ExecBasicMove ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_LINE_UP_SEL
+ [
+ ExecMethod = ExecBasicMove ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_LINE_DOWN_SEL
+ [
+ ExecMethod = ExecBasicMove;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_START_OF_NEXT_PAGE_SEL
+ [
+ ExecMethod = ExecMovePage;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_END_OF_NEXT_PAGE_SEL
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_START_OF_PREV_PAGE_SEL
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_END_OF_PREV_PAGE_SEL
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_START_OF_PAGE_SEL
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_END_OF_PAGE_SEL
+ [
+ ExecMethod = ExecMovePage ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_NEXT_WORD_SEL
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_START_OF_PARA_SEL
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_END_OF_PARA_SEL
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_PREV_WORD_SEL
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_NEXT_SENT_SEL
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_START_OF_LINE_SEL
+ [
+ ExecMethod = ExecMove ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_END_OF_LINE_SEL
+ [
+ ExecMethod = ExecMove ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_START_OF_DOCUMENT_SEL
+ [
+ ExecMethod = ExecMove ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_END_OF_DOCUMENT_SEL
+ [
+ ExecMethod = ExecMove ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_PREV_SENT_SEL
+ [
+ ExecMethod = ExecMoveLingu ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_QRY_INSERT
+ [
+ ExecMethod = ExecDB ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_QRY_MERGE_FIELD
+ [
+ ExecMethod = ExecDB ;
+ StateMethod = NoState ;
+ Export = FALSE ;
+ ]
+ FN_QRY_INSERT_FIELD
+ [
+ ExecMethod = ExecDB ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE ;
+ ]
+ SID_ATTR_PARA_ADJUST_LEFT
+ [
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE ;
+ ]
+ SID_ATTR_PARA_ADJUST_RIGHT
+ [
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE ;
+ ]
+ SID_ATTR_PARA_ADJUST_CENTER
+ [
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE ;
+ ]
+ SID_ATTR_PARA_ADJUST_BLOCK
+ [
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE ;
+ ]
+ SID_ATTR_PARA_LINESPACE_10
+ [
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE ;
+ ]
+ SID_ATTR_PARA_LINESPACE_15
+ [
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE ;
+ ]
+ SID_ATTR_PARA_LINESPACE_20
+ [
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Export = FALSE ;
+ ]
+ SID_ATTR_PARA_ADJUST // status(final|play)
+ [
+ // (0=links, 1=rechts, 2=block, 3=zentriert, )"
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_LINESPACE // status(final|play)
+ [
+ // SvxLineSpace LineSpace MID_LINESPACE;
+ // UINT16 LineHeight MID_HEIGHT; // % or direct
+ // SvxInterLineSpace InterLineSpace MID_INTER_LINESPACE;
+ // INT16 InterSpace MID_INTER_SPACE;
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_SPLIT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_KEEP // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_WIDOWS // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_ORPHANS // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_PAGEBREAK // status(final|play)
+ [
+ ExecMethod = ExecParaAttrArgs ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_MODEL // status(final|play)
+ [
+ ExecMethod = ExecParaAttrArgs ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_PARA_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_SELECT_PARA // status(final|play)
+ [
+ ExecMethod = Execute ;
+ ]
+ SID_DEC_INDENT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INC_INDENT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DEC_INDENT_OFFSET
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INC_INDENT_OFFSET
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_DROPCAPS // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DROP_TEXT
+ [
+ ExecMethod = Execute;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_DROP_CHAR_STYLE_NAME
+ [
+ ExecMethod = ExecParaAttrArgs;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_HYPHENZONE // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_RELIEF
+ [
+ ExecMethod = ExecTxtCtrl ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_FONT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl ;
+ StateMethod = GetTxtFontCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CJK_FONT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl ;
+ StateMethod = GetTxtFontCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CTL_FONT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl ;
+ StateMethod = GetTxtFontCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_FONTHEIGHT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl ;
+ StateMethod = GetTxtFontCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CJK_FONTHEIGHT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl ;
+ StateMethod = GetTxtFontCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CTL_FONTHEIGHT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl ;
+ StateMethod = GetTxtFontCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_COLOR_BACKGROUND // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_COLOR_BACKGROUND_EXT // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_COLOR_EXT // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_COLOR2
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_COLOR // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl ;
+ StateMethod = GetTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_WEIGHT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtFontCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CJK_WEIGHT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtFontCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CTL_WEIGHT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtFontCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_POSTURE // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtFontCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CJK_POSTURE // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtFontCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CTL_POSTURE // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtFontCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_UNDERLINE // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_OVERLINE // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_FLASH // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_STRIKEOUT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_UNDERLINE_DOUBLE // status(final|play)
+ [
+ ExecMethod = ExecCharAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CONTOUR // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_SHADOWED // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_AUTOKERN // // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_ESCAPEMENT // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_SET_SUPER_SCRIPT
+ [
+ ExecMethod = ExecCharAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_SET_SUB_SCRIPT
+ [
+ ExecMethod = ExecCharAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CASEMAP // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_LANGUAGE // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;;
+ StateMethod = GetTxtFontCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_KERNING // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_CHAR_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_CHAR_DLG_FOR_PARAGRAPH
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_WORDLINEMODE // status(final|play)
+ [
+ ExecMethod = ExecTxtCtrl;
+ StateMethod = GetTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_GROW_FONT_SIZE // status(final|play)
+ [
+ ExecMethod = ExecCharAttrArgs ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_SHRINK_FONT_SIZE // status(final|play)
+ [
+ ExecMethod = ExecCharAttrArgs ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_REMOVE_DIRECT_CHAR_FORMATS
+ [
+ ExecMethod = ExecCharAttr ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TRANSLITERATE_SENTENCE_CASE
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_TITLE_CASE
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_TOGGLE_CASE
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_UPPER
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_LOWER
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_HALFWIDTH
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_FULLWIDTH
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_HIRAGANA
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_KATAGANA
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_LEFT_TO_RIGHT
+ [
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_RIGHT_TO_LEFT
+ [
+ ExecMethod = ExecParaAttr ;
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_VERTICALTEXT_STATE
+ [
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_CTLFONT_STATE
+ [
+ StateMethod = GetAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_READONLY_SELECTION_MODE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_SELECTION_MODE_DEFAULT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_SELECTION_MODE_BLOCK
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_OPEN_HYPERLINK
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_OPEN_SMARTTAGMENU
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_OPEN_XML_FILTERSETTINGS // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_WORDCOUNT_DIALOG
+ [
+ ExecMethod = Execute;
+ ]
+
+ SID_LANGUAGE_STATUS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents
+ ]
+
+ SID_THES
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents
+ ]
+
+} //ende interface text
+
+
+
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
new file mode 100644
index 000000000000..a17fbb8f5742
--- /dev/null
+++ b/sw/sdi/_viewsh.sdi
@@ -0,0 +1,784 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+interface BaseTextEditView
+[
+ Automation = FALSE;
+]
+{
+ FN_REFRESH_VIEW // status(final|play)
+ [
+ ExecMethod = Execute ;
+ ]
+ FN_PAGEUP // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_PAGEUP_SEL // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_UNDO // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FORMATPAINTBRUSH //
+ [
+ ExecMethod = ExecFormatPaintbrush ;
+ StateMethod = StateFormatPaintbrush ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_CLEARHISTORY // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_CREATE_SW_DRAWVIEW
+ [
+ ExecMethod = Execute;
+ ]
+ FN_PAGEDOWN // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_PAGEDOWN_SEL // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_NAVIGATION_PI_GOTO_PAGE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+ FN_SCROLL_NAVIGATION
+ [
+ ExecMethod = NoExec ;
+ StateMethod = NoState ;
+ ]
+ FN_SCROLL_NEXT_PREV
+ [
+ ExecMethod = Execute;
+ ]
+ FN_SET_PAGE_STYLE // status(final|play)
+ [
+ ExecMethod = ExecColl ;
+ ]
+ SID_OBJECT_SELECT
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ ]
+ SID_BROWSER_MODE
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ ]
+ FN_PRINT_LAYOUT
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ ]
+ FN_REDLINE_PROTECT
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+ FN_REDLINE_ON // status()
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+ FN_REDLINE_SHOW // status()
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+ FN_REDLINE_ACCEPT // status(play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+ FN_REDLINE_ACCEPT_DIRECT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+ FN_REDLINE_REJECT_DIRECT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+
+ SID_DOCUMENT_COMPARE // status(play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+ SID_DOCUMENT_MERGE // status(play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+ FN_ESCAPE // status(final|play|rec)
+ [
+ ExecMethod = Execute ;
+ ]
+ FN_FAX // status(final|play)
+ [
+ ExecMethod = ExecutePrint ;
+ ]
+ SID_PRINTDOC // status(final|play)
+ [
+ ExecMethod = ExecutePrint ;
+ StateMethod = GetState ;
+ ]
+ SID_PRINTDOCDIRECT // status(final|play)
+ [
+ ExecMethod = ExecutePrint ;
+ StateMethod = GetState ;
+ ]
+ SID_ATTR_LRSPACE
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ GroupId = GID_EDIT ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_ULSPACE
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_LONG_LRSPACE // status()
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_LONG_ULSPACE // status()
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_LRSPACE // status()
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_LRSPACE_VERTICAL // status()
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_RULER_BORDERS // status()
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_RULER_BORDERS_VERTICAL // status()
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_RULER_BORDER_DISTANCE // status()
+ [
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_RULER_PAGE_POS // status()
+ [
+ ExecMethod = NoExec ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_RULER_TEXT_RIGHT_TO_LEFT
+ [
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_RULER_LR_MIN_MAX // status()
+ [
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_RULER_PROTECT // status()
+ [
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_RULER_ROWS // status()
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_RULER_ROWS_VERTICAL // status()
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_EDIT_LINK_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_SPELL_GRAMMAR_DIALOG
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_RECHECK_DOCUMENT
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_LINE_NUMBERING_DLG // status()
+ [
+ ExecMethod = Execute;
+ ]
+ FN_UPDATE_TOX // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ MenuConfig , AccelConfig , ToolBoxConfig ;
+
+ ]
+ FN_UPDATE_CUR_TOX // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_EDIT_CURRENT_TOX // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_TWAIN_SELECT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_TWAIN_TRANSFER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ //---------------------------------------------------------------------
+ //Ab hier Statusleiste
+ FN_STAT_PAGE // status()
+ [
+ ExecMethod = ExecuteStatusLine ;
+ StateMethod = StateStatusLine ;
+ ]
+ FN_STAT_BOOKMARK // status()
+ [
+ ExecMethod = ExecuteStatusLine ;
+ ]
+ FN_STAT_TEMPLATE // status(final|play)
+ [
+ ExecMethod = ExecuteStatusLine ;
+ StateMethod = StateStatusLine ;
+ ]
+ FN_STAT_SELMODE // status(final|play)
+ [
+ //Aktueller Selektionsmode: 0 == Normal, 2 == Ergaenzen, 1 == Erweitern
+ ExecMethod = ExecuteStatusLine ;
+ StateMethod = StateStatusLine ;
+ ]
+ FN_SET_ADD_MODE // status()
+ [
+ ExecMethod = ExecuteStatusLine ;
+ StateMethod = NoState ;
+ ]
+ FN_SET_EXT_MODE // status()
+ [
+ ExecMethod = ExecuteStatusLine ;
+ StateMethod = NoState ;
+ ]
+ SID_ATTR_ZOOM // status(final|play)
+ [
+ ExecMethod = ExecuteStatusLine ;
+ StateMethod = StateStatusLine ;
+ ]
+ SID_ATTR_VIEWLAYOUT // status()
+ [
+ ExecMethod = ExecuteStatusLine ;
+ StateMethod = StateStatusLine ;
+ ]
+ SID_ATTR_ZOOMSLIDER // status()
+ [
+ ExecMethod = ExecuteStatusLine ;
+ StateMethod = StateStatusLine ;
+ ]
+ SID_ATTR_INSERT // status(final|play|rec)
+ [
+ ExecMethod = ExecuteStatusLine ;
+ StateMethod = StateStatusLine ;
+ ]
+ SID_ATTR_SIZE // status()
+ [
+ ExecMethod = ExecuteStatusLine ;
+ StateMethod = StateStatusLine ;
+ ]
+ SID_ATTR_POSITION // status()
+ [
+ StateMethod = StateStatusLine ;
+ ]
+ SID_TABLE_CELL // status()
+ [
+ StateMethod = StateStatusLine ;
+ ]
+ //----------------------------------------------
+ //End mit Statusleiste
+ //----------------------------------------------
+ SID_ATTR_BORDER_SHADOW // status()
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ /****************************************************/
+ /* */
+ /* Properties Seitenformat */
+ /* */
+ /****************************************************/
+ SID_ATTR_PAGE // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ATTR_PAGE_SIZE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ATTR_PAGE_MAXSIZE // status()
+ [
+ Export = FALSE ;
+ ExecMethod = Execute ;
+ ]
+ SID_ATTR_PAGE_PAPERBIN // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_THESAURUS // status(final|play)
+ [
+ ExecMethod = ExecLingu ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_HANGUL_HANJA_CONVERSION // status(final|play)
+ [
+ ExecMethod = ExecLingu ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_CHINESE_CONVERSION
+ [
+ ExecMethod = ExecLingu ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ /*
+ suchen und ersetzen
+*/
+
+
+ SID_SEARCH_ITEM // status()
+ [
+ ExecMethod = ExecSearch ;
+ StateMethod = StateSearch ;
+ Export = FALSE;
+ ]
+ FN_REPEAT_SEARCH // status(final|play)
+ [
+ ExecMethod = ExecSearch ;
+ ]
+ FID_SEARCH_NOW // status()
+ [
+ ExecMethod = ExecSearch ;
+ ]
+ SID_SEARCH_OPTIONS // status()
+ [
+ StateMethod = StateSearch ;
+ ]
+ FID_SEARCH_SEARCHSET // status()
+ [
+ ExecMethod = ExecSearch ;
+ ]
+ FID_SEARCH_REPLACESET // status()
+ [
+ ExecMethod = ExecSearch ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_TABSTOP // status()
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_TABSTOP_VERTICAL // status()
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ // ab hier Export = FALSE;
+ FID_SEARCH_ON // status()
+ [
+ ExecMethod = ExecSearch ;
+ Export = FALSE;
+ ]
+ FID_SEARCH_OFF // status()
+ [
+ ExecMethod = ExecSearch ;
+ Export = FALSE;
+ ]
+ FN_INSERT_CTRL
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Export = FALSE;
+ ]
+
+ SID_ATTR_DEFTABSTOP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Export = FALSE;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_LANGUAGE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Export = FALSE;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CJK_LANGUAGE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Export = FALSE;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_CTL_LANGUAGE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Export = FALSE;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ SID_JUMPTOMARK
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ FastCall , Cachable ;
+ ]
+
+ FN_SYNC_LABELS // status(play)
+ [
+ ExecMethod = Execute ;
+ ]
+ FN_MAILMERGE_CHILDWINDOW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ ]
+
+ FN_MAILMERGE_SENDMAIL_CHILDWINDOW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ ]
+
+ SID_ATTR_BRUSH // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_GALLERY
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_AVMEDIA_PLAYER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_VIEW_DATA_SOURCE_BROWSER // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState;
+ ]
+ SID_READONLY_MODE // ole : no, status : no
+ [
+ StateMethod = GetState ;
+ ]
+ SID_IMAGE_ORIENTATION
+ [
+ StateMethod = GetState ;
+ ]
+ FN_INSERT_FIELD_DATA_ONLY // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_QRY_MERGE // status()
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+ SID_ALIGN_ANY_LEFT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ALIGN_ANY_HCENTER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ALIGN_ANY_RIGHT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ALIGN_ANY_JUSTIFIED
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ALIGN_ANY_TOP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ALIGN_ANY_VCENTER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ALIGN_ANY_BOTTOM
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_RESTORE_EDITING_VIEW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_INSERT_GRAPHIC // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_AUTOSPELL_CHECK
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ ]
+
+ //Extra/Optionen/Ansicht
+ //Wird zusammen zum Property ViewSettings
+ FN_VIEW_HIDDEN_PARA
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Export = FALSE;
+ ]
+
+ FN_VIEW_NOTES
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Export = FALSE;
+ ]
+ // alles ab hier kann weg (Export = FALSE;), wenn die vorangehenden funktionieren
+ FN_RULER // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Export = FALSE;
+ Cachable;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_VIEW_BOUNDS // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Export = FALSE;
+ Cachable;
+ ]
+
+ FN_VIEW_GRAPHIC // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Export = FALSE ;
+ ]
+ FN_VIEW_FIELDS // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Export = FALSE;
+ ]
+
+ FN_VIEW_FIELDNAME // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Cachable ;
+ Export = FALSE;
+ ]
+
+ FN_VIEW_MARKS // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Cachable ;
+ Export = FALSE;
+ ]
+
+ FN_VIEW_META_CHARS // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Cachable ;
+ Export = FALSE;
+ ]
+
+ FN_VIEW_TABLEGRID // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ ]
+
+ SID_GRID_VISIBLE
+ [
+ ExecMethod = ExecViewOptions;
+ StateMethod = StateViewOptions ;
+ ]
+ SID_GRID_USE
+ [
+ ExecMethod = ExecViewOptions;
+ StateMethod = StateViewOptions ;
+ ]
+ SID_HELPLINES_MOVE
+ [
+ ExecMethod = ExecViewOptions;
+ StateMethod = StateViewOptions ;
+ ]
+
+ FN_VLINEAL // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Export = FALSE;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_HSCROLLBAR // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Export = FALSE;
+ ]
+
+ FN_VSCROLLBAR // status()
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Export = FALSE;
+ ]
+
+ FN_SHADOWCURSOR // status(final|play)
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
+interface GlobalContents
+[ uuid = "1FD80520-F517-11d0-AC9B-008029E867C6"; ]
+{
+ UINT16 Type FN_COLL_TYPE
+ (
+ UINT16 Position FN_COLL_TYPE
+ )
+ [
+ ]
+
+ // Bereichsname, Index-Titel oder Leerstring
+ String Title FN_COLL_TITLE
+ (
+ UINT16 Position FN_COLL_TITLE
+ )
+ [
+ ]
+ // ohne FileName wird ein TextBereich an der Position eingefuegt
+ BOOL InsertDocument FN_COLL_ADD
+ (
+ UINT16 Position FN_COLL_ADD,
+ UINT16 FileName FN_PARAM_1
+ )
+ [
+ ]
+
+}
+
diff --git a/sw/sdi/annotsh.sdi b/sw/sdi/annotsh.sdi
new file mode 100755
index 000000000000..349e17b9d985
--- /dev/null
+++ b/sw/sdi/annotsh.sdi
@@ -0,0 +1,380 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface Annotation : _Annotation
+[
+ uuid = "CA0C4280-293D-11D1-89CB-008029E4B0B1"
+]
+{
+
+ SID_THESAURUS // api:
+ [
+ ExecMethod = ExecLingu ;
+ StateMethod = GetLinguState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_HANGUL_HANJA_CONVERSION // api:
+ [
+ ExecMethod = ExecLingu ;
+ StateMethod = GetLinguState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CHINESE_CONVERSION // api:
+ [
+ ExecMethod = ExecLingu ;
+ StateMethod = GetLinguState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_STYLE_CATALOG // ole(no) api(play/rec)
+ [
+ StateMethod = StateDisableItems ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TWAIN_SELECT
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_TWAIN_TRANSFER
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_INSERT_GRAPHIC
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_AUTOSPELL_CHECK
+ [
+ ExecMethod = Exec;
+ StateMethod = GetState;
+ ]
+
+ SID_HYPERLINK_SETLINK // status()
+ [
+ ExecMethod = Exec ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_HYPERLINK_GETLINK // status()
+ [
+ StateMethod = StateInsert ;
+ ]
+
+ FN_INSERT_SOFT_HYPHEN // status(final|play)
+ [
+ ExecMethod = Exec ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_INSERT_HARDHYPHEN // status()
+ [
+ ExecMethod = Exec ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_INSERT_HARD_SPACE // status(final|play)
+ [
+ ExecMethod = Exec ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_INSERT_RLM
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_INSERT_LRM
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_INSERT_ZWSP
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_INSERT_ZWNBSP
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_LEFT_TO_RIGHT
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_RIGHT_TO_LEFT
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TEXTDIRECTION_LEFT_TO_RIGHT
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TEXTDIRECTION_TOP_TO_BOTTOM
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_VERTICALTEXT_STATE
+ [
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CTLFONT_STATE
+ [
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TRANSLITERATE_SENTENCE_CASE
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TRANSLITERATE_TITLE_CASE
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TRANSLITERATE_TOGGLE_CASE
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TRANSLITERATE_UPPER
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TRANSLITERATE_LOWER
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TRANSLITERATE_HALFWIDTH
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TRANSLITERATE_FULLWIDTH
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TRANSLITERATE_HIRAGANA
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TRANSLITERATE_KATAGANA
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_WORDLINEMODE // status(final|play)
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_RELIEF
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_LANGUAGE // status(final|play)
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_KERNING // status(final|play)
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_AUTOKERN // // status(final|play)
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_ESCAPEMENT // status(final|play)
+ [
+ ExecMethod = Exec ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_SCALEWIDTH // status()
+ [
+ ExecMethod = Exec ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_STYLE_FAMILY1
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_FAMILY2
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_FAMILY3
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_FAMILY4
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_FAMILY5
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_WATERCAN // status()
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_UPDATE_BY_EXAMPLE // status()
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_NEW_BY_EXAMPLE // status(fina|play)
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_APPLY // status(fina|play)
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_NEW // ole : no, status : ?
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_EDIT // ole : no, status : ?
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_STYLE_DELETE // ole : no, status : ?
+ [
+ StateMethod = StateDisableItems ;
+ ]
+ FN_STAT_SELMODE
+ [
+ StateMethod = StateStatusLine ;
+ ]
+
+ FN_STAT_TEMPLATE
+ [
+ StateMethod = StateStatusLine ;
+ ]
+
+ SID_LANGUAGE_STATUS
+ [
+ ExecMethod = ExecLingu ;
+ StateMethod = GetLinguState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_THES
+ [
+ ExecMethod = ExecLingu ;
+ StateMethod = GetLinguState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents
+ ]
+
+}
+
+shell SwAnnotationShell
+{
+ import Annotation[Automation];
+}
diff --git a/sw/sdi/basesh.sdi b/sw/sdi/basesh.sdi
new file mode 100644
index 000000000000..230d977b0cfc
--- /dev/null
+++ b/sw/sdi/basesh.sdi
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface TextSelection : BaseTextSelection
+[
+ uuid = "F23BA0A8-73A0-11d0-89CA-008029E4B0B1"
+]
+{
+ // hier sollen die Slots eingefuegt werden, die vom StarWriter/WEB
+ // nicht unterstuetzt werden
+
+ FN_TOOL_ANKER_PAGE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CONTOUR_DLG
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CONTOUR_EXEC
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+} // end interface Base
+
+
+shell SwBaseShell
+{
+ import TextSelection[Automation];
+}
+
diff --git a/sw/sdi/beziersh.sdi b/sw/sdi/beziersh.sdi
new file mode 100644
index 000000000000..6a2c8289b628
--- /dev/null
+++ b/sw/sdi/beziersh.sdi
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface TextBezier : TextSelection
+[
+ uuid = "68EF7EA0-6876-11D0-A887-008029E86826" ]
+{
+ SID_DELETE
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_BACKSPACE
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_ESCAPE // api:
+ [
+ ExecMethod = Execute;
+ ]
+
+ SID_BEZIER_MOVE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_INSERT
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_DELETE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_CUTLINE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_CONVERT
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_EDGE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_SMOOTH
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_SYMMTR
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_CLOSE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_ELIMINATE_POINTS
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
+shell SwBezierShell: SwBaseShell
+{
+ import TextBezier[Automation];
+}
+
+
diff --git a/sw/sdi/docsh.sdi b/sw/sdi/docsh.sdi
new file mode 100644
index 000000000000..5925edd7528c
--- /dev/null
+++ b/sw/sdi/docsh.sdi
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface TextDocument : BaseTextDocument
+[
+ uuid = "0D960120-111C-101D-9757-6E74207A7520"
+]
+{
+ // Slots, die nicht in der WebDocShell gebraucht werden
+
+ FN_OUTLINE_TO_IMPRESS
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+
+ FN_OUTLINE_TO_CLIPBOARD
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ FN_ABSTRACT_STARIMPRESS
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ FN_ABSTRACT_NEWDOC
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ FN_NEW_GLOBAL_DOC
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ FN_NEW_HTML_DOC
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+}
+
+shell SwDocShell
+{
+ import TextDocument[Automation];
+}
+
+shell SwGlosDocShell : SwDocShell
+{
+ import TextDocument[Automation];
+
+ SID_SAVEDOC // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+}
+
diff --git a/sw/sdi/drawsh.sdi b/sw/sdi/drawsh.sdi
new file mode 100644
index 000000000000..303190e88f2d
--- /dev/null
+++ b/sw/sdi/drawsh.sdi
@@ -0,0 +1,477 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+interface TextDraw : TextDrawBase
+[
+ uuid = "626DE480-111A-101D-9757-6E74207A7520"
+]
+{
+ SID_ATTR_LINEEND_STYLE
+ [
+ SlotType = SfxBoolItem ;
+ ExecMethod = ExecDrawAttrArgs ;
+ StateMethod = DisableState ;
+ Export = FALSE;
+ ]
+
+ SID_ATTR_LINE_STYLE
+ [
+ Export = FALSE;
+ ExecMethod = ExecDrawAttrArgs ;
+ StateMethod = GetDrawAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_LINE_DASH
+ [
+ ExecMethod = ExecDrawAttrArgs ;
+ StateMethod = GetDrawAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_DASH_LIST
+ [
+ StateMethod = GetDrawAttrState ;
+ ]
+
+ SID_LINEEND_LIST
+ [
+ StateMethod = GetDrawAttrState ;
+ ]
+
+ SID_COLOR_TABLE
+ [
+ StateMethod = GetDrawAttrState ;
+ ]
+
+ SID_GRADIENT_LIST
+ [
+ StateMethod = GetDrawAttrState ;
+ ]
+
+ SID_HATCH_LIST
+ [
+ StateMethod = GetDrawAttrState ;
+ ]
+
+ SID_BITMAP_LIST
+ [
+ StateMethod = GetDrawAttrState ;
+ ]
+
+ SID_ATTR_LINE_WIDTH
+ [
+ ExecMethod = ExecDrawAttrArgs ;
+ StateMethod = GetDrawAttrState ;
+ Export = FALSE;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_LINE_COLOR
+ [
+ Export = FALSE;
+ ExecMethod = ExecDrawAttrArgs ;
+ StateMethod = GetDrawAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_FILL_STYLE
+ [
+ Export = FALSE;
+ ExecMethod = ExecDrawAttrArgs ;
+ StateMethod = GetDrawAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_FILL_COLOR
+ [
+ Export = FALSE;
+ ExecMethod = ExecDrawAttrArgs ;
+ StateMethod = GetDrawAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_FILL_GRADIENT
+ [
+ Export = FALSE;
+ ExecMethod = ExecDrawAttrArgs ;
+ StateMethod = GetDrawAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_FILL_HATCH
+ [
+ Export = FALSE;
+ ExecMethod = ExecDrawAttrArgs ;
+ StateMethod = GetDrawAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_FILL_BITMAP
+ [
+ Export = FALSE;
+ ExecMethod = ExecDrawAttrArgs ;
+ StateMethod = GetDrawAttrState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTRIBUTES_LINE
+ [
+ ExecMethod = ExecDrawDlg ;
+ StateMethod = DisableState ;
+ ]
+
+ SID_ATTRIBUTES_AREA
+ [
+ ExecMethod = ExecDrawDlg ;
+ StateMethod = DisableState ;
+ ]
+
+ FN_DRAWTEXT_ATTR_DLG
+ [
+ ExecMethod = ExecDrawDlg ;
+ StateMethod = DisableState ;
+ ]
+
+ FN_FLIP_VERT_GRAFIC
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FLIP_HORZ_GRAFIC
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_OBJECT_ROTATE
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_BEZIER_EDIT
+ [
+ Export = FALSE;
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FONTWORK
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_OBJECT_HELL
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_OBJECT_HEAVEN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_TOOL_HIERARCHIE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_EXTRUSION_TOOGLE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_TILT_DOWN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_TILT_UP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_TILT_LEFT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_TILT_RIGHT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_DEPTH_FLOATER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_DEPTH_DIALOG
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_DIRECTION_FLOATER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_LIGHTING_FLOATER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_SURFACE_FLOATER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_3D_COLOR
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_DEPTH
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_DIRECTION
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_PROJECTION
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_LIGHTING_DIRECTION
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_LIGHTING_INTENSITY
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_EXTRUSION_SURFACE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FONTWORK_SHAPE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FONTWORK_SHAPE_TYPE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FONTWORK_ALIGNMENT_FLOATER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FONTWORK_CHARACTER_SPACING_FLOATER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FONTWORK_ALIGNMENT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FONTWORK_SAME_LETTER_HEIGHTS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FONTWORK_CHARACTER_SPACING
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FONTWORK_KERN_CHARACTER_PAIRS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FONTWORK_CHARACTER_SPACING_DIALOG
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_INSERT_GRAPHIC
+ [
+ StateMethod = StateDisableItems ;
+ ]
+ SID_TWAIN_SELECT
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_TWAIN_TRANSFER
+ [
+ StateMethod = StateDisableItems ;
+ ]
+}
+
+shell SwDrawShell : SwDrawBaseShell
+{
+ import TextDraw [Automation];
+
+ // no export
+
+ SID_FORMTEXT_STYLE
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ SID_FORMTEXT_ADJUST
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ SID_FORMTEXT_DISTANCE
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ SID_FORMTEXT_START
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_MIRROR
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ SID_FORMTEXT_HIDEFORM
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_OUTLINE
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_SHDWXVAL
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_SHADOW
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_SHDWCOLOR
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_SHDWYVAL
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_STDFORM
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FORMAT_FOOTNOTE_DLG // status()
+ [
+ ExecMethod = Execute;
+ ]
+
+ SID_OPEN_XML_FILTERSETTINGS // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ ]
+
+ FN_WORDCOUNT_DIALOG
+ [
+ ExecMethod = Execute;
+ ]
+
+ FN_NUMBERING_OUTLINE_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ ]
+}
+
+
diff --git a/sw/sdi/drwbassh.sdi b/sw/sdi/drwbassh.sdi
new file mode 100644
index 000000000000..7d2ec32f3a8e
--- /dev/null
+++ b/sw/sdi/drwbassh.sdi
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface TextDrawBase : BaseTextDrawBase
+[
+ Automation = FALSE;
+]
+{
+ import TextSelection;
+}
+
+shell SwDrawBaseShell: SwBaseShell
+{
+ import TextDrawBase[Automation];
+
+ SID_OBJECT_ALIGN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi
new file mode 100644
index 000000000000..d98d368a9460
--- /dev/null
+++ b/sw/sdi/drwtxtsh.sdi
@@ -0,0 +1,659 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface TextDrawText
+[
+ uuid = "CA0C4280-293D-11D1-89CB-008029E4B0B1"
+]
+{
+ SID_SELECTALL // api:
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = NoState ;
+ ]
+
+ SID_CUT // api:
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_COPY // api:
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ ]
+
+ SID_PASTE // api:
+ [
+ ExecMethod = ExecClpbrd ;
+ StateMethod = StateClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_PASTE_SPECIAL // api:
+ [
+ StateMethod = StateClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CLIPBOARD_FORMAT_ITEMS // api:
+ [
+ StateMethod = StateClpbrd ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_ESCAPE // api:
+ [
+ ExecMethod = ExecDraw ;
+ ]
+
+ SID_UNDO // api:
+ [
+ ExecMethod = ExecUndo ;
+ StateMethod = StateUndo ;
+
+ ToolBoxConfig , MenuConfig , AccelConfig;
+ ]
+
+ SID_REDO // api:
+ [
+ ExecMethod = ExecUndo ;
+ StateMethod = StateUndo ;
+ ]
+
+ SID_REPEAT // api:
+ [
+ ExecMethod = ExecUndo ;
+ StateMethod = StateUndo ;
+ ]
+ SID_GETUNDOSTRINGS
+ [
+ StateMethod = StateUndo ;
+ ]
+
+ SID_GETREDOSTRINGS
+ [
+ StateMethod = StateUndo ;
+ ]
+
+ FN_FORMAT_RESET // api:
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CHARMAP // api:
+ [
+ ExecMethod = ExecDraw ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_INSERT_STRING
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_INSERT_SOFT_HYPHEN // status(final|play)
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_HARDHYPHEN // status()
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_HARD_SPACE // status(final|play)
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_RLM
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_LRM
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_ZWSP
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_ZWNBSP
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_WEIGHT // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_POSTURE // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_UNDERLINE // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_OVERLINE // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_CONTOUR
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_SHADOWED
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_STRIKEOUT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_ADJUST_LEFT // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_ADJUST_CENTER // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_ADJUST_RIGHT // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_ADJUST_BLOCK // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_LINESPACE_10 // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_LINESPACE_15 // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_PARA_LINESPACE_20 // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_LEFT_TO_RIGHT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_PARA_RIGHT_TO_LEFT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_TEXTDIRECTION_LEFT_TO_RIGHT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TEXTDIRECTION_TOP_TO_BOTTOM
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_VERTICALTEXT_STATE
+ [
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_CTLFONT_STATE
+ [
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_CHAR_DLG // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_CHAR_DLG_FOR_PARAGRAPH
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_PARA_DLG // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_SET_SUPER_SCRIPT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_SET_SUB_SCRIPT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FONTWORK // api:
+ [
+ ExecMethod = ExecFontWork ;
+ StateMethod = StateFontWork ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ SID_FORMTEXT_STYLE // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_ADJUST // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_DISTANCE // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_START // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ SID_FORMTEXT_MIRROR // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+
+ SID_FORMTEXT_HIDEFORM // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_OUTLINE // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_SHADOW // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_SHDWCOLOR // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_SHDWXVAL // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_SHDWYVAL // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_FORMTEXT_STDFORM // api:
+ [
+ ExecMethod = ExecFormText ;
+ StateMethod = GetFormTextState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_THESAURUS // api:
+ [
+ ExecMethod = ExecDrawLingu ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_HANGUL_HANJA_CONVERSION // api:
+ [
+ ExecMethod = ExecDrawLingu ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CHINESE_CONVERSION // api:
+ [
+ ExecMethod = ExecDrawLingu ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_DRAWTEXT_ATTR_DLG
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_STYLE_CATALOG // ole(no) api(play/rec)
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_AUTOSPELL_CHECK
+ [
+ ExecMethod = Execute;
+ StateMethod = GetDrawTxtCtrlState
+ ]
+
+ SID_SEARCH_DLG
+ [
+ StateMethod = StateDisableItems
+ ]
+
+ SID_HYPERLINK_SETLINK // status()
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_HYPERLINK_GETLINK // status()
+ [
+ StateMethod = StateInsert ;
+ ]
+ SID_TRANSLITERATE_SENTENCE_CASE
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_TITLE_CASE
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_TOGGLE_CASE
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_UPPER
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_LOWER
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = NoState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_HALFWIDTH
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_FULLWIDTH
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_HIRAGANA
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_TRANSLITERATE_KATAGANA
+ [
+ ExecMethod = ExecTransliteration;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_LANGUAGE_STATUS
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents
+ ]
+
+ SID_THES
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents
+ ]
+
+ FN_FORMAT_FOOTNOTE_DLG // status()
+ [
+ ExecMethod = Execute ;
+ ]
+
+ SID_OPEN_XML_FILTERSETTINGS // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ ]
+
+ FN_WORDCOUNT_DIALOG
+ [
+ ExecMethod = Execute;
+ ]
+
+ FN_NUMBERING_OUTLINE_DLG // status(final|play)
+ [
+ ExecMethod = Execute ;
+ ]
+
+ SID_INSERT_GRAPHIC
+ [
+ StateMethod = StateDisableItems ;
+ ]
+ SID_TWAIN_SELECT
+ [
+ StateMethod = StateDisableItems ;
+ ]
+
+ SID_TWAIN_TRANSFER
+ [
+ StateMethod = StateDisableItems ;
+ ]
+}
+
+interface TextDrawFont
+[ uuid = "074C35E0-11EF-101D-9757-6E74207A7520"; ]
+{
+ SID_ATTR_CHAR_FONT // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_FONTHEIGHT // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_COLOR // api:
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_WORDLINEMODE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_RELIEF
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_LANGUAGE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_KERNING // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_AUTOKERN // // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_ATTR_CHAR_ESCAPEMENT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_ATTR_CHAR_SCALEWIDTH // status()
+ [
+ ExecMethod = Execute ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
+
+
+shell SwDrawTextShell
+{
+ import TextDrawText[Automation];
+ import TextDrawFont ".DrawFont";
+}
+
diff --git a/sw/sdi/formsh.sdi b/sw/sdi/formsh.sdi
new file mode 100644
index 000000000000..e6058fb40ac0
--- /dev/null
+++ b/sw/sdi/formsh.sdi
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+interface TextDrawForm: BaseTextDrawForm
+[
+ uuid = "1D396B40-B8CC-11d1-AB80-006097B418C2"
+]
+{
+ import TextDrawBase;
+}
+
+shell SwDrawFormShell : SwDrawBaseShell
+{
+ import TextDrawForm[Automation];
+}
+
+
diff --git a/sw/sdi/frmsh.sdi b/sw/sdi/frmsh.sdi
new file mode 100644
index 000000000000..ff0d951eb51f
--- /dev/null
+++ b/sw/sdi/frmsh.sdi
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface TextFrame : BaseTextFrame
+[
+ uuid = "564CBAA0-111A-101D-9757-6E74207A7520"
+]
+{
+ import TextSelection;
+}
+
+ //=========================================================================
+
+shell SwFrameShell : SwBaseShell
+{
+ import TextFrame[Automation];
+
+ FN_FRAME_CHAIN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ FN_FRAME_UNCHAIN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
diff --git a/sw/sdi/grfsh.sdi b/sw/sdi/grfsh.sdi
new file mode 100644
index 000000000000..4e6a7675862f
--- /dev/null
+++ b/sw/sdi/grfsh.sdi
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+interface TextGraphic : BaseTextGraphic
+[
+ uuid = "1885FE00-111C-101D-9757-6E74207A7520"
+]
+{
+}
+
+ //=========================================================================
+
+shell SwGrfShell : SwBaseShell
+
+{
+ import TextGraphic[Automation];
+}
+
+
diff --git a/sw/sdi/listsh.sdi b/sw/sdi/listsh.sdi
new file mode 100644
index 000000000000..1acb01fecab7
--- /dev/null
+++ b/sw/sdi/listsh.sdi
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface TextList : BaseTextList
+[
+ uuid = "509E9100-111A-101D-9757-6E74207A7520"
+]
+{
+ import TextSelection;
+}
+
+ //=========================================================================
+
+shell SwListShell : SwBaseShell
+{
+ import TextList[Automation];
+}
+
+
diff --git a/sw/sdi/mediash.sdi b/sw/sdi/mediash.sdi
new file mode 100644
index 000000000000..647a02434351
--- /dev/null
+++ b/sw/sdi/mediash.sdi
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+interface TextMedia : BaseTextMedia
+[
+ uuid = "54268616-9970-4ad9-8798-280206fc160a"
+]
+{
+}
+
+ //=========================================================================
+
+shell SwMediaShell : SwBaseShell
+
+{
+ import TextMedia[Automation];
+}
diff --git a/sw/sdi/olesh.sdi b/sw/sdi/olesh.sdi
new file mode 100644
index 000000000000..c10717b945a9
--- /dev/null
+++ b/sw/sdi/olesh.sdi
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface TextOLEObject : BaseTextOLEObject
+[
+ uuid = "B156B300-39FC-101D-9757-C667E8298000"
+]
+{
+ import TextFrame;
+}
+
+shell SwOleShell: SwFrameShell
+{
+ import TextOLEObject[Automation];
+}
+
+
diff --git a/sw/sdi/swinterf.c b/sw/sdi/swinterf.c
new file mode 100644
index 000000000000..01a741cc04b5
--- /dev/null
+++ b/sw/sdi/swinterf.c
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <stdio.h>
+
+#include <svinterf.h>
+#include <cmdid.h>
+
+static char pEmpty[] = "";
+
+extern void *pSvClient;
+
+/* WRITER */
+short SwInsertDocument (void *pHandle,
+ const char *pFileName,
+ const char *pFilter)
+{
+ return 0;
+}
+
+/**************************************************************************/
+
+/* WRITER */
+short SwDeleteTableColumns (void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_TABLE_DELETE_COL | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/* WRITER */
+short SwDeleteTableRows (void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_TABLE_DELETE_ROW | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/* WRITER */
+short SwGotoStartOfTable (void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_START_TABLE | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/* WRITER */
+short SwGotoEndOfTable (void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_END_TABLE | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/* WRITER */
+short SwGotoNextTable (void *pHandle)
+{
+ return 0;
+}
+
+/* WRITER */
+short SwGotoPrevTable (void *pHandle)
+{
+ return 0;
+}
+
+/* WRITER */
+short SwSelectTableRow (void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_TABLE_SELECT_ROW | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/* WRITER */
+short SwSelectTableColumn (void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_TABLE_SELECT_COL | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/* WRITER */
+short SwTableSelect (void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_TABLE_SELECT_ALL | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/* WRITER */
+short SwInsertTable (void *pHandle, const char *pName,
+ unsigned short nRow, unsigned short nColumn)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_INSERT_TABLE | 0x10000,
+ pHandle,0,"hh",nRow,nColumn);
+ return 0;
+
+}
+
+/**************************************************************************/
+
+/* WRITER */
+short SwCharLeft(void *pHandle, unsigned short nCount, unsigned short bSelect)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_CHAR_LEFT | 0x10000,
+ pHandle,0,"hb",nCount,bSelect);
+ return 0;
+}
+
+/* WRITER */
+short SwCharRight(void *pHandle, unsigned short nCount, unsigned short bSelect)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_CHAR_RIGHT | 0x10000,
+ pHandle,0,"hb",nCount,bSelect);
+ return 0;
+}
+
+/* WRITER */
+short SwLineUp(void *pHandle, unsigned short nCount, unsigned short bSelect)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_LINE_UP | 0x10000,
+ pHandle,0,"hb",nCount,bSelect);
+ return 0;
+}
+
+/* WRITER */
+short SwLineDown(void *pHandle, unsigned short nCount, unsigned short bSelect)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_LINE_DOWN | 0x10000,
+ pHandle,0,"hb",nCount,bSelect);
+ return 0;
+}
+
+/**************************************************************************/
+
+/* WRITER */
+const char *SwGetSelectedText(void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallStringFunction(SvIPCGetClient(),FN_GET_SELECTED_TEXT,
+ pHandle,0,pEmpty);
+ return NULL;
+}
+
+/* WRITER */
+short SwInsertString(void *pHandle,const char *pString)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_INSERT_STRING | 0x10000,
+ pHandle,0,"s",pString);
+ return 0;
+}
+
+/* WRITER */
+extern short SwInsertLineBreak(void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_INSERT_LINEBREAK | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/**************************************************************************/
+
+/* WRITER */
+short SwDelLeft (void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_BACKSPACE | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/* WRITER */
+short SwDelRight (void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_DELETE | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/* WRITER */
+short SwDelLine (void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_DELETE_WHOLE_LINE | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/**************************************************************************/
+
+/* WRITER */
+short SwCharDlg(void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_FORMAT_CHAR_DLG | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+/* WRITER */
+short SwParagrDlg(void *pHandle)
+{
+ if (SvIPCIsConnected())
+ return pIPCCallShortFunction(SvIPCGetClient(),FN_FORMAT_PARA_DLG | 0x10000,
+ pHandle,0,pEmpty);
+ return 0;
+}
+
+
diff --git a/sw/sdi/switems.sdi b/sw/sdi/switems.sdi
new file mode 100644
index 000000000000..f2595aa104df
--- /dev/null
+++ b/sw/sdi/switems.sdi
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+item String SwNumRuleItem;
+item BOOL SwRegisterItem;
+
+struct SwLineNumber
+{
+ BOOL CountLines MID_LINENUMBER_COUNT;
+ INT32 StartValue MID_LINENUMBER_STARTVALUE;
+};
+item SwLineNumber SwFmtLineNumber;
+
+struct INetFmt
+{
+ String URL MID_URL_URL;
+ String Target MID_URL_TARGET;
+ String Name MID_URL_HYPERLINKNAME;
+ String VisitedFormat MID_URL_VISITED_FMT;
+ String UnvisitedFormat MID_URL_UNVISITED_FMT;
+};
+item INetFmt SwFmtINetFmt;
+
+struct Drop
+{
+ INT16 Lines MID_DROPCAP_LINES;
+ INT16 Count MID_DROPCAP_COUNT;
+ INT16 Distance MID_DROPCAP_DISTANCE;
+ BOOL WholeWord MID_DROPCAP_WHOLE_WORD;
+// String Style MID_DROPCAP_CHAR_STYLE_NAME;
+};
+item Drop SwFmtDrop;
+
+struct Envelope
+{
+ String AddrText MID_ENV_ADDR_TEXT;
+ BOOL Send MID_ENV_SEND;
+ String SendText MID_SEND_TEXT;
+ INT32 AddrFromLeft MID_ENV_ADDR_FROM_LEFT;
+ INT32 AddrFromTop MID_ENV_ADDR_FROM_TOP;
+ INT32 SendFromLeft MID_ENV_SEND_FROM_LEFT;
+ INT32 SendFromTop MID_ENV_SEND_FROM_TOP;
+ INT32 Width MID_ENV_WIDTH;
+ INT32 Height MID_ENV_HEIGHT;
+ INT16 Align MID_ENV_ALIGN;
+ BOOL PrintFromAbove MID_ENV_PRINT_FROM_ABOVE;
+ INT32 ShiftRight MID_ENV_SHIFT_RIGHT;
+ INT32 ShiftDown MID_ENV_SHIFT_DOWN;
+};
+item Envelope SwEnvItem;
+
+struct ViewLayout
+{
+ INT16 Columns MID_VIEWLAYOUT_COLUMNS;
+ BOOL BookMode MID_VIEWLAYOUT_BOOKMODE;
+};
+item ViewLayout SvxViewLayoutItem;
+
diff --git a/sw/sdi/swpatch.txt b/sw/sdi/swpatch.txt
new file mode 100644
index 000000000000..5c52bb3c130b
--- /dev/null
+++ b/sw/sdi/swpatch.txt
@@ -0,0 +1,21 @@
+swinter.h:
+
+unsigned char SYSCALL SwDocumentGetIsPrinting( C_Object ObjHdl );
+
+
+swinter.c:
+
+unsigned char SYSCALL SwDocumentGetIsPrinting( C_Object ObjHdl )
+{
+ if( SvIPCIsConnected() )
+ {
+ return (unsigned char) pIPCCallFunction( SvIPCGetClient(), 136598,
+ ObjHdl , 1, NULL );
+ }
+ return 0;
+}
+
+#ifdef _MSC_VER
+#pragma code_seg("swinter2","CODE")
+#endif
+
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
new file mode 100644
index 000000000000..64f52343cb7b
--- /dev/null
+++ b/sw/sdi/swriter.sdi
@@ -0,0 +1,10268 @@
+//--------------------------------------------------------------------------
+SfxVoidItem CreateSWDrawView SID_CREATE_SW_DRAWVIEW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem AcceptTrackedChanges FN_REDLINE_ACCEPT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TrackChanges FN_REDLINE_ON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AddAllUnknownWords FN_ADD_UNKNOWN
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignBottom FN_FRAME_ALIGN_VERT_BOTTOM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignCharBottom FN_FRAME_ALIGN_VERT_CHAR_BOTTOM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignCharTop FN_FRAME_ALIGN_VERT_CHAR_TOP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignHorizontalCenter FN_FRAME_ALIGN_HORZ_CENTER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignLeft FN_FRAME_ALIGN_HORZ_LEFT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignRight FN_FRAME_ALIGN_HORZ_RIGHT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignRowBottom FN_FRAME_ALIGN_VERT_ROW_BOTTOM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignRowTop FN_FRAME_ALIGN_VERT_ROW_TOP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignTop FN_FRAME_ALIGN_VERT_TOP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignVerticalCenter FN_FRAME_ALIGN_VERT_CENTER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignVerticalCharCenter FN_FRAME_ALIGN_VERT_CHAR_CENTER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignVerticalRowCenter FN_FRAME_ALIGN_VERT_ROW_CENTER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AuthoritiesEntryDialog FN_EDIT_AUTH_ENTRY_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AutoFormatApply FN_AUTOFORMAT_APPLY
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AutoFormatRedlineApply FN_AUTOFORMAT_REDLINE_APPLY
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AutoSum FN_TABLE_AUTOSUM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SvxColorItem BackColor SID_ATTR_CHAR_COLOR_BACKGROUND
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem BackgroundDialog FN_FORMAT_BACKGROUND_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SwBackspace FN_BACKSPACE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem BorderDialog FN_FORMAT_BORDER_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem BulletsAndNumberingDialog FN_NUMBER_BULLETS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Calc FN_CALC_TABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CalculateSel FN_CALCULATE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CellVertBottom FN_TABLE_VERT_BOTTOM
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CellVertCenter FN_TABLE_VERT_CENTER
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CellVertTop FN_TABLE_VERT_NONE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ChainFrames FN_FRAME_CHAIN
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeDatabaseField FN_CHANGE_DBFIELD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChapterNumberingDialog FN_NUMBERING_OUTLINE_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CharBackgroundExt SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CharColorExt SID_ATTR_CHAR_COLOR_EXT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CharLeftSel FN_CHAR_LEFT_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CharRightSel FN_CHAR_RIGHT_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ClosePreview FN_CLOSE_PAGEPREVIEW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CommentChangeTracking FN_REDLINE_COMMENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ControlCodes FN_VIEW_META_CHARS
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ConvertTableText FN_CONVERT_TEXT_TABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CreateAbstract FN_ABSTRACT_NEWDOC
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DecrementIndentValue FN_DEC_INDENT_OFFSET
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DecrementLevel FN_NUM_BULLET_DOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DecrementSubLevels FN_NUM_BULLET_OUTLINE_DOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DeleteColumns FN_TABLE_DELETE_COL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DeleteRows FN_TABLE_DELETE_ROW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DelLine FN_DELETE_WHOLE_LINE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DelToEndOfLine FN_DELETE_LINE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DelToEndOfPara FN_DELETE_PARA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DelToEndOfSentence FN_DELETE_SENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DelToEndOfWord FN_DELETE_WORD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DelToStartOfLine FN_DELETE_BACK_LINE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DelToStartOfPara FN_DELETE_BACK_PARA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DelToStartOfSentence FN_DELETE_BACK_SENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DelToStartOfWord FN_DELETE_BACK_WORD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DistributeColumns FN_TABLE_BALANCE_CELLS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DistributeRows FN_TABLE_BALANCE_ROWS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EditCurIndex FN_EDIT_CURRENT_TOX
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EditGlossary FN_GLOSSARY_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EditHyperlink FN_EDIT_HYPERLINK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EditRegion FN_EDIT_REGION
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EndOfDocumentSel FN_END_OF_DOCUMENT_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EndOfLineSel FN_END_OF_LINE_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EndOfParaSel FN_END_OF_PARA_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EntireColumn FN_TABLE_SELECT_COL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EntireRow FN_TABLE_SELECT_ROW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Escape FN_ESCAPE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExecuteMacroField FN_EXECUTE_MACROFIELD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_MACRO;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ExpandGlossary FN_EXPAND_GLOSSARY
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FieldDialog FN_EDIT_FIELD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Fieldnames FN_VIEW_FIELDNAME
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Fields FN_VIEW_FIELDS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FlipHorizontal FN_FLIP_HORZ_GRAFIC
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FlipVertical FN_FLIP_VERT_GRAFIC
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxColorItem FontColor SID_ATTR_CHAR_COLOR2
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FootnoteDialog FN_FORMAT_FOOTNOTE_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EditFootnote FN_EDIT_FOOTNOTE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FormatColumns FN_FORMAT_COLUMN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SwFmtDrop FormatDropcap FN_FORMAT_DROPCAPS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FrameDialog FN_FORMAT_FRAME_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoDown FN_LINE_DOWN
+(SfxInt16Item Count FN_PARAM_MOVE_COUNT,SfxBoolItem Select FN_PARAM_MOVE_SELECTION)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoLeft FN_CHAR_LEFT
+(SfxInt16Item Count FN_PARAM_MOVE_COUNT,SfxBoolItem Select FN_PARAM_MOVE_SELECTION)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoRight FN_CHAR_RIGHT
+(SfxInt16Item Count FN_PARAM_MOVE_COUNT,SfxBoolItem Select FN_PARAM_MOVE_SELECTION)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToAnchor FN_FRAME_TO_ANCHOR
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToEnd FN_END_TABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToEndOfColumn FN_END_OF_COLUMN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToEndOfDoc FN_END_OF_DOCUMENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToEndOfLine FN_END_OF_LINE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToEndOfNextColumn FN_END_OF_NEXT_COLUMN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToEndOfNextPage FN_END_OF_NEXT_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToEndOfNextPageSel FN_END_OF_NEXT_PAGE_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToEndOfPage FN_END_OF_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToEndOfPageSel FN_END_OF_PAGE_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToEndOfPara FN_END_OF_PARA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToEndOfPrevColumn FN_END_OF_PREV_COLUMN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToEndOfPrevPage FN_END_OF_PREV_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToEndOfPrevPageSel FN_END_OF_PREV_PAGE_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoNextIndexMark FN_NEXT_TOXMARK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoNextInputField FN_GOTO_NEXT_INPUTFLD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoNextObject FN_GOTO_NEXT_OBJ
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToNextPara FN_NEXT_PARA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoNextPlacemarker FN_GOTO_NEXT_MARK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToNextSentence FN_NEXT_SENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GotoNextSentenceSel FN_NEXT_SENT_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoNextTableFormula FN_NEXT_TBLFML
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToNextWord FN_NEXT_WORD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoNextWrongTableFormula FN_NEXT_TBLFML_ERR
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GotoPage FN_NAVIGATION_PI_GOTO_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoPrevIndexMark FN_PREV_TOXMARK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoPrevInputField FN_GOTO_PREV_INPUTFLD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoPrevObject FN_GOTO_PREV_OBJ
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToPrevPara FN_PREV_PARA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoPrevPlacemarker FN_GOTO_PREV_MARK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToPrevSentence FN_PREV_SENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GotoPrevSentenceSel FN_PREV_SENT_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoPrevTableFormula FN_PREV_TBLFML
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToPrevWord FN_PREV_WORD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GotoPrevWrongTableFormula FN_PREV_TBLFML_ERR
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToStartOfTable FN_START_TABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToStartOfColumn FN_START_OF_COLUMN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToStartOfDoc FN_START_OF_DOCUMENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToStartOfLine FN_START_OF_LINE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToStartOfNextColumn FN_START_OF_NEXT_COLUMN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToStartOfNextPage FN_START_OF_NEXT_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToStartOfNextPageSel FN_START_OF_NEXT_PAGE_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToStartOfPage FN_START_OF_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToStartOfPageSel FN_START_OF_PAGE_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoToStartOfPara FN_START_OF_PARA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToStartOfPrevColumn FN_START_OF_PREV_COLUMN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToStartOfPrevPage FN_START_OF_PREV_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GoToStartOfPrevPageSel FN_START_OF_PREV_PAGE_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GoUp FN_LINE_UP
+(SfxInt16Item Count FN_PARAM_MOVE_COUNT,SfxBoolItem Select FN_PARAM_MOVE_SELECTION)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Graphic FN_VIEW_GRAPHIC
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicDialog FN_FORMAT_GRAFIC_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_GRAPHIC;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem SaveGraphic FN_SAVE_GRAPHIC
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_GRAPHIC;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Grow FN_GROW_FONT_SIZE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem HScroll FN_HSCROLLBAR
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item HtmlMode SID_HTML_MODE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = TRUE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Hyphenate FN_HYPHENATE_OPT_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem IncrementIndentValue FN_INC_INDENT_OFFSET
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem IncrementLevel FN_NUM_BULLET_UP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem IncrementSubLevels FN_NUM_BULLET_OUTLINE_UP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem IndexEntryDialog FN_EDIT_IDX_ENTRY_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem IndexMarkToIndex FN_IDX_MARK_TO_IDX
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertAnnotation FN_POSTIT
+(SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT,SvxPostItAuthorItem Author SID_ATTR_POSTIT_AUTHOR,SvxPostItDateItem Date SID_ATTR_POSTIT_DATE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertAuthorField FN_INSERT_FLD_AUTHOR
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertAuthoritiesEntry FN_INSERT_AUTH_ENTRY_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertBookmark FN_INSERT_BOOKMARK
+(SfxStringItem Bookmark FN_INSERT_BOOKMARK)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertBreak FN_INSERT_BREAK_DLG
+(SfxInt16Item Kind FN_INSERT_BREAK_DLG,SfxStringItem TemplateName FN_PARAM_1,SfxUInt16Item PageNumber FN_PARAM_2)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertCaptionDialog FN_INSERT_CAPTION
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertColumnBreak FN_INSERT_COLUMN_BREAK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertColumnDialog FN_TABLE_INSERT_COL_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertColumns FN_TABLE_INSERT_COL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem InsertSection FN_INSERT_REGION
+(SfxUInt16Item Columns SID_ATTR_COLUMNS,SfxStringItem RegionName FN_PARAM_REGION_NAME,SfxStringItem RegionCondition FN_PARAM_REGION_CONDITION,SfxBoolItem RegionHidden FN_PARAM_REGION_HIDDEN,SfxBoolItem RegionProtect FN_PARAM_REGION_PROTECT,SfxStringItem LinkName FN_PARAM_1,SfxStringItem FilterName FN_PARAM_2,SfxStringItem SubRegion FN_PARAM_3)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxUInt16Item
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxImageItem InsertCtrl FN_INSERT_CTRL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertDateField FN_INSERT_FLD_DATE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertEndnote FN_INSERT_ENDNOTE
+(SfxStringItem FootnoteAnchorText FN_INSERT_ENDNOTE,SfxStringItem FontName FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertEnvelope FN_ENVELOP
+(SwEnvItem Envelope FN_ENVELOP,SfxBoolItem NewDocument FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertField FN_INSERT_FIELD
+(SfxUInt16Item Type FN_PARAM_FIELD_TYPE,SfxUInt16Item SubType FN_PARAM_FIELD_SUBTYPE,SfxStringItem Name FN_INSERT_FIELD,SfxStringItem Content FN_PARAM_FIELD_CONTENT,SfxUInt32Item Format FN_PARAM_FIELD_FORMAT,SfxStringItem Separator FN_PARAM_3)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertFieldCtrl FN_INSERT_FIELD_CTRL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertFootnoteDialog FN_INSERT_FOOTNOTE_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertFootnote FN_INSERT_FOOTNOTE
+(SfxStringItem NoteAnchorText FN_INSERT_FOOTNOTE,SfxStringItem FontName FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertFormula FN_EDIT_FORMULA
+(SfxStringItem Formula FN_EDIT_FORMULA)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertFrame FN_INSERT_FRAME
+(SfxUInt16Item AnchorType FN_INSERT_FRAME,SfxPointItem Pos FN_PARAM_1,SvxSizeItem Size FN_PARAM_2)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxUInt16Item
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertFrameInteract FN_INSERT_FRAME_INTERACT
+(SfxUInt16Item Columns SID_ATTR_COLUMNS, SfxUInt16Item Modifier SID_MODIFIER)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxUInt16Item
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertFrameInteractNoColumns FN_INSERT_FRAME_INTERACT_NOCOL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertGraphicRuler FN_INSERT_HRULER
+(SfxStringItem GraphicName FN_INSERT_HRULER,SfxBoolItem IsSimpleLine FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertHyperlinkDlg FN_INSERT_HYPERLINK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertIndexesEntry FN_INSERT_IDX_ENTRY_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertLinebreak FN_INSERT_LINEBREAK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertMultiIndex FN_INSERT_MULTI_TOX
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertNeutralParagraph FN_NUM_BULLET_NONUM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxImageItem InsertObjCtrl FN_INSERT_OBJ_CTRL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertObjectDialog FN_INSERT_OBJECT_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertObjectStarMath FN_INSERT_SMA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertPagebreak FN_INSERT_PAGEBREAK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertPageCountField FN_INSERT_FLD_PGCOUNT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertPageFooter FN_INSERT_PAGEFOOTER
+(SfxStringItem PageStyle FN_INSERT_PAGEFOOTER,SfxBoolItem On FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxObjectShellItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertPageHeader FN_INSERT_PAGEHEADER
+(SfxStringItem PageStyle FN_INSERT_PAGEHEADER,SfxBoolItem On FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxObjectShellItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertPageNumberField FN_INSERT_FLD_PGNUMBER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertPara FN_INSERT_BREAK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertReferenceField FN_INSERT_REF_FIELD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertRowDialog FN_TABLE_INSERT_ROW_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertRows FN_TABLE_INSERT_ROW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertScript FN_JAVAEDIT
+(SfxStringItem Text FN_JAVAEDIT,SfxBoolItem IsURL FN_PARAM_1,SfxStringItem Type FN_PARAM_2)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertTable FN_INSERT_TABLE
+(SfxStringItem TableName FN_INSERT_TABLE,SfxUInt16Item Columns SID_ATTR_TABLE_COLUMN,SfxUInt16Item Rows SID_ATTR_TABLE_ROW,SfxInt32Item Flags FN_PARAM_1,SfxStringItem AutoFormat FN_PARAM_2)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxUInt16Item
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertTimeField FN_INSERT_FLD_TIME
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertTitleField FN_INSERT_FLD_TITLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertTopicField FN_INSERT_FLD_TOPIC
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem JumpDownThisLevel FN_NUM_BULLET_NEXT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem JumpToEndOfDoc FN_END_DOC_DIRECT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem JumpToFooter FN_TO_FOOTER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem JumpToFootnoteOrAnchor FN_FOOTNOTE_TO_ANCHOR
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem JumpToHeader FN_TO_HEADER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToNextBookmark FN_NEXT_BOOKMARK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToNextFootnote FN_NEXT_FOOTNOTE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToNextFrame FN_CNTNT_TO_NEXT_FRAME
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToNextRegion FN_GOTO_NEXT_REGION
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToNextTable FN_NEXT_TABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToPrevBookmark FN_PREV_BOOKMARK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToPrevFootnote FN_PREV_FOOTNOTE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToPrevRegion FN_GOTO_PREV_REGION
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToPrevTable FN_PREV_TABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem JumpToReference FN_GOTO_REFERENCE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem JumpToStartOfDoc FN_START_DOC_DIRECT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem JumpUpThisLevel FN_NUM_BULLET_PREV
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LineDownSel FN_LINE_DOWN_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LineNumberingDialog FN_LINE_NUMBERING_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LineUpSel FN_LINE_UP_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LinkDialog FN_EDIT_LINK_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LoadStyles SID_TEMPLATE_LOAD
+(SfxStringItem FileName SID_TEMPLATE_NAME,SfxInt32Item Flags SID_TEMPLATE_LOAD)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Marks FN_VIEW_MARKS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MergeCells FN_TABLE_MERGE_CELLS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MergeDialog FN_QRY_MERGE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem MailMergeWizard FN_MAILMERGE_WIZARD
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+//--------------------------------------------------------------------------
+SfxBoolItem MergeTable FN_TABLE_MERGE_TABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem ApplyStyleHead1 FN_FORMAT_APPLY_HEAD1
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem ApplyStyleHead2 FN_FORMAT_APPLY_HEAD2
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem ApplyStyleHead3 FN_FORMAT_APPLY_HEAD3
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem ApplyStyleDefault FN_FORMAT_APPLY_DEFAULT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem ApplyStyleTextbody FN_FORMAT_APPLY_TEXTBODY
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxBoolItem MirrorGraphicOnEvenPages FN_GRAPHIC_MIRROR_ON_EVEN_PAGES
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem MirrorOnEvenPages FN_FRAME_MIRROR_ON_EVEN_PAGES
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MoveDown FN_NUM_BULLET_MOVEDOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MoveDownSubItems FN_NUM_BULLET_OUTLINE_MOVEDOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MoveUp FN_NUM_BULLET_MOVEUP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MoveUpSubItems FN_NUM_BULLET_OUTLINE_MOVEUP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//-#i68101#------------------------------------------------------------------------
+SfxVoidItem ObjectTitleDescription FN_TITLE_DESCRIPTION_SHAPE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NameGroup FN_NAME_SHAPE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem NewGlobalDoc FN_NEW_GLOBAL_DOC
+(SfxStringItem FileName FN_NEW_GLOBAL_DOC,SfxStringItem TemplateName SID_TEMPLATE_NAME)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_APPLICATION;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem NewHtmlDoc FN_NEW_HTML_DOC
+(SfxStringItem FileName FN_NEW_HTML_DOC,SfxStringItem TemplateName SID_TEMPLATE_NAME)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_APPLICATION;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem NumberFormat FN_NUMBER_FORMAT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NumberFormatCurrency FN_NUMBER_CURRENCY
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NumberFormatDate FN_NUMBER_DATE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NumberFormatDecimal FN_NUMBER_TWODEC
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NumberFormatPercent FN_NUMBER_PERCENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NumberFormatScientific FN_NUMBER_SCIENTIFIC
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NumberFormatStandard FN_NUMBER_STANDARD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NumberFormatTime FN_NUMBER_TIME
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem NumberingStart FN_NUMBER_NEWSTART
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem NumberOrNoNumber FN_NUM_OR_NONUM
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ObjectBackOne FN_FRAME_DOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ObjectForwardOne FN_FRAME_UP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem OnlineAutoFormat FN_AUTOFORMAT_AUTO
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item OptimizeTable FN_OPTIMIZE_TABLE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageColumnDialog FN_FORMAT_PAGE_COLUMN_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageDialog FN_FORMAT_PAGE_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageDown FN_PAGEDOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageDownSel FN_PAGEDOWN_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item PageOffset FN_CHANGE_PAGENUM
+[
+ SfxVoidItem PageOffsetDialog(SfxUInt16Item nOffset FN_CHANGE_PAGENUM);
+
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageStyleApply FN_SET_PAGE_STYLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem PageStyleName FN_STAT_TEMPLATE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = TRUE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageUp FN_PAGEUP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PageUpSel FN_PAGEUP_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PreviewZoom FN_PREVIEW_ZOOM
+( SfxUInt16Item PreviewZoom FN_PREVIEW_ZOOM )
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxUInt16Item
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem PrintLayout FN_PRINT_LAYOUT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PrintPagePreView FN_PRINT_PAGEPREVIEW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Protect FN_TABLE_SET_READ_ONLY_CELLS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ProtectTraceChangeMode FN_REDLINE_PROTECT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RefreshView FN_REFRESH_VIEW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RemoveBullets FN_NUM_BULLET_OFF
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RemoveTableOf FN_REMOVE_CUR_TOX
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Repaginate FN_REPAGINATE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem RepeatSearch FN_REPEAT_SEARCH
+( SfxBoolItem Quiet SID_SEARCH_QUIET )
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ResetAttributes FN_FORMAT_RESET
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ResetTableProtection FN_TABLE_UNSET_READ_ONLY
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Ruler FN_RULER
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = TRUE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SbaInsert FN_QRY_INSERT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SbaInsertField FN_QRY_INSERT_FIELD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SbaMerge FN_QRY_MERGE_FIELD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ScrollNavigation FN_SCROLL_NAVIGATION
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ScrollNextPrev FN_SCROLL_NEXT_PREV
+( SfxBoolItem ScrollNextPrev FN_SCROLL_NEXT_PREV )
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SelectTable FN_TABLE_SELECT_ALL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item SelectionMode FN_STAT_SELMODE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SelectText FN_SELECT_PARA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SelectWord FN_SELECT_WORD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SendAbstractToStarImpress FN_ABSTRACT_STARIMPRESS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SendOutlineToClipboard FN_OUTLINE_TO_CLIPBOARD
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SendOutlineToStarImpress FN_OUTLINE_TO_IMPRESS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetAnchorAtChar FN_TOOL_ANKER_AT_CHAR
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetAnchorToChar FN_TOOL_ANKER_CHAR
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetAnchorToFrame FN_TOOL_ANKER_FRAME
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetAnchorToPage FN_TOOL_ANKER_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetAnchorToPara FN_TOOL_ANKER_PARAGRAPH
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetColumnWidth FN_TABLE_SET_COL_WIDTH
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetExtSelection FN_SET_EXT_MODE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetMultiSelection FN_SET_ADD_MODE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetOptimalColumnWidth FN_TABLE_ADJUST_CELLS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetOptimalRowHeight FN_TABLE_OPTIMAL_HEIGHT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetRowHeight FN_TABLE_SET_ROW_HEIGHT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShadowCursor FN_SHADOWCURSOR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ShiftBackspace FN_SHIFT_BACKSPACE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ShowMultiplePages FN_SHOW_MULTIPLE_PAGES
+( SfxUInt16Item Columns SID_ATTR_TABLE_COLUMN,SfxUInt16Item Rows SID_ATTR_TABLE_ROW )
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxUInt16Item
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+SfxBoolItem ShowAnnotations FN_VIEW_NOTES
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowHiddenParagraphs FN_VIEW_HIDDEN_PARA
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowTrackedChanges FN_REDLINE_SHOW
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ShowTwoPages FN_SHOW_TWO_PAGES
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowBookview FN_SHOW_BOOKVIEW
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Shrink FN_SHRINK_FONT_SIZE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SortDialog FN_SORTING_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SplitCell FN_TABLE_SPLIT_CELLS
+(SfxInt32Item Amount FN_TABLE_SPLIT_CELLS,SfxBoolItem Horizontal FN_PARAM_1,
+ SfxBoolItem Proportional FN_PARAM_2)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SplitTable FN_TABLE_SPLIT_TABLE
+(SfxUInt16Item Type FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem StartAutoCorrect FN_AUTO_CORRECT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem StartOfDocumentSel FN_START_OF_DOCUMENT_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem StartOfLineSel FN_START_OF_LINE_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem StartOfParaSel FN_START_OF_PARA_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem StateBookmark FN_STAT_BOOKMARK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INTERN;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem StatePageNumber FN_STAT_PAGE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem StateZoom FN_STAT_ZOOM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SubScript FN_SET_SUB_SCRIPT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SuperScript FN_SET_SUPER_SCRIPT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SwBrwInsert FN_SBA_BRW_INSERT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SwMailMerge FN_SBA_BRW_MERGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SwUpdate FN_SBA_BRW_UPDATE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SynchronizeLabelsDlg FN_SYNC_LABELS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TableBoundaries FN_VIEW_TABLEGRID
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TableDialog FN_FORMAT_TABLE_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TableModeFix FN_TABLE_MODE_FIX
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TableModeFixProp FN_TABLE_MODE_FIX_PROP
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TableModeVariable FN_TABLE_MODE_VARIABLE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TableNumberFormatDialog FN_NUM_FORMAT_TABLE_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TableNumberRecognition FN_SET_MODOPT_TBLNUMFMT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TextAttributes FN_DRAWTEXT_ATTR_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TextWrap FN_DRAW_WRAP_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ToggleAnchorType FN_TOOL_ANKER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxUInt16Item
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ToggleObjectLayer FN_TOOL_HIERARCHIE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem UnderlineDouble FN_UNDERLINE_DOUBLE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem UnhainFrames FN_FRAME_UNCHAIN
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem UnsetCellsReadOnly FN_TABLE_UNSET_READ_ONLY_CELLS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem UpdateAll FN_UPDATE_ALL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem UpdateAllIndexes FN_UPDATE_TOX
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem UpdateAllLinks FN_UPDATE_ALL_LINKS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem UpdateCharts FN_UPDATE_CHARTS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem UpdateCurIndex FN_UPDATE_CUR_TOX
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem UpdateFields FN_UPDATE_FIELDS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem UpdateInputFields FN_UPDATE_INPUTFIELDS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ViewBounds FN_VIEW_BOUNDS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem VRuler FN_VLINEAL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem VScroll FN_VSCROLLBAR
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem WordLeftSel FN_PREV_WORD_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem WordRightSel FN_NEXT_WORD_SEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem WrapAnchorOnly FN_WRAP_ANCHOR_ONLY
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem WrapContour FN_FRAME_WRAP_CONTOUR
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem WrapIdeal FN_FRAME_WRAP_IDEAL
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem WrapLeft FN_FRAME_WRAP_LEFT
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem WrapOff FN_FRAME_NOWRAP
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem WrapOn FN_FRAME_WRAP
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem WrapRight FN_FRAME_WRAP_RIGHT
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem WrapThrough FN_FRAME_WRAPTHRU
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem WrapThroughTransparent FN_FRAME_WRAPTHRU_TRANSP
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertText FN_INSERT_STRING
+(SfxStringItem Text FN_INSERT_STRING)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SwNumRuleItem NumRule SID_ATTR_PARA_NUMRULE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//#outline level,add by zhaojianwei
+//---------------------------------------------------------------------------
+SfxUInt16Item OutlineLevel SID_ATTR_PARA_OUTLINE_LEVEL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+//<-end,zhaojianwei
+//--------------------------------------------------------------------------
+SfxUInt16Item NumNewStartAt FN_NUMBER_NEWSTART_AT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SwFmtLineNumber LineNumber FN_FORMAT_LINENUMBER
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item PageNumber SID_ATTR_PARA_PAGENUM
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SwRegisterItem RegisterTrue SID_ATTR_PARA_REGISTER
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem JumpToFootnoteArea FN_TO_FOOTNOTE_AREA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SwFmtINetFmt HyperlinkAttributes FN_TXTATR_INET
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertGlossary FN_INSERT_GLOSSARY
+(SfxStringItem Group FN_INSERT_GLOSSARY,SfxStringItem ShortName FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NewGlossary FN_NEW_GLOSSARY
+(SfxStringItem Group FN_NEW_GLOSSARY,SfxStringItem Name FN_PARAM_1,SfxStringItem ShortName FN_PARAM_2)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetActGlossaryGroup FN_SET_ACT_GLOSSARY
+(SfxStringItem Group FN_SET_ACT_GLOSSARY)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DeleteBookmark FN_DELETE_BOOKMARK
+(SfxStringItem Bookmark FN_DELETE_BOOKMARK)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetDropCapText FN_DROP_TEXT
+(SfxStringItem DropCapText FN_DROP_TEXT)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetDropCapCharStyleName FN_DROP_CHAR_STYLE_NAME
+(SfxStringItem CharStyleName FN_DROP_CHAR_STYLE_NAME)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SelectTextMode FN_READONLY_SELECTION_MODE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertDBField FN_INSERT_DBFIELD
+(SfxUInt16Item Type FN_PARAM_FIELD_TYPE,SfxStringItem DBName FN_INSERT_DBFIELD,SfxStringItem Command FN_PARAM_1,SfxStringItem ColumnName FN_PARAM_2,SfxInt32Item CommandType FN_PARAM_3,SfxStringItem Content FN_PARAM_FIELD_CONTENT,SfxUInt32Item Format FN_PARAM_FIELD_FORMAT)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToNextCell FN_GOTO_NEXT_CELL
+(SfxBoolItem AppendLineInReadonlyFlag FN_GOTO_NEXT_CELL)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+//--------------------------------------------------------------------------
+SfxBoolItem JumpToPrevCell FN_GOTO_PREV_CELL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_NAVIGATOR;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertFieldDataOnly FN_INSERT_FIELD_DATA_ONLY()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+//--------------------------------------------------------------------------
+SvxBrushItem TableRowBackground SID_ATTR_BRUSH_ROW
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SvxBrushItem TableBackground SID_ATTR_BRUSH_TABLE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxBoolItem RowSplit FN_TABLE_ROW_SPLIT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxBoolItem MailmergeChildWindow FN_MAILMERGE_CHILDWINDOW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem WordCountDialog FN_WORDCOUNT_DIALOG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SendMailChildWindow FN_MAILMERGE_SENDMAIL_CHILDWINDOW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem DeleteTable FN_TABLE_DELETE_TABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EntireCell FN_TABLE_SELECT_CELL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem ConvertTableToText FN_CONVERT_TABLE_TO_TEXT
+(
+ SfxStringItem Delimiter FN_PARAM_1,
+)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem ConvertTextToTable FN_CONVERT_TEXT_TO_TABLE
+(
+ SfxStringItem Delimiter FN_PARAM_1
+ SfxStringItem AutoFormat FN_PARAM_2,
+ SfxBoolItem WithHeader FN_PARAM_3,
+ SfxInt16Item RepeatHeaderLines FN_PARAM_4,
+ SfxBoolItem WithBorder FN_PARAM_5,
+ SfxBoolItem DontSplitTable FN_PARAM_6
+)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+//--------------------------------------------------------------------------
+
+SfxVoidItem HeadingRowsRepeat FN_TABLE_HEADLINE_REPEAT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem TableSort FN_TABLE_SORT_DIALOG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+// #i31958#: toggle design mode for XForms; copied from SID_FM_DESIGN_MODE
+SfxBoolItem SwitchXFormsDesignMode FN_XFORMS_DESIGN_MODE
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RemoveDirectCharFormats FN_REMOVE_DIRECT_CHAR_FORMATS
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = TRUE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem ContinueNumbering FN_NUM_CONTINUE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+//--------------------------------------------------------------------------
+SfxBoolItem SelectionModeDefault FN_SELECTION_MODE_DEFAULT
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+SfxVoidItem ReplyComment FN_REPLY
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DeleteComment FN_DELETE_COMMENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DeleteAuthor FN_DELETE_NOTE_AUTHOR ( SfxStringItem Author FN_DELETE_NOTE_AUTHOR )
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DeleteAllNotes FN_DELETE_ALL_NOTES
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem HideNote FN_HIDE_NOTE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem HideAuthor FN_HIDE_NOTE_AUTHOR ( SfxStringItem Author FN_HIDE_NOTE_AUTHOR )
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SvxViewLayoutItem ViewLayout SID_ATTR_VIEWLAYOUT
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem HideAllNotes FN_HIDE_ALL_NOTES
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SelectionModeBlock FN_SELECTION_MODE_BLOCK
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+//--------------------------------------------------------------------------
+SfxBoolItem SpellingAndGrammarDialog FN_SPELL_GRAMMAR_DIALOG
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem AcceptTracedChange FN_REDLINE_ACCEPT_DIRECT
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RejectTracedChange FN_REDLINE_REJECT_DIRECT
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RemoveHyperlink FN_REMOVE_HYPERLINK
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CopyHyperlinkLocation FN_COPY_HYPERLINK_LOCATION
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
diff --git a/sw/sdi/swslots.hrc b/sw/sdi/swslots.hrc
new file mode 100644
index 000000000000..c4be8f9559fc
--- /dev/null
+++ b/sw/sdi/swslots.hrc
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <editeng/memberids.hrc>
+#include <editeng/editids.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include "globals.hrc"
+#include "cmdid.h"
+
diff --git a/sw/sdi/swslots.sdi b/sw/sdi/swslots.sdi
new file mode 100644
index 000000000000..0b59ebb0c211
--- /dev/null
+++ b/sw/sdi/swslots.sdi
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+module
+"9F76B581-23DD-101C-80B6-000024021835"
+"A1810F00-23DE-101C-80B6-000024021835"
+StarWriter
+[
+HelpText( "StarWriter Application" )
+SlotIdFile( "swslots.hrc" )
+ModulePrefix( "Sw" )
+]
+{
+ include "sfx2/sfxitems.sdi"
+ include "sfx2/sfx.sdi"
+ include "svx/svxitems.sdi"
+ include "svx/xoitems.sdi"
+ include "svx/svx.sdi"
+
+ item String TbxDummyItem;
+/*
+ item String XFillAttrSetItem;
+ item String XFillBitmapItem;
+ item String XFillColorItem;
+ item String XFillGradientItem;
+ item String XFillHatchItem;
+ item String XFillStyleItem;
+ item String XLineAttrSetItem;
+ item String XLineColorItem;
+ item String XLineDashItem;
+ item String XLineEndItem;
+ item String XLineEndWidthItem;
+ item String XLineEndCenterItem;
+ item String XLineStartItem;
+ item String XLineStartWidthItem;
+ item String XLineStartCenterItem;
+ item String XLineStyleItem;
+ item String XLineWidthItem;
+*/
+ include "switems.sdi"
+ include "swriter.sdi"
+
+ include "_docsh.sdi"
+ include "docsh.sdi"
+ include "wdocsh.sdi"
+
+ include "wrtapp.sdi"
+
+ include "_basesh.sdi"
+ include "basesh.sdi"
+
+ include "_textsh.sdi"
+ include "textsh.sdi"
+ include "wtextsh.sdi"
+
+ include "_drwbase.sdi"
+ include "drwbassh.sdi"
+ include "wdrwbase.sdi"
+
+ include "_formsh.sdi"
+ include "formsh.sdi"
+ include "wformsh.sdi"
+
+ include "drawsh.sdi"
+ include "drwtxtsh.sdi"
+
+ include "_listsh.sdi"
+ include "listsh.sdi"
+ include "wlistsh.sdi"
+
+ include "_frmsh.sdi"
+ include "frmsh.sdi"
+ include "wfrmsh.sdi"
+
+ include "_tabsh.sdi"
+ include "tabsh.sdi"
+ include "wtabsh.sdi"
+
+ include "_grfsh.sdi"
+ include "grfsh.sdi"
+ include "wgrfsh.sdi"
+
+ include "_olesh.sdi"
+ include "olesh.sdi"
+ include "wolesh.sdi"
+
+ include "beziersh.sdi"
+
+ include "_viewsh.sdi"
+ include "viewsh.sdi"
+ include "wviewsh.sdi"
+
+ include "_mediash.sdi"
+ include "mediash.sdi"
+
+ include "_annotsh.sdi"
+ include "annotsh.sdi"
+
+}
+
+
diff --git a/sw/sdi/tabsh.sdi b/sw/sdi/tabsh.sdi
new file mode 100644
index 000000000000..3e112a9ff11f
--- /dev/null
+++ b/sw/sdi/tabsh.sdi
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface TextTable : BaseTextTable
+[
+ uuid = "49CE7CA0-111A-101D-9757-6E74207A7520"
+]
+{
+ // hier sollen die Slots eingefuegt werden, die vom StarWriter/WEB
+ // nicht unterstuetzt werden
+
+ import TextSelection;
+
+ FN_TABLE_SET_READ_ONLY_CELLS // status(final|play)
+ [
+ ExecMethod = Execute;
+ StateMethod = NoState;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+/*
+ SvxFmtSplitItem TableSplit SID_ATTR_PARA_SPLIT // status(final|play)
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ GroupId = GID_TABLE ;
+ ]
+ SvxFmtKeepItem TableKeepTogether SID_ATTR_PARA_KEEP // status(final|play)
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ GroupId = GID_TABLE ;
+ ]
+*/
+}
+
+ //=========================================================================
+
+shell SwTableShell : SwBaseShell
+
+{
+ import TextTable[Automation];
+}
+
diff --git a/sw/sdi/textsh.sdi b/sw/sdi/textsh.sdi
new file mode 100644
index 000000000000..cd321d95d1bf
--- /dev/null
+++ b/sw/sdi/textsh.sdi
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface Text : BaseText
+[
+ uuid = "1BD56200-111A-101D-9757-6E74207A7520"
+]
+{
+ FN_INSERT_FRAME_INTERACT // status()
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Cachable ;
+ ]
+ // hier sollen die Slots eingefuegt werden, die vom StarWriter/WEB
+ // nicht unterstuetzt werden
+
+ import TextSelection;
+
+ /*-----------------24.01.97 08.13-------------------
+ Spezielle Feldbefehle
+--------------------------------------------------*/
+
+ FN_INSERT_FLD_TOPIC
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ReadOnlyDoc = FALSE ;
+ ]
+ /*-----------------24.01.97 08.13-------------------
+ Ende Spezielle Feldbefehle
+--------------------------------------------------*/
+
+ /*-----------------24.01.97 07.36-------------------
+ Verzeichnisse
+--------------------------------------------------*/
+
+ /*
+enum TOXTypes
+{
+ TOX_INDEX,
+ TOX_USER,
+ TOX_CONTENT
+};
+
+ */
+
+ FN_INSERT_IDX_ENTRY_DLG // status(final|play)
+ [
+ ExecMethod = ExecIdx ;
+ StateMethod = GetIdxState ;
+ ]
+
+ FN_INSERT_AUTH_ENTRY_DLG
+ [
+ ExecMethod = ExecIdx ;
+ StateMethod = GetIdxState ;
+ ]
+ FN_EDIT_AUTH_ENTRY_DLG
+ [
+ ExecMethod = ExecIdx ;
+ StateMethod = GetIdxState ;
+ ]
+ FN_EDIT_IDX_ENTRY_DLG // status(final|play)
+ [
+ ExecMethod = ExecIdx ;
+ StateMethod = GetIdxState ;
+ ]
+ FN_INSERT_MULTI_TOX // status(final|play)
+ [
+ ExecMethod = ExecIdx ;
+ StateMethod = GetIdxState ;
+ ]
+ FN_REMOVE_CUR_TOX
+ [
+ ExecMethod = ExecIdx ;
+ StateMethod = GetIdxState ;
+ ]
+ FN_IDX_MARK_TO_IDX // status(final|play)
+ [
+ ExecMethod = ExecIdx ;
+ ]
+
+ /*-----------------24.01.97 08.01-------------------
+ Absatzeinstellungen
+--------------------------------------------------*/
+
+ /*-----------------24.01.97 08.01-------------------
+ Ende Absatzeinstellungen
+--------------------------------------------------*/
+
+}
+
+shell SwTextShell : SwBaseShell
+{
+ import Text[Automation];
+}
+
diff --git a/sw/sdi/viewsh.sdi b/sw/sdi/viewsh.sdi
new file mode 100644
index 000000000000..1005c96040a1
--- /dev/null
+++ b/sw/sdi/viewsh.sdi
@@ -0,0 +1,326 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface TextInTable
+[ uuid = "63C33940-69D8-101D-9757-C667E8298000" ]
+{
+ import Text;
+ import TextTable;
+}
+
+interface ListInTable
+[ uuid="7F1A6E20-69D8-101D-9757-C667E8298000" ]
+{
+ import Text;
+ import TextList;
+ import TextTable;
+}
+
+interface ListInText
+[ uuid = "8A4C07E0-69D8-101D-9757-C667E8298000"]
+{
+ import TextList;
+ import Text;
+}
+
+interface TextEditView : BaseTextEditView
+[
+ uuid = "09782660-111A-101D-9757-6E74207A7520"
+]
+{
+ // Slots, die nicht in der WebDocShell gebraucht werden
+ FN_INSERT_OBJ_CTRL
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Export = FALSE ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_INSERT_CAPTION // status()
+ [
+ ExecMethod = ExecDlgExt ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_EDIT_FOOTNOTE // status(final|play)
+ [
+ ExecMethod = ExecDlgExt ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_HYPHENATE_OPT_DLG // status(final|play)
+ [
+ ExecMethod = ExecLingu ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_CHANGE_PAGENUM // status(final)
+ [
+ ExecMethod = ExecDlg ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_INSERT_DRAW // status()
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ ]
+ SID_FONTWORK_GALLERY_FLOATER
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ ]
+ SID_DRAWTBX_CS_BASIC
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ ]
+ SID_DRAWTBX_CS_SYMBOL
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ ]
+ SID_DRAWTBX_CS_ARROW
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ ]
+ SID_DRAWTBX_CS_FLOWCHART
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ ]
+ SID_DRAWTBX_CS_CALLOUT
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ ]
+ SID_DRAWTBX_CS_STAR
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ ]
+ SID_DRAW_CS_ID
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ ]
+ SID_FM_CREATE_CONTROL // status()
+ [
+ ExecMethod = ExecDraw ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ SID_FM_CREATE_FIELDCONTROL
+ [
+ ExecMethod = ExecDraw ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+ //=========================================================================
+
+shell SwView
+
+{
+ import TextEditView [Automation];
+// import TextPage "Page";
+// import SearchSettings;
+// import SearchAttributes;
+// import ReplaceAttributes;
+}
+
+interface TextPrintPreview
+[ uuid = "1622A480-111A-101D-9757-6E74207A7520" ]
+{
+ SID_BROWSER_MODE
+ [
+ StateMethod = GetState;
+ ]
+ FN_PRINT_LAYOUT
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+ FN_REFRESH_VIEW // status(final|play)
+ [
+ StateMethod = GetState ;
+ ]
+ FN_CHAR_LEFT // status(final|play)
+ [
+ ExecMethod = Execute;
+ StateMethod = NoState ;
+ ]
+ FN_CHAR_RIGHT // status(final|play)
+ [
+ ExecMethod = Execute;
+ StateMethod = NoState ;
+ ]
+ FN_LINE_UP // status(final|play)
+ [
+ ExecMethod = Execute;
+ StateMethod = NoState ;
+ ]
+ FN_LINE_DOWN // status(final|play)
+ [
+ ExecMethod = Execute;
+ StateMethod = NoState ;
+ ]
+ FN_PAGEUP // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_PAGEDOWN // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_START_OF_DOCUMENT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_END_OF_DOCUMENT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_SHOW_TWO_PAGES // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_SHOW_MULTIPLE_PAGES // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_SHOW_BOOKVIEW // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_PRINT_PAGEPREVIEW // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_PRINTDOC // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_PRINTDOCDIRECT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_PRINTPREVIEW // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_CLOSE_PAGEPREVIEW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ZOOM_IN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ZOOM_OUT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_PREVIEW_ZOOM
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_UNDO // status()
+ [
+ StateMethod = StateUndo ;
+ ]
+ SID_REDO // status()
+ [
+ StateMethod = StateUndo ;
+ ]
+ SID_REPEAT // status()
+ [
+ StateMethod = StateUndo ;
+ ]
+ //---------------------------------------------------------------------
+ //Ab hier Statusleiste
+ FN_STAT_ZOOM // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ATTR_ZOOM // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_STAT_PAGE // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_START_OF_LINE // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_END_OF_LINE // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_INSERT_BREAK // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ATTR_ZOOMSLIDER // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ //----------------------------------------------
+ //End mit Statusleiste
+}
+
+ //=========================================================================
+
+shell SwPagePreView
+{
+ import TextPrintPreview[Automation];
+}
+
+
diff --git a/sw/sdi/wbasesh.sdi b/sw/sdi/wbasesh.sdi
new file mode 100644
index 000000000000..59328cb69dd7
--- /dev/null
+++ b/sw/sdi/wbasesh.sdi
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface WebSelection : BaseTextSelection
+[
+ Automation = FALSE;
+]
+{
+ // hier kommt nur dann etwas hinein, wenn es im
+ // kompletten StarWriter nicht benoetigt wird
+}
+
+shell SwWebBaseShell
+{
+ import WebSelection[Automation];
+ import Interior "Interior";
+ import Shadow "Shadow";
+
+}
+
diff --git a/sw/sdi/wbeziers.sdi b/sw/sdi/wbeziers.sdi
new file mode 100644
index 000000000000..41eeadb6b9e0
--- /dev/null
+++ b/sw/sdi/wbeziers.sdi
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface Bezier : _Bezier
+[ uuid = "68EF7EA0-6876-11D0-A887-008029E86826" ]
+{
+}
+
+shell SwBezierShell: SwBaseShell
+{
+ import Bezier[Automation];
+}
+
+
diff --git a/sw/sdi/wdocsh.sdi b/sw/sdi/wdocsh.sdi
new file mode 100644
index 000000000000..df1b60ecbc62
--- /dev/null
+++ b/sw/sdi/wdocsh.sdi
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface WebDocument : BaseTextDocument
+[
+ uuid = "B47F0DE4-1E1F-11d1-89CA-008029E4B0B1"
+]
+{
+ // hier nur Slots, die der vollstaendige Writer nicht braucht
+ SID_SOURCEVIEW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Asynchron = TRUE;
+ ]
+
+ SID_HTML_MODE
+ [
+ StateMethod = GetState ;
+ ]
+}
+
+shell SwWebDocShell
+{
+ import WebDocument[Automation];
+}
+
+shell SwWebGlosDocShell : SwWebDocShell
+{
+ SID_SAVEDOC // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+}
+
diff --git a/sw/sdi/wdrwbase.sdi b/sw/sdi/wdrwbase.sdi
new file mode 100644
index 000000000000..990475298c0a
--- /dev/null
+++ b/sw/sdi/wdrwbase.sdi
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface WebDrawBase : BaseTextDrawBase
+[
+ Automation = FALSE;
+]
+{
+ import BaseTextSelection;
+}
+
+
+shell SwWebDrawBaseShell: SwBaseShell
+{
+ import WebDrawBase[Automation];
+
+ SID_OBJECT_ALIGN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
+
diff --git a/sw/sdi/wformsh.sdi b/sw/sdi/wformsh.sdi
new file mode 100644
index 000000000000..497008033eba
--- /dev/null
+++ b/sw/sdi/wformsh.sdi
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+interface WebDrawForm: BaseTextDrawForm
+[
+ uuid = "4bac4490-fede-11d1-abff-006097b418c2"
+]
+{
+ import WebDrawBase;
+}
+
+shell SwWebDrawFormShell : SwWebDrawBaseShell
+{
+ import WebDrawForm[Automation];
+}
+
+
diff --git a/sw/sdi/wfrmsh.sdi b/sw/sdi/wfrmsh.sdi
new file mode 100644
index 000000000000..b5d87c8cfc4b
--- /dev/null
+++ b/sw/sdi/wfrmsh.sdi
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface WebFrame : BaseTextFrame
+[
+ uuid = "B47F0DE6-1E1F-11d1-89CA-008029E4B0B1"
+]
+{
+ import BaseTextSelection;
+}
+
+
+ //=========================================================================
+
+shell SwWebFrameShell : SwBaseShell
+{
+ import WebFrame[Automation];
+}
+
+
diff --git a/sw/sdi/wgrfsh.sdi b/sw/sdi/wgrfsh.sdi
new file mode 100644
index 000000000000..19384e7983e2
--- /dev/null
+++ b/sw/sdi/wgrfsh.sdi
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface WebGraphic : BaseTextGraphic
+[
+ uuid = "B47F0DEB-1E1F-11d1-89CA-008029E4B0B1"
+]
+{
+}
+
+
+ //=========================================================================
+
+shell SwWebGrfShell : SwBaseShell
+{
+ import WebGraphic[Automation];
+}
+
+
diff --git a/sw/sdi/wlistsh.sdi b/sw/sdi/wlistsh.sdi
new file mode 100644
index 000000000000..a6777b9c01ee
--- /dev/null
+++ b/sw/sdi/wlistsh.sdi
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+interface WebList : BaseTextList
+[
+ uuid = "B47F0DE3-1E1F-11d1-89CA-008029E4B0B1"
+]
+{
+ import TextSelection;
+}
+
+ //=========================================================================
+
+shell SwWebListShell : SwBaseShell
+{
+ import WebList[Automation];
+}
+
diff --git a/sw/sdi/wolesh.sdi b/sw/sdi/wolesh.sdi
new file mode 100644
index 000000000000..29497a61a407
--- /dev/null
+++ b/sw/sdi/wolesh.sdi
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+interface WebOLEObject : BaseTextOLEObject
+[
+ uuid = "B47F0DE2-1E1F-11d1-89CA-008029E4B0B1"
+]
+{
+ import WebFrame;
+}
+
+
+ //=========================================================================
+
+shell SwWebOleShell : SwWebFrameShell
+{
+ import WebOLEObject[Automation];
+}
+
+
diff --git a/sw/sdi/wrtapp.sdi b/sw/sdi/wrtapp.sdi
new file mode 100644
index 000000000000..9786eb38daf1
--- /dev/null
+++ b/sw/sdi/wrtapp.sdi
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+interface StarWriter
+[
+ uuid ( "4BF0AA20-E6B9-101C-8A0E-040224007802" )
+]
+{
+ FN_ENVELOP // status(final|play)
+ [
+ ExecMethod = ExecOther ;
+ StateMethod = StateOther ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+
+ FN_LABEL // status(final|play)
+ [
+ ExecMethod = ExecOther ;
+ StateMethod = StateOther ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+
+ FN_BUSINESS_CARD // status()
+ [
+ ExecMethod = ExecOther ;
+ StateMethod = StateOther ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+
+ FN_XFORMS_INIT // #i31958#
+ [
+ ExecMethod = ExecOther ;
+ StateMethod = StateOther ;
+ DisableFlags="SW_DISABLE_ON_MAILBOX_EDITOR";
+ ]
+
+ SID_ATTR_METRIC // status(final|play)
+ [
+ ExecMethod = ExecOther ;
+ StateMethod = StateOther ;
+ ]
+ SID_ATTR_UNDO_COUNT // ole(no) api(final/play)
+ [
+ ExecMethod = ExecOther ;
+ StateMethod = StateOther ;
+ ]
+
+ FN_MAILMERGE_WIZARD
+ [
+ ExecMethod = ExecOther ;
+ ]
+
+ FN_SET_MODOPT_TBLNUMFMT // status()
+ [
+ ExecMethod = ExecOther ;
+ StateMethod = StateOther ;
+ ]
+
+} //end interface Application
+
+shell SwModule
+{
+ import StarWriter[Automation];
+}
+
diff --git a/sw/sdi/wtabsh.sdi b/sw/sdi/wtabsh.sdi
new file mode 100644
index 000000000000..ee2ae7503e9f
--- /dev/null
+++ b/sw/sdi/wtabsh.sdi
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface WebTable : BaseTextTable
+[ uuid = "B47F0DEC-1E1F-11d1-89CA-008029E4B0B1" ]
+{
+ import BaseTextSelection;
+}
+
+ //=========================================================================
+
+shell SwWebTableShell : SwBaseShell
+{
+ import WebTable[Automation];
+}
+
diff --git a/sw/sdi/wtextsh.sdi b/sw/sdi/wtextsh.sdi
new file mode 100644
index 000000000000..42d6a9e69cdd
--- /dev/null
+++ b/sw/sdi/wtextsh.sdi
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface WebText : BaseText
+[
+ uuid = "B47F0DE5-1E1F-11d1-89CA-008029E4B0B1";
+]
+{
+ FN_INSERT_FRAME_INTERACT_NOCOL
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = StateInsert ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ Cachable ;
+ ]
+ // hier sollen die Slots eingefuegt werden, die n u r vom StarWriter/WEB
+ // unterstuetzt werden
+ import TextSelection;
+}
+
+shell SwWebTextShell : SwBaseShell
+{
+ import WebText[Automation];
+}
+
diff --git a/sw/sdi/wviewsh.sdi b/sw/sdi/wviewsh.sdi
new file mode 100644
index 000000000000..9d0ebde9c800
--- /dev/null
+++ b/sw/sdi/wviewsh.sdi
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface WebTextInTable
+[ uuid = "B47F0DE7-1E1F-11d1-89CA-008029E4B0B1" ]
+{
+ import WebText;
+ import WebTable;
+}
+
+interface WebListInTable
+[ uuid="B47F0DE8-1E1F-11d1-89CA-008029E4B0B1" ]
+{
+ import WebText;
+ import WebList;
+ import WebTable;
+}
+
+interface WebListInText
+[ uuid = "B47F0DE9-1E1F-11d1-89CA-008029E4B0B1"]
+{
+ import WebList;
+ import WebText;
+}
+
+interface WebEditView : BaseTextEditView
+[
+ uuid = "B47F0DEA-1E1F-11d1-89CA-008029E4B0B1"
+]
+{
+ SID_DRAW_TEXT_MARQUEE // status()
+ [
+ ExecMethod = ExecDraw ;
+ StateMethod = GetDrawState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+}
+
+shell SwWebView
+{
+ import WebEditView [Automation];
+// import SearchSettings;
+// import TextPage "Page";
+// import SearchAttributes;
+// import ReplaceAttributes;
+
+}
+
+interface WebSourceView
+[ uuid = "95069CE0-69D8-101D-9757-C667E8298000"]
+{
+ SID_TABLE_CELL // status()
+ [
+ StateMethod = GetState ;
+ ]
+ SID_SAVEASDOC // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_SAVEDOC // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_PRINTDOC // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_PRINTDOCDIRECT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_SEARCH_OPTIONS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_SEARCH_ITEM
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ Export = FALSE;
+ ]
+ FID_SEARCH_NOW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ FN_REPEAT_SEARCH // status(final|play)
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState ;
+ ]
+ SID_UNDO // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_REDO // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_REPEAT // status()
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_CUT // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_COPY // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
+ SID_PASTE // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+
+ SID_SELECTALL // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = NoState ;
+ ]
+ SID_MAIL_SENDDOC
+ [
+ StateMethod = GetState ;
+ ]
+ SID_MAIL_SENDDOCASPDF
+ [
+ StateMethod = GetState ;
+ ]
+ SID_EXPORTDOC
+ [
+ StateMethod = GetState ;
+ ]
+ SID_EXPORTDOCASPDF
+ [
+ StateMethod = GetState ;
+ ]
+ SID_DIRECTEXPORTDOCASPDF
+ [
+ StateMethod = GetState ;
+ ]
+ SID_BROWSER_MODE
+ [
+ StateMethod = GetState;
+ ]
+ FN_PRINT_LAYOUT
+ [
+ StateMethod = GetState;
+ ]
+}
+
+shell SwSrcView
+
+{
+ import WebSourceView [Automation];
+}
+
+
+
+
diff --git a/sw/source/core/SwNumberTree/SwNodeNum.cxx b/sw/source/core/SwNumberTree/SwNodeNum.cxx
new file mode 100644
index 000000000000..cec279e73096
--- /dev/null
+++ b/sw/source/core/SwNumberTree/SwNodeNum.cxx
@@ -0,0 +1,534 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <editeng/svxenum.hxx>
+#include <numrule.hxx>
+#include <SwNodeNum.hxx>
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <stdio.h>
+// --> OD 2007-10-31 #i83479#
+#include <IDocumentListItems.hxx>
+// <--
+// --> OD 2010-01-13 #b6912256#
+//#include <svtools/svstdarr.hxx>
+#include <doc.hxx>
+// <--
+
+// --> OD 2008-02-19 #refactorlists#
+SwNodeNum::SwNodeNum( SwTxtNode* pTxtNode )
+ : SwNumberTreeNode(),
+ mpTxtNode( pTxtNode ),
+ mpNumRule( 0 )
+{
+}
+
+SwNodeNum::SwNodeNum( SwNumRule* pNumRule )
+ : SwNumberTreeNode(),
+ mpTxtNode( 0 ),
+ mpNumRule( pNumRule )
+{
+}
+// <--
+
+SwNodeNum::~SwNodeNum()
+{
+}
+
+SwTxtNode * SwNodeNum::GetTxtNode() const
+{
+ return mpTxtNode;
+}
+
+SwNumRule * SwNodeNum::GetNumRule() const
+{
+ return mpNumRule;
+}
+
+void SwNodeNum::ChangeNumRule( SwNumRule& rNumRule )
+{
+ ASSERT( GetNumRule() && GetTxtNode(),
+ "<SwNodeNum::ChangeNumRule(..)> - missing list style and/or text node. Serious defect -> please informm OD." );
+ if ( GetNumRule() && GetTxtNode() )
+ {
+ GetNumRule()->RemoveTxtNode( *(GetTxtNode()) );
+ }
+
+ mpNumRule = &rNumRule;
+
+ if ( GetNumRule() && GetTxtNode() )
+ {
+ GetNumRule()->AddTxtNode( *(GetTxtNode()) );
+ }
+}
+
+SwPosition SwNodeNum::GetPosition() const
+{
+ ASSERT( GetTxtNode(),
+ "<SwNodeNum::GetPosition()> - no text node set at <SwNodeNum> instance" );
+ return SwPosition(*mpTxtNode);
+}
+
+SwNumberTreeNode * SwNodeNum::Create() const
+{
+ // --> OD 2008-02-19 #refactorlists#
+// SwNodeNum * pResult = new SwNodeNum();
+// pResult->SetNumRule(mpNumRule);
+ SwNodeNum * pResult = new SwNodeNum( GetNumRule() );
+ // <--
+
+ return pResult;
+}
+
+// --> OD 2008-02-19 #refactorlists#
+void SwNodeNum::PreAdd()
+{
+ ASSERT( GetTxtNode(),
+ "<SwNodeNum::PreAdd()> - no text node set at <SwNodeNum> instance" );
+ if ( !GetNumRule() && GetTxtNode() )
+ {
+ mpNumRule = GetTxtNode()->GetNumRule();
+ }
+ ASSERT( GetNumRule(),
+ "<SwNodeNum::PreAdd()> - no list style set at <SwNodeNum> instance" );
+ if ( GetNumRule() && GetTxtNode() )
+ {
+ GetNumRule()->AddTxtNode( *(GetTxtNode()) );
+ }
+
+
+ {
+ if ( GetTxtNode() &&
+ GetTxtNode()->GetNodes().IsDocNodes() )
+ {
+ GetTxtNode()->getIDocumentListItems().addListItem( *this );
+ }
+ }
+}
+
+void SwNodeNum::PostRemove()
+{
+ ASSERT( GetTxtNode(),
+ "<SwNodeNum::PostRemove()> - no text node set at <SwNodeNum> instance" );
+ ASSERT( GetNumRule(),
+ "<SwNodeNum::PostRemove()> - no list style set at <SwNodeNum> instance" );
+
+ if ( GetTxtNode() )
+ {
+ GetTxtNode()->getIDocumentListItems().removeListItem( *this );
+ }
+
+ if ( GetNumRule() )
+ {
+ if ( GetTxtNode() )
+ {
+ GetNumRule()->RemoveTxtNode( *(GetTxtNode()) );
+ }
+ mpNumRule = 0;
+ }
+}
+// <--
+
+bool SwNodeNum::IsNotifiable() const
+{
+ bool aResult = true;
+
+ if ( GetTxtNode() )
+ aResult = GetTxtNode()->IsNotifiable();
+
+ return aResult;
+}
+
+bool SwNodeNum::IsNotificationEnabled() const
+{
+ bool aResult = true;
+
+ if ( GetTxtNode() )
+ aResult = GetTxtNode()->IsNotificationEnabled();
+
+ return aResult;
+}
+
+bool SwNodeNum::IsContinuous() const
+{
+ bool aResult = false;
+
+ // --> OD 2006-04-21 #i64311#
+ if ( GetNumRule() )
+ {
+ aResult = mpNumRule->IsContinusNum();
+ }
+ else if ( GetParent() )
+ {
+ aResult = GetParent()->IsContinuous();
+ }
+ else
+ {
+ ASSERT( false, "<SwNodeNum::IsContinuous()> - OD debug" );
+ }
+ // <--
+
+ return aResult;
+}
+
+bool SwNodeNum::IsCounted() const
+{
+ bool aResult = false;
+
+ if ( GetTxtNode() )
+ {
+ // --> OD 2006-01-25 #i59559#
+ // <SwTxtNode::IsCounted()> determines, if a text node is counted for numbering
+// const SwNumFmt * pNumFmt = GetNumFmt();
+// if (pNumFmt)
+// {
+// sal_Int16 nType = pNumFmt->GetNumberingType();
+// if ( nType != SVX_NUM_NUMBER_NONE)
+// aResult = mpTxtNode->IsCounted();
+// }
+ aResult = GetTxtNode()->IsCountedInList();
+ // <--
+ }
+ else
+ aResult = SwNumberTreeNode::IsCounted();
+
+ return aResult;
+}
+
+// --> OD 2006-04-26 #i64010#
+bool SwNodeNum::HasCountedChildren() const
+{
+ bool bResult = false;
+
+ tSwNumberTreeChildren::iterator aIt;
+
+ for (aIt = mChildren.begin(); aIt != mChildren.end(); aIt++)
+ {
+ SwNodeNum* pChild( dynamic_cast<SwNodeNum*>(*aIt) );
+ ASSERT( pChild,
+ "<SwNodeNum::HasCountedChildren()> - unexcepted type of child -> please inform OD" );
+ if ( pChild &&
+ ( pChild->IsCountedForNumbering() ||
+ pChild->HasCountedChildren() ) )
+ {
+ bResult = true;
+
+ break;
+ }
+ }
+
+ return bResult;
+}
+// <--
+// --> OD 2006-04-26 #i64010#
+bool SwNodeNum::IsCountedForNumbering() const
+{
+ return IsCounted() &&
+ ( IsPhantom() || // phantoms
+ !GetTxtNode() || // root node
+ GetTxtNode()->HasNumber() || // text node
+ GetTxtNode()->HasBullet() ); // text node
+}
+// <--
+
+
+void SwNodeNum::NotifyNode()
+{
+ ValidateMe();
+
+ if (mpTxtNode)
+ {
+ mpTxtNode->NumRuleChgd();
+ }
+}
+
+bool SwNodeNum::LessThan(const SwNumberTreeNode & rNode) const
+{
+ bool bResult = false;
+ const SwNodeNum & rTmpNode = static_cast<const SwNodeNum &>(rNode);
+
+ if (mpTxtNode == NULL && rTmpNode.mpTxtNode != NULL)
+ bResult = true;
+ else if (mpTxtNode != NULL && rTmpNode.mpTxtNode != NULL)
+ {
+ // --> OD 2007-10-31 #i83479# - refactoring
+ // simplify comparison by comparing the indexes of the text nodes
+// SwPosition aMyPos(*mpTxtNode);
+// SwPosition aHisPos(*rTmpNode.mpTxtNode);
+// bResult = (aMyPos < aHisPos) ? true : false;
+ bResult = ( mpTxtNode->GetIndex() < rTmpNode.mpTxtNode->GetIndex() ) ? true : false;
+ // <--
+ }
+
+ return bResult;
+}
+
+//void SwNodeNum::SetRestart(bool bRestart)
+//{
+// // --> OD 2005-10-19 #126009#
+// // - improvement: invalidation only, if <IsRestart()> state changes.
+// const bool bInvalidate( mbRestart != bRestart );
+// // <--
+// mbRestart = bRestart;
+
+// // --> OD 2005-10-19 #126009#
+// if ( bInvalidate )
+// {
+// InvalidateMe();
+// NotifyInvalidSiblings();
+// }
+// // <--
+//}
+
+// --> OD 2008-02-25 #refactorlists#
+bool SwNodeNum::IsRestart() const
+{
+ bool bIsRestart = false;
+
+ if ( GetTxtNode() )
+ {
+ bIsRestart = GetTxtNode()->IsListRestart();
+ }
+
+ return bIsRestart;
+}
+// <--
+
+//void SwNodeNum::SetStart(SwNumberTree::tSwNumTreeNumber nStart)
+//{
+// // --> OD 2005-10-19 #126009#
+// // - improvement: invalidation only, if <IsRestart()> state changes.
+// const bool bInvalidate( mnStart != nStart );
+// // <--
+// mnStart = nStart;
+
+// // --> OD 2005-10-19 #126009#
+// if ( bInvalidate )
+// {
+// InvalidateMe();
+// NotifyInvalidSiblings();
+// }
+//}
+
+bool SwNodeNum::IsCountPhantoms() const
+{
+ bool bResult = true;
+
+ // --> OD 2006-04-21 #i64311#
+ // phantoms aren't counted in consecutive numbering rules
+ if ( mpNumRule )
+ bResult = !mpNumRule->IsContinusNum() &&
+ mpNumRule->IsCountPhantoms();
+ else
+ {
+ ASSERT( false,
+ "<SwNodeNum::IsCountPhantoms(): missing numbering rule - please inform OD" );
+ }
+ // <--
+
+ return bResult;
+}
+
+// --> OD 2008-02-25 #refactorlists#
+SwNumberTree::tSwNumTreeNumber SwNodeNum::GetStartValue() const
+//SwNumberTree::tSwNumTreeNumber SwNodeNum::GetStart() const
+{
+ SwNumberTree::tSwNumTreeNumber aResult = 1;
+
+ if ( IsRestart() && GetTxtNode() )
+ {
+ aResult = GetTxtNode()->GetActualListStartValue();
+ }
+ else
+ {
+ SwNumRule * pRule = GetNumRule();
+
+ if (pRule)
+ {
+ int nLevel = GetParent() ? GetLevelInListTree() : 0;
+
+ if (nLevel >= 0 && nLevel < MAXLEVEL)
+ {
+ const SwNumFmt * pFmt = pRule->GetNumFmt( static_cast<sal_uInt16>(nLevel));
+
+ if (pFmt)
+ aResult = pFmt->GetStart();
+ }
+ }
+ }
+
+ return aResult;
+}
+
+//String SwNodeNum::ToString() const
+//{
+// String aResult("[ ", RTL_TEXTENCODING_ASCII_US);
+
+// if (GetTxtNode())
+// {
+// char aBuffer[256];
+
+// sprintf(aBuffer, "%p ", GetTxtNode());
+
+// aResult += String(aBuffer, RTL_TEXTENCODING_ASCII_US);
+// aResult += String::CreateFromInt32(GetPosition().nNode.GetIndex());
+// }
+// else
+// aResult += String("*", RTL_TEXTENCODING_ASCII_US);
+
+// aResult += String(" ", RTL_TEXTENCODING_ASCII_US);
+
+// unsigned int nLvl = GetLevel();
+// aResult += String::CreateFromInt32(nLvl);
+
+// aResult += String(": ", RTL_TEXTENCODING_ASCII_US);
+
+// tNumberVector aNumVector;
+
+// _GetNumberVector(aNumVector, false);
+
+// for (unsigned int n = 0; n < aNumVector.size(); n++)
+// {
+// if (n > 0)
+// aResult += String(", ", RTL_TEXTENCODING_ASCII_US);
+
+// aResult += String::CreateFromInt32(aNumVector[n]);
+// }
+
+// if (IsCounted())
+//// aResult += String(" counted", RTL_TEXTENCODING_ASCII_US);
+// aResult += String(" C", RTL_TEXTENCODING_ASCII_US);
+
+// if (IsRestart())
+// {
+//// aResult += String(" restart(", RTL_TEXTENCODING_ASCII_US);
+// aResult += String(" R(", RTL_TEXTENCODING_ASCII_US);
+// aResult += String::CreateFromInt32(GetStart());
+// aResult += String(")", RTL_TEXTENCODING_ASCII_US);
+// }
+
+// if (! IsValid())
+//// aResult += String(" invalid", RTL_TEXTENCODING_ASCII_US);
+// aResult += String(" I", RTL_TEXTENCODING_ASCII_US);
+
+// aResult += String(" ]", RTL_TEXTENCODING_ASCII_US);
+
+// return aResult;
+//}
+
+// --> OD 2006-03-07 #131436#
+void SwNodeNum::HandleNumberTreeRootNodeDelete( SwNodeNum& rNodeNum )
+{
+ SwNodeNum* pRootNode = rNodeNum.GetParent()
+ ? dynamic_cast<SwNodeNum*>(rNodeNum.GetRoot())
+ : &rNodeNum;
+ if ( !pRootNode )
+ {
+ // no root node -> nothing do.
+ return;
+ }
+
+ // unregister all number tree node entries, which correspond to a text node,
+ // about the deletion of the number tree root node.
+ _UnregisterMeAndChildrenDueToRootDelete( *pRootNode );
+}
+
+void SwNodeNum::_UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum )
+{
+ const bool bIsPhantom( rNodeNum.IsPhantom() );
+ tSwNumberTreeChildren::size_type nAllowedChildCount( 0 );
+ bool bDone( false );
+ while ( !bDone &&
+ rNodeNum.GetChildCount() > nAllowedChildCount )
+ {
+ SwNodeNum* pChildNode( dynamic_cast<SwNodeNum*>((*rNodeNum.mChildren.begin())) );
+ if ( !pChildNode )
+ {
+ ASSERT( false,
+ "<SwNodeNum::_UnregisterMeAndChildrenDueToRootDelete(..)> - unknown number tree node child" );
+ ++nAllowedChildCount;
+ continue;
+ }
+
+ // Unregistering the last child of a phantom will destroy the phantom.
+ // Thus <rNodeNum> will be destroyed and access on <rNodeNum> has to
+ // be suppressed.
+ if ( bIsPhantom && rNodeNum.GetChildCount() == 1 )
+ {
+ bDone = true;
+ }
+
+ _UnregisterMeAndChildrenDueToRootDelete( *pChildNode );
+ }
+
+ if ( !bIsPhantom )
+ {
+ SwTxtNode* pTxtNode( rNodeNum.GetTxtNode() );
+ if ( pTxtNode )
+ {
+ pTxtNode->RemoveFromList();
+ // --> OD 2010-01-13 #b6912256#
+ // clear all list attributes and the list style
+ SvUShortsSort aResetAttrsArray;
+ aResetAttrsArray.Insert( RES_PARATR_LIST_ID );
+ aResetAttrsArray.Insert( RES_PARATR_LIST_LEVEL );
+ aResetAttrsArray.Insert( RES_PARATR_LIST_ISRESTART );
+ aResetAttrsArray.Insert( RES_PARATR_LIST_RESTARTVALUE );
+ aResetAttrsArray.Insert( RES_PARATR_LIST_ISCOUNTED );
+ aResetAttrsArray.Insert( RES_PARATR_NUMRULE );
+ SwPaM aPam( *pTxtNode );
+ pTxtNode->GetDoc()->ResetAttrs( aPam, sal_False,
+ &aResetAttrsArray,
+ false );
+ // <--
+ }
+ }
+}
+// <--
+
+// --> OD 2007-09-06 #i81002#
+const SwNodeNum* SwNodeNum::GetPrecedingNodeNumOf( const SwTxtNode& rTxtNode ) const
+{
+ const SwNodeNum* pPrecedingNodeNum( 0 );
+
+ // --> OD 2007-10-31 #i83479#
+// SwNodeNum aNodeNumForTxtNode;
+// aNodeNumForTxtNode.SetTxtNode( const_cast<SwTxtNode*>(&rTxtNode) );
+ SwNodeNum aNodeNumForTxtNode( const_cast<SwTxtNode*>(&rTxtNode) );
+ // <--
+
+ pPrecedingNodeNum = dynamic_cast<const SwNodeNum*>(
+ GetRoot()
+ ? GetRoot()->GetPrecedingNodeOf( aNodeNumForTxtNode )
+ : GetPrecedingNodeOf( aNodeNumForTxtNode ) );
+
+ return pPrecedingNodeNum;
+}
+// <--
diff --git a/sw/source/core/SwNumberTree/SwNumberTree.cxx b/sw/source/core/SwNumberTree/SwNumberTree.cxx
new file mode 100644
index 000000000000..05c30aa97f5b
--- /dev/null
+++ b/sw/source/core/SwNumberTree/SwNumberTree.cxx
@@ -0,0 +1,1409 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <algorithm>
+#include <functional>
+#include <errhdl.hxx>
+#include <SwNumberTree.hxx>
+
+using std::vector;
+using std::find;
+
+#ifdef DBG_UTIL
+unsigned long SwNumberTreeNode::nInstances = 0;
+#endif
+
+SwNumberTreeNode::SwNumberTreeNode()
+ : mChildren(),
+ mpParent( 0 ),
+ mnNumber( 0 ),
+ // --> OD 2008-11-26 #158694#
+ mbContinueingPreviousSubTree( false ),
+ // <--
+ mbPhantom( false ),
+ mItLastValid()
+{
+ mItLastValid = mChildren.end();
+
+#ifdef DBG_UTIL
+ mnSerial = nInstances;
+ nInstances++;
+#endif
+}
+
+SwNumberTreeNode::~SwNumberTreeNode()
+{
+ if (GetChildCount() > 0)
+ {
+ if (HasOnlyPhantoms())
+ {
+ delete *mChildren.begin();
+
+ mChildren.clear();
+ mItLastValid = mChildren.end();
+ }
+ else
+ {
+ ASSERT(false, "lost children!");
+ }
+ }
+
+ ASSERT( IsPhantom() || mpParent == NULL, ": I'm not supposed to have a parent.");
+
+#ifdef DBG_UTIL
+ nInstances--;
+#endif
+
+ mpParent = (SwNumberTreeNode *) 0xdeadbeef;
+
+ ASSERT(mChildren.empty(), "children left!");
+}
+
+SwNumberTreeNode * SwNumberTreeNode::CreatePhantom()
+{
+ SwNumberTreeNode * pNew = NULL;
+
+ if (! mChildren.empty() &&
+ (*mChildren.begin())->IsPhantom())
+ {
+ ASSERT(false, "phantom already present");
+ }
+ else
+ {
+ pNew = Create();
+ pNew->SetPhantom(true);
+ pNew->mpParent = this;
+
+ std::pair<tSwNumberTreeChildren::iterator, bool> aInsert =
+ mChildren.insert(pNew);
+
+ if (! aInsert.second)
+ {
+ ASSERT(false, "insert of phantom failed!");
+
+ delete pNew;
+ pNew = NULL;
+ }
+ }
+
+ return pNew;
+}
+
+SwNumberTreeNode * SwNumberTreeNode::GetRoot() const
+{
+ SwNumberTreeNode * pResult = mpParent;
+
+ if (pResult)
+ while (pResult->mpParent)
+ pResult = pResult->mpParent;
+
+ return pResult;
+}
+
+void SwNumberTreeNode::ClearObsoletePhantoms()
+{
+ tSwNumberTreeChildren::iterator aIt = mChildren.begin();
+
+ if (aIt != mChildren.end() && (*aIt)->IsPhantom())
+ {
+ (*aIt)->ClearObsoletePhantoms();
+
+ if ((*aIt)->mChildren.empty())
+ {
+ // --> OD 2006-01-17 #i60652#
+ // Because <mChildren.erase(aIt)> could destroy the element, which
+ // is referenced by <mItLastValid>, it's needed to adjust
+ // <mItLastValid> before erasing <aIt>.
+ SetLastValid(mChildren.end());
+ // <--
+
+ delete *aIt;
+ mChildren.erase(aIt);
+ }
+ }
+}
+
+void SwNumberTreeNode::ValidateHierarchical(const SwNumberTreeNode * pNode) const
+{
+ tSwNumberTreeChildren::iterator aValidateIt =
+ GetIterator(pNode);
+
+ if (aValidateIt != mChildren.end())
+ {
+ ASSERT((*aValidateIt)->mpParent == this, "wrong parent");
+
+ tSwNumberTreeChildren::iterator aIt = mItLastValid;
+
+ // --> OD 2005-10-19 #126009#
+ // improvement:
+ // - Only one time checked for <mChildren.end()>.
+ // - Less checks for each loop run.
+ // correction:
+ // - consider case that current node isn't counted and isn't the first
+ // child of its parent. In this case the number of last counted child
+ // of the previous node determines the start value for the following
+ // children loop, if all children have to be validated and the first
+ // one doesn't restart the counting.
+// tSwNumTreeNumber nTmpNumber = 0;
+// if (aIt != mChildren.end())
+// nTmpNumber = (*aIt)->mnNumber;
+// while (aIt != aValidateIt)
+// {
+// if (aIt == mChildren.end())
+// aIt = mChildren.begin();
+// else
+// {
+// aIt++;
+// if ((*aIt)->IsCounted())
+// nTmpNumber++;
+// }
+// if ((*aIt)->IsRestart() || aIt == mChildren.begin())
+// nTmpNumber = (*aIt)->GetStart();
+// (*aIt)->mnNumber = nTmpNumber;
+// }
+ SwNumberTree::tSwNumTreeNumber nTmpNumber( 0 );
+ if (aIt != mChildren.end())
+ nTmpNumber = (*aIt)->mnNumber;
+ else
+ {
+ aIt = mChildren.begin();
+ // --> OD 2008-11-26 #158694#
+ (*aIt)->mbContinueingPreviousSubTree = false;
+ // <--
+
+ // determine default start value
+ // consider the case that the first child isn't counted.
+ nTmpNumber = (*aIt)->GetStartValue();
+ if ( !(*aIt)->IsCounted() &&
+ ( !(*aIt)->HasCountedChildren() || (*aIt)->IsPhantom() ) )
+ {
+ --nTmpNumber;
+ }
+
+ // determine special start value for the case that first child
+ // doesn't restart the numbering and the parent node isn't counted
+ // and isn't the first child.
+ // --> OD 2005-10-27 #126009#
+ const bool bParentCounted( IsCounted() &&
+ ( !IsPhantom() ||
+ HasPhantomCountedParent() ) );
+ // <--
+ if ( !(*aIt)->IsRestart() &&
+ GetParent() && !bParentCounted )
+ {
+ tSwNumberTreeChildren::iterator aParentChildIt =
+ GetParent()->GetIterator( this );
+ while ( aParentChildIt != GetParent()->mChildren.begin() )
+ {
+ --aParentChildIt;
+ SwNumberTreeNode* pPrevNode( *aParentChildIt );
+ if ( pPrevNode->GetChildCount() > 0 )
+ {
+ // --> OD 2008-11-26 #158694#
+ (*aIt)->mbContinueingPreviousSubTree = true;
+ // <--
+ nTmpNumber = (*(pPrevNode->mChildren.rbegin()))->GetNumber();
+ // --> OD 2005-10-27 #126009#
+ if ( (*aIt)->IsCounted() &&
+ ( !(*aIt)->IsPhantom() ||
+ (*aIt)->HasPhantomCountedParent() ) )
+ // <--
+ {
+ ++nTmpNumber;
+ }
+ break;
+ }
+ else if ( pPrevNode->IsCounted() )
+ {
+ break;
+ }
+ else
+ {
+ // Previous node has no children and is not counted.
+ // Thus, next turn and check for the previous node.
+ }
+ }
+ }
+
+ (*aIt)->mnNumber = nTmpNumber;
+ }
+
+ while (aIt != aValidateIt)
+ {
+ ++aIt;
+ // --> OD 2008-11-26 #158694#
+ (*aIt)->mbContinueingPreviousSubTree = false;
+ // <--
+
+ // --> OD 2005-10-19 #126009# - only for counted nodes the number
+ // has to be adjusted, compared to the previous node.
+ // this condition is hold also for nodes, which restart the numbering.
+ if ( (*aIt)->IsCounted() )
+ {
+ if ((*aIt)->IsRestart())
+ nTmpNumber = (*aIt)->GetStartValue();
+ else
+ ++nTmpNumber;
+ }
+ // <--
+
+ (*aIt)->mnNumber = nTmpNumber;
+ }
+ // <--
+
+ SetLastValid(aIt, true);
+ }
+}
+
+void SwNumberTreeNode::ValidateContinuous(const SwNumberTreeNode * pNode) const
+{
+ tSwNumberTreeChildren::iterator aIt = mItLastValid;
+
+ SwNumberTree::tSwNumTreeNumber nTmpNumber = 0;
+
+ do
+ {
+ if (aIt == mChildren.end())
+ {
+ aIt = mChildren.begin();
+
+ nTmpNumber = GetStartValue();
+ }
+ else
+ aIt++;
+
+ if (aIt != mChildren.end())
+ {
+ SwNumberTreeNode * pPred = (*aIt)->GetPred();
+
+ // --> OD 2006-04-21 #i64311#
+ // correct consideration of phantoms
+ // correct consideration of restart at a number tree node
+ if ( pPred )
+ {
+ if ( !(*aIt)->IsCounted() )
+ // --> OD 2006-05-12 #i65284#
+ nTmpNumber = pPred->GetNumber( pPred->GetParent() != (*aIt)->GetParent() );
+ // <--
+ else
+ {
+ if ( (*aIt)->IsRestart() )
+ nTmpNumber = (*aIt)->GetStartValue();
+ else
+ nTmpNumber = pPred->GetNumber( pPred->GetParent() != (*aIt)->GetParent() ) + 1;
+ }
+ }
+ else
+ {
+ if ( !(*aIt)->IsCounted() )
+ nTmpNumber = GetStartValue() - 1;
+ else
+ {
+ if ( (*aIt)->IsRestart() )
+ nTmpNumber = (*aIt)->GetStartValue();
+ else
+ nTmpNumber = GetStartValue();
+ }
+ }
+ // <--
+
+ (*aIt)->mnNumber = nTmpNumber;
+ }
+ }
+ while (aIt != mChildren.end() && *aIt != pNode);
+
+ // --> OD 2008-05-21 #i74748# - applied patch from garnier_romain
+ // number tree node has to be validated.
+// SetLastValid(aIt);
+ SetLastValid( aIt, true );
+ // <--
+}
+
+void SwNumberTreeNode::Validate(const SwNumberTreeNode * pNode) const
+{
+ if (! IsValid(pNode))
+ {
+ if (IsContinuous())
+ ValidateContinuous(pNode);
+ else
+ ValidateHierarchical(pNode);
+ }
+}
+
+void SwNumberTreeNode::ValidateTree()
+{
+ if (! IsContinuous())
+ {
+ {
+ tSwNumberTreeChildren::reverse_iterator aIt = mChildren.rbegin();
+
+ if (aIt != mChildren.rend())
+ Validate(*aIt);
+ }
+ {
+ tSwNumberTreeChildren::iterator aIt;
+
+ for (aIt = mChildren.begin(); aIt != mChildren.end(); aIt++)
+ (*aIt)->ValidateTree();
+ }
+ }
+ else
+ {
+ SwNumberTreeNode * pNode = GetLastDescendant();
+
+ if (pNode && pNode->mpParent)
+ pNode->mpParent->Validate(pNode);
+ }
+}
+
+void SwNumberTreeNode::_GetNumberVector(vector<SwNumberTree::tSwNumTreeNumber> & rVector,
+ bool bValidate) const
+{
+ if (mpParent)
+ {
+ mpParent->_GetNumberVector(rVector, bValidate);
+ rVector.push_back(GetNumber(bValidate));
+ }
+}
+
+SwNumberTreeNode * SwNumberTreeNode::GetFirstNonPhantomChild()
+{
+ if (IsPhantom())
+ return (*mChildren.begin())->GetFirstNonPhantomChild();
+
+ return this;
+}
+
+/** Moves all children of this node that are greater than a given node
+ to the destination node.
+
+ OD 2005-10-14 #125991#
+*/
+void SwNumberTreeNode::MoveGreaterChildren( SwNumberTreeNode& _rCompareNode,
+ SwNumberTreeNode& _rDestNode )
+{
+ if ( mChildren.size() == 0 )
+ return;
+
+ // determine first child, which has to move to <_rDestNode>
+ tSwNumberTreeChildren::iterator aItUpper( mChildren.end() );
+ if ((*mChildren.begin())->IsPhantom() &&
+ _rCompareNode.LessThan(*(*mChildren.begin())->GetFirstNonPhantomChild()))
+ {
+ aItUpper = mChildren.begin();
+ }
+ else
+ {
+ aItUpper = mChildren.upper_bound(&_rCompareNode);
+ }
+
+ // move children
+ if (aItUpper != mChildren.end())
+ {
+ tSwNumberTreeChildren::iterator aIt;
+ for (aIt = aItUpper; aIt != mChildren.end(); aIt++)
+ (*aIt)->mpParent = &_rDestNode;
+
+ _rDestNode.mChildren.insert(aItUpper, mChildren.end());
+
+ // --> OD 2006-01-17 #i60652#
+ // Because <mChildren.erase(aItUpper, mChildren.end())> could destroy
+ // the element, which is referenced by <mItLastValid>, it's needed to
+ // adjust <mItLastValid> before erasing <aIt>.
+ SetLastValid( mChildren.end() );
+ // <--
+
+ mChildren.erase(aItUpper, mChildren.end());
+
+ // --> OD 2006-01-17 #i60652#
+ if ( !mChildren.empty() )
+ {
+ SetLastValid( --(mChildren.end()) );
+ }
+ // <--
+ }
+
+#ifdef __SW_NUMBER_TREE_SANITY_CHECK
+ if (! IsSane(false) || ! IsSane(&_rDestNode))
+ clog << __FUNCTION__ << "insanity!" << endl;
+#endif
+}
+
+void SwNumberTreeNode::MoveChildren(SwNumberTreeNode * pDest)
+{
+ if (! mChildren.empty())
+ {
+ tSwNumberTreeChildren::iterator aItBegin = mChildren.begin();
+ SwNumberTreeNode * pMyFirst = *mChildren.begin();
+
+ // --> OD 2006-01-17 #i60652#
+ // Because <mChildren.erase(aItBegin)> could destroy the element,
+ // which is referenced by <mItLastValid>, it's needed to adjust
+ // <mItLastValid> before erasing <aItBegin>.
+ SetLastValid(mChildren.end());
+ // <--
+
+ if (pMyFirst->IsPhantom())
+ {
+ SwNumberTreeNode * pDestLast = NULL;
+
+ if (pDest->mChildren.empty())
+ pDestLast = pDest->CreatePhantom();
+ else
+ pDestLast = *pDest->mChildren.rbegin();
+
+ pMyFirst->MoveChildren(pDestLast);
+
+ delete pMyFirst;
+ mChildren.erase(aItBegin);
+
+ aItBegin = mChildren.begin();
+ }
+
+ tSwNumberTreeChildren::iterator aIt;
+ for (aIt = mChildren.begin(); aIt != mChildren.end(); aIt++)
+ (*aIt)->mpParent = pDest;
+
+ pDest->mChildren.insert(mChildren.begin(), mChildren.end());
+ mChildren.clear();
+ // --> OD 2006-03-08 #131436#
+ // <stl::set.clear()> destroys all existing iterators.
+ // Thus, <mItLastValid> is also destroyed and reset becomes necessary
+ mItLastValid = mChildren.end();
+ // <--
+ }
+
+ ASSERT (mChildren.empty(), "MoveChildren failed!");
+
+#ifdef __SW_NUMBER_TREE_SANITY_CHECK
+ ASSERT(IsSane(false) && pDest->IsSane(false), "insanity!");
+#endif
+}
+
+void SwNumberTreeNode::AddChild( SwNumberTreeNode * pChild,
+ const int nDepth )
+{
+ /*
+ Algorithm:
+
+ Search first child A that is greater than pChild,
+ A may be the end of childs.
+ If nDepth > 0 then
+ {
+ if A is first child then
+ create new phantom child B at beginning of child list
+ else
+ B is A
+
+ Add child to B with depth nDepth - 1.
+ }
+ else
+ {
+ Insert pNode before A.
+
+ if A has predecessor B then
+ remove children of B that are greater as A and insert them as
+ children of A.
+ }
+
+*/
+
+ // --> OD 2008-03-13 #refactorlists#
+ if ( nDepth < 0 )
+ {
+ ASSERT( false,
+ "<SwNumberTreeNode::AddChild(..)> - parameter <nDepth> out of valid range. Serious defect -> please inform OD." );
+ return;
+ }
+ // <--
+
+ if ( pChild->GetParent() != NULL || pChild->GetChildCount() > 0 )
+ {
+ ASSERT(false, "only orphans allowed.");
+ return;
+ }
+
+ if (nDepth > 0)
+ {
+ tSwNumberTreeChildren::iterator aInsertDeepIt =
+ mChildren.upper_bound(pChild);
+
+ ASSERT(! (aInsertDeepIt != mChildren.end() &&
+ (*aInsertDeepIt)->IsPhantom()), " unexspected phantom");
+
+
+ if (aInsertDeepIt == mChildren.begin())
+ {
+ SwNumberTreeNode * pNew = CreatePhantom();
+
+ SetLastValid(mChildren.end());
+
+ if (pNew)
+ pNew->AddChild(pChild, nDepth - 1);
+ }
+ else
+ {
+ aInsertDeepIt--;
+ (*aInsertDeepIt)->AddChild(pChild, nDepth - 1);
+ }
+
+ }
+ else
+ {
+ // --> OD 2008-02-19 #refactorlists#
+ pChild->PreAdd();
+ // <--
+ std::pair<tSwNumberTreeChildren::iterator, bool> aResult =
+ mChildren.insert(pChild);
+
+ if (aResult.second)
+ {
+ pChild->mpParent = this;
+ bool bNotification = pChild->IsNotificationEnabled();
+ tSwNumberTreeChildren::iterator aInsertedIt = aResult.first;
+
+ if (aInsertedIt != mChildren.begin())
+ {
+ tSwNumberTreeChildren::iterator aPredIt = aInsertedIt;
+ aPredIt--;
+
+ // --> OD 2005-10-14 #125991#
+ // Move greater children of previous node to new child.
+ // This has to be done recursively on the children levels.
+ // Initialize loop variables <pPrevChildNode> and <pDestNode>
+ // for loop on children levels.
+ SwNumberTreeNode* pPrevChildNode( *aPredIt );
+ SwNumberTreeNode* pDestNode( pChild );
+ while ( pDestNode && pPrevChildNode &&
+ pPrevChildNode->GetChildCount() > 0 )
+ {
+ // move children
+ pPrevChildNode->MoveGreaterChildren( *pChild, *pDestNode );
+
+ // prepare next loop:
+ // - search of last child of <pPrevChildNode
+ // - If found, determine destination node
+ if ( pPrevChildNode->GetChildCount() > 0 )
+ {
+ tSwNumberTreeChildren::reverse_iterator aIt =
+ pPrevChildNode->mChildren.rbegin();
+ pPrevChildNode = *aIt;
+ // determine new destination node
+ if ( pDestNode->GetChildCount() > 0 )
+ {
+ pDestNode = *(pDestNode->mChildren.begin());
+ if ( !pDestNode->IsPhantom() )
+ {
+ pDestNode = pDestNode->mpParent->CreatePhantom();
+ }
+ }
+ else
+ {
+ pDestNode = pDestNode->CreatePhantom();
+ }
+ }
+ else
+ {
+ // ready -> break loop.
+ break;
+ }
+ }
+ // assure that unnessary created phantoms at <pChild> are deleted.
+ pChild->ClearObsoletePhantoms();
+ // <--
+
+ if ((*aPredIt)->IsValid())
+ SetLastValid(aPredIt);
+ }
+ else
+ SetLastValid(mChildren.end());
+
+ ClearObsoletePhantoms();
+
+ if( bNotification )
+ {
+ // --> OD 2005-10-20 #126009# - invalidation of not counted parent
+ // and notification of its siblings.
+ if ( !IsCounted() )
+ {
+ InvalidateMe();
+ NotifyInvalidSiblings();
+ }
+ // <--
+ NotifyInvalidChildren();
+ }
+ }
+ }
+
+#ifdef __SW_NUMBER_TREE_SANITY_CHECK
+ if (! IsSane(false))
+ clog << __FUNCTION__ << ": insanity!" << endl;
+#endif
+}
+
+void SwNumberTreeNode::RemoveChild(SwNumberTreeNode * pChild)
+{
+ /*
+ Algorithm:
+
+ if pChild has predecessor A then
+ B is A
+ else
+ create phantom child B at beginning of child list
+
+ Move children of pChild to B.
+ */
+
+ if (pChild->IsPhantom())
+ {
+ ASSERT(false, "not applicable to phantoms!");
+
+ return;
+ }
+
+ tSwNumberTreeChildren::iterator aRemoveIt = GetIterator(pChild);
+
+ if (aRemoveIt != mChildren.end())
+ {
+ SwNumberTreeNode * pRemove = *aRemoveIt;
+
+ pRemove->mpParent = NULL;
+
+ tSwNumberTreeChildren::iterator aItPred = mChildren.end();
+
+ if (aRemoveIt == mChildren.begin())
+ {
+ if (! pRemove->mChildren.empty())
+ {
+ CreatePhantom();
+
+ aItPred = mChildren.begin();
+ }
+ }
+ else
+ {
+ aItPred = aRemoveIt;
+
+ aItPred--;
+ }
+
+ if (! pRemove->mChildren.empty())
+ {
+ pRemove->MoveChildren(*aItPred);
+ // --> OD 2008-04-04 #refactorlists#
+ (*aItPred)->InvalidateTree();
+ (*aItPred)->NotifyInvalidChildren();
+ // <--
+ }
+
+ // --> OD 2006-01-17 #i60652#
+ // Because <mChildren.erase(aRemoveIt)> could destroy the element,
+ // which is referenced by <mItLastValid>, it's needed to adjust
+ // <mItLastValid> before erasing <aRemoveIt>.
+ if (aItPred != mChildren.end() && (*aItPred)->IsPhantom())
+ SetLastValid(mChildren.end());
+ else
+ SetLastValid(aItPred);
+ // <--
+
+ mChildren.erase(aRemoveIt);
+
+ // --> OD 2008-04-04 #refactorlists#
+// if (aItPred != mChildren.end())
+// NotifyInvalidChildren();
+ NotifyInvalidChildren();
+ // <--
+ }
+ else
+ {
+ ASSERT(false, "RemoveChild: failed!");
+ }
+
+ // --> OD 2008-02-19 #refactorlists#
+ pChild->PostRemove();
+ // <--
+}
+
+void SwNumberTreeNode::RemoveMe()
+{
+ if (mpParent)
+ {
+ SwNumberTreeNode * pSavedParent = mpParent;
+
+ pSavedParent->RemoveChild(this);
+
+ while (pSavedParent && pSavedParent->IsPhantom() &&
+ pSavedParent->HasOnlyPhantoms())
+ pSavedParent = pSavedParent->GetParent();
+
+ if (pSavedParent)
+ pSavedParent->ClearObsoletePhantoms();
+
+#ifdef __SW_NUMBER_TREE_SANITY_CHECK
+ if (! IsSane(false))
+ clog << __FUNCTION__ << ": insanity!" << endl;
+#endif
+ }
+}
+
+bool SwNumberTreeNode::IsValid() const
+{
+ return mpParent ? mpParent->IsValid(this) : false;
+}
+
+SwNumberTree::tSwNumTreeNumber SwNumberTreeNode::GetNumber(bool bValidate)
+ const
+{
+ if (bValidate && mpParent)
+ mpParent->Validate(this);
+
+ return mnNumber;
+}
+
+// --> OD 2008-11-26 #158694#
+bool SwNumberTreeNode::IsContinueingPreviousSubTree() const
+{
+ return mbContinueingPreviousSubTree;
+}
+// <--
+
+
+vector<SwNumberTree::tSwNumTreeNumber> SwNumberTreeNode::GetNumberVector() const
+{
+ vector<SwNumberTree::tSwNumTreeNumber> aResult;
+
+ _GetNumberVector(aResult);
+
+ return aResult;
+}
+
+bool SwNumberTreeNode::IsValid(const SwNumberTreeNode * pChild) const
+{
+ bool bResult = false;
+
+ if (mItLastValid != mChildren.end())
+ {
+ if (pChild && pChild->mpParent == this)
+ {
+ bResult = ! (*mItLastValid)->LessThan(*pChild);
+ }
+ }
+
+ return bResult;
+}
+
+bool SwNumberTreeNode::IsPhantom() const
+{
+ return mbPhantom;
+}
+
+void SwNumberTreeNode::SetPhantom(bool _bPhantom)
+{
+ mbPhantom = _bPhantom;
+}
+
+bool SwNumberTreeNode::HasOnlyPhantoms() const
+{
+ bool bResult = false;
+
+ if (GetChildCount() == 1)
+ {
+ tSwNumberTreeChildren::const_iterator aIt = mChildren.begin();
+
+ bResult = (*aIt)->IsPhantom() && (*aIt)->HasOnlyPhantoms();
+ }
+ else if (GetChildCount() == 0)
+ bResult = true;
+
+ return bResult;
+}
+
+bool SwNumberTreeNode::IsCounted() const
+{
+ return !IsPhantom() ||
+ ( IsCountPhantoms() && HasCountedChildren() );
+}
+
+// --> OD 2005-10-27 #126009#
+bool SwNumberTreeNode::HasPhantomCountedParent() const
+{
+ bool bRet( false );
+
+ ASSERT( IsPhantom(),
+ "<SwNumberTreeNode::HasPhantomCountedParent()> - wrong usage of method - it's only for phantoms" );
+ if ( IsPhantom() && mpParent )
+ {
+ if ( mpParent == GetRoot() )
+ {
+ bRet = true;
+ }
+ else if ( !mpParent->IsPhantom() )
+ {
+ bRet = mpParent->IsCounted();
+ }
+ else
+ {
+ bRet = mpParent->IsCounted() && mpParent->HasPhantomCountedParent();
+ }
+ }
+
+ return bRet;
+}
+// <--
+
+bool SwNumberTreeNode::IsFirst(const SwNumberTreeNode * pNode) const
+{
+ tSwNumberTreeChildren::iterator aIt = mChildren.begin();
+
+ if ((*aIt)->IsPhantom())
+ aIt++;
+
+ return *aIt == pNode;
+}
+
+bool SwNumberTreeNode::IsFirst() const
+{
+ bool bResult = true;
+
+ if (GetParent())
+ {
+ if (GetParent()->IsFirst(this))
+ {
+ SwNumberTreeNode * pNode = GetParent();
+
+ while (pNode)
+ {
+ if (!pNode->IsPhantom() && pNode->GetParent())
+ {
+ bResult = false;
+ break;
+ }
+
+ pNode = pNode->GetParent();
+ }
+
+ // --> OD 2007-10-02 #b6600435#
+ // If node isn't the first child, it is the second child and the
+ // first child is a phanton. In this case check, if the first phantom
+ // child have only phanton childs
+ if ( bResult &&
+ this != *(GetParent()->mChildren.begin()) &&
+ !(*(GetParent()->mChildren.begin()))->HasOnlyPhantoms() )
+ {
+ bResult = false;
+ }
+ // <--
+ }
+ else
+ bResult = false;
+ }
+
+ return bResult;
+}
+
+// --> OD 2008-03-13 #refactorlists#
+void SwNumberTreeNode::SetLevelInListTree( const int nLevel )
+{
+ if ( nLevel < 0 )
+ {
+ ASSERT( false,
+ "<SwNumberTreeNode::SetLevelInListTree(..)> - parameter <nLevel> out of valid range. Serious defect -> please inform OD." );
+ return;
+ }
+
+ ASSERT( GetParent(),
+ "<SwNumberTreeNode::SetLevelInListTree(..)> - can only be called for number tree nodes in a list tree" );
+ if ( GetParent() )
+ {
+ if ( nLevel != GetLevelInListTree() )
+ {
+ SwNumberTreeNode* pRootTreeNode = GetRoot();
+ ASSERT( pRootTreeNode,
+ "<SwNumberTreeNode::SetLevelInListTree(..)> - no root tree node found. Serious defect -> please inform OD." );
+
+ RemoveMe();
+ pRootTreeNode->AddChild( this, nLevel );
+ }
+ }
+}
+// <--
+
+int SwNumberTreeNode::GetLevelInListTree() const
+{
+ if (mpParent)
+ return mpParent->GetLevelInListTree() + 1;
+
+ return -1;
+}
+
+SwNumberTreeNode::tSwNumberTreeChildren::size_type
+SwNumberTreeNode::GetChildCount() const
+{
+ return mChildren.size();
+}
+
+#ifdef __SW_NUMBER_TREE_SANITY_CHECK
+bool SwNumberTreeNode::IsSane(bool bRecursive) const
+{
+ vector<const SwNumberTreeNode*> aParents;
+
+ return IsSane(bRecursive, aParents);
+}
+
+bool SwNumberTreeNode::IsSane(bool bRecursive,
+ vector<const SwNumberTreeNode *> rParents)
+ const
+{
+ bool bResult = true;
+
+ tSwNumberTreeChildren::const_iterator aIt;
+
+ if (find(rParents.begin(), rParents.end(), this) != rParents.end())
+ {
+ ASSERT(false, " I'm my own ancestor!");
+
+ bResult = false;
+ }
+
+ if (! rParents.empty() && rParents.back() != mpParent)
+ {
+ ASSERT(false, " I'm a bastard!");
+
+ bResult = false;
+ }
+
+ rParents.push_back(this);
+
+ bool bFirst = true;
+ for (aIt = mChildren.begin(); aIt != mChildren.end(); aIt++)
+ {
+ if (*aIt)
+ {
+ if ((*aIt)->IsPhantom())
+ {
+ if ((*aIt)->HasOnlyPhantoms())
+ {
+ bResult = false;
+ }
+
+ if (! bFirst)
+ {
+ ASSERT(false, " found phantom not at first position.");
+
+ bResult = false;
+ }
+ }
+
+ if ((*aIt)->mpParent != (SwNumberTreeNode *) this)
+ {
+ ASSERT(false, "found a bastard");
+
+ bResult = false;
+ }
+
+ if (mpParent)
+ {
+ if (!(*aIt)->IsPhantom() && (*aIt)->LessThan(*this))
+ {
+ ASSERT(false, " found child less than me");
+
+ bResult = false;
+ }
+ }
+ }
+ else
+ {
+ ASSERT(false, "found child that is NULL");
+ bResult = false;
+ }
+
+ if (bRecursive)
+ bResult = (*aIt)->IsSane(bRecursive, rParents) && bResult;
+ }
+
+ rParents.pop_back();
+
+ return bResult;
+}
+#endif // __SW_NUMBER_TREE_SANITY_CHECK
+
+SwNumberTreeNode::tSwNumberTreeChildren::iterator
+SwNumberTreeNode::GetIterator(const SwNumberTreeNode * pChild) const
+{
+ tSwNumberTreeChildren::iterator aItResult =
+ mChildren.find(const_cast<SwNumberTreeNode *>(pChild));
+
+ ASSERT( aItResult != mChildren.end(),
+ "something went wrong getting the iterator for a child");
+
+ return aItResult;
+}
+
+//String SwNumberTreeNode::print(const String & rIndent,
+// const String & rMyIndent,
+// int nDepth) const
+//{
+// String aStr = rIndent;
+// aStr += ToString();
+// aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
+
+// if (nDepth != 0)
+// {
+// if (nDepth < 0)
+// nDepth = -1;
+
+// tSwNumberTreeChildren::const_iterator aIt;
+// for (aIt = mChildren.begin(); aIt != mChildren.end(); aIt++)
+// {
+// String aTmpStr(rIndent);
+
+// aTmpStr += rMyIndent;
+// aStr += (*aIt)->print(aTmpStr, rMyIndent, nDepth - 1);
+// }
+// }
+
+// return aStr;
+//}
+
+#ifdef DBG_UTIL
+unsigned long SwNumberTreeNode::GetInstances()
+{
+ return nInstances;
+}
+
+unsigned long SwNumberTreeNode::GetSerial()
+{
+ return mnSerial;
+}
+#endif
+
+bool SwNumberTreeNodeLessThan(const SwNumberTreeNode * pA,
+ const SwNumberTreeNode * pB)
+{
+ bool bResult = false;
+
+ if (pA == NULL && pB != NULL)
+ bResult = true;
+ else if (pA != NULL && pB != NULL)
+ bResult = pA->LessThan(*pB);
+
+ return bResult;
+}
+
+SwNumberTreeNode * SwNumberTreeNode::GetLastDescendant() const
+{
+ SwNumberTreeNode * pResult = NULL;
+ tSwNumberTreeChildren::reverse_iterator aIt = mChildren.rbegin();
+
+ if (aIt != mChildren.rend())
+ {
+ pResult = (*aIt)->GetLastDescendant();
+
+ if (! pResult)
+ pResult = *aIt;
+ }
+
+ return pResult;
+}
+
+bool SwNumberTreeNode::LessThan(const SwNumberTreeNode & rTreeNode) const
+{
+ return this < &rTreeNode;
+}
+
+SwNumberTreeNode * SwNumberTreeNode::GetPred(bool bSibling) const
+{
+ SwNumberTreeNode * pResult = NULL;
+
+ if (mpParent)
+ {
+ tSwNumberTreeChildren::iterator aIt =
+ mpParent->GetIterator(this);
+
+ if ( aIt == mpParent->mChildren.begin() )
+ {
+ // --> OD 2006-04-24 #i64311#
+ // root node is no valid predecessor
+ pResult = mpParent->GetParent() ? mpParent : NULL;
+ // <--
+ }
+ else
+ {
+ aIt--;
+
+ if ( !bSibling )
+ pResult = (*aIt)->GetLastDescendant();
+ else
+ pResult = (*aIt);
+
+ if (! pResult)
+ pResult = (*aIt);
+ }
+ }
+
+ return pResult;
+}
+
+void SwNumberTreeNode::SetLastValid
+ ( SwNumberTreeNode::tSwNumberTreeChildren::iterator aItValid,
+ bool bValidating ) const
+{
+ ASSERT( (aItValid == mChildren.end() || GetIterator(*aItValid) != mChildren.end()),
+ "last-valid iterator");
+
+ if (
+ bValidating ||
+ aItValid == mChildren.end() ||
+ (mItLastValid != mChildren.end() &&
+ (*aItValid)->LessThan(**mItLastValid))
+ )
+ {
+ mItLastValid = aItValid;
+ // --> OD 2005-10-19 #126009# - invalidation of children of next not
+ // counted is needed
+ if ( GetParent() )
+ {
+ tSwNumberTreeChildren::iterator aParentChildIt =
+ GetParent()->GetIterator( this );
+ ++aParentChildIt;
+ if ( aParentChildIt != GetParent()->mChildren.end() )
+ {
+ SwNumberTreeNode* pNextNode( *aParentChildIt );
+ if ( !pNextNode->IsCounted() )
+ {
+ pNextNode->InvalidateChildren();
+ }
+ }
+ }
+ // <--
+ }
+
+ {
+ if (IsContinuous())
+ {
+ tSwNumberTreeChildren::iterator aIt = mItLastValid;
+
+ if (aIt != mChildren.end())
+ aIt++;
+ else
+ aIt = mChildren.begin();
+
+ while (aIt != mChildren.end())
+ {
+ (*aIt)->InvalidateTree();
+
+ aIt++;
+ }
+
+ SetLastValid(bValidating);
+ }
+ }
+}
+
+void SwNumberTreeNode::SetLastValid(bool bValidating) const
+{
+ if (mpParent)
+ {
+ tSwNumberTreeChildren::iterator aIt = mpParent->GetIterator(this);
+
+ mpParent->SetLastValid(aIt, bValidating);
+ }
+}
+
+void SwNumberTreeNode::InvalidateTree() const
+{
+ // do not call SetInvalid, would cause loop !!!
+ mItLastValid = mChildren.end();
+
+ tSwNumberTreeChildren::iterator aIt;
+
+ for (aIt = mChildren.begin(); aIt != mChildren.end(); aIt++)
+ (*aIt)->InvalidateTree();
+}
+
+void SwNumberTreeNode::Invalidate(SwNumberTreeNode * pChild)
+{
+ if (pChild->IsValid())
+ {
+ tSwNumberTreeChildren::iterator aIt = GetIterator(pChild);
+
+ if (aIt != mChildren.begin())
+ aIt--;
+ else
+ aIt = mChildren.end();
+
+ SetLastValid(aIt);
+
+ }
+}
+
+void SwNumberTreeNode::InvalidateMe()
+{
+ if (mpParent)
+ mpParent->Invalidate(this);
+}
+
+void SwNumberTreeNode::ValidateMe()
+{
+ if (mpParent)
+ mpParent->Validate(this);
+}
+
+void SwNumberTreeNode::Notify()
+{
+ if (IsNotifiable())
+ {
+ if (! IsPhantom())
+ NotifyNode();
+
+ tSwNumberTreeChildren::iterator aIt;
+
+ for (aIt = mChildren.begin(); aIt != mChildren.end(); aIt++)
+ (*aIt)->Notify();
+ }
+}
+
+void SwNumberTreeNode::NotifyInvalidChildren()
+{
+ if (IsNotifiable())
+ {
+ tSwNumberTreeChildren::iterator aIt = mItLastValid;
+
+ if (aIt == mChildren.end())
+ aIt = mChildren.begin();
+ else
+ aIt++;
+
+ while (aIt != mChildren.end())
+ {
+ (*aIt)->Notify();
+
+ aIt++;
+ }
+ // --> OD 2005-10-19 #126009# - notification of next not counted node
+ // is also needed.
+ if ( GetParent() )
+ {
+ tSwNumberTreeChildren::iterator aParentChildIt =
+ GetParent()->GetIterator( this );
+ ++aParentChildIt;
+ if ( aParentChildIt != GetParent()->mChildren.end() )
+ {
+ SwNumberTreeNode* pNextNode( *aParentChildIt );
+ if ( !pNextNode->IsCounted() )
+ {
+ pNextNode->NotifyInvalidChildren();
+ }
+ }
+ }
+
+ // <--
+ }
+
+ if (IsContinuous() && mpParent)
+ mpParent->NotifyInvalidChildren();
+}
+
+void SwNumberTreeNode::NotifyInvalidSiblings()
+{
+ if (mpParent != NULL)
+ mpParent->NotifyInvalidChildren();
+}
+
+// --> OD 2007-09-07 #i81002#
+const SwNumberTreeNode* SwNumberTreeNode::GetPrecedingNodeOf(
+ const SwNumberTreeNode& rNode ) const
+{
+ const SwNumberTreeNode* pPrecedingNode( 0 );
+
+ if ( GetChildCount() > 0 )
+ {
+ tSwNumberTreeChildren::const_iterator aUpperBoundIt =
+ mChildren.upper_bound( const_cast<SwNumberTreeNode*>(&rNode) );
+ if ( aUpperBoundIt != mChildren.begin() )
+ {
+ --aUpperBoundIt;
+ pPrecedingNode = (*aUpperBoundIt)->GetPrecedingNodeOf( rNode );
+ }
+ }
+
+ if ( pPrecedingNode == 0 && GetRoot() )
+ {
+ // <this> node has no children or the given node precedes all its children
+ // and the <this> node isn't the root node.
+ // Thus, compare the given node with the <this> node in order to check,
+ // if the <this> node precedes the given node.
+ if ( !(rNode.LessThan( *this )) )
+ {
+ pPrecedingNode = this;
+ }
+ }
+
+ return pPrecedingNode;
+}
+// <--
+
+// --> OD 2008-04-17 #refactorlists#
+void SwNumberTreeNode::NotifyNodesOnListLevel( const int nListLevel )
+{
+ if ( nListLevel < 0 )
+ {
+ ASSERT( false,
+ "<SwNumberTreeNode::NotifyNodesOnListLevel(..)> - invalid list level provided" );
+ return;
+ }
+
+ SwNumberTreeNode* pRootNode = GetParent() ? GetRoot() : this;
+
+ pRootNode->NotifyChildrenOnDepth( nListLevel );
+}
+
+void SwNumberTreeNode::NotifyChildrenOnDepth( const int nDepth )
+{
+ ASSERT( nDepth >= 0,
+ "<SwNumberTreeNode::NotifyChildrenOnDepth(..)> - misusage" );
+
+ SwNumberTreeNode::tSwNumberTreeChildren::iterator aChildIter =
+ mChildren.begin();
+ while ( aChildIter != mChildren.end() )
+ {
+ if ( nDepth == 0 )
+ {
+ (*aChildIter)->NotifyNode();
+ }
+ else
+ {
+ (*aChildIter)->NotifyChildrenOnDepth( nDepth - 1 );
+ }
+
+ ++aChildIter;
+ }
+}
+// <--
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
new file mode 100644
index 000000000000..f4cf864b7217
--- /dev/null
+++ b/sw/source/core/access/acccell.cxx
@@ -0,0 +1,375 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vos/mutex.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <rtl/uuid.h>
+#include <vcl/svapp.hxx>
+#include <cellfrm.hxx>
+#include <tabfrm.hxx>
+#include <swtable.hxx>
+#include "crsrsh.hxx"
+#include "viscrs.hxx"
+#include <accfrmobj.hxx>
+#include <accfrmobjslist.hxx>
+#include "frmfmt.hxx"
+#include "cellatr.hxx"
+#include "accmap.hxx"
+#include <acccell.hxx>
+
+#ifndef _STLP_CFLOAT
+#include <cfloat>
+#endif
+
+#include <limits.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+using namespace sw::access;
+
+const sal_Char sServiceName[] = "com.sun.star.table.AccessibleCellView";
+const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleCellView";
+
+sal_Bool SwAccessibleCell::IsSelected()
+{
+ sal_Bool bRet = sal_False;
+
+ DBG_ASSERT( GetMap(), "no map?" );
+ const ViewShell *pVSh = GetMap()->GetShell();
+ DBG_ASSERT( pVSh, "no shell?" );
+ if( pVSh->ISA( SwCrsrShell ) )
+ {
+ const SwCrsrShell *pCSh = static_cast< const SwCrsrShell * >( pVSh );
+ if( pCSh->IsTableMode() )
+ {
+ const SwCellFrm *pCFrm =
+ static_cast< const SwCellFrm * >( GetFrm() );
+ SwTableBox *pBox =
+ const_cast< SwTableBox *>( pCFrm->GetTabBox() ); //SVPtrArr!
+ bRet = pCSh->GetTableCrsr()->GetBoxes().Seek_Entry( pBox );
+ }
+ }
+
+ return bRet;
+}
+
+void SwAccessibleCell::GetStates( ::utl::AccessibleStateSetHelper& rStateSet )
+{
+ SwAccessibleContext::GetStates( rStateSet );
+
+ // SELECTABLE
+ const ViewShell *pVSh = GetMap()->GetShell();
+ DBG_ASSERT( pVSh, "no shell?" );
+ if( pVSh->ISA( SwCrsrShell ) )
+ rStateSet.AddState( AccessibleStateType::SELECTABLE );
+
+ // SELECTED
+ if( IsSelected() )
+ {
+ rStateSet.AddState( AccessibleStateType::SELECTED );
+ ASSERT( bIsSelected, "bSelected out of sync" );
+ ::vos::ORef < SwAccessibleContext > xThis( this );
+ GetMap()->SetCursorContext( xThis );
+ }
+}
+
+SwAccessibleCell::SwAccessibleCell( SwAccessibleMap *pInitMap,
+ const SwCellFrm *pCellFrm )
+ : SwAccessibleContext( pInitMap, AccessibleRole::TABLE_CELL, pCellFrm )
+ , bIsSelected( sal_False )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ OUString sBoxName( pCellFrm->GetTabBox()->GetName() );
+ SetName( sBoxName );
+
+ bIsSelected = IsSelected();
+}
+
+sal_Bool SwAccessibleCell::_InvalidateMyCursorPos()
+{
+ sal_Bool bNew = IsSelected();
+ sal_Bool bOld;
+ {
+ vos::OGuard aGuard( aMutex );
+ bOld = bIsSelected;
+ bIsSelected = bNew;
+ }
+ if( bNew )
+ {
+ // remember that object as the one that has the caret. This is
+ // neccessary to notify that object if the cursor leaves it.
+ ::vos::ORef < SwAccessibleContext > xThis( this );
+ GetMap()->SetCursorContext( xThis );
+ }
+
+ sal_Bool bChanged = bOld != bNew;
+ if( bChanged )
+ FireStateChangedEvent( AccessibleStateType::SELECTED, bNew );
+
+ return bChanged;
+}
+
+sal_Bool SwAccessibleCell::_InvalidateChildrenCursorPos( const SwFrm *pFrm )
+{
+ sal_Bool bChanged = sal_False;
+
+ const SwAccessibleChildSList aVisList( GetVisArea(), *pFrm, *GetMap() );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
+ while( aIter != aVisList.end() )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm *pLower = rLower.GetSwFrm();
+ if( pLower )
+ {
+ if( rLower.IsAccessible( GetMap()->GetShell()->IsPreView() ) )
+ {
+ ::vos::ORef< SwAccessibleContext > xAccImpl(
+ GetMap()->GetContextImpl( pLower, sal_False ) );
+ if( xAccImpl.isValid() )
+ {
+ ASSERT( xAccImpl->GetFrm()->IsCellFrm(),
+ "table child is not a cell frame" )
+ bChanged |= static_cast< SwAccessibleCell *>(
+ xAccImpl.getBodyPtr() )->_InvalidateMyCursorPos();
+ }
+ else
+ bChanged = sal_True; // If the context is not know we
+ // don't know whether the selection
+ // changed or not.
+ }
+ else
+ {
+ // This is a box with sub rows.
+ bChanged |= _InvalidateChildrenCursorPos( pLower );
+ }
+ }
+ ++aIter;
+ }
+
+ return bChanged;
+}
+
+void SwAccessibleCell::_InvalidateCursorPos()
+{
+
+ const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
+ ASSERT( pParent->IsTabFrm(), "parent is not a tab frame" );
+ const SwTabFrm *pTabFrm = static_cast< const SwTabFrm * >( pParent );
+ if( pTabFrm->IsFollow() )
+ pTabFrm = pTabFrm->FindMaster();
+
+ while( pTabFrm )
+ {
+ sal_Bool bChanged = _InvalidateChildrenCursorPos( pTabFrm );
+ if( bChanged )
+ {
+ ::vos::ORef< SwAccessibleContext > xAccImpl(
+ GetMap()->GetContextImpl( pTabFrm, sal_False ) );
+ if( xAccImpl.isValid() )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+ xAccImpl->FireAccessibleEvent( aEvent );
+ }
+ }
+
+ pTabFrm = pTabFrm->GetFollow();
+ }
+}
+
+sal_Bool SwAccessibleCell::HasCursor()
+{
+ vos::OGuard aGuard( aMutex );
+ return bIsSelected;
+}
+
+SwAccessibleCell::~SwAccessibleCell()
+{
+}
+
+OUString SAL_CALL SwAccessibleCell::getAccessibleDescription (void)
+ throw (uno::RuntimeException)
+{
+ return GetName();
+}
+
+OUString SAL_CALL SwAccessibleCell::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
+}
+
+sal_Bool SAL_CALL SwAccessibleCell::supportsService(
+ const ::rtl::OUString& sTestServiceName)
+ throw (uno::RuntimeException)
+{
+ return sTestServiceName.equalsAsciiL( sServiceName,
+ sizeof(sServiceName)-1 ) ||
+ sTestServiceName.equalsAsciiL( sAccessibleServiceName,
+ sizeof(sAccessibleServiceName)-1 );
+}
+
+uno::Sequence< OUString > SAL_CALL SwAccessibleCell::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
+ pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ return aRet;
+}
+
+void SwAccessibleCell::Dispose( sal_Bool bRecursive )
+{
+ const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
+ ::vos::ORef< SwAccessibleContext > xAccImpl(
+ GetMap()->GetContextImpl( pParent, sal_False ) );
+ if( xAccImpl.isValid() )
+ xAccImpl->DisposeChild( SwAccessibleChild(GetFrm()), bRecursive );
+ SwAccessibleContext::Dispose( bRecursive );
+}
+
+void SwAccessibleCell::InvalidatePosOrSize( const SwRect& rOldBox )
+{
+ const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
+ ::vos::ORef< SwAccessibleContext > xAccImpl(
+ GetMap()->GetContextImpl( pParent, sal_False ) );
+ if( xAccImpl.isValid() )
+ xAccImpl->InvalidateChildPosOrSize( SwAccessibleChild(GetFrm()), rOldBox );
+ SwAccessibleContext::InvalidatePosOrSize( rOldBox );
+}
+
+
+// ===== XAccessibleInterface ===========================================
+
+uno::Any SwAccessibleCell::queryInterface( const uno::Type& rType )
+ throw( uno::RuntimeException )
+{
+ if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleValue > * >( 0 ) ) )
+ {
+ uno::Reference<XAccessibleValue> xValue = this;
+ uno::Any aRet;
+ aRet <<= xValue;
+ return aRet;
+ }
+ else
+ {
+ return SwAccessibleContext::queryInterface( rType );
+ }
+}
+
+//====== XTypeProvider ====================================================
+uno::Sequence< uno::Type > SAL_CALL SwAccessibleCell::getTypes()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() );
+
+ sal_Int32 nIndex = aTypes.getLength();
+ aTypes.realloc( nIndex + 1 );
+
+ uno::Type* pTypes = aTypes.getArray();
+ pTypes[nIndex] = ::getCppuType( static_cast< uno::Reference< XAccessibleValue > * >( 0 ) );
+
+ return aTypes;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleCell::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+// ===== XAccessibleValue ===============================================
+
+SwFrmFmt* SwAccessibleCell::GetTblBoxFormat() const
+{
+ DBG_ASSERT( GetFrm() != NULL, "no frame?" );
+ DBG_ASSERT( GetFrm()->IsCellFrm(), "no cell frame?" );
+
+ const SwCellFrm* pCellFrm = static_cast<const SwCellFrm*>( GetFrm() );
+ return pCellFrm->GetTabBox()->GetFrmFmt();
+}
+
+
+uno::Any SwAccessibleCell::getCurrentValue( )
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleValue );
+
+ uno::Any aAny;
+ aAny <<= GetTblBoxFormat()->GetTblBoxValue().GetValue();
+ return aAny;
+}
+
+sal_Bool SwAccessibleCell::setCurrentValue( const uno::Any& aNumber )
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleValue );
+
+ double fValue = 0;
+ sal_Bool bValid = (aNumber >>= fValue);
+ if( bValid )
+ {
+ SwTblBoxValue aValue( fValue );
+ GetTblBoxFormat()->SetFmtAttr( aValue );
+ }
+ return bValid;
+}
+
+uno::Any SwAccessibleCell::getMaximumValue( )
+ throw( uno::RuntimeException )
+{
+ uno::Any aAny;
+ aAny <<= DBL_MAX;
+ return aAny;
+}
+
+uno::Any SwAccessibleCell::getMinimumValue( )
+ throw( uno::RuntimeException )
+{
+ uno::Any aAny;
+ aAny <<= -DBL_MAX;
+ return aAny;
+}
diff --git a/sw/source/core/access/acccell.hxx b/sw/source/core/access/acccell.hxx
new file mode 100644
index 000000000000..db3d7d5fd5cb
--- /dev/null
+++ b/sw/source/core/access/acccell.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCCELL_HXX
+#define _ACCCELL_HXX
+
+#include "acccontext.hxx"
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+
+class SwCellFrm;
+class SwFrmFmt;
+
+class SwAccessibleCell : public SwAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleValue
+
+{
+ sal_Bool bIsSelected; // protected by base class mutex
+
+ sal_Bool IsSelected();
+
+ sal_Bool _InvalidateMyCursorPos();
+ sal_Bool _InvalidateChildrenCursorPos( const SwFrm *pFrm );
+
+protected:
+
+ // Set states for getAccessibleStateSet.
+ // This drived class additionaly sets SELECTABLE(1) and SELECTED(+)
+ virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
+
+ virtual void _InvalidateCursorPos();
+
+ virtual ~SwAccessibleCell();
+
+public:
+
+ SwAccessibleCell( SwAccessibleMap* pInitMap, const SwCellFrm *pCellFrm );
+
+ virtual sal_Bool HasCursor(); // required by map to remember that object
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (com::sun::star::uno::RuntimeException);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void Dispose( sal_Bool bRecursive = sal_False );
+
+ virtual void InvalidatePosOrSize( const SwRect& rFrm );
+
+ //===== XInterface ======================================================
+
+ // (XInterface methods need to be implemented to disambiguate
+ // between those inherited through SwAcessibleContext and
+ // XAccessibleValue).
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire( ) throw ()
+ { SwAccessibleContext::acquire(); };
+
+ virtual void SAL_CALL release( ) throw ()
+ { SwAccessibleContext::release(); };
+
+ //====== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleValue ================================================
+
+private:
+ SwFrmFmt* GetTblBoxFormat() const;
+
+public:
+ virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL setCurrentValue(
+ const ::com::sun::star::uno::Any& aNumber )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif
+
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
new file mode 100644
index 000000000000..1b5e66071b84
--- /dev/null
+++ b/sw/source/core/access/acccontext.cxx
@@ -0,0 +1,1604 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+#if (OSL_DEBUG_LEVEL > 1) && defined TEST_MIB
+ #ifndef _STRING_HXX
+ #include <tools/string.hxx>
+ #endif
+
+ #ifndef _STREAM_HXX
+ #include <tools/stream.hxx>
+ #endif
+#endif // #if (OSL_DEBUG_LEVEL > 1) && defined TEST_MIB
+#include <tools/debug.hxx>
+#include <vcl/window.hxx>
+#include <errhdl.hxx>
+#include <swtypes.hxx>
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <viewsh.hxx>
+#include <crsrsh.hxx>
+#include <fesh.hxx>
+#include <txtfrm.hxx>
+#include <ndtxt.hxx>
+#include <pagefrm.hxx>
+#include <flyfrm.hxx>
+#include <dflyobj.hxx>
+#include <pam.hxx>
+#include <viewimp.hxx>
+#include <accmap.hxx>
+#include <accfrmobjslist.hxx>
+#include <acccontext.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <PostItMgr.hxx>
+
+using namespace sw::access;
+
+#if (OSL_DEBUG_LEVEL > 1) && defined TEST_MIB
+#define DBG_MSG( _msg ) \
+ lcl_SwAccessibleContext_DbgMsg( this, _msg, 0, sal_False );
+#define DBG_MSG_CD( _msg ) \
+ lcl_SwAccessibleContext_DbgMsg( this, _msg, 0, sal_True );
+#define DBG_MSG_PARAM( _msg, _param ) \
+ lcl_SwAccessibleContext_DbgMsg( this, _msg, _param, sal_False );
+#define DBG_MSG_THIS_PARAM( _msg, _this, _param ) \
+ lcl_SwAccessibleContext_DbgMsg( _this, _msg, _param, sal_False );
+
+void lcl_SwAccessibleContext_DbgMsg( SwAccessibleContext *pThisAcc,
+ const char *pMsg,
+ SwAccessibleContext *pChildAcc,
+ sal_Bool bConstrDestr );
+#else
+#define DBG_MSG( _msg )
+#define DBG_MSG_PARAM( _msg, _param )
+#define DBG_MSG_THIS_PARAM( _msg, _this, _param )
+#define DBG_MSG_CD( _msg )
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+
+void SwAccessibleContext::InitStates()
+{
+ bIsShowingState = GetMap() ? IsShowing( *(GetMap()) ) : sal_False;
+
+ ViewShell *pVSh = GetMap()->GetShell();
+ bIsEditableState = pVSh && IsEditable( pVSh );
+ bIsOpaqueState = pVSh && IsOpaque( pVSh );
+ bIsDefuncState = sal_False;
+}
+
+void SwAccessibleContext::SetParent( SwAccessibleContext *pParent )
+{
+ vos::OGuard aGuard( aMutex );
+
+ uno::Reference < XAccessible > xParent( pParent );
+ xWeakParent = xParent;
+}
+
+uno::Reference< XAccessible > SwAccessibleContext::GetWeakParent() const
+{
+ vos::OGuard aGuard( aMutex );
+
+ uno::Reference< XAccessible > xParent( xWeakParent );
+ return xParent;
+}
+
+Window *SwAccessibleContext::GetWindow()
+{
+ Window *pWin = 0;
+
+ if( GetMap() )
+ {
+ const ViewShell *pVSh = GetMap()->GetShell();
+ ASSERT( pVSh, "no view shell" );
+ if( pVSh )
+ pWin = pVSh->GetWin();
+
+ ASSERT( pWin, "no window" );
+ }
+
+ return pWin;
+}
+
+// get ViewShell from accessibility map, and cast to cursor shell
+SwCrsrShell* SwAccessibleContext::GetCrsrShell()
+{
+ SwCrsrShell* pCrsrShell;
+ ViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : 0;
+ ASSERT( pViewShell, "no view shell" );
+ if( pViewShell && pViewShell->ISA( SwCrsrShell ) )
+ pCrsrShell = static_cast<SwCrsrShell*>( pViewShell );
+ else
+ pCrsrShell = NULL;
+
+ return pCrsrShell;
+}
+
+const SwCrsrShell* SwAccessibleContext::GetCrsrShell() const
+{
+ // just like non-const GetCrsrShell
+ const SwCrsrShell* pCrsrShell;
+ const ViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : 0;
+ ASSERT( pViewShell, "no view shell" );
+ if( pViewShell && pViewShell->ISA( SwCrsrShell ) )
+ pCrsrShell = static_cast<const SwCrsrShell*>( pViewShell );
+ else
+ pCrsrShell = NULL;
+
+ return pCrsrShell;
+}
+
+
+enum Action { NONE, SCROLLED, SCROLLED_WITHIN,
+ SCROLLED_IN, SCROLLED_OUT };
+
+void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
+ const SwRect& rOldVisArea )
+{
+ const SwRect& rNewVisArea = GetVisArea();
+ const bool bVisibleChildrenOnly = SwAccessibleChild( pFrm ).IsVisibleChildrenOnly();
+
+ const SwAccessibleChildSList aList( *pFrm, *(GetMap()) );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ while( aIter != aList.end() )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwRect aBox( rLower.GetBox( *(GetMap()) ) );
+ if( rLower.IsAccessible( GetShell()->IsPreView() ) )
+ {
+ Action eAction = NONE;
+ if( aBox.IsOver( rNewVisArea ) )
+ {
+ if( aBox.IsOver( rOldVisArea ) )
+ {
+ eAction = SCROLLED_WITHIN;
+ }
+ else
+ {
+ if ( bVisibleChildrenOnly &&
+ !rLower.AlwaysIncludeAsChild() )
+ {
+ eAction = SCROLLED_IN;
+ }
+ else
+ {
+ eAction = SCROLLED;
+ }
+ }
+ }
+ else if( aBox.IsOver( rOldVisArea ) )
+ {
+ if ( bVisibleChildrenOnly &&
+ !rLower.AlwaysIncludeAsChild() )
+ {
+ eAction = SCROLLED_OUT;
+ }
+ else
+ {
+ eAction = SCROLLED;
+ }
+ }
+ else if( !bVisibleChildrenOnly ||
+ rLower.AlwaysIncludeAsChild() )
+ {
+ // This wouldn't be required if the SwAccessibleFrame,
+ // wouldn't know about the vis area.
+ eAction = SCROLLED;
+ }
+ if( NONE != eAction )
+ {
+ if ( rLower.GetSwFrm() )
+ {
+ ASSERT( !rLower.AlwaysIncludeAsChild(),
+ "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
+ const SwFrm* pLower( rLower.GetSwFrm() );
+ ::vos::ORef< SwAccessibleContext > xAccImpl =
+ GetMap()->GetContextImpl( pLower, SCROLLED_OUT == eAction ||
+ SCROLLED_IN == eAction );
+ if( xAccImpl.isValid() )
+ {
+ switch( eAction )
+ {
+ case SCROLLED:
+ xAccImpl->Scrolled( rOldVisArea );
+ break;
+ case SCROLLED_WITHIN:
+ xAccImpl->ScrolledWithin( rOldVisArea );
+ break;
+ case SCROLLED_IN:
+ xAccImpl->ScrolledIn();
+ break;
+ case SCROLLED_OUT:
+ xAccImpl->ScrolledOut( rOldVisArea );
+ break;
+ case NONE:
+ break;
+ }
+ }
+ else
+ {
+ ChildrenScrolled( pLower, rOldVisArea );
+ }
+ }
+ else if ( rLower.GetDrawObject() )
+ {
+ ASSERT( !rLower.AlwaysIncludeAsChild(),
+ "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
+ ::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
+ GetMap()->GetContextImpl( rLower.GetDrawObject(),
+ this,
+ SCROLLED_OUT == eAction ||
+ SCROLLED_IN == eAction );
+ if( xAccImpl.isValid() )
+ {
+ switch( eAction )
+ {
+ case SCROLLED:
+ case SCROLLED_WITHIN:
+ xAccImpl->ViewForwarderChanged(
+ ::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA,
+ GetMap() );
+ break;
+ case SCROLLED_IN:
+ ScrolledInShape( rLower.GetDrawObject(),
+ xAccImpl.getBodyPtr() );
+ break;
+ case SCROLLED_OUT:
+ {
+ xAccImpl->ViewForwarderChanged(
+ ::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA,
+ GetMap() );
+ DisposeShape( rLower.GetDrawObject(),
+ xAccImpl.getBodyPtr() );
+ }
+ break;
+ case NONE:
+ break;
+ }
+ }
+ }
+ else if ( rLower.GetWindow() )
+ {
+ // nothing to do - as such children are always included as children.
+ ASSERT( rLower.AlwaysIncludeAsChild(),
+ "<SwAccessibleContext::ChildrenScrolled(..)> - not always included child not considered!" );
+ }
+ }
+ }
+ else if ( rLower.GetSwFrm() &&
+ ( !bVisibleChildrenOnly ||
+ aBox.IsOver( rOldVisArea ) ||
+ aBox.IsOver( rNewVisArea ) ) )
+ {
+ // There are no unaccessible SdrObjects that need to be notified
+ ChildrenScrolled( rLower.GetSwFrm(), rOldVisArea );
+ }
+ ++aIter;
+ }
+}
+
+void SwAccessibleContext::Scrolled( const SwRect& rOldVisArea )
+{
+ SetVisArea( GetMap()->GetVisArea() );
+
+ ChildrenScrolled( GetFrm(), rOldVisArea );
+
+ sal_Bool bIsOldShowingState;
+ sal_Bool bIsNewShowingState = IsShowing( *(GetMap()) );
+ {
+ vos::OGuard aGuard( aMutex );
+ bIsOldShowingState = bIsShowingState;
+ bIsShowingState = bIsNewShowingState;
+ }
+
+ if( bIsOldShowingState != bIsNewShowingState )
+ FireStateChangedEvent( AccessibleStateType::SHOWING,
+ bIsNewShowingState );
+}
+
+void SwAccessibleContext::ScrolledWithin( const SwRect& rOldVisArea )
+{
+ SetVisArea( GetMap()->GetVisArea() );
+
+ ChildrenScrolled( GetFrm(), rOldVisArea );
+
+ FireVisibleDataEvent();
+}
+
+void SwAccessibleContext::ScrolledIn()
+{
+ // This accessible should be freshly created, because it
+ // was not visisble before. Therefor, its vis area must already
+ // reflect the scrolling.
+ ASSERT( GetVisArea() == GetMap()->GetVisArea(),
+ "Vis area of child is wrong. Did it exist already?" );
+
+ // Send child event at parent. That's all we have to do here.
+ const SwFrm* pParent = GetParent();
+ ::vos::ORef< SwAccessibleContext > xParentImpl(
+ GetMap()->GetContextImpl( pParent, sal_False ) );
+ uno::Reference < XAccessibleContext > xThis( this );
+ if( xParentImpl.isValid() )
+ {
+ SetParent( xParentImpl.getBodyPtr() );
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xThis;
+
+ xParentImpl->FireAccessibleEvent( aEvent );
+ DBG_MSG_PARAM( "AccessibleChild (added)", xChildImpl.getBodyPtr() );
+
+ if( HasCursor() )
+ {
+ Window *pWin = GetWindow();
+ if( pWin && pWin->HasFocus() )
+ {
+ FireStateChangedEvent( AccessibleStateType::FOCUSED, sal_True );
+ }
+ }
+
+ }
+}
+
+void SwAccessibleContext::ScrolledOut( const SwRect& rOldVisArea )
+{
+ SetVisArea( GetMap()->GetVisArea() );
+
+ // First of all, update the children. That's required to dispose
+ // all children that are existing only if they are visible. They
+ // are not disposed by the recusive Dispose call that follows later on,
+ // because this call will only dispose children that are in the
+ // new vis area. The children we want to dispode however are in the
+ // old vis area all.
+ ChildrenScrolled( GetFrm(), rOldVisArea );
+
+ // Broadcast a state changed event for the showing state.
+ // It might be that the child is freshly created just to send
+ // the child event. In this case no listener will exist.
+ FireStateChangedEvent( AccessibleStateType::SHOWING, sal_False );
+
+ // We now dispose the frame
+ Dispose( sal_True );
+}
+
+// --> OD 2005-12-12 #i27301# - use new type definition for <_nStates>
+void SwAccessibleContext::InvalidateChildrenStates( const SwFrm* _pFrm,
+ tAccessibleStates _nStates )
+{
+ const SwAccessibleChildSList aVisList( GetVisArea(), *_pFrm, *(GetMap()) );
+
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
+ while( aIter != aVisList.end() )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm* pLower = rLower.GetSwFrm();
+ if( pLower )
+ {
+ ::vos::ORef< SwAccessibleContext > xAccImpl;
+ if( rLower.IsAccessible( GetShell()->IsPreView() ) )
+ xAccImpl = GetMap()->GetContextImpl( pLower, sal_False );
+ if( xAccImpl.isValid() )
+ xAccImpl->InvalidateStates( _nStates );
+ else
+ InvalidateChildrenStates( pLower, _nStates );
+ }
+ else if ( rLower.GetDrawObject() )
+ {
+ // TODO: SdrObjects
+ }
+ else if ( rLower.GetWindow() )
+ {
+ // nothing to do ?
+ }
+
+ ++aIter;
+ }
+}
+// <--
+
+void SwAccessibleContext::DisposeChildren( const SwFrm *pFrm,
+ sal_Bool bRecursive )
+{
+ const SwAccessibleChildSList aVisList( GetVisArea(), *pFrm, *(GetMap()) );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
+ while( aIter != aVisList.end() )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm* pLower = rLower.GetSwFrm();
+ if( pLower )
+ {
+ ::vos::ORef< SwAccessibleContext > xAccImpl;
+ if( rLower.IsAccessible( GetShell()->IsPreView() ) )
+ xAccImpl = GetMap()->GetContextImpl( pLower, sal_False );
+ if( xAccImpl.isValid() )
+ xAccImpl->Dispose( bRecursive );
+ else if( bRecursive )
+ DisposeChildren( pLower, bRecursive );
+ }
+ else if ( rLower.GetDrawObject() )
+ {
+ ::vos::ORef< ::accessibility::AccessibleShape > xAccImpl(
+ GetMap()->GetContextImpl( rLower.GetDrawObject(),
+ this, sal_False ) );
+ if( xAccImpl.isValid() )
+ DisposeShape( rLower.GetDrawObject(), xAccImpl.getBodyPtr() );
+ }
+ else if ( rLower.GetWindow() )
+ {
+ DisposeChild( rLower, sal_False );
+ }
+ ++aIter;
+ }
+}
+
+void SwAccessibleContext::_InvalidateContent( sal_Bool )
+{
+}
+
+void SwAccessibleContext::_InvalidateCursorPos()
+{
+}
+
+void SwAccessibleContext::_InvalidateFocus()
+{
+}
+
+void SwAccessibleContext::FireAccessibleEvent( AccessibleEventObject& rEvent )
+{
+ ASSERT( GetFrm(), "fire event for diposed frame?" );
+ if( !GetFrm() )
+ return;
+
+ if( !rEvent.Source.is() )
+ {
+ uno::Reference < XAccessibleContext > xThis( this );
+ rEvent.Source = xThis;
+ }
+
+ if (nClientId)
+ comphelper::AccessibleEventNotifier::addEvent( nClientId, rEvent );
+}
+
+void SwAccessibleContext::FireVisibleDataEvent()
+{
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
+
+ FireAccessibleEvent( aEvent );
+ DBG_MSG( "AccessibleVisibleData" )
+}
+
+void SwAccessibleContext::FireStateChangedEvent( sal_Int16 nState,
+ sal_Bool bNewState )
+{
+ AccessibleEventObject aEvent;
+
+ aEvent.EventId = AccessibleEventId::STATE_CHANGED;
+ if( bNewState )
+ aEvent.NewValue <<= nState;
+ else
+ aEvent.OldValue <<= nState;
+
+ FireAccessibleEvent( aEvent );
+ DBG_MSG( "StateChanged" )
+}
+
+void SwAccessibleContext::GetStates(
+ ::utl::AccessibleStateSetHelper& rStateSet )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // SHOWING
+ if( bIsShowingState )
+ rStateSet.AddState( AccessibleStateType::SHOWING );
+
+ // EDITABLE
+ if( bIsEditableState )
+ rStateSet.AddState( AccessibleStateType::EDITABLE );
+
+ // ENABLED
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+
+ // OPAQUE
+ if( bIsOpaqueState )
+ rStateSet.AddState( AccessibleStateType::OPAQUE );
+
+ // VISIBLE
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+
+ if( bIsDefuncState )
+ rStateSet.AddState( AccessibleStateType::DEFUNC );
+}
+
+sal_Bool SwAccessibleContext::IsEditableState()
+{
+ sal_Bool bRet;
+ {
+ vos::OGuard aGuard( aMutex );
+ bRet = bIsEditableState;
+ }
+
+ return bRet;
+}
+
+SwAccessibleContext::SwAccessibleContext( SwAccessibleMap *pM,
+ sal_Int16 nR,
+ const SwFrm *pF )
+ : SwAccessibleFrame( pM->GetVisArea().SVRect(), pF,
+ pM->GetShell()->IsPreView() )
+ , pMap( pM )
+ , nClientId(0)
+ , nRole( nR )
+ , bDisposing( sal_False )
+ , bRegisteredAtAccessibleMap( true )
+{
+ InitStates();
+ DBG_MSG_CD( "constructed" )
+}
+
+SwAccessibleContext::~SwAccessibleContext()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ DBG_MSG_CD( "destructed" )
+ RemoveFrmFromAccessibleMap();
+}
+
+uno::Reference< XAccessibleContext > SAL_CALL
+ SwAccessibleContext::getAccessibleContext( void )
+ throw (uno::RuntimeException)
+{
+ uno::Reference < XAccessibleContext > xRet( this );
+ return xRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleChildCount( void )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ return bDisposing ? 0 : GetChildCount( *(GetMap()) );
+}
+
+uno::Reference< XAccessible> SAL_CALL
+ SwAccessibleContext::getAccessibleChild( sal_Int32 nIndex )
+ throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ const SwAccessibleChild aChild( GetChild( *(GetMap()), nIndex ) );
+ if( !aChild.IsValid() )
+ {
+ uno::Reference < XAccessibleContext > xThis( this );
+ lang::IndexOutOfBoundsException aExcept(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("index out of bounds") ),
+ xThis );
+ throw aExcept;
+ }
+
+ uno::Reference< XAccessible > xChild;
+ if( aChild.GetSwFrm() )
+ {
+ ::vos::ORef < SwAccessibleContext > xChildImpl(
+ GetMap()->GetContextImpl( aChild.GetSwFrm(), !bDisposing ) );
+ if( xChildImpl.isValid() )
+ {
+ xChildImpl->SetParent( this );
+ xChild = xChildImpl.getBodyPtr();
+ }
+ }
+ else if ( aChild.GetDrawObject() )
+ {
+ ::vos::ORef < ::accessibility::AccessibleShape > xChildImpl(
+ GetMap()->GetContextImpl( aChild.GetDrawObject(),
+ this, !bDisposing ) );
+ if( xChildImpl.isValid() )
+ xChild = xChildImpl.getBodyPtr();
+ }
+ else if ( aChild.GetWindow() )
+ {
+ xChild = aChild.GetWindow()->GetAccessible();
+ }
+
+ return xChild;
+}
+
+uno::Reference< XAccessible> SAL_CALL SwAccessibleContext::getAccessibleParent (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ const SwFrm *pUpper = GetParent();
+ ASSERT( pUpper != 0 || bDisposing, "no upper found" );
+
+ uno::Reference< XAccessible > xAcc;
+ if( pUpper )
+ xAcc = GetMap()->GetContext( pUpper, !bDisposing );
+
+ ASSERT( xAcc.is() || bDisposing, "no parent found" );
+
+ // Remember the parent as weak ref.
+ {
+ vos::OGuard aWeakParentGuard( aMutex );
+ xWeakParent = xAcc;
+ }
+
+ return xAcc;
+}
+
+sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleIndexInParent (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ const SwFrm *pUpper = GetParent();
+ ASSERT( pUpper != 0 || bDisposing, "no upper found" );
+
+ sal_Int32 nIndex = -1;
+ if( pUpper )
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl(
+ GetMap()->GetContextImpl( pUpper, !bDisposing ) );
+ ASSERT( xAccImpl.isValid() || bDisposing, "no parent found" );
+ if( xAccImpl.isValid() )
+ nIndex = xAccImpl->GetChildIndex( *(GetMap()), SwAccessibleChild(GetFrm()) );
+ }
+
+ return nIndex;
+}
+
+sal_Int16 SAL_CALL SwAccessibleContext::getAccessibleRole (void)
+ throw (uno::RuntimeException)
+{
+ return nRole;
+}
+
+OUString SAL_CALL SwAccessibleContext::getAccessibleDescription (void)
+ throw (uno::RuntimeException)
+{
+ ASSERT( !this, "description needs to be overloaded" );
+ THROW_RUNTIME_EXCEPTION( XAccessibleContext, "internal error (method must be overloaded)" );
+}
+
+OUString SAL_CALL SwAccessibleContext::getAccessibleName (void)
+ throw (uno::RuntimeException)
+{
+ return sName;
+}
+
+uno::Reference< XAccessibleRelationSet> SAL_CALL
+ SwAccessibleContext::getAccessibleRelationSet (void)
+ throw (uno::RuntimeException)
+{
+ // by default there are no relations
+ uno::Reference< XAccessibleRelationSet> xRet( new utl::AccessibleRelationSetHelper() );
+ return xRet;
+}
+
+uno::Reference<XAccessibleStateSet> SAL_CALL
+ SwAccessibleContext::getAccessibleStateSet (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ ::utl::AccessibleStateSetHelper *pStateSet =
+ new ::utl::AccessibleStateSetHelper;
+
+ uno::Reference<XAccessibleStateSet> xStateSet( pStateSet );
+ GetStates( *pStateSet );
+
+ return xStateSet;
+}
+
+lang::Locale SAL_CALL SwAccessibleContext::getLocale (void)
+ throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ lang::Locale aLoc( Application::GetSettings().GetLocale() );
+ return aLoc;
+}
+
+void SAL_CALL SwAccessibleContext::addEventListener(
+ const uno::Reference< XAccessibleEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ DBG_MSG( "accessible event listener added" )
+
+ if (xListener.is())
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (!nClientId)
+ nClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( nClientId, xListener );
+ }
+}
+
+void SAL_CALL SwAccessibleContext::removeEventListener(
+ const uno::Reference< XAccessibleEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ DBG_MSG( "accessible event listener removed" )
+
+ if (xListener.is())
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( nClientId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ comphelper::AccessibleEventNotifier::revokeClient( nClientId );
+ nClientId = 0;
+ }
+ }
+}
+
+static sal_Bool lcl_PointInRectangle(const awt::Point & aPoint,
+ const awt::Rectangle & aRect)
+{
+ long nDiffX = aPoint.X - aRect.X;
+ long nDiffY = aPoint.Y - aRect.Y;
+
+ return
+ nDiffX >= 0 && nDiffX < aRect.Width && nDiffY >= 0 &&
+ nDiffY < aRect.Height;
+
+}
+
+sal_Bool SAL_CALL SwAccessibleContext::containsPoint(
+ const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aPixBounds = getBoundsImpl(sal_True);
+ aPixBounds.X = 0;
+ aPixBounds.Y = 0;
+
+ return lcl_PointInRectangle(aPoint, aPixBounds);
+}
+
+uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint(
+ const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleComponent )
+
+ uno::Reference< XAccessible > xAcc;
+
+ Window *pWin = GetWindow();
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+
+ Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to parent
+ if( !GetFrm()->IsRootFrm() )
+ {
+ SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
+ Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
+ aPixPoint.X() += aPixPos.X();
+ aPixPoint.Y() += aPixPos.Y();
+ }
+
+ const SwAccessibleChild aChild( GetChildAtPixel( aPixPoint, *(GetMap()) ) );
+ if( aChild.GetSwFrm() )
+ {
+ xAcc = GetMap()->GetContext( aChild.GetSwFrm() );
+ }
+ else if( aChild.GetDrawObject() )
+ {
+ xAcc = GetMap()->GetContext( aChild.GetDrawObject(), this );
+ }
+ else if ( aChild.GetWindow() )
+ {
+ xAcc = aChild.GetWindow()->GetAccessible();
+ }
+
+ return xAcc;
+}
+
+
+/**
+ Get bounding box.
+
+ There are two modes.
+
+ - realative
+
+ Return bounding box relative to parent if parent is no root
+ frame. Otherwise return the absolute bounding box.
+
+ - absolute
+
+ Return the absolute bounding box.
+
+ @param bRelative
+ true: Use relative mode.
+ false: Use absolute mode.
+*/
+awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(sal_Bool bRelative)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleComponent )
+
+ const SwFrm *pParent = GetParent();
+ ASSERT( pParent, "no Parent found" );
+ Window *pWin = GetWindow();
+
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin && pParent )
+
+ SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
+ Rectangle aPixBounds( 0, 0, 0, 0 );
+ if( GetFrm()->IsPageFrm() &&
+ static_cast < const SwPageFrm * >( GetFrm() )->IsEmptyPage() )
+ {
+ ASSERT( GetShell()->IsPreView(), "empty page accessible?" );
+ if( GetShell()->IsPreView() )
+ {
+ // OD 15.01.2003 #103492# - adjust method call <GetMap()->GetPreViewPageSize()>
+ sal_uInt16 nPageNum =
+ static_cast < const SwPageFrm * >( GetFrm() )->GetPhyPageNum();
+ aLogBounds.SSize( GetMap()->GetPreViewPageSize( nPageNum ) );
+ }
+ }
+ if( !aLogBounds.IsEmpty() )
+ {
+ aPixBounds = GetMap()->CoreToPixel( aLogBounds.SVRect() );
+ if( !pParent->IsRootFrm() && bRelative)
+ {
+ SwRect aParentLogBounds( GetBounds( *(GetMap()), pParent ) ); // twip rel to doc root
+ Point aParentPixPos( GetMap()->CoreToPixel( aParentLogBounds.SVRect() ).TopLeft() );
+ aPixBounds.Move( -aParentPixPos.X(), -aParentPixPos.Y() );
+ }
+ }
+
+ awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
+ aPixBounds.GetWidth(), aPixBounds.GetHeight() );
+
+ return aBox;
+}
+
+
+awt::Rectangle SAL_CALL SwAccessibleContext::getBounds()
+ throw (uno::RuntimeException)
+{
+ return getBoundsImpl(sal_True);
+}
+
+awt::Point SAL_CALL SwAccessibleContext::getLocation()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aRect = getBoundsImpl(sal_True);
+ awt::Point aPoint(aRect.X, aRect.Y);
+
+ return aPoint;
+}
+
+
+
+awt::Point SAL_CALL SwAccessibleContext::getLocationOnScreen()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aRect = getBoundsImpl(sal_False);
+
+ Point aPixPos(aRect.X, aRect.Y);
+
+ /* getBoundsImpl already checked that GetWindow returns valid pointer. */
+ aPixPos = GetWindow()->OutputToAbsoluteScreenPixel(aPixPos);
+ awt::Point aPoint(aPixPos.X(), aPixPos.Y());
+
+ return aPoint;
+}
+
+
+awt::Size SAL_CALL SwAccessibleContext::getSize()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aRect = getBoundsImpl(sal_False);
+ awt::Size aSize( aRect.Width, aRect.Height );
+
+ return aSize;
+}
+
+void SAL_CALL SwAccessibleContext::grabFocus()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext );
+
+ if( GetFrm()->IsFlyFrm() )
+ {
+ const SdrObject *pObj =
+ static_cast < const SwFlyFrm * >( GetFrm() )->GetVirtDrawObj();
+ if( pObj )
+ Select( const_cast < SdrObject * >( pObj ), sal_False );
+ }
+ else
+ {
+ const SwCntntFrm *pCFrm = 0;
+ if( GetFrm()->IsCntntFrm() )
+ pCFrm = static_cast< const SwCntntFrm * >( GetFrm() );
+ else if( GetFrm()->IsLayoutFrm() )
+ pCFrm = static_cast< const SwLayoutFrm * >( GetFrm() )->ContainsCntnt();
+
+ if( pCFrm && pCFrm->IsTxtFrm() )
+ {
+ const SwTxtFrm *pTxtFrm = static_cast< const SwTxtFrm * >( pCFrm );
+ const SwTxtNode *pTxtNd = pTxtFrm->GetTxtNode();
+ if( pTxtNd )
+ {
+ // create pam for selection
+ SwIndex aIndex( const_cast< SwTxtNode * >( pTxtNd ),
+ pTxtFrm->GetOfst() );
+ SwPosition aStartPos( *pTxtNd, aIndex );
+ SwPaM aPaM( aStartPos );
+
+ // set PaM at cursor shell
+ Select( aPaM );
+ }
+ }
+ }
+}
+
+
+uno::Any SAL_CALL SwAccessibleContext::getAccessibleKeyBinding()
+ throw (uno::RuntimeException)
+{
+ // There are no key bindings
+ return uno::Any();
+}
+
+sal_Int32 SAL_CALL SwAccessibleContext::getForeground()
+ throw (uno::RuntimeException)
+{
+ return 0;
+}
+
+sal_Int32 SAL_CALL SwAccessibleContext::getBackground()
+ throw (uno::RuntimeException)
+{
+ return 0xffffff;
+}
+
+
+OUString SAL_CALL SwAccessibleContext::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ ASSERT( !this, "implementation name needs to be overloaded" );
+
+ THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "implementation name needs to be overloaded" )
+}
+
+sal_Bool SAL_CALL
+ SwAccessibleContext::supportsService (const ::rtl::OUString& )
+ throw (uno::RuntimeException)
+{
+ ASSERT( !this, "supports service needs to be overloaded" );
+ THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "supports service needs to be overloaded" )
+}
+
+uno::Sequence< OUString > SAL_CALL SwAccessibleContext::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ ASSERT( !this, "supported services names needs to be overloaded" );
+ THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "supported services needs to be overloaded" )
+}
+
+void SwAccessibleContext::DisposeShape( const SdrObject *pObj,
+ ::accessibility::AccessibleShape *pAccImpl )
+{
+ ::vos::ORef< ::accessibility::AccessibleShape > xAccImpl( pAccImpl );
+ if( !xAccImpl.isValid() )
+ xAccImpl = GetMap()->GetContextImpl( pObj, this, sal_True );
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ uno::Reference< XAccessible > xAcc( xAccImpl.getBodyPtr() );
+ aEvent.OldValue <<= xAcc;
+ FireAccessibleEvent( aEvent );
+
+ GetMap()->RemoveContext( pObj );
+ xAccImpl->dispose();
+}
+
+void SwAccessibleContext::ScrolledInShape( const SdrObject* ,
+ ::accessibility::AccessibleShape *pAccImpl )
+{
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ uno::Reference< XAccessible > xAcc( pAccImpl );
+ aEvent.NewValue <<= xAcc;
+ FireAccessibleEvent( aEvent );
+
+ if( pAccImpl->GetState( AccessibleStateType::FOCUSED ) )
+ {
+ Window *pWin = GetWindow();
+ if( pWin && pWin->HasFocus() )
+ {
+ AccessibleEventObject aStateChangedEvent;
+ aStateChangedEvent.EventId = AccessibleEventId::STATE_CHANGED;
+ aStateChangedEvent.NewValue <<= AccessibleStateType::FOCUSED;
+ aStateChangedEvent.Source = xAcc;
+
+ FireAccessibleEvent( aStateChangedEvent );
+ }
+ }
+}
+
+void SwAccessibleContext::Dispose( sal_Bool bRecursive )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ ASSERT( GetFrm() && GetMap(), "already disposed" );
+ ASSERT( GetMap()->GetVisArea() == GetVisArea(),
+ "invalid vis area for dispose" );
+
+ bDisposing = sal_True;
+
+ // dispose children
+ if( bRecursive )
+ DisposeChildren( GetFrm(), bRecursive );
+
+ // get parent
+ uno::Reference< XAccessible > xParent( GetWeakParent() );
+ uno::Reference < XAccessibleContext > xThis( this );
+
+ // send child event at parent
+ if( xParent.is() )
+ {
+ SwAccessibleContext *pAcc = (SwAccessibleContext *)xParent.get();
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.OldValue <<= xThis;
+ pAcc->FireAccessibleEvent( aEvent );
+ DBG_MSG_THIS_PARAM( "AccessibleChild (removed)", pAcc, this )
+ }
+
+ // set defunc state (its not required to broadcast a state changed
+ // event if the object is diposed afterwards)
+ {
+ vos::OGuard aDefuncStateGuard( aMutex );
+ bIsDefuncState = sal_True;
+ }
+
+ // broadcast dispose event
+ if ( nClientId )
+ {
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, *this );
+ nClientId = 0;
+ DBG_MSG_CD( "dispose" )
+ }
+
+ RemoveFrmFromAccessibleMap();
+ ClearFrm();
+ pMap = 0;
+
+ bDisposing = sal_False;
+}
+
+void SwAccessibleContext::DisposeChild( const SwAccessibleChild& rChildFrmOrObj,
+ sal_Bool bRecursive )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if ( IsShowing( *(GetMap()), rChildFrmOrObj ) ||
+ rChildFrmOrObj.AlwaysIncludeAsChild() ||
+ !SwAccessibleChild( GetFrm() ).IsVisibleChildrenOnly() )
+ {
+ // If the object could have existed before, than there is nothing to do,
+ // because no wrapper exists now and therefor no one is interested to
+ // get notified of the movement.
+ if( rChildFrmOrObj.GetSwFrm() )
+ {
+ ::vos::ORef< SwAccessibleContext > xAccImpl =
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetSwFrm(),
+ sal_True );
+ xAccImpl->Dispose( bRecursive );
+ }
+ else if ( rChildFrmOrObj.GetDrawObject() )
+ {
+ ::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
+ this, sal_True );
+ DisposeShape( rChildFrmOrObj.GetDrawObject(),
+ xAccImpl.getBodyPtr() );
+ }
+ else if ( rChildFrmOrObj.GetWindow() )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ uno::Reference< XAccessible > xAcc =
+ rChildFrmOrObj.GetWindow()->GetAccessible();
+ aEvent.OldValue <<= xAcc;
+ FireAccessibleEvent( aEvent );
+ }
+ }
+ else if( bRecursive && rChildFrmOrObj.GetSwFrm() )
+ DisposeChildren( rChildFrmOrObj.GetSwFrm(), bRecursive );
+}
+
+void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ ASSERT( GetFrm() && !GetFrm()->Frm().IsEmpty(), "context should have a size" );
+
+ sal_Bool bIsOldShowingState;
+ sal_Bool bIsNewShowingState = IsShowing( *(GetMap()) );
+ {
+ vos::OGuard aShowingStateGuard( aMutex );
+ bIsOldShowingState = bIsShowingState;
+ bIsShowingState = bIsNewShowingState;
+ }
+
+ if( bIsOldShowingState != bIsNewShowingState )
+ {
+ FireStateChangedEvent( AccessibleStateType::SHOWING,
+ bIsNewShowingState );
+ }
+ else if( bIsNewShowingState )
+ {
+ // The frame stays visible -> broadcast event
+ FireVisibleDataEvent();
+ }
+
+ if( !bIsNewShowingState &&
+ SwAccessibleChild( GetParent() ).IsVisibleChildrenOnly() )
+ {
+ // The frame is now invisible -> dispose it
+ Dispose( sal_True );
+ }
+ else
+ {
+ _InvalidateContent( sal_True );
+ }
+}
+
+void SwAccessibleContext::InvalidateChildPosOrSize(
+ const SwAccessibleChild& rChildFrmOrObj,
+ const SwRect& rOldFrm )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ ASSERT( !rChildFrmOrObj.GetSwFrm() ||
+ !rChildFrmOrObj.GetSwFrm()->Frm().IsEmpty(),
+ "child context should have a size" );
+
+ if ( rChildFrmOrObj.AlwaysIncludeAsChild() )
+ {
+ // nothing to do;
+ return;
+ }
+
+ const bool bVisibleChildrenOnly = SwAccessibleChild( GetFrm() ).IsVisibleChildrenOnly();
+ const bool bNew = rOldFrm.IsEmpty() ||
+ ( rOldFrm.Left() == 0 && rOldFrm.Top() == 0 );
+ if( IsShowing( *(GetMap()), rChildFrmOrObj ) )
+ {
+ // If the object could have existed before, than there is nothing to do,
+ // because no wrapper exists now and therefor no one is interested to
+ // get notified of the movement.
+ if( bNew || (bVisibleChildrenOnly && !IsShowing( rOldFrm )) )
+ {
+ if( rChildFrmOrObj.GetSwFrm() )
+ {
+ // The frame becomes visible. A child event must be send.
+ ::vos::ORef< SwAccessibleContext > xAccImpl =
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetSwFrm(),
+ sal_True );
+ xAccImpl->ScrolledIn();
+ }
+ else if ( rChildFrmOrObj.GetDrawObject() )
+ {
+ ::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
+ this, sal_True );
+ // --> OD 2004-11-29 #i37790#
+ if ( xAccImpl.isValid() )
+ {
+ ScrolledInShape( rChildFrmOrObj.GetDrawObject(),
+ xAccImpl.getBodyPtr() );
+ }
+ else
+ {
+ ASSERT( false ,
+ "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - no accessible shape found." );
+ }
+ // <--
+ }
+ else if ( rChildFrmOrObj.GetWindow() )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= (rChildFrmOrObj.GetWindow()->GetAccessible());
+ FireAccessibleEvent( aEvent );
+ }
+ }
+ }
+ else
+ {
+ // If the frame was visible before, than a child event for the parent
+ // needs to be send. However, there is no wrapper existing, and so
+ // no notifications for grandchildren are required. If the are
+ // grandgrandchildren, they would be notified by the layout.
+ if( bVisibleChildrenOnly &&
+ !bNew && IsShowing( rOldFrm ) )
+ {
+ if( rChildFrmOrObj.GetSwFrm() )
+ {
+ ::vos::ORef< SwAccessibleContext > xAccImpl =
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetSwFrm(),
+ sal_True );
+ xAccImpl->SetParent( this );
+ xAccImpl->Dispose( sal_True );
+ }
+ else if ( rChildFrmOrObj.GetDrawObject() )
+ {
+ ::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
+ this, sal_True );
+ DisposeShape( rChildFrmOrObj.GetDrawObject(),
+ xAccImpl.getBodyPtr() );
+ }
+ else if ( rChildFrmOrObj.GetWindow() )
+ {
+ ASSERT( false,
+ "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - not expected to handle dispose of child of type <Window>." );
+ }
+ }
+ }
+}
+
+void SwAccessibleContext::InvalidateContent()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ _InvalidateContent( sal_False );
+}
+
+void SwAccessibleContext::InvalidateCursorPos()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ _InvalidateCursorPos();
+}
+
+void SwAccessibleContext::InvalidateFocus()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ _InvalidateFocus();
+}
+
+// --> OD 2005-12-12 #i27301# - use new type definition for <_nStates>
+void SwAccessibleContext::InvalidateStates( tAccessibleStates _nStates )
+{
+ if( GetMap() )
+ {
+ ViewShell *pVSh = GetMap()->GetShell();
+ if( pVSh )
+ {
+ if( (_nStates & ACC_STATE_EDITABLE) != 0 )
+ {
+ sal_Bool bIsOldEditableState;
+ sal_Bool bIsNewEditableState = IsEditable( pVSh );
+ {
+ vos::OGuard aGuard( aMutex );
+ bIsOldEditableState = bIsEditableState;
+ bIsEditableState = bIsNewEditableState;
+ }
+
+ if( bIsOldEditableState != bIsNewEditableState )
+ FireStateChangedEvent( AccessibleStateType::EDITABLE,
+ bIsNewEditableState );
+ }
+ if( (_nStates & ACC_STATE_OPAQUE) != 0 )
+ {
+ sal_Bool bIsOldOpaqueState;
+ sal_Bool bIsNewOpaqueState = IsOpaque( pVSh );
+ {
+ vos::OGuard aGuard( aMutex );
+ bIsOldOpaqueState = bIsOpaqueState;
+ bIsOpaqueState = bIsNewOpaqueState;
+ }
+
+ if( bIsOldOpaqueState != bIsNewOpaqueState )
+ FireStateChangedEvent( AccessibleStateType::OPAQUE,
+ bIsNewOpaqueState );
+ }
+ }
+
+ InvalidateChildrenStates( GetFrm(), _nStates );
+ }
+}
+// <--
+
+void SwAccessibleContext::InvalidateRelation( sal_uInt16 nType )
+{
+ AccessibleEventObject aEvent;
+ aEvent.EventId = nType;
+
+ FireAccessibleEvent( aEvent );
+}
+
+/** text selection has changed
+
+ OD 2005-12-14 #i27301#
+
+ @author OD
+*/
+void SwAccessibleContext::InvalidateTextSelection()
+{
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
+
+ FireAccessibleEvent( aEvent );
+}
+
+/** attributes has changed
+
+ OD 2009-01-06 #i88069#
+
+ @author OD
+*/
+void SwAccessibleContext::InvalidateAttr()
+{
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::TEXT_ATTRIBUTE_CHANGED;
+
+ FireAccessibleEvent( aEvent );
+}
+
+sal_Bool SwAccessibleContext::HasCursor()
+{
+ return sal_False;
+}
+
+sal_Bool SwAccessibleContext::Select( SwPaM *pPaM, SdrObject *pObj,
+ sal_Bool bAdd )
+{
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( !pCrsrShell )
+ return sal_False;
+
+ SwFEShell* pFEShell = pCrsrShell->ISA( SwFEShell )
+ ? static_cast<SwFEShell*>( pCrsrShell )
+ : 0;
+ // Get rid of activated OLE object
+ if( pFEShell )
+ pFEShell->FinishOLEObj();
+
+ sal_Bool bRet = sal_False;
+ if( pObj )
+ {
+ if( pFEShell )
+ {
+ Point aDummy;
+ sal_uInt8 nFlags = bAdd ? SW_ADD_SELECT : 0;
+ pFEShell->SelectObj( aDummy, nFlags, pObj );
+ bRet = sal_True;
+ }
+ }
+ else if( pPaM )
+ {
+ // Get rid of frame selection. If there is one, make text cursor
+ // visible again.
+ sal_Bool bCallShowCrsr = sal_False;
+ if( pFEShell && (pFEShell->IsFrmSelected() ||
+ pFEShell->IsObjSelected()) )
+ {
+ Point aPt( LONG_MIN, LONG_MIN );
+ pFEShell->SelectObj( aPt, 0 );
+ bCallShowCrsr = sal_True;
+ }
+ pCrsrShell->KillPams();
+ pCrsrShell->SetSelection( *pPaM );
+ if( bCallShowCrsr )
+ pCrsrShell->ShowCrsr();
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+OUString SwAccessibleContext::GetResource( sal_uInt16 nResId,
+ const OUString *pArg1,
+ const OUString *pArg2 )
+{
+ String sStr;
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ sStr = SW_RES( nResId );
+ }
+
+ if( pArg1 )
+ {
+ sStr.SearchAndReplace( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "$(ARG1)" )),
+ String( *pArg1 ) );
+ }
+ if( pArg2 )
+ {
+ sStr.SearchAndReplace( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "$(ARG2)" )),
+ String( *pArg2 ) );
+ }
+
+ return OUString( sStr );
+}
+
+void SwAccessibleContext::RemoveFrmFromAccessibleMap()
+{
+ if( bRegisteredAtAccessibleMap && GetFrm() && GetMap() )
+ GetMap()->RemoveContext( GetFrm() );
+}
+
+bool SwAccessibleContext::HasAdditionalAccessibleChildren()
+{
+ bool bRet( false );
+
+ if ( GetFrm()->IsTxtFrm() )
+ {
+ SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+ if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
+ {
+ bRet = pPostItMgr->HasFrmConnectedSidebarWins( *(GetFrm()) );
+ }
+ }
+
+ return bRet;
+}
+/** get additional accessible child by index
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+*/
+Window* SwAccessibleContext::GetAdditionalAccessibleChild( const sal_Int32 nIndex )
+{
+ Window* pAdditionalAccessibleChild( 0 );
+
+ if ( GetFrm()->IsTxtFrm() )
+ {
+ SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+ if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
+ {
+ pAdditionalAccessibleChild =
+ pPostItMgr->GetSidebarWinForFrmByIndex( *(GetFrm()), nIndex );
+ }
+ }
+
+ return pAdditionalAccessibleChild;
+}
+
+/** get all additional accessible children
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+*/
+void SwAccessibleContext::GetAdditionalAccessibleChildren( std::vector< Window* >* pChildren )
+{
+ if ( GetFrm()->IsTxtFrm() )
+ {
+ SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+ if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
+ {
+ pPostItMgr->GetAllSidebarWinForFrm( *(GetFrm()), pChildren );
+ }
+ }
+}
+
+#if (OSL_DEBUG_LEVEL > 1) && defined TEST_MIB
+void lcl_SwAccessibleContext_DbgMsg( SwAccessibleContext *pThisAcc,
+ const char *pMsg,
+ SwAccessibleContext *pChildAcc,
+ sal_Bool bConstrDestr )
+{
+ static SvFileStream aStrm( String::CreateFromAscii("j:\\acc.log"),
+ STREAM_WRITE|STREAM_TRUNC|STREAM_SHARE_DENYNONE );
+ ByteString aName( String(pThisAcc->GetName()),
+ RTL_TEXTENCODING_ISO_8859_1 );
+ if( aName.Len() )
+ {
+ aStrm << aName.GetBuffer()
+ << ": ";
+ }
+ aStrm << pMsg;
+ if( pChildAcc )
+ {
+ ByteString aChild( String(pChildAcc->GetName()),
+ RTL_TEXTENCODING_ISO_8859_1 );
+ aStrm << ": "
+ << aChild.GetBuffer();
+ }
+ aStrm << "\r\n (";
+
+ if( !bConstrDestr )
+ {
+ ByteString aDesc( String(pThisAcc->getAccessibleDescription()),
+ RTL_TEXTENCODING_ISO_8859_1 );
+ aStrm << aDesc.GetBuffer()
+ << ", ";
+ }
+
+ Rectangle aVisArea( pThisAcc->GetVisArea() );
+ aStrm << "VA: "
+ << ByteString::CreateFromInt32( aVisArea.Left() ).GetBuffer()
+ << ","
+ << ByteString::CreateFromInt32( aVisArea.Top() ).GetBuffer()
+ << ","
+ << ByteString::CreateFromInt32( aVisArea.GetWidth() ).GetBuffer()
+ << ","
+ << ByteString::CreateFromInt32( aVisArea.GetHeight() ).GetBuffer();
+
+ if( pThisAcc->GetFrm() )
+ {
+ Rectangle aBounds( pThisAcc->GetBounds( pThisAcc->GetFrm() ) );
+ aStrm << ", BB: "
+ << ByteString::CreateFromInt32( aBounds.Left() ).GetBuffer()
+ << ","
+ << ByteString::CreateFromInt32( aBounds.Top() ).GetBuffer()
+ << ","
+ << ByteString::CreateFromInt32( aBounds.GetWidth() ).GetBuffer()
+ << ","
+ << ByteString::CreateFromInt32( aBounds.GetHeight() ).GetBuffer()
+ << ")\r\n";
+ }
+
+ aStrm.Flush();
+}
+#endif
diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx
new file mode 100644
index 000000000000..8bad4ab9074b
--- /dev/null
+++ b/sw/source/core/access/acccontext.hxx
@@ -0,0 +1,459 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCBASE_HXX
+#define _ACCBASE_HXX
+#include <accframe.hxx>
+#include <accmap.hxx>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+class Window;
+class SwAccessibleMap;
+class SwCrsrShell;
+class SdrObject;
+class SwPaM;
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+namespace accessibility {
+ class AccessibleShape;
+}
+class SwFmtFld;
+class SwAccessibleChildContainer;
+
+const sal_Char sAccessibleServiceName[] = "com.sun.star.accessibility.Accessible";
+
+class SwAccessibleContext :
+ public ::cppu::WeakImplHelper5<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::lang::XServiceInfo
+ >,
+ public SwAccessibleFrame
+{
+ // The implements for the XAccessibleSelection interface has been
+ // 'externalized' and wants access to the protected members like
+ // GetMap, GetChild, GetParent, and GetFrm.
+ friend class SwAccessibleSelectionHelper;
+
+
+protected:
+
+ mutable ::osl::Mutex aListenerMutex;
+ mutable ::vos::OMutex aMutex;
+
+private:
+
+ ::rtl::OUString sName; // immutable outside constructor
+
+ // The parent if it has been retrieved. This is always an
+ // SwAccessibleContext. (protected by Mutex)
+ ::com::sun::star::uno::WeakReference <
+ ::com::sun::star::accessibility::XAccessible > xWeakParent;
+
+ SwAccessibleMap *pMap; // must be protected by solar mutex
+
+ sal_uInt32 nClientId; // client id in the AccessibleEventNotifier queue
+ sal_Int16 nRole; // immutable outside constructor
+
+ // The current states (protected by mutex)
+ sal_Bool bIsShowingState : 1;
+ sal_Bool bIsEditableState : 1;
+ sal_Bool bIsOpaqueState : 1;
+ sal_Bool bIsDefuncState : 1;
+
+ // Are we currently disposing that object (protected by solar mutex)?
+ sal_Bool bDisposing : 1;
+
+ // --> OD 2008-03-10 #i85634#
+ // boolean, indicating if the accessible context is in general registered at
+ // the accessible map.
+ bool bRegisteredAtAccessibleMap;
+ // <--
+
+ void InitStates();
+
+protected:
+ void SetName( const ::rtl::OUString& rName ) { sName = rName; }
+ inline sal_Int16 GetRole() const
+ {
+ return nRole;
+ }
+
+ void SetParent( SwAccessibleContext *pParent );
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> GetWeakParent() const;
+
+ sal_Bool IsDisposing() const { return bDisposing; }
+
+ Window *GetWindow();
+ SwAccessibleMap *GetMap() { return pMap; }
+ const SwAccessibleMap *GetMap() const { return pMap; }
+
+ /** convenience method to get the SwViewShell through accessibility map */
+ inline ViewShell* GetShell()
+ {
+ return GetMap()->GetShell();
+ }
+ inline const ViewShell* GetShell() const
+ {
+ return GetMap()->GetShell();
+ }
+
+ /** convenience method to get SwCrsrShell through accessibility map
+ * @returns SwCrsrShell, or NULL if none is found */
+ SwCrsrShell* GetCrsrShell();
+ const SwCrsrShell* GetCrsrShell() const;
+
+ // Notify all children that the vis araea has changed.
+ // The SwFrm might belong to the current object or to any other child or
+ // grandchild.
+ void ChildrenScrolled( const SwFrm *pFrm, const SwRect& rOldVisArea );
+
+ // The context's showing state changed. May only be called for context that
+ // exist even if they aren't visible.
+ void Scrolled( const SwRect& rOldVisArea );
+
+ // A child has been moved while setting the vis area
+ void ScrolledWithin( const SwRect& rOldVisArea );
+
+ // The has been added while setting the vis area
+ void ScrolledIn();
+
+ // The context has to be removed while setting the vis area
+ void ScrolledOut( const SwRect& rOldVisArea );
+
+ // Invalidate the states of all children of the specified SwFrm. The
+ // SwFrm might belong the the current object or to any child or grandchild!
+ // --> OD 2005-12-12 #i27301# - use new type definition for <_nStates>
+ void InvalidateChildrenStates( const SwFrm* _pFrm,
+ tAccessibleStates _nStates );
+ // <--
+
+ // Dispose children of the specified SwFrm. The SwFrm might belong to
+ // the current object or to any other child or grandchild.
+ void DisposeChildren( const SwFrm *pFrm,
+ sal_Bool bRecursive );
+
+ void DisposeShape( const SdrObject *pObj,
+ ::accessibility::AccessibleShape *pAccImpl );
+ void ScrolledInShape( const SdrObject *pObj,
+ ::accessibility::AccessibleShape *pAccImpl );
+
+ virtual void _InvalidateContent( sal_Bool bVisibleDataFired );
+
+ virtual void _InvalidateCursorPos();
+ virtual void _InvalidateFocus();
+
+public:
+
+ void FireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventObject& rEvent );
+
+protected:
+
+ // broadcast visual data event
+ void FireVisibleDataEvent();
+
+ // broadcast state change event
+ void FireStateChangedEvent( sal_Int16 nState, sal_Bool bNewState );
+
+ // Set states for getAccessibleStateSet.
+ // This base class sets DEFUNC(0/1), EDITABLE(0/1), ENABLED(1),
+ // SHOWING(0/1), OPAQUE(0/1) and VISIBLE(1).
+ virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
+
+ sal_Bool IsEditableState();
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL
+ getBoundsImpl(sal_Bool bRelative)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // --> OD 2008-03-10 #i85634#
+ inline void NotRegisteredAtAccessibleMap()
+ {
+ bRegisteredAtAccessibleMap = false;
+ }
+ void RemoveFrmFromAccessibleMap();
+ // <--
+
+ virtual ~SwAccessibleContext();
+
+public:
+
+ SwAccessibleContext( SwAccessibleMap *pMap, sal_Int16 nRole,
+ const SwFrm *pFrm );
+
+ //===== XAccessible =====================================================
+
+ /// Return the XAccessibleContext.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+ getAccessibleContext (void) throw (com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the specified child or NULL if index is invalid.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 nIndex)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException);
+
+ /// Return a reference to the parent.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this objects index among the parents children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's role.
+ virtual sal_Int16 SAL_CALL
+ getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the object's current name.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return NULL to indicate that an empty relation set.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the set of current states.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return the parents locale or throw exception if this object has no
+ parent yet/anymore.
+ */
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale (void)
+ throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleEventBroadcaster =====================================
+
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleComponent ============================================
+ virtual sal_Bool SAL_CALL containsPoint(
+ const ::com::sun::star::awt::Point& aPoint )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
+ const ::com::sun::star::awt::Point& aPoint )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL grabFocus()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground()
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //====== thread safe C++ interface ========================================
+
+ // The object is not visible an longer and should be destroyed
+ virtual void Dispose( sal_Bool bRecursive = sal_False );
+
+ // The child object is not visible an longer and should be destroyed
+ virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj, sal_Bool bRecursive );
+
+ // The object has been moved by the layout
+ virtual void InvalidatePosOrSize( const SwRect& rFrm );
+
+ // The vhild object has been moved by the layout
+ virtual void InvalidateChildPosOrSize( const sw::access::SwAccessibleChild& rFrmOrObj,
+ const SwRect& rFrm );
+
+ // The content may have changed (but it hasn't tohave changed)
+ void InvalidateContent();
+
+ // The caretPos has changed
+ void InvalidateCursorPos();
+
+ // The Focus state has changed
+ void InvalidateFocus();
+
+ // Check states
+ // --> OD 2005-12-12 #i27301# - use new type definition for <_nStates>
+ void InvalidateStates( tAccessibleStates _nStates );
+ // <--
+
+ // the XAccessibleRelationSet may have changed
+ void InvalidateRelation( sal_uInt16 nType );
+
+ /** text selection has changed
+
+ OD 2005-12-14 #i27301#
+
+ @author OD
+ */
+ void InvalidateTextSelection();
+
+ /** attributes has changed
+
+ OD 2009-01-06 #i88069#
+
+ @author OD
+ */
+ void InvalidateAttr();
+
+ bool HasAdditionalAccessibleChildren();
+
+ /** get additional child by index
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+ */
+ Window* GetAdditionalAccessibleChild( const sal_Int32 nIndex );
+
+ /** get all additional accessible children
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+ */
+ void GetAdditionalAccessibleChildren( std::vector< Window* >* pChildren );
+
+
+ const ::rtl::OUString& GetName() const { return sName; }
+
+ virtual sal_Bool HasCursor(); // required by map to remember that object
+
+ sal_Bool Select( SwPaM *pPaM, SdrObject *pObj, sal_Bool bAdd );
+ inline sal_Bool Select( SwPaM& rPaM )
+ {
+ return Select( &rPaM, 0, sal_False );
+ }
+ inline sal_Bool Select( SdrObject *pObj, sal_Bool bAdd )
+ {
+ return Select( 0, pObj, bAdd );
+ }
+
+ static ::rtl::OUString GetResource( sal_uInt16 nResId,
+ const ::rtl::OUString *pArg1 = 0,
+ const ::rtl::OUString *pArg2 = 0 );
+
+
+};
+
+// some heaviliy used exception support
+const sal_Char sDefunc[] = "object is defunctional";
+const sal_Char sMissingWindow[] = "window is missing";
+
+#define THROW_RUNTIME_EXCEPTION( ifc, msg ) \
+ ::com::sun::star::uno::Reference < ifc > xThis( this ); \
+ ::com::sun::star::uno::RuntimeException aExcept( \
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(msg) ), xThis ); \
+ throw aExcept;
+
+#define CHECK_FOR_DEFUNC_THIS( ifc, ths ) \
+ if( !(GetFrm() && GetMap()) ) \
+ { \
+ ::com::sun::star::uno::Reference < ifc > xThis( ths ); \
+ ::com::sun::star::lang::DisposedException aExcept( \
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(sDefunc) ), \
+ xThis ); \
+ throw aExcept; \
+ }
+
+#define CHECK_FOR_DEFUNC( ifc ) \
+ CHECK_FOR_DEFUNC_THIS( ifc, this )
+
+#define CHECK_FOR_WINDOW( i, w ) \
+ if( !(w) ) \
+ { \
+ THROW_RUNTIME_EXCEPTION( i, sMissingWindow ); \
+ }
+#endif
+
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
new file mode 100644
index 000000000000..08de7edba46f
--- /dev/null
+++ b/sw/source/core/access/accdoc.cxx
@@ -0,0 +1,515 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vcl/window.hxx>
+#include <rootfrm.hxx>
+
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <tools/link.hxx>
+#include <sfx2/viewsh.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <viewsh.hxx>
+#include <doc.hxx>
+#include <accmap.hxx>
+#include <accdoc.hxx>
+#ifndef _ACCESS_HRC
+#include "access.hrc"
+#endif
+#include <pagefrm.hxx>
+
+const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentView";
+const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentView";
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+
+using lang::IndexOutOfBoundsException;
+
+
+
+//
+// SwAccessibleDocumentBase: base class for SwAccessibleDocument and
+// SwAccessiblePreview
+//
+
+SwAccessibleDocumentBase::SwAccessibleDocumentBase ( SwAccessibleMap *_pMap ) :
+ SwAccessibleContext( _pMap, AccessibleRole::DOCUMENT,
+ _pMap->GetShell()->GetLayout() ),//swmod 071107//swmod 071225
+ mxParent( _pMap->GetShell()->GetWin()->GetAccessibleParentWindow()->GetAccessible() ),
+ mpChildWin( 0 )
+{
+}
+
+SwAccessibleDocumentBase::~SwAccessibleDocumentBase()
+{
+}
+
+void SwAccessibleDocumentBase::SetVisArea()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwRect aOldVisArea( GetVisArea() );
+ const SwRect& rNewVisArea = GetMap()->GetVisArea();
+ if( aOldVisArea != rNewVisArea )
+ {
+ SwAccessibleFrame::SetVisArea( GetMap()->GetVisArea() );
+ // --> OD 2007-12-07 #i58139#
+ // showing state of document view needs also be updated.
+ // Thus, call method <Scrolled(..)> instead of <ChildrenScrolled(..)>
+// ChildrenScrolled( GetFrm(), aOldVisArea );
+ Scrolled( aOldVisArea );
+ // <--
+ }
+}
+
+void SwAccessibleDocumentBase::AddChild( Window *pWin, sal_Bool bFireEvent )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ ASSERT( !mpChildWin, "only one child window is supported" );
+ if( !mpChildWin )
+ {
+ mpChildWin = pWin;
+
+ if( bFireEvent )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= mpChildWin->GetAccessible();
+ FireAccessibleEvent( aEvent );
+ }
+ }
+}
+
+void SwAccessibleDocumentBase::RemoveChild( Window *pWin )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ ASSERT( !mpChildWin || pWin == mpChildWin, "invalid child window to remove" );
+ if( mpChildWin && pWin == mpChildWin )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.OldValue <<= mpChildWin->GetAccessible();
+ FireAccessibleEvent( aEvent );
+
+ mpChildWin = 0;
+ }
+}
+
+sal_Int32 SAL_CALL SwAccessibleDocumentBase::getAccessibleChildCount( void )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // CHECK_FOR_DEFUNC is called by parent
+
+ sal_Int32 nChildren = SwAccessibleContext::getAccessibleChildCount();
+ if( !IsDisposing() && mpChildWin )
+ nChildren++;
+
+ return nChildren;
+}
+
+uno::Reference< XAccessible> SAL_CALL
+ SwAccessibleDocumentBase::getAccessibleChild( sal_Int32 nIndex )
+ throw (uno::RuntimeException,
+ lang::IndexOutOfBoundsException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if( mpChildWin )
+ {
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+ if ( nIndex == GetChildCount( *(GetMap()) ) )
+ {
+ return mpChildWin->GetAccessible();
+ }
+ }
+
+ return SwAccessibleContext::getAccessibleChild( nIndex );
+}
+
+
+uno::Reference< XAccessible> SAL_CALL SwAccessibleDocumentBase::getAccessibleParent (void)
+ throw (uno::RuntimeException)
+{
+ return mxParent;
+}
+
+sal_Int32 SAL_CALL SwAccessibleDocumentBase::getAccessibleIndexInParent (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference < XAccessibleContext > xAcc( mxParent->getAccessibleContext() );
+ uno::Reference < XAccessible > xThis( this );
+ sal_Int32 nCount = xAcc->getAccessibleChildCount();
+
+ for( sal_Int32 i=0; i < nCount; i++ )
+ {
+ if( xAcc->getAccessibleChild( i ) == xThis )
+ return i;
+ }
+ return -1L;
+}
+
+OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleDescription (void)
+ throw (uno::RuntimeException)
+{
+ return GetResource( STR_ACCESS_DOC_DESC );
+}
+
+awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ Window *pWin = GetWindow();
+
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+
+ Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
+ awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
+ aPixBounds.GetWidth(), aPixBounds.GetHeight() );
+
+ return aBox;
+}
+
+
+awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ Window *pWin = GetWindow();
+
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+
+ Point aPixPos( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ).TopLeft() );
+ awt::Point aLoc( aPixPos.X(), aPixPos.Y() );
+
+ return aLoc;
+}
+
+
+::com::sun::star::awt::Point SAL_CALL SwAccessibleDocumentBase::getLocationOnScreen()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ Window *pWin = GetWindow();
+
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+
+ Point aPixPos( pWin->GetWindowExtentsRelative( 0 ).TopLeft() );
+ awt::Point aLoc( aPixPos.X(), aPixPos.Y() );
+
+ return aLoc;
+}
+
+
+::com::sun::star::awt::Size SAL_CALL SwAccessibleDocumentBase::getSize()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ Window *pWin = GetWindow();
+
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+
+ Size aPixSize( pWin->GetWindowExtentsRelative( 0 ).GetSize() );
+ awt::Size aSize( aPixSize.Width(), aPixSize.Height() );
+
+ return aSize;
+}
+
+sal_Bool SAL_CALL SwAccessibleDocumentBase::containsPoint(
+ const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ Window *pWin = GetWindow();
+
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+
+ Rectangle aPixBounds( pWin->GetWindowExtentsRelative( 0 ) );
+ aPixBounds.Move(-aPixBounds.Left(), -aPixBounds.Top());
+
+ Point aPixPoint( aPoint.X, aPoint.Y );
+ return aPixBounds.IsInside( aPixPoint );
+}
+
+uno::Reference< XAccessible > SAL_CALL SwAccessibleDocumentBase::getAccessibleAtPoint(
+ const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if( mpChildWin )
+ {
+ CHECK_FOR_DEFUNC( XAccessibleComponent )
+
+ Window *pWin = GetWindow();
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+
+ Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to window
+ if( mpChildWin->GetWindowExtentsRelative( pWin ).IsInside( aPixPoint ) )
+ return mpChildWin->GetAccessible();
+ }
+
+ return SwAccessibleContext::getAccessibleAtPoint( aPoint );
+}
+
+//
+// SwAccessibeDocument
+//
+
+void SwAccessibleDocument::GetStates(
+ ::utl::AccessibleStateSetHelper& rStateSet )
+{
+ SwAccessibleContext::GetStates( rStateSet );
+
+ // MULTISELECTABLE
+ rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
+}
+
+
+SwAccessibleDocument::SwAccessibleDocument ( SwAccessibleMap* pInitMap ) :
+ SwAccessibleDocumentBase( pInitMap ),
+ maSelectionHelper( *this )
+{
+ SetName( GetResource( STR_ACCESS_DOC_NAME ) );
+ Window *pWin = pInitMap->GetShell()->GetWin();
+ if( pWin )
+ {
+ pWin->AddChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
+ sal_uInt16 nCount = pWin->GetChildCount();
+ for( sal_uInt16 i=0; i < nCount; i++ )
+ {
+ Window* pChildWin = pWin->GetChild( i );
+ if( pChildWin &&
+ AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
+ AddChild( pChildWin, sal_False );
+ }
+ }
+}
+
+SwAccessibleDocument::~SwAccessibleDocument()
+{
+ Window *pWin = GetMap() ? GetMap()->GetShell()->GetWin() : 0;
+ if( pWin )
+ pWin->RemoveChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
+}
+
+void SwAccessibleDocument::Dispose( sal_Bool bRecursive )
+{
+ ASSERT( GetFrm() && GetMap(), "already disposed" );
+
+ Window *pWin = GetMap() ? GetMap()->GetShell()->GetWin() : 0;
+ if( pWin )
+ pWin->RemoveChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
+ SwAccessibleContext::Dispose( bRecursive );
+}
+
+IMPL_LINK( SwAccessibleDocument, WindowChildEventListener, VclSimpleEvent*, pEvent )
+{
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
+ if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+ {
+ VclWindowEvent *pVclEvent = static_cast< VclWindowEvent * >( pEvent );
+ DBG_ASSERT( pVclEvent->GetWindow(), "Window???" );
+ switch ( pVclEvent->GetId() )
+ {
+ case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children
+ {
+ Window* pChildWin = static_cast< Window* >( pVclEvent->GetData() );
+ if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
+ {
+ AddChild( pChildWin );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_HIDE: // send destroy on hide for direct accessible children
+ {
+ Window* pChildWin = static_cast< Window* >( pVclEvent->GetData() );
+ if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
+ {
+ RemoveChild( pChildWin );
+ }
+ }
+ break;
+ case VCLEVENT_OBJECT_DYING: // send destroy on hide for direct accessible children
+ {
+ Window* pChildWin = pVclEvent->GetWindow();
+ if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
+ {
+ RemoveChild( pChildWin );
+ }
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
+
+OUString SAL_CALL SwAccessibleDocument::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
+}
+
+sal_Bool SAL_CALL SwAccessibleDocument::supportsService(
+ const ::rtl::OUString& sTestServiceName)
+ throw (uno::RuntimeException)
+{
+ return sTestServiceName.equalsAsciiL( sServiceName,
+ sizeof(sServiceName)-1 ) ||
+ sTestServiceName.equalsAsciiL( sAccessibleServiceName,
+ sizeof(sAccessibleServiceName)-1 );
+}
+
+uno::Sequence< OUString > SAL_CALL SwAccessibleDocument::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
+ pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ return aRet;
+}
+
+//===== XInterface ======================================================
+
+uno::Any SwAccessibleDocument::queryInterface(
+ const uno::Type& rType )
+ throw ( uno::RuntimeException )
+{
+ uno::Any aRet;
+ if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) ) )
+ {
+ uno::Reference<XAccessibleSelection> aSelect = this;
+ aRet <<= aSelect;
+ }
+ else
+ aRet = SwAccessibleContext::queryInterface( rType );
+ return aRet;
+}
+
+//====== XTypeProvider ====================================================
+uno::Sequence< uno::Type > SAL_CALL SwAccessibleDocument::getTypes()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes( SwAccessibleDocumentBase::getTypes() );
+
+ sal_Int32 nIndex = aTypes.getLength();
+ aTypes.realloc( nIndex + 1 );
+
+ uno::Type* pTypes = aTypes.getArray();
+ pTypes[nIndex] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) );
+
+ return aTypes;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleDocument::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+//===== XAccessibleSelection ============================================
+
+void SwAccessibleDocument::selectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ maSelectionHelper.selectAccessibleChild(nChildIndex);
+}
+
+sal_Bool SwAccessibleDocument::isAccessibleChildSelected(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ return maSelectionHelper.isAccessibleChildSelected(nChildIndex);
+}
+
+void SwAccessibleDocument::clearAccessibleSelection( )
+ throw ( uno::RuntimeException )
+{
+ maSelectionHelper.clearAccessibleSelection();
+}
+
+void SwAccessibleDocument::selectAllAccessibleChildren( )
+ throw ( uno::RuntimeException )
+{
+ maSelectionHelper.selectAllAccessibleChildren();
+}
+
+sal_Int32 SwAccessibleDocument::getSelectedAccessibleChildCount( )
+ throw ( uno::RuntimeException )
+{
+ return maSelectionHelper.getSelectedAccessibleChildCount();
+}
+
+uno::Reference<XAccessible> SwAccessibleDocument::getSelectedAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ return maSelectionHelper.getSelectedAccessibleChild(nSelectedChildIndex);
+}
+
+// --> OD 2004-11-16 #111714# - index has to be treated as global child index.
+void SwAccessibleDocument::deselectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ maSelectionHelper.deselectAccessibleChild( nChildIndex );
+}
diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx
new file mode 100644
index 000000000000..3e2153876219
--- /dev/null
+++ b/sw/source/core/access/accdoc.hxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCDOC_HXX
+#define _ACCDOC_HXX
+#ifndef _ACCCONTEXT_HXX
+#include "acccontext.hxx"
+#endif
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <accselectionhelper.hxx>
+
+class VclSimpleEvent;
+
+/**
+ * base class for SwAccessibleDocument (in this same header file) and
+ * SwAccessiblePreview
+ */
+class SwAccessibleDocumentBase : public SwAccessibleContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxParent;
+
+ Window* mpChildWin; // protected by solar mutext
+
+ using SwAccessibleFrame::SetVisArea;
+
+protected:
+
+ virtual ~SwAccessibleDocumentBase();
+
+public:
+
+ SwAccessibleDocumentBase( SwAccessibleMap* pInitMap );
+
+ void SetVisArea();
+
+ virtual void AddChild( Window *pWin, sal_Bool bFireEvent = sal_True );
+ virtual void RemoveChild( Window *pWin );
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the specified child or NULL if index is invalid.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 nIndex)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException);
+
+ /// Return a reference to the parent.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this objects index among the parents children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleComponent ==============================================
+ virtual sal_Bool SAL_CALL containsPoint(
+ const ::com::sun::star::awt::Point& aPoint )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
+ const ::com::sun::star::awt::Point& aPoint )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+
+
+/**
+ * access to an accessible Writer document
+ */
+class SwAccessibleDocument : public SwAccessibleDocumentBase,
+ public com::sun::star::accessibility::XAccessibleSelection
+{
+ // Implementation for XAccessibleSelection interface
+ SwAccessibleSelectionHelper maSelectionHelper;
+
+protected:
+
+ // Set states for getAccessibleStateSet.
+ // This drived class additinaly sets MULTISELECTABLE(1)
+ virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
+
+ virtual ~SwAccessibleDocument();
+
+public:
+
+ SwAccessibleDocument( SwAccessibleMap* pInitMap );
+
+ DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XInterface ======================================================
+
+ // XInterface is inherited through SwAcessibleContext and
+ // XAccessibleSelection. These methods are needed to avoid
+ // ambigiouties.
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire( ) throw ()
+ { SwAccessibleContext::acquire(); };
+
+ virtual void SAL_CALL release( ) throw ()
+ { SwAccessibleContext::release(); };
+
+ //====== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleSelection ============================================
+
+ virtual void SAL_CALL selectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL clearAccessibleSelection( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL selectAllAccessibleChildren( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
+ virtual void SAL_CALL deselectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ //====== thread safe C++ interface ========================================
+
+ // The object is not visible an longer and should be destroyed
+ virtual void Dispose( sal_Bool bRecursive = sal_False );
+};
+
+#endif
+
diff --git a/sw/source/core/access/accembedded.cxx b/sw/source/core/access/accembedded.cxx
new file mode 100644
index 000000000000..33a32dc5c9ca
--- /dev/null
+++ b/sw/source/core/access/accembedded.cxx
@@ -0,0 +1,97 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vcl/svapp.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <rtl/uuid.h>
+#include <flyfrm.hxx>
+#include "accembedded.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+
+const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextEmbeddedObject";
+const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleEmbeddedObject";
+
+SwAccessibleEmbeddedObject::SwAccessibleEmbeddedObject(
+ SwAccessibleMap* pInitMap,
+ const SwFlyFrm* pFlyFrm ) :
+ SwAccessibleNoTextFrame( pInitMap, AccessibleRole::EMBEDDED_OBJECT, pFlyFrm )
+{
+}
+
+SwAccessibleEmbeddedObject::~SwAccessibleEmbeddedObject()
+{
+}
+
+OUString SAL_CALL SwAccessibleEmbeddedObject::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
+}
+
+sal_Bool SAL_CALL SwAccessibleEmbeddedObject::supportsService(
+ const ::rtl::OUString& sTestServiceName)
+ throw (uno::RuntimeException)
+{
+ return sTestServiceName.equalsAsciiL( sServiceName,
+ sizeof(sServiceName)-1 ) ||
+ sTestServiceName.equalsAsciiL( sAccessibleServiceName,
+ sizeof(sAccessibleServiceName)-1 );
+}
+
+uno::Sequence< OUString > SAL_CALL SwAccessibleEmbeddedObject::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
+ pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ return aRet;
+}
+
+
+uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleEmbeddedObject::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
diff --git a/sw/source/core/access/accembedded.hxx b/sw/source/core/access/accembedded.hxx
new file mode 100644
index 000000000000..cd7205293ed0
--- /dev/null
+++ b/sw/source/core/access/accembedded.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCEMBEDDED_HXX
+#define _ACCEMBEDDED_HXX
+#include "accnotextframe.hxx"
+
+class SwAccessibleEmbeddedObject : public SwAccessibleNoTextFrame
+{
+
+protected:
+
+ virtual ~SwAccessibleEmbeddedObject();
+
+public:
+
+ SwAccessibleEmbeddedObject( SwAccessibleMap* pInitMap,
+ const SwFlyFrm* pFlyFrm );
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif
diff --git a/sw/source/core/access/accfootnote.cxx b/sw/source/core/access/accfootnote.cxx
new file mode 100644
index 000000000000..1fb553d58120
--- /dev/null
+++ b/sw/source/core/access/accfootnote.cxx
@@ -0,0 +1,157 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vos/mutex.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <rtl/uuid.h>
+#include <vcl/svapp.hxx>
+#include <ftnfrm.hxx>
+#include <fmtftn.hxx>
+#include <txtftn.hxx>
+#include <viewsh.hxx>
+#include <accmap.hxx>
+#include "accfootnote.hxx"
+#ifndef _ACCESS_HRC
+#include "access.hrc"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+
+const sal_Char sServiceNameFootnote[] = "com.sun.star.text.AccessibleFootnoteView";
+const sal_Char sServiceNameEndnote[] = "com.sun.star.text.AccessibleEndnoteView";
+const sal_Char sImplementationNameFootnote[] = "com.sun.star.comp.Writer.SwAccessibleFootnoteView";
+const sal_Char sImplementationNameEndnote[] = "com.sun.star.comp.Writer.SwAccessibleEndnoteView";
+
+SwAccessibleFootnote::SwAccessibleFootnote(
+ SwAccessibleMap* pInitMap,
+ sal_Bool bIsEndnote,
+ sal_Int32 nFootEndNote,
+ const SwFtnFrm *pFtnFrm ) :
+ SwAccessibleContext( pInitMap,
+ bIsEndnote ? AccessibleRole::END_NOTE : AccessibleRole::FOOTNOTE,
+ pFtnFrm )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ sal_uInt16 nResId = bIsEndnote ? STR_ACCESS_ENDNOTE_NAME
+ : STR_ACCESS_FOOTNOTE_NAME;
+ OUString sArg( OUString::valueOf( nFootEndNote ) );
+ SetName( GetResource( nResId, &sArg ) );
+}
+
+SwAccessibleFootnote::~SwAccessibleFootnote()
+{
+}
+
+OUString SAL_CALL SwAccessibleFootnote::getAccessibleDescription (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ sal_uInt16 nResId = AccessibleRole::END_NOTE == GetRole()
+ ? STR_ACCESS_ENDNOTE_DESC
+ : STR_ACCESS_FOOTNOTE_DESC ;
+
+ OUString sArg;
+ const SwTxtFtn *pTxtFtn =
+ static_cast< const SwFtnFrm *>( GetFrm() )->GetAttr();
+ if( pTxtFtn )
+ {
+ const SwDoc *pDoc = GetMap()->GetShell()->GetDoc();
+ sArg = pTxtFtn->GetFtn().GetViewNumStr( *pDoc );
+ }
+
+ return GetResource( nResId, &sArg );
+}
+
+OUString SAL_CALL SwAccessibleFootnote::getImplementationName()
+ throw( RuntimeException )
+{
+ if( AccessibleRole::END_NOTE == GetRole() )
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationNameEndnote));
+ else
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationNameFootnote));
+}
+
+sal_Bool SAL_CALL SwAccessibleFootnote::supportsService(
+ const ::rtl::OUString& sTestServiceName)
+ throw (uno::RuntimeException)
+{
+ if( sTestServiceName.equalsAsciiL( sAccessibleServiceName,
+ sizeof(sAccessibleServiceName)-1 ) )
+ return sal_True;
+ else if( AccessibleRole::END_NOTE == GetRole() )
+ return sTestServiceName.equalsAsciiL( sServiceNameEndnote, sizeof(sServiceNameEndnote)-1 );
+ else
+ return sTestServiceName.equalsAsciiL( sServiceNameFootnote, sizeof(sServiceNameFootnote)-1 );
+
+}
+
+Sequence< OUString > SAL_CALL SwAccessibleFootnote::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ if( AccessibleRole::END_NOTE == GetRole() )
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceNameEndnote) );
+ else
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceNameFootnote) );
+ pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ return aRet;
+}
+
+Sequence< sal_Int8 > SAL_CALL SwAccessibleFootnote::getImplementationId()
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+sal_Bool SwAccessibleFootnote::IsEndnote( const SwFtnFrm *pFtnFrm )
+{
+ const SwTxtFtn *pTxtFtn = pFtnFrm ->GetAttr();
+ return pTxtFtn && pTxtFtn->GetFtn().IsEndNote() ;
+}
diff --git a/sw/source/core/access/accfootnote.hxx b/sw/source/core/access/accfootnote.hxx
new file mode 100644
index 000000000000..1c7330bc694d
--- /dev/null
+++ b/sw/source/core/access/accfootnote.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCFOOTNOTE_HXX
+#define _ACCFOOTNOTE_HXX
+
+#include <sal/types.h>
+
+#include <acccontext.hxx>
+
+class SwAccessibleMap;
+class SwFtnFrm;
+
+class SwAccessibleFootnote : public SwAccessibleContext
+{
+
+protected:
+
+ virtual ~SwAccessibleFootnote();
+
+public:
+
+ SwAccessibleFootnote( SwAccessibleMap* pInitMap,
+ sal_Bool bIsEndnote,
+ sal_Int32 nFootEndNote,
+ const SwFtnFrm *pFtnFrm );
+
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (com::sun::star::uno::RuntimeException);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ static sal_Bool IsEndnote( const SwFtnFrm *pFrm );
+};
+
+
+#endif
+
diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx
new file mode 100644
index 000000000000..043e40bb943b
--- /dev/null
+++ b/sw/source/core/access/accframe.cxx
@@ -0,0 +1,497 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <hintids.hxx>
+#include <editeng/brshitem.hxx>
+#include <flyfrm.hxx>
+#include <rootfrm.hxx>
+#include <txtfrm.hxx>
+#include <sectfrm.hxx>
+#include <pagefrm.hxx>
+#include <section.hxx>
+#include <viewsh.hxx>
+#include <viewopt.hxx>
+#include <doc.hxx>
+#include <frmatr.hxx>
+#include <pagefrm.hxx>
+#include <pagedesc.hxx>
+#include <fmtanchr.hxx>
+#include <fldbas.hxx>
+#include <dcontact.hxx>
+#include <accmap.hxx>
+#include <accfrmobjslist.hxx>
+#include <accfrmobjmap.hxx>
+#include <accframe.hxx>
+
+using namespace sw::access;
+
+// Regarding visibilily (or in terms of accessibility: regarding the showing
+// state): A frame is visible and therfor contained in the tree if its frame
+// size overlaps with the visible area. The bounding box however is the
+// frame's paint area.
+/* static */ sal_Int32 SwAccessibleFrame::GetChildCount( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm *pFrm,
+ sal_Bool bInPagePreview )
+{
+ sal_Int32 nCount = 0;
+
+ const SwAccessibleChildSList aVisList( rVisArea, *pFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
+ while( aIter != aVisList.end() )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ if( rLower.IsAccessible( bInPagePreview ) )
+ {
+ nCount++;
+ }
+ else if( rLower.GetSwFrm() )
+ {
+ // There are no unaccessible SdrObjects that count
+ nCount += GetChildCount( rAccMap,
+ rVisArea, rLower.GetSwFrm(),
+ bInPagePreview );
+ }
+ ++aIter;
+ }
+
+ return nCount;
+}
+
+/* static */ SwAccessibleChild SwAccessibleFrame::GetChild(
+ SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview )
+{
+ SwAccessibleChild aRet;
+
+ if( rPos >= 0 )
+ {
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
+ {
+ // We need a sorted list here
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
+ while( aIter != aVisMap.end() && !aRet.IsValid() )
+ {
+ const SwAccessibleChild& rLower = (*aIter).second;
+ if( rLower.IsAccessible( bInPagePreview ) )
+ {
+ if( 0 == rPos )
+ aRet = rLower;
+ else
+ rPos--;
+ }
+ else if( rLower.GetSwFrm() )
+ {
+ // There are no unaccessible SdrObjects that count
+ aRet = GetChild( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rPos,
+ bInPagePreview );
+ }
+ ++aIter;
+ }
+ }
+ else
+ {
+ // The unsorted list is sorted enough, because it return lower
+ // frames in the correct order.
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
+ while( aIter != aVisList.end() && !aRet.IsValid() )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ if( rLower.IsAccessible( bInPagePreview ) )
+ {
+ if( 0 == rPos )
+ aRet = rLower;
+ else
+ rPos--;
+ }
+ else if( rLower.GetSwFrm() )
+ {
+ // There are no unaccessible SdrObjects that count
+ aRet = GetChild( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rPos,
+ bInPagePreview );
+ }
+ ++aIter;
+ }
+ }
+ }
+
+ return aRet;
+}
+
+/* static */ sal_Bool SwAccessibleFrame::GetChildIndex(
+ SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ const SwAccessibleChild& rChild,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview )
+{
+ sal_Bool bFound = sal_False;
+
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
+ {
+ // We need a sorted list here
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
+ while( aIter != aVisMap.end() && !bFound )
+ {
+ const SwAccessibleChild& rLower = (*aIter).second;
+ if( rLower.IsAccessible( bInPagePreview ) )
+ {
+ if( rChild == rLower )
+ bFound = sal_True;
+ else
+ rPos++;
+ }
+ else if( rLower.GetSwFrm() )
+ {
+ // There are no unaccessible SdrObjects that count
+ bFound = GetChildIndex( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rChild,
+ rPos, bInPagePreview );
+ }
+ ++aIter;
+ }
+ }
+ else
+ {
+ // The unsorted list is sorted enough, because it return lower
+ // frames in the correct order.
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
+ while( aIter != aVisList.end() && !bFound )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ if( rLower.IsAccessible( bInPagePreview ) )
+ {
+ if( rChild == rLower )
+ bFound = sal_True;
+ else
+ rPos++;
+ }
+ else if( rLower.GetSwFrm() )
+ {
+ // There are no unaccessible SdrObjects that count
+ bFound = GetChildIndex( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rChild,
+ rPos, bInPagePreview );
+ }
+ ++aIter;
+ }
+ }
+
+ return bFound;
+}
+
+SwAccessibleChild SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ const Point& rPixPos,
+ sal_Bool bInPagePreview,
+ SwAccessibleMap& rAccMap )
+{
+ SwAccessibleChild aRet;
+
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
+ {
+ // We need a sorted list here, and we have to reverse iterate,
+ // because objects in front should be returned.
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_reverse_iterator aRIter( aVisMap.rbegin() );
+ while( aRIter != aVisMap.rend() && !aRet.IsValid() )
+ {
+ const SwAccessibleChild& rLower = (*aRIter).second;
+ // A frame is returned if it's frame size is inside the visarea
+ // and the positiion is inside the frame's paint area.
+ if( rLower.IsAccessible( bInPagePreview ) )
+ {
+ SwRect aLogBounds( rLower.GetBounds( rAccMap ) );
+ if( !aLogBounds.IsEmpty() )
+ {
+ Rectangle aPixBounds( rAccMap.CoreToPixel( aLogBounds.SVRect() ) );
+ if( aPixBounds.IsInside( rPixPos ) )
+ aRet = rLower;
+ }
+ }
+ else if( rLower.GetSwFrm() )
+ {
+ // There are no unaccessible SdrObjects that count
+ aRet = GetChildAtPixel( rVisArea, *(rLower.GetSwFrm()), rPixPos,
+ bInPagePreview, rAccMap );
+ }
+ aRIter++;
+ }
+ }
+ else
+ {
+ // The unsorted list is sorted enough, because it returns lower
+ // frames in the correct order. Morover, we can iterate forward,
+ // because the lowers don't overlap!
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
+ while( aIter != aVisList.end() && !aRet.IsValid() )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ // A frame is returned if it's frame size is inside the visarea
+ // and the positiion is inside the frame's paint area.
+ if( rLower.IsAccessible( bInPagePreview ) )
+ {
+ SwRect aLogBounds( rLower.GetBounds( rAccMap ) );
+ if( !aLogBounds.IsEmpty() )
+ {
+ Rectangle aPixBounds( rAccMap.CoreToPixel( aLogBounds.SVRect() ) );
+ if( aPixBounds.IsInside( rPixPos ) )
+ aRet = rLower;
+ }
+ }
+ else if( rLower.GetSwFrm() )
+ {
+ // There are no unaccessible SdrObjects that count
+ aRet = GetChildAtPixel( rVisArea, *(rLower.GetSwFrm()), rPixPos,
+ bInPagePreview, rAccMap );
+ }
+ ++aIter;
+ }
+ }
+
+ return aRet;
+}
+
+/* static */ void SwAccessibleFrame::GetChildren( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ ::std::list< SwAccessibleChild >& rChildren,
+ sal_Bool bInPagePreview )
+{
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
+ {
+ // We need a sorted list here
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
+ while( aIter != aVisMap.end() )
+ {
+ const SwAccessibleChild& rLower = (*aIter).second;
+ if( rLower.IsAccessible( bInPagePreview ) )
+ {
+ rChildren.push_back( rLower );
+ }
+ else if( rLower.GetSwFrm() )
+ {
+ // There are no unaccessible SdrObjects that count
+ GetChildren( rAccMap, rVisArea, *(rLower.GetSwFrm()),
+ rChildren, bInPagePreview );
+ }
+ ++aIter;
+ }
+ }
+ else
+ {
+ // The unsorted list is sorted enough, because it return lower
+ // frames in the correct order.
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
+ while( aIter != aVisList.end() )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ if( rLower.IsAccessible( bInPagePreview ) )
+ {
+ rChildren.push_back( rLower );
+ }
+ else if( rLower.GetSwFrm() )
+ {
+ // There are no unaccessible SdrObjects that count
+ GetChildren( rAccMap, rVisArea, *(rLower.GetSwFrm()),
+ rChildren, bInPagePreview );
+ }
+ ++aIter;
+ }
+ }
+}
+
+SwRect SwAccessibleFrame::GetBounds( const SwAccessibleMap& rAccMap,
+ const SwFrm *pFrm )
+{
+ if( !pFrm )
+ pFrm = GetFrm();
+
+ SwAccessibleChild aFrm( pFrm );
+ SwRect aBounds( aFrm.GetBounds( rAccMap ).Intersection( maVisArea ) );
+ return aBounds;
+}
+
+sal_Bool SwAccessibleFrame::IsEditable( ViewShell *pVSh ) const
+{
+ const SwFrm *pFrm = GetFrm();
+ if( !pFrm )
+ return sal_False;
+
+ ASSERT( pVSh, "no view shell" );
+ if( pVSh && (pVSh->GetViewOptions()->IsReadonly() ||
+ pVSh->IsPreView()) )
+ return sal_False;
+
+ if( !pFrm->IsRootFrm() && pFrm->IsProtected() )
+ return sal_False;
+
+ return sal_True;
+}
+
+sal_Bool SwAccessibleFrame::IsOpaque( ViewShell *pVSh ) const
+{
+ SwAccessibleChild aFrm( GetFrm() );
+ if( !aFrm.GetSwFrm() )
+ return sal_False;
+
+ ASSERT( pVSh, "no view shell" );
+ if( !pVSh )
+ return sal_False;
+
+ const SwViewOption *pVOpt = pVSh->GetViewOptions();
+ do
+ {
+ const SwFrm *pFrm = aFrm.GetSwFrm();
+ if( pFrm->IsRootFrm() )
+ return sal_True;
+
+ if( pFrm->IsPageFrm() && !pVOpt->IsPageBack() )
+ return sal_False;
+
+ const SvxBrushItem &rBack = pFrm->GetAttrSet()->GetBackground();
+ if( !rBack.GetColor().GetTransparency() ||
+ rBack.GetGraphicPos() != GPOS_NONE )
+ return sal_True;
+
+ /// OD 20.08.2002 #99657#
+ /// If a fly frame has a transparent background color, we have
+ /// to consider the background.
+ /// But a background color "no fill"/"auto fill" has *not* to be considered.
+ if( pFrm->IsFlyFrm() &&
+ (rBack.GetColor().GetTransparency() != 0) &&
+ (rBack.GetColor() != COL_TRANSPARENT)
+ )
+ return sal_True;
+
+ if( pFrm->IsSctFrm() )
+ {
+ const SwSection* pSection = ((SwSectionFrm*)pFrm)->GetSection();
+ if( pSection && ( TOX_HEADER_SECTION == pSection->GetType() ||
+ TOX_CONTENT_SECTION == pSection->GetType() ) &&
+ !pVOpt->IsReadonly() &&
+ SwViewOption::IsIndexShadings() )
+ return sal_True;
+ }
+ if( pFrm->IsFlyFrm() )
+ aFrm = static_cast<const SwFlyFrm*>(pFrm)->GetAnchorFrm();
+ else
+ aFrm = pFrm->GetUpper();
+ } while( aFrm.GetSwFrm() && !aFrm.IsAccessible( IsInPagePreview() ) );
+
+ return sal_False;
+}
+
+SwAccessibleFrame::SwAccessibleFrame( const SwRect& rVisArea,
+ const SwFrm *pF,
+ sal_Bool bIsPagePreview ) :
+ maVisArea( rVisArea ),
+ mpFrm( pF ),
+ mbIsInPagePreview( bIsPagePreview )
+{
+}
+
+SwAccessibleFrame::~SwAccessibleFrame()
+{
+}
+
+/* static */ const SwFrm* SwAccessibleFrame::GetParent( const SwAccessibleChild& rFrmOrObj,
+ sal_Bool bInPagePreview )
+{
+ return rFrmOrObj.GetParent( bInPagePreview );
+}
+
+String SwAccessibleFrame::GetFormattedPageNumber() const
+{
+ sal_uInt16 nPageNum = GetFrm()->GetVirtPageNum();
+ sal_uInt32 nFmt = GetFrm()->FindPageFrm()->GetPageDesc()
+ ->GetNumType().GetNumberingType();
+ if( SVX_NUM_NUMBER_NONE == nFmt )
+ nFmt = SVX_NUM_ARABIC;
+
+ String sRet( FormatNumber( nPageNum, nFmt ) );
+ return sRet;
+}
+
+sal_Int32 SwAccessibleFrame::GetChildCount( SwAccessibleMap& rAccMap ) const
+{
+ return GetChildCount( rAccMap, maVisArea, mpFrm, IsInPagePreview() );
+}
+
+sw::access::SwAccessibleChild SwAccessibleFrame::GetChild(
+ SwAccessibleMap& rAccMap,
+ sal_Int32 nPos ) const
+{
+ return SwAccessibleFrame::GetChild( rAccMap, maVisArea, *mpFrm, nPos, IsInPagePreview() );
+}
+
+sal_Int32 SwAccessibleFrame::GetChildIndex( SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rChild ) const
+{
+ sal_Int32 nPos = 0;
+ return GetChildIndex( rAccMap, maVisArea, *mpFrm, rChild, nPos, IsInPagePreview() )
+ ? nPos
+ : -1L;
+}
+
+sw::access::SwAccessibleChild SwAccessibleFrame::GetChildAtPixel(
+ const Point& rPos,
+ SwAccessibleMap& rAccMap ) const
+{
+ return GetChildAtPixel( maVisArea, *mpFrm, rPos, IsInPagePreview(), rAccMap );
+}
+
+void SwAccessibleFrame::GetChildren( SwAccessibleMap& rAccMap,
+ ::std::list< sw::access::SwAccessibleChild >& rChildren ) const
+{
+ GetChildren( rAccMap, maVisArea, *mpFrm, rChildren, IsInPagePreview() );
+}
+
+sal_Bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rFrmOrObj ) const
+{
+ return IsShowing( rFrmOrObj.GetBox( rAccMap ) );
+}
+
diff --git a/sw/source/core/access/accframe.hxx b/sw/source/core/access/accframe.hxx
new file mode 100644
index 000000000000..48da1bdbb9cb
--- /dev/null
+++ b/sw/source/core/access/accframe.hxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCFRAME_HXX
+#define _ACCFRAME_HXX
+
+#include <swrect.hxx>
+
+#include <sal/types.h>
+#include <tools/string.hxx>
+
+#include <list>
+#include <accfrmobj.hxx>
+
+class SwAccessibleMap;
+class SwFrm;
+class ViewShell;
+namespace sw { namespace access {
+ class SwAccessibleChild;
+}}
+
+// Any method of this class must be called with an acquired solar mutex!
+
+class SwAccessibleFrame
+{
+ SwRect maVisArea;
+ const SwFrm* mpFrm;
+ const sal_Bool mbIsInPagePreview;
+
+protected:
+ // --> OD 2007-06-29 #i77106#
+ // method needs to be called by new class <SwAccessibleTableColHeaders>
+ static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm *pFrm,
+ sal_Bool bInPagePreview );
+private:
+ static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview);
+
+ static sal_Bool GetChildIndex( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ const sw::access::SwAccessibleChild& rChild,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview );
+
+ static sw::access::SwAccessibleChild GetChildAtPixel( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ const Point& rPos,
+ sal_Bool bInPagePreview,
+ SwAccessibleMap& rAccMap );
+
+ static void GetChildren( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ ::std::list< sw::access::SwAccessibleChild >& rChildren,
+ sal_Bool bInPagePreview );
+
+protected:
+
+ sal_Bool IsEditable( ViewShell *pVSh ) const;
+
+ sal_Bool IsOpaque( ViewShell *pVSh ) const;
+
+ sal_Bool IsShowing( const SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rFrmOrObj ) const;
+ inline sal_Bool IsShowing( const SwRect& rFrm ) const;
+ inline sal_Bool IsShowing( const SwAccessibleMap& rAccMap ) const;
+
+ inline sal_Bool IsInPagePreview() const
+ {
+ return mbIsInPagePreview;
+ }
+
+ inline void ClearFrm()
+ {
+ mpFrm = 0;
+ }
+
+ SwAccessibleFrame( const SwRect& rVisArea,
+ const SwFrm *pFrm,
+ sal_Bool bIsPagePreview );
+ virtual ~SwAccessibleFrame();
+
+public:
+ // Return the SwFrm this context is attached to.
+ const SwFrm* GetFrm() const { return mpFrm; };
+
+ static const SwFrm* GetParent( const sw::access::SwAccessibleChild& rFrmOrObj,
+ sal_Bool bInPagePreview );
+
+ sal_Int32 GetChildIndex( SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rChild ) const;
+
+protected:
+
+ // Return the bounding box of the frame clipped to the vis area. If
+ // no frame is specified, use this' frame.
+ SwRect GetBounds( const SwAccessibleMap& rAccMap,
+ const SwFrm *pFrm = 0 );
+
+ // Return the upper that has a context attached. This might be
+ // another one than the immediate upper.
+ inline const SwFrm *GetParent() const;
+
+ // Return the lower count or the nth lower, there the lowers have a
+ // not be same one as the SwFrm's lowers
+ sal_Int32 GetChildCount( SwAccessibleMap& rAccMap ) const;
+ sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
+ sal_Int32 nPos ) const;
+ sw::access::SwAccessibleChild GetChildAtPixel( const Point& rPos,
+ SwAccessibleMap& rAccMap ) const;
+ void GetChildren( SwAccessibleMap& rAccMap,
+ ::std::list< sw::access::SwAccessibleChild >& rChildren ) const;
+
+ inline void SetVisArea( const SwRect& rNewVisArea )
+ {
+ maVisArea = rNewVisArea;
+ }
+
+ inline const SwRect& GetVisArea() const
+ {
+ return maVisArea;
+ }
+
+
+ String GetFormattedPageNumber() const;
+};
+
+inline sal_Bool SwAccessibleFrame::IsShowing( const SwRect& rFrm ) const
+{
+ return rFrm.IsOver( maVisArea );
+}
+
+inline sal_Bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap ) const
+{
+ sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
+ return IsShowing( rAccMap, aFrmOrObj );
+}
+
+inline const SwFrm *SwAccessibleFrame::GetParent() const
+{
+ sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
+ return GetParent( aFrmOrObj, IsInPagePreview() );
+}
+
+#endif
+
diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx
new file mode 100644
index 000000000000..91cbe0b9324f
--- /dev/null
+++ b/sw/source/core/access/accframebase.cxx
@@ -0,0 +1,279 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <frmfmt.hxx>
+#include <ndnotxt.hxx>
+#include <flyfrm.hxx>
+#include <cntfrm.hxx>
+#include <fmtcntnt.hxx>
+#include <ndindex.hxx>
+#include "fesh.hxx"
+#include <hints.hxx>
+#include "accmap.hxx"
+#include "accframebase.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+
+sal_Bool SwAccessibleFrameBase::IsSelected()
+{
+ sal_Bool bRet = sal_False;
+
+ DBG_ASSERT( GetMap(), "no map?" );
+ const ViewShell *pVSh = GetMap()->GetShell();
+ DBG_ASSERT( pVSh, "no shell?" );
+ if( pVSh->ISA( SwFEShell ) )
+ {
+ const SwFEShell *pFESh = static_cast< const SwFEShell * >( pVSh );
+ const SwFrm *pFlyFrm = pFESh->GetCurrFlyFrm();
+ if( pFlyFrm == GetFrm() )
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+void SwAccessibleFrameBase::GetStates(
+ ::utl::AccessibleStateSetHelper& rStateSet )
+{
+ SwAccessibleContext::GetStates( rStateSet );
+
+ const ViewShell *pVSh = GetMap()->GetShell();
+ DBG_ASSERT( pVSh, "no shell?" );
+ sal_Bool bSelectable = pVSh->ISA( SwFEShell );
+
+ // SELECTABLE
+ if( bSelectable )
+ rStateSet.AddState( AccessibleStateType::SELECTABLE );
+
+ // FOCUSABLE
+ if( bSelectable )
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ // SELECTED and FOCUSED
+ if( IsSelected() )
+ {
+ rStateSet.AddState( AccessibleStateType::SELECTED );
+ ASSERT( bIsSelected, "bSelected out of sync" );
+ ::vos::ORef < SwAccessibleContext > xThis( this );
+ GetMap()->SetCursorContext( xThis );
+
+ Window *pWin = GetWindow();
+ if( pWin && pWin->HasFocus() )
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+ }
+}
+
+
+sal_uInt8 SwAccessibleFrameBase::GetNodeType( const SwFlyFrm *pFlyFrm )
+{
+ sal_uInt8 nType = ND_TEXTNODE;
+ if( pFlyFrm->Lower() )
+ {
+ if( pFlyFrm->Lower()->IsNoTxtFrm() )
+ {
+ const SwCntntFrm *pCntFrm =
+ static_cast<const SwCntntFrm *>( pFlyFrm->Lower() );
+ nType = pCntFrm->GetNode()->GetNodeType();
+ }
+ }
+ else
+ {
+ const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+ const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt();
+ const SwNodeIndex *pNdIdx = rCntnt.GetCntntIdx();
+ if( pNdIdx )
+ {
+ const SwCntntNode *pCNd =
+ (pNdIdx->GetNodes())[pNdIdx->GetIndex()+1]->GetCntntNode();
+ if( pCNd )
+ nType = pCNd->GetNodeType();
+ }
+ }
+
+ return nType;
+}
+
+SwAccessibleFrameBase::SwAccessibleFrameBase(
+ SwAccessibleMap* pInitMap,
+ sal_Int16 nInitRole,
+ const SwFlyFrm* pFlyFrm ) :
+ SwAccessibleContext( pInitMap, nInitRole, pFlyFrm ),
+ bIsSelected( sal_False )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+ const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
+
+ SetName( pFrmFmt->GetName() );
+
+ bIsSelected = IsSelected();
+}
+
+void SwAccessibleFrameBase::_InvalidateCursorPos()
+{
+ sal_Bool bNewSelected = IsSelected();
+ sal_Bool bOldSelected;
+
+ {
+ vos::OGuard aGuard( aMutex );
+ bOldSelected = bIsSelected;
+ bIsSelected = bNewSelected;
+ }
+
+ if( bNewSelected )
+ {
+ // remember that object as the one that has the caret. This is
+ // neccessary to notify that object if the cursor leaves it.
+ ::vos::ORef < SwAccessibleContext > xThis( this );
+ GetMap()->SetCursorContext( xThis );
+ }
+
+ if( bOldSelected != bNewSelected )
+ {
+ Window *pWin = GetWindow();
+ if( pWin && pWin->HasFocus() && bNewSelected )
+ FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected );
+ FireStateChangedEvent( AccessibleStateType::SELECTED, bNewSelected );
+ if( pWin && pWin->HasFocus() && !bNewSelected )
+ FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected );
+
+ uno::Reference< XAccessible > xParent( GetWeakParent() );
+ if( xParent.is() )
+ {
+ SwAccessibleContext *pAcc =
+ static_cast <SwAccessibleContext *>( xParent.get() );
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+ pAcc->FireAccessibleEvent( aEvent );
+ }
+ }
+}
+
+void SwAccessibleFrameBase::_InvalidateFocus()
+{
+ Window *pWin = GetWindow();
+ if( pWin )
+ {
+ sal_Bool bSelected;
+
+ {
+ vos::OGuard aGuard( aMutex );
+ bSelected = bIsSelected;
+ }
+ ASSERT( bSelected, "focus object should be selected" );
+
+ FireStateChangedEvent( AccessibleStateType::FOCUSED,
+ pWin->HasFocus() && bSelected );
+ }
+}
+
+sal_Bool SwAccessibleFrameBase::HasCursor()
+{
+ vos::OGuard aGuard( aMutex );
+ return bIsSelected;
+}
+
+
+SwAccessibleFrameBase::~SwAccessibleFrameBase()
+{
+}
+
+void SwAccessibleFrameBase::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
+{
+ sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+ const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm * >( GetFrm() );
+ switch( nWhich )
+ {
+ case RES_NAME_CHANGED:
+ if( pFlyFrm )
+ {
+ const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+ ASSERT( pFrmFmt == GetRegisteredIn(), "invalid frame" );
+
+ OUString sOldName( GetName() );
+ ASSERT( !pOld ||
+ static_cast < const SwStringMsgPoolItem * >( pOld )->GetString() == String( sOldName ),
+ "invalid old name" );
+
+ const String& rNewName = pFrmFmt->GetName();
+ SetName( rNewName );
+ ASSERT( !pNew ||
+ static_cast < const SwStringMsgPoolItem * >( pNew )->GetString() == rNewName,
+ "invalid new name" );
+
+ if( sOldName != GetName() )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::NAME_CHANGED;
+ aEvent.OldValue <<= sOldName;
+ aEvent.NewValue <<= GetName();
+ FireAccessibleEvent( aEvent );
+ }
+ }
+ break;
+ case RES_OBJECTDYING:
+ // mba: it seems that this class intentionally does not call code in base class SwClient
+ if( GetRegisteredIn() ==
+ static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) )
+ GetRegisteredInNonConst()->Remove( this );
+ break;
+
+ case RES_FMT_CHG:
+ if( static_cast< const SwFmtChg * >(pNew)->pChangedFmt == GetRegisteredIn() &&
+ static_cast< const SwFmtChg * >(pOld)->pChangedFmt->IsFmtInDTOR() )
+ GetRegisteredInNonConst()->Remove( this );
+ break;
+
+ default:
+ // mba: former call to base class method removed as it is meant to handle only RES_OBJECTDYING
+ break;
+ }
+}
+
+void SwAccessibleFrameBase::Dispose( sal_Bool bRecursive )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if( GetRegisteredIn() )
+ GetRegisteredInNonConst()->Remove( this );
+
+ SwAccessibleContext::Dispose( bRecursive );
+}
diff --git a/sw/source/core/access/accframebase.hxx b/sw/source/core/access/accframebase.hxx
new file mode 100644
index 000000000000..551f8b452621
--- /dev/null
+++ b/sw/source/core/access/accframebase.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCFRAMEBASE_HXX
+#define _ACCFRAMEBASE_HXX
+
+#include <acccontext.hxx>
+
+#include <calbck.hxx>
+
+class SwFlyFrm;
+
+class SwAccessibleFrameBase : public SwAccessibleContext,
+ public SwClient
+{
+ sal_Bool bIsSelected; // protected by base class mutex
+
+ sal_Bool IsSelected();
+
+protected:
+
+ // Set states for getAccessibleStateSet.
+ // This drived class additionaly sets SELECTABLE(1), SELECTED(+),
+ // FOCUSABLE(1) and FOCUSED(+)
+ virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
+
+ virtual void _InvalidateCursorPos();
+ virtual void _InvalidateFocus();
+
+ virtual ~SwAccessibleFrameBase();
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+
+ SwAccessibleFrameBase( SwAccessibleMap* pInitMap,
+ sal_Int16 nInitRole,
+ const SwFlyFrm *pFlyFrm );
+
+ virtual sal_Bool HasCursor(); // required by map to remember that object
+
+ static sal_uInt8 GetNodeType( const SwFlyFrm *pFlyFrm );
+
+ // The object is not visible an longer and should be destroyed
+ virtual void Dispose( sal_Bool bRecursive = sal_False );
+};
+
+
+#endif
diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx
new file mode 100644
index 000000000000..66f41e2d7ec1
--- /dev/null
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -0,0 +1,428 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <accfrmobj.hxx>
+
+#include <accmap.hxx>
+#include <acccontext.hxx>
+
+#include <viewsh.hxx>
+#include <rootfrm.hxx>
+#include <flyfrm.hxx>
+#include <pagefrm.hxx>
+#include <cellfrm.hxx>
+#include <swtable.hxx>
+#include <dflyobj.hxx>
+#include <frmfmt.hxx>
+#include <fmtanchr.hxx>
+#include <dcontact.hxx>
+
+#include <vcl/window.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace access {
+
+SwAccessibleChild::SwAccessibleChild()
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{}
+
+SwAccessibleChild::SwAccessibleChild( const SdrObject* pDrawObj )
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{
+ Init( pDrawObj );
+}
+
+SwAccessibleChild::SwAccessibleChild( const SwFrm* pFrm )
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{
+ Init( pFrm );
+}
+
+SwAccessibleChild::SwAccessibleChild( Window* pWindow )
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{
+ Init( pWindow );
+}
+
+
+SwAccessibleChild::SwAccessibleChild( const SwFrm* pFrm,
+ const SdrObject* pDrawObj,
+ Window* pWindow )
+{
+ if ( pFrm )
+ {
+ Init( pFrm );
+ }
+ else if ( pDrawObj )
+ {
+ Init( pDrawObj );
+ }
+ else if ( pWindow )
+ {
+ Init( pWindow );
+ }
+ ASSERT( (!pFrm || pFrm == mpFrm) &&
+ (!pDrawObj || pDrawObj == mpDrawObj) &&
+ (!pWindow || pWindow == mpWindow),
+ "invalid frame/object/window combination" );
+
+}
+
+void SwAccessibleChild::Init( const SdrObject* pDrawObj )
+{
+ mpDrawObj = pDrawObj;
+ mpFrm = mpDrawObj && mpDrawObj->ISA(SwVirtFlyDrawObj)
+ ? static_cast < const SwVirtFlyDrawObj * >( mpDrawObj )->GetFlyFrm()
+ : 0;
+ mpWindow = 0;
+}
+
+void SwAccessibleChild::Init( const SwFrm* pFrm )
+{
+ mpFrm = pFrm;
+ mpDrawObj = mpFrm && mpFrm->IsFlyFrm()
+ ? static_cast < const SwFlyFrm * >( mpFrm )->GetVirtDrawObj()
+ : 0;
+ mpWindow = 0;
+}
+
+void SwAccessibleChild::Init( Window* pWindow )
+{
+ mpWindow = pWindow;
+ mpFrm = 0;
+ mpDrawObj = 0;
+}
+
+bool SwAccessibleChild::IsAccessible( sal_Bool bPagePreview ) const
+{
+ bool bRet( false );
+
+ if ( mpFrm )
+ {
+ bRet = mpFrm->IsAccessibleFrm() &&
+ ( !mpFrm->IsCellFrm() ||
+ static_cast<const SwCellFrm *>( mpFrm )->GetTabBox()->GetSttNd() != 0 ) &&
+ !mpFrm->IsInCoveredCell() &&
+ ( bPagePreview ||
+ !mpFrm->IsPageFrm() );
+ }
+ else if ( mpDrawObj )
+ {
+ bRet = true;
+ }
+ else if ( mpWindow )
+ {
+ bRet = true;
+ }
+
+ return bRet;
+}
+
+bool SwAccessibleChild::IsBoundAsChar() const
+{
+ bool bRet( false );
+
+ if ( mpFrm )
+ {
+ bRet = mpFrm->IsFlyFrm() &&
+ static_cast< const SwFlyFrm *>(mpFrm)->IsFlyInCntFrm();
+ }
+ else if ( mpDrawObj )
+ {
+ const SwFrmFmt* mpFrmFmt = ::FindFrmFmt( mpDrawObj );
+ bRet = mpFrmFmt
+ ? (FLY_AS_CHAR == mpFrmFmt->GetAnchor().GetAnchorId())
+ : false;
+ }
+ else if ( mpWindow )
+ {
+ bRet = false;
+ }
+
+ return bRet;
+}
+
+SwAccessibleChild::SwAccessibleChild( const SwAccessibleChild& r )
+ : mpFrm( r.mpFrm )
+ , mpDrawObj( r.mpDrawObj )
+ , mpWindow( r.mpWindow )
+{}
+
+SwAccessibleChild& SwAccessibleChild::operator=( const SwAccessibleChild& r )
+{
+ mpDrawObj = r.mpDrawObj;
+ mpFrm = r.mpFrm;
+ mpWindow = r.mpWindow;
+
+ return *this;
+}
+
+SwAccessibleChild& SwAccessibleChild::operator=( const SdrObject* pDrawObj )
+{
+ Init( pDrawObj );
+ return *this;
+}
+
+SwAccessibleChild& SwAccessibleChild::operator=( const SwFrm* pFrm )
+{
+ Init( pFrm );
+ return *this;
+}
+
+SwAccessibleChild& SwAccessibleChild::operator=( Window* pWindow )
+{
+ Init( pWindow );
+ return *this;
+}
+
+bool SwAccessibleChild::operator==( const SwAccessibleChild& r ) const
+{
+ return mpFrm == r.mpFrm &&
+ mpDrawObj == r.mpDrawObj &&
+ mpWindow == r.mpWindow;
+}
+
+bool SwAccessibleChild::IsValid() const
+{
+ return mpFrm != 0 ||
+ mpDrawObj != 0 ||
+ mpWindow != 0;
+}
+
+const SdrObject* SwAccessibleChild::GetDrawObject() const
+{
+ return mpDrawObj;
+}
+
+const SwFrm *SwAccessibleChild::GetSwFrm() const
+{
+ return mpFrm;
+}
+
+Window* SwAccessibleChild::GetWindow() const
+{
+ return mpWindow;
+}
+
+bool SwAccessibleChild::IsVisibleChildrenOnly() const
+{
+ bool bRet( false );
+
+ if ( !mpFrm )
+ {
+ bRet = true;
+ }
+ else
+ {
+ bRet = mpFrm->IsRootFrm() ||
+ !( mpFrm->IsTabFrm() ||
+ mpFrm->IsInTab() ||
+ ( IsBoundAsChar() &&
+ static_cast<const SwFlyFrm*>(mpFrm)->GetAnchorFrm()->IsInTab() ) );
+ }
+
+ return bRet;
+}
+
+SwRect SwAccessibleChild::GetBox( const SwAccessibleMap& rAccMap ) const
+{
+ SwRect aBox;
+
+ if ( mpFrm )
+ {
+ if ( mpFrm->IsPageFrm() &&
+ static_cast< const SwPageFrm * >( mpFrm )->IsEmptyPage() )
+ {
+ aBox = SwRect( mpFrm->Frm().Left(), mpFrm->Frm().Top()-1, 1, 1 );
+ }
+ else if ( mpFrm->IsTabFrm() )
+ {
+ aBox = SwRect( mpFrm->Frm() );
+ aBox.Intersection( mpFrm->GetUpper()->Frm() );
+ }
+ else
+ {
+ aBox = mpFrm->Frm();
+ }
+ }
+ else if( mpDrawObj )
+ {
+ aBox = SwRect( mpDrawObj->GetCurrentBoundRect() );
+ }
+ else if ( mpWindow )
+ {
+ aBox = SwRect( rAccMap.GetShell()->GetWin()->PixelToLogic(
+ Rectangle( mpWindow->GetPosPixel(),
+ mpWindow->GetSizePixel() ) ) );
+}
+
+ return aBox;
+}
+
+SwRect SwAccessibleChild::GetBounds( const SwAccessibleMap& rAccMap ) const
+{
+ SwRect aBound;
+
+ if( mpFrm )
+ {
+ if( mpFrm->IsPageFrm() &&
+ static_cast< const SwPageFrm * >( mpFrm )->IsEmptyPage() )
+ {
+ aBound = SwRect( mpFrm->Frm().Left(), mpFrm->Frm().Top()-1, 0, 0 );
+ }
+ else
+ aBound = mpFrm->PaintArea();
+ }
+ else if( mpDrawObj )
+ {
+ aBound = GetBox( rAccMap );
+ }
+ else if ( mpWindow )
+ {
+ aBound = GetBox( rAccMap );
+ }
+
+ return aBound;
+}
+
+bool SwAccessibleChild::AlwaysIncludeAsChild() const
+{
+ bool bAlwaysIncludedAsChild( false );
+
+ if ( mpWindow )
+ {
+ bAlwaysIncludedAsChild = true;
+ }
+
+ return bAlwaysIncludedAsChild;
+}
+
+const SwFrm* SwAccessibleChild::GetParent( const sal_Bool bInPagePreview ) const
+{
+ const SwFrm* pParent( 0 );
+
+ if ( mpFrm )
+ {
+ if( mpFrm->IsFlyFrm() )
+ {
+ const SwFlyFrm* pFly = static_cast< const SwFlyFrm *>( mpFrm );
+ if( pFly->IsFlyInCntFrm() )
+ {
+ // For FLY_AS_CHAR the parent is the anchor
+ pParent = pFly->GetAnchorFrm();
+ ASSERT( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ),
+ "parent is not accessible" );
+ }
+ else
+ {
+ // In any other case the parent is the root frm
+ // (in page preview, the page frame)
+ if( bInPagePreview )
+ pParent = pFly->FindPageFrm();
+ else
+ pParent = pFly->getRootFrm();
+ }
+ }
+ else
+ {
+ SwAccessibleChild aUpper( mpFrm->GetUpper() );
+ while( aUpper.GetSwFrm() && !aUpper.IsAccessible(bInPagePreview) )
+ {
+ aUpper = aUpper.GetSwFrm()->GetUpper();
+ }
+ pParent = aUpper.GetSwFrm();
+ }
+ }
+ else if( mpDrawObj )
+ {
+ const SwDrawContact *pContact =
+ static_cast< const SwDrawContact* >( GetUserCall( mpDrawObj ) );
+ ASSERT( pContact, "sdr contact is missing" );
+ if( pContact )
+ {
+ const SwFrmFmt *pFrmFmt = pContact->GetFmt();
+ ASSERT( pFrmFmt, "frame format is missing" );
+ if( pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() )
+ {
+ // For FLY_AS_CHAR the parent is the anchor
+ pParent = pContact->GetAnchorFrm();
+ ASSERT( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ),
+ "parent is not accessible" );
+
+ }
+ else
+ {
+ // In any other case the parent is the root frm
+ if( bInPagePreview )
+ pParent = pContact->GetAnchorFrm()->FindPageFrm();
+ else
+ pParent = pContact->GetAnchorFrm()->getRootFrm();
+ }
+ }
+ }
+ else if ( mpWindow )
+ {
+ css::uno::Reference < css::accessibility::XAccessible > xAcc =
+ mpWindow->GetAccessible();
+ if ( xAcc.is() )
+ {
+ css::uno::Reference < css::accessibility::XAccessibleContext > xAccContext =
+ xAcc->getAccessibleContext();
+ if ( xAccContext.is() )
+ {
+ css::uno::Reference < css::accessibility::XAccessible > xAccParent =
+ xAccContext->getAccessibleParent();
+ if ( xAccParent.is() )
+ {
+ SwAccessibleContext* pAccParentImpl =
+ dynamic_cast< SwAccessibleContext *>( xAccParent.get() );
+ if ( pAccParentImpl )
+ {
+ pParent = pAccParentImpl->GetFrm();
+ }
+ }
+ }
+ }
+ }
+
+ return pParent;
+}
+
+} } // eof of namespace sw::access
+
diff --git a/sw/source/core/access/accfrmobj.hxx b/sw/source/core/access/accfrmobj.hxx
new file mode 100644
index 000000000000..76113c62eae3
--- /dev/null
+++ b/sw/source/core/access/accfrmobj.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCFRMOBJ_HXX
+#define _ACCFRMOBJ_HXX
+
+#include <sal/types.h>
+
+class SwAccessibleMap;
+class SwFrm;
+class SdrObject;
+class Window;
+class SwRect;
+
+namespace sw { namespace access {
+
+class SwAccessibleChild
+{
+ public:
+ SwAccessibleChild();
+ explicit SwAccessibleChild( const SdrObject* pDrawObj );
+ explicit SwAccessibleChild( const SwFrm* pFrm );
+ explicit SwAccessibleChild( Window* pWindow );
+ SwAccessibleChild( const SwFrm* pFrm,
+ const SdrObject* pDrawObj,
+ Window* pWindow );
+
+ SwAccessibleChild( const SwAccessibleChild& r );
+ SwAccessibleChild& operator=( const SwAccessibleChild& r );
+
+ SwAccessibleChild& operator=( const SdrObject* pDrawObj );
+ SwAccessibleChild& operator=( const SwFrm* pFrm );
+ SwAccessibleChild& operator=( Window* pWindow );
+
+ bool operator==( const SwAccessibleChild& r ) const;
+
+ bool IsValid() const;
+
+ const SwFrm* GetSwFrm() const;
+ const SdrObject* GetDrawObject() const;
+ Window* GetWindow() const;
+
+ const SwFrm* GetParent( const sal_Bool bInPagePreview ) const;
+
+ bool IsAccessible( sal_Bool bPagePreview ) const;
+ bool IsBoundAsChar() const;
+
+ bool IsVisibleChildrenOnly() const;
+ SwRect GetBox( const SwAccessibleMap& rAccMap ) const;
+ SwRect GetBounds( const SwAccessibleMap& rAccMap ) const;
+
+ /** indicating, if accessible child is included even, if the corresponding
+ object is not visible.
+
+ @author OD
+ */
+ bool AlwaysIncludeAsChild() const;
+
+ private:
+ const SwFrm* mpFrm;
+ const SdrObject* mpDrawObj;
+ Window* mpWindow;
+
+ void Init( const SdrObject* pDrawObj );
+ void Init( const SwFrm* pFrm );
+ void Init( Window* pWindow );
+};
+
+
+} } // eof of namespace sw::access
+
+#endif
diff --git a/sw/source/core/access/accfrmobjmap.cxx b/sw/source/core/access/accfrmobjmap.cxx
new file mode 100644
index 000000000000..11834ee89963
--- /dev/null
+++ b/sw/source/core/access/accfrmobjmap.cxx
@@ -0,0 +1,168 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <accfrmobjmap.hxx>
+#include <accframe.hxx>
+#include <accmap.hxx>
+#include <acccontext.hxx>
+
+#include <viewsh.hxx>
+#include <doc.hxx>
+#include <frmfmt.hxx>
+#include <pagefrm.hxx>
+#include <txtfrm.hxx>
+#include <node.hxx>
+#include <sortedobjs.hxx>
+#include <anchoredobject.hxx>
+
+#include <svx/svdobj.hxx>
+
+using namespace sw::access;
+
+SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap )
+ : nHellId( rAccMap.GetShell()->GetDoc()->GetHellId() )
+ , nControlsId( rAccMap.GetShell()->GetDoc()->GetControlsId() )
+{
+ const bool bVisibleChildrenOnly = SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly();
+
+ sal_uInt32 nPos = 0;
+ SwAccessibleChild aLower( rFrm.GetLower() );
+ while( aLower.GetSwFrm() )
+ {
+ if ( !bVisibleChildrenOnly ||
+ aLower.AlwaysIncludeAsChild() ||
+ aLower.GetBox( rAccMap ).IsOver( rVisArea ) )
+ {
+ insert( nPos++, SwAccessibleChildMapKey::TEXT, aLower );
+ }
+
+ aLower = aLower.GetSwFrm()->GetNext();
+ }
+
+ if ( rFrm.IsPageFrm() )
+ {
+ ASSERT( bVisibleChildrenOnly, "page frame within tab frame???" );
+ const SwPageFrm *pPgFrm =
+ static_cast< const SwPageFrm * >( &rFrm );
+ const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs();
+ if ( pObjs )
+ {
+ for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
+ {
+ aLower = (*pObjs)[i]->GetDrawObj();
+ if ( aLower.GetBox( rAccMap ).IsOver( rVisArea ) )
+ {
+ insert( aLower.GetDrawObject(), aLower );
+ }
+ }
+ }
+ }
+ else if( rFrm.IsTxtFrm() )
+ {
+ const SwSortedObjs *pObjs = rFrm.GetDrawObjs();
+ if ( pObjs )
+ {
+ for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
+ {
+ aLower = (*pObjs)[i]->GetDrawObj();
+ if ( aLower.IsBoundAsChar() &&
+ ( !bVisibleChildrenOnly ||
+ aLower.AlwaysIncludeAsChild() ||
+ aLower.GetBox( rAccMap ).IsOver( rVisArea ) ) )
+ {
+ insert( aLower.GetDrawObject(), aLower );
+ }
+ }
+ }
+
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl =
+ rAccMap.GetContextImpl( &rFrm, sal_False );
+ if( xAccImpl.isValid() )
+ {
+ SwAccessibleContext* pAccImpl = xAccImpl.getBodyPtr();
+ if ( pAccImpl &&
+ pAccImpl->HasAdditionalAccessibleChildren() )
+ {
+ std::vector< Window* >* pAdditionalChildren =
+ new std::vector< Window* >();
+ pAccImpl->GetAdditionalAccessibleChildren( pAdditionalChildren );
+
+ sal_Int32 nCounter( 0 );
+ for ( std::vector< Window* >::iterator aIter = pAdditionalChildren->begin();
+ aIter != pAdditionalChildren->end();
+ ++aIter )
+ {
+ aLower = (*aIter);
+ insert( ++nCounter, SwAccessibleChildMapKey::XWINDOW, aLower );
+ }
+
+ delete pAdditionalChildren;
+ }
+ }
+ }
+ }
+}
+
+::std::pair< SwAccessibleChildMap::iterator, bool > SwAccessibleChildMap::insert(
+ const sal_uInt32 nPos,
+ const SwAccessibleChildMapKey::LayerId eLayerId,
+ const SwAccessibleChild& rLower )
+{
+ SwAccessibleChildMapKey aKey( eLayerId, nPos );
+ value_type aEntry( aKey, rLower );
+ return _SwAccessibleChildMap::insert( aEntry );
+}
+
+::std::pair< SwAccessibleChildMap::iterator, bool > SwAccessibleChildMap::insert(
+ const SdrObject *pObj,
+ const SwAccessibleChild& rLower )
+{
+ const SdrLayerID nLayer = pObj->GetLayer();
+ SwAccessibleChildMapKey::LayerId eLayerId =
+ (nHellId == nLayer)
+ ? SwAccessibleChildMapKey::HELL
+ : ( (nControlsId == nLayer)
+ ? SwAccessibleChildMapKey::CONTROLS
+ : SwAccessibleChildMapKey::HEAVEN );
+ SwAccessibleChildMapKey aKey( eLayerId, pObj->GetOrdNum() );
+ value_type aEntry( aKey, rLower );
+ return _SwAccessibleChildMap::insert( aEntry );
+}
+
+/* static */ sal_Bool SwAccessibleChildMap::IsSortingRequired( const SwFrm& rFrm )
+{
+ return ( rFrm.IsPageFrm() &&
+ static_cast< const SwPageFrm& >( rFrm ).GetSortedObjs() ) ||
+ ( rFrm.IsTxtFrm() &&
+ rFrm.GetDrawObjs() );
+}
diff --git a/sw/source/core/access/accfrmobjmap.hxx b/sw/source/core/access/accfrmobjmap.hxx
new file mode 100644
index 000000000000..91365ed9c258
--- /dev/null
+++ b/sw/source/core/access/accfrmobjmap.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCFRMOBJMAP_HXX
+#define _ACCFRMOBJMAP_HXX
+
+#include <accfrmobj.hxx>
+
+#include <svx/svdtypes.hxx>
+
+#include <map>
+
+class SwAccessibleMap;
+class SwDoc;
+class SwRect;
+class SwFrm;
+class SdrObject;
+
+class SwAccessibleChildMapKey
+{
+public:
+ enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS, XWINDOW };
+
+ inline SwAccessibleChildMapKey()
+ : eLayerId( INVALID )
+ , nOrdNum( 0 )
+ {}
+
+ inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
+ : eLayerId( eId )
+ , nOrdNum( nOrd )
+ {}
+
+ inline bool operator()( const SwAccessibleChildMapKey& r1,
+ const SwAccessibleChildMapKey& r2 ) const
+ {
+ return (r1.eLayerId == r2.eLayerId)
+ ? (r1.nOrdNum < r2.nOrdNum)
+ : (r1.eLayerId < r2.eLayerId);
+ }
+
+private:
+
+ LayerId eLayerId;
+ sal_uInt32 nOrdNum;
+
+};
+
+typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey >
+ _SwAccessibleChildMap;
+
+class SwAccessibleChildMap : public _SwAccessibleChildMap
+{
+ const SdrLayerID nHellId;
+ const SdrLayerID nControlsId;
+
+ ::std::pair< iterator, bool > insert( const sal_uInt32 nPos,
+ const SwAccessibleChildMapKey::LayerId eLayerId,
+ const sw::access::SwAccessibleChild& rLower );
+ ::std::pair< iterator, bool > insert( const SdrObject* pObj,
+ const sw::access::SwAccessibleChild& rLower );
+
+public:
+
+ SwAccessibleChildMap( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap );
+
+ static sal_Bool IsSortingRequired( const SwFrm& rFrm );
+};
+
+#endif
+
diff --git a/sw/source/core/access/accfrmobjslist.cxx b/sw/source/core/access/accfrmobjslist.cxx
new file mode 100644
index 000000000000..2f3e8399187a
--- /dev/null
+++ b/sw/source/core/access/accfrmobjslist.cxx
@@ -0,0 +1,173 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <accfrmobjslist.hxx>
+#include <accmap.hxx>
+#include <acccontext.hxx>
+
+#include <pagefrm.hxx>
+#include <sortedobjs.hxx>
+#include <anchoredobject.hxx>
+
+using namespace ::sw::access;
+
+SwAccessibleChildSList_const_iterator::SwAccessibleChildSList_const_iterator(
+ const SwAccessibleChildSList& rLst,
+ SwAccessibleMap& rAccMap )
+ : rList( rLst ),
+ aCurr( rList.GetFrm().GetLower() ),
+ nNextObj( 0 )
+{
+ if( !aCurr.GetSwFrm() )
+ {
+ const SwFrm& rFrm = rList.GetFrm();
+ if( rFrm.IsPageFrm() )
+ {
+ const SwPageFrm& rPgFrm = static_cast< const SwPageFrm& >( rFrm );
+ const SwSortedObjs *pObjs = rPgFrm.GetSortedObjs();
+ if( pObjs && pObjs->Count() )
+ {
+ aCurr = (*pObjs)[nNextObj++]->GetDrawObj();
+ }
+ }
+ else if( rFrm.IsTxtFrm() )
+ {
+ const SwSortedObjs *pObjs = rFrm.GetDrawObjs();
+ if ( pObjs && pObjs->Count() )
+ {
+ aCurr = (*pObjs)[nNextObj++]->GetDrawObj();
+ while( aCurr.IsValid() && !aCurr.IsBoundAsChar() )
+ {
+ aCurr = (nNextObj < pObjs->Count())
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
+ }
+ }
+ if ( !aCurr.IsValid() )
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl =
+ rAccMap.GetContextImpl( &rFrm, sal_False );
+ if( xAccImpl.isValid() )
+ {
+ SwAccessibleContext* pAccImpl = xAccImpl.getBodyPtr();
+ aCurr = SwAccessibleChild( pAccImpl->GetAdditionalAccessibleChild( 0 ) );
+ ++nNextObj;
+ }
+ }
+ }
+ }
+
+ if( rList.IsVisibleChildrenOnly() )
+ {
+ // Find the first visible
+ while( aCurr.IsValid() &&
+ !aCurr.AlwaysIncludeAsChild() &&
+ !aCurr.GetBox( rAccMap ).IsOver( rList.GetVisArea() ) )
+ {
+ next();
+ }
+ }
+}
+
+SwAccessibleChildSList_const_iterator& SwAccessibleChildSList_const_iterator::next()
+{
+ bool bNextTaken( true );
+ if( aCurr.GetDrawObject() || aCurr.GetWindow() )
+ {
+ bNextTaken = false;
+ }
+ else if( aCurr.GetSwFrm() )
+ {
+ aCurr = aCurr.GetSwFrm()->GetNext();
+ if( !aCurr.GetSwFrm() )
+ {
+ bNextTaken = false;
+ }
+ }
+
+ if( !bNextTaken )
+ {
+ const SwFrm& rFrm = rList.GetFrm();
+ if( rFrm.IsPageFrm() )
+ {
+ const SwPageFrm& rPgFrm = static_cast< const SwPageFrm& >( rFrm );
+ const SwSortedObjs *pObjs = rPgFrm.GetSortedObjs();
+ aCurr = ( pObjs && nNextObj < pObjs->Count() )
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
+ }
+ else if( rFrm.IsTxtFrm() )
+ {
+ const SwSortedObjs* pObjs = rFrm.GetDrawObjs();
+ const sal_uInt32 nObjsCount = pObjs ? pObjs->Count() : 0;
+ aCurr = ( pObjs && nNextObj < nObjsCount )
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
+ while( aCurr.IsValid() && !aCurr.IsBoundAsChar() )
+ {
+ aCurr = ( nNextObj < nObjsCount )
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
+ }
+ if ( !aCurr.IsValid() )
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl =
+ rList.GetAccMap().GetContextImpl( &rFrm, sal_False );
+ if( xAccImpl.isValid() )
+ {
+ SwAccessibleContext* pAccImpl = xAccImpl.getBodyPtr();
+ aCurr = SwAccessibleChild( pAccImpl->GetAdditionalAccessibleChild( nNextObj - nObjsCount ) );
+ ++nNextObj;
+ }
+ }
+ }
+ }
+
+ return *this;
+}
+
+SwAccessibleChildSList_const_iterator& SwAccessibleChildSList_const_iterator::next_visible()
+{
+ next();
+ while( aCurr.IsValid() &&
+ !aCurr.AlwaysIncludeAsChild() &&
+ !aCurr.GetBox( rList.GetAccMap() ).IsOver( rList.GetVisArea() ) )
+ {
+ next();
+ }
+
+ return *this;
+}
+
+SwAccessibleChildSList_const_iterator& SwAccessibleChildSList_const_iterator::operator++()
+{
+ return rList.IsVisibleChildrenOnly() ? next_visible() : next();
+}
+
diff --git a/sw/source/core/access/accfrmobjslist.hxx b/sw/source/core/access/accfrmobjslist.hxx
new file mode 100644
index 000000000000..f81cfc85a9d7
--- /dev/null
+++ b/sw/source/core/access/accfrmobjslist.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCFRMOBJSLIST_HXX
+#define _ACCFRMOBJSLIST_HXX
+
+#include <accfrmobj.hxx>
+#include <swrect.hxx>
+
+class SwAccessibleMap;
+
+class SwAccessibleChildSList;
+
+class SwAccessibleChildSList_const_iterator
+{
+private:
+ friend class SwAccessibleChildSList;
+
+ const SwAccessibleChildSList& rList; // The frame we are iterating over
+ sw::access::SwAccessibleChild aCurr; // The current object
+ sal_uInt16 nNextObj; // The index of the current sdr object
+
+ inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst )
+ : rList( rLst )
+ , nNextObj( 0 )
+ {}
+
+ SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst,
+ SwAccessibleMap& rAccMap );
+
+ SwAccessibleChildSList_const_iterator& next();
+ SwAccessibleChildSList_const_iterator& next_visible();
+
+public:
+
+ inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList_const_iterator& rIter )
+ : rList( rIter.rList )
+ , aCurr( rIter.aCurr )
+ , nNextObj( rIter.nNextObj )
+ {}
+
+ inline sal_Bool operator==( const SwAccessibleChildSList_const_iterator& r ) const
+ {
+ return aCurr == r.aCurr;
+ }
+
+ inline sal_Bool operator!=(
+ const SwAccessibleChildSList_const_iterator& r ) const
+ {
+ return !(*this == r);
+ }
+
+ SwAccessibleChildSList_const_iterator& operator++();
+
+ inline const sw::access::SwAccessibleChild& operator*() const
+ {
+ return aCurr;
+ }
+};
+
+// An iterator to iterate over a frame's child in any order
+class SwAccessibleChildSList
+{
+ const SwRect maVisArea;
+ const SwFrm& mrFrm;
+ const sal_Bool mbVisibleChildrenOnly;
+ SwAccessibleMap& mrAccMap;
+
+public:
+
+ typedef SwAccessibleChildSList_const_iterator const_iterator;
+
+ inline SwAccessibleChildSList( const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap )
+ : maVisArea()
+ , mrFrm( rFrm )
+ , mbVisibleChildrenOnly( sal_False )
+ , mrAccMap( rAccMap )
+ {}
+
+ inline SwAccessibleChildSList( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap )
+ : maVisArea( rVisArea )
+ , mrFrm( rFrm )
+ , mbVisibleChildrenOnly( sw::access::SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly() )
+ , mrAccMap( rAccMap )
+ {
+ }
+
+ inline const_iterator begin() const
+ {
+ return SwAccessibleChildSList_const_iterator( *this, mrAccMap );
+ }
+
+ inline const_iterator end() const
+ {
+ return SwAccessibleChildSList_const_iterator( *this );
+ }
+
+ inline const SwFrm& GetFrm() const
+ {
+ return mrFrm;
+ }
+
+ inline sal_Bool IsVisibleChildrenOnly() const
+ {
+ return mbVisibleChildrenOnly;
+ }
+
+ inline const SwRect& GetVisArea() const
+ {
+ return maVisArea;
+ }
+
+ inline SwAccessibleMap& GetAccMap() const
+ {
+ return mrAccMap;
+ }
+};
+
+#endif
diff --git a/sw/source/core/access/accgraphic.cxx b/sw/source/core/access/accgraphic.cxx
new file mode 100644
index 000000000000..40888f4b3738
--- /dev/null
+++ b/sw/source/core/access/accgraphic.cxx
@@ -0,0 +1,97 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vcl/svapp.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <rtl/uuid.h>
+#include <flyfrm.hxx>
+#include "accgraphic.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+
+const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextGraphicObject";
+const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleGraphic";
+
+SwAccessibleGraphic::SwAccessibleGraphic(
+ SwAccessibleMap* pInitMap,
+ const SwFlyFrm* pFlyFrm ) :
+ SwAccessibleNoTextFrame( pInitMap, AccessibleRole::GRAPHIC, pFlyFrm )
+{
+}
+
+SwAccessibleGraphic::~SwAccessibleGraphic()
+{
+}
+
+OUString SAL_CALL SwAccessibleGraphic::getImplementationName()
+ throw( RuntimeException )
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
+}
+
+sal_Bool SAL_CALL SwAccessibleGraphic::supportsService(
+ const ::rtl::OUString& sTestServiceName)
+ throw (uno::RuntimeException)
+{
+ return sTestServiceName.equalsAsciiL( sServiceName,
+ sizeof(sServiceName)-1 ) ||
+ sTestServiceName.equalsAsciiL( sAccessibleServiceName,
+ sizeof(sAccessibleServiceName)-1 );
+}
+
+Sequence< OUString > SAL_CALL SwAccessibleGraphic::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
+ pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ return aRet;
+}
+
+Sequence< sal_Int8 > SAL_CALL SwAccessibleGraphic::getImplementationId()
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
diff --git a/sw/source/core/access/accgraphic.hxx b/sw/source/core/access/accgraphic.hxx
new file mode 100644
index 000000000000..aa64ee0df7e1
--- /dev/null
+++ b/sw/source/core/access/accgraphic.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCGRAPHIC_HXX
+#define _ACCGRAPHIC_HXX
+#include "accnotextframe.hxx"
+
+class SwAccessibleGraphic : public SwAccessibleNoTextFrame
+{
+
+protected:
+
+ virtual ~SwAccessibleGraphic();
+
+public:
+
+ SwAccessibleGraphic( SwAccessibleMap* pInitMap,
+ const SwFlyFrm *pFlyFrm );
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif
diff --git a/sw/source/core/access/accheaderfooter.cxx b/sw/source/core/access/accheaderfooter.cxx
new file mode 100644
index 000000000000..dada1083c810
--- /dev/null
+++ b/sw/source/core/access/accheaderfooter.cxx
@@ -0,0 +1,145 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vos/mutex.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <rtl/uuid.h>
+#include <vcl/svapp.hxx>
+#include <hffrm.hxx>
+#include "accheaderfooter.hxx"
+#ifndef _ACCESS_HRC
+#include "access.hrc"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+
+const sal_Char sServiceNameHeader[] = "com.sun.star.text.AccessibleHeaderView";
+const sal_Char sServiceNameFooter[] = "com.sun.star.text.AccessibleFooterView";
+const sal_Char sImplementationNameHeader[] = "com.sun.star.comp.Writer.SwAccessibleHeaderView";
+const sal_Char sImplementationNameFooter[] = "com.sun.star.comp.Writer.SwAccessibleFooterView";
+
+SwAccessibleHeaderFooter::SwAccessibleHeaderFooter(
+ SwAccessibleMap* pInitMap,
+ const SwHeaderFrm* pHdFrm ) :
+ SwAccessibleContext( pInitMap, AccessibleRole::HEADER, pHdFrm )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ OUString sArg( OUString::valueOf( (sal_Int32)pHdFrm->GetPhyPageNum() ) );
+ SetName( GetResource( STR_ACCESS_HEADER_NAME, &sArg ) );
+}
+
+SwAccessibleHeaderFooter::SwAccessibleHeaderFooter(
+ SwAccessibleMap* pInitMap,
+ const SwFooterFrm* pFtFrm ) :
+ SwAccessibleContext( pInitMap, AccessibleRole::FOOTER, pFtFrm )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ OUString sArg( OUString::valueOf( (sal_Int32)pFtFrm->GetPhyPageNum() ) );
+ SetName( GetResource( STR_ACCESS_FOOTER_NAME, &sArg ) );
+}
+
+SwAccessibleHeaderFooter::~SwAccessibleHeaderFooter()
+{
+}
+
+OUString SAL_CALL SwAccessibleHeaderFooter::getAccessibleDescription (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ sal_uInt16 nResId = AccessibleRole::HEADER == GetRole()
+ ? STR_ACCESS_HEADER_DESC
+ : STR_ACCESS_FOOTER_DESC ;
+
+ OUString sArg( GetFormattedPageNumber() );
+
+ return GetResource( nResId, &sArg );
+}
+
+OUString SAL_CALL SwAccessibleHeaderFooter::getImplementationName()
+ throw( RuntimeException )
+{
+ if( AccessibleRole::HEADER == GetRole() )
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationNameHeader));
+ else
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationNameFooter));
+}
+
+sal_Bool SAL_CALL SwAccessibleHeaderFooter::supportsService(
+ const ::rtl::OUString& sTestServiceName)
+ throw (uno::RuntimeException)
+{
+ if( sTestServiceName.equalsAsciiL( sAccessibleServiceName,
+ sizeof(sAccessibleServiceName)-1 ) )
+ return sal_True;
+ else if( AccessibleRole::HEADER == GetRole() )
+ return sTestServiceName.equalsAsciiL( sServiceNameHeader, sizeof(sServiceNameHeader)-1 );
+ else
+ return sTestServiceName.equalsAsciiL( sServiceNameFooter, sizeof(sServiceNameFooter)-1 );
+
+}
+
+Sequence< OUString > SAL_CALL SwAccessibleHeaderFooter::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ if( AccessibleRole::HEADER == GetRole() )
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceNameHeader) );
+ else
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceNameFooter) );
+ pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ return aRet;
+}
+
+Sequence< sal_Int8 > SAL_CALL SwAccessibleHeaderFooter::getImplementationId()
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
diff --git a/sw/source/core/access/accheaderfooter.hxx b/sw/source/core/access/accheaderfooter.hxx
new file mode 100644
index 000000000000..8a0bbb84b6e5
--- /dev/null
+++ b/sw/source/core/access/accheaderfooter.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCHEADERFOOTER_HXX
+#define _ACCHEADERFOOTER_HXX
+#ifndef _ACCCONTEXT_HXX
+#include "acccontext.hxx"
+#endif
+
+class SwHeaderFrm;
+class SwFooterFrm;
+
+class SwAccessibleHeaderFooter : public SwAccessibleContext
+{
+
+protected:
+
+ virtual ~SwAccessibleHeaderFooter();
+
+public:
+
+ SwAccessibleHeaderFooter( SwAccessibleMap* pInitMap,
+ const SwHeaderFrm* pHdFrm );
+ SwAccessibleHeaderFooter( SwAccessibleMap* pInitMap,
+ const SwFooterFrm* pFtFrm );
+
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (com::sun::star::uno::RuntimeException);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif
+
diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx
new file mode 100644
index 000000000000..6d252488c792
--- /dev/null
+++ b/sw/source/core/access/acchyperlink.cxx
@@ -0,0 +1,190 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <comphelper/accessiblekeybindinghelper.hxx>
+#include <swurl.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <ndtxt.hxx>
+#include <txtinet.hxx>
+#include <accpara.hxx>
+#include <acchyperlink.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+
+SwAccessibleHyperlink::SwAccessibleHyperlink( sal_uInt16 nHPos,
+ SwAccessibleParagraph *p, sal_Int32 nStt, sal_Int32 nEnd ) :
+ nHintPos( nHPos ),
+ xPara( p ),
+ nStartIdx( nStt ),
+ nEndIdx( nEnd )
+{
+}
+
+const SwTxtAttr *SwAccessibleHyperlink::GetTxtAttr() const
+{
+ const SwTxtAttr *pTxtAttr = 0;
+ if( xPara.isValid() && xPara->GetMap() )
+ {
+ const SwTxtNode *pTxtNd = xPara->GetTxtNode();
+ const SwpHints *pHints = pTxtNd->GetpSwpHints();
+ if( pHints && nHintPos < pHints->Count() )
+ {
+ const SwTxtAttr *pHt = (*pHints)[nHintPos];
+ if( RES_TXTATR_INETFMT == pHt->Which() )
+ pTxtAttr = pHt;
+ }
+ }
+
+ return pTxtAttr;
+}
+
+
+// XAccessibleAction
+sal_Int32 SAL_CALL SwAccessibleHyperlink::getAccessibleActionCount()
+ throw (uno::RuntimeException)
+{
+ return isValid() ? 1 : 0;
+}
+
+sal_Bool SAL_CALL SwAccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ sal_Bool bRet = sal_False;
+
+ const SwTxtAttr *pTxtAttr = GetTxtAttr();
+ if( pTxtAttr && 0 == nIndex )
+ {
+ const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
+ if( rINetFmt.GetValue().Len() )
+ {
+ ViewShell *pVSh = xPara->GetShell();
+ if( pVSh )
+ {
+ LoadURL( rINetFmt.GetValue(), pVSh, URLLOAD_NOFILTER,
+ &rINetFmt.GetTargetFrame() );
+ ASSERT( pTxtAttr == rINetFmt.GetTxtINetFmt(),
+ "lost my txt attr" );
+ const SwTxtINetFmt* pTxtAttr2 = rINetFmt.GetTxtINetFmt();
+ if( pTxtAttr2 )
+ {
+ const_cast<SwTxtINetFmt*>(pTxtAttr2)->SetVisited(true);
+ const_cast<SwTxtINetFmt*>(pTxtAttr2)->SetVisitedValid(true);
+ }
+ bRet = sal_True;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+OUString SAL_CALL SwAccessibleHyperlink::getAccessibleActionDescription(
+ sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ OUString sDesc;
+
+ const SwTxtAttr *pTxtAttr = GetTxtAttr();
+ if( pTxtAttr && 0 == nIndex )
+ {
+ const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
+ sDesc = OUString( rINetFmt.GetValue() );
+ }
+
+ return sDesc;
+}
+
+uno::Reference< XAccessibleKeyBinding > SAL_CALL
+ SwAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ uno::Reference< XAccessibleKeyBinding > xKeyBinding;
+
+ if( isValid() && 0==nIndex )
+ {
+ ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper =
+ new ::comphelper::OAccessibleKeyBindingHelper();
+ xKeyBinding = pKeyBindingHelper;
+
+ awt::KeyStroke aKeyStroke;
+ aKeyStroke.Modifiers = 0;
+ aKeyStroke.KeyCode = KEY_RETURN;
+ aKeyStroke.KeyChar = 0;
+ aKeyStroke.KeyFunc = 0;
+ pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+ }
+
+ return xKeyBinding;
+}
+
+// XAccessibleHyperlink
+uno::Any SAL_CALL SwAccessibleHyperlink::getAccessibleActionAnchor(
+ sal_Int32 /*nIndex*/ )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ return uno::Any();
+}
+
+uno::Any SAL_CALL SwAccessibleHyperlink::getAccessibleActionObject(
+ sal_Int32 /*nIndex*/ )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ return uno::Any();
+}
+
+sal_Int32 SAL_CALL SwAccessibleHyperlink::getStartIndex()
+ throw (uno::RuntimeException)
+{
+ return nStartIdx;
+}
+
+sal_Int32 SAL_CALL SwAccessibleHyperlink::getEndIndex()
+ throw (uno::RuntimeException)
+{
+ return nEndIdx;
+}
+
+sal_Bool SAL_CALL SwAccessibleHyperlink::isValid( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return xPara.isValid();
+}
+
+void SwAccessibleHyperlink::Invalidate()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ xPara = 0;
+}
+
diff --git a/sw/source/core/access/acchyperlink.hxx b/sw/source/core/access/acchyperlink.hxx
new file mode 100644
index 000000000000..ed81feb9deb3
--- /dev/null
+++ b/sw/source/core/access/acchyperlink.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ACCHYPERLINK_HXX
+#define _ACCHYPERLINK_HXX
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#include <vos/ref.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <fmtinfmt.hxx>
+
+class SwAccessibleParagraph;
+class SwTxtAttr;
+
+class SwAccessibleHyperlink :
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::accessibility::XAccessibleHyperlink >
+{
+ friend class SwAccessibleParagraph;
+ friend class SwAccessibleHyperTextData;
+ sal_uInt16 nHintPos;
+ ::vos::ORef< SwAccessibleParagraph > xPara;
+ sal_Int32 nStartIdx;
+ sal_Int32 nEndIdx;
+
+ SwAccessibleHyperlink( sal_uInt16 nHintPos,
+ SwAccessibleParagraph *p,
+ sal_Int32 nStt, sal_Int32 nEnd );
+
+ const SwTxtAttr *GetTxtAttr() const;
+ void Invalidate();
+
+public:
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription(
+ sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL
+ getAccessibleActionKeyBinding( sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleHyperlink
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor(
+ sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject(
+ sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getStartIndex()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getEndIndex()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isValid( )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
diff --git a/sw/source/core/access/acchypertextdata.cxx b/sw/source/core/access/acchypertextdata.cxx
new file mode 100644
index 000000000000..5a6193489255
--- /dev/null
+++ b/sw/source/core/access/acchypertextdata.cxx
@@ -0,0 +1,55 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <acchyperlink.hxx>
+#include <acchypertextdata.hxx>
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+
+SwAccessibleHyperTextData::SwAccessibleHyperTextData() :
+ _SwAccessibleHyperlinkMap_Impl()
+{
+}
+
+SwAccessibleHyperTextData::~SwAccessibleHyperTextData()
+{
+ iterator aIter = begin();
+ while( aIter != end() )
+ {
+ Reference < XAccessibleHyperlink > xTmp = (*aIter).second;
+ if( xTmp.is() )
+ {
+ SwAccessibleHyperlink *pTmp =
+ static_cast< SwAccessibleHyperlink * >( xTmp.get() );
+ pTmp->Invalidate();
+ }
+ ++aIter;
+ }
+}
diff --git a/sw/source/core/access/acchypertextdata.hxx b/sw/source/core/access/acchypertextdata.hxx
new file mode 100644
index 000000000000..fde1809fef1b
--- /dev/null
+++ b/sw/source/core/access/acchypertextdata.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCHYPERTEXTDATA_HXX
+#define _ACCHYPERTEXTDATA_HXX
+
+#include <cppuhelper/weakref.hxx>
+
+#include <map>
+
+class SwTxtAttr;
+
+namespace com { namespace sun { namespace star {
+ namespace accessibility { class XAccessibleHyperlink; }
+} } }
+
+typedef ::std::less< const SwTxtAttr * > SwTxtAttrPtrLess;
+typedef ::std::map < const SwTxtAttr *, ::com::sun::star::uno::WeakReference < com::sun::star::accessibility::XAccessibleHyperlink >, SwTxtAttrPtrLess > _SwAccessibleHyperlinkMap_Impl;
+
+class SwAccessibleHyperTextData : public _SwAccessibleHyperlinkMap_Impl
+{
+public:
+ SwAccessibleHyperTextData();
+ ~SwAccessibleHyperTextData();
+};
+
+#endif
+
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
new file mode 100644
index 000000000000..6684354ef7ac
--- /dev/null
+++ b/sw/source/core/access/accmap.cxx
@@ -0,0 +1,2878 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vos/ref.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <vcl/window.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/unomod.hxx>
+#include <tools/debug.hxx>
+
+#include <map>
+#include <list>
+#include <accmap.hxx>
+#include <acccontext.hxx>
+#include <accdoc.hxx>
+#include <accpreview.hxx>
+#include <accpage.hxx>
+#include <accpara.hxx>
+#include <accheaderfooter.hxx>
+#include <accfootnote.hxx>
+#include <acctextframe.hxx>
+#include <accgraphic.hxx>
+#include <accembedded.hxx>
+#include <acccell.hxx>
+#include <acctable.hxx>
+#include <fesh.hxx>
+#include <rootfrm.hxx>
+#include <txtfrm.hxx>
+#include <hffrm.hxx>
+#include <ftnfrm.hxx>
+#include <cellfrm.hxx>
+#include <tabfrm.hxx>
+#include <pagefrm.hxx>
+#include <flyfrm.hxx>
+#include <ndtyp.hxx>
+#include <IDocumentDrawModelAccess.hxx>
+#include <svx/ShapeTypeHandler.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <pagepreviewlayout.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <dflyobj.hxx>
+#include <prevwpage.hxx>
+#include <switerator.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+using namespace ::sw::access;
+
+struct SwFrmFunc
+{
+ sal_Bool operator()( const SwFrm * p1,
+ const SwFrm * p2) const
+ {
+ return p1 < p2;
+ }
+};
+
+typedef ::std::map < const SwFrm *, uno::WeakReference < XAccessible >, SwFrmFunc > _SwAccessibleContextMap_Impl;
+
+class SwAccessibleContextMap_Impl: public _SwAccessibleContextMap_Impl
+{
+public:
+
+#ifdef DBG_UTIL
+ sal_Bool mbLocked;
+#endif
+
+ SwAccessibleContextMap_Impl()
+#ifdef DBG_UTIL
+ : mbLocked( sal_False )
+#endif
+ {}
+
+};
+
+//------------------------------------------------------------------------------
+class SwDrawModellListener_Impl : public SfxListener,
+ public ::cppu::WeakImplHelper1< document::XEventBroadcaster >
+{
+ mutable ::osl::Mutex maListenerMutex;
+ ::cppu::OInterfaceContainerHelper maEventListeners;
+ SdrModel *mpDrawModel;
+protected:
+ virtual ~SwDrawModellListener_Impl();
+public:
+
+ SwDrawModellListener_Impl( SdrModel *pDrawModel );
+
+
+ virtual void SAL_CALL addEventListener( const uno::Reference< document::XEventListener >& xListener ) throw (uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const uno::Reference< document::XEventListener >& xListener ) throw (uno::RuntimeException);
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ void Dispose();
+};
+
+SwDrawModellListener_Impl::SwDrawModellListener_Impl( SdrModel *pDrawModel ) :
+ maEventListeners( maListenerMutex ),
+ mpDrawModel( pDrawModel )
+{
+ StartListening( *mpDrawModel );
+}
+
+SwDrawModellListener_Impl::~SwDrawModellListener_Impl()
+{
+ EndListening( *mpDrawModel );
+}
+
+void SAL_CALL SwDrawModellListener_Impl::addEventListener( const uno::Reference< document::XEventListener >& xListener ) throw (uno::RuntimeException)
+{
+ maEventListeners.addInterface( xListener );
+}
+
+void SAL_CALL SwDrawModellListener_Impl::removeEventListener( const uno::Reference< document::XEventListener >& xListener ) throw (uno::RuntimeException)
+{
+ maEventListeners.removeInterface( xListener );
+}
+
+void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/,
+ const SfxHint& rHint )
+{
+ // do not broadcast notifications for writer fly frames, because there
+ // are no shapes that need to know about them.
+ // OD 01.07.2003 #110554# - correct condition in order not to broadcast
+ // notifications for writer fly frames.
+ // OD 01.07.2003 #110554# - do not broadcast notifications for plane
+ // <SdrObject>objects
+ const SdrHint *pSdrHint = PTR_CAST( SdrHint, &rHint );
+ if ( !pSdrHint ||
+ ( pSdrHint->GetObject() &&
+ ( pSdrHint->GetObject()->ISA(SwFlyDrawObj) ||
+ pSdrHint->GetObject()->ISA(SwVirtFlyDrawObj) ||
+ IS_TYPE(SdrObject,pSdrHint->GetObject()) ) ) )
+ {
+ return;
+ }
+
+ ASSERT( mpDrawModel, "draw model listener is disposed" );
+ if( !mpDrawModel )
+ return;
+
+ document::EventObject aEvent;
+ if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) )
+ return;
+
+ ::cppu::OInterfaceIteratorHelper aIter( maEventListeners );
+ while( aIter.hasMoreElements() )
+ {
+ uno::Reference < document::XEventListener > xListener( aIter.next(),
+ uno::UNO_QUERY );
+ try
+ {
+ xListener->notifyEvent( aEvent );
+ }
+ catch( uno::RuntimeException const & r )
+ {
+ (void)r;
+#if OSL_DEBUG_LEVEL > 1
+ ByteString aError( "Runtime exception caught while notifying shape.:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ DBG_ERROR( aError.GetBuffer() );
+#endif
+ }
+ }
+}
+
+void SwDrawModellListener_Impl::Dispose()
+{
+ mpDrawModel = 0;
+}
+
+//------------------------------------------------------------------------------
+struct SwShapeFunc
+{
+ sal_Bool operator()( const SdrObject * p1,
+ const SdrObject * p2) const
+ {
+ return p1 < p2;
+ }
+};
+typedef ::std::map < const SdrObject *, uno::WeakReference < XAccessible >, SwShapeFunc > _SwAccessibleShapeMap_Impl;
+typedef ::std::pair < const SdrObject *, ::vos::ORef < ::accessibility::AccessibleShape > > SwAccessibleObjShape_Impl;
+
+class SwAccessibleShapeMap_Impl: public _SwAccessibleShapeMap_Impl
+
+{
+ ::accessibility::AccessibleShapeTreeInfo maInfo;
+
+public:
+
+#ifdef DBG_UTIL
+ sal_Bool mbLocked;
+#endif
+ SwAccessibleShapeMap_Impl( SwAccessibleMap *pMap )
+#ifdef DBG_UTIL
+ : mbLocked( sal_False )
+#endif
+ {
+ maInfo.SetSdrView( pMap->GetShell()->GetDrawView() );
+ maInfo.SetWindow( pMap->GetShell()->GetWin() );
+ maInfo.SetViewForwarder( pMap );
+ // --> OD 2005-08-08 #i52858# - method name changed
+ uno::Reference < document::XEventBroadcaster > xModelBroadcaster =
+ new SwDrawModellListener_Impl(
+ pMap->GetShell()->getIDocumentDrawModelAccess()->GetOrCreateDrawModel() );
+ // <--
+ maInfo.SetControllerBroadcaster( xModelBroadcaster );
+ }
+
+ ~SwAccessibleShapeMap_Impl();
+
+ const ::accessibility::AccessibleShapeTreeInfo& GetInfo() const { return maInfo; }
+
+ SwAccessibleObjShape_Impl *Copy( size_t& rSize,
+ const SwFEShell *pFESh = 0,
+ SwAccessibleObjShape_Impl **pSelShape = 0 ) const;
+};
+
+SwAccessibleShapeMap_Impl::~SwAccessibleShapeMap_Impl()
+{
+ uno::Reference < document::XEventBroadcaster > xBrd( maInfo.GetControllerBroadcaster() );
+ if( xBrd.is() )
+ static_cast < SwDrawModellListener_Impl * >( xBrd.get() )->Dispose();
+}
+
+SwAccessibleObjShape_Impl
+ *SwAccessibleShapeMap_Impl::Copy(
+ size_t& rSize, const SwFEShell *pFESh,
+ SwAccessibleObjShape_Impl **pSelStart ) const
+{
+ SwAccessibleObjShape_Impl *pShapes = 0;
+ SwAccessibleObjShape_Impl *pSelShape = 0;
+
+ sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
+ rSize = size();
+
+ if( rSize > 0 )
+ {
+ pShapes =
+ new SwAccessibleObjShape_Impl[rSize];
+
+ const_iterator aIter = begin();
+ const_iterator aEndIter = end();
+
+ SwAccessibleObjShape_Impl *pShape = pShapes;
+ pSelShape = &(pShapes[rSize]);
+ while( aIter != aEndIter )
+ {
+ const SdrObject *pObj = (*aIter).first;
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if( nSelShapes && pFESh->IsObjSelected( *pObj ) )
+ {
+ // selected objects are inserted from the back
+ --pSelShape;
+ pSelShape->first = pObj;
+ pSelShape->second =
+ static_cast < ::accessibility::AccessibleShape* >(
+ xAcc.get() );
+ --nSelShapes;
+ }
+ else
+ {
+ pShape->first = pObj;
+ pShape->second =
+ static_cast < ::accessibility::AccessibleShape* >(
+ xAcc.get() );
+ ++pShape;
+ }
+ ++aIter;
+ }
+ ASSERT( pSelShape == pShape, "copying shapes went wrong!" );
+ }
+
+ if( pSelStart )
+ *pSelStart = pSelShape;
+
+ return pShapes;
+}
+
+//------------------------------------------------------------------------------
+struct SwAccessibleEvent_Impl
+{
+public:
+ enum EventType { CARET_OR_STATES,
+ INVALID_CONTENT,
+ POS_CHANGED,
+ CHILD_POS_CHANGED,
+ SHAPE_SELECTION,
+ DISPOSE,
+ INVALID_ATTR };
+
+private:
+ SwRect maOldBox; // the old bounds for CHILD_POS_CHANGED
+ // and POS_CHANGED
+ uno::WeakReference < XAccessible > mxAcc; // The object that fires the event
+ SwAccessibleChild maFrmOrObj; // the child for CHILD_POS_CHANGED and
+ // the same as xAcc for any other
+ // event type
+ EventType meType; // The event type
+ // --> OD 2005-12-12 #i27301# - use new type definition for <mnStates>
+ tAccessibleStates mnStates; // check states or update caret pos
+ // <--
+
+ SwAccessibleEvent_Impl& operator==( const SwAccessibleEvent_Impl& );
+
+public:
+ SwAccessibleEvent_Impl( EventType eT,
+ SwAccessibleContext *pA,
+ const SwAccessibleChild& rFrmOrObj )
+ : mxAcc( pA ),
+ maFrmOrObj( rFrmOrObj ),
+ meType( eT ),
+ mnStates( 0 )
+ {}
+
+ SwAccessibleEvent_Impl( EventType eT,
+ const SwAccessibleChild& rFrmOrObj )
+ : maFrmOrObj( rFrmOrObj ),
+ meType( eT ),
+ mnStates( 0 )
+ {
+ ASSERT( SwAccessibleEvent_Impl::DISPOSE == meType,
+ "wrong event constructor, DISPOSE only" );
+ }
+
+ SwAccessibleEvent_Impl( EventType eT )
+ : meType( eT ),
+ mnStates( 0 )
+ {
+ ASSERT( SwAccessibleEvent_Impl::SHAPE_SELECTION == meType,
+ "wrong event constructor, SHAPE_SELECTION only" );
+ }
+
+ SwAccessibleEvent_Impl( EventType eT,
+ SwAccessibleContext *pA,
+ const SwAccessibleChild& rFrmOrObj,
+ const SwRect& rR )
+ : maOldBox( rR ),
+ mxAcc( pA ),
+ maFrmOrObj( rFrmOrObj ),
+ meType( eT ),
+ mnStates( 0 )
+ {
+ ASSERT( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType ||
+ SwAccessibleEvent_Impl::POS_CHANGED == meType,
+ "wrong event constructor, (CHILD_)POS_CHANGED only" );
+ }
+
+ // --> OD 2005-12-12 #i27301# - use new type definition for parameter <_nStates>
+ SwAccessibleEvent_Impl( EventType eT,
+ SwAccessibleContext *pA,
+ const SwAccessibleChild& rFrmOrObj,
+ const tAccessibleStates _nStates )
+ : mxAcc( pA ),
+ maFrmOrObj( rFrmOrObj ),
+ meType( eT ),
+ mnStates( _nStates )
+ {
+ ASSERT( SwAccessibleEvent_Impl::CARET_OR_STATES == meType,
+ "wrong event constructor, CARET_OR_STATES only" );
+ }
+
+ // <SetType(..)> only used in method <SwAccessibleMap::AppendEvent(..)>
+ inline void SetType( EventType eT )
+ {
+ meType = eT;
+ }
+ inline EventType GetType() const
+ {
+ return meType;
+ }
+
+ inline ::vos::ORef < SwAccessibleContext > GetContext() const
+ {
+ uno::Reference < XAccessible > xTmp( mxAcc );
+ ::vos::ORef < SwAccessibleContext > xAccImpl(
+ static_cast<SwAccessibleContext*>( xTmp.get() ) );
+
+ return xAccImpl;
+ }
+
+ inline const SwRect& GetOldBox() const
+ {
+ return maOldBox;
+ }
+ // <SetOldBox(..)> only used in method <SwAccessibleMap::AppendEvent(..)>
+ inline void SetOldBox( const SwRect& rOldBox )
+ {
+ maOldBox = rOldBox;
+ }
+
+ inline const SwAccessibleChild& GetFrmOrObj() const
+ {
+ return maFrmOrObj;
+ }
+
+ // <SetStates(..)> only used in method <SwAccessibleMap::AppendEvent(..)>
+ // --> OD 2005-12-12 #i27301# - use new type definition for parameter <_nStates>
+ inline void SetStates( tAccessibleStates _nStates )
+ {
+ mnStates |= _nStates;
+ }
+ // <--
+
+ inline sal_Bool IsUpdateCursorPos() const
+ {
+ return (mnStates & ACC_STATE_CARET) != 0;
+ }
+ inline sal_Bool IsInvalidateStates() const
+ {
+ return (mnStates & ACC_STATE_MASK) != 0;
+ }
+ inline sal_Bool IsInvalidateRelation() const
+ {
+ return (mnStates & ACC_STATE_RELATION_MASK) != 0;
+ }
+ // --> OD 2005-12-12 #i27301# - new event TEXT_SELECTION_CHANGED
+ inline sal_Bool IsInvalidateTextSelection() const
+ {
+ return ( mnStates & ACC_STATE_TEXT_SELECTION_CHANGED ) != 0;
+ }
+ // <--
+ // --> OD 2009-01-07 #i88069# - new event TEXT_ATTRIBUTE_CHANGED
+ inline sal_Bool IsInvalidateTextAttrs() const
+ {
+ return ( mnStates & ACC_STATE_TEXT_ATTRIBUTE_CHANGED ) != 0;
+ }
+ // <--
+ // --> OD 2005-12-12 #i27301# - use new type definition <tAccessibleStates>
+ // for return value
+ inline tAccessibleStates GetStates() const
+ {
+ return mnStates & ACC_STATE_MASK;
+ }
+ // <--
+ // --> OD 2005-12-12 #i27301# - use new type definition <tAccessibleStates>
+ // for return value
+ inline tAccessibleStates GetAllStates() const
+ {
+ return mnStates;
+ }
+ // <--
+};
+
+//------------------------------------------------------------------------------
+typedef ::std::list < SwAccessibleEvent_Impl > _SwAccessibleEventList_Impl;
+
+class SwAccessibleEventList_Impl: public _SwAccessibleEventList_Impl
+{
+ sal_Bool mbFiring;
+
+public:
+
+ SwAccessibleEventList_Impl()
+ : mbFiring( sal_False )
+ {}
+
+ inline void SetFiring()
+ {
+ mbFiring = sal_True;
+ }
+ inline sal_Bool IsFiring() const
+ {
+ return mbFiring;
+ }
+};
+
+//------------------------------------------------------------------------------
+// The shape list is filled if an accessible shape is destroyed. It
+// simply keeps a reference to the accessible shape's XShape. These
+// references are destroyed within the EndAction when firing events,
+// There are twp reason for this. First of all, a new accessible shape
+// for the XShape might be created soon. It's then cheaper if the XShape
+// still exists. The other reason are situations where an accessible shape
+// is destroyed within an SwFrmFmt::Modify. In this case, destryoing
+// the XShape at the same time (indirectly by destroying the accessible
+// shape) leads to an assert, because a client of the Modify is destroyed
+// within a Modify call.
+
+typedef ::std::list < uno::Reference < drawing::XShape > > _SwShapeList_Impl;
+
+class SwShapeList_Impl: public _SwShapeList_Impl
+{
+public:
+
+ SwShapeList_Impl() {}
+};
+
+
+//------------------------------------------------------------------------------
+struct SwAccessibleChildFunc
+{
+ sal_Bool operator()( const SwAccessibleChild& r1,
+ const SwAccessibleChild& r2 ) const
+ {
+ const void *p1 = r1.GetSwFrm()
+ ? static_cast < const void * >( r1.GetSwFrm())
+ : ( r1.GetDrawObject()
+ ? static_cast < const void * >( r1.GetDrawObject() )
+ : static_cast < const void * >( r1.GetWindow() ) );
+ const void *p2 = r2.GetSwFrm()
+ ? static_cast < const void * >( r2.GetSwFrm())
+ : ( r2.GetDrawObject()
+ ? static_cast < const void * >( r2.GetDrawObject() )
+ : static_cast < const void * >( r2.GetWindow() ) );
+ return p1 < p2;
+ }
+};
+typedef ::std::map < SwAccessibleChild, SwAccessibleEventList_Impl::iterator,
+ SwAccessibleChildFunc > _SwAccessibleEventMap_Impl;
+
+class SwAccessibleEventMap_Impl: public _SwAccessibleEventMap_Impl
+{
+};
+
+//------------------------------------------------------------------------------
+// --> OD 2005-12-13 #i27301# - map containing the accessible paragraph, which
+// have a selection. Needed to keep this information to submit corresponding
+// TEXT_SELECTION_CHANGED events.
+struct SwAccessibleParaSelection
+{
+ xub_StrLen nStartOfSelection;
+ xub_StrLen nEndOfSelection;
+
+ SwAccessibleParaSelection( const xub_StrLen _nStartOfSelection,
+ const xub_StrLen _nEndOfSelection )
+ : nStartOfSelection( _nStartOfSelection ),
+ nEndOfSelection( _nEndOfSelection )
+ {}
+};
+
+struct SwXAccWeakRefComp
+{
+ sal_Bool operator()( const uno::WeakReference<XAccessible>& _rXAccWeakRef1,
+ const uno::WeakReference<XAccessible>& _rXAccWeakRef2 ) const
+ {
+ return _rXAccWeakRef1.get() < _rXAccWeakRef2.get();
+ }
+};
+
+typedef ::std::map< uno::WeakReference < XAccessible >,
+ SwAccessibleParaSelection,
+ SwXAccWeakRefComp > _SwAccessibleSelectedParas_Impl;
+
+class SwAccessibleSelectedParas_Impl: public _SwAccessibleSelectedParas_Impl
+{};
+// <--
+
+// helper class that stores preview data
+class SwAccPreviewData
+{
+ typedef std::vector<Rectangle> Rectangles;
+ Rectangles maPreviewRects;
+ Rectangles maLogicRects;
+
+ SwRect maVisArea;
+ Fraction maScale;
+
+ const SwPageFrm *mpSelPage;
+
+ /** adjust logic page retangle to its visible part
+
+ OD 17.01.2003 #103492#
+
+ @author OD
+
+ @param _iorLogicPgSwRect
+ input/output parameter - reference to the logic page rectangle, which
+ has to be adjusted.
+
+ @param _rPrevwPgSwRect
+ input parameter - constant reference to the corresponding preview page
+ rectangle; needed to determine the visible part of the logic page rectangle.
+
+ @param _rPrevwWinSize
+ input paramter - constant reference to the preview window size in TWIP;
+ needed to determine the visible part of the logic page rectangle
+ */
+ void AdjustLogicPgRectToVisibleArea( SwRect& _iorLogicPgSwRect,
+ const SwRect& _rPrevwPgSwRect,
+ const Size& _rPrevwWinSize );
+
+public:
+ SwAccPreviewData();
+ ~SwAccPreviewData();
+
+ // OD 14.01.2003 #103492# - complete re-factoring of method due to new
+ // page/print preview functionality.
+ void Update( const SwAccessibleMap& rAccMap,
+ const std::vector<PrevwPage*>& _rPrevwPages,
+ const Fraction& _rScale,
+ const SwPageFrm* _pSelectedPageFrm,
+ const Size& _rPrevwWinSize );
+
+ // OD 14.01.2003 #103492# - complete re-factoring of method due to new
+ // page/print preview functionality.
+ void InvalidateSelection( const SwPageFrm* _pSelectedPageFrm );
+
+ const SwRect& GetVisArea() const;
+
+ MapMode GetMapModeForPreview( ) const;
+
+ /** Adjust the MapMode so that the preview page appears at the
+ * proper position. rPoint identifies the page for which the
+ * MapMode should be adjusted. If bFromPreview is true, rPoint is
+ * a preview coordinate; else it's a document coordinate. */
+ // OD 17.01.2003 #103492# - delete unused 3rd parameter.
+ void AdjustMapMode( MapMode& rMapMode,
+ const Point& rPoint ) const;
+
+ inline const SwPageFrm *GetSelPage() const { return mpSelPage; }
+
+ void DisposePage(const SwPageFrm *pPageFrm );
+};
+
+SwAccPreviewData::SwAccPreviewData() :
+ mpSelPage( 0 )
+{
+}
+
+SwAccPreviewData::~SwAccPreviewData()
+{
+}
+
+// OD 13.01.2003 #103492# - complete re-factoring of method due to new page/print
+// preview functionality.
+void SwAccPreviewData::Update( const SwAccessibleMap& rAccMap,
+ const std::vector<PrevwPage*>& _rPrevwPages,
+ const Fraction& _rScale,
+ const SwPageFrm* _pSelectedPageFrm,
+ const Size& _rPrevwWinSize )
+{
+ // store preview scaling, maximal preview page size and selected page
+ maScale = _rScale;
+ mpSelPage = _pSelectedPageFrm;
+
+ // prepare loop on preview pages
+ maPreviewRects.clear();
+ maLogicRects.clear();
+ SwAccessibleChild aPage;
+ maVisArea.Clear();
+
+ // loop on preview pages to calculate <maPreviewRects>, <maLogicRects> and
+ // <maVisArea>
+ for ( std::vector<PrevwPage*>::const_iterator aPageIter = _rPrevwPages.begin();
+ aPageIter != _rPrevwPages.end();
+ ++aPageIter )
+ {
+ aPage = (*aPageIter)->pPage;
+
+ // add preview page rectangle to <maPreviewRects>
+ Rectangle aPrevwPgRect( (*aPageIter)->aPrevwWinPos, (*aPageIter)->aPageSize );
+ maPreviewRects.push_back( aPrevwPgRect );
+
+ // add logic page rectangle to <maLogicRects>
+ SwRect aLogicPgSwRect( aPage.GetBox( rAccMap ) );
+ Rectangle aLogicPgRect( aLogicPgSwRect.SVRect() );
+ maLogicRects.push_back( aLogicPgRect );
+ // union visible area with visible part of logic page rectangle
+ if ( (*aPageIter)->bVisible )
+ {
+ if ( !(*aPageIter)->pPage->IsEmptyPage() )
+ {
+ AdjustLogicPgRectToVisibleArea( aLogicPgSwRect,
+ SwRect( aPrevwPgRect ),
+ _rPrevwWinSize );
+ }
+ if ( maVisArea.IsEmpty() )
+ maVisArea = aLogicPgSwRect;
+ else
+ maVisArea.Union( aLogicPgSwRect );
+ }
+ }
+}
+
+// OD 16.01.2003 #103492# - complete re-factoring of method due to new page/print
+// preview functionality.
+void SwAccPreviewData::InvalidateSelection( const SwPageFrm* _pSelectedPageFrm )
+{
+ mpSelPage = _pSelectedPageFrm;
+ ASSERT( mpSelPage, "selected page not found" );
+}
+
+struct ContainsPredicate
+{
+ const Point& mrPoint;
+ ContainsPredicate( const Point& rPoint ) : mrPoint(rPoint) {}
+ bool operator() ( const Rectangle& rRect ) const
+ {
+ return rRect.IsInside( mrPoint ) ? true : false;
+ }
+};
+
+const SwRect& SwAccPreviewData::GetVisArea() const
+{
+ return maVisArea;
+}
+
+void SwAccPreviewData::AdjustMapMode( MapMode& rMapMode,
+ const Point& rPoint ) const
+{
+ // adjust scale
+ rMapMode.SetScaleX( maScale );
+ rMapMode.SetScaleY( maScale );
+
+ // find proper rectangle
+ Rectangles::const_iterator aBegin = maLogicRects.begin();
+ Rectangles::const_iterator aEnd = maLogicRects.end();
+ Rectangles::const_iterator aFound = ::std::find_if( aBegin, aEnd,
+ ContainsPredicate( rPoint ) );
+
+ if( aFound != aEnd )
+ {
+ // found! set new origin
+ Point aPoint = (maPreviewRects.begin() + (aFound - aBegin))->TopLeft();
+ aPoint -= (maLogicRects.begin() + (aFound-aBegin))->TopLeft();
+ rMapMode.SetOrigin( aPoint );
+ }
+ // else: don't adjust MapMode
+}
+
+void SwAccPreviewData::DisposePage(const SwPageFrm *pPageFrm )
+{
+ if( mpSelPage == pPageFrm )
+ mpSelPage = 0;
+}
+
+/** adjust logic page retangle to its visible part
+
+ OD 17.01.2003 #103492#
+
+ @author OD
+*/
+void SwAccPreviewData::AdjustLogicPgRectToVisibleArea(
+ SwRect& _iorLogicPgSwRect,
+ const SwRect& _rPrevwPgSwRect,
+ const Size& _rPrevwWinSize )
+{
+ // determine preview window rectangle
+ const SwRect aPrevwWinSwRect( Point( 0, 0 ), _rPrevwWinSize );
+ // calculate visible preview page rectangle
+ SwRect aVisPrevwPgSwRect( _rPrevwPgSwRect );
+ aVisPrevwPgSwRect.Intersection( aPrevwWinSwRect );
+ // adjust logic page rectangle
+ SwTwips nTmpDiff;
+ // left
+ nTmpDiff = aVisPrevwPgSwRect.Left() - _rPrevwPgSwRect.Left();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Left( _iorLogicPgSwRect.Left() + nTmpDiff );
+ // top
+ nTmpDiff = aVisPrevwPgSwRect.Top() - _rPrevwPgSwRect.Top();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Top( _iorLogicPgSwRect.Top() + nTmpDiff );
+ // right
+ nTmpDiff = _rPrevwPgSwRect.Right() - aVisPrevwPgSwRect.Right();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Right( _iorLogicPgSwRect.Right() - nTmpDiff );
+ // bottom
+ nTmpDiff = _rPrevwPgSwRect.Bottom() - aVisPrevwPgSwRect.Bottom();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Bottom( _iorLogicPgSwRect.Bottom() - nTmpDiff );
+}
+
+//------------------------------------------------------------------------------
+static sal_Bool AreInSameTable( const uno::Reference< XAccessible >& rAcc,
+ const SwFrm *pFrm )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pFrm && pFrm->IsCellFrm() && rAcc.is() )
+ {
+ // Is it in the same table? We check that
+ // by comparing the last table frame in the
+ // follow chain, because that's cheaper than
+ // searching the first one.
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( rAcc.get() );
+ if( pAccImpl->GetFrm()->IsCellFrm() )
+ {
+ const SwTabFrm *pTabFrm1 = pAccImpl->GetFrm()->FindTabFrm();
+ while( pTabFrm1->GetFollow() )
+ pTabFrm1 = pTabFrm1->GetFollow();
+
+ const SwTabFrm *pTabFrm2 = pFrm->FindTabFrm();
+ while( pTabFrm2->GetFollow() )
+ pTabFrm2 = pTabFrm2->GetFollow();
+
+ bRet = (pTabFrm1 == pTabFrm2);
+ }
+ }
+
+ return bRet;
+}
+
+void SwAccessibleMap::FireEvent( const SwAccessibleEvent_Impl& rEvent )
+{
+ ::vos::ORef < SwAccessibleContext > xAccImpl( rEvent.GetContext() );
+ if( SwAccessibleEvent_Impl::SHAPE_SELECTION == rEvent.GetType() )
+ {
+ DoInvalidateShapeSelection();
+ }
+ else if( xAccImpl.isValid() && xAccImpl->GetFrm() )
+ {
+ // --> OD 2009-01-07 #i88069#
+ if ( rEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE &&
+ rEvent.IsInvalidateTextAttrs() )
+ {
+ xAccImpl->InvalidateAttr();
+ }
+ // <--
+ switch( rEvent.GetType() )
+ {
+ case SwAccessibleEvent_Impl::INVALID_CONTENT:
+ xAccImpl->InvalidateContent();
+ break;
+ case SwAccessibleEvent_Impl::POS_CHANGED:
+ xAccImpl->InvalidatePosOrSize( rEvent.GetOldBox() );
+ break;
+ case SwAccessibleEvent_Impl::CHILD_POS_CHANGED:
+ xAccImpl->InvalidateChildPosOrSize( rEvent.GetFrmOrObj(),
+ rEvent.GetOldBox() );
+ break;
+ case SwAccessibleEvent_Impl::DISPOSE:
+ ASSERT( xAccImpl.isValid(),
+ "dispose event has been stored" );
+ break;
+ // --> OD 2009-01-06 #i88069#
+ case SwAccessibleEvent_Impl::INVALID_ATTR:
+ // nothing to do here - handled above
+ break;
+ // <--
+ default:
+ break;
+ }
+ if( SwAccessibleEvent_Impl::DISPOSE != rEvent.GetType() )
+ {
+ if( rEvent.IsUpdateCursorPos() )
+ xAccImpl->InvalidateCursorPos();
+ if( rEvent.IsInvalidateStates() )
+ xAccImpl->InvalidateStates( rEvent.GetStates() );
+ if( rEvent.IsInvalidateRelation() )
+ {
+ // --> OD 2005-12-01 #i27138#
+ // both events CONTENT_FLOWS_FROM_RELATION_CHANGED and
+ // CONTENT_FLOWS_TO_RELATION_CHANGED are possible
+ if ( rEvent.GetAllStates() & ACC_STATE_RELATION_FROM )
+ {
+ xAccImpl->InvalidateRelation(
+ AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED );
+ }
+ if ( rEvent.GetAllStates() & ACC_STATE_RELATION_TO )
+ {
+ xAccImpl->InvalidateRelation(
+ AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED );
+ }
+ // <--
+ }
+ // --> OD 2005-12-12 #i27301# - submit event TEXT_SELECTION_CHANGED
+ if ( rEvent.IsInvalidateTextSelection() )
+ {
+ xAccImpl->InvalidateTextSelection();
+ }
+ // <--
+ }
+ }
+}
+
+void SwAccessibleMap::AppendEvent( const SwAccessibleEvent_Impl& rEvent )
+{
+ vos::OGuard aGuard( maEventMutex );
+
+ if( !mpEvents )
+ mpEvents = new SwAccessibleEventList_Impl;
+ if( !mpEventMap )
+ mpEventMap = new SwAccessibleEventMap_Impl;
+
+ if( mpEvents->IsFiring() )
+ {
+ // While events are fired new ones are generated. They have to be fired
+ // now. This does not work for DISPOSE events!
+ ASSERT( rEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE,
+ "dispose event while firing events" );
+ FireEvent( rEvent );
+ }
+ else
+ {
+
+ SwAccessibleEventMap_Impl::iterator aIter =
+ mpEventMap->find( rEvent.GetFrmOrObj() );
+ if( aIter != mpEventMap->end() )
+ {
+ SwAccessibleEvent_Impl aEvent( *(*aIter).second );
+ ASSERT( aEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE,
+ "dispose events should not be stored" );
+ sal_Bool bAppendEvent = sal_True;
+ switch( rEvent.GetType() )
+ {
+ case SwAccessibleEvent_Impl::CARET_OR_STATES:
+ // A CARET_OR_STATES event is added to any other
+ // event only. It is broadcasted after any other event, so the
+ // event should be put to the back.
+ ASSERT( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
+ "invalid event combination" );
+ aEvent.SetStates( rEvent.GetAllStates() );
+ break;
+ case SwAccessibleEvent_Impl::INVALID_CONTENT:
+ // An INVALID_CONTENT event overwrites a CARET_OR_STATES
+ // event (but keeps its flags) and it is contained in a
+ // POS_CHANGED event.
+ // Therefor, the event's type has to be adapted and the event
+ // has to be put at the end.
+ ASSERT( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
+ "invalid event combination" );
+ if( aEvent.GetType() == SwAccessibleEvent_Impl::CARET_OR_STATES )
+ aEvent.SetType( SwAccessibleEvent_Impl::INVALID_CONTENT );
+ break;
+ case SwAccessibleEvent_Impl::POS_CHANGED:
+ // A pos changed event overwrites CARET_STATES (keeping its
+ // flags) as well as INVALID_CONTENT. The old box position
+ // has to be stored however if the old event is not a
+ // POS_CHANGED itself.
+ ASSERT( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
+ "invalid event combination" );
+ if( aEvent.GetType() != SwAccessibleEvent_Impl::POS_CHANGED )
+ aEvent.SetOldBox( rEvent.GetOldBox() );
+ aEvent.SetType( SwAccessibleEvent_Impl::POS_CHANGED );
+ break;
+ case SwAccessibleEvent_Impl::CHILD_POS_CHANGED:
+ // CHILD_POS_CHANGED events can only follow CHILD_POS_CHANGED
+ // events. The only action that needs to be done again is
+ // to put the old event to the back. The new one cannot be used,
+ // because we are interested in the old frame bounds.
+ ASSERT( aEvent.GetType() == SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
+ "invalid event combination" );
+ break;
+ case SwAccessibleEvent_Impl::SHAPE_SELECTION:
+ ASSERT( aEvent.GetType() == SwAccessibleEvent_Impl::SHAPE_SELECTION,
+ "invalid event combination" );
+ break;
+ case SwAccessibleEvent_Impl::DISPOSE:
+ // DISPOSE events overwrite all others. They are not stored
+ // but executed immediatly to avoid broadcasting of
+ // defunctional objects. So what needs to be done here is to
+ // remove all events for the frame in question.
+ bAppendEvent = sal_False;
+ break;
+ // --> OD 2009-01-06 #i88069#
+ case SwAccessibleEvent_Impl::INVALID_ATTR:
+ ASSERT( aEvent.GetType() == SwAccessibleEvent_Impl::INVALID_ATTR,
+ "invalid event combination" );
+ break;
+ // <--
+ }
+ if( bAppendEvent )
+ {
+ mpEvents->erase( (*aIter).second );
+ (*aIter).second = mpEvents->insert( mpEvents->end(), aEvent );
+ }
+ else
+ {
+ mpEvents->erase( (*aIter).second );
+ mpEventMap->erase( aIter );
+ }
+ }
+ else if( SwAccessibleEvent_Impl::DISPOSE != rEvent.GetType() )
+ {
+ SwAccessibleEventMap_Impl::value_type aEntry( rEvent.GetFrmOrObj(),
+ mpEvents->insert( mpEvents->end(), rEvent ) );
+ mpEventMap->insert( aEntry );
+ }
+ }
+}
+
+void SwAccessibleMap::InvalidateCursorPosition(
+ const uno::Reference< XAccessible >& rAcc )
+{
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( rAcc.get() );
+ ASSERT( pAccImpl, "no caret context" );
+ ASSERT( pAccImpl->GetFrm(), "caret context is disposed" );
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
+ pAccImpl,
+ SwAccessibleChild(pAccImpl->GetFrm()),
+ ACC_STATE_CARET );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ FireEvents();
+ // While firing events the current frame might have
+ // been disposed because it moved out of the vis area.
+ // Setting the cursor for such frames is useless and even
+ // causes asserts.
+ if( pAccImpl->GetFrm() )
+ pAccImpl->InvalidateCursorPos();
+ }
+}
+
+void SwAccessibleMap::InvalidateShapeSelection()
+{
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent(
+ SwAccessibleEvent_Impl::SHAPE_SELECTION );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ FireEvents();
+ DoInvalidateShapeSelection();
+ }
+}
+
+void SwAccessibleMap::DoInvalidateShapeSelection()
+{
+ SwAccessibleObjShape_Impl *pShapes = 0;
+ SwAccessibleObjShape_Impl *pSelShape = 0;
+ size_t nShapes = 0;
+
+ const ViewShell *pVSh = GetShell();
+ const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ?
+ static_cast< const SwFEShell * >( pVSh ) : 0;
+ sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
+
+ {
+ vos::OGuard aGuard( maMutex );
+ if( mpShapeMap )
+ pShapes = mpShapeMap->Copy( nShapes, pFESh, &pSelShape );
+ }
+
+ if( pShapes )
+ {
+ ::std::list< const SwFrm * > aParents;
+ Window *pWin = GetShell()->GetWin();
+ sal_Bool bFocused = pWin && pWin->HasFocus();
+ SwAccessibleObjShape_Impl *pShape = pShapes;
+ while( nShapes )
+ {
+ if( pShape->second.isValid() )
+ {
+ sal_Bool bChanged;
+ if( pShape >= pSelShape )
+ {
+ bChanged =
+ pShape->second->SetState( AccessibleStateType::SELECTED );
+ if( bFocused && 1 == nSelShapes )
+ pShape->second->SetState( AccessibleStateType::FOCUSED );
+ else
+ pShape->second->ResetState( AccessibleStateType::FOCUSED );
+ }
+ else
+ {
+ bChanged =
+ pShape->second->ResetState( AccessibleStateType::SELECTED );
+ pShape->second->ResetState( AccessibleStateType::FOCUSED );
+ }
+ if( bChanged )
+ {
+ const SwFrm* pParent = SwAccessibleFrame::GetParent(
+ SwAccessibleChild( pShape->first ),
+ GetShell()->IsPreView() );
+ aParents.push_back( pParent );
+ }
+ }
+
+ --nShapes;
+ ++pShape;
+ }
+ if( aParents.size() > 0 )
+ {
+ ::std::list< const SwFrm * >::const_iterator aIter = aParents.begin();
+ ::std::list< const SwFrm * >::const_iterator aEndIter = aParents.end();
+ while( aIter != aEndIter )
+ {
+ ::vos::ORef< SwAccessibleContext > xParentAccImpl;
+ {
+ vos::OGuard aGuard( maMutex );
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::const_iterator aMapIter =
+ mpFrmMap->find( *aIter );
+ if( aMapIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc( (*aMapIter).second );
+ xParentAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ }
+ }
+ }
+ if( xParentAccImpl.isValid() )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+ xParentAccImpl->FireAccessibleEvent( aEvent );
+ }
+
+ ++aIter;
+ }
+ }
+
+ delete[] pShapes;
+ }
+}
+
+void SwAccessibleMap::DoInvalidateShapeFocus()
+{
+ const ViewShell *pVSh = GetShell();
+ const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ?
+ static_cast< const SwFEShell * >( pVSh ) : 0;
+ sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
+
+ if( nSelShapes != 1 )
+ return;
+
+ SwAccessibleObjShape_Impl *pShapes = 0;
+ SwAccessibleObjShape_Impl *pSelShape = 0;
+ size_t nShapes = 0;
+
+
+ {
+ vos::OGuard aGuard( maMutex );
+ if( mpShapeMap )
+ pShapes = mpShapeMap->Copy( nShapes, pFESh, &pSelShape );
+ }
+
+ if( pShapes )
+ {
+ Window *pWin = GetShell()->GetWin();
+ sal_Bool bFocused = pWin && pWin->HasFocus();
+ SwAccessibleObjShape_Impl *pShape = pShapes;
+ while( nShapes )
+ {
+ if( pShape->second.isValid() )
+ {
+ if( bFocused && pShape >= pSelShape )
+ pShape->second->SetState( AccessibleStateType::FOCUSED );
+ else
+ pShape->second->ResetState( AccessibleStateType::FOCUSED );
+ }
+
+ --nShapes;
+ ++pShape;
+ }
+
+ delete[] pShapes;
+ }
+}
+
+
+SwAccessibleMap::SwAccessibleMap( ViewShell *pSh ) :
+ mpFrmMap( 0 ),
+ mpShapeMap( 0 ),
+ mpShapes( 0 ),
+ mpEvents( 0 ),
+ mpEventMap( 0 ),
+ // --> OD 2005-12-13 #i27301#
+ mpSelectedParas( 0 ),
+ // <--
+ mpVSh( pSh ),
+ mpPreview( 0 ),
+ mnPara( 1 ),
+ mnFootnote( 1 ),
+ mnEndnote( 1 ),
+ mbShapeSelected( sal_False )
+{
+ pSh->GetLayout()->AddAccessibleShell();
+}
+
+SwAccessibleMap::~SwAccessibleMap()
+{
+ uno::Reference < XAccessible > xAcc;
+ {
+ vos::OGuard aGuard( maMutex );
+ if( mpFrmMap )
+ {
+ const SwRootFrm *pRootFrm = GetShell()->GetLayout();
+ SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->find( pRootFrm );
+ if( aIter != mpFrmMap->end() )
+ xAcc = (*aIter).second;
+ if( !xAcc.is() )
+ xAcc = new SwAccessibleDocument( this );
+ }
+ }
+
+ SwAccessibleDocument *pAcc =
+ static_cast< SwAccessibleDocument * >( xAcc.get() );
+ pAcc->Dispose( sal_True );
+
+ {
+ vos::OGuard aGuard( maMutex );
+#ifdef DBG_UTIL
+ ASSERT( !mpFrmMap || mpFrmMap->empty(),
+ "Frame map should be empty after disposing the root frame" );
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->begin();
+ while( aIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xTmp = (*aIter).second;
+ if( xTmp.is() )
+ {
+ SwAccessibleContext *pTmp =
+ static_cast< SwAccessibleContext * >( xTmp.get() );
+ (void) pTmp;
+ }
+ ++aIter;
+ }
+ }
+ ASSERT( !mpShapeMap || mpShapeMap->empty(),
+ "Object map should be empty after disposing the root frame" );
+ if( mpShapeMap )
+ {
+ SwAccessibleShapeMap_Impl::iterator aIter = mpShapeMap->begin();
+ while( aIter != mpShapeMap->end() )
+ {
+ uno::Reference < XAccessible > xTmp = (*aIter).second;
+ if( xTmp.is() )
+ {
+ ::accessibility::AccessibleShape *pTmp =
+ static_cast< ::accessibility::AccessibleShape* >( xTmp.get() );
+ (void) pTmp;
+ }
+ ++aIter;
+ }
+ }
+#endif
+ delete mpFrmMap;
+ mpFrmMap = 0;
+ delete mpShapeMap;
+ mpShapeMap = 0;
+ delete mpShapes;
+ mpShapes = 0;
+ // --> OD 2005-12-13 #i27301#
+ delete mpSelectedParas;
+ mpSelectedParas = 0;
+ // <--
+ }
+
+ delete mpPreview;
+ mpPreview = NULL;
+
+ {
+ vos::OGuard aGuard( maEventMutex );
+#ifdef DBG_UTIL
+ ASSERT( !(mpEvents || mpEventMap), "pending events" );
+ if( mpEvents )
+ {
+ SwAccessibleEventList_Impl::iterator aIter = mpEvents->begin();
+ while( aIter != mpEvents->end() )
+ {
+ ++aIter;
+ }
+ }
+ if( mpEventMap )
+ {
+ SwAccessibleEventMap_Impl::iterator aIter = mpEventMap->begin();
+ while( aIter != mpEventMap->end() )
+ {
+ ++aIter;
+ }
+ }
+#endif
+ delete mpEventMap;
+ mpEventMap = 0;
+ delete mpEvents;
+ mpEvents = 0;
+ }
+ mpVSh->GetLayout()->RemoveAccessibleShell();
+}
+
+uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView(
+ sal_Bool bPagePreview )
+{
+ uno::Reference < XAccessible > xAcc;
+ sal_Bool bSetVisArea = sal_False;
+
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( !mpFrmMap )
+ {
+ mpFrmMap = new SwAccessibleContextMap_Impl;
+#ifdef DBG_UTIL
+ mpFrmMap->mbLocked = sal_False;
+#endif
+ }
+
+#ifdef DBG_UTIL
+ ASSERT( !mpFrmMap->mbLocked, "Map is locked" );
+ mpFrmMap->mbLocked = sal_True;
+#endif
+
+ const SwRootFrm *pRootFrm = GetShell()->GetLayout();
+ SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->find( pRootFrm );
+ if( aIter != mpFrmMap->end() )
+ xAcc = (*aIter).second;
+ if( xAcc.is() )
+ {
+ bSetVisArea = sal_True; // Set VisArea when map mutex is not
+ // locked
+ }
+ else
+ {
+ if( bPagePreview )
+ xAcc = new SwAccessiblePreview( this );
+ else
+ xAcc = new SwAccessibleDocument( this );
+
+ if( aIter != mpFrmMap->end() )
+ {
+ (*aIter).second = xAcc;
+ }
+ else
+ {
+ SwAccessibleContextMap_Impl::value_type aEntry( pRootFrm, xAcc );
+ mpFrmMap->insert( aEntry );
+ }
+ }
+
+#ifdef DBG_UTIL
+ mpFrmMap->mbLocked = sal_False;
+#endif
+ }
+
+ if( bSetVisArea )
+ {
+ SwAccessibleDocumentBase *pAcc =
+ static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
+ pAcc->SetVisArea();
+ }
+
+ return xAcc;
+}
+
+uno::Reference< XAccessible > SwAccessibleMap::GetDocumentView( )
+{
+ return _GetDocumentView( sal_False );
+}
+
+// OD 14.01.2003 #103492# - complete re-factoring of method due to new page/print
+// preview functionality.
+uno::Reference<XAccessible> SwAccessibleMap::GetDocumentPreview(
+ const std::vector<PrevwPage*>& _rPrevwPages,
+ const Fraction& _rScale,
+ const SwPageFrm* _pSelectedPageFrm,
+ const Size& _rPrevwWinSize )
+{
+ // create & update preview data object
+ if( mpPreview == NULL )
+ mpPreview = new SwAccPreviewData();
+ mpPreview->Update( *this, _rPrevwPages, _rScale, _pSelectedPageFrm, _rPrevwWinSize );
+
+ uno::Reference<XAccessible> xAcc = _GetDocumentView( sal_True );
+ return xAcc;
+}
+
+uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrm *pFrm,
+ sal_Bool bCreate )
+{
+ uno::Reference < XAccessible > xAcc;
+ uno::Reference < XAccessible > xOldCursorAcc;
+ sal_Bool bOldShapeSelected = sal_False;
+
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( !mpFrmMap && bCreate )
+ mpFrmMap = new SwAccessibleContextMap_Impl;
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->find( pFrm );
+ if( aIter != mpFrmMap->end() )
+ xAcc = (*aIter).second;
+
+ if( !xAcc.is() && bCreate )
+ {
+ SwAccessibleContext *pAcc = 0;
+ switch( pFrm->GetType() )
+ {
+ case FRM_TXT:
+ mnPara++;
+ pAcc = new SwAccessibleParagraph( *this,
+ static_cast< const SwTxtFrm& >( *pFrm ) );
+ break;
+ case FRM_HEADER:
+ pAcc = new SwAccessibleHeaderFooter( this,
+ static_cast< const SwHeaderFrm *>( pFrm ) );
+ break;
+ case FRM_FOOTER:
+ pAcc = new SwAccessibleHeaderFooter( this,
+ static_cast< const SwFooterFrm *>( pFrm ) );
+ break;
+ case FRM_FTN:
+ {
+ const SwFtnFrm *pFtnFrm =
+ static_cast < const SwFtnFrm * >( pFrm );
+ sal_Bool bIsEndnote =
+ SwAccessibleFootnote::IsEndnote( pFtnFrm );
+ pAcc = new SwAccessibleFootnote( this, bIsEndnote,
+ (bIsEndnote ? mnEndnote++ : mnFootnote++),
+ pFtnFrm );
+ }
+ break;
+ case FRM_FLY:
+ {
+ const SwFlyFrm *pFlyFrm =
+ static_cast < const SwFlyFrm * >( pFrm );
+ switch( SwAccessibleFrameBase::GetNodeType( pFlyFrm ) )
+ {
+ case ND_GRFNODE:
+ pAcc = new SwAccessibleGraphic( this, pFlyFrm );
+ break;
+ case ND_OLENODE:
+ pAcc = new SwAccessibleEmbeddedObject( this, pFlyFrm );
+ break;
+ default:
+ pAcc = new SwAccessibleTextFrame( this, pFlyFrm );
+ break;
+ }
+ }
+ break;
+ case FRM_CELL:
+ pAcc = new SwAccessibleCell( this,
+ static_cast< const SwCellFrm *>( pFrm ) );
+ break;
+ case FRM_TAB:
+ pAcc = new SwAccessibleTable( this,
+ static_cast< const SwTabFrm *>( pFrm ) );
+ break;
+ case FRM_PAGE:
+ DBG_ASSERT( GetShell()->IsPreView(),
+ "accessible page frames only in PagePreview" );
+ pAcc = new SwAccessiblePage( this, pFrm );
+ break;
+ }
+ xAcc = pAcc;
+
+ ASSERT( xAcc.is(), "unknown frame type" );
+ if( xAcc.is() )
+ {
+ if( aIter != mpFrmMap->end() )
+ {
+ (*aIter).second = xAcc;
+ }
+ else
+ {
+ SwAccessibleContextMap_Impl::value_type aEntry( pFrm, xAcc );
+ mpFrmMap->insert( aEntry );
+ }
+
+ if( pAcc->HasCursor() &&
+ !AreInSameTable( mxCursorContext, pFrm ) )
+ {
+ // If the new context has the focus, and if we know
+ // another context that had the focus, then the focus
+ // just moves from the old context to the new one. We
+ // have to send a focus event and a caret event for
+ // the old context then. We have to to that know,
+ // because after we have left this method, anyone might
+ // call getStates for the new context and will get a
+ // focused state then. Sending the focus changes event
+ // after that seems to be strange. However, we cannot
+ // send a focus event fo the new context now, because
+ // noone except us knows it. In any case, we remeber
+ // the new context as the one that has the focus
+ // currently.
+
+ xOldCursorAcc = mxCursorContext;
+ mxCursorContext = xAcc;
+
+ bOldShapeSelected = mbShapeSelected;
+ mbShapeSelected = sal_False;
+ }
+ }
+ }
+ }
+ }
+
+ // Invalidate focus for old object when map is not locked
+ if( xOldCursorAcc.is() )
+ InvalidateCursorPosition( xOldCursorAcc );
+ if( bOldShapeSelected )
+ InvalidateShapeSelection();
+
+ return xAcc;
+}
+
+::vos::ORef < SwAccessibleContext > SwAccessibleMap::GetContextImpl(
+ const SwFrm *pFrm,
+ sal_Bool bCreate )
+{
+ uno::Reference < XAccessible > xAcc( GetContext( pFrm, bCreate ) );
+
+ ::vos::ORef < SwAccessibleContext > xAccImpl(
+ static_cast< SwAccessibleContext * >( xAcc.get() ) );
+
+ return xAccImpl;
+}
+
+uno::Reference< XAccessible> SwAccessibleMap::GetContext(
+ const SdrObject *pObj,
+ SwAccessibleContext *pParentImpl,
+ sal_Bool bCreate )
+{
+ uno::Reference < XAccessible > xAcc;
+ uno::Reference < XAccessible > xOldCursorAcc;
+
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( !mpShapeMap && bCreate )
+ mpShapeMap = new SwAccessibleShapeMap_Impl( this );
+ if( mpShapeMap )
+ {
+ SwAccessibleShapeMap_Impl::iterator aIter =
+ mpShapeMap->find( pObj );
+ if( aIter != mpShapeMap->end() )
+ xAcc = (*aIter).second;
+
+ if( !xAcc.is() && bCreate )
+ {
+ ::accessibility::AccessibleShape *pAcc = 0;
+ uno::Reference < drawing::XShape > xShape(
+ const_cast< SdrObject * >( pObj )->getUnoShape(),
+ uno::UNO_QUERY );
+ if( xShape.is() )
+ {
+ ::accessibility::ShapeTypeHandler& rShapeTypeHandler =
+ ::accessibility::ShapeTypeHandler::Instance();
+ uno::Reference < XAccessible > xParent( pParentImpl );
+ ::accessibility::AccessibleShapeInfo aShapeInfo(
+ xShape, xParent, this );
+
+ pAcc = rShapeTypeHandler.CreateAccessibleObject(
+ aShapeInfo, mpShapeMap->GetInfo() );
+ }
+ xAcc = pAcc;
+
+ ASSERT( xAcc.is(), "unknown shape type" );
+ if( xAcc.is() )
+ {
+ pAcc->Init();
+ if( aIter != mpShapeMap->end() )
+ {
+ (*aIter).second = xAcc;
+ }
+ else
+ {
+ SwAccessibleShapeMap_Impl::value_type aEntry( pObj,
+ xAcc );
+ mpShapeMap->insert( aEntry );
+ }
+ // TODO: focus!!!
+ }
+ }
+ }
+ }
+
+ // Invalidate focus for old object when map is not locked
+ if( xOldCursorAcc.is() )
+ InvalidateCursorPosition( xOldCursorAcc );
+
+ return xAcc;
+}
+
+::vos::ORef < ::accessibility::AccessibleShape > SwAccessibleMap::GetContextImpl(
+ const SdrObject *pObj,
+ SwAccessibleContext *pParentImpl,
+ sal_Bool bCreate )
+{
+ uno::Reference < XAccessible > xAcc( GetContext( pObj, pParentImpl, bCreate ) );
+
+ ::vos::ORef < ::accessibility::AccessibleShape > xAccImpl(
+ static_cast< ::accessibility::AccessibleShape* >( xAcc.get() ) );
+
+ return xAccImpl;
+}
+
+
+void SwAccessibleMap::RemoveContext( const SwFrm *pFrm )
+{
+ vos::OGuard aGuard( maMutex );
+
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( pFrm );
+ if( aIter != mpFrmMap->end() )
+ {
+ mpFrmMap->erase( aIter );
+
+ // Remove reference to old caret object. Though mxCursorContext
+ // is a weak reference and cleared automatically, clearing it
+ // directly makes sure to not keep a defunctional object.
+ uno::Reference < XAccessible > xOldAcc( mxCursorContext );
+ if( xOldAcc.is() )
+ {
+ SwAccessibleContext *pOldAccImpl =
+ static_cast< SwAccessibleContext *>( xOldAcc.get() );
+ ASSERT( pOldAccImpl->GetFrm(), "old caret context is disposed" );
+ if( pOldAccImpl->GetFrm() == pFrm )
+ {
+ xOldAcc.clear(); // get an empty ref
+ mxCursorContext = xOldAcc;
+ }
+ }
+
+ if( mpFrmMap->empty() )
+ {
+ delete mpFrmMap;
+ mpFrmMap = 0;
+ }
+ }
+ }
+}
+
+void SwAccessibleMap::RemoveContext( const SdrObject *pObj )
+{
+ vos::OGuard aGuard( maMutex );
+
+ if( mpShapeMap )
+ {
+ SwAccessibleShapeMap_Impl::iterator aIter =
+ mpShapeMap->find( pObj );
+ if( aIter != mpShapeMap->end() )
+ {
+ mpShapeMap->erase( aIter );
+
+ // The shape selection flag is not cleared, but one might do
+ // so but has to make sure that the removed context is the one
+ // that is selected.
+
+ if( mpShapeMap->empty() )
+ {
+ delete mpShapeMap;
+ mpShapeMap = 0;
+ }
+ }
+ }
+}
+
+
+void SwAccessibleMap::Dispose( const SwFrm *pFrm,
+ const SdrObject *pObj,
+ Window* pWindow,
+ sal_Bool bRecursive )
+{
+ SwAccessibleChild aFrmOrObj( pFrm, pObj, pWindow );
+
+ // Indeed, the following assert checks the frame's accessible flag,
+ // because that's the one that is evaluated in the layout. The frame
+ // might not be accessible anyway. That's the case for cell frames that
+ // contain further cells.
+ ASSERT( !aFrmOrObj.GetSwFrm() || aFrmOrObj.GetSwFrm()->IsAccessibleFrm(),
+ "non accessible frame should be disposed" );
+
+ if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
+ {
+ ::vos::ORef< SwAccessibleContext > xAccImpl;
+ ::vos::ORef< SwAccessibleContext > xParentAccImpl;
+ ::vos::ORef< ::accessibility::AccessibleShape > xShapeAccImpl;
+ // get accessible context for frame
+ {
+ vos::OGuard aGuard( maMutex );
+
+ // First of all look for an accessible context for a frame
+ if( aFrmOrObj.GetSwFrm() && mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ xAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ }
+ }
+ if( !xAccImpl.isValid() && mpFrmMap )
+ {
+ // If there is none, look if the parent is accessible.
+ const SwFrm *pParent =
+ SwAccessibleFrame::GetParent( aFrmOrObj,
+ GetShell()->IsPreView());
+
+ if( pParent )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( pParent );
+ if( aIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ xParentAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ }
+ }
+ }
+ if( !xParentAccImpl.isValid() && !aFrmOrObj.GetSwFrm() &&
+ mpShapeMap )
+ {
+ SwAccessibleShapeMap_Impl::iterator aIter =
+ mpShapeMap->find( aFrmOrObj.GetDrawObject() );
+ if( aIter != mpShapeMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ xShapeAccImpl =
+ static_cast< ::accessibility::AccessibleShape *>( xAcc.get() );
+ }
+ }
+ if( pObj && GetShell()->ActionPend() &&
+ (xParentAccImpl.isValid() || xShapeAccImpl.isValid()) )
+ {
+ // Keep a reference to the XShape to avoid that it
+ // is deleted with a SwFrmFmt::Modify.
+ uno::Reference < drawing::XShape > xShape(
+ const_cast< SdrObject * >( pObj )->getUnoShape(),
+ uno::UNO_QUERY );
+ if( xShape.is() )
+ {
+ if( !mpShapes )
+ mpShapes = new SwShapeList_Impl;
+ mpShapes->push_back( xShape );
+ }
+ }
+ }
+
+ // remove events stored for the frame
+ {
+ vos::OGuard aGuard( maEventMutex );
+ if( mpEvents )
+ {
+ SwAccessibleEventMap_Impl::iterator aIter =
+ mpEventMap->find( aFrmOrObj );
+ if( aIter != mpEventMap->end() )
+ {
+ SwAccessibleEvent_Impl aEvent(
+ SwAccessibleEvent_Impl::DISPOSE, aFrmOrObj );
+ AppendEvent( aEvent );
+ }
+ }
+ }
+
+ // If the frame is accessible and there is a context for it, dispose
+ // the frame. If the frame is no context for it but disposing should
+ // take place recursive, the frame's children have to be disposed
+ // anyway, so we have to create the context then.
+ if( xAccImpl.isValid() )
+ {
+ xAccImpl->Dispose( bRecursive );
+ }
+ else if( xParentAccImpl.isValid() )
+ {
+ // If the frame is a cell frame, the table must be notified.
+ // If we are in an action, a table model change event will
+ // be broadcasted at the end of the action to give the table
+ // a chance to generate a single table change event.
+
+ xParentAccImpl->DisposeChild( aFrmOrObj, bRecursive );
+ }
+ else if( xShapeAccImpl.isValid() )
+ {
+ RemoveContext( aFrmOrObj.GetDrawObject() );
+ xShapeAccImpl->dispose();
+ }
+
+ if( mpPreview && pFrm && pFrm->IsPageFrm() )
+ mpPreview->DisposePage( static_cast< const SwPageFrm *>( pFrm ) );
+ }
+}
+
+void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
+ const SdrObject *pObj,
+ Window* pWindow,
+ const SwRect& rOldBox )
+{
+ SwAccessibleChild aFrmOrObj( pFrm, pObj, pWindow );
+ if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
+ {
+ ::vos::ORef< SwAccessibleContext > xAccImpl;
+ ::vos::ORef< SwAccessibleContext > xParentAccImpl;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( mpFrmMap )
+ {
+ if( aFrmOrObj.GetSwFrm() )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ {
+ // If there is an accesible object already it is
+ // notified directly.
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ xAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ }
+ }
+ if( !xAccImpl.isValid() )
+ {
+ // Otherwise we look if the parent is accessible.
+ // If not, there is nothing to do.
+ const SwFrm *pParent =
+ SwAccessibleFrame::GetParent( aFrmOrObj,
+ GetShell()->IsPreView());
+
+ if( pParent )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( pParent );
+ if( aIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ xParentAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ }
+ }
+ }
+ }
+ }
+
+ if( xAccImpl.isValid() )
+ {
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent(
+ SwAccessibleEvent_Impl::POS_CHANGED, xAccImpl.getBodyPtr(),
+ aFrmOrObj, rOldBox );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ FireEvents();
+ xAccImpl->InvalidatePosOrSize( rOldBox );
+ }
+ }
+ else if( xParentAccImpl.isValid() )
+ {
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent(
+ SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
+ xParentAccImpl.getBodyPtr(), aFrmOrObj, rOldBox );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ FireEvents();
+ xParentAccImpl->InvalidateChildPosOrSize( aFrmOrObj,
+ rOldBox );
+ }
+ }
+ }
+}
+
+void SwAccessibleMap::InvalidateContent( const SwFrm *pFrm )
+{
+ SwAccessibleChild aFrmOrObj( pFrm );
+ if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
+ {
+ uno::Reference < XAccessible > xAcc;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ xAcc = (*aIter).second;
+ }
+ }
+
+ if( xAcc.is() )
+ {
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent(
+ SwAccessibleEvent_Impl::INVALID_CONTENT, pAccImpl,
+ aFrmOrObj );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ FireEvents();
+ pAccImpl->InvalidateContent();
+ }
+ }
+ }
+}
+
+// --> OD 2009-01-06 #i88069#
+void SwAccessibleMap::InvalidateAttr( const SwTxtFrm& rTxtFrm )
+{
+ SwAccessibleChild aFrmOrObj( &rTxtFrm );
+ if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
+ {
+ uno::Reference < XAccessible > xAcc;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ xAcc = (*aIter).second;
+ }
+ }
+
+ if( xAcc.is() )
+ {
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::INVALID_ATTR,
+ pAccImpl, aFrmOrObj );
+ aEvent.SetStates( ACC_STATE_TEXT_ATTRIBUTE_CHANGED );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ FireEvents();
+ pAccImpl->InvalidateAttr();
+ }
+ }
+ }
+}
+// <--
+
+void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm )
+{
+ SwAccessibleChild aFrmOrObj( pFrm );
+ sal_Bool bShapeSelected = sal_False;
+ const ViewShell *pVSh = GetShell();
+ if( pVSh->ISA( SwCrsrShell ) )
+ {
+ const SwCrsrShell *pCSh = static_cast< const SwCrsrShell * >( pVSh );
+ if( pCSh->IsTableMode() )
+ {
+ while( aFrmOrObj.GetSwFrm() && !aFrmOrObj.GetSwFrm()->IsCellFrm() )
+ aFrmOrObj = aFrmOrObj.GetSwFrm()->GetUpper();
+ }
+ else if( pVSh->ISA( SwFEShell ) )
+ {
+ sal_uInt16 nObjCount;
+ const SwFEShell *pFESh = static_cast< const SwFEShell * >( pVSh );
+ const SwFrm *pFlyFrm = pFESh->GetCurrFlyFrm();
+ if( pFlyFrm )
+ {
+ ASSERT( !pFrm || pFrm->FindFlyFrm() == pFlyFrm,
+ "cursor is not contained in fly frame" );
+ aFrmOrObj = pFlyFrm;
+ }
+ else if( (nObjCount = pFESh->IsObjSelected()) > 0 )
+ {
+ bShapeSelected = sal_True;
+ aFrmOrObj = static_cast<const SwFrm *>( 0 );
+ }
+ }
+ }
+
+ ASSERT( bShapeSelected || aFrmOrObj.IsAccessible(GetShell()->IsPreView()),
+ "frame is not accessible" );
+
+ uno::Reference < XAccessible > xOldAcc;
+ uno::Reference < XAccessible > xAcc;
+ sal_Bool bOldShapeSelected = sal_False;
+
+ {
+ vos::OGuard aGuard( maMutex );
+
+ xOldAcc = mxCursorContext;
+ mxCursorContext = xAcc; // clear reference
+
+ bOldShapeSelected = mbShapeSelected;
+ mbShapeSelected = bShapeSelected;
+
+ if( aFrmOrObj.GetSwFrm() && mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ xAcc = (*aIter).second;
+
+ // For cells, some extra thoughts are necessary,
+ // because invalidating the cursor for one cell
+ // invalidates the cursor for all cells of the same
+ // table. For this reason, we don't want to
+ // invalidate the cursor for the old cursor object
+ // and the new one if they are within the same table,
+ // because this would result in doing the work twice.
+ // Moreover, we have to make sure to invalidate the
+ // cursor even if the current cell has no accessible object.
+ // If the old cursor objects exists and is in the same
+ // table, its the best choice, because using it avoids
+ // an unnessarary cursor invalidation cycle when creating
+ // a new object for the current cell.
+ if( aFrmOrObj.GetSwFrm()->IsCellFrm() )
+ {
+ if( xOldAcc.is() &&
+ AreInSameTable( xOldAcc, aFrmOrObj.GetSwFrm() ) )
+ {
+ if( xAcc.is() )
+ xOldAcc = xAcc; // avoid extra invalidation
+ else
+ xAcc = xOldAcc; // make sure ate least one
+ }
+ if( !xAcc.is() )
+ xAcc = GetContext( aFrmOrObj.GetSwFrm(), sal_True );
+ }
+ }
+ }
+
+ if( xOldAcc.is() && xOldAcc != xAcc )
+ InvalidateCursorPosition( xOldAcc );
+ if( bOldShapeSelected || bShapeSelected )
+ InvalidateShapeSelection();
+ if( xAcc.is() )
+ InvalidateCursorPosition( xAcc );
+}
+
+void SwAccessibleMap::InvalidateFocus()
+{
+ uno::Reference < XAccessible > xAcc;
+ sal_Bool bShapeSelected;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ xAcc = mxCursorContext;
+ bShapeSelected = mbShapeSelected;
+ }
+
+ if( xAcc.is() )
+ {
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ pAccImpl->InvalidateFocus();
+ }
+ else if( bShapeSelected )
+ {
+ DoInvalidateShapeFocus();
+ }
+}
+
+void SwAccessibleMap::SetCursorContext(
+ const ::vos::ORef < SwAccessibleContext >& rCursorContext )
+{
+ vos::OGuard aGuard( maMutex );
+ uno::Reference < XAccessible > xAcc( rCursorContext.getBodyPtr() );
+ mxCursorContext = xAcc;
+}
+
+// --> OD 2005-12-12 #i27301# - use new type definition for <_nStates>
+void SwAccessibleMap::InvalidateStates( tAccessibleStates _nStates,
+ const SwFrm* _pFrm )
+{
+ // Start with the frame or the first upper that is accessible
+ SwAccessibleChild aFrmOrObj( _pFrm );
+ while( aFrmOrObj.GetSwFrm() &&
+ !aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
+ aFrmOrObj = aFrmOrObj.GetSwFrm()->GetUpper();
+ if( !aFrmOrObj.GetSwFrm() )
+ aFrmOrObj = GetShell()->GetLayout();
+
+ uno::Reference< XAccessible > xAcc( GetContext( aFrmOrObj.GetSwFrm(), sal_True ) );
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
+ pAccImpl,
+ SwAccessibleChild(pAccImpl->GetFrm()),
+ _nStates );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ FireEvents();
+ pAccImpl->InvalidateStates( _nStates );
+ }
+}
+// <--
+
+void SwAccessibleMap::_InvalidateRelationSet( const SwFrm* pFrm,
+ sal_Bool bFrom )
+{
+ // first, see if this frame is accessible, and if so, get the respective
+ SwAccessibleChild aFrmOrObj( pFrm );
+ if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
+ {
+ uno::Reference < XAccessible > xAcc;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ {
+ xAcc = (*aIter).second;
+ }
+ }
+ }
+
+ // deliver event directly, or queue event
+ if( xAcc.is() )
+ {
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
+ pAccImpl, SwAccessibleChild(pFrm),
+ ( bFrom
+ ? ACC_STATE_RELATION_FROM
+ : ACC_STATE_RELATION_TO ) );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ FireEvents();
+ pAccImpl->InvalidateRelation( bFrom
+ ? AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED
+ : AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED );
+ }
+ }
+ }
+}
+
+void SwAccessibleMap::InvalidateRelationSet( const SwFrm* pMaster,
+ const SwFrm* pFollow )
+{
+ _InvalidateRelationSet( pMaster, sal_False );
+ _InvalidateRelationSet( pFollow, sal_True );
+}
+
+/** invalidation CONTENT_FLOW_FROM/_TO relation of a paragraph
+
+ OD 2005-12-01 #i27138#
+
+ @author OD
+*/
+void SwAccessibleMap::InvalidateParaFlowRelation( const SwTxtFrm& _rTxtFrm,
+ const bool _bFrom )
+{
+ _InvalidateRelationSet( &_rTxtFrm, _bFrom );
+}
+
+/** invalidation of text selection of a paragraph
+
+ OD 2005-12-12 #i27301#
+
+ @author OD
+*/
+void SwAccessibleMap::InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm )
+{
+ // first, see if this frame is accessible, and if so, get the respective
+ SwAccessibleChild aFrmOrObj( &_rTxtFrm );
+ if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
+ {
+ uno::Reference < XAccessible > xAcc;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ {
+ xAcc = (*aIter).second;
+ }
+ }
+ }
+
+ // deliver event directly, or queue event
+ if( xAcc.is() )
+ {
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent(
+ SwAccessibleEvent_Impl::CARET_OR_STATES,
+ pAccImpl,
+ SwAccessibleChild( &_rTxtFrm ),
+ ACC_STATE_TEXT_SELECTION_CHANGED );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ FireEvents();
+ pAccImpl->InvalidateTextSelection();
+ }
+ }
+ }
+}
+
+sal_Int32 SwAccessibleMap::GetChildIndex( const SwFrm& rParentFrm,
+ Window& rChild ) const
+{
+ sal_Int32 nIndex( -1 );
+
+ SwAccessibleChild aFrmOrObj( &rParentFrm );
+ if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
+ {
+ uno::Reference < XAccessible > xAcc;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ {
+ xAcc = (*aIter).second;
+ }
+ }
+ }
+
+ if( xAcc.is() )
+ {
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+
+ nIndex = pAccImpl->GetChildIndex( const_cast<SwAccessibleMap&>(*this),
+ SwAccessibleChild( &rChild ) );
+ }
+ }
+
+ return nIndex;
+}
+
+
+// OD 15.01.2003 #103492# - complete re-factoring of method due to new page/print
+// preview functionality.
+void SwAccessibleMap::UpdatePreview( const std::vector<PrevwPage*>& _rPrevwPages,
+ const Fraction& _rScale,
+ const SwPageFrm* _pSelectedPageFrm,
+ const Size& _rPrevwWinSize )
+{
+ DBG_ASSERT( GetShell()->IsPreView(), "no preview?" );
+ DBG_ASSERT( mpPreview != NULL, "no preview data?" );
+
+ // OD 15.01.2003 #103492# - adjustments for changed method signature
+ mpPreview->Update( *this, _rPrevwPages, _rScale, _pSelectedPageFrm, _rPrevwWinSize );
+
+ // propagate change of VisArea through the document's
+ // accessibility tree; this will also send appropriate scroll
+ // events
+ SwAccessibleContext* pDoc =
+ GetContextImpl( GetShell()->GetLayout() ).getBodyPtr();
+ static_cast<SwAccessibleDocumentBase*>( pDoc )->SetVisArea();
+
+ uno::Reference < XAccessible > xOldAcc;
+ uno::Reference < XAccessible > xAcc;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ xOldAcc = mxCursorContext;
+
+ const SwPageFrm *pSelPage = mpPreview->GetSelPage();
+ if( pSelPage && mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( pSelPage );
+ if( aIter != mpFrmMap->end() )
+ xAcc = (*aIter).second;
+ }
+ }
+
+ if( xOldAcc.is() && xOldAcc != xAcc )
+ InvalidateCursorPosition( xOldAcc );
+ if( xAcc.is() )
+ InvalidateCursorPosition( xAcc );
+}
+
+void SwAccessibleMap::InvalidatePreViewSelection( sal_uInt16 nSelPage )
+{
+ DBG_ASSERT( GetShell()->IsPreView(), "no preview?" );
+ DBG_ASSERT( mpPreview != NULL, "no preview data?" );
+
+ // OD 16.01.2003 #103492# - changed metthod call due to method signature change.
+ mpPreview->InvalidateSelection( GetShell()->GetLayout()->GetPageByPageNum( nSelPage ) );
+
+ uno::Reference < XAccessible > xOldAcc;
+ uno::Reference < XAccessible > xAcc;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ xOldAcc = mxCursorContext;
+
+ const SwPageFrm *pSelPage = mpPreview->GetSelPage();
+ if( pSelPage && mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( pSelPage );
+ if( aIter != mpFrmMap->end() )
+ xAcc = (*aIter).second;
+ }
+ }
+
+ if( xOldAcc.is() && xOldAcc != xAcc )
+ InvalidateCursorPosition( xOldAcc );
+ if( xAcc.is() )
+ InvalidateCursorPosition( xAcc );
+}
+
+
+sal_Bool SwAccessibleMap::IsPageSelected( const SwPageFrm *pPageFrm ) const
+{
+ return mpPreview && mpPreview->GetSelPage() == pPageFrm;
+}
+
+
+void SwAccessibleMap::FireEvents()
+{
+ {
+ vos::OGuard aGuard( maEventMutex );
+ if( mpEvents )
+ {
+ mpEvents->SetFiring();
+ SwAccessibleEventList_Impl::iterator aIter = mpEvents->begin();
+ while( aIter != mpEvents->end() )
+ {
+ FireEvent( *aIter );
+ ++aIter;
+ }
+
+ delete mpEventMap;
+ mpEventMap = 0;
+
+ delete mpEvents;
+ mpEvents = 0;
+ }
+ }
+ {
+ vos::OGuard aGuard( maMutex );
+ if( mpShapes )
+ {
+ delete mpShapes;
+ mpShapes = 0;
+ }
+ }
+
+}
+
+sal_Bool SwAccessibleMap::IsValid() const
+{
+ return sal_True;
+}
+
+Rectangle SwAccessibleMap::GetVisibleArea() const
+{
+ MapMode aSrc( MAP_TWIP );
+ MapMode aDest( MAP_100TH_MM );
+ return OutputDevice::LogicToLogic( GetVisArea().SVRect(), aSrc, aDest );
+}
+
+// Convert a MM100 value realtive to the document root into a pixel value
+// realtive to the screen!
+Point SwAccessibleMap::LogicToPixel( const Point& rPoint ) const
+{
+ MapMode aSrc( MAP_100TH_MM );
+ MapMode aDest( MAP_TWIP );
+
+ Point aPoint = rPoint;
+
+ aPoint = OutputDevice::LogicToLogic( aPoint, aSrc, aDest );
+ Window *pWin = GetShell()->GetWin();
+ if( pWin )
+ {
+ // OD 16.01.2003 #103492# - get mapping mode for LogicToPixel conversion
+ MapMode aMapMode;
+ GetMapMode( aPoint, aMapMode );
+ aPoint = pWin->LogicToPixel( aPoint, aMapMode );
+ aPoint = pWin->OutputToAbsoluteScreenPixel( aPoint );
+ }
+
+ return aPoint;
+}
+
+Size SwAccessibleMap::LogicToPixel( const Size& rSize ) const
+{
+ MapMode aSrc( MAP_100TH_MM );
+ MapMode aDest( MAP_TWIP );
+ Size aSize( OutputDevice::LogicToLogic( rSize, aSrc, aDest ) );
+ if( GetShell()->GetWin() )
+ {
+ // OD 16.01.2003 #103492# - get mapping mode for LogicToPixel conversion
+ MapMode aMapMode;
+ GetMapMode( Point(0,0), aMapMode );
+ aSize = GetShell()->GetWin()->LogicToPixel( aSize, aMapMode );
+ }
+
+ return aSize;
+}
+
+Point SwAccessibleMap::PixelToLogic( const Point& rPoint ) const
+{
+ Point aPoint;
+ Window *pWin = GetShell()->GetWin();
+ if( pWin )
+ {
+ aPoint = pWin->ScreenToOutputPixel( rPoint );
+ // OD 16.01.2003 #103492# - get mapping mode for PixelToLogic conversion
+ MapMode aMapMode;
+ GetMapMode( aPoint, aMapMode );
+ aPoint = pWin->PixelToLogic( aPoint, aMapMode );
+ MapMode aSrc( MAP_TWIP );
+ MapMode aDest( MAP_100TH_MM );
+ aPoint = OutputDevice::LogicToLogic( aPoint, aSrc, aDest );
+ }
+
+ return aPoint;
+}
+
+Size SwAccessibleMap::PixelToLogic( const Size& rSize ) const
+{
+ Size aSize;
+ if( GetShell()->GetWin() )
+ {
+ // OD 16.01.2003 #103492# - get mapping mode for PixelToLogic conversion
+ MapMode aMapMode;
+ GetMapMode( Point(0,0), aMapMode );
+ aSize = GetShell()->GetWin()->PixelToLogic( rSize, aMapMode );
+ MapMode aSrc( MAP_TWIP );
+ MapMode aDest( MAP_100TH_MM );
+ aSize = OutputDevice::LogicToLogic( aSize, aSrc, aDest );
+ }
+
+ return aSize;
+}
+
+sal_Bool SwAccessibleMap::ReplaceChild (
+ ::accessibility::AccessibleShape* pCurrentChild,
+ const uno::Reference< drawing::XShape >& _rxShape,
+ const long /*_nIndex*/,
+ const ::accessibility::AccessibleShapeTreeInfo& /*_rShapeTreeInfo*/
+ ) throw (uno::RuntimeException)
+{
+ const SdrObject *pObj = 0;
+ {
+ vos::OGuard aGuard( maMutex );
+ if( mpShapeMap )
+ {
+ SwAccessibleShapeMap_Impl::const_iterator aIter = mpShapeMap->begin();
+ SwAccessibleShapeMap_Impl::const_iterator aEndIter = mpShapeMap->end();
+ while( aIter != aEndIter && !pObj )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ ::accessibility::AccessibleShape *pAccShape =
+ static_cast < ::accessibility::AccessibleShape* >( xAcc.get() );
+ if( pAccShape == pCurrentChild )
+ {
+ pObj = (*aIter).first;
+ }
+ ++aIter;
+ }
+ }
+ }
+ if( !pObj )
+ return sal_False;
+
+ uno::Reference < drawing::XShape > xShape( _rxShape ); //keep reference to shape, because
+ // we might be the only one that
+ // hold it.
+ // Also get keep parent.
+ uno::Reference < XAccessible > xParent( pCurrentChild->getAccessibleParent() );
+ pCurrentChild = 0; // well be realease by dispose
+ Dispose( 0, pObj, 0 );
+
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( !mpShapeMap )
+ mpShapeMap = new SwAccessibleShapeMap_Impl( this );
+
+ // create the new child
+ ::accessibility::ShapeTypeHandler& rShapeTypeHandler =
+ ::accessibility::ShapeTypeHandler::Instance();
+ ::accessibility::AccessibleShapeInfo aShapeInfo(
+ xShape, xParent, this );
+ ::accessibility::AccessibleShape* pReplacement =
+ rShapeTypeHandler.CreateAccessibleObject (
+ aShapeInfo, mpShapeMap->GetInfo() );
+
+ uno::Reference < XAccessible > xAcc( pReplacement );
+ if( xAcc.is() )
+ {
+ pReplacement->Init();
+
+ SwAccessibleShapeMap_Impl::iterator aIter =
+ mpShapeMap->find( pObj );
+ if( aIter != mpShapeMap->end() )
+ {
+ (*aIter).second = xAcc;
+ }
+ else
+ {
+ SwAccessibleShapeMap_Impl::value_type aEntry( pObj, xAcc );
+ mpShapeMap->insert( aEntry );
+ }
+ }
+ }
+
+ SwRect aEmptyRect;
+ InvalidatePosOrSize( 0, pObj, 0, aEmptyRect );
+
+ return sal_True;
+}
+
+Point SwAccessibleMap::PixelToCore( const Point& rPoint ) const
+{
+ Point aPoint;
+ if( GetShell()->GetWin() )
+ {
+ // OD 15.01.2003 #103492# - replace <PreviewAdjust(..)> by <GetMapMode(..)>
+ MapMode aMapMode;
+ GetMapMode( rPoint, aMapMode );
+ aPoint = GetShell()->GetWin()->PixelToLogic( rPoint, aMapMode );
+ }
+ return aPoint;
+}
+
+static inline long lcl_CorrectCoarseValue(long aCoarseValue, long aFineValue,
+ long aRefValue, bool bToLower)
+{
+ long aResult = aCoarseValue;
+
+ if (bToLower)
+ {
+ if (aFineValue < aRefValue)
+ aResult -= 1;
+ }
+ else
+ {
+ if (aFineValue > aRefValue)
+ aResult += 1;
+ }
+
+ return aResult;
+}
+
+static inline void lcl_CorrectRectangle(Rectangle & rRect,
+ const Rectangle & rSource,
+ const Rectangle & rInGrid)
+{
+ rRect.nLeft = lcl_CorrectCoarseValue(rRect.nLeft, rSource.nLeft,
+ rInGrid.nLeft, false);
+ rRect.nTop = lcl_CorrectCoarseValue(rRect.nTop, rSource.nTop,
+ rInGrid.nTop, false);
+ rRect.nRight = lcl_CorrectCoarseValue(rRect.nRight, rSource.nRight,
+ rInGrid.nRight, true);
+ rRect.nBottom = lcl_CorrectCoarseValue(rRect.nBottom, rSource.nBottom,
+ rInGrid.nBottom, true);
+}
+
+Rectangle SwAccessibleMap::CoreToPixel( const Rectangle& rRect ) const
+{
+ Rectangle aRect;
+ if( GetShell()->GetWin() )
+ {
+ // OD 15.01.2003 #103492# - replace <PreviewAdjust(..)> by <GetMapMode(..)>
+ MapMode aMapMode;
+ GetMapMode( rRect.TopLeft(), aMapMode );
+ aRect = GetShell()->GetWin()->LogicToPixel( rRect, aMapMode );
+
+ Rectangle aTmpRect = GetShell()->GetWin()->PixelToLogic( aRect, aMapMode );
+ lcl_CorrectRectangle(aRect, rRect, aTmpRect);
+ }
+
+ return aRect;
+}
+
+/** get mapping mode for LogicToPixel and PixelToLogic conversions
+
+ OD 15.01.2003 #103492#
+ Replacement method <PreviewAdjust(..)> by new method <GetMapMode>.
+ Method returns mapping mode of current output device and adjusts it,
+ if the shell is in page/print preview.
+ Necessary, because <PreviewAdjust(..)> changes mapping mode at current
+ output device for mapping logic document positions to page preview window
+ positions and vice versa and doesn't take care to recover its changes.
+
+ @author OD
+*/
+void SwAccessibleMap::GetMapMode( const Point& _rPoint,
+ MapMode& _orMapMode ) const
+{
+ MapMode aMapMode = GetShell()->GetWin()->GetMapMode();
+ if( GetShell()->IsPreView() )
+ {
+ DBG_ASSERT( mpPreview != NULL, "need preview data" );
+
+ mpPreview->AdjustMapMode( aMapMode, _rPoint );
+ }
+ _orMapMode = aMapMode;
+}
+
+/** get size of a dedicated preview page
+
+ OD 15.01.2003 #103492#
+
+ @author OD
+*/
+Size SwAccessibleMap::GetPreViewPageSize( sal_uInt16 _nPrevwPageNum ) const
+{
+ DBG_ASSERT( mpVSh->IsPreView(), "no page preview accessible." );
+ DBG_ASSERT( mpVSh->IsPreView() && ( mpPreview != NULL ),
+ "missing accessible preview data at page preview" );
+ if ( mpVSh->IsPreView() && ( mpPreview != NULL ) )
+ {
+ return mpVSh->PagePreviewLayout()->GetPrevwPageSizeByPageNum( _nPrevwPageNum );
+ }
+ else
+ {
+ return Size( 0, 0 );
+ }
+}
+
+/** method to build up a new data structure of the accessible pararaphs,
+ which have a selection
+
+ OD 2005-12-13 #i27301#
+ Important note: method has to used inside a mutual exclusive section
+
+ @author OD
+*/
+SwAccessibleSelectedParas_Impl* SwAccessibleMap::_BuildSelectedParas()
+{
+ // no accessible contexts, no selection
+ if ( !mpFrmMap )
+ {
+ return 0L;
+ }
+
+ // get cursor as an instance of its base class <SwPaM>
+ SwPaM* pCrsr( 0L );
+ {
+ SwCrsrShell* pCrsrShell = dynamic_cast<SwCrsrShell*>(GetShell());
+ if ( pCrsrShell )
+ {
+ SwFEShell* pFEShell = dynamic_cast<SwFEShell*>(pCrsrShell);
+ if ( !pFEShell ||
+ ( !pFEShell->IsFrmSelected() &&
+ pFEShell->IsObjSelected() == 0 ) )
+ {
+ // get cursor without updating an existing table cursor.
+ pCrsr = pCrsrShell->GetCrsr( sal_False );
+ }
+ }
+ }
+ // no cursor, no selection
+ if ( !pCrsr )
+ {
+ return 0L;
+ }
+
+ SwAccessibleSelectedParas_Impl* pRetSelectedParas( 0L );
+
+ // loop on all cursors
+ SwPaM* pRingStart = pCrsr;
+ do {
+
+ // for a selection the cursor has to have a mark.
+ // for savety reasons assure that point and mark are in text nodes
+ if ( pCrsr->HasMark() &&
+ pCrsr->GetPoint()->nNode.GetNode().IsTxtNode() &&
+ pCrsr->GetMark()->nNode.GetNode().IsTxtNode() )
+ {
+ SwPosition* pStartPos = pCrsr->Start();
+ SwPosition* pEndPos = pCrsr->End();
+ // loop on all text nodes inside the selection
+ SwNodeIndex aIdx( pStartPos->nNode );
+ for ( ; aIdx.GetIndex() <= pEndPos->nNode.GetIndex(); ++aIdx )
+ {
+ SwTxtNode* pTxtNode( aIdx.GetNode().GetTxtNode() );
+ if ( pTxtNode )
+ {
+ // loop on all text frames registered at the text node.
+ SwIterator<SwTxtFrm,SwTxtNode> aIter( *pTxtNode );
+ for( SwTxtFrm* pTxtFrm = aIter.First(); pTxtFrm; pTxtFrm = aIter.Next() )
+ {
+ uno::WeakReference < XAccessible > xWeakAcc;
+ SwAccessibleContextMap_Impl::iterator aMapIter =
+ mpFrmMap->find( pTxtFrm );
+ if( aMapIter != mpFrmMap->end() )
+ {
+ xWeakAcc = (*aMapIter).second;
+ SwAccessibleParaSelection aDataEntry(
+ pTxtNode == &(pStartPos->nNode.GetNode())
+ ? pStartPos->nContent.GetIndex()
+ : 0,
+ pTxtNode == &(pEndPos->nNode.GetNode())
+ ? pEndPos->nContent.GetIndex()
+ : STRING_LEN );
+ SwAccessibleSelectedParas_Impl::value_type
+ aEntry( xWeakAcc, aDataEntry );
+ if ( !pRetSelectedParas )
+ {
+ pRetSelectedParas =
+ new SwAccessibleSelectedParas_Impl;
+ }
+ pRetSelectedParas->insert( aEntry );
+ }
+ }
+ }
+ }
+ }
+
+ // prepare next turn: get next cursor in ring
+ pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
+ } while ( pCrsr != pRingStart );
+
+ return pRetSelectedParas;
+}
+
+/** invalidation of text selection of all paragraphs
+
+ OD 2005-12-13 #i27301#
+
+ @author OD
+*/
+void SwAccessibleMap::InvalidateTextSelectionOfAllParas()
+{
+ vos::OGuard aGuard( maMutex );
+
+ // keep previously known selected paragraphs
+ SwAccessibleSelectedParas_Impl* pPrevSelectedParas( mpSelectedParas );
+
+ // determine currently selected paragraphs
+ mpSelectedParas = _BuildSelectedParas();
+
+ // compare currently selected paragraphs with the previously selected
+ // paragraphs and submit corresponding TEXT_SELECTION_CHANGED events.
+ // first, search for new and changed selections.
+ // on the run remove selections from previously known ones, if they are
+ // also in the current ones.
+ if ( mpSelectedParas )
+ {
+ SwAccessibleSelectedParas_Impl::iterator aIter = mpSelectedParas->begin();
+ for ( ; aIter != mpSelectedParas->end(); ++aIter )
+ {
+ bool bSubmitEvent( false );
+ if ( !pPrevSelectedParas )
+ {
+ // new selection
+ bSubmitEvent = true;
+ }
+ else
+ {
+ SwAccessibleSelectedParas_Impl::iterator aPrevSelected =
+ pPrevSelectedParas->find( (*aIter).first );
+ if ( aPrevSelected != pPrevSelectedParas->end() )
+ {
+ // check, if selection has changed
+ if ( (*aIter).second.nStartOfSelection !=
+ (*aPrevSelected).second.nStartOfSelection ||
+ (*aIter).second.nEndOfSelection !=
+ (*aPrevSelected).second.nEndOfSelection )
+ {
+ // changed selection
+ bSubmitEvent = true;
+ }
+ pPrevSelectedParas->erase( aPrevSelected );
+ }
+ else
+ {
+ // new selection
+ bSubmitEvent = true;
+ }
+ }
+
+ if ( bSubmitEvent )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).first );
+ if ( xAcc.is() )
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl(
+ static_cast<SwAccessibleContext*>( xAcc.get() ) );
+ if ( xAccImpl.isValid() && xAccImpl->GetFrm() )
+ {
+ const SwTxtFrm* pTxtFrm(
+ dynamic_cast<const SwTxtFrm*>(xAccImpl->GetFrm()) );
+ ASSERT( pTxtFrm,
+ "<SwAccessibleMap::_SubmitTextSelectionChangedEvents()> - unexcepted type of frame" );
+ if ( pTxtFrm )
+ {
+ InvalidateParaTextSelection( *pTxtFrm );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // second, handle previous selections - after the first step the data
+ // structure of the previously known only contains the 'old' selections
+ if ( pPrevSelectedParas )
+ {
+ SwAccessibleSelectedParas_Impl::iterator aIter = pPrevSelectedParas->begin();
+ for ( ; aIter != pPrevSelectedParas->end(); ++aIter )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).first );
+ if ( xAcc.is() )
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl(
+ static_cast<SwAccessibleContext*>( xAcc.get() ) );
+ if ( xAccImpl.isValid() && xAccImpl->GetFrm() )
+ {
+ const SwTxtFrm* pTxtFrm(
+ dynamic_cast<const SwTxtFrm*>(xAccImpl->GetFrm()) );
+ ASSERT( pTxtFrm,
+ "<SwAccessibleMap::_SubmitTextSelectionChangedEvents()> - unexcepted type of frame" );
+ if ( pTxtFrm )
+ {
+ InvalidateParaTextSelection( *pTxtFrm );
+ }
+ }
+ }
+ }
+
+ delete pPrevSelectedParas;
+ }
+}
+
+const SwRect& SwAccessibleMap::GetVisArea() const
+{
+ DBG_ASSERT( !GetShell()->IsPreView() || (mpPreview != NULL),
+ "preview without preview data?" );
+
+ return GetShell()->IsPreView()
+ ? mpPreview->GetVisArea()
+ : GetShell()->VisArea();
+}
+
diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx
new file mode 100644
index 000000000000..8764feff8d74
--- /dev/null
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -0,0 +1,275 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <frmfmt.hxx>
+#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;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+
+const SwNoTxtNode *SwAccessibleNoTextFrame::GetNoTxtNode() const
+{
+ const SwNoTxtNode *pNd = 0;
+ const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm *>( GetFrm() );
+ if( pFlyFrm->Lower() && pFlyFrm->Lower()->IsNoTxtFrm() )
+ {
+ const SwCntntFrm *pCntFrm =
+ static_cast<const SwCntntFrm *>( pFlyFrm->Lower() );
+ pNd = pCntFrm->GetNode()->GetNoTxtNode();
+ }
+
+ return pNd;
+}
+
+SwAccessibleNoTextFrame::SwAccessibleNoTextFrame(
+ SwAccessibleMap* pInitMap,
+ sal_Int16 nInitRole,
+ const SwFlyFrm* pFlyFrm ) :
+ SwAccessibleFrameBase( pInitMap, nInitRole, pFlyFrm ),
+ aDepend( this, const_cast < SwNoTxtNode * >( GetNoTxtNode() ) ),
+ msTitle(),
+ msDesc()
+{
+ const SwNoTxtNode* pNd = GetNoTxtNode();
+ // --> OD 2009-07-14 #i73249#
+ // consider new attributes Title and Description
+ if( pNd )
+ {
+ msTitle = pNd->GetTitle();
+
+ msDesc = pNd->GetDescription();
+ if ( msDesc.getLength() == 0 &&
+ msTitle != GetName() )
+ {
+ msDesc = msTitle;
+ }
+ }
+ // <--
+}
+
+SwAccessibleNoTextFrame::~SwAccessibleNoTextFrame()
+{
+}
+
+void SwAccessibleNoTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *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 );
+ }
+
+ const SwNoTxtNode *pNd = GetNoTxtNode();
+ ASSERT( pNd == aDepend.GetRegisteredIn(), "invalid frame" );
+ switch( nWhich )
+ {
+ // --> OD 2009-07-14 #i73249#
+ case RES_TITLE_CHANGED:
+ {
+ const String& sOldTitle(
+ dynamic_cast<const SwStringMsgPoolItem*>(pOld)->GetString() );
+ const String& sNewTitle(
+ dynamic_cast<const SwStringMsgPoolItem*>(pNew)->GetString() );
+ if ( sOldTitle == sNewTitle )
+ {
+ 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() ==
+ static_cast< SwModify *>( static_cast< SwPtrMsgPoolItem * >( pOld )->pObject ) )
+ const_cast < SwModify *>( aDepend.GetRegisteredIn()->Remove( aDepend );
+ break;
+
+ case RES_FMT_CHG:
+ if( static_cast< SwFmtChg * >(pNew)->pChangedFmt == GetRegisteredIn() &&
+ static_cast< SwFmtChg * >(pOld)->pChangedFmt->IsFmtInDTOR() )
+ GetRegisteredIn()->Remove( this );
+ break;
+ */
+ }
+}
+
+void SwAccessibleNoTextFrame::Dispose( sal_Bool bRecursive )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if( aDepend.GetRegisteredIn() )
+ const_cast < SwModify *>( aDepend.GetRegisteredIn() )->Remove( &aDepend );
+
+ 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)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ return msDesc;
+}
+
+
+
+//
+// XInterface
+//
+
+uno::Any SAL_CALL SwAccessibleNoTextFrame::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ if( aType ==
+ ::getCppuType( static_cast<uno::Reference<XAccessibleImage>*>( NULL ) ) )
+ {
+ uno::Reference<XAccessibleImage> xImage = this;
+ uno::Any aAny;
+ aAny <<= xImage;
+ return aAny;
+ }
+ else
+ return SwAccessibleContext::queryInterface( aType );
+}
+
+
+//====== XTypeProvider ====================================================
+uno::Sequence< uno::Type > SAL_CALL SwAccessibleNoTextFrame::getTypes() throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes( SwAccessibleFrameBase::getTypes() );
+
+ sal_Int32 nIndex = aTypes.getLength();
+ aTypes.realloc( nIndex + 1 );
+
+ uno::Type* pTypes = aTypes.getArray();
+ pTypes[nIndex] = ::getCppuType( static_cast< uno::Reference< XAccessibleImage > * >( 0 ) );
+
+ return aTypes;
+}
+
+
+//
+// XAccessibleImage
+//
+
+// implementation of the XAccessibleImage methods is a no-brainer, as
+// all releveant information is already accessible through other
+// methods. So we just delegate to those.
+
+OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleImageDescription()
+ throw ( uno::RuntimeException )
+{
+ return getAccessibleDescription();
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getAccessibleImageHeight( )
+ throw ( uno::RuntimeException )
+{
+ return getSize().Height;
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getAccessibleImageWidth( )
+ throw ( uno::RuntimeException )
+{
+ return getSize().Width;
+}
diff --git a/sw/source/core/access/accnotextframe.hxx b/sw/source/core/access/accnotextframe.hxx
new file mode 100644
index 000000000000..e07d9ff0ffc0
--- /dev/null
+++ b/sw/source/core/access/accnotextframe.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCNOTEXTFRAME_HXX
+#define _ACCNOTEXTFRAME_HXX
+#include "accframebase.hxx"
+#include <com/sun/star/accessibility/XAccessibleImage.hpp>
+
+class SwFlyFrm;
+class SwNoTxtNode;
+
+class SwAccessibleNoTextFrame : public SwAccessibleFrameBase,
+ public ::com::sun::star::accessibility::XAccessibleImage
+{
+ SwDepend aDepend;
+ // --> OD 2009-07-14 #i73249#
+ ::rtl::OUString msTitle;
+ // <--
+ ::rtl::OUString msDesc;
+
+protected:
+
+ virtual ~SwAccessibleNoTextFrame();
+
+ const SwNoTxtNode *GetNoTxtNode() const;
+
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+
+ SwAccessibleNoTextFrame( SwAccessibleMap* pInitMap,
+ sal_Int16 nInitRole,
+ const SwFlyFrm *pFlyFrm );
+
+ //===== 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)
+ throw (com::sun::star::uno::RuntimeException);
+
+ //===== XInterface ======================================================
+
+ // XInterface methods need to be implemented to disambiguate
+ // between those inherited through SwAcessibleContext and
+ // XAccessibleImage.
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire( ) throw ()
+ { SwAccessibleContext::acquire(); };
+
+ virtual void SAL_CALL release( ) throw ()
+ { SwAccessibleContext::release(); };
+
+ //====== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleImage ================================================
+
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleImageDescription( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL
+ getAccessibleImageHeight( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL
+ getAccessibleImageWidth( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // The object is not visible an longer and should be destroyed
+ virtual void Dispose( sal_Bool bRecursive = sal_False );
+};
+
+
+#endif
diff --git a/sw/source/core/access/accpage.cxx b/sw/source/core/access/accpage.cxx
new file mode 100644
index 000000000000..d5feca2e0ba9
--- /dev/null
+++ b/sw/source/core/access/accpage.cxx
@@ -0,0 +1,200 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <rtl/uuid.h>
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include "accpage.hxx"
+
+#ifndef _ACCESS_HRC
+#include "access.hrc"
+#endif
+#include <pagefrm.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using uno::Reference;
+using uno::RuntimeException;
+using uno::Sequence;
+using ::rtl::OUString;
+
+
+const sal_Char sServiceName[] = "com.sun.star.text.AccessiblePageView";
+const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessiblePageView";
+
+sal_Bool SwAccessiblePage::IsSelected()
+{
+ return GetMap()->IsPageSelected( static_cast < const SwPageFrm * >( GetFrm() ) );
+}
+
+void SwAccessiblePage::GetStates(
+ ::utl::AccessibleStateSetHelper& rStateSet )
+{
+ SwAccessibleContext::GetStates( rStateSet );
+
+ // FOCUSABLE
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ // FOCUSED
+ if( IsSelected() )
+ {
+ ASSERT( bIsSelected, "bSelected out of sync" );
+ ::vos::ORef < SwAccessibleContext > xThis( this );
+ GetMap()->SetCursorContext( xThis );
+
+ Window *pWin = GetWindow();
+ if( pWin && pWin->HasFocus() )
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+ }
+}
+
+void SwAccessiblePage::_InvalidateCursorPos()
+{
+ sal_Bool bNewSelected = IsSelected();
+ sal_Bool bOldSelected;
+
+ {
+ vos::OGuard aGuard( aMutex );
+ bOldSelected = bIsSelected;
+ bIsSelected = bNewSelected;
+ }
+
+ if( bNewSelected )
+ {
+ // remember that object as the one that has the caret. This is
+ // neccessary to notify that object if the cursor leaves it.
+ ::vos::ORef < SwAccessibleContext > xThis( this );
+ GetMap()->SetCursorContext( xThis );
+ }
+
+ if( bOldSelected != bNewSelected )
+ {
+ Window *pWin = GetWindow();
+ if( pWin && pWin->HasFocus() )
+ FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected );
+ }
+}
+
+void SwAccessiblePage::_InvalidateFocus()
+{
+ Window *pWin = GetWindow();
+ if( pWin )
+ {
+ sal_Bool bSelected;
+
+ {
+ vos::OGuard aGuard( aMutex );
+ bSelected = bIsSelected;
+ }
+ ASSERT( bSelected, "focus object should be selected" );
+
+ FireStateChangedEvent( AccessibleStateType::FOCUSED,
+ pWin->HasFocus() && bSelected );
+ }
+}
+
+SwAccessiblePage::SwAccessiblePage( SwAccessibleMap* pInitMap,
+ const SwFrm* pFrame )
+ : SwAccessibleContext( pInitMap, AccessibleRole::PANEL, pFrame )
+ , bIsSelected( sal_False )
+{
+ DBG_ASSERT( pFrame != NULL, "need frame" );
+ DBG_ASSERT( pInitMap != NULL, "need map" );
+ DBG_ASSERT( pFrame->IsPageFrm(), "need page frame" );
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ OUString sPage = OUString::valueOf(
+ static_cast<sal_Int32>(
+ static_cast<const SwPageFrm*>( GetFrm() )->GetPhyPageNum() ) );
+ SetName( GetResource( STR_ACCESS_PAGE_NAME, &sPage ) );
+}
+
+SwAccessiblePage::~SwAccessiblePage()
+{
+}
+
+sal_Bool SwAccessiblePage::HasCursor()
+{
+ vos::OGuard aGuard( aMutex );
+ return bIsSelected;
+}
+
+OUString SwAccessiblePage::getImplementationName( )
+ throw( RuntimeException )
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
+}
+
+sal_Bool SwAccessiblePage::supportsService( const OUString& rServiceName)
+ throw( RuntimeException )
+{
+ return rServiceName.equalsAsciiL( sServiceName, sizeof(sServiceName)-1 ) ||
+ rServiceName.equalsAsciiL( sAccessibleServiceName,
+ sizeof(sAccessibleServiceName)-1 );
+}
+
+Sequence<OUString> SwAccessiblePage::getSupportedServiceNames( )
+ throw( RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
+ pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ return aRet;
+}
+
+Sequence< sal_Int8 > SAL_CALL SwAccessiblePage::getImplementationId()
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+OUString SwAccessiblePage::getAccessibleDescription( )
+ throw( RuntimeException )
+{
+ CHECK_FOR_DEFUNC( ::com::sun::star::accessibility::XAccessibleContext );
+
+ OUString sArg( GetFormattedPageNumber() );
+ return GetResource( STR_ACCESS_PAGE_DESC, &sArg );
+}
diff --git a/sw/source/core/access/accpage.hxx b/sw/source/core/access/accpage.hxx
new file mode 100644
index 000000000000..f8972060ecb3
--- /dev/null
+++ b/sw/source/core/access/accpage.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCPAGE_HXX
+#define _ACCPAGE_HXX
+
+#ifndef _ACCCONTEXT_HXX
+#include "acccontext.hxx"
+#endif
+
+
+/**
+ * accessibility implementation for the page (SwPageFrm)
+ * The page is _only_ visible in the page preview. For the regular
+ * document view, it doesn't make sense to add this additional element
+ * into the hierarchy. For the page preview, however, the page is the
+ * important.
+ */
+class SwAccessiblePage : public SwAccessibleContext
+{
+ sal_Bool bIsSelected; // protected by base class mutex
+
+ sal_Bool IsSelected();
+
+ using SwAccessibleFrame::GetBounds;
+
+protected:
+
+ // return the bounding box for the page in page preview mode
+ SwRect GetBounds( /* const SwFrm *pFrm =0 */ );
+
+ // Set states for getAccessibleStateSet.
+ // This drived class additionaly sets
+ // FOCUSABLE(1) and FOCUSED(+)
+ virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
+
+ virtual void _InvalidateCursorPos();
+ virtual void _InvalidateFocus();
+
+ virtual ~SwAccessiblePage();
+
+public:
+ // convenience constructor to avoid typecast;
+ // may only be called with SwPageFrm argument
+ SwAccessiblePage( SwAccessibleMap* pInitMap, const SwFrm* pFrame );
+
+
+
+ //
+ // XAccessibleContext methods that need to be overridden
+ //
+
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //
+ // XServiceInfo
+ //
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService (
+ const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool HasCursor(); // required by map to remember that object
+};
+
+#endif
+
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
new file mode 100644
index 000000000000..ec8ab7a7c703
--- /dev/null
+++ b/sw/source/core/access/accpara.cxx
@@ -0,0 +1,2678 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <txtfrm.hxx>
+#include <flyfrm.hxx>
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <unotextrange.hxx>
+#include <unocrsrhelper.hxx>
+#include <crstate.hxx>
+#include <accmap.hxx>
+#include <fesh.hxx>
+#include <viewopt.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleTextType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
+#include <com/sun/star/i18n/WordType.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/beans/UnknownPropertyException.hpp>
+#include <breakit.hxx>
+#include <accpara.hxx>
+#include <access.hrc>
+#include <accportions.hxx>
+#include <sfx2/viewsh.hxx> // for ExecuteAtViewShell(...)
+#include <sfx2/viewfrm.hxx> // for ExecuteAtViewShell(...)
+#include <sfx2/dispatch.hxx> // for ExecuteAtViewShell(...)
+#include <unotools/charclass.hxx> // for GetWordBoundary
+// for get/setCharacterAttribute(...)
+#include <unocrsr.hxx>
+//#include <unoobj.hxx>
+#include <unoport.hxx>
+#include <doc.hxx>
+#include <crsskip.hxx>
+#include <txtatr.hxx>
+#include <acchyperlink.hxx>
+#include <acchypertextdata.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <comphelper/accessibletexthelper.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <editeng/brshitem.hxx>
+#include <viewimp.hxx>
+#include <boost/scoped_ptr.hpp>
+#include <textmarkuphelper.hxx>
+// --> OD 2010-02-22 #i10825#
+#include <parachangetrackinginfo.hxx>
+#include <com/sun/star/text/TextMarkupType.hpp>
+// <--
+// --> OD 2010-03-08 #i92233#
+#include <comphelper/stlunosequence.hxx>
+// <--
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using beans::PropertyValue;
+using beans::XMultiPropertySet;
+using beans::UnknownPropertyException;
+using beans::PropertyState_DIRECT_VALUE;
+
+using std::max;
+using std::min;
+using std::sort;
+
+namespace com { namespace sun { namespace star {
+ namespace text {
+ class XText;
+ }
+} } }
+
+
+const sal_Char sServiceName[] = "com.sun.star.text.AccessibleParagraphView";
+const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleParagraphView";
+const xub_StrLen MAX_DESC_TEXT_LEN = 40;
+const SwTxtNode* SwAccessibleParagraph::GetTxtNode() const
+{
+ const SwFrm* pFrm = GetFrm();
+ DBG_ASSERT( pFrm->IsTxtFrm(), "The text frame has mutated!" );
+
+ const SwTxtNode* pNode = static_cast<const SwTxtFrm*>(pFrm)->GetTxtNode();
+ DBG_ASSERT( pNode != NULL, "A text frame without a text node." );
+
+ return pNode;
+}
+
+::rtl::OUString SwAccessibleParagraph::GetString()
+{
+ return GetPortionData().GetAccessibleString();
+}
+
+::rtl::OUString SwAccessibleParagraph::GetDescription()
+{
+ // --> OD 2004-09-29 #117933# - provide empty description for paragraphs
+ return ::rtl::OUString();
+ // <--
+}
+
+sal_Int32 SwAccessibleParagraph::GetCaretPos()
+{
+ sal_Int32 nRet = -1;
+
+ // get the selection's point, and test whether it's in our node
+ // --> OD 2005-12-20 #i27301# - consider adjusted method signature
+ SwPaM* pCaret = GetCursor( false ); // caret is first PaM in PaM-ring
+ // <--
+ if( pCaret != NULL )
+ {
+ const SwTxtNode* pNode = GetTxtNode();
+
+ // check whether the point points into 'our' node
+ SwPosition* pPoint = pCaret->GetPoint();
+ if( pNode->GetIndex() == pPoint->nNode.GetIndex() )
+ {
+ // same node? Then check whether it's also within 'our' part
+ // of the paragraph
+ sal_uInt16 nIndex = pPoint->nContent.GetIndex();
+ if( GetPortionData().IsValidCorePosition( nIndex ) )
+ {
+ // Yes, it's us!
+ // --> OD 2006-10-19 #70538#
+ // consider that cursor/caret is in front of the list label
+ if ( pCaret->IsInFrontOfLabel() )
+ {
+ nRet = 0;
+ }
+ else
+ {
+ nRet = GetPortionData().GetAccessiblePosition( nIndex );
+ }
+ // <--
+
+ DBG_ASSERT( nRet >= 0, "invalid cursor?" );
+ DBG_ASSERT( nRet <= GetPortionData().GetAccessibleString().
+ getLength(), "invalid cursor?" );
+ }
+ // else: in this paragraph, but in different frame
+ }
+ // else: not in this paragraph
+ }
+ // else: no cursor -> no caret
+
+ return nRet;
+}
+
+sal_Bool SwAccessibleParagraph::GetSelection(
+ sal_Int32& nStart, sal_Int32& nEnd)
+{
+ sal_Bool bRet = sal_False;
+ nStart = -1;
+ nEnd = -1;
+
+ // get the selection, and test whether it affects our text node
+ // --> OD 2005-12-20 #i27301# - consider adjusted method signature
+ SwPaM* pCrsr = GetCursor( true );
+ // <--
+ if( pCrsr != NULL )
+ {
+ // get SwPosition for my node
+ const SwTxtNode* pNode = GetTxtNode();
+ sal_uLong nHere = pNode->GetIndex();
+
+ // iterate over ring
+ SwPaM* pRingStart = pCrsr;
+ do
+ {
+ // ignore, if no mark
+ if( pCrsr->HasMark() )
+ {
+ // check whether nHere is 'inside' pCrsr
+ SwPosition* pStart = pCrsr->Start();
+ sal_uLong nStartIndex = pStart->nNode.GetIndex();
+ SwPosition* pEnd = pCrsr->End();
+ sal_uLong nEndIndex = pEnd->nNode.GetIndex();
+ if( ( nHere >= nStartIndex ) &&
+ ( nHere <= nEndIndex ) )
+ {
+ // translate start and end positions
+
+ // start position
+ sal_Int32 nLocalStart = -1;
+ if( nHere > nStartIndex )
+ {
+ // selection starts in previous node:
+ // then our local selection starts with the paragraph
+ nLocalStart = 0;
+ }
+ else
+ {
+ DBG_ASSERT( nHere == nStartIndex,
+ "miscalculated index" );
+
+ // selection starts in this node:
+ // then check whether it's before or inside our part of
+ // the paragraph, and if so, get the proper position
+ sal_uInt16 nCoreStart = pStart->nContent.GetIndex();
+ if( nCoreStart <
+ GetPortionData().GetFirstValidCorePosition() )
+ {
+ nLocalStart = 0;
+ }
+ else if( nCoreStart <=
+ GetPortionData().GetLastValidCorePosition() )
+ {
+ DBG_ASSERT(
+ GetPortionData().IsValidCorePosition(
+ nCoreStart ),
+ "problem determining valid core position" );
+
+ nLocalStart =
+ GetPortionData().GetAccessiblePosition(
+ nCoreStart );
+ }
+ }
+
+ // end position
+ sal_Int32 nLocalEnd = -1;
+ if( nHere < nEndIndex )
+ {
+ // selection ends in following node:
+ // then our local selection extends to the end
+ nLocalEnd = GetPortionData().GetAccessibleString().
+ getLength();
+ }
+ else
+ {
+ DBG_ASSERT( nHere == nEndIndex,
+ "miscalculated index" );
+
+ // selection ends in this node: then select everything
+ // before our part of the node
+ sal_uInt16 nCoreEnd = pEnd->nContent.GetIndex();
+ if( nCoreEnd >
+ GetPortionData().GetLastValidCorePosition() )
+ {
+ // selection extends beyond out part of this para
+ nLocalEnd = GetPortionData().GetAccessibleString().
+ getLength();
+ }
+ else if( nCoreEnd >=
+ GetPortionData().GetFirstValidCorePosition() )
+ {
+ // selection is inside our part of this para
+ DBG_ASSERT(
+ GetPortionData().IsValidCorePosition(
+ nCoreEnd ),
+ "problem determining valid core position" );
+
+ nLocalEnd = GetPortionData().GetAccessiblePosition(
+ nCoreEnd );
+ }
+ }
+
+ if( ( nLocalStart != -1 ) && ( nLocalEnd != -1 ) )
+ {
+ nStart = nLocalStart;
+ nEnd = nLocalEnd;
+ bRet = sal_True;
+ }
+ }
+ // else: this PaM doesn't point to this paragraph
+ }
+ // else: this PaM is collapsed and doesn't select anything
+
+ // next PaM in ring
+ pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
+ }
+ while( !bRet && (pCrsr != pRingStart) );
+ }
+ // else: nocursor -> no selection
+
+ return bRet;
+}
+
+// --> OD 2005-12-20 #i27301# - new parameter <_bForSelection>
+SwPaM* SwAccessibleParagraph::GetCursor( const bool _bForSelection )
+{
+ // get the cursor shell; if we don't have any, we don't have a
+ // cursor/selection either
+ SwPaM* pCrsr = NULL;
+ SwCrsrShell* pCrsrShell = SwAccessibleParagraph::GetCrsrShell();
+ // --> OD 2005-12-20 #i27301#
+ // - if cursor is retrieved for selection, the cursors for a table selection
+ // has to be returned.
+ if ( pCrsrShell != NULL &&
+ ( _bForSelection || !pCrsrShell->IsTableMode() ) )
+ // <--
+ {
+ SwFEShell *pFESh = pCrsrShell->ISA( SwFEShell )
+ ? static_cast< SwFEShell * >( pCrsrShell ) : 0;
+ if( !pFESh ||
+ !(pFESh->IsFrmSelected() || pFESh->IsObjSelected() > 0) )
+ {
+ // get the selection, and test whether it affects our text node
+ pCrsr = pCrsrShell->GetCrsr( sal_False /* ??? */ );
+ }
+ }
+
+ return pCrsr;
+}
+
+sal_Bool SwAccessibleParagraph::IsHeading() const
+{
+ const SwTxtNode *pTxtNd = GetTxtNode();
+ return pTxtNd->IsOutline();
+}
+
+void SwAccessibleParagraph::GetStates(
+ ::utl::AccessibleStateSetHelper& rStateSet )
+{
+ SwAccessibleContext::GetStates( rStateSet );
+
+ // MULTILINE
+ rStateSet.AddState( AccessibleStateType::MULTI_LINE );
+
+ // MULTISELECTABLE
+ SwCrsrShell *pCrsrSh = GetCrsrShell();
+ if( pCrsrSh )
+ rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
+
+ // FOCUSABLE
+ if( pCrsrSh )
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ // FOCUSED (simulates node index of cursor)
+ // --> OD 2005-12-20 #i27301# - consider adjusted method signature
+ SwPaM* pCaret = GetCursor( false );
+ // <--
+ const SwTxtNode* pTxtNd = GetTxtNode();
+ if( pCaret != 0 && pTxtNd != 0 &&
+ pTxtNd->GetIndex() == pCaret->GetPoint()->nNode.GetIndex() &&
+ nOldCaretPos != -1)
+ {
+ Window *pWin = GetWindow();
+ if( pWin && pWin->HasFocus() )
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+ ::vos::ORef < SwAccessibleContext > xThis( this );
+ GetMap()->SetCursorContext( xThis );
+ }
+}
+
+void SwAccessibleParagraph::_InvalidateContent( sal_Bool bVisibleDataFired )
+{
+ ::rtl::OUString sOldText( GetString() );
+
+ ClearPortionData();
+
+ const ::rtl::OUString& rText = GetString();
+
+ if( rText != sOldText )
+ {
+ // The text is changed
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::TEXT_CHANGED;
+
+ // determine exact changes between sOldText and rText
+ comphelper::OCommonAccessibleText::implInitTextChangedEvent(
+ sOldText, rText,
+ aEvent.OldValue, aEvent.NewValue );
+
+ FireAccessibleEvent( aEvent );
+ }
+ else if( !bVisibleDataFired )
+ {
+ FireVisibleDataEvent();
+ }
+
+ sal_Bool bNewIsHeading = IsHeading();
+ sal_Bool bOldIsHeading;
+ {
+ vos::OGuard aGuard( aMutex );
+ bOldIsHeading = bIsHeading;
+ if( bIsHeading != bNewIsHeading )
+ bIsHeading = bNewIsHeading;
+ }
+
+
+ if( bNewIsHeading != bOldIsHeading || rText != sOldText )
+ {
+ ::rtl::OUString sNewDesc( GetDescription() );
+ ::rtl::OUString sOldDesc;
+ {
+ vos::OGuard aGuard( aMutex );
+ sOldDesc = sDesc;
+ if( sDesc != sNewDesc )
+ sDesc = sNewDesc;
+ }
+
+ if( sNewDesc != sOldDesc )
+ {
+ // The text is changed
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
+ aEvent.OldValue <<= sOldDesc;
+ aEvent.NewValue <<= sNewDesc;
+
+ FireAccessibleEvent( aEvent );
+ }
+ }
+}
+
+void SwAccessibleParagraph::_InvalidateCursorPos()
+{
+ // The text is changed
+ sal_Int32 nNew = GetCaretPos();
+ sal_Int32 nOld;
+ {
+ vos::OGuard aGuard( aMutex );
+ nOld = nOldCaretPos;
+ nOldCaretPos = nNew;
+ }
+ if( -1 != nNew )
+ {
+ // remember that object as the one that has the caret. This is
+ // neccessary to notify that object if the cursor leaves it.
+ ::vos::ORef < SwAccessibleContext > xThis( this );
+ GetMap()->SetCursorContext( xThis );
+ }
+
+ Window *pWin = GetWindow();
+ if( nOld != nNew )
+ {
+ // The cursor's node position is sumilated by the focus!
+ if( pWin && pWin->HasFocus() && -1 == nOld )
+ FireStateChangedEvent( AccessibleStateType::FOCUSED, sal_True );
+
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CARET_CHANGED;
+ aEvent.OldValue <<= nOld;
+ aEvent.NewValue <<= nNew;
+
+ FireAccessibleEvent( aEvent );
+
+ if( pWin && pWin->HasFocus() && -1 == nNew )
+ FireStateChangedEvent( AccessibleStateType::FOCUSED, sal_False );
+ }
+}
+
+void SwAccessibleParagraph::_InvalidateFocus()
+{
+ Window *pWin = GetWindow();
+ if( pWin )
+ {
+ sal_Int32 nPos;
+ {
+ vos::OGuard aGuard( aMutex );
+ nPos = nOldCaretPos;
+ }
+ ASSERT( nPos != -1, "focus object should be selected" );
+
+ FireStateChangedEvent( AccessibleStateType::FOCUSED,
+ pWin->HasFocus() && nPos != -1 );
+ }
+}
+
+SwAccessibleParagraph::SwAccessibleParagraph(
+ SwAccessibleMap& rInitMap,
+ const SwTxtFrm& rTxtFrm )
+ // --> OD 2010-02-24 #i108125#
+ : SwClient( const_cast<SwTxtNode*>(rTxtFrm.GetTxtNode()) )
+ // <--
+ , SwAccessibleContext( &rInitMap, AccessibleRole::PARAGRAPH, &rTxtFrm )
+ , sDesc()
+ , pPortionData( NULL )
+ , pHyperTextData( NULL )
+ , nOldCaretPos( -1 )
+ , bIsHeading( sal_False )
+ , aSelectionHelper( *this )
+ // --> OD 2010-02-19 #i108125#
+ , mpParaChangeTrackInfo( new SwParaChangeTrackingInfo( rTxtFrm ) )
+ // <--
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ bIsHeading = IsHeading();
+ // --> OD 2004-09-27 #117970# - set an empty accessibility name for paragraphs
+ SetName( ::rtl::OUString() );
+ // <--
+
+ // If this object has the focus, then it is remembered by the map itself.
+ nOldCaretPos = GetCaretPos();
+}
+
+SwAccessibleParagraph::~SwAccessibleParagraph()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ delete pPortionData;
+ delete pHyperTextData;
+ // --> OD 2010-02-22 #i108125#
+ delete mpParaChangeTrackInfo;
+ // <--
+}
+
+sal_Bool SwAccessibleParagraph::HasCursor()
+{
+ vos::OGuard aGuard( aMutex );
+ return nOldCaretPos != -1;
+}
+
+void SwAccessibleParagraph::UpdatePortionData()
+ throw( uno::RuntimeException )
+{
+ // obtain the text frame
+ DBG_ASSERT( GetFrm() != NULL, "The text frame has vanished!" );
+ DBG_ASSERT( GetFrm()->IsTxtFrm(), "The text frame has mutated!" );
+ const SwTxtFrm* pFrm = static_cast<const SwTxtFrm*>( GetFrm() );
+
+ // build new portion data
+ delete pPortionData;
+ pPortionData = new SwAccessiblePortionData(
+ pFrm->GetTxtNode(), GetMap()->GetShell()->GetViewOptions() );
+ pFrm->VisitPortions( *pPortionData );
+
+ DBG_ASSERT( pPortionData != NULL, "UpdatePortionData() failed" );
+}
+
+void SwAccessibleParagraph::ClearPortionData()
+{
+ delete pPortionData;
+ pPortionData = NULL;
+
+ delete pHyperTextData;
+ pHyperTextData = 0;
+}
+
+
+void SwAccessibleParagraph::ExecuteAtViewShell( sal_uInt16 nSlot )
+{
+ DBG_ASSERT( GetMap() != NULL, "no map?" );
+ ViewShell* pViewShell = GetMap()->GetShell();
+
+ DBG_ASSERT( pViewShell != NULL, "View shell exptected!" );
+ SfxViewShell* pSfxShell = pViewShell->GetSfxViewShell();
+
+ DBG_ASSERT( pSfxShell != NULL, "SfxViewShell shell exptected!" );
+ if( !pSfxShell )
+ return;
+
+ SfxViewFrame *pFrame = pSfxShell->GetViewFrame();
+ DBG_ASSERT( pFrame != NULL, "View frame exptected!" );
+ if( !pFrame )
+ return;
+
+ SfxDispatcher *pDispatcher = pFrame->GetDispatcher();
+ DBG_ASSERT( pDispatcher != NULL, "Dispatcher exptected!" );
+ if( !pDispatcher )
+ return;
+
+ pDispatcher->Execute( nSlot );
+}
+
+SwXTextPortion* SwAccessibleParagraph::CreateUnoPortion(
+ sal_Int32 nStartIndex,
+ sal_Int32 nEndIndex )
+{
+ DBG_ASSERT( (IsValidChar(nStartIndex, GetString().getLength()) &&
+ (nEndIndex == -1)) ||
+ IsValidRange(nStartIndex, nEndIndex, GetString().getLength()),
+ "please check parameters before calling this method" );
+
+ sal_uInt16 nStart = GetPortionData().GetModelPosition( nStartIndex );
+ sal_uInt16 nEnd = (nEndIndex == -1) ? (nStart + 1) :
+ GetPortionData().GetModelPosition( nEndIndex );
+
+ // create UNO cursor
+ SwTxtNode* pTxtNode = const_cast<SwTxtNode*>( GetTxtNode() );
+ SwIndex aIndex( pTxtNode, nStart );
+ SwPosition aStartPos( *pTxtNode, aIndex );
+ SwUnoCrsr* pUnoCursor = pTxtNode->GetDoc()->CreateUnoCrsr( aStartPos );
+ pUnoCursor->SetMark();
+ pUnoCursor->GetMark()->nContent = nEnd;
+
+ // create a (dummy) text portion to be returned
+ uno::Reference<text::XText> aEmpty;
+ SwXTextPortion* pPortion =
+ new SwXTextPortion ( pUnoCursor, aEmpty, PORTION_TEXT);
+ delete pUnoCursor;
+
+ return pPortion;
+}
+
+
+//
+// range checking for parameter
+//
+
+sal_Bool SwAccessibleParagraph::IsValidChar(
+ sal_Int32 nPos, sal_Int32 nLength)
+{
+ return (nPos >= 0) && (nPos < nLength);
+}
+
+sal_Bool SwAccessibleParagraph::IsValidPosition(
+ sal_Int32 nPos, sal_Int32 nLength)
+{
+ return (nPos >= 0) && (nPos <= nLength);
+}
+
+sal_Bool SwAccessibleParagraph::IsValidRange(
+ sal_Int32 nBegin, sal_Int32 nEnd, sal_Int32 nLength)
+{
+ return IsValidPosition(nBegin, nLength) && IsValidPosition(nEnd, nLength);
+}
+
+
+//
+// text boundaries
+//
+
+
+sal_Bool SwAccessibleParagraph::GetCharBoundary(
+ i18n::Boundary& rBound,
+ const ::rtl::OUString&,
+ sal_Int32 nPos )
+{
+ rBound.startPos = nPos;
+ rBound.endPos = nPos+1;
+ return sal_True;
+}
+
+sal_Bool SwAccessibleParagraph::GetWordBoundary(
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
+ sal_Int32 nPos )
+{
+ sal_Bool bRet = sal_False;
+
+ // now ask the Break-Iterator for the word
+ DBG_ASSERT( pBreakIt != NULL, "We always need a break." );
+ DBG_ASSERT( pBreakIt->GetBreakIter().is(), "No break-iterator." );
+ if( pBreakIt->GetBreakIter().is() )
+ {
+ // get locale for this position
+ sal_uInt16 nModelPos = GetPortionData().GetModelPosition( nPos );
+ lang::Locale aLocale = pBreakIt->GetLocale(
+ GetTxtNode()->GetLang( nModelPos ) );
+
+ // which type of word are we interested in?
+ // (DICTIONARY_WORD includes punctuation, ANY_WORD doesn't.)
+ const sal_uInt16 nWordType = i18n::WordType::ANY_WORD;
+
+ // get word boundary, as the Break-Iterator sees fit.
+ rBound = pBreakIt->GetBreakIter()->getWordBoundary(
+ rText, nPos, aLocale, nWordType, sal_True );
+
+ // It's a word if the first character is an alpha-numeric character.
+ bRet = GetAppCharClass().isLetterNumeric(
+ rText.getStr()[ rBound.startPos ] );
+ }
+ else
+ {
+ // no break Iterator -> no word
+ rBound.startPos = nPos;
+ rBound.endPos = nPos;
+ }
+
+ return bRet;
+}
+
+sal_Bool SwAccessibleParagraph::GetSentenceBoundary(
+ i18n::Boundary& rBound,
+ const ::rtl::OUString&,
+ sal_Int32 nPos )
+{
+ GetPortionData().GetSentenceBoundary( rBound, nPos );
+ return sal_True;
+}
+
+sal_Bool SwAccessibleParagraph::GetLineBoundary(
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
+ sal_Int32 nPos )
+{
+ if( rText.getLength() == nPos )
+ GetPortionData().GetLastLineBoundary( rBound );
+ else
+ GetPortionData().GetLineBoundary( rBound, nPos );
+ return sal_True;
+}
+
+sal_Bool SwAccessibleParagraph::GetParagraphBoundary(
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
+ sal_Int32 )
+{
+ rBound.startPos = 0;
+ rBound.endPos = rText.getLength();
+ return sal_True;
+}
+
+sal_Bool SwAccessibleParagraph::GetAttributeBoundary(
+ i18n::Boundary& rBound,
+ const ::rtl::OUString&,
+ sal_Int32 nPos )
+{
+ GetPortionData().GetAttributeBoundary( rBound, nPos );
+ return sal_True;
+}
+
+sal_Bool SwAccessibleParagraph::GetGlyphBoundary(
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
+ sal_Int32 nPos )
+{
+ sal_Bool bRet = sal_False;
+
+ // ask the Break-Iterator for the glyph by moving one cell
+ // forward, and then one cell back
+ DBG_ASSERT( pBreakIt != NULL, "We always need a break." );
+ DBG_ASSERT( pBreakIt->GetBreakIter().is(), "No break-iterator." );
+ if( pBreakIt->GetBreakIter().is() )
+ {
+ // get locale for this position
+ sal_uInt16 nModelPos = GetPortionData().GetModelPosition( nPos );
+ lang::Locale aLocale = pBreakIt->GetLocale(
+ GetTxtNode()->GetLang( nModelPos ) );
+
+ // get word boundary, as the Break-Iterator sees fit.
+ const sal_uInt16 nIterMode = i18n::CharacterIteratorMode::SKIPCELL;
+ sal_Int32 nDone = 0;
+ rBound.endPos = pBreakIt->GetBreakIter()->nextCharacters(
+ rText, nPos, aLocale, nIterMode, 1, nDone );
+ rBound.startPos = pBreakIt->GetBreakIter()->previousCharacters(
+ rText, rBound.endPos, aLocale, nIterMode, 1, nDone );
+
+ DBG_ASSERT( rBound.startPos <= nPos, "start pos too high" );
+ DBG_ASSERT( rBound.endPos >= nPos, "end pos too low" );
+ }
+ else
+ {
+ // no break Iterator -> no glyph
+ rBound.startPos = nPos;
+ rBound.endPos = nPos;
+ }
+
+ return bRet;
+}
+
+
+sal_Bool SwAccessibleParagraph::GetTextBoundary(
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
+ sal_Int32 nPos,
+ sal_Int16 nTextType )
+ throw (
+ lang::IndexOutOfBoundsException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ // error checking
+ if( !( AccessibleTextType::LINE == nTextType
+ ? IsValidPosition( nPos, rText.getLength() )
+ : IsValidChar( nPos, rText.getLength() ) ) )
+ throw lang::IndexOutOfBoundsException();
+
+ sal_Bool bRet;
+
+ switch( nTextType )
+ {
+ case AccessibleTextType::WORD:
+ bRet = GetWordBoundary( rBound, rText, nPos );
+ break;
+
+ case AccessibleTextType::SENTENCE:
+ bRet = GetSentenceBoundary( rBound, rText, nPos );
+ break;
+
+ case AccessibleTextType::PARAGRAPH:
+ bRet = GetParagraphBoundary( rBound, rText, nPos );
+ break;
+
+ case AccessibleTextType::CHARACTER:
+ bRet = GetCharBoundary( rBound, rText, nPos );
+ break;
+
+ case AccessibleTextType::LINE:
+ bRet = GetLineBoundary( rBound, rText, nPos );
+ break;
+
+ case AccessibleTextType::ATTRIBUTE_RUN:
+ bRet = GetAttributeBoundary( rBound, rText, nPos );
+ break;
+
+ case AccessibleTextType::GLYPH:
+ bRet = GetGlyphBoundary( rBound, rText, nPos );
+ break;
+
+ default:
+ throw lang::IllegalArgumentException( );
+ }
+
+ return bRet;
+}
+
+::rtl::OUString SAL_CALL SwAccessibleParagraph::getAccessibleDescription (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext );
+
+ vos::OGuard aGuard2( aMutex );
+ if( !sDesc.getLength() )
+ sDesc = GetDescription();
+
+ return sDesc;
+}
+
+lang::Locale SAL_CALL SwAccessibleParagraph::getLocale (void)
+ throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTxtFrm *pTxtFrm = PTR_CAST( SwTxtFrm, GetFrm() );
+ if( !pTxtFrm )
+ {
+ THROW_RUNTIME_EXCEPTION( XAccessibleContext, "internal error (no text frame)" );
+ }
+
+ const SwTxtNode *pTxtNd = pTxtFrm->GetTxtNode();
+ lang::Locale aLoc( pBreakIt->GetLocale( pTxtNd->GetLang( 0 ) ) );
+
+ return aLoc;
+}
+
+/** paragraphs are in relation CONTENT_FLOWS_FROM and/or CONTENT_FLOWS_TO
+
+ OD 2005-12-02 #i27138#
+
+ @author OD
+*/
+uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleParagraph::getAccessibleRelationSet()
+ throw ( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleContext );
+
+ utl::AccessibleRelationSetHelper* pHelper = new utl::AccessibleRelationSetHelper();
+
+ const SwTxtFrm* pTxtFrm = dynamic_cast<const SwTxtFrm*>(GetFrm());
+ ASSERT( pTxtFrm,
+ "<SwAccessibleParagraph::getAccessibleRelationSet()> - missing text frame");
+ if ( pTxtFrm )
+ {
+ const SwCntntFrm* pPrevCntFrm( pTxtFrm->FindPrevCnt( true ) );
+ if ( pPrevCntFrm )
+ {
+ uno::Sequence< uno::Reference<XInterface> > aSequence(1);
+ aSequence[0] = GetMap()->GetContext( pPrevCntFrm );
+ AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_FROM,
+ aSequence );
+ pHelper->AddRelation( aAccRel );
+ }
+
+ const SwCntntFrm* pNextCntFrm( pTxtFrm->FindNextCnt( true ) );
+ if ( pNextCntFrm )
+ {
+ uno::Sequence< uno::Reference<XInterface> > aSequence(1);
+ aSequence[0] = GetMap()->GetContext( pNextCntFrm );
+ AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_TO,
+ aSequence );
+ pHelper->AddRelation( aAccRel );
+ }
+ }
+
+ return pHelper;
+}
+
+void SAL_CALL SwAccessibleParagraph::grabFocus()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext );
+
+ // get cursor shell
+ SwCrsrShell *pCrsrSh = GetCrsrShell();
+ // --> OD 2005-12-20 #i27301# - consider new method signature
+ SwPaM *pCrsr = GetCursor( false );
+ // <--
+ const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>( GetFrm() );
+ const SwTxtNode* pTxtNd = pTxtFrm->GetTxtNode();
+
+ if( pCrsrSh != 0 && pTxtNd != 0 &&
+ ( pCrsr == 0 ||
+ pCrsr->GetPoint()->nNode.GetIndex() != pTxtNd->GetIndex() ||
+ !pTxtFrm->IsInside( pCrsr->GetPoint()->nContent.GetIndex()) ) )
+ {
+ // create pam for selection
+ SwIndex aIndex( const_cast< SwTxtNode * >( pTxtNd ),
+ pTxtFrm->GetOfst() );
+ SwPosition aStartPos( *pTxtNd, aIndex );
+ SwPaM aPaM( aStartPos );
+
+ // set PaM at cursor shell
+ Select( aPaM );
+
+
+ }
+
+ /* ->#i13955# */
+ Window * pWindow = GetWindow();
+
+ if (pWindow != NULL)
+ pWindow->GrabFocus();
+ /* <-#i13955# */
+}
+
+// --> OD 2007-01-17 #i71385#
+bool lcl_GetBackgroundColor( Color & rColor,
+ const SwFrm* pFrm,
+ SwCrsrShell* pCrsrSh )
+{
+ const SvxBrushItem* pBackgrdBrush = 0;
+ const Color* pSectionTOXColor = 0;
+ SwRect aDummyRect;
+ if ( pFrm &&
+ pFrm->GetBackgroundBrush( pBackgrdBrush, pSectionTOXColor, aDummyRect, false ) )
+ {
+ if ( pSectionTOXColor )
+ {
+ rColor = *pSectionTOXColor;
+ return true;
+ }
+ else
+ {
+ rColor = pBackgrdBrush->GetColor();
+ return true;
+ }
+ }
+ else if ( pCrsrSh )
+ {
+ rColor = pCrsrSh->Imp()->GetRetoucheColor();
+ return true;
+ }
+
+ return false;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getForeground()
+ throw (uno::RuntimeException)
+{
+ Color aBackgroundCol;
+
+ if ( lcl_GetBackgroundColor( aBackgroundCol, GetFrm(), GetCrsrShell() ) )
+ {
+ if ( aBackgroundCol.IsDark() )
+ {
+ return COL_WHITE;
+ }
+ else
+ {
+ return COL_BLACK;
+ }
+ }
+
+ return SwAccessibleContext::getForeground();
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getBackground()
+ throw (uno::RuntimeException)
+{
+ Color aBackgroundCol;
+
+ if ( lcl_GetBackgroundColor( aBackgroundCol, GetFrm(), GetCrsrShell() ) )
+ {
+ return aBackgroundCol.GetColor();
+ }
+
+ return SwAccessibleContext::getBackground();
+}
+// <--
+
+::rtl::OUString SAL_CALL SwAccessibleParagraph::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
+}
+
+sal_Bool SAL_CALL SwAccessibleParagraph::supportsService(
+ const ::rtl::OUString& sTestServiceName)
+ throw (uno::RuntimeException)
+{
+ return sTestServiceName.equalsAsciiL( sServiceName,
+ sizeof(sServiceName)-1 ) ||
+ sTestServiceName.equalsAsciiL( sAccessibleServiceName,
+ sizeof(sAccessibleServiceName)-1 );
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SwAccessibleParagraph::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aRet(2);
+ ::rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
+ pArray[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ return aRet;
+}
+
+//
+//===== XInterface =======================================================
+//
+
+uno::Any SwAccessibleParagraph::queryInterface( const uno::Type& rType )
+ throw (uno::RuntimeException)
+{
+ uno::Any aRet;
+ if ( rType == ::getCppuType((uno::Reference<XAccessibleText> *)0) )
+ {
+ uno::Reference<XAccessibleText> aAccText = (XAccessibleText *) *this; // resolve ambiguity
+ aRet <<= aAccText;
+ }
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleEditableText> *)0) )
+ {
+ uno::Reference<XAccessibleEditableText> aAccEditText = this;
+ aRet <<= aAccEditText;
+ }
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleSelection> *)0) )
+ {
+ uno::Reference<XAccessibleSelection> aAccSel = this;
+ aRet <<= aAccSel;
+ }
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleHypertext> *)0) )
+ {
+ uno::Reference<XAccessibleHypertext> aAccHyp = this;
+ aRet <<= aAccHyp;
+ }
+ // --> OD 2006-07-13 #i63870#
+ // add interface com::sun:star:accessibility::XAccessibleTextAttributes
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleTextAttributes> *)0) )
+ {
+ uno::Reference<XAccessibleTextAttributes> aAccTextAttr = this;
+ aRet <<= aAccTextAttr;
+ }
+ // <--
+ // --> OD 2008-06-10 #i89175#
+ // add interface com::sun:star:accessibility::XAccessibleTextMarkup
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleTextMarkup> *)0) )
+ {
+ uno::Reference<XAccessibleTextMarkup> aAccTextMarkup = this;
+ aRet <<= aAccTextMarkup;
+ }
+ // add interface com::sun:star:accessibility::XAccessibleMultiLineText
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleMultiLineText> *)0) )
+ {
+ uno::Reference<XAccessibleMultiLineText> aAccMultiLineText = this;
+ aRet <<= aAccMultiLineText;
+ }
+ // <--
+ else
+ {
+ aRet = SwAccessibleContext::queryInterface(rType);
+ }
+
+ return aRet;
+}
+
+//====== XTypeProvider ====================================================
+uno::Sequence< uno::Type > SAL_CALL SwAccessibleParagraph::getTypes() throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() );
+
+ sal_Int32 nIndex = aTypes.getLength();
+ // --> OD 2006-07-13 #i63870#
+ // add type accessibility::XAccessibleTextAttributes
+ // --> OD 2008-06-10 #i89175#
+ // add type accessibility::XAccessibleTextMarkup and accessibility::XAccessibleMultiLineText
+ aTypes.realloc( nIndex + 6 );
+
+ uno::Type* pTypes = aTypes.getArray();
+ pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleEditableText > * >( 0 ) );
+ pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleTextAttributes > * >( 0 ) );
+ pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) );
+ pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleTextMarkup > * >( 0 ) );
+ pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleMultiLineText > * >( 0 ) );
+ pTypes[nIndex] = ::getCppuType( static_cast< uno::Reference< XAccessibleHypertext > * >( 0 ) );
+ // <--
+
+ return aTypes;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleParagraph::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+
+//
+//===== XAccesibleText ===================================================
+//
+
+sal_Int32 SwAccessibleParagraph::getCaretPosition()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ sal_Int32 nRet = GetCaretPos();
+ {
+ vos::OGuard aOldCaretPosGuard( aMutex );
+ ASSERT( nRet == nOldCaretPos, "caret pos out of sync" );
+ nOldCaretPos = nRet;
+ }
+ if( -1 != nRet )
+ {
+ ::vos::ORef < SwAccessibleContext > xThis( this );
+ GetMap()->SetCursorContext( xThis );
+ }
+
+ return nRet;
+}
+
+sal_Bool SAL_CALL SwAccessibleParagraph::setCaretPosition( sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ // parameter checking
+ sal_Int32 nLength = GetString().getLength();
+ if ( ! IsValidPosition( nIndex, nLength ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ sal_Bool bRet = sal_False;
+
+ // get cursor shell
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL )
+ {
+ // create pam for selection
+ SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() );
+ SwIndex aIndex( pNode, GetPortionData().GetModelPosition(nIndex));
+ SwPosition aStartPos( *pNode, aIndex );
+ SwPaM aPaM( aStartPos );
+
+ // set PaM at cursor shell
+ bRet = Select( aPaM );
+ }
+
+ return bRet;
+}
+
+sal_Unicode SwAccessibleParagraph::getCharacter( sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ ::rtl::OUString sText( GetString() );
+
+ // return character (if valid)
+ if( IsValidChar(nIndex, sText.getLength() ) )
+ {
+ return sText.getStr()[nIndex];
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+}
+
+// --> OD 2006-07-20 #i63870#
+// re-implement method on behalf of methods <_getDefaultAttributesImpl(..)> and
+// <_getRunAttributesImpl(..)>
+uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
+ sal_Int32 nIndex,
+ const uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ const ::rtl::OUString& rText = GetString();
+
+ if( ! IsValidChar( nIndex, rText.getLength() ) )
+ throw lang::IndexOutOfBoundsException();
+
+ // retrieve default character attributes
+ tAccParaPropValMap aDefAttrSeq;
+ _getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq, true );
+
+ // retrieved run character attributes
+ tAccParaPropValMap aRunAttrSeq;
+ _getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq );
+
+ // merge default and run attributes
+ uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
+ PropertyValue* pValues = aValues.getArray();
+ sal_Int32 i = 0;
+ for ( tAccParaPropValMap::const_iterator aDefIter = aDefAttrSeq.begin();
+ aDefIter != aDefAttrSeq.end();
+ ++aDefIter )
+ {
+ tAccParaPropValMap::const_iterator aRunIter =
+ aRunAttrSeq.find( aDefIter->first );
+ if ( aRunIter != aRunAttrSeq.end() )
+ {
+ pValues[i] = aRunIter->second;
+ }
+ else
+ {
+ pValues[i] = aDefIter->second;
+ }
+ ++i;
+ }
+
+// // create a (dummy) text portion for the sole purpose of calling
+// // getPropertyValues on it
+// Reference<XMultiPropertySet> xPortion = CreateUnoPortion( nIndex, nIndex + 1 );
+
+// // get values
+// Sequence<OUString> aNames = getAttributeNames();
+// sal_Int32 nLength = aNames.getLength();
+// Sequence<Any> aAnys( nLength );
+// aAnys = xPortion->getPropertyValues( aNames );
+
+// // copy names + anys into return sequence
+// Sequence<PropertyValue> aValues( aNames.getLength() );
+// const OUString* pNames = aNames.getConstArray();
+// const Any* pAnys = aAnys.getConstArray();
+// PropertyValue* pValues = aValues.getArray();
+// for( sal_Int32 i = 0; i < nLength; i++ )
+// {
+// PropertyValue& rValue = pValues[i];
+// rValue.Name = pNames[i];
+// rValue.Value = pAnys[i];
+// rValue.Handle = -1; // handle not supported
+// rValue.State = PropertyState_DIRECT_VALUE; // states not supported
+// }
+
+// // adjust background color if we're in a gray portion
+// DBG_ASSERT( pValues[CHAR_BACK_COLOR_POS].Name.
+// equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("CharBackColor")),
+// "Please adjust CHAR_BACK_COLOR_POS constant." );
+// if( GetPortionData().IsInGrayPortion( nIndex ) )
+// pValues[CHAR_BACK_COLOR_POS].Value <<= SwViewOption::GetFieldShadingsColor().GetColor();
+
+ return aValues;
+}
+
+// --> OD 2006-07-11 #i63870#
+void SwAccessibleParagraph::_getDefaultAttributesImpl(
+ const uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
+ tAccParaPropValMap& rDefAttrSeq,
+ const bool bOnlyCharAttrs )
+{
+ // retrieve default attributes
+ const SwTxtNode* pTxtNode( GetTxtNode() );
+ ::boost::scoped_ptr<SfxItemSet> pSet;
+ if ( !bOnlyCharAttrs )
+ {
+ pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTxtNode->GetDoc()->GetAttrPool()),
+ RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
+ RES_PARATR_BEGIN, RES_PARATR_END - 1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
+ 0 ) );
+ }
+ else
+ {
+ pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTxtNode->GetDoc()->GetAttrPool()),
+ RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
+ 0 ) );
+ }
+ // --> OD 2007-11-12 #i82637#
+ // From the perspective of the a11y API the default character attributes
+ // are the character attributes, which are set at the paragraph style
+ // of the paragraph. The character attributes set at the automatic paragraph
+ // style of the paragraph are treated as run attributes.
+// pTxtNode->SwCntntNode::GetAttr( *pSet );
+ // get default paragraph attributes, if needed, and merge these into <pSet>
+ if ( !bOnlyCharAttrs )
+ {
+ SfxItemSet aParaSet( const_cast<SwAttrPool&>(pTxtNode->GetDoc()->GetAttrPool()),
+ RES_PARATR_BEGIN, RES_PARATR_END - 1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
+ 0 );
+ pTxtNode->SwCntntNode::GetAttr( aParaSet );
+ pSet->Put( aParaSet );
+ }
+ // get default character attributes and merge these into <pSet>
+ ASSERT( pTxtNode->GetTxtColl(),
+ "<SwAccessibleParagraph::_getDefaultAttributesImpl(..)> - missing paragraph style. Serious defect, please inform OD!" );
+ if ( pTxtNode->GetTxtColl() )
+ {
+ SfxItemSet aCharSet( const_cast<SwAttrPool&>(pTxtNode->GetDoc()->GetAttrPool()),
+ RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
+ 0 );
+ aCharSet.Put( pTxtNode->GetTxtColl()->GetAttrSet() );
+ pSet->Put( aCharSet );
+ }
+ // <--
+
+ // build-up sequence containing the run attributes <rDefAttrSeq>
+ tAccParaPropValMap aDefAttrSeq;
+ {
+ const SfxItemPropertyMap* pPropMap =
+ aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_CURSOR )->getPropertyMap();
+ PropertyEntryVector_t aPropertyEntries = pPropMap->getPropertyEntries();
+ PropertyEntryVector_t::const_iterator aPropIt = aPropertyEntries.begin();
+ while ( aPropIt != aPropertyEntries.end() )
+ {
+ const SfxPoolItem* pItem = pSet->GetItem( aPropIt->nWID );
+ if ( pItem )
+ {
+ uno::Any aVal;
+ pItem->QueryValue( aVal, aPropIt->nMemberId );
+
+ PropertyValue rPropVal;
+ rPropVal.Name = aPropIt->sName;
+ rPropVal.Value = aVal;
+ rPropVal.Handle = -1;
+ rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
+
+ aDefAttrSeq[rPropVal.Name] = rPropVal;
+ }
+ ++aPropIt;
+ }
+
+ // --> OD 2007-01-15 #i72800#
+ // add property value entry for the paragraph style
+ if ( !bOnlyCharAttrs && pTxtNode->GetTxtColl() )
+ {
+ const ::rtl::OUString sParaStyleName =
+ ::rtl::OUString::createFromAscii(
+ GetPropName( UNO_NAME_PARA_STYLE_NAME ).pName );
+ if ( aDefAttrSeq.find( sParaStyleName ) == aDefAttrSeq.end() )
+ {
+ PropertyValue rPropVal;
+ rPropVal.Name = sParaStyleName;
+ uno::Any aVal( uno::makeAny( ::rtl::OUString( pTxtNode->GetTxtColl()->GetName() ) ) );
+ rPropVal.Value = aVal;
+ rPropVal.Handle = -1;
+ rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
+
+ aDefAttrSeq[rPropVal.Name] = rPropVal;
+ }
+ }
+ // <--
+
+ // --> OD 2007-01-15 #i73371#
+ // resolve value text::WritingMode2::PAGE of property value entry WritingMode
+ if ( !bOnlyCharAttrs && GetFrm() )
+ {
+ const ::rtl::OUString sWritingMode =
+ ::rtl::OUString::createFromAscii(
+ GetPropName( UNO_NAME_WRITING_MODE ).pName );
+ tAccParaPropValMap::iterator aIter = aDefAttrSeq.find( sWritingMode );
+ if ( aIter != aDefAttrSeq.end() )
+ {
+ PropertyValue rPropVal( aIter->second );
+ sal_Int16 nVal = rPropVal.Value.get<sal_Int16>();
+ if ( nVal == text::WritingMode2::PAGE )
+ {
+ const SwFrm* pUpperFrm( GetFrm()->GetUpper() );
+ while ( pUpperFrm )
+ {
+ if ( pUpperFrm->GetType() &
+ ( FRM_PAGE | FRM_FLY | FRM_SECTION | FRM_TAB | FRM_CELL ) )
+ {
+ if ( pUpperFrm->IsVertical() )
+ {
+ nVal = text::WritingMode2::TB_RL;
+ }
+ else if ( pUpperFrm->IsRightToLeft() )
+ {
+ nVal = text::WritingMode2::RL_TB;
+ }
+ else
+ {
+ nVal = text::WritingMode2::LR_TB;
+ }
+ rPropVal.Value <<= nVal;
+ aDefAttrSeq[rPropVal.Name] = rPropVal;
+ break;
+ }
+
+ if ( dynamic_cast<const SwFlyFrm*>(pUpperFrm) )
+ {
+ pUpperFrm = dynamic_cast<const SwFlyFrm*>(pUpperFrm)->GetAnchorFrm();
+ }
+ else
+ {
+ pUpperFrm = pUpperFrm->GetUpper();
+ }
+ }
+ }
+ }
+ }
+ // <--
+ }
+
+ if ( aRequestedAttributes.getLength() == 0 )
+ {
+ rDefAttrSeq = aDefAttrSeq;
+ }
+ else
+ {
+ const ::rtl::OUString* pReqAttrs = aRequestedAttributes.getConstArray();
+ const sal_Int32 nLength = aRequestedAttributes.getLength();
+ for( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ tAccParaPropValMap::const_iterator const aIter = aDefAttrSeq.find( pReqAttrs[i] );
+ if ( aIter != aDefAttrSeq.end() )
+ {
+ rDefAttrSeq[ aIter->first ] = aIter->second;
+ }
+ }
+ }
+}
+
+uno::Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
+ const uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
+ throw ( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ tAccParaPropValMap aDefAttrSeq;
+ _getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq );
+
+ // --> OD 2010-03-08 #i92233#
+ static rtl::OUString sMMToPixelRatio( rtl::OUString::createFromAscii( "MMToPixelRatio" ) );
+ bool bProvideMMToPixelRatio( false );
+ {
+ if ( aRequestedAttributes.getLength() == 0 )
+ {
+ bProvideMMToPixelRatio = true;
+ }
+ else
+ {
+ const rtl::OUString* aRequestedAttrIter =
+ ::std::find( ::comphelper::stl_begin( aRequestedAttributes ),
+ ::comphelper::stl_end( aRequestedAttributes ),
+ sMMToPixelRatio );
+ if ( aRequestedAttrIter != ::comphelper::stl_end( aRequestedAttributes ) )
+ {
+ bProvideMMToPixelRatio = true;
+ }
+ }
+ }
+ // <--
+
+ uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() +
+ ( bProvideMMToPixelRatio ? 1 : 0 ) );
+ PropertyValue* pValues = aValues.getArray();
+ sal_Int32 i = 0;
+ for ( tAccParaPropValMap::const_iterator aIter = aDefAttrSeq.begin();
+ aIter != aDefAttrSeq.end();
+ ++aIter )
+ {
+ pValues[i] = aIter->second;
+ ++i;
+ }
+
+ // --> OD 2010-03-08 #i92233#
+ if ( bProvideMMToPixelRatio )
+ {
+ PropertyValue rPropVal;
+ rPropVal.Name = sMMToPixelRatio;
+ const Size a100thMMSize( 1000, 1000 );
+ const Size aPixelSize = GetMap()->LogicToPixel( a100thMMSize );
+ const float fRatio = ((float)a100thMMSize.Width()/100)/aPixelSize.Width();
+ rPropVal.Value = uno::makeAny( fRatio );
+ rPropVal.Handle = -1;
+ rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
+ pValues[ aValues.getLength() - 1 ] = rPropVal;
+ }
+ // <--
+
+ return aValues;
+}
+
+void SwAccessibleParagraph::_getRunAttributesImpl(
+ const sal_Int32 nIndex,
+ const uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
+ tAccParaPropValMap& rRunAttrSeq )
+{
+ // create PaM for character at position <nIndex>
+ SwPaM* pPaM( 0 );
+ {
+ const SwTxtNode* pTxtNode( GetTxtNode() );
+ SwPosition* pStartPos = new SwPosition( *pTxtNode );
+ pStartPos->nContent.Assign( const_cast<SwTxtNode*>(pTxtNode), static_cast<sal_uInt16>(nIndex) );
+ SwPosition* pEndPos = new SwPosition( *pTxtNode );
+ pEndPos->nContent.Assign( const_cast<SwTxtNode*>(pTxtNode), static_cast<sal_uInt16>(nIndex+1) );
+
+ pPaM = new SwPaM( *pStartPos, *pEndPos );
+
+ delete pStartPos;
+ delete pEndPos;
+ }
+
+ // retrieve character attributes for the created PaM <pPaM>
+ SfxItemSet aSet( pPaM->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END -1,
+ 0 );
+ // --> OD 2007-11-12 #i82637#
+ // From the perspective of the a11y API the character attributes, which
+ // are set at the automatic paragraph style of the paragraph are treated
+ // as run attributes.
+// SwXTextCursor::GetCrsrAttr( *pPaM, aSet, sal_True, sal_True );
+ // get character attributes from automatic paragraph style and merge these into <aSet>
+ {
+ const SwTxtNode* pTxtNode( GetTxtNode() );
+ if ( pTxtNode->HasSwAttrSet() )
+ {
+ SfxItemSet aAutomaticParaStyleCharAttrs( pPaM->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END -1,
+ 0 );
+ aAutomaticParaStyleCharAttrs.Put( *(pTxtNode->GetpSwAttrSet()), sal_False );
+ aSet.Put( aAutomaticParaStyleCharAttrs );
+ }
+ }
+ // get character attributes at <pPaM> and merge these into <aSet>
+ {
+ SfxItemSet aCharAttrsAtPaM( pPaM->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END -1,
+ 0 );
+ SwUnoCursorHelper::GetCrsrAttr(*pPaM, aCharAttrsAtPaM, sal_True, sal_True);
+ aSet.Put( aCharAttrsAtPaM );
+ }
+ // <--
+
+ // build-up sequence containing the run attributes <rRunAttrSeq>
+ {
+ tAccParaPropValMap aRunAttrSeq;
+ {
+ // --> OD 2007-11-12 #i82637#
+ tAccParaPropValMap aDefAttrSeq;
+ uno::Sequence< ::rtl::OUString > aDummy;
+ _getDefaultAttributesImpl( aDummy, aDefAttrSeq, true );
+ // <--
+
+ const SfxItemPropertyMap* pPropMap =
+ aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_CURSOR )->getPropertyMap();
+ PropertyEntryVector_t aPropertyEntries = pPropMap->getPropertyEntries();
+ PropertyEntryVector_t::const_iterator aPropIt = aPropertyEntries.begin();
+ while ( aPropIt != aPropertyEntries.end() )
+ {
+ const SfxPoolItem* pItem( 0 );
+ // --> OD 2007-11-12 #i82637#
+ // Found character attributes, whose value equals the value of
+ // the corresponding default character attributes, are excluded.
+ if ( aSet.GetItemState( aPropIt->nWID, sal_True, &pItem ) == SFX_ITEM_SET )
+ {
+ uno::Any aVal;
+ pItem->QueryValue( aVal, aPropIt->nMemberId );
+
+ PropertyValue rPropVal;
+ rPropVal.Name = aPropIt->sName;
+ rPropVal.Value = aVal;
+ rPropVal.Handle = -1;
+ rPropVal.State = PropertyState_DIRECT_VALUE;
+
+ tAccParaPropValMap::const_iterator aDefIter =
+ aDefAttrSeq.find( rPropVal.Name );
+ if ( aDefIter == aDefAttrSeq.end() ||
+ rPropVal.Value != aDefIter->second.Value )
+ {
+ aRunAttrSeq[rPropVal.Name] = rPropVal;
+ }
+ }
+
+ ++aPropIt;
+ }
+ }
+
+ if ( aRequestedAttributes.getLength() == 0 )
+ {
+ rRunAttrSeq = aRunAttrSeq;
+ }
+ else
+ {
+ const ::rtl::OUString* pReqAttrs = aRequestedAttributes.getConstArray();
+ const sal_Int32 nLength = aRequestedAttributes.getLength();
+ for( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ tAccParaPropValMap::iterator aIter = aRunAttrSeq.find( pReqAttrs[i] );
+ if ( aIter != aRunAttrSeq.end() )
+ {
+ rRunAttrSeq[ (*aIter).first ] = (*aIter).second;
+ }
+ }
+ }
+ }
+
+ delete pPaM;
+}
+
+uno::Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
+ sal_Int32 nIndex,
+ const uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ {
+ const ::rtl::OUString& rText = GetString();
+ if ( !IsValidChar( nIndex, rText.getLength() ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+ }
+
+ tAccParaPropValMap aRunAttrSeq;
+ _getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq );
+
+ uno::Sequence< PropertyValue > aValues( aRunAttrSeq.size() );
+ PropertyValue* pValues = aValues.getArray();
+ sal_Int32 i = 0;
+ for ( tAccParaPropValMap::const_iterator aIter = aRunAttrSeq.begin();
+ aIter != aRunAttrSeq.end();
+ ++aIter )
+ {
+ pValues[i] = aIter->second;
+ ++i;
+ }
+
+ return aValues;
+}
+// <--
+
+awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
+ sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+
+ /* #i12332# The position after the string needs special treatment.
+ IsValidChar -> IsValidPosition
+ */
+ if( ! (IsValidPosition( nIndex, GetString().getLength() ) ) )
+ throw lang::IndexOutOfBoundsException();
+
+ /* #i12332# */
+ sal_Bool bBehindText = sal_False;
+ if ( nIndex == GetString().getLength() )
+ bBehindText = sal_True;
+
+ // get model position & prepare GetCharRect() arguments
+ SwCrsrMoveState aMoveState;
+ aMoveState.bRealHeight = sal_True;
+ aMoveState.bRealWidth = sal_True;
+ SwSpecialPos aSpecialPos;
+ SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() );
+
+ sal_uInt16 nPos = 0;
+
+ /* #i12332# FillSpecialPos does not accept nIndex ==
+ GetString().getLength(). In that case nPos is set to the
+ length of the string in the core. This way GetCharRect
+ returns the rectangle for a cursor at the end of the
+ paragraph. */
+ if (bBehindText)
+ {
+ nPos = pNode->GetTxt().Len();
+ }
+ else
+ nPos = GetPortionData().FillSpecialPos
+ (nIndex, aSpecialPos, aMoveState.pSpecialPos );
+
+ // call GetCharRect
+ SwRect aCoreRect;
+ SwIndex aIndex( pNode, nPos );
+ SwPosition aPosition( *pNode, aIndex );
+ GetFrm()->GetCharRect( aCoreRect, aPosition, &aMoveState );
+
+ // translate core coordinates into accessibility coordinates
+ Window *pWin = GetWindow();
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
+
+ Rectangle aScreenRect( GetMap()->CoreToPixel( aCoreRect.SVRect() ));
+ SwRect aFrmLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
+
+ Point aFrmPixPos( GetMap()->CoreToPixel( aFrmLogBounds.SVRect() ).TopLeft() );
+ aScreenRect.Move( -aFrmPixPos.X(), -aFrmPixPos.Y() );
+
+ // convert into AWT Rectangle
+ return awt::Rectangle(
+ aScreenRect.Left(), aScreenRect.Top(),
+ aScreenRect.GetWidth(), aScreenRect.GetHeight() );
+}
+
+sal_Int32 SwAccessibleParagraph::getCharacterCount()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ return GetString().getLength();
+}
+
+sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ // construct SwPosition (where GetCrsrOfst() will put the result into)
+ SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() );
+ SwIndex aIndex( pNode, 0);
+ SwPosition aPos( *pNode, aIndex );
+
+ // construct Point (translate into layout coordinates)
+ Window *pWin = GetWindow();
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
+ Point aPoint( rPoint.X, rPoint.Y );
+ SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
+ Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
+ aPoint.X() += aPixPos.X();
+ aPoint.Y() += aPixPos.Y();
+ MapMode aMapMode = pWin->GetMapMode();
+ Point aCorePoint( GetMap()->PixelToCore( aPoint ) );
+ if( !aLogBounds.IsInside( aCorePoint ) )
+ {
+ /* #i12332# rPoint is may also be in rectangle returned by
+ getCharacterBounds(getCharacterCount() */
+
+ awt::Rectangle aRectEndPos =
+ getCharacterBounds(getCharacterCount());
+
+ if (rPoint.X - aRectEndPos.X >= 0 &&
+ rPoint.X - aRectEndPos.X < aRectEndPos.Width &&
+ rPoint.Y - aRectEndPos.Y >= 0 &&
+ rPoint.Y - aRectEndPos.Y < aRectEndPos.Height)
+ return getCharacterCount();
+
+ return -1;
+ }
+
+ // ask core for position
+ DBG_ASSERT( GetFrm() != NULL, "The text frame has vanished!" );
+ DBG_ASSERT( GetFrm()->IsTxtFrm(), "The text frame has mutated!" );
+ const SwTxtFrm* pFrm = static_cast<const SwTxtFrm*>( GetFrm() );
+ SwCrsrMoveState aMoveState;
+ aMoveState.bPosMatchesBounds = sal_True;
+ sal_Bool bSuccess = pFrm->GetCrsrOfst( &aPos, aCorePoint, &aMoveState );
+
+ SwIndex aCntntIdx = aPos.nContent;
+ const xub_StrLen nIndex = aCntntIdx.GetIndex();
+ if ( nIndex > 0 )
+ {
+ SwRect aResultRect;
+ pFrm->GetCharRect( aResultRect, aPos );
+ bool bVert = pFrm->IsVertical();
+ bool bR2L = pFrm->IsRightToLeft();
+
+ if ( (!bVert && aResultRect.Pos().X() > aCorePoint.X()) ||
+ ( bVert && aResultRect.Pos().Y() > aCorePoint.Y()) ||
+ ( bR2L && aResultRect.Right() < aCorePoint.X()) )
+ {
+ SwIndex aIdxPrev( pNode, nIndex - 1);
+ SwPosition aPosPrev( *pNode, aIdxPrev );
+ SwRect aResultRectPrev;
+ pFrm->GetCharRect( aResultRectPrev, aPosPrev );
+ if ( (!bVert && aResultRectPrev.Pos().X() < aCorePoint.X() && aResultRect.Pos().Y() == aResultRectPrev.Pos().Y()) ||
+ ( bVert && aResultRectPrev.Pos().Y() < aCorePoint.Y() && aResultRect.Pos().X() == aResultRectPrev.Pos().X()) ||
+ ( bR2L && aResultRectPrev.Right() > aCorePoint.X() && aResultRect.Pos().Y() == aResultRectPrev.Pos().Y()) )
+ aPos = aPosPrev;
+ }
+ }
+
+ return bSuccess ?
+ GetPortionData().GetAccessiblePosition( aPos.nContent.GetIndex() )
+ : -1L;
+}
+
+::rtl::OUString SwAccessibleParagraph::getSelectedText()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ sal_Int32 nStart, nEnd;
+ sal_Bool bSelected = GetSelection( nStart, nEnd );
+ return bSelected
+ ? GetString().copy( nStart, nEnd - nStart )
+ : ::rtl::OUString();
+}
+
+sal_Int32 SwAccessibleParagraph::getSelectionStart()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ sal_Int32 nStart, nEnd;
+ GetSelection( nStart, nEnd );
+ return nStart;
+}
+
+sal_Int32 SwAccessibleParagraph::getSelectionEnd()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ sal_Int32 nStart, nEnd;
+ GetSelection( nStart, nEnd );
+ return nEnd;
+}
+
+sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ // parameter checking
+ sal_Int32 nLength = GetString().getLength();
+ if ( ! IsValidRange( nStartIndex, nEndIndex, nLength ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ sal_Bool bRet = sal_False;
+
+ // get cursor shell
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL )
+ {
+ // create pam for selection
+ SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() );
+ SwIndex aIndex( pNode, GetPortionData().GetModelPosition(nStartIndex));
+ SwPosition aStartPos( *pNode, aIndex );
+ SwPaM aPaM( aStartPos );
+ aPaM.SetMark();
+ aPaM.GetPoint()->nContent =
+ GetPortionData().GetModelPosition(nEndIndex);
+
+ // set PaM at cursor shell
+ bRet = Select( aPaM );
+ }
+
+ return bRet;
+}
+
+::rtl::OUString SwAccessibleParagraph::getText()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ return GetString();
+}
+
+::rtl::OUString SwAccessibleParagraph::getTextRange(
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ ::rtl::OUString sText( GetString() );
+
+ if ( IsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
+ {
+ OrderRange( nStartIndex, nEndIndex );
+ return sText.copy(nStartIndex, nEndIndex-nStartIndex );
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+}
+
+/*accessibility::*/TextSegment SwAccessibleParagraph::getTextAtIndex( sal_Int32 nIndex, sal_Int16 nTextType ) throw (lang::IndexOutOfBoundsException, lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ /*accessibility::*/TextSegment aResult;
+ aResult.SegmentStart = -1;
+ aResult.SegmentEnd = -1;
+
+ const ::rtl::OUString rText = GetString();
+ // implement the silly specification that first position after
+ // text must return an empty string, rather than throwing an
+ // IndexOutOfBoundsException, except for LINE, where the last
+ // line is returned
+ if( nIndex == rText.getLength() && AccessibleTextType::LINE != nTextType )
+ return aResult;
+
+ // with error checking
+ i18n::Boundary aBound;
+ sal_Bool bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+
+ DBG_ASSERT( aBound.startPos >= 0, "illegal boundary" );
+ DBG_ASSERT( aBound.startPos <= aBound.endPos, "illegal boundary" );
+
+ // return word (if present)
+ if ( bWord )
+ {
+ aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
+ aResult.SegmentStart = aBound.startPos;
+ aResult.SegmentEnd = aBound.endPos;
+ }
+
+ return aResult;
+}
+
+/*accessibility::*/TextSegment SwAccessibleParagraph::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 nTextType ) throw (lang::IndexOutOfBoundsException, lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ const ::rtl::OUString rText = GetString();
+
+ /*accessibility::*/TextSegment aResult;
+ aResult.SegmentStart = -1;
+ aResult.SegmentEnd = -1;
+
+ // get starting pos
+ i18n::Boundary aBound;
+ if (nIndex == rText.getLength())
+ aBound.startPos = aBound.endPos = nIndex;
+ else
+ {
+ sal_Bool bTmp = GetTextBoundary( aBound, rText, nIndex, nTextType );
+
+ if ( ! bTmp )
+ aBound.startPos = aBound.endPos = nIndex;
+ }
+
+ // now skip to previous word
+ sal_Bool bWord = sal_False;
+ while( !bWord )
+ {
+ nIndex = min( nIndex, aBound.startPos ) - 1;
+ if( nIndex >= 0 )
+ bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+ else
+ break; // exit if beginning of string is reached
+ }
+
+ if ( bWord )
+ {
+ aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
+ aResult.SegmentStart = aBound.startPos;
+ aResult.SegmentEnd = aBound.endPos;
+ };
+ return aResult;
+}
+
+/*accessibility::*/TextSegment SwAccessibleParagraph::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 nTextType ) throw (lang::IndexOutOfBoundsException, lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ /*accessibility::*/TextSegment aResult;
+ aResult.SegmentStart = -1;
+ aResult.SegmentEnd = -1;
+ const ::rtl::OUString rText = GetString();
+
+ // implement the silly specification that first position after
+ // text must return an empty string, rather than throwing an
+ // IndexOutOfBoundsException
+ if( nIndex == rText.getLength() )
+ return aResult;
+
+
+ // get first word, then skip to next word
+ i18n::Boundary aBound;
+ GetTextBoundary( aBound, rText, nIndex, nTextType );
+ sal_Bool bWord = sal_False;
+ while( !bWord )
+ {
+ nIndex = max( sal_Int32(nIndex+1), aBound.endPos );
+ if( nIndex < rText.getLength() )
+ bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+ else
+ break; // exit if end of string is reached
+ }
+
+ if ( bWord )
+ {
+ aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
+ aResult.SegmentStart = aBound.startPos;
+ aResult.SegmentEnd = aBound.endPos;
+ }
+ return aResult;
+}
+
+sal_Bool SwAccessibleParagraph::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // select and copy (through dispatch mechanism)
+ setSelection( nStartIndex, nEndIndex );
+ ExecuteAtViewShell( SID_COPY );
+ return sal_True;
+}
+
+
+//
+//===== XAccesibleEditableText ==========================================
+//
+
+sal_Bool SwAccessibleParagraph::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ CHECK_FOR_DEFUNC( XAccessibleEditableText );
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if( !IsEditableState() )
+ return sal_False;
+
+ // select and cut (through dispatch mechanism)
+ setSelection( nStartIndex, nEndIndex );
+ ExecuteAtViewShell( SID_CUT );
+ return sal_True;
+}
+
+sal_Bool SwAccessibleParagraph::pasteText( sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ CHECK_FOR_DEFUNC( XAccessibleEditableText );
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if( !IsEditableState() )
+ return sal_False;
+
+ // select and paste (through dispatch mechanism)
+ setSelection( nIndex, nIndex );
+ ExecuteAtViewShell( SID_PASTE );
+ return sal_True;
+}
+
+sal_Bool SwAccessibleParagraph::deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ return replaceText( nStartIndex, nEndIndex, ::rtl::OUString() );
+}
+
+sal_Bool SwAccessibleParagraph::insertText( const ::rtl::OUString& sText, sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ return replaceText( nIndex, nIndex, sText );
+}
+
+sal_Bool SwAccessibleParagraph::replaceText(
+ sal_Int32 nStartIndex, sal_Int32 nEndIndex,
+ const ::rtl::OUString& sReplacement )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleEditableText );
+
+ const ::rtl::OUString& rText = GetString();
+
+ if( IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
+ {
+ if( !IsEditableState() )
+ return sal_False;
+
+ SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() );
+
+ // translate positions
+ sal_uInt16 nStart, nEnd;
+ sal_Bool bSuccess = GetPortionData().GetEditableRange(
+ nStartIndex, nEndIndex, nStart, nEnd );
+
+ // edit only if the range is editable
+ if( bSuccess )
+ {
+ // create SwPosition for nStartIndex
+ SwIndex aIndex( pNode, nStart );
+ SwPosition aStartPos( *pNode, aIndex );
+
+ // create SwPosition for nEndIndex
+ SwPosition aEndPos( aStartPos );
+ aEndPos.nContent = nEnd;
+
+ // now create XTextRange as helper and set string
+ const uno::Reference<text::XTextRange> xRange(
+ SwXTextRange::CreateXTextRange(
+ *pNode->GetDoc(), aStartPos, &aEndPos));
+ xRange->setString(sReplacement);
+
+ // delete portion data
+ ClearPortionData();
+ }
+
+ return bSuccess;
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+}
+
+struct IndexCompare
+{
+ const PropertyValue* pValues;
+ IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {}
+ bool operator() ( const sal_Int32& a, const sal_Int32& b ) const
+ {
+ return (pValues[a].Name < pValues[b].Name) ? true : false;
+ }
+};
+
+
+sal_Bool SwAccessibleParagraph::setAttributes(
+ sal_Int32 nStartIndex,
+ sal_Int32 nEndIndex,
+ const uno::Sequence<PropertyValue>& rAttributeSet )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleEditableText );
+
+ const ::rtl::OUString& rText = GetString();
+
+ if( ! IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
+ throw lang::IndexOutOfBoundsException();
+
+ if( !IsEditableState() )
+ return sal_False;
+
+
+ // create a (dummy) text portion for the sole purpose of calling
+ // setPropertyValue on it
+ uno::Reference<XMultiPropertySet> xPortion = CreateUnoPortion( nStartIndex,
+ nEndIndex );
+
+ // build sorted index array
+ sal_Int32 nLength = rAttributeSet.getLength();
+ const PropertyValue* pPairs = rAttributeSet.getConstArray();
+ sal_Int32* pIndices = new sal_Int32[nLength];
+ sal_Int32 i;
+ for( i = 0; i < nLength; i++ )
+ pIndices[i] = i;
+ sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) );
+
+ // create sorted sequences accoring to index array
+ uno::Sequence< ::rtl::OUString > aNames( nLength );
+ ::rtl::OUString* pNames = aNames.getArray();
+ uno::Sequence< uno::Any > aValues( nLength );
+ uno::Any* pValues = aValues.getArray();
+ for( i = 0; i < nLength; i++ )
+ {
+ const PropertyValue& rVal = pPairs[pIndices[i]];
+ pNames[i] = rVal.Name;
+ pValues[i] = rVal.Value;
+ }
+ delete[] pIndices;
+
+ // now set the values
+ sal_Bool bRet = sal_True;
+ try
+ {
+ xPortion->setPropertyValues( aNames, aValues );
+ }
+ catch( UnknownPropertyException e )
+ {
+ // error handling through return code!
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+sal_Bool SwAccessibleParagraph::setText( const ::rtl::OUString& sText )
+ throw (uno::RuntimeException)
+{
+ return replaceText(0, GetString().getLength(), sText);
+}
+
+//===== XAccessibleSelection ============================================
+
+void SwAccessibleParagraph::selectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ CHECK_FOR_DEFUNC( XAccessibleSelection );
+
+ aSelectionHelper.selectAccessibleChild(nChildIndex);
+}
+
+sal_Bool SwAccessibleParagraph::isAccessibleChildSelected(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ CHECK_FOR_DEFUNC( XAccessibleSelection );
+
+ return aSelectionHelper.isAccessibleChildSelected(nChildIndex);
+}
+
+void SwAccessibleParagraph::clearAccessibleSelection( )
+ throw ( uno::RuntimeException )
+{
+ CHECK_FOR_DEFUNC( XAccessibleSelection );
+
+ aSelectionHelper.clearAccessibleSelection();
+}
+
+void SwAccessibleParagraph::selectAllAccessibleChildren( )
+ throw ( uno::RuntimeException )
+{
+ CHECK_FOR_DEFUNC( XAccessibleSelection );
+
+ aSelectionHelper.selectAllAccessibleChildren();
+}
+
+sal_Int32 SwAccessibleParagraph::getSelectedAccessibleChildCount( )
+ throw ( uno::RuntimeException )
+{
+ CHECK_FOR_DEFUNC( XAccessibleSelection );
+
+ return aSelectionHelper.getSelectedAccessibleChildCount();
+}
+
+uno::Reference<XAccessible> SwAccessibleParagraph::getSelectedAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ CHECK_FOR_DEFUNC( XAccessibleSelection );
+
+ return aSelectionHelper.getSelectedAccessibleChild(nSelectedChildIndex);
+}
+
+// --> OD 2004-11-16 #111714# - index has to be treated as global child index.
+void SwAccessibleParagraph::deselectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ CHECK_FOR_DEFUNC( XAccessibleSelection );
+
+ aSelectionHelper.deselectAccessibleChild( nChildIndex );
+}
+
+//===== XAccessibleHypertext ============================================
+
+class SwHyperlinkIter_Impl
+{
+ const SwpHints *pHints;
+ xub_StrLen nStt;
+ xub_StrLen nEnd;
+ sal_uInt16 nPos;
+
+public:
+ SwHyperlinkIter_Impl( const SwTxtFrm *pTxtFrm );
+ const SwTxtAttr *next();
+ sal_uInt16 getCurrHintPos() const { return nPos-1; }
+
+ xub_StrLen startIdx() const { return nStt; }
+ xub_StrLen endIdx() const { return nEnd; }
+};
+
+SwHyperlinkIter_Impl::SwHyperlinkIter_Impl( const SwTxtFrm *pTxtFrm ) :
+ pHints( pTxtFrm->GetTxtNode()->GetpSwpHints() ),
+ nStt( pTxtFrm->GetOfst() ),
+ nPos( 0 )
+{
+ const SwTxtFrm *pFollFrm = pTxtFrm->GetFollow();
+ nEnd = pFollFrm ? pFollFrm->GetOfst() : pTxtFrm->GetTxtNode()->Len();
+}
+
+const SwTxtAttr *SwHyperlinkIter_Impl::next()
+{
+ const SwTxtAttr *pAttr = 0;
+ if( pHints )
+ {
+ while( !pAttr && nPos < pHints->Count() )
+ {
+ const SwTxtAttr *pHt = (*pHints)[nPos];
+ if( RES_TXTATR_INETFMT == pHt->Which() )
+ {
+ xub_StrLen nHtStt = *pHt->GetStart();
+ xub_StrLen nHtEnd = *pHt->GetAnyEnd();
+ if( nHtEnd > nHtStt &&
+ ( (nHtStt >= nStt && nHtStt < nEnd) ||
+ (nHtEnd > nStt && nHtEnd <= nEnd) ) )
+ {
+ pAttr = pHt;
+ }
+ }
+ ++nPos;
+ }
+ }
+
+ return pAttr;
+};
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkCount()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+ sal_Int32 nCount = 0;
+ // --> OD 2007-06-27 #i77108# - provide hyperlinks also in editable documents.
+// if( !IsEditableState() )
+ // <--
+ {
+ const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>( GetFrm() );
+ SwHyperlinkIter_Impl aIter( pTxtFrm );
+ while( aIter.next() )
+ nCount++;
+ }
+
+ return nCount;
+}
+
+uno::Reference< XAccessibleHyperlink > SAL_CALL
+ SwAccessibleParagraph::getHyperLink( sal_Int32 nLinkIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+ uno::Reference< XAccessibleHyperlink > xRet;
+
+ // --> OD 2007-06-27 #i77108# - provide hyperlinks also in editable documents.
+// if( !IsEditableState() )
+ // <--
+ {
+ const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>( GetFrm() );
+ SwHyperlinkIter_Impl aHIter( pTxtFrm );
+ while( nLinkIndex-- )
+ aHIter.next();
+
+ const SwTxtAttr *pHt = aHIter.next();
+ if( pHt )
+ {
+ if( !pHyperTextData )
+ pHyperTextData = new SwAccessibleHyperTextData;
+ SwAccessibleHyperTextData::iterator aIter =
+ pHyperTextData ->find( pHt );
+ if( aIter != pHyperTextData->end() )
+ {
+ xRet = (*aIter).second;
+ }
+ if( !xRet.is() )
+ {
+ sal_Int32 nHStt= GetPortionData().GetAccessiblePosition(
+ max( aHIter.startIdx(), *pHt->GetStart() ) );
+ sal_Int32 nHEnd= GetPortionData().GetAccessiblePosition(
+ min( aHIter.endIdx(), *pHt->GetAnyEnd() ) );
+ xRet = new SwAccessibleHyperlink( aHIter.getCurrHintPos(),
+ this, nHStt, nHEnd );
+ if( aIter != pHyperTextData->end() )
+ {
+ (*aIter).second = xRet;
+ }
+ else
+ {
+ SwAccessibleHyperTextData::value_type aEntry( pHt, xRet );
+ pHyperTextData->insert( aEntry );
+ }
+ }
+ }
+ }
+
+ if( !xRet.is() )
+ throw lang::IndexOutOfBoundsException();
+
+ return xRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+ // parameter checking
+ sal_Int32 nLength = GetString().getLength();
+ if ( ! IsValidPosition( nCharIndex, nLength ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ sal_Int32 nRet = -1;
+ // --> OD 2007-06-27 #i77108# - provide hyperlinks also in editable documents.
+// if( !IsEditableState() )
+ // <--
+ {
+ const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>( GetFrm() );
+ SwHyperlinkIter_Impl aHIter( pTxtFrm );
+
+ xub_StrLen nIdx = GetPortionData().GetModelPosition( nCharIndex );
+ sal_Int32 nPos = 0;
+ const SwTxtAttr *pHt = aHIter.next();
+ while( pHt && !(nIdx >= *pHt->GetStart() && nIdx < *pHt->GetAnyEnd()) )
+ {
+ pHt = aHIter.next();
+ nPos++;
+ }
+
+ if( pHt )
+ nRet = nPos;
+
+ }
+
+ return nRet;
+}
+
+// --> OD 2008-05-26 #i71360#
+// --> OD 2010-02-22 #i108125# - adjustments for change tracking text markup
+sal_Int32 SAL_CALL SwAccessibleParagraph::getTextMarkupCount( sal_Int32 nTextMarkupType )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ std::auto_ptr<SwTextMarkupHelper> pTextMarkupHelper;
+ switch ( nTextMarkupType )
+ {
+ case text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ case text::TextMarkupType::TRACK_CHANGE_DELETION:
+ case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper(
+ GetPortionData(),
+ *(mpParaChangeTrackInfo->getChangeTrackingTextMarkupList( nTextMarkupType ) )) );
+ }
+ break;
+ default:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper( GetPortionData(), *GetTxtNode() ) );
+ }
+ }
+
+ return pTextMarkupHelper->getTextMarkupCount( nTextMarkupType );
+}
+
+/*accessibility::*/TextSegment SAL_CALL
+ SwAccessibleParagraph::getTextMarkup( sal_Int32 nTextMarkupIndex,
+ sal_Int32 nTextMarkupType )
+ throw (lang::IndexOutOfBoundsException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ std::auto_ptr<SwTextMarkupHelper> pTextMarkupHelper;
+ switch ( nTextMarkupType )
+ {
+ case text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ case text::TextMarkupType::TRACK_CHANGE_DELETION:
+ case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper(
+ GetPortionData(),
+ *(mpParaChangeTrackInfo->getChangeTrackingTextMarkupList( nTextMarkupType ) )) );
+ }
+ break;
+ default:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper( GetPortionData(), *GetTxtNode() ) );
+ }
+ }
+
+ return pTextMarkupHelper->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
+}
+
+uno::Sequence< /*accessibility::*/TextSegment > SAL_CALL
+ SwAccessibleParagraph::getTextMarkupAtIndex( sal_Int32 nCharIndex,
+ sal_Int32 nTextMarkupType )
+ throw (lang::IndexOutOfBoundsException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ // parameter checking
+ const sal_Int32 nLength = GetString().getLength();
+ if ( ! IsValidPosition( nCharIndex, nLength ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ std::auto_ptr<SwTextMarkupHelper> pTextMarkupHelper;
+ switch ( nTextMarkupType )
+ {
+ case text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ case text::TextMarkupType::TRACK_CHANGE_DELETION:
+ case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper(
+ GetPortionData(),
+ *(mpParaChangeTrackInfo->getChangeTrackingTextMarkupList( nTextMarkupType ) )) );
+ }
+ break;
+ default:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper( GetPortionData(), *GetTxtNode() ) );
+ }
+ }
+
+ return pTextMarkupHelper->getTextMarkupAtIndex( nCharIndex, nTextMarkupType );
+}
+// <--
+
+// --> OD 2008-05-29 #i89175#
+sal_Int32 SAL_CALL SwAccessibleParagraph::getLineNumberAtIndex( sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ // parameter checking
+ const sal_Int32 nLength = GetString().getLength();
+ if ( ! IsValidPosition( nIndex, nLength ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ const sal_Int32 nLineNo = GetPortionData().GetLineNo( nIndex );
+ return nLineNo;
+}
+
+/*accessibility::*/TextSegment SAL_CALL
+ SwAccessibleParagraph::getTextAtLineNumber( sal_Int32 nLineNo )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ // parameter checking
+ if ( nLineNo < 0 ||
+ nLineNo >= GetPortionData().GetLineCount() )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ i18n::Boundary aLineBound;
+ GetPortionData().GetBoundaryOfLine( nLineNo, aLineBound );
+
+ /*accessibility::*/TextSegment aTextAtLine;
+ const ::rtl::OUString rText = GetString();
+ aTextAtLine.SegmentText = rText.copy( aLineBound.startPos,
+ aLineBound.endPos - aLineBound.startPos );
+ aTextAtLine.SegmentStart = aLineBound.startPos;
+ aTextAtLine.SegmentEnd = aLineBound.endPos;
+
+ return aTextAtLine;
+}
+
+/*accessibility::*/TextSegment SAL_CALL SwAccessibleParagraph::getTextAtLineWithCaret()
+ throw (uno::RuntimeException)
+{
+ const sal_Int32 nLineNoOfCaret = getNumberOfLineWithCaret();
+
+ if ( nLineNoOfCaret >= 0 &&
+ nLineNoOfCaret < GetPortionData().GetLineCount() )
+ {
+ return getTextAtLineNumber( nLineNoOfCaret );
+ }
+
+ return /*accessibility::*/TextSegment();
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
+ throw (uno::RuntimeException)
+{
+ const sal_Int32 nCaretPos = getCaretPosition();
+ const sal_Int32 nLength = GetString().getLength();
+ if ( !IsValidPosition( nCaretPos, nLength ) )
+ {
+ return -1;
+ }
+
+ sal_Int32 nLineNo = GetPortionData().GetLineNo( nCaretPos );
+
+ // special handling for cursor positioned at end of text line via End key
+ if ( nCaretPos != 0 )
+ {
+ i18n::Boundary aLineBound;
+ GetPortionData().GetBoundaryOfLine( nLineNo, aLineBound );
+ if ( nCaretPos == aLineBound.startPos )
+ {
+ SwCrsrShell* pCrsrShell = SwAccessibleParagraph::GetCrsrShell();
+ if ( pCrsrShell != 0 )
+ {
+ const awt::Rectangle aCharRect = getCharacterBounds( nCaretPos );
+
+ const SwRect& aCursorCoreRect = pCrsrShell->GetCharRect();
+ // translate core coordinates into accessibility coordinates
+ Window *pWin = GetWindow();
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
+
+ Rectangle aScreenRect( GetMap()->CoreToPixel( aCursorCoreRect.SVRect() ));
+
+ SwRect aFrmLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
+ Point aFrmPixPos( GetMap()->CoreToPixel( aFrmLogBounds.SVRect() ).TopLeft() );
+ aScreenRect.Move( -aFrmPixPos.X(), -aFrmPixPos.Y() );
+
+ // convert into AWT Rectangle
+ const awt::Rectangle aCursorRect( aScreenRect.Left(),
+ aScreenRect.Top(),
+ aScreenRect.GetWidth(),
+ aScreenRect.GetHeight() );
+
+ if ( aCharRect.X != aCursorRect.X ||
+ aCharRect.Y != aCursorRect.Y )
+ {
+ --nLineNo;
+ }
+ }
+ }
+ }
+
+ return nLineNo;
+}
+
+// --> OD 2010-02-19 #i108125#
+void SwAccessibleParagraph::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+{
+ mpParaChangeTrackInfo->reset();
+
+ CheckRegistration( pOld, pNew );
+}
+// <--
diff --git a/sw/source/core/access/accpara.hxx b/sw/source/core/access/accpara.hxx
new file mode 100644
index 000000000000..440fd08c7ebd
--- /dev/null
+++ b/sw/source/core/access/accpara.hxx
@@ -0,0 +1,447 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCPARA_HXX
+#define _ACCPARA_HXX
+
+#include <acccontext.hxx>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp>
+#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
+#include <hash_map>
+#include <accselectionhelper.hxx>
+// --> OD 2010-02-19 #i108125#
+#include <calbck.hxx>
+// <--
+
+class SwTxtFrm;
+class SwTxtNode;
+class SwPaM;
+class SwAccessiblePortionData;
+class SwAccessibleHyperTextData;
+class SwXTextPortion;
+// --> OD 2010-02-19 #i108125#
+class SwParaChangeTrackingInfo;
+// <--
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace i18n { struct Boundary; }
+ namespace accessibility { class XAccessibleHyperlink; }
+} } }
+
+typedef ::std::hash_map< ::rtl::OUString,
+ ::com::sun::star::beans::PropertyValue,
+ ::rtl::OUStringHash,
+ ::std::equal_to< ::rtl::OUString > > tAccParaPropValMap;
+
+class SwAccessibleParagraph :
+ // --> OD 2010-02-19 #i108125#
+ public SwClient,
+ // <--
+ public SwAccessibleContext,
+ public ::com::sun::star::accessibility::XAccessibleEditableText,
+ public com::sun::star::accessibility::XAccessibleSelection,
+ public com::sun::star::accessibility::XAccessibleHypertext,
+ public com::sun::star::accessibility::XAccessibleTextMarkup,
+ public com::sun::star::accessibility::XAccessibleMultiLineText,
+ public ::com::sun::star::accessibility::XAccessibleTextAttributes
+{
+ friend class SwAccessibleHyperlink;
+
+ ::rtl::OUString sDesc; // protected by base classes mutex
+
+ /// data for this paragraph's text portions; this contains the
+ /// mapping from the core 'model string' to the accessible text
+ /// string.
+ /// pPortionData may be NULL; it should only be accessed through the
+ /// Get/Clear/Has/UpdatePortionData() methods
+ SwAccessiblePortionData* pPortionData;
+ SwAccessibleHyperTextData *pHyperTextData;
+
+ sal_Int32 nOldCaretPos; // The 'old' caret pos. It's only valid as long
+ // as the cursor is inside this object (protected by
+ // mutex)
+
+ sal_Bool bIsHeading; // protected by base classes mutex
+
+ // implementation for XAccessibleSelection
+ SwAccessibleSelectionHelper aSelectionHelper;
+
+ // --> OD 2010-02-19 #i108125#
+ SwParaChangeTrackingInfo* mpParaChangeTrackInfo;
+ // <--
+
+ /// get the SwTxtNode (requires frame; check before)
+ const SwTxtNode* GetTxtNode() const;
+
+ /// get the (accessible) text string (requires frame; check before)
+ ::rtl::OUString GetString();
+
+ ::rtl::OUString GetDescription();
+
+ // get the current care position
+ sal_Int32 GetCaretPos();
+
+ /// determine the current selection. Fill the values with
+ /// -1 if there is no selection in the this paragraph
+ sal_Bool GetSelection(sal_Int32& nStart, sal_Int32& nEnd);
+
+ // helper for GetSelection and getCaretPosition
+ // --> OD 2005-12-20 #i27301#
+ // - add parameter <_bForSelection>, which indicates, if the cursor is
+ // retrieved for selection or for caret position.
+ SwPaM* GetCursor( const bool _bForSelection );
+
+ /// for cut/copy/paste: execute a particular slot at the view shell
+ void ExecuteAtViewShell( sal_uInt16 nSlot );
+
+ /// helper method for get/setAttributes
+ /// (for the special case of (nEndIndex==-1) a single character will
+ /// be selected)
+ SwXTextPortion* CreateUnoPortion( sal_Int32 nStart, sal_Int32 nEnd );
+
+
+ // methods for checking the parameter range:
+
+ /// does nPos point to a char?
+ sal_Bool IsValidChar(sal_Int32 nPos, sal_Int32 nLength);
+
+ /// does nPos point to a position? (may be behind the last character)
+ sal_Bool IsValidPosition(sal_Int32 nPos, sal_Int32 nLength);
+
+ /// is nBegin...nEnd a valid range? (nEnd points past the last character)
+ sal_Bool IsValidRange(sal_Int32 nBegin, sal_Int32 nEnd, sal_Int32 nLength);
+
+ /// Ensure ordered range (i.e. nBegin is smaller then nEnd)
+ inline void OrderRange(sal_Int32& nBegin, sal_Int32& nEnd)
+ {
+ if( nBegin > nEnd )
+ {
+ sal_Int32 nTmp = nBegin; nBegin = nEnd; nEnd = nTmp;
+ }
+ }
+
+ // --> OD 2006-07-13 #i63870#
+ void _getDefaultAttributesImpl(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
+ tAccParaPropValMap& rDefAttrSeq,
+ const bool bOnlyCharAttrs = false );
+ void _getRunAttributesImpl(
+ const sal_Int32 nIndex,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
+ tAccParaPropValMap& rRunAttrSeq );
+ // <--
+
+public:
+
+ sal_Bool IsHeading() const;
+
+protected:
+
+ // Set states for getAccessibleStateSet.
+ // This drived class additinaly sets MULTILINE(1), MULTISELECTABLE(+),
+ // FOCUSABLE(+) and FOCUSED(+)
+ virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
+
+ virtual void _InvalidateContent( sal_Bool bVisibleDataFired );
+
+ virtual void _InvalidateCursorPos();
+ virtual void _InvalidateFocus();
+
+ virtual ~SwAccessibleParagraph();
+
+ //===== handling of data for the text portions ===========================
+
+ /// force update of new portion data
+ void UpdatePortionData()
+ throw( com::sun::star::uno::RuntimeException );
+
+ /// remove the current portion data
+ void ClearPortionData();
+
+ /// get portion data; update if necesary
+ SwAccessiblePortionData& GetPortionData()
+ throw( com::sun::star::uno::RuntimeException )
+ {
+ if( pPortionData == NULL )
+ UpdatePortionData();
+ return *pPortionData;
+ }
+
+ /// determine if portion data is currently available
+ sal_Bool HasPortionData() { return (pPortionData != NULL); }
+
+
+ //===== helpers for word boundaries ====================================
+
+ sal_Bool GetCharBoundary( com::sun::star::i18n::Boundary& rBound,
+ const rtl::OUString& rText,
+ sal_Int32 nPos );
+ sal_Bool GetWordBoundary( com::sun::star::i18n::Boundary& rBound,
+ const rtl::OUString& rText,
+ sal_Int32 nPos );
+ sal_Bool GetSentenceBoundary( com::sun::star::i18n::Boundary& rBound,
+ const rtl::OUString& rText,
+ sal_Int32 nPos );
+ sal_Bool GetLineBoundary( com::sun::star::i18n::Boundary& rBound,
+ const rtl::OUString& rText,
+ sal_Int32 nPos );
+ sal_Bool GetParagraphBoundary( com::sun::star::i18n::Boundary& rBound,
+ const rtl::OUString& rText,
+ sal_Int32 nPos );
+ sal_Bool GetAttributeBoundary( com::sun::star::i18n::Boundary& rBound,
+ const rtl::OUString& rText,
+ sal_Int32 nPos );
+ sal_Bool GetGlyphBoundary( com::sun::star::i18n::Boundary& rBound,
+ const rtl::OUString& rText,
+ sal_Int32 nPos );
+
+ /// get boundaries of word/sentence/etc. for specified text type
+ /// Does all argument checking, and then delegates to helper methods above.
+ sal_Bool GetTextBoundary( com::sun::star::i18n::Boundary& rBound,
+ const rtl::OUString& rText,
+ sal_Int32 nPos,
+ sal_Int16 aTextType )
+ throw (
+ ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew);
+
+public:
+
+ SwAccessibleParagraph( SwAccessibleMap& rInitMap,
+ const SwTxtFrm& rTxtFrm );
+
+ inline operator ::com::sun::star::accessibility::XAccessibleText *();
+
+ virtual sal_Bool HasCursor(); // required by map to remember that object
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (com::sun::star::uno::RuntimeException);
+
+ /** Return the parents locale or throw exception if this object has no
+ parent yet/anymore.
+ */
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale (void)
+ throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ /** paragraphs are in relation CONTENT_FLOWS_FROM and/or CONTENT_FLOWS_TO
+
+ OD 2005-12-02 #i27138#
+
+ @author OD
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleComponent ============================================
+
+ virtual void SAL_CALL grabFocus()
+ throw (::com::sun::star::uno::RuntimeException);
+ // --> OD 2007-01-17 #i71385#
+ virtual sal_Int32 SAL_CALL getForeground()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground()
+ throw (::com::sun::star::uno::RuntimeException);
+ // <--
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XInterface ======================================================
+
+ // (XInterface methods need to be implemented to disambiguate
+ // between those inherited through SwAcessibleContext and
+ // XAccessibleEditableText).
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire( ) throw ()
+ { SwAccessibleContext::acquire(); };
+
+ virtual void SAL_CALL release( ) throw ()
+ { SwAccessibleContext::release(); };
+
+ //====== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //===== XAccesibleText ==================================================
+ virtual sal_Int32 SAL_CALL getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ //===== XAccesibleEditableText ==========================================
+ virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setText( const ::rtl::OUString& sText ) throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleSelection ============================================
+ virtual void SAL_CALL selectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL clearAccessibleSelection( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL selectAllAccessibleChildren( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
+ virtual void SAL_CALL deselectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ //===== XAccessibleHypertext ============================================
+ virtual sal_Int32 SAL_CALL getHyperLinkCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleHyperlink >
+ SAL_CALL getHyperLink( sal_Int32 nLinkIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getHyperLinkIndex( sal_Int32 nCharIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // --> OD 2008-05-19 #i71360#
+ //===== XAccesibleTextMarkup ============================================
+ virtual sal_Int32 SAL_CALL getTextMarkupCount( sal_Int32 nTextMarkupType )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL
+ getTextMarkup( sal_Int32 nTextMarkupIndex,
+ sal_Int32 nTextMarkupType )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::accessibility::TextSegment > SAL_CALL
+ getTextMarkupAtIndex( sal_Int32 nCharIndex,
+ sal_Int32 nTextMarkupType )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ // <--
+
+ // --> OD 2008-05-29 #i89175#
+ //===== XAccessibleMultiLineText ========================================
+ virtual sal_Int32 SAL_CALL getLineNumberAtIndex( sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL
+ getTextAtLineNumber( sal_Int32 nLineNo )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL
+ getTextAtLineWithCaret()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getNumberOfLineWithCaret()
+ throw (::com::sun::star::uno::RuntimeException);
+ // <--
+
+ // --> OD 2006-07-11 #i63870#
+ //===== XAccesibleTextAttributes ========================================
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ // <--
+};
+
+inline SwAccessibleParagraph::operator ::com::sun::star::accessibility::XAccessibleText *()
+{
+ return static_cast<
+ ::com::sun::star::accessibility::XAccessibleEditableText * >( this );
+}
+
+#endif
+
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
new file mode 100644
index 000000000000..c90fa9d4e34d
--- /dev/null
+++ b/sw/source/core/access/accportions.cxx
@@ -0,0 +1,753 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "accportions.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/i18n/Boundary.hpp>
+#include <txttypes.hxx>
+
+// for portion replacement in Special()
+#ifndef _ACCESS_HRC
+#include "access.hrc"
+#endif
+#include <tools/resid.hxx>
+#include "viewopt.hxx"
+
+// for GetWordBoundary(...), GetSentenceBoundary(...):
+#include <breakit.hxx>
+#include <com/sun/star/i18n/WordType.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <ndtxt.hxx>
+
+// for FillSpecialPos(...)
+#include "crstate.hxx"
+
+// for SwAccessibleContext::GetResource()
+#include "acccontext.hxx"
+
+// for Post-It replacement text:
+#include "txatbase.hxx"
+#include "fmtfld.hxx"
+#include "fldbas.hxx"
+#include "docufld.hxx"
+
+// for in-line graphics replacement:
+#include "ndindex.hxx"
+#include "ndnotxt.hxx"
+#include "fmtflcnt.hxx"
+#include "frmfmt.hxx"
+#include "fmtcntnt.hxx"
+
+
+using namespace ::com::sun::star;
+
+using rtl::OUString;
+using rtl::OUStringBuffer;
+using i18n::Boundary;
+
+
+// 'portion type' for terminating portions
+#define POR_TERMINATE 0
+
+
+// portion attributes
+#define PORATTR_SPECIAL 1
+#define PORATTR_READONLY 2
+#define PORATTR_GRAY 4
+#define PORATTR_TERM 128
+
+SwAccessiblePortionData::SwAccessiblePortionData(
+ const SwTxtNode* pTxtNd,
+ const SwViewOption* pViewOpt ) :
+ SwPortionHandler(),
+ pTxtNode( pTxtNd ),
+ aBuffer(),
+ nModelPosition( 0 ),
+ bFinished( sal_False ),
+ pViewOptions( pViewOpt ),
+ sAccessibleString(),
+ aLineBreaks(),
+ aModelPositions(),
+ aAccessiblePositions(),
+ pSentences( 0 ),
+ nBeforePortions( 0 ),
+ bLastIsSpecial( sal_False )
+{
+ DBG_ASSERT( pTxtNode != NULL, "Text node is needed!" );
+
+ // reserve some space to reduce memory allocations
+ aLineBreaks.reserve( 5 );
+ aModelPositions.reserve( 10 );
+ aAccessiblePositions.reserve( 10 );
+
+ // always include 'first' line-break position
+ aLineBreaks.push_back( 0 );
+}
+
+SwAccessiblePortionData::~SwAccessiblePortionData()
+{
+ delete pSentences;
+}
+
+void SwAccessiblePortionData::Text(sal_uInt16 nLength, sal_uInt16 nType)
+{
+ DBG_ASSERT( (nModelPosition + nLength) <= pTxtNode->GetTxt().Len(),
+ "portion exceeds model string!" );
+
+ DBG_ASSERT( !bFinished, "We are already done!" );
+
+ // ignore zero-length portions
+ if( nLength == 0 )
+ return;
+
+ // store 'old' positions
+ aModelPositions.push_back( nModelPosition );
+ aAccessiblePositions.push_back( aBuffer.getLength() );
+
+ // store portion attributes
+ sal_uInt8 nAttr = IsGrayPortionType(nType) ? PORATTR_GRAY : 0;
+ aPortionAttrs.push_back( nAttr );
+
+ // update buffer + nModelPosition
+ aBuffer.append( OUString(
+ pTxtNode->GetTxt().Copy(
+ static_cast<sal_uInt16>( nModelPosition ),
+ nLength ) ) );
+ nModelPosition += nLength;
+
+ bLastIsSpecial = sal_False;
+}
+
+void SwAccessiblePortionData::Special(
+ sal_uInt16 nLength, const String& rText, sal_uInt16 nType)
+{
+ DBG_ASSERT( nModelPosition >= 0, "illegal position" );
+ DBG_ASSERT( (nModelPosition + nLength) <= pTxtNode->GetTxt().Len(),
+ "portion exceeds model string!" );
+
+ DBG_ASSERT( !bFinished, "We are already done!" );
+
+ // construct string with representation; either directly from
+ // rText, or use resources for special case portions
+ String sDisplay;
+ switch( nType )
+ {
+ case POR_POSTITS:
+ case POR_FLYCNT:
+ case POR_GRFNUM:
+ sDisplay = String(sal_Unicode(0xfffc));
+
+ break;
+ case POR_NUMBER:
+ {
+ OUStringBuffer aTmpBuffer( rText.Len() + 1 );
+ aTmpBuffer.append( rText );
+ aTmpBuffer.append( sal_Unicode(' ') );
+ sDisplay = aTmpBuffer.makeStringAndClear();
+ break;
+ }
+ // --> OD 2010-06-04 #i111768# - apply patch from kstribley:
+ // Include the control characters.
+ case POR_CONTROLCHAR:
+ {
+ OUStringBuffer aTmpBuffer( rText.Len() + 1 );
+ aTmpBuffer.append( rText );
+ aTmpBuffer.append( pTxtNode->GetTxt().GetChar(nModelPosition) );
+ sDisplay = aTmpBuffer.makeStringAndClear();
+ break;
+ }
+ // <--
+ default:
+ sDisplay = rText;
+ break;
+ }
+
+ // ignore zero/zero portions (except for terminators)
+ if( (nLength == 0) && (sDisplay.Len() == 0) && (nType != POR_TERMINATE) )
+ return;
+
+ // special treatment for zero length portion at the beginning:
+ // count as 'before' portion
+ if( ( nLength == 0 ) && ( nModelPosition == 0 ) )
+ nBeforePortions++;
+
+ // store the 'old' positions
+ aModelPositions.push_back( nModelPosition );
+ aAccessiblePositions.push_back( aBuffer.getLength() );
+
+ // store portion attributes
+ sal_uInt8 nAttr = PORATTR_SPECIAL;
+ if( IsGrayPortionType(nType) ) nAttr |= PORATTR_GRAY;
+ if( nLength == 0 ) nAttr |= PORATTR_READONLY;
+ if( nType == POR_TERMINATE ) nAttr |= PORATTR_TERM;
+ aPortionAttrs.push_back( nAttr );
+
+ // update buffer + nModelPosition
+ aBuffer.append( OUString(sDisplay) );
+ nModelPosition += nLength;
+
+ // remember 'last' special portion (unless it's our own 'closing'
+ // portions from 'Finish()'
+ if( nType != POR_TERMINATE )
+ bLastIsSpecial = sal_True;
+}
+
+void SwAccessiblePortionData::LineBreak()
+{
+ DBG_ASSERT( !bFinished, "We are already done!" );
+
+ aLineBreaks.push_back( aBuffer.getLength() );
+}
+
+void SwAccessiblePortionData::Skip(sal_uInt16 nLength)
+{
+ DBG_ASSERT( !bFinished, "We are already done!" );
+ DBG_ASSERT( aModelPositions.size() == 0, "Never Skip() after portions" );
+ DBG_ASSERT( nLength <= pTxtNode->GetTxt().Len(), "skip exceeds model string!" );
+
+ nModelPosition += nLength;
+}
+
+void SwAccessiblePortionData::Finish()
+{
+ DBG_ASSERT( !bFinished, "We are already done!" );
+
+ // include terminator values: always include two 'last character'
+ // markers in the position arrays to make sure we always find one
+ // position before the end
+ Special( 0, String(), POR_TERMINATE );
+ Special( 0, String(), POR_TERMINATE );
+ LineBreak();
+ LineBreak();
+
+ sAccessibleString = aBuffer.makeStringAndClear();
+ bFinished = sal_True;
+}
+
+
+sal_Bool SwAccessiblePortionData::IsPortionAttrSet(
+ size_t nPortionNo, sal_uInt8 nAttr ) const
+{
+ DBG_ASSERT( nPortionNo < aPortionAttrs.size(),
+ "Illegal portion number" );
+ return (aPortionAttrs[nPortionNo] & nAttr) != 0;
+}
+
+sal_Bool SwAccessiblePortionData::IsSpecialPortion( size_t nPortionNo ) const
+{
+ return IsPortionAttrSet(nPortionNo, PORATTR_SPECIAL);
+}
+
+sal_Bool SwAccessiblePortionData::IsReadOnlyPortion( size_t nPortionNo ) const
+{
+ return IsPortionAttrSet(nPortionNo, PORATTR_READONLY);
+}
+
+sal_Bool SwAccessiblePortionData::IsGrayPortionType( sal_uInt16 nType ) const
+{
+ // gray portions?
+ // Compare with: inftxt.cxx, SwTxtPaintInfo::DrawViewOpt(...)
+ sal_Bool bGray = sal_False;
+ switch( nType )
+ {
+ case POR_FTN:
+ case POR_ISOREF:
+ case POR_REF:
+ case POR_QUOVADIS:
+ case POR_NUMBER:
+ case POR_FLD:
+ case POR_URL:
+ case POR_ISOTOX:
+ case POR_TOX:
+ case POR_HIDDEN:
+ bGray = !pViewOptions->IsPagePreview() &&
+ !pViewOptions->IsReadonly() && SwViewOption::IsFieldShadings();
+ break;
+ case POR_TAB: bGray = pViewOptions->IsTab(); break;
+ case POR_SOFTHYPH: bGray = pViewOptions->IsSoftHyph(); break;
+ case POR_BLANK: bGray = pViewOptions->IsHardBlank(); break;
+ default:
+ break; // bGray is false
+ }
+ return bGray;
+}
+
+
+const OUString& SwAccessiblePortionData::GetAccessibleString() const
+{
+ DBG_ASSERT( bFinished, "Shouldn't call this before we are done!" );
+
+ return sAccessibleString;
+}
+
+
+void SwAccessiblePortionData::GetLineBoundary(
+ Boundary& rBound,
+ sal_Int32 nPos ) const
+{
+ FillBoundary( rBound, aLineBreaks,
+ FindBreak( aLineBreaks, nPos ) );
+}
+
+// --> OD 2008-05-30 #i89175#
+sal_Int32 SwAccessiblePortionData::GetLineCount() const
+{
+ size_t nBreaks = aLineBreaks.size();
+ // A non-empty paragraph has at least 4 breaks: one for each line3 and
+ // 3 additional ones.
+ // An empty paragraph has 3 breaks.
+ // Less than 3 breaks is an error case.
+ sal_Int32 nLineCount = ( nBreaks > 3 )
+ ? nBreaks - 3
+ : ( ( nBreaks == 3 ) ? 1 : 0 );
+ return nLineCount;
+}
+
+sal_Int32 SwAccessiblePortionData::GetLineNo( const sal_Int32 nPos ) const
+{
+ sal_Int32 nLineNo = FindBreak( aLineBreaks, nPos );
+
+ // handling of position after last character
+ const sal_Int32 nLineCount( GetLineCount() );
+ if ( nLineNo >= nLineCount )
+ {
+ nLineNo = nLineCount - 1;
+ }
+
+ return nLineNo;
+}
+
+void SwAccessiblePortionData::GetBoundaryOfLine( const sal_Int32 nLineNo,
+ i18n::Boundary& rLineBound )
+{
+ FillBoundary( rLineBound, aLineBreaks, nLineNo );
+}
+// <--
+
+void SwAccessiblePortionData::GetLastLineBoundary(
+ Boundary& rBound ) const
+{
+ DBG_ASSERT( aLineBreaks.size() >= 2, "need min + max value" );
+
+ // The last two positions except the two deleimiters are the ones
+ // we are looking for, except for empty paragraphs (nBreaks==3)
+ size_t nBreaks = aLineBreaks.size();
+ FillBoundary( rBound, aLineBreaks, nBreaks <= 3 ? 0 : nBreaks-4 );
+}
+
+sal_uInt16 SwAccessiblePortionData::GetModelPosition( sal_Int32 nPos ) const
+{
+ DBG_ASSERT( nPos >= 0, "illegal position" );
+ DBG_ASSERT( nPos <= sAccessibleString.getLength(), "illegal position" );
+
+ // find the portion number
+ size_t nPortionNo = FindBreak( aAccessiblePositions, nPos );
+
+ // get model portion size
+ sal_Int32 nStartPos = aModelPositions[nPortionNo];
+
+ // if it's a non-special portion, move into the portion, else
+ // return the portion start
+ if( ! IsSpecialPortion( nPortionNo ) )
+ {
+ // 'wide' portions have to be of the same width
+ DBG_ASSERT( ( aModelPositions[nPortionNo+1] - nStartPos ) ==
+ ( aAccessiblePositions[nPortionNo+1] -
+ aAccessiblePositions[nPortionNo] ),
+ "accesability portion disagrees with text model" );
+
+ sal_Int32 nWithinPortion = nPos - aAccessiblePositions[nPortionNo];
+ nStartPos += nWithinPortion;
+ }
+ // else: return nStartPos unmodified
+
+ DBG_ASSERT( (nStartPos >= 0) && (nStartPos < USHRT_MAX),
+ "How can the SwTxtNode have so many characters?" );
+ return static_cast<sal_uInt16>(nStartPos);
+}
+
+void SwAccessiblePortionData::FillBoundary(
+ Boundary& rBound,
+ const Positions_t& rPositions,
+ size_t nPos ) const
+{
+ rBound.startPos = rPositions[nPos];
+ rBound.endPos = rPositions[nPos+1];
+}
+
+
+size_t SwAccessiblePortionData::FindBreak(
+ const Positions_t& rPositions,
+ sal_Int32 nValue ) const
+{
+ DBG_ASSERT( rPositions.size() >= 2, "need min + max value" );
+ DBG_ASSERT( rPositions[0] <= nValue, "need min value" );
+ DBG_ASSERT( rPositions[rPositions.size()-1] >= nValue,
+ "need first terminator value" );
+ DBG_ASSERT( rPositions[rPositions.size()-2] >= nValue,
+ "need second terminator value" );
+
+ size_t nMin = 0;
+ size_t nMax = rPositions.size()-2;
+
+ // loop until no more than two candidates are left
+ while( nMin+1 < nMax )
+ {
+ // check loop invariants
+ DBG_ASSERT( ( (nMin == 0) && (rPositions[nMin] <= nValue) ) ||
+ ( (nMin != 0) && (rPositions[nMin] < nValue) ),
+ "minvalue not minimal" );
+ DBG_ASSERT( nValue <= rPositions[nMax], "max value not maximal" );
+
+ // get middle (and ensure progress)
+ size_t nMiddle = (nMin + nMax)/2;
+ DBG_ASSERT( nMin < nMiddle, "progress?" );
+ DBG_ASSERT( nMiddle < nMax, "progress?" );
+
+ // check array
+ DBG_ASSERT( rPositions[nMin] <= rPositions[nMiddle],
+ "garbled positions array" );
+ DBG_ASSERT( rPositions[nMiddle] <= rPositions[nMax],
+ "garbled positions array" );
+
+ if( nValue > rPositions[nMiddle] )
+ nMin = nMiddle;
+ else
+ nMax = nMiddle;
+ }
+
+ // only two are left; we only need to check which one is the winner
+ DBG_ASSERT( (nMax == nMin) || (nMax == nMin+1), "only two left" );
+ if( (rPositions[nMin] < nValue) && (rPositions[nMin+1] <= nValue) )
+ nMin = nMin+1;
+
+ // finally, check to see whether the returned value is the 'right' position
+ DBG_ASSERT( rPositions[nMin] <= nValue, "not smaller or equal" );
+ DBG_ASSERT( nValue <= rPositions[nMin+1], "not equal or larger" );
+ DBG_ASSERT( (nMin == 0) || (rPositions[nMin-1] <= nValue),
+ "earlier value should have been returned" );
+
+ DBG_ASSERT( nMin < rPositions.size()-1,
+ "shouldn't return last position (due to termintator values)" );
+
+ return nMin;
+}
+
+size_t SwAccessiblePortionData::FindLastBreak(
+ const Positions_t& rPositions,
+ sal_Int32 nValue ) const
+{
+ size_t nResult = FindBreak( rPositions, nValue );
+
+ // skip 'zero-length' portions
+ // --> OD 2006-10-19 #i70538#
+ // consider size of <rPosition> and ignore last entry
+// while( rPositions[nResult+1] <= nValue )
+ while ( nResult < rPositions.size() - 2 &&
+ rPositions[nResult+1] <= nValue )
+ {
+ nResult++;
+ }
+ // <--
+
+ return nResult;
+}
+
+
+void SwAccessiblePortionData::GetSentenceBoundary(
+ Boundary& rBound,
+ sal_Int32 nPos )
+{
+ DBG_ASSERT( nPos >= 0, "illegal position; check before" );
+ DBG_ASSERT( nPos < sAccessibleString.getLength(), "illegal position" );
+
+ if( pSentences == NULL )
+ {
+ DBG_ASSERT( pBreakIt != NULL, "We always need a break." );
+ DBG_ASSERT( pBreakIt->GetBreakIter().is(), "No break-iterator." );
+ if( pBreakIt->GetBreakIter().is() )
+ {
+ pSentences = new Positions_t();
+ pSentences->reserve(10);
+
+ // use xBreak->endOfSentence to iterate over all words; store
+ // positions in pSentences
+ sal_Int32 nCurrent = 0;
+ sal_Int32 nLength = sAccessibleString.getLength();
+ do
+ {
+ pSentences->push_back( nCurrent );
+
+ sal_uInt16 nModelPos = GetModelPosition( nCurrent );
+
+ sal_Int32 nNew = pBreakIt->GetBreakIter()->endOfSentence(
+ sAccessibleString, nCurrent,
+ pBreakIt->GetLocale(pTxtNode->GetLang(nModelPos)) ) + 1;
+
+ if( (nNew < 0) && (nNew > nLength) )
+ nNew = nLength;
+ else if (nNew <= nCurrent)
+ nNew = nCurrent + 1; // ensure forward progress
+
+ nCurrent = nNew;
+ }
+ while (nCurrent < nLength);
+
+ // finish with two terminators
+ pSentences->push_back( nLength );
+ pSentences->push_back( nLength );
+ }
+ else
+ {
+ // no break iterator -> empty word
+ rBound.startPos = 0;
+ rBound.endPos = 0;
+ return;
+ }
+ }
+
+ FillBoundary( rBound, *pSentences, FindBreak( *pSentences, nPos ) );
+}
+
+void SwAccessiblePortionData::GetAttributeBoundary(
+ Boundary& rBound,
+ sal_Int32 nPos) const
+{
+ DBG_ASSERT( pTxtNode != NULL, "Need SwTxtNode!" );
+
+ // attribute boundaries can only occur on portion boundaries
+ FillBoundary( rBound, aAccessiblePositions,
+ FindBreak( aAccessiblePositions, nPos ) );
+}
+
+
+sal_Int32 SwAccessiblePortionData::GetAccessiblePosition( sal_uInt16 nPos ) const
+{
+ DBG_ASSERT( nPos <= pTxtNode->GetTxt().Len(), "illegal position" );
+
+ // find the portion number
+ // --> OD 2006-10-19 #i70538#
+ // consider "empty" model portions - e.g. number portion
+ size_t nPortionNo = FindLastBreak( aModelPositions,
+ static_cast<sal_Int32>(nPos) );
+ // <--
+
+ sal_Int32 nRet = aAccessiblePositions[nPortionNo];
+
+ // if the model portion has more than one position, go into it;
+ // else return that position
+ sal_Int32 nStartPos = aModelPositions[nPortionNo];
+ sal_Int32 nEndPos = aModelPositions[nPortionNo+1];
+ if( (nEndPos - nStartPos) > 1 )
+ {
+ // 'wide' portions have to be of the same width
+ DBG_ASSERT( ( nEndPos - nStartPos ) ==
+ ( aAccessiblePositions[nPortionNo+1] -
+ aAccessiblePositions[nPortionNo] ),
+ "accesability portion disagrees with text model" );
+
+ sal_Int32 nWithinPortion = nPos - aModelPositions[nPortionNo];
+ nRet += nWithinPortion;
+ }
+ // else: return nRet unmodified
+
+ DBG_ASSERT( (nRet >= 0) && (nRet <= sAccessibleString.getLength()),
+ "too long!" );
+ return nRet;
+}
+
+sal_uInt16 SwAccessiblePortionData::FillSpecialPos(
+ sal_Int32 nPos,
+ SwSpecialPos& rPos,
+ SwSpecialPos*& rpPos ) const
+{
+ size_t nPortionNo = FindLastBreak( aAccessiblePositions, nPos );
+
+ sal_uInt8 nExtend(SP_EXTEND_RANGE_NONE);
+ sal_Int32 nRefPos(0);
+ sal_Int32 nModelPos(0);
+
+ if( nPortionNo < nBeforePortions )
+ {
+ nExtend = SP_EXTEND_RANGE_BEFORE;
+ rpPos = &rPos;
+ }
+ else
+ {
+ sal_Int32 nModelEndPos = aModelPositions[nPortionNo+1];
+ nModelPos = aModelPositions[nPortionNo];
+
+ // skip backwards over zero-length portions, since GetCharRect()
+ // counts all model-zero-length portions as belonging to the
+ // previus portion
+ size_t nCorePortionNo = nPortionNo;
+ while( nModelPos == nModelEndPos )
+ {
+ nCorePortionNo--;
+ nModelEndPos = nModelPos;
+ nModelPos = aModelPositions[nCorePortionNo];
+
+ DBG_ASSERT( nModelPos >= 0, "Can't happen." );
+ DBG_ASSERT( nCorePortionNo >= nBeforePortions, "Can't happen." );
+ }
+ DBG_ASSERT( nModelPos != nModelEndPos,
+ "portion with core-representation expected" );
+
+ // if we have anything except plain text, compute nExtend + nRefPos
+ if( (nModelEndPos - nModelPos == 1) &&
+ (pTxtNode->GetTxt().GetChar(static_cast<sal_uInt16>(nModelPos)) !=
+ sAccessibleString.getStr()[nPos]) )
+ {
+ // case 1: a one-character, non-text portion
+ // reference position is the first accessibilty for our
+ // core portion
+ nRefPos = aAccessiblePositions[ nCorePortionNo ];
+ nExtend = SP_EXTEND_RANGE_NONE;
+ rpPos = &rPos;
+ }
+ else if(nPortionNo != nCorePortionNo)
+ {
+ // case 2: a multi-character (text!) portion, followed by
+ // zero-length portions
+ // reference position is the first character of the next
+ // portion, and we are 'behind'
+ nRefPos = aAccessiblePositions[ nCorePortionNo+1 ];
+ nExtend = SP_EXTEND_RANGE_BEHIND;
+ rpPos = &rPos;
+ }
+ else
+ {
+ // case 3: regular text portion
+ DBG_ASSERT( ( nModelEndPos - nModelPos ) ==
+ ( aAccessiblePositions[nPortionNo+1] -
+ aAccessiblePositions[nPortionNo] ),
+ "text portion expected" );
+
+ nModelPos += nPos - aAccessiblePositions[ nPortionNo ];
+ rpPos = NULL;
+ }
+ }
+ if( rpPos != NULL )
+ {
+ DBG_ASSERT( rpPos == &rPos, "Yes!" );
+ DBG_ASSERT( nRefPos <= nPos, "wrong reference" );
+ DBG_ASSERT( (nExtend == SP_EXTEND_RANGE_NONE) ||
+ (nExtend == SP_EXTEND_RANGE_BEFORE) ||
+ (nExtend == SP_EXTEND_RANGE_BEHIND), "need extend" );
+
+ // get the line number, and adjust nRefPos for the line
+ // (if necessary)
+ size_t nRefLine = FindBreak( aLineBreaks, nRefPos );
+ size_t nMyLine = FindBreak( aLineBreaks, nPos );
+ sal_uInt16 nLineOffset = static_cast<sal_uInt16>( nMyLine - nRefLine );
+ if( nLineOffset != 0 )
+ nRefPos = aLineBreaks[ nMyLine ];
+
+ // fill char offset and 'special position'
+ rPos.nCharOfst = static_cast<sal_uInt16>( nPos - nRefPos );
+ rPos.nExtendRange = nExtend;
+ rPos.nLineOfst = nLineOffset;
+ }
+
+ return static_cast<sal_uInt16>( nModelPos );
+}
+
+void SwAccessiblePortionData::AdjustAndCheck(
+ sal_Int32 nPos,
+ size_t& nPortionNo,
+ sal_uInt16& nCorePos,
+ sal_Bool& bEdit) const
+{
+ // find portion and get mode position
+ nPortionNo = FindBreak( aAccessiblePositions, nPos );
+ nCorePos = static_cast<sal_uInt16>( aModelPositions[ nPortionNo ] );
+
+ // for special portions, make sure we're on a portion boundary
+ // for text portions, add the in-portion offset
+ if( IsSpecialPortion( nPortionNo ) )
+ bEdit &= nPos == aAccessiblePositions[nPortionNo];
+ else
+ nCorePos = static_cast<sal_uInt16>( nCorePos +
+ nPos - aAccessiblePositions[nPortionNo] );
+}
+
+sal_Bool SwAccessiblePortionData::GetEditableRange(
+ sal_Int32 nStart, sal_Int32 nEnd,
+ sal_uInt16& nCoreStart, sal_uInt16& nCoreEnd ) const
+{
+ sal_Bool bIsEditable = sal_True;
+
+ // get start and end portions
+ size_t nStartPortion, nEndPortion;
+ AdjustAndCheck( nStart, nStartPortion, nCoreStart, bIsEditable );
+ AdjustAndCheck( nEnd, nEndPortion, nCoreEnd, bIsEditable );
+
+ // iterate over portions, and make sure there is no read-only portion
+ // in-between
+ size_t nLastPortion = nEndPortion;
+
+ // don't count last portion if we're in front of a special portion
+ if( IsSpecialPortion(nLastPortion) )
+ {
+ if (nLastPortion > 0)
+ nLastPortion--;
+ else
+ // special case: because size_t is usually unsigned, we can't just
+ // decrease nLastPortion to -1 (which would normally do the job, so
+ // this whole if wouldn't be needed). Instead, we'll do this
+ // special case and just increae the start portion beyond the last
+ // portion to make sure the loop below will have zero iteration.
+ nStartPortion = nLastPortion + 1;
+ }
+
+ for( size_t nPor = nStartPortion; nPor <= nLastPortion; nPor ++ )
+ {
+ bIsEditable &= ! IsReadOnlyPortion( nPor );
+ }
+
+ return bIsEditable;
+}
+
+sal_Bool SwAccessiblePortionData::IsValidCorePosition( sal_uInt16 nPos ) const
+{
+ // a position is valid its within the model positions that we know
+ return ( aModelPositions[0] <= nPos ) &&
+ ( nPos <= aModelPositions[ aModelPositions.size()-1 ] );
+}
+
+sal_uInt16 SwAccessiblePortionData::GetFirstValidCorePosition() const
+{
+ return static_cast<sal_uInt16>( aModelPositions[0] );
+}
+
+sal_uInt16 SwAccessiblePortionData::GetLastValidCorePosition() const
+{
+ return static_cast<sal_uInt16>( aModelPositions[ aModelPositions.size()-1 ] );
+}
diff --git a/sw/source/core/access/accportions.hxx b/sw/source/core/access/accportions.hxx
new file mode 100644
index 000000000000..1e147ff2d99b
--- /dev/null
+++ b/sw/source/core/access/accportions.hxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCPORTIONS_HXX
+#define _ACCPORTIONS_HXX
+#include <SwPortionHandler.hxx>
+#include <sal/types.h>
+#include <rtl/ustrbuf.hxx>
+#include <vector>
+
+class String;
+class SwTxtNode;
+struct SwSpecialPos;
+class SwViewOption;
+namespace com { namespace sun { namespace star {
+ namespace i18n { struct Boundary; }
+} } }
+
+/**
+ * collect text portion data from the layout through SwPortionHandler interface
+ */
+class SwAccessiblePortionData : public SwPortionHandler
+{
+ // the node this portion is referring to
+ const SwTxtNode* pTxtNode;
+
+ // variables used while collecting the data
+ rtl::OUStringBuffer aBuffer;
+ sal_Int32 nModelPosition;
+ sal_Bool bFinished;
+ const SwViewOption* pViewOptions;
+
+ // the accessible string
+ rtl::OUString sAccessibleString;
+
+ // positions array
+ // instances of Position_t must always include the minimum and
+ // maximum positions as first/last elements (to simplify the
+ // algorithms)
+ typedef std::vector<sal_Int32> Positions_t;
+
+ Positions_t aLineBreaks; /// position of line breaks
+ Positions_t aModelPositions; /// position of portion breaks in the model
+ Positions_t aAccessiblePositions; /// portion breaks in sAccessibleString
+
+ typedef std::vector<sal_uInt8> PortionAttrs_t;
+ PortionAttrs_t aPortionAttrs; /// additional portion attributes
+
+ Positions_t* pSentences; /// positions of sentence breaks
+
+ size_t nBeforePortions; /// # of portions before first model character
+ sal_Bool bLastIsSpecial; /// set if last portion was 'Special()'
+
+ /// returns the index of the first position whose value is smaller
+ /// or equal, and whose following value is equal or larger
+ size_t FindBreak( const Positions_t& rPositions, sal_Int32 nValue ) const;
+
+ /// like FindBreak, but finds the last equal or larger position
+ size_t FindLastBreak( const Positions_t& rPositions, sal_Int32 nValue ) const;
+
+ /// fill the boundary with the values from rPositions[nPos]
+ void FillBoundary(com::sun::star::i18n::Boundary& rBound,
+ const Positions_t& rPositions,
+ size_t nPos ) const;
+
+ /// Access to portion attributes
+ sal_Bool IsPortionAttrSet( size_t nPortionNo, sal_uInt8 nAttr ) const;
+ sal_Bool IsSpecialPortion( size_t nPortionNo ) const;
+ sal_Bool IsReadOnlyPortion( size_t nPortionNo ) const;
+ sal_Bool IsGrayPortionType( sal_uInt16 nType ) const;
+
+ // helper method for GetEditableRange(...):
+ void AdjustAndCheck( sal_Int32 nPos, size_t& nPortionNo,
+ sal_uInt16& nCorePos, sal_Bool& bEdit ) const;
+
+public:
+ SwAccessiblePortionData( const SwTxtNode* pTxtNd,
+ const SwViewOption* pViewOpt = NULL );
+ virtual ~SwAccessiblePortionData();
+
+ // SwPortionHandler methods
+ virtual void Text(sal_uInt16 nLength, sal_uInt16 nType);
+ virtual void Special(sal_uInt16 nLength, const String& rText, sal_uInt16 nType);
+ virtual void LineBreak();
+ virtual void Skip(sal_uInt16 nLength);
+ virtual void Finish();
+
+
+ // access to the portion data
+
+ /// get the text string, as presented by the layout
+ const rtl::OUString& GetAccessibleString() const;
+
+ /// get the start & end positions of the sentence
+ void GetLineBoundary( com::sun::star::i18n::Boundary& rBound,
+ sal_Int32 nPos ) const;
+
+ // get start and end position of the last line
+ void GetLastLineBoundary( com::sun::star::i18n::Boundary& rBound ) const;
+
+ // --> OD 2008-05-30 #i89175#
+ sal_Int32 GetLineCount() const;
+ sal_Int32 GetLineNo( const sal_Int32 nPos ) const;
+ void GetBoundaryOfLine( const sal_Int32 nLineNo,
+ com::sun::star::i18n::Boundary& rLineBound );
+ // <--
+
+ /// get the position in the model string for a given
+ /// (accessibility) position
+ sal_uInt16 GetModelPosition( sal_Int32 nPos ) const;
+
+ /// get the position in the accessibility string for a given model position
+ sal_Int32 GetAccessiblePosition( sal_uInt16 nPos ) const;
+
+ /// fill a SwSpecialPos structure, suitable for calling
+ /// SwTxtFrm->GetCharRect
+ /// Returns the core position, and fills thr rpPos either with NULL or
+ /// with the &rPos, after putting the appropriate data into it.
+ sal_uInt16 FillSpecialPos( sal_Int32 nPos,
+ SwSpecialPos& rPos,
+ SwSpecialPos*& rpPos ) const;
+
+
+ // get boundaries of words/sentences. The data structures are
+ // created on-demand.
+ void GetSentenceBoundary( com::sun::star::i18n::Boundary& rBound,
+ sal_Int32 nPos );
+
+ // get (a) boundary for attribut change
+ void GetAttributeBoundary( com::sun::star::i18n::Boundary& rBound,
+ sal_Int32 nPos ) const;
+
+ /// Convert start and end positions into core positions.
+ /// @returns true if 'special' portions are included either completely
+ /// or not at all. This can be used to test whether editing
+ /// that range would be legal
+ sal_Bool GetEditableRange( sal_Int32 nStart, sal_Int32 nEnd,
+ sal_uInt16& nCoreStart, sal_uInt16& nCoreEnd ) const;
+
+ /// Determine whether this core position is valid for these portions.
+ /// (A paragraph may be split into several frames, e.g. at page
+ /// boundaries. In this case, only part of a paragraph is represented
+ /// through this object. This method determines whether one particular
+ /// position is valid for this object or not.)
+ sal_Bool IsValidCorePosition( sal_uInt16 nPos ) const;
+ sal_uInt16 GetFirstValidCorePosition() const;
+ sal_uInt16 GetLastValidCorePosition() const;
+};
+
+
+#endif
+
diff --git a/sw/source/core/access/accpreview.cxx b/sw/source/core/access/accpreview.cxx
new file mode 100644
index 000000000000..b8fabc3d5f25
--- /dev/null
+++ b/sw/source/core/access/accpreview.cxx
@@ -0,0 +1,104 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vcl/svapp.hxx>
+#include <rtl/uuid.h>
+#ifndef _ACCESS_HRC
+#include "access.hrc"
+#endif
+#include <accpreview.hxx>
+
+
+const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentPageView";
+const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentPageView";
+
+
+// using namespace accessibility;
+
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+
+
+
+//
+// SwAccessiblePreview
+//
+
+SwAccessiblePreview::SwAccessiblePreview( SwAccessibleMap *pMp ) :
+ SwAccessibleDocumentBase( pMp )
+{
+ SetName( GetResource( STR_ACCESS_DOC_NAME ) );
+}
+
+SwAccessiblePreview::~SwAccessiblePreview()
+{
+}
+
+OUString SwAccessiblePreview::getImplementationName( )
+ throw( RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( sImplementationName ) );
+}
+
+sal_Bool SwAccessiblePreview::supportsService( const OUString& rServiceName )
+ throw( RuntimeException )
+{
+ return rServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( sServiceName) ) ||
+ rServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( sAccessibleServiceName ) );
+}
+
+Sequence<OUString> SwAccessiblePreview::getSupportedServiceNames( )
+ throw( RuntimeException )
+{
+ Sequence<OUString> aSeq( 2 );
+ aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( sServiceName ) );
+ aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM( sAccessibleServiceName ) );
+ return aSeq;
+}
+
+Sequence< sal_Int8 > SAL_CALL SwAccessiblePreview::getImplementationId()
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
diff --git a/sw/source/core/access/accpreview.hxx b/sw/source/core/access/accpreview.hxx
new file mode 100644
index 000000000000..aab14dc80026
--- /dev/null
+++ b/sw/source/core/access/accpreview.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCPREVIEW_HXX
+#define _ACCPREVIEW_HXX
+
+#include "accdoc.hxx"
+
+/**
+ * accessibility implementation for the page preview.
+ * The children of the page preview are the pages that are visible in the
+ * preview.
+ *
+ * The vast majority of the implemention logic is inherited from
+ * SwAccessibleDocumentBase.
+ */
+class SwAccessiblePreview : public SwAccessibleDocumentBase
+{
+ virtual ~SwAccessiblePreview();
+
+public:
+
+ SwAccessiblePreview( SwAccessibleMap *pMap );
+
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //====== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx
new file mode 100644
index 000000000000..8e4593377c63
--- /dev/null
+++ b/sw/source/core/access/accselectionhelper.cxx
@@ -0,0 +1,334 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <accselectionhelper.hxx>
+
+#include <acccontext.hxx>
+#include <accmap.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <viewsh.hxx>
+#include <fesh.hxx>
+#include <vcl/svapp.hxx> // for SolarMutex
+#include <tools/debug.hxx>
+#include <flyfrm.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+using ::com::sun::star::accessibility::XAccessible;
+using ::com::sun::star::accessibility::XAccessibleContext;
+using ::com::sun::star::accessibility::XAccessibleSelection;
+
+using namespace ::sw::access;
+
+SwAccessibleSelectionHelper::SwAccessibleSelectionHelper(
+ SwAccessibleContext& rCtxt ) :
+ rContext( rCtxt )
+{
+}
+
+SwAccessibleSelectionHelper::~SwAccessibleSelectionHelper()
+{
+}
+
+SwFEShell* SwAccessibleSelectionHelper::GetFEShell()
+{
+ DBG_ASSERT( rContext.GetMap() != NULL, "no map?" );
+ ViewShell* pViewShell = rContext.GetMap()->GetShell();
+ DBG_ASSERT( pViewShell != NULL,
+ "No view shell? Then what are you looking at?" );
+
+ SwFEShell* pFEShell = NULL;
+ if( pViewShell->ISA( SwFEShell ) )
+ {
+ pFEShell = static_cast<SwFEShell*>( pViewShell );
+ }
+
+ return pFEShell;
+}
+
+void SwAccessibleSelectionHelper::throwIndexOutOfBoundsException()
+ throw ( lang::IndexOutOfBoundsException )
+{
+ Reference < XAccessibleContext > xThis( &rContext );
+ Reference < XAccessibleSelection >xSelThis( xThis, UNO_QUERY );
+ lang::IndexOutOfBoundsException aExcept(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("index out of bounds") ),
+ xSelThis ); \
+ throw aExcept;
+}
+
+
+//===== XAccessibleSelection ============================================
+
+void SwAccessibleSelectionHelper::selectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // Get the respective child as SwFrm (also do index checking), ...
+ const SwAccessibleChild aChild = rContext.GetChild( *(rContext.GetMap()),
+ nChildIndex );
+ if( !aChild.IsValid() )
+ throwIndexOutOfBoundsException();
+
+ // we can only select fly frames, so we ignore (should: return
+ // false) all other attempts at child selection
+ sal_Bool bRet = sal_False;
+ SwFEShell* pFEShell = GetFEShell();
+ if( pFEShell != NULL )
+ {
+ const SdrObject *pObj = aChild.GetDrawObject();
+ if( pObj )
+ {
+ bRet = rContext.Select( const_cast< SdrObject *>( pObj ), 0==aChild.GetSwFrm());
+ }
+ }
+ // no frame shell, or no frame, or no fly frame -> can't select
+
+ // return bRet;
+}
+
+sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // Get the respective child as SwFrm (also do index checking), ...
+ const SwAccessibleChild aChild = rContext.GetChild( *(rContext.GetMap()),
+ nChildIndex );
+ if( !aChild.IsValid() )
+ throwIndexOutOfBoundsException();
+
+ // ... and compare to the currently selected frame
+ sal_Bool bRet = sal_False;
+ SwFEShell* pFEShell = GetFEShell();
+ if( pFEShell )
+ {
+ if ( aChild.GetSwFrm() != 0 )
+ {
+ bRet = (pFEShell->GetCurrFlyFrm() == aChild.GetSwFrm());
+ }
+ else if ( aChild.GetDrawObject() )
+ {
+ bRet = pFEShell->IsObjSelected( *aChild.GetDrawObject() );
+ }
+ }
+
+ return bRet;
+}
+
+void SwAccessibleSelectionHelper::clearAccessibleSelection( )
+ throw ( RuntimeException )
+{
+ // return sal_False // we can't deselect
+}
+
+void SwAccessibleSelectionHelper::selectAllAccessibleChildren( )
+ throw ( RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // We can select only one. So iterate over the children to find
+ // the first we can select, and select it.
+
+ SwFEShell* pFEShell = GetFEShell();
+ if( pFEShell )
+ {
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
+
+ ::std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin();
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end();
+ while( aIter != aEndIter )
+ {
+ const SwAccessibleChild& rChild = *aIter;
+ const SdrObject* pObj = rChild.GetDrawObject();
+ const SwFrm* pFrm = rChild.GetSwFrm();
+ if( pObj && !(pFrm != 0 && pFEShell->IsObjSelected()) )
+ {
+ rContext.Select( const_cast< SdrObject *>( pObj ), 0==pFrm );
+ if( pFrm )
+ break;
+ }
+ ++aIter;
+ }
+ }
+}
+
+sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
+ throw ( RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ sal_Int32 nCount = 0;
+ // Only one frame can be selected at a time, and we only frames
+ // for selectable children.
+ SwFEShell* pFEShell = GetFEShell();
+ if( pFEShell != 0 )
+ {
+ const SwFlyFrm* pFlyFrm = pFEShell->GetCurrFlyFrm();
+ if( pFlyFrm )
+ {
+ if( rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
+ rContext.GetFrm() )
+ {
+ nCount = 1;
+ }
+ }
+ else
+ {
+ sal_uInt16 nSelObjs = pFEShell->IsObjSelected();
+ if( nSelObjs > 0 )
+ {
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
+
+ ::std::list< SwAccessibleChild >::const_iterator aIter =
+ aChildren.begin();
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter =
+ aChildren.end();
+ while( aIter != aEndIter && nCount < nSelObjs )
+ {
+ const SwAccessibleChild& rChild = *aIter;
+ if( rChild.GetDrawObject() && !rChild.GetSwFrm() &&
+ rContext.GetParent(rChild, rContext.IsInPagePreview())
+ == rContext.GetFrm() &&
+ pFEShell->IsObjSelected( *rChild.GetDrawObject() ) )
+ {
+ nCount++;
+ }
+ ++aIter;
+ }
+ }
+ }
+ }
+ return nCount;
+}
+
+Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // Since the index is relative to the selected children, and since
+ // there can be at most one selected frame child, the index must
+ // be 0, and a selection must exist, otherwise we have to throw an
+ // lang::IndexOutOfBoundsException
+ SwFEShell* pFEShell = GetFEShell();
+ if( 0 == pFEShell )
+ throwIndexOutOfBoundsException();
+
+ SwAccessibleChild aChild;
+ const SwFlyFrm *pFlyFrm = pFEShell->GetCurrFlyFrm();
+ if( pFlyFrm )
+ {
+ if( 0 == nSelectedChildIndex &&
+ rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
+ rContext.GetFrm() )
+ {
+ aChild = pFlyFrm;
+ }
+ }
+ else
+ {
+ sal_uInt16 nSelObjs = pFEShell->IsObjSelected();
+ if( 0 == nSelObjs || nSelectedChildIndex >= nSelObjs )
+ throwIndexOutOfBoundsException();
+
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
+
+ ::std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin();
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end();
+ while( aIter != aEndIter && !aChild.IsValid() )
+ {
+ const SwAccessibleChild& rChild = *aIter;
+ if( rChild.GetDrawObject() && !rChild.GetSwFrm() &&
+ rContext.GetParent(rChild, rContext.IsInPagePreview()) ==
+ rContext.GetFrm() &&
+ pFEShell->IsObjSelected( *rChild.GetDrawObject() ) )
+ {
+ if( 0 == nSelectedChildIndex )
+ aChild = rChild;
+ else
+ --nSelectedChildIndex;
+ }
+ ++aIter;
+ }
+ }
+
+ if( !aChild.IsValid() )
+ throwIndexOutOfBoundsException();
+
+ DBG_ASSERT( rContext.GetMap() != NULL, "We need the map." );
+ Reference< XAccessible > xChild;
+ if( aChild.GetSwFrm() )
+ {
+ ::vos::ORef < SwAccessibleContext > xChildImpl(
+ rContext.GetMap()->GetContextImpl( aChild.GetSwFrm(),
+ sal_True ) );
+ if( xChildImpl.isValid() )
+ {
+ xChildImpl->SetParent( &rContext );
+ xChild = xChildImpl.getBodyPtr();
+ }
+ }
+ else if ( aChild.GetDrawObject() )
+ {
+ ::vos::ORef < ::accessibility::AccessibleShape > xChildImpl(
+ rContext.GetMap()->GetContextImpl( aChild.GetDrawObject(),
+ &rContext, sal_True ) );
+ if( xChildImpl.isValid() )
+ xChild = xChildImpl.getBodyPtr();
+ }
+ return xChild;
+}
+
+// --> OD 2004-11-16 #111714# - index has to be treated as global child index.
+void SwAccessibleSelectionHelper::deselectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ RuntimeException )
+{
+ // return sal_False // we can't deselect
+ if( nChildIndex < 0 ||
+ nChildIndex >= rContext.GetChildCount( *(rContext.GetMap()) ) )
+ throwIndexOutOfBoundsException();
+}
diff --git a/sw/source/core/access/accselectionhelper.hxx b/sw/source/core/access/accselectionhelper.hxx
new file mode 100644
index 000000000000..ff0833d25ed6
--- /dev/null
+++ b/sw/source/core/access/accselectionhelper.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCSELECTIONHELPER_HXX_
+#define _ACCSELECTIONHELPER_HXX_
+class SwAccessibleContext;
+class SwFEShell;
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
+class SwAccessibleSelectionHelper
+{
+ /// the context on which this helper works
+ SwAccessibleContext& rContext;
+
+
+ /// get FE-Shell
+ SwFEShell* GetFEShell();
+
+ void throwIndexOutOfBoundsException()
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+
+public:
+
+ SwAccessibleSelectionHelper( SwAccessibleContext& rContext );
+ ~SwAccessibleSelectionHelper();
+
+
+ //===== XAccessibleSelection ============================================
+
+ void selectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ sal_Bool isAccessibleChildSelected(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+ void clearAccessibleSelection( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ void selectAllAccessibleChildren( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ sal_Int32 getSelectedAccessibleChildCount( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getSelectedAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
+ void deselectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+};
+
+
+#endif
+
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
new file mode 100644
index 000000000000..fd788574aad7
--- /dev/null
+++ b/sw/source/core/access/acctable.cxx
@@ -0,0 +1,1804 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vos/mutex.hxx>
+#include <rtl/uuid.h>
+#include <rtl/ustrbuf.hxx>
+
+#include <list>
+#include <set>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <vcl/svapp.hxx>
+#include <frmfmt.hxx>
+#include <tabfrm.hxx>
+#include <rowfrm.hxx>
+#include <cellfrm.hxx>
+#include <swtable.hxx>
+#include <crsrsh.hxx>
+#include <viscrs.hxx>
+#include <hints.hxx>
+#include <fesh.hxx>
+#include <accfrmobjslist.hxx>
+#include <accmap.hxx>
+#include <access.hrc>
+#include <acctable.hxx>
+
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::sw::access;
+
+const sal_Char sServiceName[] = "com.sun.star.table.AccessibleTableView";
+const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleTableView";
+
+typedef ::std::less < sal_Int32 > Int32Less_Impl;
+typedef ::std::set < sal_Int32, Int32Less_Impl > Int32Set_Impl;
+
+typedef ::std::pair < sal_Int32, sal_Int32 > Int32Pair_Impl;
+typedef ::std::list < Int32Pair_Impl > Int32PairList_Impl;
+
+class SwAccTableSelHander_Impl
+{
+public:
+ virtual void Unselect( sal_Int32 nRowOrCol, sal_Int32 nExt ) = 0;
+};
+
+
+//------------------------------------------------------------------------------
+
+class SwAccessibleTableData_Impl
+{
+ SwAccessibleMap& mrAccMap;
+ Int32Set_Impl maRows;
+ Int32Set_Impl maColumns;
+ Int32PairList_Impl maExtents; // cell extends for event processing only
+ Point maTabFrmPos;
+ const SwTabFrm *mpTabFrm;
+ sal_Bool mbIsInPagePreview;
+ bool mbOnlyTableColumnHeader;
+
+ void CollectData( const SwFrm *pFrm );
+ void CollectExtents( const SwFrm *pFrm );
+
+ sal_Bool FindCell( const Point& rPos, const SwFrm *pFrm ,
+ sal_Bool bExact, const SwFrm *& rFrm ) const;
+
+ void GetSelection( const Point& rTabPos, const SwRect& rArea,
+ const SwSelBoxes& rSelBoxes, const SwFrm *pFrm,
+ SwAccTableSelHander_Impl& rSelHdl,
+ sal_Bool bColumns ) const;
+
+ // --> OD 2007-06-27 #i77106#
+ inline bool IncludeRow( const SwFrm& rFrm ) const
+ {
+ return !mbOnlyTableColumnHeader ||
+ mpTabFrm->IsInHeadline( rFrm );
+ }
+ // <--
+public:
+ // --> OD 2007-06-27 #i77106#
+ // add third optional parameter <bOnlyTableColumnHeader>, default value <false>
+ SwAccessibleTableData_Impl( SwAccessibleMap& rAccMap,
+ const SwTabFrm *pTabFrm,
+ sal_Bool bIsInPagePreview,
+ bool bOnlyTableColumnHeader = false );
+ // <--
+
+ const Int32Set_Impl& GetRows() const { return maRows; }
+ const Int32Set_Impl& GetColumns() const { return maColumns; }
+
+ inline Int32Set_Impl::const_iterator GetRowIter( sal_Int32 nRow ) const;
+ inline Int32Set_Impl::const_iterator GetColumnIter( sal_Int32 nCol ) const;
+
+ const SwFrm *GetCell( sal_Int32 nRow, sal_Int32 nColumn, sal_Bool bExact,
+ SwAccessibleTable *pThis ) const
+ throw(lang::IndexOutOfBoundsException );
+ const SwFrm *GetCellAtPos( sal_Int32 nLeft, sal_Int32 nTop,
+ sal_Bool bExact ) const;
+ inline sal_Int32 GetRowCount() const;
+ inline sal_Int32 GetColumnCount() const;
+ sal_Bool CompareExtents( const SwAccessibleTableData_Impl& r ) const;
+
+ void GetSelection( sal_Int32 nStart, sal_Int32 nEnd,
+ const SwSelBoxes& rSelBoxes,
+ SwAccTableSelHander_Impl& rSelHdl,
+ sal_Bool bColumns ) const;
+
+ void CheckRowAndCol( sal_Int32 nRow, sal_Int32 nCol,
+ SwAccessibleTable *pThis ) const
+ throw(lang::IndexOutOfBoundsException );
+
+ void GetRowColumnAndExtent( const SwRect& rBox,
+ sal_Int32& rRow, sal_Int32& rColumn,
+ sal_Int32& rRowExtent,
+ sal_Int32& rColumnExtent ) const;
+
+ const Point& GetTablePos() const { return maTabFrmPos; }
+ void SetTablePos( const Point& rPos ) { maTabFrmPos = rPos; }
+};
+
+void SwAccessibleTableData_Impl::CollectData( const SwFrm *pFrm )
+{
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
+ while( aIter != aEndIter )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm *pLower = rLower.GetSwFrm();
+ if( pLower )
+ {
+ if( pLower->IsRowFrm() )
+ {
+ // --> OD 2007-06-27 #i77106#
+ if ( IncludeRow( *pLower ) )
+ {
+ maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() );
+ CollectData( pLower );
+ }
+ // <--
+ }
+ else if( pLower->IsCellFrm() &&
+ rLower.IsAccessible( mbIsInPagePreview ) )
+ {
+ maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() );
+ }
+ else
+ {
+ CollectData( pLower );
+ }
+ }
+ ++aIter;
+ }
+}
+
+void SwAccessibleTableData_Impl::CollectExtents( const SwFrm *pFrm )
+{
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
+ while( aIter != aEndIter )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm *pLower = rLower.GetSwFrm();
+ if( pLower )
+ {
+ if( pLower->IsCellFrm() &&
+ rLower.IsAccessible( mbIsInPagePreview ) )
+ {
+ sal_Int32 nRow, nCol;
+ Int32Pair_Impl aCellExtents;
+ GetRowColumnAndExtent( pLower->Frm(), nRow, nCol,
+ aCellExtents.first,
+ aCellExtents.second );
+
+ maExtents.push_back( aCellExtents );
+ }
+ else
+ {
+ // --> OD 2007-06-27 #i77106#
+ if ( !pLower->IsRowFrm() ||
+ IncludeRow( *pLower ) )
+ {
+ CollectExtents( pLower );
+ }
+ // <--
+ }
+ }
+ ++aIter;
+ }
+}
+
+sal_Bool SwAccessibleTableData_Impl::FindCell(
+ const Point& rPos, const SwFrm *pFrm, sal_Bool bExact,
+ const SwFrm *& rRet ) const
+{
+ sal_Bool bFound = sal_False;
+
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
+ while( !bFound && aIter != aEndIter )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm *pLower = rLower.GetSwFrm();
+ ASSERT( pLower, "child should be a frame" );
+ if( pLower )
+ {
+ if( rLower.IsAccessible( mbIsInPagePreview ) )
+ {
+ ASSERT( pLower->IsCellFrm(), "lower is not a cell frame" );
+ const SwRect& rFrm = pLower->Frm();
+ if( rFrm.Right() >= rPos.X() && rFrm.Bottom() >= rPos.Y() )
+ {
+ // We have found the cell
+ ASSERT( rFrm.Left() <= rPos.X() && rFrm.Top() <= rPos.Y(),
+ "find frame moved to far!" );
+ bFound = sal_True;
+ if( !bExact ||
+ (rFrm.Top() == rPos.Y() && rFrm.Left() == rPos.Y() ) )
+ {
+ rRet = pLower;
+ }
+ }
+ }
+ else
+ {
+ // --> OD 2007-06-27 #i77106#
+ if ( !pLower->IsRowFrm() ||
+ IncludeRow( *pLower ) )
+ {
+ bFound = FindCell( rPos, pLower, bExact, rRet );
+ }
+ // <--
+ }
+ }
+ ++aIter;
+ }
+
+ return bFound;
+}
+
+void SwAccessibleTableData_Impl::GetSelection(
+ const Point& rTabPos,
+ const SwRect& rArea,
+ const SwSelBoxes& rSelBoxes,
+ const SwFrm *pFrm,
+ SwAccTableSelHander_Impl& rSelHdl,
+ sal_Bool bColumns ) const
+{
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
+ while( aIter != aEndIter )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm *pLower = rLower.GetSwFrm();
+ ASSERT( pLower, "child should be a frame" );
+ const SwRect& rBox = rLower.GetBox( mrAccMap );
+ if( pLower && rBox.IsOver( rArea ) )
+ {
+ if( rLower.IsAccessible( mbIsInPagePreview ) )
+ {
+ ASSERT( pLower->IsCellFrm(), "lower is not a cell frame" );
+ const SwCellFrm *pCFrm =
+ static_cast < const SwCellFrm * >( pLower );
+ SwTableBox *pBox =
+ const_cast< SwTableBox *>( pCFrm->GetTabBox() ); //SVPtrArr!
+ if( !rSelBoxes.Seek_Entry( pBox ) )
+ {
+ const Int32Set_Impl rRowsOrCols =
+ bColumns ? maColumns : maRows;
+
+ sal_Int32 nPos = bColumns ? (rBox.Left() - rTabPos.X())
+ : (rBox.Top() - rTabPos.Y());
+ Int32Set_Impl::const_iterator aSttRowOrCol(
+ rRowsOrCols.lower_bound( nPos ) );
+ sal_Int32 nRowOrCol =
+ static_cast< sal_Int32 >( ::std::distance(
+ rRowsOrCols.begin(), aSttRowOrCol ) );
+
+ nPos = bColumns ? (rBox.Right() - rTabPos.X())
+ : (rBox.Bottom() - rTabPos.Y());
+ Int32Set_Impl::const_iterator aEndRowOrCol(
+ rRowsOrCols.upper_bound( nPos ) );
+ sal_Int32 nExt =
+ static_cast< sal_Int32 >( ::std::distance(
+ aSttRowOrCol, aEndRowOrCol ) );
+
+ rSelHdl.Unselect( nRowOrCol, nExt );
+ }
+ }
+ else
+ {
+ // --> OD 2007-06-27 #i77106#
+ if ( !pLower->IsRowFrm() ||
+ IncludeRow( *pLower ) )
+ {
+ GetSelection( rTabPos, rArea, rSelBoxes, pLower, rSelHdl,
+ bColumns );
+ }
+ // <--
+ }
+ }
+ ++aIter;
+ }
+}
+
+const SwFrm *SwAccessibleTableData_Impl::GetCell(
+ sal_Int32 nRow, sal_Int32 nColumn, sal_Bool,
+ SwAccessibleTable *pThis ) const
+ throw(lang::IndexOutOfBoundsException )
+{
+ CheckRowAndCol( nRow, nColumn, pThis );
+
+ Int32Set_Impl::const_iterator aSttCol( GetColumnIter( nColumn ) );
+ Int32Set_Impl::const_iterator aSttRow( GetRowIter( nRow ) );
+ const SwFrm *pCellFrm = GetCellAtPos( *aSttCol, *aSttRow, sal_False );
+
+ return pCellFrm;
+}
+
+void SwAccessibleTableData_Impl::GetSelection(
+ sal_Int32 nStart, sal_Int32 nEnd,
+ const SwSelBoxes& rSelBoxes,
+ SwAccTableSelHander_Impl& rSelHdl,
+ sal_Bool bColumns ) const
+{
+ SwRect aArea( mpTabFrm->Frm() );
+ Point aPos( aArea.Pos() );
+
+ const Int32Set_Impl& rRowsOrColumns = bColumns ? maColumns : maRows;
+ if( nStart > 0 )
+ {
+ Int32Set_Impl::const_iterator aStt( rRowsOrColumns.begin() );
+ ::std::advance( aStt,
+ static_cast< Int32Set_Impl::difference_type >( nStart ) );
+ if( bColumns )
+ aArea.Left( *aStt + aPos.X() );
+ else
+ aArea.Top( *aStt + aPos.Y() );
+ }
+ if( nEnd < static_cast< sal_Int32 >( rRowsOrColumns.size() ) )
+ {
+ Int32Set_Impl::const_iterator aEnd( rRowsOrColumns.begin() );
+ ::std::advance( aEnd,
+ static_cast< Int32Set_Impl::difference_type >( nEnd ) );
+ if( bColumns )
+ aArea.Right( *aEnd + aPos.X() - 1 );
+ else
+ aArea.Bottom( *aEnd + aPos.Y() - 1 );
+ }
+
+ GetSelection( aPos, aArea, rSelBoxes, mpTabFrm, rSelHdl, bColumns );
+}
+
+const SwFrm *SwAccessibleTableData_Impl::GetCellAtPos(
+ sal_Int32 nLeft, sal_Int32 nTop, sal_Bool bExact ) const
+{
+ Point aPos( mpTabFrm->Frm().Pos() );
+ aPos.Move( nLeft, nTop );
+ const SwFrm *pRet = 0;
+ FindCell( aPos, mpTabFrm, bExact, pRet );
+
+ return pRet;
+}
+
+inline sal_Int32 SwAccessibleTableData_Impl::GetRowCount() const
+{
+ return static_cast< sal_Int32 >( maRows.size() );
+}
+
+inline sal_Int32 SwAccessibleTableData_Impl::GetColumnCount() const
+{
+ return static_cast< sal_Int32 >( maColumns.size() );
+}
+
+sal_Bool SwAccessibleTableData_Impl::CompareExtents(
+ const SwAccessibleTableData_Impl& rCmp ) const
+{
+ if( maExtents.size() != rCmp.maExtents.size() )
+ return sal_False;
+
+ Int32PairList_Impl::const_iterator aIter( maExtents.begin() );
+ Int32PairList_Impl::const_iterator aEndIter( maExtents.end() );
+ Int32PairList_Impl::const_iterator aCmpIter( rCmp.maExtents.begin() );
+ while( aIter != aEndIter )
+ {
+ if( *aIter != *aCmpIter )
+ return sal_False;
+
+ ++aIter;
+ ++aCmpIter;
+ }
+
+ return sal_True;
+}
+
+SwAccessibleTableData_Impl::SwAccessibleTableData_Impl( SwAccessibleMap& rAccMap,
+ const SwTabFrm *pTabFrm,
+ sal_Bool bIsInPagePreview,
+ bool bOnlyTableColumnHeader )
+ : mrAccMap( rAccMap )
+ , maTabFrmPos( pTabFrm->Frm().Pos() )
+ , mpTabFrm( pTabFrm )
+ , mbIsInPagePreview( bIsInPagePreview )
+ , mbOnlyTableColumnHeader( bOnlyTableColumnHeader )
+{
+ CollectData( mpTabFrm );
+ CollectExtents( mpTabFrm );
+}
+
+inline Int32Set_Impl::const_iterator SwAccessibleTableData_Impl::GetRowIter(
+ sal_Int32 nRow ) const
+{
+ Int32Set_Impl::const_iterator aCol( GetRows().begin() );
+ if( nRow > 0 )
+ {
+ ::std::advance( aCol,
+ static_cast< Int32Set_Impl::difference_type >( nRow ) );
+ }
+ return aCol;
+}
+
+inline Int32Set_Impl::const_iterator SwAccessibleTableData_Impl::GetColumnIter(
+ sal_Int32 nColumn ) const
+{
+ Int32Set_Impl::const_iterator aCol = GetColumns().begin();
+ if( nColumn > 0 )
+ {
+ ::std::advance( aCol,
+ static_cast< Int32Set_Impl::difference_type >( nColumn ) );
+ }
+ return aCol;
+}
+
+void SwAccessibleTableData_Impl::CheckRowAndCol(
+ sal_Int32 nRow, sal_Int32 nCol, SwAccessibleTable *pThis ) const
+ throw(lang::IndexOutOfBoundsException )
+{
+ if( ( nRow < 0 || nRow >= static_cast< sal_Int32 >( maRows.size() ) ) ||
+ ( nCol < 0 || nCol >= static_cast< sal_Int32 >( maColumns.size() ) ) )
+ {
+ uno::Reference < XAccessibleTable > xThis( pThis );
+ lang::IndexOutOfBoundsException aExcept(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "row or column index out of range") ),
+ xThis );
+ throw aExcept;
+ }
+}
+
+void SwAccessibleTableData_Impl::GetRowColumnAndExtent(
+ const SwRect& rBox,
+ sal_Int32& rRow, sal_Int32& rColumn,
+ sal_Int32& rRowExtent, sal_Int32& rColumnExtent ) const
+{
+ Int32Set_Impl::const_iterator aStt(
+ maRows.lower_bound( rBox.Top() - maTabFrmPos.Y() ) );
+ Int32Set_Impl::const_iterator aEnd(
+ maRows.upper_bound( rBox.Bottom() - maTabFrmPos.Y() ) );
+ rRow =
+ static_cast< sal_Int32 >( ::std::distance( maRows.begin(), aStt ) );
+ rRowExtent =
+ static_cast< sal_Int32 >( ::std::distance( aStt, aEnd ) );
+
+ aStt = maColumns.lower_bound( rBox.Left() - maTabFrmPos.X() );
+ aEnd = maColumns.upper_bound( rBox.Right() - maTabFrmPos.X() );
+ rColumn =
+ static_cast< sal_Int32 >( ::std::distance( maColumns.begin(), aStt ) );
+ rColumnExtent =
+ static_cast< sal_Int32 >( ::std::distance( aStt, aEnd ) );
+}
+
+//------------------------------------------------------------------------------
+
+class SwAccSingleTableSelHander_Impl : public SwAccTableSelHander_Impl
+{
+ sal_Bool bSelected;
+
+public:
+
+ inline SwAccSingleTableSelHander_Impl();
+
+ inline sal_Bool IsSelected() const { return bSelected; }
+
+ virtual void Unselect( sal_Int32, sal_Int32 );
+};
+
+inline SwAccSingleTableSelHander_Impl::SwAccSingleTableSelHander_Impl() :
+ bSelected( sal_True )
+{
+}
+
+void SwAccSingleTableSelHander_Impl::Unselect( sal_Int32, sal_Int32 )
+{
+ bSelected = sal_False;
+}
+
+//------------------------------------------------------------------------------
+
+class SwAccAllTableSelHander_Impl : public SwAccTableSelHander_Impl
+
+{
+ ::std::vector< sal_Bool > aSelected;
+ sal_Int32 nCount;
+
+public:
+
+ inline SwAccAllTableSelHander_Impl( sal_Int32 nSize );
+
+ uno::Sequence < sal_Int32 > GetSelSequence();
+
+ virtual void Unselect( sal_Int32 nRowOrCol, sal_Int32 nExt );
+ virtual ~SwAccAllTableSelHander_Impl();
+};
+
+SwAccAllTableSelHander_Impl::~SwAccAllTableSelHander_Impl()
+{
+}
+
+inline SwAccAllTableSelHander_Impl::SwAccAllTableSelHander_Impl( sal_Int32 nSize ) :
+ aSelected( nSize, sal_True ),
+ nCount( nSize )
+{
+}
+
+uno::Sequence < sal_Int32 > SwAccAllTableSelHander_Impl::GetSelSequence()
+{
+ ASSERT( nCount >= 0, "underflow" );
+ uno::Sequence < sal_Int32 > aRet( nCount );
+ sal_Int32 *pRet = aRet.getArray();
+ sal_Int32 nPos = 0;
+ size_t nSize = aSelected.size();
+ for( size_t i=0; i < nSize && nPos < nCount; i++ )
+ {
+ if( aSelected[i] )
+ {
+ *pRet++ = i;
+ nPos++;
+ }
+ }
+
+ ASSERT( nPos == nCount, "count is wrong" );
+
+ return aRet;
+}
+
+void SwAccAllTableSelHander_Impl::Unselect( sal_Int32 nRowOrCol,
+ sal_Int32 nExt )
+{
+ ASSERT( static_cast< size_t >( nRowOrCol ) < aSelected.size(),
+ "index to large" );
+ ASSERT( static_cast< size_t >( nRowOrCol+nExt ) <= aSelected.size(),
+ "extent to large" );
+ while( nExt )
+ {
+ if( aSelected[static_cast< size_t >( nRowOrCol )] )
+ {
+ aSelected[static_cast< size_t >( nRowOrCol )] = sal_False;
+ nCount--;
+ }
+ nExt--;
+ nRowOrCol++;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+const SwSelBoxes *SwAccessibleTable::GetSelBoxes() const
+{
+ const SwSelBoxes *pSelBoxes = 0;
+ const SwCrsrShell *pCSh = GetCrsrShell();
+ if( (pCSh != NULL) && pCSh->IsTableMode() )
+ {
+ pSelBoxes = &pCSh->GetTableCrsr()->GetBoxes();
+ }
+
+ return pSelBoxes;
+}
+
+void SwAccessibleTable::FireTableChangeEvent(
+ const SwAccessibleTableData_Impl& rTableData )
+{
+ AccessibleTableModelChange aModelChange;
+ aModelChange.Type = AccessibleTableModelChangeType::UPDATE;
+ aModelChange.FirstRow = 0;
+ aModelChange.LastRow = rTableData.GetRowCount() - 1;
+ aModelChange.FirstColumn = 0;
+ aModelChange.LastColumn = rTableData.GetColumnCount() - 1;
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::TABLE_MODEL_CHANGED;
+ aEvent.NewValue <<= aModelChange;
+
+ FireAccessibleEvent( aEvent );
+}
+
+
+const SwTableBox* SwAccessibleTable::GetTableBox( sal_Int32 nChildIndex ) const
+{
+ DBG_ASSERT( nChildIndex >= 0, "Illegal child index." );
+ // --> OD 2007-06-27 #i77106#
+ DBG_ASSERT( nChildIndex < const_cast<SwAccessibleTable*>(this)->getAccessibleChildCount(), "Illegal child index." );
+ // <--
+
+ const SwTableBox* pBox = NULL;
+
+ // get table box for 'our' table cell
+ SwAccessibleChild aCell( GetChild( *(const_cast<SwAccessibleMap*>(GetMap())), nChildIndex ) );
+ if( aCell.GetSwFrm() )
+ {
+ const SwFrm* pChildFrm = aCell.GetSwFrm();
+ if( (pChildFrm != NULL) && pChildFrm->IsCellFrm() )
+ {
+ const SwCellFrm* pCellFrm =
+ static_cast<const SwCellFrm*>( pChildFrm );
+ pBox = pCellFrm->GetTabBox();
+ }
+ }
+
+ DBG_ASSERT( pBox != NULL, "We need the table box." );
+ return pBox;
+}
+
+sal_Bool SwAccessibleTable::IsChildSelected( sal_Int32 nChildIndex ) const
+{
+ sal_Bool bRet = sal_False;
+ const SwSelBoxes* pSelBoxes = GetSelBoxes();
+ if( pSelBoxes )
+ {
+ const SwTableBox* pBox = GetTableBox( nChildIndex );
+ DBG_ASSERT( pBox != NULL, "We need the table box." );
+ bRet = pSelBoxes->Seek_Entry( const_cast<SwTableBox*>( pBox ) );
+ }
+
+ return bRet;
+}
+
+sal_Int32 SwAccessibleTable::GetIndexOfSelectedChild(
+ sal_Int32 nSelectedChildIndex ) const
+{
+ // iterate over all children to n-th isAccessibleChildSelected()
+ // --> OD 2007-06-27 #i77106#
+ sal_Int32 nChildren = const_cast<SwAccessibleTable*>(this)->getAccessibleChildCount();
+ // <--
+ if( nSelectedChildIndex >= nChildren )
+ return -1L;
+
+ sal_Int32 n = 0;
+ while( n < nChildren )
+ {
+ if( IsChildSelected( n ) )
+ {
+ if( 0 == nSelectedChildIndex )
+ break;
+ else
+ --nSelectedChildIndex;
+ }
+ ++n;
+ }
+
+ return n < nChildren ? n : -1L;
+}
+
+void SwAccessibleTable::GetStates(
+ ::utl::AccessibleStateSetHelper& rStateSet )
+{
+ SwAccessibleContext::GetStates( rStateSet );
+
+ // MULTISELECTABLE
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell )
+ rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
+}
+
+SwAccessibleTable::SwAccessibleTable(
+ SwAccessibleMap* pInitMap,
+ const SwTabFrm* pTabFrm ) :
+ SwAccessibleContext( pInitMap, AccessibleRole::TABLE, pTabFrm ),
+ mpTableData( 0 )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
+ const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
+ const String& rName = pFrmFmt->GetName();
+
+ OUStringBuffer aBuffer( rName.Len() + 4 );
+ aBuffer.append( OUString(rName) );
+ aBuffer.append( static_cast<sal_Unicode>( '-' ) );
+ aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
+
+ SetName( aBuffer.makeStringAndClear() );
+
+ OUString sArg1( static_cast< const SwTabFrm * >( GetFrm() )
+ ->GetFmt()->GetName() );
+ OUString sArg2( GetFormattedPageNumber() );
+
+ sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
+}
+
+SwAccessibleTable::~SwAccessibleTable()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ delete mpTableData;
+}
+
+void SwAccessibleTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
+{
+ sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+ const SwTabFrm *pTabFrm = static_cast< const SwTabFrm * >( GetFrm() );
+ switch( nWhich )
+ {
+ case RES_NAME_CHANGED:
+ if( pTabFrm )
+ {
+ const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
+ ASSERT( pFrmFmt == GetRegisteredIn(), "invalid frame" );
+
+ OUString sOldName( GetName() );
+
+ const String& rNewTabName = pFrmFmt->GetName();
+ OUStringBuffer aBuffer( rNewTabName.Len() + 4 );
+ aBuffer.append( OUString(rNewTabName) );
+ aBuffer.append( static_cast<sal_Unicode>( '-' ) );
+ aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
+
+ SetName( aBuffer.makeStringAndClear() );
+ if( sOldName != GetName() )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::NAME_CHANGED;
+ aEvent.OldValue <<= sOldName;
+ aEvent.NewValue <<= GetName();
+ FireAccessibleEvent( aEvent );
+ }
+
+ OUString sOldDesc( sDesc );
+ OUString sArg1( rNewTabName );
+ OUString sArg2( GetFormattedPageNumber() );
+
+ sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
+ if( sDesc != sOldDesc )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
+ aEvent.OldValue <<= sOldDesc;
+ aEvent.NewValue <<= sDesc;
+ FireAccessibleEvent( aEvent );
+ }
+ }
+ break;
+
+ case RES_OBJECTDYING:
+ // mba: it seems that this class intentionally does not call code in base class SwClient
+ if( GetRegisteredIn() ==
+ static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) )
+ GetRegisteredInNonConst()->Remove( this );
+ break;
+
+ default:
+ // mba: former call to base class method removed as it is meant to handle only RES_OBJECTDYING
+ break;
+ }
+}
+
+uno::Any SwAccessibleTable::queryInterface( const uno::Type& rType )
+ throw (uno::RuntimeException)
+{
+ uno::Any aRet;
+ if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleTable > * >( 0 ) ) )
+ {
+ uno::Reference<XAccessibleTable> xThis( this );
+ aRet <<= xThis;
+ }
+ else if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) ) )
+ {
+ uno::Reference<XAccessibleSelection> xSelection( this );
+ aRet <<= xSelection;
+ }
+ else
+ {
+ aRet = SwAccessibleContext::queryInterface(rType);
+ }
+
+ return aRet;
+}
+
+//====== XTypeProvider ====================================================
+uno::Sequence< uno::Type > SAL_CALL SwAccessibleTable::getTypes()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() );
+
+ sal_Int32 nIndex = aTypes.getLength();
+ aTypes.realloc( nIndex + 2 );
+
+ uno::Type* pTypes = aTypes.getArray();
+ pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) );
+ pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleTable > * >( 0 ) );
+
+ return aTypes;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleTable::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+// --> OD 2007-06-28 #i77106#
+SwAccessibleTableData_Impl* SwAccessibleTable::CreateNewTableData()
+{
+ const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
+ return new SwAccessibleTableData_Impl( *GetMap(), pTabFrm, IsInPagePreview() );
+}
+// <--
+
+void SwAccessibleTable::UpdateTableData()
+{
+ // --> OD 2007-06-28 #i77106# - usage of new method <CreateNewTableData()>
+ delete mpTableData;
+ mpTableData = CreateNewTableData();
+ // <--
+}
+
+void SwAccessibleTable::ClearTableData()
+{
+ delete mpTableData;
+ mpTableData = 0;
+}
+
+OUString SAL_CALL SwAccessibleTable::getAccessibleDescription (void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ return sDesc;
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowCount()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ return GetTableData().GetRowCount();
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumnCount( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ return GetTableData().GetColumnCount();
+}
+
+OUString SAL_CALL SwAccessibleTable::getAccessibleRowDescription(
+ sal_Int32 nRow )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ // --> OD 2010-03-10 #i87532#
+ // determine table cell in <nRow>th row and in first column of row header table
+ // and return its text content.
+ OUString sRowDesc;
+
+ GetTableData().CheckRowAndCol(nRow, 0, this);
+
+ uno::Reference< XAccessibleTable > xTableRowHeader = getAccessibleRowHeaders();
+ if ( xTableRowHeader.is() )
+ {
+ uno::Reference< XAccessible > xRowHeaderCell =
+ xTableRowHeader->getAccessibleCellAt( nRow, 0 );
+ ASSERT( xRowHeaderCell.is(),
+ "<SwAccessibleTable::getAccessibleRowDescription(..)> - missing row header cell -> serious issue." );
+ uno::Reference< XAccessibleContext > xRowHeaderCellContext =
+ xRowHeaderCell->getAccessibleContext();
+ const sal_Int32 nCellChildCount( xRowHeaderCellContext->getAccessibleChildCount() );
+ for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
+ {
+ uno::Reference< XAccessible > xChild = xRowHeaderCellContext->getAccessibleChild( nChildIndex );
+ uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
+ if ( xChildText.is() )
+ {
+ sRowDesc = sRowDesc + xChildText->getText();
+ }
+ }
+ }
+
+ return sRowDesc;
+ // <--
+}
+
+OUString SAL_CALL SwAccessibleTable::getAccessibleColumnDescription(
+ sal_Int32 nColumn )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ // --> OD 2010-03-10 #i87532#
+ // determine table cell in first row and in <nColumn>th column of column header table
+ // and return its text content.
+ OUString sColumnDesc;
+
+ GetTableData().CheckRowAndCol(0, nColumn, this);
+
+ uno::Reference< XAccessibleTable > xTableColumnHeader = getAccessibleColumnHeaders();
+ if ( xTableColumnHeader.is() )
+ {
+ uno::Reference< XAccessible > xColumnHeaderCell =
+ xTableColumnHeader->getAccessibleCellAt( 0, nColumn );
+ ASSERT( xColumnHeaderCell.is(),
+ "<SwAccessibleTable::getAccessibleColumnDescription(..)> - missing column header cell -> serious issue." );
+ uno::Reference< XAccessibleContext > xColumnHeaderCellContext =
+ xColumnHeaderCell->getAccessibleContext();
+ const sal_Int32 nCellChildCount( xColumnHeaderCellContext->getAccessibleChildCount() );
+ for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
+ {
+ uno::Reference< XAccessible > xChild = xColumnHeaderCellContext->getAccessibleChild( nChildIndex );
+ uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
+ if ( xChildText.is() )
+ {
+ sColumnDesc = sColumnDesc + xChildText->getText();
+ }
+ }
+ }
+
+ return sColumnDesc;
+ // <--
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowExtentAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ sal_Int32 nExtend = -1;
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ GetTableData().CheckRowAndCol( nRow, nColumn, this );
+
+ Int32Set_Impl::const_iterator aSttCol(
+ GetTableData().GetColumnIter( nColumn ) );
+ Int32Set_Impl::const_iterator aSttRow(
+ GetTableData().GetRowIter( nRow ) );
+ const SwFrm *pCellFrm = GetTableData().GetCellAtPos( *aSttCol, *aSttRow,
+ sal_False );
+ if( pCellFrm )
+ {
+ sal_Int32 nBottom = pCellFrm->Frm().Bottom();
+ nBottom -= GetFrm()->Frm().Top();
+ Int32Set_Impl::const_iterator aEndRow(
+ GetTableData().GetRows().upper_bound( nBottom ) );
+ nExtend =
+ static_cast< sal_Int32 >( ::std::distance( aSttRow, aEndRow ) );
+ }
+
+ return nExtend;
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumnExtentAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ sal_Int32 nExtend = -1;
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ GetTableData().CheckRowAndCol( nRow, nColumn, this );
+
+ Int32Set_Impl::const_iterator aSttCol(
+ GetTableData().GetColumnIter( nColumn ) );
+ Int32Set_Impl::const_iterator aSttRow(
+ GetTableData().GetRowIter( nRow ) );
+ const SwFrm *pCellFrm = GetTableData().GetCellAtPos( *aSttCol, *aSttRow,
+ sal_False );
+ if( pCellFrm )
+ {
+ sal_Int32 nRight = pCellFrm->Frm().Right();
+ nRight -= GetFrm()->Frm().Left();
+ Int32Set_Impl::const_iterator aEndCol(
+ GetTableData().GetColumns().upper_bound( nRight ) );
+ nExtend =
+ static_cast< sal_Int32 >( ::std::distance( aSttCol, aEndCol ) );
+ }
+
+ return nExtend;
+}
+
+uno::Reference< XAccessibleTable > SAL_CALL
+ SwAccessibleTable::getAccessibleRowHeaders( )
+ throw (uno::RuntimeException)
+{
+ // Row headers aren't supported
+ return uno::Reference< XAccessibleTable >();
+}
+
+uno::Reference< XAccessibleTable > SAL_CALL
+ SwAccessibleTable::getAccessibleColumnHeaders( )
+ throw (uno::RuntimeException)
+{
+ // --> OD 2010-03-10 #i87532#
+ // assure that return accesible object is empty, if no column header exists.
+ SwAccessibleTableColHeaders* pTableColHeaders =
+ new SwAccessibleTableColHeaders( GetMap(), static_cast< const SwTabFrm *>( GetFrm() ) );
+ uno::Reference< XAccessibleTable > xTableColumnHeaders( pTableColHeaders );
+ if ( pTableColHeaders->getAccessibleChildCount() <= 0 )
+ {
+ return uno::Reference< XAccessibleTable >();
+ }
+
+ return xTableColumnHeaders;
+ // <--
+}
+
+uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleRows()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ const SwSelBoxes *pSelBoxes = GetSelBoxes();
+ if( pSelBoxes )
+ {
+ sal_Int32 nRows = GetTableData().GetRowCount();
+ SwAccAllTableSelHander_Impl aSelRows( nRows );
+
+ GetTableData().GetSelection( 0, nRows, *pSelBoxes, aSelRows,
+ sal_False );
+
+ return aSelRows.GetSelSequence();
+ }
+ else
+ {
+ return uno::Sequence< sal_Int32 >( 0 );
+ }
+}
+
+uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleColumns()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ const SwSelBoxes *pSelBoxes = GetSelBoxes();
+ if( pSelBoxes )
+ {
+ sal_Int32 nCols = GetTableData().GetColumnCount();
+ SwAccAllTableSelHander_Impl aSelCols( nCols );
+
+ GetTableData().GetSelection( 0, nCols, *pSelBoxes, aSelCols, sal_True );
+
+ return aSelCols.GetSelSequence();
+ }
+ else
+ {
+ return uno::Sequence< sal_Int32 >( 0 );
+ }
+}
+
+sal_Bool SAL_CALL SwAccessibleTable::isAccessibleRowSelected( sal_Int32 nRow )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ GetTableData().CheckRowAndCol( nRow, 0, this );
+
+ sal_Bool bRet;
+ const SwSelBoxes *pSelBoxes = GetSelBoxes();
+ if( pSelBoxes )
+ {
+ SwAccSingleTableSelHander_Impl aSelRow;
+ GetTableData().GetSelection( nRow, nRow+1, *pSelBoxes, aSelRow,
+ sal_False );
+ bRet = aSelRow.IsSelected();
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+sal_Bool SAL_CALL SwAccessibleTable::isAccessibleColumnSelected(
+ sal_Int32 nColumn )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ GetTableData().CheckRowAndCol( 0, nColumn, this );
+
+ sal_Bool bRet;
+ const SwSelBoxes *pSelBoxes = GetSelBoxes();
+ if( pSelBoxes )
+ {
+ SwAccSingleTableSelHander_Impl aSelCol;
+
+ GetTableData().GetSelection( nColumn, nColumn+1, *pSelBoxes, aSelCol,
+ sal_True );
+ bRet = aSelCol.IsSelected();
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCellAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ uno::Reference< XAccessible > xRet;
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ const SwFrm *pCellFrm =
+ GetTableData().GetCell( nRow, nColumn, sal_False, this );
+ if( pCellFrm )
+ xRet = GetMap()->GetContext( pCellFrm, sal_True );
+
+ return xRet;
+}
+
+uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCaption()
+ throw (uno::RuntimeException)
+{
+ // captions aren't supported
+ return uno::Reference< XAccessible >();
+}
+
+uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleSummary()
+ throw (uno::RuntimeException)
+{
+ // summaries aren't supported
+ return uno::Reference< XAccessible >();
+}
+
+sal_Bool SAL_CALL SwAccessibleTable::isAccessibleSelected(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ sal_Bool bRet = sal_False;
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ const SwFrm *pFrm =
+ GetTableData().GetCell( nRow, nColumn, sal_False, this );
+ if( pFrm && pFrm->IsCellFrm() )
+ {
+ const SwSelBoxes *pSelBoxes = GetSelBoxes();
+ if( pSelBoxes )
+ {
+ const SwCellFrm *pCFrm = static_cast < const SwCellFrm * >( pFrm );
+ SwTableBox *pBox =
+ const_cast< SwTableBox *>( pCFrm->GetTabBox() ); //SVPtrArr!
+ bRet = pSelBoxes->Seek_Entry( pBox );
+ }
+ }
+
+ return bRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleIndex(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ sal_Int32 nRet = -1;
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ SwAccessibleChild aCell( GetTableData().GetCell( nRow, nColumn, sal_False, this ));
+ if ( aCell.IsValid() )
+ {
+ nRet = GetChildIndex( *(GetMap()), aCell );
+ }
+
+ return nRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRow( sal_Int32 nChildIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ sal_Int32 nRet = -1;
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ // --> OD 2007-06-27 #i77106#
+ if ( ( nChildIndex < 0 ) ||
+ ( nChildIndex >= getAccessibleChildCount() ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+ // <--
+
+ SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
+ if ( aCell.GetSwFrm() )
+ {
+ sal_Int32 nTop = aCell.GetSwFrm()->Frm().Top();
+ nTop -= GetFrm()->Frm().Top();
+ Int32Set_Impl::const_iterator aRow(
+ GetTableData().GetRows().lower_bound( nTop ) );
+ nRet = static_cast< sal_Int32 >( ::std::distance(
+ GetTableData().GetRows().begin(), aRow ) );
+ }
+ else
+ {
+ ASSERT( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:"
+ "aCell not expected to be valid.");
+
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ return nRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumn(
+ sal_Int32 nChildIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ sal_Int32 nRet = -1;
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable )
+
+ // --> OD 2007-06-27 #i77106#
+ if ( ( nChildIndex < 0 ) ||
+ ( nChildIndex >= getAccessibleChildCount() ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+ // <--
+
+ SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
+ if ( aCell.GetSwFrm() )
+ {
+ sal_Int32 nLeft = aCell.GetSwFrm()->Frm().Left();
+ nLeft -= GetFrm()->Frm().Left();
+ Int32Set_Impl::const_iterator aCol(
+ GetTableData().GetColumns().lower_bound( nLeft ) );
+ nRet = static_cast< sal_Int32 >( ::std::distance(
+ GetTableData().GetColumns().begin(), aCol ) );
+ }
+ else
+ {
+ ASSERT( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:"
+ "aCell not expected to be valid.");
+
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ return nRet;
+}
+
+
+OUString SAL_CALL SwAccessibleTable::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
+}
+
+sal_Bool SAL_CALL SwAccessibleTable::supportsService(
+ const OUString& sTestServiceName)
+ throw (uno::RuntimeException)
+{
+ return sTestServiceName.equalsAsciiL( sServiceName,
+ sizeof(sServiceName)-1 ) ||
+ sTestServiceName.equalsAsciiL( sAccessibleServiceName,
+ sizeof(sAccessibleServiceName)-1 );
+}
+
+uno::Sequence< OUString > SAL_CALL SwAccessibleTable::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
+ pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ return aRet;
+}
+
+void SwAccessibleTable::InvalidatePosOrSize( const SwRect& rOldBox )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if( HasTableData() )
+ GetTableData().SetTablePos( GetFrm()->Frm().Pos() );
+
+ SwAccessibleContext::InvalidatePosOrSize( rOldBox );
+}
+
+void SwAccessibleTable::Dispose( sal_Bool bRecursive )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if( GetRegisteredIn() )
+ GetRegisteredInNonConst()->Remove( this );
+
+ SwAccessibleContext::Dispose( bRecursive );
+}
+
+void SwAccessibleTable::DisposeChild( const SwAccessibleChild& rChildFrmOrObj,
+ sal_Bool bRecursive )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const SwFrm *pFrm = rChildFrmOrObj.GetSwFrm();
+ ASSERT( pFrm, "frame expected" );
+ if( HasTableData() )
+ {
+ FireTableChangeEvent( GetTableData() );
+ ClearTableData();
+ }
+
+ // There are two reason why this method has been called. The first one
+ // is there is no context for pFrm. The method is them called by
+ // the map, and we have to call our superclass.
+ // The other situation is that we have been call by a call to get notified
+ // about its change. We then must not call the superclass
+ uno::Reference< XAccessible > xAcc( GetMap()->GetContext( pFrm, sal_False ) );
+ if( !xAcc.is() )
+ SwAccessibleContext::DisposeChild( rChildFrmOrObj, bRecursive );
+}
+
+void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChildFrmOrObj,
+ const SwRect& rOldBox )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if( HasTableData() )
+ {
+ ASSERT( !HasTableData() ||
+ GetFrm()->Frm().Pos() == GetTableData().GetTablePos(),
+ "table has invalid position" );
+ if( HasTableData() )
+ {
+ // --> OD 2007-06-28 #i77106#
+ SwAccessibleTableData_Impl *pNewTableData = CreateNewTableData();
+ // <--
+ if( !pNewTableData->CompareExtents( GetTableData() ) )
+ {
+ FireTableChangeEvent( GetTableData() );
+ ClearTableData();
+ mpTableData = pNewTableData;
+ }
+ else
+ {
+ delete pNewTableData;
+ }
+ }
+ }
+
+ // --> OD 2010-02-18 #i013961# - always call super class method
+ SwAccessibleContext::InvalidateChildPosOrSize( rChildFrmOrObj, rOldBox );
+ // <--
+}
+
+
+//
+// XAccessibleSelection
+//
+
+void SAL_CALL SwAccessibleTable::selectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleTable );
+
+ // --> OD 2007-06-27 #i77106#
+ if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) )
+ // <--
+ throw lang::IndexOutOfBoundsException();
+
+ // preliminaries: get 'our' table box, and get the cursor shell
+ const SwTableBox* pBox = GetTableBox( nChildIndex );
+ DBG_ASSERT( pBox != NULL, "We need the table box." );
+
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell == NULL )
+ return;
+
+ // --> OD 2004-11-16 #111714# - assure, that child, indentified by the given
+ // index, isn't already selected.
+ if ( IsChildSelected( nChildIndex ) )
+ {
+ return;
+ }
+ // <--
+
+ // now we can start to do the work: check whether we already have
+ // a table selection (in 'our' table). If so, extend the
+ // selection, else select the current cell.
+
+ // if we have a selection in a table, check if it's in the
+ // same table that we're trying to select in
+ const SwTableNode* pSelectedTable = pCrsrShell->IsCrsrInTbl();
+ if( pSelectedTable != NULL )
+ {
+ // get top-most table line
+ const SwTableLine* pUpper = pBox->GetUpper();
+ while( pUpper->GetUpper() != NULL )
+ pUpper = pUpper->GetUpper()->GetUpper();
+ sal_uInt16 nPos =
+ pSelectedTable->GetTable().GetTabLines().GetPos( pUpper );
+ if( nPos == USHRT_MAX )
+ pSelectedTable = NULL;
+ }
+
+ // create the new selection
+ const SwStartNode* pStartNode = pBox->GetSttNd();
+ if( pSelectedTable == NULL || !pCrsrShell->GetTblCrs() )
+ {
+ // if we're in the wrong table, or there's no table selection
+ // at all, then select the current table cell.
+// SwPaM* pPaM = pCrsrShell->GetCrsr();
+// pPaM->DeleteMark();
+// *(pPaM->GetPoint()) = SwPosition( *pStartNode );
+// pPaM->Move( fnMoveForward, fnGoNode );
+// // pCrsrShell->SelTblBox();
+
+ pCrsrShell->StartAction();
+ // Set cursor into current cell. This deletes any table cursor.
+ SwPaM aPaM( *pStartNode );
+ aPaM.Move( fnMoveForward, fnGoNode );
+ Select( aPaM );
+ // Move cursor to the end of the table creating a selection and a table
+ // cursor.
+ pCrsrShell->SetMark();
+ pCrsrShell->MoveTable( fnTableCurr, fnTableEnd );
+ // now set the cursor into the cell again.
+ SwPaM *pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
+ : pCrsrShell->GetCrsr();
+ *pPaM->GetPoint() = *pPaM->GetMark();
+ pCrsrShell->EndAction();
+ // we now have one cell selected!
+ }
+ else
+ {
+ // if the cursor is already in this table,
+ // expand the current selection (i.e., set
+ // point to new position; keep mark)
+ SwPaM aPaM( *pStartNode );
+ aPaM.Move( fnMoveForward, fnGoNode );
+ aPaM.SetMark();
+ const SwPaM *pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
+ : pCrsrShell->GetCrsr();
+ *(aPaM.GetMark()) = *pPaM->GetMark();
+ Select( aPaM );
+
+ // if only one box is selected, we select this one in
+ // order to maintain our table selection
+// if( aPaM.GetPoint()->nNode.GetNode().FindTableBoxStartNode() ==
+// aPaM.GetMark()->nNode.GetNode().FindTableBoxStartNode() )
+// {
+// // pCrsrShell->SelTblBox();
+// }
+// else
+// {
+ // finally; set the selection. This will call UpdateCursor
+ // on the cursor shell, too.
+// pCrsrShell->KillPams();
+ // pCrsrShell->SetSelection( aPaM );
+// }
+ }
+}
+
+
+sal_Bool SAL_CALL SwAccessibleTable::isAccessibleChildSelected(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleTable );
+
+ // --> OD 2007-06-27 #i77106#
+ if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) )
+ // <--
+ throw lang::IndexOutOfBoundsException();
+
+ return IsChildSelected( nChildIndex );
+}
+
+void SAL_CALL SwAccessibleTable::clearAccessibleSelection( )
+ throw ( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleTable );
+
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL )
+ {
+ pCrsrShell->StartAction();
+ pCrsrShell->ClearMark();
+ pCrsrShell->EndAction();
+ }
+}
+
+void SAL_CALL SwAccessibleTable::selectAllAccessibleChildren( )
+ throw ( uno::RuntimeException )
+{
+ // first clear selection, then select first and last child
+ clearAccessibleSelection();
+ selectAccessibleChild( 0 );
+ // --> OD 2007-06-27 #i77106#
+ selectAccessibleChild( getAccessibleChildCount()-1 );
+ // <--
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::getSelectedAccessibleChildCount( )
+ throw ( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleTable );
+
+ // iterate over all children and count isAccessibleChildSelected()
+ sal_Int32 nCount = 0;
+
+ // --> OD 2007-06-27 #i71106#
+ sal_Int32 nChildren = getAccessibleChildCount();
+ // <--
+ for( sal_Int32 n = 0; n < nChildren; n++ )
+ if( IsChildSelected( n ) )
+ nCount++;
+
+ return nCount;
+}
+
+uno::Reference<XAccessible> SAL_CALL SwAccessibleTable::getSelectedAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleTable );
+
+ // paremter checking (part 1): index lower 0
+ if( nSelectedChildIndex < 0 )
+ throw lang::IndexOutOfBoundsException();
+
+ sal_Int32 nChildIndex = GetIndexOfSelectedChild( nSelectedChildIndex );
+
+ // parameter checking (part 2): index higher than selected children?
+ if( nChildIndex < 0 )
+ throw lang::IndexOutOfBoundsException();
+
+ // --> OD 2007-06-28 #i77106#
+ if ( nChildIndex >= getAccessibleChildCount() )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+ // <--
+
+ return getAccessibleChild( nChildIndex );
+}
+
+// --> OD 2004-11-16 #111714# - index has to be treated as global child index.
+void SAL_CALL SwAccessibleTable::deselectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleTable );
+
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+
+ // --> OD 2004-11-16 #111714# - index has to be treated as global child index
+ if ( !pCrsrShell )
+ throw lang::IndexOutOfBoundsException();
+
+ // assure, that given child index is in bounds.
+ // --> OD 2007-06-27 #i77106#
+ if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
+ // <--
+ throw lang::IndexOutOfBoundsException();
+
+ // assure, that child, identified by the given index, is selected.
+ if ( !IsChildSelected( nChildIndex ) )
+ return;
+ // <--
+
+ const SwTableBox* pBox = GetTableBox( nChildIndex );
+ DBG_ASSERT( pBox != NULL, "We need the table box." );
+
+ // If we unselect point, then set cursor to mark. If we clear another
+ // selected box, then set cursor to point.
+ // reduce selection to mark.
+ SwPaM *pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
+ : pCrsrShell->GetCrsr();
+ sal_Bool bDeselectPoint =
+ pBox->GetSttNd() ==
+ pPaM->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+
+ SwPaM aPaM( bDeselectPoint ? *pPaM->GetMark() : *pPaM->GetPoint() );
+
+ pCrsrShell->StartAction();
+
+ // Set cursor into either point or mark
+ Select( aPaM );
+ // Move cursor to the end of the table creating a selection and a table
+ // cursor.
+ pCrsrShell->SetMark();
+ pCrsrShell->MoveTable( fnTableCurr, fnTableEnd );
+ // now set the cursor into the cell again.
+ pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
+ : pCrsrShell->GetCrsr();
+ *pPaM->GetPoint() = *pPaM->GetMark();
+ pCrsrShell->EndAction();
+}
+
+// --> OD 2007-06-28 #i77106#
+// implementation of class <SwAccessibleTableColHeaders>
+SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2,
+ const SwTabFrm *pTabFrm )
+ : SwAccessibleTable( pMap2, pTabFrm )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
+ const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
+ const String& rName = pFrmFmt->GetName();
+
+ OUStringBuffer aBuffer( rName.Len() + 15 + 6 );
+ aBuffer.append( OUString(rName) );
+ aBuffer.append( String::CreateFromAscii("-ColumnHeaders-") );
+ aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
+
+ SetName( aBuffer.makeStringAndClear() );
+
+ OUStringBuffer aBuffer2( rName.Len() + 14 );
+ aBuffer2.append( OUString(rName) );
+ aBuffer2.append( String::CreateFromAscii("-ColumnHeaders") );
+ OUString sArg1( aBuffer2.makeStringAndClear() );
+ OUString sArg2( GetFormattedPageNumber() );
+
+ OUString sDesc2 = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
+ SetDesc( sDesc2 );
+
+ // --> OD 2008-03-10 #i85634#
+ NotRegisteredAtAccessibleMap();
+ // <--
+}
+
+SwAccessibleTableData_Impl* SwAccessibleTableColHeaders::CreateNewTableData()
+{
+ const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
+ return new SwAccessibleTableData_Impl( *(GetMap()), pTabFrm, IsInPagePreview(), true );
+}
+
+
+void SwAccessibleTableColHeaders::Modify( const SfxPoolItem * /*pOld*/, const SfxPoolItem * /*pNew*/ )
+{
+}
+
+//===== XInterface ======================================================
+uno::Any SAL_CALL SwAccessibleTableColHeaders::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ return SwAccessibleTable::queryInterface( aType );
+}
+
+//===== XAccessibleContext ==============================================
+sal_Int32 SAL_CALL SwAccessibleTableColHeaders::getAccessibleChildCount(void)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ sal_Int32 nCount = 0;
+
+ const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
+ const SwAccessibleChildSList aVisList( GetVisArea(), *pTabFrm, *(GetMap()) );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
+ while( aIter != aVisList.end() )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ if( rLower.IsAccessible( IsInPagePreview() ) )
+ {
+ nCount++;
+ }
+ else if( rLower.GetSwFrm() )
+ {
+ // There are no unaccessible SdrObjects that count
+ if ( !rLower.GetSwFrm()->IsRowFrm() ||
+ pTabFrm->IsInHeadline( *(rLower.GetSwFrm()) ) )
+ {
+ nCount += SwAccessibleFrame::GetChildCount( *(GetMap()),
+ GetVisArea(),
+ rLower.GetSwFrm(),
+ IsInPagePreview() );
+ }
+ }
+ ++aIter;
+ }
+
+ return nCount;
+}
+
+uno::Reference< XAccessible> SAL_CALL
+ SwAccessibleTableColHeaders::getAccessibleChild (sal_Int32 nIndex)
+ throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ if ( nIndex < 0 || nIndex >= getAccessibleChildCount() )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ return SwAccessibleTable::getAccessibleChild( nIndex );
+}
+
+//===== XAccessibleTable ================================================
+uno::Reference< XAccessibleTable >
+ SAL_CALL SwAccessibleTableColHeaders::getAccessibleRowHeaders()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< XAccessibleTable >();
+}
+
+uno::Reference< XAccessibleTable >
+ SAL_CALL SwAccessibleTableColHeaders::getAccessibleColumnHeaders()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< XAccessibleTable >();
+}
+
+//===== XServiceInfo ====================================================
+
+::rtl::OUString SAL_CALL SwAccessibleTableColHeaders::getImplementationName (void)
+ throw (uno::RuntimeException)
+{
+ static const sal_Char sImplName[] = "com.sun.star.comp.Writer.SwAccessibleTableColumnHeadersView";
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplName));
+}
diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx
new file mode 100644
index 000000000000..82141c09bead
--- /dev/null
+++ b/sw/source/core/access/acctable.hxx
@@ -0,0 +1,331 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCTABLE_HXX
+#define _ACCTABLE_HXX
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
+#include <acccontext.hxx>
+
+class SwTabFrm;
+class SwAccessibleTableData_Impl;
+class SwTableBox;
+class SwSelBoxes;
+
+namespace sw { namespace access {
+ class SwAccessibleChild;
+} }
+
+class SwAccessibleTable :
+ public SwAccessibleContext,
+ public ::com::sun::star::accessibility::XAccessibleTable,
+ public ::com::sun::star::accessibility::XAccessibleSelection,
+ public SwClient
+{
+ SwAccessibleTableData_Impl *mpTableData; // the table's data, prot by Sol-Mutex
+ ::rtl::OUString sDesc;
+ const SwSelBoxes *GetSelBoxes() const;
+
+ void FireTableChangeEvent( const SwAccessibleTableData_Impl& rTableData );
+
+ /** get the SwTableBox* for the given child */
+ const SwTableBox* GetTableBox( sal_Int32 ) const;
+
+ sal_Bool IsChildSelected( sal_Int32 nChildIndex ) const;
+
+ sal_Int32 GetIndexOfSelectedChild( sal_Int32 nSelectedChildIndex ) const;
+
+protected:
+
+ // Set states for getAccessibleStateSet.
+ // This drived class additinaly sets MULTISELECTABLE(+)
+ virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
+
+ virtual ~SwAccessibleTable();
+
+ // --> OD 2007-06-27 #i77106#
+ inline void SetDesc( ::rtl::OUString sNewDesc )
+ {
+ sDesc = sNewDesc;
+ }
+
+ // --> OD 2007-06-28 #i77106#
+ virtual SwAccessibleTableData_Impl* CreateNewTableData();
+ // <--
+
+ // force update of table data
+ void UpdateTableData();
+
+ // remove the current table data
+ void ClearTableData();
+
+ // get table data, update if necessary
+ inline SwAccessibleTableData_Impl& GetTableData();
+
+ // Is table data evailable?
+ sal_Bool HasTableData() const { return (mpTableData != 0); }
+
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+
+ SwAccessibleTable( SwAccessibleMap* pInitMap, const SwTabFrm* pTableFrm );
+
+ //===== XInterface ======================================================
+
+ // (XInterface methods need to be implemented to disambigouate
+ // between those inherited through SwAcessibleContext and
+ // XAccessibleTable).
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire( ) throw ()
+ { SwAccessibleContext::acquire(); };
+
+ virtual void SAL_CALL release( ) throw ()
+ { SwAccessibleContext::release(); };
+
+ //====== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleTable ================================================
+
+ virtual sal_Int32 SAL_CALL getAccessibleRowCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumnCount( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription(
+ sal_Int32 nRow )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription(
+ sal_Int32 nColumn )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable >
+ SAL_CALL getAccessibleRowHeaders( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable >
+ SAL_CALL getAccessibleColumnHeaders( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+ getSelectedAccessibleRows( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+ getSelectedAccessibleColumns( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleCaption( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleSummary( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleSelected(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndex(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== C++ interface ======================================================
+
+ // The object has been moved by the layout
+ virtual void InvalidatePosOrSize( const SwRect& rOldBox );
+
+ // The object is not visible an longer and should be destroyed
+ virtual void Dispose( sal_Bool bRecursive = sal_False );
+
+ virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj,
+ sal_Bool bRecursive );
+ virtual void InvalidateChildPosOrSize( const sw::access::SwAccessibleChild& rFrmOrObj,
+ const SwRect& rFrm );
+
+ //===== XAccessibleSelection ============================================
+
+ virtual void SAL_CALL selectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL clearAccessibleSelection( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL selectAllAccessibleChildren( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
+ virtual void SAL_CALL deselectAccessibleChild(
+ sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+};
+
+inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData()
+{
+ if( !mpTableData )
+ UpdateTableData();
+ return *mpTableData;
+}
+
+// --> OD 2007-06-28 #i77106#
+// subclass to represent table column headers
+class SwAccessibleTableColHeaders : public SwAccessibleTable
+{
+protected:
+
+ virtual ~SwAccessibleTableColHeaders()
+ {}
+
+ virtual SwAccessibleTableData_Impl* CreateNewTableData();
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+
+ SwAccessibleTableColHeaders( SwAccessibleMap *pMap, const SwTabFrm *pTabFrm );
+
+ //===== XInterface ======================================================
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire( ) throw ()
+ { SwAccessibleContext::acquire(); };
+
+ virtual void SAL_CALL release( ) throw ()
+ { SwAccessibleContext::release(); };
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the specified child or NULL if index is invalid.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 nIndex)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException);
+
+ //===== XAccessibleTable ================================================
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable >
+ SAL_CALL getAccessibleRowHeaders( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable >
+ SAL_CALL getAccessibleColumnHeaders( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+// <--
+#endif
diff --git a/sw/source/core/access/acctextframe.cxx b/sw/source/core/access/acctextframe.cxx
new file mode 100644
index 000000000000..c0188c7eb193
--- /dev/null
+++ b/sw/source/core/access/acctextframe.cxx
@@ -0,0 +1,278 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <rtl/uuid.h>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRelation.hpp>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <frmfmt.hxx>
+#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;
+using namespace ::com::sun::star::accessibility;
+using ::rtl::OUString;
+
+using utl::AccessibleRelationSetHelper;
+using ::com::sun::star::accessibility::XAccessibleContext;
+
+const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextFrameView";
+const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleTextFrameView";
+
+SwAccessibleTextFrame::SwAccessibleTextFrame(
+ SwAccessibleMap* pInitMap,
+ const SwFlyFrm* 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()
+{
+}
+
+void SwAccessibleTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *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 );
+ }
+
+ const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm * >( GetFrm() );
+ switch( nWhich )
+ {
+ // --> OD 2009-07-14 #i73249#
+ case RES_TITLE_CHANGED:
+ {
+ const String& sOldTitle(
+ dynamic_cast<const SwStringMsgPoolItem*>(pOld)->GetString() );
+ const String& sNewTitle(
+ dynamic_cast<const SwStringMsgPoolItem*>(pNew)->GetString() );
+ if ( sOldTitle == sNewTitle )
+ {
+ 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;
+ // <--
+ }
+}
+
+// --> 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)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleContext )
+
+ return msDesc;
+
+}
+
+OUString SAL_CALL SwAccessibleTextFrame::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
+}
+
+sal_Bool SAL_CALL SwAccessibleTextFrame::supportsService(
+ const OUString& sTestServiceName)
+ throw (uno::RuntimeException)
+{
+ return sTestServiceName.equalsAsciiL( sServiceName,
+ sizeof(sServiceName)-1 ) ||
+ sTestServiceName.equalsAsciiL( sAccessibleServiceName,
+ sizeof(sAccessibleServiceName)-1 );
+}
+
+uno::Sequence< OUString > SAL_CALL SwAccessibleTextFrame::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
+ pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ return aRet;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleTextFrame::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+
+//
+// XAccessibleRelationSet
+//
+
+
+SwFlyFrm* SwAccessibleTextFrame::getFlyFrm() const
+{
+ SwFlyFrm* pFlyFrm = NULL;
+
+ const SwFrm* pFrm = GetFrm();
+ DBG_ASSERT( pFrm != NULL, "frame expected" );
+ if( pFrm->IsFlyFrm() )
+ {
+ pFlyFrm = static_cast<SwFlyFrm*>( const_cast<SwFrm*>( pFrm ) );
+ }
+
+ return pFlyFrm;
+}
+
+AccessibleRelation SwAccessibleTextFrame::makeRelation( sal_Int16 nType, const SwFlyFrm* pFrm )
+{
+ uno::Sequence<uno::Reference<XInterface> > aSequence(1);
+ aSequence[0] = GetMap()->GetContext( pFrm );
+ return AccessibleRelation( nType, aSequence );
+}
+
+
+uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleTextFrame::getAccessibleRelationSet( )
+ throw ( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleContext );
+
+ // get the frame, and insert prev/next relations into helper
+
+ AccessibleRelationSetHelper* pHelper = new AccessibleRelationSetHelper();
+
+ SwFlyFrm* pFlyFrm = getFlyFrm();
+ DBG_ASSERT( pFlyFrm != NULL, "fly frame expected" );
+
+ const SwFlyFrm* pPrevFrm = pFlyFrm->GetPrevLink();
+ if( pPrevFrm != NULL )
+ pHelper->AddRelation( makeRelation(
+ AccessibleRelationType::CONTENT_FLOWS_FROM, pPrevFrm ) );
+
+ const SwFlyFrm* pNextFrm = pFlyFrm->GetNextLink();
+ if( pNextFrm != NULL )
+ pHelper->AddRelation( makeRelation(
+ AccessibleRelationType::CONTENT_FLOWS_TO, pNextFrm ) );
+
+ return pHelper;
+}
diff --git a/sw/source/core/access/acctextframe.hxx b/sw/source/core/access/acctextframe.hxx
new file mode 100644
index 000000000000..a2b891de18e4
--- /dev/null
+++ b/sw/source/core/access/acctextframe.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _ACCTEXTFRAME_HXX
+#define _ACCTEXTFRAME_HXX
+#include "accframebase.hxx"
+
+class SwFlyFrm;
+namespace utl { class AccessibleRelationSetHelper; }
+namespace com { namespace star {
+ namespace accessibility { struct AccessibleRelation; }
+} }
+
+class SwAccessibleTextFrame : public SwAccessibleFrameBase
+{
+private:
+ // --> OD 2009-07-14 #i73249#
+ ::rtl::OUString msTitle;
+ ::rtl::OUString msDesc;
+ // <--
+
+protected:
+
+ virtual ~SwAccessibleTextFrame();
+
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+
+public:
+
+ SwAccessibleTextFrame( SwAccessibleMap* pInitMap, const SwFlyFrm* pFlyFrm );
+
+ //===== 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)
+ throw (com::sun::star::uno::RuntimeException);
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const ::rtl::OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //====== XTypeProvider ====================================================
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ //===== XAccessibleContext::getAccessibleRelationSet ====================
+
+ // text frame may have accessible relations to their
+ // predocesor/successor frames
+
+private:
+ // helper methods for getAccessibleRelationSet:
+ SwFlyFrm* getFlyFrm() const;
+
+ com::sun::star::accessibility::AccessibleRelation makeRelation(
+ sal_Int16 nType, const SwFlyFrm* pFrm );
+
+public:
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif
diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx
new file mode 100644
index 000000000000..465e4a01b3da
--- /dev/null
+++ b/sw/source/core/access/parachangetrackinginfo.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_sw.hxx"
+
+#include <parachangetrackinginfo.hxx>
+
+#include <errhdl.hxx>
+#include <wrong.hxx>
+#include <com/sun/star/text/TextMarkupType.hpp>
+
+#include <txtfrm.hxx>
+#include <ndtxt.hxx>
+#include <IDocumentRedlineAccess.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+
+namespace css = com::sun::star;
+
+namespace {
+ void initChangeTrackTextMarkupLists( const SwTxtFrm& rTxtFrm,
+ SwWrongList*& opChangeTrackInsertionTextMarkupList,
+ SwWrongList*& opChangeTrackDeletionTextMarkupList,
+ SwWrongList*& opChangeTrackFormatChangeTextMarkupList )
+ {
+ opChangeTrackInsertionTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
+ opChangeTrackDeletionTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
+ opChangeTrackFormatChangeTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
+
+ if ( !rTxtFrm.GetTxtNode() )
+ {
+ ASSERT( false,
+ "<initChangeTrackTextMarkupLists(..) - missing <SwTxtNode> instance!" );
+ return;
+ }
+ const SwTxtNode& rTxtNode( *(rTxtFrm.GetTxtNode()) );
+
+ const IDocumentRedlineAccess* pIDocChangeTrack( rTxtNode.getIDocumentRedlineAccess() );
+ if ( !pIDocChangeTrack )
+ {
+ ASSERT( false,
+ "<initChangeTrackTextMarkupLists(..) - missing <IDocumentRedlineAccess> instance!" );
+ return;
+ }
+
+ if ( !IDocumentRedlineAccess::IsShowChanges( pIDocChangeTrack->GetRedlineMode() ) ||
+ pIDocChangeTrack->GetRedlineTbl().Count() == 0 )
+ {
+ // nothing to do --> empty change track text markup lists.
+ return;
+ }
+
+ const sal_uInt16 nIdxOfFirstRedlineForTxtNode =
+ pIDocChangeTrack->GetRedlinePos( rTxtNode, USHRT_MAX );
+ if ( nIdxOfFirstRedlineForTxtNode == USHRT_MAX )
+ {
+ // nothing to do --> empty change track text markup lists.
+ return;
+ }
+
+ const xub_StrLen nTxtFrmTextStartPos = rTxtFrm.IsFollow()
+ ? rTxtFrm.GetOfst()
+ : 0;
+ const xub_StrLen nTxtFrmTextEndPos = rTxtFrm.HasFollow()
+ ? rTxtFrm.GetFollow()->GetOfst()
+ : rTxtFrm.GetTxt().Len();
+
+ // iteration over the redlines which overlap with the text node.
+ const SwRedlineTbl& rRedlineTbl = pIDocChangeTrack->GetRedlineTbl();
+ const sal_uInt16 nRedlineCount( rRedlineTbl.Count() );
+ for ( sal_uInt16 nActRedline = nIdxOfFirstRedlineForTxtNode;
+ nActRedline < nRedlineCount;
+ ++nActRedline)
+ {
+ const SwRedline* pActRedline = rRedlineTbl[ nActRedline ];
+ if ( pActRedline->Start()->nNode > rTxtNode.GetIndex() )
+ {
+ break;
+ }
+
+ xub_StrLen nTxtNodeChangeTrackStart( STRING_LEN );
+ xub_StrLen nTxtNodeChangeTrackEnd( STRING_LEN );
+ pActRedline->CalcStartEnd( rTxtNode.GetIndex(),
+ nTxtNodeChangeTrackStart,
+ nTxtNodeChangeTrackEnd );
+ if ( nTxtNodeChangeTrackStart > nTxtFrmTextEndPos ||
+ nTxtNodeChangeTrackEnd < nTxtFrmTextStartPos )
+ {
+ // Consider only redlines which overlap with the text frame's text.
+ continue;
+ }
+
+ SwWrongList* pMarkupList( 0 );
+ switch ( pActRedline->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ {
+ pMarkupList = opChangeTrackInsertionTextMarkupList;
+ }
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ {
+ pMarkupList = opChangeTrackDeletionTextMarkupList;
+ }
+ break;
+ case nsRedlineType_t::REDLINE_FORMAT:
+ {
+ pMarkupList = opChangeTrackFormatChangeTextMarkupList;
+ }
+ break;
+ default:
+ {
+ // other types are not considered
+ }
+ }
+ if ( pMarkupList )
+ {
+ const xub_StrLen nTxtFrmChangeTrackStart =
+ nTxtNodeChangeTrackStart <= nTxtFrmTextStartPos
+ ? nTxtFrmTextStartPos
+ : nTxtNodeChangeTrackStart;
+
+ const xub_StrLen nTxtFrmChangeTrackEnd =
+ nTxtNodeChangeTrackEnd >= nTxtFrmTextEndPos
+ ? nTxtFrmTextEndPos
+ : nTxtNodeChangeTrackEnd;
+
+ pMarkupList->Insert( rtl::OUString(), 0,
+ nTxtFrmChangeTrackStart,
+ nTxtFrmChangeTrackEnd - nTxtFrmChangeTrackStart,
+ pMarkupList->Count() );
+ }
+ } // eof iteration over the redlines which overlap with the text node
+ }
+} // eof anonymous namespace
+
+SwParaChangeTrackingInfo::SwParaChangeTrackingInfo( const SwTxtFrm& rTxtFrm )
+ : mrTxtFrm( rTxtFrm )
+ , mpChangeTrackInsertionTextMarkupList( 0 )
+ , mpChangeTrackDeletionTextMarkupList( 0 )
+ , mpChangeTrackFormatChangeTextMarkupList( 0 )
+{
+}
+
+
+SwParaChangeTrackingInfo::~SwParaChangeTrackingInfo()
+{
+ reset();
+}
+
+void SwParaChangeTrackingInfo::reset()
+{
+ delete mpChangeTrackInsertionTextMarkupList;
+ mpChangeTrackInsertionTextMarkupList = 0;
+
+ delete mpChangeTrackDeletionTextMarkupList;
+ mpChangeTrackDeletionTextMarkupList = 0;
+
+ delete mpChangeTrackFormatChangeTextMarkupList;
+ mpChangeTrackFormatChangeTextMarkupList = 0;
+}
+
+const SwWrongList* SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList( const sal_Int32 nTextMarkupType )
+{
+ SwWrongList* pChangeTrackingTextMarkupList = 0;
+
+ if ( mpChangeTrackInsertionTextMarkupList == 0 )
+ {
+ ASSERT( mpChangeTrackDeletionTextMarkupList == 0,
+ "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..) - <mpChangeTrackDeletionTextMarkupList> expected to be NULL." );
+ ASSERT( mpChangeTrackFormatChangeTextMarkupList == 0,
+ "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..) - <mpChangeTrackFormatChangeTextMarkupList> expected to be NULL." );
+ initChangeTrackTextMarkupLists( mrTxtFrm,
+ mpChangeTrackInsertionTextMarkupList,
+ mpChangeTrackDeletionTextMarkupList,
+ mpChangeTrackFormatChangeTextMarkupList );
+ }
+
+ switch ( nTextMarkupType )
+ {
+ case css::text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ {
+ pChangeTrackingTextMarkupList = mpChangeTrackInsertionTextMarkupList;
+ }
+ break;
+ case css::text::TextMarkupType::TRACK_CHANGE_DELETION:
+ {
+ pChangeTrackingTextMarkupList = mpChangeTrackDeletionTextMarkupList;
+ }
+ break;
+ case css::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pChangeTrackingTextMarkupList = mpChangeTrackFormatChangeTextMarkupList;
+ }
+ break;
+ default:
+ {
+ ASSERT( false,
+ "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..)> - misusage - unexpected text markup type for change tracking." );
+ }
+ }
+
+ return pChangeTrackingTextMarkupList;
+}
diff --git a/sw/source/core/access/parachangetrackinginfo.hxx b/sw/source/core/access/parachangetrackinginfo.hxx
new file mode 100644
index 000000000000..91131f37b757
--- /dev/null
+++ b/sw/source/core/access/parachangetrackinginfo.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * 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 _PARACHANGETRACKINGINFO_HXX_
+#define _PARACHANGETRACKINGINFO_HXX_
+
+#include <sal/types.h>
+
+class SwTxtFrm;
+class SwWrongList;
+
+class SwParaChangeTrackingInfo
+{
+ public:
+ explicit SwParaChangeTrackingInfo( const SwTxtFrm& rTxtFrm );
+ ~SwParaChangeTrackingInfo();
+
+ void reset();
+
+ const SwWrongList* getChangeTrackingTextMarkupList( const sal_Int32 nTextMarkupType );
+
+ private:
+ SwParaChangeTrackingInfo( const SwParaChangeTrackingInfo& );
+ SwParaChangeTrackingInfo& operator=( const SwParaChangeTrackingInfo& );
+
+ const SwTxtFrm& mrTxtFrm;
+
+ SwWrongList* mpChangeTrackInsertionTextMarkupList;
+ SwWrongList* mpChangeTrackDeletionTextMarkupList;
+ SwWrongList* mpChangeTrackFormatChangeTextMarkupList;
+};
+#endif
+
diff --git a/sw/source/core/access/textmarkuphelper.cxx b/sw/source/core/access/textmarkuphelper.cxx
new file mode 100644
index 000000000000..90444e4cdca0
--- /dev/null
+++ b/sw/source/core/access/textmarkuphelper.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+
+#include <textmarkuphelper.hxx>
+#include <accportions.hxx>
+
+#include <vector>
+#include <algorithm>
+#include <comphelper/stlunosequence.hxx>
+
+#include <errhdl.hxx>
+
+#include <com/sun/star/text/TextMarkupType.hpp>
+#include <com/sun/star/accessibility/TextSegment.hpp>
+
+#include <ndtxt.hxx>
+#include <wrong.hxx>
+
+using namespace com::sun::star;
+
+// helper functions
+namespace {
+ const SwWrongList* getTextMarkupList( const SwTxtNode& rTxtNode,
+ const sal_Int32 nTextMarkupType )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ const SwWrongList* pTextMarkupList( 0 );
+ switch ( nTextMarkupType )
+ {
+ case text::TextMarkupType::SPELLCHECK:
+ {
+ pTextMarkupList = rTxtNode.GetWrong();
+ }
+ break;
+ case text::TextMarkupType::PROOFREADING:
+ {
+ // support not implemented yet
+ pTextMarkupList = 0;
+ }
+ break;
+ case text::TextMarkupType::SMARTTAG:
+ {
+ // support not implemented yet
+ pTextMarkupList = 0;
+ }
+ break;
+ default:
+ {
+ throw lang::IllegalArgumentException();
+ }
+ }
+
+ return pTextMarkupList;
+ }
+}
+
+// implementation of class <SwTextMarkupoHelper>
+SwTextMarkupHelper::SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwTxtNode& rTxtNode )
+ : mrPortionData( rPortionData )
+ // --> OD 2010-02-19 #i108125#
+ , mpTxtNode( &rTxtNode )
+ , mpTextMarkupList( 0 )
+ // <--
+{
+}
+
+// --> OD 2010-02-19 #i108125#
+SwTextMarkupHelper::SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwWrongList& rTextMarkupList )
+ : mrPortionData( rPortionData )
+ , mpTxtNode( 0 )
+ , mpTextMarkupList( &rTextMarkupList )
+{
+}
+// <--
+
+sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const sal_Int32 nTextMarkupType )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 nTextMarkupCount( 0 );
+
+ // --> OD 2010-02-19 #i108125#
+ const SwWrongList* pTextMarkupList =
+ mpTextMarkupList
+ ? mpTextMarkupList
+ : getTextMarkupList( *mpTxtNode, nTextMarkupType );
+ // <--
+ if ( pTextMarkupList )
+ {
+ nTextMarkupCount = pTextMarkupList->Count();
+ }
+
+ return nTextMarkupCount;
+}
+::com::sun::star::accessibility::TextSegment
+ SwTextMarkupHelper::getTextMarkup( const sal_Int32 nTextMarkupIndex,
+ const sal_Int32 nTextMarkupType )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ if ( nTextMarkupIndex >= getTextMarkupCount( nTextMarkupType ) ||
+ nTextMarkupIndex < 0 )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ ::com::sun::star::accessibility::TextSegment aTextMarkupSegment;
+ aTextMarkupSegment.SegmentStart = -1;
+ aTextMarkupSegment.SegmentEnd = -1;
+
+ // --> OD 2010-02-19 #i108125#
+ const SwWrongList* pTextMarkupList =
+ mpTextMarkupList
+ ? mpTextMarkupList
+ : getTextMarkupList( *mpTxtNode, nTextMarkupType );
+ // <--
+ if ( pTextMarkupList )
+ {
+ const SwWrongArea* pTextMarkup =
+ pTextMarkupList->GetElement( static_cast<sal_uInt16>(nTextMarkupIndex) );
+ if ( pTextMarkup )
+ {
+ const ::rtl::OUString rText = mrPortionData.GetAccessibleString();
+ const sal_Int32 nStartPos =
+ mrPortionData.GetAccessiblePosition( pTextMarkup->mnPos );
+ const sal_Int32 nEndPos =
+ mrPortionData.GetAccessiblePosition( pTextMarkup->mnPos + pTextMarkup->mnLen );
+ aTextMarkupSegment.SegmentText = rText.copy( nStartPos, nEndPos - nStartPos );
+ aTextMarkupSegment.SegmentStart = nStartPos;
+ aTextMarkupSegment.SegmentEnd = nEndPos;
+ }
+ else
+ {
+ ASSERT( false,
+ "<SwTextMarkupHelper::getTextMarkup(..)> - missing <SwWrongArea> instance" );
+ }
+ }
+
+ return aTextMarkupSegment;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::accessibility::TextSegment >
+ SwTextMarkupHelper::getTextMarkupAtIndex( const sal_Int32 nCharIndex,
+ const sal_Int32 nTextMarkupType )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ // assumption:
+ // value of <nCharIndex> is in range [0..length of accessible text)
+
+ const sal_uInt16 nCoreCharIndex = mrPortionData.GetModelPosition( nCharIndex );
+ // Handling of portions with core length == 0 at the beginning of the
+ // paragraph - e.g. numbering portion.
+ if ( mrPortionData.GetAccessiblePosition( nCoreCharIndex ) > nCharIndex )
+ {
+ return uno::Sequence< ::com::sun::star::accessibility::TextSegment >();
+ }
+
+ // --> OD 2010-02-19 #i108125#
+ const SwWrongList* pTextMarkupList =
+ mpTextMarkupList
+ ? mpTextMarkupList
+ : getTextMarkupList( *mpTxtNode, nTextMarkupType );
+ // <--
+ ::std::vector< ::com::sun::star::accessibility::TextSegment > aTmpTextMarkups;
+ if ( pTextMarkupList )
+ {
+ const ::rtl::OUString rText = mrPortionData.GetAccessibleString();
+
+ const sal_uInt16 nTextMarkupCount = pTextMarkupList->Count();
+ for ( sal_uInt16 nTextMarkupIdx = 0; nTextMarkupIdx < nTextMarkupCount; ++nTextMarkupIdx )
+ {
+ const SwWrongArea* pTextMarkup =
+ pTextMarkupList->GetElement( static_cast<sal_uInt16>(nTextMarkupIdx) );
+ ASSERT( pTextMarkup,
+ "<SwTextMarkupHelper::getTextMarkup(..)> - missing <SwWrongArea> instance" );
+ if ( pTextMarkup &&
+ pTextMarkup->mnPos <= nCoreCharIndex &&
+ nCoreCharIndex < ( pTextMarkup->mnPos + pTextMarkup->mnLen ) )
+ {
+ const sal_Int32 nStartPos =
+ mrPortionData.GetAccessiblePosition( pTextMarkup->mnPos );
+ const sal_Int32 nEndPos =
+ mrPortionData.GetAccessiblePosition( pTextMarkup->mnPos + pTextMarkup->mnLen );
+ ::com::sun::star::accessibility::TextSegment aTextMarkupSegment;
+ aTextMarkupSegment.SegmentText = rText.copy( nStartPos, nEndPos - nStartPos );
+ aTextMarkupSegment.SegmentStart = nStartPos;
+ aTextMarkupSegment.SegmentEnd = nEndPos;
+ aTmpTextMarkups.push_back( aTextMarkupSegment );
+ }
+ }
+ }
+
+ uno::Sequence< ::com::sun::star::accessibility::TextSegment > aTextMarkups(
+ aTmpTextMarkups.size() );
+ ::std::copy( aTmpTextMarkups.begin(), aTmpTextMarkups.end(),
+ ::comphelper::stl_begin( aTextMarkups ) );
+
+ return aTextMarkups;
+}
diff --git a/sw/source/core/access/textmarkuphelper.hxx b/sw/source/core/access/textmarkuphelper.hxx
new file mode 100644
index 000000000000..9b2bb519a2a1
--- /dev/null
+++ b/sw/source/core/access/textmarkuphelper.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TEXTMARKUPHELPER_HXX_
+#define _TEXTMARKUPHELPER_HXX_
+
+#include <sal/types.h>
+#include "com/sun/star/lang/IndexOutOfBoundsException.hdl"
+#include "com/sun/star/lang/IllegalArgumentException.hdl"
+#include "com/sun/star/uno/RuntimeException.hdl"
+#include "com/sun/star/uno/Sequence.h"
+
+namespace com { namespace sun { namespace star { namespace accessibility {
+struct TextSegment;
+} } } }
+
+class SwAccessiblePortionData;
+class SwTxtNode;
+// --> OD 2010-02-19 #i108125#
+class SwWrongList;
+// <--
+
+class SwTextMarkupHelper
+{
+ public:
+ SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwTxtNode& rTxtNode );
+ // --> OD 2010-02-19 #i108125#
+ SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwWrongList& rTextMarkupList );
+ // <--
+ ~SwTextMarkupHelper() {}
+
+ sal_Int32 getTextMarkupCount( const sal_Int32 nTextMarkupType )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::accessibility::TextSegment getTextMarkup(
+ const sal_Int32 nTextMarkupIndex,
+ const sal_Int32 nTextMarkupType )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::accessibility::TextSegment >
+ getTextMarkupAtIndex( const sal_Int32 nCharIndex,
+ const sal_Int32 nTextMarkupType )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ private:
+ SwTextMarkupHelper( const SwTextMarkupHelper& );
+ SwTextMarkupHelper& operator=( const SwTextMarkupHelper& );
+
+ const SwAccessiblePortionData& mrPortionData;
+
+ // --> OD 2010-02-19 #i108125#
+ const SwTxtNode* mpTxtNode;
+ const SwWrongList* mpTextMarkupList;
+ // <--
+};
+#endif
+
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
new file mode 100644
index 000000000000..68150f3f9e5d
--- /dev/null
+++ b/sw/source/core/attr/calbck.cxx
@@ -0,0 +1,564 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx> // contains RES_.. IDs
+#include <frame.hxx>
+#include <hints.hxx>
+#include <swcache.hxx> // mba: get rid of that dependency
+#include <swfntcch.hxx> // mba: get rid of that dependency
+
+static SwClientIter* pClientIters = 0;
+
+TYPEINIT0(SwClient);
+
+/*************************************************************************/
+SwClient::SwClient(SwModify *pToRegisterIn)
+ : pLeft( 0 ), pRight( 0 ), pRegisteredIn( 0 ), mbIsAllowedToBeRemovedInModifyCall(false)
+{
+ if(pToRegisterIn)
+ // connect to SwModify
+ pToRegisterIn->Add(this);
+}
+
+/*************************************************************************/
+void SwClient::CheckRegistration( const SfxPoolItem* pOld, const SfxPoolItem * )
+{
+ // this method only handles notification about dying SwModify objects
+ if( (!pOld || pOld->Which() != RES_OBJECTDYING) )
+ return;
+
+ const SwPtrMsgPoolItem *pDead = static_cast<const SwPtrMsgPoolItem*>(pOld);
+ if(pDead && pDead->pObject == pRegisteredIn)
+ {
+ // I've got a notification from the object I know
+ SwModify *pAbove = const_cast<SwModify*>(pRegisteredIn->GetRegisteredIn());
+ if(pAbove)
+ {
+ // if the dying object itself was listening at an SwModify, I take over
+ // adding myself to pAbove will automatically remove me from my current pRegisteredIn
+ pAbove->Add(this);
+ return;
+ }
+
+ // destroy connection
+ pRegisteredIn->Remove(this);
+ }
+}
+
+void SwClient::Modify( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue )
+{
+ CheckRegistration( pOldValue, pNewValue );
+}
+
+void SwClient::SwClientNotify( const SwModify&, const SfxHint& )
+{
+
+}
+
+//*************************************************************************
+SwClient::~SwClient()
+{
+ DBG_ASSERT( !pRegisteredIn || pRegisteredIn->GetDepends(),"SwModify still known, but Client already disconnected!" );
+ if( pRegisteredIn && pRegisteredIn->GetDepends() )
+ // still connected
+ pRegisteredIn->Remove( this );
+}
+
+
+sal_Bool SwClient::GetInfo( SfxPoolItem& ) const
+{
+ return sal_True; // und weiter
+}
+
+
+/*************************************************************************/
+SwModify::SwModify()
+ : SwClient(0), pRoot(0)
+{
+ bModifyLocked = sal_False;
+ bLockClientList = sal_False;
+ bInDocDTOR = sal_False;
+ bInCache = sal_False;
+ bInSwFntCache = sal_False;
+}
+
+SwModify::SwModify( SwModify *pToRegisterIn )
+ : SwClient(pToRegisterIn), pRoot( 0 )
+{
+ bModifyLocked = sal_False;
+ bLockClientList = sal_False;
+ bInDocDTOR = sal_False;
+ bInCache = sal_False;
+ bInSwFntCache = sal_False;
+}
+
+/*************************************************************************/
+SwModify::~SwModify()
+{
+ ASSERT( !IsModifyLocked(), "Modify destroyed but locked." );
+
+ if ( IsInCache() )
+ SwFrm::GetCache().Delete( this );
+
+ if ( IsInSwFntCache() )
+ pSwFontCache->Delete( this );
+
+ if( pRoot )
+ {
+ // there are depending objects
+ if( IsInDocDTOR() )
+ {
+ // if document gets destroyed anyway, just tell clients to forget me
+ // so that they don't try to get removed from my list later when they also get destroyed
+ SwClientIter aIter( *this );
+ SwClient* p = aIter.GoStart();
+ while ( p )
+ {
+ p->pRegisteredIn = 0;
+ p = aIter++;
+ }
+ }
+ else
+ {
+ // notify all clients that they shall remove themselves
+ SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this );
+ NotifyClients( &aDyObject, &aDyObject );
+
+ // remove all clients that have not done themselves
+ // mba: possibly a hotfix for forgotten base class calls?!
+ while( pRoot )
+ pRoot->CheckRegistration(&aDyObject, &aDyObject);
+ }
+ }
+}
+
+/*************************************************************************/
+void SwModify::Modify( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue )
+{
+ NotifyClients( pOldValue, pNewValue );
+}
+
+void SwModify::NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue )
+{
+ if (IsInCache() || IsInSwFntCache())
+ {
+ const sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
+ pNewValue ? pNewValue->Which() : 0;
+ CheckCaching( nWhich );
+ }
+
+ if (!pRoot || IsModifyLocked())
+ return;
+
+ LockModify();
+
+ // mba: WTF?!
+ if( !pOldValue )
+ bLockClientList = sal_True;
+ else
+ {
+ // following Modifies shouldn't call an ASSERT
+ switch( pOldValue->Which() )
+ {
+ case RES_OBJECTDYING:
+ case RES_REMOVE_UNO_OBJECT:
+ bLockClientList = ((SwPtrMsgPoolItem *)pOldValue)->pObject != this;
+ break;
+
+ case RES_FOOTNOTE_DELETED:
+ case RES_REFMARK_DELETED:
+ case RES_TOXMARK_DELETED:
+ case RES_FIELD_DELETED:
+ bLockClientList = sal_False;
+ break;
+ default:
+ bLockClientList = sal_True;
+ }
+ }
+
+ ModifyBroadcast( pOldValue, pNewValue );
+ bLockClientList = sal_False;
+ UnlockModify();
+}
+
+sal_Bool SwModify::GetInfo( SfxPoolItem& rInfo ) const
+{
+ sal_Bool bRet = sal_True; // bedeutet weiter zum naechsten
+
+ if( pRoot )
+ {
+ SwClientIter aIter( *(SwModify*)this );
+
+ SwClient* pLast = aIter.GoStart();
+ if( pLast )
+ while( 0 != ( bRet = pLast->GetInfo( rInfo )) &&
+ 0 != ( pLast = aIter++ ) )
+ ;
+ }
+
+ return bRet;
+}
+
+/*************************************************************************/
+void SwModify::Add(SwClient *pDepend)
+{
+ ASSERT( !bLockClientList, "Client inserted while in Modify" );
+
+ if(pDepend->pRegisteredIn != this )
+ {
+#ifdef DBG_UTIL
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp )
+ {
+ ASSERT( &pTmp->GetModify() != pRoot, "Client added to active ClientIter" );
+ pTmp = pTmp->pNxtIter;
+ }
+#endif
+ // deregister new client in case it is already registered elsewhere
+ if( pDepend->pRegisteredIn != 0 )
+ pDepend->pRegisteredIn->Remove( pDepend );
+
+ if( !pRoot )
+ {
+ // first client added
+ pRoot = pDepend;
+ pRoot->pLeft = 0;
+ pRoot->pRight = 0;
+ }
+ else
+ {
+ // append client
+ pDepend->pRight = pRoot->pRight;
+ pRoot->pRight = pDepend;
+ pDepend->pLeft = pRoot;
+ if( pDepend->pRight )
+ pDepend->pRight->pLeft = pDepend;
+ }
+
+ // connect client to me
+ pDepend->pRegisteredIn = this;
+ }
+}
+
+/*************************************************************************/
+
+SwClient* SwModify::Remove(SwClient * pDepend)
+{
+ if ( bInDocDTOR )
+ return 0;
+
+ ASSERT( !bLockClientList || pDepend->mbIsAllowedToBeRemovedInModifyCall, "SwClient shall be removed in Modify call!" );
+
+ if( pDepend->pRegisteredIn == this )
+ {
+ // SwClient is my listener
+ // remove it from my list
+ SwClient* pR = pDepend->pRight;
+ SwClient* pL = pDepend->pLeft;
+ if( pRoot == pDepend )
+ pRoot = pL ? pL : pR;
+
+ if( pL )
+ pL->pRight = pR;
+ if( pR )
+ pR->pLeft = pL;
+
+ // update ClientIters
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp )
+ {
+ if( pTmp->pAct == pDepend || pTmp->pDelNext == pDepend )
+ // if object being removed is the current or next object in an iterator, advance this iterator
+ pTmp->pDelNext = pR;
+ pTmp = pTmp->pNxtIter;
+ }
+
+ pDepend->pLeft = 0;
+ pDepend->pRight = 0;
+ }
+ else
+ {
+ ASSERT( false, "SwModify::Remove(): pDepend nicht gefunden" );
+ }
+
+ // disconnect client from me
+ pDepend->pRegisteredIn = 0;
+ return pDepend;
+}
+
+int SwModify::GetClientCount() const
+{
+ int nRet=0;
+ SwClientIter aIter( *this );
+ SwClient *pLast = aIter.GoStart();
+ if( pLast )
+ do
+ {
+ ++nRet;
+ } while( 0 != ( pLast = aIter++ ));
+ return nRet;
+}
+
+void SwModify::CheckCaching( const sal_uInt16 nWhich )
+{
+ if (isCHRATR(nWhich))
+ {
+ SetInSwFntCache( sal_False );
+ }
+ else
+ switch ( nWhich )
+ {
+ case RES_OBJECTDYING:
+ case RES_FMT_CHG:
+ case RES_ATTRSET_CHG:
+ SetInSwFntCache( sal_False );
+
+ case RES_UL_SPACE:
+ case RES_LR_SPACE:
+ case RES_BOX:
+ case RES_SHADOW:
+ case RES_FRM_SIZE:
+ case RES_KEEP:
+ case RES_BREAK:
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+ break;
+ }
+}
+
+void SwModify::CallSwClientNotify( const SfxHint& rHint ) const
+{
+ SwClientIter aIter(*this);
+ SwClient * pClient = aIter.GoStart();
+ while (pClient)
+ {
+ pClient->SwClientNotify( *this, rHint );
+ pClient = aIter++;
+ }
+}
+
+void SwModify::ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, TypeId nType )
+{
+ SwClientIter aIter(*this);
+ SwClient * pClient = aIter.First( nType );
+ while (pClient)
+ {
+ pClient->Modify( pOldValue, pNewValue );
+ pClient = aIter.Next();
+ }
+}
+
+// ----------
+// SwDepend
+// ----------
+
+/*************************************************************************/
+
+SwDepend::SwDepend(SwClient *pTellHim, SwModify *pDepend)
+ : SwClient(pDepend)
+{
+ pToTell = pTellHim;
+}
+
+/*************************************************************************/
+
+void SwDepend::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem *pNewValue )
+{
+ if(pNewValue && pNewValue->Which() == RES_OBJECTDYING)
+ CheckRegistration(pOldValue,pNewValue);
+ else if(pToTell)
+ pToTell->ModifyNotification(pOldValue, pNewValue);
+}
+
+void SwDepend::SwClientNotify( const SwModify& rMod, const SfxHint& rHint )
+{
+ if ( pToTell )
+ pToTell->SwClientNotifyCall( rMod, rHint );
+}
+
+sal_Bool SwDepend::GetInfo( SfxPoolItem& rInfo ) const
+{
+ return pToTell ? pToTell->GetInfo( rInfo ) : sal_True;
+}
+
+/********************************************************************/
+
+SwClientIter::SwClientIter( const SwModify& rModify )
+ : rRoot( rModify )
+{
+ pNxtIter = 0;
+ if( pClientIters )
+ {
+ // append to list of ClientIters
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp->pNxtIter )
+ pTmp = pTmp->pNxtIter;
+ pTmp->pNxtIter = this;
+ }
+ else
+ pClientIters = this;
+
+ pAct = const_cast<SwClient*>(rRoot.GetDepends());
+ pDelNext = pAct;
+}
+
+
+
+SwClientIter::~SwClientIter()
+{
+ if( pClientIters )
+ {
+ // reorganize list of ClientIters
+ if( pClientIters == this )
+ pClientIters = pNxtIter;
+ else
+ {
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp->pNxtIter != this )
+ if( 0 == ( pTmp = pTmp->pNxtIter ) )
+ {
+ ASSERT( this, "wo ist mein Pointer" );
+ return ;
+ }
+ pTmp->pNxtIter = pNxtIter;
+ }
+ }
+}
+
+
+SwClient* SwClientIter::operator++(int)
+{
+ if( pDelNext == pAct )
+ {
+ pAct = pAct->pRight;
+ pDelNext = pAct;
+ }
+ else
+ pAct = pDelNext;
+ return pAct;
+}
+
+SwClient* SwClientIter::GoStart()
+{
+ pAct = const_cast<SwClient*>(rRoot.GetDepends());
+ if( pAct )
+ while( pAct->pLeft )
+ pAct = pAct->pLeft;
+ pDelNext = pAct;
+ return pAct;
+}
+
+SwClient* SwClientIter::GoEnd()
+{
+ pAct = pDelNext;
+ if( !pAct )
+ pAct = const_cast<SwClient*>(rRoot.GetDepends());
+ if( pAct )
+ while( pAct->pRight )
+ pAct = pAct->pRight;
+ pDelNext = pAct;
+ return pAct;
+}
+
+SwClient* SwClientIter::First( TypeId nType )
+{
+ aSrchId = nType;
+ GoStart();
+ if( pAct )
+ do {
+ if( pAct->IsA( aSrchId ) )
+ break;
+
+ if( pDelNext == pAct )
+ {
+ pAct = pAct->pRight;
+ pDelNext = pAct;
+ }
+ else
+ pAct = pDelNext;
+
+ } while( pAct );
+ return pAct;
+}
+
+SwClient* SwClientIter::Next()
+{
+ do {
+ if( pDelNext == pAct )
+ {
+ pAct = pAct->pRight;
+ pDelNext = pAct;
+ }
+ else
+ pAct = pDelNext;
+
+ if( pAct && pAct->IsA( aSrchId ) )
+ break;
+ } while( pAct );
+ return pAct;
+}
+
+SwClient* SwClientIter::Last( TypeId nType )
+{
+ aSrchId = nType;
+ GoEnd();
+ if( pAct )
+ do {
+ if( pAct->IsA( aSrchId ) )
+ break;
+
+ if( pDelNext == pAct )
+ pAct = pAct->pLeft;
+ else
+ pAct = pDelNext->pLeft;
+ pDelNext = pAct;
+
+ } while( pAct );
+ return pAct;
+}
+
+SwClient* SwClientIter::Previous()
+{
+ do {
+ if( pDelNext == pAct )
+ pAct = pAct->pLeft;
+ else
+ pAct = pDelNext->pLeft;
+ pDelNext = pAct;
+
+ if( pAct && pAct->IsA( aSrchId ) )
+ break;
+ } while( pAct );
+ return pAct;
+}
+
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
new file mode 100644
index 000000000000..e171b4408018
--- /dev/null
+++ b/sw/source/core/attr/cellatr.cxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <float.h>
+#include <rtl/math.hxx>
+#include <hintids.hxx> // fuer RES_..
+#include <cellatr.hxx>
+#include <calc.hxx>
+#include <format.hxx>
+#include <doc.hxx>
+#include <swtable.hxx>
+#include <node.hxx>
+#include <hints.hxx>
+#include <rolbck.hxx>
+#include <switerator.hxx>
+
+
+//TYPEINIT1( SwFmt, SwClient ); //rtti fuer SwFmt
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+SwTblBoxNumFormat::SwTblBoxNumFormat( sal_uInt32 nFormat, sal_Bool bFlag )
+ : SfxUInt32Item( RES_BOXATR_FORMAT, nFormat ), bAuto( bFlag )
+{
+}
+
+
+int SwTblBoxNumFormat::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return GetValue() == ((SwTblBoxNumFormat&)rAttr).GetValue() &&
+ bAuto == ((SwTblBoxNumFormat&)rAttr).bAuto;
+}
+
+
+SfxPoolItem* SwTblBoxNumFormat::Clone( SfxItemPool* ) const
+{
+ return new SwTblBoxNumFormat( GetValue(), bAuto );
+}
+
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+
+SwTblBoxFormula::SwTblBoxFormula( const String& rFormula )
+ : SfxPoolItem( RES_BOXATR_FORMULA ),
+ SwTableFormula( rFormula ),
+ pDefinedIn( 0 )
+{
+}
+
+
+int SwTblBoxFormula::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return GetFormula() == ((SwTblBoxFormula&)rAttr).GetFormula() &&
+ pDefinedIn == ((SwTblBoxFormula&)rAttr).pDefinedIn;
+}
+
+
+SfxPoolItem* SwTblBoxFormula::Clone( SfxItemPool* ) const
+{
+// auf externe Darstellung umschalten!!
+ SwTblBoxFormula* pNew = new SwTblBoxFormula( GetFormula() );
+ pNew->SwTableFormula::operator=( *this );
+ return pNew;
+}
+
+
+
+ // suche den Node, in dem die Formel steht:
+ // TextFeld -> TextNode,
+ // BoxAttribut -> BoxStartNode
+ // !!! MUSS VON JEDER ABLEITUNG UEBERLADEN WERDEN !!!
+const SwNode* SwTblBoxFormula::GetNodeOfFormula() const
+{
+ const SwNode* pRet = 0;
+ if( pDefinedIn )
+ {
+ SwTableBox* pBox = SwIterator<SwTableBox,SwModify>::FirstElement( *pDefinedIn );
+ if( pBox )
+ pRet = pBox->GetSttNd();
+ }
+ return pRet;
+}
+
+
+SwTableBox* SwTblBoxFormula::GetTableBox()
+{
+ SwTableBox* pBox = 0;
+ if( pDefinedIn )
+ pBox = SwIterator<SwTableBox,SwModify>::FirstElement( *pDefinedIn );
+ return pBox;
+}
+
+
+void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem )
+{
+ if( !pDefinedIn )
+ return ;
+
+ SwTableFmlUpdate* pUpdtFld;
+ if( !pItem || RES_TABLEFML_UPDATE != pItem->Which() )
+ {
+ // setze bei allen das Value-Flag zurueck
+ ChgValid( sal_False );
+ return ;
+ }
+
+ pUpdtFld = (SwTableFmlUpdate*)pItem;
+
+ // bestimme die Tabelle, in der das Attribut steht
+ const SwTableNode* pTblNd;
+ const SwNode* pNd = GetNodeOfFormula();
+ if( pNd && &pNd->GetNodes() == &pNd->GetDoc()->GetNodes() &&
+ 0 != ( pTblNd = pNd->FindTableNode() ))
+ {
+ switch( pUpdtFld->eFlags )
+ {
+ case TBL_CALC:
+ // setze das Value-Flag zurueck
+ // JP 17.06.96: interne Darstellung auf alle Formeln
+ // (Referenzen auf andere Tabellen!!!)
+// if( VF_CMD & pFld->GetFormat() )
+// pFld->PtrToBoxNm( pUpdtFld->pTbl );
+// else
+ ChgValid( sal_False );
+ break;
+ case TBL_BOXNAME:
+ // ist es die gesuchte Tabelle ??
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ // zur externen Darstellung
+ PtrToBoxNm( pUpdtFld->pTbl );
+ break;
+ case TBL_BOXPTR:
+ // zur internen Darstellung
+ // JP 17.06.96: interne Darstellung auf alle Formeln
+ // (Referenzen auf andere Tabellen!!!)
+ BoxNmToPtr( &pTblNd->GetTable() );
+ break;
+ case TBL_RELBOXNAME:
+ // ist es die gesuchte Tabelle ??
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ // zur relativen Darstellung
+ ToRelBoxNm( pUpdtFld->pTbl );
+ break;
+
+ case TBL_SPLITTBL:
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ {
+ sal_uInt16 nLnPos = SwTableFormula::GetLnPosInTbl(
+ pTblNd->GetTable(), GetTableBox() );
+ pUpdtFld->bBehindSplitLine = USHRT_MAX != nLnPos &&
+ pUpdtFld->nSplitLine <= nLnPos;
+ }
+ else
+ pUpdtFld->bBehindSplitLine = sal_False;
+ // kein break
+ case TBL_MERGETBL:
+ if( pUpdtFld->pHistory )
+ {
+ // fuer die History brauche ich aber die unveraenderte Formel
+ SwTblBoxFormula aCopy( *this );
+ pUpdtFld->bModified = sal_False;
+ ToSplitMergeBoxNm( *pUpdtFld );
+
+ if( pUpdtFld->bModified )
+ {
+ // und dann in der externen Darstellung
+ aCopy.PtrToBoxNm( &pTblNd->GetTable() );
+ pUpdtFld->pHistory->Add( &aCopy, &aCopy,
+ pNd->FindTableBoxStartNode()->GetIndex() );
+ }
+ }
+ else
+ ToSplitMergeBoxNm( *pUpdtFld );
+ break;
+ }
+ }
+}
+
+
+void SwTblBoxFormula::Calc( SwTblCalcPara& rCalcPara, double& rValue )
+{
+ if( !rCalcPara.rCalc.IsCalcError() ) // ist schon Fehler gesetzt ?
+ {
+ // erzeuge aus den BoxNamen die Pointer
+ BoxNmToPtr( rCalcPara.pTbl );
+ String sFml( MakeFormel( rCalcPara ));
+ if( !rCalcPara.rCalc.IsCalcError() )
+ rValue = rCalcPara.rCalc.Calculate( sFml ).GetDouble();
+ else
+ rValue = DBL_MAX;
+ ChgValid( !rCalcPara.IsStackOverFlow() ); // der Wert ist wieder gueltig
+ }
+}
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+SwTblBoxValue::SwTblBoxValue()
+ : SfxPoolItem( RES_BOXATR_VALUE ), nValue( 0 )
+{
+}
+
+
+SwTblBoxValue::SwTblBoxValue( const double nVal )
+ : SfxPoolItem( RES_BOXATR_VALUE ), nValue( nVal )
+{
+}
+
+
+int SwTblBoxValue::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT(SfxPoolItem::operator==(rAttr), "SwTblBoxValue: item not equal");
+ SwTblBoxValue const& rOther( static_cast<SwTblBoxValue const&>(rAttr) );
+ // items with NaN should be equal to enable pooling
+ return ::rtl::math::isNan(nValue)
+ ? ::rtl::math::isNan(rOther.nValue)
+ : (nValue == rOther.nValue);
+}
+
+
+SfxPoolItem* SwTblBoxValue::Clone( SfxItemPool* ) const
+{
+ return new SwTblBoxValue( nValue );
+}
+
+
+
+
diff --git a/sw/source/core/attr/fmtfollowtextflow.cxx b/sw/source/core/attr/fmtfollowtextflow.cxx
new file mode 100644
index 000000000000..8bcd5b682116
--- /dev/null
+++ b/sw/source/core/attr/fmtfollowtextflow.cxx
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <fmtfollowtextflow.hxx>
+
+TYPEINIT1(SwFmtFollowTextFlow, SfxBoolItem);
+
+SfxPoolItem* SwFmtFollowTextFlow::Clone( SfxItemPool * ) const
+{
+ return new SwFmtFollowTextFlow(*this);
+}
diff --git a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
new file mode 100644
index 000000000000..fde57e74e2ff
--- /dev/null
+++ b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <fmtwrapinfluenceonobjpos.hxx>
+
+#ifndef _UNOMID_H
+#include <unomid.h>
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+TYPEINIT1(SwFmtWrapInfluenceOnObjPos, SfxPoolItem);
+
+SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos(
+ sal_Int16 _nWrapInfluenceOnPosition )
+ : SfxPoolItem( RES_WRAP_INFLUENCE_ON_OBJPOS ),
+ mnWrapInfluenceOnPosition( _nWrapInfluenceOnPosition )
+{
+}
+
+SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos(
+ const SwFmtWrapInfluenceOnObjPos& _rCpy )
+ : SfxPoolItem( RES_WRAP_INFLUENCE_ON_OBJPOS ),
+ mnWrapInfluenceOnPosition( _rCpy.GetWrapInfluenceOnObjPos() )
+{
+}
+
+SwFmtWrapInfluenceOnObjPos::~SwFmtWrapInfluenceOnObjPos()
+{
+}
+
+SwFmtWrapInfluenceOnObjPos& SwFmtWrapInfluenceOnObjPos::operator=(
+ const SwFmtWrapInfluenceOnObjPos& _rSource )
+{
+ mnWrapInfluenceOnPosition = _rSource.GetWrapInfluenceOnObjPos();
+
+ return *this;
+}
+
+int SwFmtWrapInfluenceOnObjPos::operator==( const SfxPoolItem& _rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( _rAttr ), "keine gleichen Attribute" );
+ return ( mnWrapInfluenceOnPosition ==
+ static_cast<const SwFmtWrapInfluenceOnObjPos&>(_rAttr).
+ GetWrapInfluenceOnObjPos() );
+}
+
+SfxPoolItem* SwFmtWrapInfluenceOnObjPos::Clone( SfxItemPool * ) const
+{
+ return new SwFmtWrapInfluenceOnObjPos(*this);
+}
+
+sal_Bool SwFmtWrapInfluenceOnObjPos::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ sal_Bool bRet = sal_True;
+ switch ( nMemberId )
+ {
+ case MID_WRAP_INFLUENCE:
+ {
+ rVal <<= GetWrapInfluenceOnObjPos();
+ }
+ break;
+ default:
+ ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" );
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+sal_Bool SwFmtWrapInfluenceOnObjPos::PutValue( const Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ sal_Bool bRet = sal_True;
+
+ switch ( nMemberId )
+ {
+ case MID_WRAP_INFLUENCE:
+ {
+ sal_Int16 nNewWrapInfluence = 0;
+ rVal >>= nNewWrapInfluence;
+ // --> OD 2004-10-18 #i35017# - constant names have changed and
+ // <ITERATIVE> has been added
+ if ( nNewWrapInfluence == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ||
+ nNewWrapInfluence == text::WrapInfluenceOnPosition::ONCE_CONCURRENT ||
+ nNewWrapInfluence == text::WrapInfluenceOnPosition::ITERATIVE )
+ // <--
+ {
+ SetWrapInfluenceOnObjPos( nNewWrapInfluence );
+ }
+ else
+ {
+ ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::PutValue(..)> - invalid attribute value" );
+ bRet = sal_False;
+ }
+ }
+ break;
+ default:
+ ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" );
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+void SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos( sal_Int16 _nWrapInfluenceOnPosition )
+{
+ // --> OD 2004-10-18 #i35017# - constant names have changed and consider
+ // new value <ITERATIVE>
+ if ( _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ||
+ _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_CONCURRENT ||
+ _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ITERATIVE )
+ // <--
+ {
+ mnWrapInfluenceOnPosition = _nWrapInfluenceOnPosition;
+ }
+ else
+ {
+ ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos(..)> - invalid attribute value" );
+ }
+}
+
+// --> OD 2004-10-18 #i35017# - add parameter <_bIterativeAsOnceConcurrent>
+// to control, if value <ITERATIVE> has to be treated as <ONCE_CONCURRENT>
+sal_Int16 SwFmtWrapInfluenceOnObjPos::GetWrapInfluenceOnObjPos(
+ const bool _bIterativeAsOnceConcurrent ) const
+{
+ sal_Int16 nWrapInfluenceOnPosition( mnWrapInfluenceOnPosition );
+
+ if ( _bIterativeAsOnceConcurrent &&
+ nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ITERATIVE )
+ {
+ nWrapInfluenceOnPosition = text::WrapInfluenceOnPosition::ONCE_CONCURRENT;
+ }
+
+ return nWrapInfluenceOnPosition;
+}
+// <--
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
new file mode 100644
index 000000000000..2e4212fea321
--- /dev/null
+++ b/sw/source/core/attr/format.cxx
@@ -0,0 +1,692 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx> // fuer RES_..
+#include <frame.hxx> // fuer AttrCache
+#include <format.hxx>
+#include <hints.hxx> // fuer SwFmtChg
+#include <doc.hxx>
+#include <paratr.hxx> // fuer SwParaFmt - SwHyphenBug
+#include <swcache.hxx>
+#include <fmtcolfunc.hxx>
+
+TYPEINIT1( SwFmt, SwClient ); //rtti fuer SwFmt
+
+/*************************************************************************
+|* SwFmt::SwFmt
+*************************************************************************/
+
+
+SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+ const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich )
+ : SwModify( pDrvdFrm ),
+ aSet( rPool, pWhichRanges ),
+ nWhichId( nFmtWhich ),
+ nFmtId( 0 ),
+ nPoolFmtId( USHRT_MAX ),
+ nPoolHelpId( USHRT_MAX ),
+ nPoolHlpFileId( UCHAR_MAX )
+{
+ aFmtName.AssignAscii( pFmtNm );
+ bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
+ bAutoFmt = sal_True;
+
+ if( pDrvdFrm )
+ aSet.SetParent( &pDrvdFrm->aSet );
+}
+
+
+SwFmt::SwFmt( SwAttrPool& rPool, const String &rFmtNm,
+ const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich )
+ : SwModify( pDrvdFrm ),
+ aFmtName( rFmtNm ),
+ aSet( rPool, pWhichRanges ),
+ nWhichId( nFmtWhich ),
+ nFmtId( 0 ),
+ nPoolFmtId( USHRT_MAX ),
+ nPoolHelpId( USHRT_MAX ),
+ nPoolHlpFileId( UCHAR_MAX )
+{
+ bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
+ bAutoFmt = sal_True;
+
+ if( pDrvdFrm )
+ aSet.SetParent( &pDrvdFrm->aSet );
+}
+
+
+SwFmt::SwFmt( const SwFmt& rFmt )
+ : SwModify( rFmt.DerivedFrom() ),
+ aFmtName( rFmt.aFmtName ),
+ aSet( rFmt.aSet ),
+ nWhichId( rFmt.nWhichId ),
+ nFmtId( 0 ),
+ nPoolFmtId( rFmt.GetPoolFmtId() ),
+ nPoolHelpId( rFmt.GetPoolHelpId() ),
+ nPoolHlpFileId( rFmt.GetPoolHlpFileId() )
+{
+ bWritten = bFmtInDTOR = sal_False; // LAYER_IMPL
+ bAutoFmt = rFmt.bAutoFmt;
+ bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
+
+ if( rFmt.DerivedFrom() )
+ aSet.SetParent( &rFmt.DerivedFrom()->aSet );
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+}
+
+/*************************************************************************
+|* SwFmt &SwFmt::operator=(const SwFmt& aFmt)
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+SwFmt &SwFmt::operator=(const SwFmt& rFmt)
+{
+ nWhichId = rFmt.nWhichId;
+ nPoolFmtId = rFmt.GetPoolFmtId();
+ nPoolHelpId = rFmt.GetPoolHelpId();
+ nPoolHlpFileId = rFmt.GetPoolHlpFileId();
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+ SetInSwFntCache( sal_False );
+
+ // kopiere nur das Attribut-Delta Array
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ aSet.Intersect_BC( rFmt.aSet, &aOld, &aNew );
+ aSet.Put_BC( rFmt.aSet, &aOld, &aNew );
+
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+
+ // PoolItem-Attr erzeugen fuers Modify !!!
+ if( aOld.Count() )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+
+ if( GetRegisteredIn() != rFmt.GetRegisteredIn() )
+ {
+ if( GetRegisteredIn() )
+ GetRegisteredInNonConst()->Remove(this);
+ if(rFmt.GetRegisteredIn())
+ {
+ const_cast<SwFmt&>(rFmt).GetRegisteredInNonConst()->Add(this);
+ aSet.SetParent( &rFmt.aSet );
+ }
+ else
+ aSet.SetParent( 0 );
+ }
+ bAutoFmt = rFmt.bAutoFmt;
+ bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
+ return *this;
+}
+
+void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
+{
+ ASSERT(!IsDefault(), "SetName: Defaultformat" );
+ if( bBroadcast )
+ {
+ SwStringMsgPoolItem aOld( RES_NAME_CHANGED, aFmtName );
+ SwStringMsgPoolItem aNew( RES_NAME_CHANGED, rNewName );
+ aFmtName = rNewName;
+ ModifyNotification( &aOld, &aNew );
+ }
+ else
+ {
+ aFmtName = rNewName;
+ }
+}
+
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * diese Funktion wird in jedem Copy-Ctor gerufen, damit die
+ * Attribute kopiert werden. Diese koennen erst kopiert werden,
+ * wenn die abgeleitet Klasse existiert, denn beim Setzen der
+ * Attribute wird die Which()-Methode gerufen, die hier in der
+ * Basis-Klasse auf 0 defaultet ist.
+ *
+ * Zusatz: JP 8.4.1994
+ * Wird ueber Dokumentgrenzen kopiert, so muss das neue Dokument
+ * mit angeben werden, in dem this steht. Z.Z. ist das fuers
+ * DropCaps wichtig, dieses haelt Daten, die tief kopiert werden
+ * muessen !!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
+
+void SwFmt::CopyAttrs( const SwFmt& rFmt, sal_Bool bReplace )
+{
+ // kopiere nur das Attribut-Delta Array
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+ SetInSwFntCache( sal_False );
+
+ // Sonderbehandlung fuer einige Attribute
+ SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
+
+ if( !bReplace ) // nur die neu, die nicht gesetzt sind ??
+ {
+ if( pChgSet == (SwAttrSet*)&rFmt.aSet ) // Set hier kopieren
+ pChgSet = new SwAttrSet( rFmt.aSet );
+ pChgSet->Differentiate( aSet );
+ }
+
+ // kopiere nur das Attribut-Delta Array
+ if( pChgSet->GetPool() != aSet.GetPool() )
+ pChgSet->CopyToModify( *this );
+ else
+ {
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+
+ if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+
+ if( pChgSet != (SwAttrSet*)&rFmt.aSet ) // Set hier angelegt ?
+ delete pChgSet;
+}
+
+/*************************************************************************
+|* SwFmt::~SwFmt()
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 14.02.91
+*************************************************************************/
+
+
+SwFmt::~SwFmt()
+{
+ /* das passiert bei der ObjectDying Message */
+ /* alle Abhaengigen auf DerivedFrom umhaengen */
+ if( GetDepends() )
+ {
+ ASSERT(DerivedFrom(), "SwFmt::~SwFmt: Def Abhaengige!" );
+
+ bFmtInDTOR = sal_True;
+
+ SwFmt *pParentFmt = DerivedFrom();
+ if (!pParentFmt) // see #112405#
+ {
+ DBG_ERROR( "~SwFmt: parent format missing" );
+ }
+ else
+ {
+ while( GetDepends() )
+ {
+ SwFmtChg aOldFmt(this);
+ SwFmtChg aNewFmt(pParentFmt);
+ SwClient * pDepend = (SwClient*)GetDepends();
+ pParentFmt->Add(pDepend);
+ pDepend->ModifyNotification(&aOldFmt, &aNewFmt);
+ }
+ }
+ }
+}
+
+
+/*************************************************************************
+|* void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
+{
+ sal_Bool bWeiter = sal_True; // sal_True = Propagierung an die Abhaengigen
+
+ sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
+ pNewValue ? pNewValue->Which() : 0 ;
+ switch( nWhich )
+ {
+ case 0: break; // Which-Id von 0 ???
+
+ case RES_OBJECTDYING :
+ {
+ // ist das sterbende Object das "Parent"-Format von diesen Format,
+ // dann haengt sich dieses Format an den Parent vom Parent
+ SwFmt * pFmt = (SwFmt *) ((SwPtrMsgPoolItem *)pNewValue)->pObject;
+
+ // nicht umhaengen wenn dieses das oberste Format ist !!
+ if( GetRegisteredIn() && GetRegisteredIn() == pFmt )
+ {
+ if( pFmt->GetRegisteredIn() )
+ {
+ // wenn Parent, dann im neuen Parent wieder anmelden
+ pFmt->DerivedFrom()->Add( this );
+ aSet.SetParent( &DerivedFrom()->aSet );
+ }
+ else
+ {
+ // sonst auf jeden Fall beim sterbenden abmelden
+ DerivedFrom()->Remove( this );
+ aSet.SetParent( 0 );
+ }
+ }
+ } // OBJECTDYING
+ break;
+
+ case RES_ATTRSET_CHG:
+ if( ((SwAttrSetChg*)pOldValue)->GetTheChgdSet() != &aSet )
+ {
+ //nur die weiter geben, die hier nicht gesetzt sind !!
+ SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue );
+ SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue );
+
+ aOld.GetChgSet()->Differentiate( aSet );
+ aNew.GetChgSet()->Differentiate( aSet );
+
+ if( aNew.Count() )
+ // keine mehr gesetzt, dann Ende !!
+ NotifyClients( &aOld, &aNew );
+ bWeiter = sal_False;
+ }
+ break;
+ case RES_FMT_CHG:
+ // falls mein Format Parent umgesetzt wird, dann melde ich
+ // meinen Attrset beim Neuen an.
+
+ // sein eigenes Modify ueberspringen !!
+ if( ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
+ ((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
+ {
+ // den Set an den neuen Parent haengen
+ aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );
+ }
+ break;
+
+ case RES_RESET_FMTWRITTEN:
+ {
+ // IsWritten-Flag zuruecksetzen. Hint nur an abhanegige
+ // Formate (und keine Frames) propagieren.
+ // mba: the code does the opposite from what is written in the comment!
+ ResetWritten();
+ // mba: here we don't use the additional stuff from NotifyClients().
+ // should we?!
+ // mba: move the code that ignores this event to the clients
+ ModifyBroadcast( pOldValue, pNewValue, TYPE(SwFmt) );
+ bWeiter = sal_False;
+ }
+ break;
+
+ default:
+ {
+ // Ist das Attribut in diesem Format definiert, dann auf
+ // NICHT weiter propagieren !!
+ if( SFX_ITEM_SET == aSet.GetItemState( nWhich, sal_False ))
+ {
+// wie finde ich heraus, ob nicht ich die Message versende ??
+// aber wer ruft das hier ????
+//ASSERT( sal_False, "Modify ohne Absender verschickt" );
+//JP 11.06.96: DropCaps koennen hierher kommen
+ASSERT( RES_PARATR_DROP == nWhich, "Modify ohne Absender verschickt" );
+ bWeiter = sal_False;
+ }
+
+ } // default
+ } // switch
+
+ if( bWeiter )
+ {
+ // laufe durch alle abhaengigen Formate
+ NotifyClients( pOldValue, pNewValue );
+ }
+
+}
+
+
+sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
+{
+ if ( pDerFrom )
+ {
+ // Zyklus?
+ const SwFmt* pFmt = pDerFrom;
+ while ( pFmt != 0 )
+ {
+ if ( pFmt == this )
+ return sal_False;
+
+ pFmt=pFmt->DerivedFrom();
+ }
+ }
+ else
+ {
+ // Nichts angegeben, Dflt-Format suchen
+ pDerFrom = this;
+ while ( pDerFrom->DerivedFrom() )
+ pDerFrom = pDerFrom->DerivedFrom();
+ }
+ if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) )
+ return sal_False;
+
+ ASSERT( Which()==pDerFrom->Which()
+ || ( Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL)
+ || ( Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL)
+ || ( Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT ),
+ "SetDerivedFrom: Aepfel von Birnen ableiten?");
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+ SetInSwFntCache( sal_False );
+
+ pDerFrom->Add(this);
+ aSet.SetParent( &pDerFrom->aSet );
+
+ SwFmtChg aOldFmt(this);
+ SwFmtChg aNewFmt(this);
+ ModifyNotification( &aOldFmt, &aNewFmt );
+
+ return sal_True;
+}
+
+
+sal_Bool SwFmt::SetFmtAttr(const SfxPoolItem& rAttr )
+{
+ if ( IsInCache() || IsInSwFntCache() )
+ {
+ const sal_uInt16 nWhich = rAttr.Which();
+ CheckCaching( nWhich );
+ }
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt;
+ // fuer FrmFmt's immer das Modify verschicken!
+ sal_Bool bRet = sal_False;
+ const sal_uInt16 nFmtWhich = Which();
+ if( IsModifyLocked() || (!GetDepends() &&
+ (RES_GRFFMTCOLL == nFmtWhich ||
+ RES_TXTFMTCOLL == nFmtWhich ) ) )
+ {
+ if( 0 != ( bRet = (0 != aSet.Put( rAttr ))) )
+ aSet.SetModifyAtAttr( this );
+ // --> OD 2006-11-22 #i71574#
+ if ( nFmtWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE )
+ {
+ TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
+ }
+ // <--
+ }
+ else
+ {
+ // kopiere nur das Attribut-Delta Array
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+
+ bRet = 0 != aSet.Put_BC( rAttr, &aOld, &aNew );
+ if( bRet )
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+ return bRet;
+}
+
+
+sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
+{
+ if( !rSet.Count() )
+ return sal_False;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+ SetInSwFntCache( sal_False );
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt;
+ // fuer FrmFmt's immer das Modify verschicken!
+ sal_Bool bRet = sal_False;
+ const sal_uInt16 nFmtWhich = Which();
+ if ( IsModifyLocked() ||
+ ( !GetDepends() &&
+ ( RES_GRFFMTCOLL == nFmtWhich ||
+ RES_TXTFMTCOLL == nFmtWhich ) ) )
+ {
+ if( 0 != ( bRet = (0 != aSet.Put( rSet ))) )
+ aSet.SetModifyAtAttr( this );
+ // --> OD 2006-11-22 #i71574#
+ if ( nFmtWhich == RES_TXTFMTCOLL )
+ {
+ TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
+ }
+ // <--
+ }
+ else
+ {
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ bRet = 0 != aSet.Put_BC( rSet, &aOld, &aNew );
+ if( bRet )
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+ return bRet;
+}
+
+// Nimmt den Hint mit nWhich aus dem Delta-Array
+
+
+sal_Bool SwFmt::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
+{
+ if( !aSet.Count() )
+ return sal_False;
+
+ if( !nWhich2 || nWhich2 < nWhich1 )
+ nWhich2 = nWhich1; // dann setze auf 1. Id, nur dieses Item
+
+ if ( IsInCache() || IsInSwFntCache() )
+ {
+ for( sal_uInt16 n = nWhich1; n < nWhich2; ++n )
+ CheckCaching( n );
+ }
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ return 0 != (( nWhich2 == nWhich1 )
+ ? aSet.ClearItem( nWhich1 )
+ : aSet.ClearItem_BC( nWhich1, nWhich2 ));
+
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ sal_Bool bRet = 0 != aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ return bRet;
+}
+
+
+
+// --> OD 2007-01-24 #i73790#
+// method renamed
+sal_uInt16 SwFmt::ResetAllFmtAttr()
+// <--
+{
+ if( !aSet.Count() )
+ return 0;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+ SetInSwFntCache( sal_False );
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ return aSet.ClearItem( 0 );
+
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ sal_Bool bRet = 0 != aSet.ClearItem_BC( 0, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ return aNew.Count();
+}
+
+
+/*************************************************************************
+|* void SwFmt::GetInfo( const SfxPoolItem& ) const
+|*
+|* Beschreibung
+|* Ersterstellung JP 18.04.94
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+sal_Bool SwFmt::GetInfo( SfxPoolItem& rInfo ) const
+{
+ sal_Bool bRet = SwModify::GetInfo( rInfo );
+ return bRet;
+}
+
+
+void SwFmt::DelDiffs( const SfxItemSet& rSet )
+{
+ if( !aSet.Count() )
+ return;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+ SetInSwFntCache( sal_False );
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ {
+ aSet.Intersect( rSet );
+ return;
+ }
+
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ sal_Bool bRet = 0 != aSet.Intersect_BC( rSet, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+}
+
+/** SwFmt::IsBackgroundTransparent - for feature #99657#
+
+ OD 22.08.2002
+ Virtual method to determine, if background of format is transparent.
+ Default implementation returns false. Thus, subclasses have to overload
+ method, if the specific subclass can have a transparent background.
+
+ @author OD
+
+ @return false, default implementation
+*/
+sal_Bool SwFmt::IsBackgroundTransparent() const
+{
+ return sal_False;
+}
+
+/** SwFmt::IsShadowTransparent - for feature #99657#
+
+ OD 22.08.2002
+ Virtual method to determine, if shadow of format is transparent.
+ Default implementation returns false. Thus, subclasses have to overload
+ method, if the specific subclass can have a transparent shadow.
+
+ @author OD
+
+ @return false, default implementation
+*/
+sal_Bool SwFmt::IsShadowTransparent() const
+{
+ return sal_False;
+}
+
+/*
+ * Document Interface Access
+ */
+const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return GetDoc(); }
+const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return GetDoc(); }
+IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return GetDoc(); }
+const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return GetDoc(); }
+IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); }
+IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); }
+IDocumentFieldsAccess* SwFmt::getIDocumentFieldsAccess() { return GetDoc(); }
+IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() { return GetDoc(); }
+
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
new file mode 100644
index 000000000000..3d9d284b8c6d
--- /dev/null
+++ b/sw/source/core/attr/hints.cxx
@@ -0,0 +1,308 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <hints.hxx>
+
+#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
+#include <com/sun/star/i18n/ScriptType.hdl>
+#endif
+#include <editeng/scripttypeitem.hxx>
+#include <hintids.hxx>
+#include <swtypes.hxx>
+#include <ndtxt.hxx>
+#include <errhdl.hxx>
+
+SwFmtChg::SwFmtChg( SwFmt *pFmt )
+ : SwMsgPoolItem( RES_FMT_CHG ),
+ pChangedFmt( pFmt )
+{}
+
+
+
+SwInsTxt::SwInsTxt( xub_StrLen nP, xub_StrLen nL )
+ : SwMsgPoolItem( RES_INS_TXT ),
+ nPos( nP ),
+ nLen( nL )
+{}
+
+
+
+SwDelChr::SwDelChr( xub_StrLen nP )
+ : SwMsgPoolItem( RES_DEL_CHR ),
+ nPos( nP )
+{}
+
+
+
+SwDelTxt::SwDelTxt( xub_StrLen nS, xub_StrLen nL )
+ : SwMsgPoolItem( RES_DEL_TXT ),
+ nStart( nS ),
+ nLen( nL )
+{}
+
+
+
+SwUpdateAttr::SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, sal_uInt16 nW )
+ : SwMsgPoolItem( RES_UPDATE_ATTR ),
+ nStart( nS ),
+ nEnd( nE ),
+ nWhichAttr( nW )
+{}
+
+
+// SwRefMarkFldUpdate wird verschickt, wenn sich die ReferenzMarkierungen
+// Updaten sollen. Um Seiten-/KapitelNummer feststellen zu koennen, muss
+// der akt. Frame befragt werden. Dafuer wird das akt. OutputDevice benoetigt.
+
+
+SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput )
+ : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
+ pOut( pOutput )
+{
+ ASSERT( pOut, "es muss ein OutputDevice-Pointer gesetzt werden!" );
+}
+
+
+SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDcPos )
+ : SwMsgPoolItem( RES_DOCPOS_UPDATE ),
+ nDocPos(nDcPos)
+{}
+
+
+
+// SwTableFmlUpdate wird verschickt, wenn sich die Tabelle neu berechnen soll
+SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl )
+ : SwMsgPoolItem( RES_TABLEFML_UPDATE ),
+ pTbl( pNewTbl ), pHistory( 0 ), nSplitLine( USHRT_MAX ),
+ eFlags( TBL_CALC )
+{
+ DATA.pDelTbl = 0;
+ bModified = bBehindSplitLine = sal_False;
+ ASSERT( pTbl, "es muss ein Table-Pointer gesetzt werden!" );
+}
+
+
+SwAutoFmtGetDocNode::SwAutoFmtGetDocNode( const SwNodes* pNds )
+ : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ),
+ pCntntNode( 0 ), pNodes( pNds )
+{}
+
+
+SwAttrSetChg::SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet )
+ : SwMsgPoolItem( RES_ATTRSET_CHG ),
+ bDelSet( sal_False ),
+ pChgSet( &rSet ),
+ pTheChgdSet( &rTheSet )
+{}
+
+
+SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg& rChgSet )
+ : SwMsgPoolItem( RES_ATTRSET_CHG ),
+ bDelSet( sal_True ),
+ pTheChgdSet( rChgSet.pTheChgdSet )
+{
+ pChgSet = new SwAttrSet( *rChgSet.pChgSet );
+}
+
+
+SwAttrSetChg::~SwAttrSetChg()
+{
+ if( bDelSet )
+ delete pChgSet;
+}
+
+
+#ifdef DBG_UTIL
+
+void SwAttrSetChg::ClearItem( sal_uInt16 nWhch )
+{
+ ASSERT( bDelSet, "der Set darf nicht veraendert werden!" );
+ pChgSet->ClearItem( nWhch );
+}
+
+#endif
+
+
+SwMsgPoolItem::SwMsgPoolItem( sal_uInt16 nWhch )
+ : SfxPoolItem( nWhch )
+{}
+
+
+// "Overhead" vom SfxPoolItem
+int SwMsgPoolItem::operator==( const SfxPoolItem& ) const
+{
+ ASSERT( sal_False, "SwMsgPoolItem kennt kein ==" );
+ return 0;
+}
+
+
+SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const
+{
+ ASSERT( sal_False, "SwMsgPoolItem kennt kein Clone" );
+ return 0;
+}
+
+/******************************************************************************
+ * hole aus der Default-Attribut Tabelle ueber den Which-Wert
+ * das entsprechende default Attribut.
+ * Ist keines vorhanden, returnt ein 0-Pointer !!!
+ * Used to be inlined (hintids.hxx) in PRODUCT.
+ ******************************************************************************/
+#ifndef DBG_UTIL
+const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
+{
+ return aAttrTab[ nWhich - POOLATTR_BEGIN ];
+}
+#else
+const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
+{
+ ASSERT_ID( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN,
+ ERR_OUTOFSCOPE );
+
+ SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ];
+ ASSERT( pHt, "GetDfltFmtAttr(): Dflt == 0" );
+ return pHt;
+}
+#endif
+
+
+
+SwCondCollCondChg::SwCondCollCondChg( SwFmt *pFmt )
+ : SwMsgPoolItem( RES_CONDCOLL_CONDCHG ), pChangedFmt( pFmt )
+{
+}
+
+
+SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrm *pPg ) :
+ SwMsgPoolItem( RES_VIRTPAGENUM_INFO ),
+ pPage( 0 ),
+ pOrigPage( pPg ),
+ pFrm( 0 )
+{
+}
+
+// --> OD 2008-02-19 #refactorlists#
+//SwNumRuleInfo::SwNumRuleInfo( const String& rRuleName )
+// : SwMsgPoolItem( RES_GETNUMNODES ), rName( rRuleName )
+//{
+//}
+
+//void SwNumRuleInfo::AddNode( SwTxtNode& rNd )
+//{
+// aList.Insert(rNd.GetIndex(), &rNd);
+//}
+
+
+SwFindNearestNode::SwFindNearestNode( const SwNode& rNd )
+ : SwMsgPoolItem( RES_FINDNEARESTNODE ), pNd( &rNd ), pFnd( 0 )
+{
+}
+
+void SwFindNearestNode::CheckNode( const SwNode& rNd )
+{
+ if( &pNd->GetNodes() == &rNd.GetNodes() )
+ {
+ sal_uLong nIdx = rNd.GetIndex();
+ if( nIdx < pNd->GetIndex() &&
+ ( !pFnd || nIdx > pFnd->GetIndex() ) &&
+ nIdx > rNd.GetNodes().GetEndOfExtras().GetIndex() )
+ pFnd = &rNd;
+ }
+}
+
+
+
+sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript )
+{
+ static const sal_uInt16 aLangMap[3] =
+ { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE };
+ static const sal_uInt16 aFontMap[3] =
+ { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT};
+ static const sal_uInt16 aFontSizeMap[3] =
+ { RES_CHRATR_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CTL_FONTSIZE };
+ static const sal_uInt16 aWeightMap[3] =
+ { RES_CHRATR_WEIGHT, RES_CHRATR_CJK_WEIGHT, RES_CHRATR_CTL_WEIGHT};
+ static const sal_uInt16 aPostureMap[3] =
+ { RES_CHRATR_POSTURE, RES_CHRATR_CJK_POSTURE, RES_CHRATR_CTL_POSTURE};
+
+ const sal_uInt16* pM;
+ switch( nWhich )
+ {
+ case RES_CHRATR_LANGUAGE:
+ case RES_CHRATR_CJK_LANGUAGE:
+ case RES_CHRATR_CTL_LANGUAGE:
+ pM = aLangMap;
+ break;
+
+ case RES_CHRATR_FONT:
+ case RES_CHRATR_CJK_FONT:
+ case RES_CHRATR_CTL_FONT:
+ pM = aFontMap;
+ break;
+
+ case RES_CHRATR_FONTSIZE:
+ case RES_CHRATR_CJK_FONTSIZE:
+ case RES_CHRATR_CTL_FONTSIZE:
+ pM = aFontSizeMap;
+ break;
+
+ case RES_CHRATR_WEIGHT:
+ case RES_CHRATR_CJK_WEIGHT:
+ case RES_CHRATR_CTL_WEIGHT:
+ pM = aWeightMap;
+ break;
+ case RES_CHRATR_POSTURE:
+ case RES_CHRATR_CJK_POSTURE:
+ case RES_CHRATR_CTL_POSTURE:
+ pM = aPostureMap;
+ break;
+
+ default:
+ pM = 0;
+ }
+
+ sal_uInt16 nRet;
+ if( pM )
+ {
+ using namespace ::com::sun::star::i18n;
+ {
+ if( ScriptType::WEAK == nScript )
+ nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
+ switch( nScript)
+ {
+ case ScriptType::COMPLEX: ++pM; // no break;
+ case ScriptType::ASIAN: ++pM; // no break;
+ default: nRet = *pM;
+ }
+ }
+ }
+ else
+ nRet = nWhich;
+ return nRet;
+}
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
new file mode 100644
index 000000000000..1753f06a8c1f
--- /dev/null
+++ b/sw/source/core/attr/swatrset.cxx
@@ -0,0 +1,404 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <svl/whiter.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/bolnitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <svx/xtable.hxx>
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+#include <charfmt.hxx>
+#include <doc.hxx>
+#include <node.hxx>
+#include <paratr.hxx> // fuer SetModifyAtAttr
+#include <cellatr.hxx> // fuer SetModifyAtAttr
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <istyleaccess.hxx>
+#include <numrule.hxx>
+// --> OD 2008-03-19 #refactorlists#
+#include <list.hxx>
+// <--
+
+
+SwAttrPool::SwAttrPool( SwDoc* pD )
+ : SfxItemPool( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "SWG" )),
+ POOLATTR_BEGIN, POOLATTR_END-1,
+ aSlotTab, aAttrTab ),
+ pDoc( pD )
+{
+ SetVersionMap( 1, 1, 60, pVersionMap1 );
+ SetVersionMap( 2, 1, 75, pVersionMap2 );
+ SetVersionMap( 3, 1, 86, pVersionMap3 );
+ SetVersionMap( 4, 1,121, pVersionMap4 );
+ // OD 2004-01-21 #i18732# - apply new version map
+ SetVersionMap( 5, 1,130, pVersionMap5 );
+ SetVersionMap( 6, 1,136, pVersionMap6 );
+}
+
+SwAttrPool::~SwAttrPool()
+{
+}
+
+SwAttrSet::SwAttrSet( SwAttrPool& rPool, sal_uInt16 nWh1, sal_uInt16 nWh2 )
+ : SfxItemSet( rPool, nWh1, nWh2 ), pOldSet( 0 ), pNewSet( 0 )
+{
+}
+
+
+SwAttrSet::SwAttrSet( SwAttrPool& rPool, const sal_uInt16* nWhichPairTable )
+ : SfxItemSet( rPool, nWhichPairTable ), pOldSet( 0 ), pNewSet( 0 )
+{
+}
+
+
+SwAttrSet::SwAttrSet( const SwAttrSet& rSet )
+ : SfxItemSet( rSet ), pOldSet( 0 ), pNewSet( 0 )
+{
+}
+
+SfxItemSet* SwAttrSet::Clone( sal_Bool bItems, SfxItemPool *pToPool ) const
+{
+ if ( pToPool && pToPool != GetPool() )
+ {
+ SwAttrPool* pAttrPool = dynamic_cast< SwAttrPool* >(pToPool);
+ SfxItemSet* pTmpSet = 0;
+ if ( !pAttrPool )
+ pTmpSet = SfxItemSet::Clone( bItems, pToPool );
+ else
+ {
+ pTmpSet = new SwAttrSet( *pAttrPool, GetRanges() );
+ if ( bItems )
+ {
+ SfxWhichIter aIter(*pTmpSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while ( nWhich )
+ {
+ const SfxPoolItem* pItem;
+ if ( SFX_ITEM_SET == GetItemState( nWhich, sal_False, &pItem ) )
+ pTmpSet->Put( *pItem, pItem->Which() );
+ nWhich = aIter.NextWhich();
+ }
+ }
+ }
+ return pTmpSet;
+ }
+ else
+ return bItems
+ ? new SwAttrSet( *this )
+ : new SwAttrSet( *GetPool(), GetRanges() );
+}
+
+int SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ int nRet = 0 != SfxItemSet::Put( rAttr );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+int SwAttrSet::Put_BC( const SfxItemSet& rSet,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ int nRet = 0 != SfxItemSet::Put( rSet );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+
+sal_uInt16 SwAttrSet::ClearItem_BC( sal_uInt16 nWhich,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ sal_uInt16 nRet = SfxItemSet::ClearItem( nWhich );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+sal_uInt16 SwAttrSet::ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ ASSERT( nWhich1 <= nWhich2, "kein gueltiger Bereich" );
+ pNewSet = pNew;
+ pOldSet = pOld;
+ sal_uInt16 nRet = 0;
+ for( ; nWhich1 <= nWhich2; ++nWhich1 )
+ nRet = nRet + SfxItemSet::ClearItem( nWhich1 );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+
+int SwAttrSet::Intersect_BC( const SfxItemSet& rSet,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ SfxItemSet::Intersect( rSet );
+ pOldSet = pNewSet = 0;
+ return pNew ? pNew->Count() : ( pOld ? pOld->Count() : 0 );
+}
+
+// Notification-Callback
+void SwAttrSet::Changed( const SfxPoolItem& rOld,
+ const SfxPoolItem& rNew )
+{
+ if( pOldSet )
+ pOldSet->PutChgd( rOld );
+
+ if( pNewSet )
+ pNewSet->PutChgd( rNew );
+}
+
+
+// ----------------------------------------------------------------
+// Sonderbehandlung fuer einige Attribute
+// Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen:
+// - SwFmtDropCaps
+// - SwFmtPageDesc
+// (Wird beim Einfuegen in Formate/Nodes gerufen)
+// ----------------------------------------------------------------
+
+bool SwAttrSet::SetModifyAtAttr( const SwModify* pModify )
+{
+ bool bSet = false;
+
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == GetItemState( RES_PAGEDESC, sal_False, &pItem ) &&
+ ((SwFmtPageDesc*)pItem)->GetDefinedIn() != pModify )
+ {
+ ((SwFmtPageDesc*)pItem)->ChgDefinedIn( pModify );
+ bSet = true;
+ }
+
+ if( SFX_ITEM_SET == GetItemState( RES_PARATR_DROP, sal_False, &pItem ) &&
+ ((SwFmtDrop*)pItem)->GetDefinedIn() != pModify )
+ {
+ // CharFormat gesetzt und dann noch in unterschiedlichen
+ // Attribut Pools, dann muss das CharFormat kopiert werden!
+ SwCharFmt* pCharFmt;
+ if( 0 != ( pCharFmt = ((SwFmtDrop*)pItem)->GetCharFmt() )
+ && GetPool() != pCharFmt->GetAttrSet().GetPool() )
+ {
+ pCharFmt = GetDoc()->CopyCharFmt( *pCharFmt );
+ ((SwFmtDrop*)pItem)->SetCharFmt( pCharFmt );
+ }
+ ((SwFmtDrop*)pItem)->ChgDefinedIn( pModify );
+ bSet = true;
+ }
+
+ if( SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMULA, sal_False, &pItem ) &&
+ ((SwTblBoxFormula*)pItem)->GetDefinedIn() != pModify )
+ {
+ ((SwTblBoxFormula*)pItem)->ChgDefinedIn( pModify );
+ bSet = true;
+ }
+
+ return bSet;
+}
+
+void SwAttrSet::CopyToModify( SwModify& rMod ) const
+{
+ // kopiere die Attribute ggfs. ueber Dokumentgrenzen
+ SwCntntNode* pCNd = PTR_CAST( SwCntntNode, &rMod );
+ SwFmt* pFmt = PTR_CAST( SwFmt, &rMod );
+
+ if( pCNd || pFmt )
+ {
+ if( Count() )
+ {
+ // --> OD 2008-08-15 #i92811#
+ SfxStringItem* pNewListIdItem( 0 );
+ // <--
+
+ const SfxPoolItem* pItem;
+ const SwDoc *pSrcDoc = GetDoc();
+ SwDoc *pDstDoc = pCNd ? pCNd->GetDoc() : pFmt->GetDoc();
+
+ // muss die NumRule kopiert werden?
+ if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
+ RES_PARATR_NUMRULE, sal_False, &pItem ) )
+ {
+ const String& rNm = ((SwNumRuleItem*)pItem)->GetValue();
+ if( rNm.Len() )
+ {
+ SwNumRule* pDestRule = pDstDoc->FindNumRulePtr( rNm );
+ if( pDestRule )
+ pDestRule->SetInvalidRule( sal_True );
+ else
+ pDstDoc->MakeNumRule( rNm,
+ pSrcDoc->FindNumRulePtr( rNm ) );
+ }
+ }
+
+ // --> OD 2008-03-19 #refactorlists#
+ // copy list and if needed also the corresponding list style
+ // for text nodes
+ if ( pSrcDoc != pDstDoc &&
+ pCNd && pCNd->IsTxtNode() &&
+ GetItemState( RES_PARATR_LIST_ID, sal_False, &pItem ) == SFX_ITEM_SET )
+ {
+ const String& sListId =
+ dynamic_cast<const SfxStringItem*>(pItem)->GetValue();
+ if ( sListId.Len() > 0 &&
+ !pDstDoc->getListByName( sListId ) )
+ {
+ const SwList* pList = pSrcDoc->getListByName( sListId );
+ // copy list style, if needed
+ const String sDefaultListStyleName =
+ pList->GetDefaultListStyleName();
+ // --> OD 2008-08-15 #i92811#
+ const SwNumRule* pDstDocNumRule =
+ pDstDoc->FindNumRulePtr( sDefaultListStyleName );
+ if ( !pDstDocNumRule )
+ {
+ pDstDoc->MakeNumRule( sDefaultListStyleName,
+ pSrcDoc->FindNumRulePtr( sDefaultListStyleName ) );
+ }
+ else
+ {
+ const SwNumRule* pSrcDocNumRule =
+ pSrcDoc->FindNumRulePtr( sDefaultListStyleName );
+ // If list id of text node equals the list style's
+ // default list id in the source document, the same
+ // should be hold in the destination document.
+ // Thus, create new list id item.
+ if ( sListId == pSrcDocNumRule->GetDefaultListId() )
+ {
+ pNewListIdItem = new SfxStringItem (
+ RES_PARATR_LIST_ID,
+ pDstDocNumRule->GetDefaultListId() );
+ }
+ }
+ // check again, if list exist, because <SwDoc::MakeNumRule(..)>
+ // could have also created it.
+ if ( pNewListIdItem == 0 &&
+ !pDstDoc->getListByName( sListId ) )
+ {
+ // copy list
+ pDstDoc->createList( sListId, sDefaultListStyleName );
+ }
+ // <--
+ }
+ }
+ // <--
+
+ // JP 04.02.99: Task #61467# Seitenvorlagenwechsel mit kopieren
+ // Gegenueber dem alten Verhalten, sie zu entfernen
+ const SwPageDesc* pPgDesc;
+ if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
+ RES_PAGEDESC, sal_False, &pItem ) &&
+ 0 != ( pPgDesc = ((SwFmtPageDesc*)pItem)->GetPageDesc()) )
+ {
+ SfxItemSet aTmpSet( *this );
+
+ SwPageDesc* pDstPgDesc = pDstDoc->FindPageDescByName(
+ pPgDesc->GetName() );
+ if( !pDstPgDesc )
+ {
+ // dann kopieren, ansonsten den benutzen
+ pDstPgDesc = &pDstDoc->_GetPageDesc( pDstDoc->MakePageDesc(
+ pPgDesc->GetName() ));
+ pDstDoc->CopyPageDesc( *pPgDesc, *pDstPgDesc );
+ }
+ SwFmtPageDesc aDesc( pDstPgDesc );
+ aDesc.SetNumOffset( ((SwFmtPageDesc*)pItem)->GetNumOffset() );
+ aTmpSet.Put( aDesc );
+
+ if( pCNd )
+ {
+ // --> OD 2008-08-15 #i92811#
+ if ( pNewListIdItem != 0 )
+ {
+ aTmpSet.Put( *pNewListIdItem );
+ }
+ // <--
+ pCNd->SetAttr( aTmpSet );
+ }
+ else
+ pFmt->SetFmtAttr( aTmpSet );
+ }
+ else if( pCNd )
+ {
+ // --> OD 2008-08-15 #i92811#
+ if ( pNewListIdItem != 0 )
+ {
+ SfxItemSet aTmpSet( *this );
+ aTmpSet.Put( *pNewListIdItem );
+ pCNd->SetAttr( aTmpSet );
+ }
+ else
+ {
+ pCNd->SetAttr( *this );
+ }
+ // <--
+ }
+ else
+ pFmt->SetFmtAttr( *this );
+
+ // --> OD 2008-08-15 #i92811#
+ delete pNewListIdItem;
+ pNewListIdItem = 0;
+ // <--
+ }
+ }
+#ifdef DBG_UTIL
+ else
+ ASSERT( !this, "weder Format noch ContentNode - keine Attribute kopiert");
+#endif
+}
+
+// check if ID is InRange of AttrSet-Ids
+sal_Bool IsInRange( const sal_uInt16* pRange, const sal_uInt16 nId )
+{
+ while( *pRange )
+ {
+ if( *pRange <= nId && nId <= *(pRange+1) )
+ return sal_True;
+ pRange += 2;
+ }
+ return sal_False;
+}
+
diff --git a/sw/source/core/bastyp/SwSmartTagMgr.cxx b/sw/source/core/bastyp/SwSmartTagMgr.cxx
new file mode 100644
index 000000000000..ac661389ae6a
--- /dev/null
+++ b/sw/source/core/bastyp/SwSmartTagMgr.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "SwSmartTagMgr.hxx"
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <swmodule.hxx>
+
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+SwSmartTagMgr* SwSmartTagMgr::mpTheSwSmartTagMgr = 0;
+
+SwSmartTagMgr& SwSmartTagMgr::Get()
+{
+ if ( !mpTheSwSmartTagMgr )
+ {
+ mpTheSwSmartTagMgr = new SwSmartTagMgr( SwDocShell::Factory().GetModuleName() );
+ mpTheSwSmartTagMgr->Init( rtl::OUString::createFromAscii("Writer") );
+ }
+ return *mpTheSwSmartTagMgr;
+}
+
+SwSmartTagMgr::SwSmartTagMgr( const rtl::OUString& rModuleName ) :
+ SmartTagMgr( rModuleName )
+{
+}
+
+SwSmartTagMgr::~SwSmartTagMgr()
+{
+}
+
+// ::com::sun::star::util::XModifyListener
+void SwSmartTagMgr::modified( const lang::EventObject& rEO ) throw( RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // Installed recognizers have changed. We remove all existing smart tags:
+ SW_MOD()->CheckSpellChanges( sal_False, sal_True, sal_True, sal_True );
+
+ SmartTagMgr::modified( rEO );
+}
+
+// ::com::sun::star::util::XChangesListener
+void SwSmartTagMgr::changesOccurred( const util::ChangesEvent& rEvent ) throw( RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // Configuration has changed. We remove all existing smart tags:
+ SW_MOD()->CheckSpellChanges( sal_False, sal_True, sal_True, sal_True );
+
+ SmartTagMgr::changesOccurred( rEvent );
+}
+
+/*
+SmartTagMgr& SwSmartTagMgr::Get()
+{
+ if ( !pSmartTagMgr )
+ pSmartTagMgr = new SmartTagMgr( SwDocShell::Factory().GetModuleName() );
+
+ return *pSmartTagMgr;
+}
+*/
+
diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx
new file mode 100644
index 000000000000..1b6db5d3dc52
--- /dev/null
+++ b/sw/source/core/bastyp/bparr.cxx
@@ -0,0 +1,580 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <string.h>
+#include <limits.h>
+#include "bparr.hxx"
+
+// die Blockverwaltung waechst/schrumpft immer um 20 Bloecke, das sind dann
+// immer ~ 20 * MAXENTRY == 20000 Eintraege
+const sal_uInt16 nBlockGrowSize = 20;
+
+#ifndef DBG_UTIL
+
+#define CHECKIDX( p, n, i, c )
+
+#else
+
+#define CHECKIDX( p, n, i, c ) CheckIdx( p, n, i, c );
+
+void CheckIdx( BlockInfo** ppInf, sal_uInt16 nBlock, sal_uLong nSize, sal_uInt16 nCur )
+{
+ DBG_ASSERT( !nSize || nCur < nBlock, "BigPtrArray: CurIndex steht falsch" );
+
+ sal_uLong nIdx = 0;
+ for( sal_uInt16 nCnt = 0; nCnt < nBlock; ++nCnt, ++ppInf )
+ {
+ nIdx += (*ppInf)->nElem;
+ // Array mit Luecken darf es nicht geben
+ DBG_ASSERT( !nCnt || (*(ppInf-1))->nEnd + 1 == (*ppInf)->nStart,
+ "BigPtrArray: Luecke in der Verwaltung!" );
+ }
+
+ DBG_ASSERT( nIdx == nSize, "BigPtrArray: Anzahl ungueltig" );
+}
+
+#endif
+
+
+BigPtrArray::BigPtrArray()
+{
+ nBlock = nCur = 0;
+ nSize = 0;
+ nMaxBlock = nBlockGrowSize; // == 20 * 1000 Eintraege
+ ppInf = new BlockInfo* [ nMaxBlock ];
+}
+
+
+
+BigPtrArray::~BigPtrArray()
+{
+ if( nBlock )
+ {
+ BlockInfo** pp = ppInf;
+ for( sal_uInt16 n = 0; n < nBlock; ++n, ++pp )
+ {
+ delete[] (*pp)->pData;
+ delete *pp;
+ }
+ }
+ delete[] ppInf;
+}
+
+// Auch der Move ist schlicht. Optimieren ist hier wg. der
+// Stueckelung des Feldes zwecklos!
+
+void BigPtrArray::Move( sal_uLong from, sal_uLong to )
+{
+ sal_uInt16 cur = Index2Block( from );
+ BlockInfo* p = ppInf[ cur ];
+ ElementPtr pElem = p->pData[ from - p->nStart ];
+ Insert( pElem, to ); // erst einfuegen, dann loeschen !!!!
+ Remove( ( to < from ) ? ( from + 1 ) : from );
+}
+
+// das Ende ist EXCLUSIV
+
+
+void BigPtrArray::ForEach( sal_uLong nStart, sal_uLong nEnd,
+ FnForEach fn, void* pArgs )
+{
+ if( nEnd > nSize )
+ nEnd = nSize;
+
+ if( nStart < nEnd )
+ {
+ sal_uInt16 cur = Index2Block( nStart );
+ BlockInfo** pp = ppInf + cur;
+ BlockInfo* p = *pp;
+ sal_uInt16 nElem = sal_uInt16( nStart - p->nStart );
+ ElementPtr* pElem = p->pData + nElem;
+ nElem = p->nElem - nElem;
+ for(;;)
+ {
+ if( !(*fn)( *pElem++, pArgs ) || ++nStart >= nEnd )
+ break;
+
+ // naechstes Element
+ if( !--nElem )
+ {
+ // neuer Block
+ p = *++pp;
+ pElem = p->pData;
+ nElem = p->nElem;
+ }
+ }
+ }
+}
+
+
+ElementPtr BigPtrArray::operator[]( sal_uLong idx ) const
+{
+ // weil die Funktion eben doch nicht const ist:
+ DBG_ASSERT( idx < nSize, "operator[]: Index aussserhalb" );
+ BigPtrArray* pThis = (BigPtrArray*) this;
+ sal_uInt16 cur = Index2Block( idx );
+ BlockInfo* p = ppInf[ cur ];
+ pThis->nCur = cur;
+ return p->pData[ idx - p->nStart ];
+}
+
+///////////////////////////////////////////////////////////////////////////
+
+// private Methoden
+
+// Suchen des Blocks einer bestimmten Position
+// Algorithmus:
+// 1. Test, ob der letzte Block der gesuchte Block ist
+// 2. Sonderfall: Index = 0?
+// 3. Test der Nachbarbloecke
+
+// 4. Binaere Suche
+
+
+
+sal_uInt16 BigPtrArray::Index2Block( sal_uLong pos ) const
+{
+ // zuletzt verwendeter Block?
+ BlockInfo* p = ppInf[ nCur ];
+ if( p->nStart <= pos && p->nEnd >= pos )
+ return nCur;
+ // Index = 0?
+ if( !pos )
+ return 0;
+ // Folgeblock?
+ if( nCur < ( nBlock - 1 ) )
+ {
+ p = ppInf[ nCur+1 ];
+ if( p->nStart <= pos && p->nEnd >= pos )
+ return nCur+1;
+ }
+ // vorangehender Block?
+ else if( pos < p->nStart && nCur > 0 )
+ {
+ p = ppInf[ nCur-1 ];
+ if( p->nStart <= pos && p->nEnd >= pos )
+ return nCur-1;
+ }
+ // Binaere Suche:
+ // Diese fuehrt immer zum Erfolg
+ sal_uInt16 lower = 0, upper = nBlock - 1;
+ sal_uInt16 cur = 0;
+ for(;;)
+ {
+ sal_uInt16 n = lower + ( upper - lower ) / 2;
+ cur = ( n == cur ) ? n+1 : n;
+ p = ppInf[ cur ];
+ if( p->nStart <= pos && p->nEnd >= pos )
+ return cur;
+ if( p->nStart > pos )
+ upper = cur;
+ else
+ lower = cur;
+ }
+}
+
+
+// Update aller Indexbereiche ab einer bestimmten Position
+
+// pos bezeichnet den letzten korrekten Block
+
+void BigPtrArray::UpdIndex( sal_uInt16 pos )
+{
+ BlockInfo** pp = ppInf + pos;
+ sal_uLong idx = (*pp)->nEnd + 1;
+ BlockInfo* p;
+ while( ++pos < nBlock )
+ {
+ p = *++pp;
+ p->nStart = idx;
+ idx += p->nElem;
+ p->nEnd = idx - 1;
+ }
+}
+
+// Einrichten eines neuen Blocks an einer bestimmten Position
+
+// Vorhandene Blocks werden nach hinten verschoben
+
+
+
+BlockInfo* BigPtrArray::InsBlock( sal_uInt16 pos )
+{
+ if( nBlock == nMaxBlock )
+ {
+ // dann sollte wir mal das Array erweitern
+ BlockInfo** ppNew = new BlockInfo* [ nMaxBlock + nBlockGrowSize ];
+ memcpy( ppNew, ppInf, nMaxBlock * sizeof( BlockInfo* ));
+ delete[] ppInf;
+ nMaxBlock += nBlockGrowSize;
+ ppInf = ppNew;
+ }
+ if( pos != nBlock )
+ memmove( ppInf + pos+1, ppInf + pos ,
+ ( nBlock - pos ) * sizeof (BlockInfo*) );
+ ++nBlock;
+ BlockInfo* p = new BlockInfo;
+ ppInf[ pos ] = p;
+
+ if( pos )
+ p->nStart = p->nEnd = ppInf[ pos-1 ]->nEnd + 1;
+ else
+ p->nStart = p->nEnd = 0;
+ p->nEnd--; // keine Elemente
+ p->nElem = 0;
+ p->pData = new ElementPtr [ MAXENTRY ];
+ p->pBigArr = this;
+ return p;
+}
+
+void BigPtrArray::BlockDel( sal_uInt16 nDel )
+{
+ nBlock = nBlock - nDel;
+ if( nMaxBlock - nBlock > nBlockGrowSize )
+ {
+ // dann koennen wir wieder schrumpfen
+ nDel = (( nBlock / nBlockGrowSize ) + 1 ) * nBlockGrowSize;
+ BlockInfo** ppNew = new BlockInfo* [ nDel ];
+ memcpy( ppNew, ppInf, nBlock * sizeof( BlockInfo* ));
+ delete[] ppInf;
+ ppInf = ppNew;
+ nMaxBlock = nDel;
+ }
+}
+
+
+void BigPtrArray::Insert( const ElementPtr& rElem, sal_uLong pos )
+{
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+
+ BlockInfo* p;
+ sal_uInt16 cur;
+ if( !nSize )
+ // Sonderfall: erstes Element einfuegen
+ p = InsBlock( cur = 0 );
+ else if( pos == nSize )
+ {
+ // Sonderfall: Einfuegen am Ende
+ cur = nBlock - 1;
+ p = ppInf[ cur ];
+ if( p->nElem == MAXENTRY )
+ // Der letzte Block ist voll, neuen anlegen
+ p = InsBlock( ++cur );
+ }
+ else
+ {
+ // Standardfall:
+ cur = Index2Block( pos );
+ p = ppInf[ cur ];
+ }
+ if( p->nElem == MAXENTRY )
+ {
+ // passt der letzte Eintrag in den naechsten Block?
+ BlockInfo* q;
+ if( cur < ( nBlock - 1 ) && ppInf[ cur+1 ]->nElem < MAXENTRY )
+ {
+ q = ppInf[ cur+1 ];
+ if( q->nElem )
+ {
+ int nCount = q->nElem;
+ ElementPtr *pFrom = q->pData + nCount,
+ *pTo = pFrom+1;
+ while( nCount-- )
+ ++( *--pTo = *--pFrom )->nOffset;
+ }
+ q->nStart--;
+ q->nEnd--;
+ }
+ else
+ {
+ // Wenn er auch nicht in den Folgeblock passt, muss ein
+ // neuer Block eingefuegt werden
+ // erst mal bei Bedarf komprimieren
+
+ // wenn mehr als 50% "Luft" im Array ist, dann sollte man mal das
+ // Compress aufrufen
+ if( /*nBlock == nMaxBlock &&*/
+ nBlock > ( nSize / ( MAXENTRY / 2 ) ) &&
+ cur >= Compress() )
+ {
+ // es wurde vor der akt. Pos etwas verschoben und alle
+ // Pointer koennen ungueltig sein. Also das Insert
+ // nochmals aufsetzen
+ Insert( rElem, pos );
+ return ;
+ }
+
+ q = InsBlock( cur+1 );
+ }
+
+ // Eintrag passt nicht mehr. Dann muss Platz gemacht werden
+ ElementPtr pLast = p->pData[ MAXENTRY-1 ];
+ pLast->nOffset = 0;
+ pLast->pBlock = q;
+
+ q->pData[ 0 ] = pLast;
+ q->nElem++;
+ q->nEnd++;
+
+ p->nEnd--;
+ p->nElem--;
+ }
+ // Nun haben wir einen freien Block am Wickel: eintragen
+ pos -= p->nStart;
+ DBG_ASSERT( pos < MAXENTRY, "falsche Pos" );
+ if( pos != p->nElem )
+ {
+ int nCount = p->nElem - sal_uInt16(pos);
+ ElementPtr *pFrom = p->pData + p->nElem,
+ *pTo = pFrom + 1;
+ while( nCount-- )
+ ++( *--pTo = *--pFrom )->nOffset;
+ }
+ // Element eintragen und Indexe updaten
+ ((ElementPtr&)rElem)->nOffset = sal_uInt16(pos);
+ ((ElementPtr&)rElem)->pBlock = p;
+ p->pData[ pos ] = rElem;
+ p->nEnd++;
+ p->nElem++;
+ nSize++;
+ if( cur != ( nBlock - 1 ) ) UpdIndex( cur );
+ nCur = cur;
+
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+}
+
+void BigPtrArray::Remove( sal_uLong pos, sal_uLong n )
+{
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+
+ sal_uInt16 nBlkdel = 0; // entfernte Bloecke
+ sal_uInt16 cur = Index2Block( pos ); // aktuelle Blocknr
+ sal_uInt16 nBlk1 = cur; // 1. behandelter Block
+ sal_uInt16 nBlk1del = USHRT_MAX; // 1. entfernter Block
+ BlockInfo* p = ppInf[ cur ];
+ pos -= p->nStart;
+ sal_uLong nElem = n;
+ while( nElem )
+ {
+ sal_uInt16 nel = p->nElem - sal_uInt16(pos);
+ if( sal_uLong(nel) > nElem )
+ nel = sal_uInt16(nElem);
+ // Eventuell Elemente verschieben
+ if( ( pos + nel ) < sal_uLong(p->nElem) )
+ {
+ ElementPtr *pTo = p->pData + pos,
+ *pFrom = pTo + nel;
+ int nCount = p->nElem - nel - sal_uInt16(pos);
+ while( nCount-- )
+ {
+ *pTo = *pFrom++;
+ (*pTo)->nOffset = (*pTo)->nOffset - nel;
+ ++pTo;
+ }
+ }
+ p->nEnd -= nel;
+ p->nElem = p->nElem - nel;
+ if( !p->nElem )
+ {
+ // eventuell Block ganz entfernen
+ delete[] p->pData;
+ nBlkdel++;
+ if( USHRT_MAX == nBlk1del )
+ nBlk1del = cur;
+ }
+ nElem -= nel;
+ if( !nElem )
+ break;
+ p = ppInf[ ++cur ];
+ pos = 0;
+ }
+ // Am Ende die Tabelle updaten, falls Bloecke geloescht waren
+ if( nBlkdel )
+ {
+ // loeschen sollte man immer !!
+ for( sal_uInt16 i = nBlk1del; i < ( nBlk1del + nBlkdel ); i++ )
+ delete ppInf[ i ];
+
+ if( ( nBlk1del + nBlkdel ) < nBlock )
+ {
+ memmove( ppInf + nBlk1del, ppInf + nBlk1del + nBlkdel,
+ ( nBlock - nBlkdel - nBlk1del ) * sizeof( BlockInfo* ) );
+
+ // JP 19.07.95: nicht den ersten behandelten, sondern den davor!!
+ // UpdateIdx updatet nur alle Nachfolgende!!
+ if( !nBlk1 )
+ {
+ p = ppInf[ 0 ];
+ p->nStart = 0;
+ p->nEnd = p->nElem-1;
+ }
+ else
+ --nBlk1;
+ }
+ BlockDel( nBlkdel ); // es wurden Bloecke geloescht
+ }
+
+ nSize -= n;
+ if( nBlk1 != ( nBlock - 1 ) && nSize )
+ UpdIndex( nBlk1 );
+ nCur = nBlk1;
+
+ // wenn mehr als 50% "Luft" im Array ist, dann sollte man mal das
+ // Compress aufrufen
+ if( nBlock > ( nSize / ( MAXENTRY / 2 ) ) )
+ Compress();
+
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+}
+
+
+void BigPtrArray::Replace( sal_uLong idx, const ElementPtr& rElem)
+{
+ // weil die Funktion eben doch nicht const ist:
+ DBG_ASSERT( idx < nSize, "Set: Index aussserhalb" );
+ BigPtrArray* pThis = (BigPtrArray*) this;
+ sal_uInt16 cur = Index2Block( idx );
+ BlockInfo* p = ppInf[ cur ];
+ pThis->nCur = cur;
+ ((ElementPtr&)rElem)->nOffset = sal_uInt16(idx - p->nStart);
+ ((ElementPtr&)rElem)->pBlock = p;
+ p->pData[ idx - p->nStart ] = rElem;
+}
+
+
+// Array komprimieren
+
+sal_uInt16 BigPtrArray::Compress( short nMax )
+{
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+
+ // Es wird von vorne nach hinten ueber das InfoBlock Array iteriert.
+ // Wenn zwischen durch Block gel�scht werden, dann mussen alle
+ // nachfolgenden verschoben werden. Dazu werden die Pointer pp und qq
+ // benutzt; wobei pp das "alte" Array, qq das "neue" Array ist.
+ BlockInfo** pp = ppInf, **qq = pp;
+ BlockInfo* p;
+ BlockInfo* pLast(0); // letzter nicht voller Block
+ sal_uInt16 nLast = 0; // fehlende Elemente
+ sal_uInt16 nBlkdel = 0; // Anzahl der geloeschte Bloecke
+ sal_uInt16 nFirstChgPos = USHRT_MAX; // ab welcher Pos gab es die 1. Aenderung?
+
+ // von Fuell-Prozenten auf uebrige Eintrage umrechnen
+ nMax = MAXENTRY - (long) MAXENTRY * nMax / 100;
+
+ for( sal_uInt16 cur = 0; cur < nBlock; ++cur )
+ {
+ p = *pp++;
+ sal_uInt16 n = p->nElem;
+ // Testen, ob der noch nicht volle Block so gelassen wird
+ // dies ist der Fall, wenn der aktuelle Block gesplittet
+ // werden muesste, der noch nicht volle Block aber bereits
+ // ueber dem uebergebenen Break-Wert voll ist. In diesem
+ // Fall wird von einer weiteren Fuellung (die ja wegen dem
+ // zweifachen memmove() zeitaufwendig ist) abgesehen.
+ if( nLast && ( n > nLast ) && ( nLast < nMax ) )
+ nLast = 0;
+ if( nLast )
+ {
+ if( USHRT_MAX == nFirstChgPos )
+ nFirstChgPos = cur;
+
+ // ein nicht voller Block vorhanden: auffuellen
+ if( n > nLast )
+ n = nLast;
+
+ // Elemente uebertragen, vom akt. in den letzten
+ ElementPtr* pElem = pLast->pData + pLast->nElem;
+ ElementPtr* pFrom = p->pData;
+ for( sal_uInt16 nCount = n, nOff = pLast->nElem;
+ nCount; --nCount, ++pElem )
+ *pElem = *pFrom++,
+ (*pElem)->pBlock = pLast,
+ (*pElem)->nOffset = nOff++;
+
+ // korrigieren
+ pLast->nElem = pLast->nElem + n;
+ nLast = nLast - n;
+ p->nElem = p->nElem - n;
+
+ // Ist der aktuelle Block dadurch leer geworden?
+ if( !p->nElem )
+ {
+ // dann kann der entfernt werden
+ delete[] p->pData;
+ delete p, p = 0;
+ ++nBlkdel;
+ }
+ else
+ {
+ pElem = p->pData, pFrom = pElem + n;
+ int nCount = p->nElem;
+ while( nCount-- )
+ {
+ *pElem = *pFrom++;
+ (*pElem)->nOffset = (*pElem)->nOffset - n;
+ ++pElem;
+ }
+ }
+ }
+
+ if( p ) // die Blockinfo wurde nicht geloescht
+ {
+ *qq++ = p; // dann setze sie an die richtige neue Position
+
+ // eventuell den letzten halbvollen Block festhalten
+ if( !nLast && p->nElem < MAXENTRY )
+ {
+ pLast = p;
+ nLast = MAXENTRY - p->nElem;
+ }
+ }
+ }
+
+ // Bloecke geloescht wurden, ggfs. das BlockInfo Array verkuerzen
+ if( nBlkdel )
+ BlockDel( nBlkdel );
+
+ // Und neu durchindizieren
+ p = ppInf[ 0 ];
+ p->nEnd = p->nElem - 1;
+ UpdIndex( 0 );
+
+ if( nCur >= nFirstChgPos )
+ nCur = 0;
+
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+
+ return nFirstChgPos;
+}
+
+
diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
new file mode 100644
index 000000000000..29fc02a3f7e1
--- /dev/null
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "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>
+#endif
+#include <unotools/localedatawrapper.hxx>
+
+#ifndef _SVX_LINGU_HXX
+#include <editeng/unolingu.hxx>
+#endif
+#include <editeng/scripttypeitem.hxx>
+#include "swtypes.hxx"
+
+using namespace com::sun::star;
+
+SwBreakIt * pBreakIt = 0;
+
+void SwBreakIt::_Create(
+ const uno::Reference< lang::XMultiServiceFactory > & rxMSF)
+{
+ delete pBreakIt, pBreakIt = new SwBreakIt( rxMSF );
+}
+
+void SwBreakIt::_Delete()
+{
+ delete pBreakIt, pBreakIt = 0;
+}
+
+SwBreakIt * SwBreakIt::Get()
+{
+ return pBreakIt;
+}
+
+SwBreakIt::SwBreakIt(
+ const uno::Reference< lang::XMultiServiceFactory > & rxMSF)
+ : m_xMSF( rxMSF ),
+ m_pLocale( NULL ),
+ m_pForbidden( NULL ),
+ aLast( LANGUAGE_DONTKNOW ),
+ aForbiddenLang( LANGUAGE_DONTKNOW)
+{
+ DBG_ASSERT( m_xMSF.is(), "SwBreakIt: no MultiServiceFactory" );
+ //if ( m_xMSF.is() )
+ //{
+ // xBreak = uno::Reference< i18n::XBreakIterator >(
+ // m_xMSF->createInstance(
+ // rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ),
+ // uno::UNO_QUERY);
+
+ // xCTLDetect = uno::Reference< i18n::XScriptTypeDetector >(
+ // m_xMSF->createInstance(
+ // rtl::OUString::createFromAscii( "com.sun.star.i18n.ScriptTypeDetector" ) ),
+ // uno::UNO_QUERY);
+ // }
+}
+
+SwBreakIt::~SwBreakIt()
+{
+ delete m_pLocale;
+ delete m_pForbidden;
+}
+void SwBreakIt::createBreakIterator() const
+{
+ if ( m_xMSF.is() && !xBreak.is() )
+ xBreak.set(m_xMSF->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator"))),uno::UNO_QUERY);
+}
+void SwBreakIt::createScriptTypeDetector()
+{
+ if ( m_xMSF.is() && !xCTLDetect.is() )
+ xCTLDetect.set(m_xMSF->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.ScriptTypeDetector" ))),uno::UNO_QUERY);
+}
+void SwBreakIt::_GetLocale( const LanguageType aLang )
+{
+ aLast = aLang;
+ delete m_pLocale;
+ m_pLocale = new lang::Locale( SvxCreateLocale( aLast ) );
+}
+
+void SwBreakIt::_GetForbidden( const LanguageType aLang )
+{
+ LocaleDataWrapper aWrap( m_xMSF, GetLocale( aLang ) );
+
+ aForbiddenLang = aLang;
+ delete m_pForbidden;
+ m_pForbidden = new i18n::ForbiddenCharacters( aWrap.getForbiddenCharacters() );
+}
+
+sal_uInt16 SwBreakIt::GetRealScriptOfText( const String& rTxt,
+ xub_StrLen nPos ) const
+{
+ createBreakIterator();
+ sal_uInt16 nScript = i18n::ScriptType::WEAK;
+ if( xBreak.is() && rTxt.Len() )
+ {
+ if( nPos && nPos == rTxt.Len() )
+ --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 );
+
+ if( i18n::ScriptType::WEAK == nScript && rTxt.Len() >
+ ( nChgPos = xBreak->endOfScript( rTxt, nPos, nScript ) ) &&
+ 0 <= nChgPos )
+ nScript = xBreak->getScriptType( rTxt, nChgPos );
+ }
+ if( i18n::ScriptType::WEAK == nScript )
+ nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
+ return nScript;
+}
+
+sal_uInt16 SwBreakIt::GetAllScriptsOfText( const String& rTxt ) const
+{
+ const sal_uInt16 coAllScripts = ( SCRIPTTYPE_LATIN |
+ SCRIPTTYPE_ASIAN |
+ SCRIPTTYPE_COMPLEX );
+ createBreakIterator();
+ sal_uInt16 nRet = 0, nScript;
+ if( !xBreak.is() )
+ nRet = coAllScripts;
+ else if( rTxt.Len() )
+ {
+ for( xub_StrLen n = 0, nEnd = rTxt.Len(); n < nEnd;
+ n = static_cast<xub_StrLen>(xBreak->endOfScript( rTxt, n, nScript )) )
+ {
+ switch( nScript = xBreak->getScriptType( rTxt, n ) )
+ {
+ case i18n::ScriptType::LATIN: nRet |= SCRIPTTYPE_LATIN; break;
+ case i18n::ScriptType::ASIAN: nRet |= SCRIPTTYPE_ASIAN; break;
+ case i18n::ScriptType::COMPLEX: nRet |= SCRIPTTYPE_COMPLEX; break;
+ case i18n::ScriptType::WEAK:
+ if( !nRet )
+ nRet |= coAllScripts;
+ break;
+ }
+ if( coAllScripts == nRet )
+ break;
+ }
+ }
+ return nRet;
+}
+
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
new file mode 100644
index 000000000000..b5622c150801
--- /dev/null
+++ b/sw/source/core/bastyp/calc.cxx
@@ -0,0 +1,1826 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <cctype>
+#if defined(MACOSX)
+#include <stdlib.h>
+#endif
+#include <cstdlib>
+#include <climits>
+// #include <cmath>
+#include <cfloat>
+#include <hintids.hxx>
+#include <osl/diagnose.hxx>
+#include <rtl/math.hxx>
+#include <editeng/langitem.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/charclass.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <unotools/useroptions.hxx>
+#include <tools/datetime.hxx>
+#include <svl/zforlist.hxx>
+#include <swmodule.hxx>
+#include <doc.hxx>
+#include <viewsh.hxx>
+#include <docstat.hxx>
+#include <calc.hxx>
+#include <shellres.hxx>
+#include <dbfld.hxx>
+#include <expfld.hxx>
+#include <usrfld.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <docfld.hxx>
+#include <swunodef.hxx>
+#include <swtypes.hxx>
+
+using namespace ::com::sun::star;
+
+// tippt sich schneller
+#define RESOURCE ViewShell::GetShellRes()
+
+const sal_Char __FAR_DATA sCalc_Add[] = "add";
+const sal_Char __FAR_DATA sCalc_Sub[] = "sub";
+const sal_Char __FAR_DATA sCalc_Mul[] = "mul";
+const sal_Char __FAR_DATA sCalc_Div[] = "div";
+const sal_Char __FAR_DATA sCalc_Phd[] = "phd";
+const sal_Char __FAR_DATA sCalc_Sqrt[] = "sqrt";
+const sal_Char __FAR_DATA sCalc_Pow[] = "pow";
+const sal_Char __FAR_DATA sCalc_Or[] = "or";
+const sal_Char __FAR_DATA sCalc_Xor[] = "xor";
+const sal_Char __FAR_DATA sCalc_And[] = "and";
+const sal_Char __FAR_DATA sCalc_Not[] = "not";
+const sal_Char __FAR_DATA sCalc_Eq[] = "eq";
+const sal_Char __FAR_DATA sCalc_Neq[] = "neq";
+const sal_Char __FAR_DATA sCalc_Leq[] = "leq";
+const sal_Char __FAR_DATA sCalc_Geq[] = "geq";
+const sal_Char __FAR_DATA sCalc_L[] = "l";
+const sal_Char __FAR_DATA sCalc_G[] = "g";
+const sal_Char __FAR_DATA sCalc_Sum[] = "sum";
+const sal_Char __FAR_DATA sCalc_Mean[] = "mean";
+const sal_Char __FAR_DATA sCalc_Min[] = "min";
+const sal_Char __FAR_DATA sCalc_Max[] = "max";
+const sal_Char __FAR_DATA sCalc_Sin[] = "sin";
+const sal_Char __FAR_DATA sCalc_Cos[] = "cos";
+const sal_Char __FAR_DATA sCalc_Tan[] = "tan";
+const sal_Char __FAR_DATA sCalc_Asin[] = "asin";
+const sal_Char __FAR_DATA sCalc_Acos[] = "acos";
+const sal_Char __FAR_DATA sCalc_Atan[] = "atan";
+const sal_Char __FAR_DATA sCalc_Round[] = "round";
+const sal_Char __FAR_DATA sCalc_Date[] = "date";
+
+
+
+//!!!!! ACHTUNG - Sortierte Liste aller Operatoren !!!!!
+struct _CalcOp
+{
+ union{
+ const sal_Char* pName;
+ const String* pUName;
+ };
+ SwCalcOper eOp;
+};
+
+_CalcOp __READONLY_DATA aOpTable[] = {
+/* ACOS */ {{sCalc_Acos}, CALC_ACOS}, // Arcuscosinus
+/* ADD */ {{sCalc_Add}, CALC_PLUS}, // Addition
+/* AND */ {{sCalc_And}, CALC_AND}, // log. und
+/* ASIN */ {{sCalc_Asin}, CALC_ASIN}, // Arcussinus
+/* ATAN */ {{sCalc_Atan}, CALC_ATAN}, // Arcustangens
+/* COS */ {{sCalc_Cos}, CALC_COS}, // Cosinus
+/* DATE */ {{sCalc_Date}, CALC_DATE}, // Date
+/* DIV */ {{sCalc_Div}, CALC_DIV}, // Dividieren
+/* EQ */ {{sCalc_Eq}, CALC_EQ}, // gleich
+/* G */ {{sCalc_G}, CALC_GRE}, // groesser
+/* GEQ */ {{sCalc_Geq}, CALC_GEQ}, // groesser gleich
+/* L */ {{sCalc_L}, CALC_LES}, // kleiner
+/* LEQ */ {{sCalc_Leq}, CALC_LEQ}, // kleiner gleich
+/* MAX */ {{sCalc_Max}, CALC_MAX}, // Maximalwert
+/* MEAN */ {{sCalc_Mean}, CALC_MEAN}, // Mittelwert
+/* MIN */ {{sCalc_Min}, CALC_MIN}, // Minimalwert
+/* MUL */ {{sCalc_Mul}, CALC_MUL}, // Multiplizieren
+/* NEQ */ {{sCalc_Neq}, CALC_NEQ}, // nicht gleich
+/* NOT */ {{sCalc_Not}, CALC_NOT}, // log. nicht
+/* OR */ {{sCalc_Or}, CALC_OR}, // log. oder
+/* PHD */ {{sCalc_Phd}, CALC_PHD}, // Prozent
+/* POW */ {{sCalc_Pow}, CALC_POW}, // Potenzieren
+/* ROUND */ {{sCalc_Round}, CALC_ROUND}, // Runden
+/* SIN */ {{sCalc_Sin}, CALC_SIN}, // Sinus
+/* SQRT */ {{sCalc_Sqrt}, CALC_SQRT}, // Wurzel
+/* SUB */ {{sCalc_Sub}, CALC_MINUS}, // Subtraktion
+/* SUM */ {{sCalc_Sum}, CALC_SUM}, // Summe
+/* TAN */ {{sCalc_Tan}, CALC_TAN}, // Tangens
+/* XOR */ {{sCalc_Xor}, CALC_XOR} // log. xoder
+};
+
+double __READONLY_DATA nRoundVal[] = {
+ 5.0e+0, 0.5e+0, 0.5e-1, 0.5e-2, 0.5e-3, 0.5e-4, 0.5e-5, 0.5e-6,
+ 0.5e-7, 0.5e-8, 0.5e-9, 0.5e-10,0.5e-11,0.5e-12,0.5e-13,0.5e-14,
+ 0.5e-15,0.5e-16
+};
+
+double __READONLY_DATA nKorrVal[] = {
+ 9, 9e-1, 9e-2, 9e-3, 9e-4, 9e-5, 9e-6, 9e-7, 9e-8,
+ 9e-9, 9e-10, 9e-11, 9e-12, 9e-13, 9e-14
+};
+
+ // First character may be any alphabetic or underscore.
+const sal_Int32 coStartFlags =
+ i18n::KParseTokens::ANY_LETTER_OR_NUMBER |
+ i18n::KParseTokens::ASC_UNDERSCORE |
+ i18n::KParseTokens::IGNORE_LEADING_WS;
+
+ // Continuing characters may be any alphanumeric or underscore or dot.
+const sal_Int32 coContFlags =
+ ( coStartFlags | i18n::KParseTokens::ASC_DOT )
+ & ~i18n::KParseTokens::IGNORE_LEADING_WS;
+
+
+extern "C" {
+static int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC )
+ _Optlink
+#endif
+ OperatorCompare( const void *pFirst, const void *pSecond)
+{
+ int nRet = 0;
+ if( CALC_NAME == ((_CalcOp*)pFirst)->eOp )
+ {
+ if( CALC_NAME == ((_CalcOp*)pSecond)->eOp )
+ nRet = ((_CalcOp*)pFirst)->pUName->CompareTo(
+ *((_CalcOp*)pSecond)->pUName );
+ else
+ nRet = ((_CalcOp*)pFirst)->pUName->CompareToAscii(
+ ((_CalcOp*)pSecond)->pName );
+ }
+ else
+ {
+ if( CALC_NAME == ((_CalcOp*)pSecond)->eOp )
+ nRet = -1 * ((_CalcOp*)pSecond)->pUName->CompareToAscii(
+ ((_CalcOp*)pFirst)->pName );
+ else
+ nRet = strcmp( ((_CalcOp*)pFirst)->pName,
+ ((_CalcOp*)pSecond)->pName );
+ }
+ return nRet;
+}
+
+}// extern "C"
+
+_CalcOp* FindOperator( const String& rSrch )
+{
+ _CalcOp aSrch;
+ aSrch.pUName = &rSrch;
+ aSrch.eOp = CALC_NAME;
+
+ return (_CalcOp*)bsearch( (void*) &aSrch,
+ (void*) aOpTable,
+ sizeof( aOpTable ) / sizeof( _CalcOp ),
+ sizeof( _CalcOp ),
+ OperatorCompare );
+}
+
+
+//-----------------------------------------------------------------------------
+
+SwHash* Find( const String& rStr, SwHash** ppTable, sal_uInt16 nTblSize,
+ sal_uInt16* pPos )
+{
+ sal_uLong ii = 0;
+ for( xub_StrLen n = 0; n < rStr.Len(); ++n )
+ ii = ii << 1 ^ rStr.GetChar( n );
+ ii %= nTblSize;
+
+ if( pPos )
+ *pPos = (sal_uInt16)ii;
+
+ for( SwHash* pEntry = *(ppTable+ii); pEntry; pEntry = pEntry->pNext )
+ if( rStr == pEntry->aStr )
+ return pEntry;
+ return 0;
+}
+
+inline LanguageType GetDocAppScriptLang( SwDoc& rDoc )
+{
+ return ((SvxLanguageItem&)rDoc.GetDefault(
+ GetWhichOfScript( RES_CHRATR_LANGUAGE,
+ GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ))
+ )).GetLanguage();
+}
+
+double lcl_ConvertToDateValue( SwDoc& rDoc, sal_Int32 nDate )
+{
+ double nRet = 0;
+ SvNumberFormatter* pFormatter = rDoc.GetNumberFormatter();
+ if( pFormatter )
+ {
+ Date* pNull = pFormatter->GetNullDate();
+ Date aDate( nDate >> 24, (nDate & 0x00FF0000) >> 16, nDate & 0x0000FFFF );
+ nRet = aDate - *pNull;
+ }
+ return nRet;
+}
+
+//-----------------------------------------------------------------------------
+
+/******************************************************************************
+|*
+|* SwCalc::SwCalc( SwDoc* pD ) :
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+SwCalc::SwCalc( SwDoc& rD )
+ :
+ aErrExpr( aEmptyStr, SwSbxValue(), 0 ),
+ rDoc( rD ),
+ pLclData( m_aSysLocale.GetLocaleDataPtr() ),
+ pCharClass( &GetAppCharClass() ),
+ nListPor( 0 ),
+ eError( CALC_NOERR )
+{
+ aErrExpr.aStr.AssignAscii( "~C_ERR~" );
+ memset( VarTable, 0, sizeof(VarTable) );
+ LanguageType eLang = GetDocAppScriptLang( rDoc );
+
+ if( eLang != SvxLocaleToLanguage( pLclData->getLocale() ) ||
+ eLang != SvxLocaleToLanguage( pCharClass->getLocale() ) )
+ {
+ STAR_NMSPC::lang::Locale aLocale( SvxCreateLocale( eLang ));
+ STAR_REFERENCE( lang::XMultiServiceFactory ) xMSF(
+ ::comphelper::getProcessServiceFactory() );
+ pCharClass = new CharClass( xMSF, aLocale );
+ pLclData = new LocaleDataWrapper( xMSF, aLocale );
+ }
+
+ sCurrSym = pLclData->getCurrSymbol();
+ sCurrSym.EraseLeadingChars().EraseTrailingChars();
+ pCharClass->toLower( sCurrSym );
+
+static sal_Char __READONLY_DATA
+ sNType0[] = "false",
+ sNType1[] = "true",
+ sNType2[] = "pi",
+ sNType3[] = "e",
+ sNType4[] = "tables",
+ sNType5[] = "graf",
+ sNType6[] = "ole",
+ sNType7[] = "page",
+ sNType8[] = "para",
+ sNType9[] = "word",
+ sNType10[]= "char",
+
+ sNType11[] = "user_firstname" ,
+ sNType12[] = "user_lastname" ,
+ sNType13[] = "user_initials" ,
+ sNType14[] = "user_company" ,
+ sNType15[] = "user_street" ,
+ sNType16[] = "user_country" ,
+ sNType17[] = "user_zipcode" ,
+ sNType18[] = "user_city" ,
+ sNType19[] = "user_title" ,
+ sNType20[] = "user_position" ,
+ sNType21[] = "user_tel_work" ,
+ sNType22[] = "user_tel_home" ,
+ sNType23[] = "user_fax" ,
+ sNType24[] = "user_email" ,
+ sNType25[] = "user_state" ,
+ sNType26[] = "graph"
+ ;
+
+static const sal_Char* __READONLY_DATA sNTypeTab[ 27 ] =
+{
+ sNType0, sNType1, sNType2, sNType3, sNType4, sNType5,
+ sNType6, sNType7, sNType8, sNType9, sNType10, sNType11,
+ sNType12, sNType13, sNType14, sNType15, sNType16, sNType17,
+ sNType18, sNType19, sNType20, sNType21, sNType22, sNType23,
+ sNType24,
+
+ // diese sind mit doppelten HashIds
+ sNType25, sNType26
+};
+static sal_uInt16 __READONLY_DATA aHashValue[ 27 ] =
+{
+ 34, 38, 43, 7, 18, 32, 22, 29, 30, 33, 3,
+ 28, 24, 40, 9, 11, 26, 45, 4, 23, 36, 44, 19, 5, 1,
+ // diese sind mit doppelten HashIds
+ 11, 38
+};
+static sal_uInt16 __READONLY_DATA aAdrToken[ 12 ] =
+{
+ USER_OPT_COMPANY, USER_OPT_STREET, USER_OPT_COUNTRY, USER_OPT_ZIP,
+ USER_OPT_CITY, USER_OPT_TITLE, USER_OPT_POSITION, USER_OPT_TELEPHONEWORK,
+ USER_OPT_TELEPHONEHOME, USER_OPT_FAX, USER_OPT_EMAIL, USER_OPT_STATE
+};
+
+static sal_uInt16 SwDocStat::* __READONLY_DATA aDocStat1[ 3 ] =
+{
+ &SwDocStat::nTbl, &SwDocStat::nGrf, &SwDocStat::nOLE
+};
+static sal_uLong SwDocStat::* __READONLY_DATA aDocStat2[ 4 ] =
+{
+ &SwDocStat::nPage, &SwDocStat::nPara,
+ &SwDocStat::nWord, &SwDocStat::nChar
+};
+
+#if TBLSZ != 47
+#error Alle Hashwerte angepasst?
+#endif
+
+ const SwDocStat& rDocStat = rDoc.GetDocStat();
+
+ SwSbxValue nVal;
+ String sTmpStr;
+ sal_uInt16 n;
+
+ for( n = 0; n < 25; ++n )
+ {
+ sTmpStr.AssignAscii( sNTypeTab[ n ] );
+ VarTable[ aHashValue[ n ] ] = new SwCalcExp( sTmpStr, nVal, 0 );
+ }
+
+ ((SwCalcExp*)VarTable[ aHashValue[ 0 ] ])->nValue.PutBool( sal_False );
+ ((SwCalcExp*)VarTable[ aHashValue[ 1 ] ])->nValue.PutBool( sal_True );
+ ((SwCalcExp*)VarTable[ aHashValue[ 2 ] ])->nValue.PutDouble( F_PI );
+ ((SwCalcExp*)VarTable[ aHashValue[ 3 ] ])->nValue.PutDouble( 2.7182818284590452354 );
+
+ for( n = 0; n < 3; ++n )
+ ((SwCalcExp*)VarTable[ aHashValue[ n + 4 ] ])->nValue.PutLong( rDocStat.*aDocStat1[ n ] );
+ for( n = 0; n < 4; ++n )
+ ((SwCalcExp*)VarTable[ aHashValue[ n + 7 ] ])->nValue.PutLong( rDocStat.*aDocStat2[ n ] );
+
+ SvtUserOptions& rUserOptions = SW_MOD()->GetUserOptions();
+
+ ((SwCalcExp*)VarTable[ aHashValue[ 11 ] ])->nValue.PutString( (String)rUserOptions.GetFirstName() );
+ ((SwCalcExp*)VarTable[ aHashValue[ 12 ] ])->nValue.PutString( (String)rUserOptions.GetLastName() );
+ ((SwCalcExp*)VarTable[ aHashValue[ 13 ] ])->nValue.PutString( (String)rUserOptions.GetID() );
+
+ for( n = 0; n < 11; ++n )
+ ((SwCalcExp*)VarTable[ aHashValue[ n + 14 ] ])->nValue.PutString(
+ (String)rUserOptions.GetToken( aAdrToken[ n ] ));
+
+ nVal.PutString( (String)rUserOptions.GetToken( aAdrToken[ 11 ] ));
+ sTmpStr.AssignAscii( sNTypeTab[ 25 ] );
+ VarTable[ aHashValue[ 25 ] ]->pNext = new SwCalcExp( sTmpStr, nVal, 0 );
+
+// at time its better not to use "graph", because then the im-/export have
+// to change in all formulas this name.
+// nVal.PutLong( rDocStat.*aDocStat1[ 1 ] );
+// VarTable[ aHashValue[ 26 ] ]->pNext = new SwCalcExp(
+// sNTypeTab[ 26 ], nVal, 0 );
+}
+
+/******************************************************************************
+|*
+|* SwCalc::~SwCalc()
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung OK 12-02-93 11:04am
+|*
+|******************************************************************************/
+
+SwCalc::~SwCalc()
+{
+ for( sal_uInt16 n = 0; n < TBLSZ; ++n )
+ delete VarTable[n];
+ if( pLclData != m_aSysLocale.GetLocaleDataPtr() )
+ delete pLclData;
+ if( pCharClass != &GetAppCharClass() )
+ delete pCharClass;
+}
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Calculate( const String& rStr )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung OK 12-02-93 11:04am
+|*
+|******************************************************************************/
+
+SwSbxValue SwCalc::Calculate( const String& rStr )
+{
+ eError = CALC_NOERR;
+ SwSbxValue nResult;
+
+ if( !rStr.Len() )
+ return nResult;
+
+ nListPor = 0;
+ eCurrListOper = CALC_PLUS; // defaulten auf Summe
+
+ sCommand = rStr;
+ nCommandPos = 0;
+
+ while( (eCurrOper = GetToken()) != CALC_ENDCALC && eError == CALC_NOERR )
+ nResult = Expr();
+
+ if( eError )
+ nResult.PutDouble( DBL_MAX );
+
+ return nResult;
+}
+
+/******************************************************************************
+|*
+|* String SwCalc::GetStrResult( SwSbxValue nValue, sal_Bool bRound = sal_True )
+|* Beschreibung Der Parameter bRound ist auf sal_True defaultet und darf
+|* nur beim errechnen von Tabellenzellen auf sal_False gesetzt
+|* werden, damit keine Rundungsfehler beim zusammenstellen
+|* der Formel entstehen.
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 19.02.98
+|*
+|******************************************************************************/
+
+String SwCalc::GetStrResult( const SwSbxValue& rVal, sal_Bool bRound )
+{
+ if( !rVal.IsDouble() )
+ return rVal.GetString();
+
+ return GetStrResult( rVal.GetDouble(), bRound );
+}
+
+
+String SwCalc::GetStrResult( double nValue, sal_Bool )
+{
+ if( nValue >= DBL_MAX )
+ switch( eError )
+ {
+ case CALC_SYNTAX : return RESOURCE->aCalc_Syntax;
+ case CALC_ZERODIV : return RESOURCE->aCalc_ZeroDiv;
+ case CALC_BRACK : return RESOURCE->aCalc_Brack;
+ case CALC_POWERR : return RESOURCE->aCalc_Pow;
+ case CALC_VARNFND : return RESOURCE->aCalc_VarNFnd;
+ case CALC_OVERFLOW : return RESOURCE->aCalc_Overflow;
+ case CALC_WRONGTIME : return RESOURCE->aCalc_WrongTime;
+ default : return RESOURCE->aCalc_Default;
+ }
+
+ sal_uInt16 nDec = 15; //pLclData->getNumDigits();
+ String aRetStr( ::rtl::math::doubleToUString( nValue,
+ rtl_math_StringFormat_Automatic,
+ nDec,
+ pLclData->getNumDecimalSep().GetChar(0),
+ true ));
+
+ return aRetStr;
+}
+
+/******************************************************************************
+|*
+|* SwCalcExp* SwCalc::VarLook( const String& )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 15.11.99
+|*
+|******************************************************************************/
+
+SwCalcExp* SwCalc::VarInsert( const String &rStr )
+{
+ String aStr( rStr );
+ pCharClass->toLower( aStr );
+ return VarLook( aStr, 1 );
+}
+
+/******************************************************************************
+|*
+|* SwCalcExp* SwCalc::VarLook( const String& , sal_uInt16 ins )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 15.11.99
+|*
+|******************************************************************************/
+SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins )
+{
+ aErrExpr.nValue.SetVoidValue(false);
+
+ sal_uInt16 ii = 0;
+ String aStr( rStr );
+ pCharClass->toLower( aStr );
+
+ SwHash* pFnd = Find( aStr, VarTable, TBLSZ, &ii );
+
+ if( !pFnd )
+ {
+ // dann sehen wir mal im Doc nach:
+ SwHash** ppDocTbl = rDoc.GetUpdtFlds().GetFldTypeTable();
+ for( SwHash* pEntry = *(ppDocTbl+ii); pEntry; pEntry = pEntry->pNext )
+ if( aStr == pEntry->aStr )
+ {
+ // dann hier zufuegen
+ pFnd = new SwCalcExp( aStr, SwSbxValue(),
+ ((SwCalcFldType*)pEntry)->pFldType );
+ pFnd->pNext = *(VarTable+ii);
+ *(VarTable+ii) = pFnd;
+ break;
+ }
+ }
+
+ if( pFnd )
+ {
+ SwCalcExp* pFndExp = (SwCalcExp*)pFnd;
+
+ if( pFndExp->pFldType && pFndExp->pFldType->Which() == RES_USERFLD )
+ {
+ SwUserFieldType* pUFld = (SwUserFieldType*)pFndExp->pFldType;
+ if( nsSwGetSetExpType::GSE_STRING & pUFld->GetType() )
+ pFndExp->nValue.PutString( pUFld->GetContent() );
+ else if( !pUFld->IsValid() )
+ {
+ // Die aktuellen Werte sichern . . .
+ sal_uInt16 nOld_ListPor = nListPor;
+ SwSbxValue nOld_LastLeft = nLastLeft;
+ SwSbxValue nOld_NumberValue = nNumberValue;
+ xub_StrLen nOld_CommandPos = nCommandPos;
+ SwCalcOper eOld_CurrOper = eCurrOper;
+ SwCalcOper eOld_CurrListOper = eCurrListOper;
+
+ pFndExp->nValue.PutDouble( pUFld->GetValue( *this ) );
+
+ // . . . und zurueck damit.
+ nListPor = nOld_ListPor;
+ nLastLeft = nOld_LastLeft;
+ nNumberValue = nOld_NumberValue;
+ nCommandPos = nOld_CommandPos;
+ eCurrOper = eOld_CurrOper;
+ eCurrListOper = eOld_CurrListOper;
+ }
+ else
+ pFndExp->nValue.PutDouble( pUFld->GetValue() );
+ }
+ return pFndExp;
+ }
+
+ // Name(p)=Adress.PLZ oder Adress.DATENSATZNUMMER
+ // DBSETNUMBERFLD = DatenSATZ-nummernfeld (NICHT "setze Datensatznummer!!!")
+ // #101436#: At this point the "real" case variable has to be used
+ String sTmpName( rStr );
+ ::ReplacePoint( sTmpName );
+
+ if( !ins )
+ {
+ SwNewDBMgr *pMgr = rDoc.GetNewDBMgr();
+
+ // Name(p)=Adress.PLZ oder Adress.DATENSATZNUMMER
+ // DBSETNUMBERFLD = DatenSATZ-nummernfeld (NICHT "setze Datensatznummer!!!")
+ String sDBName(GetDBName( sTmpName ));
+ String sSourceName(sDBName.GetToken(0, DB_DELIM));
+ String sTableName(sDBName.GetToken(0).GetToken(1, DB_DELIM));
+ if( pMgr && sSourceName.Len() && sTableName.Len() &&
+ pMgr->OpenDataSource(sSourceName, sTableName, -1, false))
+ {
+ String sColumnName( GetColumnName( sTmpName ));
+ ASSERT (sColumnName.Len(), "DB-Spaltenname fehlt!");
+
+ String sDBNum( SwFieldType::GetTypeStr(TYP_DBSETNUMBERFLD) );
+ pCharClass->toLower(sDBNum);
+
+ // Hier nochmal initialisieren, da das nicht mehr in docfld
+ // fuer Felder != RES_DBFLD geschieht. Z.B. wenn ein Expressionfield
+ // vor einem DB_Field in einem Dok vorkommt.
+ VarChange( sDBNum, pMgr->GetSelectedRecordId(sSourceName, sTableName));
+
+ if( sDBNum.EqualsIgnoreCaseAscii(sColumnName) )
+ {
+ aErrExpr.nValue.PutLong(long(pMgr->GetSelectedRecordId(sSourceName, sTableName)));
+ return &aErrExpr;
+ }
+
+ sal_uLong nTmpRec = 0;
+ if( 0 != ( pFnd = Find( sDBNum, VarTable, TBLSZ ) ) )
+ nTmpRec = ((SwCalcExp*)pFnd)->nValue.GetULong();
+
+ String sResult;
+ double nNumber = DBL_MAX;
+
+ long nLang = SvxLocaleToLanguage( pLclData->getLocale() );
+ if(pMgr->GetColumnCnt( sSourceName, sTableName, sColumnName,
+ nTmpRec, nLang, sResult, &nNumber ))
+ {
+ if (nNumber != DBL_MAX)
+ aErrExpr.nValue.PutDouble( nNumber );
+ else
+ aErrExpr.nValue.PutString( sResult );
+
+ return &aErrExpr;
+ }
+ }
+ else
+ {
+ //data source was not available - set return to "NoValue"
+ aErrExpr.nValue.SetVoidValue(true);
+ }
+ // auf keinen fall eintragen!!
+ return &aErrExpr;
+ }
+
+
+ SwCalcExp* pNewExp = new SwCalcExp( aStr, SwSbxValue(), 0 );
+ pNewExp->pNext = VarTable[ ii ];
+ VarTable[ ii ] = pNewExp;
+
+ String sColumnName( GetColumnName( sTmpName ));
+ ASSERT( sColumnName.Len(), "DB-Spaltenname fehlt!" );
+ if( sColumnName.EqualsIgnoreCaseAscii(
+ SwFieldType::GetTypeStr( TYP_DBSETNUMBERFLD ) ))
+ {
+ SwNewDBMgr *pMgr = rDoc.GetNewDBMgr();
+ String sDBName(GetDBName( sTmpName ));
+ String sSourceName(sDBName.GetToken(0, DB_DELIM));
+ String sTableName(sDBName.GetToken(0).GetToken(1, DB_DELIM));
+ if( pMgr && sSourceName.Len() && sTableName.Len() &&
+ pMgr->OpenDataSource(sSourceName, sTableName, -1, false) &&
+ !pMgr->IsInMerge())
+ pNewExp->nValue.PutULong( pMgr->GetSelectedRecordId(sSourceName, sTableName));
+ else
+ pNewExp->nValue.SetVoidValue(true);
+ }
+
+ return pNewExp;
+}
+
+/******************************************************************************
+|*
+|* sal_Bool SwCalc::VarChange( const String& rStr, const SwSbxValue nValue )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung OK 12-02-93 11:04am
+|*
+|******************************************************************************/
+
+void SwCalc::VarChange( const String& rStr, double nValue )
+{
+ SwSbxValue aVal( nValue );
+ VarChange( rStr, aVal );
+}
+
+void SwCalc::VarChange( const String& rStr, const SwSbxValue& rValue )
+{
+ String aStr( rStr );
+ pCharClass->toLower( aStr );
+
+ sal_uInt16 nPos = 0;
+ SwCalcExp* pFnd = (SwCalcExp*)Find( aStr, VarTable, TBLSZ, &nPos );
+
+ if( !pFnd )
+ {
+ pFnd = new SwCalcExp( aStr, SwSbxValue( rValue ), 0 );
+ pFnd->pNext = VarTable[ nPos ];
+ VarTable[ nPos ] = pFnd;
+ }
+ else
+ pFnd->nValue = rValue;
+}
+
+/******************************************************************************
+|*
+|* sal_Bool SwCalc::Push( const void* pPtr )
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung OK 12-02-93 11:05am
+|*
+|******************************************************************************/
+
+sal_Bool SwCalc::Push( const VoidPtr pPtr )
+{
+ if( USHRT_MAX != aRekurStk.GetPos( pPtr ) )
+ return sal_False;
+
+ aRekurStk.Insert( pPtr, aRekurStk.Count() );
+ return sal_True;
+}
+
+/******************************************************************************
+|*
+|* void SwCalc::Pop( const void* pPtr )
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung OK 12-02-93 11:05am
+|*
+|******************************************************************************/
+
+void SwCalc::Pop( const VoidPtr )
+{
+ ASSERT( aRekurStk.Count(), "SwCalc: Pop auf ungueltigen Ptr" );
+
+ aRekurStk.Remove( aRekurStk.Count() - 1 );
+}
+
+
+/******************************************************************************
+|*
+|* SwCalcOper SwCalc::GetToken()
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+SwCalcOper SwCalc::GetToken()
+{
+#if OSL_DEBUG_LEVEL > 1
+//JP 25.01.2001: static for switch back to the "old" implementation of the
+// calculator, which don't use the I18N routines.
+static int nUseOld = 0;
+if( !nUseOld )
+{
+#endif
+
+ if( nCommandPos >= sCommand.Len() )
+ return eCurrOper = CALC_ENDCALC;
+
+ using namespace ::com::sun::star::i18n;
+ {
+ // Parse any token.
+ ParseResult aRes = pCharClass->parseAnyToken( sCommand, nCommandPos,
+ coStartFlags, aEmptyStr,
+ coContFlags, aEmptyStr );
+
+ sal_Bool bSetError = sal_True;
+ xub_StrLen nRealStt = nCommandPos + (xub_StrLen)aRes.LeadingWhiteSpace;
+ if( aRes.TokenType & (KParseType::ASC_NUMBER | KParseType::UNI_NUMBER) )
+ {
+ nNumberValue.PutDouble( aRes.Value );
+ eCurrOper = CALC_NUMBER;
+ bSetError = sal_False;
+ }
+ else if( aRes.TokenType & KParseType::IDENTNAME )
+ {
+ String aName( sCommand.Copy( nRealStt, static_cast<xub_StrLen>(aRes.EndPos) - nRealStt ));
+ //#101436#: the variable may contain a database name it must not be converted to lower case
+ // instead all further comparisons must be done case-insensitive
+ //pCharClass->toLower( aName );
+ String sLowerCaseName(aName);
+ pCharClass->toLower( sLowerCaseName );
+ // Currency-Symbol abfangen
+ if( sLowerCaseName == sCurrSym )
+ {
+ nCommandPos = (xub_StrLen)aRes.EndPos;
+ return GetToken(); // also nochmal aufrufen
+ }
+
+ // Operations abfangen
+ _CalcOp* pFnd = ::FindOperator( sLowerCaseName );
+ if( pFnd )
+ {
+ switch( ( eCurrOper = ((_CalcOp*)pFnd)->eOp ) )
+ {
+ case CALC_SUM:
+ case CALC_MEAN:
+ eCurrListOper = CALC_PLUS;
+ break;
+ case CALC_MIN:
+ eCurrListOper = CALC_MIN_IN;
+ break;
+ case CALC_MAX:
+ eCurrListOper = CALC_MAX_IN;
+ break;
+ case CALC_DATE:
+ eCurrListOper = CALC_MONTH;
+ break;
+ default:
+ break;
+ }
+ nCommandPos = (xub_StrLen)aRes.EndPos;
+ return eCurrOper;
+ }
+ aVarName = aName;
+ eCurrOper = CALC_NAME;
+ bSetError = sal_False;
+ }
+ else if ( aRes.TokenType & KParseType::DOUBLE_QUOTE_STRING )
+ {
+ nNumberValue.PutString( String( aRes.DequotedNameOrString ));
+ eCurrOper = CALC_NUMBER;
+ bSetError = sal_False;
+ }
+ else if( aRes.TokenType & KParseType::ONE_SINGLE_CHAR )
+ {
+ String aName( sCommand.Copy( nRealStt, static_cast<xub_StrLen>(aRes.EndPos) - nRealStt ));
+ if( 1 == aName.Len() )
+ {
+ bSetError = sal_False;
+ sal_Unicode ch = aName.GetChar( 0 );
+ switch( ch )
+ {
+ case ';': if( CALC_MONTH == eCurrListOper ||
+ CALC_DAY == eCurrListOper )
+ {
+ eCurrOper = eCurrListOper;
+ break;
+ }
+ case '\n':
+ eCurrOper = CALC_PRINT;
+ break;
+ case '%':
+ case '^':
+ case '*':
+ case '/':
+ case '+':
+ case '-':
+ case '(':
+ case ')': eCurrOper = SwCalcOper(ch);
+ break;
+
+ case '=':
+ case '!':
+ {
+ SwCalcOper eTmp2;
+ if( '=' == ch )
+ eCurrOper = SwCalcOper('='), eTmp2 = CALC_EQ;
+ else
+ eCurrOper = CALC_NOT, eTmp2 = CALC_NEQ;
+
+ if( aRes.EndPos < sCommand.Len() &&
+ '=' == sCommand.GetChar( (xub_StrLen)aRes.EndPos ) )
+ {
+ eCurrOper = eTmp2;
+ ++aRes.EndPos;
+ }
+ }
+ break;
+
+ case cListDelim :
+ eCurrOper = eCurrListOper;
+ break;
+
+ case '[':
+ if( aRes.EndPos < sCommand.Len() )
+ {
+ aVarName.Erase();
+ xub_StrLen nFndPos = (xub_StrLen)aRes.EndPos,
+ nSttPos = nFndPos;
+
+ do{
+ if( STRING_NOTFOUND != ( nFndPos =
+ sCommand.Search( ']', nFndPos )) )
+ {
+ // ignore the ]
+ if( '\\' == sCommand.GetChar(nFndPos-1))
+ {
+ aVarName += sCommand.Copy( nSttPos,
+ nFndPos - nSttPos - 1 );
+ nSttPos = ++nFndPos;
+ }
+ else
+ break;
+ }
+ } while( STRING_NOTFOUND != nFndPos );
+
+ if( STRING_NOTFOUND != nFndPos )
+ {
+ if( nSttPos != nFndPos )
+ aVarName += sCommand.Copy( nSttPos,
+ nFndPos - nSttPos );
+ aRes.EndPos = nFndPos + 1;
+ eCurrOper = CALC_NAME;
+ }
+ else
+ bSetError = sal_True;
+ }
+ else
+ bSetError = sal_True;
+ break;
+
+ default:
+ bSetError = sal_True;
+ break;
+ }
+ }
+ }
+ else if( aRes.TokenType & KParseType::BOOLEAN )
+ {
+ String aName( sCommand.Copy( nRealStt, static_cast<xub_StrLen>(aRes.EndPos) - nRealStt ));
+ if( aName.Len() )
+ {
+ sal_Unicode ch = aName.GetChar(0);
+
+ bSetError = sal_True;
+ if ('<' == ch || '>' == ch)
+ {
+ bSetError = sal_False;
+
+ SwCalcOper eTmp2 = ('<' == ch) ? CALC_LEQ : CALC_GEQ;
+ eCurrOper = ('<' == ch) ? CALC_LES : CALC_GRE;
+
+ if( 2 == aName.Len() && '=' == aName.GetChar(1) )
+ eCurrOper = eTmp2;
+ else if( 1 != aName.Len() )
+ bSetError = sal_True;
+ }
+ }
+ }
+ else if( nRealStt == sCommand.Len() )
+ {
+ eCurrOper = CALC_ENDCALC;
+ bSetError = sal_False;
+ }
+
+ if( bSetError )
+ {
+ eError = CALC_SYNTAX;
+ eCurrOper = CALC_PRINT;
+ }
+ nCommandPos = (xub_StrLen)aRes.EndPos;
+ };
+
+#if OSL_DEBUG_LEVEL > 1
+
+#define NextCh( s, n ) (nCommandPos < sCommand.Len() ? sCommand.GetChar( nCommandPos++ ) : 0)
+
+}
+else
+{
+ sal_Unicode ch;
+ sal_Unicode cTSep = pLclData->getNumThousandSep().GetChar(0),
+ cDSep = pLclData->getNumDecimalSep().GetChar(0);
+
+ do {
+ if( 0 == ( ch = NextCh( sCommand, nCommandPos ) ) )
+ return eCurrOper = CALC_ENDCALC;
+ } while ( ch == '\t' || ch == ' ' || ch == cTSep );
+
+ if( ch == cDSep )
+ ch = '.';
+
+ switch( ch )
+ {
+ case ';': if( CALC_MONTH == eCurrListOper || CALC_DAY == eCurrListOper )
+ {
+ eCurrOper = eCurrListOper;
+ break;
+ } // else .. no break
+ case '\n':
+ {
+ sal_Unicode c;
+ while( nCommandPos < sCommand.Len() && ( ( c =
+ sCommand.GetChar( nCommandPos ) ) == ' ' ||
+ c == '\t' || c == '\x0a' || c == '\x0d' ))
+ ++nCommandPos;
+ eCurrOper = CALC_PRINT;
+ }
+ break;
+ case '%':
+ case '^':
+ case '*':
+ case '/':
+ case '+':
+ case '-':
+ case '(':
+ case ')': eCurrOper = SwCalcOper(ch);
+ break;
+
+ case '=': if( '=' == sCommand.GetChar( nCommandPos ) )
+ {
+ ++nCommandPos;
+ eCurrOper = CALC_EQ;
+ }
+ else
+ eCurrOper = SwCalcOper(ch);
+ break;
+
+ case '!': if( '=' == sCommand.GetChar( nCommandPos ) )
+ {
+ ++nCommandPos;
+ eCurrOper = CALC_NEQ;
+ }
+ else
+ eCurrOper = CALC_NOT;
+ break;
+
+ case '>':
+ case '<': eCurrOper = '>' == ch ? CALC_GRE : CALC_LES;
+ if( '=' == (ch = sCommand.GetChar( nCommandPos ) ) )
+ {
+ ++nCommandPos;
+ eCurrOper = CALC_GRE == eCurrOper ? CALC_GEQ : CALC_LEQ;
+ }
+ else if( ' ' != ch )
+ {
+ eError = CALC_SYNTAX;
+ eCurrOper = CALC_PRINT;
+ }
+ break;
+
+ case cListDelim :
+ eCurrOper = eCurrListOper;
+ break;
+
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case ',':
+ case '.': {
+ double nVal;
+ --nCommandPos; // auf das 1. Zeichen zurueck
+ if( Str2Double( sCommand, nCommandPos, nVal, pLclData ))
+ {
+ nNumberValue.PutDouble( nVal );
+ eCurrOper = CALC_NUMBER;
+ }
+ else
+ {
+ // fehlerhafte Zahl
+ eError = CALC_SYNTAX;
+ eCurrOper = CALC_PRINT;
+ }
+ }
+ break;
+
+ case '[': {
+ String aStr;
+ sal_Bool bIgnore = sal_False;
+ do {
+ while( 0 != ( ch = NextCh( sCommand, nCommandPos ))
+ && ch != ']' )
+ {
+ if( !bIgnore && '\\' == ch )
+ bIgnore = sal_True;
+ else if( bIgnore )
+ bIgnore = sal_False;
+ aStr += ch;
+ }
+
+ if( !bIgnore )
+ break;
+
+ aStr.SetChar( aStr.Len() - 1, ch );
+ } while( ch );
+
+ aVarName = aStr;
+ eCurrOper = CALC_NAME;
+ }
+ break;
+
+ case '"': {
+ xub_StrLen nStt = nCommandPos;
+ while( 0 != ( ch = NextCh( sCommand, nCommandPos ) )
+ && '"' != ch )
+ ;
+
+ xub_StrLen nLen = nCommandPos - nStt;
+ if( '"' == ch )
+ --nLen;
+ nNumberValue.PutString( sCommand.Copy( nStt, nLen ));
+ eCurrOper = CALC_NUMBER;
+ }
+ break;
+
+ default: if( ch && pCharClass->isLetter( sCommand, nCommandPos - 1)
+ || '_' == ch )
+ {
+ xub_StrLen nStt = nCommandPos-1;
+ while( 0 != (ch = NextCh( sCommand, nCommandPos )) &&
+ (pCharClass->isLetterNumeric(
+ sCommand, nCommandPos - 1) ||
+ ch == '_' || ch == '.' ) )
+ ;
+
+ if( ch )
+ --nCommandPos;
+
+ String aStr( sCommand.Copy( nStt, nCommandPos-nStt ));
+ pCharClass->toLower( aStr );
+
+
+ // Currency-Symbol abfangen
+ if( aStr == sCurrSym )
+ return GetToken(); // also nochmal aufrufen
+
+ // Operations abfangen
+ _CalcOp* pFnd = ::FindOperator( aStr );
+ if( pFnd )
+ {
+ switch( ( eCurrOper = ((_CalcOp*)pFnd)->eOp ) )
+ {
+ case CALC_SUM :
+ case CALC_MEAN : eCurrListOper = CALC_PLUS;
+ break;
+ case CALC_MIN : eCurrListOper = CALC_MIN_IN;
+ break;
+ case CALC_MAX : eCurrListOper = CALC_MAX_IN;
+ break;
+ case CALC_DATE : eCurrListOper = CALC_MONTH;
+ break;
+ default :
+ break;
+ }
+ return eCurrOper;
+ }
+ aVarName = aStr;
+ eCurrOper = CALC_NAME;
+ }
+ else
+ {
+ eError = CALC_SYNTAX;
+ eCurrOper = CALC_PRINT;
+ }
+ break;
+ }
+
+}
+#endif
+ return eCurrOper;
+}
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Term()
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung JP 16.01.96
+|*
+|******************************************************************************/
+
+SwSbxValue SwCalc::Term()
+{
+ SwSbxValue left( Prim() );
+ nLastLeft = left;
+ for(;;)
+ {
+ sal_uInt16 nSbxOper = USHRT_MAX;
+
+ switch( eCurrOper )
+ {
+// wir haben kein Bitweises verodern, oder ?
+// case CALC_AND: eSbxOper = SbxAND; break;
+// case CALC_OR: eSbxOper = SbxOR; break;
+// case CALC_XOR: eSbxOper = SbxXOR; break;
+ case CALC_AND: {
+ GetToken();
+ sal_Bool bB = Prim().GetBool();
+ left.PutBool( left.GetBool() && bB );
+ }
+ break;
+ case CALC_OR: {
+ GetToken();
+ sal_Bool bB = Prim().GetBool();
+ left.PutBool( left.GetBool() || bB );
+ }
+ break;
+ case CALC_XOR: {
+ GetToken();
+ sal_Bool bR = Prim().GetBool();
+ sal_Bool bL = left.GetBool();
+ left.PutBool( (bL && !bR) || (!bL && bR) );
+ }
+ break;
+
+ case CALC_EQ: nSbxOper = SbxEQ; break;
+ case CALC_NEQ: nSbxOper = SbxNE; break;
+ case CALC_LEQ: nSbxOper = SbxLE; break;
+ case CALC_GEQ: nSbxOper = SbxGE; break;
+ case CALC_GRE: nSbxOper = SbxGT; break;
+ case CALC_LES: nSbxOper = SbxLT; break;
+
+ case CALC_MUL: nSbxOper = SbxMUL; break;
+ case CALC_DIV: nSbxOper = SbxDIV; break;
+
+ case CALC_MIN_IN:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+ left = left.GetDouble() < e.GetDouble()
+ ? left : e;
+ }
+ break;
+ case CALC_MAX_IN:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+ left = left.GetDouble() > e.GetDouble()
+ ? left : e;
+ }
+ break;
+ case CALC_MONTH:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+ sal_Int32 nYear = (sal_Int32) floor( left.GetDouble() );
+ nYear = nYear & 0x0000FFFF;
+ sal_Int32 nMonth = (sal_Int32) floor( e.GetDouble() );
+ nMonth = ( nMonth & 0x000000FF ) << 16;
+ left.PutLong( nMonth + nYear );
+ eCurrOper = CALC_DAY;
+ }
+ break;
+ case CALC_DAY:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+ sal_Int32 nYearMonth = (sal_Int32) floor( left.GetDouble() );
+ nYearMonth = nYearMonth & 0x00FFFFFF;
+ sal_Int32 nDay = (sal_Int32) floor( e.GetDouble() );
+ nDay = ( nDay & 0x000000FF ) << 24;
+ left = lcl_ConvertToDateValue( rDoc, nDay + nYearMonth );
+ }
+ break;
+ case CALC_ROUND:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+
+ double fVal = 0;
+ double fFac = 1;
+ sal_Int32 nDec = (sal_Int32) floor( e.GetDouble() );
+ if( nDec < -20 || nDec > 20 )
+ {
+ eError = CALC_OVERFLOW;
+ left.Clear();
+ return left;
+ }
+ fVal = left.GetDouble();
+ sal_uInt16 i;
+ if( nDec >= 0)
+ for (i = 0; i < (sal_uInt16) nDec; ++i )
+ fFac *= 10.0;
+ else
+ for (i = 0; i < (sal_uInt16) -nDec; ++i )
+ fFac /= 10.0;
+
+ fVal *= fFac;
+
+ sal_Bool bSign;
+ if (fVal < 0.0)
+ {
+ fVal *= -1.0;
+ bSign = sal_True;
+ }
+ else
+ bSign = sal_False;
+
+ // runden
+ double fNum = fVal; // find the exponent
+ int nExp = 0;
+ if( fNum > 0 )
+ {
+ while( fNum < 1.0 ) fNum *= 10.0, --nExp;
+ while( fNum >= 10.0 ) fNum /= 10.0, ++nExp;
+ }
+ nExp = 15 - nExp;
+ if( nExp > 15 )
+ nExp = 15;
+ else if( nExp <= 1 )
+ nExp = 0;
+ fVal = floor( fVal+ 0.5 + nRoundVal[ nExp ] );
+
+ if (bSign)
+ fVal *= -1.0;
+
+ fVal /= fFac;
+
+ left.PutDouble( fVal );
+ }
+ break;
+
+/*
+// removed here because of #77448# (=2*3^2 != 18)
+ case CALC_POW: {
+ GetToken();
+ double fraction, integer;
+ double right = Prim().GetDouble(),
+ dleft = left.GetDouble();
+
+ fraction = modf( right, &integer );
+ if( ( dleft < 0.0 && 0.0 != fraction ) ||
+ ( 0.0 == dleft && right < 0.0 ) )
+ {
+ eError = CALC_OVERFLOW;
+ left.Clear();
+ return left;
+ }
+ dleft = pow(dleft, right );
+ if( dleft == HUGE_VAL )
+ {
+ eError = CALC_POWERR;
+ left.Clear();
+ return left;
+ }
+ left.PutDouble( dleft );
+ }
+ break;
+*/
+ default: return left;
+ }
+
+ if( USHRT_MAX != nSbxOper )
+ {
+ // #i47706: cast to SbxOperator AFTER comparing to USHRT_MAX
+ SbxOperator eSbxOper = (SbxOperator)nSbxOper;
+
+ GetToken();
+ if( SbxEQ <= eSbxOper && eSbxOper <= SbxGE )
+ left.PutBool( left.Compare( eSbxOper, Prim() ));
+ else
+ {
+ SwSbxValue aRight( Prim() );
+ aRight.MakeDouble();
+ left.MakeDouble();
+
+ if( SbxDIV == eSbxOper && !aRight.GetDouble() )
+ eError = CALC_ZERODIV;
+ else
+ left.Compute( eSbxOper, aRight );
+ }
+ }
+ }
+}
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Prim()
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+extern "C" typedef double (*pfCalc)( double );
+
+SwSbxValue SwCalc::Prim()
+{
+ SwSbxValue nErg;
+
+ pfCalc pFnc = 0;
+
+ sal_Bool bChkTrig = sal_False, bChkPow = sal_False;
+
+ switch( eCurrOper )
+ {
+ case CALC_SIN: pFnc = &sin; break;
+ case CALC_COS: pFnc = &cos; break;
+ case CALC_TAN: pFnc = &tan; break;
+ case CALC_ATAN: pFnc = &atan; break;
+ case CALC_ASIN: pFnc = &asin; bChkTrig = sal_True; break;
+ case CALC_ACOS: pFnc = &acos; bChkTrig = sal_True; break;
+
+ case CALC_NOT: {
+ GetToken();
+ nErg = Prim();
+ if( SbxSTRING == nErg.GetType() )
+ nErg.PutBool( 0 == nErg.GetString().Len() );
+ else if(SbxBOOL == nErg.GetType() )
+ nErg.PutBool(!nErg.GetBool());
+ // evaluate arguments manually so that the binary NOT below
+ // does not get called.
+ // We want a BOOLEAN NOT.
+ else if (nErg.IsNumeric())
+ nErg.PutLong( nErg.GetDouble() == 0.0 ? 1 : 0 );
+ else
+ {
+ DBG_ERROR( "unexpected case. computing binary NOT" );
+ //!! computes a binary NOT
+ nErg.Compute( SbxNOT, nErg );
+ }
+ }
+ break;
+
+ case CALC_NUMBER: if( GetToken() == CALC_PHD )
+ {
+ double aTmp = nNumberValue.GetDouble();
+ aTmp *= 0.01;
+ nErg.PutDouble( aTmp );
+ GetToken();
+ }
+ else if( eCurrOper == CALC_NAME )
+ eError = CALC_SYNTAX;
+ else
+ {
+ nErg = nNumberValue;
+ bChkPow = sal_True;
+ }
+ break;
+
+ case CALC_NAME: if( GetToken() == CALC_ASSIGN )
+ {
+ SwCalcExp* n = VarInsert( aVarName );
+ GetToken();
+ nErg = n->nValue = Expr();
+ }
+ else
+ {
+ nErg = VarLook( aVarName )->nValue;
+ bChkPow = sal_True;
+ }
+ break;
+
+ case CALC_MINUS: GetToken();
+ nErg.PutDouble( -(Prim().GetDouble()) );
+ break;
+
+ case CALC_LP: {
+ GetToken();
+ nErg = Expr();
+ if( eCurrOper != CALC_RP )
+ eError = CALC_BRACK;
+ else
+ {
+ GetToken();
+ bChkPow = sal_True; // in order for =(7)^2 to work
+ }
+ }
+ break;
+
+ case CALC_MEAN: {
+ nListPor = 1;
+ GetToken();
+ nErg = Expr();
+ double aTmp = nErg.GetDouble();
+ aTmp /= nListPor;
+ nErg.PutDouble( aTmp );
+ }
+ break;
+
+ case CALC_SQRT: {
+ GetToken();
+ nErg = Prim();
+ if( nErg.GetDouble() < 0 )
+ eError = CALC_OVERFLOW;
+ else
+ nErg.PutDouble( sqrt( nErg.GetDouble() ));
+ }
+ break;
+
+ case CALC_SUM:
+ case CALC_DATE:
+ case CALC_MIN:
+ case CALC_MAX: GetToken();
+ nErg = Expr();
+ break;
+
+ case CALC_ENDCALC: nErg.Clear();
+ break;
+
+ default: eError = CALC_SYNTAX;
+ break;
+ }
+
+ if( pFnc )
+ {
+ GetToken();
+ double nVal = Prim().GetDouble();
+ if( !bChkTrig || ( nVal > -1 && nVal < 1 ) )
+ nErg.PutDouble( (*pFnc)( nVal ) );
+ else
+ eError = CALC_OVERFLOW;
+ }
+
+ // added here because of #77448# (=2*3^2 should be 18)
+ if( bChkPow && eCurrOper == CALC_POW )
+ {
+ double dleft = nErg.GetDouble();
+ GetToken();
+ double right = Prim().GetDouble();
+
+ double fraction, integer;
+ fraction = modf( right, &integer );
+ if( ( dleft < 0.0 && 0.0 != fraction ) ||
+ ( 0.0 == dleft && right < 0.0 ) )
+ {
+ eError = CALC_OVERFLOW;
+ nErg.Clear();
+ }
+ else
+ {
+ dleft = pow(dleft, right );
+ if( dleft == HUGE_VAL )
+ {
+ eError = CALC_POWERR;
+ nErg.Clear();
+ }
+ else
+ {
+ nErg.PutDouble( dleft );
+// GetToken();
+ }
+ }
+ }
+
+ return nErg;
+}
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Expr()
+|*
+|* Erstellung OK 12-02-93 11:06am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+SwSbxValue SwCalc::Expr()
+{
+ SwSbxValue left = Term(), right;
+ nLastLeft = left;
+ for(;;)
+ switch(eCurrOper)
+ {
+ case CALC_PLUS: GetToken();
+ // erzeuge zum addieren auf jedenfall einen
+ // Double-Wert
+ left.MakeDouble();
+ ( right = Term() ).MakeDouble();
+ left.Compute( SbxPLUS, right );
+ nListPor++;
+ break;
+
+ case CALC_MINUS: GetToken();
+ // erzeuge zum addieren auf jedenfall einen
+ // Double-Wert
+ left.MakeDouble();
+ ( right = Term() ).MakeDouble();
+ left.Compute( SbxMINUS, right );
+ break;
+
+ default: return left;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+String SwCalc::GetColumnName(const String& rName)
+{
+ xub_StrLen nPos = rName.Search(DB_DELIM);
+ if( STRING_NOTFOUND != nPos )
+ {
+ nPos = rName.Search(DB_DELIM, nPos + 1);
+
+ if( STRING_NOTFOUND != nPos )
+ return rName.Copy(nPos + 1);
+ }
+ return rName;
+}
+
+//------------------------------------------------------------------------------
+
+String SwCalc::GetDBName(const String& rName)
+{
+ xub_StrLen nPos = rName.Search(DB_DELIM);
+ if( STRING_NOTFOUND != nPos )
+ {
+ nPos = rName.Search(DB_DELIM, nPos + 1);
+
+ if( STRING_NOTFOUND != nPos )
+ return rName.Copy( 0, nPos );
+ }
+ SwDBData aData = rDoc.GetDBData();
+ String sRet = aData.sDataSource;
+ sRet += DB_DELIM;
+ sRet += String(aData.sCommand);
+ return sRet;
+}
+
+//------------------------------------------------------------------------------
+
+namespace
+{
+
+static bool
+lcl_Str2Double( const String& rCommand, xub_StrLen& rCommandPos, double& rVal,
+ const LocaleDataWrapper* const pLclData )
+{
+ OSL_ASSERT(pLclData);
+ const xub_Unicode nCurrCmdPos = rCommandPos;
+ rtl_math_ConversionStatus eStatus;
+ const sal_Unicode* pEnd;
+ rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos,
+ rCommand.GetBuffer() + rCommand.Len(),
+ pLclData->getNumDecimalSep().GetChar(0),
+ pLclData->getNumThousandSep().GetChar(0),
+ &eStatus, &pEnd );
+ rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
+
+ return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos;
+}
+
+}
+
+/******************************************************************************
+ * Methode : sal_Bool SwCalc::Str2Double( double& )
+ * Beschreibung:
+ * Erstellt : OK 07.06.94 12:56
+ * Aenderung : JP 27.10.98
+ ******************************************************************************/
+bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+ double& rVal, const LocaleDataWrapper* const pLclData )
+{
+ const SvtSysLocale aSysLocale;
+ return lcl_Str2Double( rCommand, rCommandPos, rVal,
+ pLclData ? pLclData : aSysLocale.GetLocaleDataPtr() );
+}
+
+bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+ double& rVal, SwDoc* const pDoc )
+{
+ const SvtSysLocale aSysLocale;
+ ::std::auto_ptr<const LocaleDataWrapper> pLclD;
+ if( pDoc )
+ {
+ LanguageType eLang = GetDocAppScriptLang( *pDoc );
+ if (eLang !=
+ SvxLocaleToLanguage(aSysLocale.GetLocaleData().getLocale()))
+ {
+ pLclD.reset( new LocaleDataWrapper(
+ ::comphelper::getProcessServiceFactory(),
+ SvxCreateLocale( eLang ) ) );
+ }
+ }
+
+ bool const bRet = lcl_Str2Double( rCommand, rCommandPos, rVal,
+ (pLclD.get()) ? pLclD.get() : aSysLocale.GetLocaleDataPtr() );
+
+ return bRet;
+}
+
+//------------------------------------------------------------------------------
+
+sal_Bool SwCalc::IsValidVarName( const String& rStr,
+ String* pValidName )
+{
+ sal_Bool bRet = sal_False;
+ using namespace ::com::sun::star::i18n;
+ {
+ // Parse any token.
+ ParseResult aRes = GetAppCharClass().parseAnyToken( rStr, 0,
+ coStartFlags, aEmptyStr,
+ coContFlags, aEmptyStr );
+
+ if( aRes.TokenType & KParseType::IDENTNAME )
+ {
+ bRet = aRes.EndPos == rStr.Len();
+ if( pValidName )
+ {
+ xub_StrLen nRealStt = (xub_StrLen)aRes.LeadingWhiteSpace;
+ *pValidName = rStr.Copy( nRealStt, static_cast<xub_StrLen>(aRes.EndPos) - nRealStt );
+ }
+ }
+ else if( pValidName )
+ pValidName->Erase();
+ }
+ return bRet;
+}
+
+//------------------------------------------------------------------------------
+
+/******************************************************************************
+|*
+|* CTOR DTOR der SwHash classes
+|*
+|* Ersterstellung OK 25.06.93 12:20
+|* Letzte Aenderung OK 25.06.93 12:20
+|*
+******************************************************************************/
+
+SwHash::SwHash( const String& rStr ) :
+ aStr( rStr ),
+ pNext( 0 )
+{}
+
+SwHash::~SwHash()
+{
+ if( pNext )
+ delete pNext;
+}
+
+void DeleteHashTable( SwHash **ppHashTable, sal_uInt16 nCount )
+{
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ delete *(ppHashTable+i);
+ delete [] ppHashTable;
+}
+
+SwCalcExp::SwCalcExp( const String& rStr, const SwSbxValue& rVal,
+ const SwFieldType* pType )
+ : SwHash( rStr ),
+ nValue( rVal ),
+ pFldType( pType )
+{
+}
+
+
+SwSbxValue::~SwSbxValue()
+{
+}
+
+sal_Bool SwSbxValue::GetBool() const
+{
+ return SbxSTRING == GetType() ? 0 != GetString().Len()
+ : 0 != SbxValue::GetBool();
+}
+
+double SwSbxValue::GetDouble() const
+{
+ double nRet;
+ if( SbxSTRING == GetType() )
+ {
+ xub_StrLen nStt = 0;
+ SwCalc::Str2Double( GetString(), nStt, nRet );
+ }
+ else if (IsBool())
+ {
+ nRet = 0 != GetBool() ? 1.0 : 0.0;
+ }
+ else
+ nRet = SbxValue::GetDouble();
+ return nRet;
+}
+
+SwSbxValue& SwSbxValue::MakeDouble()
+{
+ if( SbxSTRING == GetType() )
+ PutDouble( GetDouble() );
+ return *this;
+}
+
+#ifdef STANDALONE_HASHCALC
+
+// dies ist der Beispielcode zu erzeugen der HashValues im CTOR:
+
+#include <stdio.h>
+
+void main()
+{
+static sal_Char
+ sNType0[] = "false", sNType1[] = "true", sNType2[] = "pi",
+ sNType3[] = "e", sNType4[] = "tables", sNType5[] = "graf",
+ sNType6[] = "ole", sNType7[] = "page", sNType8[] = "para",
+ sNType9[] = "word", sNType10[]= "char",
+ sNType11[] = "user_company" , sNType12[] = "user_firstname" ,
+ sNType13[] = "user_lastname" , sNType14[] = "user_initials",
+ sNType15[] = "user_street" , sNType16[] = "user_country" ,
+ sNType17[] = "user_zipcode" , sNType18[] = "user_city" ,
+ sNType19[] = "user_title" , sNType20[] = "user_position" ,
+ sNType21[] = "user_tel_home", sNType22[] = "user_tel_work",
+ sNType23[] = "user_fax" , sNType24[] = "user_email" ,
+ sNType25[] = "user_state", sNType26[] = "graph"
+ ;
+
+static const sal_Char* sNTypeTab[ 27 ] =
+{
+ sNType0, sNType1, sNType2, sNType3, sNType4, sNType5,
+ sNType6, sNType7, sNType8, sNType9, sNType10, sNType11,
+ sNType12, sNType13, sNType14, sNType15, sNType16, sNType17,
+ sNType18, sNType19, sNType20, sNType21, sNType22, sNType23,
+ sNType24, sNType25, sNType26
+};
+
+ const unsigned short nTblSize = 47;
+ int aArr[ nTblSize ] = { 0 };
+ sal_Char ch;
+
+ for( int n = 0; n < 27; ++n )
+ {
+ unsigned long ii = 0;
+ const sal_Char* pp = sNTypeTab[ n ];
+
+ while( *pp )
+ ii = ii << 1 ^ *pp++;
+ ii %= nTblSize;
+
+ ch = aArr[ ii ] ? 'X' : ' ';
+ aArr[ ii ] = 1;
+ printf( "%-20s -> %3d [%c]\n", sNTypeTab[ n ], ii, ch );
+ }
+}
+
+#endif
+
+
+
diff --git a/sw/source/core/bastyp/checkit.cxx b/sw/source/core/bastyp/checkit.cxx
new file mode 100644
index 000000000000..9e5ee1f368fd
--- /dev/null
+++ b/sw/source/core/bastyp/checkit.cxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <checkit.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::i18n;
+
+SwCheckIt::SwCheckIt()
+{
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference < XInterface > xI = xMSF->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) );
+ if ( xI.is() )
+ {
+ Any x = xI->queryInterface( ::getCppuType((const Reference< XExtendedInputSequenceChecker >*)0) );
+ x >>= xCheck;
+ }
+}
+
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
new file mode 100644
index 000000000000..d22c781169b3
--- /dev/null
+++ b/sw/source/core/bastyp/index.cxx
@@ -0,0 +1,593 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <stdlib.h> // fuer qsort
+#include <tools/solar.h>
+
+#include "errhdl.hxx" // fuers ASSERT
+#include "index.hxx"
+#include "error.h" // fuers ASSERT
+
+#ifdef DBG_UTIL
+int SwIndex::nSerial = 0;
+#endif
+
+
+TYPEINIT0(SwIndexReg); // rtti
+
+
+#ifdef CHK
+
+#define IDX_CHK_ARRAY pArray->ChhkArr();
+#define ARR_CHK_ARRAY ChhkArr();
+
+
+void SwIndexReg::ChkArr()
+{
+ ASSERT( (pFirst && pLast) || (!pFirst && !pLast),
+ "Array falsch Indiziert" );
+
+ if( !pFirst )
+ return;
+
+ xub_StrLen nVal = 0;
+ const SwIndex* pIdx = pFirst, *pPrev = 0;
+ ASSERT( !pIdx->pPrev, "Array-pFirst nicht am Anfang" );
+
+ while( pIdx != pLast )
+ {
+ ASSERT( pIdx->pPrev != pIdx && pIdx->pNext != pIdx,
+ "Index zeigt auf sich selbst" )
+
+ ASSERT( pIdx->nIndex >= nVal, "Reihenfolge stimmt nicht" );
+ ASSERT( pPrev == pIdx->pPrev, "Verkettung stimmt nicht" );
+ pPrev = pIdx;
+ pIdx = pIdx->pNext;
+ nVal = pPrev->nIndex;
+ }
+}
+
+#else // CHK
+
+#define IDX_CHK_ARRAY
+#define ARR_CHK_ARRAY
+
+#endif // CHK
+
+
+
+SwIndex::SwIndex(SwIndexReg *const pArr, xub_StrLen const nIdx)
+ : nIndex( nIdx ), pArray( pArr ), pNext( 0 ), pPrev( 0 )
+{
+ if( !pArray )
+ {
+ pArray = SwIndexReg::pEmptyIndexArray;
+ nIndex = 0; // steht immer auf 0 !!!
+ }
+
+ if( !pArray->pFirst ) // 1. Index ??
+ pArray->pFirst = pArray->pLast = this;
+ else if( nIdx > ((pArray->pLast->nIndex - pArray->pFirst->nIndex) / 2) )
+ ChgValue( *pArray->pLast, nIdx );
+ else
+ ChgValue( *pArray->pFirst, nIdx );
+
+#ifdef DBG_UTIL
+ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+#endif
+IDX_CHK_ARRAY
+}
+
+
+SwIndex::SwIndex( const SwIndex& rIdx, short nIdx )
+ : pArray( rIdx.pArray ), pNext( 0 ), pPrev( 0 )
+{
+ ChgValue( rIdx, rIdx.nIndex + nIdx );
+
+#ifdef DBG_UTIL
+ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+#endif
+IDX_CHK_ARRAY
+}
+
+
+SwIndex::SwIndex( const SwIndex& rIdx )
+ : nIndex( rIdx.nIndex ), pArray( rIdx.pArray ), pNext( 0 ), pPrev( 0 )
+{
+ ChgValue( rIdx, rIdx.nIndex );
+#ifdef DBG_UTIL
+ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+#endif
+IDX_CHK_ARRAY
+}
+
+
+SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
+{
+ SwIndex* pFnd = (SwIndex*)&rIdx;
+ if( rIdx.nIndex > nNewValue ) // nach vorne versuchen
+ {
+ SwIndex* pPrv;
+ while( 0 != ( pPrv = pFnd->pPrev ) && pPrv->nIndex > nNewValue )
+ pFnd = pPrv;
+
+ if( pFnd != this )
+ {
+ // an alter Position ausketten
+ // erstmal an alter Position ausketten
+ if( pPrev )
+ pPrev->pNext = pNext;
+ else if( pArray->pFirst == this )
+ pArray->pFirst = pNext;
+
+ if( pNext )
+ pNext->pPrev = pPrev;
+ else if( pArray->pLast == this )
+ pArray->pLast = pPrev;
+
+ pNext = pFnd;
+ pPrev = pFnd->pPrev;
+ if( pPrev )
+ pPrev->pNext = this;
+ else
+ pArray->pFirst = this;
+ pFnd->pPrev = this;
+ }
+ }
+ else if( rIdx.nIndex < nNewValue )
+ {
+ SwIndex* pNxt;
+ while( 0 != ( pNxt = pFnd->pNext ) && pNxt->nIndex < nNewValue )
+ pFnd = pNxt;
+
+ if( pFnd != this )
+ {
+ // erstmal an alter Position ausketten
+ if( pPrev )
+ pPrev->pNext = pNext;
+ else if( pArray->pFirst == this )
+ pArray->pFirst = pNext;
+
+ if( pNext )
+ pNext->pPrev = pPrev;
+ else if( pArray->pLast == this )
+ pArray->pLast = pPrev;
+
+ pPrev = pFnd;
+ pNext = pFnd->pNext;
+ if( pNext )
+ pNext->pPrev = this;
+ else
+ pArray->pLast = this;
+ pFnd->pNext = this;
+ }
+ }
+ else if( pFnd != this )
+ {
+ // erstmal an alter Position ausketten
+ if( pPrev )
+ pPrev->pNext = pNext;
+ else if( pArray->pFirst == this )
+ pArray->pFirst = pNext;
+
+ if( pNext )
+ pNext->pPrev = pPrev;
+ else if( pArray->pLast == this )
+ pArray->pLast = pPrev;
+
+ pPrev = (SwIndex*)&rIdx;
+ pNext = rIdx.pNext;
+ pPrev->pNext = this;
+
+ if( !pNext ) // im IndexArray als letzes
+ pArray->pLast = this;
+ else
+ pNext->pPrev = this;
+ }
+ pArray = rIdx.pArray;
+
+ if( pArray->pFirst == pNext )
+ pArray->pFirst = this;
+ if( pArray->pLast == pPrev )
+ pArray->pLast = this;
+
+ nIndex = nNewValue;
+
+IDX_CHK_ARRAY
+
+ return *this; }
+
+
+void SwIndex::Remove()
+{
+ if( !pPrev )
+ pArray->pFirst = pNext;
+ else
+ pPrev->pNext = pNext;
+
+ if( !pNext )
+ pArray->pLast = pPrev;
+ else
+ pNext->pPrev = pPrev;
+
+IDX_CHK_ARRAY
+}
+
+/*************************************************************************
+|*
+|* SwIndex & SwIndex::operator=( const SwIndex & aSwIndex )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+SwIndex& SwIndex::operator=( const SwIndex& rIdx )
+{
+ int bEqual;
+ if( rIdx.pArray != pArray ) // im alten abmelden !!
+ {
+ Remove();
+ pArray = rIdx.pArray;
+ pNext = pPrev = 0;
+ bEqual = sal_False;
+ }
+ else
+ bEqual = rIdx.nIndex == nIndex;
+
+ if( !bEqual )
+ ChgValue( rIdx, rIdx.nIndex );
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* SwIndex &SwIndex::Assign
+|*
+|* Beschreibung
+|* Ersterstellung VB 25.03.91
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+SwIndex& SwIndex::Assign( SwIndexReg* pArr, xub_StrLen nIdx )
+{
+ if( !pArr )
+ {
+ pArr = SwIndexReg::pEmptyIndexArray;
+ nIdx = 0; // steht immer auf 0 !!!
+ }
+
+ if( pArr != pArray ) // im alten abmelden !!
+ {
+ Remove();
+ pArray = pArr;
+ pNext = pPrev = 0;
+ if( !pArr->pFirst ) // 1. Index ??
+ {
+ pArr->pFirst = pArr->pLast = this;
+ nIndex = nIdx;
+ }
+ else if( pArr->pLast && (nIdx > ((pArr->pLast->nIndex - pArr->pFirst->nIndex) / 2)) )
+ ChgValue( *pArr->pLast, nIdx );
+ else
+ ChgValue( *pArr->pFirst, nIdx );
+ }
+ else if( nIndex != nIdx )
+ ChgValue( *this, nIdx );
+IDX_CHK_ARRAY
+ return *this;
+}
+
+
+SwIndexReg::SwIndexReg()
+ : pFirst( 0 ), pLast( 0 )
+{
+}
+
+
+
+SwIndexReg::~SwIndexReg()
+{
+ ASSERT( !pFirst || !pLast, "Es sind noch Indizies angemeldet" );
+}
+
+
+
+void SwIndexReg::Update( SwIndex const & rIdx, const xub_StrLen nDiff,
+ const bool bNeg, const bool /* argument is only used in derived class*/ )
+{
+ SwIndex* pStt = const_cast<SwIndex*>(&rIdx);
+ xub_StrLen nNewVal = rIdx.nIndex;
+ if( bNeg )
+ {
+ xub_StrLen nLast = rIdx.GetIndex() + nDiff;
+ while( pStt && pStt->nIndex == nNewVal )
+ {
+ pStt->nIndex = nNewVal;
+ pStt = pStt->pPrev;
+ }
+ pStt = rIdx.pNext;
+ while( pStt && pStt->nIndex >= nNewVal &&
+ pStt->nIndex <= nLast )
+ {
+ pStt->nIndex = nNewVal;
+ pStt = pStt->pNext;
+ }
+ while( pStt )
+ {
+ pStt->nIndex = pStt->nIndex - nDiff;
+ pStt = pStt->pNext;
+ }
+ }
+ else
+ {
+ while( pStt && pStt->nIndex == nNewVal )
+ {
+ pStt->nIndex = pStt->nIndex + nDiff;
+ pStt = pStt->pPrev;
+ }
+ pStt = rIdx.pNext;
+ while( pStt )
+ {
+ pStt->nIndex = pStt->nIndex + nDiff;
+ pStt = pStt->pNext;
+ }
+ }
+ARR_CHK_ARRAY
+}
+
+#ifdef DBG_UTIL
+#ifndef CFRONT
+
+/*************************************************************************
+|*
+|* SwIndex::operator++()
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+xub_StrLen SwIndex::operator++(int)
+{
+ ASSERT_ID( nIndex < INVALID_INDEX, ERR_OUTOFSCOPE );
+
+ xub_StrLen nOldIndex = nIndex;
+ ChgValue( *this, nIndex+1 );
+ return nOldIndex;
+}
+
+#endif
+
+xub_StrLen SwIndex::operator++()
+{
+ ASSERT_ID( nIndex < INVALID_INDEX, ERR_OUTOFSCOPE );
+
+ ChgValue( *this, nIndex+1 );
+ return nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator--()
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+#ifndef CFRONT
+
+xub_StrLen SwIndex::operator--(int)
+{
+ ASSERT_ID( nIndex, ERR_OUTOFSCOPE );
+
+ xub_StrLen nOldIndex = nIndex;
+ ChgValue( *this, nIndex-1 );
+ return nOldIndex;
+}
+
+#endif
+
+xub_StrLen SwIndex::operator--()
+{
+ ASSERT_ID( nIndex, ERR_OUTOFSCOPE );
+ return ChgValue( *this, nIndex-1 ).nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator+=( xub_StrLen )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+xub_StrLen SwIndex::operator+=( xub_StrLen nWert )
+{
+ ASSERT_ID( nIndex < INVALID_INDEX - nWert, ERR_OUTOFSCOPE);
+ return ChgValue( *this, nIndex + nWert ).nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator-=( xub_StrLen )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+xub_StrLen SwIndex::operator-=( xub_StrLen nWert )
+{
+ ASSERT_ID( nIndex >= nWert, ERR_OUTOFSCOPE );
+ return ChgValue( *this, nIndex - nWert ).nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator+=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+xub_StrLen SwIndex::operator+=( const SwIndex & rIndex )
+{
+ ASSERT_ID( nIndex < INVALID_INDEX - rIndex.nIndex, ERR_OUTOFSCOPE );
+ return ChgValue( *this, nIndex + rIndex.nIndex ).nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator-=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+xub_StrLen SwIndex::operator-=( const SwIndex & rIndex )
+{
+ ASSERT_ID( nIndex >= rIndex.nIndex, ERR_OUTOFSCOPE );
+ return ChgValue( *this, nIndex - rIndex.nIndex ).nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator<( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+sal_Bool SwIndex::operator<( const SwIndex & rIndex ) const
+{
+ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+ return nIndex < rIndex.nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator<=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 04.06.92
+|*
+*************************************************************************/
+
+sal_Bool SwIndex::operator<=( const SwIndex & rIndex ) const
+{
+ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+ return nIndex <= rIndex.nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator>( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 04.06.92
+|*
+*************************************************************************/
+
+sal_Bool SwIndex::operator>( const SwIndex & rIndex ) const
+{
+ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+ return nIndex > rIndex.nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator>=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 04.06.92
+|*
+*************************************************************************/
+
+sal_Bool SwIndex::operator>=( const SwIndex & rIndex ) const
+{
+ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+ return nIndex >= rIndex.nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex & SwIndex::operator=( xub_StrLen )
+|*
+|* Beschreibung
+|* Ersterstellung JP 10.12.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+SwIndex& SwIndex::operator=( xub_StrLen nWert )
+{
+ // Werte kopieren und im neuen Array anmelden
+ if( nIndex != nWert )
+ ChgValue( *this, nWert );
+
+ return *this;
+}
+
+#endif // ifndef PRODUCT
+
+void SwIndexReg::MoveTo( SwIndexReg& rArr )
+{
+ if( this != &rArr && pFirst )
+ {
+ SwIndex* pIdx = (SwIndex*)pFirst, *pNext;
+ while( pIdx )
+ {
+ pNext = pIdx->pNext;
+ pIdx->Assign( &rArr, pIdx->GetIndex() );
+ pIdx = pNext;
+ }
+ pFirst = 0, pLast = 0;
+ }
+}
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
new file mode 100644
index 000000000000..e150f5f0ae26
--- /dev/null
+++ b/sw/source/core/bastyp/init.cxx
@@ -0,0 +1,918 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <hintids.hxx>
+#include <tools/globname.hxx>
+#include <vcl/mapmod.hxx>
+#include <editeng/xmlcnitm.hxx>
+#include <svl/macitem.hxx>
+#include <editeng/pbinitem.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/nlbkitem.hxx>
+#include <editeng/hyznitem.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/prszitem.hxx>
+#include <editeng/opaqitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <editeng/prntitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/wrlmitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/cscoitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/orphitem.hxx>
+#include <editeng/widwitem.hxx>
+#include <editeng/nhypitem.hxx>
+#include <editeng/spltitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/blnkitem.hxx>
+#include <editeng/akrnitem.hxx>
+#include <editeng/emphitem.hxx>
+#include <editeng/twolinesitem.hxx>
+#include <editeng/scriptspaceitem.hxx>
+#include <editeng/hngpnctitem.hxx>
+#include <editeng/cmapitem.hxx>
+#include <editeng/charscaleitem.hxx>
+#include <editeng/charrotateitem.hxx>
+#include <editeng/charreliefitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include <editeng/swafopt.hxx>
+#include <editeng/svxacorr.hxx>
+#include <unotools/charclass.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/forbiddenruleitem.hxx>
+#include <editeng/paravertalignitem.hxx>
+#include <editeng/pgrditem.hxx>
+#include <editeng/charhiddenitem.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <unotools/syslocale.hxx>
+#include <com/sun/star/i18n/CollatorOptions.hpp>
+#include <unotools/transliterationwrapper.hxx>
+#include <editeng/acorrcfg.hxx>
+#include <vcl/svapp.hxx>
+#include <fmtanchr.hxx>
+#include <fmtornt.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtfsize.hxx>
+#include <fmtfld.hxx>
+#include <fmtrfmrk.hxx>
+#include <fmtlsplt.hxx>
+#include <fmtrowsplt.hxx>
+#include <fmteiro.hxx>
+#include <fmtclds.hxx>
+#include <fmturl.hxx>
+#include <fmtcntnt.hxx>
+#include <fmthdft.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtftn.hxx>
+#include <fmtfordr.hxx>
+#include <fmtflcnt.hxx>
+#include <fchrfmt.hxx>
+#include <fmtautofmt.hxx>
+#include <fmtinfmt.hxx>
+#include <fmtcnct.hxx>
+#include <fmtline.hxx>
+#include <fmtftntx.hxx>
+#include <fmtruby.hxx>
+#include <fmtautofmt.hxx>
+#include <tgrditem.hxx>
+#include <hfspacingitem.hxx>
+#include <editsh.hxx>
+#include <pam.hxx>
+#include <init.hxx>
+#include <paratr.hxx>
+#include <grfatr.hxx>
+#include <tox.hxx>
+#include <cellatr.hxx>
+#include <tblafmt.hxx>
+#include <viscrs.hxx>
+#include <fntcache.hxx>
+#include <doc.hxx>
+#include <acmplwrd.hxx>
+#include <fmtclbl.hxx>
+#include <cmdid.h>
+#include <breakit.hxx>
+#include <checkit.hxx>
+#include <swcalwrp.hxx>
+#include <SwStyleNameMapper.hxx>
+
+// OD 09.10.2003 #i18732#
+#include <fmtfollowtextflow.hxx>
+// OD 2004-05-05 #i28701#
+#include <fmtwrapinfluenceonobjpos.hxx>
+
+#include <fmtmeta.hxx>
+
+
+using namespace ::com::sun::star;
+
+extern void _FrmFinit();
+extern void ClearFEShellTabCols();
+
+/*************************************************************************
+|* einige Bereiche fuer die Set in Collections / Nodes
+|*************************************************************************/
+ // AttrSet-Range fuer die 2 Break-Attribute
+sal_uInt16 __FAR_DATA aBreakSetRange[] = {
+ RES_PAGEDESC, RES_BREAK,
+ 0 };
+
+ // AttrSet-Range fuer die TxtFmtColl
+ // OD 2008-02-27 #refactorlists# :
+ // list attributes ( RES_PARATR_LIST_BEGIN - RES_PARATR_LIST_END ) are not
+ // included in the paragraph style's itemset.
+sal_uInt16 __FAR_DATA aTxtFmtCollSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+ // AttrSet-Range fuer die GrfFmtColl
+sal_uInt16 __FAR_DATA aGrfFmtCollSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_GRFATR_BEGIN, RES_GRFATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+ // AttrSet-Range fuer die TextNode
+sal_uInt16 __FAR_DATA aTxtNodeSetRange[] = {
+ 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
+};
+
+ // AttrSet-Range fuer die NoTxtNode
+sal_uInt16 __FAR_DATA aNoTxtNodeSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_GRFATR_BEGIN, RES_GRFATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+sal_uInt16 __FAR_DATA aTableSetRange[] = {
+ RES_FILL_ORDER, RES_FRM_SIZE,
+ RES_LR_SPACE, RES_BREAK,
+ RES_BACKGROUND, RES_SHADOW,
+ RES_HORI_ORIENT, RES_HORI_ORIENT,
+ RES_KEEP, RES_KEEP,
+ RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
+ RES_FRAMEDIR, RES_FRAMEDIR,
+ // --> collapsing borders FME 2005-05-27 #i29550#
+ RES_COLLAPSING_BORDERS, RES_COLLAPSING_BORDERS,
+ // <-- collapsing
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+sal_uInt16 __FAR_DATA aTableLineSetRange[] = {
+ RES_FILL_ORDER, RES_FRM_SIZE,
+ RES_LR_SPACE, RES_UL_SPACE,
+ RES_BACKGROUND, RES_SHADOW,
+ RES_ROW_SPLIT, RES_ROW_SPLIT,
+ RES_PROTECT, RES_PROTECT,
+ RES_VERT_ORIENT, RES_VERT_ORIENT,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+sal_uInt16 __FAR_DATA aTableBoxSetRange[] = {
+ RES_FILL_ORDER, RES_FRM_SIZE,
+ RES_LR_SPACE, RES_UL_SPACE,
+ RES_BACKGROUND, RES_SHADOW,
+ RES_PROTECT, RES_PROTECT,
+ RES_VERT_ORIENT, RES_VERT_ORIENT,
+ RES_FRAMEDIR, RES_FRAMEDIR,
+ RES_BOXATR_BEGIN, RES_BOXATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+// AttrSet-Range fuer die SwFrmFmt
+sal_uInt16 __FAR_DATA aFrmFmtSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+// AttrSet-Range fuer die SwCharFmt
+sal_uInt16 __FAR_DATA aCharFmtSetRange[] = {
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+// AttrSet-Range fuer die character autostyles
+sal_uInt16 __FAR_DATA aCharAutoFmtSetRange[] = {
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+// AttrSet-Range fuer die SwPageDescFmt
+sal_uInt16 __FAR_DATA aPgFrmFmtSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+/******************************************************************************
+ * lege eine Tabelle fuer einen Zugriff auf die
+ * Default-Format-Attribute an
+ ******************************************************************************/
+SwDfltAttrTab __FAR_DATA aAttrTab;
+
+SfxItemInfo __FAR_DATA aSlotTab[] =
+{
+ { SID_ATTR_CHAR_CASEMAP, SFX_ITEM_POOLABLE }, // RES_CHRATR_CASEMAP
+ { SID_ATTR_CHAR_CHARSETCOLOR, SFX_ITEM_POOLABLE }, // RES_CHRATR_CHARSETCOLOR
+ { SID_ATTR_CHAR_COLOR, SFX_ITEM_POOLABLE }, // RES_CHRATR_COLOR
+ { SID_ATTR_CHAR_CONTOUR, SFX_ITEM_POOLABLE }, // RES_CHRATR_CONTOUR
+ { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEM_POOLABLE }, // RES_CHRATR_CROSSEDOUT
+ { SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEM_POOLABLE }, // RES_CHRATR_ESCAPEMENT
+ { SID_ATTR_CHAR_FONT, SFX_ITEM_POOLABLE }, // RES_CHRATR_FONT
+ { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEM_POOLABLE }, // RES_CHRATR_FONTSIZE
+ { SID_ATTR_CHAR_KERNING, SFX_ITEM_POOLABLE }, // RES_CHRATR_KERNING
+ { SID_ATTR_CHAR_LANGUAGE, SFX_ITEM_POOLABLE }, // RES_CHRATR_LANGUAGE
+ { SID_ATTR_CHAR_POSTURE, SFX_ITEM_POOLABLE }, // RES_CHRATR_POSTURE
+ { SID_ATTR_CHAR_PROPSIZE, SFX_ITEM_POOLABLE }, // RES_CHRATR_PROPORTIONALFONTSIZE
+ { SID_ATTR_CHAR_SHADOWED, SFX_ITEM_POOLABLE }, // RES_CHRATR_SHADOWED
+ { SID_ATTR_CHAR_UNDERLINE, SFX_ITEM_POOLABLE }, // RES_CHRATR_UNDERLINE
+ { SID_ATTR_CHAR_WEIGHT, SFX_ITEM_POOLABLE }, // RES_CHRATR_WEIGHT
+ { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEM_POOLABLE }, // RES_CHRATR_WORDLINEMODE
+ { SID_ATTR_CHAR_AUTOKERN, SFX_ITEM_POOLABLE }, // RES_CHRATR_AUTOKERN
+ { SID_ATTR_FLASH, SFX_ITEM_POOLABLE }, // RES_CHRATR_BLINK
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_NOLINEBREAK
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_NOHYPHEN
+ { SID_ATTR_BRUSH_CHAR, SFX_ITEM_POOLABLE }, // RES_CHRATR_BACKGROUND
+ { SID_ATTR_CHAR_CJK_FONT, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_FONT
+ { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEM_POOLABLE },// RES_CHRATR_CJK_FONTSIZE
+ { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_LANGUAGE
+ { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_POSTURE
+ { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_WEIGHT
+ { SID_ATTR_CHAR_CTL_FONT, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_FONT
+ { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEM_POOLABLE },// RES_CHRATR_CTL_FONTSIZE
+ { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_LANGUAGE
+ { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_POSTURE
+ { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_WEIGHT
+ { SID_ATTR_CHAR_ROTATED, SFX_ITEM_POOLABLE }, // RES_CHRATR_ROTATE
+ { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEM_POOLABLE }, // RES_CHRATR_EMPHASIS_MARK
+ { SID_ATTR_CHAR_TWO_LINES, SFX_ITEM_POOLABLE }, // RES_CHRATR_TWO_LINES
+ { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEM_POOLABLE }, // RES_CHRATR_SCALEW
+ { SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE }, // RES_CHRATR_RELIEF
+ { SID_ATTR_CHAR_HIDDEN, SFX_ITEM_POOLABLE }, // RES_CHRATR_HIDDEN
+ { SID_ATTR_CHAR_OVERLINE, SFX_ITEM_POOLABLE }, // RES_CHRATR_OVERLINE
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_DUMMY1
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_DUMMY2
+
+ { 0, 0 }, // RES_TXTATR_REFMARK
+ { 0, 0 }, // RES_TXTATR_TOXMARK
+ { 0, 0 }, // RES_TXTATR_META
+ { 0, 0 }, // RES_TXTATR_METAFIELD
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_AUTOFMT
+ { FN_TXTATR_INET, 0 }, // RES_TXTATR_INETFMT
+ { 0, 0 }, // RES_TXTATR_CHARFMT
+ { SID_ATTR_CHAR_CJK_RUBY, 0 }, // RES_TXTATR_CJK_RUBY
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_UNKNOWN_CONTAINER
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY5
+
+ { 0, 0 }, // RES_TXTATR_FIELD
+ { 0, 0 }, // RES_TXTATR_FLYCNT
+ { 0, 0 }, // RES_TXTATR_FTN
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY4
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY3
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY1
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY2
+
+ { SID_ATTR_PARA_LINESPACE, SFX_ITEM_POOLABLE }, // RES_PARATR_LINESPACING
+ { SID_ATTR_PARA_ADJUST, SFX_ITEM_POOLABLE }, // RES_PARATR_ADJUST
+ { SID_ATTR_PARA_SPLIT, SFX_ITEM_POOLABLE }, // RES_PARATR_SPLIT
+ { SID_ATTR_PARA_ORPHANS, SFX_ITEM_POOLABLE }, // RES_PARATR_ORPHANS
+ { SID_ATTR_PARA_WIDOWS, SFX_ITEM_POOLABLE }, // RES_PARATR_WIDOWS
+ { SID_ATTR_TABSTOP, SFX_ITEM_POOLABLE }, // RES_PARATR_TABSTOP
+ { SID_ATTR_PARA_HYPHENZONE, SFX_ITEM_POOLABLE }, // RES_PARATR_HYPHENZONE
+ { FN_FORMAT_DROPCAPS, 0 }, // RES_PARATR_DROP
+ { SID_ATTR_PARA_REGISTER, SFX_ITEM_POOLABLE }, // RES_PARATR_REGISTER
+ // --> OD 2008-03-04 #refactorlists#
+ // RES_PARATR_NUMRULE is now poolable
+ { SID_ATTR_PARA_NUMRULE, SFX_ITEM_POOLABLE }, // RES_PARATR_NUMRULE
+ // <--
+ { SID_ATTR_PARA_SCRIPTSPACE, SFX_ITEM_POOLABLE }, // RES_PARATR_SCRIPTSPACE
+ { SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEM_POOLABLE },// RES_PARATR_HANGINGPUNCTUATION
+
+ { SID_ATTR_PARA_FORBIDDEN_RULES, SFX_ITEM_POOLABLE },// RES_PARATR_FORBIDDEN_RULES
+ { SID_PARA_VERTALIGN, SFX_ITEM_POOLABLE }, // RES_PARATR_VERTALIGN
+ { SID_ATTR_PARA_SNAPTOGRID, SFX_ITEM_POOLABLE }, // RES_PARATR_SNAPTOGRID
+ { SID_ATTR_BORDER_CONNECT, SFX_ITEM_POOLABLE }, // RES_PARATR_CONNECT_BORDER
+
+ { SID_ATTR_PARA_OUTLINE_LEVEL, SFX_ITEM_POOLABLE }, // RES_PARATR_OUTLINELEVEL //#outline level,zhaojianwei
+
+ // --> OD 2008-02-19 #refactorlists#
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ID
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_LEVEL
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ISRESTART
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_RESTARTVALUE
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ISCOUNTED
+ // <--
+
+ { 0, SFX_ITEM_POOLABLE }, // RES_FILL_ORDER
+ { 0, SFX_ITEM_POOLABLE }, // RES_FRM_SIZE
+ { SID_ATTR_PAGE_PAPERBIN, SFX_ITEM_POOLABLE }, // RES_PAPER_BIN
+ { SID_ATTR_LRSPACE, SFX_ITEM_POOLABLE }, // RES_LR_SPACE
+ { SID_ATTR_ULSPACE, SFX_ITEM_POOLABLE }, // RES_UL_SPACE
+ { 0, 0 }, // RES_PAGEDESC
+ { SID_ATTR_PARA_PAGEBREAK, SFX_ITEM_POOLABLE }, // RES_BREAK
+ { 0, 0 }, // RES_CNTNT
+ { 0, SFX_ITEM_POOLABLE }, // RES_HEADER
+ { 0, SFX_ITEM_POOLABLE }, // RES_FOOTER
+ { 0, SFX_ITEM_POOLABLE }, // RES_PRINT
+ { FN_OPAQUE, SFX_ITEM_POOLABLE }, // RES_OPAQUE
+ { FN_SET_PROTECT, SFX_ITEM_POOLABLE }, // RES_PROTECT
+ { FN_SURROUND, SFX_ITEM_POOLABLE }, // RES_SURROUND
+ { FN_VERT_ORIENT, SFX_ITEM_POOLABLE }, // RES_VERT_ORIENT
+ { FN_HORI_ORIENT, SFX_ITEM_POOLABLE }, // RES_HORI_ORIENT
+ { 0, 0 }, // RES_ANCHOR
+ { SID_ATTR_BRUSH, SFX_ITEM_POOLABLE }, // RES_BACKGROUND
+ { SID_ATTR_BORDER_OUTER, SFX_ITEM_POOLABLE }, // RES_BOX
+ { SID_ATTR_BORDER_SHADOW, SFX_ITEM_POOLABLE }, // RES_SHADOW
+ { SID_ATTR_MACROITEM, SFX_ITEM_POOLABLE }, // RES_FRMMACRO
+ { FN_ATTR_COLUMNS, SFX_ITEM_POOLABLE }, // RES_COL
+ { SID_ATTR_PARA_KEEP, SFX_ITEM_POOLABLE }, // RES_KEEP
+ { 0, SFX_ITEM_POOLABLE }, // RES_URL
+ { 0, SFX_ITEM_POOLABLE }, // RES_EDIT_IN_READONLY
+
+ { 0, SFX_ITEM_POOLABLE }, // RES_LAYOUT_SPLIT
+ { 0, 0 }, // RES_CHAIN
+ { 0, SFX_ITEM_POOLABLE }, // RES_TEXTGRID
+ { FN_FORMAT_LINENUMBER, SFX_ITEM_POOLABLE }, // RES_LINENUMBER
+ { 0, SFX_ITEM_POOLABLE }, // RES_FTN_AT_TXTEND
+ { 0, SFX_ITEM_POOLABLE }, // RES_END_AT_TXTEND
+ { 0, SFX_ITEM_POOLABLE }, // RES_COLUMNBALANCE
+
+ { SID_ATTR_FRAMEDIRECTION, SFX_ITEM_POOLABLE }, // RES_FRAMEDIR
+
+ { SID_ATTR_HDFT_DYNAMIC_SPACING, SFX_ITEM_POOLABLE }, // RES_HEADER_FOOTER_EAT_SPACING
+ { FN_TABLE_ROW_SPLIT, SFX_ITEM_POOLABLE }, // RES_ROW_SPLIT
+ // DVO, OD 18.09.2003 #i18732# - use slot-id define in svx
+ { SID_SW_FOLLOW_TEXT_FLOW, SFX_ITEM_POOLABLE }, // RES_FOLLOW_TEXT_FLOW
+ // --> collapsing borders FME 2005-05-27 #i29550#
+ { SID_SW_COLLAPSING_BORDERS, SFX_ITEM_POOLABLE }, // RES_COLLAPSING_BORDERS
+ // <-- collapsing
+ // OD 2004-05-04 #i28701#
+ { SID_SW_WRAP_INFLUENCE_ON_OBJPOS, SFX_ITEM_POOLABLE }, // RES_WRAP_INFLUENCE_ON_OBJPOS
+ { 0, 0 }, // RES_AUTO_STYLE
+ { 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_STYLE_NAME
+ { 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_CONDITIONAL_STYLE_NAME
+
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_MIRRORGRF
+ { SID_ATTR_GRAF_CROP, SFX_ITEM_POOLABLE }, // RES_GRFATR_CROPGRF
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_ROTATION,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_LUMINANCE,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_CONTRAST,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_CHANNELR,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_CHANNELG,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_CHANNELB,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_GAMMA,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_INVERT,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_TRANSPARENCY,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY1,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY2,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY3,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY4,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY5,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY6,
+
+ { 0, SFX_ITEM_POOLABLE }, // RES_BOXATR_FORMAT
+ { 0, 0 }, // RES_BOXATR_FORMULA,
+ { 0, SFX_ITEM_POOLABLE }, // RES_BOXATR_VALUE
+
+ { 0, SFX_ITEM_POOLABLE } // RES_UNKNOWNATR_CONTAINER
+};
+
+
+sal_uInt16* SwAttrPool::pVersionMap1 = 0;
+sal_uInt16* SwAttrPool::pVersionMap2 = 0;
+sal_uInt16* SwAttrPool::pVersionMap3 = 0;
+sal_uInt16* SwAttrPool::pVersionMap4 = 0;
+// OD 2004-01-21 #i18732#
+sal_uInt16* SwAttrPool::pVersionMap5 = 0;
+sal_uInt16* SwAttrPool::pVersionMap6 = 0;
+SwIndexReg* SwIndexReg::pEmptyIndexArray = 0;
+
+const sal_Char* __FAR_DATA pMarkToTable = "table";
+const sal_Char* __FAR_DATA pMarkToFrame = "frame";
+const sal_Char* __FAR_DATA pMarkToRegion = "region";
+const sal_Char* __FAR_DATA pMarkToText = "text";
+const sal_Char* __FAR_DATA pMarkToOutline = "outline";
+const sal_Char* __FAR_DATA pMarkToGraphic = "graphic";
+const sal_Char* __FAR_DATA pMarkToOLE = "ole";
+
+SvPtrarr *pGlobalOLEExcludeList = 0;
+
+SwAutoCompleteWord* SwDoc::pACmpltWords = 0;
+
+SwCheckIt* pCheckIt = 0;
+CharClass* pAppCharClass = 0;
+
+CollatorWrapper* pCollator = 0, *pCaseCollator = 0;
+::utl::TransliterationWrapper* pTransWrp = 0;
+
+/******************************************************************************
+ * void _InitCore()
+ ******************************************************************************/
+salhelper::SingletonRef<SwCalendarWrapper>* s_getCalendarWrapper()
+{
+ static salhelper::SingletonRef<SwCalendarWrapper> aCalendarWrapper;
+ return &aCalendarWrapper;
+}
+void _InitCore()
+{
+ SfxPoolItem* pItem;
+
+ // erstmal alle Attribut-Pointer auf 0 setzen
+ memset( aAttrTab, 0, (POOLATTR_END - POOLATTR_BEGIN) *
+ sizeof( SfxPoolItem* ) );
+
+ aAttrTab[ RES_CHRATR_CASEMAP- POOLATTR_BEGIN ] = new SvxCaseMapItem( SVX_CASEMAP_NOT_MAPPED, RES_CHRATR_CASEMAP);
+ aAttrTab[ RES_CHRATR_CHARSETCOLOR- POOLATTR_BEGIN ] = new SvxCharSetColorItem(RES_CHRATR_CHARSETCOLOR);
+ aAttrTab[ RES_CHRATR_COLOR- POOLATTR_BEGIN ] = new SvxColorItem(RES_CHRATR_COLOR);
+ aAttrTab[ RES_CHRATR_CONTOUR- POOLATTR_BEGIN ] = new SvxContourItem( sal_False, RES_CHRATR_CONTOUR );
+ aAttrTab[ RES_CHRATR_CROSSEDOUT- POOLATTR_BEGIN ] = new SvxCrossedOutItem( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT );
+ aAttrTab[ RES_CHRATR_ESCAPEMENT- POOLATTR_BEGIN ] = new SvxEscapementItem( RES_CHRATR_ESCAPEMENT );
+ aAttrTab[ RES_CHRATR_FONT- POOLATTR_BEGIN ] = new SvxFontItem( RES_CHRATR_FONT );
+
+ aAttrTab[ RES_CHRATR_FONTSIZE- POOLATTR_BEGIN ] = new SvxFontHeightItem( 240, 100, RES_CHRATR_FONTSIZE );
+ aAttrTab[ RES_CHRATR_KERNING- POOLATTR_BEGIN ] = new SvxKerningItem( 0, RES_CHRATR_KERNING );
+ aAttrTab[ RES_CHRATR_LANGUAGE- POOLATTR_BEGIN ] = new SvxLanguageItem(LANGUAGE_DONTKNOW, RES_CHRATR_LANGUAGE );
+ aAttrTab[ RES_CHRATR_POSTURE- POOLATTR_BEGIN ] = new SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE );
+ aAttrTab[ RES_CHRATR_PROPORTIONALFONTSIZE- POOLATTR_BEGIN ] = new SvxPropSizeItem( 100, RES_CHRATR_PROPORTIONALFONTSIZE );
+ aAttrTab[ RES_CHRATR_SHADOWED- POOLATTR_BEGIN ] = new SvxShadowedItem( sal_False, RES_CHRATR_SHADOWED );
+ aAttrTab[ RES_CHRATR_UNDERLINE- POOLATTR_BEGIN ] = new SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE );
+ aAttrTab[ RES_CHRATR_WEIGHT- POOLATTR_BEGIN ] = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_WEIGHT );
+ aAttrTab[ RES_CHRATR_WORDLINEMODE- POOLATTR_BEGIN ] = new SvxWordLineModeItem( sal_False, RES_CHRATR_WORDLINEMODE );
+ aAttrTab[ RES_CHRATR_AUTOKERN- POOLATTR_BEGIN ] = new SvxAutoKernItem( sal_False, RES_CHRATR_AUTOKERN );
+ aAttrTab[ RES_CHRATR_BLINK - POOLATTR_BEGIN ] = new SvxBlinkItem( sal_False, RES_CHRATR_BLINK );
+ aAttrTab[ RES_CHRATR_NOHYPHEN - POOLATTR_BEGIN ] = new SvxNoHyphenItem( sal_True, RES_CHRATR_NOHYPHEN );
+ aAttrTab[ RES_CHRATR_NOLINEBREAK- POOLATTR_BEGIN ] = new SvxNoLinebreakItem( sal_True, RES_CHRATR_NOLINEBREAK );
+ aAttrTab[ RES_CHRATR_BACKGROUND - POOLATTR_BEGIN ] = new SvxBrushItem( RES_CHRATR_BACKGROUND );
+
+ // CJK-Attributes
+ aAttrTab[ RES_CHRATR_CJK_FONT - POOLATTR_BEGIN ] = new SvxFontItem( RES_CHRATR_CJK_FONT );
+ aAttrTab[ RES_CHRATR_CJK_FONTSIZE - POOLATTR_BEGIN ] = new SvxFontHeightItem( 240, 100, RES_CHRATR_CJK_FONTSIZE );
+ aAttrTab[ RES_CHRATR_CJK_LANGUAGE - POOLATTR_BEGIN ] = new SvxLanguageItem(LANGUAGE_DONTKNOW, RES_CHRATR_CJK_LANGUAGE);
+ aAttrTab[ RES_CHRATR_CJK_POSTURE - POOLATTR_BEGIN ] = new SvxPostureItem(ITALIC_NONE, RES_CHRATR_CJK_POSTURE );
+ aAttrTab[ RES_CHRATR_CJK_WEIGHT - POOLATTR_BEGIN ] = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT );
+
+ // CTL-Attributes
+ aAttrTab[ RES_CHRATR_CTL_FONT - POOLATTR_BEGIN ] = new SvxFontItem( RES_CHRATR_CTL_FONT );
+ aAttrTab[ RES_CHRATR_CTL_FONTSIZE - POOLATTR_BEGIN ] = new SvxFontHeightItem( 240, 100, RES_CHRATR_CTL_FONTSIZE );
+ aAttrTab[ RES_CHRATR_CTL_LANGUAGE - POOLATTR_BEGIN ] = new SvxLanguageItem(LANGUAGE_DONTKNOW, RES_CHRATR_CTL_LANGUAGE);
+ aAttrTab[ RES_CHRATR_CTL_POSTURE - POOLATTR_BEGIN ] = new SvxPostureItem(ITALIC_NONE, RES_CHRATR_CTL_POSTURE );
+ aAttrTab[ RES_CHRATR_CTL_WEIGHT - POOLATTR_BEGIN ] = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT );
+
+ aAttrTab[ RES_CHRATR_ROTATE - POOLATTR_BEGIN ] = new SvxCharRotateItem( 0, sal_False, RES_CHRATR_ROTATE );
+ aAttrTab[ RES_CHRATR_EMPHASIS_MARK - POOLATTR_BEGIN ] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, RES_CHRATR_EMPHASIS_MARK );
+ aAttrTab[ RES_CHRATR_TWO_LINES - POOLATTR_BEGIN ] = new SvxTwoLinesItem( sal_False, 0, 0, RES_CHRATR_TWO_LINES );
+ aAttrTab[ RES_CHRATR_SCALEW - POOLATTR_BEGIN ] = new SvxCharScaleWidthItem( 100, RES_CHRATR_SCALEW );
+ aAttrTab[ RES_CHRATR_RELIEF - POOLATTR_BEGIN ] = new SvxCharReliefItem( RELIEF_NONE, RES_CHRATR_RELIEF );
+ aAttrTab[ RES_CHRATR_HIDDEN - POOLATTR_BEGIN ] = new SvxCharHiddenItem( sal_False, RES_CHRATR_HIDDEN );
+ aAttrTab[ RES_CHRATR_OVERLINE- POOLATTR_BEGIN ] = new SvxOverlineItem( UNDERLINE_NONE, RES_CHRATR_OVERLINE );
+
+// CharakterAttr - Dummies
+ aAttrTab[ RES_CHRATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY1 );
+ aAttrTab[ RES_CHRATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY2 );
+// CharakterAttr - Dummies
+
+ aAttrTab[ RES_TXTATR_AUTOFMT- POOLATTR_BEGIN ] = new SwFmtAutoFmt;
+ aAttrTab[ RES_TXTATR_INETFMT - POOLATTR_BEGIN ] = new SwFmtINetFmt( aEmptyStr, aEmptyStr );
+ aAttrTab[ RES_TXTATR_REFMARK - POOLATTR_BEGIN ] = new SwFmtRefMark( aEmptyStr );
+ aAttrTab[ RES_TXTATR_TOXMARK - POOLATTR_BEGIN ] = new SwTOXMark;
+ aAttrTab[ RES_TXTATR_CHARFMT- POOLATTR_BEGIN ] = new SwFmtCharFmt( 0 );
+ aAttrTab[ RES_TXTATR_CJK_RUBY - POOLATTR_BEGIN ] = new SwFmtRuby( aEmptyStr );
+ aAttrTab[ RES_TXTATR_UNKNOWN_CONTAINER - POOLATTR_BEGIN ] = new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER );
+ aAttrTab[ RES_TXTATR_META - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_META);
+ aAttrTab[ RES_TXTATR_METAFIELD - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_METAFIELD);
+
+ aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld;
+ aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFmtFlyCnt( 0 );
+ aAttrTab[ RES_TXTATR_FTN - POOLATTR_BEGIN ] = new SwFmtFtn;
+
+// TextAttr - Dummies
+ aAttrTab[ RES_TXTATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY4 );
+ aAttrTab[ RES_TXTATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY3 );
+ aAttrTab[ RES_TXTATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY1 );
+ aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 );
+ aAttrTab[ RES_TXTATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY5 );
+// TextAttr - Dummies
+
+ aAttrTab[ RES_PARATR_LINESPACING- POOLATTR_BEGIN ] = new SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
+ aAttrTab[ RES_PARATR_ADJUST- POOLATTR_BEGIN ] = new SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST );
+ aAttrTab[ RES_PARATR_SPLIT- POOLATTR_BEGIN ] = new SvxFmtSplitItem( sal_True, RES_PARATR_SPLIT );
+ aAttrTab[ RES_PARATR_WIDOWS- POOLATTR_BEGIN ] = new SvxWidowsItem( 0, RES_PARATR_WIDOWS );
+ aAttrTab[ RES_PARATR_ORPHANS- POOLATTR_BEGIN ] = new SvxOrphansItem( 0, RES_PARATR_ORPHANS );
+ aAttrTab[ RES_PARATR_TABSTOP- POOLATTR_BEGIN ] = new SvxTabStopItem( 1, SVX_TAB_DEFDIST, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+
+ pItem = new SvxHyphenZoneItem( sal_False, RES_PARATR_HYPHENZONE );
+ ((SvxHyphenZoneItem*)pItem)->GetMaxHyphens() = 0; // Default z.Z. auf 0
+ aAttrTab[ RES_PARATR_HYPHENZONE- POOLATTR_BEGIN ] = pItem;
+
+ aAttrTab[ RES_PARATR_DROP- POOLATTR_BEGIN ] = new SwFmtDrop;
+ aAttrTab[ RES_PARATR_REGISTER - POOLATTR_BEGIN ] = new SwRegisterItem( sal_False );
+ aAttrTab[ RES_PARATR_NUMRULE - POOLATTR_BEGIN ] = new SwNumRuleItem( aEmptyStr );
+
+ aAttrTab[ RES_PARATR_SCRIPTSPACE - POOLATTR_BEGIN ] = new SvxScriptSpaceItem( sal_True, RES_PARATR_SCRIPTSPACE );
+ aAttrTab[ RES_PARATR_HANGINGPUNCTUATION - POOLATTR_BEGIN ] = new SvxHangingPunctuationItem( sal_True, RES_PARATR_HANGINGPUNCTUATION );
+ aAttrTab[ RES_PARATR_FORBIDDEN_RULES - POOLATTR_BEGIN ] = new SvxForbiddenRuleItem( sal_True, RES_PARATR_FORBIDDEN_RULES );
+ aAttrTab[ RES_PARATR_VERTALIGN - POOLATTR_BEGIN ] = new SvxParaVertAlignItem( 0, RES_PARATR_VERTALIGN );
+ aAttrTab[ RES_PARATR_SNAPTOGRID - POOLATTR_BEGIN ] = new SvxParaGridItem( sal_True, RES_PARATR_SNAPTOGRID );
+ aAttrTab[ RES_PARATR_CONNECT_BORDER - POOLATTR_BEGIN ] = new SwParaConnectBorderItem;
+
+ aAttrTab[ RES_PARATR_OUTLINELEVEL - POOLATTR_BEGIN ] = new SfxUInt16Item( RES_PARATR_OUTLINELEVEL, 0 );//#outline level,zhaojianwei
+
+ // --> OD 2008-02-19 #refactorlists#
+ aAttrTab[ RES_PARATR_LIST_ID - POOLATTR_BEGIN ] = new SfxStringItem( RES_PARATR_LIST_ID, aEmptyStr );
+ aAttrTab[ RES_PARATR_LIST_LEVEL - POOLATTR_BEGIN ] = new SfxInt16Item( RES_PARATR_LIST_LEVEL, 0 );
+ aAttrTab[ RES_PARATR_LIST_ISRESTART - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_LIST_ISRESTART, sal_False );
+ aAttrTab[ RES_PARATR_LIST_RESTARTVALUE - POOLATTR_BEGIN ] = new SfxInt16Item( RES_PARATR_LIST_RESTARTVALUE, 1 );
+ aAttrTab[ RES_PARATR_LIST_ISCOUNTED - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, sal_True );
+ // <--
+
+ aAttrTab[ RES_FILL_ORDER- POOLATTR_BEGIN ] = new SwFmtFillOrder;
+ aAttrTab[ RES_FRM_SIZE- POOLATTR_BEGIN ] = new SwFmtFrmSize;
+ aAttrTab[ RES_PAPER_BIN- POOLATTR_BEGIN ] = new SvxPaperBinItem( RES_PAPER_BIN );
+ aAttrTab[ RES_LR_SPACE- POOLATTR_BEGIN ] = new SvxLRSpaceItem( RES_LR_SPACE );
+ aAttrTab[ RES_UL_SPACE- POOLATTR_BEGIN ] = new SvxULSpaceItem( RES_UL_SPACE );
+ aAttrTab[ RES_PAGEDESC- POOLATTR_BEGIN ] = new SwFmtPageDesc;
+ aAttrTab[ RES_BREAK- POOLATTR_BEGIN ] = new SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK);
+ aAttrTab[ RES_CNTNT- POOLATTR_BEGIN ] = new SwFmtCntnt;
+ aAttrTab[ RES_HEADER- POOLATTR_BEGIN ] = new SwFmtHeader;
+ aAttrTab[ RES_FOOTER- POOLATTR_BEGIN ] = new SwFmtFooter;
+ aAttrTab[ RES_PRINT- POOLATTR_BEGIN ] = new SvxPrintItem( RES_PRINT );
+ aAttrTab[ RES_OPAQUE- POOLATTR_BEGIN ] = new SvxOpaqueItem( RES_OPAQUE );
+ aAttrTab[ RES_PROTECT- POOLATTR_BEGIN ] = new SvxProtectItem( RES_PROTECT );
+ aAttrTab[ RES_SURROUND- POOLATTR_BEGIN ] = new SwFmtSurround;
+ aAttrTab[ RES_VERT_ORIENT- POOLATTR_BEGIN ] = new SwFmtVertOrient;
+ aAttrTab[ RES_HORI_ORIENT- POOLATTR_BEGIN ] = new SwFmtHoriOrient;
+ aAttrTab[ RES_ANCHOR- POOLATTR_BEGIN ] = new SwFmtAnchor;
+ aAttrTab[ RES_BACKGROUND- POOLATTR_BEGIN ] = new SvxBrushItem( RES_BACKGROUND );
+ aAttrTab[ RES_BOX- POOLATTR_BEGIN ] = new SvxBoxItem( RES_BOX );
+ aAttrTab[ RES_SHADOW- POOLATTR_BEGIN ] = new SvxShadowItem( RES_SHADOW );
+ aAttrTab[ RES_FRMMACRO- POOLATTR_BEGIN ] = new SvxMacroItem( RES_FRMMACRO );
+ aAttrTab[ RES_COL- POOLATTR_BEGIN ] = new SwFmtCol;
+ aAttrTab[ RES_KEEP - POOLATTR_BEGIN ] = new SvxFmtKeepItem( sal_False, RES_KEEP );
+ aAttrTab[ RES_URL - POOLATTR_BEGIN ] = new SwFmtURL();
+ aAttrTab[ RES_EDIT_IN_READONLY - POOLATTR_BEGIN ] = new SwFmtEditInReadonly;
+ aAttrTab[ RES_LAYOUT_SPLIT - POOLATTR_BEGIN ] = new SwFmtLayoutSplit;
+ aAttrTab[ RES_CHAIN - POOLATTR_BEGIN ] = new SwFmtChain;
+ aAttrTab[ RES_TEXTGRID - POOLATTR_BEGIN ] = new SwTextGridItem;
+ aAttrTab[ RES_HEADER_FOOTER_EAT_SPACING - POOLATTR_BEGIN ] = new SwHeaderAndFooterEatSpacingItem;
+ aAttrTab[ RES_LINENUMBER - POOLATTR_BEGIN ] = new SwFmtLineNumber;
+ aAttrTab[ RES_FTN_AT_TXTEND - POOLATTR_BEGIN ] = new SwFmtFtnAtTxtEnd;
+ aAttrTab[ RES_END_AT_TXTEND - POOLATTR_BEGIN ] = new SwFmtEndAtTxtEnd;
+ aAttrTab[ RES_COLUMNBALANCE - POOLATTR_BEGIN ] = new SwFmtNoBalancedColumns;
+ aAttrTab[ RES_FRAMEDIR - POOLATTR_BEGIN ] = new SvxFrameDirectionItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
+ aAttrTab[ RES_ROW_SPLIT - POOLATTR_BEGIN ] = new SwFmtRowSplit;
+
+ // OD 18.09.2003 #i18732#
+ aAttrTab[ RES_FOLLOW_TEXT_FLOW - POOLATTR_BEGIN ] = new SwFmtFollowTextFlow( sal_True );
+ // --> collapsing borders FME 2005-05-27 #i29550#
+ aAttrTab[ RES_COLLAPSING_BORDERS - POOLATTR_BEGIN ] = new SfxBoolItem( RES_COLLAPSING_BORDERS, sal_False );
+ // <-- collapsing
+ // OD 2004-05-04 #i28701#
+ // --> OD 2004-10-18 #i35017# - constant name has changed
+ aAttrTab[ RES_WRAP_INFLUENCE_ON_OBJPOS - POOLATTR_BEGIN ] =
+ new SwFmtWrapInfluenceOnObjPos( text::WrapInfluenceOnPosition::ONCE_CONCURRENT );
+ // <--
+// FrmAttr-Dummies
+ aAttrTab[ RES_AUTO_STYLE - POOLATTR_BEGIN ] = new SwFmtAutoFmt( RES_AUTO_STYLE );
+ aAttrTab[ RES_FRMATR_STYLE_NAME - POOLATTR_BEGIN ] = new SfxStringItem( RES_FRMATR_STYLE_NAME, aEmptyStr );
+ aAttrTab[ RES_FRMATR_CONDITIONAL_STYLE_NAME - POOLATTR_BEGIN ] = new SfxStringItem( RES_FRMATR_CONDITIONAL_STYLE_NAME, aEmptyStr );
+// FrmAttr-Dummies
+
+ aAttrTab[ RES_GRFATR_MIRRORGRF- POOLATTR_BEGIN ] = new SwMirrorGrf;
+ aAttrTab[ RES_GRFATR_CROPGRF- POOLATTR_BEGIN ] = new SwCropGrf;
+ aAttrTab[ RES_GRFATR_ROTATION - POOLATTR_BEGIN ] = new SwRotationGrf;
+ aAttrTab[ RES_GRFATR_LUMINANCE - POOLATTR_BEGIN ] = new SwLuminanceGrf;
+ aAttrTab[ RES_GRFATR_CONTRAST - POOLATTR_BEGIN ] = new SwContrastGrf;
+ aAttrTab[ RES_GRFATR_CHANNELR - POOLATTR_BEGIN ] = new SwChannelRGrf;
+ aAttrTab[ RES_GRFATR_CHANNELG - POOLATTR_BEGIN ] = new SwChannelGGrf;
+ aAttrTab[ RES_GRFATR_CHANNELB - POOLATTR_BEGIN ] = new SwChannelBGrf;
+ aAttrTab[ RES_GRFATR_GAMMA - POOLATTR_BEGIN ] = new SwGammaGrf;
+ aAttrTab[ RES_GRFATR_INVERT - POOLATTR_BEGIN ] = new SwInvertGrf;
+ aAttrTab[ RES_GRFATR_TRANSPARENCY - POOLATTR_BEGIN ] = new SwTransparencyGrf;
+ aAttrTab[ RES_GRFATR_DRAWMODE - POOLATTR_BEGIN ] = new SwDrawModeGrf;
+
+// GraphicAttr - Dummies
+ aAttrTab[ RES_GRFATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY1 );
+ aAttrTab[ RES_GRFATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY2 );
+ aAttrTab[ RES_GRFATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY3 );
+ aAttrTab[ RES_GRFATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY4 );
+ aAttrTab[ RES_GRFATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY5 );
+// GraphicAttr - Dummies
+
+ aAttrTab[ RES_BOXATR_FORMAT- POOLATTR_BEGIN ] = new SwTblBoxNumFormat;
+ aAttrTab[ RES_BOXATR_FORMULA- POOLATTR_BEGIN ] = new SwTblBoxFormula( aEmptyStr );
+ aAttrTab[ RES_BOXATR_VALUE- POOLATTR_BEGIN ] = new SwTblBoxValue;
+
+ aAttrTab[ RES_UNKNOWNATR_CONTAINER- POOLATTR_BEGIN ] =
+ new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER );
+
+ // get the correct fonts:
+ ::GetDefaultFonts( *(SvxFontItem*)aAttrTab[ RES_CHRATR_FONT- POOLATTR_BEGIN ],
+ *(SvxFontItem*)aAttrTab[ RES_CHRATR_CJK_FONT - POOLATTR_BEGIN ],
+ *(SvxFontItem*)aAttrTab[ RES_CHRATR_CTL_FONT - POOLATTR_BEGIN ] );
+
+ // 1. Version - neue Attribute:
+ // - RES_CHRATR_BLINK
+ // - RES_CHRATR_NOHYPHEN
+ // - RES_CHRATR_NOLINEBREAK
+ // - RES_PARATR_REGISTER
+ // + 2 Dummies fuer die einzelnen "Bereiche"
+ SwAttrPool::pVersionMap1 = new sal_uInt16[ 60 ];
+ sal_uInt16 i;
+ for( i = 1; i <= 17; i++ )
+ SwAttrPool::pVersionMap1[ i-1 ] = i;
+ for ( i = 18; i <= 27; ++i )
+ SwAttrPool::pVersionMap1[ i-1 ] = i + 5;
+ for ( i = 28; i <= 35; ++i )
+ SwAttrPool::pVersionMap1[ i-1 ] = i + 7;
+ for ( i = 36; i <= 58; ++i )
+ SwAttrPool::pVersionMap1[ i-1 ] = i + 10;
+ for ( i = 59; i <= 60; ++i )
+ SwAttrPool::pVersionMap1[ i-1 ] = i + 12;
+
+ // 2. Version - neue Attribute:
+ // 10 Dummies fuer den Frame "Bereich"
+ SwAttrPool::pVersionMap2 = new sal_uInt16[ 75 ];
+ for( i = 1; i <= 70; i++ )
+ SwAttrPool::pVersionMap2[ i-1 ] = i;
+ for ( i = 71; i <= 75; ++i )
+ SwAttrPool::pVersionMap2[ i-1 ] = i + 10;
+
+ // 3. Version - neue Attribute:
+ // neue Attribute und Dummies fuer die CJK-Version
+ // und neue Grafik-Attribute
+ SwAttrPool::pVersionMap3 = new sal_uInt16[ 86 ];
+ for( i = 1; i <= 21; i++ )
+ SwAttrPool::pVersionMap3[ i-1 ] = i;
+ for ( i = 22; i <= 27; ++i )
+ SwAttrPool::pVersionMap3[ i-1 ] = i + 15;
+ for ( i = 28; i <= 82; ++i )
+ SwAttrPool::pVersionMap3[ i-1 ] = i + 20;
+ for ( i = 83; i <= 86; ++i )
+ SwAttrPool::pVersionMap3[ i-1 ] = i + 35;
+
+ // 4. Version - neue Paragraph Attribute fuer die CJK-Version
+ SwAttrPool::pVersionMap4 = new sal_uInt16[ 121 ];
+ for( i = 1; i <= 65; i++ )
+ SwAttrPool::pVersionMap4[ i-1 ] = i;
+ for ( i = 66; i <= 121; ++i )
+ SwAttrPool::pVersionMap4[ i-1 ] = i + 9;
+
+ // OD 2004-01-21 #i18732# - setup new version map due to extension of
+ // the frame attributes (RES_FRMATR_*) for binary filters.
+ SwAttrPool::pVersionMap5 = new sal_uInt16[ 130 ];
+ for( i = 1; i <= 109; i++ )
+ SwAttrPool::pVersionMap5[ i-1 ] = i;
+ for ( i = 110; i <= 130; ++i )
+ SwAttrPool::pVersionMap5[ i-1 ] = i + 6;
+
+ // 6. Version - new character attribute for overlining plus 2 dummies
+ SwAttrPool::pVersionMap6 = new sal_uInt16[ 136 ];
+ for( i = 1; i <= 37; i++ )
+ SwAttrPool::pVersionMap6[ i-1 ] = i;
+ for ( i = 38; i <= 136; ++i )
+ SwAttrPool::pVersionMap6[ i-1 ] = i + 3;
+
+ uno::Reference<
+ lang::XMultiServiceFactory > xMSF =
+ ::comphelper::getProcessServiceFactory();
+
+ SwBreakIt::_Create( xMSF );
+ pCheckIt = NULL;
+ /*pAppCharClass = new CharClass(
+ xMSF, SwBreakIt::Get()->GetLocale( (LanguageType)GetAppLanguage() ));*/
+ //pCalendarWrapper = new SwCalendarWrapper( xMSF );
+
+ _FrmInit();
+ _TextInit();
+
+ SwSelPaintRects::pMapMode = new MapMode;
+ SwFntObj::pPixMap = new MapMode;
+
+ SwIndexReg::pEmptyIndexArray = new SwIndexReg;
+
+ pGlobalOLEExcludeList = new SvPtrarr;
+
+ const SvxSwAutoFmtFlags& rAFlags = SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags();
+ SwDoc::pACmpltWords = new SwAutoCompleteWord( rAFlags.nAutoCmpltListLen,
+ rAFlags.nAutoCmpltWordLen );
+}
+
+/******************************************************************************
+ * void _FinitCore()
+ ******************************************************************************/
+
+
+
+void _FinitCore()
+{
+ _FrmFinit();
+ _TextFinit();
+
+ SwBreakIt::_Delete();
+ delete pCheckIt;
+ delete pAppCharClass;
+ delete pCollator;
+ delete pCaseCollator;
+
+ // das default TableAutoFormat zerstoeren
+ delete SwTableAutoFmt::pDfltBoxAutoFmt;
+
+ delete SwSelPaintRects::pMapMode;
+ delete SwFntObj::pPixMap;
+
+ delete SwEditShell::pAutoFmtFlags;
+
+#ifdef DBG_UTIL
+ //Defaultattribut freigeben lassen um asserts zu vermeiden.
+ if ( aAttrTab[0]->GetRefCount() )
+ SfxItemPool::ReleaseDefaults( aAttrTab, POOLATTR_END-POOLATTR_BEGIN, sal_False);
+#endif
+ delete SwDoc::pACmpltWords;
+
+ delete SwStyleNameMapper::pTextUINameArray;
+ delete SwStyleNameMapper::pListsUINameArray;
+ delete SwStyleNameMapper::pExtraUINameArray;
+ delete SwStyleNameMapper::pRegisterUINameArray;
+ delete SwStyleNameMapper::pDocUINameArray;
+ delete SwStyleNameMapper::pHTMLUINameArray;
+ delete SwStyleNameMapper::pFrmFmtUINameArray;
+ delete SwStyleNameMapper::pChrFmtUINameArray;
+ delete SwStyleNameMapper::pHTMLChrFmtUINameArray;
+ delete SwStyleNameMapper::pPageDescUINameArray;
+ delete SwStyleNameMapper::pNumRuleUINameArray;
+
+ // Delete programmatic name arrays also
+ delete SwStyleNameMapper::pTextProgNameArray;
+ delete SwStyleNameMapper::pListsProgNameArray;
+ delete SwStyleNameMapper::pExtraProgNameArray;
+ delete SwStyleNameMapper::pRegisterProgNameArray;
+ delete SwStyleNameMapper::pDocProgNameArray;
+ delete SwStyleNameMapper::pHTMLProgNameArray;
+ delete SwStyleNameMapper::pFrmFmtProgNameArray;
+ delete SwStyleNameMapper::pChrFmtProgNameArray;
+ delete SwStyleNameMapper::pHTMLChrFmtProgNameArray;
+ delete SwStyleNameMapper::pPageDescProgNameArray;
+ delete SwStyleNameMapper::pNumRuleProgNameArray;
+
+ // And finally, any hash tables that we used
+ delete SwStyleNameMapper::pParaUIMap;
+ delete SwStyleNameMapper::pCharUIMap;
+ delete SwStyleNameMapper::pPageUIMap;
+ delete SwStyleNameMapper::pFrameUIMap;
+ delete SwStyleNameMapper::pNumRuleUIMap;
+
+ delete SwStyleNameMapper::pParaProgMap;
+ delete SwStyleNameMapper::pCharProgMap;
+ delete SwStyleNameMapper::pPageProgMap;
+ delete SwStyleNameMapper::pFrameProgMap;
+ delete SwStyleNameMapper::pNumRuleProgMap;
+
+
+ // loesche alle default-Attribute
+ SfxPoolItem* pHt;
+ for( sal_uInt16 n = 0; n < POOLATTR_END - POOLATTR_BEGIN; n++ )
+ if( 0 != ( pHt = aAttrTab[n] ))
+ delete pHt;
+
+ ::ClearFEShellTabCols();
+
+ delete SwIndexReg::pEmptyIndexArray;
+ delete[] SwAttrPool::pVersionMap1;
+ delete[] SwAttrPool::pVersionMap2;
+ delete[] SwAttrPool::pVersionMap3;
+ delete[] SwAttrPool::pVersionMap4;
+ // OD 2004-01-21 #i18732#
+ delete[] SwAttrPool::pVersionMap5;
+ delete[] SwAttrPool::pVersionMap6;
+
+ for ( sal_uInt16 i = 0; i < pGlobalOLEExcludeList->Count(); ++i )
+ delete (SvGlobalName*)(*pGlobalOLEExcludeList)[i];
+ delete pGlobalOLEExcludeList;
+}
+
+// returns the APP - CharClass instance - used for all ToUpper/ToLower/...
+CharClass& GetAppCharClass()
+{
+ if ( !pAppCharClass )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ pAppCharClass = new CharClass(
+ xMSF, SwBreakIt::Get()->GetLocale( (LanguageType)GetAppLanguage() ));
+ }
+ return *pAppCharClass;
+}
+
+void SwCalendarWrapper::LoadDefaultCalendar( sal_uInt16 eLang )
+{
+ sUniqueId.Erase();
+ if( eLang != nLang )
+ loadDefaultCalendar( SvxCreateLocale( nLang = eLang ));
+}
+
+LanguageType GetAppLanguage()
+{
+ return Application::GetSettings().GetLanguage();
+}
+
+CollatorWrapper& GetAppCollator()
+{
+ if( !pCollator )
+ {
+ const lang::Locale& rLcl = pBreakIt->GetLocale(
+ (LanguageType)GetAppLanguage() );
+ uno::Reference<
+ lang::XMultiServiceFactory > xMSF =
+ ::comphelper::getProcessServiceFactory();
+
+ pCollator = new CollatorWrapper( xMSF );
+ pCollator->loadDefaultCollator( rLcl, SW_COLLATOR_IGNORES );
+ }
+ return *pCollator;
+}
+CollatorWrapper& GetAppCaseCollator()
+{
+ if( !pCaseCollator )
+ {
+ const lang::Locale& rLcl = pBreakIt->GetLocale(
+ (LanguageType)GetAppLanguage() );
+ uno::Reference<
+ lang::XMultiServiceFactory > xMSF =
+ ::comphelper::getProcessServiceFactory();
+
+ pCaseCollator = new CollatorWrapper( xMSF );
+ pCaseCollator->loadDefaultCollator( rLcl, 0 );
+ }
+ return *pCaseCollator;
+}
+
+const ::utl::TransliterationWrapper& GetAppCmpStrIgnore()
+{
+ if( !pTransWrp )
+ {
+ uno::Reference<
+ lang::XMultiServiceFactory > xMSF =
+ ::comphelper::getProcessServiceFactory();
+
+ pTransWrp = new ::utl::TransliterationWrapper( xMSF,
+ i18n::TransliterationModules_IGNORE_CASE |
+ i18n::TransliterationModules_IGNORE_KANA |
+ i18n::TransliterationModules_IGNORE_WIDTH );
+ pTransWrp->loadModuleIfNeeded( static_cast<sal_uInt16>(GetAppLanguage()) );
+ }
+ return *pTransWrp;
+}
diff --git a/sw/source/core/bastyp/ring.cxx b/sw/source/core/bastyp/ring.cxx
new file mode 100644
index 000000000000..1831093a1d19
--- /dev/null
+++ b/sw/source/core/bastyp/ring.cxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "ring.hxx"
+
+
+/*************************************************************************
+|*
+|* Ring::Ring()
+|*
+|* Ersterstellung VB 02.07.91
+|* Letzte Aenderung JP 10.10.97
+|*
+*************************************************************************/
+
+Ring::Ring( Ring *pObj )
+{
+ if( !pObj )
+ pNext = this, pPrev = this;
+ else
+ {
+ pNext = pObj;
+ pPrev = pObj->pPrev;
+ pObj->pPrev = this;
+ pPrev->pNext = this;
+ }
+}
+
+/*************************************************************************
+|*
+|* Ring::~Ring()
+|*
+|* Ersterstellung VB 02.07.91
+|* Letzte Aenderung JP 10.10.97
+|*
+*************************************************************************/
+
+Ring::~Ring()
+{
+ pNext->pPrev = pPrev;
+ pPrev->pNext = pNext;
+}
+
+/*************************************************************************
+|*
+|* Ring::MoveTo
+|*
+|* Ersterstellung VB 4.3.91
+|* Letzte Aenderung JP 10.10.97
+|*
+*************************************************************************/
+
+void Ring::MoveTo(Ring *pDestRing)
+{
+ // loeschen aus dem alten
+ pNext->pPrev = pPrev;
+ pPrev->pNext = pNext;
+
+ // im neuen einfuegen
+ if( pDestRing )
+ {
+ pNext = pDestRing;
+ pPrev = pDestRing->pPrev;
+ pDestRing->pPrev = this;
+ pPrev->pNext = this;
+ }
+ else
+ pNext = pPrev = this;
+
+}
+
+void Ring::MoveRingTo(Ring *pDestRing)
+{
+ // den gesamten Ring in den DestRing einfuegen
+ Ring* pMyPrev = pPrev;
+ Ring* pDestPrev = pDestRing->pPrev;
+
+ pMyPrev->pNext = pDestRing;
+ pDestPrev->pNext = this;
+ pDestRing->pPrev = pMyPrev;
+ pPrev = pDestPrev;
+}
+
+sal_uInt32 Ring::numberOf() const
+{
+ sal_uInt32 nRet = 1;
+ const Ring* pNxt = pNext;
+ while( pNxt != this )
+ {
+ ++nRet;
+ pNxt = pNxt->GetNext();
+ }
+ return nRet;
+}
+
+
diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
new file mode 100644
index 000000000000..e3db1a266648
--- /dev/null
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -0,0 +1,656 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <tools/debug.hxx>
+#include <errhdl.hxx>
+#include <swcache.hxx>
+
+SV_IMPL_PTRARR(SwCacheObjArr,SwCacheObj*);
+
+#ifndef DBG_UTIL
+#define INCREMENT( nVar )
+#else
+#define INCREMENT( nVar ) ++nVar
+#endif
+
+/*************************************************************************
+|*
+|* SwCache::Check()
+|*
+|* Ersterstellung MA 23. Mar. 94
+|* Letzte Aenderung MA 23. Mar. 94
+|*
+|*************************************************************************/
+
+#ifdef DBG_UTIL
+
+void SwCache::Check()
+{
+ if ( !pRealFirst )
+ return;
+
+ //Konsistenspruefung.
+ ASSERT( !pLast->GetNext(), "Last but not last." );
+ ASSERT( !pRealFirst->GetPrev(), "First but not first." );
+ sal_uInt16 nCnt = 0;
+ sal_Bool bFirstFound = sal_False;
+ SwCacheObj *pObj = pRealFirst;
+ SwCacheObj *pRekursive = pObj;
+ while ( pObj )
+ {
+ //Das Objekt muss auch auf dem Rueckwaertsweg gefunden werden.
+ SwCacheObj *pTmp = pLast;
+ while ( pTmp && pTmp != pObj )
+ pTmp = pTmp->GetPrev();
+ ASSERT( pTmp, "Objekt not found." );
+
+ ++nCnt;
+ if ( pObj == pFirst )
+ bFirstFound = sal_True;
+ if ( !pObj->GetNext() )
+ ASSERT( pObj == pLast, "Last not Found." );
+ pObj = pObj->GetNext();
+ ASSERT( pObj != pRekursive, "Recursion in SwCache." );
+ }
+ ASSERT( bFirstFound, "First not Found." );
+ ASSERT( (nCnt + aFreePositions.Count()) == Count(), "Lost Chain." );
+ if ( Count() == nCurMax )
+ ASSERT( (nCurMax - nCnt) == aFreePositions.Count(), "Lost FreePositions." );
+}
+#endif
+
+#if defined(DBG_UTIL) && defined(MADEBUG)
+#define CHECK Check();
+#else
+#define CHECK
+#endif
+
+/*************************************************************************
+|*
+|* SwCache::SwCache(), ~SwCache()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+SwCache::SwCache( const sal_uInt16 nInitSize, const sal_uInt16 nGrowSize
+#ifdef DBG_UTIL
+ , const ByteString &rNm
+#endif
+ ) :
+ SwCacheObjArr( (sal_uInt8)nInitSize, (sal_uInt8)nGrowSize ),
+ aFreePositions( 5, 5 ),
+ pRealFirst( 0 ),
+ pFirst( 0 ),
+ pLast( 0 ),
+ nMax( nInitSize ),
+ nCurMax( nInitSize )
+#ifdef DBG_UTIL
+ , aName( rNm ),
+ nAppend( 0 ),
+ nInsertFree( 0 ),
+ nReplace( 0 ),
+ nGetSuccess( 0 ),
+ nGetFail( 0 ),
+ nToTop( 0 ),
+ nDelete( 0 ),
+ nGetSeek( 0 ),
+ nAverageSeekCnt( 0 ),
+ nFlushCnt( 0 ),
+ nFlushedObjects( 0 ),
+ nIncreaseMax( 0 ),
+ nDecreaseMax( 0 )
+#endif
+{
+}
+
+#ifdef DBG_UTIL
+
+
+SwCache::~SwCache()
+{
+#if OSL_DEBUG_LEVEL > 1
+ {
+ ByteString sOut( aName ); sOut += '\n';
+ (( sOut += "Anzahl neuer Eintraege: " )
+ += ByteString::CreateFromInt32( nAppend ))+= '\n';
+ (( sOut += "Anzahl Insert auf freie Plaetze: " )
+ += ByteString::CreateFromInt32( nInsertFree ))+= '\n';
+ (( sOut += "Anzahl Ersetzungen: " )
+ += ByteString::CreateFromInt32( nReplace ))+= '\n';
+ (( sOut += "Anzahl Erfolgreicher Get's: " )
+ += ByteString::CreateFromInt32( nGetSuccess ))+= '\n';
+ (( sOut += "Anzahl Fehlgeschlagener Get's: " )
+ += ByteString::CreateFromInt32( nGetFail ))+= '\n';
+ (( sOut += "Anzahl Umsortierungen (LRU): " )
+ += ByteString::CreateFromInt32( nToTop ))+= '\n';
+ (( sOut += "Anzahl Loeschungen: " )
+ += ByteString::CreateFromInt32( nDelete ))+= '\n';
+ (( sOut += "Anzahl Get's ohne Index: " )
+ += ByteString::CreateFromInt32( nGetSeek ))+= '\n';
+ (( sOut += "Anzahl Seek fuer Get ohne Index: " )
+ += ByteString::CreateFromInt32( nAverageSeekCnt ))+= '\n';
+ (( sOut += "Anzahl Flush-Aufrufe: " )
+ += ByteString::CreateFromInt32( nFlushCnt ))+= '\n';
+ (( sOut += "Anzahl geflush'ter Objekte: " )
+ += ByteString::CreateFromInt32( nFlushedObjects ))+= '\n';
+ (( sOut += "Anzahl Cache-Erweiterungen: " )
+ += ByteString::CreateFromInt32( nIncreaseMax ))+= '\n';
+ (( sOut += "Anzahl Cache-Verkleinerungen: " )
+ += ByteString::CreateFromInt32( nDecreaseMax ))+= '\n';
+
+ DBG_ERROR( sOut.GetBuffer() );
+ }
+ Check();
+#endif
+}
+#endif
+
+/*************************************************************************
+|*
+|* SwCache::Flush()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+void SwCache::Flush( const sal_uInt8 )
+{
+ INCREMENT( nFlushCnt );
+ SwCacheObj *pObj = pRealFirst;
+ pRealFirst = pFirst = pLast = 0;
+ SwCacheObj *pTmp;
+ while ( pObj )
+ {
+#ifdef DBG_UTIL
+ if ( pObj->IsLocked() )
+ {
+ ASSERT( sal_True, "Flushing locked objects." );
+ if ( !pRealFirst )
+ {
+ pRealFirst = pFirst = pLast = pObj;
+ pTmp = pObj->GetNext();
+ pObj->SetNext( 0 ); pObj->SetPrev( 0 );
+ pObj = pTmp;
+ }
+ else
+ { pLast->SetNext( pObj );
+ pObj->SetPrev( pLast );
+ pLast = pObj;
+ pTmp = pObj->GetNext();
+ pObj->SetNext( 0 );
+ pObj = pTmp;
+ }
+ }
+ else
+#endif
+ {
+ pTmp = (SwCacheObj*)pObj;
+ pObj = pTmp->GetNext();
+ aFreePositions.Insert( pTmp->GetCachePos(), aFreePositions.Count() );
+ *(pData + pTmp->GetCachePos()) = (void*)0;
+ delete pTmp;
+ INCREMENT( nFlushedObjects );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SwCache::ToTop()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 24. Apr. 95
+|*
+|*************************************************************************/
+
+
+void SwCache::ToTop( SwCacheObj *pObj )
+{
+ INCREMENT( nToTop );
+
+ //Objekt aus der LRU-Kette ausschneiden und am Anfang einfuegen.
+ if ( pRealFirst == pObj ) //pFirst wurde vom Aufrufer geprueft!
+ { CHECK;
+ return;
+ }
+
+ if ( !pRealFirst )
+ { //Der erste wird eingetragen.
+ ASSERT( !pFirst && !pLast, "First not first." );
+ pRealFirst = pFirst = pLast = pObj;
+ CHECK;
+ return;
+ }
+
+ //Ausschneiden.
+ if ( pObj == pLast )
+ {
+ ASSERT( pObj->GetPrev(), "Last but no Prev." );
+ pLast = pObj->GetPrev();
+ pLast->SetNext( 0 );
+ }
+ else
+ {
+ if ( pObj->GetNext() )
+ pObj->GetNext()->SetPrev( pObj->GetPrev() );
+ if ( pObj->GetPrev() )
+ pObj->GetPrev()->SetNext( pObj->GetNext() );
+ }
+
+ //Am (virtuellen) Anfang einfuegen.
+ if ( pRealFirst == pFirst )
+ {
+ pRealFirst->SetPrev( pObj );
+ pObj->SetNext( pRealFirst );
+ pObj->SetPrev( 0 );
+ pRealFirst = pFirst = pObj;
+ CHECK;
+ }
+ else
+ {
+ ASSERT( pFirst, "ToTop, First ist not RealFirst an Empty." );
+
+ if ( pFirst->GetPrev() )
+ {
+ pFirst->GetPrev()->SetNext( pObj );
+ pObj->SetPrev( pFirst->GetPrev() );
+ }
+ else
+ pObj->SetPrev( 0 );
+ pFirst->SetPrev( pObj );
+ pObj->SetNext( pFirst );
+ pFirst = pObj;
+ CHECK;
+ }
+}
+
+/*************************************************************************
+|*
+|* SwCache::Get()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 22. Aug. 94
+|*
+|*************************************************************************/
+
+
+SwCacheObj *SwCache::Get( const void *pOwner, const sal_uInt16 nIndex,
+ const sal_Bool bToTop )
+{
+ SwCacheObj *pRet;
+ if ( 0 != (pRet = nIndex < Count() ? operator[]( nIndex ) : 0) )
+ {
+ if ( !pRet->IsOwner( pOwner ) )
+ pRet = 0;
+ else if ( bToTop && pRet != pFirst )
+ ToTop( pRet );
+ }
+
+#ifdef DBG_UTIL
+ if ( pRet )
+ ++nGetSuccess;
+ else
+ ++nGetFail;
+#endif
+
+ return pRet;
+}
+
+
+
+SwCacheObj *SwCache::Get( const void *pOwner, const sal_Bool bToTop )
+{
+ SwCacheObj *pRet = pRealFirst;
+ while ( pRet && !pRet->IsOwner( pOwner ) )
+ {
+ INCREMENT( nAverageSeekCnt );
+ pRet = pRet->GetNext();
+ }
+
+ if ( bToTop && pRet && pRet != pFirst )
+ ToTop( pRet );
+
+#ifdef DBG_UTIL
+ if ( pRet )
+ ++nGetSuccess;
+ else
+ ++nGetFail;
+ ++nGetSeek;
+#endif
+ return pRet;
+}
+
+/*************************************************************************
+|*
+|* SwCache::Delete()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+void SwCache::DeleteObj( SwCacheObj *pObj )
+{
+ CHECK;
+ ASSERT( !pObj->IsLocked(), "SwCache::Delete: Object ist Locked." );
+ if ( pObj->IsLocked() )
+ return;
+
+ if ( pFirst == pObj )
+ {
+ if ( pFirst->GetNext() )
+ pFirst = pFirst->GetNext();
+ else
+ pFirst = pFirst->GetPrev();
+ }
+ if ( pRealFirst == pObj )
+ pRealFirst = pRealFirst->GetNext();
+ if ( pLast == pObj )
+ pLast = pLast->GetPrev();
+ if ( pObj->GetPrev() )
+ pObj->GetPrev()->SetNext( pObj->GetNext() );
+ if ( pObj->GetNext() )
+ pObj->GetNext()->SetPrev( pObj->GetPrev() );
+
+ aFreePositions.Insert( pObj->GetCachePos(), aFreePositions.Count() );
+ *(pData + pObj->GetCachePos()) = (void*)0;
+ delete pObj;
+
+ CHECK;
+ if ( Count() > nCurMax &&
+ (nCurMax <= (Count() - aFreePositions.Count())) )
+ {
+ //Falls moeglich wieder verkleinern, dazu muessen allerdings ausreichend
+ //Freie Positionen bereitstehen.
+ //Unangenehmer Nebeneffekt ist, das die Positionen verschoben werden
+ //muessen, und die Eigentuemer der Objekte diese wahrscheinlich nicht
+ //wiederfinden werden.
+ for ( sal_uInt16 i = 0; i < Count(); ++i )
+ {
+ SwCacheObj *pTmpObj = operator[](i);
+ if ( !pTmpObj )
+ { SwCacheObjArr::Remove( i, 1 );
+ --i;
+ }
+ else
+ pTmpObj->SetCachePos( i );
+ }
+ aFreePositions.Remove( 0, aFreePositions.Count() );
+ }
+ CHECK;
+}
+
+/*
+
+
+void SwCache::Delete( const void *pOwner, const sal_uInt16 nIndex )
+{
+ INCREMENT( nDelete );
+ SwCacheObj *pObj;
+ if ( 0 != (pObj = Get( pOwner, nIndex, sal_False )) )
+ DeleteObj( pObj );
+}
+*/
+
+
+
+void SwCache::Delete( const void *pOwner )
+{
+ INCREMENT( nDelete );
+ SwCacheObj *pObj;
+ if ( 0 != (pObj = Get( pOwner, sal_Bool(sal_False) )) )
+ DeleteObj( pObj );
+}
+
+
+/*************************************************************************
+|*
+|* SwCache::Insert()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 20. Sep. 94
+|*
+|*************************************************************************/
+
+
+sal_Bool SwCache::Insert( SwCacheObj *pNew )
+{
+ CHECK;
+ ASSERT( !pNew->GetPrev() && !pNew->GetNext(), "New but not new." );
+
+ sal_uInt16 nPos;//Wird hinter den if's zum setzen am Obj benutzt.
+ if ( Count() < nCurMax )
+ {
+ //Es ist noch Platz frei, also einfach einfuegen.
+ INCREMENT( nAppend );
+ nPos = Count();
+ SwCacheObjArr::C40_INSERT( SwCacheObj, pNew, nPos );
+ }
+ else if ( aFreePositions.Count() )
+ {
+ //Es exitieren Platzhalter, also den letzten benutzen.
+ INCREMENT( nInsertFree );
+ const sal_uInt16 nFreePos = aFreePositions.Count() - 1;
+ nPos = aFreePositions[ nFreePos ];
+ *(pData + nPos) = pNew;
+ aFreePositions.Remove( nFreePos );
+ }
+ else
+ {
+ INCREMENT( nReplace );
+ //Der letzte des LRU fliegt raus.
+ SwCacheObj *pObj = pLast;
+
+ while ( pObj && pObj->IsLocked() )
+ pObj = pObj->GetPrev();
+ if ( !pObj )
+ {
+ ASSERT( sal_False, "Cache overflow." );
+ return sal_False;
+ }
+
+ nPos = pObj->GetCachePos();
+ if ( pObj == pLast )
+ { ASSERT( pObj->GetPrev(), "Last but no Prev" );
+ pLast = pObj->GetPrev();
+ pLast->SetNext( 0 );
+ }
+ else
+ {
+ if ( pObj->GetPrev() )
+ pObj->GetPrev()->SetNext( pObj->GetNext() );
+ if ( pObj->GetNext() )
+ pObj->GetNext()->SetPrev( pObj->GetPrev() );
+ }
+ delete pObj;
+ *(pData + nPos) = pNew;
+ }
+ pNew->SetCachePos( nPos );
+
+ //Anstelle von ToTop, einfach als pFirst einfuegen.
+// ToTop( nPos );
+ if ( pFirst )
+ {
+ if ( pFirst->GetPrev() )
+ { pFirst->GetPrev()->SetNext( pNew );
+ pNew->SetPrev( pFirst->GetPrev() );
+ }
+ pFirst->SetPrev( pNew );
+ pNew->SetNext( pFirst );
+ }
+ else
+ { ASSERT( !pLast, "Last but no First." );
+ pLast = pNew;
+ }
+ if ( pFirst == pRealFirst )
+ pRealFirst = pNew;
+ pFirst = pNew;
+
+ CHECK;
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SwCache::SetLRUOfst()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+void SwCache::SetLRUOfst( const sal_uInt16 nOfst )
+{
+ if ( !pRealFirst || ((Count() - aFreePositions.Count()) < nOfst) )
+ return;
+
+ CHECK;
+ pFirst = pRealFirst;
+ for ( sal_uInt16 i = 0; i < Count() && i < nOfst; ++i )
+ {
+ if ( pFirst->GetNext() && pFirst->GetNext()->GetNext() )
+ pFirst = pFirst->GetNext();
+ else
+ break;
+ }
+ CHECK;
+}
+
+/*************************************************************************
+|*
+|* SwCacheObj::SwCacheObj()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 24. Nov. 95
+|*
+|*************************************************************************/
+
+
+SwCacheObj::SwCacheObj( const void *pOwn ) :
+ pNext( 0 ),
+ pPrev( 0 ),
+ nCachePos( USHRT_MAX ),
+ nLock( 0 ),
+ pOwner( pOwn )
+{
+}
+
+
+
+SwCacheObj::~SwCacheObj()
+{
+}
+
+/*************************************************************************
+|*
+|* SwCacheObj::SetLock(), Unlock()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+#ifdef DBG_UTIL
+
+
+
+void SwCacheObj::Lock()
+{
+ ASSERT( nLock < UCHAR_MAX, "To many Locks for CacheObject." );
+ ++nLock;
+}
+
+
+
+void SwCacheObj::Unlock()
+{
+ ASSERT( nLock, "No more Locks available." );
+ --nLock;
+}
+#endif
+
+
+SwCacheAccess::~SwCacheAccess()
+{
+ if ( pObj )
+ pObj->Unlock();
+}
+
+/*************************************************************************
+|*
+|* SwCacheAccess::Get()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 04. Apr. 95
+|*
+|*************************************************************************/
+
+
+void SwCacheAccess::_Get()
+{
+ ASSERT( !pObj, "SwCacheAcces Obj already available." );
+
+ pObj = NewObj();
+ if ( !rCache.Insert( pObj ) )
+ {
+ delete pObj;
+ pObj = 0;
+ }
+ else
+ pObj->Lock();
+}
+
+/*************************************************************************
+|*
+|* SwCacheAccess::IsAvailable()
+|*
+|* Ersterstellung MA 23. Mar. 94
+|* Letzte Aenderung MA 23. Mar. 94
+|*
+|*************************************************************************/
+
+
+sal_Bool SwCacheAccess::IsAvailable() const
+{
+ return pObj != 0;
+}
+
+
+
+
+
diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx
new file mode 100644
index 000000000000..701f7dbbd69c
--- /dev/null
+++ b/sw/source/core/bastyp/swrect.cxx
@@ -0,0 +1,336 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 DBG_UTIL
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#endif
+#include <stdlib.h>
+#include "swrect.hxx"
+#include <math.h>
+
+/*************************************************************************
+|*
+|* SwRect::SwRect()
+|*
+|* Ersterstellung MA 02. Feb. 93
+|* Letzte Aenderung MA 05. Sep. 93
+|*
+|*************************************************************************/
+
+
+
+SwRect::SwRect( const Rectangle &rRect ) :
+ m_Point( rRect.Left(), rRect.Top() )
+{
+ m_Size.setWidth(rRect.Right() == RECT_EMPTY ? 0 :
+ rRect.Right() - rRect.Left() +1);
+ m_Size.setHeight(rRect.Bottom() == RECT_EMPTY ? 0 :
+ rRect.Bottom() - rRect.Top() + 1);
+}
+
+/*************************************************************************
+|*
+|* SwRect::Center()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 27. Jan. 93
+|*
+|*************************************************************************/
+Point SwRect::Center() const
+{
+ return Point( Left() + Width() / 2,
+ Top() + Height() / 2 );
+
+/* Wer ruft schon ein Center auf ein "falsches" Rechteck?
+ const long nRight = Right();
+ const long nBottom= Bottom();
+ return Point( min( Left(), nRight ) + long(abs( (nRight - Left())/2) ),
+ min( Top(), nBottom) + long(abs( (nBottom - Top())/2)));
+*/
+}
+
+/*************************************************************************
+|*
+|* SwRect::Union()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 27. Jan. 93
+|*
+|*************************************************************************/
+
+
+
+SwRect& SwRect::Union( const SwRect& rRect )
+{
+ if ( Top() > rRect.Top() )
+ Top( rRect.Top() );
+ if ( Left() > rRect.Left() )
+ Left( rRect.Left() );
+ long n = rRect.Right();
+ if ( Right() < n )
+ Right( n );
+ n = rRect.Bottom();
+ if ( Bottom() < n )
+ Bottom( n );
+ return *this;
+}
+/*************************************************************************
+|*
+|* SwRect::Intersection(), _Intersection()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 05. Sep. 93
+|*
+|*************************************************************************/
+
+
+
+SwRect& SwRect::Intersection( const SwRect& rRect )
+{
+ //Hat das Teil ueberhaupt Gemeinsamkeiten mit mir?
+ if ( IsOver( rRect ) )
+ {
+ //Bestimmung der kleineren rechten sowie unteren und
+ // der groesseren linken sowie oberen Kante.
+ if ( Left() < rRect.Left() )
+ Left( rRect.Left() );
+ if ( Top() < rRect.Top() )
+ Top( rRect.Top() );
+ long n = rRect.Right();
+ if ( Right() > n )
+ Right( n );
+ n = rRect.Bottom();
+ if ( Bottom() > n )
+ Bottom( n );
+ }
+ else
+ //Def.: Bei einer leeren Intersection wird nur die SSize genullt.
+ SSize(0, 0);
+
+ return *this;
+}
+
+
+
+SwRect& SwRect::_Intersection( const SwRect& rRect )
+{
+ //Bestimmung der kleineren rechten sowie unteren und
+ // der groesseren linken sowie oberen Kante.
+ if ( Left() < rRect.Left() )
+ Left( rRect.Left() );
+ if ( Top() < rRect.Top() )
+ Top( rRect.Top() );
+ long n = rRect.Right();
+ if ( Right() > n )
+ Right( n );
+ n = rRect.Bottom();
+ if ( Bottom() > n )
+ Bottom( n );
+
+ return *this;
+}
+/*************************************************************************
+|*
+|* SwRect::IsInside()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 27. Jan. 93
+|*
+|*************************************************************************/
+
+
+
+sal_Bool SwRect::IsInside( const SwRect& rRect ) const
+{
+ const long nRight = Right();
+ const long nBottom = Bottom();
+ const long nrRight = rRect.Right();
+ const long nrBottom= rRect.Bottom();
+ return (Left() <= rRect.Left()) && (rRect.Left()<= nRight) &&
+ (Left() <= nrRight) && (nrRight <= nRight) &&
+ (Top() <= rRect.Top()) && (rRect.Top() <= nBottom) &&
+ (Top() <= nrBottom) && (nrBottom <= nBottom);
+}
+
+
+
+sal_Bool SwRect::IsInside( const Point& rPoint ) const
+{
+ return (Left() <= rPoint.X())
+ && (Top() <= rPoint.Y())
+ && (Right() >= rPoint.X())
+ && (Bottom()>= rPoint.Y());
+}
+/* -----------------------------11.04.00 15:46--------------------------------
+ mouse moving of table borders
+ ---------------------------------------------------------------------------*/
+sal_Bool SwRect::IsNear( const Point& rPoint, long nTolerance ) const
+{
+ return IsInside(rPoint) ||
+ (((Left() - nTolerance) <= rPoint.X())
+ && ((Top() - nTolerance) <= rPoint.Y())
+ && ((Right() + nTolerance) >= rPoint.X())
+ && ((Bottom() + nTolerance)>= rPoint.Y()));
+}
+
+/*************************************************************************
+|*
+|* SwRect::IsOver()
+|*
+|* Ersterstellung MA 25. Feb. 94
+|* Letzte Aenderung MA 27. Jun. 96
+|*
+|*************************************************************************/
+
+
+
+sal_Bool SwRect::IsOver( const SwRect& rRect ) const
+{
+ return (Top() <= rRect.Bottom())
+ && (Left() <= rRect.Right())
+ && (Right() >= rRect.Left())
+ && (Bottom()>= rRect.Top()) ? sal_True : sal_False;
+}
+
+/*************************************************************************
+|*
+|* SwRect::Justify()
+|*
+|* Ersterstellung MA 10. Oct. 94
+|* Letzte Aenderung MA 23. Oct. 96
+|*
+|*************************************************************************/
+
+
+
+void SwRect::Justify()
+{
+ if ( m_Size.getHeight() < 0 )
+ {
+ m_Point.Y() += m_Size.getHeight() + 1;
+ m_Size.setHeight(-m_Size.getHeight());
+ }
+ if ( m_Size.getWidth() < 0 )
+ {
+ m_Point.X() += m_Size.getWidth() + 1;
+ m_Size.setWidth(-m_Size.getWidth());
+ }
+}
+
+
+// Similiar to the inline methods, but we need the function pointers
+
+void SwRect::_Width( const long nNew ) { m_Size.setWidth(nNew); }
+void SwRect::_Height( const long nNew ) { m_Size.setHeight(nNew); }
+void SwRect::_Left( const long nLeft ){ m_Size.Width() += m_Point.getX() - nLeft; m_Point.setX(nLeft); }
+void SwRect::_Right( const long nRight ){ m_Size.setWidth(nRight - m_Point.getX()); }
+void SwRect::_Top( const long nTop ){ m_Size.Height() += m_Point.getY() - nTop; m_Point.setY(nTop); }
+void SwRect::_Bottom( const long nBottom ){ m_Size.setHeight(nBottom - m_Point.getY()); }
+
+long SwRect::_Width() const{ return m_Size.getWidth(); }
+long SwRect::_Height() const{ return m_Size.getHeight(); }
+long SwRect::_Left() const{ return m_Point.getX(); }
+long SwRect::_Right() const{ return m_Point.getX() + m_Size.getWidth(); }
+long SwRect::_Top() const{ return m_Point.getY(); }
+long SwRect::_Bottom() const{ return m_Point.getY() + m_Size.getHeight(); }
+
+void SwRect::AddWidth( const long nAdd ) { m_Size.Width() += nAdd; }
+void SwRect::AddHeight( const long nAdd ) { m_Size.Height() += nAdd; }
+void SwRect::SubLeft( const long nSub ){ m_Size.Width() += nSub; m_Point.X() -= nSub; }
+void SwRect::AddRight( const long nAdd ){ m_Size.Width() += nAdd; }
+void SwRect::SubTop( const long nSub ){ m_Size.Height() += nSub; m_Point.Y() -= nSub; }
+void SwRect::AddBottom( const long nAdd ){ m_Size.Height() += nAdd; }
+void SwRect::SetPosX( const long nNew ){ m_Point.setX(nNew); }
+void SwRect::SetPosY( const long nNew ){ m_Point.setY(nNew); }
+const Size SwRect::_Size() const { return SSize(); }
+const Size SwRect::SwappedSize() const { return Size( m_Size.getHeight(), m_Size.getWidth() ); }
+const Point SwRect::TopLeft() const { return Pos(); }
+const Point SwRect::TopRight() const { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() ); }
+const Point SwRect::BottomLeft() const { return Point( m_Point.getX(), m_Point.getY() + m_Size.getHeight() ); }
+const Point SwRect::BottomRight() const
+ { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() + m_Size.getHeight() ); }
+long SwRect::GetLeftDistance( long nLimit ) const { return m_Point.getX() - nLimit; }
+long SwRect::GetBottomDistance( long nLim ) const { return nLim - m_Point.getY() - m_Size.getHeight();}
+long SwRect::GetTopDistance( long nLimit ) const { return m_Point.getY() - nLimit; }
+long SwRect::GetRightDistance( long nLim ) const { return nLim - m_Point.getX() - m_Size.getWidth(); }
+sal_Bool SwRect::OverStepLeft( long nLimit ) const
+ { return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; }
+sal_Bool SwRect::OverStepBottom( long nLimit ) const
+ { return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; }
+sal_Bool SwRect::OverStepTop( long nLimit ) const
+ { return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; }
+sal_Bool SwRect::OverStepRight( long nLimit ) const
+ { return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; }
+void SwRect::SetLeftAndWidth( long nLeft, long nNew )
+{
+ m_Point.setX(nLeft);
+ m_Size.setWidth(nNew);
+}
+void SwRect::SetTopAndHeight( long nTop, long nNew )
+{
+ m_Point.setY(nTop);
+ m_Size.setHeight(nNew);
+}
+void SwRect::SetRightAndWidth( long nRight, long nNew )
+{
+ m_Point.setX(nRight - nNew);
+ m_Size.setWidth(nNew);
+}
+void SwRect::SetBottomAndHeight( long nBottom, long nNew )
+{
+ m_Point.setY(nBottom - nNew);
+ m_Size.setHeight(nNew);
+}
+void SwRect::SetUpperLeftCorner( const Point& rNew )
+ { m_Point = rNew; }
+void SwRect::SetUpperRightCorner( const Point& rNew )
+ { m_Point = Point(rNew.nA - m_Size.getWidth(), rNew.nB); }
+void SwRect::SetLowerLeftCorner( const Point& rNew )
+ { m_Point = Point(rNew.nA, rNew.nB - m_Size.getHeight()); }
+
+#ifdef DBG_UTIL
+/*************************************************************************
+ * operator<<( ostream&, SwRect&)
+ *************************************************************************/
+
+
+
+SvStream &operator<<( SvStream &rStream, const SwRect &rRect )
+{
+ rStream << '[' << rRect.Top() << '/' << rRect.Left()
+ << ',' << rRect.Width() << 'x' << rRect.Height() << "] ";
+ return rStream;
+}
+#endif
+
+
diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx
new file mode 100644
index 000000000000..e2b4829b563c
--- /dev/null
+++ b/sw/source/core/bastyp/swregion.cxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <tools/debug.hxx>
+#include "swtypes.hxx"
+#include "swrect.hxx"
+#include "swregion.hxx"
+
+
+SV_IMPL_VARARR( SwRects, SwRect );
+
+/*************************************************************************
+|*
+|* SwRegionRects::SwRegionRects()
+|*
+|* Ersterstellung MA 28. Oct. 92
+|* Letzte Aenderung MA 01. Feb. 93
+|*
+|*************************************************************************/
+
+SwRegionRects::SwRegionRects( const SwRect &rStartRect, sal_uInt16 nInit,
+ sal_uInt16 nGrow ) :
+ SwRects( (sal_uInt8)nInit, (sal_uInt8)nGrow ),
+ aOrigin( rStartRect )
+{
+ Insert( aOrigin, 0 );
+}
+
+/*************************************************************************
+ * inline InsertRect()
+ *
+ * InsertRect() wird nur von operator-=() gerufen.
+ * Wenn bDel == sal_True ist, dann wird das Rect an der Position nPos mit
+ * rRect ueberschrieben, ansonsten wird rRect hinten angehaengt.
+ *************************************************************************/
+
+inline void SwRegionRects::InsertRect( const SwRect &rRect, const sal_uInt16 nPos,
+ sal_Bool &rDel )
+{
+ if( rDel )
+ {
+ pData = (SwRect*)pData; // looks weird but seems to help gcc ->i78417
+ *(pData+nPos) = rRect;
+ rDel = sal_False;
+ }
+ else
+ Insert( rRect, Count() );
+}
+
+/*************************************************************************
+|*
+|* SwRegionRects::operator-=()
+|*
+|* Beschreibung Alle Ueberschneidungen der Rechtecke, die sich
+|* gerade im Array befinden, mit dem uebergebenen Rechteck werden
+|* entfernt.
+|* Dazu muessen die vorhandenen Rechtecke entweder aufgeteilt oder
+|* geloescht werden.
+|* Ersterstellung MA 28. Oct. 92
+|* Letzte Aenderung MA 09. Sep. 93
+|*
+|*************************************************************************/
+
+void SwRegionRects::operator-=( const SwRect &rRect )
+{
+ sal_uInt16 nMax = Count();
+ for ( sal_uInt16 i = 0; i < nMax; ++i )
+ {
+ if ( rRect.IsOver( *(pData+i) ) )
+ {
+ SwRect aTmp( *(pData+i) );
+ SwRect aInter( aTmp );
+ aInter._Intersection( rRect );
+
+ // Das erste Rect, das wir inserten wollen, nimmt die
+ // Stelle von i ein. So ersparen wir uns das Delete().
+ sal_Bool bDel = sal_True;
+
+ //Jetzt aufteilen das Teil: Es sollen diejenigen Rechtecke
+ //zurueckbleiben, die im alten aber nicht im neuen liegen.
+ //Sprich alle Rechtecke die im alten aber nicht in der Intersection
+ //liegen.
+ long nTmp;
+ if ( 0 < (nTmp = aInter.Top() - aTmp.Top()) )
+ {
+ const long nOldVal = aTmp.Height();
+ aTmp.Height(nTmp);
+ InsertRect( aTmp, i, bDel );
+ aTmp.Height( nOldVal );
+ }
+
+ aTmp.Top( aInter.Top() + aInter.Height() );
+ if ( aTmp.Height() > 0 )
+ InsertRect( aTmp, i, bDel );
+
+ aTmp.Top( aInter.Top() );
+ aTmp.Bottom( aInter.Bottom() );
+ if ( 0 < (nTmp = aInter.Left() - aTmp.Left()) )
+ {
+ const long nOldVal = aTmp.Width();
+ aTmp.Width( nTmp );
+ InsertRect( aTmp, i, bDel );
+ aTmp.Width( nOldVal );
+ }
+
+ aTmp.Left( aInter.Left() + aInter.Width() ); //+1?
+ if ( aTmp.Width() > 0 )
+ InsertRect( aTmp, i, bDel );
+
+ if( bDel )
+ {
+ Remove( i );
+ --i; //Damit wir keinen uebergehen.
+ --nMax; //Damit wir keinen zuviel verarbeiten.
+ }
+ }
+ }
+
+}
+
+/*************************************************************************
+ * SwRegionRects::Invert()
+ *
+ * Bezugspunkt ist aOrigin, das Original-SRectangle.
+ * Aus Loechern werden Flaechen, aus Flaechen werden Loecher.
+ * Ein Hinweis: Wenn keine Rects abgezogen wurden, so ist das enthaltene
+ * Rechteck identisch mit aOrigin. Nach Invert() besteht die Region aus
+ * einem Null-SRectangle.
+ *************************************************************************/
+
+void SwRegionRects::Invert()
+{
+ // Nicht besonders elegant und schnell, aber wirkungsvoll:
+ // Wir legen eine weitere Region an und ziehen alle Flaechen ab,
+ // die in uns noch uebrig geblieben sind. Danach werden alle
+ // Werte uebertragen.
+
+ // Um unuetze Speicheranforderungen zu vermeiden versuchen wir die
+ // iniale Groesse moeglichst brauchbar anzulegen:
+ // Anzahl der Rechtecke in der Region * 2 + 2
+ // plus zwei um den Sonderfall eines einzelnen Loches (macht vier
+ // Rechtecke im inversen Fall) abzudecken.
+
+ SwRegionRects aInvRegion( aOrigin, Count()*2+2 );
+ const SwRect *pDat = GetData();
+ for( sal_uInt16 i = 0; i < Count(); ++pDat, ++i )
+ aInvRegion -= *pDat;
+
+ sal_uInt16 nCpy = Count(), nDel = 0;
+ if( aInvRegion.Count() < Count() )
+ {
+ nDel = Count() - aInvRegion.Count();
+ nCpy = aInvRegion.Count();
+ }
+ // alle vorhandenen ueberschreiben
+ memcpy( pData, aInvRegion.GetData(), nCpy * sizeof( SwRect ));
+
+ if( nCpy < aInvRegion.Count() )
+ Insert( &aInvRegion, nCpy, nCpy );
+ else if( nDel )
+ Remove( nCpy, nDel );
+}
+/*************************************************************************
+|*
+|* SwRegionRects::Compress()
+|*
+|* Beschreibung Zusammenfassen von benachbarten Rechtecken.
+|* Ersterstellung MA 16. Apr. 93
+|* Letzte Aenderung MA 21. Apr. 93
+|*
+|*************************************************************************/
+inline SwTwips CalcArea( const SwRect &rRect )
+{
+ return rRect.Width() * rRect.Height();
+}
+
+
+void SwRegionRects::Compress( sal_Bool bFuzzy )
+{
+ for ( int i = 0; i < Count(); ++i )
+ {
+ for ( int j = i+1; j < Count(); ++j )
+ {
+ //Wenn zwei Rechtecke ineinanderliegen, so ist eins davon
+ //uberfluessig.
+ if ( (*(pData + i)).IsInside( *(pData + j) ) )
+ {
+ Remove( static_cast<sal_uInt16>(j), 1 );
+ --j;
+ }
+ else if ( (*(pData + j)).IsInside( *(pData + i) ) )
+ {
+ *(pData + i) = *(pData + j);
+ Remove( static_cast<sal_uInt16>(j), 1 );
+ i = -1;
+ break;
+ }
+ else
+ {
+ //Wenn zwei Rechtecke dieselbe Flaeche haben wie deren
+ //Union abzueglich deren Intersection, so ist eines
+ //davon ueberfluessig.
+ //Um moeglichst viel zusammenzufassen und in der Folge
+ //moeglichst wenig einzelne Paints zu haben darf die Flaeche
+ //der Union ruhig ein bischen groesser sein
+ //( 9622 * 141.5 = 1361513 ~= ein virtel Zentimeter ueber die
+ // Breite einer DINA4 Seite)
+ const long nFuzzy = bFuzzy ? 1361513 : 0;
+ SwRect aUnion( *(pData + i) );aUnion.Union( *(pData + j) );
+ SwRect aInter( *(pData + i) );aInter.Intersection( *(pData + j));
+ if ( (::CalcArea( *(pData + i) ) +
+ ::CalcArea( *(pData + j) ) + nFuzzy) >=
+ (::CalcArea( aUnion ) - CalcArea( aInter )) )
+ {
+ *(pData + i) = aUnion;
+ Remove( static_cast<sal_uInt16>(j), 1 );
+ i = -1;
+ break;
+ }
+ }
+ }
+ }
+}
+
diff --git a/sw/source/core/bastyp/swtypes.cxx b/sw/source/core/bastyp/swtypes.cxx
new file mode 100644
index 000000000000..3015d8cf4b44
--- /dev/null
+++ b/sw/source/core/bastyp/swtypes.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "swtypes.hxx"
+#include "tools/string.hxx"
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/graph.hxx>
+#include <editeng/unolingu.hxx>
+#include <pagefrm.hxx>
+#include <swatrset.hxx>
+#include <frmfmt.hxx>
+#include <frmtool.hxx>
+#include <ndtxt.hxx>
+#include <UndoDelete.hxx>
+#include <UndoInsert.hxx>
+#include <swtable.hxx>
+#include <viscrs.hxx>
+#include <fntcache.hxx>
+#include <swfntcch.hxx>
+#include <hffrm.hxx>
+#include <colfrm.hxx>
+#include <bodyfrm.hxx>
+#include <tabfrm.hxx>
+#include <txtfrm.hxx>
+#include <swtblfmt.hxx>
+#include <rowfrm.hxx>
+#include <cellfrm.hxx>
+#include <sectfrm.hxx>
+
+using namespace com::sun::star;
+
+ByteString aEmptyByteStr; // Konstante Strings
+String aEmptyStr; // Konstante Strings
+String aDotStr('.'); // Konstante Strings
+
+IMPL_FIXEDMEMPOOL_NEWDEL( SwAttrSet, 25, 25 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwStartNode, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwEndNode, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTableBox, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwUndoDelete, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwUndoInsert, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwPaM, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwCursor, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwShellCrsr, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTxtNode, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwpHints, 25, 25 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwFntObj, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwFontObj, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwBorderAttrs, 100, 100 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwCellFrm, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwRowFrm, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwColumnFrm, 40, 40 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwSectionFrm, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTabFrm, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwPageFrm, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwBodyFrm, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwHeaderFrm, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwFooterFrm, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTxtFrm, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTableFmt, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTableLineFmt, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTableBoxFmt, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( _SwCursor_SavePos, 20, 20 )
+
+
+Size GetGraphicSizeTwip( const Graphic& rGraphic, OutputDevice* pOutDev )
+{
+ const MapMode aMapTwip( MAP_TWIP );
+ Size aSize( rGraphic.GetPrefSize() );
+ if( MAP_PIXEL == rGraphic.GetPrefMapMode().GetMapUnit() )
+ {
+ if( !pOutDev )
+ pOutDev = Application::GetDefaultDevice();
+ aSize = pOutDev->PixelToLogic( aSize, aMapTwip );
+ }
+ else
+ aSize = OutputDevice::LogicToLogic( aSize,
+ rGraphic.GetPrefMapMode(), aMapTwip );
+ return aSize;
+}
+
+
+uno::Reference< linguistic2::XSpellChecker1 > GetSpellChecker()
+{
+ return LinguMgr::GetSpellChecker();
+}
+
+
+uno::Reference< linguistic2::XHyphenator > GetHyphenator()
+{
+ return LinguMgr::GetHyphenator();
+}
+
+
+uno::Reference< linguistic2::XThesaurus > GetThesaurus()
+{
+ return LinguMgr::GetThesaurus();
+}
+
+
+uno::Reference< beans::XPropertySet > GetLinguPropertySet()
+{
+ return LinguMgr::GetLinguPropertySet();
+}
+
+
diff --git a/sw/source/core/bastyp/tabcol.cxx b/sw/source/core/bastyp/tabcol.cxx
new file mode 100644
index 000000000000..bf5b4b06084f
--- /dev/null
+++ b/sw/source/core/bastyp/tabcol.cxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "tabcol.hxx"
+#include <errhdl.hxx> // fuer Create-Methoden
+
+
+SwTabCols::SwTabCols( sal_uInt16 nSize ) :
+ nLeftMin( 0 ),
+ nLeft( 0 ),
+ nRight( 0 ),
+ nRightMax( 0 ),
+ bLastRowAllowedToChange( true )
+{
+ if ( nSize )
+ aData.reserve( nSize );
+}
+
+SwTabCols::SwTabCols( const SwTabCols& rCpy ) :
+ nLeftMin( rCpy.GetLeftMin() ),
+ nLeft( rCpy.GetLeft() ),
+ nRight( rCpy.GetRight() ),
+ nRightMax( rCpy.GetRightMax() ),
+ bLastRowAllowedToChange( rCpy.IsLastRowAllowedToChange() ),
+ aData( rCpy.GetData() )
+{
+#if OSL_DEBUG_LEVEL > 1
+ for ( sal_uInt16 i = 0; i < Count(); ++i )
+ {
+ SwTabColsEntry aEntry1 = aData[i];
+ SwTabColsEntry aEntry2 = rCpy.GetData()[i];
+ (void) aEntry1;
+ (void) aEntry2;
+ ASSERT( aEntry1.nPos == aEntry2.nPos &&
+ aEntry1.nMin == aEntry2.nMin &&
+ aEntry1.nMax == aEntry2.nMax &&
+ aEntry1.bHidden == aEntry2.bHidden,
+ "CopyContructor of SwTabColsEntries did not succeed!" )
+ }
+#endif
+}
+
+SwTabCols &SwTabCols::operator=( const SwTabCols& rCpy )
+{
+ nLeftMin = rCpy.GetLeftMin();
+ nLeft = rCpy.GetLeft();
+ nRight = rCpy.GetRight();
+ nRightMax= rCpy.GetRightMax();
+ bLastRowAllowedToChange = rCpy.IsLastRowAllowedToChange();
+
+ Remove( 0, Count() );
+ aData = rCpy.GetData();
+
+ return *this;
+}
+
+sal_Bool SwTabCols::operator==( const SwTabCols& rCmp ) const
+{
+ sal_uInt16 i;
+
+ if ( !(nLeftMin == rCmp.GetLeftMin() &&
+ nLeft == rCmp.GetLeft() &&
+ nRight == rCmp.GetRight() &&
+ nRightMax== rCmp.GetRightMax()&&
+ bLastRowAllowedToChange== rCmp.IsLastRowAllowedToChange() &&
+ Count()== rCmp.Count()) )
+ return sal_False;
+
+ for ( i = 0; i < Count(); ++i )
+ {
+ SwTabColsEntry aEntry1 = aData[i];
+ SwTabColsEntry aEntry2 = rCmp.GetData()[i];
+ if ( aEntry1.nPos != aEntry2.nPos || aEntry1.bHidden != aEntry2.bHidden )
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+void SwTabCols::Insert( long nValue, long nMin, long nMax, sal_Bool bValue, sal_uInt16 nPos )
+{
+ SwTabColsEntry aEntry;
+ aEntry.nPos = nValue;
+ aEntry.nMin = nMin;
+ aEntry.nMax = nMax;
+ aEntry.bHidden = bValue;
+ aData.insert( aData.begin() + nPos, aEntry );
+}
+
+void SwTabCols::Insert( long nValue, sal_Bool bValue, sal_uInt16 nPos )
+{
+ SwTabColsEntry aEntry;
+ aEntry.nPos = nValue;
+ aEntry.nMin = 0;
+ aEntry.nMax = LONG_MAX;
+ aEntry.bHidden = bValue;
+ aData.insert( aData.begin() + nPos, aEntry );
+
+#if OSL_DEBUG_LEVEL > 1
+ SwTabColsEntries::iterator aPos = aData.begin();
+ for ( ; aPos != aData.end(); ++aPos )
+ {
+ aEntry =(*aPos);
+ }
+#endif
+}
+
+void SwTabCols::Remove( sal_uInt16 nPos, sal_uInt16 nAnz )
+{
+ SwTabColsEntries::iterator aStart = aData.begin() + nPos;
+ aData.erase( aStart, aStart + nAnz );
+}
+
diff --git a/sw/source/core/crsr/BlockCursor.cxx b/sw/source/core/crsr/BlockCursor.cxx
new file mode 100644
index 000000000000..589549c0ade8
--- /dev/null
+++ b/sw/source/core/crsr/BlockCursor.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <IBlockCursor.hxx>
+#include <viscrs.hxx>
+#include "BlockCursor.hxx"
+
+/** The implementation of the block cursor interface
+
+ It's simply an aggregation of a SwShellCrsr and a rectangle defined by
+ a start and an end point.
+*/
+class SwBlockCursor : public IBlockCursor
+{
+ SwShellCrsr aCursor;
+ Point *pStartPt;
+ Point *pEndPt;
+public:
+ SwBlockCursor( const SwCrsrShell& rCrsrSh, const SwPosition &rPos ) :
+ aCursor( rCrsrSh, rPos ), pStartPt(0), pEndPt(0) {}
+ virtual SwShellCrsr& getShellCrsr();
+ virtual void setStartPoint( const Point &rPt );
+ virtual void setEndPoint( const Point &rPt );
+ virtual const Point* getStartPoint() const;
+ virtual const Point* getEndPoint() const;
+ virtual void clearPoints();
+ virtual ~SwBlockCursor();
+};
+
+SwBlockCursor::~SwBlockCursor()
+{
+ delete pStartPt;
+ delete pEndPt;
+}
+
+SwShellCrsr& SwBlockCursor::getShellCrsr()
+{
+ return aCursor;
+}
+
+void SwBlockCursor::setStartPoint( const Point &rPt )
+{
+ if( pStartPt )
+ *pStartPt = rPt;
+ else
+ pStartPt = new Point( rPt );
+}
+
+void SwBlockCursor::setEndPoint( const Point &rPt )
+{
+ if( pEndPt )
+ *pEndPt = rPt;
+ else
+ pEndPt = new Point( rPt );
+}
+
+const Point* SwBlockCursor::getStartPoint() const
+{
+ return pStartPt;
+}
+
+const Point* SwBlockCursor::getEndPoint() const
+{
+ return pEndPt;
+}
+
+void SwBlockCursor::clearPoints()
+{
+ delete pStartPt;
+ delete pEndPt;
+ pStartPt = 0;
+ pEndPt = 0;
+}
+
+IBlockCursor *createBlockCursor( const SwCrsrShell& rCrsrSh, const SwPosition &rPos )
+{
+ return new SwBlockCursor( rCrsrSh, rPos );
+}
+
diff --git a/sw/source/core/crsr/BlockCursor.hxx b/sw/source/core/crsr/BlockCursor.hxx
new file mode 100644
index 000000000000..a3acb0bac187
--- /dev/null
+++ b/sw/source/core/crsr/BlockCursor.hxx
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _BLOCKCURSOR_HXX
+#define _BLOCKCURSOR_HXX
+
+class IBlockCursor;
+class SwCrsrShell;
+struct SwPosition;
+
+IBlockCursor *createBlockCursor(const SwCrsrShell& rCrsrSh, const SwPosition &rPos);
+
+#endif //_BLOCKURSOR_HXX
diff --git a/sw/source/core/crsr/IBlockCursor.hxx b/sw/source/core/crsr/IBlockCursor.hxx
new file mode 100644
index 000000000000..99b5cf3b734a
--- /dev/null
+++ b/sw/source/core/crsr/IBlockCursor.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 IBLOCKCURSOR_HXX_INCLUDED
+#define IBLOCKCURSOR_HXX_INCLUDED
+
+class SwShellCrsr;
+class Point;
+
+ /** Access to the block cursor
+
+ A block cursor contains a SwShellCrsr and additional information about
+ the rectangle which has been created by pressing the mouse button and
+ moving the mouse.
+ This interface provides access to the SwShellCrsr and to start and end
+ point of the mouse movement.
+ */
+ class IBlockCursor
+ {
+ public:
+/** Access to the shell cursor
+
+ @return SwShellCrsr& which represents the start and end position of the
+ current block selection
+*/
+ virtual SwShellCrsr& getShellCrsr() = 0;
+
+/** Defines the starting vertex of the block selection
+
+ @param rPt
+ rPt should contain the document coordinates of the mouse cursor when
+ the block selection starts (MouseButtonDown)
+*/
+ virtual void setStartPoint( const Point &rPt ) = 0;
+
+/** Defines the ending vertex of the block selection
+
+ @param rPt
+ rPt should contain the document coordinates of the mouse cursor when
+ the block selection has started and the mouse has been moved (MouseMove)
+*/
+ virtual void setEndPoint( const Point &rPt ) = 0;
+
+/** The document coordinates where the block selection has been started
+
+ @return 0, if no start point has been set
+*/
+ virtual const Point* getStartPoint() const = 0;
+
+
+/** The document coordinates where the block selection ends (at the moment)
+
+ @return 0, if no end point has been set
+*/
+ virtual const Point* getEndPoint() const = 0;
+
+/** Deletion of the mouse created rectangle
+
+ When start and end points exist, the block cursor depends on this. If the
+ cursor is moved by cursor keys (e.g. up/down, home/end) the mouse rectangle
+ is obsolet and has to be deleted.
+*/
+ virtual void clearPoints() = 0;
+
+/** Destructor of the block curosr interface
+*/
+ virtual ~IBlockCursor() {};
+ };
+
+#endif // IBLOCKCURSOR_HXX_INCLUDED
+
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
new file mode 100644
index 000000000000..5b6d5701ed62
--- /dev/null
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -0,0 +1,348 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <bookmrk.hxx>
+#include <IDocumentMarkAccess.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <doc.hxx>
+#include <errhdl.hxx>
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <swserv.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <swtypes.hxx>
+#include <UndoBookmark.hxx>
+#include <unobookmark.hxx>
+#include <rtl/random.h>
+#include <xmloff/odffields.hxx>
+
+
+SV_IMPL_REF( SwServerObject )
+
+using namespace ::sw::mark;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace
+{
+ static void lcl_FixPosition(SwPosition& rPos)
+ {
+ // make sure the position has 1) the proper node, and 2) a proper index
+ SwTxtNode* pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+ if(pTxtNode == NULL && rPos.nContent.GetIndex() > 0)
+ {
+ OSL_TRACE(
+ "bookmrk.cxx::lcl_FixPosition"
+ " - illegal position: %d without proper TxtNode", rPos.nContent.GetIndex());
+ rPos.nContent.Assign(NULL, 0);
+ }
+ else if(pTxtNode != NULL && rPos.nContent.GetIndex() > pTxtNode->Len())
+ {
+ OSL_TRACE(
+ "bookmrk.cxx::lcl_FixPosition"
+ " - illegal position: %d is beyond %d", rPos.nContent.GetIndex(), pTxtNode->Len());
+ rPos.nContent.Assign(pTxtNode, pTxtNode->Len());
+ }
+ };
+
+ static void lcl_AssureFieldMarksSet(Fieldmark* const pField,
+ SwDoc* const io_pDoc,
+ const sal_Unicode aStartMark,
+ const sal_Unicode aEndMark)
+ {
+ SwPosition& rStart = pField->GetMarkStart();
+ SwPosition& rEnd = pField->GetMarkEnd();
+ SwTxtNode const*const pStartTxtNode =
+ rStart.nNode.GetNode().GetTxtNode();
+ SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode();
+ const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex());
+ const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar(rEnd.nContent.GetIndex()-1);
+ SwPaM aStartPaM(rStart);
+ SwPaM aEndPaM(rEnd);
+ io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, NULL);
+ if(ch_start != aStartMark)
+ {
+ io_pDoc->InsertString(aStartPaM, aStartMark);
+ }
+ if ( aEndMark && ( ch_end != aEndMark ) && ( rStart != rEnd ) )
+ {
+ io_pDoc->InsertString(aEndPaM, aEndMark);
+ }
+ io_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_UI_REPLACE, NULL);
+ };
+}
+
+namespace sw { namespace mark
+{
+ MarkBase::MarkBase(const SwPaM& aPaM,
+ const ::rtl::OUString& rName)
+ : SwModify(0)
+ , m_pPos1(new SwPosition(*(aPaM.GetPoint())))
+ , m_aName(rName)
+ {
+ lcl_FixPosition(*m_pPos1);
+ if(aPaM.HasMark())
+ {
+ MarkBase::SetOtherMarkPos(*(aPaM.GetMark()));
+ lcl_FixPosition(*m_pPos2);
+ }
+ }
+
+ bool MarkBase::IsCoveringPosition(const SwPosition& rPos) const
+ {
+ return GetMarkStart() <= rPos && rPos <= GetMarkEnd();
+ }
+
+ void MarkBase::SetMarkPos(const SwPosition& rNewPos)
+ {
+ ::boost::scoped_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos1);
+ //lcl_FixPosition(*m_pPos1);
+ }
+
+ void MarkBase::SetOtherMarkPos(const SwPosition& rNewPos)
+ {
+ ::boost::scoped_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos2);
+ //lcl_FixPosition(*m_pPos2);
+ }
+
+ rtl::OUString MarkBase::ToString( ) const
+ {
+ rtl::OUStringBuffer buf;
+ buf.appendAscii( "Mark: ( Name, [ Node1, Index1 ] ): ( " );
+ buf.append( m_aName ).appendAscii( ", [ " );
+ buf.append( sal_Int32( GetMarkPos().nNode.GetIndex( ) ) ).appendAscii( ", " );
+ buf.append( sal_Int32( GetMarkPos().nContent.GetIndex( ) ) ).appendAscii( " ] )" );
+
+ return buf.makeStringAndClear( );
+ }
+
+ MarkBase::~MarkBase()
+ { }
+
+ ::rtl::OUString MarkBase::GenerateNewName(const ::rtl::OUString& rPrefix)
+ {
+ static rtlRandomPool aPool = rtl_random_createPool();
+ static ::rtl::OUString sUniquePostfix;
+ static sal_Int32 nCount = SAL_MAX_INT32;
+ ::rtl::OUStringBuffer aResult(rPrefix);
+ if(nCount == SAL_MAX_INT32)
+ {
+ sal_Int32 nRandom;
+ ::rtl::OUStringBuffer sUniquePostfixBuffer;
+ rtl_random_getBytes(aPool, &nRandom, sizeof(nRandom));
+ sUniquePostfix = ::rtl::OUStringBuffer(13).appendAscii("_").append(static_cast<sal_Int32>(abs(nRandom))).makeStringAndClear();
+ nCount = 0;
+ }
+ // putting the counter in front of the random parts will speed up string comparisons
+ return aResult.append(nCount++).append(sUniquePostfix).makeStringAndClear();
+ }
+
+
+ void MarkBase::Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew )
+ {
+ NotifyClients(pOld, pNew);
+ if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
+ { // invalidate cached uno object
+ SetXBookmark(uno::Reference<text::XTextContent>(0));
+ }
+ }
+
+
+ NavigatorReminder::NavigatorReminder(const SwPaM& rPaM)
+ : MarkBase(rPaM, our_sNamePrefix)
+ { }
+
+ const ::rtl::OUString NavigatorReminder::our_sNamePrefix = ::rtl::OUString::createFromAscii("__NavigatorReminder__");
+
+ UnoMark::UnoMark(const SwPaM& aPaM)
+ : MarkBase(aPaM, MarkBase::GenerateNewName(our_sNamePrefix))
+ { }
+
+ const ::rtl::OUString UnoMark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__UnoMark__");
+
+ DdeBookmark::DdeBookmark(const SwPaM& aPaM)
+ : MarkBase(aPaM, MarkBase::GenerateNewName(our_sNamePrefix))
+ , m_aRefObj(NULL)
+ { }
+
+ void DdeBookmark::SetRefObject(SwServerObject* pObj)
+ {
+ m_aRefObj = pObj;
+ }
+
+ const ::rtl::OUString DdeBookmark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__DdeLink__");
+
+ void DdeBookmark::DeregisterFromDoc(SwDoc* const pDoc)
+ {
+ if(m_aRefObj.Is())
+ pDoc->GetLinkManager().RemoveServer(m_aRefObj);
+ }
+
+ DdeBookmark::~DdeBookmark()
+ {
+ if( m_aRefObj.Is() )
+ {
+ if(m_aRefObj->HasDataLinks())
+ {
+ ::sfx2::SvLinkSource* p = &m_aRefObj;
+ p->SendDataChanged();
+ }
+ m_aRefObj->SetNoServer();
+ }
+ }
+
+ Bookmark::Bookmark(const SwPaM& aPaM,
+ const KeyCode& rCode,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rShortName)
+ : DdeBookmark(aPaM)
+ , ::sfx2::Metadatable()
+ , m_aCode(rCode)
+ , m_sShortName(rShortName)
+ {
+ m_aName = rName;
+ }
+
+ void Bookmark::InitDoc(SwDoc* const io_pDoc)
+ {
+ if (io_pDoc->GetIDocumentUndoRedo().DoesUndo())
+ {
+ io_pDoc->GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoInsBookmark(*this));
+ }
+ io_pDoc->SetModified();
+ }
+
+ // ::sfx2::Metadatable
+ ::sfx2::IXmlIdRegistry& Bookmark::GetRegistry()
+ {
+ SwDoc *const pDoc( GetMarkPos().GetDoc() );
+ OSL_ENSURE(pDoc, "Bookmark::MakeUnoObject: no doc?");
+ return pDoc->GetXmlIdRegistry();
+ }
+
+ bool Bookmark::IsInClipboard() const
+ {
+ SwDoc *const pDoc( GetMarkPos().GetDoc() );
+ OSL_ENSURE(pDoc, "Bookmark::IsInClipboard: no doc?");
+ return pDoc->IsClipBoard();
+ }
+
+ bool Bookmark::IsInUndo() const
+ {
+ return false;
+ }
+
+ bool Bookmark::IsInContent() const
+ {
+ SwDoc *const pDoc( GetMarkPos().GetDoc() );
+ OSL_ENSURE(pDoc, "Bookmark::IsInContent: no doc?");
+ return !pDoc->IsInHeaderFooter( SwNodeIndex(GetMarkPos().nNode) );
+ }
+
+ uno::Reference< rdf::XMetadatable > Bookmark::MakeUnoObject()
+ {
+ // create new SwXBookmark
+ SwDoc *const pDoc( GetMarkPos().GetDoc() );
+ OSL_ENSURE(pDoc, "Bookmark::MakeUnoObject: no doc?");
+ const uno::Reference< rdf::XMetadatable> xMeta(
+ SwXBookmark::CreateXBookmark(*pDoc, *this), uno::UNO_QUERY);
+ return xMeta;
+ }
+
+
+ Fieldmark::Fieldmark(const SwPaM& rPaM)
+ : MarkBase(rPaM, MarkBase::GenerateNewName(our_sNamePrefix))
+ {
+ if(!IsExpanded())
+ SetOtherMarkPos(GetMarkPos());
+ }
+
+ rtl::OUString Fieldmark::ToString( ) const
+ {
+ rtl::OUStringBuffer buf;
+ buf.appendAscii( "Fieldmark: ( Name, Type, [ Nd1, Id1 ], [ Nd2, Id2 ] ): ( " );
+ buf.append( m_aName ).appendAscii( ", " );
+ buf.append( m_aFieldname ).appendAscii( ", [ " );
+ buf.append( sal_Int32( GetMarkPos().nNode.GetIndex( ) ) ).appendAscii( ", " );
+ buf.append( sal_Int32( GetMarkPos( ).nContent.GetIndex( ) ) ).appendAscii( " ], [" );
+ buf.append( sal_Int32( GetOtherMarkPos().nNode.GetIndex( ) ) ).appendAscii( ", " );
+ buf.append( sal_Int32( GetOtherMarkPos( ).nContent.GetIndex( ) ) ).appendAscii( " ] ) " );
+
+ return buf.makeStringAndClear( );
+ }
+
+ void Fieldmark::Invalidate( )
+ {
+ // @TODO: Does exist a better solution to trigger a format of the
+ // fieldmark portion? If yes, please use it.
+ SwPaM aPaM( this->GetMarkPos(), this->GetOtherMarkPos() );
+ aPaM.InvalidatePaM();
+ }
+
+ const ::rtl::OUString Fieldmark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__Fieldmark__");
+
+ TextFieldmark::TextFieldmark(const SwPaM& rPaM)
+ : Fieldmark(rPaM)
+ { }
+
+ void TextFieldmark::InitDoc(SwDoc* const io_pDoc)
+ {
+ lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ }
+
+ CheckboxFieldmark::CheckboxFieldmark(const SwPaM& rPaM)
+ : Fieldmark(rPaM)
+ { }
+
+ void CheckboxFieldmark::InitDoc(SwDoc* const io_pDoc)
+ {
+ lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FORMELEMENT, CH_TXT_ATR_FIELDEND);
+
+ // For some reason the end mark is moved from 1 by the Insert: we don't
+ // want this for checkboxes
+ this->GetMarkEnd( ).nContent--;
+ }
+ void CheckboxFieldmark::SetChecked(bool checked)
+ {
+ (*GetParameters())[::rtl::OUString::createFromAscii(ODF_FORMCHECKBOX_RESULT)] = makeAny(checked);
+ }
+
+ bool CheckboxFieldmark::IsChecked() const
+ {
+ bool bResult = false;
+ parameter_map_t::const_iterator pResult = GetParameters()->find(::rtl::OUString::createFromAscii(ODF_FORMCHECKBOX_RESULT));
+ if(pResult != GetParameters()->end())
+ pResult->second >>= bResult;
+ return bResult;
+ }
+
+}}
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
new file mode 100644
index 000000000000..8b5bf2fc5a46
--- /dev/null
+++ b/sw/source/core/crsr/callnk.cxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
+#include <com/sun/star/i18n/ScriptType.hdl>
+#endif
+#include <fmtcntnt.hxx>
+#include <txatbase.hxx>
+#include <frmatr.hxx>
+#include <viscrs.hxx>
+#include <callnk.hxx>
+#include <crsrsh.hxx>
+#include <doc.hxx>
+#include <frmfmt.hxx>
+#include <txtfrm.hxx>
+#include <ndtxt.hxx>
+#include <flyfrm.hxx>
+#include <breakit.hxx>
+
+
+SwCallLink::SwCallLink( SwCrsrShell & rSh, sal_uLong nAktNode, xub_StrLen nAktCntnt,
+ sal_uInt8 nAktNdTyp, long nLRPos, bool bAktSelection )
+ : rShell( rSh ), nNode( nAktNode ), nCntnt( nAktCntnt ),
+ nNdTyp( nAktNdTyp ), nLeftFrmPos( nLRPos ),
+ bHasSelection( bAktSelection )
+{
+}
+
+
+SwCallLink::SwCallLink( SwCrsrShell & rSh )
+ : rShell( rSh )
+{
+ // SPoint-Werte vom aktuellen Cursor merken
+ SwPaM* pCrsr = rShell.IsTableMode() ? rShell.GetTblCrs() : rShell.GetCrsr();
+ SwNode& rNd = pCrsr->GetPoint()->nNode.GetNode();
+ nNode = rNd.GetIndex();
+ nCntnt = pCrsr->GetPoint()->nContent.GetIndex();
+ nNdTyp = rNd.GetNodeType();
+ bHasSelection = ( *pCrsr->GetPoint() != *pCrsr->GetMark() );
+
+ if( ND_TEXTNODE & nNdTyp )
+ nLeftFrmPos = SwCallLink::getLayoutFrm( rShell.GetLayout(), (SwTxtNode&)rNd, nCntnt,
+ !rShell.ActionPend() );
+ else
+ {
+ nLeftFrmPos = 0;
+
+ // eine Sonderbehandlung fuer die SwFeShell: diese setzt beim Loeschen
+ // der Kopf-/Fusszeile, Fussnoten den Cursor auf NULL (Node + Content)
+ // steht der Cursor auf keinem CntntNode, wird sich das im NdType
+ // gespeichert.
+ if( ND_CONTENTNODE & nNdTyp )
+ nNdTyp = 0;
+ }
+}
+
+
+SwCallLink::~SwCallLink()
+{
+ if( !nNdTyp || !rShell.bCallChgLnk ) // siehe ctor
+ return ;
+
+ // wird ueber Nodes getravellt, Formate ueberpruefen und im neuen
+ // Node wieder anmelden
+ SwPaM* pCurCrsr = rShell.IsTableMode() ? rShell.GetTblCrs() : rShell.GetCrsr();
+ SwCntntNode * pCNd = pCurCrsr->GetCntntNode();
+ if( !pCNd )
+ return;
+
+ xub_StrLen nCmp, nAktCntnt = pCurCrsr->GetPoint()->nContent.GetIndex();
+ sal_uInt16 nNdWhich = pCNd->GetNodeType();
+ sal_uLong nAktNode = pCurCrsr->GetPoint()->nNode.GetIndex();
+
+ // melde die Shell beim akt. Node als abhaengig an, dadurch koennen
+ // alle Attribut-Aenderungen ueber den Link weiter gemeldet werden.
+ pCNd->Add( &rShell );
+
+ if( nNdTyp != nNdWhich || nNode != nAktNode )
+ {
+ /* immer, wenn zwischen Nodes gesprungen wird, kann es
+ * vorkommen, das neue Attribute gelten; die Text-Attribute.
+ * Es muesste also festgestellt werden, welche Attribute
+ * jetzt gelten; das kann auch gleich der Handler machen
+ */
+ rShell.CallChgLnk();
+ }
+ else if( !bHasSelection != !(*pCurCrsr->GetPoint() != *pCurCrsr->GetMark()) )
+ {
+ // always call change link when selection changes
+ rShell.CallChgLnk();
+ }
+ else if( rShell.aChgLnk.IsSet() && ND_TEXTNODE == nNdWhich &&
+ nCntnt != nAktCntnt )
+ {
+ // nur wenn mit Left/right getravellt, dann Text-Hints pruefen
+ // und sich nicht der Frame geaendert hat (Spalten!)
+ if( nLeftFrmPos == SwCallLink::getLayoutFrm( rShell.GetLayout(), (SwTxtNode&)*pCNd, nAktCntnt,
+ !rShell.ActionPend() ) &&
+ (( nCmp = nCntnt ) + 1 == nAktCntnt || // Right
+ nCntnt -1 == ( nCmp = nAktCntnt )) ) // Left
+ {
+ if( nCmp == nAktCntnt && pCurCrsr->HasMark() ) // left & Sele
+ ++nCmp;
+ if ( ((SwTxtNode*)pCNd)->HasHints() )
+ {
+
+ const SwpHints &rHts = ((SwTxtNode*)pCNd)->GetSwpHints();
+ sal_uInt16 n;
+ xub_StrLen nStart;
+ const xub_StrLen *pEnd;
+
+ for( n = 0; n < rHts.Count(); n++ )
+ {
+ const SwTxtAttr* pHt = rHts[ n ];
+ pEnd = pHt->GetEnd();
+ nStart = *pHt->GetStart();
+
+ // nur Start oder Start und Ende gleich, dann immer
+ // beim Ueberlaufen von Start callen
+ if( ( !pEnd || ( nStart == *pEnd ) ) &&
+ ( nStart == nCntnt || nStart == nAktCntnt) )
+ {
+ rShell.CallChgLnk();
+ return;
+ }
+
+ // hat das Attribut einen Bereich und dieser nicht leer
+ else if( pEnd && nStart < *pEnd &&
+ // dann teste, ob ueber Start/Ende getravellt wurde
+ ( nStart == nCmp ||
+ ( pHt->DontExpand() ? nCmp == *pEnd-1
+ : nCmp == *pEnd ) ))
+ {
+ rShell.CallChgLnk();
+ return;
+ }
+ nStart = 0;
+ }
+ }
+
+ if( pBreakIt->GetBreakIter().is() )
+ {
+ const String& rTxt = ((SwTxtNode*)pCNd)->GetTxt();
+ if( !nCmp ||
+ pBreakIt->GetBreakIter()->getScriptType( rTxt, nCmp )
+ != pBreakIt->GetBreakIter()->getScriptType( rTxt, nCmp - 1 ))
+ {
+ rShell.CallChgLnk();
+ return;
+ }
+ }
+ }
+ else
+ /* wenn mit Home/End/.. mehr als 1 Zeichen getravellt, dann
+ * immer den ChgLnk rufen, denn es kann hier nicht
+ * festgestellt werden, was sich geaendert; etwas kann
+ * veraendert sein.
+ */
+ rShell.CallChgLnk();
+ }
+
+ const SwFrm* pFrm;
+ const SwFlyFrm *pFlyFrm;
+ if( !rShell.ActionPend() && 0 != ( pFrm = pCNd->getLayoutFrm(rShell.GetLayout(),0,0,sal_False) ) &&
+ 0 != ( pFlyFrm = pFrm->FindFlyFrm() ) && !rShell.IsTableMode() )
+ {
+ const SwNodeIndex* pIndex = pFlyFrm->GetFmt()->GetCntnt().GetCntntIdx();
+ ASSERT( pIndex, "Fly ohne Cntnt" );
+
+ if (!pIndex)
+ return;
+
+ const SwNode& rStNd = pIndex->GetNode();
+
+ if( rStNd.EndOfSectionNode()->StartOfSectionIndex() > nNode ||
+ nNode > rStNd.EndOfSectionIndex() )
+ rShell.GetFlyMacroLnk().Call( (void*)pFlyFrm->GetFmt() );
+ }
+}
+
+long SwCallLink::getLayoutFrm( const SwRootFrm* pRoot, SwTxtNode& rNd, xub_StrLen nCntPos, sal_Bool bCalcFrm )
+{
+ SwTxtFrm* pFrm = (SwTxtFrm*)rNd.getLayoutFrm(pRoot,0,0,bCalcFrm), *pNext = pFrm;
+ if ( pFrm && !pFrm->IsHiddenNow() )
+ {
+ if( pFrm->HasFollow() )
+ while( 0 != ( pNext = (SwTxtFrm*)pFrm->GetFollow() ) &&
+ nCntPos >= pNext->GetOfst() )
+ pFrm = pNext;
+
+ return pFrm->Frm().Left();
+ }
+ return 0;
+}
+
diff --git a/sw/source/core/crsr/callnk.hxx b/sw/source/core/crsr/callnk.hxx
new file mode 100644
index 000000000000..93f6e8f11738
--- /dev/null
+++ b/sw/source/core/crsr/callnk.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CALLNK_HXX
+#define _CALLNK_HXX
+
+#include <tools/solar.h>
+
+class SwCrsrShell;
+class SwTxtNode;
+class SwRootFrm;
+
+class SwCallLink
+{
+public:
+ SwCrsrShell & rShell;
+ sal_uLong nNode;
+ xub_StrLen nCntnt;
+ sal_uInt8 nNdTyp;
+ long nLeftFrmPos;
+ bool bHasSelection;
+
+ SwCallLink( SwCrsrShell & rSh );
+ SwCallLink( SwCrsrShell & rSh, sal_uLong nAktNode, xub_StrLen nAktCntnt,
+ sal_uInt8 nAktNdTyp, long nLRPos,
+ bool bAktSelection );
+ ~SwCallLink();
+
+ static long getLayoutFrm( const SwRootFrm*, SwTxtNode& rNd, xub_StrLen nCntPos, sal_Bool bCalcFrm );
+};
+
+
+
+#endif // _CALLNK_HXX
diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx
new file mode 100644
index 000000000000..0ef82902ff08
--- /dev/null
+++ b/sw/source/core/crsr/crbm.cxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "crsrsh.hxx"
+#include "ndtxt.hxx"
+#include <docary.hxx>
+#include <boost/bind.hpp>
+
+#include "IMark.hxx"
+#include "callnk.hxx"
+#include "swcrsr.hxx"
+#include <IDocumentMarkAccess.hxx>
+#include <IDocumentSettingAccess.hxx>
+
+using namespace std;
+
+namespace
+{
+ struct CrsrStateHelper
+ {
+ CrsrStateHelper(SwCrsrShell& rShell)
+ : m_aLink(rShell)
+ , m_pCrsr(rShell.GetSwCrsr())
+ , m_aSaveState(*m_pCrsr)
+ { }
+
+ void SetCrsrToMark(::sw::mark::IMark const * const pMark)
+ {
+ *(m_pCrsr->GetPoint()) = pMark->GetMarkStart();
+ if(pMark->IsExpanded())
+ {
+ m_pCrsr->SetMark();
+ *(m_pCrsr->GetMark()) = pMark->GetMarkEnd();
+ }
+ }
+
+ // returns true if the Cursor had been rolled back
+ bool RollbackIfIllegal()
+ {
+ if(m_pCrsr->IsSelOvr(nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION
+ | nsSwCursorSelOverFlags::SELOVER_TOGGLE))
+ {
+ m_pCrsr->DeleteMark();
+ m_pCrsr->RestoreSavePos();
+ return true;
+ }
+ return false;
+ }
+
+ SwCallLink m_aLink;
+ SwCursor* m_pCrsr;
+ SwCrsrSaveState m_aSaveState;
+ };
+
+
+ static bool lcl_ReverseMarkOrderingByEnd(const IDocumentMarkAccess::pMark_t& rpFirst,
+ const IDocumentMarkAccess::pMark_t& rpSecond)
+ {
+ return rpFirst->GetMarkEnd() > rpSecond->GetMarkEnd();
+ }
+
+ static bool lcl_IsInvisibleBookmark(IDocumentMarkAccess::pMark_t pMark)
+ {
+ return IDocumentMarkAccess::GetType(*pMark) != IDocumentMarkAccess::BOOKMARK;
+ }
+}
+
+// at CurCrsr.SPoint
+::sw::mark::IMark* SwCrsrShell::SetBookmark(
+ const KeyCode& rCode,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rShortName,
+ IDocumentMarkAccess::MarkType eMark)
+{
+ StartAction();
+ ::sw::mark::IMark* pMark = getIDocumentMarkAccess()->makeMark(
+ *GetCrsr(),
+ rName,
+ eMark);
+ ::sw::mark::IBookmark* pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pMark);
+ if(pBookmark)
+ {
+ pBookmark->SetKeyCode(rCode);
+ pBookmark->SetShortName(rShortName);
+ }
+ EndAction();
+ return pMark;
+}
+// setzt CurCrsr.SPoint
+
+bool SwCrsrShell::GotoMark(const ::sw::mark::IMark* const pMark, bool bAtStart)
+{
+ // watch Crsr-Moves
+ CrsrStateHelper aCrsrSt(*this);
+ if ( bAtStart )
+ *(aCrsrSt.m_pCrsr)->GetPoint() = pMark->GetMarkStart();
+ else
+ *(aCrsrSt.m_pCrsr)->GetPoint() = pMark->GetMarkEnd();
+ if(aCrsrSt.RollbackIfIllegal()) return false;
+
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return true;
+}
+
+bool SwCrsrShell::GotoMark(const ::sw::mark::IMark* const pMark)
+{
+ // watch Crsr-Moves
+ CrsrStateHelper aCrsrSt(*this);
+ aCrsrSt.SetCrsrToMark(pMark);
+
+ if(aCrsrSt.RollbackIfIllegal()) return false;
+
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return true;
+}
+
+bool SwCrsrShell::GoNextBookmark()
+{
+ IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess();
+ IDocumentMarkAccess::container_t vCandidates;
+ remove_copy_if(
+ upper_bound(
+ pMarkAccess->getBookmarksBegin(),
+ pMarkAccess->getBookmarksEnd(),
+ *GetCrsr()->GetPoint(),
+ bind(&::sw::mark::IMark::StartsAfter, _2, _1)), // finds the first that is starting after
+ pMarkAccess->getBookmarksEnd(),
+ back_inserter(vCandidates),
+ &lcl_IsInvisibleBookmark);
+
+ // watch Crsr-Moves
+ CrsrStateHelper aCrsrSt(*this);
+ IDocumentMarkAccess::const_iterator_t ppMark = vCandidates.begin();
+ for(; ppMark!=vCandidates.end(); ++ppMark)
+ {
+ aCrsrSt.SetCrsrToMark(ppMark->get());
+ if(!aCrsrSt.RollbackIfIllegal())
+ break; // found legal move
+ }
+ if(ppMark==vCandidates.end())
+ {
+ SttEndDoc(false);
+ return false;
+ }
+
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return true;
+}
+
+bool SwCrsrShell::GoPrevBookmark()
+{
+ IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess();
+ // candidates from which to choose the mark before
+ // no need to consider marks starting after rPos
+ IDocumentMarkAccess::container_t vCandidates;
+ remove_copy_if(
+ pMarkAccess->getBookmarksBegin(),
+ upper_bound(
+ pMarkAccess->getBookmarksBegin(),
+ pMarkAccess->getBookmarksEnd(),
+ *GetCrsr()->GetPoint(),
+ bind(&::sw::mark::IMark::StartsAfter, _2, _1)),
+ back_inserter(vCandidates),
+ &lcl_IsInvisibleBookmark);
+ sort(
+ vCandidates.begin(),
+ vCandidates.end(),
+ &lcl_ReverseMarkOrderingByEnd);
+
+ // watch Crsr-Moves
+ CrsrStateHelper aCrsrSt(*this);
+ IDocumentMarkAccess::const_iterator_t ppMark = vCandidates.begin();
+ for(; ppMark!=vCandidates.end(); ++ppMark)
+ {
+ // ignoring those not ending before the Crsr
+ // (we were only able to eliminate those starting
+ // behind the Crsr by the upper_bound(..)
+ // above)
+ if(!(**ppMark).EndsBefore(*GetCrsr()->GetPoint()))
+ continue;
+ aCrsrSt.SetCrsrToMark(ppMark->get());
+ if(!aCrsrSt.RollbackIfIllegal())
+ break; // found legal move
+ }
+ if(ppMark==vCandidates.end())
+ {
+ SttEndDoc(true);
+ return false;
+ }
+
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return true;
+}
+
+bool SwCrsrShell::IsFormProtected()
+{
+ return getIDocumentSettingAccess()->get(IDocumentSettingAccess::PROTECT_FORM);
+}
+
+::sw::mark::IFieldmark* SwCrsrShell::GetCurrentFieldmark()
+{
+ // TODO: Refactor
+ SwPosition pos(*GetCrsr()->GetPoint());
+ return getIDocumentMarkAccess()->getFieldmarkFor(pos);
+}
+
+::sw::mark::IFieldmark* SwCrsrShell::GetFieldmarkAfter()
+{
+ SwPosition pos(*GetCrsr()->GetPoint());
+ return getIDocumentMarkAccess()->getFieldmarkAfter(pos);
+}
+
+::sw::mark::IFieldmark* SwCrsrShell::GetFieldmarkBefore()
+{
+ SwPosition pos(*GetCrsr()->GetPoint());
+ return getIDocumentMarkAccess()->getFieldmarkBefore(pos);
+}
+
+bool SwCrsrShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark)
+{
+ if(pMark==NULL) return false;
+
+ // watch Crsr-Moves
+ CrsrStateHelper aCrsrSt(*this);
+ aCrsrSt.SetCrsrToMark(pMark);
+ //aCrsrSt.m_pCrsr->GetPoint()->nContent--;
+ //aCrsrSt.m_pCrsr->GetMark()->nContent++;
+ if(aCrsrSt.RollbackIfIllegal()) return false;
+
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return true;
+}
diff --git a/sw/source/core/crsr/crossrefbookmark.cxx b/sw/source/core/crsr/crossrefbookmark.cxx
new file mode 100644
index 000000000000..dc083801ee8e
--- /dev/null
+++ b/sw/source/core/crsr/crossrefbookmark.cxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <crossrefbookmark.hxx>
+#include <ndtxt.hxx>
+
+using namespace rtl;
+
+namespace sw { namespace mark
+{
+ CrossRefBookmark::CrossRefBookmark(const SwPaM& rPaM,
+ const KeyCode& rCode,
+ const OUString& rName,
+ const OUString& rShortName,
+ const OUString& rPrefix)
+ : Bookmark(rPaM, rCode, rName, rShortName)
+ {
+ if(rPaM.HasMark())
+ OSL_ENSURE((rPaM.GetMark()->nNode == rPaM.GetPoint()->nNode &&
+ rPaM.Start()->nContent.GetIndex() == 0 &&
+ rPaM.End()->nContent.GetIndex() == rPaM.GetPoint()->nNode.GetNode().GetTxtNode()->Len()),
+ "<CrossRefBookmark::CrossRefBookmark(..)>"
+ "- creation of cross-reference bookmark with an expanded PaM that does not expand over exactly one whole paragraph.");
+ SetMarkPos(*rPaM.Start());
+ if(!rName.getLength())
+ m_aName = MarkBase::GenerateNewName(rPrefix);
+ }
+
+ void CrossRefBookmark::SetMarkPos(const SwPosition& rNewPos)
+ {
+ OSL_PRECOND(rNewPos.nNode.GetNode().GetTxtNode(),
+ "<SwCrossRefBookmark::SetMarkPos(..)>"
+ " - new bookmark position for cross-reference bookmark doesn't mark text node");
+ OSL_PRECOND(rNewPos.nContent.GetIndex() == 0,
+ "<SwCrossRefBookmark::SetMarkPos(..)>"
+ " - new bookmark position for cross-reference bookmark doesn't mark start of text node");
+ MarkBase::SetMarkPos(rNewPos);
+ }
+
+ SwPosition& CrossRefBookmark::GetOtherMarkPos() const
+ {
+ OSL_PRECOND(false,
+ "<SwCrossRefBookmark::GetOtherMarkPos(..)>"
+ " - this should never be called!");
+ return *static_cast<SwPosition*>(NULL);
+ }
+
+ CrossRefHeadingBookmark::CrossRefHeadingBookmark(const SwPaM& rPaM,
+ const KeyCode& rCode,
+ const OUString& rName,
+ const OUString& rShortName)
+ : CrossRefBookmark(rPaM, rCode, rName, rShortName, our_sNamePrefix)
+ { }
+
+ const ::rtl::OUString CrossRefHeadingBookmark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__RefHeading__");
+
+ bool CrossRefHeadingBookmark::IsLegalName(const ::rtl::OUString& rName)
+ {
+ return rName.match(our_sNamePrefix);
+ }
+
+ CrossRefNumItemBookmark::CrossRefNumItemBookmark(const SwPaM& rPaM,
+ const KeyCode& rCode,
+ const OUString& rName,
+ const OUString& rShortName)
+ : CrossRefBookmark(rPaM, rCode, rName, rShortName, our_sNamePrefix)
+ { }
+
+ const ::rtl::OUString CrossRefNumItemBookmark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__RefNumPara__");
+
+ bool CrossRefNumItemBookmark::IsLegalName(const ::rtl::OUString& rName)
+ {
+ return rName.match(our_sNamePrefix);
+ }
+}}
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
new file mode 100644
index 000000000000..1a100eae0682
--- /dev/null
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -0,0 +1,3512 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <hintids.hxx>
+#include <svx/svdmodel.hxx>
+#include <editeng/frmdiritem.hxx>
+
+#include <SwSmartTagMgr.hxx>
+#include <doc.hxx>
+#include <rootfrm.hxx>
+#include <pagefrm.hxx>
+#include <cntfrm.hxx>
+#include <viewimp.hxx>
+#include <pam.hxx>
+#include <swselectionlist.hxx>
+#include <IBlockCursor.hxx>
+#include "BlockCursor.hxx"
+#include <ndtxt.hxx>
+#include <flyfrm.hxx>
+#include <dview.hxx>
+#include <viewopt.hxx>
+#include <frmtool.hxx>
+#include <crsrsh.hxx>
+#include <tabfrm.hxx>
+#include <txtfrm.hxx>
+#include <sectfrm.hxx>
+#include <swtable.hxx>
+#include <callnk.hxx>
+#include <viscrs.hxx>
+#include <section.hxx>
+#include <docsh.hxx>
+#include <scriptinfo.hxx>
+#include <globdoc.hxx>
+#include <pamtyp.hxx>
+#include <mdiexp.hxx> // ...Percent()
+#include <fmteiro.hxx>
+#include <wrong.hxx> // SMARTTAGS
+#include <unotextrange.hxx> // SMARTTAGS
+#include <vcl/svapp.hxx>
+#include <numrule.hxx>
+#include <IGrammarContact.hxx>
+
+#include <globals.hrc>
+
+#include <comcore.hrc>
+
+using namespace com::sun::star;
+using namespace util;
+
+TYPEINIT2(SwCrsrShell,ViewShell,SwModify);
+
+
+// Funktion loescht, alle ueberlappenden Cursor aus einem Cursor-Ring
+void CheckRange( SwCursor* );
+
+//-----------------------------------------------------------------------
+
+/*
+ * Ueberpruefe ob der pCurCrsr in einen schon bestehenden Bereich zeigt.
+ * Wenn ja, dann hebe den alten Bereich auf.
+ */
+
+
+void CheckRange( SwCursor* pCurCrsr )
+{
+ const SwPosition *pStt = pCurCrsr->Start(),
+ *pEnd = pCurCrsr->GetPoint() == pStt ? pCurCrsr->GetMark() : pCurCrsr->GetPoint();
+
+ SwPaM *pTmpDel = 0,
+ *pTmp = (SwPaM*)pCurCrsr->GetNext();
+
+ // durchsuche den gesamten Ring
+ while( pTmp != pCurCrsr )
+ {
+ const SwPosition *pTmpStt = pTmp->Start(),
+ *pTmpEnd = pTmp->GetPoint() == pTmpStt ?
+ pTmp->GetMark() : pTmp->GetPoint();
+ if( *pStt <= *pTmpStt )
+ {
+ if( *pEnd > *pTmpStt ||
+ ( *pEnd == *pTmpStt && *pEnd == *pTmpEnd ))
+ pTmpDel = pTmp;
+ }
+ else
+ if( *pStt < *pTmpEnd )
+ pTmpDel = pTmp;
+ /*
+ * liegt ein SPoint oder GetMark innerhalb vom Crsr-Bereich
+ * muss der alte Bereich aufgehoben werden.
+ * Beim Vergleich ist darauf zu achten, das SPoint nicht mehr zum
+ * Bereich gehoert !
+ */
+ pTmp = (SwPaM*)pTmp->GetNext();
+ if( pTmpDel )
+ {
+ delete pTmpDel; // hebe alten Bereich auf
+ pTmpDel = 0;
+ }
+ }
+}
+
+// -------------- Methoden von der SwCrsrShell -------------
+
+SwPaM * SwCrsrShell::CreateCrsr()
+{
+ // Innerhalb der Tabellen-SSelection keinen neuen Crsr anlegen
+ ASSERT( !IsTableMode(), "in Tabellen SSelection" );
+
+ // neuen Cursor als Kopie vom akt. und in den Ring aufnehmen
+ // Verkettung zeigt immer auf den zuerst erzeugten, also vorwaerts
+ SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
+
+ // hier den akt. Pam nur logisch Hiden, weil sonst die Invertierung
+ // vom kopierten Pam aufgehoben wird !!
+
+ // #i75172# to be able to make a complete content swap, i moved this to a method
+ // pNew->Insert( pCurCrsr, 0 );
+ // pCurCrsr->Remove( 0, pCurCrsr->Count() );
+ pNew->swapContent(*pCurCrsr);
+
+ pCurCrsr->DeleteMark();
+
+ UpdateCrsr( SwCrsrShell::SCROLLWIN );
+// return pCurCrsr;
+ return pNew;
+}
+
+// loesche den aktuellen Cursor und der folgende wird zum Aktuellen
+
+
+sal_Bool SwCrsrShell::DestroyCrsr()
+{
+ // Innerhalb der Tabellen-SSelection keinen neuen Crsr loeschen
+ ASSERT( !IsTableMode(), "in Tabellen SSelection" );
+
+ // ist ueberhaupt ein naechtser vorhanden ?
+ if(pCurCrsr->GetNext() == pCurCrsr)
+ return sal_False;
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCursor* pNextCrsr = (SwCursor*)pCurCrsr->GetNext();
+ delete pCurCrsr;
+ pCurCrsr = dynamic_cast<SwShellCrsr*>(pNextCrsr);
+ UpdateCrsr();
+ return sal_True;
+}
+
+
+SwPaM & SwCrsrShell::CreateNewShellCursor()
+{
+ if (HasSelection())
+ {
+ (void) CreateCrsr(); // n.b. returns old cursor
+ }
+ return *GetCrsr();
+}
+
+SwPaM & SwCrsrShell::GetCurrentShellCursor()
+{
+ return *GetCrsr();
+}
+
+
+// gebe den aktuellen zurueck
+
+SwPaM* SwCrsrShell::GetCrsr( sal_Bool bMakeTblCrsr ) const
+{
+ if( pTblCrsr )
+ {
+ if( bMakeTblCrsr && pTblCrsr->IsCrsrMovedUpdt() )
+ {
+ // geparkte Cursor werden nicht wieder erzeugt
+ const SwCntntNode* pCNd;
+ if( pTblCrsr->GetPoint()->nNode.GetIndex() &&
+ pTblCrsr->GetMark()->nNode.GetIndex() &&
+ 0 != ( pCNd = pTblCrsr->GetCntntNode() ) && pCNd->getLayoutFrm( GetLayout() ) &&
+ 0 != ( pCNd = pTblCrsr->GetCntntNode(sal_False) ) && pCNd->getLayoutFrm( GetLayout() ) )
+ {
+ SwShellTableCrsr* pTC = (SwShellTableCrsr*)pTblCrsr;
+ GetLayout()->MakeTblCrsrs( *pTC );
+ }
+ }
+
+ if( pTblCrsr->IsChgd() )
+ {
+ const_cast<SwCrsrShell*>(this)->pCurCrsr =
+ dynamic_cast<SwShellCrsr*>(pTblCrsr->MakeBoxSels( pCurCrsr ));
+ }
+ }
+ return pCurCrsr;
+}
+
+
+void SwCrsrShell::StartAction()
+{
+ if( !ActionPend() )
+ {
+ // fuer das Update des Ribbon-Bars merken
+ const SwNode& rNd = pCurCrsr->GetPoint()->nNode.GetNode();
+ nAktNode = rNd.GetIndex();
+ nAktCntnt = pCurCrsr->GetPoint()->nContent.GetIndex();
+ nAktNdTyp = rNd.GetNodeType();
+ bAktSelection = *pCurCrsr->GetPoint() != *pCurCrsr->GetMark();
+ if( ND_TEXTNODE & nAktNdTyp )
+ nLeftFrmPos = SwCallLink::getLayoutFrm( GetLayout(), (SwTxtNode&)rNd, nAktCntnt, sal_True );
+ else
+ nLeftFrmPos = 0;
+ }
+ ViewShell::StartAction(); // zur ViewShell
+}
+
+
+void SwCrsrShell::EndAction( const sal_Bool bIdleEnd )
+{
+/*
+//OS: Wird z.B. eine Basic-Action im Hintergrund ausgefuehrt, geht es so nicht
+ if( !bHasFocus )
+ {
+ // hat die Shell nicht den Focus, dann nur das EndAction an
+ // die ViewShell weitergeben.
+ ViewShell::EndAction( bIdleEnd );
+ return;
+ }
+*/
+
+ sal_Bool bVis = bSVCrsrVis;
+
+ // Idle-Formatierung ?
+ if( bIdleEnd && Imp()->GetRegion() )
+ {
+ pCurCrsr->Hide();
+
+#ifdef SHOW_IDLE_REGION
+if( GetWin() )
+{
+ GetWin()->Push();
+ GetWin()->ChangePen( Pen( Color( COL_YELLOW )));
+ for( sal_uInt16 n = 0; n < aPntReg.Count(); ++n )
+ {
+ SwRect aIRect( aPntReg[n] );
+ GetWin()->DrawRect( aIRect.SVRect() );
+ }
+ GetWin()->Pop();
+}
+#endif
+
+ }
+
+ // vor der letzten Action alle invaliden Numerierungen updaten
+ if( 1 == nStartAction )
+ GetDoc()->UpdateNumRule();
+
+ // Task: 76923: dont show the cursor in the ViewShell::EndAction() - call.
+ // Only the UpdateCrsr shows the cursor.
+ sal_Bool bSavSVCrsrVis = bSVCrsrVis;
+ bSVCrsrVis = sal_False;
+
+ ViewShell::EndAction( bIdleEnd ); //der ViewShell den Vortritt lassen
+
+ bSVCrsrVis = bSavSVCrsrVis;
+
+ if( ActionPend() )
+ {
+ if( bVis ) // auch SV-Cursor wieder anzeigen
+ pVisCrsr->Show();
+
+ // falls noch ein ChgCall vorhanden ist und nur noch die Basic
+ // Klammerung vorhanden ist, dann rufe ihn. Dadurch wird die interne
+ // mit der Basic-Klammerung entkoppelt; die Shells werden umgeschaltet
+ if( !BasicActionPend() )
+ {
+ //JP 12.01.98: Bug #46496# - es muss innerhalb einer BasicAction
+ // der Cursor geupdatet werden; um z.B. den
+ // TabellenCursor zu erzeugen. Im UpdateCrsr wird
+ // das jetzt beruecksichtigt!
+ UpdateCrsr( SwCrsrShell::CHKRANGE, bIdleEnd );
+
+ {
+ // Crsr-Moves ueberwachen, evt. Link callen
+ // der DTOR ist das interressante!!
+ SwCallLink aLk( *this, nAktNode, nAktCntnt, (sal_uInt8)nAktNdTyp,
+ nLeftFrmPos, bAktSelection );
+
+ }
+ if( bCallChgLnk && bChgCallFlag && aChgLnk.IsSet() )
+ {
+ aChgLnk.Call( this );
+ bChgCallFlag = sal_False; // Flag zuruecksetzen
+ }
+ }
+ return;
+ }
+
+ sal_uInt16 nParm = SwCrsrShell::CHKRANGE;
+ if ( !bIdleEnd )
+ nParm |= SwCrsrShell::SCROLLWIN;
+// if( !IsViewLocked() )
+ UpdateCrsr( nParm, bIdleEnd ); // Cursor-Aenderungen anzeigen
+
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ aLk.nNode = nAktNode; // evt. Link callen
+ aLk.nNdTyp = (sal_uInt8)nAktNdTyp;
+ aLk.nCntnt = nAktCntnt;
+ aLk.nLeftFrmPos = nLeftFrmPos;
+
+ if( !nCrsrMove ||
+ ( 1 == nCrsrMove && bInCMvVisportChgd ) )
+ ShowCrsrs( bSVCrsrVis ? sal_True : sal_False ); // Cursor & Selektionen wieder anzeigen
+ }
+ // falls noch ein ChgCall vorhanden ist, dann rufe ihn
+ if( bCallChgLnk && bChgCallFlag && aChgLnk.IsSet() )
+ {
+ aChgLnk.Call( this );
+ bChgCallFlag = sal_False; // Flag zuruecksetzen
+ }
+}
+
+
+#if defined(DBG_UTIL)
+
+void SwCrsrShell::SttCrsrMove()
+{
+ ASSERT( nCrsrMove < USHRT_MAX, "To many nested CrsrMoves." );
+ ++nCrsrMove;
+ StartAction();
+}
+
+void SwCrsrShell::EndCrsrMove( const sal_Bool bIdleEnd )
+{
+ ASSERT( nCrsrMove, "EndCrsrMove() ohne SttCrsrMove()." );
+ EndAction( bIdleEnd );
+ if( !--nCrsrMove )
+ bInCMvVisportChgd = sal_False;
+}
+
+#endif
+
+
+sal_Bool SwCrsrShell::LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode,
+ sal_Bool bVisualAllowed )
+{
+ if( IsTableMode() )
+ return bLeft ? GoPrevCell() : GoNextCell();
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ sal_Bool bRet = sal_False;
+
+ // #i27615# Handle cursor in front of label.
+ const SwTxtNode* pTxtNd = 0;
+
+ if( pBlockCrsr )
+ pBlockCrsr->clearPoints();
+
+ //
+ // 1. CASE: Cursor is in front of label. A move to the right
+ // will simply reset the bInFrontOfLabel flag:
+ //
+ SwShellCrsr* pShellCrsr = getShellCrsr( true );
+ if ( !bLeft && pShellCrsr->IsInFrontOfLabel() )
+ {
+ SetInFrontOfLabel( sal_False );
+ bRet = sal_True;
+ }
+ //
+ // 2. CASE: Cursor is at beginning of numbered paragraph. A move
+ // to the left will simply set the bInFrontOfLabel flag:
+ //
+ else if ( bLeft && 0 == pShellCrsr->GetPoint()->nContent.GetIndex() &&
+ !pShellCrsr->IsInFrontOfLabel() && !pShellCrsr->HasMark() &&
+ 0 != ( pTxtNd = pShellCrsr->GetNode()->GetTxtNode() ) &&
+ pTxtNd->HasVisibleNumberingOrBullet() )
+ {
+ SetInFrontOfLabel( sal_True );
+ bRet = sal_True;
+ }
+ //
+ // 3. CASE: Regular cursor move. Reset the bInFrontOfLabel flag:
+ //
+ else
+ {
+ const sal_Bool bSkipHidden = !GetViewOptions()->IsShowHiddenChar();
+ // --> OD 2009-12-30 #i107447#
+ // To avoid loop the reset of <bInFrontOfLabel> flag is no longer
+ // reflected in the return value <bRet>.
+ const bool bResetOfInFrontOfLabel = SetInFrontOfLabel( sal_False );
+ bRet = pShellCrsr->LeftRight( bLeft, nCnt, nMode, bVisualAllowed,
+ bSkipHidden, !IsOverwriteCrsr() );
+ if ( !bRet && bLeft && bResetOfInFrontOfLabel )
+ {
+ // undo reset of <bInFrontOfLabel> flag
+ SetInFrontOfLabel( sal_True );
+ }
+ // <--
+ }
+
+ if( bRet )
+ {
+ UpdateCrsr();
+ }
+ return bRet;
+}
+
+// --> OD 2008-04-02 #refactorlists#
+void SwCrsrShell::MarkListLevel( const String& sListId,
+ const int nListLevel )
+{
+ if ( sListId != sMarkedListId ||
+ nListLevel != nMarkedListLevel)
+ {
+ if ( sMarkedListId.Len() > 0 )
+ pDoc->MarkListLevel( sMarkedListId, nMarkedListLevel, sal_False );
+
+ if ( sListId.Len() > 0 )
+ {
+ pDoc->MarkListLevel( sListId, nListLevel, sal_True );
+ }
+
+ sMarkedListId = sListId;
+ nMarkedListLevel = nListLevel;
+ }
+}
+
+void SwCrsrShell::UpdateMarkedListLevel()
+{
+ SwTxtNode * pTxtNd = _GetCrsr()->GetNode()->GetTxtNode();
+
+ if ( pTxtNd )
+ {
+ if ( !pTxtNd->IsNumbered() )
+ {
+ pCurCrsr->_SetInFrontOfLabel( sal_False );
+ MarkListLevel( String(), 0 );
+ }
+ else if ( pCurCrsr->IsInFrontOfLabel() )
+ {
+ if ( pTxtNd->IsInList() )
+ {
+ ASSERT( pTxtNd->GetActualListLevel() >= 0 &&
+ pTxtNd->GetActualListLevel() < MAXLEVEL, "Which level?")
+ MarkListLevel( pTxtNd->GetListId(),
+ pTxtNd->GetActualListLevel() );
+ }
+ }
+ else
+ {
+ MarkListLevel( String(), 0 );
+ }
+ }
+}
+// <--
+
+sal_Bool SwCrsrShell::UpDown( sal_Bool bUp, sal_uInt16 nCnt )
+{
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ sal_Bool bTableMode = IsTableMode();
+ SwShellCrsr* pTmpCrsr = getShellCrsr( true );
+
+ sal_Bool bRet = pTmpCrsr->UpDown( bUp, nCnt );
+ // --> FME 2005-01-10 #i40019# UpDown should always reset the
+ // bInFrontOfLabel flag:
+ bRet = SetInFrontOfLabel(sal_False) || bRet;
+ // <--
+
+ if( pBlockCrsr )
+ pBlockCrsr->clearPoints();
+
+ if( bRet )
+ {
+ eMvState = MV_UPDOWN; // Status fuers Crsr-Travelling - GetCrsrOfst
+ if( !ActionPend() )
+ {
+ CrsrFlag eUpdtMode = SwCrsrShell::SCROLLWIN;
+ if( !bTableMode )
+ eUpdtMode = (CrsrFlag) (eUpdtMode
+ | SwCrsrShell::UPDOWN | SwCrsrShell::CHKRANGE);
+ UpdateCrsr( static_cast<sal_uInt16>(eUpdtMode) );
+ }
+ }
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::LRMargin( sal_Bool bLeft, sal_Bool bAPI)
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SET_CURR_SHELL( this );
+ eMvState = MV_LEFTMARGIN; // Status fuers Crsr-Travelling - GetCrsrOfst
+
+ const sal_Bool bTableMode = IsTableMode();
+ SwShellCrsr* pTmpCrsr = getShellCrsr( true );
+
+ if( pBlockCrsr )
+ pBlockCrsr->clearPoints();
+
+ const sal_Bool bWasAtLM =
+ ( 0 == _GetCrsr()->GetPoint()->nContent.GetIndex() );
+
+ sal_Bool bRet = pTmpCrsr->LeftRightMargin( bLeft, bAPI );
+
+ if ( bLeft && !bTableMode && bRet && bWasAtLM && !_GetCrsr()->HasMark() )
+ {
+ const SwTxtNode * pTxtNd = _GetCrsr()->GetNode()->GetTxtNode();
+ if ( pTxtNd && pTxtNd->HasVisibleNumberingOrBullet() )
+ SetInFrontOfLabel( sal_True );
+ }
+ else if ( !bLeft )
+ {
+ bRet = SetInFrontOfLabel( sal_False ) || bRet;
+ }
+
+ if( bRet )
+ {
+ UpdateCrsr();
+ }
+ return bRet;
+}
+
+sal_Bool SwCrsrShell::IsAtLRMargin( sal_Bool bLeft, sal_Bool bAPI ) const
+{
+ const SwShellCrsr* pTmpCrsr = getShellCrsr( true );
+ return pTmpCrsr->IsAtLeftRightMargin( bLeft, bAPI );
+}
+
+
+sal_Bool SwCrsrShell::SttEndDoc( sal_Bool bStt )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ SwShellCrsr* pTmpCrsr = pBlockCrsr ? &pBlockCrsr->getShellCrsr() : pCurCrsr;
+ sal_Bool bRet = pTmpCrsr->SttEndDoc( bStt );
+ if( bRet )
+ {
+ if( bStt )
+ pTmpCrsr->GetPtPos().Y() = 0; // expl. 0 setzen (TabellenHeader)
+ if( pBlockCrsr )
+ {
+ pBlockCrsr->clearPoints();
+ RefreshBlockCursor();
+ }
+
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+void SwCrsrShell::ExtendedSelectAll()
+{
+ SwNodes& rNodes = GetDoc()->GetNodes();
+ SwPosition* pPos = pCurCrsr->GetPoint();
+ pPos->nNode = rNodes.GetEndOfPostIts();
+ pPos->nContent.Assign( rNodes.GoNext( &pPos->nNode ), 0 );
+ pPos = pCurCrsr->GetMark();
+ pPos->nNode = rNodes.GetEndOfContent();
+ SwCntntNode* pCNd = rNodes.GoPrevious( &pPos->nNode );
+ pPos->nContent.Assign( pCNd, pCNd ? pCNd->Len() : 0 );
+}
+
+sal_Bool SwCrsrShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage )
+{
+ sal_Bool bRet = sal_False;
+
+ // Springe beim Selektieren nie ueber Section-Grenzen !!
+ if( !pCurCrsr->HasMark() || !pCurCrsr->IsNoCntnt() )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SET_CURR_SHELL( this );
+
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ Point& rPt = pCurCrsr->GetPtPos();
+ SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->
+ getLayoutFrm( GetLayout(), &rPt, pCurCrsr->GetPoint(), sal_False );
+ if( pFrm && sal_True == ( bRet = GetFrmInPage( pFrm, fnWhichPage,
+ fnPosPage, pCurCrsr ) ) &&
+ !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ))
+ UpdateCrsr();
+ else
+ bRet = sal_False;
+ }
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCursor* pTmpCrsr = getShellCrsr( true );
+ sal_Bool bRet = pTmpCrsr->MovePara( fnWhichPara, fnPosPara );
+ if( bRet )
+ UpdateCrsr();
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::MoveSection( SwWhichSection fnWhichSect,
+ SwPosSection fnPosSect)
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCursor* pTmpCrsr = getShellCrsr( true );
+ sal_Bool bRet = pTmpCrsr->MoveSection( fnWhichSect, fnPosSect );
+ if( bRet )
+ UpdateCrsr();
+ return bRet;
+
+}
+
+
+// Positionieren des Cursors
+
+
+SwFrm* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt )
+{
+ SwFrm* pFrm = 0;
+ SwCntntNode* pCNd = rIdx.GetNode().GetCntntNode();
+ if( pCNd )
+ {
+ pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &rPt, 0, sal_False )->GetUpper();
+ while( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() )
+ pFrm = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->AnchorFrm()
+ : pFrm->GetUpper();
+ }
+ return pFrm;
+}
+
+sal_Bool SwCrsrShell::IsInHeaderFooter( sal_Bool* pbInHeader ) const
+{
+ Point aPt;
+ SwFrm* pFrm = ::lcl_IsInHeaderFooter( pCurCrsr->GetPoint()->nNode, aPt );
+ if( pFrm && pbInHeader )
+ *pbInHeader = pFrm->IsHeaderFrm();
+ return 0 != pFrm;
+}
+
+int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock )
+{
+ SET_CURR_SHELL( this );
+
+ SwShellCrsr* pCrsr = getShellCrsr( bBlock );
+ SwPosition aPos( *pCrsr->GetPoint() );
+ Point aPt( rLPt );
+ Point & rAktCrsrPt = pCrsr->GetPtPos();
+ SwCrsrMoveState aTmpState( IsTableMode() ? MV_TBLSEL :
+ bOnlyText ? MV_SETONLYTEXT : MV_NONE );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+
+ SwTxtNode * pTxtNd = pCrsr->GetNode()->GetTxtNode();
+
+ if ( pTxtNd && !IsTableMode() &&
+ // --> FME 2004-11-25 #i37515# No bInFrontOfLabel during selection
+ !pCrsr->HasMark() &&
+ // <--
+ pTxtNd->HasVisibleNumberingOrBullet() )
+ {
+ aTmpState.bInFrontOfLabel = sal_True; // #i27615#
+ }
+ else
+ {
+ aTmpState.bInFrontOfLabel = sal_False;
+ }
+
+ int bRet = CRSR_POSOLD |
+ ( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState )
+ ? 0 : CRSR_POSCHG );
+
+ const bool bOldInFrontOfLabel = IsInFrontOfLabel();
+ const bool bNewInFrontOfLabel = aTmpState.bInFrontOfLabel;
+
+ pCrsr->SetCrsrBidiLevel( aTmpState.nCursorBidiLevel );
+
+ if( MV_RIGHTMARGIN == aTmpState.eState )
+ eMvState = MV_RIGHTMARGIN;
+ // steht neu Pos im Header/Footer ?
+ SwFrm* pFrm = lcl_IsInHeaderFooter( aPos.nNode, aPt );
+ if( IsTableMode() && !pFrm && aPos.nNode.GetNode().StartOfSectionNode() ==
+ pCrsr->GetPoint()->nNode.GetNode().StartOfSectionNode() )
+ // gleiche Tabellenzelle und nicht im Header/Footer
+ // -> zurueck
+ return bRet;
+
+ if( pBlockCrsr && bBlock )
+ {
+ pBlockCrsr->setEndPoint( rLPt );
+ if( !pCrsr->HasMark() )
+ pBlockCrsr->setStartPoint( rLPt );
+ else if( !pBlockCrsr->getStartPoint() )
+ pBlockCrsr->setStartPoint( pCrsr->GetMkPos() );
+ }
+ if( !pCrsr->HasMark() )
+ {
+ // steht an der gleichen Position und wenn im Header/Footer,
+ // dann im gleichen
+ if( aPos == *pCrsr->GetPoint() &&
+ bOldInFrontOfLabel == bNewInFrontOfLabel )
+ {
+ if( pFrm )
+ {
+ if( pFrm->Frm().IsInside( rAktCrsrPt ))
+ return bRet;
+ }
+ else if( aPos.nNode.GetNode().IsCntntNode() )
+ {
+ // im gleichen Frame gelandet?
+ SwFrm* pOld = ((SwCntntNode&)aPos.nNode.GetNode()).getLayoutFrm(
+ GetLayout(), &aCharRect.Pos(), 0, sal_False );
+ SwFrm* pNew = ((SwCntntNode&)aPos.nNode.GetNode()).getLayoutFrm(
+ GetLayout(), &aPt, 0, sal_False );
+ if( pNew == pOld )
+ return bRet;
+ }
+ }
+ }
+ else
+ {
+ // SSelection ueber nicht erlaubte Sections oder wenn im Header/Footer
+ // dann in verschiedene
+ if( !CheckNodesRange( aPos.nNode, pCrsr->GetMark()->nNode, sal_True )
+ || ( pFrm && !pFrm->Frm().IsInside( pCrsr->GetMkPos() ) ))
+ return bRet;
+
+ // steht an der gleichen Position und nicht im Header/Footer
+ if( aPos == *pCrsr->GetPoint() )
+ return bRet;
+ }
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ *pCrsr->GetPoint() = aPos;
+ rAktCrsrPt = aPt;
+
+ // --> FME 2005-01-31 #i41424# Only update the marked number levels if necessary
+ // Force update of marked number levels if necessary.
+ if ( bNewInFrontOfLabel || bOldInFrontOfLabel )
+ pCurCrsr->_SetInFrontOfLabel( !bNewInFrontOfLabel );
+ SetInFrontOfLabel( bNewInFrontOfLabel );
+ // <--
+
+ if( !pCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) )
+ {
+ sal_uInt16 nFlag = SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE;
+ UpdateCrsr( nFlag );
+ bRet &= ~CRSR_POSOLD;
+ }
+ else if( bOnlyText && !pCurCrsr->HasMark() )
+ {
+ if( FindValidCntntNode( bOnlyText ) )
+ {
+ // Cursor in einen gueltigen Content stellen
+ if( aPos == *pCrsr->GetPoint() )
+ bRet = CRSR_POSOLD;
+ else
+ {
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE );
+ bRet &= ~CRSR_POSOLD;
+ }
+ }
+ else
+ {
+ // es gibt keinen gueltigen Inhalt -> Cursor verstecken
+ pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling
+ bAllProtect = sal_True;
+ if( GetDoc()->GetDocShell() )
+ {
+ GetDoc()->GetDocShell()->SetReadOnlyUI( sal_True );
+ CallChgLnk(); // UI bescheid sagen!
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+void SwCrsrShell::TblCrsrToCursor()
+{
+ ASSERT( pTblCrsr, "TblCrsrToCursor: Why?" );
+ delete pTblCrsr, pTblCrsr = 0;
+}
+
+void SwCrsrShell::BlockCrsrToCrsr()
+{
+ ASSERT( pBlockCrsr, "BlockCrsrToCrsr: Why?" );
+ if( pBlockCrsr && !HasSelection() )
+ {
+ SwPaM& rPam = pBlockCrsr->getShellCrsr();
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetPoint() = *rPam.GetPoint();
+ if( rPam.HasMark() )
+ *pCurCrsr->GetMark() = *rPam.GetMark();
+ else
+ pCurCrsr->DeleteMark();
+ }
+ delete pBlockCrsr, pBlockCrsr = 0;
+}
+
+void SwCrsrShell::CrsrToBlockCrsr()
+{
+ if( !pBlockCrsr )
+ {
+ SwPosition aPos( *pCurCrsr->GetPoint() );
+ pBlockCrsr = createBlockCursor( *this, aPos );
+ SwShellCrsr &rBlock = pBlockCrsr->getShellCrsr();
+ rBlock.GetPtPos() = pCurCrsr->GetPtPos();
+ if( pCurCrsr->HasMark() )
+ {
+ rBlock.SetMark();
+ *rBlock.GetMark() = *pCurCrsr->GetMark();
+ rBlock.GetMkPos() = pCurCrsr->GetMkPos();
+ }
+ }
+ pBlockCrsr->clearPoints();
+ RefreshBlockCursor();
+}
+
+void SwCrsrShell::ClearMark()
+{
+ // ist ueberhaupt ein GetMark gesetzt ?
+ if( pTblCrsr )
+ {
+ while( pCurCrsr->GetNext() != pCurCrsr )
+ delete pCurCrsr->GetNext();
+ pTblCrsr->DeleteMark();
+
+ if( pCurCrsr->HasMark() )
+ {
+ // falls doch nicht alle Indizies richtig verschoben werden
+ // (z.B.: Kopf-/Fusszeile loeschen) den Content-Anteil vom
+ // Mark aufs Nodes-Array setzen
+ SwPosition& rPos = *pCurCrsr->GetMark();
+ rPos.nNode.Assign( pDoc->GetNodes(), 0 );
+ rPos.nContent.Assign( 0, 0 );
+ pCurCrsr->DeleteMark();
+ }
+
+ *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
+ pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos();
+ delete pTblCrsr, pTblCrsr = 0;
+ pCurCrsr->SwSelPaintRects::Show();
+ }
+ else
+ {
+ if( !pCurCrsr->HasMark() )
+ return;
+ // falls doch nicht alle Indizies richtig verschoben werden
+ // (z.B.: Kopf-/Fusszeile loeschen) den Content-Anteil vom
+ // Mark aufs Nodes-Array setzen
+ SwPosition& rPos = *pCurCrsr->GetMark();
+ rPos.nNode.Assign( pDoc->GetNodes(), 0 );
+ rPos.nContent.Assign( 0, 0 );
+ pCurCrsr->DeleteMark();
+ if( !nCrsrMove )
+ pCurCrsr->SwSelPaintRects::Show();
+ }
+}
+
+
+void SwCrsrShell::NormalizePam(sal_Bool bPointFirst)
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ pCurCrsr->Normalize(bPointFirst);
+}
+
+void SwCrsrShell::SwapPam()
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ pCurCrsr->Exchange();
+}
+
+
+// suche innerhalb der Selektierten-Bereiche nach einer Selektion, die
+// den angebenen SPoint umschliesst
+// Ist das Flag bTstOnly gesetzt, dann wird nur getestet, ob dort eine
+// SSelection besteht; des akt. Cursr wird nicht umgesetzt!
+// Ansonsten wird er auf die gewaehlte SSelection gesetzt.
+
+
+sal_Bool SwCrsrShell::ChgCurrPam( const Point & rPt,
+ sal_Bool bTstOnly, sal_Bool bTstHit )
+{
+ SET_CURR_SHELL( this );
+
+ // Pruefe ob der SPoint in einer Tabellen-Selektion liegt
+ if( bTstOnly && pTblCrsr )
+ return pTblCrsr->IsInside( rPt );
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ // Suche die Position rPt im Dokument
+ SwPosition aPtPos( *pCurCrsr->GetPoint() );
+ Point aPt( rPt );
+
+ SwCrsrMoveState aTmpState( MV_NONE );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ if ( !GetLayout()->GetCrsrOfst( &aPtPos, aPt, &aTmpState ) && bTstHit )
+ return sal_False;
+
+ // suche in allen Selektionen nach dieser Position
+ SwShellCrsr* pCmp = (SwShellCrsr*)pCurCrsr; // sicher den Pointer auf Cursor
+ do {
+ if( pCmp->HasMark() &&
+ *pCmp->Start() <= aPtPos && *pCmp->End() > aPtPos )
+ {
+ if( bTstOnly || pCurCrsr == pCmp ) // ist der aktuelle.
+ return sal_True; // return ohne Update
+
+ pCurCrsr = pCmp;
+ UpdateCrsr(); // Cursor steht schon richtig
+ return sal_True;
+ }
+ } while( pCurCrsr !=
+ ( pCmp = dynamic_cast<SwShellCrsr*>(pCmp->GetNext()) ) );
+ return sal_False;
+}
+
+
+void SwCrsrShell::KillPams()
+{
+ // keiner zum loeschen vorhanden?
+ if( !pTblCrsr && !pBlockCrsr && pCurCrsr->GetNext() == pCurCrsr )
+ return;
+
+ while( pCurCrsr->GetNext() != pCurCrsr )
+ delete pCurCrsr->GetNext();
+ pCurCrsr->SetColumnSelection( false );
+
+ if( pTblCrsr )
+ {
+ // Cursor Ring loeschen
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
+ pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos();
+ delete pTblCrsr;
+ pTblCrsr = 0;
+ }
+ else if( pBlockCrsr )
+ {
+ // delete the ring of cursors
+ pCurCrsr->DeleteMark();
+ SwShellCrsr &rBlock = pBlockCrsr->getShellCrsr();
+ *pCurCrsr->GetPoint() = *rBlock.GetPoint();
+ pCurCrsr->GetPtPos() = rBlock.GetPtPos();
+ rBlock.DeleteMark();
+ pBlockCrsr->clearPoints();
+ }
+ UpdateCrsr( SwCrsrShell::SCROLLWIN );
+}
+
+
+int SwCrsrShell::CompareCursor( CrsrCompareType eType ) const
+{
+ int nRet = 0;
+ const SwPosition *pFirst = 0, *pSecond = 0;
+ const SwPaM *pCur = GetCrsr(), *pStk = pCrsrStk;
+ if( CurrPtCurrMk != eType && pStk )
+ {
+ switch ( eType)
+ {
+ case StackPtStackMk:
+ pFirst = pStk->GetPoint();
+ pSecond = pStk->GetMark();
+ break;
+ case StackPtCurrPt:
+ pFirst = pStk->GetPoint();
+ pSecond = pCur->GetPoint();
+ break;
+ case StackPtCurrMk:
+ pFirst = pStk->GetPoint();
+ pSecond = pCur->GetMark();
+ break;
+ case StackMkCurrPt:
+ pFirst = pStk->GetMark();
+ pSecond = pCur->GetPoint();
+ break;
+ case StackMkCurrMk:
+ pFirst = pStk->GetMark();
+ pSecond = pStk->GetMark();
+ break;
+ case CurrPtCurrMk:
+ pFirst = pCur->GetPoint();
+ pSecond = pCur->GetMark();
+ break;
+ }
+ }
+ if( !pFirst || !pSecond )
+ nRet = INT_MAX;
+ else if( *pFirst < *pSecond )
+ nRet = -1;
+ else if( *pFirst == *pSecond )
+ nRet = 0;
+ else
+ nRet = 1;
+ return nRet;
+}
+
+
+sal_Bool SwCrsrShell::IsSttPara() const
+{ return( pCurCrsr->GetPoint()->nContent == 0 ? sal_True : sal_False ); }
+
+
+sal_Bool SwCrsrShell::IsEndPara() const
+{ return( pCurCrsr->GetPoint()->nContent == pCurCrsr->GetCntntNode()->Len() ? sal_True : sal_False ); }
+
+
+sal_Bool SwCrsrShell::IsInFrontOfLabel() const
+{
+ return pCurCrsr->IsInFrontOfLabel();
+}
+
+bool SwCrsrShell::SetInFrontOfLabel( sal_Bool bNew )
+{
+ if ( bNew != IsInFrontOfLabel() )
+ {
+ pCurCrsr->_SetInFrontOfLabel( bNew );
+ UpdateMarkedListLevel();
+ return true;
+ }
+ return false;
+}
+
+sal_Bool SwCrsrShell::GotoPage( sal_uInt16 nPage )
+{
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ sal_Bool bRet = GetLayout()->SetCurrPage( pCurCrsr, nPage ) &&
+ !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return bRet;
+}
+
+
+void SwCrsrShell::GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum,
+ sal_Bool bAtCrsrPos, const sal_Bool bCalcFrm )
+{
+ SET_CURR_SHELL( this );
+ // Seitennummer: die erste sichtbare Seite oder die am Cursor
+ const SwCntntFrm* pCFrm;
+ const SwPageFrm *pPg = 0;
+
+ if( !bAtCrsrPos || 0 == (pCFrm = GetCurrFrm( bCalcFrm )) ||
+ 0 == (pPg = pCFrm->FindPageFrm()) )
+ {
+ pPg = Imp()->GetFirstVisPage();
+ while( pPg && pPg->IsEmptyPage() )
+ pPg = (const SwPageFrm *)pPg->GetNext();
+ }
+ // Abfrage auf pPg muss fuer den Sonderfall Writerstart mit
+ // standard.vor sein.
+ rnPhyNum = pPg? pPg->GetPhyPageNum() : 1;
+ rnVirtNum = pPg? pPg->GetVirtPageNum() : 1;
+}
+
+
+sal_uInt16 SwCrsrShell::GetNextPrevPageNum( sal_Bool bNext )
+{
+ SET_CURR_SHELL( this );
+
+ // Seitennummer: die erste sichtbare Seite oder die am Cursor
+ const SwPageFrm *pPg = Imp()->GetFirstVisPage();
+ if( pPg )
+ {
+ const SwTwips nPageTop = pPg->Frm().Top();
+
+ if( bNext )
+ {
+ // go to next view layout row:
+ do
+ {
+ pPg = (const SwPageFrm *)pPg->GetNext();
+ }
+ while( pPg && pPg->Frm().Top() == nPageTop );
+
+ while( pPg && pPg->IsEmptyPage() )
+ pPg = (const SwPageFrm *)pPg->GetNext();
+ }
+ else
+ {
+ // go to previous view layout row:
+ do
+ {
+ pPg = (const SwPageFrm *)pPg->GetPrev();
+ }
+ while( pPg && pPg->Frm().Top() == nPageTop );
+
+ while( pPg && pPg->IsEmptyPage() )
+ pPg = (const SwPageFrm *)pPg->GetPrev();
+ }
+ }
+ // Abfrage auf pPg muss fuer den Sonderfall Writerstart mit
+ // standard.vor sein.
+ return pPg ? pPg->GetPhyPageNum() : USHRT_MAX;
+}
+
+
+sal_uInt16 SwCrsrShell::GetPageCnt()
+{
+ SET_CURR_SHELL( this );
+ // gebe die Anzahl der Seiten zurueck
+ return GetLayout()->GetPageNum();
+}
+
+// Gehe zur naechsten SSelection
+
+
+sal_Bool SwCrsrShell::GoNextCrsr()
+{
+ // besteht ueberhaupt ein Ring ?
+ if( pCurCrsr->GetNext() == pCurCrsr )
+ return sal_False;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ pCurCrsr = dynamic_cast<SwShellCrsr*>(pCurCrsr->GetNext());
+
+ // Bug 24086: auch alle anderen anzeigen
+ if( !ActionPend() )
+ {
+ UpdateCrsr();
+ pCurCrsr->Show();
+ }
+ return sal_True;
+}
+
+// gehe zur vorherigen SSelection
+
+
+sal_Bool SwCrsrShell::GoPrevCrsr()
+{
+ // besteht ueberhaupt ein Ring ?
+ if( pCurCrsr->GetNext() == pCurCrsr )
+ return sal_False;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ pCurCrsr = dynamic_cast<SwShellCrsr*>(pCurCrsr->GetPrev());
+
+ // Bug 24086: auch alle anderen anzeigen
+ if( !ActionPend() )
+ {
+ UpdateCrsr();
+ pCurCrsr->Show();
+ }
+
+ return sal_True;
+}
+
+
+void SwCrsrShell::Paint( const Rectangle &rRect)
+{
+ SET_CURR_SHELL( this );
+
+ // beim Painten immer alle Cursor ausschalten
+ SwRect aRect( rRect );
+
+ sal_Bool bVis = sal_False;
+ // ist Cursor sichtbar, dann verstecke den SV-Cursor
+ if( pVisCrsr->IsVisible() && !aRect.IsOver( aCharRect ) ) //JP 18.06.97: ???
+ {
+ bVis = sal_True;
+ pVisCrsr->Hide();
+ }
+
+ // Bereich neu painten
+ ViewShell::Paint( rRect );
+
+ if( bHasFocus && !bBasicHideCrsr )
+ {
+ SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+// pAktCrsr->Invalidate( aRect );
+ if( !ActionPend() )
+ {
+ // damit nicht rechts/unten die Raender abgeschnitten werden
+ pAktCrsr->Invalidate( VisArea() );
+ pAktCrsr->Show();
+ }
+ else
+ pAktCrsr->Invalidate( aRect );
+
+ }
+ if( bSVCrsrVis && bVis ) // auch SV-Cursor wieder anzeigen
+ pVisCrsr->Show();
+}
+
+
+
+void SwCrsrShell::VisPortChgd( const SwRect & rRect )
+{
+ SET_CURR_SHELL( this );
+ sal_Bool bVis; // beim Scrollen immer alle Cursor ausschalten
+
+ // ist Cursor sichtbar, dann verstecke den SV-Cursor
+ if( sal_True == ( bVis = pVisCrsr->IsVisible() ))
+ pVisCrsr->Hide();
+
+ bVisPortChgd = sal_True;
+ aOldRBPos.X() = VisArea().Right();
+ aOldRBPos.Y() = VisArea().Bottom();
+
+ //Damit es es keine Probleme mit dem SV-Cursor gibt, wird in
+ //ViewShell::VisPo.. ein Update() auf das Window gerufen.
+ //Waehrend des Paintens duerfen aber nun wieder keine Selectionen
+ //angezeigt werden, deshalb wird der Aufruf hier geklammert.
+ ViewShell::VisPortChgd( rRect ); // Bereich verschieben
+
+/*
+ SwRect aRect( rRect );
+ if( VisArea().IsOver( aRect ) )
+ pCurCrsr->Invalidate( aRect );
+*/
+
+ if( bSVCrsrVis && bVis ) // auch SV-Cursor wieder anzeigen
+ pVisCrsr->Show();
+
+ if( nCrsrMove )
+ bInCMvVisportChgd = sal_True;
+
+ bVisPortChgd = sal_False;
+}
+
+// aktualisiere den Crsrs, d.H. setze ihn wieder in den Content.
+// Das sollte nur aufgerufen werden, wenn der Cursor z.B. beim
+// Loeschen von Rahmen irgendwohin gesetzt wurde. Die Position
+// ergibt sich aus seiner aktuellen Position im Layout !!
+
+
+void SwCrsrShell::UpdateCrsrPos()
+{
+ SET_CURR_SHELL( this );
+ ++nStartAction;
+ SwShellCrsr* pShellCrsr = getShellCrsr( true );
+ Size aOldSz( GetDocSize() );
+ SwCntntNode *pCNode = pShellCrsr->GetCntntNode();
+ SwCntntFrm *pFrm = pCNode ?
+ pCNode->getLayoutFrm( GetLayout(), &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), sal_False ) :0;
+ if( !pFrm || (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow()) )
+ {
+ SwCrsrMoveState aTmpState( MV_NONE );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ GetLayout()->GetCrsrOfst( pShellCrsr->GetPoint(), pShellCrsr->GetPtPos(),
+ &aTmpState );
+ if( pShellCrsr->HasMark())
+ pShellCrsr->DeleteMark();
+ }
+ IGrammarContact *pGrammarContact = GetDoc() ? GetDoc()->getGrammarContact() : 0;
+ if( pGrammarContact )
+ pGrammarContact->updateCursorPosition( *pCurCrsr->GetPoint() );
+ --nStartAction;
+ if( aOldSz != GetDocSize() )
+ SizeChgNotify();
+}
+
+// JP 30.04.99: Bug 65475 - falls Point/Mark in versteckten Bereichen
+// stehen, so mussen diese daraus verschoben werden
+static void lcl_CheckHiddenSection( SwNodeIndex& rIdx )
+{
+ const SwSectionNode* pSectNd = rIdx.GetNode().FindSectionNode();
+ if( pSectNd && pSectNd->GetSection().IsHiddenFlag() )
+ {
+ SwNodeIndex aTmp( *pSectNd );
+#if OSL_DEBUG_LEVEL > 1
+ const SwNode* pFrmNd =
+#endif
+ rIdx.GetNodes().FindPrvNxtFrmNode( aTmp, pSectNd->EndOfSectionNode() );
+
+#if OSL_DEBUG_LEVEL > 1
+ (void) pFrmNd;
+ ASSERT( pFrmNd, "keinen Node mit Frames gefunden" );
+#endif
+ rIdx = aTmp;
+ }
+}
+
+// Try to set the cursor to the next visible content node.
+static void lcl_CheckHiddenPara( SwPosition& rPos )
+{
+ SwNodeIndex aTmp( rPos.nNode );
+ SwTxtNode* pTxtNd = aTmp.GetNode().GetTxtNode();
+ while( pTxtNd && pTxtNd->HasHiddenCharAttribute( true ) )
+ {
+ SwCntntNode* pCntnt = aTmp.GetNodes().GoNext( &aTmp );
+ if ( pCntnt && pCntnt->IsTxtNode() )
+ pTxtNd = (SwTxtNode*)pCntnt;
+ else
+ pTxtNd = 0;
+ }
+
+ if ( pTxtNd )
+ rPos = SwPosition( aTmp, SwIndex( pTxtNd, 0 ) );
+}
+
+// --> OD 2005-12-14 #i27301# - helper class, which notifies the accessibility
+// about invalid text selections in its destructor
+class SwNotifyAccAboutInvalidTextSelections
+{
+ private:
+ SwCrsrShell& mrCrsrSh;
+
+ public:
+ SwNotifyAccAboutInvalidTextSelections( SwCrsrShell& _rCrsrSh )
+ : mrCrsrSh( _rCrsrSh )
+ {}
+
+ ~SwNotifyAccAboutInvalidTextSelections()
+ {
+ mrCrsrSh.InvalidateAccessibleParaTextSelection();
+ }
+};
+// <--
+void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, sal_Bool bIdleEnd )
+{
+ SET_CURR_SHELL( this );
+
+ ClearUpCrsrs();
+
+ // erfrage den Count fuer die Start-/End-Actions und ob die Shell
+ // ueberhaupt den Focus hat
+// if( ActionPend() /*|| !bHasFocus*/ )
+ //JP 12.01.98: Bug #46496# - es muss innerhalb einer BasicAction der
+ // Cursor geupdatet werden; um z.B. den TabellenCursor zu
+ // erzeugen. Im EndAction wird jetzt das UpdateCrsr gerufen!
+ if( ActionPend() && BasicActionPend() )
+ {
+ if ( eFlags & SwCrsrShell::READONLY )
+ bIgnoreReadonly = sal_True;
+ return; // wenn nicht, dann kein Update !!
+ }
+
+ // --> OD 2005-12-14 #i27301#
+ SwNotifyAccAboutInvalidTextSelections aInvalidateTextSelections( *this );
+ // <--
+
+ if ( bIgnoreReadonly )
+ {
+ bIgnoreReadonly = sal_False;
+ eFlags |= SwCrsrShell::READONLY;
+ }
+
+ if( eFlags & SwCrsrShell::CHKRANGE ) // alle Cursor-Bewegungen auf
+ CheckRange( pCurCrsr ); // ueberlappende Bereiche testen
+
+ if( !bIdleEnd )
+ CheckTblBoxCntnt();
+
+ // steht der akt. Crsr in einer Tabelle und in unterschiedlichen Boxen
+ // (oder ist noch TabellenMode), dann gilt der Tabellen Mode
+ SwPaM* pTstCrsr = getShellCrsr( true );
+ if( pTstCrsr->HasMark() && !pBlockCrsr &&
+ pDoc->IsIdxInTbl( pTstCrsr->GetPoint()->nNode ) &&
+ ( pTblCrsr ||
+ pTstCrsr->GetNode( sal_True )->StartOfSectionNode() !=
+ pTstCrsr->GetNode( sal_False )->StartOfSectionNode() ) )
+ {
+ SwShellCrsr* pITmpCrsr = getShellCrsr( true );
+ Point aTmpPt( pITmpCrsr->GetPtPos() );
+ Point aTmpMk( pITmpCrsr->GetMkPos() );
+ SwPosition* pPos = pITmpCrsr->GetPoint();
+
+ // JP 30.04.99: Bug 65475 - falls Point/Mark in versteckten Bereichen
+ // stehen, so mussen diese daraus verschoben werden
+ lcl_CheckHiddenSection( pPos->nNode );
+ lcl_CheckHiddenSection( pITmpCrsr->GetMark()->nNode );
+
+ // Move cursor out of hidden paragraphs
+ if ( !GetViewOptions()->IsShowHiddenChar() )
+ {
+ lcl_CheckHiddenPara( *pPos );
+ lcl_CheckHiddenPara( *pITmpCrsr->GetMark() );
+ }
+
+ SwCntntFrm *pTblFrm = pPos->nNode.GetNode().GetCntntNode()->
+ getLayoutFrm( GetLayout(), &aTmpPt, pPos, sal_False );
+
+ ASSERT( pTblFrm, "Tabelle Crsr nicht im Content ??" );
+
+ // --> FME 2005-12-02 #126107# Make code robust. The table
+ // cursor may point to a table in a currently inactive header.
+ SwTabFrm *pTab = pTblFrm ? pTblFrm->FindTabFrm() : 0;
+ // <--
+
+ if ( pTab && pTab->GetTable()->GetRowsToRepeat() > 0 )
+ {
+ // First check if point is in repeated headline:
+ bool bInRepeatedHeadline = pTab->IsFollow() && pTab->IsInHeadline( *pTblFrm );
+
+ // Second check if mark is in repeated headline:
+ if ( !bInRepeatedHeadline )
+ {
+ SwCntntFrm* pMarkTblFrm = pITmpCrsr->GetCntntNode( sal_False )->
+ getLayoutFrm( GetLayout(), &aTmpMk, pITmpCrsr->GetMark(), sal_False );
+ ASSERT( pMarkTblFrm, "Tabelle Crsr nicht im Content ??" );
+
+ if ( pMarkTblFrm )
+ {
+ SwTabFrm* pMarkTab = pMarkTblFrm->FindTabFrm();
+ ASSERT( pMarkTab, "Tabelle Crsr nicht im Content ??" );
+
+ // --> FME 2005-11-28 #120360# Make code robust:
+ if ( pMarkTab )
+ {
+ bInRepeatedHeadline = pMarkTab->IsFollow() && pMarkTab->IsInHeadline( *pMarkTblFrm );
+ }
+ // <--
+ }
+ }
+
+ // No table cursor in repeaded headlines:
+ if ( bInRepeatedHeadline )
+ {
+ pTblFrm = 0;
+
+ SwPosSection fnPosSect = *pPos < *pITmpCrsr->GetMark()
+ ? fnSectionStart
+ : fnSectionEnd;
+
+ // dann nur innerhalb der Box selektieren
+ if( pTblCrsr )
+ {
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *pTblCrsr->GetMark();
+ pCurCrsr->GetMkPos() = pTblCrsr->GetMkPos();
+ pTblCrsr->DeleteMark();
+ pTblCrsr->SwSelPaintRects::Hide();
+ }
+
+ *pCurCrsr->GetPoint() = *pCurCrsr->GetMark();
+ (*fnSectionCurr)( *pCurCrsr, fnPosSect );
+ }
+ }
+
+ // wir wollen wirklich eine Tabellen-Selektion
+ if( pTab && pTblFrm )
+ {
+ if( !pTblCrsr )
+ {
+ pTblCrsr = new SwShellTableCrsr( *this,
+ *pCurCrsr->GetMark(), pCurCrsr->GetMkPos(),
+ *pPos, aTmpPt );
+ pCurCrsr->DeleteMark();
+ pCurCrsr->SwSelPaintRects::Hide();
+
+ CheckTblBoxCntnt();
+ }
+
+ SwCrsrMoveState aTmpState( MV_NONE );
+ aTmpState.bRealHeight = sal_True;
+ if( !pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint(), &aTmpState ) )
+ {
+ Point aCentrPt( aCharRect.Center() );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ pTblFrm->GetCrsrOfst( pTblCrsr->GetPoint(), aCentrPt, &aTmpState );
+#ifndef DBG_UTIL
+ pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() );
+#else
+ if ( !pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() ) )
+ ASSERT( !this, "GetCharRect failed." );
+#endif
+ }
+// ALIGNRECT( aCharRect );
+
+ pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
+ // Curosr in den sichtbaren Bereich scrollen
+ if( (eFlags & SwCrsrShell::SCROLLWIN) &&
+ (HasSelection() || eFlags & SwCrsrShell::READONLY ||
+ !IsCrsrReadonly()) )
+ {
+ SwFrm* pBoxFrm = pTblFrm;
+ while( pBoxFrm && !pBoxFrm->IsCellFrm() )
+ pBoxFrm = pBoxFrm->GetUpper();
+ if( pBoxFrm && pBoxFrm->Frm().HasArea() )
+ MakeVisible( pBoxFrm->Frm() );
+ else
+ MakeVisible( aCharRect );
+ }
+
+ // lasse vom Layout die Crsr in den Boxen erzeugen
+ if( pTblCrsr->IsCrsrMovedUpdt() )
+ GetLayout()->MakeTblCrsrs( *pTblCrsr );
+ if( bHasFocus && !bBasicHideCrsr )
+ pTblCrsr->Show();
+
+ // Cursor-Points auf die neuen Positionen setzen
+ pTblCrsr->GetPtPos().X() = aCharRect.Left();
+ pTblCrsr->GetPtPos().Y() = aCharRect.Top();
+
+ if( bSVCrsrVis )
+ {
+ aCrsrHeight.X() = 0;
+ aCrsrHeight.Y() = aTmpState.aRealHeight.Y() < 0 ?
+ -aCharRect.Width() : aCharRect.Height();
+ pVisCrsr->Show(); // wieder anzeigen
+ }
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst
+ if( pTblFrm && Imp()->IsAccessible() )
+ Imp()->InvalidateAccessibleCursorPosition( pTblFrm );
+ return;
+ }
+ }
+
+ if( pTblCrsr )
+ {
+ // Cursor Ring loeschen
+ while( pCurCrsr->GetNext() != pCurCrsr )
+ delete pCurCrsr->GetNext();
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
+ pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos();
+ delete pTblCrsr, pTblCrsr = 0;
+ }
+
+ pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
+
+ // sind wir vielleicht in einer geschuetzten/versteckten Section ?
+ {
+ SwShellCrsr* pShellCrsr = getShellCrsr( true );
+ sal_Bool bChgState = sal_True;
+ const SwSectionNode* pSectNd = pShellCrsr->GetNode()->FindSectionNode();
+ if( pSectNd && ( pSectNd->GetSection().IsHiddenFlag() ||
+ ( !IsReadOnlyAvailable() &&
+ pSectNd->GetSection().IsProtectFlag() &&
+ ( !pDoc->GetDocShell() ||
+ !pDoc->GetDocShell()->IsReadOnly() || bAllProtect )) ) )
+ {
+ if( !FindValidCntntNode( !HasDrawView() ||
+ 0 == Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount()))
+ {
+ // alles ist geschuetzt / versteckt -> besonderer Mode
+ if( bAllProtect && !IsReadOnlyAvailable() &&
+ pSectNd->GetSection().IsProtectFlag() )
+ bChgState = sal_False;
+ else
+ {
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling
+ bAllProtect = sal_True;
+ if( GetDoc()->GetDocShell() )
+ {
+ GetDoc()->GetDocShell()->SetReadOnlyUI( sal_True );
+ CallChgLnk(); // UI bescheid sagen!
+ }
+ return;
+ }
+ }
+ }
+ if( bChgState )
+ {
+ sal_Bool bWasAllProtect = bAllProtect;
+ bAllProtect = sal_False;
+ if( bWasAllProtect && GetDoc()->GetDocShell() &&
+ GetDoc()->GetDocShell()->IsReadOnlyUI() )
+ {
+ GetDoc()->GetDocShell()->SetReadOnlyUI( sal_False );
+ CallChgLnk(); // UI bescheid sagen!
+ }
+ }
+ }
+
+ UpdateCrsrPos();
+
+ // #100722# The cursor must always point into content; there's some code
+ // that relies on this. (E.g. in SwEditShell::GetScriptType, which always
+ // loops _behind_ the last node in the selection, which always works if you
+ // are in content.) To achieve this, we'll force cursor(s) to point into
+ // content, if UpdateCrsrPos() hasn't already done so.
+ SwPaM* pCmp = pCurCrsr;
+ do
+ {
+ // start will move forwards, end will move backwards
+ bool bPointIsStart = ( pCmp->Start() == pCmp->GetPoint() );
+
+ // move point; forward if it's the start, backwards if it's the end
+ if( ! pCmp->GetPoint()->nNode.GetNode().IsCntntNode() )
+ pCmp->Move( bPointIsStart ? fnMoveForward : fnMoveBackward,
+ fnGoCntnt );
+
+ // move mark (if exists); forward if it's the start, else backwards
+ if( pCmp->HasMark() )
+ {
+ if( ! pCmp->GetMark()->nNode.GetNode().IsCntntNode() )
+ {
+ pCmp->Exchange();
+ pCmp->Move( !bPointIsStart ? fnMoveForward : fnMoveBackward,
+ fnGoCntnt );
+ pCmp->Exchange();
+ }
+ }
+
+ // iterate to next PaM in ring
+ pCmp = static_cast<SwPaM*>( pCmp->GetNext() );
+ }
+ while( pCmp != pCurCrsr );
+
+
+ SwRect aOld( aCharRect );
+ sal_Bool bFirst = sal_True;
+ SwCntntFrm *pFrm;
+ int nLoopCnt = 100;
+ SwShellCrsr* pShellCrsr = getShellCrsr( true );
+
+ do {
+ sal_Bool bAgainst;
+ do {
+ bAgainst = sal_False;
+ pFrm = pShellCrsr->GetCntntNode()->getLayoutFrm( GetLayout(),
+ &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), sal_False );
+ // ist der Frm nicht mehr vorhanden, dann muss das gesamte Layout
+ // erzeugt werden, weil ja mal hier einer vorhanden war !!
+ if ( !pFrm )
+ {
+ do
+ {
+ CalcLayout();
+ pFrm = pShellCrsr->GetCntntNode()->getLayoutFrm( GetLayout(),
+ &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), sal_False );
+ } while( !pFrm );
+ }
+ else if ( Imp()->IsIdleAction() )
+ //Wir stellen sicher, dass anstaendig Formatiert wurde #42224#
+ pFrm->PrepareCrsr();
+
+ // im geschuetzten Fly? aber bei Rahmenselektion ignorieren
+ if( !IsReadOnlyAvailable() && pFrm->IsProtected() &&
+ ( !Imp()->GetDrawView() ||
+ !Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() ) &&
+ (!pDoc->GetDocShell() ||
+ !pDoc->GetDocShell()->IsReadOnly() || bAllProtect ) )
+ {
+ // dann suche eine gueltige Position
+ sal_Bool bChgState = sal_True;
+ if( !FindValidCntntNode(!HasDrawView() ||
+ 0 == Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount()))
+ {
+ // alles ist geschuetzt / versteckt -> besonderer Mode
+ if( bAllProtect )
+ bChgState = sal_False;
+ else
+ {
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling
+ bAllProtect = sal_True;
+ if( GetDoc()->GetDocShell() )
+ {
+ GetDoc()->GetDocShell()->SetReadOnlyUI( sal_True );
+ CallChgLnk(); // UI bescheid sagen!
+ }
+ return;
+ }
+ }
+
+ if( bChgState )
+ {
+ sal_Bool bWasAllProtect = bAllProtect;
+ bAllProtect = sal_False;
+ if( bWasAllProtect && GetDoc()->GetDocShell() &&
+ GetDoc()->GetDocShell()->IsReadOnlyUI() )
+ {
+ GetDoc()->GetDocShell()->SetReadOnlyUI( sal_False );
+ CallChgLnk(); // UI bescheid sagen!
+ }
+ bAllProtect = sal_False;
+ bAgainst = sal_True; // nochmal den richigen Frm suchen
+ }
+ }
+ } while( bAgainst );
+
+ if( !( eFlags & SwCrsrShell::NOCALRECT ))
+ {
+ SwCrsrMoveState aTmpState( eMvState );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ aTmpState.bRealHeight = sal_True;
+ aTmpState.bRealWidth = IsOverwriteCrsr();
+ aTmpState.nCursorBidiLevel = pShellCrsr->GetCrsrBidiLevel();
+
+ // #i27615#,#i30453#
+ SwSpecialPos aSpecialPos;
+ aSpecialPos.nExtendRange = SP_EXTEND_RANGE_BEFORE;
+ if (pShellCrsr->IsInFrontOfLabel())
+ {
+ aTmpState.pSpecialPos = &aSpecialPos;
+ }
+
+ if( !pFrm->GetCharRect( aCharRect, *pShellCrsr->GetPoint(), &aTmpState ) )
+ {
+ Point& rPt = pShellCrsr->GetPtPos();
+ rPt = aCharRect.Center();
+ pFrm->GetCrsrOfst( pShellCrsr->GetPoint(), rPt, &aTmpState );
+ }
+// ALIGNRECT( aCharRect );
+
+ if( !pShellCrsr->HasMark() )
+ aCrsrHeight = aTmpState.aRealHeight;
+ else
+ {
+ aCrsrHeight.X() = 0;
+ aCrsrHeight.Y() = aTmpState.aRealHeight.Y() < 0 ?
+ -aCharRect.Width() : aCharRect.Height();
+ }
+ }
+ else
+ {
+ aCrsrHeight.X() = 0;
+ aCrsrHeight.Y() = aCharRect.Height();
+ }
+
+ if( !bFirst && aOld == aCharRect )
+ break;
+
+ // falls das Layout meint, nach dem 100 durchlauf ist man immer noch
+ // im Fluss, sollte man die akt. Pos. als gegeben hinnehmen!
+ // siehe Bug: 29658
+ if( !--nLoopCnt )
+ {
+ ASSERT( !this, "Endlosschleife? CharRect != OldCharRect ");
+ break;
+ }
+ aOld = aCharRect;
+ bFirst = sal_False;
+
+ // Cursor-Points auf die neuen Positionen setzen
+ pShellCrsr->GetPtPos().X() = aCharRect.Left();
+ pShellCrsr->GetPtPos().Y() = aCharRect.Top();
+
+ if( !(eFlags & SwCrsrShell::UPDOWN )) // alte Pos. von Up/Down loeschen
+ {
+ pFrm->Calc();
+ nUpDownX = pFrm->IsVertical() ?
+ aCharRect.Top() - pFrm->Frm().Top() :
+ aCharRect.Left() - pFrm->Frm().Left();
+ }
+
+ // Curosr in den sichtbaren Bereich scrollen
+ if( bHasFocus && eFlags & SwCrsrShell::SCROLLWIN &&
+ (HasSelection() || eFlags & SwCrsrShell::READONLY ||
+ !IsCrsrReadonly() || GetViewOptions()->IsSelectionInReadonly()) )
+ {
+ //JP 30.04.99: damit das EndAction, beim evtuellen Scrollen, den
+ // SV-Crsr nicht wieder sichtbar macht, wird hier das Flag
+ // gesichert und zurueckgesetzt.
+ sal_Bool bSav = bSVCrsrVis; bSVCrsrVis = sal_False;
+ MakeSelVisible();
+ bSVCrsrVis = bSav;
+ }
+
+ } while( eFlags & SwCrsrShell::SCROLLWIN );
+
+ if( pBlockCrsr )
+ RefreshBlockCursor();
+
+ if( !bIdleEnd && bHasFocus && !bBasicHideCrsr )
+ {
+ if( pTblCrsr )
+ pTblCrsr->SwSelPaintRects::Show();
+ else
+ {
+ pCurCrsr->SwSelPaintRects::Show();
+ if( pBlockCrsr )
+ {
+ SwShellCrsr* pNxt = dynamic_cast<SwShellCrsr*>(pCurCrsr->GetNext());
+ while( pNxt && pNxt != pCurCrsr )
+ {
+ pNxt->SwSelPaintRects::Show();
+ pNxt = dynamic_cast<SwShellCrsr*>(pNxt->GetNext());
+ }
+ }
+ }
+ }
+
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst
+
+ if( pFrm && Imp()->IsAccessible() )
+ Imp()->InvalidateAccessibleCursorPosition( pFrm );
+
+ // switch from blinking cursor to read-only-text-selection cursor
+ static const long nNoBlinkTime = STYLE_CURSOR_NOBLINKTIME;
+ const long nBlinkTime = GetOut()->GetSettings().GetStyleSettings().
+ GetCursorBlinkTime();
+
+ if ( (IsCrsrReadonly() && GetViewOptions()->IsSelectionInReadonly()) ==
+ ( nBlinkTime != nNoBlinkTime ) )
+ {
+ // non blinking cursor in read only - text selection mode
+ AllSettings aSettings = GetOut()->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ const long nNewBlinkTime = nBlinkTime == nNoBlinkTime ?
+ Application::GetSettings().GetStyleSettings().GetCursorBlinkTime() :
+ nNoBlinkTime;
+ aStyleSettings.SetCursorBlinkTime( nNewBlinkTime );
+ aSettings.SetStyleSettings( aStyleSettings );
+ GetOut()->SetSettings( aSettings );
+ }
+
+ if( bSVCrsrVis )
+ pVisCrsr->Show(); // wieder anzeigen
+}
+
+void SwCrsrShell::RefreshBlockCursor()
+{
+ ASSERT( pBlockCrsr, "Don't call me without a block cursor" );
+ SwShellCrsr &rBlock = pBlockCrsr->getShellCrsr();
+ Point aPt = rBlock.GetPtPos();
+ SwCntntFrm* pFrm = rBlock.GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, rBlock.GetPoint(), sal_False );
+ Point aMk;
+ if( pBlockCrsr->getEndPoint() && pBlockCrsr->getStartPoint() )
+ {
+ aPt = *pBlockCrsr->getStartPoint();
+ aMk = *pBlockCrsr->getEndPoint();
+ }
+ else
+ {
+ aPt = rBlock.GetPtPos();
+ if( pFrm )
+ {
+ if( pFrm->IsVertical() )
+ aPt.Y() = pFrm->Frm().Top() + GetUpDownX();
+ else
+ aPt.X() = pFrm->Frm().Left() + GetUpDownX();
+ }
+ aMk = rBlock.GetMkPos();
+ }
+ SwRect aRect( aMk, aPt );
+ aRect.Justify();
+ SwSelectionList aSelList( pFrm );
+
+ if( GetLayout()->FillSelection( aSelList, aRect ) )
+ {
+ SwCursor* pNxt = (SwCursor*)pCurCrsr->GetNext();
+ while( pNxt != pCurCrsr )
+ {
+ delete pNxt;
+ pNxt = (SwCursor*)pCurCrsr->GetNext();
+ }
+
+ std::list<SwPaM*>::iterator pStart = aSelList.getStart();
+ std::list<SwPaM*>::iterator pPam = aSelList.getEnd();
+ ASSERT( pPam != pStart, "FillSelection should deliver at least one PaM" )
+ pCurCrsr->SetMark();
+ --pPam;
+ // If there is only one text portion inside the rectangle, a simple
+ // selection is created
+ if( pPam == pStart )
+ {
+ *pCurCrsr->GetPoint() = *(*pPam)->GetPoint();
+ if( (*pPam)->HasMark() )
+ *pCurCrsr->GetMark() = *(*pPam)->GetMark();
+ else
+ pCurCrsr->DeleteMark();
+ delete *pPam;
+ pCurCrsr->SetColumnSelection( false );
+ }
+ else
+ {
+ // The order of the SwSelectionList has to be preserved but
+ // the order inside the ring created by CreateCrsr() is not like
+ // exspected => First create the selections before the last one
+ // downto the first selection.
+ // At least create the cursor for the last selection
+ --pPam;
+ *pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n-1 (if n == number of selections)
+ if( (*pPam)->HasMark() )
+ *pCurCrsr->GetMark() = *(*pPam)->GetMark();
+ else
+ pCurCrsr->DeleteMark();
+ delete *pPam;
+ pCurCrsr->SetColumnSelection( true );
+ while( pPam != pStart )
+ {
+ --pPam;
+
+ SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
+ pNew->Insert( pCurCrsr, 0 );
+ pCurCrsr->Remove( 0, pCurCrsr->Count() );
+ pCurCrsr->DeleteMark();
+
+ *pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n-2, n-3, .., 2, 1
+ if( (*pPam)->HasMark() )
+ {
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *(*pPam)->GetMark();
+ }
+ else
+ pCurCrsr->DeleteMark();
+ pCurCrsr->SetColumnSelection( true );
+ delete *pPam;
+ }
+ {
+ SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
+ pNew->Insert( pCurCrsr, 0 );
+ pCurCrsr->Remove( 0, pCurCrsr->Count() );
+ pCurCrsr->DeleteMark();
+ }
+ pPam = aSelList.getEnd();
+ --pPam;
+ *pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n, the last selection
+ if( (*pPam)->HasMark() )
+ {
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *(*pPam)->GetMark();
+ }
+ else
+ pCurCrsr->DeleteMark();
+ pCurCrsr->SetColumnSelection( true );
+ delete *pPam;
+ }
+ }
+}
+
+// erzeuge eine Kopie vom Cursor und speicher diese im Stack
+
+
+void SwCrsrShell::Push()
+{
+ pCrsrStk = new SwShellCrsr( *this, *pCurCrsr->GetPoint(),
+ pCurCrsr->GetPtPos(), pCrsrStk );
+
+ if( pCurCrsr->HasMark() )
+ {
+ pCrsrStk->SetMark();
+ *pCrsrStk->GetMark() = *pCurCrsr->GetMark();
+ }
+}
+
+/*
+ * Loescht einen Cursor (gesteuert durch bOldCrsr)
+ * - vom Stack oder ( bOldCrsr = sal_True )
+ * - den aktuellen und der auf dem Stack stehende wird zum aktuellen
+ *
+ * Return: es war auf dem Stack noch einer vorhanden
+ */
+
+
+sal_Bool SwCrsrShell::Pop( sal_Bool bOldCrsr )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ // noch weitere vorhanden ?
+ if( 0 == pCrsrStk )
+ return sal_False;
+
+ SwShellCrsr *pTmp = 0, *pOldStk = pCrsrStk;
+
+ // der Nachfolger wird der Aktuelle
+ if( pCrsrStk->GetNext() != pCrsrStk )
+ {
+ pTmp = dynamic_cast<SwShellCrsr*>(pCrsrStk->GetNext());
+ }
+
+ if( bOldCrsr ) // loesche vom Stack
+ delete pCrsrStk; //
+
+ pCrsrStk = pTmp; // neu zuweisen
+
+ if( !bOldCrsr )
+ {
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ // wurde die sichtbare SSelection nicht veraendert
+ if( pOldStk->GetPtPos() == pCurCrsr->GetPtPos() ||
+ pOldStk->GetPtPos() == pCurCrsr->GetMkPos() )
+ {
+ // "Selektions-Rechtecke" verschieben
+ pCurCrsr->Insert( pOldStk, 0 );
+ pOldStk->Remove( 0, pOldStk->Count() );
+ }
+
+ if( pOldStk->HasMark() )
+ {
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *pOldStk->GetMark();
+ pCurCrsr->GetMkPos() = pOldStk->GetMkPos();
+ }
+ else
+ // keine Selection also alte aufheben und auf die alte Pos setzen
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = *pOldStk->GetPoint();
+ pCurCrsr->GetPtPos() = pOldStk->GetPtPos();
+ delete pOldStk;
+
+ if( !pCurCrsr->IsInProtectTable( sal_True ) &&
+ !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) )
+ UpdateCrsr(); // akt. Cursor Updaten
+ }
+ return sal_True;
+}
+
+/*
+ * Verbinde zwei Cursor miteinander.
+ * Loesche vom Stack den obersten und setzen dessen GetMark im Aktuellen.
+ */
+
+
+void SwCrsrShell::Combine()
+{
+ // noch weitere vorhanden ?
+ if( 0 == pCrsrStk )
+ return;
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ if( pCrsrStk->HasMark() ) // nur wenn GetMark gesetzt wurde
+ {
+#ifndef DBG_UTIL
+ CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, sal_True );
+#else
+ if( !CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, sal_True ))
+ ASSERT( !this, "StackCrsr & akt. Crsr nicht in gleicher Section." );
+#endif
+ // kopiere das GetMark
+ if( !pCurCrsr->HasMark() )
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *pCrsrStk->GetMark();
+ pCurCrsr->GetMkPos() = pCrsrStk->GetMkPos();
+ }
+
+ SwShellCrsr * pTmp = 0;
+ if( pCrsrStk->GetNext() != pCrsrStk )
+ {
+ pTmp = dynamic_cast<SwShellCrsr*>(pCrsrStk->GetNext());
+ }
+ delete pCrsrStk;
+ pCrsrStk = pTmp;
+ if( !pCurCrsr->IsInProtectTable( sal_True ) &&
+ !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) )
+ UpdateCrsr(); // akt. Cursor Updaten
+}
+
+
+void SwCrsrShell::HideCrsrs()
+{
+ if( !bHasFocus || bBasicHideCrsr )
+ return;
+
+ // ist Cursor sichtbar, dann verstecke den SV-Cursor
+ if( pVisCrsr->IsVisible() )
+ {
+ SET_CURR_SHELL( this );
+ pVisCrsr->Hide();
+ }
+ // hebe die Invertierung der SSelection auf
+ SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+ pAktCrsr->Hide();
+}
+
+
+
+void SwCrsrShell::ShowCrsrs( sal_Bool bCrsrVis )
+{
+ if( !bHasFocus || bAllProtect || bBasicHideCrsr )
+ return;
+
+ SET_CURR_SHELL( this );
+ SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+ pAktCrsr->Show();
+
+ if( bSVCrsrVis && bCrsrVis ) // auch SV-Cursor wieder anzeigen
+ pVisCrsr->Show();
+}
+
+// Methoden zum Anzeigen bzw. Verstecken des sichtbaren Text-Cursors
+
+
+void SwCrsrShell::ShowCrsr()
+{
+ if( !bBasicHideCrsr )
+ {
+ bSVCrsrVis = sal_True;
+ UpdateCrsr();
+ }
+}
+
+
+void SwCrsrShell::HideCrsr()
+{
+ if( !bBasicHideCrsr )
+ {
+ bSVCrsrVis = sal_False;
+ // evt. die sel. Bereiche aufheben !!
+ SET_CURR_SHELL( this );
+ pVisCrsr->Hide();
+ }
+}
+
+
+void SwCrsrShell::ShLooseFcs()
+{
+ if( !bBasicHideCrsr )
+ HideCrsrs();
+ bHasFocus = sal_False;
+}
+
+
+void SwCrsrShell::ShGetFcs( sal_Bool bUpdate )
+{
+ bHasFocus = sal_True;
+ if( !bBasicHideCrsr && VisArea().Width() )
+ {
+ UpdateCrsr( static_cast<sal_uInt16>( bUpdate ?
+ SwCrsrShell::CHKRANGE|SwCrsrShell::SCROLLWIN
+ : SwCrsrShell::CHKRANGE ) );
+ ShowCrsrs( bSVCrsrVis ? sal_True : sal_False );
+ }
+}
+
+// gebe den aktuellen Frame, in dem der Cursor steht, zurueck
+
+SwCntntFrm *SwCrsrShell::GetCurrFrm( const sal_Bool bCalcFrm ) const
+{
+ SET_CURR_SHELL( (ViewShell*)this );
+ SwCntntFrm *pRet = 0;
+ SwCntntNode *pNd = pCurCrsr->GetCntntNode();
+ if ( pNd )
+ {
+ if ( bCalcFrm )
+ {
+ const sal_uInt16* pST = &nStartAction;
+ ++(*((sal_uInt16*)pST));
+ const Size aOldSz( GetDocSize() );
+ pRet = pNd->getLayoutFrm( GetLayout(), &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() );
+ --(*((sal_uInt16*)pST));
+ if( aOldSz != GetDocSize() )
+ ((SwCrsrShell*)this)->SizeChgNotify();
+ }
+ else
+ pRet = pNd->getLayoutFrm( GetLayout(), &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint(), sal_False);
+ }
+ return pRet;
+}
+
+
+// alle Attribut/Format-Aenderungen am akt. Node werden an den
+// Link weitergeleitet.
+
+
+void SwCrsrShell::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+{
+ const sal_uInt16 nWhich = pOld ?
+ pOld->Which() :
+ pNew ?
+ pNew->Which() :
+ sal::static_int_cast<sal_uInt16>(RES_MSG_BEGIN);
+
+ if( bCallChgLnk &&
+ ( nWhich < RES_MSG_BEGIN || nWhich >= RES_MSG_END ||
+ nWhich == RES_FMT_CHG || nWhich == RES_UPDATE_ATTR ||
+ nWhich == RES_ATTRSET_CHG ))
+ // die Messages werden nicht weitergemeldet
+ //MA 07. Apr. 94 fix(6681): RES_UPDATE_ATTR wird implizit vom
+ //SwTxtNode::Insert(SwTxtHint*, sal_uInt16) abgesetzt; hier wird reagiert und
+ //vom Insert brauch nicht mehr die Keule RES_FMT_CHG versandt werden.
+ CallChgLnk();
+
+ if( aGrfArrivedLnk.IsSet() &&
+ ( RES_GRAPHIC_ARRIVED == nWhich || RES_GRAPHIC_SWAPIN == nWhich ))
+ aGrfArrivedLnk.Call( this );
+}
+
+
+// Abfrage, ob der aktuelle Cursor eine Selektion aufspannt,
+// also, ob GetMark gesetzt und SPoint und GetMark unterschiedlich sind.
+
+
+sal_Bool SwCrsrShell::HasSelection() const
+{
+ const SwPaM* pCrsr = getShellCrsr( true );
+ return( IsTableMode() || ( pCrsr->HasMark() &&
+ *pCrsr->GetPoint() != *pCrsr->GetMark())
+ ? sal_True : sal_False );
+}
+
+
+void SwCrsrShell::CallChgLnk()
+{
+ // innerhalb von Start-/End-Action kein Call, sondern nur merken,
+ // das sich etwas geaendert hat. Wird bei EndAction beachtet.
+ if( BasicActionPend() )
+ bChgCallFlag = sal_True; // das Change merken
+ else if( aChgLnk.IsSet() )
+ {
+ if( bCallChgLnk )
+ aChgLnk.Call( this );
+ bChgCallFlag = sal_False; // Flag zuruecksetzen
+ }
+}
+
+// returne den am akt.Cursor selektierten Text eines Nodes.
+
+
+String SwCrsrShell::GetSelTxt() const
+{
+ String aTxt;
+ if( pCurCrsr->GetPoint()->nNode.GetIndex() ==
+ pCurCrsr->GetMark()->nNode.GetIndex() )
+ {
+ SwTxtNode* pTxtNd = pCurCrsr->GetNode()->GetTxtNode();
+ if( pTxtNd )
+ {
+ xub_StrLen nStt = pCurCrsr->Start()->nContent.GetIndex();
+ aTxt = pTxtNd->GetExpandTxt( nStt,
+ pCurCrsr->End()->nContent.GetIndex() - nStt );
+ }
+ }
+ return aTxt;
+}
+
+// gebe nur den Text ab der akt. Cursor Position zurueck (bis zum NodeEnde)
+
+
+String SwCrsrShell::GetText() const
+{
+ String aTxt;
+ if( pCurCrsr->GetPoint()->nNode.GetIndex() ==
+ pCurCrsr->GetMark()->nNode.GetIndex() )
+ {
+ SwTxtNode* pTxtNd = pCurCrsr->GetNode()->GetTxtNode();
+ if( pTxtNd )
+ aTxt = pTxtNd->GetTxt().Copy(
+ pCurCrsr->GetPoint()->nContent.GetIndex() );
+ }
+ return aTxt;
+}
+
+// hole vom Start/Ende der akt. SSelection das nte Zeichen
+sal_Unicode SwCrsrShell::GetChar( sal_Bool bEnd, long nOffset )
+{
+ if( IsTableMode() ) // im TabelleMode nicht moeglich
+ return 0;
+
+ const SwPosition* pPos = !pCurCrsr->HasMark() ? pCurCrsr->GetPoint()
+ : bEnd ? pCurCrsr->End() : pCurCrsr->Start();
+ SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+ if( !pTxtNd )
+ return 0;
+
+ xub_StrLen nPos = pPos->nContent.GetIndex();
+ const String& rStr = pTxtNd->GetTxt();
+ sal_Unicode cCh = 0;
+
+ if( ((nPos+nOffset) >= 0 ) && (nPos+nOffset) < rStr.Len() )
+ cCh = rStr.GetChar( static_cast<xub_StrLen>(nPos+nOffset) );
+
+ return cCh;
+}
+
+// erweiter die akt. SSelection am Anfang/Ende um n Zeichen
+
+
+sal_Bool SwCrsrShell::ExtendSelection( sal_Bool bEnd, xub_StrLen nCount )
+{
+ if( !pCurCrsr->HasMark() || IsTableMode() )
+ return sal_False; // keine Selektion
+
+ SwPosition* pPos = bEnd ? pCurCrsr->End() : pCurCrsr->Start();
+ SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+ ASSERT( pTxtNd, "kein TextNode, wie soll erweitert werden?" );
+
+ xub_StrLen nPos = pPos->nContent.GetIndex();
+ if( bEnd )
+ {
+ if( ( nPos + nCount ) <= pTxtNd->GetTxt().Len() )
+ nPos = nPos + nCount;
+ else
+ return sal_False; // nicht mehr moeglich
+ }
+ else if( nPos >= nCount )
+ nPos = nPos - nCount;
+ else
+ return sal_False; // nicht mehr moeglich
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+
+ pPos->nContent = nPos;
+ UpdateCrsr();
+
+ return sal_True;
+}
+
+// setze nur den sichtbaren Cursor an die angegebene Dokument-Pos.
+// returnt sal_False: wenn der SPoint vom Layout korrigiert wurde.
+
+sal_Bool SwCrsrShell::SetVisCrsr( const Point &rPt )
+{
+ SET_CURR_SHELL( this );
+ Point aPt( rPt );
+ SwPosition aPos( *pCurCrsr->GetPoint() );
+ SwCrsrMoveState aTmpState( MV_SETONLYTEXT );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ aTmpState.bRealHeight = sal_True;
+
+ sal_Bool bRet = GetLayout()->GetCrsrOfst( &aPos, aPt /*, &aTmpState*/ );
+
+ SetInFrontOfLabel( sal_False ); // #i27615#
+
+ // nur in TextNodes anzeigen !!
+ SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode();
+ if( !pTxtNd )
+ return sal_False;
+
+ const SwSectionNode* pSectNd = pTxtNd->FindSectionNode();
+ if( pSectNd && (pSectNd->GetSection().IsHiddenFlag() ||
+ ( !IsReadOnlyAvailable() &&
+ pSectNd->GetSection().IsProtectFlag())) )
+ return sal_False;
+
+ SwCntntFrm *pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt, &aPos );
+ if ( Imp()->IsIdleAction() )
+ pFrm->PrepareCrsr();
+ SwRect aTmp( aCharRect );
+
+ pFrm->GetCharRect( aCharRect, aPos, &aTmpState );
+// ALIGNRECT( aCharRect );
+
+ if( aTmp == aCharRect && // BUG 10137: bleibt der Cursor auf der
+ pVisCrsr->IsVisible() ) // Position nicht hidden & showen
+ return sal_True;
+
+ pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
+ if( IsScrollMDI( this, aCharRect ))
+ {
+ MakeVisible( aCharRect );
+ pCurCrsr->Show();
+ }
+
+ // Bug 29584: bei Rahmenselektion ist der Cursor versteckt, aber den
+ // D&D-Cursor will man trotzdem haben
+// if( bSVCrsrVis )
+ {
+ if( aTmpState.bRealHeight )
+ aCrsrHeight = aTmpState.aRealHeight;
+ else
+ {
+ aCrsrHeight.X() = 0;
+ aCrsrHeight.Y() = aCharRect.Height();
+ }
+
+ pVisCrsr->SetDragCrsr( sal_True );
+ pVisCrsr->Show(); // wieder anzeigen
+ }
+ return bRet;
+}
+
+sal_Bool SwCrsrShell::IsOverReadOnlyPos( const Point& rPt ) const
+{
+ Point aPt( rPt );
+ SwPaM aPam( *pCurCrsr->GetPoint() );
+ GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt );
+ // --> FME 2004-06-29 #114856# Formular view
+ return aPam.HasReadonlySel( GetViewOptions()->IsFormView() );
+ // <--
+}
+
+
+ // returne die Anzahl der Cursor im Ring (Flag besagt ob man nur
+ // aufgepspannte haben will - sprich etwas selektiert ist (Basic))
+sal_uInt16 SwCrsrShell::GetCrsrCnt( sal_Bool bAll ) const
+{
+ Ring* pTmp = GetCrsr()->GetNext();
+ sal_uInt16 n = (bAll || ( pCurCrsr->HasMark() &&
+ *pCurCrsr->GetPoint() != *pCurCrsr->GetMark())) ? 1 : 0;
+ while( pTmp != pCurCrsr )
+ {
+ if( bAll || ( ((SwPaM*)pTmp)->HasMark() &&
+ *((SwPaM*)pTmp)->GetPoint() != *((SwPaM*)pTmp)->GetMark()))
+ ++n;
+ pTmp = pTmp->GetNext();
+ }
+ return n;
+}
+
+
+sal_Bool SwCrsrShell::IsStartOfDoc() const
+{
+ if( pCurCrsr->GetPoint()->nContent.GetIndex() )
+ return sal_False;
+
+ // Hinter EndOfIcons kommt die Content-Section (EndNd+StNd+CntntNd)
+ SwNodeIndex aIdx( GetDoc()->GetNodes().GetEndOfExtras(), 2 );
+ if( !aIdx.GetNode().IsCntntNode() )
+ GetDoc()->GetNodes().GoNext( &aIdx );
+ return aIdx == pCurCrsr->GetPoint()->nNode;
+}
+
+
+sal_Bool SwCrsrShell::IsEndOfDoc() const
+{
+ SwNodeIndex aIdx( GetDoc()->GetNodes().GetEndOfContent(), -1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetDoc()->GetNodes().GoPrevious( &aIdx );
+
+ return aIdx == pCurCrsr->GetPoint()->nNode &&
+ pCNd->Len() == pCurCrsr->GetPoint()->nContent.GetIndex();
+}
+
+
+// loesche alle erzeugten Crsr, setze den Tabellen-Crsr und den letzten
+// Cursor auf seinen TextNode (oder StartNode?).
+// Beim naechsten ::GetCrsr werden sie wieder alle erzeugt
+// Wird fuers Drag&Drop / ClipBorad-Paste in Tabellen benoetigt.
+sal_Bool SwCrsrShell::ParkTblCrsr()
+{
+ if( !pTblCrsr )
+ return sal_False;
+
+ pTblCrsr->ParkCrsr();
+
+ while( pCurCrsr->GetNext() != pCurCrsr )
+ delete pCurCrsr->GetNext();
+
+ // vom Cursor !immer! SPoint und Mark umsetzen
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
+ pCurCrsr->DeleteMark();
+
+ return sal_True;
+}
+
+/***********************************************************************
+#* Class : SwCrsrShell
+#* Methode : ParkCrsr
+#* Beschreibung: Vernichtet Selektionen und zus. Crsr aller Shell der
+#* verbleibende Crsr der Shell wird geparkt.
+#* Datum : MA 05. Nov. 92
+#* Update : JP 19.09.97
+#***********************************************************************/
+
+void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing )
+{
+ const SwPosition *pStt = pDelRg->Start(),
+ *pEnd = pDelRg->GetPoint() == pStt ? pDelRg->GetMark() : pDelRg->GetPoint();
+
+ SwPaM *pTmpDel = 0, *pTmp = *ppDelRing;
+
+ // durchsuche den gesamten Ring
+ sal_Bool bGoNext;
+ do {
+ const SwPosition *pTmpStt = pTmp->Start(),
+ *pTmpEnd = pTmp->GetPoint() == pTmpStt ?
+ pTmp->GetMark() : pTmp->GetPoint();
+ /*
+ * liegt ein SPoint oder GetMark innerhalb vom Crsr-Bereich
+ * muss der alte Bereich aufgehoben werden.
+ * Beim Vergleich ist darauf zu achten, das End() nicht mehr zum
+ * Bereich gehoert !
+ */
+ if( *pStt <= *pTmpStt )
+ {
+ if( *pEnd > *pTmpStt ||
+ ( *pEnd == *pTmpStt && *pEnd == *pTmpEnd ))
+ pTmpDel = pTmp;
+ }
+ else
+ if( *pStt < *pTmpEnd )
+ pTmpDel = pTmp;
+
+ bGoNext = sal_True;
+ if( pTmpDel ) // ist der Pam im Bereich ?? loesche ihn
+ {
+ sal_Bool bDelete = sal_True;
+ if( *ppDelRing == pTmpDel )
+ {
+ if( *ppDelRing == pCurCrsr )
+ {
+ if( sal_True == ( bDelete = GoNextCrsr() ))
+ {
+ bGoNext = sal_False;
+ pTmp = (SwPaM*)pTmp->GetNext();
+ }
+ }
+ else
+ bDelete = sal_False; // StackCrsr nie loeschen !!
+ }
+
+ if( bDelete )
+ delete pTmpDel; // hebe alten Bereich auf
+ else
+ {
+ pTmpDel->GetPoint()->nContent.Assign( 0, 0 );
+ pTmpDel->GetPoint()->nNode = 0;
+ pTmpDel->SetMark();
+ pTmpDel->DeleteMark();
+ }
+ pTmpDel = 0;
+ }
+ else if( !pTmp->HasMark() ) // sorge auf jedenfall dafuer, das
+ { // nicht benutzte Indizies beachtet werden!
+ pTmp->SetMark(); // SPoint liegt nicht im Bereich,
+ pTmp->DeleteMark(); // aber vielleicht GetMark, also setzen
+ }
+ if( bGoNext )
+ pTmp = (SwPaM*)pTmp->GetNext();
+ } while( !bGoNext || *ppDelRing != pTmp );
+}
+
+void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx )
+{
+ SwNode *pNode = &rIdx.GetNode();
+
+ // erzeuge einen neuen Pam
+ SwPaM * pNew = new SwPaM( *GetCrsr()->GetPoint() );
+ if( pNode->GetStartNode() )
+ {
+ if( ( pNode = pNode->StartOfSectionNode())->IsTableNode() )
+ {
+ // der angegebene Node steht in einer Tabelle, also Parke
+ // den Crsr auf dem Tabellen-Node (ausserhalb der Tabelle)
+ pNew->GetPoint()->nNode = *pNode->StartOfSectionNode();
+ }
+ else // also auf dem StartNode selbst.
+ // Dann immer ueber seinen EndNode den StartNode erfragen !!!
+ // (StartOfSection vom StartNode ist der Parent !)
+ pNew->GetPoint()->nNode = *pNode->EndOfSectionNode()->StartOfSectionNode();
+ }
+ else
+ pNew->GetPoint()->nNode = *pNode->StartOfSectionNode();
+ pNew->SetMark();
+ pNew->GetPoint()->nNode = *pNode->EndOfSectionNode();
+
+ //Alle Shells wollen etwas davon haben.
+ ViewShell *pTmp = this;
+ do {
+ if( pTmp->IsA( TYPE( SwCrsrShell )))
+ {
+ SwCrsrShell* pSh = (SwCrsrShell*)pTmp;
+ if( pSh->pCrsrStk )
+ pSh->_ParkPams( pNew, &pSh->pCrsrStk );
+
+ pSh->_ParkPams( pNew, &pSh->pCurCrsr );
+ if( pSh->pTblCrsr )
+ {
+ // setze den Tabellen Cursor immer auf 0, den aktuellen
+ // immer auf den Anfang der Tabelle
+ SwPaM* pTCrsr = pSh->GetTblCrs();
+ SwNode* pTblNd = pTCrsr->GetPoint()->nNode.GetNode().FindTableNode();
+ if ( pTblNd )
+ {
+ pTCrsr->GetPoint()->nContent.Assign( 0, 0 );
+ pTCrsr->GetPoint()->nNode = 0;
+ pTCrsr->SetMark();
+ pTCrsr->DeleteMark();
+ pSh->pCurCrsr->GetPoint()->nNode = *pTblNd;
+ }
+ }
+ }
+ } while ( this != (pTmp = (ViewShell*)pTmp->GetNext() ));
+ delete pNew;
+}
+
+//=========================================================================
+
+/*
+ * der Copy-Constructor
+ * Cursor-Position kopieren, in den Ring eingetragen.
+ * Alle Ansichten eines Dokumentes stehen im Ring der Shells.
+ */
+
+SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
+ : ViewShell( rShell, pInitWin ),
+ SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
+ pBoxIdx( 0 ), pBoxPtr( 0 ), nCrsrMove( 0 ), nBasicActionCnt( 0 ),
+ eMvState( MV_NONE ),
+ // --> OD 2008-04-02 #refactorlists#
+ sMarkedListId(),
+ nMarkedListLevel( 0 )
+ // <--
+{
+ SET_CURR_SHELL( this );
+ // Nur die Position vom aktuellen Cursor aus der Copy-Shell uebernehmen
+ pCurCrsr = new SwShellCrsr( *this, *(rShell.pCurCrsr->GetPoint()) );
+ pCurCrsr->GetCntntNode()->Add( this );
+
+ bAllProtect = bVisPortChgd = bChgCallFlag = bInCMvVisportChgd =
+ bGCAttr = bIgnoreReadonly = bSelTblCells = bBasicHideCrsr =
+ bOverwriteCrsr = sal_False;
+ bCallChgLnk = bHasFocus = bSVCrsrVis = bAutoUpdateCells = sal_True;
+ bSetCrsrInReadOnly = sal_True;
+ pVisCrsr = new SwVisCrsr( this );
+// UpdateCrsr( 0 );
+ // OD 11.02.2003 #100556#
+ mbMacroExecAllowed = rShell.IsMacroExecAllowed();
+}
+
+
+/*
+ * der normale Constructor
+ */
+
+SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin,
+ const SwViewOption *pInitOpt )
+ : ViewShell( rDoc, pInitWin, pInitOpt ),
+ SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
+ pBoxIdx( 0 ), pBoxPtr( 0 ), nCrsrMove( 0 ), nBasicActionCnt( 0 ),
+ eMvState( MV_NONE ), // state for crsr-travelling - GetCrsrOfst
+ // --> OD 2008-04-02 #refactorlists#
+ sMarkedListId(),
+ nMarkedListLevel( 0 )
+ // <--
+{
+ SET_CURR_SHELL( this );
+ /*
+ * Erzeugen des initialen Cursors, wird auf die erste
+ * Inhaltsposition gesetzt
+ */
+ SwNodes& rNds = rDoc.GetNodes();
+
+ SwNodeIndex aNodeIdx( *rNds.GetEndOfContent().StartOfSectionNode() );
+ SwCntntNode* pCNd = rNds.GoNext( &aNodeIdx ); // gehe zum 1. ContentNode
+
+ pCurCrsr = new SwShellCrsr( *this, SwPosition( aNodeIdx, SwIndex( pCNd, 0 )));
+
+ // melde die Shell beim akt. Node als abhaengig an, dadurch koennen alle
+ // Attribut-Aenderungen ueber den Link weiter gemeldet werden.
+ pCNd->Add( this );
+
+ bAllProtect = bVisPortChgd = bChgCallFlag = bInCMvVisportChgd =
+ bGCAttr = bIgnoreReadonly = bSelTblCells = bBasicHideCrsr =
+ bOverwriteCrsr = sal_False;
+ bCallChgLnk = bHasFocus = bSVCrsrVis = bAutoUpdateCells = sal_True;
+ bSetCrsrInReadOnly = sal_True;
+
+ pVisCrsr = new SwVisCrsr( this );
+// UpdateCrsr( 0 );
+ // OD 11.02.2003 #100556#
+ mbMacroExecAllowed = true;
+}
+
+
+
+SwCrsrShell::~SwCrsrShell()
+{
+ // wenn es nicht die letzte View so sollte zu mindest das
+ // Feld noch geupdatet werden.
+ if( GetNext() != this )
+ CheckTblBoxCntnt( pCurCrsr->GetPoint() );
+ else
+ ClearTblBoxCntnt();
+
+ delete pVisCrsr;
+ delete pBlockCrsr;
+ delete pTblCrsr;
+
+ /*
+ * Freigabe der Cursor
+ */
+ while(pCurCrsr->GetNext() != pCurCrsr)
+ delete pCurCrsr->GetNext();
+ delete pCurCrsr;
+
+ // Stack freigeben
+ if( pCrsrStk )
+ {
+ while( pCrsrStk->GetNext() != pCrsrStk )
+ delete pCrsrStk->GetNext();
+ delete pCrsrStk;
+ }
+
+ // JP 27.07.98: Bug 54025 - ggfs. den HTML-Parser, der als Client in
+ // der CursorShell haengt keine Chance geben, sich an den
+ // TextNode zu haengen.
+ if( GetRegisteredIn() )
+ GetRegisteredInNonConst()->Remove( this );
+}
+
+SwShellCrsr* SwCrsrShell::getShellCrsr( bool bBlock )
+{
+ if( pTblCrsr )
+ return pTblCrsr;
+ if( pBlockCrsr && bBlock )
+ return &pBlockCrsr->getShellCrsr();
+ return pCurCrsr;
+}
+
+//Sollte fuer das Clipboard der WaitPtr geschaltet werden?
+//Warten bei TableMode, Mehrfachselektion und mehr als x Selektieren Absaetzen.
+
+sal_Bool SwCrsrShell::ShouldWait() const
+{
+ if ( IsTableMode() || GetCrsrCnt() > 1 )
+ return sal_True;
+
+ if( HasDrawView() && GetDrawView()->GetMarkedObjectList().GetMarkCount() )
+ return sal_True;
+
+ SwPaM* pPam = GetCrsr();
+ return pPam->Start()->nNode.GetIndex() + 10 <
+ pPam->End()->nNode.GetIndex();
+}
+
+
+sal_uInt16 SwCrsrShell::UpdateTblSelBoxes()
+{
+ if( pTblCrsr && ( pTblCrsr->IsChgd() || !pTblCrsr->GetBoxesCount() ))
+ GetLayout()->MakeTblCrsrs( *pTblCrsr );
+ return pTblCrsr ? pTblCrsr->GetBoxesCount() : 0;
+}
+
+// zeige das akt. selektierte "Object" an
+void SwCrsrShell::MakeSelVisible()
+{
+ ASSERT( bHasFocus, "kein Focus aber Cursor sichtbar machen?" );
+ if( aCrsrHeight.Y() < aCharRect.Height() && aCharRect.Height() > VisArea().Height() )
+ {
+ SwRect aTmp( aCharRect );
+ long nDiff = aCharRect.Height() - VisArea().Height();
+ if( nDiff < aCrsrHeight.X() )
+ aTmp.Top( nDiff + aCharRect.Top() );
+ else
+ {
+ aTmp.Top( aCrsrHeight.X() + aCharRect.Top() );
+ aTmp.Height( aCrsrHeight.Y() );
+ }
+ if( !aTmp.HasArea() )
+ {
+ aTmp.SSize().Height() += 1;
+ aTmp.SSize().Width() += 1;
+ }
+ MakeVisible( aTmp );
+ }
+ else
+ {
+ if( aCharRect.HasArea() )
+ MakeVisible( aCharRect );
+ else
+ {
+ SwRect aTmp( aCharRect );
+ aTmp.SSize().Height() += 1; aTmp.SSize().Width() += 1;
+ MakeVisible( aTmp );
+ }
+ }
+}
+
+
+// suche eine gueltige ContentPosition (nicht geschuetzt/nicht versteckt)
+sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText )
+{
+ if( pTblCrsr ) // was soll ich jetzt machen ??
+ {
+ ASSERT( !this, "TabellenSelection nicht aufgehoben!" );
+ return sal_False;
+ }
+
+ //JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt
+ if( !bAllProtect && GetDoc()->GetDocShell() &&
+ GetDoc()->GetDocShell()->IsReadOnlyUI() )
+ return sal_True;
+
+ // dann raus da!
+ if( pCurCrsr->HasMark() )
+ ClearMark();
+
+ // als erstes mal auf Rahmen abpruefen
+ SwNodeIndex& rNdIdx = pCurCrsr->GetPoint()->nNode;
+ sal_uLong nNdIdx = rNdIdx.GetIndex(); // sichern
+ SwNodes& rNds = pDoc->GetNodes();
+ SwCntntNode* pCNd = rNdIdx.GetNode().GetCntntNode();
+ const SwCntntFrm * pFrm;
+
+ if( pCNd && 0 != (pFrm = pCNd->getLayoutFrm( GetLayout(),0,pCurCrsr->GetPoint(),sal_False)) &&
+ !IsReadOnlyAvailable() && pFrm->IsProtected() &&
+ nNdIdx < rNds.GetEndOfExtras().GetIndex() )
+ {
+ // geschuetzter Rahmen ueberspringen
+ SwPaM aPam( *pCurCrsr->GetPoint() );
+ aPam.SetMark();
+ aPam.GetMark()->nNode = rNds.GetEndOfContent();
+ aPam.GetPoint()->nNode = *pCNd->EndOfSectionNode();
+
+ sal_Bool bFirst = sal_False;
+ if( 0 == (pCNd = ::GetNode( aPam, bFirst, fnMoveForward, sal_False )))
+ {
+ aPam.GetMark()->nNode = *rNds.GetEndOfPostIts().StartOfSectionNode();
+ pCNd = ::GetNode( aPam, bFirst, fnMoveBackward, sal_False );
+ }
+
+ if( !pCNd ) // sollte nie passieren !!!
+ {
+ rNdIdx = nNdIdx; // alten Node zurueck
+ return sal_False;
+ }
+ *pCurCrsr->GetPoint() = *aPam.GetPoint();
+ }
+ else if( bOnlyText && pCNd && pCNd->IsNoTxtNode() )
+ {
+ // dann auf den Anfang vom Doc stellen
+ rNdIdx = pDoc->GetNodes().GetEndOfExtras();
+ pCurCrsr->GetPoint()->nContent.Assign( pDoc->GetNodes().GoNext(
+ &rNdIdx ), 0 );
+ nNdIdx = rNdIdx.GetIndex();
+ }
+
+ sal_Bool bOk = sal_True;
+
+ // #i9059# cursor may not stand in protected cells
+ // (unless cursor in protected areas is OK.)
+ const SwTableNode* pTableNode = rNdIdx.GetNode().FindTableNode();
+ if( !IsReadOnlyAvailable() &&
+ pTableNode != NULL && rNdIdx.GetNode().IsProtect() )
+ {
+ // we're in a table, and we're in a protected area, so we're
+ // probably in a protected cell.
+
+ // move forward into non-protected area.
+ SwPaM aPam( rNdIdx.GetNode(), 0 );
+ while( aPam.GetNode()->IsProtect() &&
+ aPam.Move( fnMoveForward, fnGoCntnt ) )
+ ; // nothing to do in the loop; the aPam.Move does the moving!
+
+ // didn't work? then go backwards!
+ if( aPam.GetNode()->IsProtect() )
+ {
+ SwPaM aTmpPaM( rNdIdx.GetNode(), 0 );
+ aPam = aTmpPaM;
+ while( aPam.GetNode()->IsProtect() &&
+ aPam.Move( fnMoveBackward, fnGoCntnt ) )
+ ; // nothing to do in the loop; the aPam.Move does the moving!
+ }
+
+ // if we're successful, set the new position
+ if( ! aPam.GetNode()->IsProtect() )
+ {
+ *pCurCrsr->GetPoint() = *aPam.GetPoint();
+ }
+ }
+
+ // in einem geschuetzten Bereich
+ const SwSectionNode* pSectNd = rNdIdx.GetNode().FindSectionNode();
+ if( pSectNd && ( pSectNd->GetSection().IsHiddenFlag() ||
+ ( !IsReadOnlyAvailable() &&
+ pSectNd->GetSection().IsProtectFlag() )) )
+ {
+ typedef SwCntntNode* (SwNodes:: *FNGoSection)( SwNodeIndex *, int, int ) const;
+ FNGoSection funcGoSection = &SwNodes::GoNextSection;
+
+ bOk = sal_False;
+
+ for( int nLoopCnt = 0; !bOk && nLoopCnt < 2; ++nLoopCnt )
+ {
+ sal_Bool bWeiter;
+ do {
+ bWeiter = sal_False;
+ while( 0 != ( pCNd = (rNds.*funcGoSection)( &rNdIdx,
+ sal_True, !IsReadOnlyAvailable() )) )
+ {
+ // in eine Tabelle verschoben -> pruefe ob die
+ // vielleicht geschuetzt ist
+ if( pCNd->FindTableNode() )
+ {
+ SwCallLink aTmp( *this );
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ aTmp.nNdTyp = 0; // im DTOR nichts machen!
+ if( !pCurCrsr->IsInProtectTable( sal_True, sal_True ) )
+ {
+ const SwSectionNode* pSNd = pCNd->FindSectionNode();
+ if( !pSNd || !pSNd->GetSection().IsHiddenFlag()
+ || (!IsReadOnlyAvailable() &&
+ pSNd->GetSection().IsProtectFlag() ))
+ {
+ bOk = sal_True;
+ break; // eine nicht geschuetzte Zelle gef.
+ }
+ continue; // dann weiter suchen
+ }
+ }
+ else
+ {
+ bOk = sal_True;
+ break; // eine nicht geschuetzte Zelle gef.
+ }
+ }
+
+ if( bOk && rNdIdx.GetIndex() < rNds.GetEndOfExtras().GetIndex() )
+ {
+ // Teste mal auf Fly - kann auch noch geschuetzt sein!!
+ if( 0 == (pFrm = pCNd->getLayoutFrm( GetLayout(),0,0,sal_False)) ||
+ ( !IsReadOnlyAvailable() && pFrm->IsProtected() ) ||
+ ( bOnlyText && pCNd->IsNoTxtNode() ) )
+ {
+ // dann weiter suchen!
+ bOk = sal_False;
+ bWeiter = sal_True;
+ }
+ }
+ } while( bWeiter );
+
+ if( !bOk )
+ {
+ if( !nLoopCnt )
+ funcGoSection = &SwNodes::GoPrevSection;
+ rNdIdx = nNdIdx;
+ }
+ }
+ }
+ if( bOk )
+ {
+ pCNd = rNdIdx.GetNode().GetCntntNode();
+// sal_uInt16 nCntnt = Min( pCNd->Len(), pCurCrsr->GetPoint()->nContent.GetIndex() );
+ xub_StrLen nCntnt = rNdIdx.GetIndex() < nNdIdx ? pCNd->Len() : 0;
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, nCntnt );
+ }
+ else
+ {
+ pCNd = rNdIdx.GetNode().GetCntntNode();
+
+ // falls Cursor im versteckten Bereich ist, auf jedenfall schon mal
+ // verschieben!!
+ if( !pCNd || !pCNd->getLayoutFrm( GetLayout(),0,0,sal_False) )
+ {
+ SwCrsrMoveState aTmpState( MV_NONE );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ GetLayout()->GetCrsrOfst( pCurCrsr->GetPoint(), pCurCrsr->GetPtPos(),
+ &aTmpState );
+ }
+ }
+ return bOk;
+}
+
+
+void SwCrsrShell::NewCoreSelection()
+{
+}
+
+
+sal_Bool SwCrsrShell::IsCrsrReadonly() const
+{
+ if ( GetViewOptions()->IsReadonly() ||
+ // --> FME 2004-06-29 #114856# Formular view
+ GetViewOptions()->IsFormView() )
+ // <--
+ {
+ SwFrm *pFrm = GetCurrFrm( sal_False );
+ const SwFlyFrm* pFly;
+ const SwSection* pSection;
+
+ if( pFrm && pFrm->IsInFly() &&
+ (pFly = pFrm->FindFlyFrm())->GetFmt()->GetEditInReadonly().GetValue() &&
+ pFly->Lower() &&
+ !pFly->Lower()->IsNoTxtFrm() &&
+ !GetDrawView()->GetMarkedObjectList().GetMarkCount() )
+ {
+ return sal_False;
+ }
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ else if ( pFrm && pFrm->IsInSct() &&
+ 0 != ( pSection = pFrm->FindSctFrm()->GetSection() ) &&
+ pSection->IsEditInReadonlyFlag() )
+ {
+ return sal_False;
+ }
+ // <--
+
+ return sal_True;
+ }
+ return sal_False;
+}
+
+
+// darf der Cursor in ReadOnlyBereiche?
+void SwCrsrShell::SetReadOnlyAvailable( sal_Bool bFlag )
+{
+ // im GlobalDoc darf NIE umgeschaltet werden
+ if( (!GetDoc()->GetDocShell() ||
+ !GetDoc()->GetDocShell()->IsA( SwGlobalDocShell::StaticType() )) &&
+ bFlag != bSetCrsrInReadOnly )
+ {
+ // wenn das Flag ausgeschaltet wird, dann muessen erstmal alle
+ // Selektionen aufgehoben werden. Denn sonst wird sich darauf
+ // verlassen, das nichts geschuetztes selektiert ist!
+ if( !bFlag )
+ {
+ ClearMark();
+ }
+ bSetCrsrInReadOnly = bFlag;
+ UpdateCrsr();
+ }
+}
+
+sal_Bool SwCrsrShell::HasReadonlySel() const
+{
+ sal_Bool bRet = sal_False;
+ if( IsReadOnlyAvailable() ||
+ // --> FME 2004-06-29 #114856# Formular view
+ GetViewOptions()->IsFormView() )
+ // <--
+ {
+ if( pTblCrsr )
+ bRet = pTblCrsr->HasReadOnlyBoxSel() ||
+ pTblCrsr->HasReadonlySel(
+ // --> FME 2004-06-29 #114856# Formular view
+ GetViewOptions()->IsFormView() );
+ // <--
+ else
+ {
+ const SwPaM* pCrsr = pCurCrsr;
+
+ do {
+ if( pCrsr->HasReadonlySel(
+ // --> FME 2004-06-29 #114856# Formular view
+ GetViewOptions()->IsFormView() ) )
+ // <--
+ bRet = sal_True;
+ } while( !bRet && pCurCrsr != ( pCrsr = (SwPaM*)pCrsr->GetNext() ));
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCrsrShell::IsSelFullPara() const
+{
+ sal_Bool bRet = sal_False;
+
+ if( pCurCrsr->GetPoint()->nNode.GetIndex() ==
+ pCurCrsr->GetMark()->nNode.GetIndex() && pCurCrsr == pCurCrsr->GetNext() )
+ {
+ xub_StrLen nStt = pCurCrsr->GetPoint()->nContent.GetIndex(),
+ nEnd = pCurCrsr->GetMark()->nContent.GetIndex();
+ if( nStt > nEnd )
+ {
+ xub_StrLen nTmp = nStt;
+ nStt = nEnd;
+ nEnd = nTmp;
+ }
+ const SwCntntNode* pCNd = pCurCrsr->GetCntntNode();
+ bRet = pCNd && !nStt && nEnd == pCNd->Len();
+ }
+ return bRet;
+}
+
+short SwCrsrShell::GetTextDirection( const Point* pPt ) const
+{
+ SwPosition aPos( *pCurCrsr->GetPoint() );
+ Point aPt( pPt ? *pPt : pCurCrsr->GetPtPos() );
+ if( pPt )
+ {
+ SwCrsrMoveState aTmpState( MV_NONE );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+
+ GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState );
+ }
+
+ return pDoc->GetTextDirection( aPos, &aPt );
+}
+
+sal_Bool SwCrsrShell::IsInVerticalText( const Point* pPt ) const
+{
+ const short nDir = GetTextDirection( pPt );
+ return FRMDIR_VERT_TOP_RIGHT == nDir || FRMDIR_VERT_TOP_LEFT == nDir;
+}
+
+sal_Bool SwCrsrShell::IsInRightToLeftText( const Point* pPt ) const
+{
+ const short nDir = GetTextDirection( pPt );
+ // GetTextDirection uses FRMDIR_VERT_TOP_LEFT to indicate RTL in
+ // vertical environment
+ return FRMDIR_VERT_TOP_LEFT == nDir || FRMDIR_HORI_RIGHT_TOP == nDir;
+}
+
+//
+// If the current cursor position is inside a hidden range, the hidden range
+// is selected:
+//
+bool SwCrsrShell::SelectHiddenRange()
+{
+ bool bRet = false;
+ if ( !GetViewOptions()->IsShowHiddenChar() && !pCurCrsr->HasMark() )
+ {
+ SwPosition& rPt = *(SwPosition*)pCurCrsr->GetPoint();
+ const SwTxtNode* pNode = rPt.nNode.GetNode().GetTxtNode();
+ if ( pNode )
+ {
+ const xub_StrLen nPos = rPt.nContent.GetIndex();
+
+ // check if nPos is in hidden range
+ xub_StrLen nHiddenStart;
+ xub_StrLen nHiddenEnd;
+ SwScriptInfo::GetBoundsOfHiddenRange( *pNode, nPos, nHiddenStart, nHiddenEnd );
+ if ( STRING_LEN != nHiddenStart )
+ {
+ // make selection:
+ pCurCrsr->SetMark();
+ pCurCrsr->GetMark()->nContent = nHiddenEnd;
+ bRet = true;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+/* */
+
+ // die Suchfunktionen
+sal_uLong SwCrsrShell::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ sal_Bool& bCancel,
+ FindRanges eRng, int bReplace )
+{
+ if( pTblCrsr )
+ GetCrsr();
+ delete pTblCrsr, pTblCrsr = 0;
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ sal_uLong nRet = pCurCrsr->Find( rSearchOpt, bSearchInNotes, eStart, eEnde, bCancel, eRng, bReplace );
+ if( nRet || bCancel )
+ UpdateCrsr();
+ return nRet;
+}
+
+sal_uLong SwCrsrShell::Find( const SwTxtFmtColl& rFmtColl,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ sal_Bool& bCancel,
+ FindRanges eRng, const SwTxtFmtColl* pReplFmt )
+{
+ if( pTblCrsr )
+ GetCrsr();
+ delete pTblCrsr, pTblCrsr = 0;
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ sal_uLong nRet = pCurCrsr->Find( rFmtColl, eStart, eEnde, bCancel, eRng, pReplFmt );
+ if( nRet )
+ UpdateCrsr();
+ return nRet;
+}
+
+sal_uLong SwCrsrShell::Find( const SfxItemSet& rSet, sal_Bool bNoCollections,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ sal_Bool& bCancel,
+ FindRanges eRng, const SearchOptions* pSearchOpt,
+ const SfxItemSet* rReplSet )
+{
+ if( pTblCrsr )
+ GetCrsr();
+ delete pTblCrsr, pTblCrsr = 0;
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ sal_uLong nRet = pCurCrsr->Find( rSet, bNoCollections, eStart, eEnde, bCancel,
+ eRng, pSearchOpt, rReplSet );
+ if( nRet )
+ UpdateCrsr();
+ return nRet;
+}
+
+void SwCrsrShell::SetSelection( const SwPaM& rCrsr )
+{
+ StartAction();
+ SwPaM* pCrsr = GetCrsr();
+ *pCrsr->GetPoint() = *rCrsr.GetPoint();
+ if(rCrsr.HasMark())
+ {
+ pCrsr->SetMark();
+ *pCrsr->GetMark() = *rCrsr.GetMark();
+ }
+ if((SwPaM*)rCrsr.GetNext() != &rCrsr)
+ {
+ const SwPaM *_pStartCrsr = (SwPaM*)rCrsr.GetNext();
+ do
+ {
+ SwPaM* pCurrentCrsr = CreateCrsr();
+ *pCurrentCrsr->GetPoint() = *_pStartCrsr->GetPoint();
+ if(_pStartCrsr->HasMark())
+ {
+ pCurrentCrsr->SetMark();
+ *pCurrentCrsr->GetMark() = *_pStartCrsr->GetMark();
+ }
+ } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != &rCrsr );
+ }
+ EndAction();
+}
+
+void lcl_RemoveMark( SwPaM* pPam )
+{
+ ASSERT( pPam->HasMark(), "Don't remove pPoint!" )
+ pPam->GetMark()->nContent.Assign( 0, 0 );
+ pPam->GetMark()->nNode = 0;
+ pPam->DeleteMark();
+}
+
+const SwStartNode* lcl_NodeContext( const SwNode& rNode )
+{
+ const SwStartNode *pRet = rNode.StartOfSectionNode();
+ while( pRet->IsSectionNode() || pRet->IsTableNode() ||
+ pRet->GetStartNodeType() == SwTableBoxStartNode )
+ {
+ pRet = pRet->StartOfSectionNode();
+ }
+ return pRet;
+}
+
+/**
+ Checks if a position is valid. To be valid the position's node must
+ be a content node and the content must not be unregistered.
+
+ @param aPos the position to check.
+*/
+bool lcl_PosOk(const SwPosition & aPos)
+{
+ return NULL != aPos.nNode.GetNode().GetCntntNode() &&
+ SwIndexReg::pEmptyIndexArray != aPos.nContent.GetIdxReg();
+}
+
+/**
+ Checks if a PaM is valid. For a PaM to be valid its point must be
+ valid. Additionaly if the PaM has a mark this has to be valid, too.
+
+ @param aPam the PaM to check
+*/
+static bool lcl_CrsrOk(SwPaM & aPam)
+{
+ return lcl_PosOk(*aPam.GetPoint()) && (! aPam.HasMark()
+ || lcl_PosOk(*aPam.GetMark()));
+}
+
+void SwCrsrShell::ClearUpCrsrs()
+{
+ // start of the ring
+ SwPaM * pStartCrsr = GetCrsr();
+ // start loop with second entry of the ring
+ SwPaM * pCrsr = (SwPaM *) pStartCrsr->GetNext();
+ SwPaM * pTmpCrsr;
+ bool bChanged = false;
+
+ /*
+ For all entries in the ring except the start entry delete the
+ entry if it is invalid.
+ */
+ while (pCrsr != pStartCrsr)
+ {
+ pTmpCrsr = (SwPaM *) pCrsr->GetNext();
+
+ if ( ! lcl_CrsrOk(*pCrsr))
+ {
+ delete pCrsr;
+
+ bChanged = true;
+ }
+
+ pCrsr = pTmpCrsr;
+ }
+
+ if( pStartCrsr->HasMark() && !lcl_PosOk( *pStartCrsr->GetMark() ) )
+ {
+ lcl_RemoveMark( pStartCrsr );
+ bChanged = true;
+ }
+ if( !lcl_PosOk( *pStartCrsr->GetPoint() ) )
+ {
+ SwNodes & aNodes = GetDoc()->GetNodes();
+ const SwNode* pStart = lcl_NodeContext( pStartCrsr->GetPoint()->nNode.GetNode() );
+ SwNodeIndex aIdx( pStartCrsr->GetPoint()->nNode );
+ SwNode * pNode = aNodes.GoPrevious(&aIdx);
+ if( pNode == NULL || lcl_NodeContext( *pNode ) != pStart )
+ aNodes.GoNext( &aIdx );
+ if( pNode == NULL || lcl_NodeContext( *pNode ) != pStart )
+ {
+ /*
+ If the start entry of the ring is invalid replace it with a
+ cursor pointing to the beginning of the first content node in
+ the document.
+ */
+ aIdx = (*(aNodes.GetEndOfContent().StartOfSectionNode()));
+ pNode = aNodes.GoNext( &aIdx );
+ }
+ bool bFound = (pNode != NULL);
+
+ ASSERT(bFound, "no content node found");
+
+ if (bFound)
+ {
+ SwPaM aTmpPam(*pNode);
+ *pStartCrsr = aTmpPam;
+ }
+
+ bChanged = true;
+ }
+
+ /*
+ If at least one of the cursors in the ring have been deleted or
+ replaced, remove the table cursor.
+ */
+ if (pTblCrsr != NULL && bChanged)
+ TblCrsrToCursor();
+}
+
+// #111827#
+String SwCrsrShell::GetCrsrDescr() const
+{
+ String aResult;
+
+ if (IsMultiSelection())
+ aResult += String(SW_RES(STR_MULTISEL));
+ else
+ aResult = GetDoc()->GetPaMDescr(*GetCrsr());
+
+ return aResult;
+}
+
+// SMARTTAGS
+
+void lcl_FillRecognizerData( uno::Sequence< rtl::OUString >& rSmartTagTypes,
+ uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps,
+ const SwWrongList& rSmartTagList, xub_StrLen nCurrent )
+{
+ // Insert smart tag information
+ std::vector< rtl::OUString > aSmartTagTypes;
+ std::vector< uno::Reference< container::XStringKeyMap > > aStringKeyMaps;
+
+ for ( sal_uInt16 i = 0; i < rSmartTagList.Count(); ++i )
+ {
+ const xub_StrLen nSTPos = rSmartTagList.Pos( i );
+ const xub_StrLen nSTLen = rSmartTagList.Len( i );
+
+ if ( nSTPos <= nCurrent && nCurrent < nSTPos + nSTLen )
+ {
+ const SwWrongArea* pArea = rSmartTagList.GetElement( i );
+ if ( pArea )
+ {
+ aSmartTagTypes.push_back( pArea->maType );
+ aStringKeyMaps.push_back( pArea->mxPropertyBag );
+ }
+ }
+ }
+
+ if ( aSmartTagTypes.size() )
+ {
+ rSmartTagTypes.realloc( aSmartTagTypes.size() );
+ rStringKeyMaps.realloc( aSmartTagTypes.size() );
+
+ std::vector< rtl::OUString >::const_iterator aTypesIter = aSmartTagTypes.begin();
+ sal_uInt16 i = 0;
+ for ( aTypesIter = aSmartTagTypes.begin(); aTypesIter != aSmartTagTypes.end(); ++aTypesIter )
+ rSmartTagTypes[i++] = *aTypesIter;
+
+ std::vector< uno::Reference< container::XStringKeyMap > >::const_iterator aMapsIter = aStringKeyMaps.begin();
+ i = 0;
+ for ( aMapsIter = aStringKeyMaps.begin(); aMapsIter != aStringKeyMaps.end(); ++aMapsIter )
+ rStringKeyMaps[i++] = *aMapsIter;
+ }
+}
+
+void lcl_FillTextRange( uno::Reference<text::XTextRange>& rRange,
+ SwTxtNode& rNode, xub_StrLen nBegin, xub_StrLen nLen )
+{
+ // create SwPosition for nStartIndex
+ SwIndex aIndex( &rNode, nBegin );
+ SwPosition aStartPos( rNode, aIndex );
+
+ // create SwPosition for nEndIndex
+ SwPosition aEndPos( aStartPos );
+ aEndPos.nContent = nBegin + nLen;
+
+ const uno::Reference<text::XTextRange> xRange =
+ SwXTextRange::CreateXTextRange(*rNode.GetDoc(), aStartPos, &aEndPos);
+
+ rRange = xRange;
+}
+
+void SwCrsrShell::GetSmartTagTerm( uno::Sequence< rtl::OUString >& rSmartTagTypes,
+ uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps,
+ uno::Reference< text::XTextRange>& rRange ) const
+{
+ if ( !SwSmartTagMgr::Get().IsSmartTagsEnabled() )
+ return;
+
+ SwPaM* pCrsr = GetCrsr();
+ SwPosition aPos( *pCrsr->GetPoint() );
+ SwTxtNode *pNode = aPos.nNode.GetNode().GetTxtNode();
+ if ( pNode && !pNode->IsInProtectSect() )
+ {
+ const SwWrongList *pSmartTagList = pNode->GetSmartTags();
+ if ( pSmartTagList )
+ {
+ xub_StrLen nCurrent = aPos.nContent.GetIndex();
+ xub_StrLen nBegin = nCurrent;
+ xub_StrLen nLen = 1;
+
+ if( pSmartTagList->InWrongWord( nBegin, nLen ) && !pNode->IsSymbol(nBegin) )
+ {
+ const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
+ const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
+ if ( pSubList )
+ {
+ pSmartTagList = pSubList;
+ nCurrent = 0;
+ }
+
+ lcl_FillRecognizerData( rSmartTagTypes, rStringKeyMaps, *pSmartTagList, nCurrent );
+ lcl_FillTextRange( rRange, *pNode, nBegin, nLen );
+ }
+ }
+ }
+}
+
+// see also SwEditShell::GetCorrection( const Point* pPt, SwRect& rSelectRect )
+void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect,
+ uno::Sequence< rtl::OUString >& rSmartTagTypes,
+ uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps,
+ uno::Reference<text::XTextRange>& rRange )
+{
+ if ( !SwSmartTagMgr::Get().IsSmartTagsEnabled() )
+ return;
+
+ SwPaM* pCrsr = GetCrsr();
+ SwPosition aPos( *pCrsr->GetPoint() );
+ Point aPt( rPt );
+ SwCrsrMoveState eTmpState( MV_SETONLYTEXT );
+ SwSpecialPos aSpecialPos;
+ eTmpState.pSpecialPos = &aSpecialPos;
+ SwTxtNode *pNode;
+ const SwWrongList *pSmartTagList;
+
+ if( GetLayout()->GetCrsrOfst( &aPos, aPt, &eTmpState ) &&
+ 0 != (pNode = aPos.nNode.GetNode().GetTxtNode()) &&
+ 0 != (pSmartTagList = pNode->GetSmartTags()) &&
+ !pNode->IsInProtectSect() )
+ {
+ xub_StrLen nCurrent = aPos.nContent.GetIndex();
+ xub_StrLen nBegin = nCurrent;
+ xub_StrLen nLen = 1;
+
+ if( pSmartTagList->InWrongWord( nBegin, nLen ) && !pNode->IsSymbol(nBegin) )
+ {
+ const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
+ const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
+ if ( pSubList )
+ {
+ pSmartTagList = pSubList;
+ nCurrent = eTmpState.pSpecialPos->nCharOfst;
+ }
+
+ lcl_FillRecognizerData( rSmartTagTypes, rStringKeyMaps, *pSmartTagList, nCurrent );
+ lcl_FillTextRange( rRange, *pNode, nBegin, nLen );
+
+ // get smarttag word
+ String aText( pNode->GetTxt().Copy( nBegin, nLen ) );
+
+ //save the start and end positons of the line and the starting point
+ Push();
+ LeftMargin();
+ xub_StrLen nLineStart = GetCrsr()->GetPoint()->nContent.GetIndex();
+ RightMargin();
+ xub_StrLen nLineEnd = GetCrsr()->GetPoint()->nContent.GetIndex();
+ Pop(sal_False);
+
+ // make sure the selection build later from the
+ // data below does not include footnotes and other
+ // "in word" character to the left and right in order
+ // to preserve those. Therefore count those "in words"
+ // in order to modify the selection accordingly.
+ const sal_Unicode* pChar = aText.GetBuffer();
+ xub_StrLen nLeft = 0;
+ while (pChar && *pChar++ == CH_TXTATR_INWORD)
+ ++nLeft;
+ pChar = aText.Len() ? aText.GetBuffer() + aText.Len() - 1 : 0;
+ xub_StrLen nRight = 0;
+ while (pChar && *pChar-- == CH_TXTATR_INWORD)
+ ++nRight;
+
+ aPos.nContent = nBegin + nLeft;
+ pCrsr = GetCrsr();
+ *pCrsr->GetPoint() = aPos;
+ pCrsr->SetMark();
+ ExtendSelection( sal_True, nLen - nLeft - nRight );
+ //no determine the rectangle in the current line
+ xub_StrLen nWordStart = (nBegin + nLeft) < nLineStart ? nLineStart : nBegin + nLeft;
+ //take one less than the line end - otherwise the next line would be calculated
+ xub_StrLen nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd - 1: (nBegin + nLen - nLeft - nRight);
+ Push();
+ pCrsr->DeleteMark();
+ SwIndex& rContent = GetCrsr()->GetPoint()->nContent;
+ rContent = nWordStart;
+ SwRect aStartRect;
+ SwCrsrMoveState aState;
+ aState.bRealWidth = sal_True;
+ SwCntntNode* pCntntNode = pCrsr->GetCntntNode();
+ SwCntntFrm *pCntntFrame = pCntntNode->getLayoutFrm( GetLayout(), &rPt, pCrsr->GetPoint(), sal_False);
+
+ pCntntFrame->GetCharRect( aStartRect, *pCrsr->GetPoint(), &aState );
+ rContent = nWordEnd;
+ SwRect aEndRect;
+ pCntntFrame->GetCharRect( aEndRect, *pCrsr->GetPoint(),&aState );
+ rSelectRect = aStartRect.Union( aEndRect );
+ Pop(sal_False);
+ }
+ }
+}
+
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
new file mode 100644
index 000000000000..f2624677c4be
--- /dev/null
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -0,0 +1,2212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <svl/itemiter.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <svx/svdobj.hxx>
+#include <crsrsh.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pagefrm.hxx>
+#include <cntfrm.hxx>
+#include <rootfrm.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <fldbas.hxx>
+#include <swtable.hxx> // SwTxtFld
+#include <docary.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <txtftn.hxx>
+#include <txtinet.hxx>
+#include <fmtinfmt.hxx>
+#include <txttxmrk.hxx>
+#include <frmfmt.hxx>
+#include <flyfrm.hxx>
+#include <viscrs.hxx>
+#include <callnk.hxx>
+#include <doctxm.hxx>
+#include <docfld.hxx>
+#include <expfld.hxx>
+#include <reffld.hxx>
+#include <flddat.hxx> // SwTxtFld
+#include <cellatr.hxx>
+#include <swundo.hxx>
+#include <redline.hxx>
+#include <fmtcntnt.hxx>
+#include <fmthdft.hxx>
+#include <pagedesc.hxx>
+#include <fesh.hxx>
+#include <charfmt.hxx>
+#include <fmturl.hxx>
+#include "txtfrm.hxx"
+#include <wrong.hxx>
+#include <switerator.hxx>
+#include <vcl/window.hxx>
+#include <docufld.hxx> // OD 2008-06-19 #i90516#
+
+using namespace ::com::sun::star;
+
+
+// zum naechsten/vorhergehenden Punkt auf gleicher Ebene
+sal_Bool SwCrsrShell::GotoNextNum()
+{
+ sal_Bool bRet = GetDoc()->GotoNextNum( *pCurCrsr->GetPoint() );
+ if( bRet )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ if( !ActionPend() )
+ {
+ SET_CURR_SHELL( this );
+ // dann versuche den Cursor auf die Position zu setzen,
+ // auf halber Heohe vom Char-SRectangle
+ Point aPt( pCurCrsr->GetPtPos() );
+ SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->getLayoutFrm( GetLayout(), &aPt,
+ pCurCrsr->GetPoint() );
+ pFrm->GetCharRect( aCharRect, *pCurCrsr->GetPoint() );
+ pFrm->Calc();
+ if( pFrm->IsVertical() )
+ {
+ aPt.X() = aCharRect.Center().X();
+ aPt.Y() = pFrm->Frm().Top() + nUpDownX;
+ }
+ else
+ {
+ aPt.Y() = aCharRect.Center().Y();
+ aPt.X() = pFrm->Frm().Left() + nUpDownX;
+ }
+ pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
+ bRet = !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::UPDOWN |
+ SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ }
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::GotoPrevNum()
+{
+ sal_Bool bRet = GetDoc()->GotoPrevNum( *pCurCrsr->GetPoint() );
+ if( bRet )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ if( !ActionPend() )
+ {
+ SET_CURR_SHELL( this );
+ // dann versuche den Cursor auf die Position zu setzen,
+ // auf halber Heohe vom Char-SRectangle
+ Point aPt( pCurCrsr->GetPtPos() );
+ SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->getLayoutFrm( GetLayout(), &aPt,
+ pCurCrsr->GetPoint() );
+ pFrm->GetCharRect( aCharRect, *pCurCrsr->GetPoint() );
+ pFrm->Calc();
+ if( pFrm->IsVertical() )
+ {
+ aPt.X() = aCharRect.Center().X();
+ aPt.Y() = pFrm->Frm().Top() + nUpDownX;
+ }
+ else
+ {
+ aPt.Y() = aCharRect.Center().Y();
+ aPt.X() = pFrm->Frm().Left() + nUpDownX;
+ }
+ pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
+ bRet = !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::UPDOWN |
+ SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ }
+ return bRet;
+}
+
+// springe aus dem Content zum Header
+
+sal_Bool SwCrsrShell::GotoHeaderTxt()
+{
+ const SwFrm* pFrm = GetCurrFrm()->FindPageFrm();
+ while( pFrm && !pFrm->IsHeaderFrm() )
+ pFrm = pFrm->GetLower();
+ // Header gefunden, dann suche den 1.Cntnt-Frame
+ while( pFrm && !pFrm->IsCntntFrm() )
+ pFrm = pFrm->GetLower();
+ if( pFrm )
+ {
+ SET_CURR_SHELL( this );
+ // hole den Header-Frame
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCursor *pTmpCrsr = getShellCrsr( true );
+ SwCrsrSaveState aSaveState( *pTmpCrsr );
+ pFrm->Calc();
+ Point aPt( pFrm->Frm().Pos() + pFrm->Prt().Pos() );
+ pFrm->GetCrsrOfst( pTmpCrsr->GetPoint(), aPt );
+ if( !pTmpCrsr->IsSelOvr() )
+ UpdateCrsr();
+ else
+ pFrm = 0;
+ }
+ return 0 != pFrm;
+}
+
+
+// springe aus dem Content zum Footer
+
+sal_Bool SwCrsrShell::GotoFooterTxt()
+{
+ const SwPageFrm* pFrm = GetCurrFrm()->FindPageFrm();
+ if( pFrm )
+ {
+ const SwFrm* pLower = pFrm->GetLastLower();
+
+ while( pLower && !pLower->IsFooterFrm() )
+ pLower = pLower->GetLower();
+ // Header gefunden, dann suche den 1.Cntnt-Frame
+ while( pLower && !pLower->IsCntntFrm() )
+ pLower = pLower->GetLower();
+
+ if( pLower )
+ {
+ SwCursor *pTmpCrsr = getShellCrsr( true );
+ SET_CURR_SHELL( this );
+ // hole eine Position im Footer
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pTmpCrsr );
+ pLower->Calc();
+ Point aPt( pLower->Frm().Pos() + pLower->Prt().Pos() );
+ pLower->GetCrsrOfst( pTmpCrsr->GetPoint(), aPt );
+ if( !pTmpCrsr->IsSelOvr() )
+ UpdateCrsr();
+ else
+ pFrm = 0;
+ }
+ else
+ pFrm = 0;
+ }
+ else
+ pFrm = 0;
+ return 0 != pFrm;
+}
+
+sal_Bool SwCrsrShell::SetCrsrInHdFt( sal_uInt16 nDescNo, sal_Bool bInHeader )
+{
+ sal_Bool bRet = sal_False;
+ SwDoc *pMyDoc = GetDoc();
+
+ SET_CURR_SHELL( this );
+
+ if( USHRT_MAX == nDescNo )
+ {
+ // dann den akt. nehmen
+ const SwPageFrm* pPage = GetCurrFrm()->FindPageFrm();
+ if( pPage )
+ for( sal_uInt16 i = 0; i < pMyDoc->GetPageDescCnt(); ++i )
+ if( pPage->GetPageDesc() ==
+ &const_cast<const SwDoc *>(pMyDoc)->GetPageDesc( i ) )
+ {
+ nDescNo = i;
+ break;
+ }
+ }
+
+ if( USHRT_MAX != nDescNo && nDescNo < pMyDoc->GetPageDescCnt() )
+ {
+ //dann teste mal, ob ueberhaupt das Attribut vorhanden ist.
+ const SwPageDesc& rDesc = const_cast<const SwDoc *>(pMyDoc)
+ ->GetPageDesc( nDescNo );
+ const SwFmtCntnt* pCnt = 0;
+ if( bInHeader )
+ {
+ // gespiegelte Seiten??? erstmal nicht beachten
+ const SwFmtHeader& rHd = rDesc.GetMaster().GetHeader();
+ if( rHd.GetHeaderFmt() )
+ pCnt = &rHd.GetHeaderFmt()->GetCntnt();
+ }
+ else
+ {
+ const SwFmtFooter& rFt = rDesc.GetMaster().GetFooter();
+ if( rFt.GetFooterFmt() )
+ pCnt = &rFt.GetFooterFmt()->GetCntnt();
+ }
+
+ if( pCnt && pCnt->GetCntntIdx() )
+ {
+ SwNodeIndex aIdx( *pCnt->GetCntntIdx(), 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = pMyDoc->GetNodes().GoNext( &aIdx );
+
+ const SwFrm* pFrm;
+ Point aPt( pCurCrsr->GetPtPos() );
+
+ if( pCNd && 0 != ( pFrm = pCNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False ) ))
+ {
+ // dann kann der Cursor ja auch hinein gesetzt werden
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ ClearMark();
+
+ SwPosition& rPos = *pCurCrsr->GetPoint();
+ rPos.nNode = *pCNd;
+ rPos.nContent.Assign( pCNd, 0 );
+
+ bRet = !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ }
+ }
+ return bRet;
+}
+
+// springe zum naechsten Verzeichnis
+
+sal_Bool SwCrsrShell::GotoNextTOXBase( const String* pName )
+{
+ sal_Bool bRet = sal_False;
+
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ SwCntntNode* pFnd = 0;
+ for( sal_uInt16 n = rFmts.Count(); n; )
+ {
+ const SwSection* pSect = rFmts[ --n ]->GetSection();
+ const SwSectionNode* pSectNd;
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ) &&
+ pCurCrsr->GetPoint()->nNode < pSectNd->GetIndex() &&
+ ( !pFnd || pFnd->GetIndex() > pSectNd->GetIndex() ) &&
+// JP 10.12.96: solange wir nur 3 Typen kennen und UI-seitig keine anderen
+// einstellbar sind, muss ueber den Titel gesucht werden!
+// ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTypeName() ) &&
+ ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTOXName() )
+ )
+ {
+ SwNodeIndex aIdx( *pSectNd, 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
+ const SwCntntFrm* pCFrm;
+ if( pCNd &&
+ pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex() &&
+ 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) &&
+ ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
+ {
+ pFnd = pCNd;
+ }
+ }
+ }
+ if( pFnd )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->GetPoint()->nNode = *pFnd;
+ pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 );
+ bRet = !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+// springe zum vorherigen Verzeichnis
+
+
+sal_Bool SwCrsrShell::GotoPrevTOXBase( const String* pName )
+{
+ sal_Bool bRet = sal_False;
+
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ SwCntntNode* pFnd = 0;
+ for( sal_uInt16 n = rFmts.Count(); n; )
+ {
+ const SwSection* pSect = rFmts[ --n ]->GetSection();
+ const SwSectionNode* pSectNd;
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ) &&
+ pCurCrsr->GetPoint()->nNode > pSectNd->EndOfSectionIndex() &&
+ ( !pFnd || pFnd->GetIndex() < pSectNd->GetIndex() ) &&
+// JP 10.12.96: solange wir nur 3 Typen kennen und UI-seitig keine anderen
+// einstellbar sind, muss ueber den Titel gesucht werden!
+// ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTypeName() ) &&
+ ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTOXName() )
+ )
+ {
+ SwNodeIndex aIdx( *pSectNd, 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
+ const SwCntntFrm* pCFrm;
+ if( pCNd &&
+ pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex() &&
+ 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) &&
+ ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
+ {
+ pFnd = pCNd;
+ }
+ }
+ }
+
+ if( pFnd )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->GetPoint()->nNode = *pFnd;
+ pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 );
+ bRet = !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+// springe zum Verzeichnis vom TOXMark
+
+sal_Bool SwCrsrShell::GotoTOXMarkBase()
+{
+ sal_Bool bRet = sal_False;
+
+ SwTOXMarks aMarks;
+ sal_uInt16 nCnt = GetDoc()->GetCurTOXMark( *pCurCrsr->GetPoint(), aMarks );
+ if( nCnt )
+ {
+ // dann nehme den 1. und hole den Verzeichnis-Typ.
+ // Suche in seiner Abhaengigkeitsliste nach dem eigentlichem
+ // Verzeichnis
+ const SwTOXType* pType = aMarks[0]->GetTOXType();
+ SwIterator<SwTOXBase,SwTOXType> aIter( *pType );
+ const SwSectionNode* pSectNd;
+ const SwSectionFmt* pSectFmt;
+
+ for( SwTOXBase* pTOX = aIter.First(); pTOX; pTOX = aIter.Next() )
+ {
+ if( pTOX->ISA( SwTOXBaseSection ) &&
+ 0 != ( pSectFmt = ((SwTOXBaseSection*)pTOX)->GetFmt() ) &&
+ 0 != ( pSectNd = pSectFmt->GetSectionNode() ))
+ {
+ SwNodeIndex aIdx( *pSectNd, 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
+ const SwCntntFrm* pCFrm;
+ if( pCNd &&
+ pCNd->EndOfSectionIndex() < pSectNd->EndOfSectionIndex() &&
+ 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) &&
+ ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->GetPoint()->nNode = *pCNd;
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
+ bRet = !pCurCrsr->IsInProtectTable() &&
+ !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ break;
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+
+ // springe zur naechsten (vorherigen) Tabellenformel
+ // optional auch nur zu kaputten Formeln springen
+sal_Bool SwCrsrShell::GotoNxtPrvTblFormula( sal_Bool bNext, sal_Bool bOnlyErrors )
+{
+ if( IsTableMode() )
+ return sal_False;
+
+ sal_Bool bFnd = sal_False;
+ SwPosition& rPos = *pCurCrsr->GetPoint();
+
+ Point aPt;
+ SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
+ if( !bNext )
+ aFndPos.nNode = 0;
+ _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos );
+
+ {
+ const SwNode* pSttNd = rPos.nNode.GetNode().FindTableBoxStartNode();
+ if( pSttNd )
+ {
+ const SwTableBox* pTBox = pSttNd->FindTableNode()->GetTable().
+ GetTblBox( pSttNd->GetIndex() );
+ if( pTBox )
+ aCurGEF = _SetGetExpFld( *pTBox );
+ }
+ }
+
+ if( rPos.nNode < GetDoc()->GetNodes().GetEndOfExtras() )
+ // auch beim Einsammeln wird nur der erste Frame benutzt!
+ aCurGEF.SetBodyPos( *rPos.nNode.GetNode().GetCntntNode()->getLayoutFrm( GetLayout(),
+ &aPt, &rPos, sal_False ) );
+ {
+ const SfxPoolItem* pItem;
+ const SwTableBox* pTBox;
+ sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA );
+
+ for( n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem2(
+ RES_BOXATR_FORMULA, n ) ) &&
+ 0 != (pTBox = ((SwTblBoxFormula*)pItem)->GetTableBox() ) &&
+ pTBox->GetSttNd() &&
+ pTBox->GetSttNd()->GetNodes().IsDocNodes() &&
+ ( !bOnlyErrors ||
+ !((SwTblBoxFormula*)pItem)->HasValidBoxes() ) )
+ {
+ const SwCntntFrm* pCFrm;
+ SwNodeIndex aIdx( *pTBox->GetSttNd() );
+ const SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
+ if( pCNd && 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False ) ) &&
+ (IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
+ {
+ _SetGetExpFld aCmp( *pTBox );
+ aCmp.SetBodyPos( *pCFrm );
+
+ if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
+ : ( aCmp < aCurGEF && aFndGEF < aCmp ))
+ {
+ aFndGEF = aCmp;
+ bFnd = sal_True;
+ }
+ }
+ }
+ }
+
+ if( bFnd )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ aFndGEF.GetPosOfContent( rPos );
+ pCurCrsr->DeleteMark();
+
+ bFnd = !pCurCrsr->IsSelOvr();
+ if( bFnd )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ return bFnd;
+}
+
+// springe zum naechsten (vorherigen) Verzeichniseintrag
+sal_Bool SwCrsrShell::GotoNxtPrvTOXMark( sal_Bool bNext )
+{
+ if( IsTableMode() )
+ return sal_False;
+
+ sal_Bool bFnd = sal_False;
+ SwPosition& rPos = *pCurCrsr->GetPoint();
+
+ Point aPt;
+ SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
+ if( !bNext )
+ aFndPos.nNode = 0;
+ _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos );
+
+ if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() )
+ // auch beim Einsammeln wird nur der erste Frame benutzt!
+ aCurGEF.SetBodyPos( *rPos.nNode.GetNode().
+ GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) );
+ {
+ const SfxPoolItem* pItem;
+ const SwCntntFrm* pCFrm;
+ const SwTxtNode* pTxtNd;
+ const SwTxtTOXMark* pTxtTOX;
+ sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK );
+
+ for( n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem2(
+ RES_TXTATR_TOXMARK, n ) ) &&
+ 0 != (pTxtTOX = ((SwTOXMark*)pItem)->GetTxtTOXMark() ) &&
+ ( pTxtNd = &pTxtTOX->GetTxtNode())->GetNodes().IsDocNodes() &&
+ 0 != ( pCFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False )) &&
+ ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
+ {
+ SwNodeIndex aNdIndex( *pTxtNd ); // UNIX benoetigt dieses Obj.
+ _SetGetExpFld aCmp( aNdIndex, *pTxtTOX, 0 );
+ aCmp.SetBodyPos( *pCFrm );
+
+ if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
+ : ( aCmp < aCurGEF && aFndGEF < aCmp ))
+ {
+ aFndGEF = aCmp;
+ bFnd = sal_True;
+ }
+ }
+ }
+
+ if( bFnd )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ aFndGEF.GetPosOfContent( rPos );
+
+ bFnd = !pCurCrsr->IsSelOvr();
+ if( bFnd )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ return bFnd;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Traveling zwischen Markierungen
+ --------------------------------------------------------------------*/
+
+const SwTOXMark& SwCrsrShell::GotoTOXMark( const SwTOXMark& rStart,
+ SwTOXSearch eDir )
+{
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ const SwTOXMark& rNewMark = GetDoc()->GotoTOXMark( rStart, eDir,
+ IsReadOnlyAvailable() );
+ // Position setzen
+ SwPosition& rPos = *GetCrsr()->GetPoint();
+ rPos.nNode = rNewMark.GetTxtTOXMark()->GetTxtNode();
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(),
+ *rNewMark.GetTxtTOXMark()->GetStart() );
+
+ if( !pCurCrsr->IsSelOvr() )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+
+ return rNewMark;
+}
+
+// springe zum naechsten / vorherigen FeldTypen
+
+void lcl_MakeFldLst( _SetGetExpFlds& rLst, const SwFieldType& rFldType,
+ sal_uInt16 nSubType, sal_Bool bInReadOnly,
+ sal_Bool bChkInpFlag = sal_False )
+{
+ // es muss immer der 1. Frame gesucht werden
+ Point aPt;
+ SwTxtFld* pTxtFld;
+ SwIterator<SwFmtFld,SwFieldType> aIter(rFldType);
+ bool bSubType = nSubType != USHRT_MAX;
+ for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
+ if( 0 != ( pTxtFld = pFmtFld->GetTxtFld() ) &&
+ ( !bChkInpFlag || ((SwSetExpField*)pTxtFld->GetFld().GetFld())
+ ->GetInputFlag() ) &&
+ (!bSubType || (pFmtFld->GetFld()->GetSubType()
+ & 0xff ) == nSubType ))
+ {
+ SwCntntFrm* pCFrm;
+ const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
+ if( 0 != ( pCFrm = rTxtNode.getLayoutFrm( rTxtNode.GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False )) &&
+ ( bInReadOnly || !pCFrm->IsProtected() ))
+ {
+ _SetGetExpFld* pNew = new _SetGetExpFld(
+ SwNodeIndex( rTxtNode ), pTxtFld );
+ pNew->SetBodyPos( *pCFrm );
+ rLst.Insert( pNew );
+ }
+ }
+}
+
+
+sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
+ sal_uInt16 nSubType, sal_uInt16 nResType )
+{
+ // sortierte Liste aller Felder
+ _SetGetExpFlds aSrtLst( 64 );
+
+ if (pFldType)
+ {
+ if( RES_INPUTFLD != pFldType->Which() && !pFldType->GetDepends() )
+ return sal_False;
+
+ // Modify-Object gefunden, trage alle Felder ins Array ein
+ ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType, IsReadOnlyAvailable() );
+
+ if( RES_INPUTFLD == pFldType->Which() )
+ {
+ // es gibt noch versteckte InputFelder in den SetExp. Feldern
+ const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
+ const sal_uInt16 nSize = rFldTypes.Count();
+
+ // Alle Typen abklappern
+ for( sal_uInt16 i=0; i < nSize; ++i )
+ if( RES_SETEXPFLD == ( pFldType = rFldTypes[ i ] )->Which() )
+ ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType,
+ IsReadOnlyAvailable(), sal_True );
+ }
+ }
+ else
+ {
+ const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
+ const sal_uInt16 nSize = rFldTypes.Count();
+
+ // Alle Typen abklappern
+ for( sal_uInt16 i=0; i < nSize; ++i )
+ if( nResType == ( pFldType = rFldTypes[ i ] )->Which() )
+ ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType,
+ IsReadOnlyAvailable() );
+ }
+
+ // keine Felder gefunden?
+ if( !aSrtLst.Count() )
+ return sal_False;
+
+ sal_uInt16 nPos;
+ SwCursor* pCrsr = getShellCrsr( true );
+ {
+ // JP 19.08.98: es muss immer ueber das Feld gesucht werden, damit
+ // auch immer das richtige gefunden wird, wenn welche in
+ // Rahmen stehen, die in einem Absatz verankert sind,
+ // in dem ein Feld steht - siehe auch Bug 55247
+ const SwPosition& rPos = *pCrsr->GetPoint();
+
+ SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
+ ASSERT( pTNd, "Wo ist mein CntntNode?" );
+
+ SwTxtFld * pTxtFld = static_cast<SwTxtFld *>(
+ pTNd->GetTxtAttrForCharAt(rPos.nContent.GetIndex(),
+ RES_TXTATR_FIELD));
+ sal_Bool bDelFld = 0 == pTxtFld;
+ if( bDelFld )
+ {
+ SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
+ (SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) );
+
+ pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex() );
+ pTxtFld->ChgTxtNode( pTNd );
+ }
+
+ _SetGetExpFld aSrch( rPos.nNode, pTxtFld, &rPos.nContent );
+ if( rPos.nNode.GetIndex() < pDoc->GetNodes().GetEndOfExtras().GetIndex() )
+ {
+ // auch beim Einsammeln wird nur der erste Frame benutzt!
+ Point aPt;
+ aSrch.SetBodyPos( *pTNd->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) );
+ }
+
+ sal_Bool bFound = aSrtLst.Seek_Entry( &aSrch, &nPos );
+ if( bDelFld )
+ {
+ delete (SwFmtFld*)&pTxtFld->GetAttr();
+ delete pTxtFld;
+ }
+
+ if( bFound ) // stehe auf einem ?
+ {
+ if( bNext )
+ {
+ if( ++nPos >= aSrtLst.Count() )
+ return sal_False; // schon am Ende
+ }
+ else if( !nPos-- )
+ return sal_False; // weiter nach vorne geht nicht
+ }
+ else if( bNext ? nPos >= aSrtLst.Count() : !nPos--)
+ return sal_False;
+ }
+ const _SetGetExpFld& rFnd = **( aSrtLst.GetData() + nPos );
+
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ rFnd.GetPosOfContent( *pCrsr->GetPoint() );
+ sal_Bool bRet = !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE );
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::GotoFld( const SwFmtFld& rFld )
+{
+ sal_Bool bRet = sal_False;
+ if( rFld.GetTxtFld() )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ SwCursor* pCrsr = getShellCrsr( true );
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ SwTxtNode* pTNd = (SwTxtNode*)rFld.GetTxtFld()->GetpTxtNode();
+ pCrsr->GetPoint()->nNode = *pTNd;
+ pCrsr->GetPoint()->nContent.Assign( pTNd, *rFld.GetTxtFld()->GetStart() );
+
+ bRet = !pCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+
+void SwCrsrShell::GotoOutline( sal_uInt16 nIdx )
+{
+ SwCursor* pCrsr = getShellCrsr( true );
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ const SwNodes& rNds = GetDoc()->GetNodes();
+ SwTxtNode* pTxtNd = (SwTxtNode*)rNds.GetOutLineNds()[ nIdx ]->GetTxtNode();
+ pCrsr->GetPoint()->nNode = *pTxtNd;
+ pCrsr->GetPoint()->nContent.Assign( pTxtNd, 0 );
+
+ if( !pCrsr->IsSelOvr() )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+}
+
+
+sal_Bool SwCrsrShell::GotoOutline( const String& rName )
+{
+ SwCursor* pCrsr = getShellCrsr( true );
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ sal_Bool bRet = sal_False;
+ if( pDoc->GotoOutline( *pCrsr->GetPoint(), rName ) && !pCrsr->IsSelOvr() )
+ {
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ bRet = sal_True;
+ }
+ return bRet;
+}
+
+
+
+sal_Bool SwCrsrShell::GotoNextOutline() // naechster Node mit Outline-Num.
+{
+ SwCursor* pCrsr = getShellCrsr( true );
+ const SwNodes& rNds = GetDoc()->GetNodes();
+
+ SwNode* pNd = pCrsr->GetNode();
+ sal_uInt16 nPos;
+ if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
+ ++nPos;
+
+ if( nPos == rNds.GetOutLineNds().Count() )
+ return sal_False;
+
+ pNd = rNds.GetOutLineNds()[ nPos ];
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+ pCrsr->GetPoint()->nNode = *pNd;
+ pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 );
+
+ sal_Bool bRet = !pCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::GotoPrevOutline() // vorheriger Node mit Outline-Num.
+{
+ SwCursor* pCrsr = getShellCrsr( true );
+ const SwNodes& rNds = GetDoc()->GetNodes();
+
+ SwNode* pNd = pCrsr->GetNode();
+ sal_uInt16 nPos;
+ rNds.GetOutLineNds().Seek_Entry( pNd, &nPos );
+
+ sal_Bool bRet = sal_False;
+ if( nPos )
+ {
+ --nPos; // davor
+
+ pNd = rNds.GetOutLineNds()[ nPos ];
+ if( pNd->GetIndex() > pCrsr->GetPoint()->nNode.GetIndex() )
+ return sal_False;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+ pCrsr->GetPoint()->nNode = *pNd;
+ pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 );
+
+ bRet = !pCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+
+ // suche die "Outline-Position" vom vorherigen Outline-Node mit dem
+ // Level.
+sal_uInt16 SwCrsrShell::GetOutlinePos( sal_uInt8 nLevel )
+{
+ SwPaM* pCrsr = getShellCrsr( true );
+ const SwNodes& rNds = GetDoc()->GetNodes();
+
+ SwNode* pNd = pCrsr->GetNode();
+ sal_uInt16 nPos;
+ if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
+ nPos++; // steht auf der Position, fuers while zum Naechsten
+
+ while( nPos-- ) // immer den davor testen !
+ {
+ pNd = rNds.GetOutLineNds()[ nPos ];
+
+ //if( ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() <= nLevel )//#outline level,zhaojianwei
+ if( ((SwTxtNode*)pNd)->GetAttrOutlineLevel()-1 <= nLevel )//<-end,zhaojianwei
+ return nPos;
+
+ }
+ return USHRT_MAX; // davor keiner mehr also Ende
+}
+
+
+sal_Bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos,
+ sal_Bool bWithChilds )
+{
+ const SwNodes& rNds = GetDoc()->GetNodes();
+ const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
+ if( !rOutlNds.Count() ) // wie jetzt ???
+ return sal_False;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ if( nSttPos > nEndPos ) // sollte jemand das vertauscht haben?
+ {
+ ASSERT( !this, "Start- > Ende-Position im Array" );
+ sal_uInt16 nTmp = nSttPos;
+ nSttPos = nEndPos;
+ nEndPos = nTmp;
+ }
+
+ SwNode* pSttNd = rOutlNds[ nSttPos ];
+ SwNode* pEndNd = rOutlNds[ nEndPos ];
+
+ if( bWithChilds )
+ {
+ //sal_uInt8 nLevel = pEndNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
+ const int nLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end.zhaojianwei
+ for( ++nEndPos; nEndPos < rOutlNds.Count(); ++nEndPos )
+ {
+ pEndNd = rOutlNds[ nEndPos ];
+ //sal_uInt8 nNxtLevel = pEndNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
+ const int nNxtLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end,zhaojianwei
+ if( nNxtLevel <= nLevel )
+ break; // EndPos steht jetzt auf dem naechsten
+ }
+ }
+ // ohne Childs, dann aber zumindest auf den naechsten
+ else if( ++nEndPos < rOutlNds.Count() )
+ pEndNd = rOutlNds[ nEndPos ];
+
+ if( nEndPos == rOutlNds.Count() ) // kein Ende gefunden
+ pEndNd = &rNds.GetEndOfContent();
+
+ KillPams();
+
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ // Jetzt das Ende ans Ende vom voherigen ContentNode setzen
+ pCurCrsr->GetPoint()->nNode = *pSttNd;
+ pCurCrsr->GetPoint()->nContent.Assign( pSttNd->GetCntntNode(), 0 );
+ pCurCrsr->SetMark();
+ pCurCrsr->GetPoint()->nNode = *pEndNd;
+ pCurCrsr->Move( fnMoveBackward, fnGoNode ); // ans Ende vom Vorgaenger
+
+ // und schon ist alles selektiert
+ sal_Bool bRet = !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return bRet;
+}
+
+
+// springe zu dieser Refmark
+sal_Bool SwCrsrShell::GotoRefMark( const String& rRefMark, sal_uInt16 nSubType,
+ sal_uInt16 nSeqNo )
+{
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ sal_uInt16 nPos;
+ SwTxtNode* pTxtNd = SwGetRefFieldType::FindAnchor( GetDoc(), rRefMark,
+ nSubType, nSeqNo, &nPos );
+ if( pTxtNd && pTxtNd->GetNodes().IsDocNodes() )
+ {
+ pCurCrsr->GetPoint()->nNode = *pTxtNd;
+ pCurCrsr->GetPoint()->nContent.Assign( pTxtNd, nPos );
+
+ if( !pCurCrsr->IsSelOvr() )
+ {
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+sal_Bool SwCrsrShell::IsPageAtPos( const Point &rPt ) const
+{
+ if( GetLayout() )
+ return 0 != GetLayout()->GetPageAtPos( rPt );
+ return sal_False;
+}
+
+sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
+ SwContentAtPos& rCntntAtPos,
+ sal_Bool bSetCrsr,
+ SwRect* pFldRect )
+{
+ SET_CURR_SHELL( this );
+ sal_Bool bRet = sal_False;
+
+ if( !IsTableMode() )
+ {
+ Point aPt( rPt );
+ SwPosition aPos( *pCurCrsr->GetPoint() );
+
+ SwTxtNode* pTxtNd;
+ SwCntntFrm *pFrm(0);
+ SwTxtAttr* pTxtAttr;
+ SwCrsrMoveState aTmpState;
+ aTmpState.bFieldInfo = sal_True;
+ aTmpState.bExactOnly = !( SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos );
+ aTmpState.bCntntCheck = (SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos) ? sal_True : sal_False;
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+
+ SwSpecialPos aSpecialPos;
+ aTmpState.pSpecialPos = ( SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos ) ?
+ &aSpecialPos : 0;
+
+ const sal_Bool bCrsrFoundExact = GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState );
+ pTxtNd = aPos.nNode.GetNode().GetTxtNode();
+
+ const SwNodes& rNds = GetDoc()->GetNodes();
+ if( pTxtNd && SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos
+ && rNds.GetOutLineNds().Count() )
+ {
+ const SwTxtNode* pONd = pTxtNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
+ if( pONd )
+ {
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_OUTLINE;
+ rCntntAtPos.sStr = pONd->GetExpandTxt( 0, STRING_LEN, true );
+ bRet = sal_True;
+ }
+ }
+ // --> FME 2005-05-13 #i43742# New function: SW_CONTENT_CHECK
+ else if ( SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos &&
+ bCrsrFoundExact )
+ {
+ bRet = sal_True;
+ }
+ // <--
+ // #i23726#
+ else if( pTxtNd &&
+ SwContentAtPos::SW_NUMLABEL & rCntntAtPos.eCntntAtPos)
+ {
+ bRet = aTmpState.bInNumPortion;
+ rCntntAtPos.aFnd.pNode = pTxtNd;
+
+ Size aSizeLogic(aTmpState.nInNumPostionOffset, 0);
+ Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
+ rCntntAtPos.nDist = aSizePixel.Width();
+ }
+ else if( bCrsrFoundExact && pTxtNd )
+ {
+ if( !aTmpState.bPosCorr )
+ {
+ if( !bRet && SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos
+ && !aTmpState.bFtnNoInfo )
+ {
+ const SwWrongList* pSmartTagList = pTxtNd->GetSmartTags();
+ xub_StrLen nCurrent = aPos.nContent.GetIndex();
+ xub_StrLen nBegin = nCurrent;
+ xub_StrLen nLen = 1;
+
+ if ( pSmartTagList && pSmartTagList->InWrongWord( nCurrent, nLen ) && !pTxtNd->IsSymbol(nBegin) )
+ {
+ const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
+ const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
+ if ( pSubList )
+ {
+ nCurrent = aTmpState.pSpecialPos->nCharOfst;
+
+ if ( pSubList->InWrongWord( nCurrent, nLen ) )
+ bRet = sal_True;
+ }
+ else
+ bRet = sal_True;
+
+ if( bRet && bSetCrsr )
+ {
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = aPos;
+ if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
+ bRet = sal_False;
+ else
+ UpdateCrsr();
+ }
+ if( bRet )
+ {
+// rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
+// *pTxtAttr->GetStart(),
+// *pTxtAttr->GetEnd() - *pTxtAttr->GetStart(),
+// sal_False );
+
+// rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_SMARTTAG;
+// rCntntAtPos.pFndTxtAttr = pTxtAttr;
+
+ if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+ }
+ }
+ }
+
+ if( !bRet && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD )
+ & rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
+ {
+ pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
+ aPos.nContent.GetIndex(), RES_TXTATR_FIELD );
+ const SwField* pFld = pTxtAttr
+ ? pTxtAttr->GetFld().GetFld()
+ : 0;
+ if( SwContentAtPos::SW_CLICKFIELD & rCntntAtPos.eCntntAtPos &&
+ pFld && !pFld->HasClickHdl() )
+ pFld = 0;
+
+ if( pFld )
+ {
+ if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+
+ if( bSetCrsr )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = aPos;
+ if( pCurCrsr->IsSelOvr() )
+ {
+ // Click-Felder in geschuetzten Bereichen zulassen
+ // Nur Platzhalter geht nicht!
+ if( SwContentAtPos::SW_FIELD & rCntntAtPos.eCntntAtPos
+ || RES_JUMPEDITFLD == pFld->Which() )
+ pFld = 0;
+ }
+ else
+ UpdateCrsr();
+ }
+ else if( RES_TABLEFLD == pFld->Which() &&
+ ((SwTblField*)pFld)->IsIntrnlName() )
+ {
+ // erzeuge aus der internen (fuer CORE)
+ // die externe (fuer UI) Formel
+ const SwTableNode* pTblNd = pTxtNd->FindTableNode();
+ if( pTblNd ) // steht in einer Tabelle
+ ((SwTblField*)pFld)->PtrToBoxNm( &pTblNd->GetTable() );
+ }
+ }
+
+ if( pFld )
+ {
+ rCntntAtPos.aFnd.pFld = pFld;
+ rCntntAtPos.pFndTxtAttr = pTxtAttr;
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FIELD;
+ bRet = sal_True;
+ }
+ }
+
+ if( !bRet && SwContentAtPos::SW_FORMCTRL & rCntntAtPos.eCntntAtPos )
+ {
+ IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
+ sw::mark::IFieldmark* pFldBookmark = pMarksAccess->getFieldmarkFor( aPos );
+ if( bCrsrFoundExact && pTxtNd && pFldBookmark) {
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FORMCTRL;
+ rCntntAtPos.aFnd.pFldmark = pFldBookmark;
+ bRet=sal_True;
+ }
+ }
+
+ if( !bRet && SwContentAtPos::SW_FTN & rCntntAtPos.eCntntAtPos )
+ {
+ if( aTmpState.bFtnNoInfo )
+ {
+ // stehe ueber dem Zeichen der Fussnote (??)
+ bRet = sal_True;
+ if( bSetCrsr )
+ {
+ *pCurCrsr->GetPoint() = aPos;
+ if( !GotoFtnAnchor() )
+ bRet = sal_False;
+ }
+ if( bRet )
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
+ }
+ else if ( 0 != ( pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
+ aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
+ {
+ bRet = sal_True;
+ if( bSetCrsr )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->GetPoint()->nNode = *((SwTxtFtn*)pTxtAttr)->GetStartNode();
+ SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection(
+ &pCurCrsr->GetPoint()->nNode,
+ sal_True, !IsReadOnlyAvailable() );
+
+ if( pCNd )
+ {
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
+ if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE ))
+ bRet = sal_False;
+ else
+ UpdateCrsr();
+ }
+ else
+ bRet = sal_False;
+ }
+
+ if( bRet )
+ {
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
+ rCntntAtPos.pFndTxtAttr = pTxtAttr;
+ rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
+
+ if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+ }
+ }
+ }
+
+ if( !bRet && ( SwContentAtPos::SW_TOXMARK |
+ SwContentAtPos::SW_REFMARK ) &
+ rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
+ {
+ pTxtAttr = 0;
+ if( SwContentAtPos::SW_TOXMARK & rCntntAtPos.eCntntAtPos )
+ {
+ ::std::vector<SwTxtAttr *> const marks(
+ pTxtNd->GetTxtAttrsAt(
+ aPos.nContent.GetIndex(), RES_TXTATR_TOXMARK));
+ if (marks.size())
+ { // hmm... can only return 1 here
+ pTxtAttr = *marks.begin();
+ }
+ }
+
+ if( !pTxtAttr &&
+ SwContentAtPos::SW_REFMARK & rCntntAtPos.eCntntAtPos )
+ {
+ ::std::vector<SwTxtAttr *> const marks(
+ pTxtNd->GetTxtAttrsAt(
+ aPos.nContent.GetIndex(), RES_TXTATR_REFMARK));
+ if (marks.size())
+ { // hmm... can only return 1 here
+ pTxtAttr = *marks.begin();
+ }
+ }
+
+ if( pTxtAttr )
+ {
+ bRet = sal_True;
+ if( bSetCrsr )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = aPos;
+ if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE ) )
+ bRet = sal_False;
+ else
+ UpdateCrsr();
+ }
+
+ if( bRet )
+ {
+ const xub_StrLen* pEnd = pTxtAttr->GetEnd();
+ if( pEnd )
+ rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
+ *pTxtAttr->GetStart(),
+ *pEnd - *pTxtAttr->GetStart() );
+ else if( RES_TXTATR_TOXMARK == pTxtAttr->Which())
+ rCntntAtPos.sStr = pTxtAttr->GetTOXMark().
+ GetAlternativeText();
+
+ rCntntAtPos.eCntntAtPos =
+ RES_TXTATR_TOXMARK == pTxtAttr->Which()
+ ? SwContentAtPos::SW_TOXMARK
+ : SwContentAtPos::SW_REFMARK;
+ rCntntAtPos.pFndTxtAttr = pTxtAttr;
+ rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
+
+ if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+ }
+ }
+ }
+
+ if( !bRet && SwContentAtPos::SW_INETATTR & rCntntAtPos.eCntntAtPos
+ && !aTmpState.bFtnNoInfo )
+ {
+ pTxtAttr = pTxtNd->GetTxtAttrAt(
+ aPos.nContent.GetIndex(), RES_TXTATR_INETFMT);
+ // nur INetAttrs mit URLs "erkennen"
+ if( pTxtAttr && pTxtAttr->GetINetFmt().GetValue().Len() )
+ {
+ bRet = sal_True;
+ if( bSetCrsr )
+ {
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = aPos;
+ if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
+ bRet = sal_False;
+ else
+ UpdateCrsr();
+ }
+ if( bRet )
+ {
+ rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
+ *pTxtAttr->GetStart(),
+ *pTxtAttr->GetEnd() - *pTxtAttr->GetStart() );
+
+ rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_INETATTR;
+ rCntntAtPos.pFndTxtAttr = pTxtAttr;
+
+ if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+ }
+ }
+ }
+
+ if( !bRet && SwContentAtPos::SW_REDLINE & rCntntAtPos.eCntntAtPos )
+ {
+ const SwRedline* pRedl = GetDoc()->GetRedline(aPos, NULL);
+ if( pRedl )
+ {
+ rCntntAtPos.aFnd.pRedl = pRedl;
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
+ rCntntAtPos.pFndTxtAttr = 0;
+ bRet = sal_True;
+
+ if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+ }
+ }
+ }
+
+ if( !bRet && (
+ SwContentAtPos::SW_TABLEBOXFML & rCntntAtPos.eCntntAtPos
+#ifdef DBG_UTIL
+ || SwContentAtPos::SW_TABLEBOXVALUE & rCntntAtPos.eCntntAtPos
+#endif
+ ))
+ {
+ const SwTableNode* pTblNd;
+ const SwTableBox* pBox;
+ const SwStartNode* pSttNd = pTxtNd->FindTableBoxStartNode();
+ const SfxPoolItem* pItem;
+ if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) &&
+ 0 != ( pBox = pTblNd->GetTable().GetTblBox(
+ pSttNd->GetIndex() )) &&
+#ifdef DBG_UTIL
+ ( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+ RES_BOXATR_FORMULA, sal_False, &pItem ) ||
+ SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+ RES_BOXATR_VALUE, sal_False, &pItem ))
+#else
+ SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+ RES_BOXATR_FORMULA, sal_False, &pItem )
+#endif
+ )
+ {
+ SwFrm* pF = pTxtNd->getLayoutFrm( GetLayout(), &aPt );
+ if( pF )
+ {
+ // dann aber den CellFrame
+ pFrm = (SwCntntFrm*)pF;
+ while( pF && !pF->IsCellFrm() )
+ pF = pF->GetUpper();
+ }
+
+ // es wurde ein
+ if( aTmpState.bPosCorr )
+ {
+ if( pF && !pF->Frm().IsInside( aPt ))
+ pF = 0;
+ }
+ else if( !pF )
+ pF = pFrm;
+
+ if( pF ) // nur dann ist es gueltig!!
+ {
+ // erzeuge aus der internen (fuer CORE)
+ // die externe (fuer UI) Formel
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXFML;
+#ifdef DBG_UTIL
+ if( RES_BOXATR_VALUE == pItem->Which() )
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXVALUE;
+ else
+#endif
+ ((SwTblBoxFormula*)pItem)->PtrToBoxNm( &pTblNd->GetTable() );
+
+ bRet = sal_True;
+ if( bSetCrsr )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ *pCurCrsr->GetPoint() = aPos;
+ if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
+ bRet = sal_False;
+ else
+ UpdateCrsr();
+ }
+
+ if( bRet )
+ {
+ if( pFldRect )
+ {
+ *pFldRect = pF->Prt();
+ *pFldRect += pF->Frm().Pos();
+ }
+ rCntntAtPos.pFndTxtAttr = 0;
+ rCntntAtPos.aFnd.pAttr = pItem;
+ }
+ }
+ }
+ }
+
+#ifdef DBG_UTIL
+ if( !bRet && SwContentAtPos::SW_CURR_ATTRS & rCntntAtPos.eCntntAtPos )
+ {
+ xub_StrLen n = aPos.nContent.GetIndex();
+ SfxItemSet aSet( GetDoc()->GetAttrPool(), POOLATTR_BEGIN,
+ POOLATTR_END - 1 );
+ if( pTxtNd->GetpSwpHints() )
+ {
+ for( sal_uInt16 i = 0; i < pTxtNd->GetSwpHints().Count(); ++i )
+ {
+ const SwTxtAttr* pHt = pTxtNd->GetSwpHints()[i];
+ xub_StrLen nAttrStart = *pHt->GetStart();
+ if( nAttrStart > n ) // ueber den Bereich hinaus
+ break;
+
+ if( 0 != pHt->GetEnd() && (
+ ( nAttrStart < n &&
+ ( pHt->DontExpand() ? n < *pHt->GetEnd()
+ : n <= *pHt->GetEnd() )) ||
+ ( n == nAttrStart &&
+ ( nAttrStart == *pHt->GetEnd() || !n ))) )
+ {
+ aSet.Put( pHt->GetAttr() );
+ }
+ }
+ if( pTxtNd->HasSwAttrSet() &&
+ pTxtNd->GetpSwAttrSet()->Count() )
+ {
+ SfxItemSet aFmtSet( pTxtNd->GetSwAttrSet() );
+ // aus dem Format-Set alle entfernen, die im TextSet auch gesetzt sind
+ aFmtSet.Differentiate( aSet );
+ // jetzt alle zusammen "mergen"
+ aSet.Put( aFmtSet );
+ }
+ }
+ else
+ pTxtNd->SwCntntNode::GetAttr( aSet );
+
+ rCntntAtPos.sStr.AssignAscii(
+ RTL_CONSTASCII_STRINGPARAM( "Pos: (" ));
+ rCntntAtPos.sStr += String::CreateFromInt32( aPos.nNode.GetIndex());
+ rCntntAtPos.sStr += ':';
+ rCntntAtPos.sStr += String::CreateFromInt32( aPos.nContent.GetIndex());
+ rCntntAtPos.sStr += ')';
+ rCntntAtPos.sStr.AppendAscii(
+ RTL_CONSTASCII_STRINGPARAM( "\nAbs.Vorl.: " ));
+ rCntntAtPos.sStr += pTxtNd->GetFmtColl()->GetName();
+ if( pTxtNd->GetCondFmtColl() )
+ rCntntAtPos.sStr.AppendAscii(
+ RTL_CONSTASCII_STRINGPARAM( "\nBed.Vorl.: " ))
+ += pTxtNd->GetCondFmtColl()->GetName();
+
+ if( aSet.Count() )
+ {
+ String sAttrs;
+ SfxItemIter aIter( aSet );
+ const SfxPoolItem* pItem = aIter.FirstItem();
+ while( sal_True )
+ {
+ if( !IsInvalidItem( pItem ))
+ {
+ String aStr;
+ GetDoc()->GetAttrPool().GetPresentation( *pItem,
+ SFX_ITEM_PRESENTATION_COMPLETE,
+ SFX_MAPUNIT_CM, aStr );
+ if( sAttrs.Len() )
+ sAttrs.AppendAscii(
+ RTL_CONSTASCII_STRINGPARAM( ", " ));
+ sAttrs += aStr;
+ }
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+ if( sAttrs.Len() )
+ {
+ if( rCntntAtPos.sStr.Len() )
+ rCntntAtPos.sStr += '\n';
+ rCntntAtPos.sStr.AppendAscii(
+ RTL_CONSTASCII_STRINGPARAM( "Attr: " ) )
+ += sAttrs;
+ }
+ }
+ bRet = sal_True;
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_CURR_ATTRS;
+ }
+#endif
+ }
+ }
+
+ if( !bRet )
+ {
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_NOTHING;
+ rCntntAtPos.aFnd.pFld = 0;
+ }
+ return bRet;
+}
+
+// --> OD 2008-06-19 #i90516#
+const SwPostItField* SwCrsrShell::GetPostItFieldAtCursor() const
+{
+ const SwPostItField* pPostItFld = 0;
+
+ if ( !IsTableMode() )
+ {
+ const SwPosition* pCursorPos = _GetCrsr()->GetPoint();
+ const SwTxtNode* pTxtNd = pCursorPos->nNode.GetNode().GetTxtNode();
+ if ( pTxtNd )
+ {
+ SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
+ pCursorPos->nContent.GetIndex(), RES_TXTATR_FIELD );
+ const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0;
+ if ( pFld && pFld->Which()== RES_POSTITFLD )
+ {
+ pPostItFld = static_cast<const SwPostItField*>(pFld);
+ }
+ }
+ }
+
+ return pPostItFld;
+}
+// <--
+
+// befindet sich der Node in einem geschuetzten Bereich?
+sal_Bool SwContentAtPos::IsInProtectSect() const
+{
+ const SwTxtNode* pNd = 0;
+ if( pFndTxtAttr )
+ {
+ switch( eCntntAtPos )
+ {
+ case SW_FIELD:
+ case SW_CLICKFIELD:
+ pNd = ((SwTxtFld*)pFndTxtAttr)->GetpTxtNode();
+ break;
+
+ case SW_FTN:
+ pNd = &((SwTxtFtn*)pFndTxtAttr)->GetTxtNode();
+ break;
+
+ case SW_INETATTR:
+ pNd = ((SwTxtINetFmt*)pFndTxtAttr)->GetpTxtNode();
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ const SwCntntFrm* pFrm;
+ return pNd && ( pNd->IsInProtectSect() ||
+ ( 0 != ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), 0,0,sal_False)) &&
+ pFrm->IsProtected() ));
+}
+
+bool SwContentAtPos::IsInRTLText()const
+{
+ bool bRet = false;
+ const SwTxtNode* pNd = 0;
+ if (pFndTxtAttr && (eCntntAtPos == SW_FTN))
+ {
+ const SwTxtFtn* pTxtFtn = static_cast<const SwTxtFtn*>(pFndTxtAttr);
+ if(pTxtFtn->GetStartNode())
+ {
+ SwStartNode* pSttNd = pTxtFtn->GetStartNode()->GetNode().GetStartNode();
+ SwPaM aTemp( *pSttNd );
+ aTemp.Move(fnMoveForward, fnGoNode);
+ SwCntntNode* pCntntNode = aTemp.GetCntntNode();
+ if(pCntntNode && pCntntNode->IsTxtNode())
+ pNd = static_cast<SwTxtNode*>(pCntntNode);
+ }
+ }
+ if(pNd)
+ {
+ SwIterator<SwTxtFrm,SwTxtNode> aIter(*pNd);
+ SwTxtFrm* pTmpFrm = aIter.First();
+ while( pTmpFrm )
+ {
+ if ( !pTmpFrm->IsFollow())
+ {
+ bRet = pTmpFrm->IsRightToLeft();
+ break;
+ }
+ pTmpFrm = aIter.Next();
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCrsrShell::SelectTxtAttr( sal_uInt16 nWhich, sal_Bool bExpand,
+ const SwTxtAttr* pTxtAttr )
+{
+ SET_CURR_SHELL( this );
+ sal_Bool bRet = sal_False;
+
+ if( !IsTableMode() )
+ {
+ SwPosition& rPos = *pCurCrsr->GetPoint();
+ if( !pTxtAttr )
+ {
+ SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+ pTxtAttr = (pTxtNd)
+ ? pTxtNd->GetTxtAttrAt(rPos.nContent.GetIndex(),
+ static_cast<RES_TXTATR>(nWhich),
+ (bExpand) ? SwTxtNode::EXPAND : SwTxtNode::DEFAULT)
+ : 0;
+ }
+
+ if( pTxtAttr )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ pCurCrsr->DeleteMark();
+ rPos.nContent = *pTxtAttr->GetStart();
+ pCurCrsr->SetMark();
+ const xub_StrLen* pEnd = pTxtAttr->GetEnd();
+ rPos.nContent = pEnd ? *pEnd : *pTxtAttr->GetStart() + 1;
+
+ if( !pCurCrsr->IsSelOvr() )
+ {
+ UpdateCrsr();
+ bRet = sal_True;
+ }
+ }
+ }
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::GotoINetAttr( const SwTxtINetFmt& rAttr )
+{
+ sal_Bool bRet = sal_False;
+ if( rAttr.GetpTxtNode() )
+ {
+ SwCursor* pCrsr = getShellCrsr( true );
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ pCrsr->GetPoint()->nNode = *rAttr.GetpTxtNode();
+ pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)rAttr.GetpTxtNode(),
+ *rAttr.GetStart() );
+ bRet = !pCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+
+const SwFmtINetFmt* SwCrsrShell::FindINetAttr( const String& rName ) const
+{
+ return pDoc->FindINetAttr( rName );
+}
+
+sal_Bool SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode,
+ SwRect& rRect, sal_Int16& rOrient )
+{
+
+ SET_CURR_SHELL( this );
+ sal_Bool bRet = sal_False;
+
+ if (!IsTableMode() && !HasSelection()
+ && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
+ {
+ Point aPt( rPt );
+ SwPosition aPos( *pCurCrsr->GetPoint() );
+
+ SwFillCrsrPos aFPos( eFillMode );
+ SwCrsrMoveState aTmpState( &aFPos );
+
+ if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) &&
+ !aPos.nNode.GetNode().IsProtect())
+ {
+ // Start-Position im geschuetzten Bereich?
+ rRect = aFPos.aCrsr;
+ rOrient = aFPos.eOrient;
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
+{
+ SET_CURR_SHELL( this );
+ sal_Bool bRet = sal_False;
+
+ if (!IsTableMode() && !HasSelection()
+ && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
+ {
+ Point aPt( rPt );
+ SwPosition aPos( *pCurCrsr->GetPoint() );
+
+ SwFillCrsrPos aFPos( eFillMode );
+ SwCrsrMoveState aTmpState( &aFPos );
+
+ if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen
+ StartAction();
+
+ SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode();
+ SwUndoId nUndoId = UNDO_INS_FROM_SHADOWCRSR;
+ // Werden nur die Absatzattribute Adjust oder LRSpace gesetzt,
+ // dann sollte der naechste Aufruf die NICHT wieder entfernen.
+ if( 0 == aFPos.nParaCnt + aFPos.nColumnCnt &&
+ ( FILL_INDENT == aFPos.eMode ||
+ ( text::HoriOrientation::NONE != aFPos.eOrient &&
+ 0 == aFPos.nTabCnt + aFPos.nSpaceCnt )) &&
+ pCNd && pCNd->Len() )
+ nUndoId = UNDO_EMPTY;
+
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( nUndoId, NULL );
+
+ SwTxtFmtColl* pNextFmt = 0;
+ SwTxtNode* pTNd = pCNd->GetTxtNode();
+ if( pTNd )
+ pNextFmt = &pTNd->GetTxtColl()->GetNextTxtFmtColl();
+
+ const SwSectionNode* pSectNd = pCNd->FindSectionNode();
+ if( pSectNd && aFPos.nParaCnt )
+ {
+ SwNodeIndex aEnd( aPos.nNode, 1 );
+ while( aEnd.GetNode().IsEndNode() &&
+ (const SwNode*)&aEnd.GetNode() !=
+ pSectNd->EndOfSectionNode() )
+ aEnd++;
+
+ if( aEnd.GetNode().IsEndNode() &&
+ pCNd->Len() == aPos.nContent.GetIndex() )
+ aPos.nNode = *pSectNd->EndOfSectionNode();
+ }
+
+ for( sal_uInt16 n = 0; n < aFPos.nParaCnt + aFPos.nColumnCnt; ++n )
+ {
+ GetDoc()->AppendTxtNode( aPos );
+ if( !n && pNextFmt )
+ {
+ *pCurCrsr->GetPoint() = aPos;
+ GetDoc()->SetTxtFmtColl( *pCurCrsr, pNextFmt, false );
+ //JP 04.11.97: erstmal keine Folgevorlage der
+ // Folgevorlage beachten
+ // pNextFmt = pNextFmt->GetNextTxtFmtColl();
+ }
+ if( n < aFPos.nColumnCnt )
+ {
+ *pCurCrsr->GetPoint() = aPos;
+ GetDoc()->InsertPoolItem( *pCurCrsr,
+ SvxFmtBreakItem( SVX_BREAK_COLUMN_BEFORE, RES_BREAK ), 0);
+ }
+ }
+
+ *pCurCrsr->GetPoint() = aPos;
+ switch( aFPos.eMode )
+ {
+ case FILL_INDENT:
+ if( 0 != (pCNd = aPos.nNode.GetNode().GetCntntNode() ))
+ {
+ SfxItemSet aSet( GetDoc()->GetAttrPool(),
+ RES_LR_SPACE, RES_LR_SPACE,
+ RES_PARATR_ADJUST, RES_PARATR_ADJUST,
+ 0 );
+ SvxLRSpaceItem aLR( (SvxLRSpaceItem&)
+ pCNd->GetAttr( RES_LR_SPACE ) );
+ aLR.SetTxtLeft( aFPos.nTabCnt );
+ aLR.SetTxtFirstLineOfst( 0 );
+ aSet.Put( aLR );
+
+ const SvxAdjustItem& rAdj = (SvxAdjustItem&)pCNd->
+ GetAttr( RES_PARATR_ADJUST );
+ if( SVX_ADJUST_LEFT != rAdj.GetAdjust() )
+ aSet.Put( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) );
+
+ GetDoc()->InsertItemSet( *pCurCrsr, aSet, 0 );
+ }
+ else {
+ ASSERT( !this, "wo ist mein CntntNode?" );
+ }
+ break;
+
+ case FILL_TAB:
+ case FILL_SPACE:
+ {
+ String sInsert;
+ if( aFPos.nTabCnt )
+ sInsert.Fill( aFPos.nTabCnt, '\t' );
+ if( aFPos.nSpaceCnt )
+ {
+ String sSpace;
+ sSpace.Fill( aFPos.nSpaceCnt );
+ sInsert += sSpace;
+ }
+ if( sInsert.Len() )
+ {
+ GetDoc()->InsertString( *pCurCrsr, sInsert );
+ }
+ }
+ // kein break - Ausrichtung muss noch gesetzt werden
+ case FILL_MARGIN:
+ if( text::HoriOrientation::NONE != aFPos.eOrient )
+ {
+ SvxAdjustItem aAdj( SVX_ADJUST_LEFT, RES_PARATR_ADJUST );
+ switch( aFPos.eOrient )
+ {
+ case text::HoriOrientation::CENTER:
+ aAdj.SetAdjust( SVX_ADJUST_CENTER );
+ break;
+ case text::HoriOrientation::RIGHT:
+ aAdj.SetAdjust( SVX_ADJUST_RIGHT );
+ break;
+ default:
+ break;
+ }
+ GetDoc()->InsertPoolItem( *pCurCrsr, aAdj, 0 );
+ }
+ break;
+ }
+
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( nUndoId, NULL );
+ EndAction();
+
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+const SwRedline* SwCrsrShell::SelNextRedline()
+{
+ const SwRedline* pFnd = 0;
+ if( !IsTableMode() )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ pFnd = GetDoc()->SelNextRedline( *pCurCrsr );
+ if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ else
+ pFnd = 0;
+ }
+ return pFnd;
+}
+
+const SwRedline* SwCrsrShell::SelPrevRedline()
+{
+ const SwRedline* pFnd = 0;
+ if( !IsTableMode() )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ pFnd = GetDoc()->SelPrevRedline( *pCurCrsr );
+ if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ else
+ pFnd = 0;
+ }
+ return pFnd;
+}
+
+const SwRedline* SwCrsrShell::_GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect )
+{
+ const SwRedline* pFnd = 0;
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ pFnd = GetDoc()->GetRedlineTbl()[ nArrPos ];
+ if( pFnd )
+ {
+ *pCurCrsr->GetPoint() = *pFnd->Start();
+
+ SwCntntNode* pCNd;
+ SwNodeIndex* pIdx = &pCurCrsr->GetPoint()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = GetDoc()->GetNodes().GoNextSection( pIdx,
+ sal_True, IsReadOnlyAvailable() )) )
+ {
+ if( *pIdx <= pFnd->End()->nNode )
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
+ else
+ pFnd = 0;
+ }
+
+ if( pFnd && bSelect )
+ {
+ pCurCrsr->SetMark();
+ if( nsRedlineType_t::REDLINE_FMTCOLL == pFnd->GetType() )
+ {
+ pCNd = pIdx->GetNode().GetCntntNode();
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ pCurCrsr->GetMark()->nContent.Assign( pCNd, 0 );
+ }
+ else
+ *pCurCrsr->GetPoint() = *pFnd->End();
+
+ pIdx = &pCurCrsr->GetPoint()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = GetDoc()->GetNodes().GoPrevSection( pIdx,
+ sal_True, IsReadOnlyAvailable() )) )
+ {
+ if( *pIdx >= pCurCrsr->GetMark()->nNode )
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ else
+ pFnd = 0;
+ }
+ }
+
+ if( !pFnd )
+ {
+ pCurCrsr->DeleteMark();
+ pCurCrsr->RestoreSavePos();
+ }
+ else if( bSelect && *pCurCrsr->GetMark() == *pCurCrsr->GetPoint() )
+ pCurCrsr->DeleteMark();
+
+ if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE
+ | SwCrsrShell::READONLY );
+ else
+ {
+ pFnd = 0;
+ if( bSelect )
+ pCurCrsr->DeleteMark();
+ }
+ }
+ return pFnd;
+}
+
+const SwRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect )
+{
+ const SwRedline* pFnd = 0;
+ if( !IsTableMode() )
+ {
+ SET_CURR_SHELL( this );
+
+ const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
+ const SwRedline* pTmp = rTbl[ nArrPos ];
+ sal_uInt16 nSeqNo = pTmp->GetSeqNo();
+ if( nSeqNo && bSelect )
+ {
+ sal_Bool bCheck = sal_False;
+ int nLoopCnt = 2;
+ sal_uInt16 nArrSavPos = nArrPos;
+
+ do {
+ pTmp = _GotoRedline( nArrPos, sal_True );
+
+ if( !pFnd )
+ pFnd = pTmp;
+
+ if( pTmp && bCheck )
+ {
+ // checke auf Ueberlappungen. Das kann durch
+ // FmtColl-Redlines kommen, die auf den gesamten Absatz
+ // aus gedehnt werden.
+
+ SwPaM* pCur = pCurCrsr;
+ SwPaM* pNextPam = (SwPaM*)pCur->GetNext();
+ SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End();
+ while( pCur != pNextPam )
+ {
+ const SwPosition *pNStt = pNextPam->Start(),
+ *pNEnd = pNextPam->End();
+
+ sal_Bool bDel = sal_True;
+ switch( ::ComparePosition( *pCStt, *pCEnd,
+ *pNStt, *pNEnd ))
+ {
+ case POS_INSIDE: // Pos1 liegt vollstaendig in Pos2
+ if( !pCur->HasMark() )
+ {
+ pCur->SetMark();
+ *pCur->GetMark() = *pNStt;
+ }
+ else
+ *pCStt = *pNStt;
+ *pCEnd = *pNEnd;
+ break;
+
+ case POS_OUTSIDE: // Pos2 liegt vollstaendig in Pos1
+ case POS_EQUAL: // Pos1 ist genauso gross wie Pos2
+ break;
+
+ case POS_OVERLAP_BEFORE: // Pos1 ueberlappt Pos2 am Anfang
+ if( !pCur->HasMark() )
+ pCur->SetMark();
+ *pCEnd = *pNEnd;
+ break;
+ case POS_OVERLAP_BEHIND: // Pos1 ueberlappt Pos2 am Ende
+ if( !pCur->HasMark() )
+ {
+ pCur->SetMark();
+ *pCur->GetMark() = *pNStt;
+ }
+ else
+ *pCStt = *pNStt;
+ break;
+
+ default:
+ bDel = sal_False;
+ }
+
+ if( bDel )
+ {
+ // den brauchen wir nicht mehr
+ SwPaM* pPrevPam = (SwPaM*)pNextPam->GetPrev();
+ delete pNextPam;
+ pNextPam = pPrevPam;
+ }
+ pNextPam = (SwPaM*)pNextPam->GetNext();
+ }
+ }
+
+ sal_uInt16 nFndPos = 2 == nLoopCnt
+ ? rTbl.FindNextOfSeqNo( nArrPos )
+ : rTbl.FindPrevOfSeqNo( nArrPos );
+ if( USHRT_MAX != nFndPos ||
+ ( 0 != ( --nLoopCnt ) && USHRT_MAX != (
+ nFndPos = rTbl.FindPrevOfSeqNo( nArrSavPos ))) )
+ {
+ if( pTmp )
+ {
+ // neuen Cursor erzeugen
+ CreateCrsr();
+ bCheck = sal_True;
+ }
+ nArrPos = nFndPos;
+ }
+ else
+ nLoopCnt = 0;
+
+ } while( nLoopCnt );
+ }
+ else
+ pFnd = _GotoRedline( nArrPos, bSelect );
+ }
+ return pFnd;
+}
+
+
+sal_Bool SwCrsrShell::SelectNxtPrvHyperlink( sal_Bool bNext )
+{
+ SwNodes& rNds = GetDoc()->GetNodes();
+ const SwNode* pBodyEndNd = &rNds.GetEndOfContent();
+ const SwNode* pBodySttNd = pBodyEndNd->StartOfSectionNode();
+ sal_uLong nBodySttNdIdx = pBodySttNd->GetIndex();
+ Point aPt;
+
+ _SetGetExpFld aCmpPos( SwPosition( bNext ? *pBodyEndNd : *pBodySttNd ) );
+ _SetGetExpFld aCurPos( bNext ? *pCurCrsr->End() : *pCurCrsr->Start() );
+ if( aCurPos.GetNode() < nBodySttNdIdx )
+ {
+ const SwCntntNode* pCNd = aCurPos.GetNodeFromCntnt()->GetCntntNode();
+ SwCntntFrm* pFrm;
+ if( pCNd && 0 != ( pFrm = pCNd->getLayoutFrm( GetLayout(), &aPt )) )
+ aCurPos.SetBodyPos( *pFrm );
+ }
+
+ // check first all the hyperlink fields
+ {
+ const SwTxtNode* pTxtNd;
+ const SwCharFmts* pFmts = GetDoc()->GetCharFmts();
+ for( sal_uInt16 n = pFmts->Count(); 1 < n; )
+ {
+ SwIterator<SwTxtINetFmt,SwCharFmt> aIter(*(*pFmts)[--n]);
+
+ for( SwTxtINetFmt* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
+ if( 0 != ( pTxtNd = pFnd->GetpTxtNode()) &&
+ pTxtNd->GetNodes().IsDocNodes() )
+ {
+ SwTxtINetFmt& rAttr = *pFnd;
+ SwPosition aTmpPos( *pTxtNd );
+ _SetGetExpFld aPos( aTmpPos.nNode, rAttr );
+ SwCntntFrm* pFrm;
+ if( pTxtNd->GetIndex() < nBodySttNdIdx &&
+ 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt )) )
+ aPos.SetBodyPos( *pFrm );
+
+ if( bNext
+ ? ( aPos < aCmpPos && aCurPos < aPos )
+ : ( aCmpPos < aPos && aPos < aCurPos ))
+ {
+ String sTxt( pTxtNd->GetExpandTxt( *rAttr.GetStart(),
+ *rAttr.GetEnd() - *rAttr.GetStart() ) );
+
+ sTxt.EraseAllChars( 0x0a );
+ sTxt.EraseLeadingChars().EraseTrailingChars();
+
+ if( sTxt.Len() )
+ aCmpPos = aPos;
+ }
+ }
+ }
+ }
+ // then check all the Flys with a URL or imapge map
+ {
+ const SwSpzFrmFmts* pFmts = GetDoc()->GetSpzFrmFmts();
+ for( sal_uInt16 n = 0, nEnd = pFmts->Count(); n < nEnd; ++n )
+ {
+ SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)(*pFmts)[ n ];
+ const SwFmtURL& rURLItem = pFmt->GetURL();
+ if( rURLItem.GetMap() || rURLItem.GetURL().Len() )
+ {
+ SwFlyFrm* pFly = pFmt->GetFrm( &aPt, sal_False );
+ SwPosition aTmpPos( *pBodySttNd );
+ if( pFly &&
+ GetBodyTxtNode( *GetDoc(), aTmpPos, *pFly->GetLower() ) )
+ {
+ _SetGetExpFld aPos( *pFmt, &aTmpPos );
+
+ if( bNext
+ ? ( aPos < aCmpPos && aCurPos < aPos )
+ : ( aCmpPos < aPos && aPos < aCurPos ))
+ aCmpPos = aPos;
+ }
+ }
+ }
+ }
+
+ // found any URL ?
+ sal_Bool bRet = sal_False;
+ const SwTxtINetFmt* pFndAttr = aCmpPos.GetINetFmt();
+ const SwFlyFrmFmt* pFndFmt = aCmpPos.GetFlyFmt();
+ if( pFndAttr || pFndFmt )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this );
+
+ // find a text attribute ?
+ if( pFndAttr )
+ {
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ aCmpPos.GetPosOfContent( *pCurCrsr->GetPoint() );
+ pCurCrsr->DeleteMark();
+ pCurCrsr->SetMark();
+ pCurCrsr->GetPoint()->nContent = *pFndAttr->SwTxtAttr::GetEnd();
+
+ if( !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
+ {
+ UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|
+ SwCrsrShell::READONLY );
+ bRet = sal_True;
+ }
+ }
+ // find a draw object ?
+ else if( RES_DRAWFRMFMT == pFndFmt->Which() )
+ {
+ const SdrObject* pSObj = pFndFmt->FindSdrObject();
+ ((SwFEShell*)this)->SelectObj( pSObj->GetCurrentBoundRect().Center() );
+ MakeSelVisible();
+ bRet = sal_True;
+ }
+ else // then is it a fly
+ {
+ SwFlyFrm* pFly = pFndFmt->GetFrm(&aPt, sal_False );
+ if( pFly )
+ {
+ ((SwFEShell*)this)->SelectFlyFrm( *pFly, sal_True );
+ MakeSelVisible();
+ bRet = sal_True;
+ }
+ }
+ }
+ return bRet;
+}
+
diff --git a/sw/source/core/crsr/crstrvl1.cxx b/sw/source/core/crsr/crstrvl1.cxx
new file mode 100644
index 000000000000..3bdd40e7efd0
--- /dev/null
+++ b/sw/source/core/crsr/crstrvl1.cxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <crsrsh.hxx>
+#include <viscrs.hxx>
+#include <callnk.hxx>
+
+sal_Bool SwCrsrShell::IsStartWord( sal_Int16 nWordType ) const
+{
+ return pCurCrsr->IsStartWord( nWordType );
+}
+
+sal_Bool SwCrsrShell::IsEndWord( sal_Int16 nWordType ) const
+{
+ return pCurCrsr->IsEndWord( nWordType );
+}
+
+sal_Bool SwCrsrShell::IsInWord( sal_Int16 nWordType ) const
+{
+ return pCurCrsr->IsInWord( nWordType );
+}
+
+sal_Bool SwCrsrShell::IsStartSentence() const
+{
+ return pCurCrsr->IsStartEndSentence( false );
+}
+
+sal_Bool SwCrsrShell::IsEndSentence() const
+{
+ return pCurCrsr->IsStartEndSentence( true );
+}
+
+
+sal_Bool SwCrsrShell::GoStartWord()
+{
+ return CallCrsrFN( &SwCursor::GoStartWord );
+}
+sal_Bool SwCrsrShell::GoEndWord()
+{
+ return CallCrsrFN( &SwCursor::GoEndWord );
+}
+sal_Bool SwCrsrShell::GoNextWord()
+{
+ return CallCrsrFN( &SwCursor::GoNextWord );
+}
+sal_Bool SwCrsrShell::GoPrevWord()
+{
+ return CallCrsrFN( &SwCursor::GoPrevWord );
+}
+sal_Bool SwCrsrShell::GoNextSentence()
+{
+ return CallCrsrFN( &SwCursor::GoNextSentence );
+}
+sal_Bool SwCrsrShell::GoEndSentence()
+{
+ return CallCrsrFN( &SwCursor::GoEndSentence );
+}
+
+sal_Bool SwCrsrShell::GoPrevSentence()
+{
+ return CallCrsrFN( &SwCursor::GoPrevSentence );
+}
+sal_Bool SwCrsrShell::GoStartSentence()
+{
+ return CallCrsrFN( &SwCursor::GoStartSentence );
+}
+
+sal_Bool SwCrsrShell::SelectWord( const Point* pPt )
+{
+ return pCurCrsr->SelectWord( this, pPt );
+}
+
+sal_Bool SwCrsrShell::ExpandToSentenceBorders()
+{
+ return pCurCrsr->ExpandToSentenceBorders();
+}
+
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
new file mode 100644
index 000000000000..b505134e4395
--- /dev/null
+++ b/sw/source/core/crsr/findattr.cxx
@@ -0,0 +1,1314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <i18npool/mslangid.hxx>
+#include <hintids.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/whiter.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/fontitem.hxx>
+#include <fmtpdsc.hxx>
+#include <txatbase.hxx>
+#include <fchrfmt.hxx>
+#include <charfmt.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <swcrsr.hxx>
+#include <editsh.hxx>
+#include <ndtxt.hxx>
+#include <pamtyp.hxx>
+#include <swundo.hxx>
+#include <crsskip.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+
+SV_DECL_PTRARR_SORT( SwpFmts, SwFmt*, 0, 4 )
+SV_IMPL_PTRARR_SORT( SwpFmts, SwFmt* )
+
+ // Sonderbehandlung fuer SvxFontItem, nur den Namen vergleichen:
+int CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 )
+{
+ switch( rItem1.Which() )
+ {
+ case RES_CHRATR_FONT:
+ return ((SvxFontItem&)rItem1).GetFamilyName() ==
+ ((SvxFontItem&)rItem2).GetFamilyName();
+
+ case RES_CHRATR_COLOR:
+ return ((SvxColorItem&)rItem1).GetValue().IsRGBEqual(
+ ((SvxColorItem&)rItem2).GetValue() );
+ case RES_PAGEDESC:
+ return ((SwFmtPageDesc&)rItem1).GetNumOffset() ==
+ ((SwFmtPageDesc&)rItem2).GetNumOffset() &&
+ ((SwFmtPageDesc&)rItem1).GetPageDesc() ==
+ ((SwFmtPageDesc&)rItem2).GetPageDesc();
+ }
+ return rItem1 == rItem2;
+}
+
+
+const SwTxtAttr* GetFrwrdTxtHint( const SwpHints& rHtsArr, sal_uInt16& rPos,
+ xub_StrLen nCntntPos )
+{
+ while( rPos < rHtsArr.Count() )
+ {
+ const SwTxtAttr *pTxtHt = rHtsArr.GetStart( rPos++ );
+ // der Start vom Attribut muss innerhalb des Bereiches liegen !!
+ if( *pTxtHt->GetStart() >= nCntntPos )
+ return pTxtHt; // gueltiges TextAttribut
+ }
+ return 0; // kein gueltiges TextAttribut
+}
+
+
+const SwTxtAttr* GetBkwrdTxtHint( const SwpHints& rHtsArr, sal_uInt16& rPos,
+ xub_StrLen nCntntPos )
+{
+ while( rPos > 0 )
+ {
+ //Hack mit cast fuer das Update
+ const SwTxtAttr *pTxtHt = rHtsArr.GetStart( --rPos );
+ // der Start vom Attribut muss innerhalb des Bereiches liegen !!
+ if( *pTxtHt->GetStart() < nCntntPos )
+ return pTxtHt; // gueltiges TextAttribut
+ }
+ return 0; // kein gueltiges TextAttribut
+}
+
+
+void lcl_SetAttrPam( SwPaM & rPam, xub_StrLen nStart, const xub_StrLen* pEnde,
+ const sal_Bool bSaveMark )
+{
+ xub_StrLen nCntntPos;
+ if( bSaveMark )
+ nCntntPos = rPam.GetMark()->nContent.GetIndex();
+ else
+ nCntntPos = rPam.GetPoint()->nContent.GetIndex();
+ sal_Bool bTstEnde = rPam.GetPoint()->nNode == rPam.GetMark()->nNode;
+
+ SwCntntNode* pCNd = rPam.GetCntntNode();
+ rPam.GetPoint()->nContent.Assign( pCNd, nStart );
+ rPam.SetMark(); // Point == GetMark
+
+ // Point zeigt auf das Ende vom SuchBereich oder Ende vom Attribut
+ if( pEnde )
+ {
+ if( bTstEnde && *pEnde > nCntntPos )
+ rPam.GetPoint()->nContent = nCntntPos;
+ else
+ rPam.GetPoint()->nContent = *pEnde;
+ }
+}
+
+//------------------ Suche nach einem Text Attribut -----------------------
+
+// diese Funktion sucht in einem TextNode nach dem vorgegebenen Attribut.
+// Wird es gefunden, dann hat der SwPaM den Bereich der das Attribut
+// umspannt, unter Beachtung des Suchbereiches
+
+
+sal_Bool lcl_Search( const SwTxtNode& rTxtNd, SwPaM& rPam,
+ const SfxPoolItem& rCmpItem,
+ SwMoveFn fnMove, sal_Bool bValue )
+{
+ if ( !rTxtNd.HasHints() )
+ return sal_False;
+ const SwTxtAttr *pTxtHt = 0;
+ sal_Bool bForward = fnMove == fnMoveForward;
+ sal_uInt16 nPos = bForward ? 0 : rTxtNd.GetSwpHints().Count();
+ xub_StrLen nCntntPos = rPam.GetPoint()->nContent.GetIndex();
+
+ while( 0 != ( pTxtHt=(*fnMove->fnGetHint)(rTxtNd.GetSwpHints(),nPos,nCntntPos)))
+ if( pTxtHt->Which() == rCmpItem.Which() &&
+ ( !bValue || CmpAttr( pTxtHt->GetAttr(), rCmpItem )))
+ {
+ lcl_SetAttrPam( rPam, *pTxtHt->GetStart(), pTxtHt->GetEnd(), bForward );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+
+//------------------ Suche nach mehren Text Attributen -------------------
+
+struct _SwSrchChrAttr
+{
+ sal_uInt16 nWhich;
+ xub_StrLen nStt, nEnd;
+
+ _SwSrchChrAttr( const SfxPoolItem& rItem,
+ xub_StrLen nStart, xub_StrLen nAnyEnd )
+ : nWhich( rItem.Which() ), nStt( nStart ), nEnd( nAnyEnd )
+ {}
+};
+
+class SwAttrCheckArr
+{
+ _SwSrchChrAttr *pFndArr, *pStackArr;
+ xub_StrLen nNdStt, nNdEnd;
+ sal_uInt16 nArrStart, nArrLen;
+ sal_uInt16 nFound, nStackCnt;
+ SfxItemSet aCmpSet;
+ sal_Bool bNoColls;
+ sal_Bool bForward;
+
+public:
+ SwAttrCheckArr( const SfxItemSet& rSet, int bForward, int bNoCollections );
+ ~SwAttrCheckArr();
+
+ void SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam );
+
+ // wieviele Attribute ueberhaupt ??
+ sal_uInt16 Count() const { return aCmpSet.Count(); }
+ int Found() const { return nFound == aCmpSet.Count(); }
+ int CheckStack();
+
+ xub_StrLen Start() const;
+ xub_StrLen End() const;
+
+ xub_StrLen GetNdStt() const { return nNdStt; }
+ xub_StrLen GetNdEnd() const { return nNdEnd; }
+
+ int SetAttrFwd( const SwTxtAttr& rAttr );
+ int SetAttrBwd( const SwTxtAttr& rAttr );
+};
+
+
+
+SwAttrCheckArr::SwAttrCheckArr( const SfxItemSet& rSet, int bFwd,
+ int bNoCollections )
+ : aCmpSet( *rSet.GetPool(), RES_CHRATR_BEGIN, RES_TXTATR_END-1 )
+{
+ aCmpSet.Put( rSet, sal_False );
+ bNoColls = 0 != bNoCollections;
+
+ bForward = 0 != bFwd;
+
+ // Bestimmen den Bereich des Fnd/Stack-Arrays (Min/Max)
+ SfxItemIter aIter( aCmpSet );
+ nArrStart = aCmpSet.GetWhichByPos( aIter.GetFirstPos() );
+ nArrLen = aCmpSet.GetWhichByPos( aIter.GetLastPos() ) - nArrStart+1;
+
+ char* pFndChar = new char[ nArrLen * sizeof(_SwSrchChrAttr) ];
+ char* pStackChar = new char[ nArrLen * sizeof(_SwSrchChrAttr) ];
+
+ pFndArr = (_SwSrchChrAttr*)pFndChar;
+ pStackArr = (_SwSrchChrAttr*)pStackChar;
+}
+
+SwAttrCheckArr::~SwAttrCheckArr()
+{
+ delete[] (char*)pFndArr;
+ delete[] (char*)pStackArr;
+}
+
+void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam )
+{
+ memset( pFndArr, 0, nArrLen * sizeof(_SwSrchChrAttr) );
+ memset( pStackArr, 0, nArrLen * sizeof(_SwSrchChrAttr) );
+ nFound = 0;
+ nStackCnt = 0;
+
+ if( bForward )
+ {
+ nNdStt = rPam.GetPoint()->nContent.GetIndex();
+ nNdEnd = rPam.GetPoint()->nNode == rPam.GetMark()->nNode
+ ? rPam.GetMark()->nContent.GetIndex()
+ : rTxtNd.GetTxt().Len();
+ }
+ else
+ {
+ nNdEnd = rPam.GetPoint()->nContent.GetIndex();
+ nNdStt = rPam.GetPoint()->nNode == rPam.GetMark()->nNode
+ ? rPam.GetMark()->nContent.GetIndex()
+ : 0;
+ }
+
+ if( bNoColls && !rTxtNd.HasSwAttrSet() )
+ return ;
+
+ const SfxItemSet& rSet = rTxtNd.GetSwAttrSet();
+// if( !rSet.Count() )
+// return;
+
+ SfxItemIter aIter( aCmpSet );
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ const SfxPoolItem* pFndItem;
+ sal_uInt16 nWhich;
+
+ while( sal_True )
+ {
+ // nur testen, ob vorhanden ist ?
+ if( IsInvalidItem( pItem ) )
+ {
+ nWhich = aCmpSet.GetWhichByPos( aIter.GetCurPos() );
+ if( RES_TXTATR_END <= nWhich )
+ break; // Ende der TextAttribute
+
+ if( SFX_ITEM_SET == rSet.GetItemState( nWhich, !bNoColls, &pFndItem )
+ && !CmpAttr( *pFndItem, rSet.GetPool()->GetDefaultItem( nWhich ) ))
+ {
+ pFndArr[ nWhich - nArrStart ] =
+ _SwSrchChrAttr( *pFndItem, nNdStt, nNdEnd );
+ nFound++;
+ }
+ }
+ else
+ {
+ if( RES_TXTATR_END <= (nWhich = pItem->Which() ))
+ break; // Ende der TextAttribute
+
+//JP 27.02.95: wenn nach defaults gesucht wird, dann muss man bis zum Pool
+// runter
+// if( SFX_ITEM_SET == rSet.GetItemState( nWhich, !bNoColls, &pFndItem )
+// && *pFndItem == *pItem )
+ if( CmpAttr( rSet.Get( nWhich, !bNoColls ), *pItem ) )
+ {
+ pFndArr[ nWhich - nArrStart ] =
+ _SwSrchChrAttr( *pItem, nNdStt, nNdEnd );
+ nFound++;
+ }
+ }
+
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+}
+int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr )
+{
+ _SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() );
+ // alle die nicht im Bereich sind -> ignorieren
+ if( aTmp.nEnd <= nNdStt || aTmp.nStt >= nNdEnd )
+ return Found();
+
+ const SfxPoolItem* pItem;
+
+// --------------------------------------------------------------
+// Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht
+// --------------------------------------------------------------
+ sal_uInt16 nWhch = rAttr.Which();
+ SfxWhichIter* pIter = NULL;
+ const SfxPoolItem* pTmpItem = NULL;
+ const SfxItemSet* pSet = NULL;
+ if( RES_TXTATR_CHARFMT == nWhch || RES_TXTATR_AUTOFMT == nWhch )
+ {
+ if( bNoColls && RES_TXTATR_CHARFMT == nWhch )
+ return Found();
+ pTmpItem = NULL;
+ pSet = CharFmt::GetItemSet( rAttr.GetAttr() );
+ if ( pSet )
+ {
+ pIter = new SfxWhichIter( *pSet );
+ nWhch = pIter->FirstWhich();
+ while( nWhch &&
+ SFX_ITEM_SET != pSet->GetItemState( nWhch, sal_True, &pTmpItem ) )
+ nWhch = pIter->NextWhich();
+ if( !nWhch )
+ pTmpItem = NULL;
+ }
+ }
+ else
+ pTmpItem = &rAttr.GetAttr();
+ while( pTmpItem )
+ {
+ SfxItemState eState = aCmpSet.GetItemState( nWhch, sal_False, &pItem );
+ if( SFX_ITEM_DONTCARE == eState || SFX_ITEM_SET == eState )
+ {
+ sal_uInt16 n;
+ _SwSrchChrAttr* pCmp;
+
+ // loesche erstmal alle, die bis zu der Start Position schon wieder
+ // ungueltig sind:
+
+ _SwSrchChrAttr* pArrPtr;
+ if( nFound )
+ for( pArrPtr = pFndArr, n = 0; n < nArrLen;
+ ++n, ++pArrPtr )
+ if( pArrPtr->nWhich && pArrPtr->nEnd <= aTmp.nStt )
+ {
+ pArrPtr->nWhich = 0; // geloescht
+ nFound--;
+ }
+
+ // loesche erstmal alle, die bis zu der Start Position schon wieder
+ // ungueltig sind. Und verschiebe alle die "offen" sind, heisst ueber
+ // die Start Position ragen, vom Stack in den FndSet
+
+ if( nStackCnt )
+ for( pArrPtr = pStackArr, n=0; n < nArrLen; ++n, ++pArrPtr )
+ {
+ if( !pArrPtr->nWhich )
+ continue;
+
+ if( pArrPtr->nEnd <= aTmp.nStt )
+ {
+ pArrPtr->nWhich = 0; // geloescht
+ if( !--nStackCnt )
+ break;
+ }
+ else if( pArrPtr->nStt <= aTmp.nStt )
+ {
+ if( ( pCmp = &pFndArr[ n ])->nWhich )
+ {
+ if( pCmp->nEnd < pArrPtr->nEnd ) // erweitern
+ pCmp->nEnd = pArrPtr->nEnd;
+ }
+ else
+ {
+ *pCmp = *pArrPtr;
+ nFound++;
+ }
+ pArrPtr->nWhich = 0;
+ if( !--nStackCnt )
+ break;
+ }
+ }
+
+ sal_Bool bContinue = sal_False;
+
+ if( SFX_ITEM_DONTCARE == eState )
+ {
+ // wird Attribut gueltig ?
+ if( !CmpAttr( aCmpSet.GetPool()->GetDefaultItem( nWhch ),
+ *pTmpItem ))
+ {
+ // suche das Attribut und erweiter es gegebenenfalls
+ if( !( pCmp = &pFndArr[ nWhch - nArrStart ])->nWhich )
+ {
+ *pCmp = aTmp; // nicht gefunden, eintragen
+ nFound++;
+ }
+ else if( pCmp->nEnd < aTmp.nEnd ) // erweitern ?
+ pCmp->nEnd = aTmp.nEnd;
+
+ bContinue = sal_True;
+ }
+ }
+ // wird Attribut gueltig ?
+ else if( CmpAttr( *pItem, *pTmpItem ) )
+ {
+ pFndArr[ nWhch - nArrStart ] = aTmp;
+ ++nFound;
+ bContinue = sal_True;
+ }
+
+ // tja, dann muss es auf den Stack
+ if( !bContinue && ( pCmp = &pFndArr[ nWhch - nArrStart ])->nWhich )
+ {
+ // vorhanden, auf den Stack. Aber nur wenn es noch grosser ist
+ if( pCmp->nEnd > aTmp.nEnd )
+ {
+ ASSERT( !pStackArr[ nWhch - nArrStart ].nWhich,
+ "Stack-Platz ist noch belegt" );
+
+ // ---------
+ // JP 22.08.96: nur Ende manipulieren reicht nicht. Bug 30547
+ // pCmp->nStt = aTmp.nEnd;
+ if( aTmp.nStt <= pCmp->nStt )
+ pCmp->nStt = aTmp.nEnd;
+ else
+ pCmp->nEnd = aTmp.nStt;
+ // ---------
+
+ pStackArr[ nWhch - nArrStart ] = *pCmp;
+ nStackCnt++;
+ }
+ pCmp->nWhich = 0;
+ nFound--;
+ }
+ }
+ if( pIter )
+ {
+ nWhch = pIter->NextWhich();
+ while( nWhch &&
+ SFX_ITEM_SET != pSet->GetItemState( nWhch, sal_True, &pTmpItem ) )
+ nWhch = pIter->NextWhich();
+ if( !nWhch )
+ break;
+ }
+ else
+ break;
+ }
+ return Found();
+}
+
+
+int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr )
+{
+ _SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() );
+ // alle die nicht im Bereich sind -> ignorieren
+ if( aTmp.nEnd < nNdStt || aTmp.nStt >= nNdEnd )
+ return Found();
+
+ const SfxPoolItem* pItem;
+// --------------------------------------------------------------
+// Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht
+// --------------------------------------------------------------
+ sal_uInt16 nWhch = rAttr.Which();
+ SfxWhichIter* pIter = NULL;
+ const SfxPoolItem* pTmpItem = NULL;
+ const SfxItemSet* pSet = NULL;
+ if( RES_TXTATR_CHARFMT == nWhch || RES_TXTATR_AUTOFMT == nWhch )
+ {
+ if( bNoColls && RES_TXTATR_CHARFMT == nWhch )
+ return Found();
+
+ pSet = CharFmt::GetItemSet( rAttr.GetAttr() );
+ if ( pSet )
+ {
+ pIter = new SfxWhichIter( *pSet );
+ nWhch = pIter->FirstWhich();
+ while( nWhch &&
+ SFX_ITEM_SET != pSet->GetItemState( nWhch, sal_True, &pTmpItem ) )
+ nWhch = pIter->NextWhich();
+ if( !nWhch )
+ pTmpItem = NULL;
+ }
+ }
+ else
+ pTmpItem = &rAttr.GetAttr();
+ while( pTmpItem )
+ {
+ SfxItemState eState = aCmpSet.GetItemState( nWhch, sal_False, &pItem );
+ if( SFX_ITEM_DONTCARE == eState || SFX_ITEM_SET == eState )
+ {
+ sal_uInt16 n;
+ _SwSrchChrAttr* pCmp;
+
+ // loesche erstmal alle, die bis zu der Start Position schon wieder
+ // ungueltig sind:
+
+ _SwSrchChrAttr* pArrPtr;
+ if( nFound )
+ for( pArrPtr = pFndArr, n = 0; n < nArrLen; ++n, ++pArrPtr )
+ if( pArrPtr->nWhich && pArrPtr->nStt >= aTmp.nEnd )
+ {
+ pArrPtr->nWhich = 0; // geloescht
+ nFound--;
+ }
+
+ // loesche erstmal alle, die bis zu der Start Position schon wieder
+ // ungueltig sind. Und verschiebe alle die "offen" sind, heisst ueber
+ // die Start Position ragen, vom Stack in den FndSet
+
+ if( nStackCnt )
+ for( pArrPtr = pStackArr, n = 0; n < nArrLen; ++n, ++pArrPtr )
+ {
+ if( !pArrPtr->nWhich )
+ continue;
+
+ if( pArrPtr->nStt >= aTmp.nEnd )
+ {
+ pArrPtr->nWhich = 0; // geloescht
+ if( !--nStackCnt )
+ break;
+ }
+ else if( pArrPtr->nEnd >= aTmp.nEnd )
+ {
+ if( ( pCmp = &pFndArr[ n ])->nWhich )
+ {
+ if( pCmp->nStt > pArrPtr->nStt ) // erweitern
+ pCmp->nStt = pArrPtr->nStt;
+ }
+ else
+ {
+ *pCmp = *pArrPtr;
+ nFound++;
+ }
+ pArrPtr->nWhich = 0;
+ if( !--nStackCnt )
+ break;
+ }
+ }
+
+ sal_Bool bContinue = sal_False;
+ if( SFX_ITEM_DONTCARE == eState )
+ {
+ // wird Attribut gueltig ?
+ if( !CmpAttr( aCmpSet.GetPool()->GetDefaultItem( nWhch ),
+ *pTmpItem ) )
+ {
+ // suche das Attribut und erweiter es gegebenenfalls
+ if( !( pCmp = &pFndArr[ nWhch - nArrStart ])->nWhich )
+ {
+ *pCmp = aTmp; // nicht gefunden, eintragen
+ nFound++;
+ }
+ else if( pCmp->nStt > aTmp.nStt ) // erweitern ?
+ pCmp->nStt = aTmp.nStt;
+
+ bContinue = sal_True;
+ }
+ }
+ // wird Attribut gueltig ?
+ else if( CmpAttr( *pItem, *pTmpItem ))
+ {
+ pFndArr[ nWhch - nArrStart ] = aTmp;
+ ++nFound;
+ bContinue = sal_True;
+ }
+
+ // tja, dann muss es auf den Stack
+ if( !bContinue && ( pCmp = &pFndArr[ nWhch - nArrStart ])->nWhich )
+ {
+ // vorhanden, auf den Stack. Aber nur wenn es noch grosser ist
+ if( pCmp->nStt < aTmp.nStt )
+ {
+ ASSERT( !pStackArr[ nWhch - nArrStart ].nWhich,
+ "Stack-Platz ist noch belegt" );
+
+// ---------
+// JP 22.08.96: nur Ende manipulieren reicht nicht. Bug 30547
+// pCmp->nEnd = aTmp.nStt;
+ if( aTmp.nEnd <= pCmp->nEnd )
+ pCmp->nEnd = aTmp.nStt;
+ else
+ pCmp->nStt = aTmp.nEnd;
+// ---------
+
+ pStackArr[ nWhch - nArrStart ] = *pCmp;
+ nStackCnt++;
+ }
+ pCmp->nWhich = 0;
+ nFound--;
+ }
+ }
+ if( pIter )
+ {
+ nWhch = pIter->NextWhich();
+ while( nWhch &&
+ SFX_ITEM_SET != pSet->GetItemState( nWhch, sal_True, &pTmpItem ) )
+ nWhch = pIter->NextWhich();
+ if( !nWhch )
+ break;
+ }
+ else
+ break;
+ }
+ return Found();
+}
+
+
+xub_StrLen SwAttrCheckArr::Start() const
+{
+ xub_StrLen nStart = nNdStt;
+ _SwSrchChrAttr* pArrPtr = pFndArr;
+ for( sal_uInt16 n = 0; n < nArrLen; ++n, ++pArrPtr )
+ if( pArrPtr->nWhich && pArrPtr->nStt > nStart )
+ nStart = pArrPtr->nStt;
+
+ return nStart;
+}
+
+
+xub_StrLen SwAttrCheckArr::End() const
+{
+ _SwSrchChrAttr* pArrPtr = pFndArr;
+ xub_StrLen nEnd = nNdEnd;
+ for( sal_uInt16 n = 0; n < nArrLen; ++n, ++pArrPtr )
+ if( pArrPtr->nWhich && pArrPtr->nEnd < nEnd )
+ nEnd = pArrPtr->nEnd;
+
+ return nEnd;
+}
+
+
+int SwAttrCheckArr::CheckStack()
+{
+ if( !nStackCnt )
+ return sal_False;
+
+ sal_uInt16 n;
+ xub_StrLen nSttPos = Start(), nEndPos = End();
+ _SwSrchChrAttr* pArrPtr;
+ for( pArrPtr = pStackArr, n = 0; n < nArrLen; ++n, ++pArrPtr )
+ {
+ if( !pArrPtr->nWhich )
+ continue;
+
+ if( bForward ? pArrPtr->nEnd <= nSttPos : pArrPtr->nStt >= nEndPos )
+ {
+ pArrPtr->nWhich = 0; // geloescht
+ if( !--nStackCnt )
+ return nFound == aCmpSet.Count();
+ }
+ else if( bForward ? pArrPtr->nStt < nEndPos : pArrPtr->nEnd > nSttPos )
+ {
+ // alle die "offen" sind, heisst ueber die Start Position ragen,
+ // im FndSet setzen
+ ASSERT( !pFndArr[ n ].nWhich, "Array-Platz ist noch belegt" );
+ pFndArr[ n ] = *pArrPtr;
+ pArrPtr->nWhich = 0;
+ nFound++;
+ if( !--nStackCnt )
+ return nFound == aCmpSet.Count();
+ }
+ }
+ return nFound == aCmpSet.Count();
+}
+
+
+
+int lcl_SearchForward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr,
+ SwPaM& rPam )
+{
+ xub_StrLen nEndPos, nSttPos;
+ rCmpArr.SetNewSet( rTxtNd, rPam );
+ if( !rTxtNd.HasHints() )
+ {
+ if( !rCmpArr.Found() )
+ return sal_False;
+ nEndPos = rCmpArr.GetNdEnd();
+ lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, sal_True );
+ return sal_True;
+ }
+
+ // dann gehe mal durch das nach "Start" sortierte Array
+ const SwpHints& rHtArr = rTxtNd.GetSwpHints();
+ const SwTxtAttr* pAttr;
+ sal_uInt16 nPos = 0;
+
+ // sollte jetzt schon alles vorhanden sein, dann teste, mit welchem
+ // das wieder beendet wird.
+ if( rCmpArr.Found() )
+ {
+ for( ; nPos < rHtArr.Count(); ++nPos )
+ if( !rCmpArr.SetAttrFwd( *( pAttr = rHtArr.GetStart( nPos )) ) )
+ {
+ if( rCmpArr.GetNdStt() < *pAttr->GetStart() )
+ {
+ // dann haben wir unser Ende:
+ lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(),
+ pAttr->GetStart(), sal_True );
+ return sal_True;
+ }
+ // ansonsten muessen wir weiter suchen
+ break;
+ }
+
+ if( nPos == rHtArr.Count() && rCmpArr.Found() )
+ {
+ // dann haben wir unseren Bereich
+ nEndPos = rCmpArr.GetNdEnd();
+ lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, sal_True );
+ return sal_True;
+ }
+ }
+
+ for( ; nPos < rHtArr.Count(); ++nPos )
+ if( rCmpArr.SetAttrFwd( *( pAttr = rHtArr.GetStart( nPos )) ) )
+ {
+ // sollten noch mehr auf der gleichen Position anfangen ??
+ // auch die noch mit testen !!
+ nSttPos = *pAttr->GetStart();
+ while( ++nPos < rHtArr.Count() && nSttPos ==
+ *( pAttr = rHtArr.GetStart( nPos ))->GetStart() &&
+ rCmpArr.SetAttrFwd( *pAttr ) )
+ ;
+ if( !rCmpArr.Found() )
+ continue;
+
+ // dann haben wir den Bereich zusammen
+ if( (nSttPos = rCmpArr.Start()) > (nEndPos = rCmpArr.End()) )
+ return sal_False;
+ lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_True );
+ return sal_True;
+ }
+
+ if( !rCmpArr.CheckStack() ||
+ (nSttPos = rCmpArr.Start()) > (nEndPos = rCmpArr.End()) )
+ return sal_False;
+ lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_True );
+ return sal_True;
+}
+
+
+int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr,
+ SwPaM& rPam )
+{
+ xub_StrLen nEndPos, nSttPos;
+ rCmpArr.SetNewSet( rTxtNd, rPam );
+ if( !rTxtNd.HasHints() )
+ {
+ if( !rCmpArr.Found() )
+ return sal_False;
+ nEndPos = rCmpArr.GetNdEnd();
+ lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, sal_False );
+ return sal_True;
+ }
+
+ // dann gehe mal durch das nach "Start" sortierte Array
+ const SwpHints& rHtArr = rTxtNd.GetSwpHints();
+ const SwTxtAttr* pAttr;
+ sal_uInt16 nPos = rHtArr.Count();
+
+ // sollte jetzt schon alles vorhanden sein, dann teste, mit welchem
+ // das wieder beendet wird.
+ if( rCmpArr.Found() )
+ {
+ while( nPos )
+ if( !rCmpArr.SetAttrBwd( *( pAttr = rHtArr.GetEnd( --nPos )) ) )
+ {
+ nSttPos = *pAttr->GetAnyEnd();
+ if( nSttPos < rCmpArr.GetNdEnd() )
+ {
+ // dann haben wir unser Ende:
+ nEndPos = rCmpArr.GetNdEnd();
+ lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_False );
+ return sal_True;
+ }
+
+ // ansonsten muessen wir weiter suchen
+ break;
+ }
+
+ if( !nPos && rCmpArr.Found() )
+ {
+ // dann haben wir unseren Bereich
+ nEndPos = rCmpArr.GetNdEnd();
+ lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, sal_False );
+ return sal_True;
+ }
+ }
+
+ while( nPos )
+ if( rCmpArr.SetAttrBwd( *( pAttr = rHtArr.GetEnd( --nPos )) ) )
+ {
+ // sollten noch mehr auf der gleichen Position anfangen ??
+ // auch die noch mit testen !!
+ if( nPos )
+ {
+ nEndPos = *pAttr->GetAnyEnd();
+ while( --nPos && nEndPos ==
+ *( pAttr = rHtArr.GetEnd( nPos ))->GetAnyEnd() &&
+ rCmpArr.SetAttrBwd( *pAttr ) )
+ ;
+ }
+ if( !rCmpArr.Found() )
+ continue;
+
+
+ // dann haben wir den Bereich zusammen
+ if( (nSttPos = rCmpArr.Start()) > (nEndPos = rCmpArr.End()) )
+ return sal_False;
+ lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_False );
+ return sal_True;
+ }
+
+ if( !rCmpArr.CheckStack() ||
+ (nSttPos = rCmpArr.Start()) > (nEndPos = rCmpArr.End()) )
+ return sal_False;
+ lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_False );
+ return sal_True;
+}
+
+
+int lcl_Search( const SwCntntNode& rCNd, const SfxItemSet& rCmpSet, sal_Bool bNoColls )
+{
+ // nur die harte Attributierung suchen ?
+ if( bNoColls && !rCNd.HasSwAttrSet() )
+ return sal_False;
+
+ const SfxItemSet& rNdSet = rCNd.GetSwAttrSet();
+ SfxItemIter aIter( rCmpSet );
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ const SfxPoolItem* pNdItem;
+ sal_uInt16 nWhich;
+
+ while( sal_True )
+ {
+ // nur testen, ob vorhanden ist ?
+ if( IsInvalidItem( pItem ))
+ {
+ nWhich = rCmpSet.GetWhichByPos( aIter.GetCurPos() );
+ if( SFX_ITEM_SET != rNdSet.GetItemState( nWhich, !bNoColls, &pNdItem )
+ || CmpAttr( *pNdItem, rNdSet.GetPool()->GetDefaultItem( nWhich ) ))
+ return sal_False;
+ }
+ else
+ {
+ nWhich = pItem->Which();
+//JP 27.02.95: wenn nach defaults gesucht wird, dann muss man bis zum Pool
+// runter
+// if( SFX_ITEM_SET != rNdSet.GetItemState( nWhich, !bNoColls, &pNdItem )
+// || *pNdItem != *pItem )
+ if( !CmpAttr( rNdSet.Get( nWhich, !bNoColls ), *pItem ))
+ return sal_False;
+ }
+
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+ return sal_True; // wurde gefunden
+}
+
+
+sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove,
+ const SwPaM *pRegion, sal_Bool bInReadOnly )
+{
+ // stelle fest welches Attribut gesucht wird:
+ sal_uInt16 nWhich = rAttr.Which();
+ int bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich);
+
+ SwPaM* pPam = MakeRegion( fnMove, pRegion );
+
+ sal_Bool bFound = sal_False;
+ sal_Bool bFirst = sal_True;
+ sal_Bool bSrchForward = fnMove == fnMoveForward;
+ SwCntntNode * pNode;
+ const SfxPoolItem* pItem;
+ SwpFmts aFmtArr;
+
+ // Wenn am Anfang/Ende, aus dem Node moven
+ if( bSrchForward
+ ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetCntntNode()->Len()
+ : !pPam->GetPoint()->nContent.GetIndex() )
+ {
+ if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, sal_False ))
+ {
+ delete pPam;
+ return sal_False;
+ }
+ SwCntntNode *pNd = pPam->GetCntntNode();
+ xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len();
+ pPam->GetPoint()->nContent.Assign( pNd, nTmpPos );
+ }
+
+ while( 0 != ( pNode = ::GetNode( *pPam, bFirst, fnMove, bInReadOnly ) ) )
+ {
+ if( bCharAttr )
+ {
+ if( !pNode->IsTxtNode() ) // CharAttr sind nur in TextNodes
+ continue;
+
+ if( ((SwTxtNode*)pNode)->HasHints() &&
+ lcl_Search( *(SwTxtNode*)pNode, *pPam, rAttr, fnMove, bValue ))
+ {
+ // setze auf die Werte vom Attribut
+ SetMark();
+ *GetPoint() = *pPam->GetPoint();
+ *GetMark() = *pPam->GetMark();
+ bFound = sal_True;
+ break;
+ }
+ else if (isTXTATR(nWhich))
+ continue; // --> also weiter
+ }
+
+ // keine harte Attributierung, dann pruefe, ob die Vorlage schon
+ // mal nach dem Attribut befragt wurde
+ if( !pNode->HasSwAttrSet() )
+ {
+ const SwFmt* pTmpFmt = pNode->GetFmtColl();
+ if( aFmtArr.Count() && aFmtArr.Seek_Entry( pTmpFmt ))
+ continue; // die Collection wurde schon mal befragt
+ aFmtArr.Insert( pTmpFmt );
+ }
+
+ if( SFX_ITEM_SET == pNode->GetSwAttrSet().GetItemState( nWhich,
+ sal_True, &pItem ) && ( !bValue || *pItem == rAttr ) )
+ {
+ // FORWARD: Point an das Ende, GetMark zum Anfanf vom Node
+ // BACKWARD: Point zum Anfang, GetMark an das Ende vom Node
+ // und immer nach der Logik: inkl. Start, exkl. End !!!
+ *GetPoint() = *pPam->GetPoint();
+ SetMark();
+ pNode->MakeEndIndex( &GetPoint()->nContent );
+ bFound = sal_True;
+ break;
+ }
+ }
+
+ // beim rueckwaerts Suchen noch Point und Mark vertauschen
+ if( bFound && !bSrchForward )
+ Exchange();
+
+ delete pPam;
+ return bFound;
+}
+
+
+typedef int (*FnSearchAttr)( const SwTxtNode&, SwAttrCheckArr&, SwPaM& );
+
+sal_Bool SwPaM::Find( const SfxItemSet& rSet, sal_Bool bNoColls, SwMoveFn fnMove,
+ const SwPaM *pRegion, sal_Bool bInReadOnly, sal_Bool bMoveFirst )
+{
+ SwPaM* pPam = MakeRegion( fnMove, pRegion );
+
+ sal_Bool bFound = sal_False;
+ sal_Bool bFirst = sal_True;
+ sal_Bool bSrchForward = fnMove == fnMoveForward;
+ SwCntntNode * pNode;
+ SwpFmts aFmtArr;
+
+ // teste doch mal welche Text/Char-Attribute gesucht werden
+ SwAttrCheckArr aCmpArr( rSet, bSrchForward, bNoColls );
+ SfxItemSet aOtherSet( GetDoc()->GetAttrPool(),
+ RES_PARATR_BEGIN, RES_GRFATR_END-1 );
+ aOtherSet.Put( rSet, sal_False ); // alle Invalid-Items erhalten!
+
+ FnSearchAttr fnSearch = bSrchForward
+ ? (&::lcl_SearchForward)
+ : (&::lcl_SearchBackward);
+
+ // Wenn am Anfang/Ende, aus dem Node moven
+ // Wenn am Anfang/Ende, aus dem Node moven
+ if( bMoveFirst &&
+ ( bSrchForward
+ ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetCntntNode()->Len()
+ : !pPam->GetPoint()->nContent.GetIndex() ) )
+ {
+ if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, sal_False ))
+ {
+ delete pPam;
+ return sal_False;
+ }
+ SwCntntNode *pNd = pPam->GetCntntNode();
+ xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len();
+ pPam->GetPoint()->nContent.Assign( pNd, nTmpPos );
+ }
+
+
+ while( 0 != ( pNode = ::GetNode( *pPam, bFirst, fnMove, bInReadOnly ) ) )
+ {
+ if( aCmpArr.Count() )
+ {
+ if( !pNode->IsTxtNode() ) // CharAttr sind nur in TextNodes
+ continue;
+
+ if( (!aOtherSet.Count() ||
+ lcl_Search( *pNode, aOtherSet, bNoColls )) &&
+ (*fnSearch)( *(SwTxtNode*)pNode, aCmpArr, *pPam ))
+ {
+ // setze auf die Werte vom Attribut
+ SetMark();
+ *GetPoint() = *pPam->GetPoint();
+ *GetMark() = *pPam->GetMark();
+ bFound = sal_True;
+ break;
+ }
+ continue; // TextAttribute
+ }
+
+ if( !aOtherSet.Count() )
+ continue;
+
+ // keine harte Attributierung, dann pruefe, ob die Vorlage schon
+ // mal nach dem Attribut befragt wurde
+ if( !pNode->HasSwAttrSet() )
+ {
+ const SwFmt* pTmpFmt = pNode->GetFmtColl();
+ if( aFmtArr.Count() && aFmtArr.Seek_Entry( pTmpFmt ))
+ continue; // die Collection wurde schon mal befragt
+ aFmtArr.Insert( pTmpFmt );
+ }
+
+ if( lcl_Search( *pNode, aOtherSet, bNoColls ))
+ {
+ // FORWARD: Point an das Ende, GetMark zum Anfanf vom Node
+ // BACKWARD: Point zum Anfang, GetMark an das Ende vom Node
+ // und immer nach der Logik: inkl. Start, exkl. End !!!
+ *GetPoint() = *pPam->GetPoint();
+ SetMark();
+ pNode->MakeEndIndex( &GetPoint()->nContent );
+ bFound = sal_True;
+ break;
+ }
+ }
+
+ // beim rueckwaerts Suchen noch Point und Mark vertauschen
+ if( bFound && !bSrchForward )
+ Exchange();
+
+ delete pPam;
+ return bFound;
+}
+
+//------------------ Methoden vom SwCursor ---------------------------
+
+// Parameter fuer das Suchen vom Attributen
+struct SwFindParaAttr : public SwFindParas
+{
+ sal_Bool bValue;
+ const SfxItemSet *pSet, *pReplSet;
+ const SearchOptions *pSearchOpt;
+ SwCursor& rCursor;
+ utl::TextSearch* pSTxt;
+
+ SwFindParaAttr( const SfxItemSet& rSet, sal_Bool bNoCollection,
+ const SearchOptions* pOpt, const SfxItemSet* pRSet,
+ SwCursor& rCrsr )
+ : bValue( bNoCollection ), pSet( &rSet ), pReplSet( pRSet ),
+ pSearchOpt( pOpt ), rCursor( rCrsr ),pSTxt( 0 ) {}
+
+ virtual ~SwFindParaAttr() { delete pSTxt; }
+
+ virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, sal_Bool bInReadOnly );
+ virtual int IsReplaceMode() const;
+};
+
+
+int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
+ sal_Bool bInReadOnly )
+{
+ // String ersetzen ?? (nur wenn Text angegeben oder nicht attributiert
+ // gesucht wird)
+ sal_Bool bReplaceTxt = pSearchOpt && ( pSearchOpt->replaceString.getLength() ||
+ !pSet->Count() );
+ sal_Bool bReplaceAttr = pReplSet && pReplSet->Count();
+ sal_Bool bMoveFirst = !bReplaceAttr;
+ if( bInReadOnly && (bReplaceAttr || bReplaceTxt ))
+ bInReadOnly = sal_False;
+
+ // wir suchen nach Attributen, soll zusaetzlich Text gesucht werden ?
+ {
+ SwPaM aRegion( *pRegion->GetMark(), *pRegion->GetPoint() );
+ SwPaM* pTextRegion = &aRegion;
+ SwPaM aSrchPam( *pCrsr->GetPoint() );
+
+ while( sal_True )
+ {
+ if( pSet->Count() ) // gibts ueberhaupt Attributierung?
+ {
+ // zuerst die Attributierung
+ if( !aSrchPam.Find( *pSet, bValue, fnMove, &aRegion, bInReadOnly, bMoveFirst ) )
+//JP 17.11.95: was ist mit Attributen in leeren Absaetzen !!
+// || *pCrsr->GetMark() == *pCrsr->GetPoint() ) // kein Bereich ??
+ return FIND_NOT_FOUND;
+ bMoveFirst = sal_True;
+
+ if( !pSearchOpt )
+ break; // ok, nur Attribute, also gefunden
+
+ pTextRegion = &aSrchPam;
+ }
+ else if( !pSearchOpt )
+ return FIND_NOT_FOUND;
+
+ // dann darin den Text
+ if( !pSTxt )
+ {
+ SearchOptions aTmp( *pSearchOpt );
+
+ // search in selection
+ aTmp.searchFlag |= (SearchFlags::REG_NOT_BEGINOFLINE |
+ SearchFlags::REG_NOT_ENDOFLINE);
+
+ MsLangId::convertLanguageToLocale( LANGUAGE_SYSTEM, aTmp.Locale );
+
+ pSTxt = new utl::TextSearch( aTmp );
+ }
+
+ // todo/mba: searching for attributes in Outliner text?!
+ sal_Bool bSearchInNotes = sal_False;
+
+ // Bug 24665: suche im richtigen Bereich weiter (pTextRegion!)
+ if( aSrchPam.Find( *pSearchOpt, bSearchInNotes, *pSTxt, fnMove, pTextRegion, bInReadOnly ) &&
+ *aSrchPam.GetMark() != *aSrchPam.GetPoint() ) // gefunden ?
+ break; // also raus
+ else if( !pSet->Count() )
+ return FIND_NOT_FOUND; // nur Text und nicht gefunden
+
+/* // --> FME 2007-4-12 #i74765 # Why should we move the position?
+ Moving the position results in bugs when there are two adjacent
+ portions which both have the requested attributes set. I suspect this
+ should be only be an optimization. Therefore I boldly remove it now!
+
+ // JP: und wieder neu aufsetzen, aber eine Position weiter
+ //JP 04.11.97: Bug 44897 - aber den Mark wieder aufheben, damit
+ // weiterbewegt werden kann!
+ {
+ sal_Bool bCheckRegion = sal_True;
+ SwPosition* pPos = aSrchPam.GetPoint();
+ if( !(*fnMove->fnNd)( &pPos->nNode.GetNode(),
+ &pPos->nContent, CRSR_SKIP_CHARS ))
+ {
+ if( (*fnMove->fnNds)( &pPos->nNode, sal_False ))
+ {
+ SwCntntNode *pNd = pPos->nNode.GetNode().GetCntntNode();
+ xub_StrLen nCPos;
+ if( fnMove == fnMoveForward )
+ nCPos = 0;
+ else
+ nCPos = pNd->Len();
+ pPos->nContent.Assign( pNd, nCPos );
+ }
+ else
+ bCheckRegion = sal_False;
+ }
+ if( !bCheckRegion || *aRegion.GetPoint() <= *pPos )
+ return FIND_NOT_FOUND; // nicht gefunden
+ }*/
+ *aRegion.GetMark() = *aSrchPam.GetPoint();
+ }
+
+ *pCrsr->GetPoint() = *aSrchPam.GetPoint();
+ pCrsr->SetMark();
+ *pCrsr->GetMark() = *aSrchPam.GetMark();
+ }
+
+ if( bReplaceTxt )
+ {
+ const bool bRegExp(
+ SearchAlgorithms_REGEXP == pSearchOpt->algorithmType);
+ SwIndex& rSttCntIdx = pCrsr->Start()->nContent;
+ xub_StrLen nSttCnt = rSttCntIdx.GetIndex();
+
+ // damit die Region auch verschoben wird, in den Shell-Cursr-Ring
+ // mit aufnehmen !!
+ Ring *pPrevRing = 0;
+ if( bRegExp )
+ {
+ pPrevRing = pRegion->GetPrev();
+ ((Ring*)pRegion)->MoveRingTo( &rCursor );
+ }
+
+ ::std::auto_ptr<String> pRepl( (bRegExp) ?
+ ReplaceBackReferences( *pSearchOpt, pCrsr ) : 0 );
+ rCursor.GetDoc()->ReplaceRange( *pCrsr,
+ (pRepl.get()) ? *pRepl : String(pSearchOpt->replaceString),
+ bRegExp );
+ rCursor.SaveTblBoxCntnt( pCrsr->GetPoint() );
+
+ if( bRegExp )
+ {
+ // und die Region wieder herausnehmen:
+ Ring *p, *pNext = (Ring*)pRegion;
+ do {
+ p = pNext;
+ pNext = p->GetNext();
+ p->MoveTo( (Ring*)pRegion );
+ } while( p != pPrevRing );
+ }
+ rSttCntIdx = nSttCnt;
+ }
+
+ if( bReplaceAttr )
+ {
+ // --- Ist die Selection noch da ??????
+
+ // und noch die Attribute setzen
+#ifdef OLD
+ pCrsr->GetDoc()->Insert( *pCrsr, *pReplSet, 0 );
+#else
+ //JP 13.07.95: alle gesuchten Attribute werden, wenn nicht im
+ // ReplaceSet angegeben, auf Default zurueck gesetzt
+
+ if( !pSet->Count() )
+ {
+ pCrsr->GetDoc()->InsertItemSet( *pCrsr, *pReplSet, 0 );
+ }
+ else
+ {
+ SfxItemPool* pPool = pReplSet->GetPool();
+ SfxItemSet aSet( *pPool, pReplSet->GetRanges() );
+
+ SfxItemIter aIter( *pSet );
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ while( sal_True )
+ {
+ // alle die nicht gesetzt sind mit Pool-Defaults aufuellen
+ if( !IsInvalidItem( pItem ) && SFX_ITEM_SET !=
+ pReplSet->GetItemState( pItem->Which(), sal_False ))
+ aSet.Put( pPool->GetDefaultItem( pItem->Which() ));
+
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+ aSet.Put( *pReplSet );
+ pCrsr->GetDoc()->InsertItemSet( *pCrsr, aSet, 0 );
+ }
+#endif
+ return FIND_NO_RING;
+ }
+
+ else
+ return FIND_FOUND;
+}
+
+
+int SwFindParaAttr::IsReplaceMode() const
+{
+ return ( pSearchOpt && pSearchOpt->replaceString.getLength() ) ||
+ ( pReplSet && pReplSet->Count() );
+}
+
+// Suchen nach Attributen
+
+
+sal_uLong SwCursor::Find( const SfxItemSet& rSet, sal_Bool bNoCollections,
+ SwDocPositions nStart, SwDocPositions nEnde, sal_Bool& bCancel,
+ FindRanges eFndRngs,
+ const SearchOptions* pSearchOpt, const SfxItemSet* pReplSet )
+{
+ // OLE-Benachrichtigung abschalten !!
+ SwDoc* pDoc = GetDoc();
+ Link aLnk( pDoc->GetOle2Link() );
+ pDoc->SetOle2Link( Link() );
+
+ sal_Bool bReplace = ( pSearchOpt && ( pSearchOpt->replaceString.getLength() ||
+ !rSet.Count() ) ) ||
+ (pReplSet && pReplSet->Count());
+ bool const bStartUndo = pDoc->GetIDocumentUndoRedo().DoesUndo() && bReplace;
+ if (bStartUndo)
+ {
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_REPLACE, NULL );
+ }
+
+ SwFindParaAttr aSwFindParaAttr( rSet, bNoCollections, pSearchOpt,
+ pReplSet, *this );
+
+ sal_uLong nRet = FindAll(aSwFindParaAttr, nStart, nEnde, eFndRngs, bCancel );
+ pDoc->SetOle2Link( aLnk );
+ if( nRet && bReplace )
+ pDoc->SetModified();
+
+ if (bStartUndo)
+ {
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_REPLACE, NULL );
+ }
+
+ return nRet;
+}
+
+
+
diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx
new file mode 100644
index 000000000000..a78b92b180a1
--- /dev/null
+++ b/sw/source/core/crsr/findcoll.cxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <tools/resid.hxx>
+
+#include <swcrsr.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pamtyp.hxx>
+#include <swundo.hxx>
+#include <SwRewriter.hxx>
+#include <comcore.hrc>
+
+//------------------ Methoden der CrsrShell ---------------------------
+
+// Parameter fuer das Suchen vom FormatCollections
+struct SwFindParaFmtColl : public SwFindParas
+{
+ const SwTxtFmtColl *pFmtColl, *pReplColl;
+ SwCursor& rCursor;
+ SwFindParaFmtColl( const SwTxtFmtColl& rFmtColl,
+ const SwTxtFmtColl* pRpColl, SwCursor& rCrsr )
+ : pFmtColl( &rFmtColl ), pReplColl( pRpColl ), rCursor( rCrsr )
+ {}
+ virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, sal_Bool bInReadOnly );
+ virtual int IsReplaceMode() const;
+};
+
+
+int SwFindParaFmtColl::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
+ sal_Bool bInReadOnly )
+{
+ int nRet = FIND_FOUND;
+ if( bInReadOnly && pReplColl )
+ bInReadOnly = sal_False;
+
+ if( !pCrsr->Find( *pFmtColl, fnMove, pRegion, bInReadOnly ) )
+ nRet = FIND_NOT_FOUND;
+ else if( pReplColl )
+ {
+ pCrsr->GetDoc()->SetTxtFmtColl( *pCrsr, (SwTxtFmtColl*)pReplColl );
+ nRet = FIND_NO_RING;
+ }
+ return nRet;
+}
+
+
+int SwFindParaFmtColl::IsReplaceMode() const
+{
+ return 0 != pReplColl;
+}
+
+
+// Suchen nach Format-Collections
+
+
+sal_uLong SwCursor::Find( const SwTxtFmtColl& rFmtColl,
+ SwDocPositions nStart, SwDocPositions nEnde, sal_Bool& bCancel,
+ FindRanges eFndRngs, const SwTxtFmtColl* pReplFmtColl )
+{
+ // OLE-Benachrichtigung abschalten !!
+ SwDoc* pDoc = GetDoc();
+ Link aLnk( pDoc->GetOle2Link() );
+ pDoc->SetOle2Link( Link() );
+
+ bool const bStartUndo =
+ pDoc->GetIDocumentUndoRedo().DoesUndo() && pReplFmtColl;
+ if (bStartUndo)
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, rFmtColl.GetName());
+ aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS));
+ aRewriter.AddRule(UNDO_ARG3, pReplFmtColl->GetName());
+
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_UI_REPLACE_STYLE,
+ &aRewriter );
+ }
+
+ SwFindParaFmtColl aSwFindParaFmtColl( rFmtColl, pReplFmtColl, *this );
+
+ sal_uLong nRet = FindAll( aSwFindParaFmtColl, nStart, nEnde, eFndRngs, bCancel );
+ pDoc->SetOle2Link( aLnk );
+
+ if( nRet && pReplFmtColl )
+ pDoc->SetModified();
+
+ if (bStartUndo)
+ {
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
+ return nRet;
+}
+
+
+
diff --git a/sw/source/core/crsr/findfmt.cxx b/sw/source/core/crsr/findfmt.cxx
new file mode 100644
index 000000000000..8da8e83bd5cf
--- /dev/null
+++ b/sw/source/core/crsr/findfmt.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <doc.hxx>
+#include <pamtyp.hxx>
+
+
+sal_Bool SwPaM::Find( const SwFmt& rFmt, SwMoveFn fnMove,
+ const SwPaM *pRegion, sal_Bool bInReadOnly )
+{
+ sal_Bool bFound = sal_False;
+ sal_Bool bSrchForward = fnMove == fnMoveForward;
+ SwPaM* pPam = MakeRegion( fnMove, pRegion );
+
+ // Wenn am Anfang/Ende, aus dem Node moven
+ if( bSrchForward
+ ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetCntntNode()->Len()
+ : !pPam->GetPoint()->nContent.GetIndex() )
+ {
+ if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, sal_False ))
+ {
+ delete pPam;
+ return sal_False;
+ }
+ SwCntntNode *pNd = pPam->GetPoint()->nNode.GetNode().GetCntntNode();
+ xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len();
+ pPam->GetPoint()->nContent.Assign( pNd, nTmpPos );
+ }
+
+ sal_Bool bFirst = sal_True;
+ SwCntntNode* pNode;
+ while( !bFound &&
+ 0 != ( pNode = ::GetNode( *pPam, bFirst, fnMove, bInReadOnly )))
+ {
+ if( 0 != ( bFound = pNode->GetFmtColl() == &rFmt ))
+ {
+ // wurde die FormatCollection gefunden, dann handelt es sich auf
+ // jedenfall um einen SwCntntNode !!
+
+ // FORWARD: SPoint an das Ende, GetMark zum Anfanf vom Node
+ // BACKWARD: SPoint zum Anfang, GetMark an das Ende vom Node
+ // und immer nach der Logik: inkl. Start, exkl. End !!!
+ *GetPoint() = *pPam->GetPoint();
+ SetMark();
+ pNode->MakeEndIndex( &GetPoint()->nContent );
+ GetMark()->nContent = 0;
+ if( !bSrchForward ) // rueckwaerts Suche?
+ Exchange(); // SPoint und GetMark tauschen
+ break;
+ }
+ }
+ delete pPam;
+ return bFound;
+}
+
+
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
new file mode 100644
index 000000000000..6eb89eadfbff
--- /dev/null
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -0,0 +1,715 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_ULONGS
+#include <svl/svstdarr.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+
+#include <txatritr.hxx>
+#include <fldbas.hxx>
+#include <fmtfld.hxx>
+#include <txtatr.hxx>
+#include <txtfld.hxx>
+#include <swcrsr.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pamtyp.hxx>
+#include <ndtxt.hxx>
+#include <swundo.hxx>
+#include <UndoInsert.hxx>
+#include <breakit.hxx>
+
+#include <docsh.hxx>
+#include <PostItMgr.hxx>
+#include <viewsh.hxx>
+
+using namespace ::com::sun::star;
+using namespace util;
+
+String *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam );
+
+String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
+ xub_StrLen& rEnde, SvULongs& rArr, String& rRet,
+ bool bRemoveSoftHyphen )
+{
+ rRet = rNd.GetTxt();
+ if( rArr.Count() )
+ rArr.Remove( 0, rArr.Count() );
+
+ const SwpHints *pHts = rNd.GetpSwpHints();
+
+ sal_uInt16 n = 0;
+ xub_StrLen nSoftHyphen = nStart;
+ xub_StrLen nHintStart = STRING_LEN;
+ bool bNewHint = true;
+ bool bNewSoftHyphen = true;
+ const xub_StrLen nEnd = rEnde;
+ SvUShorts aReplaced;
+
+ do
+ {
+ if ( bNewHint )
+ nHintStart = pHts && n < pHts->Count() ?
+ *(*pHts)[n]->GetStart() :
+ STRING_LEN;
+
+ if ( bNewSoftHyphen )
+ nSoftHyphen = bRemoveSoftHyphen ?
+ rNd.GetTxt().Search( CHAR_SOFTHYPHEN, nSoftHyphen ) :
+ STRING_LEN;
+
+ bNewHint = false;
+ bNewSoftHyphen = false;
+
+ xub_StrLen nStt = 0;
+
+ // Check if next stop is a hint.
+ if ( STRING_LEN != nHintStart && nHintStart < nSoftHyphen && nHintStart < nEnd )
+ {
+ nStt = nHintStart;
+ bNewHint = true;
+ }
+ // Check if next stop is a soft hyphen.
+ else if ( STRING_LEN != nSoftHyphen && nSoftHyphen < nHintStart && nSoftHyphen < nEnd )
+ {
+ nStt = nSoftHyphen;
+ bNewSoftHyphen = true;
+ }
+ // If nSoftHyphen == nHintStart, the current hint *must* be a hint with an end.
+ else if ( STRING_LEN != nSoftHyphen && nSoftHyphen == nHintStart )
+ {
+ nStt = nSoftHyphen;
+ bNewHint = true;
+ bNewSoftHyphen = true;
+ }
+ else
+ break;
+
+ const xub_StrLen nAkt = nStt - rArr.Count();
+
+ if ( bNewHint )
+ {
+ const SwTxtAttr* pHt = (*pHts)[n];
+ if ( pHt->HasDummyChar() && (nStt >= nStart) )
+ {
+ //JP 17.05.00: Task 75806 ask for ">=" and not for ">"
+ switch( pHt->Which() )
+ {
+ case RES_TXTATR_FLYCNT:
+ case RES_TXTATR_FTN:
+ case RES_TXTATR_FIELD:
+ case RES_TXTATR_REFMARK:
+ case RES_TXTATR_TOXMARK:
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ {
+ // JP 06.05.98: mit Bug 50100 werden sie als Trenner erwuenscht und nicht
+ // mehr zum Wort dazu gehoerend.
+ // MA 23.06.98: mit Bug 51215 sollen sie konsequenterweise auch am
+ // Satzanfang und -ende ignoriert werden wenn sie Leer sind.
+ // Dazu werden sie schlicht entfernt. Fuer den Anfang entfernen
+ // wir sie einfach.
+ // Fuer das Ende merken wir uns die Ersetzungen und entferenen
+ // hinterher alle am Stringende (koenten ja 'normale' 0x7f drinstehen
+ sal_Bool bEmpty = RES_TXTATR_FIELD != pHt->Which() ||
+ !(static_cast<SwTxtFld const*>(pHt)
+ ->GetFld().GetFld()->ExpandField(true).Len());
+ if ( bEmpty && nStart == nAkt )
+ {
+ rArr.Insert( nAkt, rArr.Count() );
+ --rEnde;
+ rRet.Erase( nAkt, 1 );
+ }
+ else
+ {
+ if ( bEmpty )
+ aReplaced.Insert( nAkt, aReplaced.Count() );
+ rRet.SetChar( nAkt, '\x7f' );
+ }
+ }
+ break;
+ default:
+ ASSERT( false, "unknown case in lcl_CleanStr" )
+ break;
+ }
+ }
+ ++n;
+ }
+
+ if ( bNewSoftHyphen )
+ {
+ rArr.Insert( nAkt, rArr.Count() );
+ --rEnde;
+ rRet.Erase( nAkt, 1 );
+ ++nSoftHyphen;
+ }
+ }
+ while ( true );
+
+ for( sal_uInt16 i = aReplaced.Count(); i; )
+ {
+ const xub_StrLen nTmp = aReplaced[ --i ];
+ if( nTmp == rRet.Len() - 1 )
+ {
+ rRet.Erase( nTmp );
+ rArr.Insert( nTmp, rArr.Count() );
+ --rEnde;
+ }
+ }
+
+ return rRet;
+}
+
+// skip all non SwPostIts inside the array
+xub_StrLen GetPostIt(xub_StrLen aCount,const SwpHints *pHts)
+{
+ xub_StrLen aIndex = 0;
+ while (aCount)
+ {
+ for (xub_StrLen i = 0; i <pHts->Count();i++)
+ {
+ aIndex++;
+ const SwTxtAttr* pTxtAttr = (*pHts)[i];
+ if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) &&
+ (pTxtAttr->GetFld().GetFld()->Which()==RES_POSTITFLD))
+ {
+ aCount--;
+ if (!aCount)
+ break;
+ }
+ }
+ }
+ // throw away all following non postits
+ for (xub_StrLen i = aIndex; i <pHts->Count();i++)
+ {
+ const SwTxtAttr* pTxtAttr = (*pHts)[i];
+ if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) &&
+ (pTxtAttr->GetFld().GetFld()->Which()==RES_POSTITFLD))
+ break;
+ else
+ aIndex++;
+ }
+ return aIndex;
+}
+
+sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes , utl::TextSearch& rSTxt,
+ SwMoveFn fnMove, const SwPaM * pRegion,
+ sal_Bool bInReadOnly )
+{
+ if( !rSearchOpt.searchString.getLength() )
+ return sal_False;
+
+ SwPaM* pPam = MakeRegion( fnMove, pRegion );
+ sal_Bool bSrchForward = fnMove == fnMoveForward;
+ SwNodeIndex& rNdIdx = pPam->GetPoint()->nNode;
+ SwIndex& rCntntIdx = pPam->GetPoint()->nContent;
+
+ // Wenn am Anfang/Ende, aus dem Node moven
+ // beim leeren Node nicht weiter
+ if( bSrchForward
+ ? ( rCntntIdx.GetIndex() == pPam->GetCntntNode()->Len() &&
+ rCntntIdx.GetIndex() )
+ : !rCntntIdx.GetIndex() && pPam->GetCntntNode()->Len() )
+ {
+ if( !(*fnMove->fnNds)( &rNdIdx, sal_False ))
+ {
+ delete pPam;
+ return sal_False;
+ }
+ SwCntntNode *pNd = rNdIdx.GetNode().GetCntntNode();
+ xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len();
+ rCntntIdx.Assign( pNd, nTmpPos );
+ }
+
+ /*
+ * Ist bFound == sal_True, dann wurde der String gefunden und in
+ * nStart und nEnde steht der gefundenen String
+ */
+ sal_Bool bFound = sal_False;
+ /*
+ * StartPostion im Text oder Anfangsposition
+ */
+ sal_Bool bFirst = sal_True;
+ SwCntntNode * pNode;
+ //testarea
+ //String sCleanStr;
+ //SvULongs aFltArr;
+ //const SwNode* pSttNd = &rNdIdx.GetNode();
+
+ xub_StrLen nStart, nEnde, nTxtLen;
+
+ sal_Bool bRegSearch = SearchAlgorithms_REGEXP == rSearchOpt.algorithmType;
+ sal_Bool bChkEmptyPara = bRegSearch && 2 == rSearchOpt.searchString.getLength() &&
+ ( !rSearchOpt.searchString.compareToAscii( "^$" ) ||
+ !rSearchOpt.searchString.compareToAscii( "$^" ) );
+ sal_Bool bChkParaEnd = bRegSearch && 1 == rSearchOpt.searchString.getLength() &&
+ !rSearchOpt.searchString.compareToAscii( "$" );
+
+// LanguageType eLastLang = 0;
+ while( 0 != ( pNode = ::GetNode( *pPam, bFirst, fnMove, bInReadOnly ) ))
+ {
+ if( pNode->IsTxtNode() )
+ {
+ nTxtLen = ((SwTxtNode*)pNode)->GetTxt().Len();
+ if( rNdIdx == pPam->GetMark()->nNode )
+ nEnde = pPam->GetMark()->nContent.GetIndex();
+ else
+ nEnde = bSrchForward ? nTxtLen : 0;
+ nStart = rCntntIdx.GetIndex();
+
+ /* #i80135# */
+ // if there are SwPostItFields inside our current node text, we split the text into seperate pieces
+ // and search for text inside the pieces as well as inside the fields
+ const SwpHints *pHts = ((SwTxtNode*)pNode)->GetpSwpHints();
+
+ // count postitfields by looping over all fields
+ xub_StrLen aNumberPostits = 0;
+ xub_StrLen aIgnore = 0;
+ if (pHts && bSearchInNotes)
+ {
+ if (!bSrchForward)
+ {
+ xub_StrLen swap = nEnde;
+ nEnde = nStart;
+ nStart = swap;
+ }
+
+ for (xub_StrLen i = 0; i <pHts->Count();i++)
+ {
+ xub_StrLen aPos = *(*pHts)[i]->GetStart();
+ const SwTxtAttr* pTxtAttr = (*pHts)[i];
+ if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) &&
+ (pTxtAttr->GetFld().GetFld()->Which()==RES_POSTITFLD))
+ {
+ if ( (aPos >= nStart) && (aPos <= nEnde) )
+ aNumberPostits++;
+ else
+ {
+ if (bSrchForward)
+ aIgnore++;
+ }
+ }
+ }
+
+ if (!bSrchForward)
+ {
+ xub_StrLen swap = nEnde;
+ nEnde = nStart;
+ nStart = swap;
+ }
+
+ }
+
+ SwDocShell *const pDocShell = pNode->GetDoc()->GetDocShell();
+ ViewShell *const pWrtShell = (pDocShell) ? (ViewShell*)(pDocShell->GetWrtShell()) : 0;
+ SwPostItMgr *const pPostItMgr = (pWrtShell) ? pWrtShell->GetPostItMgr() : 0;
+
+ xub_StrLen aStart = 0;
+ // do we need to finish a note?
+ if (pPostItMgr && pPostItMgr->HasActiveSidebarWin())
+ {
+ if (bSearchInNotes)
+ {
+ if (bSrchForward)
+ aStart++;
+ else
+ {
+ if (aNumberPostits)
+ --aNumberPostits;
+ }
+ //search inside and finsih and put focus back into the doc
+ if (pPostItMgr->FinishSearchReplace(rSearchOpt,bSrchForward))
+ {
+ bFound = true ;
+ break;
+ }
+ }
+ else
+ {
+ pPostItMgr->SetActiveSidebarWin(0);
+ }
+ }
+
+ if (aNumberPostits)
+ {
+ // now we have to split
+ xub_StrLen nStartInside = 0;
+ xub_StrLen nEndeInside = 0;
+ sal_Int16 aLoop= bSrchForward ? aStart : aNumberPostits;
+
+ while ( (aLoop>=0) && (aLoop<=aNumberPostits))
+ {
+ if (bSrchForward)
+ {
+ nStartInside = aLoop==0 ? nStart : *(*pHts)[GetPostIt(aLoop+aIgnore-1,pHts)]->GetStart()+1;
+ nEndeInside = aLoop==aNumberPostits? nEnde : *(*pHts)[GetPostIt(aLoop+aIgnore,pHts)]->GetStart();
+ nTxtLen = nEndeInside-nStartInside;
+ }
+ else
+ {
+ nStartInside = aLoop==aNumberPostits ? nStart : *(*pHts)[GetPostIt(aLoop+aIgnore,pHts)]->GetStart();
+ nEndeInside = aLoop==0 ? nEnde : *(*pHts)[GetPostIt(aLoop+aIgnore-1,pHts)]->GetStart()+1;
+ nTxtLen = nStartInside-nEndeInside;
+ }
+ // search inside the text between a note
+ bFound = DoSearch(rSearchOpt,rSTxt,fnMove,bSrchForward,bRegSearch,bChkEmptyPara,bChkParaEnd,
+ nStartInside,nEndeInside,nTxtLen, pNode,pPam);
+ if (bFound)
+ break;
+ else
+ {
+ // we should now be right in front of a note, search inside
+ if ( (bSrchForward && (GetPostIt(aLoop + aIgnore,pHts) < pHts->Count()) ) || ( !bSrchForward && (aLoop!=0) ))
+ {
+ const SwTxtAttr* pTxtAttr = bSrchForward ? (*pHts)[GetPostIt(aLoop+aIgnore,pHts)] : (*pHts)[GetPostIt(aLoop+aIgnore-1,pHts)];
+ if ( pPostItMgr && pPostItMgr->SearchReplace(((SwTxtFld*)pTxtAttr)->GetFld(),rSearchOpt,bSrchForward) )
+ {
+ bFound = true ;
+ break;
+ }
+ }
+ }
+ aLoop = bSrchForward ? aLoop+1 : aLoop-1;
+ }
+ }
+ else
+ {
+ // if there is no SwPostItField inside or searching inside notes is disabled, we search the whole length just like before
+ bFound = DoSearch(rSearchOpt,rSTxt,fnMove,bSrchForward,bRegSearch,bChkEmptyPara,bChkParaEnd,
+ nStart,nEnde,nTxtLen, pNode,pPam);
+ }
+ if (bFound)
+ break;
+ }
+ }
+ delete pPam;
+ return bFound;
+}
+
+bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
+ SwMoveFn fnMove,
+ sal_Bool bSrchForward, sal_Bool bRegSearch, sal_Bool bChkEmptyPara, sal_Bool bChkParaEnd,
+ xub_StrLen &nStart, xub_StrLen &nEnde, xub_StrLen nTxtLen,SwNode* pNode, SwPaM* pPam)
+{
+ bool bFound = false;
+ SwNodeIndex& rNdIdx = pPam->GetPoint()->nNode;
+ const SwNode* pSttNd = &rNdIdx.GetNode();
+ String sCleanStr;
+ SvULongs aFltArr;
+ LanguageType eLastLang = 0;
+ // if the search string contains a soft hypen, we don't strip them from the text:
+ bool bRemoveSoftHyphens = true;
+ if ( bRegSearch )
+ {
+ const rtl::OUString a00AD( rtl::OUString::createFromAscii( "\\x00AD" ) );
+ if ( -1 != rSearchOpt.searchString.indexOf( a00AD ) )
+ bRemoveSoftHyphens = false;
+ }
+ else
+ {
+ if ( 1 == rSearchOpt.searchString.getLength() &&
+ CHAR_SOFTHYPHEN == rSearchOpt.searchString.toChar() )
+ bRemoveSoftHyphens = false;
+ }
+
+ if( bSrchForward )
+ lcl_CleanStr( *(SwTxtNode*)pNode, nStart, nEnde,
+ aFltArr, sCleanStr, bRemoveSoftHyphens );
+ else
+ lcl_CleanStr( *(SwTxtNode*)pNode, nEnde, nStart,
+ aFltArr, sCleanStr, bRemoveSoftHyphens );
+
+ SwScriptIterator* pScriptIter = 0;
+ sal_uInt16 nSearchScript = 0;
+ sal_uInt16 nCurrScript = 0;
+
+ if ( SearchAlgorithms_APPROXIMATE == rSearchOpt.algorithmType &&
+ pBreakIt->GetBreakIter().is() )
+ {
+ pScriptIter = new SwScriptIterator( sCleanStr, nStart, bSrchForward );
+ nSearchScript = pBreakIt->GetRealScriptOfText( rSearchOpt.searchString, 0 );
+ }
+
+ xub_StrLen nStringEnd = nEnde;
+ while ( (bSrchForward && nStart < nStringEnd) ||
+ (! bSrchForward && nStart > nStringEnd) )
+ {
+ // SearchAlgorithms_APPROXIMATE works on a per word base
+ // so we have to provide the text searcher with the correct
+ // locale, because it uses the breakiterator
+ if ( pScriptIter )
+ {
+ nEnde = pScriptIter->GetScriptChgPos();
+ nCurrScript = pScriptIter->GetCurrScript();
+ if ( nSearchScript == nCurrScript )
+ {
+ const LanguageType eCurrLang =
+ ((SwTxtNode*)pNode)->GetLang( bSrchForward ?
+ nStart :
+ nEnde );
+
+ if ( eCurrLang != eLastLang )
+ {
+ const lang::Locale aLocale(
+ pBreakIt->GetLocale( eCurrLang ) );
+ rSTxt.SetLocale( rSearchOpt, aLocale );
+ eLastLang = eCurrLang;
+ }
+ }
+ pScriptIter->Next();
+ }
+
+ if( nSearchScript == nCurrScript &&
+ (rSTxt.*fnMove->fnSearch)( sCleanStr, &nStart, &nEnde, 0 ))
+ {
+ // setze den Bereich richtig
+ *GetPoint() = *pPam->GetPoint();
+ SetMark();
+
+ // Start und Ende wieder korrigieren !!
+ if( aFltArr.Count() )
+ {
+ xub_StrLen n, nNew;
+ // bei Rueckwaertssuche die Positionen temp. vertauschen
+ if( !bSrchForward ) { n = nStart; nStart = nEnde; nEnde = n; }
+
+ for( n = 0, nNew = nStart;
+ n < aFltArr.Count() && aFltArr[ n ] <= nStart;
+ ++n, ++nNew )
+ ;
+ nStart = nNew;
+ for( n = 0, nNew = nEnde;
+ n < aFltArr.Count() && aFltArr[ n ] < nEnde;
+ ++n, ++nNew )
+ ;
+ nEnde = nNew;
+
+ // bei Rueckwaertssuche die Positionen temp. vertauschen
+ if( !bSrchForward ) { n = nStart; nStart = nEnde; nEnde = n; }
+ }
+ GetMark()->nContent = nStart; // Startposition setzen
+ GetPoint()->nContent = nEnde;
+
+ if( !bSrchForward ) // rueckwaerts Suche?
+ Exchange(); // Point und Mark tauschen
+ bFound = sal_True;
+ break;
+ }
+
+ nStart = nEnde;
+ } // end of script while
+
+ delete pScriptIter;
+
+ if ( bFound )
+ return true;
+ else if( ( bChkEmptyPara && !nStart && !nTxtLen ) || bChkParaEnd )
+ {
+ *GetPoint() = *pPam->GetPoint();
+ GetPoint()->nContent = bChkParaEnd ? nTxtLen : 0;
+ SetMark();
+ if( (bSrchForward || pSttNd != &rNdIdx.GetNode()) &&
+ Move( fnMoveForward, fnGoCntnt ) &&
+ (!bSrchForward || pSttNd != &GetPoint()->nNode.GetNode()) &&
+ 1 == Abs( (int)( GetPoint()->nNode.GetIndex() -
+ GetMark()->nNode.GetIndex()) ) )
+ {
+ if( !bSrchForward ) // rueckwaerts Suche?
+ Exchange(); // Point und Mark tauschen
+ //bFound = sal_True;
+ //break;
+ return true;
+ }
+ }
+ return bFound;
+}
+
+// Parameter fuers Suchen und Ersetzen von Text
+struct SwFindParaText : public SwFindParas
+{
+ const SearchOptions& rSearchOpt;
+ SwCursor& rCursor;
+ utl::TextSearch aSTxt;
+ sal_Bool bReplace;
+ sal_Bool bSearchInNotes;
+
+ SwFindParaText( const SearchOptions& rOpt, sal_Bool bSearchNotes, int bRepl, SwCursor& rCrsr )
+ : rSearchOpt( rOpt ), rCursor( rCrsr ), aSTxt( rOpt ), bReplace( 0 != bRepl ), bSearchInNotes( bSearchNotes )
+ {}
+ virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, sal_Bool bInReadOnly );
+ virtual int IsReplaceMode() const;
+ virtual ~SwFindParaText();
+};
+
+SwFindParaText::~SwFindParaText()
+{
+}
+
+int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove,
+ const SwPaM* pRegion, sal_Bool bInReadOnly )
+{
+ if( bInReadOnly && bReplace )
+ bInReadOnly = sal_False;
+
+ sal_Bool bFnd = (sal_Bool)pCrsr->Find( rSearchOpt, bSearchInNotes, aSTxt, fnMove, pRegion, bInReadOnly );
+
+ /* #i80135# if we found something in a note, Mark and Point is the same
+ if( bFnd && *pCrsr->GetMark() == *pCrsr->GetPoint() )
+ return FIND_NOT_FOUND;
+ */
+
+ if( bFnd && bReplace ) // String ersetzen ??
+ {
+ // Replace-Methode vom SwDoc benutzen
+ const bool bRegExp(SearchAlgorithms_REGEXP == rSearchOpt.algorithmType);
+ SwIndex& rSttCntIdx = pCrsr->Start()->nContent;
+ xub_StrLen nSttCnt = rSttCntIdx.GetIndex();
+ // damit die Region auch verschoben wird, in den Shell-Cursr-Ring
+ // mit aufnehmen !!
+ Ring *pPrev(0);
+ if( bRegExp )
+ {
+ pPrev = pRegion->GetPrev();
+ ((Ring*)pRegion)->MoveRingTo( &rCursor );
+ }
+
+ ::std::auto_ptr<String> pRepl( (bRegExp)
+ ? ReplaceBackReferences( rSearchOpt, pCrsr ) : 0 );
+ rCursor.GetDoc()->ReplaceRange( *pCrsr,
+ (pRepl.get()) ? *pRepl : String(rSearchOpt.replaceString),
+ bRegExp );
+ rCursor.SaveTblBoxCntnt( pCrsr->GetPoint() );
+
+ if( bRegExp )
+ {
+ // und die Region wieder herausnehmen:
+ Ring *p, *pNext = (Ring*)pRegion;
+ do {
+ p = pNext;
+ pNext = p->GetNext();
+ p->MoveTo( (Ring*)pRegion );
+ } while( p != pPrev );
+ }
+ pCrsr->Start()->nContent = nSttCnt;
+ return FIND_NO_RING;
+ }
+ return bFnd ? FIND_FOUND : FIND_NOT_FOUND;
+}
+
+
+int SwFindParaText::IsReplaceMode() const
+{
+ return bReplace;
+}
+
+
+sal_uLong SwCursor::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes,
+ SwDocPositions nStart, SwDocPositions nEnde,
+ sal_Bool& bCancel,
+ FindRanges eFndRngs, int bReplace )
+{
+ // OLE-Benachrichtigung abschalten !!
+ SwDoc* pDoc = GetDoc();
+ Link aLnk( pDoc->GetOle2Link() );
+ pDoc->SetOle2Link( Link() );
+
+ bool const bStartUndo = pDoc->GetIDocumentUndoRedo().DoesUndo() && bReplace;
+ if (bStartUndo)
+ {
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_REPLACE, NULL );
+ }
+
+ sal_Bool bSearchSel = 0 != (rSearchOpt.searchFlag & SearchFlags::REG_NOT_BEGINOFLINE);
+ if( bSearchSel )
+ eFndRngs = (FindRanges)(eFndRngs | FND_IN_SEL);
+ SwFindParaText aSwFindParaText( rSearchOpt, bSearchInNotes, bReplace, *this );
+ sal_uLong nRet = FindAll( aSwFindParaText, nStart, nEnde, eFndRngs, bCancel );
+ pDoc->SetOle2Link( aLnk );
+ if( nRet && bReplace )
+ pDoc->SetModified();
+
+ if (bStartUndo)
+ {
+ SwRewriter rewriter(MakeUndoReplaceRewriter(
+ nRet, rSearchOpt.searchString, rSearchOpt.replaceString));
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_REPLACE, & rewriter );
+ }
+ return nRet;
+}
+
+String *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam )
+{
+ String *pRet = 0;
+ if( pPam && pPam->HasMark() &&
+ SearchAlgorithms_REGEXP == rSearchOpt.algorithmType )
+ {
+ const SwCntntNode* pTxtNode = pPam->GetCntntNode( sal_True );
+ if( pTxtNode && pTxtNode->IsTxtNode() && pTxtNode == pPam->GetCntntNode( sal_False ) )
+ {
+ utl::TextSearch aSTxt( rSearchOpt );
+ String aStr( pPam->GetTxt() );
+ String aSearchStr( rSearchOpt.searchString );
+ String aReplaceStr( rSearchOpt.replaceString );
+ aStr.EraseAllChars( CH_TXTATR_BREAKWORD );
+ aStr.EraseAllChars( CH_TXTATR_INWORD );
+ xub_StrLen nStart = 0;
+ String sX( 'x' );
+ if( pPam->Start()->nContent > 0 )
+ {
+ aStr.Insert( sX, 0 );
+ ++nStart;
+ }
+ xub_StrLen nEnd = aStr.Len();
+ bool bDeleteLastX = false;
+ if( pPam->End()->nContent < (static_cast<const SwTxtNode*>(pTxtNode))->GetTxt().Len() )
+ {
+ aStr.Insert( sX );
+ bDeleteLastX = true;
+ }
+ SearchResult aResult;
+ if( aSTxt.SearchFrwrd( aStr, &nStart, &nEnd, &aResult ) )
+ {
+ if( bDeleteLastX )
+ aStr.Erase( aStr.Len() - 1 );
+ aSTxt.ReplaceBackReferences( aReplaceStr, aStr, aResult );
+ pRet = new String( aReplaceStr );
+ }
+ }
+ }
+ return pRet;
+}
+
+
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
new file mode 100644
index 000000000000..e1599db289c9
--- /dev/null
+++ b/sw/source/core/crsr/pam.cxx
@@ -0,0 +1,1246 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <editeng/protitem.hxx>
+#include <cntfrm.hxx>
+#include <pagefrm.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <pam.hxx>
+#include <pamtyp.hxx>
+#include <txtfrm.hxx>
+#include <section.hxx>
+#include <fmtcntnt.hxx>
+#include <frmatr.hxx>
+#include <swtable.hxx>
+#include <crsskip.hxx>
+
+// --> FME 2004-06-29 #114856# Formular view
+#include <flyfrm.hxx>
+#include <fmteiro.hxx>
+#include <section.hxx>
+#include <sectfrm.hxx>
+// <--
+#include <ndtxt.hxx> // #111827#
+
+#include <IMark.hxx>
+#include <hints.hxx>
+
+// fuer den dummen ?MSC-? Compiler
+inline xub_StrLen GetSttOrEnd( sal_Bool bCondition, const SwCntntNode& rNd )
+{
+ return bCondition ? 0 : rNd.Len();
+}
+
+/*************************************************************************
+|*
+|* SwPosition
+|*
+|* Beschreibung PAM.DOC
+|* Ersterstellung VB 4.3.91
+|* Letzte Aenderung VB 4.3.91
+|*
+*************************************************************************/
+
+
+SwPosition::SwPosition( const SwNodeIndex & rNodeIndex, const SwIndex & rCntnt )
+ : nNode( rNodeIndex ), nContent( rCntnt )
+{
+}
+
+SwPosition::SwPosition( const SwNodeIndex & rNodeIndex )
+ : nNode( rNodeIndex ), nContent( nNode.GetNode().GetCntntNode() )
+{
+}
+
+SwPosition::SwPosition( const SwNode& rNode )
+ : 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::operator=(const SwPosition &rPos)
+{
+ nNode = rPos.nNode;
+ nContent = rPos.nContent;
+ return *this;
+}
+
+
+sal_Bool SwPosition::operator<(const SwPosition &rPos) const
+{
+ if( nNode < rPos.nNode )
+ return sal_True;
+ if( nNode == rPos.nNode )
+ return ( nContent < rPos.nContent );
+ return sal_False;
+}
+
+
+sal_Bool SwPosition::operator>(const SwPosition &rPos) const
+{
+ if(nNode > rPos.nNode )
+ return sal_True;
+ if( nNode == rPos.nNode )
+ return ( nContent > rPos.nContent );
+ return sal_False;
+}
+
+
+sal_Bool SwPosition::operator<=(const SwPosition &rPos) const
+{
+ if(nNode < rPos.nNode )
+ return sal_True;
+ if( nNode == rPos.nNode )
+ return ( nContent <= rPos.nContent );
+ return sal_False;
+}
+
+
+sal_Bool SwPosition::operator>=(const SwPosition &rPos) const
+{
+ if(nNode > rPos.nNode )
+ return sal_True;
+ if( nNode == rPos.nNode )
+ return ( nContent >= rPos.nContent );
+ return sal_False;
+}
+
+
+sal_Bool SwPosition::operator==(const SwPosition &rPos) const
+{
+ return
+ ( ( nNode == rPos.nNode ) && ( nContent == rPos.nContent ) ?
+ sal_True: sal_False);
+}
+
+
+sal_Bool SwPosition::operator!=(const SwPosition &rPos) const
+{
+ if( nNode != rPos.nNode )
+ return sal_True;
+ return ( nContent != rPos.nContent );
+}
+
+SwDoc * SwPosition::GetDoc() const
+{
+ return nNode.GetNode().GetDoc();
+}
+
+SwComparePosition ComparePosition(
+ const SwPosition& rStt1, const SwPosition& rEnd1,
+ const SwPosition& rStt2, const SwPosition& rEnd2 )
+{
+ SwComparePosition nRet;
+ if( rStt1 < rStt2 )
+ {
+ if( rEnd1 > rStt2 )
+ {
+ if( rEnd1 >= rEnd2 )
+ nRet = POS_OUTSIDE;
+ else
+ nRet = POS_OVERLAP_BEFORE;
+
+ }
+ else if( rEnd1 == rStt2 )
+ nRet = POS_COLLIDE_END;
+ else
+ nRet = POS_BEFORE;
+ }
+ else if( rEnd2 > rStt1 )
+ {
+ if( rEnd2 >= rEnd1 )
+ {
+ if( rEnd2 == rEnd1 && rStt2 == rStt1 )
+ nRet = POS_EQUAL;
+ else
+ nRet = POS_INSIDE;
+ }
+ else
+ {
+ if (rStt1 == rStt2)
+ nRet = POS_OUTSIDE;
+ else
+ nRet = POS_OVERLAP_BEHIND;
+ }
+ }
+ else if( rEnd2 == rStt1 )
+ nRet = POS_COLLIDE_START;
+ else
+ nRet = POS_BEHIND;
+ return nRet;
+}
+
+SwComparePosition ComparePosition(
+ const unsigned long nStt1, const unsigned long nEnd1,
+ const unsigned long nStt2, const unsigned long nEnd2 )
+{
+ SwComparePosition nRet;
+ if( nStt1 < nStt2 )
+ {
+ if( nEnd1 > nStt2 )
+ {
+ if( nEnd1 >= nEnd2 )
+ nRet = POS_OUTSIDE;
+ else
+ nRet = POS_OVERLAP_BEFORE;
+
+ }
+ else if( nEnd1 == nStt2 )
+ nRet = POS_COLLIDE_END;
+ else
+ nRet = POS_BEFORE;
+ }
+ else if( nEnd2 > nStt1 )
+ {
+ if( nEnd2 >= nEnd1 )
+ {
+ if( nEnd2 == nEnd1 && nStt2 == nStt1 )
+ nRet = POS_EQUAL;
+ else
+ nRet = POS_INSIDE;
+ }
+ else
+ {
+ if (nStt1 == nStt2)
+ nRet = POS_OUTSIDE;
+ else
+ nRet = POS_OVERLAP_BEHIND;
+ }
+ }
+ else if( nEnd2 == nStt1 )
+ nRet = POS_COLLIDE_START;
+ else
+ nRet = POS_BEHIND;
+ return nRet;
+}
+
+/* */
+
+enum CHKSECTION { Chk_Both, Chk_One, Chk_None };
+
+
+CHKSECTION lcl_TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, const SwNode& rEndNd )
+{
+ sal_uLong nStt = rEndNd.StartOfSectionIndex(), nEnd = rEndNd.GetIndex();
+ CHKSECTION eSec = nStt < nSttIdx && nEnd >= nSttIdx ? Chk_One : Chk_None;
+ if( nStt < nEndIdx && nEnd >= nEndIdx )
+ return( eSec == Chk_One ? Chk_Both : Chk_One );
+ return eSec;
+}
+
+
+sal_Bool lcl_ChkOneRange( CHKSECTION eSec, sal_Bool bChkSections,
+ const SwNode& rBaseEnd, sal_uLong nStt, sal_uLong nEnd )
+{
+ if( eSec != Chk_Both )
+ return sal_False;
+
+ if( !bChkSections )
+ return sal_True;
+
+ // suche die umspannende Section
+ const SwNodes& rNds = rBaseEnd.GetNodes();
+ const SwNode *pTmp, *pNd = rNds[ nStt ];
+ if( !pNd->IsStartNode() )
+ pNd = pNd->StartOfSectionNode();
+
+ if( pNd == rNds[ nEnd ]->StartOfSectionNode() )
+ return sal_True; // der gleiche StartNode, die selbe Section
+
+ // steht schon auf einem GrundSection Node ? Fehler !!!
+ if( !pNd->StartOfSectionIndex() )
+ return sal_False;
+
+ while( ( pTmp = pNd->StartOfSectionNode())->EndOfSectionNode() !=
+ &rBaseEnd )
+ pNd = pTmp;
+
+ sal_uLong nSttIdx = pNd->GetIndex(), nEndIdx = pNd->EndOfSectionIndex();
+ return nSttIdx <= nStt && nStt <= nEndIdx &&
+ nSttIdx <= nEnd && nEnd <= nEndIdx ? sal_True : sal_False;
+}
+
+
+sal_Bool CheckNodesRange( const SwNodeIndex& rStt,
+ const SwNodeIndex& rEnd, sal_Bool bChkSection )
+{
+ const SwNodes& rNds = rStt.GetNodes();
+ sal_uLong nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex();
+ CHKSECTION eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfContent() );
+ if( Chk_None != eSec ) return eSec == Chk_Both ? sal_True : sal_False;
+
+ eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfAutotext() );
+ if( Chk_None != eSec )
+ return lcl_ChkOneRange( eSec, bChkSection,
+ rNds.GetEndOfAutotext(), nStt, nEnd );
+
+ eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfPostIts() );
+ if( Chk_None != eSec )
+ return lcl_ChkOneRange( eSec, bChkSection,
+ rNds.GetEndOfPostIts(), nStt, nEnd );
+
+ eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfInserts() );
+ if( Chk_None != eSec )
+ return lcl_ChkOneRange( eSec, bChkSection,
+ rNds.GetEndOfInserts(), nStt, nEnd );
+
+ eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfRedlines() );
+ if( Chk_None != eSec )
+ return lcl_ChkOneRange( eSec, bChkSection,
+ rNds.GetEndOfRedlines(), nStt, nEnd );
+
+ return sal_False; // liegt irgendwo dazwischen, FEHLER
+}
+
+
+sal_Bool GoNext(SwNode* pNd, SwIndex * pIdx, sal_uInt16 nMode )
+{
+ if( pNd->IsCntntNode() )
+ return ((SwCntntNode*)pNd)->GoNext( pIdx, nMode );
+ return sal_False;
+}
+
+
+sal_Bool GoPrevious( SwNode* pNd, SwIndex * pIdx, sal_uInt16 nMode )
+{
+ if( pNd->IsCntntNode() )
+ return ((SwCntntNode*)pNd)->GoPrevious( pIdx, nMode );
+ return sal_False;
+}
+
+
+SwCntntNode* GoNextNds( SwNodeIndex* pIdx, sal_Bool bChk )
+{
+ SwNodeIndex aIdx( *pIdx );
+ SwCntntNode* pNd = aIdx.GetNodes().GoNext( &aIdx );
+ if( pNd )
+ {
+ if( bChk && 1 != aIdx.GetIndex() - pIdx->GetIndex() &&
+ !CheckNodesRange( *pIdx, aIdx, sal_True ) )
+ pNd = 0;
+ else
+ *pIdx = aIdx;
+ }
+ return pNd;
+}
+
+
+SwCntntNode* GoPreviousNds( SwNodeIndex * pIdx, sal_Bool bChk )
+{
+ SwNodeIndex aIdx( *pIdx );
+ SwCntntNode* pNd = aIdx.GetNodes().GoPrevious( &aIdx );
+ if( pNd )
+ {
+ if( bChk && 1 != pIdx->GetIndex() - aIdx.GetIndex() &&
+ !CheckNodesRange( *pIdx, aIdx, sal_True ) )
+ pNd = 0;
+ else
+ *pIdx = aIdx;
+ }
+ return pNd;
+}
+
+// ----------------------------------------------------------------------
+
+/*************************************************************************
+|*
+|* SwPointAndMark
+|*
+|* Beschreibung PAM.DOC
+|* Ersterstellung VB 4.3.91
+|* Letzte Aenderung JP 6.5.91
+|*
+*************************************************************************/
+
+SwPaM::SwPaM( const SwPosition& rPos, SwPaM* pRing )
+ : Ring( pRing )
+ , m_Bound1( rPos )
+ , m_Bound2( rPos.nNode.GetNode().GetNodes() ) // default initialize
+ , m_pPoint( &m_Bound1 )
+ , m_pMark( m_pPoint )
+ , m_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 )
+{
+}
+
+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 ( 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& 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 ( 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& 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 )
+{
+ m_pPoint->nContent.Assign( rPoint.GetNode().GetCntntNode(), nPointCntnt);
+ m_pMark ->nContent.Assign( rMark .GetNode().GetCntntNode(), nMarkCntnt );
+}
+
+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 )
+{
+ m_pPoint->nContent.Assign( m_pPoint->nNode.GetNode().GetCntntNode(),
+ nPointCntnt);
+ m_pMark ->nContent.Assign( m_pMark ->nNode.GetNode().GetCntntNode(),
+ nMarkCntnt );
+}
+
+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 )
+{
+ m_pPoint->nContent.Assign( m_pPoint->nNode.GetNode().GetCntntNode(),
+ nCntnt );
+}
+
+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 )
+{
+ m_pPoint->nContent.Assign( rNodeIdx.GetNode().GetCntntNode(), nCntnt );
+}
+
+SwPaM::~SwPaM() {}
+
+// @@@ semantic: no copy ctor.
+SwPaM::SwPaM( SwPaM &rPam )
+ : 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 )
+{
+}
+
+// @@@ semantic: no copy assignment for super class Ring.
+SwPaM &SwPaM::operator=( const SwPaM &rPam )
+{
+ *m_pPoint = *( rPam.m_pPoint );
+ if ( rPam.HasMark() )
+ {
+ SetMark();
+ *m_pMark = *( rPam.m_pMark );
+ }
+ else
+ {
+ DeleteMark();
+ }
+ return *this;
+}
+
+void SwPaM::SetMark()
+{
+ if (m_pPoint == &m_Bound1)
+ {
+ m_pMark = &m_Bound2;
+ }
+ else
+ {
+ m_pMark = &m_Bound1;
+ }
+ (*m_pMark) = (*m_pPoint);
+}
+
+#ifdef DBG_UTIL
+
+void SwPaM::Exchange()
+{
+ if (m_pPoint != m_pMark)
+ {
+ SwPosition *pTmp = m_pPoint;
+ m_pPoint = m_pMark;
+ m_pMark = pTmp;
+ }
+}
+#endif
+
+// Bewegen des Cursors
+
+
+sal_Bool SwPaM::Move( SwMoveFn fnMove, SwGoInDoc fnGo )
+{
+ sal_Bool bRet = (*fnGo)( *this, fnMove );
+
+ m_bIsInFrontOfLabel = false;
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|* void SwPaM::MakeRegion( SwMoveFn, SwPaM*, const SwPaM* )
+|*
+|* Beschreibung Setzt den 1. SwPaM auf den uebergebenen SwPaM
+|* oder setzt auf den Anfang oder Ende vom Document.
+|* SPoint bleibt auf der Position stehen, GetMark aendert
+|* sich entsprechend !
+|*
+|* Parameter SwDirection gibt an, ob an Anfang / Ende
+|* SwPaM * der zu setzende Bereich
+|* const SwPaM& der enventuell vorgegeben Bereich
+|* Return-Werte SwPaM* der entsprehend neu gesetzte Bereich
+|*
+|* Ersterstellung JP 26.04.91
+|* Letzte Aenderung JP 26.04.91
+|*
+*************************************************************************/
+
+
+SwPaM* SwPaM::MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg )
+{
+ SwPaM* pPam;
+ if( pOrigRg == 0 )
+ {
+ pPam = new SwPaM( *m_pPoint );
+ pPam->SetMark(); // setze Anfang fest
+ pPam->Move( fnMove, fnGoSection); // an Anfang / Ende vom Node
+
+ // stelle SPoint wieder auf alte Position, GetMark auf das "Ende"
+ pPam->Exchange();
+ }
+ else
+ {
+ pPam = new SwPaM( *(SwPaM*)pOrigRg ); // die Suchregion ist vorgegeben
+ // sorge dafuer, dass SPoint auf dem "echten" StartPunkt steht
+ // FORWARD --> SPoint immer kleiner als GetMark
+ // BACKWARD --> SPoint immer groesser als GetMark
+ if( (pPam->GetMark()->*fnMove->fnCmpOp)( *pPam->GetPoint() ) )
+ pPam->Exchange();
+ }
+ return pPam;
+}
+
+SwPaM & SwPaM::Normalize(sal_Bool bPointFirst)
+{
+ if (HasMark())
+ if ( ( bPointFirst && *m_pPoint > *m_pMark) ||
+ (!bPointFirst && *m_pPoint < *m_pMark) )
+ {
+ Exchange();
+ }
+
+ return *this;
+}
+
+sal_uInt16 SwPaM::GetPageNum( sal_Bool bAtPoint, const Point* pLayPos )
+{
+ // return die Seitennummer am Cursor
+ // (fuer Reader + Seitengebundene Rahmen)
+ const SwCntntFrm* pCFrm;
+ const SwPageFrm *pPg;
+ const SwCntntNode *pNd ;
+ const SwPosition* pPos = bAtPoint ? m_pPoint : m_pMark;
+
+ if( 0 != ( pNd = pPos->nNode.GetNode().GetCntntNode() ) &&
+ 0 != ( pCFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), pLayPos, pPos, sal_False )) &&
+ 0 != ( pPg = pCFrm->FindPageFrm() ))
+ return pPg->GetPhyPageNum();
+ return 0;
+}
+
+// --> FME 2004-06-29 #114856# Formular view
+// See also SwCrsrShell::IsCrsrReadonly()
+const SwFrm* lcl_FindEditInReadonlyFrm( const SwFrm& rFrm )
+{
+ const SwFrm* pRet = 0;
+
+ const SwFlyFrm* pFly;
+ const SwSectionFrm* pSectionFrm;
+
+ if( rFrm.IsInFly() &&
+ (pFly = rFrm.FindFlyFrm())->GetFmt()->GetEditInReadonly().GetValue() &&
+ pFly->Lower() &&
+ !pFly->Lower()->IsNoTxtFrm() )
+ {
+ pRet = pFly;
+ }
+ else if ( rFrm.IsInSct() &&
+ 0 != ( pSectionFrm = rFrm.FindSctFrm() )->GetSection() &&
+ pSectionFrm->GetSection()->IsEditInReadonlyFlag() )
+ {
+ pRet = pSectionFrm;
+ }
+
+ return pRet;
+}
+// <--
+
+// steht in etwas geschuetztem oder in die Selektion umspannt
+// etwas geschuetztes.
+sal_Bool SwPaM::HasReadonlySel( bool bFormView ) const
+{
+ sal_Bool bRet = sal_False;
+ Point aTmpPt;
+ const SwCntntNode *pNd;
+ const SwCntntFrm *pFrm;
+
+ if( 0 != ( pNd = GetPoint()->nNode.GetNode().GetCntntNode() ))
+ pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aTmpPt, GetPoint(), sal_False );
+ else
+ pFrm = 0;
+
+ // --> FME 2004-06-29 #114856# Formular view
+ // Will be set if point/mark are inside edit-in-readonly environment
+ const SwFrm* pSttEIRFrm = 0;
+ const SwFrm* pEndEIRFrm = 0;
+
+ if( pFrm && ( pFrm->IsProtected() ||
+ // --> FME 2004-06-29 #114856# Formular view
+ ( bFormView &&
+ 0 == ( pSttEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) )
+ // <--
+ bRet = sal_True;
+ else if( pNd )
+ {
+ const SwSectionNode* pSNd = pNd->GetSectionNode();
+ if( pSNd && ( pSNd->GetSection().IsProtectFlag() ||
+ // --> FME 2004-06-29 #114856# Formular view
+ (bFormView && !pSNd->GetSection().IsEditInReadonlyFlag()) ) )
+ // <--
+ bRet = sal_True;
+ }
+
+ if( !bRet && HasMark() && GetPoint()->nNode != GetMark()->nNode )
+ {
+ if( 0 != ( pNd = GetMark()->nNode.GetNode().GetCntntNode() ))
+ pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aTmpPt, GetMark(), sal_False );
+ else
+ pFrm = 0;
+
+ if( pFrm && ( pFrm->IsProtected() ||
+ // --> FME 2004-06-29 #114856# Formular view
+ ( bFormView &&
+ 0 == ( pEndEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) )
+ // <--
+ bRet = sal_True;
+ else if( pNd )
+ {
+ const SwSectionNode* pSNd = pNd->GetSectionNode();
+ if( pSNd && ( pSNd->GetSection().IsProtectFlag() ||
+ // --> FME 2004-06-29 #114856# Formular view
+ (bFormView && !pSNd->GetSection().IsEditInReadonlyFlag()) ) )
+ // <--
+ bRet = sal_True;
+ }
+
+ // --> FME 2004-06-29 #114856# Formular view
+ if ( !bRet && bFormView )
+ {
+ // Check if start and end frame are inside the _same_
+ // edit-in-readonly-environment. Otherwise we better return 'true'
+ if ( pSttEIRFrm != pEndEIRFrm )
+ bRet = sal_True;
+ }
+ // <--
+
+ // oder sollte eine geschuetzte Section innerhalb der
+ // Selektion liegen?
+ if( !bRet )
+ {
+ sal_uLong nSttIdx = GetMark()->nNode.GetIndex(),
+ nEndIdx = GetPoint()->nNode.GetIndex();
+ if( nEndIdx <= nSttIdx )
+ {
+ sal_uLong nTmp = nSttIdx;
+ nSttIdx = nEndIdx;
+ nEndIdx = nTmp;
+ }
+
+ // wenn ein geschuetzter Bereich zwischen den Nodes stehen soll,
+ // muss die Selektion selbst schon x Nodes umfassen.
+ // (TxtNd, SectNd, TxtNd, EndNd, TxtNd )
+ if( nSttIdx + 3 < nEndIdx )
+ {
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = rFmts.Count(); n; )
+ {
+ const SwSectionFmt* pFmt = rFmts[ --n ];
+ if( pFmt->GetProtect().IsCntntProtected() )
+ {
+ const SwFmtCntnt& rCntnt = pFmt->GetCntnt(sal_False);
+ ASSERT( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" );
+ sal_uLong nIdx = rCntnt.GetCntntIdx()->GetIndex();
+ if( nSttIdx <= nIdx && nEndIdx >= nIdx &&
+ rCntnt.GetCntntIdx()->GetNode().GetNodes().IsDocNodes() )
+ {
+/* // ist es keine gelinkte Section, dann kann sie auch
+ // nicht mitselektiert werden
+ const SwSection& rSect = *pFmt->GetSection();
+ if( CONTENT_SECTION == rSect.GetType() )
+ {
+ RestoreSavePos();
+ return sal_True;
+ }
+*/
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+
+#ifdef CHECK_CELL_READONLY
+//JP 22.01.99: bisher wurden Tabelle, die in der Text-Selektion standen
+// nicht beachtet. Wollte man das haben, dann muss dieser
+// Code freigeschaltet werden
+
+ if( !bRet )
+ {
+ // dann noch ueber alle Tabellen
+ const SwFrmFmts& rFmts = *GetDoc()->GetTblFrmFmts();
+ for( n = rFmts.Count(); n ; )
+ {
+ SwFrmFmt* pFmt = (SwFrmFmt*)rFmts[ --n ];
+ const SwTable* pTbl = SwTable::FindTable( pFmt );
+ sal_uLong nIdx = pTbl ? pTbl->GetTabSortBoxes()[0]->GetSttIdx()
+ : 0;
+ if( nSttIdx <= nIdx && nEndIdx >= nIdx )
+ {
+ // dann teste mal alle Boxen
+ const SwTableSortBoxes& rBoxes = pTbl->GetTabSortBoxes();
+
+ for( sal_uInt16 i = rBoxes.Count(); i; )
+ if( rBoxes[ --i ]->GetFrmFmt()->GetProtect().
+ IsCntntProtected() )
+ {
+ bRet = sal_True;
+ break;
+ }
+
+ if( bRet )
+ break;
+ }
+ }
+ }
+#endif
+ }
+ }
+ }
+ //FIXME FieldBk
+ // TODO: Form Protection when Enhanced Fields are enabled
+ if (!bRet) {
+ const SwDoc *pDoc = GetDoc();
+ sw::mark::IMark* pA = NULL;
+ sw::mark::IMark* pB = NULL;
+ if ( pDoc )
+ {
+ const IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess( );
+ pA = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : NULL;
+ pB = GetMark( ) ? pMarksAccess->getFieldmarkFor( *GetMark( ) ) : pA;
+ bRet = ( pA != pB );
+ }
+ bool bProtectForm = pDoc->get( IDocumentSettingAccess::PROTECT_FORM );
+ if ( bProtectForm )
+ bRet |= ( pA == NULL || pB == NULL );
+ }
+ return bRet;
+}
+
+//-------------------- Suche nach Formaten( FormatNamen ) -----------------
+
+// die Funktion gibt in Suchrichtung den folgenden Node zurueck.
+// Ist in der Richtung keiner mehr vorhanden oder ist dieser ausserhalb
+// des Bereiches, wird ein 0 Pointer returnt.
+// Das rbFirst gibt an, ob es man zu erstenmal einen Node holt. Ist das der
+// Fall, darf die Position vom Pam nicht veraendert werden!
+
+
+SwCntntNode* GetNode( SwPaM & rPam, sal_Bool& rbFirst, SwMoveFn fnMove,
+ sal_Bool bInReadOnly )
+{
+ SwCntntNode * pNd = 0;
+ SwCntntFrm* pFrm;
+ if( ((*rPam.GetPoint()).*fnMove->fnCmpOp)( *rPam.GetMark() ) ||
+ ( *rPam.GetPoint() == *rPam.GetMark() && rbFirst ) )
+ {
+ if( rbFirst )
+ {
+ rbFirst = sal_False;
+ pNd = rPam.GetCntntNode();
+ if( pNd )
+ {
+ if(
+ (
+ 0 == ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout() ) ) ||
+ ( !bInReadOnly && pFrm->IsProtected() ) ||
+ (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow())
+ ) ||
+ ( !bInReadOnly && pNd->FindSectionNode() &&
+ pNd->FindSectionNode()->GetSection().IsProtect()
+ )
+ )
+ {
+ pNd = 0;
+ }
+ }
+ }
+
+ if( !pNd ) // steht Cursor auf keinem ContentNode ?
+ {
+ SwPosition aPos( *rPam.GetPoint() );
+ sal_Bool bSrchForward = fnMove == fnMoveForward;
+ SwNodes& rNodes = aPos.nNode.GetNodes();
+
+ // zum naechsten / vorherigen ContentNode
+// Funktioniert noch alles, wenn die Uerbpruefung vom ueberspringen der
+// Sektions herausgenommen wird ??
+// if( (*fnMove->fnNds)( rNodes, &aPos.nNode ) )
+ while( sal_True )
+ {
+ pNd = bSrchForward
+ ? rNodes.GoNextSection( &aPos.nNode, sal_True, !bInReadOnly )
+ : rNodes.GoPrevSection( &aPos.nNode, sal_True, !bInReadOnly );
+ if( pNd )
+ {
+ aPos.nContent.Assign( pNd, ::GetSttOrEnd( bSrchForward,*pNd ));
+ // liegt Position immer noch im Bereich ?
+ if( (aPos.*fnMove->fnCmpOp)( *rPam.GetMark() ) )
+ {
+ // nur in der AutoTextSection koennen Node stehen, die
+ // nicht angezeigt werden !!
+ if( 0 == ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout() ) ) ||
+ ( !bInReadOnly && pFrm->IsProtected() ) ||
+ ( pFrm->IsTxtFrm() &&
+ ((SwTxtFrm*)pFrm)->IsHiddenNow() ) )
+
+// rNodes[ rNodes.EndOfAutotext ]->StartOfSection().GetIndex()
+// < aPos.nNode.GetIndex() && aPos.nNode.GetIndex()
+// < rNodes.EndOfAutotext.GetIndex() &&
+// 0 == ( pFrm = pNd->GetFrm()) &&
+// pFrm->IsProtected() )
+ {
+ pNd = 0;
+ continue; // suche weiter
+ }
+ *(SwPosition*)rPam.GetPoint() = aPos;
+ }
+ else
+ pNd = 0; // kein gueltiger Node
+ break;
+ }
+ break;
+ }
+ }
+ }
+ return pNd;
+}
+
+// ----------------------------------------------------------------------
+
+// hier folgen die Move-Methoden ( Foward, Backward; Content, Node, Doc )
+
+
+void GoStartDoc( SwPosition * pPos )
+{
+ SwNodes& rNodes = pPos->nNode.GetNodes();
+ pPos->nNode = *rNodes.GetEndOfContent().StartOfSectionNode();
+ // es muss immer ein ContentNode gefunden werden !!
+ SwCntntNode* pCNd = rNodes.GoNext( &pPos->nNode );
+ if( pCNd )
+ pCNd->MakeStartIndex( &pPos->nContent );
+}
+
+
+void GoEndDoc( SwPosition * pPos )
+{
+ SwNodes& rNodes = pPos->nNode.GetNodes();
+ pPos->nNode = rNodes.GetEndOfContent();
+ SwCntntNode* pCNd = GoPreviousNds( &pPos->nNode, sal_True );
+ if( pCNd )
+ pCNd->MakeEndIndex( &pPos->nContent );
+}
+
+
+void GoStartSection( SwPosition * pPos )
+{
+ // springe zum Anfang der Section
+ SwNodes& rNodes = pPos->nNode.GetNodes();
+ sal_uInt16 nLevel = rNodes.GetSectionLevel( pPos->nNode );
+ if( pPos->nNode < rNodes.GetEndOfContent().StartOfSectionIndex() )
+ nLevel--;
+ do { rNodes.GoStartOfSection( &pPos->nNode ); } while( nLevel-- );
+
+ // steht jetzt schon auf einem CntntNode
+ pPos->nNode.GetNode().GetCntntNode()->MakeStartIndex( &pPos->nContent );
+}
+
+// gehe an das Ende der akt. Grund-Section
+
+
+void GoEndSection( SwPosition * pPos )
+{
+ // springe zum Anfang/Ende der Section
+ SwNodes& rNodes = pPos->nNode.GetNodes();
+ sal_uInt16 nLevel = rNodes.GetSectionLevel( pPos->nNode );
+ if( pPos->nNode < rNodes.GetEndOfContent().StartOfSectionIndex() )
+ nLevel--;
+ do { rNodes.GoEndOfSection( &pPos->nNode ); } while( nLevel-- );
+
+ // steht jetzt auf einem EndNode, also zum vorherigen CntntNode
+ if( GoPreviousNds( &pPos->nNode, sal_True ) )
+ pPos->nNode.GetNode().GetCntntNode()->MakeEndIndex( &pPos->nContent );
+}
+
+
+
+sal_Bool GoInDoc( SwPaM & rPam, SwMoveFn fnMove )
+{
+ (*fnMove->fnDoc)( rPam.GetPoint() );
+ return sal_True;
+}
+
+
+sal_Bool GoInSection( SwPaM & rPam, SwMoveFn fnMove )
+{
+ (*fnMove->fnSections)( (SwPosition*)rPam.GetPoint() );
+ return sal_True;
+}
+
+
+sal_Bool GoInNode( SwPaM & rPam, SwMoveFn fnMove )
+{
+ SwCntntNode *pNd = (*fnMove->fnNds)( &rPam.GetPoint()->nNode, sal_True );
+ if( pNd )
+ rPam.GetPoint()->nContent.Assign( pNd,
+ ::GetSttOrEnd( fnMove == fnMoveForward, *pNd ) );
+ return 0 != pNd;
+}
+
+
+sal_Bool GoInCntnt( SwPaM & rPam, SwMoveFn fnMove )
+{
+ if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(),
+ &rPam.GetPoint()->nContent, CRSR_SKIP_CHARS ))
+ return sal_True;
+ return GoInNode( rPam, fnMove );
+}
+
+sal_Bool GoInCntntCells( SwPaM & rPam, SwMoveFn fnMove )
+{
+ if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(),
+ &rPam.GetPoint()->nContent, CRSR_SKIP_CELLS ))
+ return sal_True;
+ return GoInNode( rPam, fnMove );
+}
+
+sal_Bool GoInCntntSkipHidden( SwPaM & rPam, SwMoveFn fnMove )
+{
+ if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(),
+ &rPam.GetPoint()->nContent, CRSR_SKIP_CHARS | CRSR_SKIP_HIDDEN ) )
+ return sal_True;
+ return GoInNode( rPam, fnMove );
+}
+
+sal_Bool GoInCntntCellsSkipHidden( SwPaM & rPam, SwMoveFn fnMove )
+{
+ if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(),
+ &rPam.GetPoint()->nContent, CRSR_SKIP_CELLS | CRSR_SKIP_HIDDEN ) )
+ return sal_True;
+ return GoInNode( rPam, fnMove );
+}
+
+
+
+// --------- Funktionsdefinitionen fuer die SwCrsrShell --------------
+
+
+sal_Bool GoPrevPara( SwPaM & rPam, SwPosPara aPosPara )
+{
+ if( rPam.Move( fnMoveBackward, fnGoNode ) )
+ {
+ // steht immer auf einem ContentNode !
+ SwPosition& rPos = *rPam.GetPoint();
+ SwCntntNode * pNd = rPos.nNode.GetNode().GetCntntNode();
+ rPos.nContent.Assign( pNd,
+ ::GetSttOrEnd( aPosPara == fnMoveForward, *pNd ) );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+
+sal_Bool GoCurrPara( SwPaM & rPam, SwPosPara aPosPara )
+{
+ SwPosition& rPos = *rPam.GetPoint();
+ SwCntntNode * pNd = rPos.nNode.GetNode().GetCntntNode();
+ if( pNd )
+ {
+ xub_StrLen nOld = rPos.nContent.GetIndex(),
+ nNew = aPosPara == fnMoveForward ? 0 : pNd->Len();
+ // stand er schon auf dem Anfang/Ende dann zum naechsten/vorherigen
+ if( nOld != nNew )
+ {
+ rPos.nContent.Assign( pNd, nNew );
+ return sal_True;
+ }
+ }
+ // den Node noch etwas bewegen ( auf den naechsten/vorh. CntntNode)
+ if( ( aPosPara==fnParaStart && 0 != ( pNd =
+ GoPreviousNds( &rPos.nNode, sal_True ))) ||
+ ( aPosPara==fnParaEnd && 0 != ( pNd =
+ GoNextNds( &rPos.nNode, sal_True ))) )
+ {
+ rPos.nContent.Assign( pNd,
+ ::GetSttOrEnd( aPosPara == fnMoveForward, *pNd ));
+ return sal_True;
+ }
+ return sal_False;
+}
+
+
+sal_Bool GoNextPara( SwPaM & rPam, SwPosPara aPosPara )
+{
+ if( rPam.Move( fnMoveForward, fnGoNode ) )
+ {
+ // steht immer auf einem ContentNode !
+ SwPosition& rPos = *rPam.GetPoint();
+ SwCntntNode * pNd = rPos.nNode.GetNode().GetCntntNode();
+ rPos.nContent.Assign( pNd,
+ ::GetSttOrEnd( aPosPara == fnMoveForward, *pNd ) );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+
+
+sal_Bool GoCurrSection( SwPaM & rPam, SwMoveFn fnMove )
+{
+ SwPosition& rPos = *rPam.GetPoint();
+ SwPosition aSavePos( rPos ); // eine Vergleichsposition
+ SwNodes& rNds = aSavePos.nNode.GetNodes();
+ (rNds.*fnMove->fnSection)( &rPos.nNode );
+ SwCntntNode *pNd;
+ if( 0 == ( pNd = rPos.nNode.GetNode().GetCntntNode()) &&
+ 0 == ( pNd = (*fnMove->fnNds)( &rPos.nNode, sal_True )) )
+ {
+ rPos = aSavePos; // Cusror nicht veraendern
+ return sal_False;
+ }
+
+ rPos.nContent.Assign( pNd,
+ ::GetSttOrEnd( fnMove == fnMoveForward, *pNd ) );
+ return aSavePos != rPos;
+}
+
+
+sal_Bool GoNextSection( SwPaM & rPam, SwMoveFn fnMove )
+{
+ SwPosition& rPos = *rPam.GetPoint();
+ SwPosition aSavePos( rPos ); // eine Vergleichsposition
+ SwNodes& rNds = aSavePos.nNode.GetNodes();
+ rNds.GoEndOfSection( &rPos.nNode );
+
+ // kein weiterer ContentNode vorhanden ?
+ if( !GoInCntnt( rPam, fnMoveForward ) )
+ {
+ rPos = aSavePos; // Cusror nicht veraendern
+ return sal_False;
+ }
+ (rNds.*fnMove->fnSection)( &rPos.nNode );
+ SwCntntNode *pNd = rPos.nNode.GetNode().GetCntntNode();
+ rPos.nContent.Assign( pNd,
+ ::GetSttOrEnd( fnMove == fnMoveForward, *pNd ) );
+ return sal_True;
+}
+
+
+sal_Bool GoPrevSection( SwPaM & rPam, SwMoveFn fnMove )
+{
+ SwPosition& rPos = *rPam.GetPoint();
+ SwPosition aSavePos( rPos ); // eine Vergleichsposition
+ SwNodes& rNds = aSavePos.nNode.GetNodes();
+ rNds.GoStartOfSection( &rPos.nNode );
+
+ // kein weiterer ContentNode vorhanden ?
+ if( !GoInCntnt( rPam, fnMoveBackward ))
+ {
+ rPos = aSavePos; // Cusror nicht veraendern
+ return sal_False;
+ }
+ (rNds.*fnMove->fnSection)( &rPos.nNode );
+ SwCntntNode *pNd = rPos.nNode.GetNode().GetCntntNode();
+ rPos.nContent.Assign( pNd,
+ ::GetSttOrEnd( fnMove == fnMoveForward, *pNd ));
+ return sal_True;
+}
+
+// #111827#
+String SwPaM::GetTxt() const
+{
+ String aResult;
+
+ SwNodeIndex aNodeIndex = Start()->nNode;
+
+ /* The first node can be the end node. A first end node must be
+ handled, too. There fore do ... while and no incrementing of
+ aNodeIndex in the first pass.
+ */
+ bool bFirst = true;
+ do
+ {
+ if (! bFirst)
+ {
+ aNodeIndex++;
+ }
+
+ bFirst = false;
+
+ SwTxtNode * pTxtNode = aNodeIndex.GetNode().GetTxtNode();
+
+ if (pTxtNode != NULL)
+ {
+ const String & aTmpStr = pTxtNode->GetTxt();
+
+ if (aNodeIndex == Start()->nNode)
+ {
+ xub_StrLen nEnd;
+ if (End()->nNode == aNodeIndex)
+ nEnd = End()->nContent.GetIndex();
+ else
+ nEnd = aTmpStr.Len();
+
+ aResult += aTmpStr.Copy(Start()->nContent.GetIndex(),
+ nEnd - Start()->nContent.GetIndex()) ;
+ }
+ else if (aNodeIndex == End()->nNode)
+ aResult += aTmpStr.Copy(0, End()->nContent.GetIndex());
+ else
+ aResult += aTmpStr;
+ }
+ }
+ while (aNodeIndex != End()->nNode);
+
+ return aResult;
+}
+
+sal_Bool SwPaM::Overlap(const SwPaM & a, const SwPaM & b)
+{
+ return !(*b.End() <= *a.Start() || *a.End() <= *b.End());
+}
+
+void SwPaM::InvalidatePaM()
+{
+ const SwNode *_pNd=this->GetNode();
+ const SwTxtNode *_pTxtNd=(_pNd!=NULL?_pNd->GetTxtNode():NULL);
+ if (_pTxtNd!=NULL)
+ {
+ // pretent that the PaM marks inserted text to recalc the portion...
+ SwInsTxt aHint( Start()->nContent.GetIndex(),
+ End()->nContent.GetIndex() - Start()->nContent.GetIndex() + 1 );
+ SwModify *_pModify=(SwModify*)_pTxtNd;
+ _pModify->ModifyNotification( 0, &aHint);
+ }
+}
+
+sal_Bool SwPaM::LessThan(const SwPaM & a, const SwPaM & b)
+{
+ return (*a.Start() < *b.Start()) || (*a.Start() == *b.Start() && *a.End() < *b.End());
+}
diff --git a/sw/source/core/crsr/paminit.cxx b/sw/source/core/crsr/paminit.cxx
new file mode 100644
index 000000000000..37bd63fe224d
--- /dev/null
+++ b/sw/source/core/crsr/paminit.cxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <pamtyp.hxx>
+
+
+static SwMoveFnCollection aFwrd = {
+ /* fnNd */ &GoNext,
+ /* fnNds */ &GoNextNds,
+ /* fnDoc */ &GoEndDoc,
+ /* fnSections */ &GoEndSection,
+ /* fnCmpOp */ &SwPosition::operator<,
+ /* fnGetHint */ &GetFrwrdTxtHint,
+ /* fnSearch */ &utl::TextSearch::SearchFrwrd,
+ /* fnSection */ &SwNodes::GoStartOfSection
+};
+
+static SwMoveFnCollection aBwrd = {
+ /* fnNd */ &GoPrevious,
+ /* fnNds */ &GoPreviousNds,
+ /* fnDoc */ &GoStartDoc,
+ /* fnSections */ &GoStartSection,
+ /* fnCmpOp */ &SwPosition::operator>,
+ /* fnGetHint */ &GetBkwrdTxtHint,
+ /* fnSearch */ &utl::TextSearch::SearchBkwrd,
+ /* fnSection */ &SwNodes::GoEndOfSection
+};
+
+SwGoInDoc fnGoDoc = &GoInDoc;
+SwGoInDoc fnGoSection = &GoInSection;
+SwGoInDoc fnGoNode = &GoInNode;
+SwGoInDoc fnGoCntnt = &GoInCntnt;
+SwGoInDoc fnGoCntntCells = &GoInCntntCells;
+SwGoInDoc fnGoCntntSkipHidden = &GoInCntntSkipHidden;
+SwGoInDoc fnGoCntntCellsSkipHidden = &GoInCntntCellsSkipHidden;
+
+SwWhichPara fnParaPrev = &GoPrevPara;
+SwWhichPara fnParaCurr = &GoCurrPara;
+SwWhichPara fnParaNext = &GoNextPara;
+SwPosPara fnParaStart = &aFwrd;
+SwPosPara fnParaEnd = &aBwrd;
+
+SwWhichSection fnSectionPrev = &GoPrevSection;
+SwWhichSection fnSectionCurr = &GoCurrSection;
+SwWhichSection fnSectionNext = &GoNextSection;
+SwPosSection fnSectionStart = &aFwrd;
+SwPosSection fnSectionEnd = &aBwrd;
+
+// Travelling in Tabellen
+sal_Bool GotoPrevTable( SwPaM&, SwPosTable, sal_Bool bInReadOnly );
+sal_Bool GotoCurrTable( SwPaM&, SwPosTable, sal_Bool bInReadOnly );
+sal_Bool GotoNextTable( SwPaM&, SwPosTable, sal_Bool bInReadOnly );
+
+SwWhichTable fnTablePrev = &GotoPrevTable;
+SwWhichTable fnTableCurr = &GotoCurrTable;
+SwWhichTable fnTableNext = &GotoNextTable;
+SwPosTable fnTableStart = &aFwrd;
+SwPosTable fnTableEnd = &aBwrd;
+
+// Travelling in Bereichen
+sal_Bool GotoPrevRegion( SwPaM&, SwPosRegion, sal_Bool bInReadOnly );
+sal_Bool GotoCurrRegion( SwPaM&, SwPosRegion, sal_Bool bInReadOnly );
+sal_Bool GotoCurrRegionAndSkip( SwPaM&, SwPosRegion, sal_Bool bInReadOnly );
+sal_Bool GotoNextRegion( SwPaM&, SwPosRegion, sal_Bool bInReadOnly );
+
+SwWhichRegion fnRegionPrev = &GotoPrevRegion;
+SwWhichRegion fnRegionCurr = &GotoCurrRegion;
+SwWhichRegion fnRegionCurrAndSkip = &GotoCurrRegionAndSkip;
+SwWhichRegion fnRegionNext = &GotoNextRegion;
+SwPosRegion fnRegionStart = &aFwrd;
+SwPosRegion fnRegionEnd = &aBwrd;
+
+SwMoveFn fnMoveBackward = &aBwrd;
+SwMoveFn fnMoveForward = &aFwrd;
+
+SwWhichPara GetfnParaCurr()
+{
+ return fnParaCurr;
+}
+SwPosPara GetfnParaStart()
+{
+ return fnParaStart;
+}
+SwWhichTable GetfnTablePrev()
+{
+ return fnTablePrev;
+}
+SwPosPara GetfnParaEnd()
+{
+ return fnParaEnd;
+}
+SwPosTable GetfnTableStart()
+{
+ return fnTableStart;
+}
+SwWhichTable GetfnTableCurr()
+{
+ return fnTableCurr;
+}
+SwPosTable GetfnTableEnd()
+{
+ return fnTableEnd;
+}
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
new file mode 100755
index 000000000000..b2fe94708d4f
--- /dev/null
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -0,0 +1,2356 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <editeng/protitem.hxx>
+#include <com/sun/star/i18n/WordType.hdl>
+#include <com/sun/star/i18n/CharType.hdl>
+#include <unotools/charclass.hxx>
+#include <svl/ctloptions.hxx>
+#include <swmodule.hxx>
+#include <fmtcntnt.hxx>
+#include <swtblfmt.hxx>
+#include <swcrsr.hxx>
+#include <unocrsr.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <docary.hxx>
+#include <ndtxt.hxx>
+#include <section.hxx>
+#include <swtable.hxx>
+#include <cntfrm.hxx>
+#include <rootfrm.hxx>
+#include <txtfrm.hxx>
+#include <scriptinfo.hxx>
+#include <crstate.hxx>
+#include <docsh.hxx>
+#include <viewsh.hxx>
+#include <frmatr.hxx>
+#include <breakit.hxx>
+#include <crsskip.hxx>
+#include <vcl/msgbox.hxx>
+#include <mdiexp.hxx> // ...Percent()
+#include <statstr.hrc> // ResId fuer Statusleiste
+#include <redline.hxx> // SwRedline
+
+
+using namespace ::com::sun::star::i18n;
+
+
+static const sal_uInt16 coSrchRplcThreshold = 60000;
+
+struct _PercentHdl
+{
+ SwDocShell* pDSh;
+ sal_uLong nActPos;
+ sal_Bool bBack, bNodeIdx;
+
+ _PercentHdl( sal_uLong nStt, sal_uLong nEnd, SwDocShell* pSh )
+ : pDSh( pSh )
+ {
+ nActPos = nStt;
+ if( 0 != ( bBack = (nStt > nEnd )) )
+ {
+ sal_uLong n = nStt; nStt = nEnd; nEnd = n;
+ }
+ ::StartProgress( STR_STATSTR_SEARCH, nStt, nEnd, 0 );
+ }
+
+ _PercentHdl( const SwPaM& rPam )
+ : pDSh( (SwDocShell*)rPam.GetDoc()->GetDocShell() )
+ {
+ sal_uLong nStt, nEnd;
+ if( rPam.GetPoint()->nNode == rPam.GetMark()->nNode )
+ {
+ bNodeIdx = sal_False;
+ nStt = rPam.GetMark()->nContent.GetIndex();
+ nEnd = rPam.GetPoint()->nContent.GetIndex();
+ }
+ else
+ {
+ bNodeIdx = sal_True;
+ nStt = rPam.GetMark()->nNode.GetIndex();
+ nEnd = rPam.GetPoint()->nNode.GetIndex();
+ }
+ nActPos = nStt;
+ if( 0 != ( bBack = (nStt > nEnd )) )
+ {
+ sal_uLong n = nStt; nStt = nEnd; nEnd = n;
+ }
+ ::StartProgress( STR_STATSTR_SEARCH, nStt, nEnd, pDSh );
+ }
+
+ ~_PercentHdl() { ::EndProgress( pDSh ); }
+
+ void NextPos( sal_uLong nPos ) const
+ { ::SetProgressState( bBack ? nActPos - nPos : nPos, pDSh ); }
+
+ void NextPos( SwPosition& rPos ) const
+ {
+ sal_uLong nPos;
+ if( bNodeIdx )
+ nPos = rPos.nNode.GetIndex();
+ else
+ nPos = rPos.nContent.GetIndex();
+ ::SetProgressState( bBack ? nActPos - nPos : nPos, pDSh );
+ }
+};
+
+SwCursor::SwCursor( const SwPosition &rPos, SwPaM* pRing, bool bColumnSel )
+ : SwPaM( rPos, pRing ), pSavePos( 0 ), mnRowSpanOffset( 0 ), nCursorBidiLevel( 0 ),
+ mbColumnSelection( bColumnSel )
+{
+}
+
+// @@@ semantic: no copy ctor.
+SwCursor::SwCursor( SwCursor& rCpy )
+ : SwPaM( rCpy ), pSavePos( 0 ), mnRowSpanOffset( rCpy.mnRowSpanOffset ),
+ nCursorBidiLevel( rCpy.nCursorBidiLevel ), mbColumnSelection( rCpy.mbColumnSelection )
+{
+}
+
+SwCursor::~SwCursor()
+{
+ while( pSavePos )
+ {
+ _SwCursor_SavePos* pNxt = pSavePos->pNext;
+ delete pSavePos;
+ pSavePos = pNxt;
+ }
+}
+
+SwCursor* SwCursor::Create( SwPaM* pRing ) const
+{
+ return new SwCursor( *GetPoint(), pRing, false );
+}
+
+bool SwCursor::IsReadOnlyAvailable() const
+{
+ return false;
+}
+
+sal_Bool SwCursor::IsSkipOverHiddenSections() const
+{
+ return sal_True;
+}
+
+sal_Bool SwCursor::IsSkipOverProtectSections() const
+{
+ return !IsReadOnlyAvailable();
+}
+
+
+// Sicher die aktuelle Position, damit ggfs. auf diese zurueck
+// gefallen werden kann. Die SavePos Objekte werden als Stack verwaltet,
+// damit das auch alles bei verschachtelten Aufrufen funktioniert.
+// Das CreateNewSavePos ist virtual, damit abgeleitete Klassen vom Cursor
+// gegebenenfalls eigene SaveObjecte anlegen und in den virtuellen
+// Check-Routinen verwenden koennen.
+
+void SwCursor::SaveState()
+{
+ _SwCursor_SavePos* pNew = CreateNewSavePos();
+ pNew->pNext = pSavePos;
+ pSavePos = pNew;
+}
+
+void SwCursor::RestoreState()
+{
+ if( pSavePos ) // Robust
+ {
+ _SwCursor_SavePos* pDel = pSavePos;
+ pSavePos = pSavePos->pNext;
+ delete pDel;
+ }
+}
+
+_SwCursor_SavePos* SwCursor::CreateNewSavePos() const
+{
+ return new _SwCursor_SavePos( *this );
+}
+
+// stelle fest, ob sich der Point ausserhalb des Content-Bereichs
+// vom Nodes-Array befindet
+sal_Bool SwCursor::IsNoCntnt() const
+{
+ return GetPoint()->nNode.GetIndex() <
+ 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, sal_True ))
+ {
+ GetPoint()->nNode = aOldPos;
+ GetPoint()->nContent.Assign( GetCntntNode(), GetSavePos()->nCntnt );
+ return true;
+ }
+ }
+ return SwCursor::IsSelOvrCheck(eFlags);
+}
+
+sal_Bool SwCursor::IsSelOvr( int eFlags )
+{
+ SwDoc* pDoc = GetDoc();
+ SwNodes& rNds = pDoc->GetNodes();
+
+ sal_Bool bSkipOverHiddenSections = IsSkipOverHiddenSections();
+ sal_Bool bSkipOverProtectSections = IsSkipOverProtectSections();
+
+ if ( IsSelOvrCheck( eFlags ) )
+ {
+ return sal_True;
+ }
+
+// neu: Bereiche ueberpruefen
+// Anfang
+ if( pSavePos->nNode != GetPoint()->nNode.GetIndex() &&
+ //JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt
+ ( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() ))
+ {
+ // teste doch mal die neuen Sections:
+ SwNodeIndex& rPtIdx = GetPoint()->nNode;
+ const SwSectionNode* pSectNd = rPtIdx.GetNode().FindSectionNode();
+ if( pSectNd &&
+ ((bSkipOverHiddenSections && pSectNd->GetSection().IsHiddenFlag() ) ||
+ (bSkipOverProtectSections && pSectNd->GetSection().IsProtectFlag() )))
+ {
+ if( 0 == ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) )
+ {
+ // dann wars das schon
+ RestoreSavePos();
+ return sal_True;
+ }
+
+ // dann setze den Cursor auf die neue Position:
+ SwNodeIndex aIdx( rPtIdx );
+ xub_StrLen nCntntPos = pSavePos->nCntnt;
+ int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
+ SwCntntNode* pCNd = bGoNxt
+ ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections)
+ : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
+ if( !pCNd && ( nsSwCursorSelOverFlags::SELOVER_ENABLEREVDIREKTION & eFlags ))
+ {
+ bGoNxt = !bGoNxt;
+ pCNd = bGoNxt ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections)
+ : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
+ }
+
+ int bIsValidPos = 0 != pCNd;
+ sal_Bool bValidNodesRange = bIsValidPos &&
+ ::CheckNodesRange( rPtIdx, aIdx, sal_True );
+ if( !bValidNodesRange )
+ {
+ rPtIdx = pSavePos->nNode;
+ if( 0 == ( pCNd = rPtIdx.GetNode().GetCntntNode() ) )
+ {
+ bIsValidPos = sal_False;
+ nCntntPos = 0;
+ rPtIdx = aIdx;
+ if( 0 == ( pCNd = rPtIdx.GetNode().GetCntntNode() ) )
+ {
+ // dann auf den Anfang vom Doc
+ rPtIdx = rNds.GetEndOfExtras();
+ pCNd = rNds.GoNext( &rPtIdx );
+ }
+ }
+ }
+
+ // ContentIndex noch anmelden:
+ xub_StrLen nTmpPos = bIsValidPos ? (bGoNxt ? 0 : pCNd->Len()) : nCntntPos;
+ GetPoint()->nContent.Assign( pCNd, nTmpPos );
+ if( !bIsValidPos || !bValidNodesRange ||
+ // sollten wir in einer Tabelle gelandet sein?
+ IsInProtectTable( sal_True ) )
+ return sal_True;
+ }
+
+ // oder sollte eine geschuetzte Section innerhalb der Selektion liegen?
+ if( HasMark() && bSkipOverProtectSections)
+ {
+ sal_uLong nSttIdx = GetMark()->nNode.GetIndex(),
+ nEndIdx = GetPoint()->nNode.GetIndex();
+ if( nEndIdx <= nSttIdx )
+ {
+ sal_uLong nTmp = nSttIdx;
+ nSttIdx = nEndIdx;
+ nEndIdx = nTmp;
+ }
+
+ const SwSectionFmts& rFmts = pDoc->GetSections();
+ for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSectionFmt* pFmt = rFmts[n];
+ const SvxProtectItem& rProtect = pFmt->GetProtect();
+ if( rProtect.IsCntntProtected() )
+ {
+ const SwFmtCntnt& rCntnt = pFmt->GetCntnt(sal_False);
+ ASSERT( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" );
+ sal_uLong nIdx = rCntnt.GetCntntIdx()->GetIndex();
+ if( nSttIdx <= nIdx && nEndIdx >= nIdx )
+ {
+ // ist es keine gelinkte Section, dann kann sie auch
+ // nicht mitselektiert werden
+ const SwSection& rSect = *pFmt->GetSection();
+ if( CONTENT_SECTION == rSect.GetType() )
+ {
+ RestoreSavePos();
+ return sal_True;
+ }
+ }
+ }
+ }
+ }
+
+ }
+// Ende
+// neu: Bereiche ueberpruefen
+
+ const SwNode* pNd = &GetPoint()->nNode.GetNode();
+ if( pNd->IsCntntNode() && !dynamic_cast<SwUnoCrsr*>(this) )
+ {
+ const SwCntntFrm* pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() );
+ if( pFrm && pFrm->IsValid() && 0 == pFrm->Frm().Height() &&
+ 0 != ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) )
+ {
+ // skip to the next / prev valid paragraph with a layout
+ SwNodeIndex& rPtIdx = GetPoint()->nNode;
+ int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
+ while( 0 != ( pFrm = ( bGoNxt ? pFrm->GetNextCntntFrm()
+ : pFrm->GetPrevCntntFrm() )) &&
+ 0 == pFrm->Frm().Height() )
+ ;
+
+ // --> LIJIAN/FME 2007-11-27 #i72394# skip to prev /next valid paragraph
+ // with a layout in case the first search did not succeed:
+ if( !pFrm )
+ {
+ bGoNxt = !bGoNxt;
+ pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() );
+ while ( pFrm && 0 == pFrm->Frm().Height() )
+ {
+ pFrm = bGoNxt ? pFrm->GetNextCntntFrm()
+ : pFrm->GetPrevCntntFrm();
+ }
+ }
+ // <--
+
+ SwCntntNode* pCNd;
+ if( pFrm && 0 != (pCNd = (SwCntntNode*)pFrm->GetNode()) )
+ {
+ // set this cntntNode as new position
+ rPtIdx = *pCNd;
+ pNd = pCNd;
+
+ // ContentIndex noch anmelden:
+ xub_StrLen nTmpPos = bGoNxt ? 0 : pCNd->Len();
+ GetPoint()->nContent.Assign( pCNd, nTmpPos );
+
+ // sollten wir in einer Tabelle gelandet sein?
+ if( IsInProtectTable( sal_True ) )
+ pFrm = 0;
+ }
+ }
+
+ if( !pFrm )
+ {
+ DeleteMark();
+ RestoreSavePos();
+ return sal_True; // ohne Frames geht gar nichts!
+ }
+ }
+
+ // darf der Cursor in geschuetzen "Nodes" stehen?
+ if( 0 == ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) && !IsAtValidPos() )
+ {
+ DeleteMark();
+ RestoreSavePos();
+ return sal_True;
+ }
+
+ if( !HasMark() )
+ return sal_False;
+
+ //JP 19.08.98: teste mal auf ungueltige Selektion - sprich ueber
+ // GrundSections:
+ if( !::CheckNodesRange( GetMark()->nNode, GetPoint()->nNode, sal_True ))
+ {
+ DeleteMark();
+ RestoreSavePos();
+ return sal_True; // ohne Frames geht gar nichts!
+ }
+
+ const SwTableNode* pPtNd = pNd->FindTableNode();
+
+ if( (pNd = &GetMark()->nNode.GetNode())->IsCntntNode() &&
+ !((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() ) && !dynamic_cast<SwUnoCrsr*>(this) )
+ {
+ DeleteMark();
+ RestoreSavePos();
+ return sal_True; // ohne Frames geht gar nichts!
+ }
+
+ const SwTableNode* pMrkNd = pNd->FindTableNode();
+
+ // beide in keinem oder beide im gleichen TableNode
+ if( ( !pMrkNd && !pPtNd ) || pPtNd == pMrkNd )
+ return sal_False;
+
+ // in unterschiedlichen Tabellen oder nur Mark in der Tabelle
+ if( ( pPtNd && pMrkNd ) || pMrkNd )
+ { // dann lasse das nicht zu, alte Pos zurueck
+ RestoreSavePos();
+ // Crsr bleibt an der alten Position
+ return sal_True;
+ }
+
+ // ACHTUNG: dieses kann nicht im TableMode geschehen !!
+ if( pPtNd ) // nur Point in Tabelle, dann gehe hinter/vor diese
+ {
+ if( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags )
+ {
+ sal_Bool bSelTop = GetPoint()->nNode.GetIndex() <
+ (( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags ) ? pSavePos->nNode
+ : GetMark()->nNode.GetIndex());
+
+ do {
+ // in Schleife fuer Tabelle hinter Tabelle
+ sal_uLong nSEIdx = pPtNd->EndOfSectionIndex();
+ sal_uLong nSttEndTbl = nSEIdx + 1; // dflt. Sel. nach unten
+
+ if( bSelTop ) // Sel. nach oben
+ nSttEndTbl = rNds[ nSEIdx ]->StartOfSectionIndex() - 1;
+
+ GetPoint()->nNode = nSttEndTbl;
+ const SwNode* pMyNd = GetNode();
+
+ if( pMyNd->IsSectionNode() || ( pMyNd->IsEndNode() &&
+ pMyNd->StartOfSectionNode()->IsSectionNode() ) )
+ {
+ // die lassen wir zu:
+ pMyNd = bSelTop
+ ? rNds.GoPrevSection( &GetPoint()->nNode,sal_True,sal_False )
+ : rNds.GoNextSection( &GetPoint()->nNode,sal_True,sal_False );
+
+ /* #i12312# Handle failure of Go{Prev|Next}Section */
+ if ( 0 == pMyNd)
+ break;
+
+ if( 0 != ( pPtNd = pMyNd->FindTableNode() ))
+ continue;
+ }
+
+ if( pMyNd->IsCntntNode() && // ist es ein ContentNode ??
+ ::CheckNodesRange( GetMark()->nNode,
+ GetPoint()->nNode, sal_True ))
+ {
+ // TABLE IN TABLE
+ const SwTableNode* pOuterTableNd = pMyNd->FindTableNode();
+ if ( pOuterTableNd )
+ pMyNd = pOuterTableNd;
+ else
+ {
+ SwCntntNode* pCNd = (SwCntntNode*)pMyNd;
+ xub_StrLen nTmpPos = bSelTop ? pCNd->Len() : 0;
+ GetPoint()->nContent.Assign( pCNd, nTmpPos );
+ return sal_False;
+ }
+ }
+ if( bSelTop
+ ? ( !pMyNd->IsEndNode() || 0 == ( pPtNd = pMyNd->FindTableNode() ))
+ : 0 == ( pPtNd = pMyNd->GetTableNode() ))
+ break;
+ } while( sal_True );
+ }
+
+ // dann verbleibe auf der alten Position
+ RestoreSavePos();
+ return sal_True; // Crsr bleibt an der alten Position
+ }
+ return sal_False; // was bleibt noch ??
+}
+
+#if defined( UNX )
+#define IDX (*pCellStt)
+#else
+#define IDX aCellStt
+#endif
+
+
+sal_Bool SwCursor::IsInProtectTable( sal_Bool bMove, sal_Bool bChgCrsr )
+{
+ SwCntntNode* pCNd = GetCntntNode();
+ if( !pCNd )
+ return sal_False;
+
+ // No table, no protected cell:
+ const SwTableNode* pTableNode = pCNd->FindTableNode();
+ if ( !pTableNode )
+ return sal_False;
+
+ // Current position == last save position?
+ if ( pSavePos->nNode == GetPoint()->nNode.GetIndex() )
+ return sal_False;
+
+ // Check for convered cell:
+ bool bInCoveredCell = false;
+ const SwStartNode* pTmpSttNode = pCNd->FindTableBoxStartNode();
+ ASSERT( pTmpSttNode, "In table, therefore I expect to get a SwTableBoxStartNode" )
+ const SwTableBox* pBox = pTmpSttNode ? pTableNode->GetTable().GetTblBox( pTmpSttNode->GetIndex() ) : 0; //Robust #151355
+ if ( pBox && pBox->getRowSpan() < 1 ) // Robust #151270
+ bInCoveredCell = true;
+
+ // Positions of covered cells are not acceptable:
+ if ( !bInCoveredCell )
+ {
+ // Position not protected?
+ if ( !pCNd->IsProtect() )
+ return sal_False;
+
+ // Cursor in protected cells allowed?
+ if ( IsReadOnlyAvailable() )
+ return sal_False;
+ }
+
+ // If we reach this point, we are in a protected or covered table cell!
+
+ if( !bMove )
+ {
+ if( bChgCrsr )
+ // restore the last save position
+ RestoreSavePos();
+ return sal_True; // Crsr bleibt an der alten Position
+ }
+
+ // wir stehen in einer geschuetzten TabellenZelle
+ // von Oben nach Unten Traveln ?
+ if( pSavePos->nNode < GetPoint()->nNode.GetIndex() )
+ {
+ // suche die naechste "gueltige" Box
+
+ // folgt nach dem EndNode der Zelle ein weiterer StartNode, dann
+ // gibt es auch eine naechste Zelle
+#if defined( UNX )
+ SwNodeIndex* pCellStt = new SwNodeIndex( *GetNode()->
+ FindTableBoxStartNode()->EndOfSectionNode(), 1 );
+#else
+ SwNodeIndex aCellStt( *GetNode()->FindTableBoxStartNode()->EndOfSectionNode(), 1 );
+#endif
+ sal_Bool bProt = sal_True;
+GoNextCell:
+ do {
+ if( !IDX.GetNode().IsStartNode() )
+ break;
+ IDX++;
+ if( 0 == ( pCNd = IDX.GetNode().GetCntntNode() ))
+ pCNd = IDX.GetNodes().GoNext( &IDX );
+ if( 0 == ( bProt = pCNd->IsProtect() ))
+ break;
+ IDX.Assign( *pCNd->FindTableBoxStartNode()->EndOfSectionNode(), 1 );
+ } while( bProt );
+
+SetNextCrsr:
+ if( !bProt ) // eine freie Zelle gefunden
+ {
+ GetPoint()->nNode = IDX;
+#if defined( UNX )
+ delete pCellStt;
+#endif
+ SwCntntNode* pTmpCNd = GetCntntNode();
+ if( pTmpCNd )
+ {
+ GetPoint()->nContent.Assign( pTmpCNd, 0 );
+ return sal_False;
+ }
+ return IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
+ }
+ // am Ende der Tabelle, also setze hinter diese
+ IDX++; // auf den naechsten Node
+ SwNode* pNd;
+ if( ( pNd = &IDX.GetNode())->IsEndNode() || HasMark())
+ {
+ // Tabelle allein in einem FlyFrame oder SSelection,
+ // dann verbleibe auf der alten Position
+ if( bChgCrsr )
+ RestoreSavePos();
+#if defined( UNX )
+ delete pCellStt;
+#endif
+ return sal_True; // Crsr bleibt an der alten Position
+ }
+ else if( pNd->IsTableNode() && IDX++ )
+ goto GoNextCell;
+
+ bProt = sal_False; // Index steht jetzt auf einem ContentNode
+ goto SetNextCrsr;
+ }
+
+ // suche die vorherige "gueltige" Box
+ {
+ // liegt vor dem StartNode der Zelle ein weiterer EndNode, dann
+ // gibt es auch eine vorherige Zelle
+#if defined( UNX )
+ SwNodeIndex* pCellStt = new SwNodeIndex(
+ *GetNode()->FindTableBoxStartNode(), -1 );
+#else
+ SwNodeIndex aCellStt( *GetNode()->FindTableBoxStartNode(), -1 );
+#endif
+ SwNode* pNd;
+ sal_Bool bProt = sal_True;
+GoPrevCell:
+ do {
+ if( !( pNd = &IDX.GetNode())->IsEndNode() )
+ break;
+ IDX.Assign( *pNd->StartOfSectionNode(), +1 );
+ if( 0 == ( pCNd = IDX.GetNode().GetCntntNode() ))
+ pCNd = pNd->GetNodes().GoNext( &IDX );
+ if( 0 == ( bProt = pCNd->IsProtect() ))
+ break;
+ IDX.Assign( *pNd->FindTableBoxStartNode(), -1 );
+ } while( bProt );
+
+SetPrevCrsr:
+ if( !bProt ) // eine freie Zelle gefunden
+ {
+ GetPoint()->nNode = IDX;
+#if defined( UNX )
+ delete pCellStt;
+#endif
+ SwCntntNode* pTmpCNd = GetCntntNode();
+ if( pTmpCNd )
+ {
+ GetPoint()->nContent.Assign( pTmpCNd, 0 );
+ return sal_False;
+ }
+ return IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
+ }
+ // am Start der Tabelle, also setze vor diese
+ IDX--; // auf den naechsten Node
+ if( ( pNd = &IDX.GetNode())->IsStartNode() || HasMark() )
+ {
+ // Tabelle allein in einem FlyFrame oder Selektion,
+ // dann verbleibe auf der alten Position
+ if( bChgCrsr )
+ RestoreSavePos();
+#if defined( UNX )
+ delete pCellStt;
+#endif
+ return sal_True; // Crsr bleibt an der alten Position
+ }
+ else if( pNd->StartOfSectionNode()->IsTableNode() && IDX-- )
+ goto GoPrevCell;
+
+ bProt = sal_False; // Index steht jetzt auf einem ContentNode
+ goto SetPrevCrsr;
+ }
+}
+
+// sal_True: an die Position kann der Cursor gesetzt werden
+sal_Bool SwCursor::IsAtValidPos( sal_Bool bPoint ) const
+{
+ const SwDoc* pDoc = GetDoc();
+ const SwPosition* pPos = bPoint ? GetPoint() : GetMark();
+ const SwNode* pNd = &pPos->nNode.GetNode();
+
+ if( pNd->IsCntntNode() && !((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() ) &&
+ !dynamic_cast<const SwUnoCrsr*>(this) )
+ {
+ return sal_False;
+ }
+
+ //JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt
+ if( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() )
+ return sal_True;
+
+ sal_Bool bCrsrInReadOnly = IsReadOnlyAvailable();
+ if( !bCrsrInReadOnly && pNd->IsProtect() )
+ return sal_False;
+
+ const SwSectionNode* pSectNd = pNd->FindSectionNode();
+ if( pSectNd && (pSectNd->GetSection().IsHiddenFlag() ||
+ ( !bCrsrInReadOnly && pSectNd->GetSection().IsProtectFlag() )))
+ return sal_False;
+
+ return sal_True;
+}
+
+void SwCursor::SaveTblBoxCntnt( const SwPosition* ) {}
+
+// setze den SRange fuer das Suchen im Dokument
+SwMoveFnCollection* SwCursor::MakeFindRange( SwDocPositions nStart,
+ SwDocPositions nEnd, SwPaM* pRange ) const
+{
+ pRange->SetMark();
+ FillFindPos( nStart, *pRange->GetMark() );
+ FillFindPos( nEnd, *pRange->GetPoint() );
+
+ // bestimme die Richtung, in der zu suchen ist
+ // ( GetPoint > GetMark -> vorwaerts, sonst rueckwaerts )
+ return ( DOCPOS_START == nStart || DOCPOS_OTHERSTART == nStart ||
+ (DOCPOS_CURR == nStart &&
+ (DOCPOS_END == nEnd || DOCPOS_OTHEREND == nEnd ) ))
+ ? fnMoveForward : fnMoveBackward;
+}
+
+
+sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
+ SwMoveFn fnMove, SwCursor*& pFndRing,
+ SwPaM& aRegion, FindRanges eFndRngs,
+ sal_Bool bInReadOnly, sal_Bool& bCancel )
+{
+ SwDoc* pDoc = pCurCrsr->GetDoc();
+ bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo();
+ int nFndRet = 0;
+ sal_uLong nFound = 0;
+ int bSrchBkwrd = fnMove == fnMoveBackward, bEnde = sal_False;
+ SwPaM *pTmpCrsr = pCurCrsr, *pSaveCrsr = pCurCrsr;
+
+ // only create progress-bar for ShellCrsr
+ bool bIsUnoCrsr = 0 != dynamic_cast<SwUnoCrsr*>(pCurCrsr);
+ _PercentHdl* pPHdl = 0;
+ sal_uInt16 nCrsrCnt = 0;
+ if( FND_IN_SEL & eFndRngs )
+ {
+ while( pCurCrsr != ( pTmpCrsr = (SwPaM*)pTmpCrsr->GetNext() ))
+ ++nCrsrCnt;
+ if( nCrsrCnt && !bIsUnoCrsr )
+ pPHdl = new _PercentHdl( 0, nCrsrCnt, pDoc->GetDocShell() );
+ }
+ else
+ pSaveCrsr = (SwPaM*)pSaveCrsr->GetPrev();
+
+ do {
+ aRegion.SetMark();
+ // egal in welche Richtung, SPoint ist immer groesser als Mark,
+ // wenn der Suchbereich gueltig ist !!
+ SwPosition *pSttPos = aRegion.GetMark(),
+ *pEndPos = aRegion.GetPoint();
+ *pSttPos = *pTmpCrsr->Start();
+ *pEndPos = *pTmpCrsr->End();
+ if( bSrchBkwrd )
+ aRegion.Exchange();
+
+ if( !nCrsrCnt && !pPHdl && !bIsUnoCrsr )
+ pPHdl = new _PercentHdl( aRegion );
+
+ // solange gefunden und nicht auf gleicher Position haengen bleibt
+ while( *pSttPos <= *pEndPos &&
+ 0 != ( nFndRet = rParas.Find( pCurCrsr, fnMove,
+ &aRegion, bInReadOnly )) &&
+ ( !pFndRing ||
+ *pFndRing->GetPoint() != *pCurCrsr->GetPoint() ||
+ *pFndRing->GetMark() != *pCurCrsr->GetMark() ))
+ {
+ if( !( FIND_NO_RING & nFndRet ))
+ {
+ // Bug 24084: Ring richtig herum aufbauen -> gleiche Mimik
+ // wie beim CreateCrsr !!!!
+
+ SwCursor* pNew = pCurCrsr->Create( pFndRing );
+ if( !pFndRing )
+ pFndRing = pNew;
+
+ pNew->SetMark();
+ *pNew->GetMark() = *pCurCrsr->GetMark();
+ }
+
+ ++nFound;
+
+ if( !( eFndRngs & FND_IN_SELALL) )
+ {
+ bEnde = sal_True;
+ break;
+ }
+
+ if ((coSrchRplcThreshold == nFound)
+ && pDoc->GetIDocumentUndoRedo().DoesUndo()
+ && rParas.IsReplaceMode())
+ {
+ short nRet = pCurCrsr->MaxReplaceArived();
+ if( RET_YES == nRet )
+ {
+ pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
+ pDoc->GetIDocumentUndoRedo().DoUndo(false);
+ }
+ else
+ {
+ bEnde = sal_True;
+ if(RET_CANCEL == nRet)
+ {
+ bCancel = sal_True;
+ //unwind() ??
+ }
+ break;
+ }
+ }
+
+ if( bSrchBkwrd )
+ // bewege pEndPos vor den gefundenen Bereich
+ *pEndPos = *pCurCrsr->Start();
+ else
+ // bewege pSttPos hinter den gefundenen Bereich
+ *pSttPos = *pCurCrsr->End();
+
+ if( *pSttPos == *pEndPos ) // im Bereich, aber am Ende
+ break; // fertig
+
+ if( !nCrsrCnt && pPHdl )
+ {
+ pPHdl->NextPos( *aRegion.GetMark() );
+ }
+ }
+
+ if( bEnde || !( eFndRngs & ( FND_IN_SELALL | FND_IN_SEL )) )
+ break;
+
+ pTmpCrsr = ((SwPaM*)pTmpCrsr->GetNext());
+ if( nCrsrCnt && pPHdl )
+ {
+ pPHdl->NextPos( ++pPHdl->nActPos );
+ }
+
+ } while( pTmpCrsr != pSaveCrsr );
+
+ if( nFound && !pFndRing ) // falls kein Ring aufgebaut werden soll
+ pFndRing = pCurCrsr->Create();
+
+ delete pPHdl;
+ pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo);
+ return nFound;
+}
+
+
+int lcl_MakeSelFwrd( const SwNode& rSttNd, const SwNode& rEndNd,
+ SwPaM& rPam, int bFirst )
+{
+ if( rSttNd.GetIndex() + 1 == rEndNd.GetIndex() )
+ return sal_False;
+
+ SwNodes& rNds = rPam.GetDoc()->GetNodes();
+ rPam.DeleteMark();
+ SwCntntNode* pCNd;
+ if( !bFirst )
+ {
+ rPam.GetPoint()->nNode = rSttNd;
+ pCNd = rNds.GoNext( &rPam.GetPoint()->nNode );
+ if( !pCNd )
+ return sal_False;
+ pCNd->MakeStartIndex( &rPam.GetPoint()->nContent );
+ }
+ else if( rSttNd.GetIndex() > rPam.GetPoint()->nNode.GetIndex() ||
+ rPam.GetPoint()->nNode.GetIndex() >= rEndNd.GetIndex() )
+ return sal_False; // steht nicht in dieser Section
+
+ rPam.SetMark();
+ rPam.GetPoint()->nNode = rEndNd;
+ pCNd = rNds.GoPrevious( &rPam.GetPoint()->nNode );
+ if( !pCNd )
+ return sal_False;
+ pCNd->MakeEndIndex( &rPam.GetPoint()->nContent );
+
+ return *rPam.GetMark() < *rPam.GetPoint();
+}
+
+
+int lcl_MakeSelBkwrd( const SwNode& rSttNd, const SwNode& rEndNd,
+ SwPaM& rPam, int bFirst )
+{
+ if( rEndNd.GetIndex() + 1 == rSttNd.GetIndex() )
+ return sal_False;
+
+ SwNodes& rNds = rPam.GetDoc()->GetNodes();
+ rPam.DeleteMark();
+ SwCntntNode* pCNd;
+ if( !bFirst )
+ {
+ rPam.GetPoint()->nNode = rSttNd;
+ pCNd = rNds.GoPrevious( &rPam.GetPoint()->nNode );
+ if( !pCNd )
+ return sal_False;
+ pCNd->MakeEndIndex( &rPam.GetPoint()->nContent );
+ }
+ else if( rEndNd.GetIndex() > rPam.GetPoint()->nNode.GetIndex() ||
+ rPam.GetPoint()->nNode.GetIndex() >= rSttNd.GetIndex() )
+ return sal_False; // steht nicht in dieser Section
+
+ rPam.SetMark();
+ rPam.GetPoint()->nNode = rEndNd;
+ pCNd = rNds.GoNext( &rPam.GetPoint()->nNode );
+ if( !pCNd )
+ return sal_False;
+ pCNd->MakeStartIndex( &rPam.GetPoint()->nContent );
+
+ return *rPam.GetPoint() < *rPam.GetMark();
+}
+
+
+// diese Methode "sucht" fuer alle Anwendungsfaelle, denn in SwFindParas
+// steht immer die richtigen Parameter und die entsprechende Find-Methode
+
+sal_uLong SwCursor::FindAll( SwFindParas& rParas,
+ SwDocPositions nStart, SwDocPositions nEnde,
+ FindRanges eFndRngs, sal_Bool& bCancel )
+{
+ bCancel = sal_False;
+ SwCrsrSaveState aSaveState( *this );
+
+ // Region erzeugen, ohne das diese in den Ring aufgenommen wird !
+ SwPaM aRegion( *GetPoint() );
+ SwMoveFn fnMove = MakeFindRange( nStart, nEnde, &aRegion );
+
+ sal_uLong nFound = 0;
+ int bMvBkwrd = fnMove == fnMoveBackward;
+ sal_Bool bInReadOnly = IsReadOnlyAvailable();
+
+ SwCursor* pFndRing = 0;
+ SwNodes& rNds = GetDoc()->GetNodes();
+
+ // suche in Bereichen ?
+ if( FND_IN_SEL & eFndRngs )
+ {
+ // String nicht im Bereich gefunden, dann erhalte alle Bereiche,
+ // der Cursor beleibt unveraendert
+ if( 0 == ( nFound = lcl_FindSelection( rParas, this, fnMove,
+ pFndRing, aRegion, eFndRngs,
+ bInReadOnly, bCancel ) ))
+ return nFound;
+
+ // der String wurde ein- bis mehrmals gefunden. Das steht alles
+ // im neuen Crsr-Ring. Darum hebe erstmal den alten Ring auf
+ while( GetNext() != this )
+ delete GetNext();
+
+ *GetPoint() = *pFndRing->GetPoint();
+ SetMark();
+ *GetMark() = *pFndRing->GetMark();
+ pFndRing->MoveRingTo( this );
+ delete pFndRing;
+ }
+ else if( FND_IN_OTHER & eFndRngs )
+ {
+ // Cursor als Kopie vom akt. und in den Ring aufnehmen
+ // Verkettung zeigt immer auf den zuerst erzeugten, also vorwaerts
+ std::auto_ptr< SwCursor > pSav( Create( this ) ); // save the current cursor
+
+ // wenn schon ausserhalb vom Bodytext, suche von der Position,
+ // ansonsten beginne mit der 1. GrundSection
+ if( bMvBkwrd
+ ? lcl_MakeSelBkwrd( rNds.GetEndOfExtras(),
+ *rNds.GetEndOfPostIts().StartOfSectionNode(),
+ *this, rNds.GetEndOfExtras().GetIndex() >=
+ GetPoint()->nNode.GetIndex() )
+ : lcl_MakeSelFwrd( *rNds.GetEndOfPostIts().StartOfSectionNode(),
+ rNds.GetEndOfExtras(), *this,
+ rNds.GetEndOfExtras().GetIndex() >=
+ GetPoint()->nNode.GetIndex() ))
+ {
+ nFound = lcl_FindSelection( rParas, this, fnMove, pFndRing,
+ aRegion, eFndRngs, bInReadOnly, bCancel );
+ }
+
+ if( !nFound )
+ {
+ // den alten wieder zurueck
+ *GetPoint() = *pSav->GetPoint();
+ if( pSav->HasMark() )
+ {
+ SetMark();
+ *GetMark() = *pSav->GetMark();
+ }
+ else
+ DeleteMark();
+ return 0;
+ }
+ pSav.release();
+
+ if( !( FND_IN_SELALL & eFndRngs ))
+ {
+ // es sollte nur einer gesucht werden, also fuege in dazu
+ // egal in welche Richtung, SPoint ist immer groesser als Mark,
+ // wenn der Suchbereich gueltig ist !!
+ *GetPoint() = *pFndRing->GetPoint();
+ SetMark();
+ *GetMark() = *pFndRing->GetMark();
+ }
+ else
+ {
+ // es wurde ein- bis mehrmals gefunden. Das steht alles
+ // im neuen Crsr-Ring. Darum hebe erstmal den alten Ring auf
+ while( GetNext() != this )
+ delete GetNext();
+
+ *GetPoint() = *pFndRing->GetPoint();
+ SetMark();
+ *GetMark() = *pFndRing->GetMark();
+ pFndRing->MoveRingTo( this );
+ }
+ delete pFndRing;
+ }
+ else if( FND_IN_SELALL & eFndRngs )
+ {
+ ::std::auto_ptr< SwCursor> pSav( Create( this ) ); // save the current cursor
+
+ const SwNode* pSttNd = ( FND_IN_BODYONLY & eFndRngs )
+ ? rNds.GetEndOfContent().StartOfSectionNode()
+ : rNds.GetEndOfPostIts().StartOfSectionNode();
+
+ if( bMvBkwrd
+ ? lcl_MakeSelBkwrd( rNds.GetEndOfContent(), *pSttNd,*this, sal_False )
+ : lcl_MakeSelFwrd( *pSttNd, rNds.GetEndOfContent(), *this, sal_False ))
+ {
+ nFound = lcl_FindSelection( rParas, this, fnMove, pFndRing,
+ aRegion, eFndRngs, bInReadOnly, bCancel );
+ }
+
+ if( !nFound )
+ {
+ // den alten wieder zurueck
+ *GetPoint() = *pSav->GetPoint();
+ if( pSav->HasMark() )
+ {
+ SetMark();
+ *GetMark() = *pSav->GetMark();
+ }
+ else
+ DeleteMark();
+ return 0;
+ }
+ pSav.release();
+ while( GetNext() != this )
+ delete GetNext();
+
+ *GetPoint() = *pFndRing->GetPoint();
+ SetMark();
+ *GetMark() = *pFndRing->GetMark();
+ pFndRing->MoveRingTo( this );
+ delete pFndRing;
+ }
+ else
+ {
+ // ist ein GetMark gesetzt, dann wird bei gefundenem Object
+ // der GetMark beibehalten !! Dadurch kann ein Bereich mit der Suche
+ // aufgespannt werden.
+ SwPosition aMarkPos( *GetMark() );
+ int bMarkPos = HasMark() && !eFndRngs;
+
+ if( 0 != (nFound = rParas.Find( this, fnMove,
+ &aRegion, bInReadOnly ) ? 1 : 0)
+ && bMarkPos )
+ *GetMark() = aMarkPos;
+ }
+
+ if( nFound && SwCursor::IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE ) )
+ nFound = 0;
+ return nFound;
+}
+
+
+void SwCursor::FillFindPos( SwDocPositions ePos, SwPosition& rPos ) const
+{
+ sal_Bool bIsStart = sal_True;
+ SwCntntNode* pCNd = 0;
+ SwNodes& rNds = GetDoc()->GetNodes();
+
+ switch( ePos )
+ {
+ case DOCPOS_START:
+ rPos.nNode = *rNds.GetEndOfContent().StartOfSectionNode();
+ pCNd = rNds.GoNext( &rPos.nNode );
+ break;
+
+ case DOCPOS_END:
+ rPos.nNode = rNds.GetEndOfContent();
+ pCNd = rNds.GoPrevious( &rPos.nNode );
+ bIsStart = sal_False;
+ break;
+
+ case DOCPOS_OTHERSTART:
+ rPos.nNode = *rNds[ sal_uLong(0) ];
+ pCNd = rNds.GoNext( &rPos.nNode );
+ break;
+
+ case DOCPOS_OTHEREND:
+ rPos.nNode = *rNds.GetEndOfContent().StartOfSectionNode();
+ pCNd = rNds.GoPrevious( &rPos.nNode );
+ bIsStart = sal_False;
+ break;
+
+// case DOCPOS_CURR:
+ default:
+ rPos = *GetPoint();
+ }
+
+ if( pCNd )
+ {
+ xub_StrLen nCPos = 0;
+ if( !bIsStart )
+ nCPos = pCNd->Len();
+ rPos.nContent.Assign( pCNd, nCPos );
+ }
+}
+
+short SwCursor::MaxReplaceArived()
+{
+ return RET_YES;
+}
+
+
+sal_Bool SwCursor::IsStartWord( sal_Int16 nWordType ) const
+{
+ return IsStartWordWT( nWordType );
+}
+
+sal_Bool SwCursor::IsEndWord( sal_Int16 nWordType ) const
+{
+ return IsEndWordWT( nWordType );
+}
+
+sal_Bool SwCursor::IsInWord( sal_Int16 nWordType ) const
+{
+ return IsInWordWT( nWordType );
+}
+
+sal_Bool SwCursor::GoStartWord()
+{
+ return GoStartWordWT( WordType::ANYWORD_IGNOREWHITESPACES );
+}
+
+sal_Bool SwCursor::GoEndWord()
+{
+ return GoEndWordWT( WordType::ANYWORD_IGNOREWHITESPACES );
+}
+
+sal_Bool SwCursor::GoNextWord()
+{
+ return GoNextWordWT( WordType::ANYWORD_IGNOREWHITESPACES );
+}
+
+sal_Bool SwCursor::GoPrevWord()
+{
+ return GoPrevWordWT( WordType::ANYWORD_IGNOREWHITESPACES );
+}
+
+sal_Bool SwCursor::SelectWord( ViewShell* pViewShell, const Point* pPt )
+{
+ return SelectWordWT( pViewShell, WordType::ANYWORD_IGNOREWHITESPACES, pPt );
+}
+
+sal_Bool SwCursor::IsStartWordWT( sal_Int16 nWordType ) const
+{
+ sal_Bool bRet = sal_False;
+ const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
+ {
+ xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
+ bRet = pBreakIt->GetBreakIter()->isBeginWord(
+ pTxtNd->GetTxt(), nPtPos,
+ pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos )),
+ nWordType );
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::IsEndWordWT( sal_Int16 nWordType ) const
+{
+ sal_Bool bRet = sal_False;
+ const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
+ {
+ xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
+ bRet = pBreakIt->GetBreakIter()->isEndWord(
+ pTxtNd->GetTxt(), nPtPos,
+ pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
+ nWordType );
+
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::IsInWordWT( sal_Int16 nWordType ) const
+{
+ sal_Bool bRet = sal_False;
+ const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
+ {
+ xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
+ Boundary aBoundary = pBreakIt->GetBreakIter()->getWordBoundary(
+ pTxtNd->GetTxt(), nPtPos,
+ pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
+ nWordType,
+ sal_True );
+
+ bRet = aBoundary.startPos != aBoundary.endPos &&
+ aBoundary.startPos <= nPtPos &&
+ nPtPos <= aBoundary.endPos;
+ if(bRet)
+ {
+ const CharClass& rCC = GetAppCharClass();
+ bRet = rCC.isLetterNumeric( pTxtNd->GetTxt(), static_cast<xub_StrLen>(aBoundary.startPos) );
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::IsStartEndSentence( bool bEnd ) const
+{
+ sal_Bool bRet = bEnd ?
+ GetCntntNode() && GetPoint()->nContent == GetCntntNode()->Len() :
+ GetPoint()->nContent.GetIndex() == 0;
+
+ if( !bRet )
+ {
+ SwCursor aCrsr(*GetPoint(), 0, false);
+ SwPosition aOrigPos = *aCrsr.GetPoint();
+ aCrsr.GoSentence( bEnd ? SwCursor::END_SENT : SwCursor::START_SENT );
+ bRet = aOrigPos == *aCrsr.GetPoint();
+ }
+
+ return bRet;
+}
+
+sal_Bool SwCursor::GoStartWordWT( sal_Int16 nWordType )
+{
+ sal_Bool bRet = sal_False;
+ const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
+ {
+ SwCrsrSaveState aSave( *this );
+ xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->getWordBoundary(
+ pTxtNd->GetTxt(), nPtPos,
+ pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
+ nWordType,
+ sal_False ).startPos;
+
+ if( nPtPos < pTxtNd->GetTxt().Len() )
+ {
+ GetPoint()->nContent = nPtPos;
+ if( !IsSelOvr() )
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::GoEndWordWT( sal_Int16 nWordType )
+{
+ sal_Bool bRet = sal_False;
+ const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
+ {
+ SwCrsrSaveState aSave( *this );
+ xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->getWordBoundary(
+ pTxtNd->GetTxt(), nPtPos,
+ pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
+ nWordType,
+ sal_True ).endPos;
+
+ if( nPtPos <= pTxtNd->GetTxt().Len() &&
+ GetPoint()->nContent.GetIndex() != nPtPos )
+ {
+ GetPoint()->nContent = nPtPos;
+ if( !IsSelOvr() )
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::GoNextWordWT( sal_Int16 nWordType )
+{
+ sal_Bool bRet = sal_False;
+ const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
+ {
+ SwCrsrSaveState aSave( *this );
+ xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
+
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->nextWord(
+ pTxtNd->GetTxt(), nPtPos,
+ pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos, 1 ) ),
+ nWordType ).startPos;
+
+ if( nPtPos < pTxtNd->GetTxt().Len() )
+ {
+ GetPoint()->nContent = nPtPos;
+ if( !IsSelOvr() )
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::GoPrevWordWT( sal_Int16 nWordType )
+{
+ sal_Bool bRet = sal_False;
+ const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
+ {
+ SwCrsrSaveState aSave( *this );
+ xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
+ const xub_StrLen nPtStart = nPtPos;
+
+ if( nPtPos )
+ --nPtPos;
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->previousWord(
+ pTxtNd->GetTxt(), nPtStart,
+ pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos, 1 ) ),
+ nWordType ).startPos;
+
+ if( nPtPos < pTxtNd->GetTxt().Len() )
+ {
+ GetPoint()->nContent = nPtPos;
+ if( !IsSelOvr() )
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::SelectWordWT( ViewShell* pViewShell, sal_Int16 nWordType, const Point* pPt )
+{
+ SwCrsrSaveState aSave( *this );
+
+ sal_Bool bRet = sal_False;
+ sal_Bool bForward = sal_True;
+ DeleteMark();
+ const SwRootFrm* pLayout = pViewShell->GetLayout();
+ if( pPt && 0 != pLayout )
+ {
+ // set the cursor to the layout position
+ Point aPt( *pPt );
+ pLayout->GetCrsrOfst( GetPoint(), aPt );
+ } //swmod 071107//swmod 071225
+
+ const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
+ {
+ xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
+ Boundary aBndry( pBreakIt->GetBreakIter()->getWordBoundary(
+ pTxtNd->GetTxt(), nPtPos,
+ pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
+ nWordType,
+ bForward ));
+
+ if( aBndry.startPos != aBndry.endPos )
+ {
+ GetPoint()->nContent = (xub_StrLen)aBndry.endPos;
+ if( !IsSelOvr() )
+ {
+ SetMark();
+ GetMark()->nContent = (xub_StrLen)aBndry.startPos;
+ if( !IsSelOvr() )
+ bRet = sal_True;
+ }
+ }
+ }
+
+ if( !bRet )
+ {
+ DeleteMark();
+ RestoreSavePos();
+ }
+ return bRet;
+}
+
+//-----------------------------------------------------------------------------
+
+static String lcl_MaskDeletedRedlines( const SwTxtNode* pTxtNd )
+{
+ String aRes;
+ if (pTxtNd)
+ {
+ //mask deleted redlines
+ String sNodeText(pTxtNd->GetTxt());
+ const SwDoc& rDoc = *pTxtNd->GetDoc();
+ const bool nShowChg = IDocumentRedlineAccess::IsShowChanges( rDoc.GetRedlineMode() );
+ if ( nShowChg )
+ {
+ sal_uInt16 nAct = rDoc.GetRedlinePos( *pTxtNd, USHRT_MAX );
+ for ( ; nAct < rDoc.GetRedlineTbl().Count(); nAct++ )
+ {
+ const SwRedline* pRed = rDoc.GetRedlineTbl()[ nAct ];
+ if ( pRed->Start()->nNode > pTxtNd->GetIndex() )
+ break;
+
+ if( nsRedlineType_t::REDLINE_DELETE == pRed->GetType() )
+ {
+ xub_StrLen nStart, nEnd;
+ pRed->CalcStartEnd( pTxtNd->GetIndex(), nStart, nEnd );
+
+ while ( nStart < nEnd && nStart < sNodeText.Len() )
+ sNodeText.SetChar( nStart++, CH_TXTATR_INWORD );
+ }
+ }
+ }
+ aRes = sNodeText;
+ }
+ return aRes;
+}
+
+sal_Bool SwCursor::GoSentence( SentenceMoveType eMoveType )
+{
+ sal_Bool bRet = sal_False;
+ const SwTxtNode* pTxtNd = GetNode()->GetTxtNode();
+ if( pTxtNd && pBreakIt->GetBreakIter().is() )
+ {
+ String sNodeText( lcl_MaskDeletedRedlines( pTxtNd ) );
+
+ SwCrsrSaveState aSave( *this );
+ xub_StrLen nPtPos = GetPoint()->nContent.GetIndex();
+ switch ( eMoveType )
+ {
+ case START_SENT: /* when modifying: see also ExpandToSentenceBorders below! */
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->beginOfSentence(
+ sNodeText,
+ nPtPos, pBreakIt->GetLocale(
+ pTxtNd->GetLang( nPtPos ) ));
+ break;
+ case END_SENT: /* when modifying: see also ExpandToSentenceBorders below! */
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfSentence(
+ sNodeText,
+ nPtPos, pBreakIt->GetLocale(
+ pTxtNd->GetLang( nPtPos ) ));
+ break;
+ case NEXT_SENT:
+ {
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfSentence(
+ sNodeText,
+ nPtPos, pBreakIt->GetLocale(
+ pTxtNd->GetLang( nPtPos ) ));
+ while (nPtPos != (sal_uInt16) -1 && ++nPtPos < sNodeText.Len()
+ && sNodeText.GetChar(nPtPos)== ' ' /*isWhiteSpace( aTxt.GetChar(nPtPos)*/ )
+ ;
+ break;
+ }
+ case PREV_SENT:
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->beginOfSentence(
+ sNodeText,
+ nPtPos, pBreakIt->GetLocale(
+ pTxtNd->GetLang( nPtPos ) ));
+ if (nPtPos == 0)
+ return sal_False; // the previous sentence is not in this paragraph
+ if (nPtPos > 0)
+ nPtPos = (xub_StrLen)pBreakIt->GetBreakIter()->beginOfSentence(
+ sNodeText,
+ nPtPos - 1, pBreakIt->GetLocale(
+ pTxtNd->GetLang( nPtPos ) ));
+ break;
+ }
+
+ // it is allowed to place the PaM just behind the last
+ // character in the text thus <= ...Len
+ if( nPtPos <= pTxtNd->GetTxt().Len() )
+ {
+ GetPoint()->nContent = nPtPos;
+ if( !IsSelOvr() )
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+
+sal_Bool SwCursor::ExpandToSentenceBorders()
+{
+ sal_Bool bRes = sal_False;
+ const SwTxtNode* pStartNd = Start()->nNode.GetNode().GetTxtNode();
+ const SwTxtNode* pEndNd = End()->nNode.GetNode().GetTxtNode();
+ if (pStartNd && pEndNd && pBreakIt->GetBreakIter().is())
+ {
+ if (!HasMark())
+ SetMark();
+
+ String sStartText( lcl_MaskDeletedRedlines( pStartNd ) );
+ String sEndText( pStartNd == pEndNd? sStartText : lcl_MaskDeletedRedlines( pEndNd ) );
+
+ SwCrsrSaveState aSave( *this );
+ xub_StrLen nStartPos = Start()->nContent.GetIndex();
+ xub_StrLen nEndPos = End()->nContent.GetIndex();
+
+ nStartPos = (xub_StrLen)pBreakIt->GetBreakIter()->beginOfSentence(
+ sStartText, nStartPos,
+ pBreakIt->GetLocale( pStartNd->GetLang( nStartPos ) ) );
+ nEndPos = (xub_StrLen)pBreakIt->GetBreakIter()->endOfSentence(
+ sEndText, nEndPos,
+ pBreakIt->GetLocale( pEndNd->GetLang( nEndPos ) ) );
+
+ // it is allowed to place the PaM just behind the last
+ // character in the text thus <= ...Len
+ bool bChanged = false;
+ if (nStartPos <= pStartNd->GetTxt().Len())
+ {
+ GetMark()->nContent = nStartPos;
+ bChanged = true;
+ }
+ if (nEndPos <= pEndNd->GetTxt().Len())
+ {
+ GetPoint()->nContent = nEndPos;
+ bChanged = true;
+ }
+ if (bChanged && !IsSelOvr())
+ bRes = sal_True;
+ }
+ return bRes;
+}
+
+
+sal_Bool SwTableCursor::LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 /*nMode*/,
+ sal_Bool /*bVisualAllowed*/, sal_Bool /*bSkipHidden*/, sal_Bool /*bInsertCrsr*/ )
+{
+ return bLeft ? GoPrevCell( nCnt )
+ : GoNextCell( nCnt );
+}
+
+
+// calculate cursor bidi level: extracted from LeftRight()
+const SwCntntFrm*
+SwCursor::DoSetBidiLevelLeftRight(
+ sal_Bool & io_rbLeft, sal_Bool bVisualAllowed, sal_Bool bInsertCrsr)
+{
+ // calculate cursor bidi level
+ const SwCntntFrm* pSttFrm = NULL;
+ SwNode& rNode = GetPoint()->nNode.GetNode();
+
+ 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() )
+ {
+ // for visual cursor travelling (used in bidi layout)
+ // we first have to convert the logic to a visual position
+ Point aPt;
+ pSttFrm = rTNd.getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() );
+ if( pSttFrm )
+ {
+ sal_uInt8 nCrsrLevel = GetCrsrBidiLevel();
+ sal_Bool bForward = ! io_rbLeft;
+ ((SwTxtFrm*)pSttFrm)->PrepareVisualMove( nPos, nCrsrLevel,
+ bForward, bInsertCrsr );
+ rIdx = nPos;
+ SetCrsrBidiLevel( nCrsrLevel );
+ io_rbLeft = ! bForward;
+ }
+ }
+ else
+ {
+ const SwScriptInfo* pSI = SwScriptInfo::GetScriptInfo( rTNd );
+ if ( pSI )
+ {
+ const xub_StrLen nMoveOverPos = io_rbLeft ?
+ ( nPos ? nPos - 1 : 0 ) :
+ nPos;
+ SetCrsrBidiLevel( pSI->DirType( nMoveOverPos ) );
+ }
+ }
+ }
+ return pSttFrm;
+}
+
+sal_Bool SwCursor::LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode,
+ sal_Bool bVisualAllowed,sal_Bool bSkipHidden, sal_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 );
+ SwMoveFn fnMove = bLeft ? fnMoveBackward : fnMoveForward;
+
+ SwGoInDoc fnGo;
+ if ( bSkipHidden )
+ fnGo = CRSR_SKIP_CELLS == nMode ? fnGoCntntCellsSkipHidden : fnGoCntntSkipHidden;
+ else
+ fnGo = CRSR_SKIP_CELLS == nMode ? fnGoCntntCells : fnGoCntnt;
+
+ // ASSERT( not in covered cell )
+
+ while( nCnt )
+ {
+ SwNodeIndex aOldNodeIdx( GetPoint()->nNode );
+
+ bool bSuccess = Move( fnMove, fnGo );
+ if ( !bSuccess )
+ break;
+
+ // If we were located inside a covered cell but our position has been
+ // corrected, we check if the last move has moved the cursor to a different
+ // table cell. In this case we set the cursor to the stored covered position
+ // and redo the move:
+ if ( mnRowSpanOffset )
+ {
+ const SwNode* pOldTabBoxSttNode = aOldNodeIdx.GetNode().FindTableBoxStartNode();
+ const SwTableNode* pOldTabSttNode = pOldTabBoxSttNode ? pOldTabBoxSttNode->FindTableNode() : 0;
+ const SwNode* pNewTabBoxSttNode = GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+ const SwTableNode* pNewTabSttNode = pNewTabBoxSttNode ? pNewTabBoxSttNode->FindTableNode() : 0;
+
+ const bool bCellChanged = pOldTabSttNode && pNewTabSttNode &&
+ pOldTabSttNode == pNewTabSttNode &&
+ pOldTabBoxSttNode && pNewTabBoxSttNode &&
+ pOldTabBoxSttNode != pNewTabBoxSttNode;
+
+ if ( bCellChanged )
+ {
+ // Set cursor to start/end of covered cell:
+ SwTableBox* pTableBox = pOldTabBoxSttNode->GetTblBox();
+ const long nRowSpan = pTableBox->getRowSpan();
+ if ( nRowSpan > 1 )
+ {
+ pTableBox = & pTableBox->FindEndOfRowSpan( pOldTabSttNode->GetTable(), (sal_uInt16)(pTableBox->getRowSpan() + mnRowSpanOffset ) );
+ SwNodeIndex& rPtIdx = GetPoint()->nNode;
+ SwNodeIndex aNewIdx( *pTableBox->GetSttNd() );
+ rPtIdx = aNewIdx;
+
+ GetDoc()->GetNodes().GoNextSection( &rPtIdx, sal_False, sal_False );
+ SwCntntNode* pCntntNode = GetCntntNode();
+ if ( pCntntNode )
+ {
+ const xub_StrLen nTmpPos = bLeft ? pCntntNode->Len() : 0;
+ GetPoint()->nContent.Assign( pCntntNode, nTmpPos );
+
+ // Redo the move:
+ bSuccess = Move( fnMove, fnGo );
+ if ( !bSuccess )
+ break;
+ }
+ }
+
+ mnRowSpanOffset = 0;
+ }
+ }
+
+ // Check if I'm inside a covered cell. Correct cursor if necessary and
+ // store covered cell:
+ const SwNode* pTableBoxStartNode = GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+ if ( pTableBoxStartNode )
+ {
+ const SwTableBox* pTableBox = pTableBoxStartNode->GetTblBox();
+ if ( pTableBox->getRowSpan() < 1 )
+ {
+ // Store the row span offset:
+ mnRowSpanOffset = pTableBox->getRowSpan();
+
+ // Move cursor to non-covered cell:
+ const SwTableNode* pTblNd = pTableBoxStartNode->FindTableNode();
+ pTableBox = & pTableBox->FindStartOfRowSpan( pTblNd->GetTable(), USHRT_MAX );
+ SwNodeIndex& rPtIdx = GetPoint()->nNode;
+ SwNodeIndex aNewIdx( *pTableBox->GetSttNd() );
+ rPtIdx = aNewIdx;
+
+ GetDoc()->GetNodes().GoNextSection( &rPtIdx, sal_False, sal_False );
+ SwCntntNode* pCntntNode = GetCntntNode();
+ if ( pCntntNode )
+ {
+ const xub_StrLen nTmpPos = bLeft ? pCntntNode->Len() : 0;
+ GetPoint()->nContent.Assign( pCntntNode, nTmpPos );
+ }
+ }
+ }
+
+ --nCnt;
+ }
+
+ // here come some special rules for visual cursor travelling
+ if ( pSttFrm )
+ {
+ SwNode& rTmpNode = GetPoint()->nNode.GetNode();
+ if ( &rTmpNode != &rNode && rTmpNode.IsTxtNode() )
+ {
+ Point aPt;
+ const SwCntntFrm* pEndFrm = ((SwTxtNode&)rTmpNode).getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() );
+ if ( pEndFrm )
+ {
+ if ( ! pEndFrm->IsRightToLeft() != ! pSttFrm->IsRightToLeft() )
+ {
+ if ( ! bLeft )
+ pEndFrm->RightMargin( this );
+ else
+ pEndFrm->LeftMargin( this );
+ }
+ }
+ }
+ }
+
+ return 0 == nCnt && !IsInProtectTable( sal_True ) &&
+ !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ 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 sal_uInt8 nCurrLevel = pSI->DirType( nPos );
+ const sal_uInt8 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 );
+ }
+ }
+ }
+}
+
+sal_Bool SwCursor::UpDown( sal_Bool bUp, sal_uInt16 nCnt,
+ Point* pPt, long nUpDownX )
+{
+ SwTableCursor* pTblCrsr = dynamic_cast<SwTableCursor*>(this);
+ sal_Bool bAdjustTableCrsr = sal_False;
+
+ // vom Tabellen Crsr Point/Mark in der gleichen Box ??
+ // dann stelle den Point an den Anfang der Box
+ if( pTblCrsr && GetNode( sal_True )->StartOfSectionNode() ==
+ GetNode( sal_False )->StartOfSectionNode() )
+ {
+ if ( End() != GetPoint() )
+ Exchange();
+ bAdjustTableCrsr = sal_True;
+ }
+
+ sal_Bool bRet = sal_False;
+ Point aPt;
+ if( pPt )
+ aPt = *pPt;
+ SwCntntFrm* pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() );
+
+ if( pFrm )
+ {
+ SwCrsrSaveState aSave( *this );
+
+ if( !pPt )
+ {
+ SwRect aTmpRect;
+ pFrm->GetCharRect( aTmpRect, *GetPoint() );
+ aPt = aTmpRect.Pos();
+
+ nUpDownX = pFrm->IsVertical() ?
+ aPt.Y() - pFrm->Frm().Top() :
+ aPt.X() - pFrm->Frm().Left();
+ }
+
+ // Bei Fussnoten ist auch die Bewegung in eine andere Fussnote erlaubt.
+ // aber keine Selection!!
+ const sal_Bool bChkRange = pFrm->IsInFtn() && !HasMark()
+ ? sal_False : sal_True;
+ const SwPosition aOldPos( *GetPoint() );
+ sal_Bool bInReadOnly = IsReadOnlyAvailable();
+
+ if ( bAdjustTableCrsr && !bUp )
+ {
+ // Special case: We have a table cursor but the start box
+ // has more than one paragraph. If we want to go down, we have to
+ // set the point to the last frame in the table box. This is
+ // only necessary if we do not already have a table selection
+ const SwStartNode* pTblNd = GetNode( sal_True )->FindTableBoxStartNode();
+ ASSERT( pTblNd, "pTblCrsr without SwTableNode?" )
+
+ if ( pTblNd ) // safety first
+ {
+ const SwNode* pEndNd = pTblNd->EndOfSectionNode();
+ GetPoint()->nNode = *pEndNd;
+ pTblCrsr->Move( fnMoveBackward, fnGoNode );
+ pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() );
+ }
+ }
+
+ while( nCnt &&
+ (bUp ? pFrm->UnitUp( this, nUpDownX, bInReadOnly )
+ : pFrm->UnitDown( this, nUpDownX, bInReadOnly ) ) &&
+ CheckNodesRange( aOldPos.nNode, GetPoint()->nNode, bChkRange ))
+ {
+ pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() );
+ --nCnt;
+ }
+
+ if( !nCnt && !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) // die gesamte Anzahl durchlaufen ?
+ {
+ if( !pTblCrsr )
+ {
+ // dann versuche den Cursor auf die Position zu setzen,
+ // auf halber Heohe vom Char-Rectangle
+ pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() );
+ SwCrsrMoveState eTmpState( MV_UPDOWN );
+ eTmpState.bSetInReadOnly = bInReadOnly;
+ SwRect aTmpRect;
+ pFrm->GetCharRect( aTmpRect, *GetPoint(), &eTmpState );
+ if ( pFrm->IsVertical() )
+ {
+ aPt.X() = aTmpRect.Center().X();
+ pFrm->Calc();
+ aPt.Y() = pFrm->Frm().Top() + nUpDownX;
+ }
+ else
+ {
+ aPt.Y() = aTmpRect.Center().Y();
+ pFrm->Calc();
+ aPt.X() = pFrm->Frm().Left() + nUpDownX;
+ }
+ pFrm->GetCrsrOfst( GetPoint(), aPt, &eTmpState );
+ }
+ bRet = sal_True;
+ }
+ else
+ *GetPoint() = aOldPos;
+
+ DoSetBidiLevelUpDown(); // calculate cursor bidi level
+ }
+
+ return bRet;
+}
+
+sal_Bool SwCursor::LeftRightMargin( sal_Bool bLeft, sal_Bool bAPI )
+{
+ Point aPt;
+ SwCntntFrm * pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() );
+
+ // calculate cursor bidi level
+ if ( pFrm )
+ SetCrsrBidiLevel( pFrm->IsRightToLeft() ? 1 : 0 );
+
+ return pFrm && (bLeft ? pFrm->LeftMargin( this ) :
+ pFrm->RightMargin( this, bAPI ) );
+}
+
+sal_Bool SwCursor::IsAtLeftRightMargin( sal_Bool bLeft, sal_Bool bAPI ) const
+{
+ sal_Bool bRet = sal_False;
+ Point aPt;
+ SwCntntFrm * pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() );
+ if( pFrm )
+ {
+ SwPaM aPam( *GetPoint() );
+ if( !bLeft && aPam.GetPoint()->nContent.GetIndex() )
+ aPam.GetPoint()->nContent--;
+ bRet = (bLeft ? pFrm->LeftMargin( &aPam )
+ : pFrm->RightMargin( &aPam, bAPI ))
+ && *aPam.GetPoint() == *GetPoint();
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::SttEndDoc( sal_Bool bStt )
+{
+ SwCrsrSaveState aSave( *this );
+
+ // Springe beim Selektieren nie ueber Section-Grenzen !!
+ // kann der Cursor weiterverschoben werden ?
+ SwMoveFn fnMove = bStt ? fnMoveBackward : fnMoveForward;
+ sal_Bool bRet = (!HasMark() || !IsNoCntnt() ) &&
+ Move( fnMove, fnGoDoc ) &&
+ !IsInProtectTable( sal_True ) &&
+ !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS |
+ nsSwCursorSelOverFlags::SELOVER_ENABLEREVDIREKTION );
+
+ return bRet;
+}
+
+sal_Bool SwCursor::GoPrevNextCell( sal_Bool bNext, sal_uInt16 nCnt )
+{
+ const SwTableNode* pTblNd = GetPoint()->nNode.GetNode().FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ // liegt vor dem StartNode der Cell ein weiterer EndNode, dann
+ // gibt es auch eine vorherige Celle
+ SwCrsrSaveState aSave( *this );
+ SwNodeIndex& rPtIdx = GetPoint()->nNode;
+
+ while( nCnt-- )
+ {
+ const SwNode* pTableBoxStartNode = rPtIdx.GetNode().FindTableBoxStartNode();
+ const SwTableBox* pTableBox = pTableBoxStartNode->GetTblBox();
+
+ // Check if we have to move the cursor to a covered cell before
+ // proceeding:
+ if ( mnRowSpanOffset )
+ {
+ if ( pTableBox->getRowSpan() > 1 )
+ {
+ pTableBox = & pTableBox->FindEndOfRowSpan( pTblNd->GetTable(), (sal_uInt16)(pTableBox->getRowSpan() + mnRowSpanOffset) );
+ SwNodeIndex aNewIdx( *pTableBox->GetSttNd() );
+ rPtIdx = aNewIdx;
+ pTableBoxStartNode = rPtIdx.GetNode().FindTableBoxStartNode();
+ }
+ mnRowSpanOffset = 0;
+ }
+
+ const SwNode* pTmpNode = bNext ?
+ pTableBoxStartNode->EndOfSectionNode() :
+ pTableBoxStartNode;
+
+ SwNodeIndex aCellIdx( *pTmpNode, bNext ? 1 : -1 );
+ if( (bNext && !aCellIdx.GetNode().IsStartNode()) ||
+ (!bNext && !aCellIdx.GetNode().IsEndNode()) )
+ return sal_False;
+
+ rPtIdx = bNext ? aCellIdx : SwNodeIndex(*aCellIdx.GetNode().StartOfSectionNode());
+
+ pTableBoxStartNode = rPtIdx.GetNode().FindTableBoxStartNode();
+ pTableBox = pTableBoxStartNode->GetTblBox();
+ if ( pTableBox->getRowSpan() < 1 )
+ {
+ mnRowSpanOffset = pTableBox->getRowSpan();
+ // move cursor to non-covered cell:
+ pTableBox = & pTableBox->FindStartOfRowSpan( pTblNd->GetTable(), USHRT_MAX );
+ SwNodeIndex aNewIdx( *pTableBox->GetSttNd() );
+ rPtIdx = aNewIdx;
+ }
+ }
+
+ rPtIdx++;
+ if( !rPtIdx.GetNode().IsCntntNode() )
+ GetDoc()->GetNodes().GoNextSection( &rPtIdx, sal_True, sal_False );
+ GetPoint()->nContent.Assign( GetCntntNode(), 0 );
+
+ return !IsInProtectTable( sal_True );
+}
+
+sal_Bool SwTableCursor::GotoTable( const String& /*rName*/ )
+{
+ return sal_False; // invalid action
+}
+
+sal_Bool SwCursor::GotoTable( const String& rName )
+{
+ sal_Bool bRet = sal_False;
+ if ( !HasMark() )
+ {
+ SwTable* pTmpTbl = SwTable::FindTable( GetDoc()->FindTblFmtByName( rName ) );
+ if( pTmpTbl )
+ {
+ // eine Tabelle im normalen NodesArr
+ SwCrsrSaveState aSave( *this );
+ GetPoint()->nNode = *pTmpTbl->GetTabSortBoxes()[ 0 ]->
+ GetSttNd()->FindTableNode();
+ Move( fnMoveForward, fnGoCntnt );
+ bRet = !IsSelOvr();
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::GotoTblBox( const String& rName )
+{
+ sal_Bool bRet = sal_False;
+ const SwTableNode* pTblNd = GetPoint()->nNode.GetNode().FindTableNode();
+ if( pTblNd )
+ {
+ // erfrage die Box, mit dem Nanen
+ const SwTableBox* pTblBox = pTblNd->GetTable().GetTblBox( rName );
+ if( pTblBox && pTblBox->GetSttNd() &&
+ ( !pTblBox->GetFrmFmt()->GetProtect().IsCntntProtected() ||
+ IsReadOnlyAvailable() ) )
+ {
+ SwCrsrSaveState aSave( *this );
+ GetPoint()->nNode = *pTblBox->GetSttNd();
+ Move( fnMoveForward, fnGoCntnt );
+ bRet = !IsSelOvr();
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara )
+{
+ //JP 28.8.2001: for optimization test something before
+ const SwNode* pNd = &GetPoint()->nNode.GetNode();
+ bool bShortCut = false;
+ if ( fnWhichPara == fnParaCurr )
+ {
+ // --> FME 2005-02-21 #i41048#
+ // If fnWhichPara == fnParaCurr, (*fnWhichPara)( *this, fnPosPara )
+ // can already move the cursor to a different text node. In this case
+ // we better check if IsSelOvr().
+ const SwCntntNode* pCntntNd = pNd->GetCntntNode();
+ if ( pCntntNd )
+ {
+ const xub_StrLen nSttEnd = fnPosPara == fnMoveForward ? 0 : pCntntNd->Len();
+ if ( GetPoint()->nContent.GetIndex() != nSttEnd )
+ bShortCut = true;
+ }
+ // <--
+ }
+ else
+ {
+ if ( pNd->IsTxtNode() &&
+ pNd->GetNodes()[ pNd->GetIndex() +
+ (fnWhichPara == fnParaNext ? 1 : -1 ) ]->IsTxtNode() )
+ bShortCut = true;
+ }
+
+ if ( bShortCut )
+ return (*fnWhichPara)( *this, fnPosPara );
+
+ // else we must use the SaveStructure, because the next/prev is not
+ // a same node type.
+ SwCrsrSaveState aSave( *this );
+ return (*fnWhichPara)( *this, fnPosPara ) &&
+ !IsInProtectTable( sal_True ) &&
+ !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
+}
+
+
+sal_Bool SwCursor::MoveSection( SwWhichSection fnWhichSect,
+ SwPosSection fnPosSect)
+{
+ SwCrsrSaveState aSave( *this );
+ return (*fnWhichSect)( *this, fnPosSect ) &&
+ !IsInProtectTable( sal_True ) &&
+ !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
+ nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
+}
+
+/*
+ sal_Bool MoveTable( SwWhichTable, SwPosTable );
+ sal_Bool MoveColumn( SwWhichColumn, SwPosColumn );
+ sal_Bool MoveRegion( SwWhichRegion, SwPosRegion );
+*/
+
+void SwCursor::RestoreSavePos() // Point auf die SavePos setzen
+{
+ if( pSavePos )
+ {
+ GetPoint()->nNode = pSavePos->nNode;
+ GetPoint()->nContent.Assign( GetCntntNode(), pSavePos->nCntnt );
+ }
+}
+
+
+/* */
+
+SwTableCursor::SwTableCursor( const SwPosition &rPos, SwPaM* pRing )
+ : SwCursor( rPos, pRing, false )
+{
+ bParked = sal_False;
+ bChg = sal_False;
+ nTblPtNd = 0, nTblMkNd = 0;
+ nTblPtCnt = 0, nTblMkCnt = 0;
+}
+
+SwTableCursor::~SwTableCursor() {}
+
+
+sal_Bool lcl_SeekEntry( const SwSelBoxes& rTmp, const SwStartNode* pSrch, sal_uInt16& rFndPos )
+{
+ sal_uLong nIdx = pSrch->GetIndex();
+
+ sal_uInt16 nO = rTmp.Count(), nM, nU = 0;
+ if( nO > 0 )
+ {
+ nO--;
+ while( nU <= nO )
+ {
+ nM = nU + ( nO - nU ) / 2;
+ if( rTmp[ nM ]->GetSttNd() == pSrch )
+ {
+ rFndPos = nM;
+ return sal_True;
+ }
+ else if( rTmp[ nM ]->GetSttIdx() < nIdx )
+ nU = nM + 1;
+ else if( nM == 0 )
+ return sal_False;
+ else
+ nO = nM - 1;
+ }
+ }
+ return sal_False;
+}
+
+
+SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
+{
+ if( bChg ) // ???
+ {
+ if( bParked )
+ {
+ // wieder in den Inhalt schieben
+ Exchange();
+ Move( fnMoveForward );
+ Exchange();
+ Move( fnMoveForward );
+ bParked = sal_False;
+ }
+
+ bChg = sal_False;
+
+ // temp Kopie anlegen, damit alle Boxen, fuer die schon Cursor
+ // existieren, entfernt werden koennen.
+ SwSelBoxes aTmp;
+ aTmp.Insert( &aSelBoxes );
+
+ //Jetzt die Alten und die neuen abgleichen.
+ SwNodes& rNds = pAktCrsr->GetDoc()->GetNodes();
+ sal_uInt16 nPos;
+ const SwStartNode* pSttNd;
+ SwPaM* pCur = pAktCrsr;
+ do {
+ sal_Bool bDel = sal_False;
+ pSttNd = pCur->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+ if( !pCur->HasMark() || !pSttNd ||
+ pSttNd != pCur->GetMark()->nNode.GetNode().FindTableBoxStartNode() )
+ bDel = sal_True;
+
+ else if( lcl_SeekEntry( aTmp, pSttNd, nPos ))
+ {
+ SwNodeIndex aIdx( *pSttNd, 1 );
+ const SwNode* pNd = &aIdx.GetNode();
+ if( !pNd->IsCntntNode() )
+ pNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
+
+ SwPosition* pPos = pCur->GetMark();
+ if( pNd != &pPos->nNode.GetNode() )
+ pPos->nNode = *pNd;
+ pPos->nContent.Assign( (SwCntntNode*)pNd, 0 );
+
+ aIdx.Assign( *pSttNd->EndOfSectionNode(), - 1 );
+ if( !( pNd = &aIdx.GetNode())->IsCntntNode() )
+ pNd = rNds.GoPrevSection( &aIdx, sal_True, sal_False );
+
+ pPos = pCur->GetPoint();
+ if( pNd != &pPos->nNode.GetNode() )
+ pPos->nNode = *pNd;
+ pPos->nContent.Assign( (SwCntntNode*)pNd, ((SwCntntNode*)pNd)->Len() );
+
+ aTmp.Remove( nPos );
+ }
+ else
+ bDel = sal_True;
+
+ pCur = (SwPaM*)pCur->GetNext();
+ if( bDel )
+ {
+ SwPaM* pDel = (SwPaM*)pCur->GetPrev();
+/*
+JP 20.07.98: der alte Code geht mit dem UNO-TableCrsr nicht
+ if( pDel == pAktCrsr )
+ {
+ if( pAktCrsr->GetNext() == pAktCrsr )
+ {
+ pAktCrsr->DeleteMark();
+ break; // es gibt nichts mehr zu loeschen!
+ }
+ pAktCrsr = (SwCursor*)pDel->GetPrev();
+ }
+ delete pDel;
+*/
+
+ if( pDel == pAktCrsr )
+ pAktCrsr->DeleteMark();
+ else
+ delete pDel;
+ }
+ } while ( pAktCrsr != pCur );
+
+ for( nPos = 0; nPos < aTmp.Count(); ++nPos )
+ {
+ pSttNd = aTmp[ nPos ]->GetSttNd();
+
+ SwNodeIndex aIdx( *pSttNd, 1 );
+ if( &aIdx.GetNodes() != &rNds )
+ break;
+ const SwNode* pNd = &aIdx.GetNode();
+ if( !pNd->IsCntntNode() )
+ pNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
+
+ SwPaM* pNew;
+ if( pAktCrsr->GetNext() == pAktCrsr && !pAktCrsr->HasMark() )
+ {
+ pNew = pAktCrsr;
+ pNew->GetPoint()->nNode = *pNd;
+ pNew->GetPoint()->nContent.Assign( (SwCntntNode*)pNd, 0 );
+ }
+ else
+ {
+ pNew = pAktCrsr->Create( pAktCrsr );
+ pNew->GetPoint()->nNode = *pNd;
+ pNew->GetPoint()->nContent.Assign( (SwCntntNode*)pNd, 0 );
+ }
+ pNew->SetMark();
+
+ SwPosition* pPos = pNew->GetPoint();
+ pPos->nNode.Assign( *pSttNd->EndOfSectionNode(), - 1 );
+ if( !( pNd = &pPos->nNode.GetNode())->IsCntntNode() )
+ pNd = rNds.GoPrevSection( &pPos->nNode, sal_True, sal_False );
+
+ pPos->nContent.Assign( (SwCntntNode*)pNd, ((SwCntntNode*)pNd)->Len() );
+ }
+ }
+ return pAktCrsr;
+}
+
+
+void SwTableCursor::InsertBox( const SwTableBox& rTblBox )
+{
+ SwTableBox* pBox = (SwTableBox*)&rTblBox;
+ aSelBoxes.Insert( pBox );
+ bChg = sal_True;
+}
+
+bool SwTableCursor::NewTableSelection()
+{
+ bool bRet = false;
+ const SwNode *pStart = GetCntntNode()->FindTableBoxStartNode();
+ const SwNode *pEnd = GetCntntNode(sal_False)->FindTableBoxStartNode();
+ if( pStart && pEnd )
+ {
+ const SwTableNode *pTableNode = pStart->FindTableNode();
+ if( pTableNode == pEnd->FindTableNode() &&
+ pTableNode->GetTable().IsNewModel() )
+ {
+ bRet = true;
+ SwSelBoxes aNew;
+ aNew.Insert( &aSelBoxes );
+ pTableNode->GetTable().CreateSelection( pStart, pEnd, aNew,
+ SwTable::SEARCH_NONE, false );
+ ActualizeSelection( aNew );
+ }
+ }
+ return bRet;
+}
+
+void SwTableCursor::ActualizeSelection( const SwSelBoxes &rNew )
+{
+ sal_uInt16 nOld = 0, nNew = 0;
+ while ( nOld < aSelBoxes.Count() && nNew < rNew.Count() )
+ {
+ const SwTableBox* pPOld = *( aSelBoxes.GetData() + nOld );
+ const SwTableBox* pPNew = *( rNew.GetData() + nNew );
+ if( pPOld == pPNew )
+ { // this box will stay
+ ++nOld;
+ ++nNew;
+ }
+ else if( pPOld->GetSttIdx() < pPNew->GetSttIdx() )
+ DeleteBox( nOld ); // this box has to go
+ else
+ {
+ InsertBox( *pPNew ); // this is a new one
+ ++nOld;
+ ++nNew;
+ }
+ }
+
+ while( nOld < aSelBoxes.Count() )
+ DeleteBox( nOld ); // some more to delete
+
+ for( ; nNew < rNew.Count(); ++nNew ) // some more to insert
+ InsertBox( **( rNew.GetData() + nNew ) );
+}
+
+sal_Bool SwTableCursor::IsCrsrMovedUpdt()
+{
+ if( !IsCrsrMoved() )
+ return sal_False;
+
+ nTblMkNd = GetMark()->nNode.GetIndex();
+ nTblPtNd = GetPoint()->nNode.GetIndex();
+ nTblMkCnt = GetMark()->nContent.GetIndex();
+ nTblPtCnt = GetPoint()->nContent.GetIndex();
+ return sal_True;
+}
+
+
+// Parke den Tabellen-Cursor auf dem StartNode der Boxen.
+void SwTableCursor::ParkCrsr()
+{
+ // Index aus dem TextNode abmelden
+ SwNode* pNd = &GetPoint()->nNode.GetNode();
+ if( !pNd->IsStartNode() )
+ pNd = pNd->StartOfSectionNode();
+ GetPoint()->nNode = *pNd;
+ GetPoint()->nContent.Assign( 0, 0 );
+
+ pNd = &GetMark()->nNode.GetNode();
+ if( !pNd->IsStartNode() )
+ pNd = pNd->StartOfSectionNode();
+ GetMark()->nNode = *pNd;
+ GetMark()->nContent.Assign( 0, 0 );
+
+ bChg = sal_True;
+ bParked = sal_True;
+}
+
+
+sal_Bool SwTableCursor::HasReadOnlyBoxSel() const
+{
+ sal_Bool bRet = sal_False;
+ for( sal_uInt16 n = aSelBoxes.Count(); n; )
+ if( aSelBoxes[ --n ]->GetFrmFmt()->GetProtect().IsCntntProtected() )
+ {
+ bRet = sal_True;
+ break;
+ }
+ return bRet;
+}
+
+
diff --git a/sw/source/core/crsr/trvlcol.cxx b/sw/source/core/crsr/trvlcol.cxx
new file mode 100644
index 000000000000..92cd87889875
--- /dev/null
+++ b/sw/source/core/crsr/trvlcol.cxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <crsrsh.hxx>
+#include <doc.hxx>
+#include <layfrm.hxx>
+#include <cntfrm.hxx>
+#include <swcrsr.hxx>
+#include <viscrs.hxx>
+#include <callnk.hxx>
+
+
+
+SwLayoutFrm* GetCurrColumn( const SwLayoutFrm* pLayFrm )
+{
+ while( pLayFrm && !pLayFrm->IsColumnFrm() )
+ pLayFrm = pLayFrm->GetUpper();
+ return (SwLayoutFrm*)pLayFrm;
+}
+
+
+SwLayoutFrm* GetNextColumn( const SwLayoutFrm* pLayFrm )
+{
+ SwLayoutFrm* pActCol = GetCurrColumn( pLayFrm );
+ return pActCol ? (SwLayoutFrm*)pActCol->GetNext() : 0;
+}
+
+
+SwLayoutFrm* GetPrevColumn( const SwLayoutFrm* pLayFrm )
+{
+ SwLayoutFrm* pActCol = GetCurrColumn( pLayFrm );
+ return pActCol ? (SwLayoutFrm*)pActCol->GetPrev() : 0;
+}
+
+
+SwCntntFrm* GetColumnStt( const SwLayoutFrm* pColFrm )
+{
+ return pColFrm ? (SwCntntFrm*)pColFrm->ContainsCntnt() : 0;
+}
+
+
+SwCntntFrm* GetColumnEnd( const SwLayoutFrm* pColFrm )
+{
+ SwCntntFrm *pRet = GetColumnStt( pColFrm );
+ if( !pRet )
+ return 0;
+
+ SwCntntFrm *pNxt = pRet->GetNextCntntFrm();
+ while( pNxt && pColFrm->IsAnLower( pNxt ) )
+ {
+ pRet = pNxt;
+ pNxt = pNxt->GetNextCntntFrm();
+ }
+ return pRet;
+}
+
+
+SwWhichColumn fnColumnPrev = &GetPrevColumn;
+SwWhichColumn fnColumnCurr = &GetCurrColumn;
+SwWhichColumn fnColumnNext = &GetNextColumn;
+SwPosColumn fnColumnStart = &GetColumnStt;
+SwPosColumn fnColumnEnd = &GetColumnEnd;
+
+
+sal_Bool SwCrsrShell::MoveColumn( SwWhichColumn fnWhichCol, SwPosColumn fnPosCol )
+{
+ sal_Bool bRet = sal_False;
+ if( !pTblCrsr )
+ {
+ SwLayoutFrm* pLayFrm = GetCurrFrm()->GetUpper();
+ if( pLayFrm && 0 != ( pLayFrm = (*fnWhichCol)( pLayFrm )) )
+ {
+ SwCntntFrm* pCnt = (*fnPosCol)( pLayFrm );
+ if( pCnt )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ pCnt->Calc(); // ???
+
+ Point aPt( pCnt->Frm().Pos() + pCnt->Prt().Pos() );
+ if( fnPosCol == GetColumnEnd )
+ {
+ aPt.X() += pCnt->Prt().Width();
+ aPt.Y() += pCnt->Prt().Height();
+ }
+
+ pCnt->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
+
+ if( !pCurCrsr->IsInProtectTable( sal_True ) &&
+ !pCurCrsr->IsSelOvr() )
+ {
+ UpdateCrsr();
+ bRet = sal_True;
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+
+
diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx
new file mode 100644
index 000000000000..c3eeaf61b952
--- /dev/null
+++ b/sw/source/core/crsr/trvlfnfl.cxx
@@ -0,0 +1,359 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <crsrsh.hxx>
+#include <doc.hxx>
+#include <pagefrm.hxx>
+#include <cntfrm.hxx>
+#include <ftnfrm.hxx>
+#include <viewimp.hxx>
+#include <swcrsr.hxx>
+#include <dflyobj.hxx>
+#include <ndtxt.hxx>
+#include <flyfrm.hxx>
+#include <txtfrm.hxx>
+#include <txtftn.hxx>
+#include <ftnidx.hxx>
+#include <viscrs.hxx>
+#include <callnk.hxx>
+
+sal_Bool SwCrsrShell::CallCrsrFN( FNCrsr fnCrsr )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCursor* pCrsr = getShellCrsr( true );
+ sal_Bool bRet = (pCrsr->*fnCrsr)();
+ if( bRet )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ return bRet;
+}
+
+sal_Bool SwCursor::GotoFtnTxt()
+{
+ // springe aus dem Content zur Fussnote
+ sal_Bool bRet = sal_False;
+ SwTxtNode* pTxtNd = GetPoint()->nNode.GetNode().GetTxtNode();
+
+ SwTxtAttr *const pFtn( (pTxtNd)
+ ? pTxtNd->GetTxtAttrForCharAt(
+ GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN)
+ : 0);
+ if (pFtn)
+ {
+ SwCrsrSaveState aSaveState( *this );
+ GetPoint()->nNode = *((SwTxtFtn*)pFtn)->GetStartNode();
+
+ SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection(
+ &GetPoint()->nNode,
+ sal_True, !IsReadOnlyAvailable() );
+ if( pCNd )
+ {
+ GetPoint()->nContent.Assign( pCNd, 0 );
+ bRet = !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE );
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCrsrShell::GotoFtnTxt()
+{
+ sal_Bool bRet = CallCrsrFN( &SwCursor::GotoFtnTxt );
+ if( !bRet )
+ {
+ SwTxtNode* pTxtNd = _GetCrsr() ?
+ _GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode() : NULL;
+ if( pTxtNd )
+ {
+ const SwFrm *pFrm = pTxtNd->getLayoutFrm( GetLayout(), &_GetCrsr()->GetSttPos(),
+ _GetCrsr()->Start() );
+ const SwFtnBossFrm* pFtnBoss;
+ sal_Bool bSkip = pFrm && pFrm->IsInFtn();
+ while( pFrm && 0 != ( pFtnBoss = pFrm->FindFtnBossFrm() ) )
+ {
+ if( 0 != ( pFrm = pFtnBoss->FindFtnCont() ) )
+ {
+ if( bSkip )
+ bSkip = sal_False;
+ else
+ {
+ const SwCntntFrm* pCnt = static_cast<const SwLayoutFrm*>
+ (pFrm)->ContainsCntnt();
+ if( pCnt )
+ {
+ const SwCntntNode* pNode = pCnt->GetNode();
+ _GetCrsr()->GetPoint()->nNode = *pNode;
+ _GetCrsr()->GetPoint()->nContent.Assign(
+ const_cast<SwCntntNode*>(pNode),
+ static_cast<const SwTxtFrm*>(pCnt)->GetOfst() );
+ UpdateCrsr( SwCrsrShell::SCROLLWIN |
+ SwCrsrShell::CHKRANGE | SwCrsrShell::READONLY );
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+ if( pFtnBoss->GetNext() && !pFtnBoss->IsPageFrm() )
+ pFrm = pFtnBoss->GetNext();
+ else
+ pFrm = pFtnBoss->GetUpper();
+ }
+ }
+ }
+ return bRet;
+}
+
+
+sal_Bool SwCursor::GotoFtnAnchor()
+{
+ // springe aus der Fussnote zum Anker
+ const SwNode* pSttNd = GetNode()->FindFootnoteStartNode();
+ if( pSttNd )
+ {
+ // durchsuche alle Fussnoten im Dokument nach diesem StartIndex
+ const SwTxtFtn* pTxtFtn;
+ const SwFtnIdxs& rFtnArr = pSttNd->GetDoc()->GetFtnIdxs();
+ for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n )
+ if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() &&
+ pSttNd == &pTxtFtn->GetStartNode()->GetNode() )
+ {
+ SwCrsrSaveState aSaveState( *this );
+
+ SwTxtNode& rTNd = (SwTxtNode&)pTxtFtn->GetTxtNode();
+
+ GetPoint()->nNode = rTNd;
+ GetPoint()->nContent.Assign( &rTNd, *pTxtFtn->GetStart() );
+
+ return !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE );
+ }
+ }
+ return sal_False;
+}
+
+sal_Bool SwCrsrShell::GotoFtnAnchor()
+{
+ // springe aus der Fussnote zum Anker
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ sal_Bool bRet = pCurCrsr->GotoFtnAnchor();
+ if( bRet )
+ {
+ // BUG 5996: Tabellen-Kopfzeile sonderbehandeln
+ pCurCrsr->GetPtPos() = Point();
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ return bRet;
+}
+
+inline sal_Bool CmpLE( const SwTxtFtn& rFtn, sal_uLong nNd, xub_StrLen nCnt )
+{
+ sal_uLong nTNd = rFtn.GetTxtNode().GetIndex();
+ return nTNd < nNd || ( nTNd == nNd && *rFtn.GetStart() <= nCnt );
+}
+inline sal_Bool CmpL( const SwTxtFtn& rFtn, sal_uLong nNd, xub_StrLen nCnt )
+{
+ sal_uLong nTNd = rFtn.GetTxtNode().GetIndex();
+ return nTNd < nNd || ( nTNd == nNd && *rFtn.GetStart() < nCnt );
+}
+
+sal_Bool SwCursor::GotoNextFtnAnchor()
+{
+ const SwFtnIdxs& rFtnArr = GetDoc()->GetFtnIdxs();
+ const SwTxtFtn* pTxtFtn = 0;
+ sal_uInt16 nPos;
+
+ if( rFtnArr.SeekEntry( GetPoint()->nNode, &nPos ))
+ {
+ // es gibt eine Fussnote mit dem Index, suche also die
+ // naechstgelegene
+ if( nPos < rFtnArr.Count() )
+ {
+ sal_uLong nNdPos = GetPoint()->nNode.GetIndex();
+ xub_StrLen nCntPos = GetPoint()->nContent.GetIndex();
+
+ pTxtFtn = rFtnArr[ nPos ];
+ // suche vorewaerts zur naechsten
+ if( CmpLE( *pTxtFtn, nNdPos, nCntPos ) )
+ {
+ pTxtFtn = 0;
+ for( ++nPos; nPos < rFtnArr.Count(); ++nPos )
+ {
+ pTxtFtn = rFtnArr[ nPos ];
+ if( !CmpLE( *pTxtFtn, nNdPos, nCntPos ) )
+ break; // gefunden
+ pTxtFtn = 0;
+ }
+ }
+ else if( nPos )
+ {
+ // suche rueckwaerts zur vorherigen
+ pTxtFtn = 0;
+ while( nPos )
+ {
+ pTxtFtn = rFtnArr[ --nPos ];
+ if( CmpLE( *pTxtFtn, nNdPos, nCntPos ) )
+ {
+ pTxtFtn = rFtnArr[ ++nPos ];
+ break; // gefunden
+ }
+// pTxtFtn = 0;
+ }
+ }
+ }
+ }
+ else if( nPos < rFtnArr.Count() )
+ pTxtFtn = rFtnArr[ nPos ];
+
+ sal_Bool bRet = 0 != pTxtFtn;
+ if( bRet )
+ {
+ SwCrsrSaveState aSaveState( *this );
+
+ SwTxtNode& rTNd = (SwTxtNode&)pTxtFtn->GetTxtNode();
+ GetPoint()->nNode = rTNd;
+ GetPoint()->nContent.Assign( &rTNd, *pTxtFtn->GetStart() );
+ bRet = !IsSelOvr();
+ }
+ return bRet;
+}
+
+sal_Bool SwCursor::GotoPrevFtnAnchor()
+{
+ const SwFtnIdxs& rFtnArr = GetDoc()->GetFtnIdxs();
+ const SwTxtFtn* pTxtFtn = 0;
+ sal_uInt16 nPos;
+
+ if( rFtnArr.SeekEntry( GetPoint()->nNode, &nPos ) )
+ {
+ // es gibt eine Fussnote mit dem Index, suche also die
+ // naechstgelegene
+ sal_uLong nNdPos = GetPoint()->nNode.GetIndex();
+ xub_StrLen nCntPos = GetPoint()->nContent.GetIndex();
+
+ pTxtFtn = rFtnArr[ nPos ];
+ // suche vorwaerts zur naechsten
+ if( CmpL( *pTxtFtn, nNdPos, nCntPos ))
+ {
+ for( ++nPos; nPos < rFtnArr.Count(); ++nPos )
+ {
+ pTxtFtn = rFtnArr[ nPos ];
+ if( !CmpL( *pTxtFtn, nNdPos, nCntPos ) )
+ {
+ pTxtFtn = rFtnArr[ nPos-1 ];
+ break;
+ }
+ }
+ }
+ else if( nPos )
+ {
+ // suche rueckwaerts zur vorherigen
+ pTxtFtn = 0;
+ while( nPos )
+ {
+ pTxtFtn = rFtnArr[ --nPos ];
+ if( CmpL( *pTxtFtn, nNdPos, nCntPos ))
+ break; // gefunden
+ pTxtFtn = 0;
+ }
+ }
+ else
+ pTxtFtn = 0;
+ }
+ else if( nPos )
+ pTxtFtn = rFtnArr[ nPos-1 ];
+
+ sal_Bool bRet = 0 != pTxtFtn;
+ if( bRet )
+ {
+ SwCrsrSaveState aSaveState( *this );
+
+ SwTxtNode& rTNd = (SwTxtNode&)pTxtFtn->GetTxtNode();
+ GetPoint()->nNode = rTNd;
+ GetPoint()->nContent.Assign( &rTNd, *pTxtFtn->GetStart() );
+ bRet = !IsSelOvr();
+ }
+ return bRet;
+}
+
+sal_Bool SwCrsrShell::GotoNextFtnAnchor()
+{
+ return CallCrsrFN( &SwCursor::GotoNextFtnAnchor );
+}
+
+sal_Bool SwCrsrShell::GotoPrevFtnAnchor()
+{
+ return CallCrsrFN( &SwCursor::GotoPrevFtnAnchor );
+}
+
+// springe aus dem Rahmen zum Anker
+
+
+sal_Bool SwCrsrShell::GotoFlyAnchor()
+{
+ SET_CURR_SHELL( this );
+ const SwFrm* pFrm = GetCurrFrm();
+ do {
+ pFrm = pFrm->GetUpper();
+ } while( pFrm && !pFrm->IsFlyFrm() );
+
+ if( !pFrm ) // ist kein FlyFrame
+ return sal_False;
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ // springe in den BodyFrame, der am naechsten vom Fly liegt
+ SwRect aTmpRect( aCharRect );
+ if( !pFrm->Frm().IsInside( aTmpRect ))
+ aTmpRect = pFrm->Frm();
+ Point aPt( aTmpRect.Left(), aTmpRect.Top() +
+ ( aTmpRect.Bottom() - aTmpRect.Top() ) / 2 );
+ aPt.X() = aPt.X() > (pFrm->Frm().Left() + (pFrm->Frm().SSize().Width() / 2 ))
+ ? pFrm->Frm().Right()
+ : pFrm->Frm().Left();
+
+ const SwPageFrm* pPageFrm = pFrm->FindPageFrm();
+ const SwCntntFrm* pFndFrm = pPageFrm->GetCntntPos( aPt, sal_False, sal_True );
+ pFndFrm->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
+
+ sal_Bool bRet = !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ return bRet;
+}
+
+
+
+
diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx
new file mode 100644
index 000000000000..0dbc6013e465
--- /dev/null
+++ b/sw/source/core/crsr/trvlreg.cxx
@@ -0,0 +1,291 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <crsrsh.hxx>
+#include <doc.hxx>
+#include <swcrsr.hxx>
+#include <docary.hxx>
+#include <fmtcntnt.hxx>
+#include <viscrs.hxx>
+#include <callnk.hxx>
+#include <pamtyp.hxx>
+#include <section.hxx>
+
+
+
+sal_Bool GotoPrevRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion,
+ sal_Bool bInReadOnly )
+{
+ SwNodeIndex aIdx( rCurCrsr.GetPoint()->nNode );
+ SwSectionNode* pNd = aIdx.GetNode().FindSectionNode();
+ if( pNd )
+ aIdx.Assign( *pNd, - 1 );
+
+ do {
+ while( aIdx.GetIndex() &&
+ 0 == ( pNd = aIdx.GetNode().StartOfSectionNode()->GetSectionNode()) )
+ aIdx--;
+
+ if( pNd ) // gibt einen weiteren SectionNode ?
+ {
+ if( pNd->GetSection().IsHiddenFlag() ||
+ ( !bInReadOnly &&
+ pNd->GetSection().IsProtectFlag() ))
+ {
+ // geschuetzte/versteckte ueberspringen wir
+ aIdx.Assign( *pNd, - 1 );
+ }
+ else if( fnPosRegion == fnMoveForward )
+ {
+ aIdx = *pNd;
+ SwCntntNode* pCNd = pNd->GetNodes().GoNextSection( &aIdx,
+ sal_True, !bInReadOnly );
+ if( !pCNd )
+ {
+ aIdx--;
+ continue;
+ }
+ rCurCrsr.GetPoint()->nContent.Assign( pCNd, 0 );
+ }
+ else
+ {
+ aIdx = *pNd->EndOfSectionNode();
+ SwCntntNode* pCNd = pNd->GetNodes().GoPrevSection( &aIdx,
+ sal_True, !bInReadOnly );
+ if( !pCNd )
+ {
+ aIdx.Assign( *pNd, - 1 );
+ continue;
+ }
+ rCurCrsr.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ }
+
+ rCurCrsr.GetPoint()->nNode = aIdx;
+ return sal_True;
+ }
+ } while( pNd );
+ return sal_False;
+}
+
+
+sal_Bool GotoNextRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion,
+ sal_Bool bInReadOnly )
+{
+ SwNodeIndex aIdx( rCurCrsr.GetPoint()->nNode );
+ SwSectionNode* pNd = aIdx.GetNode().FindSectionNode();
+ if( pNd )
+ aIdx.Assign( *pNd->EndOfSectionNode(), - 1 );
+
+ sal_uLong nEndCount = aIdx.GetNode().GetNodes().Count()-1;
+ do {
+ while( aIdx.GetIndex() < nEndCount &&
+ 0 == ( pNd = aIdx.GetNode().GetSectionNode()) )
+ aIdx++;
+
+ if( pNd ) // gibt einen weiteren SectionNode ?
+ {
+ if( pNd->GetSection().IsHiddenFlag() ||
+ ( !bInReadOnly &&
+ pNd->GetSection().IsProtectFlag() ))
+ {
+ // geschuetzte/versteckte ueberspringen wir
+ aIdx.Assign( *pNd->EndOfSectionNode(), +1 );
+ }
+ else if( fnPosRegion == fnMoveForward )
+ {
+ aIdx = *pNd;
+ SwCntntNode* pCNd = pNd->GetNodes().GoNextSection( &aIdx,
+ sal_True, !bInReadOnly );
+ if( !pCNd )
+ {
+ aIdx.Assign( *pNd->EndOfSectionNode(), +1 );
+ continue;
+ }
+ rCurCrsr.GetPoint()->nContent.Assign( pCNd, 0 );
+ }
+ else
+ {
+ aIdx = *pNd->EndOfSectionNode();
+ SwCntntNode* pCNd = pNd->GetNodes().GoPrevSection( &aIdx,
+ sal_True, !bInReadOnly );
+ if( !pCNd )
+ {
+ aIdx++;
+ continue;
+ }
+ rCurCrsr.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ }
+
+ rCurCrsr.GetPoint()->nNode = aIdx;
+ return sal_True;
+ }
+ } while( pNd );
+ return sal_False;
+}
+
+
+sal_Bool GotoCurrRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion,
+ sal_Bool bInReadOnly )
+{
+ SwSectionNode* pNd = rCurCrsr.GetNode()->FindSectionNode();
+ if( !pNd )
+ return sal_False;
+
+ SwPosition* pPos = rCurCrsr.GetPoint();
+ sal_Bool bMoveBackward = fnPosRegion == fnMoveBackward;
+
+ SwCntntNode* pCNd;
+ if( bMoveBackward )
+ {
+ SwNodeIndex aIdx( *pNd->EndOfSectionNode() );
+ pCNd = pNd->GetNodes().GoPrevSection( &aIdx, sal_True, !bInReadOnly );
+ }
+ else
+ {
+ SwNodeIndex aIdx( *pNd );
+ pCNd = pNd->GetNodes().GoNextSection( &aIdx, sal_True, !bInReadOnly );
+ }
+
+ if( pCNd )
+ {
+ pPos->nNode = *pCNd;
+ xub_StrLen nTmpPos = bMoveBackward ? pCNd->Len() : 0;
+ pPos->nContent.Assign( pCNd, nTmpPos );
+ }
+ return 0 != pCNd;
+}
+
+
+sal_Bool GotoCurrRegionAndSkip( SwPaM& rCurCrsr, SwPosRegion fnPosRegion,
+ sal_Bool bInReadOnly )
+{
+ SwNode* pCurrNd = rCurCrsr.GetNode();
+ SwSectionNode* pNd = pCurrNd->FindSectionNode();
+ if( !pNd )
+ return sal_False;
+
+ SwPosition* pPos = rCurCrsr.GetPoint();
+ xub_StrLen nCurrCnt = pPos->nContent.GetIndex();
+ sal_Bool bMoveBackward = fnPosRegion == fnMoveBackward;
+
+ do {
+ SwCntntNode* pCNd;
+ if( bMoveBackward ) // ans Ende vom Bereich
+ {
+ SwNodeIndex aIdx( *pNd->EndOfSectionNode() );
+ pCNd = pNd->GetNodes().GoPrevSection( &aIdx, sal_True, !bInReadOnly );
+ if( !pCNd )
+ return sal_False;
+ pPos->nNode = aIdx;
+ }
+ else
+ {
+ SwNodeIndex aIdx( *pNd );
+ pCNd = pNd->GetNodes().GoNextSection( &aIdx, sal_True, !bInReadOnly );
+ if( !pCNd )
+ return sal_False;
+ pPos->nNode = aIdx;
+ }
+
+ xub_StrLen nTmpPos = bMoveBackward ? pCNd->Len() : 0;
+ pPos->nContent.Assign( pCNd, nTmpPos );
+
+ if( &pPos->nNode.GetNode() != pCurrNd ||
+ pPos->nContent.GetIndex() != nCurrCnt )
+ // es gab eine Veraenderung
+ return sal_True;
+
+ // dann versuche mal den "Parent" dieser Section
+ SwSection* pParent = pNd->GetSection().GetParent();
+ pNd = pParent ? pParent->GetFmt()->GetSectionNode() : 0;
+ } while( pNd );
+ return sal_False;
+}
+
+
+
+sal_Bool SwCursor::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion )
+{
+ SwCrsrSaveState aSaveState( *this );
+ return !dynamic_cast<SwTableCursor*>(this) &&
+ (*fnWhichRegion)( *this, fnPosRegion, IsReadOnlyAvailable() ) &&
+ !IsSelOvr() &&
+ ( GetPoint()->nNode.GetIndex() != pSavePos->nNode ||
+ GetPoint()->nContent.GetIndex() != pSavePos->nCntnt );
+}
+
+sal_Bool SwCrsrShell::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ sal_Bool bRet = !pTblCrsr && pCurCrsr->MoveRegion( fnWhichRegion, fnPosRegion );
+ if( bRet )
+ UpdateCrsr();
+ return bRet;
+}
+
+
+sal_Bool SwCursor::GotoRegion( const String& rName )
+{
+ sal_Bool bRet = sal_False;
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = rFmts.Count(); n; )
+ {
+ const SwSectionFmt* pFmt = rFmts[ --n ];
+ const SwNodeIndex* pIdx;
+ const SwSection* pSect;
+ if( 0 != ( pSect = pFmt->GetSection() ) &&
+ pSect->GetSectionName() == rName &&
+ 0 != ( pIdx = pFmt->GetCntnt().GetCntntIdx() ) &&
+ pIdx->GetNode().GetNodes().IsDocNodes() )
+ {
+ // ein Bereich im normalen NodesArr
+ SwCrsrSaveState aSaveState( *this );
+
+ GetPoint()->nNode = *pIdx;
+ Move( fnMoveForward, fnGoCntnt );
+ bRet = !IsSelOvr();
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwCrsrShell::GotoRegion( const String& rName )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ sal_Bool bRet = !pTblCrsr && pCurCrsr->GotoRegion( rName );
+ if( bRet )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY ); // und den akt. Updaten
+ return bRet;
+}
+
+
+
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
new file mode 100644
index 000000000000..ee33dd8208e3
--- /dev/null
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -0,0 +1,931 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <hintids.hxx>
+
+#include <vcl/svapp.hxx>
+#include <editeng/protitem.hxx>
+#include <crsrsh.hxx>
+#include <doc.hxx>
+#include <cntfrm.hxx>
+#include <editsh.hxx> //EndAllAction gibts nur an der EditShell
+#include <pam.hxx>
+#include <swtable.hxx>
+#include <docary.hxx>
+#include <frmatr.hxx>
+#include <frmfmt.hxx>
+#include <viscrs.hxx>
+#include <callnk.hxx>
+#include <tabfrm.hxx>
+#include <ndtxt.hxx>
+#include <shellres.hxx>
+#include <cellatr.hxx>
+#include <cellfrm.hxx>
+#include <rowfrm.hxx>
+
+
+// setze Crsr in die naechsten/vorherigen Celle
+sal_Bool SwCrsrShell::GoNextCell( sal_Bool bAppendLine )
+{
+ sal_Bool bRet = sal_False;
+ const SwTableNode* pTblNd = 0;
+
+ if( IsTableMode() || 0 != ( pTblNd = IsCrsrInTbl() ))
+ {
+ SwCursor* pCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ bRet = sal_True;
+
+ // Check if we have to move the cursor to a covered cell before
+ // proceeding:
+ const SwNode* pTableBoxStartNode = pCrsr->GetNode()->FindTableBoxStartNode();
+ const SwTableBox* pTableBox = 0;
+
+ if ( pCrsr->GetCrsrRowSpanOffset() )
+ {
+ pTableBox = pTableBoxStartNode->GetTblBox();
+ if ( pTableBox->getRowSpan() > 1 )
+ {
+ if ( !pTblNd )
+ pTblNd = IsCrsrInTbl();
+ pTableBox = & pTableBox->FindEndOfRowSpan( pTblNd->GetTable(),
+ (sal_uInt16)(pTableBox->getRowSpan() + pCrsr->GetCrsrRowSpanOffset() ) );
+ pTableBoxStartNode = pTableBox->GetSttNd();
+ }
+ }
+
+ SwNodeIndex aCellStt( *pTableBoxStartNode->EndOfSectionNode(), 1 );
+
+ // folgt nach dem EndNode der Cell ein weiterer StartNode, dann
+ // gibt es auch eine naechste Celle
+
+ if( !aCellStt.GetNode().IsStartNode() )
+ {
+ if( pCrsr->HasMark() || !bAppendLine )
+ bRet = sal_False;
+ else
+ {
+ // auf besonderen Wunsch: keine Line mehr vorhanden, dann
+ // mache doch eine neue:
+ if ( !pTableBox )
+ pTableBox = pTblNd->GetTable().GetTblBox(
+ pCrsr->GetPoint()->nNode.GetNode().
+ StartOfSectionIndex() );
+
+ ASSERT( pTableBox, "Box steht nicht in dieser Tabelle" );
+ SwSelBoxes aBoxes;
+
+ //Das Dokument veraendert sich evtl. ohne Action wuerden die Sichten
+ //nichts mitbekommen.
+ ((SwEditShell*)this)->StartAllAction();
+ bRet = pDoc->InsertRow( pTblNd->GetTable().
+ SelLineFromBox( pTableBox, aBoxes, sal_False ));
+ ((SwEditShell*)this)->EndAllAction();
+ }
+ }
+ if( bRet && 0 != ( bRet = pCrsr->GoNextCell() ))
+ UpdateCrsr(); // und den akt. Updaten
+ }
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::GoPrevCell()
+{
+ sal_Bool bRet = sal_False;
+ const SwTableNode* pTblNd;
+ if( IsTableMode() || 0 != ( pTblNd = IsCrsrInTbl() ))
+ {
+ SwCursor* pCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ bRet = pCrsr->GoPrevCell();
+ if( bRet )
+ UpdateCrsr(); // und den akt. Updaten
+ }
+ return bRet;
+}
+
+const SwFrm* lcl_FindMostUpperCellFrm( const SwFrm* pFrm )
+{
+ while ( pFrm &&
+ ( !pFrm->IsCellFrm() ||
+ !pFrm->GetUpper()->GetUpper()->IsTabFrm() ||
+ pFrm->GetUpper()->GetUpper()->GetUpper()->IsInTab() ) )
+ {
+ pFrm = pFrm->GetUpper();
+ }
+ return pFrm;
+}
+
+sal_Bool SwCrsrShell::_SelTblRowOrCol( bool bRow, bool bRowSimple )
+{
+ // pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen
+ SwFrm *pFrm = GetCurrFrm();
+ if( !pFrm->IsInTab() )
+ return sal_False;
+
+ const SwTabFrm* pTabFrm = pFrm->FindTabFrm();
+ const SwTabFrm* pMasterTabFrm = pTabFrm->IsFollow() ? pTabFrm->FindMaster( true ) : pTabFrm;
+ const SwTable* pTable = pTabFrm->GetTable();
+
+ SET_CURR_SHELL( this );
+
+ const SwTableBox* pStt = 0;
+ const SwTableBox* pEnd = 0;
+
+ // lasse ueber das Layout die Boxen suchen
+ SwSelBoxes aBoxes;
+ SwTblSearchType eType = bRow ? nsSwTblSearchType::TBLSEARCH_ROW : nsSwTblSearchType::TBLSEARCH_COL;
+ const bool bCheckProtected = !IsReadOnlyAvailable();
+
+ if( bCheckProtected )
+ eType = (SwTblSearchType)(eType | nsSwTblSearchType::TBLSEARCH_PROTECT);
+
+ if ( !bRowSimple )
+ {
+ GetTblSel( *this, aBoxes, eType );
+
+ if( !aBoxes.Count() )
+ return sal_False;
+
+ pStt = aBoxes[0];
+ pEnd = aBoxes[aBoxes.Count() - 1];
+ }
+ // --> FME 2004-07-30 #i32329# Enhanced table selection
+ else if ( pTable->IsNewModel() )
+ {
+ const SwShellCrsr *pCrsr = _GetCrsr();
+ SwTable::SearchType eSearchType = bRow ? SwTable::SEARCH_ROW : SwTable::SEARCH_COL;
+ pTable->CreateSelection( *pCrsr, aBoxes, eSearchType, bCheckProtected );
+ if( !aBoxes.Count() )
+ return sal_False;
+
+ pStt = aBoxes[0];
+ pEnd = aBoxes[aBoxes.Count() - 1];
+ }
+ else
+ {
+ const SwShellCrsr *pCrsr = _GetCrsr();
+ const SwFrm* pStartFrm = pFrm;
+ const SwCntntNode *pCNd = pCrsr->GetCntntNode( sal_False );
+ const SwFrm* pEndFrm = pCNd ? pCNd->getLayoutFrm( GetLayout(), &pCrsr->GetMkPos() ) : 0;
+
+ if ( bRow )
+ {
+ pStartFrm = lcl_FindMostUpperCellFrm( pStartFrm );
+ pEndFrm = lcl_FindMostUpperCellFrm( pEndFrm );
+ }
+
+ if ( !pStartFrm || !pEndFrm )
+ return sal_False;
+
+ const bool bVert = pFrm->ImplFindTabFrm()->IsVertical();
+
+ // If we select upwards it is sufficient to set pStt and pEnd
+ // to the first resp. last box of the selection obtained from
+ // GetTblSel. However, selecting downwards requires the frames
+ // located at the corners of the selection. This does not work
+ // for column selections in vertical tables:
+ const bool bSelectUp = ( bVert && !bRow ) ||
+ *pCrsr->GetPoint() <= *pCrsr->GetMark();
+ SwCellFrms aCells;
+ GetTblSel( static_cast<const SwCellFrm*>(pStartFrm),
+ static_cast<const SwCellFrm*>(pEndFrm),
+ aBoxes, bSelectUp ? 0 : &aCells, eType );
+
+ if( !aBoxes.Count() || ( !bSelectUp && 4 != aCells.Count() ) )
+ return sal_False;
+
+ if ( bSelectUp )
+ {
+ pStt = aBoxes[0];
+ pEnd = aBoxes[aBoxes.Count() - 1];
+ }
+ else
+ {
+ pStt = aCells[ bVert ? (bRow ? 0 : 3) : (bRow ? 2 : 1) ]->GetTabBox(); // will become point of table cursor
+ pEnd = aCells[ bVert ? (bRow ? 3 : 0) : (bRow ? 1 : 2) ]->GetTabBox(); // will become mark of table cursor
+ }
+ }
+ // <--
+
+ // noch kein Tabellen-Cursor vorhanden, dann erzeuge einen
+ if( !pTblCrsr )
+ {
+ pTblCrsr = new SwShellTableCrsr( *this, *pCurCrsr->GetPoint() );
+ pCurCrsr->DeleteMark();
+ pCurCrsr->SwSelPaintRects::Hide();
+ }
+
+ pTblCrsr->DeleteMark();
+
+ // dann setze mal Anfang und Ende der Spalte
+ pTblCrsr->GetPoint()->nNode = *pEnd->GetSttNd();
+ pTblCrsr->Move( fnMoveForward, fnGoCntnt );
+ pTblCrsr->SetMark();
+ pTblCrsr->GetPoint()->nNode = *pStt->GetSttNd()->EndOfSectionNode();
+ pTblCrsr->Move( fnMoveBackward, fnGoCntnt );
+
+ // set PtPos 'close' to the reference table, otherwise we might get problems with the
+ // repeated headlines check in UpdateCrsr():
+ if ( !bRow )
+ pTblCrsr->GetPtPos() = pMasterTabFrm->IsVertical() ? pMasterTabFrm->Frm().TopRight() : pMasterTabFrm->Frm().TopLeft();
+
+ UpdateCrsr(); // und den akt. Updaten
+ return sal_True;
+}
+
+sal_Bool SwCrsrShell::SelTbl()
+{
+ // pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen
+ SwFrm *pFrm = GetCurrFrm();
+ if( !pFrm->IsInTab() )
+ return sal_False;
+
+ const SwTabFrm *pTblFrm = pFrm->ImplFindTabFrm();
+ const SwTabFrm* pMasterTabFrm = pTblFrm->IsFollow() ? pTblFrm->FindMaster( true ) : pTblFrm;
+ const SwTableNode* pTblNd = pTblFrm->GetTable()->GetTableNode();
+
+ SET_CURR_SHELL( this );
+
+ if( !pTblCrsr )
+ {
+ pTblCrsr = new SwShellTableCrsr( *this, *pCurCrsr->GetPoint() );
+ pCurCrsr->DeleteMark();
+ pCurCrsr->SwSelPaintRects::Hide();
+ }
+
+ pTblCrsr->DeleteMark();
+ pTblCrsr->GetPoint()->nNode = *pTblNd;
+ pTblCrsr->Move( fnMoveForward, fnGoCntnt );
+ pTblCrsr->SetMark();
+ // set MkPos 'close' to the master table, otherwise we might get problems with the
+ // repeated headlines check in UpdateCrsr():
+ pTblCrsr->GetMkPos() = pMasterTabFrm->IsVertical() ? pMasterTabFrm->Frm().TopRight() : pMasterTabFrm->Frm().TopLeft();
+ pTblCrsr->GetPoint()->nNode = *pTblNd->EndOfSectionNode();
+ pTblCrsr->Move( fnMoveBackward, fnGoCntnt );
+ UpdateCrsr(); // und den akt. Updaten
+ return sal_True;
+}
+
+
+sal_Bool SwCrsrShell::SelTblBox()
+{
+ // if we're in a table, create a table cursor, and select the cell
+ // that the current cursor's point resides in
+
+ // search for start node of our table box. If not found, exit realy
+ const SwStartNode* pStartNode =
+ pCurCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+
+#ifdef DBG_UTIL
+ // the old code checks whether we're in a table by asking the
+ // frame. This should yield the same result as searching for the
+ // table box start node, right?
+ SwFrm *pFrm = GetCurrFrm();
+ DBG_ASSERT( !pFrm->IsInTab() == !(pStartNode != NULL),
+ "Schroedinger's table: We're in a box, and also we aren't." );
+#endif
+
+ if( pStartNode == NULL )
+ return sal_False;
+
+
+ SET_CURR_SHELL( this );
+
+ // create a table cursor, if there isn't one already
+ if( !pTblCrsr )
+ {
+ pTblCrsr = new SwShellTableCrsr( *this, *pCurCrsr->GetPoint() );
+ pCurCrsr->DeleteMark();
+ pCurCrsr->SwSelPaintRects::Hide();
+ }
+
+ // select the complete box with our shiny new pTblCrsr
+ // 1. delete mark, and move point to first content node in box
+ // 2. set mark, and move point to last content node in box
+ // 3. exchange
+
+ pTblCrsr->DeleteMark();
+ *(pTblCrsr->GetPoint()) = SwPosition( *pStartNode );
+ pTblCrsr->Move( fnMoveForward, fnGoNode );
+
+ pTblCrsr->SetMark();
+ *(pTblCrsr->GetPoint()) = SwPosition( *(pStartNode->EndOfSectionNode()) );
+ pTblCrsr->Move( fnMoveBackward, fnGoNode );
+
+ pTblCrsr->Exchange();
+
+ // with some luck, UpdateCrsr() will now update everything that
+ // needs updateing
+ UpdateCrsr();
+
+ return sal_True;
+}
+
+// return the next non-protected cell inside a table
+// rIdx - is on a table node
+// return:
+// true - Idx points to content in a suitable cell
+// false - could not find a suitable cell
+bool lcl_FindNextCell( SwNodeIndex& rIdx, sal_Bool bInReadOnly )
+{
+ // ueberpruefe geschuetzte Zellen
+ SwNodeIndex aTmp( rIdx, 2 ); // TableNode + StartNode
+
+ // the resulting cell should be in that table:
+ const SwTableNode* pTblNd = rIdx.GetNode().GetTableNode();
+
+ if ( !pTblNd )
+ {
+ ASSERT( false, "lcl_FindNextCell not celled with table start node!" )
+ return false;
+ }
+
+ const SwNode* pTableEndNode = pTblNd->EndOfSectionNode();
+
+ SwNodes& rNds = aTmp.GetNode().GetNodes();
+ SwCntntNode* pCNd = aTmp.GetNode().GetCntntNode();
+
+ // no content node => go to next content node
+ if( !pCNd )
+ pCNd = rNds.GoNext( &aTmp );
+
+ // robust
+ if ( !pCNd )
+ return false;
+
+ SwCntntFrm* pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() );
+
+ if ( 0 == pFrm || pCNd->FindTableNode() != pTblNd ||
+ (!bInReadOnly && pFrm->IsProtected() ) )
+ {
+ // we are not located inside a 'valid' cell. We have to continue searching...
+
+ // skip behind current section. This might be the end of the table cell
+ // or behind a inner section or or or...
+ aTmp.Assign( *pCNd->EndOfSectionNode(), 1 );
+
+ // loop to find a suitable cell...
+ for( ;; )
+ {
+ SwNode* pNd = &aTmp.GetNode();
+
+ // we break this loop if we reached the end of the table.
+ // to make this code even more robust, we also break if we are
+ // already behind the table end node:
+ if( pNd == pTableEndNode || /*robust: */ pNd->GetIndex() > pTableEndNode->GetIndex() )
+ return false;
+
+ // ok, get the next content node:
+ pCNd = aTmp.GetNode().GetCntntNode();
+ if( 0 == pCNd )
+ pCNd = rNds.GoNext( &aTmp );
+
+ // robust:
+ if ( !pCNd )
+ return false;
+
+ // check if we have found a suitable table cell:
+ pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() );
+
+ if ( 0 != pFrm && pCNd->FindTableNode() == pTblNd &&
+ (bInReadOnly || !pFrm->IsProtected() ) )
+ {
+ // finally, we have found a suitable table cell => set index and return
+ rIdx = *pCNd;
+ return true;
+ }
+
+ // continue behind the current section:
+ aTmp.Assign( *pCNd->EndOfSectionNode(), +1 );
+ }
+ }
+
+ rIdx = *pCNd;
+ return true;
+}
+
+// comments see lcl_FindNextCell
+bool lcl_FindPrevCell( SwNodeIndex& rIdx, sal_Bool bInReadOnly )
+{
+ SwNodeIndex aTmp( rIdx, -2 ); // TableNode + EndNode
+
+ const SwNode* pTableEndNode = &rIdx.GetNode();
+ const SwTableNode* pTblNd = pTableEndNode->StartOfSectionNode()->GetTableNode();
+
+ if ( !pTblNd )
+ {
+ ASSERT( false, "lcl_FindPrevCell not celled with table start node!" )
+ return false;
+ }
+
+ SwNodes& rNds = aTmp.GetNode().GetNodes();
+ SwCntntNode* pCNd = aTmp.GetNode().GetCntntNode();
+
+ if( !pCNd )
+ pCNd = rNds.GoPrevious( &aTmp );
+
+ if ( !pCNd )
+ return false;
+
+ SwCntntFrm* pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() );
+
+ if( 0 == pFrm || pCNd->FindTableNode() != pTblNd ||
+ (!bInReadOnly && pFrm->IsProtected() ))
+ {
+ // skip before current section
+ aTmp.Assign( *pCNd->StartOfSectionNode(), -1 );
+ for( ;; )
+ {
+ SwNode* pNd = &aTmp.GetNode();
+
+ if( pNd == pTblNd || pNd->GetIndex() < pTblNd->GetIndex() )
+ return false;
+
+ pCNd = aTmp.GetNode().GetCntntNode();
+ if( 0 == pCNd )
+ pCNd = rNds.GoPrevious( &aTmp );
+
+ if ( !pCNd )
+ return false;
+
+ pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() );
+
+ if( 0 != pFrm && pCNd->FindTableNode() == pTblNd &&
+ (bInReadOnly || !pFrm->IsProtected() ) )
+ {
+ rIdx = *pCNd;
+ return true; // Ok, nicht geschuetzt
+ }
+ aTmp.Assign( *pCNd->StartOfSectionNode(), - 1 );
+ }
+ }
+
+ rIdx = *pCNd;
+ return true;
+}
+
+
+sal_Bool GotoPrevTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl,
+ sal_Bool bInReadOnly )
+{
+ SwNodeIndex aIdx( rCurCrsr.GetPoint()->nNode );
+
+ SwTableNode* pTblNd = aIdx.GetNode().FindTableNode();
+ if( pTblNd )
+ {
+ // #i26532#: If we are inside a table, we may not go backward
+ // to the table start node, because we would miss any tables
+ // inside this table.
+ SwTableNode* pInnerTblNd = 0;
+ SwNodeIndex aTmpIdx( aIdx );
+ while( aTmpIdx.GetIndex() &&
+ 0 == ( pInnerTblNd = aTmpIdx.GetNode().StartOfSectionNode()->GetTableNode()) )
+ aTmpIdx--;
+
+ if( pInnerTblNd == pTblNd )
+ aIdx.Assign( *pTblNd, - 1 );
+ }
+
+ do {
+ while( aIdx.GetIndex() &&
+ 0 == ( pTblNd = aIdx.GetNode().StartOfSectionNode()->GetTableNode()) )
+ aIdx--;
+
+ if( pTblNd ) // gibt einen weiteren TableNode ?
+ {
+ if( fnPosTbl == fnMoveForward ) // an Anfang ?
+ {
+ aIdx = *aIdx.GetNode().StartOfSectionNode();
+ if( !lcl_FindNextCell( aIdx, bInReadOnly ))
+ {
+ // Tabelle ueberspringen
+ aIdx.Assign( *pTblNd, -1 );
+ continue;
+ }
+ }
+ else
+ {
+ // ueberpruefe geschuetzte Zellen
+ if( !lcl_FindNextCell( aIdx, bInReadOnly ))
+ {
+ // Tabelle ueberspringen
+ aIdx.Assign( *pTblNd, -1 );
+ continue;
+ }
+ }
+
+ SwTxtNode* pTxtNode = aIdx.GetNode().GetTxtNode();
+ if ( pTxtNode )
+ {
+ rCurCrsr.GetPoint()->nNode = *pTxtNode;
+ rCurCrsr.GetPoint()->nContent.Assign( pTxtNode, fnPosTbl == fnMoveBackward ?
+ pTxtNode->Len() :
+ 0 );
+ }
+ return sal_True;
+ }
+ } while( pTblNd );
+
+ return sal_False;
+}
+
+
+sal_Bool GotoNextTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl,
+ sal_Bool bInReadOnly )
+{
+ SwNodeIndex aIdx( rCurCrsr.GetPoint()->nNode );
+ SwTableNode* pTblNd = aIdx.GetNode().FindTableNode();
+
+ if( pTblNd )
+ aIdx.Assign( *pTblNd->EndOfSectionNode(), 1 );
+
+ sal_uLong nLastNd = rCurCrsr.GetDoc()->GetNodes().Count() - 1;
+ do {
+ while( aIdx.GetIndex() < nLastNd &&
+ 0 == ( pTblNd = aIdx.GetNode().GetTableNode()) )
+ aIdx++;
+ if( pTblNd ) // gibt einen weiteren TableNode ?
+ {
+ if( fnPosTbl == fnMoveForward ) // an Anfang ?
+ {
+ if( !lcl_FindNextCell( aIdx, bInReadOnly ))
+ {
+ // Tabelle ueberspringen
+ aIdx.Assign( *pTblNd->EndOfSectionNode(), + 1 );
+ continue;
+ }
+ }
+ else
+ {
+ aIdx = *aIdx.GetNode().EndOfSectionNode();
+ // ueberpruefe geschuetzte Zellen
+ if( !lcl_FindNextCell( aIdx, bInReadOnly ))
+ {
+ // Tabelle ueberspringen
+ aIdx.Assign( *pTblNd->EndOfSectionNode(), + 1 );
+ continue;
+ }
+ }
+
+ SwTxtNode* pTxtNode = aIdx.GetNode().GetTxtNode();
+ if ( pTxtNode )
+ {
+ rCurCrsr.GetPoint()->nNode = *pTxtNode;
+ rCurCrsr.GetPoint()->nContent.Assign( pTxtNode, fnPosTbl == fnMoveBackward ?
+ pTxtNode->Len() :
+ 0 );
+ }
+ return sal_True;
+ }
+ } while( pTblNd );
+
+ return sal_False;
+}
+
+
+sal_Bool GotoCurrTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl,
+ sal_Bool bInReadOnly )
+{
+ SwTableNode* pTblNd = rCurCrsr.GetPoint()->nNode.GetNode().FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ SwTxtNode* pTxtNode = 0;
+ if( fnPosTbl == fnMoveBackward ) // ans Ende der Tabelle
+ {
+ SwNodeIndex aIdx( *pTblNd->EndOfSectionNode() );
+ if( !lcl_FindPrevCell( aIdx, bInReadOnly ))
+ return sal_False;
+ pTxtNode = aIdx.GetNode().GetTxtNode();
+ }
+ else
+ {
+ SwNodeIndex aIdx( *pTblNd );
+ if( !lcl_FindNextCell( aIdx, bInReadOnly ))
+ return sal_False;
+ pTxtNode = aIdx.GetNode().GetTxtNode();
+ }
+
+ if ( pTxtNode )
+ {
+ rCurCrsr.GetPoint()->nNode = *pTxtNode;
+ rCurCrsr.GetPoint()->nContent.Assign( pTxtNode, fnPosTbl == fnMoveBackward ?
+ pTxtNode->Len() :
+ 0 );
+ }
+
+ return sal_True;
+}
+
+
+sal_Bool SwCursor::MoveTable( SwWhichTable fnWhichTbl, SwPosTable fnPosTbl )
+{
+ sal_Bool bRet = sal_False;
+ SwTableCursor* pTblCrsr = dynamic_cast<SwTableCursor*>(this);
+
+ if( pTblCrsr || !HasMark() ) // nur wenn kein Mark oder ein TblCrsr
+ {
+ SwCrsrSaveState aSaveState( *this );
+ bRet = (*fnWhichTbl)( *this, fnPosTbl, IsReadOnlyAvailable() ) &&
+ !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE );
+ }
+ return bRet;
+}
+
+sal_Bool SwCrsrShell::MoveTable( SwWhichTable fnWhichTbl, SwPosTable fnPosTbl )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ SwShellCrsr* pCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+ sal_Bool bCheckPos, bRet;
+ sal_uLong nPtNd = 0;
+ xub_StrLen nPtCnt = 0;
+
+ if( !pTblCrsr && pCurCrsr->HasMark() ) // wenn Mark und kein TblCrsr,
+ {
+ // dann auf jedenfall in den Tabellen-Modus schalten
+ pTblCrsr = new SwShellTableCrsr( *this, *pCurCrsr->GetPoint() );
+ pCurCrsr->DeleteMark();
+ pCurCrsr->SwSelPaintRects::Hide();
+ pTblCrsr->SetMark();
+ pCrsr = pTblCrsr;
+ bCheckPos = sal_False;
+ }
+ else
+ {
+ bCheckPos = sal_True;
+ nPtNd = pCrsr->GetPoint()->nNode.GetIndex();
+ nPtCnt = pCrsr->GetPoint()->nContent.GetIndex();
+ }
+
+ bRet = pCrsr->MoveTable( fnWhichTbl, fnPosTbl );
+
+ if( bRet )
+ {
+ //JP 28.10.97: Bug 45028 - die "oberste" Position setzen fuer
+ // wiederholte Kopfzeilen
+ pCrsr->GetPtPos() = Point();
+
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+
+ if( bCheckPos &&
+ pCrsr->GetPoint()->nNode.GetIndex() == nPtNd &&
+ pCrsr->GetPoint()->nContent.GetIndex() == nPtCnt )
+ bRet = sal_False;
+ }
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::IsTblComplex() const
+{
+ SwFrm *pFrm = GetCurrFrm( sal_False );
+ if ( pFrm && pFrm->IsInTab() )
+ return pFrm->FindTabFrm()->GetTable()->IsTblComplex();
+ return sal_False;
+}
+
+
+sal_Bool SwCrsrShell::IsTblComplexForChart()
+{
+ sal_Bool bRet = sal_False;
+
+ StartAction(); // IsTblComplexForChart() may trigger table formatting
+ // we better do that inside an action
+
+ const SwTableNode* pTNd = pCurCrsr->GetPoint()->nNode.GetNode().FindTableNode();
+ if( pTNd )
+ {
+ // wir stehen in der Tabelle, dann teste mal, ob die Tabelle oder die
+ // Selektion ausgeglichen ist.
+ String sSel;
+ if( pTblCrsr )
+ sSel = GetBoxNms();
+ bRet = pTNd->GetTable().IsTblComplexForChart( sSel );
+ }
+
+ EndAction();
+
+ return bRet;
+}
+
+String SwCrsrShell::GetBoxNms() const
+{
+ String sNm;
+ const SwPosition* pPos;
+ SwFrm* pFrm;
+
+ if( IsTableMode() )
+ {
+ SwCntntNode *pCNd = pTblCrsr->Start()->nNode.GetNode().GetCntntNode();
+ pFrm = pCNd ? pCNd->getLayoutFrm( GetLayout() ) : 0;
+ if( !pFrm )
+ return sNm;
+
+ do {
+ pFrm = pFrm->GetUpper();
+ } while ( pFrm && !pFrm->IsCellFrm() );
+
+ ASSERT( pFrm, "kein Frame zur Box" );
+ sNm = ((SwCellFrm*)pFrm)->GetTabBox()->GetName();
+ sNm += ':';
+ pPos = pTblCrsr->End();
+ }
+ else
+ {
+ const SwTableNode* pTblNd = IsCrsrInTbl();
+ if( !pTblNd )
+ return sNm;
+ pPos = GetCrsr()->GetPoint();
+ }
+
+ SwCntntNode* pCNd = pPos->nNode.GetNode().GetCntntNode();
+ pFrm = pCNd ? pCNd->getLayoutFrm( GetLayout() ) : 0;
+
+ if( pFrm )
+ {
+ do {
+ pFrm = pFrm->GetUpper();
+ } while ( pFrm && !pFrm->IsCellFrm() );
+
+ if( pFrm )
+ sNm += ((SwCellFrm*)pFrm)->GetTabBox()->GetName();
+ }
+ return sNm;
+}
+
+
+sal_Bool SwCrsrShell::GotoTable( const String& rName )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ sal_Bool bRet = !pTblCrsr && pCurCrsr->GotoTable( rName );
+ if( bRet )
+ {
+ pCurCrsr->GetPtPos() = Point();
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY ); // und den akt. Updaten
+ }
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::CheckTblBoxCntnt( const SwPosition* pPos )
+{
+ if( !pBoxIdx || !pBoxPtr || IsSelTblCells() || !IsAutoUpdateCells() )
+ return sal_False;
+
+ // ueberpruefe, ob der Box Inhalt mit dem angegebenen Format der Box
+ // ueber einstimmt. Wenn nicht, setze neu
+ SwTableBox* pChkBox = 0;
+ SwStartNode* pSttNd = 0;
+ if( !pPos )
+ {
+ // gesicherte Position heraus holen.
+ if( pBoxIdx && pBoxPtr &&
+ 0 != ( pSttNd = pBoxIdx->GetNode().GetStartNode() ) &&
+ SwTableBoxStartNode == pSttNd->GetStartNodeType() &&
+ pBoxPtr == pSttNd->FindTableNode()->GetTable().
+ GetTblBox( pBoxIdx->GetIndex() ) )
+ pChkBox = pBoxPtr;
+ }
+ else if( 0 != ( pSttNd = pPos->nNode.GetNode().
+ FindSttNodeByType( SwTableBoxStartNode )) )
+ {
+ pChkBox = pSttNd->FindTableNode()->GetTable().GetTblBox( pSttNd->GetIndex() );
+ }
+
+
+ // Box mehr als 1 Absatz?
+ if( pChkBox && pSttNd->GetIndex() + 2 != pSttNd->EndOfSectionIndex() )
+ pChkBox = 0;
+
+ // jetzt sollten wir mal die Pointer zerstoeren, bevor eine erneute
+ // Actionklammerung kommt.
+ if( !pPos && !pChkBox )
+ ClearTblBoxCntnt();
+
+ // liegt der Cursor nicht mehr in dem Bereich ?
+ if( pChkBox && !pPos &&
+ ( pCurCrsr->HasMark() || pCurCrsr->GetNext() != pCurCrsr ||
+ pSttNd->GetIndex() + 1 == pCurCrsr->GetPoint()->nNode.GetIndex() ))
+ pChkBox = 0;
+
+ //JP 12.01.99: hat sich der Inhalt der Box ueberhaupt veraendert?
+ // Ist wichtig, wenn z.B. Undo nicht den richtigen Inhalt wieder
+ // herstellen konnte.
+ if( pChkBox )
+ {
+ const SwTxtNode* pNd = GetDoc()->GetNodes()[
+ pSttNd->GetIndex() + 1 ]->GetTxtNode();
+ if( !pNd ||
+ ( pNd->GetTxt() == ViewShell::GetShellRes()->aCalc_Error &&
+ SFX_ITEM_SET == pChkBox->GetFrmFmt()->
+ GetItemState( RES_BOXATR_FORMULA )) )
+ pChkBox = 0;
+ }
+
+ if( pChkBox )
+ {
+ // jetzt sollten wir mal die Pointer zerstoeren, bevor ein weiterer
+ // aufruf kommt.
+ ClearTblBoxCntnt();
+ StartAction();
+ GetDoc()->ChkBoxNumFmt( *pChkBox, sal_True );
+ EndAction();
+ }
+
+ return 0 != pChkBox;
+}
+
+
+void SwCrsrShell::SaveTblBoxCntnt( const SwPosition* pPos )
+{
+ if( IsSelTblCells() || !IsAutoUpdateCells() )
+ return ;
+
+ if( !pPos )
+ pPos = pCurCrsr->GetPoint();
+
+ SwStartNode* pSttNd = pPos->nNode.GetNode().FindSttNodeByType( SwTableBoxStartNode );
+
+ sal_Bool bCheckBox = sal_False;
+ if( pSttNd && pBoxIdx )
+ {
+ if( pSttNd == &pBoxIdx->GetNode() )
+ pSttNd = 0; // die haben wir schon
+ else
+ bCheckBox = sal_True;
+ }
+ else
+ bCheckBox = 0 != pBoxIdx;
+
+ if( bCheckBox )
+ {
+ // pBoxIdx Checken
+ SwPosition aPos( *pBoxIdx );
+ CheckTblBoxCntnt( &aPos );
+ }
+
+ if( pSttNd )
+ {
+ pBoxPtr = pSttNd->FindTableNode()->GetTable().GetTblBox( pSttNd->GetIndex() );
+
+ if( pBoxIdx )
+ *pBoxIdx = *pSttNd;
+ else
+ pBoxIdx = new SwNodeIndex( *pSttNd );
+ }
+}
+
+
+void SwCrsrShell::ClearTblBoxCntnt()
+{
+ delete pBoxIdx, pBoxIdx = 0;
+ pBoxPtr = 0;
+}
+
+sal_Bool SwCrsrShell::EndAllTblBoxEdit()
+{
+ sal_Bool bRet = sal_False;
+ ViewShell *pSh = this;
+ do {
+ if( pSh->IsA( TYPE( SwCrsrShell ) ) )
+ bRet |= ((SwCrsrShell*)pSh)->CheckTblBoxCntnt(
+ ((SwCrsrShell*)pSh)->pCurCrsr->GetPoint() );
+
+ } while( this != (pSh = (ViewShell *)pSh->GetNext()) );
+ return bRet;
+}
+
+
+
+
diff --git a/sw/source/core/crsr/unocrsr.cxx b/sw/source/core/crsr/unocrsr.cxx
new file mode 100644
index 000000000000..7a25fe5c47a2
--- /dev/null
+++ b/sw/source/core/crsr/unocrsr.cxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <unocrsr.hxx>
+#include <doc.hxx>
+#include <swtable.hxx>
+#include <docary.hxx>
+#include <rootfrm.hxx>
+
+SV_IMPL_PTRARR( SwUnoCrsrTbl, SwUnoCrsrPtr )
+
+IMPL_FIXEDMEMPOOL_NEWDEL( SwUnoCrsr, 10, 10 )
+
+SwUnoCrsr::SwUnoCrsr( const SwPosition &rPos, SwPaM* pRing )
+ : SwCursor( rPos, pRing, false ), SwModify( 0 ),
+ bRemainInSection( sal_True ),
+ bSkipOverHiddenSections( sal_False ),
+ bSkipOverProtectSections( sal_False )
+
+{}
+
+SwUnoCrsr::~SwUnoCrsr()
+{
+ SwDoc* pDoc = GetDoc();
+ if( !pDoc->IsInDtor() )
+ {
+ // dann muss der Cursor aus dem Array ausgetragen werden
+ SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl();
+ sal_uInt16 nDelPos = rTbl.GetPos( this );
+
+ if( USHRT_MAX != nDelPos )
+ rTbl.Remove( nDelPos );
+ else {
+ ASSERT( !this, "UNO Cursor nicht mehr im Array" );
+ }
+ }
+
+ // den gesamten Ring loeschen!
+ while( GetNext() != this )
+ {
+ Ring* pNxt = GetNext();
+ pNxt->MoveTo( 0 ); // ausketten
+ delete pNxt; // und loeschen
+ }
+}
+
+SwUnoCrsr * SwUnoCrsr::Clone() const
+{
+ 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();
+ *pNewCrsr->GetMark() = *GetMark();
+ }
+ return pNewCrsr;
+}
+
+
+bool SwUnoCrsr::IsReadOnlyAvailable() const
+{
+ return true;
+}
+
+const SwCntntFrm*
+SwUnoCrsr::DoSetBidiLevelLeftRight( sal_Bool &, sal_Bool, sal_Bool )
+{
+ return 0; // not for uno cursor
+}
+
+void SwUnoCrsr::DoSetBidiLevelUpDown()
+{
+ return; // not for uno cursor
+}
+
+sal_Bool SwUnoCrsr::IsSelOvr( int eFlags )
+{
+ if( bRemainInSection )
+ {
+ SwDoc* pDoc = GetDoc();
+ SwNodeIndex aOldIdx( *pDoc->GetNodes()[ GetSavePos()->nNode ] );
+ SwNodeIndex& rPtIdx = GetPoint()->nNode;
+ SwStartNode *pOldSttNd = aOldIdx.GetNode().StartOfSectionNode(),
+ *pNewSttNd = rPtIdx.GetNode().StartOfSectionNode();
+ if( pOldSttNd != pNewSttNd )
+ {
+ sal_Bool bMoveDown = GetSavePos()->nNode < rPtIdx.GetIndex();
+ sal_Bool bValidPos = sal_False;
+
+ // search the correct surrounded start node - which the index
+ // can't leave.
+ while( pOldSttNd->IsSectionNode() )
+ pOldSttNd = pOldSttNd->StartOfSectionNode();
+
+ // is the new index inside this surrounded section?
+ if( rPtIdx > *pOldSttNd &&
+ rPtIdx < pOldSttNd->EndOfSectionIndex() )
+ {
+ // check if it a valid move inside this section
+ // (only over SwSection's !)
+ const SwStartNode* pInvalidNode;
+ do {
+ pInvalidNode = 0;
+ pNewSttNd = rPtIdx.GetNode().StartOfSectionNode();
+
+ const SwStartNode *pSttNd = pNewSttNd, *pEndNd = pOldSttNd;
+ if( pSttNd->EndOfSectionIndex() >
+ pEndNd->EndOfSectionIndex() )
+ {
+ pEndNd = pNewSttNd;
+ pSttNd = pOldSttNd;
+ }
+
+ while( pSttNd->GetIndex() > pEndNd->GetIndex() )
+ {
+ if( !pSttNd->IsSectionNode() )
+ pInvalidNode = pSttNd;
+ pSttNd = pSttNd->StartOfSectionNode();
+ }
+ if( pInvalidNode )
+ {
+ if( bMoveDown )
+ {
+ rPtIdx.Assign( *pInvalidNode->EndOfSectionNode(), 1 );
+
+ if( !rPtIdx.GetNode().IsCntntNode() &&
+ ( !pDoc->GetNodes().GoNextSection( &rPtIdx ) ||
+ rPtIdx > pOldSttNd->EndOfSectionIndex() ) )
+ break;
+ }
+ else
+ {
+ rPtIdx.Assign( *pInvalidNode, -1 );
+
+ if( !rPtIdx.GetNode().IsCntntNode() &&
+ ( !pDoc->GetNodes().GoPrevSection( &rPtIdx ) ||
+ rPtIdx < *pOldSttNd ) )
+ break;
+ }
+ }
+ else
+ bValidPos = sal_True;
+ } while ( pInvalidNode );
+ }
+
+ if( bValidPos )
+ {
+ SwCntntNode* pCNd = GetCntntNode();
+ sal_uInt16 nCnt = 0;
+ if( pCNd && !bMoveDown )
+ nCnt = pCNd->Len();
+ GetPoint()->nContent.Assign( pCNd, nCnt );
+ }
+ else
+ {
+ rPtIdx = GetSavePos()->nNode;
+ GetPoint()->nContent.Assign( GetCntntNode(), GetSavePos()->nCntnt );
+ return sal_True;
+ }
+ }
+ }
+ return SwCursor::IsSelOvr( eFlags );
+}
+
+
+/* */
+
+SwUnoTableCrsr::SwUnoTableCrsr(const SwPosition& rPos)
+ : SwCursor(rPos,0,false), SwUnoCrsr(rPos), SwTableCursor(rPos), aTblSel(rPos,0,false)
+{
+ SetRemainInSection(sal_False);
+}
+
+SwUnoTableCrsr::~SwUnoTableCrsr()
+{
+ while( aTblSel.GetNext() != &aTblSel )
+ delete aTblSel.GetNext(); // und loeschen
+}
+
+
+/*
+SwCursor* SwUnoTableCrsr::Create( SwPaM* pRing ) const
+{
+ return SwUnoCrsr::Create( pRing );
+}
+*/
+
+sal_Bool SwUnoTableCrsr::IsSelOvr( int eFlags )
+{
+ sal_Bool bRet = SwUnoCrsr::IsSelOvr( eFlags );
+ if( !bRet )
+ {
+ const SwTableNode* pTNd = GetPoint()->nNode.GetNode().FindTableNode();
+ bRet = !(pTNd == GetDoc()->GetNodes()[ GetSavePos()->nNode ]->
+ FindTableNode() && (!HasMark() ||
+ pTNd == GetMark()->nNode.GetNode().FindTableNode() ));
+ }
+ return bRet;
+}
+
+void SwUnoTableCrsr::MakeBoxSels()
+{
+ const SwCntntNode* pCNd;
+ bool bMakeTblCrsrs = true;
+ if( GetPoint()->nNode.GetIndex() && GetMark()->nNode.GetIndex() &&
+ 0 != ( pCNd = GetCntntNode() ) && pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ) &&
+ 0 != ( pCNd = GetCntntNode(sal_False) ) && pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ) )
+ bMakeTblCrsrs = GetDoc()->GetCurrentLayout()->MakeTblCrsrs( *this );
+
+ if ( !bMakeTblCrsrs )
+ {
+ SwSelBoxes& rTmpBoxes = (SwSelBoxes&)GetBoxes();
+ sal_uInt16 nCount = 0;
+ while( nCount < rTmpBoxes.Count() )
+ DeleteBox( nCount );
+ }
+
+ if( IsChgd() )
+ {
+ SwTableCursor::MakeBoxSels( &aTblSel );
+ if( !GetBoxesCount() )
+ {
+ const SwTableBox* pBox;
+ const SwNode* pBoxNd = GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+ const SwTableNode* pTblNd = pBoxNd ? pBoxNd->FindTableNode() : 0;
+ if( pTblNd && 0 != ( pBox = pTblNd->GetTable().GetTblBox( pBoxNd->GetIndex() )) )
+ InsertBox( *pBox );
+ }
+ }
+}
+
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
new file mode 100644
index 000000000000..f526e9b765a8
--- /dev/null
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -0,0 +1,1006 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#endif
+
+#include <vcl/dialog.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/wrkwin.hxx>
+#include <viewopt.hxx>
+#include <frmtool.hxx>
+#include <viscrs.hxx>
+#include <crsrsh.hxx>
+#include <doc.hxx>
+#include <swtable.hxx>
+#include <viewimp.hxx>
+#include <dview.hxx>
+#include <rootfrm.hxx>
+#include <txtfrm.hxx> // SwTxtFrm
+#include <docary.hxx>
+#include <extinput.hxx>
+#include <ndtxt.hxx>
+#include <scriptinfo.hxx>
+#include <mdiexp.hxx> // GetSearchDialog
+#ifndef _COMCORE_HRC
+#include <comcore.hrc> // ResId fuer Abfrage wenn zu Search & Replaces
+#endif
+
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/sdr/overlay/overlayselection.hxx>
+
+extern void SwCalcPixStatics( OutputDevice *pOut );
+
+//Damit beim ShowCrsr nicht immer wieder die gleiche Size teuer ermittelt
+//werden muss, hier statische Member, die beim Wechsel des MapModes
+// angepasst werden
+
+long SwSelPaintRects::nPixPtX = 0;
+long SwSelPaintRects::nPixPtY = 0;
+MapMode* SwSelPaintRects::pMapMode = 0;
+
+
+#ifdef SHOW_BOOKMARKS
+// #include <IMark.hxx>
+//
+// class SwBookmarkRects : public SwSelPaintRects
+// {
+// virtual void Paint( const Rectangle& rRect );
+// virtual void FillRects();
+//
+// public:
+// SwBookmarkRects( const SwCrsrShell& rSh ) : SwSelPaintRects( rSh ) {}
+// };
+//
+// void SwBookmarkRects::Paint( const Rectangle& rRect )
+// {
+// Window* pWin = GetShell()->GetWin();
+//
+// RasterOp eOld( pWin->GetRasterOp() );
+// sal_Bool bLCol = pWin->IsLineColor();
+// Color aLCol( pWin->GetLineColor() );
+// sal_Bool bFCol = pWin->IsFillColor();
+// Color aFCol( pWin->GetFillColor() );
+//
+// pWin->SetRasterOp( ROP_XOR );
+// Color aCol( RGB_COLORDATA( 0xF0, 0xC8, 0xF0 ) ^ COL_WHITE );
+// pWin->SetFillColor( aCol );
+// pWin->SetLineColor( aCol );
+//
+// pWin->DrawRect( rRect );
+//
+// if( bLCol ) pWin->SetLineColor( aLCol ); else pWin->SetLineColor();
+// if( bFCol ) pWin->SetFillColor( aFCol ); else pWin->SetFillColor();
+// pWin->SetRasterOp( eOld );
+// }
+//
+// void SwBookmarkRects::FillRects()
+// {
+// SwRegionRects aReg( GetShell()->VisArea() );
+//
+// const SwBookmarks& rBkmkTbl = GetShell()->getIDocumentMarkAccess()->getBookmarks();
+// SwShellCrsr* pCrsr = 0;
+// for( sal_uInt16 n = 0; n < rBkmkTbl.Count(); ++n )
+// {
+// const SwBookmark& rBkmk = *rBkmkTbl[ n ];
+// if( rBkmk.IsBookMark() && rBkmk.GetOtherPos() )
+// {
+// if( !pCrsr )
+// {
+// pCrsr = new SwShellCrsr( *GetShell(), rBkmk.GetPos() );
+// pCrsr->SetMark();
+// }
+// else
+// *pCrsr->GetPoint() = rBkmk.GetPos();
+// *pCrsr->GetMark() = *rBkmk.GetOtherPos();
+// pCrsr->FillRects();
+// for( sal_uInt16 i = 0; i < pCrsr->Count(); ++i )
+// aReg -= (*pCrsr)[ i ];
+//
+// pCrsr->Remove( 0, i );
+// }
+// }
+// if( pCrsr ) delete pCrsr;
+//
+// aReg.Invert();
+// SwRects::Insert( &aReg, 0 );
+// }
+//
+// SwBookmarkRects* pBookMarkRects = 0;
+//
+// void ShowBookmarks( const SwCrsrShell* pSh, int nAction, const SwRect* pRect = 0 )
+// {
+// if( !pBookMarkRects && pSh->getIDocumentMarkAccess()->getBookmarks().Count() )
+// pBookMarkRects = new SwBookmarkRects( *pSh );
+//
+// if( pBookMarkRects )
+// {
+// switch( nAction )
+// {
+// case 1: pBookMarkRects->Show(); break;
+// case 2: pBookMarkRects->Hide(); break;
+// case 3: pBookMarkRects->Invalidate( *pRect ); break;
+// }
+//
+// if( !pBookMarkRects->Count() )
+// delete pBookMarkRects, pBookMarkRects = 0;
+// }
+// }
+//
+// #define SHOWBOOKMARKS1( nAct ) ShowBookmarks( GetShell(),nAct );
+// #define SHOWBOOKMARKS2( nAct, pRect ) ShowBookmarks( GetShell(),nAct, pRect );
+
+#else
+
+#define SHOWBOOKMARKS1( nAct )
+#define SHOWBOOKMARKS2( nAct, pRect )
+
+#endif
+
+#ifdef SHOW_REDLINES
+#include <redline.hxx>
+
+class SwRedlineRects : public SwSelPaintRects
+{
+ sal_uInt16 nMode;
+ sal_uInt16 nNm;
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void FillRects();
+
+public:
+ SwRedlineRects( const SwCrsrShell& rSh, sal_uInt16 nName, sal_uInt16 n )
+ : SwSelPaintRects( rSh ), nMode( n ), nNm( nName )
+ {}
+};
+
+void SwRedlineRects::Paint( const Rectangle& rRect )
+{
+ Window* pWin = GetShell()->GetWin();
+
+ RasterOp eOld( pWin->GetRasterOp() );
+ sal_Bool bLCol = pWin->IsLineColor();
+ Color aLCol( pWin->GetLineColor() );
+ sal_Bool bFCol = pWin->IsFillColor();
+ Color aFCol( pWin->GetFillColor() );
+
+ pWin->SetRasterOp( ROP_XOR );
+ Color aCol;
+
+ sal_uInt8 nVal = 0xc8 - ( (nMode / 4) * 16 );
+ switch( nMode % 4 )
+ {
+ case 0: aCol = RGB_COLORDATA( nVal, nVal, 0xFF ); break;
+ case 1: aCol = RGB_COLORDATA( 0xFF, 0xc8, nVal ); break;
+ case 2: aCol = RGB_COLORDATA( nVal, 0xFF, nVal ); break;
+ case 3: aCol = RGB_COLORDATA( 0xFF, nVal, nVal ); break;
+ }
+ aCol = aCol.GetColor() ^ COL_WHITE;
+
+ pWin->SetFillColor( aCol );
+ pWin->SetLineColor( aCol );
+
+ pWin->DrawRect( rRect );
+
+ if( bLCol ) pWin->SetLineColor( aLCol ); else pWin->SetLineColor();
+ if( bFCol ) pWin->SetFillColor( aFCol ); else pWin->SetFillColor();
+ pWin->SetRasterOp( eOld );
+}
+
+void SwRedlineRects::FillRects()
+{
+ SwRegionRects aReg( GetShell()->VisArea() );
+
+ const SwRedlineTbl& rTbl = GetShell()->GetDoc()->GetRedlineTbl();
+ SwShellCrsr* pCrsr = 0;
+ for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ {
+ const SwRedline& rRed = *rTbl[ n ];
+ if( rRed.HasMark() && (nMode % 4 ) == rRed.GetType() &&
+ nNm == rRed.GetAuthor() )
+ {
+ if( !pCrsr )
+ {
+ pCrsr = new SwShellCrsr( *GetShell(), *rRed.GetPoint() );
+ pCrsr->SetMark();
+ }
+ else
+ *pCrsr->GetPoint() = *rRed.GetPoint();
+ *pCrsr->GetMark() = *rRed.GetMark();
+ pCrsr->FillRects();
+ for( sal_uInt16 i = 0; i < pCrsr->Count(); ++i )
+ aReg -= (*pCrsr)[ i ];
+
+ pCrsr->Remove( 0, i );
+ }
+ }
+ if( pCrsr ) delete pCrsr;
+
+ aReg.Invert();
+ SwRects::Insert( &aReg, 0 );
+}
+
+SwRedlineRects* aRedlines[ 10 * 4 ];
+static int bFirstCall = sal_True;
+
+void ShowRedlines( const SwCrsrShell* pSh, int nAction, const SwRect* pRect = 0 )
+{
+ if( bFirstCall )
+ {
+ memset( aRedlines, 0, sizeof(aRedlines));
+ bFirstCall = sal_False;
+ }
+
+ const SwRedlineTbl& rTbl = pSh->GetDoc()->GetRedlineTbl();
+ const SwRedlineAuthorTbl& rAuthorTbl = pSh->GetDoc()->GetRedlineAuthorTbl();
+
+ for( sal_uInt16 n = 0; n < rAuthorTbl.Count(); ++n )
+ {
+ for( int i = 0; i < 4; ++i )
+ {
+ SwRedlineRects** ppRedRect = &aRedlines[ n * 4 + i ];
+ if( rTbl.Count() && !*ppRedRect )
+ *ppRedRect = new SwRedlineRects( *pSh, n, n * 4 + i );
+
+ if( *ppRedRect )
+ {
+ switch( nAction )
+ {
+ case 1: (*ppRedRect)->Show(); break;
+ case 2: (*ppRedRect)->Hide(); break;
+ case 3: (*ppRedRect)->Invalidate( *pRect ); break;
+ }
+
+ if( !(*ppRedRect)->Count() )
+ delete *ppRedRect, *ppRedRect = 0;
+ }
+ }
+ }
+}
+
+#define SHOWREDLINES1( nAct ) ShowRedlines( GetShell(),nAct );
+#define SHOWREDLINES2( nAct, pRect ) ShowRedlines( GetShell(),nAct, pRect );
+
+#else
+
+#define SHOWREDLINES1( nAct )
+#define SHOWREDLINES2( nAct, pRect )
+
+#endif
+
+#ifdef JP_REDLINE
+ if( GetDoc()->GetRedlineTbl().Count() )
+ {
+ SwRedlineTbl& rRedlineTbl = (SwRedlineTbl&)GetDoc()->GetRedlineTbl();
+ for( sal_uInt16 i = 0; i < rRedlineTbl.Count(); ++i )
+ rRedlineTbl[ i ]->HideRects( *GetShell() );
+ }
+#endif
+
+// -------- Ab hier Klassen / Methoden fuer den nicht Text-Cursor ------
+
+SwVisCrsr::SwVisCrsr( const SwCrsrShell * pCShell )
+ : pCrsrShell( pCShell )
+{
+ pCShell->GetWin()->SetCursor( &aTxtCrsr );
+ bIsVisible = aTxtCrsr.IsVisible();
+ bIsDragCrsr = sal_False;
+ aTxtCrsr.SetWidth( 0 );
+
+#ifdef SW_CRSR_TIMER
+ bTimerOn = sal_True;
+ SetTimeout( 50 ); // 50msec Verzoegerung
+#endif
+}
+
+
+
+SwVisCrsr::~SwVisCrsr()
+{
+#ifdef SW_CRSR_TIMER
+ if( bTimerOn )
+ Stop(); // Timer stoppen
+#endif
+
+ if( bIsVisible && aTxtCrsr.IsVisible() )
+ aTxtCrsr.Hide();
+
+ pCrsrShell->GetWin()->SetCursor( 0 );
+}
+
+
+
+
+void SwVisCrsr::Show()
+{
+ if( !bIsVisible )
+ {
+ bIsVisible = sal_True;
+
+ // muss ueberhaupt angezeigt werden ?
+ if( pCrsrShell->VisArea().IsOver( pCrsrShell->aCharRect ) )
+#ifdef SW_CRSR_TIMER
+ {
+ if( bTimerOn )
+ Start(); // Timer aufsetzen
+ else
+ {
+ if( IsActive() )
+ Stop(); // Timer Stoppen
+
+ _SetPosAndShow();
+ }
+ }
+#else
+ _SetPosAndShow();
+#endif
+ }
+}
+
+
+
+void SwVisCrsr::Hide()
+{
+ if( bIsVisible )
+ {
+ bIsVisible = sal_False;
+
+#ifdef SW_CRSR_TIMER
+ if( IsActive() )
+ Stop(); // Timer Stoppen
+#endif
+
+ if( aTxtCrsr.IsVisible() ) // sollten die Flags nicht gueltig sein?
+ aTxtCrsr.Hide();
+ }
+}
+
+#ifdef SW_CRSR_TIMER
+
+void __EXPORT SwVisCrsr::Timeout()
+{
+ ASSERT( !bIsDragCrsr, "Timer vorher abschalten" );
+ if( bIsVisible )
+ {
+ if ( !pCrsrShell->GetWin() ) //SwFrmFmt::GetGraphic setzt das Win temp aus!
+ Start();
+ else
+ _SetPosAndShow();
+ }
+}
+
+sal_Bool SwCrsrShell::ChgCrsrTimerFlag( sal_Bool bTimerOn )
+{
+ return pVisCrsr->ChgTimerFlag( bTimerOn );
+}
+
+
+sal_Bool SwVisCrsr::ChgTimerFlag( sal_Bool bFlag )
+{
+ bOld = bTimerOn;
+ if( !bFlag && bIsVisible && IsActive() )
+ {
+ Stop(); // Timer Stoppen
+ _SetPosAndShow();
+ }
+ bTimerOn = bFlag;
+ return bOld;
+}
+
+#endif
+
+
+void SwVisCrsr::_SetPosAndShow()
+{
+ SwRect aRect;
+ long nTmpY = pCrsrShell->aCrsrHeight.Y();
+ if( 0 > nTmpY )
+ {
+ nTmpY = -nTmpY;
+ aTxtCrsr.SetOrientation( 900 );
+ aRect = SwRect( pCrsrShell->aCharRect.Pos(),
+ Size( pCrsrShell->aCharRect.Height(), nTmpY ) );
+ aRect.Pos().X() += pCrsrShell->aCrsrHeight.X();
+ if( pCrsrShell->IsOverwriteCrsr() )
+ aRect.Pos().Y() += aRect.Width();
+ }
+ else
+ {
+ aTxtCrsr.SetOrientation( 0 );
+ aRect = SwRect( pCrsrShell->aCharRect.Pos(),
+ Size( pCrsrShell->aCharRect.Width(), nTmpY ) );
+ aRect.Pos().Y() += pCrsrShell->aCrsrHeight.X();
+ }
+
+ // check if cursor should show the current cursor bidi level
+ aTxtCrsr.SetDirection( CURSOR_DIRECTION_NONE );
+ const SwCursor* pTmpCrsr = pCrsrShell->_GetCrsr();
+
+ if ( pTmpCrsr && !pCrsrShell->IsOverwriteCrsr() )
+ {
+ SwNode& rNode = pTmpCrsr->GetPoint()->nNode.GetNode();
+ if( rNode.IsTxtNode() )
+ {
+ const SwTxtNode& rTNd = *rNode.GetTxtNode();
+ const SwFrm* pFrm = rTNd.getLayoutFrm( pCrsrShell->GetLayout(), 0, 0, sal_False );
+ if ( pFrm )
+ {
+ const SwScriptInfo* pSI = ((SwTxtFrm*)pFrm)->GetScriptInfo();
+ // cursor level has to be shown
+ if ( pSI && pSI->CountDirChg() > 1 )
+ {
+ aTxtCrsr.SetDirection(
+ ( pTmpCrsr->GetCrsrBidiLevel() % 2 ) ?
+ CURSOR_DIRECTION_RTL :
+ CURSOR_DIRECTION_LTR );
+ }
+
+ if ( pFrm->IsRightToLeft() )
+ {
+ const OutputDevice *pOut = pCrsrShell->GetOut();
+ if ( pOut )
+ {
+ long nSize = pOut->GetSettings().GetStyleSettings().GetCursorSize();
+ Size aSize( nSize, nSize );
+ aSize = pOut->PixelToLogic( aSize );
+ aRect.Left( aRect.Left() - aSize.Width() );
+ }
+ }
+ }
+ }
+ }
+
+ if( aRect.Height() )
+ {
+ ::SwCalcPixStatics( pCrsrShell->GetOut() );
+ ::SwAlignRect( aRect, (ViewShell*)pCrsrShell );
+ }
+ if( !pCrsrShell->IsOverwriteCrsr() || bIsDragCrsr ||
+ pCrsrShell->IsSelection() )
+ aRect.Width( 0 );
+
+ aTxtCrsr.SetSize( aRect.SSize() );
+
+ aTxtCrsr.SetPos( aRect.Pos() );
+ if ( !pCrsrShell->IsCrsrReadonly() || pCrsrShell->GetViewOptions()->IsSelectionInReadonly() )
+ {
+ if ( pCrsrShell->GetDrawView() )
+ ((SwDrawView*)pCrsrShell->GetDrawView())->SetAnimationEnabled(
+ !pCrsrShell->IsSelection() );
+
+ sal_uInt16 nStyle = bIsDragCrsr ? CURSOR_SHADOW : 0;
+ if( nStyle != aTxtCrsr.GetStyle() )
+ {
+ aTxtCrsr.SetStyle( nStyle );
+ aTxtCrsr.SetWindow( bIsDragCrsr ? pCrsrShell->GetWin() : 0 );
+ }
+
+ aTxtCrsr.Show();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SwSelPaintRects::SwSelPaintRects( const SwCrsrShell& rCSh )
+: SwRects( 0 ),
+ pCShell( &rCSh ),
+ mpCursorOverlay(0)
+{
+}
+
+SwSelPaintRects::~SwSelPaintRects()
+{
+ Hide();
+}
+
+void SwSelPaintRects::swapContent(SwSelPaintRects& rSwap)
+{
+ SwRects aTempRects;
+ aTempRects.Insert(this, 0);
+
+ Remove(0, Count());
+ Insert(&rSwap, 0);
+
+ rSwap.Remove(0, rSwap.Count());
+ rSwap.Insert(&aTempRects, 0);
+
+ // #i75172# also swap mpCursorOverlay
+ sdr::overlay::OverlayObject* pTempOverlay = getCursorOverlay();
+ setCursorOverlay(rSwap.getCursorOverlay());
+ rSwap.setCursorOverlay(pTempOverlay);
+}
+
+void SwSelPaintRects::Hide()
+{
+ if(mpCursorOverlay)
+ {
+ delete mpCursorOverlay;
+ mpCursorOverlay = 0;
+ }
+
+ SwRects::Remove( 0, Count() );
+}
+
+void SwSelPaintRects::Show()
+{
+ SdrView* pView = (SdrView*)pCShell->GetDrawView();
+
+ 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++)
+ {
+ const SwRect aNextRect((*this)[a]);
+ const Rectangle aPntRect(aNextRect.SVRect());
+
+ aNewRanges.push_back(basegfx::B2DRange(
+ aPntRect.Left(), aPntRect.Top(),
+ aPntRect.Right() + 1, aPntRect.Bottom() + 1));
+ }
+
+ if(mpCursorOverlay)
+ {
+ if(aNewRanges.size())
+ {
+ static_cast< sdr::overlay::OverlaySelection* >(mpCursorOverlay)->setRanges(aNewRanges);
+ }
+ else
+ {
+ delete mpCursorOverlay;
+ mpCursorOverlay = 0;
+ }
+ }
+ else if(Count())
+ {
+ SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
+ sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
+
+ if(pTargetOverlay)
+ {
+ // #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)
+ {
+ const double fFactor(fMaxLum / fLuminance);
+ const basegfx::BColor aNewSelection(
+ aSelection.getRed() * fFactor,
+ aSelection.getGreen() * fFactor,
+ aSelection.getBlue() * fFactor);
+
+ aHighlight = Color(aNewSelection);
+ }
+
+ // create correct selection
+ mpCursorOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_TRANSPARENT,
+ aHighlight,
+ aNewRanges,
+ true);
+
+ pTargetOverlay->add(*mpCursorOverlay);
+ }
+ }
+ }
+}
+
+void SwSelPaintRects::Invalidate( const SwRect& rRect )
+{
+ sal_uInt16 nSz = Count();
+ if( !nSz )
+ return;
+
+ SwRegionRects aReg( GetShell()->VisArea() );
+ aReg.Remove( 0, aReg.Count() );
+ aReg.Insert( this, 0 );
+ aReg -= rRect;
+ SwRects::Remove( 0, nSz );
+ SwRects::Insert( &aReg, 0 );
+
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // Liegt die Selection rechts oder unten ausserhalb des sichtbaren
+ // Bereiches, so ist diese nie auf eine Pixel rechts/unten aligned.
+ // Das muss hier erkannt und ggf. das Rechteckt erweitert werden.
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ if( GetShell()->bVisPortChgd && 0 != ( nSz = Count()) )
+ {
+ SwSelPaintRects::Get1PixelInLogic( *GetShell() );
+ SwRect* pRect = (SwRect*)GetData();
+ for( ; nSz--; ++pRect )
+ {
+ if( pRect->Right() == GetShell()->aOldRBPos.X() )
+ pRect->Right( pRect->Right() + nPixPtX );
+ if( pRect->Bottom() == GetShell()->aOldRBPos.Y() )
+ pRect->Bottom( pRect->Bottom() + nPixPtY );
+ }
+ }
+}
+
+void SwSelPaintRects::Paint( const Rectangle& /*rRect*/ )
+{
+ // nothing to do with overlays
+}
+
+
+// check current MapMode of the shell and set possibly the static members.
+// Optional set the parameters pX, pY
+void SwSelPaintRects::Get1PixelInLogic( const ViewShell& rSh,
+ long* pX, long* pY )
+{
+ const OutputDevice* pOut = rSh.GetWin();
+ if ( ! pOut )
+ pOut = rSh.GetOut();
+
+ const MapMode& rMM = pOut->GetMapMode();
+ if( pMapMode->GetMapUnit() != rMM.GetMapUnit() ||
+ pMapMode->GetScaleX() != rMM.GetScaleX() ||
+ pMapMode->GetScaleY() != rMM.GetScaleY() )
+ {
+ *pMapMode = rMM;
+ Size aTmp( 1, 1 );
+ aTmp = pOut->PixelToLogic( aTmp );
+ nPixPtX = aTmp.Width();
+ nPixPtY = aTmp.Height();
+ }
+ if( pX )
+ *pX = nPixPtX;
+ if( pY )
+ *pY = nPixPtY;
+}
+
+
+/* */
+
+SwShellCrsr::SwShellCrsr( const SwCrsrShell& rCShell, const SwPosition &rPos )
+ : SwCursor(rPos,0,false), SwSelPaintRects(rCShell), pPt(SwPaM::GetPoint())
+{}
+
+
+SwShellCrsr::SwShellCrsr( const SwCrsrShell& rCShell, const SwPosition &rPos,
+ const Point& rPtPos, SwPaM* pRing )
+ : SwCursor(rPos, pRing, false), SwSelPaintRects(rCShell), aMkPt(rPtPos),
+ aPtPt(rPtPos), pPt(SwPaM::GetPoint())
+{}
+
+
+SwShellCrsr::SwShellCrsr( SwShellCrsr& rICrsr )
+ : SwCursor(rICrsr), SwSelPaintRects(*rICrsr.GetShell()),
+ aMkPt(rICrsr.GetMkPos()), aPtPt(rICrsr.GetPtPos()), pPt(SwPaM::GetPoint())
+{}
+
+SwShellCrsr::~SwShellCrsr() {}
+
+
+bool SwShellCrsr::IsReadOnlyAvailable() const
+{
+ return GetShell()->IsReadOnlyAvailable();
+}
+
+void SwShellCrsr::SetMark()
+{
+ if( SwPaM::GetPoint() == pPt )
+ aMkPt = aPtPt;
+ else
+ aPtPt = aMkPt;
+ SwPaM::SetMark();
+}
+
+void SwShellCrsr::FillRects()
+{
+ // die neuen Rechtecke berechnen
+ if( HasMark() &&
+ GetPoint()->nNode.GetNode().IsCntntNode() &&
+ GetPoint()->nNode.GetNode().GetCntntNode()->getLayoutFrm( GetShell()->GetLayout() ) &&
+ (GetMark()->nNode == GetPoint()->nNode ||
+ (GetMark()->nNode.GetNode().IsCntntNode() &&
+ GetMark()->nNode.GetNode().GetCntntNode()->getLayoutFrm( GetShell()->GetLayout() ) ) ))
+ GetShell()->GetLayout()->CalcFrmRects( *this, GetShell()->IsTableMode() ); //swmod 071107//swmod 071225
+}
+
+
+void SwShellCrsr::Show()
+{
+ SwShellCrsr * pTmp = this;
+ do {
+ pTmp->SwSelPaintRects::Show();
+ } while( this != ( pTmp = dynamic_cast<SwShellCrsr*>(pTmp->GetNext()) ) );
+
+ SHOWBOOKMARKS1( 1 )
+ SHOWREDLINES1( 1 )
+}
+
+
+ // Dieses Rechteck wird neu gepaintet, also ist die SSelection in
+ // dem Bereich ungueltig
+void SwShellCrsr::Invalidate( const SwRect& rRect )
+{
+ SwShellCrsr * pTmp = this;
+
+ do
+ {
+ pTmp->SwSelPaintRects::Invalidate( rRect );
+
+ // --> FME 2005-08-18 #125102#
+ // skip any non SwShellCrsr objects in the ring
+ // (see:SwAutoFormat::DeleteSel()
+ // <--
+ Ring* pTmpRing = pTmp;
+ pTmp = 0;
+ do
+ {
+ pTmpRing = pTmpRing->GetNext();
+ pTmp = dynamic_cast<SwShellCrsr*>(pTmpRing);
+ }
+ while ( !pTmp );
+ }
+ while( this != pTmp );
+
+ SHOWBOOKMARKS2( 3, &rRect )
+ SHOWREDLINES2( 3, &rRect )
+}
+
+
+void SwShellCrsr::Hide()
+{
+ SwShellCrsr * pTmp = this;
+ do {
+ pTmp->SwSelPaintRects::Hide();
+ } while( this != ( pTmp = dynamic_cast<SwShellCrsr*>(pTmp->GetNext()) ) );
+
+ SHOWBOOKMARKS1( 2 )
+ SHOWREDLINES1( 2 )
+}
+
+SwCursor* SwShellCrsr::Create( SwPaM* pRing ) const
+{
+ return new SwShellCrsr( *GetShell(), *GetPoint(), GetPtPos(), pRing );
+}
+
+
+short SwShellCrsr::MaxReplaceArived()
+{
+ short nRet = RET_YES;
+ Window* pDlg = LAYOUT_THIS_WINDOW (::GetSearchDialog());
+ if( pDlg )
+ {
+ // alte Actions beenden; die Tabellen-Frames werden angelegt und
+ // eine SSelection kann erzeugt werden
+ SvUShorts aArr;
+ sal_uInt16 nActCnt;
+ ViewShell *pShell = const_cast< SwCrsrShell* >( GetShell() ),
+ *pSh = pShell;
+ do {
+ for( nActCnt = 0; pSh->ActionPend(); ++nActCnt )
+ pSh->EndAction();
+ aArr.Insert( nActCnt, aArr.Count() );
+ } while( pShell != ( pSh = (ViewShell*)pSh->GetNext() ) );
+
+ {
+ nRet = QueryBox( pDlg, SW_RES( MSG_COMCORE_ASKSEARCH )).Execute();
+ }
+
+ for( sal_uInt16 n = 0; n < aArr.Count(); ++n )
+ {
+ for( nActCnt = aArr[n]; nActCnt--; )
+ pSh->StartAction();
+ pSh = (ViewShell*)pSh->GetNext();
+ } //swmod 071107//swmod 071225
+ }
+ else
+ // ansonsten aus dem Basic, und dann auf RET_YES schalten
+ nRet = RET_YES;
+
+ return nRet;
+}
+
+void SwShellCrsr::SaveTblBoxCntnt( const SwPosition* pPos )
+{
+ ((SwCrsrShell*)GetShell())->SaveTblBoxCntnt( pPos );
+}
+
+sal_Bool SwShellCrsr::UpDown( sal_Bool bUp, sal_uInt16 nCnt )
+{
+ return SwCursor::UpDown( bUp, nCnt,
+ &GetPtPos(), GetShell()->GetUpDownX() );
+}
+
+#ifdef DBG_UTIL
+
+// JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung
+// am sichtbaren Cursor
+
+sal_Bool SwShellCrsr::IsSelOvr( int eFlags )
+{
+ return SwCursor::IsSelOvr( eFlags );
+}
+
+#endif
+
+// sal_True: an die Position kann der Cursor gesetzt werden
+sal_Bool SwShellCrsr::IsAtValidPos( sal_Bool bPoint ) const
+{
+ if( GetShell() && ( GetShell()->IsAllProtect() ||
+ GetShell()->GetViewOptions()->IsReadonly() ||
+ ( GetShell()->Imp()->GetDrawView() &&
+ GetShell()->Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() )))
+ return sal_True;
+
+ return SwCursor::IsAtValidPos( bPoint );
+}
+
+/* */
+
+SwShellTableCrsr::SwShellTableCrsr( const SwCrsrShell& rCrsrSh,
+ const SwPosition& rPos )
+ : SwCursor(rPos,0,false), SwShellCrsr(rCrsrSh, rPos), SwTableCursor(rPos)
+{
+}
+
+SwShellTableCrsr::SwShellTableCrsr( const SwCrsrShell& rCrsrSh,
+ const SwPosition& rMkPos, const Point& rMkPt,
+ const SwPosition& rPtPos, const Point& rPtPt )
+ : SwCursor(rPtPos,0,false), SwShellCrsr(rCrsrSh, rPtPos), SwTableCursor(rPtPos)
+{
+ SetMark();
+ *GetMark() = rMkPos;
+ GetMkPos() = rMkPt;
+ GetPtPos() = rPtPt;
+}
+
+SwShellTableCrsr::~SwShellTableCrsr() {}
+
+void SwShellTableCrsr::SetMark() { SwShellCrsr::SetMark(); }
+
+SwCursor* SwShellTableCrsr::Create( SwPaM* pRing ) const
+{
+ return SwShellCrsr::Create( pRing );
+}
+short SwShellTableCrsr::MaxReplaceArived()
+{
+ return SwShellCrsr::MaxReplaceArived();
+}
+void SwShellTableCrsr::SaveTblBoxCntnt( const SwPosition* pPos )
+{
+ SwShellCrsr::SaveTblBoxCntnt( pPos );
+}
+
+
+void SwShellTableCrsr::FillRects()
+{
+ // die neuen Rechtecke berechnen
+ // JP 16.01.98: wenn der Cursor noch "geparkt" ist nichts machen!!
+ if( !aSelBoxes.Count() || bParked ||
+ !GetPoint()->nNode.GetIndex() )
+ return;
+
+ SwRegionRects aReg( GetShell()->VisArea() );
+ SwNodes& rNds = GetDoc()->GetNodes();
+ for( sal_uInt16 n = 0; n < aSelBoxes.Count(); ++n )
+ {
+ const SwStartNode* pSttNd = (*(aSelBoxes.GetData() + n ))->GetSttNd();
+ const SwTableNode* pSelTblNd = pSttNd->FindTableNode();
+
+ SwNodeIndex aIdx( *pSttNd );
+ SwCntntNode* pCNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
+
+ // TABLE IN TABLE
+ // (see also lcl_FindTopLevelTable in unoobj2.cxx for a different
+ // version to do this)
+ const SwTableNode* pCurTblNd = pCNd->FindTableNode();
+ while ( pSelTblNd != pCurTblNd && pCurTblNd )
+ {
+ aIdx = pCurTblNd->EndOfSectionIndex();
+ pCNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
+ pCurTblNd = pCNd->FindTableNode();
+ }
+
+ if( !pCNd )
+ continue;
+
+ SwFrm* pFrm = pCNd->getLayoutFrm( GetShell()->GetLayout(), &GetSttPos() );
+ while( pFrm && !pFrm->IsCellFrm() )
+ pFrm = pFrm->GetUpper();
+
+ ASSERT( pFrm, "Node nicht in einer Tabelle" );
+
+ while ( pFrm )
+ {
+ if( pFrm && aReg.GetOrigin().IsOver( pFrm->Frm() ) )
+ aReg -= pFrm->Frm();
+
+ pFrm = pFrm->GetNextCellLeaf( MAKEPAGE_NONE );
+ }
+ }
+ aReg.Invert();
+ Insert( &aReg, 0 );
+}
+
+
+// Pruefe, ob sich der SPoint innerhalb der Tabellen-SSelection befindet
+sal_Bool SwShellTableCrsr::IsInside( const Point& rPt ) const
+{
+ // die neuen Rechtecke berechnen
+ // JP 16.01.98: wenn der Cursor noch "geparkt" ist nichts machen!!
+ if( !aSelBoxes.Count() || bParked ||
+ !GetPoint()->nNode.GetIndex() )
+ return sal_False;
+
+ SwNodes& rNds = GetDoc()->GetNodes();
+ for( sal_uInt16 n = 0; n < aSelBoxes.Count(); ++n )
+ {
+ SwNodeIndex aIdx( *(*(aSelBoxes.GetData() + n ))->GetSttNd() );
+ SwCntntNode* pCNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
+ if( !pCNd )
+ continue;
+
+ SwFrm* pFrm = pCNd->getLayoutFrm( GetShell()->GetLayout(), &GetPtPos() );
+ while( pFrm && !pFrm->IsCellFrm() )
+ pFrm = pFrm->GetUpper();
+ ASSERT( pFrm, "Node nicht in einer Tabelle" );
+ if( pFrm && pFrm->Frm().IsInside( rPt ) )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+#ifdef DBG_UTIL
+
+// JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung
+// am sichtbaren Cursor
+sal_Bool SwShellTableCrsr::IsSelOvr( int eFlags )
+{
+ return SwShellCrsr::IsSelOvr( eFlags );
+}
+
+#endif
+
+sal_Bool SwShellTableCrsr::IsAtValidPos( sal_Bool bPoint ) const
+{
+ return SwShellCrsr::IsAtValidPos( bPoint );
+}
+
diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx
new file mode 100644
index 000000000000..d25c7d8417cb
--- /dev/null
+++ b/sw/source/core/doc/SwStyleNameMapper.cxx
@@ -0,0 +1,1142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <SwStyleNameMapper.hxx>
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <tools/resmgr.hxx>
+#include <poolfmt.hxx>
+#ifndef _RDIC_HRC
+#include <rcid.hrc>
+#endif
+#include <tools/debug.hxx>
+extern ResMgr* pSwResMgr;
+// Initialise UI names to 0
+SvStringsDtor *SwStyleNameMapper::pTextUINameArray = 0,
+ *SwStyleNameMapper::pListsUINameArray = 0,
+ *SwStyleNameMapper::pExtraUINameArray = 0,
+ *SwStyleNameMapper::pRegisterUINameArray = 0,
+ *SwStyleNameMapper::pDocUINameArray = 0,
+ *SwStyleNameMapper::pHTMLUINameArray = 0,
+ *SwStyleNameMapper::pFrmFmtUINameArray = 0,
+ *SwStyleNameMapper::pChrFmtUINameArray = 0,
+ *SwStyleNameMapper::pHTMLChrFmtUINameArray = 0,
+ *SwStyleNameMapper::pPageDescUINameArray = 0,
+ *SwStyleNameMapper::pNumRuleUINameArray = 0,
+
+// Initialise programmatic names to 0
+ *SwStyleNameMapper::pTextProgNameArray = 0,
+ *SwStyleNameMapper::pListsProgNameArray = 0,
+ *SwStyleNameMapper::pExtraProgNameArray = 0,
+ *SwStyleNameMapper::pRegisterProgNameArray = 0,
+ *SwStyleNameMapper::pDocProgNameArray = 0,
+ *SwStyleNameMapper::pHTMLProgNameArray = 0,
+ *SwStyleNameMapper::pFrmFmtProgNameArray = 0,
+ *SwStyleNameMapper::pChrFmtProgNameArray = 0,
+ *SwStyleNameMapper::pHTMLChrFmtProgNameArray = 0,
+ *SwStyleNameMapper::pPageDescProgNameArray = 0,
+ *SwStyleNameMapper::pNumRuleProgNameArray = 0;
+
+NameToIdHash *SwStyleNameMapper::pParaUIMap = 0,
+ *SwStyleNameMapper::pCharUIMap = 0,
+ *SwStyleNameMapper::pPageUIMap = 0,
+ *SwStyleNameMapper::pFrameUIMap = 0,
+ *SwStyleNameMapper::pNumRuleUIMap = 0,
+
+ *SwStyleNameMapper::pParaProgMap = 0,
+ *SwStyleNameMapper::pCharProgMap = 0,
+ *SwStyleNameMapper::pPageProgMap = 0,
+ *SwStyleNameMapper::pFrameProgMap = 0,
+ *SwStyleNameMapper::pNumRuleProgMap = 0;
+
+// SwTableEntry so we can pass the length to the String CTOR
+struct SwTableEntry
+{
+ sal_uInt8 nLength;
+ const sal_Char *pChar;
+};
+
+#define ENTRY( s ) { sizeof (s)-1, s }
+
+// Hard coded Programmatic Name tables
+const struct SwTableEntry TextProgNameTable [] =
+{
+ ENTRY( "Standard" ), // RES_POOLCOLL_STANDARD
+ ENTRY( "Text body" ),
+ ENTRY( "First line indent" ),
+ ENTRY( "Hanging indent" ),
+ ENTRY( "Text body indent" ),
+ ENTRY( "Salutation" ),
+ ENTRY( "Signature" ),
+ ENTRY( "List Indent" ), // RES_POOLCOLL_CONFRONTATION
+ ENTRY( "Marginalia" ),
+ ENTRY( "Heading" ),
+ ENTRY( "Heading 1" ),
+ ENTRY( "Heading 2" ),
+ ENTRY( "Heading 3" ),
+ ENTRY( "Heading 4" ),
+ ENTRY( "Heading 5" ),
+ ENTRY( "Heading 6" ),
+ ENTRY( "Heading 7" ),
+ ENTRY( "Heading 8" ),
+ ENTRY( "Heading 9" ),
+ ENTRY( "Heading 10" ), // RES_POOLCOLL_TEXT_END
+ { 0, NULL }
+};
+
+const struct SwTableEntry ListsProgNameTable [] =
+{
+ ENTRY( "List" ), // STR_POCO_PRGM_NUMBUL_BASE
+ ENTRY( "Numbering 1 Start" ), // STR_POCO_PRGM_NUM_LEVEL1S
+ ENTRY( "Numbering 1" ),
+ ENTRY( "Numbering 1 End" ),
+ ENTRY( "Numbering 1 Cont." ),
+ ENTRY( "Numbering 2 Start" ),
+ ENTRY( "Numbering 2" ),
+ ENTRY( "Numbering 2 End" ),
+ ENTRY( "Numbering 2 Cont." ),
+ ENTRY( "Numbering 3 Start" ),
+ ENTRY( "Numbering 3" ),
+ ENTRY( "Numbering 3 End" ),
+ ENTRY( "Numbering 3 Cont." ),
+ ENTRY( "Numbering 4 Start" ),
+ ENTRY( "Numbering 4" ),
+ ENTRY( "Numbering 4 End" ),
+ ENTRY( "Numbering 4 Cont." ),
+ ENTRY( "Numbering 5 Start" ),
+ ENTRY( "Numbering 5" ),
+ ENTRY( "Numbering 5 End" ),
+ ENTRY( "Numbering 5 Cont." ),
+ ENTRY( "List 1 Start" ),
+ ENTRY( "List 1" ),
+ ENTRY( "List 1 End" ),
+ ENTRY( "List 1 Cont." ),
+ ENTRY( "List 2 Start" ),
+ ENTRY( "List 2" ),
+ ENTRY( "List 2 End" ),
+ ENTRY( "List 2 Cont." ),
+ ENTRY( "List 3 Start" ),
+ ENTRY( "List 3" ),
+ ENTRY( "List 3 End" ),
+ ENTRY( "List 3 Cont." ),
+ ENTRY( "List 4 Start" ),
+ ENTRY( "List 4" ),
+ ENTRY( "List 4 End" ),
+ ENTRY( "List 4 Cont." ),
+ ENTRY( "List 5 Start" ),
+ ENTRY( "List 5" ),
+ ENTRY( "List 5 End" ),
+ ENTRY( "List 5 Cont." ), // STR_POCO_PRGM_BUL_NONUM5
+ { 0, NULL }
+};
+
+const struct SwTableEntry ExtraProgNameTable [] =
+{
+ ENTRY( "Header" ), // RES_POOLCOLL_EXTRA_BEGIN
+ ENTRY( "Header left" ),
+ ENTRY( "Header right" ),
+ ENTRY( "Footer" ),
+ ENTRY( "Footer left" ),
+ ENTRY( "Footer right" ),
+ ENTRY( "Table Contents" ),
+ ENTRY( "Table Heading" ),
+ ENTRY( "Caption" ),
+ ENTRY( "Illustration" ),
+ ENTRY( "Table" ),
+ ENTRY( "Text" ),
+ ENTRY( "Frame contents" ),
+ ENTRY( "Footnote" ),
+ ENTRY( "Addressee" ),
+ ENTRY( "Sender" ),
+ ENTRY( "Endnote" ),
+ ENTRY( "Drawing" ), // RES_POOLCOLL_LABEL_DRAWING
+ { 0, NULL }
+};
+
+const struct SwTableEntry RegisterProgNameTable [] =
+{
+ ENTRY( "Index" ), // STR_POCO_PRGM_REGISTER_BASE
+ ENTRY( "Index Heading" ), // STR_POCO_PRGM_TOX_IDXH
+ ENTRY( "Index 1" ),
+ ENTRY( "Index 2" ),
+ ENTRY( "Index 3" ),
+ ENTRY( "Index Separator" ),
+ ENTRY( "Contents Heading" ),
+ ENTRY( "Contents 1" ),
+ ENTRY( "Contents 2" ),
+ ENTRY( "Contents 3" ),
+ ENTRY( "Contents 4" ),
+ ENTRY( "Contents 5" ),
+ ENTRY( "User Index Heading" ),
+ ENTRY( "User Index 1" ),
+ ENTRY( "User Index 2" ),
+ ENTRY( "User Index 3" ),
+ ENTRY( "User Index 4" ),
+ ENTRY( "User Index 5" ),
+ ENTRY( "Contents 6" ),
+ ENTRY( "Contents 7" ),
+ ENTRY( "Contents 8" ),
+ ENTRY( "Contents 9" ),
+ ENTRY( "Contents 10" ),
+ ENTRY( "Illustration Index Heading" ),
+ ENTRY( "Illustration Index 1" ),
+ ENTRY( "Object index heading" ),
+ ENTRY( "Object index 1" ),
+ ENTRY( "Table index heading" ),
+ ENTRY( "Table index 1" ),
+ ENTRY( "Bibliography Heading" ),
+ ENTRY( "Bibliography 1" ),
+ ENTRY( "User Index 6" ),
+ ENTRY( "User Index 7" ),
+ ENTRY( "User Index 8" ),
+ ENTRY( "User Index 9" ),
+ ENTRY( "User Index 10" ), // STR_POCO_PRGM_TOX_USER10
+ { 0, NULL }
+};
+
+const struct SwTableEntry DocProgNameTable [] =
+{
+ ENTRY( "Title" ), // STR_POCO_PRGM_DOC_TITEL
+ ENTRY( "Subtitle" ),
+ { 0, NULL }
+};
+
+const struct SwTableEntry HTMLProgNameTable [] =
+{
+ ENTRY( "Quotations" ),
+ ENTRY( "Preformatted Text" ),
+ ENTRY( "Horizontal Line" ),
+ ENTRY( "List Contents" ),
+ ENTRY( "List Heading" ), // STR_POCO_PRGM_HTML_DT
+ { 0, NULL }
+};
+
+const struct SwTableEntry FrmFmtProgNameTable [] =
+{
+ ENTRY( "Frame" ), // RES_POOLFRM_FRAME
+ ENTRY( "Graphics" ),
+ ENTRY( "OLE" ),
+ ENTRY( "Formula" ),
+ ENTRY( "Marginalia" ),
+ ENTRY( "Watermark" ),
+ ENTRY( "Labels" ), // RES_POOLFRM_LABEL
+ { 0, NULL }
+};
+
+const struct SwTableEntry ChrFmtProgNameTable [] =
+{
+ ENTRY( "Footnote Symbol" ), // RES_POOLCHR_FOOTNOTE
+ ENTRY( "Page Number" ),
+ ENTRY( "Caption characters" ),
+ ENTRY( "Drop Caps" ),
+ ENTRY( "Numbering Symbols" ),
+ ENTRY( "Bullet Symbols" ),
+ ENTRY( "Internet link" ),
+ ENTRY( "Visited Internet Link" ),
+ ENTRY( "Placeholder" ),
+ ENTRY( "Index Link" ),
+ ENTRY( "Endnote Symbol" ),
+ ENTRY( "Line numbering" ),
+ ENTRY( "Main index entry" ),
+ ENTRY( "Footnote anchor" ),
+ ENTRY( "Endnote anchor" ),
+ ENTRY( "Rubies" ), // RES_POOLCHR_RUBYTEXT
+ ENTRY( "Vertical Numbering Symbols" ), // RES_POOLCHR_VERT_NUMBER
+ { 0, NULL }
+};
+
+const struct SwTableEntry HTMLChrFmtProgNameTable [] =
+{
+ ENTRY( "Emphasis" ), // RES_POOLCHR_HTML_EMPHASIS
+ ENTRY( "Citation" ),
+ ENTRY( "Strong Emphasis" ),
+ ENTRY( "Source Text" ),
+ ENTRY( "Example" ),
+ ENTRY( "User Entry" ),
+ ENTRY( "Variable" ),
+ ENTRY( "Definition" ),
+ ENTRY( "Teletype" ), // RES_POOLCHR_HTML_TELETYPE
+ { 0, NULL }
+};
+
+const struct SwTableEntry PageDescProgNameTable [] =
+{
+ ENTRY( "Standard" ), // STR_POOLPAGE_PRGM_STANDARD
+ ENTRY( "First Page" ),
+ ENTRY( "Left Page" ),
+ ENTRY( "Right Page" ),
+ ENTRY( "Envelope" ),
+ ENTRY( "Index" ),
+ ENTRY( "HTML" ),
+ ENTRY( "Footnote" ),
+ ENTRY( "Endnote" ), // STR_POOLPAGE_PRGM_ENDNOTE
+ ENTRY( "Landscape" ),
+ { 0, NULL }
+};
+
+const struct SwTableEntry NumRuleProgNameTable [] =
+{
+ ENTRY( "Numbering 1" ), // STR_POOLNUMRULE_PRGM_NUM1
+ ENTRY( "Numbering 2" ),
+ ENTRY( "Numbering 3" ),
+ ENTRY( "Numbering 4" ),
+ ENTRY( "Numbering 5" ),
+ ENTRY( "List 1" ),
+ ENTRY( "List 2" ),
+ ENTRY( "List 3" ),
+ ENTRY( "List 4" ),
+ ENTRY( "List 5" ), // STR_POOLNUMRULE_PRGM_BUL5
+ { 0, NULL }
+};
+#undef ENTRY
+
+sal_Bool SwStyleNameMapper::SuffixIsUser ( const String & rString )
+{
+ const sal_Unicode *pChar = rString.GetBuffer();
+ sal_Int32 nLen = rString.Len();
+ sal_Bool bRet = sal_False;
+ if( nLen > 8 &&
+ pChar[nLen-7] == ' ' &&
+ pChar[nLen-6] == '(' &&
+ pChar[nLen-5] == 'u' &&
+ pChar[nLen-4] == 's' &&
+ pChar[nLen-3] == 'e' &&
+ pChar[nLen-2] == 'r' &&
+ pChar[nLen-1] == ')' )
+ bRet = sal_True;
+ return bRet;
+}
+void SwStyleNameMapper::CheckSuffixAndDelete ( String & rString )
+{
+ const sal_Unicode *pChar = rString.GetBuffer();
+ xub_StrLen nLen = rString.Len();
+ if (nLen > 8 &&
+ pChar[nLen-7] == ' ' &&
+ pChar[nLen-6] == '(' &&
+ pChar[nLen-5] == 'u' &&
+ pChar[nLen-4] == 's' &&
+ pChar[nLen-3] == 'e' &&
+ pChar[nLen-2] == 'r' &&
+ pChar[nLen-1] == ')')
+ {
+ rString.Erase ( nLen - 7, 7 );
+ }
+}
+const NameToIdHash & SwStyleNameMapper::getHashTable ( SwGetPoolIdFromName eFlags, sal_Bool bProgName )
+{
+ NameToIdHash *pHash = 0;
+ const SvStringsDtor *pStrings;
+
+ switch ( eFlags )
+ {
+ case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL:
+ {
+ sal_uInt16 nIndex;
+ sal_uInt16 nId;
+
+ pHash = bProgName ? pParaProgMap : pParaUIMap;
+ if ( !pHash )
+ {
+ pHash = new NameToIdHash ( RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+ RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+ RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN );
+ pStrings = bProgName ? &GetTextProgNameArray() : &GetTextUINameArray();
+ for ( nIndex = 0, nId = RES_POOLCOLL_TEXT_BEGIN ; nId < RES_POOLCOLL_TEXT_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+ pStrings = bProgName ? &GetListsProgNameArray() : &GetListsUINameArray();
+ for ( nIndex = 0, nId = RES_POOLCOLL_LISTS_BEGIN ; nId < RES_POOLCOLL_LISTS_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+ pStrings = bProgName ? &GetExtraProgNameArray() : &GetExtraUINameArray();
+ for ( nIndex = 0, nId = RES_POOLCOLL_EXTRA_BEGIN ; nId < RES_POOLCOLL_EXTRA_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+ pStrings = bProgName ? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
+ for ( nIndex = 0, nId = RES_POOLCOLL_REGISTER_BEGIN ; nId < RES_POOLCOLL_REGISTER_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+ pStrings = bProgName ? &GetDocProgNameArray() : &GetDocUINameArray();
+ for ( nIndex = 0, nId = RES_POOLCOLL_DOC_BEGIN ; nId < RES_POOLCOLL_DOC_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+ pStrings = bProgName ? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
+ for ( nIndex = 0, nId = RES_POOLCOLL_HTML_BEGIN ; nId < RES_POOLCOLL_HTML_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+
+ if ( bProgName )
+ pParaProgMap = pHash;
+ else
+ pParaUIMap = pHash;
+ }
+ }
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT:
+ {
+ pHash = bProgName ? pCharProgMap : pCharUIMap;
+ if ( !pHash )
+ {
+ sal_uInt16 nIndex;
+ sal_uInt16 nId;
+
+ pHash = new NameToIdHash ( RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN +
+ RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN );
+ pStrings = bProgName ? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
+ for ( nIndex = 0, nId = RES_POOLCHR_NORMAL_BEGIN ; nId < RES_POOLCHR_NORMAL_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+ pStrings = bProgName ? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
+ for ( nIndex = 0, nId = RES_POOLCHR_HTML_BEGIN ; nId < RES_POOLCHR_HTML_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+ if (bProgName )
+ pCharProgMap = pHash;
+ else
+ pCharUIMap = pHash;
+ }
+ }
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT:
+ {
+ pHash = bProgName ? pFrameProgMap : pFrameUIMap;
+ if ( !pHash )
+ {
+ pHash = new NameToIdHash ( RES_POOLFRM_END - RES_POOLFRM_BEGIN );
+ pStrings = bProgName ? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
+ for ( sal_uInt16 nIndex=0,nId = RES_POOLFRM_BEGIN ; nId < RES_POOLFRM_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+ if ( bProgName )
+ pFrameProgMap = pHash;
+ else
+ pFrameUIMap = pHash;
+ }
+ }
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
+ {
+ pHash = bProgName ? pPageProgMap : pPageUIMap;
+ if ( !pHash )
+ {
+ pHash = new NameToIdHash ( RES_POOLPAGE_END - RES_POOLPAGE_BEGIN );
+ pStrings = bProgName ? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
+ for ( sal_uInt16 nIndex=0,nId = RES_POOLPAGE_BEGIN ; nId < RES_POOLPAGE_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+ if ( bProgName )
+ pPageProgMap = pHash;
+ else
+ pPageUIMap = pHash;
+ }
+ }
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_NUMRULE:
+ {
+ pHash = bProgName ? pNumRuleProgMap : pNumRuleUIMap;
+ if ( !pHash )
+ {
+ pHash = new NameToIdHash ( RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN );
+ pStrings = bProgName ? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
+ for ( sal_uInt16 nIndex=0,nId = RES_POOLNUMRULE_BEGIN ; nId < RES_POOLNUMRULE_END ; nId++,nIndex++ )
+ (*pHash)[(*pStrings)[nIndex]] = nId;
+ if ( bProgName )
+ pNumRuleProgMap = pHash;
+ else
+ pNumRuleUIMap = pHash;
+ }
+ }
+ break;
+ }
+#ifdef _NEED_TO_DEBUG_MAPPING
+ static sal_Bool bTested = sal_False;
+ if ( !bTested )
+ {
+ bTested = sal_True;
+ {
+ for ( sal_uInt16 nIndex = 0, nId = RES_POOLCOLL_TEXT_BEGIN ; nId < RES_POOLCOLL_TEXT_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ for ( nIndex = 0, nId = RES_POOLCOLL_LISTS_BEGIN ; nId < RES_POOLCOLL_LISTS_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ for ( nIndex = 0, nId = RES_POOLCOLL_EXTRA_BEGIN ; nId < RES_POOLCOLL_EXTRA_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ for ( nIndex = 0, nId = RES_POOLCOLL_REGISTER_BEGIN ; nId < RES_POOLCOLL_REGISTER_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ for ( nIndex = 0, nId = RES_POOLCOLL_DOC_BEGIN ; nId < RES_POOLCOLL_DOC_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ for ( nIndex = 0, nId = RES_POOLCOLL_HTML_BEGIN ; nId < RES_POOLCOLL_HTML_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ }
+ {
+ for ( sal_uInt16 nIndex = 0, nId = RES_POOLCHR_NORMAL_BEGIN ; nId < RES_POOLCHR_NORMAL_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ for ( nIndex = 0, nId = RES_POOLCHR_HTML_BEGIN ; nId < RES_POOLCHR_HTML_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ }
+ {
+ for ( sal_uInt16 nIndex=0,nId = RES_POOLFRM_BEGIN ; nId < RES_POOLFRM_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ }
+ {
+ for ( sal_uInt16 nIndex=0,nId = RES_POOLPAGE_BEGIN ; nId < RES_POOLPAGE_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ }
+ {
+ for ( sal_uInt16 nIndex=0,nId = RES_POOLNUMRULE_BEGIN ; nId < RES_POOLNUMRULE_END ; nId++,nIndex++ )
+ {
+ String aString, bString;
+ FillUIName ( nId, aString );
+ bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
+ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ FillProgName ( nNewId, aString );
+ bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( nNewId != nId )
+ *((sal_Int32*)0) = 42;
+ }
+ }
+ }
+#endif
+ return *pHash;
+}
+// This gets the UI Name from the programmatic name
+const String& SwStyleNameMapper::GetUIName ( const String& rName, SwGetPoolIdFromName eFlags )
+{
+ sal_uInt16 nId = GetPoolIdFromProgName ( rName, eFlags );
+ return nId != USHRT_MAX ? GetUIName( nId, rName ) : rName;
+}
+
+
+// Get the programmatic Name from the UI name
+const String& SwStyleNameMapper::GetProgName( const String& rName, SwGetPoolIdFromName eFlags )
+{
+ sal_uInt16 nId = GetPoolIdFromUIName ( rName, eFlags );
+ return nId != USHRT_MAX ? GetProgName( nId, rName ) : rName;
+}
+
+// Get the programmatic name from the UI name in rName and put it into rFillName
+void SwStyleNameMapper::FillProgName ( const String& rName, String& rFillName, SwGetPoolIdFromName eFlags, sal_Bool bDisambiguate )
+{
+ sal_uInt16 nId = GetPoolIdFromUIName ( rName, eFlags );
+ if ( bDisambiguate && nId == USHRT_MAX )
+ {
+ // rName isn't in our UI name table...check if it's in the programmatic one
+ nId = GetPoolIdFromProgName ( rName, eFlags );
+
+ rFillName = rName;
+ if (nId == USHRT_MAX )
+ {
+ // It isn't ...make sure the suffix isn't already " (user)"...if it is,
+ // we need to add another one
+ if ( SuffixIsUser ( rFillName ) )
+ rFillName.AppendAscii ( RTL_CONSTASCII_STRINGPARAM ( " (user)" ) );
+ }
+ else
+ {
+ // It's in the programmatic name table...append suffix
+ rFillName.AppendAscii ( RTL_CONSTASCII_STRINGPARAM ( " (user)" ) );
+ }
+ }
+ else
+ {
+ // If we aren't trying to disambiguate, then just do a normal fill
+ fillNameFromId ( nId, rFillName, sal_True);
+ }
+}
+// Get the UI name from the programmatic name in rName and put it into rFillName
+void SwStyleNameMapper::FillUIName ( const String& rName, String& rFillName, SwGetPoolIdFromName eFlags, sal_Bool bDisambiguate )
+{
+ sal_uInt16 nId = GetPoolIdFromProgName ( rName, eFlags );
+ if ( bDisambiguate && nId == USHRT_MAX )
+ {
+ rFillName = rName;
+ // rName isn't in our Prog name table...check if it has a " (user)" suffix, if so remove it
+ CheckSuffixAndDelete ( rFillName );
+ }
+ else
+ {
+ // If we aren't trying to disambiguate, then just do a normal fill
+ fillNameFromId ( nId, rFillName, sal_False);
+ }
+}
+
+const String& SwStyleNameMapper::getNameFromId( sal_uInt16 nId, const String& rFillName, sal_Bool bProgName )
+{
+ sal_uInt16 nStt = 0;
+ const SvStringsDtor* pStrArr = 0;
+
+ switch( (USER_FMT | COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID) & nId )
+ {
+ case COLL_TEXT_BITS:
+ if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
+ {
+ pStrArr = bProgName ? &GetTextProgNameArray() : &GetTextUINameArray();
+ nStt = RES_POOLCOLL_TEXT_BEGIN;
+ }
+ break;
+ case COLL_LISTS_BITS:
+ if( RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END )
+ {
+ pStrArr = bProgName ? &GetListsProgNameArray() : &GetListsUINameArray();
+ nStt = RES_POOLCOLL_LISTS_BEGIN;
+ }
+ break;
+ case COLL_EXTRA_BITS:
+ if( RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END )
+ {
+ pStrArr = bProgName ? &GetExtraProgNameArray() : &GetExtraUINameArray();
+ nStt = RES_POOLCOLL_EXTRA_BEGIN;
+ }
+ break;
+ case COLL_REGISTER_BITS:
+ if( RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END )
+ {
+ pStrArr = bProgName ? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
+ nStt = RES_POOLCOLL_REGISTER_BEGIN;
+ }
+ break;
+ case COLL_DOC_BITS:
+ if( RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END )
+ {
+ pStrArr = bProgName ? &GetDocProgNameArray() : &GetDocUINameArray();
+ nStt = RES_POOLCOLL_DOC_BEGIN;
+ }
+ break;
+ case COLL_HTML_BITS:
+ if( RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END )
+ {
+ pStrArr = bProgName ? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
+ nStt = RES_POOLCOLL_HTML_BEGIN;
+ }
+ break;
+ case POOLGRP_CHARFMT:
+ if( RES_POOLCHR_NORMAL_BEGIN <= nId && nId < RES_POOLCHR_NORMAL_END )
+ {
+ pStrArr = bProgName ? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
+ nStt = RES_POOLCHR_NORMAL_BEGIN;
+ }
+ else if( RES_POOLCHR_HTML_BEGIN <= nId && nId < RES_POOLCHR_HTML_END )
+ {
+ pStrArr = bProgName ? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
+ nStt = RES_POOLCHR_HTML_BEGIN;
+ }
+ break;
+ case POOLGRP_FRAMEFMT:
+ if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
+ {
+ pStrArr = bProgName ? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
+ nStt = RES_POOLFRM_BEGIN;
+ }
+ break;
+ case POOLGRP_PAGEDESC:
+ if( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END )
+ {
+ pStrArr = bProgName ? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
+ nStt = RES_POOLPAGE_BEGIN;
+ }
+ break;
+ case POOLGRP_NUMRULE:
+ if( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END )
+ {
+ pStrArr = bProgName ? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
+ nStt = RES_POOLNUMRULE_BEGIN;
+ }
+ break;
+ }
+ return pStrArr ? *(pStrArr->operator[] ( nId - nStt ) ) : rFillName;
+}
+void SwStyleNameMapper::fillNameFromId( sal_uInt16 nId, String& rFillName, sal_Bool bProgName )
+{
+ sal_uInt16 nStt = 0;
+ const SvStringsDtor* pStrArr = 0;
+
+ switch( (USER_FMT | COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID) & nId )
+ {
+ case COLL_TEXT_BITS:
+ if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
+ {
+ pStrArr = bProgName ? &GetTextProgNameArray() : &GetTextUINameArray();
+ nStt = RES_POOLCOLL_TEXT_BEGIN;
+ }
+ break;
+ case COLL_LISTS_BITS:
+ if( RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END )
+ {
+ pStrArr = bProgName ? &GetListsProgNameArray() : &GetListsUINameArray();
+ nStt = RES_POOLCOLL_LISTS_BEGIN;
+ }
+ break;
+ case COLL_EXTRA_BITS:
+ if( RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END )
+ {
+ pStrArr = bProgName ? &GetExtraProgNameArray() : &GetExtraUINameArray();
+ nStt = RES_POOLCOLL_EXTRA_BEGIN;
+ }
+ break;
+ case COLL_REGISTER_BITS:
+ if( RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END )
+ {
+ pStrArr = bProgName ? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
+ nStt = RES_POOLCOLL_REGISTER_BEGIN;
+ }
+ break;
+ case COLL_DOC_BITS:
+ if( RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END )
+ {
+ pStrArr = bProgName ? &GetDocProgNameArray() : &GetDocUINameArray();
+ nStt = RES_POOLCOLL_DOC_BEGIN;
+ }
+ break;
+ case COLL_HTML_BITS:
+ if( RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END )
+ {
+ pStrArr = bProgName ? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
+ nStt = RES_POOLCOLL_HTML_BEGIN;
+ }
+ break;
+ case POOLGRP_CHARFMT:
+ if( RES_POOLCHR_NORMAL_BEGIN <= nId && nId < RES_POOLCHR_NORMAL_END )
+ {
+ pStrArr = bProgName ? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
+ nStt = RES_POOLCHR_NORMAL_BEGIN;
+ }
+ else if( RES_POOLCHR_HTML_BEGIN <= nId && nId < RES_POOLCHR_HTML_END )
+ {
+ pStrArr = bProgName ? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
+ nStt = RES_POOLCHR_HTML_BEGIN;
+ }
+ break;
+ case POOLGRP_FRAMEFMT:
+ if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
+ {
+ pStrArr = bProgName ? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
+ nStt = RES_POOLFRM_BEGIN;
+ }
+ break;
+ case POOLGRP_PAGEDESC:
+ if( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END )
+ {
+ pStrArr = bProgName ? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
+ nStt = RES_POOLPAGE_BEGIN;
+ }
+ break;
+ case POOLGRP_NUMRULE:
+ if( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END )
+ {
+ pStrArr = bProgName ? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
+ nStt = RES_POOLNUMRULE_BEGIN;
+ }
+ break;
+ }
+ if (pStrArr)
+ rFillName = *(pStrArr->operator[] ( nId - nStt ) );
+}
+// Get the UI Name from the pool ID
+void SwStyleNameMapper::FillUIName ( sal_uInt16 nId, String& rFillName )
+{
+ fillNameFromId ( nId, rFillName, sal_False );
+}
+// Get the UI Name from the pool ID
+const String& SwStyleNameMapper::GetUIName ( sal_uInt16 nId, const String& rName )
+{
+ return getNameFromId ( nId, rName, sal_False );
+}
+
+// Get the programmatic Name from the pool ID
+void SwStyleNameMapper::FillProgName ( sal_uInt16 nId, String& rFillName )
+{
+ fillNameFromId ( nId, rFillName, sal_True );
+}
+// Get the programmatic Name from the pool ID
+const String& SwStyleNameMapper::GetProgName ( sal_uInt16 nId, const String& rName )
+{
+ return getNameFromId ( nId, rName, sal_True );
+}
+// This gets the PoolId from the UI Name
+sal_uInt16 SwStyleNameMapper::GetPoolIdFromUIName( const String& rName, SwGetPoolIdFromName eFlags )
+{
+ const NameToIdHash & rHashMap = getHashTable ( eFlags, sal_False );
+ NameToIdHash::const_iterator aIter = rHashMap.find ( &rName );
+ return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
+}
+// Get the Pool ID from the programmatic name
+sal_uInt16 SwStyleNameMapper::GetPoolIdFromProgName( const String& rName, SwGetPoolIdFromName eFlags )
+{
+ const NameToIdHash & rHashMap = getHashTable ( eFlags, sal_True );
+ NameToIdHash::const_iterator aIter = rHashMap.find ( &rName );
+ return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
+}
+
+SvStringsDtor* SwStyleNameMapper::NewUINameArray( SvStringsDtor*& pNameArray, sal_uInt16 nStt, sal_uInt16 nEnd )
+{
+ if( !pNameArray )
+ {
+ pNameArray = new SvStringsDtor( static_cast < sal_Int8 > (nEnd - nStt), 1 );
+ while( nStt < nEnd )
+ {
+ const ResId rRId( nStt, *pSwResMgr );
+ String* pStr = new String( rRId );
+ pNameArray->Insert( pStr, pNameArray->Count() );
+ ++nStt;
+ }
+ }
+ return pNameArray;
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetTextUINameArray()
+{
+ return pTextUINameArray ? *pTextUINameArray :
+ *NewUINameArray( pTextUINameArray, RC_POOLCOLL_TEXT_BEGIN,
+ ( RC_POOLCOLL_TEXT_BEGIN +
+ (RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN )) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetListsUINameArray()
+{
+ return pListsUINameArray ? *pListsUINameArray :
+ *NewUINameArray( pListsUINameArray, RC_POOLCOLL_LISTS_BEGIN,
+ ( RC_POOLCOLL_LISTS_BEGIN +
+ (RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN )) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetExtraUINameArray()
+{
+ return pExtraUINameArray ? *pExtraUINameArray :
+ *NewUINameArray( pExtraUINameArray, RC_POOLCOLL_EXTRA_BEGIN,
+ ( RC_POOLCOLL_EXTRA_BEGIN +
+ (RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN )) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetRegisterUINameArray()
+{
+ return pRegisterUINameArray ? *pRegisterUINameArray :
+ *NewUINameArray( pRegisterUINameArray, RC_POOLCOLL_REGISTER_BEGIN,
+ ( RC_POOLCOLL_REGISTER_BEGIN +
+ (RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN )) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetDocUINameArray()
+{
+ return pDocUINameArray ? *pDocUINameArray :
+ *NewUINameArray( pDocUINameArray, RC_POOLCOLL_DOC_BEGIN,
+ ( RC_POOLCOLL_DOC_BEGIN +
+ (RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN )) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetHTMLUINameArray()
+{
+ return pHTMLUINameArray ? *pHTMLUINameArray :
+ *NewUINameArray( pHTMLUINameArray, RC_POOLCOLL_HTML_BEGIN,
+ ( RC_POOLCOLL_HTML_BEGIN +
+ (RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN )) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetFrmFmtUINameArray()
+{
+ return pFrmFmtUINameArray ? *pFrmFmtUINameArray :
+ *NewUINameArray( pFrmFmtUINameArray, RC_POOLFRMFMT_BEGIN,
+ ( RC_POOLFRMFMT_BEGIN +
+ (RES_POOLFRM_END - RES_POOLFRM_BEGIN )) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetChrFmtUINameArray()
+{
+ return pChrFmtUINameArray ? *pChrFmtUINameArray :
+ *NewUINameArray( pChrFmtUINameArray, RC_POOLCHRFMT_BEGIN,
+ ( RC_POOLCHRFMT_BEGIN +
+ (RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN )) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetHTMLChrFmtUINameArray()
+{
+ return pHTMLChrFmtUINameArray ? *pHTMLChrFmtUINameArray :
+ *NewUINameArray( pHTMLChrFmtUINameArray, RC_POOLCHRFMT_HTML_BEGIN,
+ ( RC_POOLCHRFMT_HTML_BEGIN +
+ (RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN )) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetPageDescUINameArray()
+{
+ return pPageDescUINameArray ? *pPageDescUINameArray :
+ *NewUINameArray( pPageDescUINameArray, RC_POOLPAGEDESC_BEGIN,
+ ( RC_POOLPAGEDESC_BEGIN +
+ (RES_POOLPAGE_END - RES_POOLPAGE_BEGIN )) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetNumRuleUINameArray()
+{
+ return pNumRuleUINameArray ? *pNumRuleUINameArray :
+ *NewUINameArray( pNumRuleUINameArray, RC_POOLNUMRULE_BEGIN,
+ ( RC_POOLNUMRULE_BEGIN +
+ (RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN )) );
+}
+
+SvStringsDtor* SwStyleNameMapper::NewProgNameArray( SvStringsDtor*& pProgNameArray, const SwTableEntry *pTable, sal_uInt8 nCount )
+{
+ if( !pProgNameArray )
+ {
+ pProgNameArray = new SvStringsDtor( nCount, 1 );
+ while (pTable->nLength)
+ {
+ String* pStr = new String( pTable->pChar, pTable->nLength, RTL_TEXTENCODING_ASCII_US );
+ pProgNameArray->Insert( pStr, pProgNameArray->Count() );
+ pTable++;
+ }
+ }
+ return pProgNameArray;
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetTextProgNameArray()
+{
+ return pTextProgNameArray ? *pTextProgNameArray :
+ *NewProgNameArray( pTextProgNameArray, TextProgNameTable,
+ sizeof ( TextProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetListsProgNameArray()
+{
+ return pListsProgNameArray ? *pListsProgNameArray :
+ *NewProgNameArray( pListsProgNameArray, ListsProgNameTable,
+ sizeof ( ListsProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetExtraProgNameArray()
+{
+ return pExtraProgNameArray ? *pExtraProgNameArray :
+ *NewProgNameArray( pExtraProgNameArray, ExtraProgNameTable,
+ sizeof ( ExtraProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetRegisterProgNameArray()
+{
+ return pRegisterProgNameArray ? *pRegisterProgNameArray :
+ *NewProgNameArray( pRegisterProgNameArray, RegisterProgNameTable,
+ sizeof ( RegisterProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetDocProgNameArray()
+{
+ return pDocProgNameArray ? *pDocProgNameArray :
+ *NewProgNameArray( pDocProgNameArray, DocProgNameTable,
+ sizeof ( DocProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetHTMLProgNameArray()
+{
+ return pHTMLProgNameArray ? *pHTMLProgNameArray :
+ *NewProgNameArray( pHTMLProgNameArray, HTMLProgNameTable,
+ sizeof ( HTMLProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetFrmFmtProgNameArray()
+{
+ return pFrmFmtProgNameArray ? *pFrmFmtProgNameArray :
+ *NewProgNameArray( pFrmFmtProgNameArray, FrmFmtProgNameTable,
+ sizeof ( FrmFmtProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetChrFmtProgNameArray()
+{
+ return pChrFmtProgNameArray ? *pChrFmtProgNameArray :
+ *NewProgNameArray( pChrFmtProgNameArray, ChrFmtProgNameTable,
+ sizeof ( ChrFmtProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetHTMLChrFmtProgNameArray()
+{
+ return pHTMLChrFmtProgNameArray ? *pHTMLChrFmtProgNameArray :
+ *NewProgNameArray( pHTMLChrFmtProgNameArray, HTMLChrFmtProgNameTable,
+ sizeof ( HTMLChrFmtProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetPageDescProgNameArray()
+{
+ return pPageDescProgNameArray ? *pPageDescProgNameArray :
+ *NewProgNameArray( pPageDescProgNameArray, PageDescProgNameTable,
+ sizeof ( PageDescProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+const SvStringsDtor& SwStyleNameMapper::GetNumRuleProgNameArray()
+{
+ return pNumRuleProgNameArray ? *pNumRuleProgNameArray :
+ *NewProgNameArray( pNumRuleProgNameArray, NumRuleProgNameTable,
+ sizeof ( NumRuleProgNameTable ) / sizeof ( SwTableEntry ) );
+}
+
+
+const String SwStyleNameMapper::GetSpecialExtraProgName( const String& rExtraUIName )
+{
+ String aRes = rExtraUIName;
+ sal_Bool bChgName = sal_False;
+ const SvStringsDtor& rExtraArr = GetExtraUINameArray();
+ static sal_uInt16 nIds[] =
+ {
+ RES_POOLCOLL_LABEL_DRAWING - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_ABB - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_TABLE - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_FRAME- RES_POOLCOLL_EXTRA_BEGIN,
+ 0
+ };
+ const sal_uInt16 * pIds;
+ for ( pIds = nIds; *pIds; ++pIds)
+ {
+ if (aRes == *rExtraArr[ *pIds ])
+ {
+ bChgName = sal_True;
+ break;
+ }
+ }
+ if (bChgName)
+ aRes = *GetExtraProgNameArray()[*pIds];
+ return aRes;
+}
+
+const String SwStyleNameMapper::GetSpecialExtraUIName( const String& rExtraProgName )
+{
+ String aRes = rExtraProgName;
+ sal_Bool bChgName = sal_False;
+ const SvStringsDtor& rExtraArr = GetExtraProgNameArray();
+ static sal_uInt16 nIds[] =
+ {
+ RES_POOLCOLL_LABEL_DRAWING - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_ABB - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_TABLE - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_FRAME- RES_POOLCOLL_EXTRA_BEGIN,
+ 0
+ };
+ const sal_uInt16 * pIds;
+
+ for ( pIds = nIds; *pIds; ++pIds)
+ {
+ if (aRes == *rExtraArr[ *pIds ])
+ {
+ bChgName = sal_True;
+ break;
+ }
+ }
+ if (bChgName)
+ aRes = *GetExtraUINameArray()[*pIds];
+ return aRes;
+}
+
diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
new file mode 100644
index 000000000000..f1285cd48ba1
--- /dev/null
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -0,0 +1,474 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <tools/urlobj.hxx>
+#include <hintids.hxx>
+#include <hints.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include <acmplwrd.hxx>
+#include <doc.hxx>
+#include <ndindex.hxx>
+#include <docary.hxx>
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+#include <calbck.hxx>
+#include <editeng/svxacorr.hxx>
+
+#include <editeng/acorrcfg.hxx>
+#include <sfx2/docfile.hxx>
+#include <docsh.hxx>
+
+#include <vector>
+/* -----------------------------05.08.2002 12:43------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwAutoCompleteClient : public SwClient
+{
+ SwAutoCompleteWord* pAutoCompleteWord;
+ SwDoc* pDoc;
+#ifdef DBG_UTIL
+ static sal_uLong nSwAutoCompleteClientCount;
+#endif
+public:
+ SwAutoCompleteClient(SwAutoCompleteWord& rToTell, SwDoc& rSwDoc);
+ SwAutoCompleteClient(const SwAutoCompleteClient& rClient);
+ ~SwAutoCompleteClient();
+
+ SwAutoCompleteClient& operator=(const SwAutoCompleteClient& rClient);
+
+ const SwDoc& GetDoc(){return *pDoc;}
+#ifdef DBG_UTIL
+ static sal_uLong GetElementCount() {return nSwAutoCompleteClientCount;}
+#endif
+protected:
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
+};
+/* -----------------------------05.08.2002 12:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+typedef std::vector<SwAutoCompleteClient> SwAutoCompleteClientVector;
+
+class SwAutoCompleteWord_Impl
+{
+ SwAutoCompleteClientVector aClientVector;
+ SwAutoCompleteWord& rAutoCompleteWord;
+public:
+ SwAutoCompleteWord_Impl(SwAutoCompleteWord& rParent) :
+ rAutoCompleteWord(rParent){}
+ void AddDocument(SwDoc& rDoc);
+ void RemoveDocument(const SwDoc& rDoc);
+};
+
+/* -----------------------------05.08.2002 14:11------------------------------
+
+ ---------------------------------------------------------------------------*/
+typedef const SwDoc* SwDocPtr;
+typedef std::vector<SwDocPtr> SwDocPtrVector;
+class SwAutoCompleteString : public String
+{
+#ifdef DBG_UTIL
+ static sal_uLong nSwAutoCompleteStringCount;
+#endif
+ SwDocPtrVector aSourceDocs;
+ public:
+ SwAutoCompleteString(const String& rStr, xub_StrLen nPos, xub_StrLen nLen);
+
+ ~SwAutoCompleteString();
+ void AddDocument(const SwDoc& rDoc);
+ //returns true if last document reference has been removed
+ sal_Bool RemoveDocument(const SwDoc& rDoc);
+#ifdef DBG_UTIL
+ static sal_uLong GetElementCount() {return nSwAutoCompleteStringCount;}
+#endif
+};
+#ifdef DBG_UTIL
+ sal_uLong SwAutoCompleteClient::nSwAutoCompleteClientCount = 0;
+ sal_uLong SwAutoCompleteString::nSwAutoCompleteStringCount = 0;
+#endif
+/* -----------------------------06.08.2002 08:57------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwAutoCompleteClient::SwAutoCompleteClient(SwAutoCompleteWord& rToTell, SwDoc& rSwDoc) :
+ pAutoCompleteWord(&rToTell),
+ pDoc(&rSwDoc)
+{
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+#ifdef DBG_UTIL
+ ++nSwAutoCompleteClientCount;
+#endif
+}
+/* -----------------------------05.08.2002 14:07------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwAutoCompleteClient::SwAutoCompleteClient(const SwAutoCompleteClient& rClient) :
+ SwClient(),
+ pAutoCompleteWord(rClient.pAutoCompleteWord),
+ pDoc(rClient.pDoc)
+{
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+#ifdef DBG_UTIL
+ ++nSwAutoCompleteClientCount;
+#endif
+}
+/* -----------------------------05.08.2002 14:10------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwAutoCompleteClient::~SwAutoCompleteClient()
+{
+#ifdef DBG_UTIL
+ --nSwAutoCompleteClientCount;
+#endif
+}
+/* -----------------06.03.2003 15:30-----------------
+
+ --------------------------------------------------*/
+SwAutoCompleteClient& SwAutoCompleteClient::operator=(const SwAutoCompleteClient& rClient)
+{
+ pAutoCompleteWord = rClient.pAutoCompleteWord;
+ pDoc = rClient.pDoc;
+ if(rClient.GetRegisteredIn())
+ ((SwModify*)rClient.GetRegisteredIn())->Add(this);
+ else if(GetRegisteredIn())
+ GetRegisteredInNonConst()->Remove(this);
+ return *this;
+}
+/* -----------------------------05.08.2002 12:49------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwAutoCompleteClient::Modify( const SfxPoolItem* pOld, const SfxPoolItem *)
+{
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ if( (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ pAutoCompleteWord->DocumentDying(*pDoc);
+ break;
+
+ }
+}
+/* -----------------------------05.08.2002 13:03------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwAutoCompleteWord_Impl::AddDocument(SwDoc& rDoc)
+{
+ SwAutoCompleteClientVector::iterator aIt;
+ for(aIt = aClientVector.begin(); aIt != aClientVector.end(); aIt++)
+ {
+ if(&aIt->GetDoc() == &rDoc)
+ return;
+ }
+ aClientVector.push_back(SwAutoCompleteClient(rAutoCompleteWord, rDoc));
+}
+/* -----------------------------05.08.2002 14:33------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwAutoCompleteWord_Impl::RemoveDocument(const SwDoc& rDoc)
+{
+ SwAutoCompleteClientVector::iterator aIt;
+ for(aIt = aClientVector.begin(); aIt != aClientVector.end(); aIt++)
+ {
+ if(&aIt->GetDoc() == &rDoc)
+ {
+ aClientVector.erase(aIt);
+ return;
+ }
+ }
+}
+/* -----------------------------06.08.2002 08:54------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwAutoCompleteString::SwAutoCompleteString(const String& rStr, xub_StrLen nPos, xub_StrLen nLen) :
+ String( rStr, nPos, nLen )
+{
+#ifdef DBG_UTIL
+ ++nSwAutoCompleteStringCount;
+#endif
+}
+/* -----------------------------05.08.2002 14:22------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwAutoCompleteString::~SwAutoCompleteString()
+{
+#ifdef DBG_UTIL
+ --nSwAutoCompleteStringCount;
+#endif
+}
+/* -----------------------------05.08.2002 14:17------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwAutoCompleteString::AddDocument(const SwDoc& rDoc)
+{
+ SwDocPtrVector::iterator aIt;
+ for(aIt = aSourceDocs.begin(); aIt != aSourceDocs.end(); aIt++)
+ {
+ if(*aIt == &rDoc)
+ return;
+ }
+ SwDocPtr pNew = &rDoc;
+ aSourceDocs.push_back(pNew);
+}
+/* -----------------------------05.08.2002 14:36------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwAutoCompleteString::RemoveDocument(const SwDoc& rDoc)
+{
+ SwDocPtrVector::iterator aIt;
+ for(aIt = aSourceDocs.begin(); aIt != aSourceDocs.end(); aIt++)
+ {
+ if(*aIt == &rDoc)
+ {
+ aSourceDocs.erase(aIt);
+ return !aSourceDocs.size();
+ }
+ }
+ return sal_False;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwAutoCompleteWord::SwAutoCompleteWord( sal_uInt16 nWords, sal_uInt16 nMWrdLen )
+ : aWordLst( 0, 255 ), aLRULst( 0, 255 ),
+ pImpl(new SwAutoCompleteWord_Impl(*this)),
+ nMaxCount( nWords ),
+ nMinWrdLen( nMWrdLen ),
+ bLockWordLst( sal_False )
+{
+}
+
+SwAutoCompleteWord::~SwAutoCompleteWord()
+{
+ for(sal_uInt16 nPos = aWordLst.Count(); nPos; nPos--)
+ {
+ SwAutoCompleteString* pCurrent = (SwAutoCompleteString*)aWordLst[ nPos - 1 ];
+ aWordLst.Remove( nPos - 1 );
+ delete pCurrent;
+ }
+ delete pImpl;
+#ifdef DBG_UTIL
+ sal_uLong nStrings = SwAutoCompleteString::GetElementCount();
+ sal_uLong nClients = SwAutoCompleteClient::GetElementCount();
+ DBG_ASSERT(!nStrings && !nClients, "AutoComplete: clients or string count mismatch");
+#endif
+}
+
+sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc )
+{
+ SwDocShell* pDocShell = rDoc.GetDocShell();
+ SfxMedium* pMedium = pDocShell ? pDocShell->GetMedium() : 0;
+ // strings from help module should not be added
+ if( pMedium )
+ {
+ const INetURLObject& rURL = pMedium->GetURLObject();
+ if ( rURL.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP )
+ return sal_False;
+ }
+
+ String aNewWord(rWord);
+ aNewWord.EraseAllChars( CH_TXTATR_INWORD );
+ aNewWord.EraseAllChars( CH_TXTATR_BREAKWORD );
+
+ pImpl->AddDocument(rDoc);
+ sal_Bool bRet = sal_False;
+ xub_StrLen nWrdLen = aNewWord.Len();
+ while( nWrdLen && '.' == aNewWord.GetChar( nWrdLen-1 ))
+ --nWrdLen;
+
+ if( !bLockWordLst && nWrdLen >= nMinWrdLen )
+ {
+ SwAutoCompleteString* pAutoString;
+ StringPtr pNew = pAutoString = new SwAutoCompleteString( aNewWord, 0, nWrdLen );
+ pAutoString->AddDocument(rDoc);
+ sal_uInt16 nInsPos;
+ if( aWordLst.Insert( pNew, nInsPos ) )
+ {
+ bRet = sal_True;
+ if( aLRULst.Count() < nMaxCount )
+ aLRULst.Insert( pNew, 0 );
+ else
+ {
+ // der letzte muss entfernt werden
+ // damit der neue vorne Platz hat
+ String* pDel = (String*)aLRULst[ nMaxCount - 1 ];
+
+ void** ppData = (void**)aLRULst.GetData();
+ memmove( ppData+1, ppData, (nMaxCount - 1) * sizeof( void* ));
+ *ppData = pNew;
+
+ aWordLst.Remove( pDel );
+ delete (SwAutoCompleteString*)pDel;
+ }
+ }
+ else
+ {
+ delete (SwAutoCompleteString*)pNew;
+ // dann aber auf jedenfall nach "oben" moven
+ pNew = aWordLst[ nInsPos ];
+
+ //add the document to the already inserted string
+ SwAutoCompleteString* pCurrent = (SwAutoCompleteString*)pNew;
+ pCurrent->AddDocument(rDoc);
+
+ nInsPos = aLRULst.GetPos( (void*)pNew );
+ ASSERT( USHRT_MAX != nInsPos, "String nicht gefunden" );
+ if( nInsPos )
+ {
+ void** ppData = (void**)aLRULst.GetData();
+ memmove( ppData+1, ppData, nInsPos * sizeof( void* ) );
+ *ppData = pNew;
+ }
+ }
+ }
+ return bRet;
+}
+
+void SwAutoCompleteWord::SetMaxCount( sal_uInt16 nNewMax )
+{
+ if( nNewMax < nMaxCount && aLRULst.Count() > nNewMax )
+ {
+ // dann die unten ueberhaengenden entfernen
+ sal_uInt16 nLRUIndex = nNewMax-1;
+ while( nNewMax < aWordLst.Count() && nLRUIndex < aLRULst.Count())
+ {
+ sal_uInt16 nPos = aWordLst.GetPos( (String*)aLRULst[ nLRUIndex++ ] );
+ ASSERT( USHRT_MAX != nPos, "String nicht gefunden" );
+ void * pDel = aWordLst[nPos];
+ aWordLst.Remove(nPos);
+ delete (SwAutoCompleteString*)pDel;
+ }
+ aLRULst.Remove( nNewMax-1, aLRULst.Count() - nNewMax );
+ }
+ nMaxCount = nNewMax;
+}
+
+void SwAutoCompleteWord::SetMinWordLen( sal_uInt16 n )
+{
+ // will man wirklich alle Worte, die kleiner als die neue Min Laenge
+ // sind entfernen?
+ // JP 02.02.99 - erstmal nicht.
+
+ // JP 11.03.99 - mal testhalber eingebaut
+ if( n < nMinWrdLen )
+ {
+ for( sal_uInt16 nPos = 0; nPos < aWordLst.Count(); ++nPos )
+ if( aWordLst[ nPos ]->Len() < n )
+ {
+ void* pDel = aWordLst[ nPos ];
+ aWordLst.Remove(nPos);
+
+ sal_uInt16 nDelPos = aLRULst.GetPos( pDel );
+ ASSERT( USHRT_MAX != nDelPos, "String nicht gefunden" );
+ aLRULst.Remove( nDelPos );
+ --nPos;
+ delete (SwAutoCompleteString*)pDel;
+ }
+ }
+
+ nMinWrdLen = n;
+}
+
+sal_Bool SwAutoCompleteWord::GetRange( const String& rWord, sal_uInt16& rStt,
+ sal_uInt16& rEnd ) const
+{
+ const StringPtr pStr = (StringPtr)&rWord;
+ aWordLst.Seek_Entry( pStr, &rStt );
+ rEnd = rStt;
+
+ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+ while( rEnd < aWordLst.Count() && rSCmp.isMatch( rWord, *aWordLst[ rEnd ]))
+ ++rEnd;
+
+ return rStt < rEnd;
+}
+
+void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst )
+{
+ sal_uInt16 nMyLen = aWordLst.Count(), nNewLen = rNewLst.Count();
+ sal_uInt16 nMyPos = 0, nNewPos = 0;
+
+ for( ; nMyPos < nMyLen && nNewPos < nNewLen; ++nMyPos, ++nNewPos )
+ {
+ const StringPtr pStr = rNewLst[ nNewPos ];
+ while( aWordLst[ nMyPos ] != pStr )
+ {
+ void* pDel = aWordLst[ nMyPos ];
+ aWordLst.Remove(nMyPos);
+
+ sal_uInt16 nPos = aLRULst.GetPos( pDel );
+ ASSERT( USHRT_MAX != nPos, "String nicht gefunden" );
+ aLRULst.Remove( nPos );
+ delete (SwAutoCompleteString*)pDel;
+ if( nMyPos >= --nMyLen )
+ break;
+ }
+ }
+ //remove the elements at the end of the array
+ if( nMyPos < nMyLen )
+ {
+ //clear LRU array first then delete the string object
+ for( ; nNewPos < nMyLen; ++nNewPos )
+ {
+ void* pDel = aWordLst[ nNewPos ];
+ sal_uInt16 nPos = aLRULst.GetPos( pDel );
+ ASSERT( USHRT_MAX != nPos, "String nicht gefunden" );
+ aLRULst.Remove( nPos );
+ delete (SwAutoCompleteString*)pDel;
+ }
+ //remove from array
+ aWordLst.Remove( nMyPos, nMyLen - nMyPos );
+ }
+}
+/* -----------------------------05.08.2002 12:54------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwAutoCompleteWord::DocumentDying(const SwDoc& rDoc)
+{
+ pImpl->RemoveDocument(rDoc);
+
+ SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ const sal_Bool bDelete = !pACorr->GetSwFlags().bAutoCmpltKeepList;
+ for(sal_uInt16 nPos = aWordLst.Count(); nPos; nPos--)
+ {
+ SwAutoCompleteString* pCurrent = (SwAutoCompleteString*)aWordLst[ nPos - 1 ];
+ if(pCurrent->RemoveDocument(rDoc) && bDelete)
+ {
+ aWordLst.Remove( nPos - 1 );
+ sal_uInt16 nLRUPos = aLRULst.GetPos( (void*)pCurrent );
+ DBG_ASSERT(nLRUPos < USHRT_MAX, "word not found in LRU list" );
+ aLRULst.Remove( nLRUPos );
+ delete pCurrent;
+ }
+ }
+}
+
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
new file mode 100644
index 000000000000..08dab4aff359
--- /dev/null
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -0,0 +1,1040 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 DEBUG
+
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/itemiter.hxx>
+#include <string>
+#include <map>
+#include <node.hxx>
+#include <ndtxt.hxx>
+#include <ndhints.hxx>
+#include <txatbase.hxx>
+#include <pam.hxx>
+#include <docary.hxx>
+#include <swundo.hxx>
+#include <undobj.hxx>
+#include <numrule.hxx>
+#include <doc.hxx>
+#include <frmfmt.hxx>
+#include <fmtanchr.hxx>
+#include <swrect.hxx>
+#include <ndarr.hxx>
+#include <paratr.hxx>
+#include <SwNodeNum.hxx>
+#include <dbgoutsw.hxx>
+#include <SwRewriter.hxx>
+#include <iostream>
+#include <cstdio>
+
+using namespace std;
+
+static ByteString aDbgOutResult;
+bool bDbgOutStdErr = false;
+bool bDbgOutPrintAttrSet = false;
+
+char* db_pretty_print(const String* str, int flags, char* fmt)
+{
+ (void) fmt;
+ (void) flags;
+ return const_cast<char*>(dbg_out(*str));
+}
+
+template<class T>
+String lcl_dbg_out_SvPtrArr(const T & rArr)
+{
+ String aStr("[ ", RTL_TEXTENCODING_ASCII_US);
+
+ for (sal_Int16 n = 0; n < rArr.Count(); n++)
+ {
+ if (n > 0)
+ aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
+
+ if (rArr[n])
+ aStr += lcl_dbg_out(*rArr[n]);
+ else
+ aStr += String("(null)", RTL_TEXTENCODING_ASCII_US);
+ }
+
+ aStr += String(" ]", RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const void * pVoid)
+{
+ char sBuffer[1024];
+
+ sprintf(sBuffer, "%p", pVoid);
+
+ String aTmpStr(sBuffer, RTL_TEXTENCODING_ASCII_US);
+
+ return dbg_out(aTmpStr);
+}
+
+SW_DLLPUBLIC const char * dbg_out(const String & aStr)
+{
+ aDbgOutResult = ByteString(aStr, RTL_TEXTENCODING_ASCII_US);
+
+ if (bDbgOutStdErr)
+ fprintf(stderr, "%s", aDbgOutResult.GetBuffer());
+
+ return aDbgOutResult.GetBuffer();
+}
+
+SW_DLLPUBLIC const char * dbg_out(const ::rtl::OUString & aStr)
+{
+ return OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US).getStr();
+}
+
+
+struct CompareUShort
+{
+ bool operator()(sal_uInt16 a, sal_uInt16 b) const
+ {
+ return a < b;
+ }
+};
+
+map<sal_uInt16,String,CompareUShort> & GetItemWhichMap()
+{
+ static map<sal_uInt16,String,CompareUShort> aItemWhichMap;
+ static bool bInitialized = false;
+
+ if (! bInitialized)
+ {
+ aItemWhichMap[RES_CHRATR_CASEMAP] = String("CHRATR_CASEMAP", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CHARSETCOLOR] = String("CHRATR_CHARSETCOLOR", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_COLOR] = String("CHRATR_COLOR", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CONTOUR] = String("CHRATR_CONTOUR", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CROSSEDOUT] = String("CHRATR_CROSSEDOUT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_ESCAPEMENT] = String("CHRATR_ESCAPEMENT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_FONT] = String("CHRATR_FONT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_FONTSIZE] = String("CHRATR_FONTSIZE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_KERNING] = String("CHRATR_KERNING", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_LANGUAGE] = String("CHRATR_LANGUAGE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_POSTURE] = String("CHRATR_POSTURE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_PROPORTIONALFONTSIZE] = String("CHRATR_PROPORTIONALFONTSIZE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_SHADOWED] = String("CHRATR_SHADOWED", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_UNDERLINE] = String("CHRATR_UNDERLINE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_OVERLINE] = String("CHRATR_OVERLINE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_WEIGHT] = String("CHRATR_WEIGHT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_WORDLINEMODE] = String("CHRATR_WORDLINEMODE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_AUTOKERN] = String("CHRATR_AUTOKERN", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_BLINK] = String("CHRATR_BLINK", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_NOHYPHEN] = String("CHRATR_NOHYPHEN", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_NOLINEBREAK] = String("CHRATR_NOLINEBREAK", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_BACKGROUND] = String("CHRATR_BACKGROUND", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CJK_FONT] = String("CHRATR_CJK_FONT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CJK_FONTSIZE] = String("CHRATR_CJK_FONTSIZE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CJK_LANGUAGE] = String("CHRATR_CJK_LANGUAGE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CJK_POSTURE] = String("CHRATR_CJK_POSTURE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CJK_WEIGHT] = String("CHRATR_CJK_WEIGHT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CTL_FONT] = String("CHRATR_CTL_FONT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CTL_FONTSIZE] = String("CHRATR_CTL_FONTSIZE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CTL_LANGUAGE] = String("CHRATR_CTL_LANGUAGE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CTL_POSTURE] = String("CHRATR_CTL_POSTURE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_CTL_WEIGHT] = String("CHRATR_CTL_WEIGHT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_ROTATE] = String("CHRATR_ROTATE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_EMPHASIS_MARK] = String("CHRATR_EMPHASIS_MARK", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_TWO_LINES] = String("CHRATR_TWO_LINES", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_SCALEW] = String("CHRATR_SCALEW", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_RELIEF] = String("CHRATR_RELIEF", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHRATR_HIDDEN] = String("CHRATR_HIDDEN", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_AUTOFMT] = String("TXTATR_AUTOFMT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_INETFMT] = String("TXTATR_INETFMT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_REFMARK] = String("TXTATR_REFMARK", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_TOXMARK] = String("TXTATR_TOXMARK", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_CHARFMT] = String("TXTATR_CHARFMT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_DUMMY5] = String("TXTATR_DUMMY5", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_CJK_RUBY] = String("TXTATR_CJK_RUBY", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_UNKNOWN_CONTAINER] = String("TXTATR_UNKNOWN_CONTAINER", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_META] = String("TXTATR_META", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_METAFIELD] = String("TXTATR_METAFIELD", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_FIELD] = String("TXTATR_FIELD", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_FLYCNT] = String("TXTATR_FLYCNT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_FTN] = String("TXTATR_FTN", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_DUMMY4] = String("TXTATR_DUMMY4", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_DUMMY3] = String("TXTATR_DUMMY3", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_DUMMY1] = String("TXTATR_DUMMY1", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_DUMMY2] = String("TXTATR_DUMMY2", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_LINESPACING] = String("PARATR_LINESPACING", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_ADJUST] = String("PARATR_ADJUST", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_SPLIT] = String("PARATR_SPLIT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_ORPHANS] = String("PARATR_ORPHANS", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_WIDOWS] = String("PARATR_WIDOWS", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_TABSTOP] = String("PARATR_TABSTOP", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_HYPHENZONE] = String("PARATR_HYPHENZONE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_DROP] = String("PARATR_DROP", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_REGISTER] = String("PARATR_REGISTER", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_NUMRULE] = String("PARATR_NUMRULE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_SCRIPTSPACE] = String("PARATR_SCRIPTSPACE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_HANGINGPUNCTUATION] = String("PARATR_HANGINGPUNCTUATION", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_FORBIDDEN_RULES] = String("PARATR_FORBIDDEN_RULES", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_VERTALIGN] = String("PARATR_VERTALIGN", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_SNAPTOGRID] = String("PARATR_SNAPTOGRID", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PARATR_CONNECT_BORDER] = String("PARATR_CONNECT_BORDER", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_FILL_ORDER] = String("FILL_ORDER", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_FRM_SIZE] = String("FRM_SIZE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PAPER_BIN] = String("PAPER_BIN", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_LR_SPACE] = String("LR_SPACE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_UL_SPACE] = String("UL_SPACE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PAGEDESC] = String("PAGEDESC", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_BREAK] = String("BREAK", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CNTNT] = String("CNTNT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_HEADER] = String("HEADER", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_FOOTER] = String("FOOTER", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PRINT] = String("PRINT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_OPAQUE] = String("OPAQUE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_PROTECT] = String("PROTECT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_SURROUND] = String("SURROUND", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_VERT_ORIENT] = String("VERT_ORIENT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_HORI_ORIENT] = String("HORI_ORIENT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_ANCHOR] = String("ANCHOR", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_BACKGROUND] = String("BACKGROUND", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_BOX] = String("BOX", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_SHADOW] = String("SHADOW", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_FRMMACRO] = String("FRMMACRO", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_COL] = String("COL", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_KEEP] = String("KEEP", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_URL] = String("URL", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_EDIT_IN_READONLY] = String("EDIT_IN_READONLY", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_LAYOUT_SPLIT] = String("LAYOUT_SPLIT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_CHAIN] = String("CHAIN", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TEXTGRID] = String("TEXTGRID", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_LINENUMBER ] = String("LINENUMBER ", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_FTN_AT_TXTEND] = String("FTN_AT_TXTEND", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_END_AT_TXTEND] = String("END_AT_TXTEND", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_COLUMNBALANCE] = String("COLUMNBALANCE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_FRAMEDIR] = String("FRAMEDIR", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_HEADER_FOOTER_EAT_SPACING] = String("HEADER_FOOTER_EAT_SPACING", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_ROW_SPLIT] = String("ROW_SPLIT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_MIRRORGRF] = String("GRFATR_MIRRORGRF", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_CROPGRF] = String("GRFATR_CROPGRF", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_ROTATION] = String("GRFATR_ROTATION", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_LUMINANCE] = String("GRFATR_LUMINANCE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_CONTRAST] = String("GRFATR_CONTRAST", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_CHANNELR] = String("GRFATR_CHANNELR", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_CHANNELG] = String("GRFATR_CHANNELG", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_CHANNELB] = String("GRFATR_CHANNELB", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_GAMMA] = String("GRFATR_GAMMA", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_INVERT] = String("GRFATR_INVERT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_TRANSPARENCY] = String("GRFATR_TRANSPARENCY", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_GRFATR_DRAWMODE] = String("GRFATR_DRAWMODE", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_BOXATR_FORMAT] = String("BOXATR_FORMAT", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_BOXATR_FORMULA] = String("BOXATR_FORMULA", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_BOXATR_VALUE] = String("BOXATR_VALUE", RTL_TEXTENCODING_ASCII_US);
+
+ bInitialized = true;
+ }
+
+ return aItemWhichMap;
+}
+
+const String lcl_dbg_out(const SfxPoolItem & rItem)
+{
+ String aStr("[ ", RTL_TEXTENCODING_ASCII_US);
+
+ if (GetItemWhichMap().find(rItem.Which()) != GetItemWhichMap().end())
+ aStr += GetItemWhichMap()[rItem.Which()];
+ else
+ aStr += String::CreateFromInt32(rItem.Which());
+
+ aStr += String(" ]", RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SfxPoolItem & rItem)
+{
+ return dbg_out(lcl_dbg_out(rItem));
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SfxPoolItem * pItem)
+{
+ return dbg_out(pItem ? lcl_dbg_out(*pItem) :
+ String("(nil)", RTL_TEXTENCODING_ASCII_US));
+}
+
+SW_DLLPUBLIC const String lcl_dbg_out(const SfxItemSet & rSet)
+{
+ SfxItemIter aIter(rSet);
+ const SfxPoolItem * pItem;
+ bool bFirst = true;
+ String aStr = String("[ ", RTL_TEXTENCODING_ASCII_US);
+
+ pItem = aIter.FirstItem();
+
+ while (pItem )
+ {
+ if (!bFirst)
+ aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
+
+ if ((sal_uIntPtr)pItem != SAL_MAX_SIZE)
+ aStr += lcl_dbg_out(*pItem);
+ else
+ aStr += String("invalid", RTL_TEXTENCODING_ASCII_US);
+
+ bFirst = false;
+
+ pItem = aIter.NextItem();
+ }
+
+ aStr += String(" ]", RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SfxItemSet & rSet)
+{
+ return dbg_out(lcl_dbg_out(rSet));
+}
+
+const String lcl_dbg_out(const SwTxtAttr & rAttr)
+{
+ String aStr("[ ", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += String::CreateFromInt32(*rAttr.GetStart());
+ aStr += String("->", RTL_TEXTENCODING_ASCII_US);
+ aStr += String::CreateFromInt32(*rAttr.GetEnd());
+ aStr += String(" ", RTL_TEXTENCODING_ASCII_US);
+ aStr += lcl_dbg_out(rAttr.GetAttr());
+
+ aStr += String(" ]", RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwTxtAttr & rAttr)
+{
+ return dbg_out(lcl_dbg_out(rAttr));
+}
+
+const String lcl_dbg_out(const SwpHints & rHints)
+{
+ String aStr("[ SwpHints\n", RTL_TEXTENCODING_ASCII_US);
+
+ for (sal_uInt16 i = 0; i < rHints.Count(); i++)
+ {
+ aStr += String(" ", RTL_TEXTENCODING_ASCII_US);
+ aStr += lcl_dbg_out(*rHints[i]);
+ aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
+ }
+
+ aStr += String("]\n", RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwpHints &rHints)
+{
+ return dbg_out(lcl_dbg_out(rHints));
+}
+
+String lcl_dbg_out(const SwPosition & rPos)
+{
+ String aStr("( ", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += String::CreateFromInt32(rPos.nNode.GetIndex());
+ aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
+ aStr += String::CreateFromInt32(rPos.nContent.GetIndex());
+ aStr += String(": ", RTL_TEXTENCODING_ASCII_US);
+ aStr += String::CreateFromInt32
+ (reinterpret_cast<sal_IntPtr>(rPos.nContent.GetIdxReg()), 16);
+
+ aStr += String(" )", RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwPosition & rPos)
+{
+ return dbg_out(lcl_dbg_out(rPos));
+}
+
+String lcl_dbg_out(const SwPaM & rPam)
+{
+ String aStr("[ Pt: ", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += lcl_dbg_out(*rPam.GetPoint());
+
+ if (rPam.HasMark())
+ {
+ aStr += String(", Mk: ", RTL_TEXTENCODING_ASCII_US);
+ aStr += lcl_dbg_out(*rPam.GetMark());
+ }
+
+ aStr += String(" ]", RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwPaM & rPam)
+{
+ return dbg_out(lcl_dbg_out(rPam));
+}
+
+String lcl_dbg_out(const SwNodeNum & )
+{
+ return String();/*rNum.ToString();*/
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwNodeNum & rNum)
+{
+ return dbg_out(lcl_dbg_out(rNum));
+}
+
+String lcl_dbg_out(const SwRect & rRect)
+{
+ String aResult("[ [", RTL_TEXTENCODING_ASCII_US);
+
+ aResult += String::CreateFromInt32(rRect.Left());
+ aResult += String(", ", RTL_TEXTENCODING_ASCII_US);
+ aResult += String::CreateFromInt32(rRect.Top());
+ aResult += String("], [", RTL_TEXTENCODING_ASCII_US);
+ aResult += String::CreateFromInt32(rRect.Right());
+ aResult += String(", ", RTL_TEXTENCODING_ASCII_US);
+ aResult += String::CreateFromInt32(rRect.Bottom());
+
+ aResult += String("] ]", RTL_TEXTENCODING_ASCII_US);
+
+ return aResult;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwRect & rRect)
+{
+ return dbg_out(lcl_dbg_out(rRect));
+}
+
+String lcl_dbg_out(const SwFrmFmt & rFrmFmt)
+{
+ String aResult("[ ", RTL_TEXTENCODING_ASCII_US);
+
+ char sBuffer[256];
+ sprintf(sBuffer, "%p", &rFrmFmt);
+
+ aResult += String(sBuffer, RTL_TEXTENCODING_ASCII_US);
+ aResult += String("(", RTL_TEXTENCODING_ASCII_US);
+ aResult += rFrmFmt.GetName();
+ aResult += String(")", RTL_TEXTENCODING_ASCII_US);
+
+ if (rFrmFmt.IsAuto())
+ aResult += String("*", RTL_TEXTENCODING_ASCII_US);
+
+ aResult += String(" ,", RTL_TEXTENCODING_ASCII_US);
+ aResult += lcl_dbg_out(rFrmFmt.FindLayoutRect());
+ aResult += String(" ]", RTL_TEXTENCODING_ASCII_US);
+
+ return aResult;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwFrmFmt & rFrmFmt)
+{
+ return dbg_out(lcl_dbg_out(rFrmFmt));
+}
+
+const String lcl_AnchoredFrames(const SwNode & rNode)
+{
+ String aResult("[", RTL_TEXTENCODING_ASCII_US);
+
+ const SwDoc * pDoc = rNode.GetDoc();
+ if (pDoc)
+ {
+ const SwSpzFrmFmts * pFrmFmts = pDoc->GetSpzFrmFmts();
+
+ if (pFrmFmts)
+ {
+ bool bFirst = true;
+ for (sal_uInt16 nI = 0; nI < pFrmFmts->Count(); nI++)
+ {
+ const SwFmtAnchor & rAnchor = (*pFrmFmts)[nI]->GetAnchor();
+ const SwPosition * pPos = rAnchor.GetCntntAnchor();
+
+ if (pPos && &pPos->nNode.GetNode() == &rNode)
+ {
+ if (! bFirst)
+ aResult += String(", ", RTL_TEXTENCODING_ASCII_US);
+
+ if ((*pFrmFmts)[nI])
+ aResult += lcl_dbg_out(*(*pFrmFmts)[nI]);
+ bFirst = false;
+ }
+ }
+ }
+ }
+
+ aResult += String("]", RTL_TEXTENCODING_ASCII_US);
+
+ return aResult;
+}
+
+String lcl_dbg_out_NumType(sal_Int16 nType)
+{
+ String aTmpStr;
+
+ switch (nType)
+ {
+ case SVX_NUM_NUMBER_NONE:
+ aTmpStr += String(" NONE", RTL_TEXTENCODING_ASCII_US);
+
+ break;
+ case SVX_NUM_CHARS_UPPER_LETTER:
+ aTmpStr += String(" CHARS_UPPER_LETTER",
+ RTL_TEXTENCODING_ASCII_US);
+
+ break;
+ case SVX_NUM_CHARS_LOWER_LETTER:
+ aTmpStr += String(" CHARS_LOWER_LETTER",
+ RTL_TEXTENCODING_ASCII_US);
+
+ break;
+ case SVX_NUM_ROMAN_UPPER:
+ aTmpStr += String(" ROMAN_UPPER",
+ RTL_TEXTENCODING_ASCII_US);
+
+ break;
+ case SVX_NUM_ROMAN_LOWER:
+ aTmpStr += String(" ROMAN_LOWER",
+ RTL_TEXTENCODING_ASCII_US);
+
+ break;
+ case SVX_NUM_ARABIC:
+ aTmpStr += String(" ARABIC",
+ RTL_TEXTENCODING_ASCII_US);
+
+ break;
+ default:
+ aTmpStr += String(" ??",
+ RTL_TEXTENCODING_ASCII_US);
+
+ break;
+ }
+
+ return aTmpStr;
+}
+
+String lcl_dbg_out(const SwNode & rNode)
+{
+ String aTmpStr;
+
+ aTmpStr += String("<node ", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += String("index=\"", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += String::CreateFromInt32(rNode.GetIndex());
+ aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US);
+
+#ifdef DBG_UTIL
+ aTmpStr += String(" serial=\"", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += String::CreateFromInt32(rNode.GetSerial());
+ 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];
+ sprintf(aBuffer, "%p", &rNode);
+ aTmpStr += String(aBuffer, RTL_TEXTENCODING_ASCII_US);
+
+ aTmpStr += String("\">", RTL_TEXTENCODING_ASCII_US);
+
+ const SwTxtNode * pTxtNode = rNode.GetTxtNode();
+
+ if (rNode.IsTxtNode())
+ {
+ const SfxItemSet * pAttrSet = pTxtNode->GetpSwAttrSet();
+
+ aTmpStr += String("<txt>", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += pTxtNode->GetTxt().Copy(0, 10);
+ aTmpStr += String("</txt>", RTL_TEXTENCODING_ASCII_US);
+
+ if (rNode.IsTableNode())
+ aTmpStr += String("<tbl/>", RTL_TEXTENCODING_ASCII_US);
+
+ aTmpStr += String("<outlinelevel>", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += String::CreateFromInt32(pTxtNode->GetAttrOutlineLevel()-1);
+ aTmpStr += String("</outlinelevel>", RTL_TEXTENCODING_ASCII_US);
+
+ const SwNumRule * pNumRule = pTxtNode->GetNumRule();
+
+ if (pNumRule != NULL)
+ {
+ aTmpStr += String("<number>", RTL_TEXTENCODING_ASCII_US);
+ if ( pTxtNode->GetNum() )
+ {
+ aTmpStr += lcl_dbg_out(*(pTxtNode->GetNum()));
+ }
+ aTmpStr += String("</number>", RTL_TEXTENCODING_ASCII_US);
+
+ aTmpStr += String("<rule>", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += pNumRule->GetName();
+
+ const SfxPoolItem * pItem = NULL;
+
+ if (pAttrSet && SFX_ITEM_SET ==
+ pAttrSet->GetItemState(RES_PARATR_NUMRULE, sal_False, &pItem))
+ {
+ aTmpStr += String("(", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr +=
+ static_cast<const SwNumRuleItem *>(pItem)->GetValue();
+ aTmpStr += String(")", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += String("*", RTL_TEXTENCODING_ASCII_US);
+ }
+
+ const SwNumFmt * pNumFmt = NULL;
+ aTmpStr += String("</rule>", RTL_TEXTENCODING_ASCII_US);
+
+ if (pTxtNode->GetActualListLevel() > 0)
+ pNumFmt = pNumRule->GetNumFmt( static_cast< sal_uInt16 >(pTxtNode->GetActualListLevel()) );
+
+ if (pNumFmt)
+ {
+ aTmpStr += String("<numformat>", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr +=
+ lcl_dbg_out_NumType(pNumFmt->GetNumberingType());
+ aTmpStr += String("</numformat>", RTL_TEXTENCODING_ASCII_US);
+ }
+ }
+
+ if (pTxtNode->IsCountedInList())
+ aTmpStr += String("<counted/>", RTL_TEXTENCODING_ASCII_US);
+
+ SwFmtColl * pColl = pTxtNode->GetFmtColl();
+
+ if (pColl)
+ {
+ aTmpStr += String("<coll>", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += pColl->GetName();
+
+ aTmpStr += String("(", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += String::CreateFromInt32
+ //(static_cast<SwTxtFmtColl *>(pColl)->GetOutlineLevel());//#outline level,zhaojianwei
+ (static_cast<SwTxtFmtColl *>(pColl)->GetAssignedOutlineStyleLevel());//<-end,zhaojianwei
+
+ const SwNumRuleItem & rItem =
+ static_cast<const SwNumRuleItem &>
+ (pColl->GetFmtAttr(RES_PARATR_NUMRULE));
+ const String sNumruleName = rItem.GetValue();
+
+ if (sNumruleName.Len() > 0)
+ {
+ aTmpStr += String(", ", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += sNumruleName;
+ }
+ aTmpStr += String(")", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += String("</coll>", RTL_TEXTENCODING_ASCII_US);
+ }
+
+ SwFmtColl * pCColl = pTxtNode->GetCondFmtColl();
+
+ if (pCColl)
+ {
+ aTmpStr += String("<ccoll>", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += pCColl->GetName();
+ aTmpStr += String("</ccoll>", RTL_TEXTENCODING_ASCII_US);
+ }
+
+ aTmpStr += String("<frms>", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += lcl_AnchoredFrames(rNode);
+ aTmpStr += String("</frms>", RTL_TEXTENCODING_ASCII_US);
+
+ if (bDbgOutPrintAttrSet)
+ {
+ aTmpStr += String("<attrs>", RTL_TEXTENCODING_ASCII_US);
+ aTmpStr += lcl_dbg_out(pTxtNode->GetSwAttrSet());
+ aTmpStr += String("</attrs>", RTL_TEXTENCODING_ASCII_US);
+ }
+ }
+ else if (rNode.IsStartNode())
+ {
+ aTmpStr += String("<start end=\"", RTL_TEXTENCODING_ASCII_US);
+
+ const SwStartNode * pStartNode = dynamic_cast<const SwStartNode *> (&rNode);
+ if (pStartNode != NULL)
+ aTmpStr += String::CreateFromInt32(pStartNode->EndOfSectionNode()->GetIndex());
+
+ aTmpStr += String("\"/>", RTL_TEXTENCODING_ASCII_US);
+ }
+ else if (rNode.IsEndNode())
+ aTmpStr += String("<end/>", RTL_TEXTENCODING_ASCII_US);
+
+ aTmpStr += String("</node>", RTL_TEXTENCODING_ASCII_US);
+
+ return aTmpStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwNode & rNode)
+{
+ return dbg_out(lcl_dbg_out(rNode));
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwNode * pNode)
+{
+ if (NULL != pNode)
+ return dbg_out(*pNode);
+ else
+ return NULL;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwCntntNode * pNode)
+{
+ if (NULL != pNode)
+ return dbg_out(*pNode);
+ else
+ return NULL;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwTxtNode * pNode)
+{
+ if (NULL != pNode)
+ return dbg_out(*pNode);
+ else
+ return NULL;
+}
+
+sal_Bool lcl_dbg_add_node(const SwNodePtr & pNode, void * pArgs)
+{
+ if (pNode)
+ {
+ (*((String *) pArgs)) += lcl_dbg_out(*pNode);
+ (*((String *) pArgs)) += String("\n", RTL_TEXTENCODING_ASCII_US);
+ }
+
+ //MBA: this code didn't compile, needed to add a return value
+ return sal_True;
+}
+
+void lcl_dbg_nodes_inner(String & aStr, SwNodes & rNodes, sal_uLong & nIndex)
+{
+ SwNode * pNode = rNodes[nIndex];
+ SwStartNode * pStartNode = dynamic_cast<SwStartNode *> (pNode);
+
+ SwNode * pEndNode = NULL;
+ if (pStartNode != NULL)
+ pEndNode = pStartNode->EndOfSectionNode();
+
+ sal_uLong nCount = rNodes.Count();
+ sal_uLong nStartIndex = nIndex;
+
+ bool bDone = false;
+
+ String aTag;
+ if (pNode->IsTableNode())
+ aTag += String("table", RTL_TEXTENCODING_ASCII_US);
+ else if (pNode->IsSectionNode())
+ aTag += String("section", RTL_TEXTENCODING_ASCII_US);
+ else
+ aTag += String("nodes", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += String("<", RTL_TEXTENCODING_ASCII_US);
+ aStr += aTag;
+ aStr += String(">", RTL_TEXTENCODING_ASCII_US);
+
+ while (! bDone)
+ {
+ if (pNode->IsStartNode() && nIndex != nStartIndex)
+ lcl_dbg_nodes_inner(aStr, rNodes, nIndex);
+ else
+ {
+ aStr += lcl_dbg_out(*pNode);
+ aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
+
+ nIndex++;
+ }
+
+ if (pNode == pEndNode || nIndex >= nCount)
+ bDone = true;
+ else
+ pNode = rNodes[nIndex];
+ }
+
+ aStr += String("</", RTL_TEXTENCODING_ASCII_US);
+ aStr += aTag;
+ aStr += String(">\n", RTL_TEXTENCODING_ASCII_US);
+}
+
+String lcl_dbg_out(SwNodes & rNodes)
+{
+ String aStr("<nodes-array>", RTL_TEXTENCODING_ASCII_US);
+
+ sal_uLong nIndex = 0;
+ sal_uLong nCount = rNodes.Count();
+
+ while (nIndex < nCount)
+ {
+ lcl_dbg_nodes_inner(aStr, rNodes, nIndex);
+ }
+
+ aStr += String("</nodes-array>\n", RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(SwNodes & rNodes)
+{
+ return dbg_out(lcl_dbg_out(rNodes));
+}
+
+String lcl_dbg_out(const SwUndo & rUndo)
+{
+ String aStr("[ ", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += String::CreateFromInt32(
+ static_cast<SfxUndoAction const&>(rUndo).GetId());
+ aStr += String(": ", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += rUndo.GetComment();
+ aStr += String(" ]", RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwUndo & rUndo)
+{
+ return dbg_out(lcl_dbg_out(rUndo));
+}
+
+String lcl_dbg_out(SwOutlineNodes & rNodes)
+{
+ String aStr("[\n", RTL_TEXTENCODING_ASCII_US);
+
+ for (sal_uInt16 i = 0; i < rNodes.Count(); i++)
+ {
+ aStr += lcl_dbg_out(*rNodes[i]);
+ aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
+ }
+
+ aStr += String("]\n", RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(SwOutlineNodes & rNodes)
+{
+ return dbg_out(lcl_dbg_out(rNodes));
+}
+
+String lcl_dbg_out(const SwRewriter & rRewriter)
+{
+ (void) rRewriter;
+ String aResult;
+
+ //aResult = rRewriter.ToString();
+
+ return aResult;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwRewriter & rRewriter)
+{
+ return dbg_out(lcl_dbg_out(rRewriter));
+}
+
+String lcl_dbg_out(const SvxNumberFormat & rFmt)
+{
+ String aResult;
+
+ aResult = lcl_dbg_out_NumType(rFmt.GetNumberingType());
+
+ return aResult;
+}
+
+String lcl_dbg_out(const SwNumRule & rRule)
+{
+ String aResult("[ ", RTL_TEXTENCODING_ASCII_US);
+
+ aResult += rRule.GetName();
+ aResult += String(" [", RTL_TEXTENCODING_ASCII_US);
+
+ for (sal_uInt8 n = 0; n < MAXLEVEL; n++)
+ {
+ if (n > 0)
+ aResult += String(", ", RTL_TEXTENCODING_ASCII_US);
+
+ aResult += lcl_dbg_out(rRule.Get(n));
+ }
+
+ aResult += String("]", RTL_TEXTENCODING_ASCII_US);
+
+ aResult += String("]", RTL_TEXTENCODING_ASCII_US);
+
+ return aResult;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwNumRule & rRule)
+{
+ return dbg_out(lcl_dbg_out(rRule));
+}
+
+String lcl_dbg_out(const SwTxtFmtColl & rFmt)
+{
+ String aResult(rFmt.GetName());
+
+ aResult += String("(", RTL_TEXTENCODING_ASCII_US);
+ aResult += String::CreateFromInt32(rFmt.GetAttrOutlineLevel());
+ aResult += String(")", RTL_TEXTENCODING_ASCII_US);
+
+ return aResult;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwTxtFmtColl & rFmt)
+{
+ return dbg_out(lcl_dbg_out(rFmt));
+}
+
+String lcl_dbg_out(const SwFrmFmts & rFrmFmts)
+{
+ return lcl_dbg_out_SvPtrArr<SwFrmFmts>(rFrmFmts);
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwFrmFmts & rFrmFmts)
+{
+ return dbg_out(lcl_dbg_out(rFrmFmts));
+}
+
+String lcl_dbg_out(const SwNumRuleTbl & rTbl)
+{
+ String aResult("[", RTL_TEXTENCODING_ASCII_US);
+
+ for (sal_uInt16 n = 0; n < rTbl.Count(); n++)
+ {
+ if (n > 0)
+ aResult += String(", ", RTL_TEXTENCODING_ASCII_US);
+
+ aResult += rTbl[n]->GetName();
+
+ char sBuffer[256];
+ sprintf(sBuffer, "(%p)", rTbl[n]);
+ aResult += String(sBuffer, RTL_TEXTENCODING_ASCII_US);
+ }
+
+ aResult += String("]", RTL_TEXTENCODING_ASCII_US);
+
+ return aResult;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwNumRuleTbl & rTbl)
+{
+ return dbg_out(lcl_dbg_out(rTbl));
+}
+
+String lcl_TokenType2Str(FormTokenType nType)
+{
+ switch(nType)
+ {
+ case TOKEN_ENTRY_NO:
+ return String("NO", RTL_TEXTENCODING_ASCII_US);
+ case TOKEN_ENTRY_TEXT:
+ return String("ENTRY_TEXT", RTL_TEXTENCODING_ASCII_US);
+ case TOKEN_ENTRY:
+ return String("ENTRY", RTL_TEXTENCODING_ASCII_US);
+ case TOKEN_TAB_STOP:
+ return String("TAB_STOP", RTL_TEXTENCODING_ASCII_US);
+ case TOKEN_TEXT:
+ return String("TOKEN_TEXT", RTL_TEXTENCODING_ASCII_US);
+ case TOKEN_PAGE_NUMS:
+ return String("NUMS", RTL_TEXTENCODING_ASCII_US);
+ case TOKEN_CHAPTER_INFO:
+ return String("CHAPTER_INFO", RTL_TEXTENCODING_ASCII_US);
+ case TOKEN_LINK_START:
+ return String("LINK_START", RTL_TEXTENCODING_ASCII_US);
+ case TOKEN_LINK_END:
+ return String("LINK_END", RTL_TEXTENCODING_ASCII_US);
+ case TOKEN_AUTHORITY:
+ return String("AUTHORITY", RTL_TEXTENCODING_ASCII_US);
+ case TOKEN_END:
+ return String("END", RTL_TEXTENCODING_ASCII_US);
+ default:
+ return String("??", RTL_TEXTENCODING_ASCII_US);
+ }
+
+ ASSERT(false, "should not be reached");
+
+ return String("??", RTL_TEXTENCODING_ASCII_US);
+}
+
+String lcl_dbg_out(const SwFormToken & rToken)
+{
+ return rToken.GetString();
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwFormToken & rToken)
+{
+ return dbg_out(lcl_dbg_out(rToken));
+}
+
+String lcl_dbg_out(const SwFormTokens & rTokens)
+{
+ String aStr("[", RTL_TEXTENCODING_ASCII_US);
+
+ SwFormTokens::const_iterator aIt;
+
+ for (aIt = rTokens.begin(); aIt != rTokens.end(); aIt++)
+ {
+ if (aIt != rTokens.begin())
+ aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += lcl_TokenType2Str(aIt->eTokenType);
+ aStr += String(": ", RTL_TEXTENCODING_ASCII_US);
+ aStr += lcl_dbg_out(*aIt);
+ }
+
+ aStr += String("]" , RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwFormTokens & rTokens)
+{
+ return dbg_out(lcl_dbg_out(rTokens));
+}
+
+String lcl_dbg_out(const SwNodeRange & rRange)
+{
+ String aStr("[", RTL_TEXTENCODING_ASCII_US);
+
+ aStr += lcl_dbg_out(SwPosition(rRange.aStart));
+ aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
+ aStr += lcl_dbg_out(SwPosition(rRange.aEnd));
+
+ aStr += String("]" , RTL_TEXTENCODING_ASCII_US);
+
+ return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange)
+{
+ return dbg_out(lcl_dbg_out(rRange));
+}
+
+#endif // DEBUG
+
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
new file mode 100644
index 000000000000..c454da191cf7
--- /dev/null
+++ b/sw/source/core/doc/doc.cxx
@@ -0,0 +1,2776 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <doc.hxx>
+#include <UndoManager.hxx>
+#include <hintids.hxx>
+
+#include <tools/shl.hxx>
+#include <tools/globname.hxx>
+#include <svx/svxids.hrc>
+#include <com/sun/star/i18n/WordType.hdl>
+#include <com/sun/star/i18n/ForbiddenCharacters.hdl>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <comphelper/processfactory.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/poly.hxx>
+#include <tools/multisel.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/virdev.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/poolitem.hxx>
+#include <unotools/syslocale.hxx>
+#include <sfx2/printer.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/cscoitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <svx/svdmodel.hxx>
+#include <editeng/pbinitem.hxx>
+#include <unotools/charclass.hxx>
+#include <unotools/localedatawrapper.hxx>
+
+#include <swatrset.hxx>
+#include <swmodule.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtanchr.hxx>
+#include <fmtrfmrk.hxx>
+#include <fmtinfmt.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <dbfld.hxx>
+#include <txtinet.hxx>
+#include <txtrfmrk.hxx>
+#include <frmatr.hxx>
+#include <linkenum.hxx>
+#include <errhdl.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <swtable.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <UndoCore.hxx>
+#include <UndoInsert.hxx>
+#include <UndoSplitMove.hxx>
+#include <UndoTable.hxx>
+#include <pagedesc.hxx> //DTor
+#include <breakit.hxx>
+#include <ndole.hxx>
+#include <ndgrf.hxx>
+#include <rolbck.hxx> // Undo-Attr
+#include <doctxm.hxx> // fuer die Verzeichnisse
+#include <grfatr.hxx>
+#include <poolfmt.hxx> // PoolVorlagen-Id's
+#include <mvsave.hxx> // fuer Server-Funktionalitaet
+#include <SwGrammarMarkUp.hxx>
+#include <scriptinfo.hxx>
+#include <acorrect.hxx> // Autokorrektur
+#include <mdiexp.hxx> // Statusanzeige
+#include <docstat.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+#include <fldupde.hxx>
+#include <swbaslnk.hxx>
+#include <printdata.hxx>
+#include <cmdid.h> // fuer den dflt - Printer in SetJob
+#include <statstr.hrc> // StatLine-String
+#include <comcore.hrc>
+#include <SwUndoTOXChange.hxx>
+#include <SwUndoFmt.hxx>
+#include <unocrsr.hxx>
+#include <docsh.hxx>
+#include <viewopt.hxx>
+#include <docfld.hxx> // _SetGetExpFld
+#include <docufld.hxx> // SwPostItField
+#include <viewsh.hxx>
+#include <shellres.hxx>
+#include <txtfrm.hxx>
+#include <attrhint.hxx>
+
+#include <wdocsh.hxx> // SwWebDocShell
+#include <prtopt.hxx> // SwPrintOptions
+
+#include <vector>
+#include <map>
+
+#include <osl/diagnose.h>
+#include <osl/interlck.h>
+#include <vbahelper/vbaaccesshelper.hxx>
+
+#include "switerator.hxx"
+
+/* @@@MAINTAINABILITY-HORROR@@@
+ Probably unwanted dependency on SwDocShell
+*/
+// --> OD 2005-08-29 #125370#
+#include <layouter.hxx>
+// <--
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+
+// Seiten-Deskriptoren
+SV_IMPL_PTRARR(SwPageDescs,SwPageDescPtr);
+// Verzeichnisse
+SV_IMPL_PTRARR( SwTOXTypes, SwTOXTypePtr )
+// FeldTypen
+SV_IMPL_PTRARR( SwFldTypes, SwFldTypePtr)
+
+/** IInterface
+*/
+sal_Int32 SwDoc::acquire()
+{
+ OSL_ASSERT(mReferenceCount >= 0 && "Negative reference count detected! This is a sign for unbalanced acquire/release calls.");
+ return osl_incrementInterlockedCount(&mReferenceCount);
+}
+
+sal_Int32 SwDoc::release()
+{
+ OSL_PRECOND(mReferenceCount >= 1, "Object is already released! Releasing it again leads to a negative reference count.");
+ return osl_decrementInterlockedCount(&mReferenceCount);
+}
+
+sal_Int32 SwDoc::getReferenceCount() const
+{
+ OSL_ASSERT(mReferenceCount >= 0 && "Negative reference count detected! This is a sign for unbalanced acquire/release calls.");
+ return mReferenceCount;
+}
+
+/** IDocumentSettingAccess
+*/
+bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
+{
+ switch (id)
+ {
+ // COMPATIBILITY FLAGS START
+ case PARA_SPACE_MAX: return mbParaSpaceMax; //(n8Dummy1 & DUMMY_PARASPACEMAX);
+ case PARA_SPACE_MAX_AT_PAGES: return mbParaSpaceMaxAtPages; //(n8Dummy1 & DUMMY_PARASPACEMAX_AT_PAGES);
+ case TAB_COMPAT: return mbTabCompat; //(n8Dummy1 & DUMMY_TAB_COMPAT);
+ case ADD_FLY_OFFSETS: return mbAddFlyOffsets; //(n8Dummy2 & DUMMY_ADD_FLY_OFFSETS);
+ case ADD_EXT_LEADING: return mbAddExternalLeading; //(n8Dummy2 & DUMMY_ADD_EXTERNAL_LEADING);
+ case USE_VIRTUAL_DEVICE: return mbUseVirtualDevice; //(n8Dummy1 & DUMMY_USE_VIRTUAL_DEVICE);
+ case USE_HIRES_VIRTUAL_DEVICE: return mbUseHiResolutionVirtualDevice; //(n8Dummy2 & DUMMY_USE_HIRES_VIR_DEV);
+ case OLD_NUMBERING: return mbOldNumbering;
+ case OLD_LINE_SPACING: return mbOldLineSpacing;
+ case ADD_PARA_SPACING_TO_TABLE_CELLS: return mbAddParaSpacingToTableCells;
+ case USE_FORMER_OBJECT_POS: return mbUseFormerObjectPos;
+ case USE_FORMER_TEXT_WRAPPING: return mbUseFormerTextWrapping;
+ case CONSIDER_WRAP_ON_OBJECT_POSITION: return mbConsiderWrapOnObjPos;
+ case DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK: return mbDoNotJustifyLinesWithManualBreak;
+ case IGNORE_FIRST_LINE_INDENT_IN_NUMBERING: return mbIgnoreFirstLineIndentInNumbering;
+ case OUTLINE_LEVEL_YIELDS_OUTLINE_RULE: return mbOutlineLevelYieldsOutlineRule;
+ case TABLE_ROW_KEEP: return mbTableRowKeep;
+ case IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION: return mbIgnoreTabsAndBlanksForLineCalculation;
+ case DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE: return mbDoNotCaptureDrawObjsOnPage;
+ // --> OD 2006-08-25 #i68949#
+ case CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME: return mbClipAsCharacterAnchoredWriterFlyFrames;
+ // <--
+ case UNIX_FORCE_ZERO_EXT_LEADING: return mbUnixForceZeroExtLeading;
+ case USE_OLD_PRINTER_METRICS: return mbOldPrinterMetrics;
+ case TABS_RELATIVE_TO_INDENT : return mbTabRelativeToIndent;
+ case PROTECT_FORM: return mbProtectForm;
+ // --> OD 2008-06-05 #i89181#
+ case TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: return mbTabAtLeftIndentForParagraphsInList;
+ // <--
+ // COMPATIBILITY FLAGS END
+
+ case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked!
+ case HTML_MODE: return mbHTMLMode;
+ case GLOBAL_DOCUMENT: return mbIsGlobalDoc;
+ case GLOBAL_DOCUMENT_SAVE_LINKS: return mbGlblDocSaveLinks;
+ case LABEL_DOCUMENT: return mbIsLabelDoc;
+ case PURGE_OLE: return mbPurgeOLE;
+ case KERN_ASIAN_PUNCTUATION: return mbKernAsianPunctuation;
+ case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: return mbDoNotResetParaAttrsForNumFont;
+ case MATH_BASELINE_ALIGNMENT: return mbMathBaselineAlignment;
+ default:
+ ASSERT(false, "Invalid setting id");
+ }
+ return false;
+}
+
+void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
+{
+ switch (id)
+ {
+ // COMPATIBILITY FLAGS START
+ case PARA_SPACE_MAX:
+ mbParaSpaceMax = value;
+ break;
+ case PARA_SPACE_MAX_AT_PAGES:
+ mbParaSpaceMaxAtPages = value;
+ break;
+ case TAB_COMPAT:
+ mbTabCompat = value;
+ break;
+ case ADD_FLY_OFFSETS:
+ mbAddFlyOffsets = value;
+ break;
+ case ADD_EXT_LEADING:
+ mbAddExternalLeading = value;
+ break;
+ case USE_VIRTUAL_DEVICE:
+ mbUseVirtualDevice = value;
+ break;
+ case USE_HIRES_VIRTUAL_DEVICE:
+ mbUseHiResolutionVirtualDevice = value;
+ break;
+ case OLD_NUMBERING:
+ if (mbOldNumbering != value)
+ {
+ mbOldNumbering = value;
+
+ const SwNumRuleTbl& rNmTbl = GetNumRuleTbl();
+ for( sal_uInt16 n = 0; n < rNmTbl.Count(); ++n )
+ rNmTbl[n]->SetInvalidRule(sal_True);
+
+ UpdateNumRule();
+
+ if (pOutlineRule)
+ {
+ pOutlineRule->Validate();
+ // --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()>
+ pOutlineRule->SetCountPhantoms( !mbOldNumbering );
+ // <--
+ }
+ }
+ break;
+ case OLD_LINE_SPACING:
+ mbOldLineSpacing = value;
+ break;
+ case ADD_PARA_SPACING_TO_TABLE_CELLS:
+ mbAddParaSpacingToTableCells = value;
+ break;
+ case USE_FORMER_OBJECT_POS:
+ mbUseFormerObjectPos = value;
+ break;
+ case USE_FORMER_TEXT_WRAPPING:
+ mbUseFormerTextWrapping = value;
+ break;
+ case CONSIDER_WRAP_ON_OBJECT_POSITION:
+ mbConsiderWrapOnObjPos = value;
+ break;
+ case DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
+ mbDoNotJustifyLinesWithManualBreak = value;
+ break;
+ case IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
+ mbIgnoreFirstLineIndentInNumbering = value;
+ break;
+
+ case OUTLINE_LEVEL_YIELDS_OUTLINE_RULE:
+ mbOutlineLevelYieldsOutlineRule = value;
+ break;
+
+ case TABLE_ROW_KEEP:
+ mbTableRowKeep = value;
+ break;
+
+ case IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
+ mbIgnoreTabsAndBlanksForLineCalculation = value;
+ break;
+
+ case DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
+ mbDoNotCaptureDrawObjsOnPage = value;
+ break;
+
+ // --> OD 2006-08-25 #i68949#
+ case CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME:
+ mbClipAsCharacterAnchoredWriterFlyFrames = value;
+ break;
+ // <--
+ case UNIX_FORCE_ZERO_EXT_LEADING:
+ mbUnixForceZeroExtLeading = value;
+ break;
+ case PROTECT_FORM:
+ mbProtectForm = value;
+ break;
+
+ case USE_OLD_PRINTER_METRICS:
+ mbOldPrinterMetrics = value;
+ break;
+ case TABS_RELATIVE_TO_INDENT:
+ mbTabRelativeToIndent = value;
+ break;
+ // --> OD 2008-06-05 #i89181#
+ case TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
+ mbTabAtLeftIndentForParagraphsInList = value;
+ break;
+ // <--
+ // COMPATIBILITY FLAGS END
+
+ case BROWSE_MODE: //can be used temporary (load/save) when no ViewShell is avaiable
+ mbLastBrowseMode = value;
+ break;
+ case HTML_MODE:
+ mbHTMLMode = value;
+ break;
+ case GLOBAL_DOCUMENT:
+ mbIsGlobalDoc = value;
+ break;
+ case GLOBAL_DOCUMENT_SAVE_LINKS:
+ mbGlblDocSaveLinks = value;
+ break;
+ case LABEL_DOCUMENT:
+ mbIsLabelDoc = value;
+ break;
+ case PURGE_OLE:
+ mbPurgeOLE = value;
+ break;
+ case KERN_ASIAN_PUNCTUATION:
+ mbKernAsianPunctuation = value;
+ break;
+ case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
+ mbDoNotResetParaAttrsForNumFont = value;
+ break;
+ case MATH_BASELINE_ALIGNMENT:
+ mbMathBaselineAlignment = value;
+ break;
+ default:
+ ASSERT(false, "Invalid setting id");
+ }
+}
+
+const i18n::ForbiddenCharacters*
+ SwDoc::getForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ bool bLocaleData ) const
+{
+ const i18n::ForbiddenCharacters* pRet = 0;
+ if( xForbiddenCharsTable.isValid() )
+ pRet = xForbiddenCharsTable->GetForbiddenCharacters( nLang, sal_False );
+ if( bLocaleData && !pRet && pBreakIt )
+ pRet = &pBreakIt->GetForbidden( (LanguageType)nLang );
+ return pRet;
+}
+
+void SwDoc::setForbiddenCharacters(/*[in]*/ sal_uInt16 nLang,
+ /*[in]*/ const com::sun::star::i18n::ForbiddenCharacters& rFChars )
+{
+ if( !xForbiddenCharsTable.isValid() )
+ {
+ uno::Reference<
+ lang::XMultiServiceFactory > xMSF =
+ ::comphelper::getProcessServiceFactory();
+ xForbiddenCharsTable = new SvxForbiddenCharactersTable( xMSF );
+ }
+ xForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
+ if( pDrawModel )
+ {
+ pDrawModel->SetForbiddenCharsTable( xForbiddenCharsTable );
+ if( !mbInReading )
+ pDrawModel->ReformatAllTextObjects();
+ }
+
+ SwRootFrm* pTmpRoot = GetCurrentLayout();
+ if( pTmpRoot && !mbInReading )
+ {
+ pTmpRoot->StartAllAction();
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(), std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_SIZE));
+ pTmpRoot->EndAllAction();
+ }//swmod 080310
+ SetModified();
+}
+
+vos::ORef<SvxForbiddenCharactersTable>& SwDoc::getForbiddenCharacterTable()
+{
+ if( !xForbiddenCharsTable.isValid() )
+ {
+ uno::Reference<
+ lang::XMultiServiceFactory > xMSF =
+ ::comphelper::getProcessServiceFactory();
+ xForbiddenCharsTable = new SvxForbiddenCharactersTable( xMSF );
+ }
+ return xForbiddenCharsTable;
+}
+
+const vos::ORef<SvxForbiddenCharactersTable>& SwDoc::getForbiddenCharacterTable() const
+{
+ return xForbiddenCharsTable;
+}
+
+sal_uInt16 SwDoc::getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const
+{
+ sal_uInt16 nRet = nLinkUpdMode;
+ if( bGlobalSettings && GLOBALSETTING == nRet )
+ nRet = SW_MOD()->GetLinkUpdMode(get(IDocumentSettingAccess::HTML_MODE));
+ return nRet;
+}
+
+void SwDoc::setLinkUpdateMode( /*[in]*/sal_uInt16 eMode )
+{
+ nLinkUpdMode = eMode;
+}
+
+SwFldUpdateFlags SwDoc::getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const
+{
+ SwFldUpdateFlags eRet = eFldUpdMode;
+ if( bGlobalSettings && AUTOUPD_GLOBALSETTING == eRet )
+ eRet = SW_MOD()->GetFldUpdateFlags(get(IDocumentSettingAccess::HTML_MODE));
+ return eRet;
+}
+
+void SwDoc::setFieldUpdateFlags(/*[in]*/SwFldUpdateFlags eMode )
+{
+ eFldUpdMode = eMode;
+}
+
+SwCharCompressType SwDoc::getCharacterCompressionType() const
+{
+ return eChrCmprType;
+}
+
+void SwDoc::setCharacterCompressionType( /*[in]*/SwCharCompressType n )
+{
+ if( eChrCmprType != n )
+ {
+ eChrCmprType = n;
+ if( pDrawModel )
+ {
+ pDrawModel->SetCharCompressType( static_cast<sal_uInt16>(n) );
+ if( !mbInReading )
+ pDrawModel->ReformatAllTextObjects();
+ }
+
+ SwRootFrm* pTmpRoot = GetCurrentLayout();
+ if( pTmpRoot && !mbInReading )
+ {
+ pTmpRoot->StartAllAction();
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(), std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_SIZE));
+ pTmpRoot->EndAllAction();
+ }//swmod 080310
+ SetModified();
+ }
+}
+
+/** IDocumentDeviceAccess
+*/
+SfxPrinter* SwDoc::getPrinter(/*[in]*/ bool bCreate ) const
+{
+ SfxPrinter* pRet = 0;
+ if ( !bCreate || pPrt )
+ pRet = pPrt;
+ else
+ pRet = &CreatePrinter_();
+
+ return pRet;
+}
+
+void SwDoc::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDeleteOld,/*[in]*/ bool bCallPrtDataChanged )
+{
+ if ( pP != pPrt )
+ {
+ if ( bDeleteOld )
+ delete pPrt;
+ pPrt = pP;
+
+ // our printer should always use TWIP. Don't rely on this being set in ViewShell::InitPrt, there
+ // are situations where this isn't called.
+ // #i108712# / 2010-02-26 / frank.schoenheit@sun.com
+ if ( pPrt )
+ {
+ MapMode aMapMode( pPrt->GetMapMode() );
+ aMapMode.SetMapUnit( MAP_TWIP );
+ pPrt->SetMapMode( aMapMode );
+ }
+
+ if ( pDrawModel && !get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
+ pDrawModel->SetRefDevice( pPrt );
+ }
+
+ if ( bCallPrtDataChanged &&
+ // --> FME 2005-01-21 #i41075# Do not call PrtDataChanged() if we do not
+ // use the printer for formatting:
+ !get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) )
+ // <--
+ PrtDataChanged();
+}
+
+VirtualDevice* SwDoc::getVirtualDevice(/*[in]*/ bool bCreate ) const
+{
+ VirtualDevice* pRet = 0;
+ if ( !bCreate || pVirDev )
+ pRet = pVirDev;
+ else
+ pRet = &CreateVirtualDevice_();
+
+ return pRet;
+}
+
+void SwDoc::setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*/ bool bDeleteOld, /*[in]*/ bool )
+{
+ if ( pVirDev != pVd )
+ {
+ if ( bDeleteOld )
+ delete pVirDev;
+ pVirDev = pVd;
+
+ if ( pDrawModel && get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
+ pDrawModel->SetRefDevice( pVirDev );
+ }
+}
+
+OutputDevice* SwDoc::getReferenceDevice(/*[in]*/ bool bCreate ) const
+{
+ OutputDevice* pRet = 0;
+ if ( !get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) )
+ {
+ pRet = getPrinter( bCreate );
+
+ if ( bCreate && !pPrt->IsValid() )
+ {
+ pRet = getVirtualDevice( sal_True );
+ }
+ }
+ else
+ {
+ pRet = getVirtualDevice( bCreate );
+ }
+
+ return pRet;
+}
+
+void SwDoc::setReferenceDeviceType(/*[in]*/ bool bNewVirtual,/*[in]*/ bool bNewHiRes )
+{
+ if ( get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) != bNewVirtual ||
+ get(IDocumentSettingAccess::USE_HIRES_VIRTUAL_DEVICE) != bNewHiRes )
+ {
+ if ( bNewVirtual )
+ {
+ VirtualDevice* pMyVirDev = getVirtualDevice( true );
+ if ( !bNewHiRes )
+ pMyVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE06 );
+ else
+ pMyVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
+
+ if( pDrawModel )
+ pDrawModel->SetRefDevice( pMyVirDev );
+ }
+ else
+ {
+ // --> FME 2005-01-21 #i41075#
+ // We have to take care that a printer exists before calling
+ // PrtDataChanged() in order to prevent that PrtDataChanged()
+ // triggers this funny situation:
+ // getReferenceDevice()->getPrinter()->CreatePrinter_()
+ // ->setPrinter()-> PrtDataChanged()
+ SfxPrinter* pPrinter = getPrinter( true );
+ // <--
+ if( pDrawModel )
+ pDrawModel->SetRefDevice( pPrinter );
+ }
+
+ set(IDocumentSettingAccess::USE_VIRTUAL_DEVICE, bNewVirtual );
+ set(IDocumentSettingAccess::USE_HIRES_VIRTUAL_DEVICE, bNewHiRes );
+ PrtDataChanged();
+ SetModified();
+ }
+}
+
+const JobSetup* SwDoc::getJobsetup() const
+{
+ return pPrt ? &pPrt->GetJobSetup() : 0;
+}
+
+void SwDoc::setJobsetup(/*[in]*/ const JobSetup &rJobSetup )
+{
+ sal_Bool bCheckPageDescs = 0 == pPrt;
+ sal_Bool bDataChanged = sal_False;
+
+ if ( pPrt )
+ {
+ if ( pPrt->GetName() == rJobSetup.GetPrinterName() )
+ {
+ if ( pPrt->GetJobSetup() != rJobSetup )
+ {
+ pPrt->SetJobSetup( rJobSetup );
+ bDataChanged = sal_True;
+ }
+ }
+ else
+ delete pPrt, pPrt = 0;
+ }
+
+ if( !pPrt )
+ {
+ //Das ItemSet wird vom Sfx geloescht!
+ SfxItemSet *pSet = new SfxItemSet( GetAttrPool(),
+ FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
+ SID_HTML_MODE, SID_HTML_MODE,
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ 0 );
+ SfxPrinter *p = new SfxPrinter( pSet, rJobSetup );
+ if ( bCheckPageDescs )
+ setPrinter( p, true, true );
+ else
+ {
+ pPrt = p;
+ bDataChanged = sal_True;
+ }
+ }
+ if ( bDataChanged && !get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) )
+ PrtDataChanged();
+}
+
+const SwPrintData & SwDoc::getPrintData() const
+{
+ if(!pPrtData)
+ {
+ SwDoc * pThis = const_cast< SwDoc * >(this);
+ pThis->pPrtData = new SwPrintData;
+
+ // SwPrintData should be initialized from the configuration,
+ // the respective config item is implememted by SwPrintOptions which
+ // is also derived from SwPrintData
+ const SwDocShell *pDocSh = GetDocShell();
+ DBG_ASSERT( pDocSh, "pDocSh is 0, can't determine if this is a WebDoc or not" );
+ bool bWeb = 0 != dynamic_cast< const SwWebDocShell * >(pDocSh);
+ SwPrintOptions aPrintOptions( bWeb );
+ *pThis->pPrtData = aPrintOptions;
+ }
+ return *pPrtData;
+}
+
+void SwDoc::setPrintData(/*[in]*/ const SwPrintData& rPrtData )
+{
+ if(!pPrtData)
+ pPrtData = new SwPrintData;
+ *pPrtData = rPrtData;
+}
+
+/** Implementations the next Interface here
+*/
+
+/*
+ * Dokumenteditieren (Doc-SS) zum Fuellen des Dokuments
+ * durch den RTF Parser und fuer die EditShell.
+ */
+void SwDoc::ChgDBData(const SwDBData& rNewData)
+{
+ if( rNewData != aDBData )
+ {
+ aDBData = rNewData;
+ SetModified();
+ }
+ GetSysFldType(RES_DBNAMEFLD)->UpdateFlds();
+}
+
+bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
+{
+ SwCntntNode *pNode = rPos.nNode.GetNode().GetCntntNode();
+ if(0 == pNode)
+ return false;
+
+ {
+ // Bug 26675: DataChanged vorm loeschen verschicken, dann bekommt
+ // man noch mit, welche Objecte sich im Bereich befinden.
+ // Danach koennen sie vor/hinter der Position befinden.
+ SwDataChanged aTmp( this, rPos, 0 );
+ }
+
+ SwUndoSplitNode* pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ // einfuegen vom Undo-Object, z.Z. nur beim TextNode
+ if( pNode->IsTxtNode() )
+ {
+ pUndo = new SwUndoSplitNode( this, rPos, bChkTableStart );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ }
+
+ //JP 28.01.97: Sonderfall fuer SplitNode am Tabellenanfang:
+ // steht die am Doc/Fly/Footer/..-Anfang oder direkt
+ // hinter einer Tabelle, dann fuege davor
+ // einen Absatz ein
+ if( bChkTableStart && !rPos.nContent.GetIndex() && pNode->IsTxtNode() )
+ {
+ sal_uLong nPrevPos = rPos.nNode.GetIndex() - 1;
+ const SwTableNode* pTblNd;
+ const SwNode* pNd = GetNodes()[ nPrevPos ];
+ if( pNd->IsStartNode() &&
+ SwTableBoxStartNode == ((SwStartNode*)pNd)->GetStartNodeType() &&
+ 0 != ( pTblNd = GetNodes()[ --nPrevPos ]->GetTableNode() ) &&
+ ((( pNd = GetNodes()[ --nPrevPos ])->IsStartNode() &&
+ SwTableBoxStartNode != ((SwStartNode*)pNd)->GetStartNodeType() )
+ || ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsTableNode() )
+ || pNd->IsCntntNode() ))
+ {
+ if( pNd->IsCntntNode() )
+ {
+ //JP 30.04.99 Bug 65660:
+ // ausserhalb des normalen BodyBereiches gibt es keine
+ // Seitenumbrueche, also ist das hier kein gueltige
+ // Bedingung fuers einfuegen eines Absatzes
+ if( nPrevPos < GetNodes().GetEndOfExtras().GetIndex() )
+ pNd = 0;
+ else
+ {
+ // Dann nur, wenn die Tabelle Umbrueche traegt!
+ const SwFrmFmt* pFrmFmt = pTblNd->GetTable().GetFrmFmt();
+ if( SFX_ITEM_SET != pFrmFmt->GetItemState(RES_PAGEDESC, sal_False) &&
+ SFX_ITEM_SET != pFrmFmt->GetItemState( RES_BREAK, sal_False ) )
+ pNd = 0;
+ }
+ }
+
+ if( pNd )
+ {
+ SwTxtNode* pTxtNd = GetNodes().MakeTxtNode(
+ SwNodeIndex( *pTblNd ),
+ GetTxtCollFromPool( RES_POOLCOLL_TEXT ));
+ if( pTxtNd )
+ {
+ ((SwPosition&)rPos).nNode = pTblNd->GetIndex()-1;
+ ((SwPosition&)rPos).nContent.Assign( pTxtNd, 0 );
+
+ // nur im BodyBereich den SeitenUmbruch/-Vorlage umhaengem
+ if( nPrevPos > GetNodes().GetEndOfExtras().GetIndex() )
+ {
+ SwFrmFmt* pFrmFmt = pTblNd->GetTable().GetFrmFmt();
+ const SfxPoolItem *pItem;
+ if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_PAGEDESC,
+ sal_False, &pItem ) )
+ {
+ pTxtNd->SetAttr( *pItem );
+ pFrmFmt->ResetFmtAttr( RES_PAGEDESC );
+ }
+ if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_BREAK,
+ sal_False, &pItem ) )
+ {
+ pTxtNd->SetAttr( *pItem );
+ pFrmFmt->ResetFmtAttr( RES_BREAK );
+ }
+ }
+
+ if( pUndo )
+ pUndo->SetTblFlag();
+ SetModified();
+ return true;
+ }
+ }
+ }
+ }
+
+ SvULongs aBkmkArr( 15, 15 );
+ _SaveCntntIdx( this, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(),
+ aBkmkArr, SAVEFLY_SPLIT );
+ // FIXME: only SwTxtNode has a valid implementation of SplitCntntNode!
+ ASSERT(pNode->IsTxtNode(), "splitting non-text node?");
+ pNode = pNode->SplitCntntNode( rPos );
+ if (pNode)
+ {
+ // verschiebe noch alle Bookmarks/TOXMarks/FlyAtCnt
+ if( aBkmkArr.Count() )
+ _RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True );
+
+ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ {
+ SwPaM aPam( rPos );
+ aPam.SetMark();
+ aPam.Move( fnMoveBackward );
+ if( IsRedlineOn() )
+ AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ else
+ SplitRedline( aPam );
+ }
+ }
+
+ SetModified();
+ return true;
+}
+
+bool SwDoc::AppendTxtNode( SwPosition& rPos )
+{
+ // create new node before EndOfContent
+ SwTxtNode * pCurNode = rPos.nNode.GetNode().GetTxtNode();
+ if( !pCurNode )
+ {
+ // dann kann ja einer angelegt werden!
+ SwNodeIndex aIdx( rPos.nNode, 1 );
+ pCurNode = GetNodes().MakeTxtNode( aIdx,
+ GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
+ }
+ else
+ pCurNode = (SwTxtNode*)pCurNode->AppendNode( rPos );
+
+ rPos.nNode++;
+ rPos.nContent.Assign( pCurNode, 0 );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoInsert( rPos.nNode ) );
+ }
+
+ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ {
+ SwPaM aPam( rPos );
+ aPam.SetMark();
+ aPam.Move( fnMoveBackward );
+ if( IsRedlineOn() )
+ AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ else
+ SplitRedline( aPam );
+ }
+
+ SetModified();
+ return sal_True;
+}
+
+bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
+ const enum InsertFlags nInsertMode )
+{
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo(); // AppendUndo not always called!
+ }
+
+ const SwPosition& rPos = *rRg.GetPoint();
+
+ if( pACEWord ) // Aufnahme in die Autokorrektur
+ {
+ if( 1 == rStr.Len() && pACEWord->IsDeleted() )
+ {
+ pACEWord->CheckChar( rPos, rStr.GetChar( 0 ) );
+ }
+ delete pACEWord, pACEWord = 0;
+ }
+
+ SwTxtNode *const pNode = rPos.nNode.GetNode().GetTxtNode();
+ if(!pNode)
+ {
+ return false;
+ }
+
+ SwDataChanged aTmp( rRg, 0 );
+
+ if (!GetIDocumentUndoRedo().DoesUndo() ||
+ !GetIDocumentUndoRedo().DoesGroupUndo())
+ {
+ pNode->InsertText( rStr, rPos.nContent, nInsertMode );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndoInsert * const pUndo( new SwUndoInsert(
+ rPos.nNode, rPos.nContent.GetIndex(), rStr.Len(), nInsertMode));
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ }
+ else
+ { // ist Undo und Gruppierung eingeschaltet, ist alles anders !
+ SwUndoInsert * pUndo = NULL; // #111827#
+
+ // don't group the start if hints at the start should be expanded
+ if (!(nInsertMode & IDocumentContentOperations::INS_FORCEHINTEXPAND))
+ // -> #111827#
+ {
+ SwUndo *const pLastUndo = GetUndoManager().GetLastUndo();
+ SwUndoInsert *const pUndoInsert(
+ dynamic_cast<SwUndoInsert *>(pLastUndo) );
+ if (pUndoInsert && pUndoInsert->CanGrouping(rPos))
+ {
+ pUndo = pUndoInsert;
+ }
+ }
+ // <- #111827#
+
+ CharClass const& rCC = GetAppCharClass();
+ xub_StrLen nInsPos = rPos.nContent.GetIndex();
+
+ if (!pUndo)
+ {
+ pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 0, nInsertMode,
+ !rCC.isLetterNumeric( rStr, 0 ) );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+
+ pNode->InsertText( rStr, rPos.nContent, nInsertMode );
+
+ for( xub_StrLen i = 0; i < rStr.Len(); ++i )
+ {
+ nInsPos++;
+ // wenn CanGrouping() sal_True returnt, ist schon alles erledigt
+ if( !pUndo->CanGrouping( rStr.GetChar( i ) ))
+ {
+ pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 1, nInsertMode,
+ !rCC.isLetterNumeric( rStr, i ) );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ }
+ }
+
+ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ {
+ SwPaM aPam( rPos.nNode, aTmp.GetCntnt(),
+ rPos.nNode, rPos.nContent.GetIndex());
+ if( IsRedlineOn() )
+ {
+ AppendRedline(
+ new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ }
+ else
+ {
+ SplitRedline( aPam );
+ }
+ }
+
+ SetModified();
+ return true;
+}
+
+SwFlyFrmFmt* SwDoc::_InsNoTxtNode( const SwPosition& rPos, SwNoTxtNode* pNode,
+ const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet,
+ SwFrmFmt* pFrmFmt)
+{
+ SwFlyFrmFmt *pFmt = 0;
+ if( pNode )
+ {
+ pFmt = _MakeFlySection( rPos, *pNode, FLY_AT_PARA,
+ pFlyAttrSet, pFrmFmt );
+ if( pGrfAttrSet )
+ pNode->SetAttr( *pGrfAttrSet );
+ }
+ return pFmt;
+}
+
+SwFlyFrmFmt* SwDoc::Insert( const SwPaM &rRg,
+ const String& rGrfName,
+ const String& rFltName,
+ const Graphic* pGraphic,
+ const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet,
+ SwFrmFmt* pFrmFmt )
+{
+ if( !pFrmFmt )
+ pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC );
+ return _InsNoTxtNode( *rRg.GetPoint(), GetNodes().MakeGrfNode(
+ SwNodeIndex( GetNodes().GetEndOfAutotext() ),
+ rGrfName, rFltName, pGraphic,
+ pDfltGrfFmtColl ),
+ pFlyAttrSet, pGrfAttrSet, pFrmFmt );
+}
+SwFlyFrmFmt* SwDoc::Insert( const SwPaM &rRg, const GraphicObject& rGrfObj,
+ const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet,
+ SwFrmFmt* pFrmFmt )
+{
+ if( !pFrmFmt )
+ pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC );
+ return _InsNoTxtNode( *rRg.GetPoint(), GetNodes().MakeGrfNode(
+ SwNodeIndex( GetNodes().GetEndOfAutotext() ),
+ rGrfObj, pDfltGrfFmtColl ),
+ pFlyAttrSet, pGrfAttrSet, pFrmFmt );
+}
+
+SwFlyFrmFmt* SwDoc::Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj,
+ const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet,
+ SwFrmFmt* pFrmFmt )
+{
+ if( !pFrmFmt )
+ {
+ sal_uInt16 nId = RES_POOLFRM_OLE;
+ SvGlobalName aClassName( xObj->getClassID() );
+ if (SotExchange::IsMath(aClassName))
+ nId = RES_POOLFRM_FORMEL;
+
+ pFrmFmt = GetFrmFmtFromPool( nId );
+ }
+ return _InsNoTxtNode( *rRg.GetPoint(), GetNodes().MakeOLENode(
+ SwNodeIndex( GetNodes().GetEndOfAutotext() ),
+ xObj,
+ pDfltGrfFmtColl ),
+ pFlyAttrSet, pGrfAttrSet,
+ pFrmFmt );
+}
+
+SwFlyFrmFmt* SwDoc::InsertOLE(const SwPaM &rRg, const String& rObjName,
+ sal_Int64 nAspect,
+ const SfxItemSet* pFlyAttrSet,
+ const SfxItemSet* pGrfAttrSet,
+ SwFrmFmt* pFrmFmt )
+{
+ if( !pFrmFmt )
+ pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_OLE );
+
+ return _InsNoTxtNode( *rRg.GetPoint(),
+ GetNodes().MakeOLENode(
+ SwNodeIndex( GetNodes().GetEndOfAutotext() ),
+ rObjName,
+ nAspect,
+ pDfltGrfFmtColl,
+ 0 ),
+ pFlyAttrSet, pGrfAttrSet,
+ pFrmFmt );
+}
+
+/*************************************************************************
+|* SwDoc::GetFldType()
+|* Beschreibung: liefert den am Doc eingerichteten Feldtypen zurueck
+*************************************************************************/
+
+SwFieldType *SwDoc::GetSysFldType( const sal_uInt16 eWhich ) const
+{
+ for( sal_uInt16 i = 0; i < INIT_FLDTYPES; ++i )
+ if( eWhich == (*pFldTypes)[i]->Which() )
+ return (*pFldTypes)[i];
+ return 0;
+}
+/*************************************************************************
+ * void SetDocStat( const SwDocStat& rStat );
+ *************************************************************************/
+
+void SwDoc::SetDocStat( const SwDocStat& rStat )
+{
+ *pDocStat = rStat;
+}
+
+const SwDocStat& SwDoc::GetDocStat() const
+{
+ return *pDocStat;
+}
+
+/*************************************************************************/
+
+
+struct _PostItFld : public _SetGetExpFld
+{
+ _PostItFld( const SwNodeIndex& rNdIdx, const SwTxtFld* pFld, const SwIndex* pIdx = 0 )
+ : _SetGetExpFld( rNdIdx, pFld, pIdx ) {}
+
+ sal_uInt16 GetPageNo( const StringRangeEnumerator &rRangeEnum,
+ const std::set< sal_Int32 > &rPossiblePages,
+ sal_uInt16& rVirtPgNo, sal_uInt16& rLineNo );
+
+ SwPostItField* GetPostIt() const
+ {
+ return (SwPostItField*) GetFld()->GetFld().GetFld();
+ }
+};
+
+
+sal_uInt16 _PostItFld::GetPageNo(
+ const StringRangeEnumerator &rRangeEnum,
+ const std::set< sal_Int32 > &rPossiblePages,
+ /* out */ sal_uInt16& rVirtPgNo, /* out */ sal_uInt16& rLineNo )
+{
+ //Problem: Wenn ein PostItFld in einem Node steht, der von mehr als
+ //einer Layout-Instanz repraesentiert wird, steht die Frage im Raum,
+ //ob das PostIt nur ein- oder n-mal gedruck werden soll.
+ //Wahrscheinlich nur einmal, als Seitennummer soll hier keine Zufaellige
+ //sondern die des ersten Auftretens des PostIts innerhalb des selektierten
+ //Bereichs ermittelt werden.
+ rVirtPgNo = 0;
+ sal_uInt16 nPos = GetCntnt();
+ SwIterator<SwTxtFrm,SwTxtNode> aIter( GetFld()->GetTxtNode() );
+ for( SwTxtFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() )
+ {
+ if( pFrm->GetOfst() > nPos ||
+ (pFrm->HasFollow() && pFrm->GetFollow()->GetOfst() <= nPos) )
+ continue;
+ sal_uInt16 nPgNo = pFrm->GetPhyPageNum();
+ if( rRangeEnum.hasValue( nPgNo, &rPossiblePages ))
+ {
+ rLineNo = (sal_uInt16)(pFrm->GetLineCount( nPos ) +
+ pFrm->GetAllLines() - pFrm->GetThisLines());
+ rVirtPgNo = pFrm->GetVirtPageNum();
+ return nPgNo;
+ }
+ }
+ return 0;
+}
+
+
+bool lcl_GetPostIts(
+ IDocumentFieldsAccess* pIDFA,
+ _SetGetExpFlds * pSrtLst )
+{
+ bool bHasPostIts = false;
+
+ SwFieldType* pFldType = pIDFA->GetSysFldType( RES_POSTITFLD );
+ DBG_ASSERT( pFldType, "kein PostItType ? ");
+
+ if( pFldType->GetDepends() )
+ {
+ // Modify-Object gefunden, trage alle Felder ins Array ein
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType );
+ const SwTxtFld* pTxtFld;
+ for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() )
+ {
+ if( 0 != ( pTxtFld = pFld->GetTxtFld() ) &&
+ pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+ {
+ bHasPostIts = true;
+ if (pSrtLst)
+ {
+ SwNodeIndex aIdx( pTxtFld->GetTxtNode() );
+ _PostItFld* pNew = new _PostItFld( aIdx, pTxtFld );
+ pSrtLst->Insert( pNew );
+ }
+ else
+ break; // we just wanted to check for the existence of postits ...
+ }
+ }
+ }
+
+ return bHasPostIts;
+}
+
+
+static void lcl_FormatPostIt(
+ IDocumentContentOperations* pIDCO,
+ SwPaM& aPam,
+ SwPostItField* pField,
+ bool bNewPage, bool bIsFirstPostIt,
+ sal_uInt16 nPageNo, sal_uInt16 nLineNo )
+{
+ static char __READONLY_DATA sTmp[] = " : ";
+
+ DBG_ASSERT( ViewShell::GetShellRes(), "missing ShellRes" );
+
+ if (bNewPage)
+ {
+ pIDCO->InsertPoolItem( aPam, SvxFmtBreakItem( SVX_BREAK_PAGE_AFTER, RES_BREAK ), 0 );
+ pIDCO->SplitNode( *aPam.GetPoint(), false );
+ }
+ else if (!bIsFirstPostIt)
+ {
+ // add an empty line between different notes
+ pIDCO->SplitNode( *aPam.GetPoint(), false );
+ pIDCO->SplitNode( *aPam.GetPoint(), false );
+ }
+
+ String aStr( ViewShell::GetShellRes()->aPostItPage );
+ aStr.AppendAscii(sTmp);
+
+ aStr += XubString::CreateFromInt32( nPageNo );
+ aStr += ' ';
+ if( nLineNo )
+ {
+ aStr += ViewShell::GetShellRes()->aPostItLine;
+ aStr.AppendAscii(sTmp);
+ aStr += XubString::CreateFromInt32( nLineNo );
+ aStr += ' ';
+ }
+ aStr += ViewShell::GetShellRes()->aPostItAuthor;
+ aStr.AppendAscii(sTmp);
+ aStr += pField->GetPar1();
+ aStr += ' ';
+ SvtSysLocale aSysLocale;
+ aStr += /*(LocaleDataWrapper&)*/aSysLocale.GetLocaleData().getDate( pField->GetDate() );
+ pIDCO->InsertString( aPam, aStr );
+
+ pIDCO->SplitNode( *aPam.GetPoint(), false );
+ aStr = pField->GetPar2();
+#if defined( WNT ) || defined( PM2 )
+ // Bei Windows und Co alle CR rausschmeissen
+ aStr.EraseAllChars( '\r' );
+#endif
+ pIDCO->InsertString( aPam, aStr );
+}
+
+
+// provide the paper tray to use according to the page style in use,
+// but do that only if the respective item is NOT just the default item
+static sal_Int32 lcl_GetPaperBin( const SwPageFrm *pStartFrm )
+{
+ sal_Int32 nRes = -1;
+
+ const SwFrmFmt &rFmt = pStartFrm->GetPageDesc()->GetMaster();
+ const SfxPoolItem *pItem = NULL;
+ SfxItemState eState = rFmt.GetItemState( RES_PAPER_BIN, sal_False, &pItem );
+ const SvxPaperBinItem *pPaperBinItem = dynamic_cast< const SvxPaperBinItem * >(pItem);
+ if (eState > SFX_ITEM_DEFAULT && pPaperBinItem)
+ nRes = pPaperBinItem->GetValue();
+
+ return nRes;
+}
+
+
+void SwDoc::CalculatePagesForPrinting(
+ const SwRootFrm& rLayout,
+ /* out */ SwRenderData &rData,
+ const SwPrintUIOptions &rOptions,
+ bool bIsPDFExport,
+ sal_Int32 nDocPageCount )
+{
+ const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 );
+ const bool bPrintSelection = nContent == 2;
+
+ // properties to take into account when calcualting the set of pages
+ // (PDF export UI does not allow for selecting left or right pages only)
+ bool bPrintLeftPages = bIsPDFExport ? true : rOptions.IsPrintLeftPages();
+ bool bPrintRightPages = bIsPDFExport ? true : rOptions.IsPrintRightPages();
+ // #i103700# printing selections should not allow for automatic inserting empty pages
+ bool bPrintEmptyPages = bPrintSelection ? false : rOptions.IsPrintEmptyPages( bIsPDFExport );
+
+ Range aPages( 1, nDocPageCount );
+
+ MultiSelection aMulti( aPages );
+ aMulti.SetTotalRange( Range( 0, RANGE_MAX ) );
+ aMulti.Select( aPages );
+
+ const SwPageFrm *pStPage = dynamic_cast<const SwPageFrm*>( rLayout.Lower() );
+ const SwFrm *pEndPage = pStPage;
+
+ sal_uInt16 nFirstPageNo = 0;
+ sal_uInt16 nLastPageNo = 0;
+ sal_uInt16 nPageNo = 1;
+
+ for( sal_uInt16 i = 1; i <= (sal_uInt16)aPages.Max(); ++i )
+ {
+ if( i < (sal_uInt16)aPages.Min() )
+ {
+ if( !pStPage->GetNext() )
+ break;
+ pStPage = (SwPageFrm*)pStPage->GetNext();
+ pEndPage= pStPage;
+ }
+ else if( i == (sal_uInt16)aPages.Min() )
+ {
+ nFirstPageNo = i;
+ nLastPageNo = nFirstPageNo;
+ if( !pStPage->GetNext() || (i == (sal_uInt16)aPages.Max()) )
+ break;
+ pEndPage = pStPage->GetNext();
+ }
+ else if( i > (sal_uInt16)aPages.Min() )
+ {
+ nLastPageNo = i;
+ if( !pEndPage->GetNext() || (i == (sal_uInt16)aPages.Max()) )
+ break;
+ pEndPage = pEndPage->GetNext();
+ }
+ }
+
+ DBG_ASSERT( nFirstPageNo, "first page not found! Should not happen!" );
+ if (nFirstPageNo)
+ {
+// HACK: Hier muss von der MultiSelection noch eine akzeptable Moeglichkeit
+// geschaffen werden, alle Seiten von Seite x an zu deselektieren.
+// Z.B. durch SetTotalRange ....
+
+// aMulti.Select( Range( nLastPageNo+1, SELECTION_MAX ), sal_False );
+ MultiSelection aTmpMulti( Range( 1, nLastPageNo ) );
+ long nTmpIdx = aMulti.FirstSelected();
+ static long nEndOfSelection = SFX_ENDOFSELECTION;
+ while ( nEndOfSelection != nTmpIdx && nTmpIdx <= long(nLastPageNo) )
+ {
+ aTmpMulti.Select( nTmpIdx );
+ nTmpIdx = aMulti.NextSelected();
+ }
+ aMulti = aTmpMulti;
+// Ende des HACKs
+
+ nPageNo = nFirstPageNo;
+
+ std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays();
+ std::set< sal_Int32 > &rValidPages = rData.GetValidPagesSet();
+ std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames();
+ rValidPages.clear();
+ rValidStartFrms.clear();
+ while ( pStPage )
+ {
+ const sal_Bool bRightPg = pStPage->OnRightPage();
+ if ( aMulti.IsSelected( nPageNo ) &&
+ ( (bRightPg && bPrintRightPages) ||
+ (!bRightPg && bPrintLeftPages) ) )
+ {
+ // --> FME 2005-12-12 #b6354161# Feature - Print empty pages
+ if ( bPrintEmptyPages || pStPage->Frm().Height() )
+ // <--
+ {
+ rValidPages.insert( nPageNo );
+ rValidStartFrms[ nPageNo ] = pStPage;
+
+ rPrinterPaperTrays[ nPageNo ] = lcl_GetPaperBin( pStPage );
+ }
+ }
+
+ if ( pStPage == pEndPage )
+ {
+ pStPage = 0;
+ }
+ else
+ { ++nPageNo;
+ pStPage = (SwPageFrm*)pStPage->GetNext();
+ }
+ }
+ }
+
+
+ //
+ // now that we have identified the valid pages for printing according
+ // to the print settings we need to get the PageRange to use and
+ // use both results to get the actual pages to be printed
+ // (post-it settings need to be taken into account later on!)
+ //
+
+ // get PageRange value to use
+ OUString aPageRange;
+ // --> PL, OD #i116085# - adjusting fix for i113919
+// if (bIsPDFExport)
+// {
+// aPageRange = rOptions.getStringValue( "PageRange", OUString() );
+// }
+// else
+ if ( !bIsPDFExport )
+ // <--
+ {
+ // PageContent :
+ // 0 -> print all pages (default if aPageRange is empty)
+ // 1 -> print range according to PageRange
+ // 2 -> print selection
+ if (1 == nContent)
+ aPageRange = rOptions.getStringValue( "PageRange", OUString() );
+ if (2 == nContent)
+ {
+ // note that printing selections is actually implemented by copying
+ // the selection to a new temporary document and printing all of that one.
+ // Thus for Writer "PrintContent" must never be 2.
+ // See SwXTextDocument::GetRenderDoc for evaluating if a selection is to be
+ // printed and for creating the temporary document.
+ }
+
+ // please note
+ }
+ if (aPageRange.getLength() == 0) // empty string -> print all
+ {
+ // set page range to print to 'all pages'
+ aPageRange = OUString::valueOf( (sal_Int32)1 );
+ aPageRange += OUString::valueOf( (sal_Unicode)'-');
+ aPageRange += OUString::valueOf( nDocPageCount );
+ }
+ rData.SetPageRange( aPageRange );
+
+ // get vector of pages to print according to PageRange and valid pages set from above
+ // (result may be an empty vector, for example if the range string is not correct)
+ StringRangeEnumerator::getRangesFromString(
+ aPageRange, rData.GetPagesToPrint(),
+ 1, nDocPageCount, 0, &rData.GetValidPagesSet() );
+}
+
+
+void SwDoc::UpdatePagesForPrintingWithPostItData(
+ /* out */ SwRenderData &rData,
+ const SwPrintUIOptions &rOptions,
+ bool /*bIsPDFExport*/,
+ sal_Int32 nDocPageCount )
+{
+
+ sal_Int16 nPostItMode = (sal_Int16) rOptions.getIntValue( "PrintAnnotationMode", 0 );
+ DBG_ASSERT(nPostItMode == POSTITS_NONE || rData.HasPostItData(),
+ "print post-its without post-it data?" );
+ const sal_uInt16 nPostItCount = rData.HasPostItData() ? rData.m_pPostItFields->Count() : 0;
+ if (nPostItMode != POSTITS_NONE && nPostItCount > 0)
+ {
+ SET_CURR_SHELL( rData.m_pPostItShell );
+
+ // clear document and move to end of it
+ SwPaM aPam( rData.m_pPostItDoc->GetNodes().GetEndOfContent() );
+ aPam.Move( fnMoveBackward, fnGoDoc );
+ aPam.SetMark();
+ aPam.Move( fnMoveForward, fnGoDoc );
+ rData.m_pPostItDoc->DeleteRange( aPam );
+
+ const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 );
+
+ // For mode POSTITS_ENDPAGE:
+ // maps a physical page number to the page number in post-it document that holds
+ // the first post-it for that physical page . Needed to relate the correct start frames
+ // from the post-it doc to the physical page of the document
+ std::map< sal_Int32, sal_Int32 > aPostItLastStartPageNum;
+
+ // add all post-its on valid pages within the the page range to the
+ // temporary post-it document.
+ // Since the array of post-it fileds is sorted by page and line number we will
+ // already get them in the correct order
+ sal_uInt16 nVirtPg = 0, nLineNo = 0, nLastPageNum = 0, nPhyPageNum = 0;
+ bool bIsFirstPostIt = true;
+ for (sal_uInt16 i = 0; i < nPostItCount; ++i)
+ {
+ _PostItFld& rPostIt = (_PostItFld&)*(*rData.m_pPostItFields)[ i ];
+ nLastPageNum = nPhyPageNum;
+ nPhyPageNum = rPostIt.GetPageNo(
+ aRangeEnum, rData.GetValidPagesSet(), nVirtPg, nLineNo );
+ if (nPhyPageNum)
+ {
+ // need to insert a page break?
+ // In POSTITS_ENDPAGE mode for each document page the following
+ // post-it page needs to start on a new page
+ const bool bNewPage = nPostItMode == POSTITS_ENDPAGE &&
+ !bIsFirstPostIt && nPhyPageNum != nLastPageNum;
+
+ lcl_FormatPostIt( rData.m_pPostItShell->GetDoc(), aPam,
+ rPostIt.GetPostIt(), bNewPage, bIsFirstPostIt, nVirtPg, nLineNo );
+ bIsFirstPostIt = false;
+
+ if (nPostItMode == POSTITS_ENDPAGE)
+ {
+ // get the correct number of current pages for the post-it document
+ rData.m_pPostItShell->CalcLayout();
+ const sal_Int32 nPages = rData.m_pPostItShell->GetPageCount();
+ aPostItLastStartPageNum[ nPhyPageNum ] = nPages;
+ }
+ }
+ }
+
+ // format post-it doc to get correct number of pages
+ rData.m_pPostItShell->CalcLayout();
+ const sal_Int32 nPostItDocPageCount = rData.m_pPostItShell->GetPageCount();
+
+ if (nPostItMode == POSTITS_ONLY || nPostItMode == POSTITS_ENDDOC)
+ {
+ // now add those post-it pages to the vector of pages to print
+ // or replace them if only post-its should be printed
+
+ rData.GetPostItStartFrames().clear();
+ if (nPostItMode == POSTITS_ENDDOC)
+ {
+ // set all values up to number of pages to print currently known to NULL,
+ // meaning none of the pages currently in the vector is from the
+ // post-it document, they are the documents pages.
+ rData.GetPostItStartFrames().resize( rData.GetPagesToPrint().size() );
+ }
+ else if (nPostItMode == POSTITS_ONLY)
+ {
+ // no document page to be printed
+ rData.GetPagesToPrint().clear();
+ }
+
+ // now we just need to add the post-it pages to be printed to the end
+ // of the vector of pages to print and keep the GetValidStartFrames
+ // data conform with it
+ sal_Int32 nPageNum = 0;
+ const SwPageFrm * pPageFrm = (SwPageFrm*)rData.m_pPostItShell->GetLayout()->Lower();
+ while( pPageFrm && nPageNum < nPostItDocPageCount )
+ {
+ DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" );
+ ++nPageNum;
+ rData.GetPagesToPrint().push_back( 0 ); // a page number of 0 indicates this page is from the post-it doc
+ DBG_ASSERT( pPageFrm, "pPageFrm is NULL!" );
+ rData.GetPostItStartFrames().push_back( pPageFrm );
+ pPageFrm = (SwPageFrm*)pPageFrm->GetNext();
+ }
+ DBG_ASSERT( nPageNum == nPostItDocPageCount, "unexpected number of pages" );
+ }
+ else if (nPostItMode == POSTITS_ENDPAGE)
+ {
+ // the next step is to find all the start frames from the post-it
+ // document that should be printed for a given physical page of the document
+ std::map< sal_Int32, std::vector< const SwPageFrm * > > aPhysPageToPostItFrames;
+
+ // ... thus, first collect all post-it doc start frames in a vector
+ sal_Int32 nPostItPageNum = 0;
+ std::vector< const SwPageFrm * > aAllPostItStartFrames;
+ const SwPageFrm * pPageFrm = (SwPageFrm*)rData.m_pPostItShell->GetLayout()->Lower();
+ while( pPageFrm && sal_Int32(aAllPostItStartFrames.size()) < nPostItDocPageCount )
+ {
+ DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" );
+ ++nPostItPageNum;
+ aAllPostItStartFrames.push_back( pPageFrm );
+ pPageFrm = (SwPageFrm*)pPageFrm->GetNext();
+ }
+ DBG_ASSERT( sal_Int32(aAllPostItStartFrames.size()) == nPostItDocPageCount,
+ "unexpected number of frames; does not match number of pages" );
+
+ // get a map that holds all post-it frames to be printed for a
+ // given physical page from the document
+ sal_Int32 nLastStartPageNum = 0;
+ std::map< sal_Int32, sal_Int32 >::const_iterator aIt;
+ for (aIt = aPostItLastStartPageNum.begin(); aIt != aPostItLastStartPageNum.end(); ++aIt)
+ {
+ const sal_Int32 nFrames = aIt->second - nLastStartPageNum;
+ const sal_Int32 nFirstStartPageNum = aIt == aPostItLastStartPageNum.begin() ?
+ 1 : aIt->second - nFrames + 1;
+ DBG_ASSERT( 1 <= nFirstStartPageNum && nFirstStartPageNum <= nPostItDocPageCount,
+ "page number for first frame out of range" );
+ std::vector< const SwPageFrm * > aStartFrames;
+ for (sal_Int32 i = 0; i < nFrames; ++i)
+ {
+ const sal_Int32 nIdx = nFirstStartPageNum - 1 + i; // -1 because lowest page num is 1
+ DBG_ASSERT( 0 <= nIdx && nIdx < sal_Int32(aAllPostItStartFrames.size()),
+ "index out of range" );
+ aStartFrames.push_back( aAllPostItStartFrames[ nIdx ] );
+ }
+ aPhysPageToPostItFrames[ aIt->first /* phys page num */ ] = aStartFrames;
+ nLastStartPageNum = aIt->second;
+ }
+
+
+ // ok, now that aPhysPageToPostItFrames can give the start frames for all
+ // post-it pages to be printed we need to merge those at the correct
+ // position into the GetPagesToPrint vector and build and maintain the
+ // GetValidStartFrames vector as well.
+ // Since inserting a larger number of entries in the middle of a vector
+ // isn't that efficient we will create new vectors by copying the required data
+ std::vector< sal_Int32 > aTmpPagesToPrint;
+ std::vector< const SwPageFrm * > aTmpPostItStartFrames;
+ const size_t nNum = rData.GetPagesToPrint().size();
+ for (size_t i = 0 ; i < nNum; ++i)
+ {
+ // add the physical page to print from the document
+ const sal_Int32 nPhysPage = rData.GetPagesToPrint()[i];
+ aTmpPagesToPrint.push_back( nPhysPage );
+ aTmpPostItStartFrames.push_back( NULL );
+
+ // add the post-it document pages to print, i.e those
+ // post-it pages that have the data for the above physical page
+ const std::vector< const SwPageFrm * > &rPostItFrames = aPhysPageToPostItFrames[ nPhysPage ];
+ const size_t nPostItFrames = rPostItFrames.size();
+ for (size_t k = 0; k < nPostItFrames; ++k)
+ {
+ aTmpPagesToPrint.push_back( 0 );
+ aTmpPostItStartFrames.push_back( rPostItFrames[k] );
+ }
+ }
+
+ // finally we need to assign those vectors to the resulting ones.
+ // swapping the data should be more efficient than assigning since
+ // we won't need the temporary vectors anymore
+ rData.GetPagesToPrint().swap( aTmpPagesToPrint );
+ rData.GetPostItStartFrames().swap( aTmpPostItStartFrames );
+ }
+ }
+}
+
+
+void SwDoc::CalculatePagePairsForProspectPrinting(
+ const SwRootFrm& rLayout,
+ /* out */ SwRenderData &rData,
+ const SwPrintUIOptions &rOptions,
+ sal_Int32 nDocPageCount )
+{
+ std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays();
+ std::set< sal_Int32 > &rValidPagesSet = rData.GetValidPagesSet();
+ std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames();
+ std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rData.GetPagePairsForProspectPrinting();
+
+ rPagePairs.clear();
+ rValidPagesSet.clear();
+ rValidStartFrms.clear();
+
+ rtl::OUString aPageRange = rOptions.getStringValue( "PageRange", rtl::OUString() );
+ // PageContent :
+ // 0 -> print all pages (default if aPageRange is empty)
+ // 1 -> print range according to PageRange
+ // 2 -> print selection
+ const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 );
+ if (0 == nContent)
+ {
+ // set page range to print to 'all pages'
+ aPageRange = OUString::valueOf( (sal_Int32)1 );
+ aPageRange += OUString::valueOf( (sal_Unicode)'-');
+ aPageRange += OUString::valueOf( nDocPageCount );
+ }
+ StringRangeEnumerator aRange( aPageRange, 1, nDocPageCount, 0 );
+
+ if ( aRange.size() <= 0)
+ return;
+
+ const SwPageFrm *pStPage = dynamic_cast<const SwPageFrm*>( rLayout.Lower() );
+ sal_Int32 i = 0;
+ for ( i = 1; pStPage && i < nDocPageCount; ++i )
+ pStPage = (SwPageFrm*)pStPage->GetNext();
+ if ( !pStPage ) // dann wars das
+ return;
+
+ // currently for prospect printing all pages are valid to be printed
+ // thus we add them all to the respective map and set for later use
+ sal_Int32 nPageNum = 0;
+ const SwPageFrm *pPageFrm = dynamic_cast<const SwPageFrm*>( rLayout.Lower() );
+ while( pPageFrm && nPageNum < nDocPageCount )
+ {
+ DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" );
+ ++nPageNum;
+ rValidPagesSet.insert( nPageNum );
+ rValidStartFrms[ nPageNum ] = pPageFrm;
+ pPageFrm = (SwPageFrm*)pPageFrm->GetNext();
+
+ rPrinterPaperTrays[ nPageNum ] = lcl_GetPaperBin( pStPage );
+ }
+ DBG_ASSERT( nPageNum == nDocPageCount, "unexpected number of pages" );
+
+ // properties to take into account when calcualting the set of pages
+ // Note: here bPrintLeftPages and bPrintRightPages refer to the (virtual) resulting pages
+ // of the prospect!
+ bool bPrintLeftPages = rOptions.IsPrintLeftPages();
+ bool bPrintRightPages = rOptions.IsPrintRightPages();
+ bool bPrintProspectRTL = rOptions.getIntValue( "PrintProspectRTL", 0 ) ? true : false;
+
+ // get pages for prospect printing according to the 'PageRange'
+ // (duplicates and any order allowed!)
+ std::vector< sal_Int32 > aPagesToPrint;
+ StringRangeEnumerator::getRangesFromString(
+ aPageRange, aPagesToPrint, 1, nDocPageCount, 0 );
+
+ // now fill the vector for calculating the page pairs with the start frames
+ // from the above obtained vector
+ std::vector< const SwPageFrm * > aVec;
+ for ( i = 0; i < sal_Int32(aPagesToPrint.size()); ++i)
+ {
+ const sal_Int32 nPage = aPagesToPrint[i];
+ const SwPageFrm *pFrm = rValidStartFrms[ nPage ];
+ aVec.push_back( pFrm );
+ }
+
+ // just one page is special ...
+ if ( 1 == aVec.size() )
+ aVec.insert( aVec.begin() + 1, 0 ); // insert a second empty page
+ else
+ {
+ // now extend the number of pages to fit a multiple of 4
+ // (4 'normal' pages are needed for a single prospect paper
+ // with back and front)
+ while( aVec.size() & 3 )
+ aVec.push_back( 0 );
+ }
+
+ // dann sorge mal dafuer, das alle Seiten in der richtigen
+ // Reihenfolge stehen:
+ sal_uInt16 nSPg = 0, nEPg = aVec.size(), nStep = 1;
+ if ( 0 == (nEPg & 1 )) // ungerade gibt es nicht!
+ --nEPg;
+
+ if ( !bPrintLeftPages )
+ ++nStep;
+ else if ( !bPrintRightPages )
+ {
+ ++nStep;
+ ++nSPg, --nEPg;
+ }
+
+ // the number of 'virtual' pages to be printed
+ sal_Int32 nCntPage = (( nEPg - nSPg ) / ( 2 * nStep )) + 1;
+
+ for ( sal_uInt16 nPrintCount = 0; nSPg < nEPg &&
+ nPrintCount < nCntPage; ++nPrintCount )
+ {
+ pStPage = aVec[ nSPg ];
+ const SwPageFrm* pNxtPage = nEPg < aVec.size() ? aVec[ nEPg ] : 0;
+
+ short nRtlOfs = bPrintProspectRTL ? 1 : 0;
+ if ( 0 == (( nSPg + nRtlOfs) & 1 ) ) // switch for odd number in LTR, even number in RTL
+ {
+ const SwPageFrm* pTmp = pStPage;
+ pStPage = pNxtPage;
+ pNxtPage = pTmp;
+ }
+
+ sal_Int32 nFirst = -1, nSecond = -1;
+ for ( int nC = 0; nC < 2; ++nC )
+ {
+ sal_Int32 nPage = -1;
+ if ( pStPage )
+ nPage = pStPage->GetPhyPageNum();
+ if (nC == 0)
+ nFirst = nPage;
+ else
+ nSecond = nPage;
+
+ pStPage = pNxtPage;
+ }
+ rPagePairs.push_back( std::pair< sal_Int32, sal_Int32 >(nFirst, nSecond) );
+
+ nSPg = nSPg + nStep;
+ nEPg = nEPg - nStep;
+ }
+ DBG_ASSERT( size_t(nCntPage) == rPagePairs.size(), "size mismatch for number of page pairs" );
+
+ // luckily prospect printing does not make use of post-its so far,
+ // thus we are done here.
+}
+
+/*************************************************************************
+ * void UpdateDocStat( const SwDocStat& rStat );
+ *************************************************************************/
+
+void SwDoc::UpdateDocStat( SwDocStat& rStat )
+{
+ if( rStat.bModified )
+ {
+ rStat.Reset();
+ rStat.nPara = 0; // Default ist auf 1 !!
+ SwNode* pNd;
+
+ for( sal_uLong i = GetNodes().Count(); i; )
+ {
+ switch( ( pNd = GetNodes()[ --i ])->GetNodeType() )
+ {
+ case ND_TEXTNODE:
+ ((SwTxtNode*)pNd)->CountWords( rStat, 0, ((SwTxtNode*)pNd)->GetTxt().Len() );
+ break;
+ case ND_TABLENODE: ++rStat.nTbl; break;
+ case ND_GRFNODE: ++rStat.nGrf; break;
+ case ND_OLENODE: ++rStat.nOLE; break;
+ case ND_SECTIONNODE: break;
+ }
+ }
+
+ // #i93174#: notes contain paragraphs that are not nodes
+ {
+ SwFieldType * const pPostits( GetSysFldType(RES_POSTITFLD) );
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pPostits );
+ for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
+ {
+ if (pFmtFld->IsFldInDoc())
+ {
+ SwPostItField const * const pField(
+ static_cast<SwPostItField const*>(pFmtFld->GetFld()));
+ rStat.nAllPara += pField->GetNumberOfParagraphs();
+ }
+ }
+ }
+
+ rStat.nPage = GetCurrentLayout() ? GetCurrentLayout()->GetPageNum() : 0; //swmod 080218
+ rStat.bModified = sal_False;
+ SetDocStat( rStat );
+
+ com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aStat( rStat.nPage ? 7 : 6);
+ sal_Int32 n=0;
+ aStat[n].Name = ::rtl::OUString::createFromAscii("TableCount");
+ aStat[n++].Value <<= (sal_Int32)rStat.nTbl;
+ aStat[n].Name = ::rtl::OUString::createFromAscii("ImageCount");
+ aStat[n++].Value <<= (sal_Int32)rStat.nGrf;
+ aStat[n].Name = ::rtl::OUString::createFromAscii("ObjectCount");
+ aStat[n++].Value <<= (sal_Int32)rStat.nOLE;
+ if ( rStat.nPage )
+ {
+ aStat[n].Name = ::rtl::OUString::createFromAscii("PageCount");
+ aStat[n++].Value <<= (sal_Int32)rStat.nPage;
+ }
+ aStat[n].Name = ::rtl::OUString::createFromAscii("ParagraphCount");
+ aStat[n++].Value <<= (sal_Int32)rStat.nPara;
+ aStat[n].Name = ::rtl::OUString::createFromAscii("WordCount");
+ aStat[n++].Value <<= (sal_Int32)rStat.nWord;
+ aStat[n].Name = ::rtl::OUString::createFromAscii("CharacterCount");
+ aStat[n++].Value <<= (sal_Int32)rStat.nChar;
+
+ // For e.g. autotext documents there is no pSwgInfo (#i79945)
+ SfxObjectShell * const pObjShell( GetDocShell() );
+ if (pObjShell)
+ {
+ const uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pObjShell->GetModel(), uno::UNO_QUERY_THROW);
+ const uno::Reference<document::XDocumentProperties> xDocProps(
+ xDPS->getDocumentProperties());
+ // #i96786#: do not set modified flag when updating statistics
+ const bool bDocWasModified( IsModified() );
+ const ModifyBlocker_Impl b(pObjShell);
+ xDocProps->setDocumentStatistics(aStat);
+ if (!bDocWasModified)
+ {
+ ResetModified();
+ }
+ }
+
+ // event. Stat. Felder Updaten
+ SwFieldType *pType = GetSysFldType(RES_DOCSTATFLD);
+ pType->UpdateFlds();
+ }
+}
+
+
+// Dokument - Info
+
+void SwDoc::DocInfoChgd( )
+{
+ GetSysFldType( RES_DOCINFOFLD )->UpdateFlds();
+ GetSysFldType( RES_TEMPLNAMEFLD )->UpdateFlds();
+ SetModified();
+}
+
+ // returne zum Namen die im Doc gesetzte Referenz
+const SwFmtRefMark* SwDoc::GetRefMark( const String& rName ) const
+{
+ const SfxPoolItem* pItem;
+ sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK );
+ for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+ {
+ if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n ) ))
+ continue;
+
+ const SwFmtRefMark* pFmtRef = (SwFmtRefMark*)pItem;
+ const SwTxtRefMark* pTxtRef = pFmtRef->GetTxtRefMark();
+ if( pTxtRef && &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() &&
+ rName.Equals( pFmtRef->GetRefName() ) )
+ return pFmtRef;
+ }
+ return 0;
+}
+
+ // returne die RefMark per Index - fuer Uno
+const SwFmtRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const
+{
+ const SfxPoolItem* pItem;
+ const SwTxtRefMark* pTxtRef;
+ const SwFmtRefMark* pRet = 0;
+
+ sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK );
+ sal_uInt32 nCount = 0;
+ for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) &&
+ 0 != (pTxtRef = ((SwFmtRefMark*)pItem)->GetTxtRefMark()) &&
+ &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() )
+ {
+ if(nCount == nIndex)
+ {
+ pRet = (SwFmtRefMark*)pItem;
+ break;
+ }
+ nCount++;
+ }
+ return pRet;
+}
+
+ // returne die Namen aller im Doc gesetzten Referenzen
+ //JP 24.06.96: Ist der ArrayPointer 0 dann returne nur, ob im Doc. eine
+ // RefMark gesetzt ist
+ // OS 25.06.96: ab jetzt wird immer die Anzahl der Referenzen returnt
+sal_uInt16 SwDoc::GetRefMarks( SvStringsDtor* pNames ) const
+{
+ const SfxPoolItem* pItem;
+ const SwTxtRefMark* pTxtRef;
+
+ sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK );
+ sal_uInt32 nCount = 0;
+ for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) &&
+ 0 != (pTxtRef = ((SwFmtRefMark*)pItem)->GetTxtRefMark()) &&
+ &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() )
+ {
+ if( pNames )
+ {
+ String* pTmp = new String( ((SwFmtRefMark*)pItem)->GetRefName() );
+ pNames->Insert( pTmp, nCount );
+ }
+ nCount ++;
+ }
+
+ return nCount;
+}
+
+bool SwDoc::IsLoaded() const
+{
+ return mbLoaded;
+}
+
+bool SwDoc::IsUpdateExpFld() const
+{
+ return mbUpdateExpFld;
+}
+
+bool SwDoc::IsNewDoc() const
+{
+ return mbNewDoc;
+}
+
+bool SwDoc::IsPageNums() const
+{
+ return mbPageNums;
+}
+
+void SwDoc::SetPageNums(bool b)
+{
+ mbPageNums = b;
+}
+
+void SwDoc::SetNewDoc(bool b)
+{
+ mbNewDoc = b;
+}
+
+void SwDoc::SetUpdateExpFldStat(bool b)
+{
+ mbUpdateExpFld = b;
+}
+
+void SwDoc::SetLoaded(bool b)
+{
+ mbLoaded = b;
+}
+
+bool SwDoc::IsModified() const
+{
+ return mbModified;
+}
+
+void SwDoc::SetModified()
+{
+ // --> OD 2005-08-29 #125370#
+ SwLayouter::ClearMovedFwdFrms( *this );
+ SwLayouter::ClearObjsTmpConsiderWrapInfluence( *this );
+ SwLayouter::ClearFrmsNotToWrap( *this );
+ // <--
+ // --> OD 2006-05-10 #i65250#
+ SwLayouter::ClearMoveBwdLayoutInfo( *this );
+ // <--
+ // dem Link wird der Status returnt, wie die Flags waren und werden
+ // Bit 0: -> alter Zustand
+ // Bit 1: -> neuer Zustand
+ long nCall = mbModified ? 3 : 2;
+ mbModified = sal_True;
+ pDocStat->bModified = sal_True;
+ if( aOle2Link.IsSet() )
+ {
+ mbInCallModified = sal_True;
+ aOle2Link.Call( (void*)nCall );
+ mbInCallModified = sal_False;
+ }
+
+ if( pACEWord && !pACEWord->IsDeleted() )
+ delete pACEWord, pACEWord = 0;
+}
+
+void SwDoc::ResetModified()
+{
+ // dem Link wird der Status returnt, wie die Flags waren und werden
+ // Bit 0: -> alter Zustand
+ // Bit 1: -> neuer Zustand
+ long nCall = mbModified ? 1 : 0;
+ mbModified = sal_False;
+ // If there is already a document statistic, we assume that
+ // it is correct. In this case we reset the modified flag.
+ if ( 0 != pDocStat->nChar )
+ pDocStat->bModified = sal_False;
+ GetIDocumentUndoRedo().SetUndoNoModifiedPosition();
+ if( nCall && aOle2Link.IsSet() )
+ {
+ mbInCallModified = sal_True;
+ aOle2Link.Call( (void*)nCall );
+ mbInCallModified = sal_False;
+ }
+}
+
+
+void SwDoc::ReRead( SwPaM& rPam, const String& rGrfName,
+ const String& rFltName, const Graphic* pGraphic,
+ const GraphicObject* pGrafObj )
+{
+ SwGrfNode *pGrfNd;
+ if( ( !rPam.HasMark()
+ || rPam.GetPoint()->nNode.GetIndex() == rPam.GetMark()->nNode.GetIndex() )
+ && 0 != ( pGrfNd = rPam.GetPoint()->nNode.GetNode().GetGrfNode() ) )
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoReRead(rPam, *pGrfNd));
+ }
+
+ // Weil nicht bekannt ist, ob sich die Grafik spiegeln laesst,
+ // immer das SpiegelungsAttribut zuruecksetzen
+ if( RES_MIRROR_GRAPH_DONT != pGrfNd->GetSwAttrSet().
+ GetMirrorGrf().GetValue() )
+ pGrfNd->SetAttr( SwMirrorGrf() );
+
+ pGrfNd->ReRead( rGrfName, rFltName, pGraphic, pGrafObj, sal_True );
+ SetModified();
+ }
+}
+
+sal_Bool lcl_SpellAndGrammarAgain( const SwNodePtr& rpNd, void* pArgs )
+{
+ SwTxtNode *pTxtNode = (SwTxtNode*)rpNd->GetTxtNode();
+ sal_Bool bOnlyWrong = *(sal_Bool*)pArgs;
+ if( pTxtNode )
+ {
+ if( bOnlyWrong )
+ {
+ if( pTxtNode->GetWrong() &&
+ pTxtNode->GetWrong()->InvalidateWrong() )
+ pTxtNode->SetWrongDirty( true );
+ if( pTxtNode->GetGrammarCheck() &&
+ pTxtNode->GetGrammarCheck()->InvalidateWrong() )
+ pTxtNode->SetGrammarCheckDirty( true );
+ }
+ else
+ {
+ pTxtNode->SetWrongDirty( true );
+ if( pTxtNode->GetWrong() )
+ pTxtNode->GetWrong()->SetInvalid( 0, STRING_LEN );
+ pTxtNode->SetGrammarCheckDirty( true );
+ if( pTxtNode->GetGrammarCheck() )
+ pTxtNode->GetGrammarCheck()->SetInvalid( 0, STRING_LEN );
+ }
+ }
+ return sal_True;
+}
+
+sal_Bool lcl_CheckSmartTagsAgain( const SwNodePtr& rpNd, void* )
+{
+ SwTxtNode *pTxtNode = (SwTxtNode*)rpNd->GetTxtNode();
+// sal_Bool bOnlyWrong = *(sal_Bool*)pArgs;
+ if( pTxtNode )
+ {
+ pTxtNode->SetSmartTagDirty( true );
+ if( pTxtNode->GetSmartTags() )
+ {
+// if ( bOnlyWrong ) // only some smart tag types have been enabled or disabled
+// pTxtNode->GetSmartTags()->SetInvalid( 0, STRING_LEN );
+// else // smart tags all have been enabled or disabled
+ pTxtNode->SetSmartTags( NULL );
+ }
+ }
+ return sal_True;
+}
+
+
+/*************************************************************************
+ * SwDoc::SpellItAgainSam( sal_Bool bInvalid, sal_Bool bOnlyWrong )
+ *
+ * stoesst das Spelling im Idle-Handler wieder an.
+ * Wird bInvalid als sal_True uebergeben, so werden zusaetzlich die WrongListen
+ * an allen Nodes invalidiert und auf allen Seiten das SpellInvalid-Flag
+ * gesetzt.
+ * Mit bOnlyWrong kann man dann steuern, ob nur die Bereiche mit falschen
+ * Woertern oder die kompletten Bereiche neu ueberprueft werden muessen.
+ ************************************************************************/
+
+void SwDoc::SpellItAgainSam( sal_Bool bInvalid, sal_Bool bOnlyWrong, sal_Bool bSmartTags )
+{
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();//swmod 080307
+ ASSERT( GetCurrentLayout(), "SpellAgain: Where's my RootFrm?" );
+ if( bInvalid )
+ {
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::AllInvalidateSmartTagsOrSpelling),bSmartTags));//swmod 080305
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::SetNeedGrammarCheck), true) );
+ if ( bSmartTags )
+ GetNodes().ForEach( lcl_CheckSmartTagsAgain, &bOnlyWrong );
+ GetNodes().ForEach( lcl_SpellAndGrammarAgain, &bOnlyWrong );
+ }
+
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::SetIdleFlags));//swmod 080307
+}
+
+void SwDoc::InvalidateAutoCompleteFlag()
+{
+ SwRootFrm* pTmpRoot = GetCurrentLayout();
+ if( pTmpRoot )
+ {
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllInvalidateAutoCompleteWords));//swmod 080305
+ for( sal_uLong nNd = 1, nCnt = GetNodes().Count(); nNd < nCnt; ++nNd )
+ {
+ SwTxtNode* pTxtNode = GetNodes()[ nNd ]->GetTxtNode();
+ if ( pTxtNode ) pTxtNode->SetAutoCompleteWordDirty( true );
+ }
+
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::SetIdleFlags));//swmod 080228
+ } //swmod 080219
+}
+
+const SwFmtINetFmt* SwDoc::FindINetAttr( const String& rName ) const
+{
+ const SwFmtINetFmt* pItem;
+ const SwTxtINetFmt* pTxtAttr;
+ const SwTxtNode* pTxtNd;
+ sal_uInt32 n, nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT );
+ for( n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = (SwFmtINetFmt*)GetAttrPool().GetItem2(
+ RES_TXTATR_INETFMT, n ) ) &&
+ pItem->GetName().Equals( rName ) &&
+ 0 != ( pTxtAttr = pItem->GetTxtINetFmt()) &&
+ 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
+ &pTxtNd->GetNodes() == &GetNodes() )
+ {
+ return pItem;
+ }
+
+ return 0;
+}
+
+void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, sal_Bool bImpress )
+{
+ const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds();
+ if( pExtDoc && rOutNds.Count() )
+ {
+ sal_uInt16 i;
+ ::StartProgress( STR_STATSTR_SUMMARY, 0, rOutNds.Count(), GetDocShell() );
+ SwNodeIndex aEndOfDoc( pExtDoc->GetNodes().GetEndOfContent(), -1 );
+ for( i = 0; i < rOutNds.Count(); ++i )
+ {
+ ::SetProgressState( i, GetDocShell() );
+ const sal_uLong nIndex = rOutNds[ i ]->GetIndex();
+ //sal_uInt8 nLvl = ((SwTxtNode*)GetNodes()[ nIndex ])->GetTxtColl()//#outline level,zhaojianwei
+ // ->GetOutlineLevel();
+ const int nLvl = ((SwTxtNode*)GetNodes()[ nIndex ])->GetAttrOutlineLevel()-1;//<-end,zhaojianwei
+ if( nLvl > nLevel )
+ continue;
+ sal_uInt16 nEndOfs = 1;
+ sal_uInt8 nWish = nPara;
+ sal_uLong nNextOutNd = i + 1 < rOutNds.Count() ?
+ rOutNds[ i + 1 ]->GetIndex() : GetNodes().Count();
+ sal_Bool bKeep = sal_False;
+ while( ( nWish || bKeep ) && nIndex + nEndOfs < nNextOutNd &&
+ GetNodes()[ nIndex + nEndOfs ]->IsTxtNode() )
+ {
+ SwTxtNode* pTxtNode = (SwTxtNode*)GetNodes()[ nIndex+nEndOfs ];
+ if( pTxtNode->GetTxt().Len() && nWish )
+ --nWish;
+ bKeep = pTxtNode->GetSwAttrSet().GetKeep().GetValue();
+ ++nEndOfs;
+ }
+
+ SwNodeRange aRange( *rOutNds[ i ], 0, *rOutNds[ i ], nEndOfs );
+ GetNodes()._Copy( aRange, aEndOfDoc );
+ }
+ const SwTxtFmtColls *pColl = pExtDoc->GetTxtFmtColls();
+ for( i = 0; i < pColl->Count(); ++i )
+ (*pColl)[ i ]->ResetFmtAttr( RES_PAGEDESC, RES_BREAK );
+ SwNodeIndex aIndx( pExtDoc->GetNodes().GetEndOfExtras() );
+ ++aEndOfDoc;
+ while( aIndx < aEndOfDoc )
+ {
+ SwNode *pNode;
+ sal_Bool bDelete = sal_False;
+ if( (pNode = &aIndx.GetNode())->IsTxtNode() )
+ {
+ SwTxtNode *pNd = (SwTxtNode*)pNode;
+ if( pNd->HasSwAttrSet() )
+ pNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
+ if( bImpress )
+ {
+ SwTxtFmtColl* pMyColl = pNd->GetTxtColl();
+ //sal_uInt16 nHeadLine = static_cast<sal_uInt16>(pMyColl->GetOutlineLevel()==NO_NUMBERING ?//#outlinelevel,zhaojianwei
+ const sal_uInt16 nHeadLine = static_cast<sal_uInt16>(
+ !pMyColl->IsAssignedToListLevelOfOutlineStyle() //<-end,zhaojianwei
+ ? RES_POOLCOLL_HEADLINE2
+ : RES_POOLCOLL_HEADLINE1 );
+ pMyColl = pExtDoc->GetTxtCollFromPool( nHeadLine );
+ pNd->ChgFmtColl( pMyColl );
+ }
+ if( !pNd->Len() &&
+ pNd->StartOfSectionIndex()+2 < pNd->EndOfSectionIndex() )
+ {
+ bDelete = sal_True;
+ pExtDoc->GetNodes().Delete( aIndx );
+ }
+ }
+ if( !bDelete )
+ ++aIndx;
+ }
+ ::EndProgress( GetDocShell() );
+ }
+}
+
+ // loesche den nicht sichtbaren Content aus dem Document, wie z.B.:
+ // versteckte Bereiche, versteckte Absaetze
+bool SwDoc::RemoveInvisibleContent()
+{
+ sal_Bool bRet = sal_False;
+ GetIDocumentUndoRedo().StartUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL );
+
+ {
+ SwTxtNode* pTxtNd;
+ SwIterator<SwFmtFld,SwFieldType> aIter( *GetSysFldType( RES_HIDDENPARAFLD ) );
+ for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
+ {
+ if( pFmtFld->GetTxtFld() &&
+ 0 != ( pTxtNd = (SwTxtNode*)pFmtFld->GetTxtFld()->GetpTxtNode() ) &&
+ pTxtNd->GetpSwpHints() && pTxtNd->HasHiddenParaField() &&
+ &pTxtNd->GetNodes() == &GetNodes() )
+ {
+ bRet = sal_True;
+ SwPaM aPam( *pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().Len() );
+
+ // Remove hidden paragraph or delete contents:
+ // Delete contents if
+ // 1. removing the paragraph would result in an empty section or
+ // 2. if the paragraph is the last paragraph in the section and
+ // there is no paragraph in front of the paragraph:
+ if ( ( 2 == pTxtNd->EndOfSectionIndex() - pTxtNd->StartOfSectionIndex() ) ||
+ ( 1 == pTxtNd->EndOfSectionIndex() - pTxtNd->GetIndex() &&
+ !GetNodes()[ pTxtNd->GetIndex() - 1 ]->GetTxtNode() ) )
+ {
+ DeleteRange( aPam );
+ }
+ else
+ {
+ aPam.DeleteMark();
+ DelFullPara( aPam );
+ }
+ }
+ }
+ }
+
+ //
+ // Remove any hidden paragraph (hidden text attribute)
+ //
+ for( sal_uLong n = GetNodes().Count(); n; )
+ {
+ SwTxtNode* pTxtNd = GetNodes()[ --n ]->GetTxtNode();
+ if ( pTxtNd )
+ {
+ bool bRemoved = false;
+ SwPaM aPam( *pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().Len() );
+ if ( pTxtNd->HasHiddenCharAttribute( true ) )
+ {
+ bRemoved = sal_True;
+ bRet = sal_True;
+
+ // Remove hidden paragraph or delete contents:
+ // Delete contents if
+ // 1. removing the paragraph would result in an empty section or
+ // 2. if the paragraph is the last paragraph in the section and
+ // there is no paragraph in front of the paragraph:
+
+ if ( ( 2 == pTxtNd->EndOfSectionIndex() - pTxtNd->StartOfSectionIndex() ) ||
+ ( 1 == pTxtNd->EndOfSectionIndex() - pTxtNd->GetIndex() &&
+ !GetNodes()[ pTxtNd->GetIndex() - 1 ]->GetTxtNode() ) )
+ {
+ DeleteRange( aPam );
+ }
+ else
+ {
+ aPam.DeleteMark();
+ DelFullPara( aPam );
+ }
+ }
+ else if ( pTxtNd->HasHiddenCharAttribute( false ) )
+ {
+ bRemoved = sal_True;
+ bRet = sal_True;
+ SwScriptInfo::DeleteHiddenRanges( *pTxtNd );
+ }
+
+ // --> FME 2006-01-11 #120473#
+ // Footnotes/Frames may have been removed, therefore we have
+ // to reset n:
+ if ( bRemoved )
+ n = aPam.GetPoint()->nNode.GetIndex();
+ // <--
+ }
+ }
+
+ {
+ // dann noch alle versteckten Bereiche loeschen/leeren
+ SwSectionFmts aSectFmts;
+ SwSectionFmts& rSectFmts = GetSections();
+ sal_uInt16 n;
+
+ for( n = rSectFmts.Count(); n; )
+ {
+ SwSectionFmt* pSectFmt = rSectFmts[ --n ];
+ // don't add sections in Undo/Redo
+ if( !pSectFmt->IsInNodesArr())
+ continue;
+ SwSection* pSect = pSectFmt->GetSection();
+ if( pSect->CalcHiddenFlag() )
+ {
+ SwSection* pParent = pSect, *pTmp;
+ while( 0 != (pTmp = pParent->GetParent() ))
+ {
+ if( pTmp->IsHiddenFlag() )
+ pSect = pTmp;
+ pParent = pTmp;
+ }
+
+ if( USHRT_MAX == aSectFmts.GetPos( pSect->GetFmt() ) )
+ aSectFmts.Insert( pSect->GetFmt(), 0 );
+ }
+ if( pSect->GetCondition().Len() )
+ {
+ SwSectionData aSectionData( *pSect );
+ aSectionData.SetCondition( aEmptyStr );
+ aSectionData.SetHidden( false );
+ UpdateSection( n, aSectionData );
+ }
+ }
+
+ if( 0 != ( n = aSectFmts.Count() ))
+ {
+ while( n )
+ {
+ SwSectionFmt* pSectFmt = aSectFmts[ --n ];
+ SwSectionNode* pSectNd = pSectFmt->GetSectionNode();
+ if( pSectNd )
+ {
+ bRet = sal_True;
+ SwPaM aPam( *pSectNd );
+
+ if( pSectNd->StartOfSectionNode()->StartOfSectionIndex() ==
+ pSectNd->GetIndex() - 1 &&
+ pSectNd->StartOfSectionNode()->EndOfSectionIndex() ==
+ pSectNd->EndOfSectionIndex() + 1 )
+ {
+ // nur den Inhalt loeschen
+ SwCntntNode* pCNd = GetNodes().GoNext(
+ &aPam.GetPoint()->nNode );
+ aPam.GetPoint()->nContent.Assign( pCNd, 0 );
+ aPam.SetMark();
+ aPam.GetPoint()->nNode = *pSectNd->EndOfSectionNode();
+ pCNd = GetNodes().GoPrevious(
+ &aPam.GetPoint()->nNode );
+ aPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+
+ DeleteRange( aPam );
+ }
+ else
+ {
+ // die gesamte Section loeschen
+ aPam.SetMark();
+ aPam.GetPoint()->nNode = *pSectNd->EndOfSectionNode();
+ DelFullPara( aPam );
+ }
+
+ }
+ }
+ aSectFmts.Remove( 0, aSectFmts.Count() );
+ }
+ }
+
+ if( bRet )
+ SetModified();
+ GetIDocumentUndoRedo().EndUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL );
+ return bRet;
+}
+/*-- 25.08.2010 14:18:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwDoc::HasInvisibleContent() const
+{
+ sal_Bool bRet = sal_False;
+
+ SwClientIter aIter( *GetSysFldType( RES_HIDDENPARAFLD ) );
+ if( aIter.First( TYPE( SwFmtFld ) ) )
+ bRet = sal_True;
+
+ //
+ // Search for any hidden paragraph (hidden text attribute)
+ //
+ if( ! bRet )
+ {
+ for( sal_uLong n = GetNodes().Count(); !bRet && (n > 0); )
+ {
+ SwTxtNode* pTxtNd = GetNodes()[ --n ]->GetTxtNode();
+ if ( pTxtNd )
+ {
+ SwPaM aPam( *pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().Len() );
+ if( pTxtNd->HasHiddenCharAttribute( true ) || ( pTxtNd->HasHiddenCharAttribute( false ) ) )
+ {
+ bRet = sal_True;
+ }
+ }
+ }
+ }
+
+ if( ! bRet )
+ {
+ const SwSectionFmts& rSectFmts = GetSections();
+ sal_uInt16 n;
+
+ for( n = rSectFmts.Count(); !bRet && (n > 0); )
+ {
+ SwSectionFmt* pSectFmt = rSectFmts[ --n ];
+ // don't add sections in Undo/Redo
+ if( !pSectFmt->IsInNodesArr())
+ continue;
+ SwSection* pSect = pSectFmt->GetSection();
+ if( pSect->IsHidden() )
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+bool SwDoc::RestoreInvisibleContent()
+{
+ bool bRet = false;
+ SwUndoId nLastUndoId(UNDO_EMPTY);
+ if (GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId)
+ && (UNDO_UI_DELETE_INVISIBLECNTNT == nLastUndoId))
+ {
+ GetIDocumentUndoRedo().Undo();
+ GetIDocumentUndoRedo().ClearRedo();
+ bRet = true;
+ }
+ return bRet;
+}
+
+/*-- 11.06.2004 08:34:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwDoc::ConvertFieldsToText()
+{
+ sal_Bool bRet = sal_False;
+ LockExpFlds();
+ GetIDocumentUndoRedo().StartUndo( UNDO_UI_REPLACE, NULL );
+
+ const SwFldTypes* pMyFldTypes = GetFldTypes();
+ sal_uInt16 nCount = pMyFldTypes->Count();
+ //go backward, field types are removed
+ for(sal_uInt16 nType = nCount; nType > 0; --nType)
+ {
+ const SwFieldType *pCurType = pMyFldTypes->GetObject(nType - 1);
+
+ if ( RES_POSTITFLD == pCurType->Which() )
+ continue;
+
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pCurType );
+ ::std::vector<const SwFmtFld*> aFieldFmts;
+ for( SwFmtFld* pCurFldFmt = aIter.First(); pCurFldFmt; pCurFldFmt = aIter.Next() )
+ aFieldFmts.push_back(pCurFldFmt);
+
+ ::std::vector<const SwFmtFld*>::iterator aBegin = aFieldFmts.begin();
+ ::std::vector<const SwFmtFld*>::iterator aEnd = aFieldFmts.end();
+ while(aBegin != aEnd)
+ {
+ const SwTxtFld *pTxtFld = (*aBegin)->GetTxtFld();
+ // skip fields that are currently not in the document
+ // e.g. fields in undo or redo array
+
+ sal_Bool bSkip = !pTxtFld ||
+ !pTxtFld->GetpTxtNode()->GetNodes().IsDocNodes();
+
+ if (!bSkip)
+ {
+ sal_Bool bInHeaderFooter = IsInHeaderFooter(SwNodeIndex(*pTxtFld->GetpTxtNode()));
+ const SwFmtFld& rFmtFld = pTxtFld->GetFld();
+ const SwField* pField = rFmtFld.GetFld();
+
+ //#i55595# some fields have to be excluded in headers/footers
+ sal_uInt16 nWhich = pField->GetTyp()->Which();
+ if(!bInHeaderFooter ||
+ (nWhich != RES_PAGENUMBERFLD &&
+ nWhich != RES_CHAPTERFLD &&
+ nWhich != RES_GETEXPFLD&&
+ nWhich != RES_SETEXPFLD&&
+ nWhich != RES_INPUTFLD&&
+ nWhich != RES_REFPAGEGETFLD&&
+ nWhich != RES_REFPAGESETFLD))
+ {
+ String sText = pField->ExpandField(true);
+ //database fields should not convert their command into text
+ if( RES_DBFLD == pCurType->Which() && !static_cast<const SwDBField*>(pField)->IsInitialized())
+ sText.Erase();
+
+ //now remove the field and insert the string
+ SwPaM aPam1(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart());
+ aPam1.Move();
+ //insert first to keep the field's attributes
+ InsertString( aPam1, sText );
+ SwPaM aPam2(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart());
+ aPam2.SetMark();
+ aPam2.Move();
+ DeleteAndJoin(aPam2);//remove the field
+ }
+ }
+ ++aBegin;
+ }
+ }
+
+ if( bRet )
+ SetModified();
+ GetIDocumentUndoRedo().EndUndo( UNDO_UI_REPLACE, NULL );
+ UnlockExpFlds();
+ return bRet;
+
+}
+
+bool SwDoc::IsVisibleLinks() const
+{
+ return mbVisibleLinks;
+}
+
+void SwDoc::SetVisibleLinks(bool bFlag)
+{
+ mbVisibleLinks = bFlag;
+}
+
+sfx2::LinkManager& SwDoc::GetLinkManager()
+{
+ return *pLinkMgr;
+}
+
+const sfx2::LinkManager& SwDoc::GetLinkManager() const
+{
+ return *pLinkMgr;
+}
+
+void SwDoc::SetLinksUpdated(const bool bNewLinksUpdated)
+{
+ mbLinksUpdated = bNewLinksUpdated;
+}
+
+bool SwDoc::LinksUpdated() const
+{
+ return mbLinksUpdated;
+}
+
+ // embedded alle lokalen Links (Bereiche/Grafiken)
+::sfx2::SvBaseLink* lcl_FindNextRemovableLink( const ::sfx2::SvBaseLinks& rLinks, sfx2::LinkManager& rLnkMgr )
+{
+ for( sal_uInt16 n = 0; n < rLinks.Count(); ++n )
+ {
+ ::sfx2::SvBaseLink* pLnk = &(*rLinks[ n ]);
+ if( pLnk &&
+ ( OBJECT_CLIENT_GRF == pLnk->GetObjType() ||
+ OBJECT_CLIENT_FILE == pLnk->GetObjType() ) &&
+ pLnk->ISA( SwBaseLink ) )
+ {
+ ::sfx2::SvBaseLinkRef xLink = pLnk;
+
+ String sFName;
+ rLnkMgr.GetDisplayNames( xLink, 0, &sFName, 0, 0 );
+
+ INetURLObject aURL( sFName );
+ if( INET_PROT_FILE == aURL.GetProtocol() ||
+ INET_PROT_CID == aURL.GetProtocol() )
+ return pLnk;
+ }
+ }
+ return 0;
+}
+bool SwDoc::EmbedAllLinks()
+{
+ sal_Bool bRet = sal_False;
+ sfx2::LinkManager& rLnkMgr = GetLinkManager();
+ const ::sfx2::SvBaseLinks& rLinks = rLnkMgr.GetLinks();
+ if( rLinks.Count() )
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ ::sfx2::SvBaseLink* pLnk = 0;
+ while( 0 != (pLnk = lcl_FindNextRemovableLink( rLinks, rLnkMgr ) ) )
+ {
+ ::sfx2::SvBaseLinkRef xLink = pLnk;
+ // dem Link sagen, das er aufgeloest wird!
+ xLink->Closed();
+
+ // falls einer vergessen hat sich auszutragen
+ if( xLink.Is() )
+ rLnkMgr.Remove( xLink );
+
+ bRet = sal_True;
+ }
+
+ GetIDocumentUndoRedo().DelAllUndoObj();
+ SetModified();
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwDoc::IsInsTblFormatNum() const
+{
+ return SW_MOD()->IsInsTblFormatNum(get(IDocumentSettingAccess::HTML_MODE));
+}
+
+sal_Bool SwDoc::IsInsTblChangeNumFormat() const
+{
+ return SW_MOD()->IsInsTblChangeNumFormat(get(IDocumentSettingAccess::HTML_MODE));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwDoc::IsInsTblAlignNum() const
+{
+ return SW_MOD()->IsInsTblAlignNum(get(IDocumentSettingAccess::HTML_MODE));
+}
+
+ // setze das InsertDB als Tabelle Undo auf:
+void SwDoc::AppendUndoForInsertFromDB( const SwPaM& rPam, sal_Bool bIsTable )
+{
+ if( bIsTable )
+ {
+ const SwTableNode* pTblNd = rPam.GetPoint()->nNode.GetNode().FindTableNode();
+ if( pTblNd )
+ {
+ SwUndoCpyTbl* pUndo = new SwUndoCpyTbl;
+ pUndo->SetTableSttIdx( pTblNd->GetIndex() );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ }
+ else if( rPam.HasMark() )
+ {
+ SwUndoCpyDoc* pUndo = new SwUndoCpyDoc( rPam );
+ pUndo->SetInsertRange( rPam, sal_False );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+}
+
+void SwDoc::ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew)
+{
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().DelAllUndoObj();
+
+ SwUndo * pUndo = new SwUndoTOXChange(&rTOX, rNew);
+
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ rTOX = rNew;
+
+ if (rTOX.ISA(SwTOXBaseSection))
+ {
+ static_cast<SwTOXBaseSection &>(rTOX).Update();
+ static_cast<SwTOXBaseSection &>(rTOX).UpdatePageNum();
+ }
+}
+
+// #111827#
+String SwDoc::GetPaMDescr(const SwPaM & rPam) const
+{
+ String aResult;
+ bool bOK = false;
+
+ if (rPam.GetNode(sal_True) == rPam.GetNode(sal_False))
+ {
+ SwTxtNode * pTxtNode = rPam.GetNode(sal_True)->GetTxtNode();
+
+ if (0 != pTxtNode)
+ {
+ xub_StrLen nStart = rPam.Start()->nContent.GetIndex();
+ xub_StrLen nEnd = rPam.End()->nContent.GetIndex();
+
+ aResult += String(SW_RES(STR_START_QUOTE));
+ aResult += ShortenString(pTxtNode->GetTxt().
+ Copy(nStart, nEnd - nStart),
+ nUndoStringLength,
+ String(SW_RES(STR_LDOTS)));
+ aResult += String(SW_RES(STR_END_QUOTE));
+
+ bOK = true;
+ }
+ }
+ else if (0 != rPam.GetNode(sal_True))
+ {
+ if (0 != rPam.GetNode(sal_False))
+ aResult += String(SW_RES(STR_PARAGRAPHS));
+
+ bOK = true;
+ }
+
+ if (! bOK)
+ aResult += String("??", RTL_TEXTENCODING_ASCII_US);
+
+ return aResult;
+}
+
+// -> #111840#
+SwField * SwDoc::GetField(const SwPosition & rPos)
+{
+ SwTxtFld * const pAttr = GetTxtFld(rPos);
+
+ return (pAttr) ? const_cast<SwField *>( pAttr->GetFld().GetFld() ) : 0;
+}
+
+SwTxtFld * SwDoc::GetTxtFld(const SwPosition & rPos)
+{
+ SwTxtNode * const pNode = rPos.nNode.GetNode().GetTxtNode();
+
+ return (pNode)
+ ? static_cast<SwTxtFld*>( pNode->GetTxtAttrForCharAt(
+ rPos.nContent.GetIndex(), RES_TXTATR_FIELD) )
+ : 0;
+}
+// <- #111840#
+
+bool SwDoc::ContainsHiddenChars() const
+{
+ for( sal_uLong n = GetNodes().Count(); n; )
+ {
+ SwNode* pNd = GetNodes()[ --n ];
+ if ( ND_TEXTNODE == pNd->GetNodeType() &&
+ ((SwTxtNode*)pNd)->HasHiddenCharAttribute( false ) )
+ return true;
+ }
+
+ return false;
+}
+
+SwUnoCrsr* SwDoc::CreateUnoCrsr( const SwPosition& rPos, sal_Bool bTblCrsr )
+{
+ SwUnoCrsr* pNew;
+ if( bTblCrsr )
+ pNew = new SwUnoTableCrsr( rPos );
+ else
+ pNew = new SwUnoCrsr( rPos );
+
+ pUnoCrsrTbl->Insert( pNew, pUnoCrsrTbl->Count() );
+ return pNew;
+}
+
+void SwDoc::ChkCondColls()
+{
+ for (sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); n++)
+ {
+ SwTxtFmtColl *pColl = (*pTxtFmtCollTbl)[n];
+ if (RES_CONDTXTFMTCOLL == pColl->Which())
+ pColl->CallSwClientNotify( SwAttrHint(RES_CONDTXTFMTCOLL) );
+ }
+}
+
+#ifdef FUTURE_VBA
+uno::Reference< script::vba::XVBAEventProcessor >
+SwDoc::GetVbaEventProcessor()
+{
+ if( !mxVbaEvents.is() && pDocShell && ooo::vba::isAlienWordDoc( *pDocShell ) )
+ {
+ try
+ {
+ uno::Reference< frame::XModel > xModel( pDocShell->GetModel(), uno::UNO_SET_THROW );
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[0] <<= xModel;
+ mxVbaEvents.set( ooo::vba::createVBAUnoAPIServiceWithArgs( pDocShell, "com.sun.star.script.vba.VBATextEventProcessor" , aArgs ), uno::UNO_QUERY_THROW );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ return mxVbaEvents;
+}
+#endif
+
+void SwDoc::setExternalData(::sw::tExternalDataType eType,
+ ::sw::tExternalDataPointer pPayload)
+{
+ m_externalData[eType] = pPayload;
+}
+
+::sw::tExternalDataPointer SwDoc::getExternalData(::sw::tExternalDataType eType)
+{
+ return m_externalData[eType];
+}
diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx
new file mode 100644
index 000000000000..77665e55fbce
--- /dev/null
+++ b/sw/source/core/doc/docbasic.cxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#ifndef _RTL_USTRING_HXX //autogen
+#include <rtl/ustring.hxx>
+#endif
+#include <svtools/imap.hxx>
+#include <svtools/imapobj.hxx>
+#include <basic/sbx.hxx>
+#include <frmfmt.hxx>
+#include <fmtinfmt.hxx>
+#include <fmturl.hxx>
+#include <frmatr.hxx>
+#include <docary.hxx>
+#include <doc.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <swevent.hxx>
+
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+static Sequence<Any> *lcl_docbasic_convertArgs( SbxArray& rArgs )
+{
+ Sequence<Any> *pRet = 0;
+
+ sal_uInt16 nCount = rArgs.Count();
+ if( nCount > 1 )
+ {
+ nCount--;
+ pRet = new Sequence<Any>( nCount );
+ Any *pUnoArgs = pRet->getArray();
+ for( sal_uInt16 i=0; i<nCount; i++ )
+ {
+ SbxVariable *pVar = rArgs.Get( i+1 );
+ switch( pVar->GetType() )
+ {
+ case SbxSTRING:
+ pUnoArgs[i] <<= OUString( pVar->GetString() );
+ break;
+ case SbxCHAR:
+ pUnoArgs[i] <<= (sal_Int16)pVar->GetChar() ;
+ break;
+ case SbxUSHORT:
+ pUnoArgs[i] <<= (sal_Int16)pVar->GetUShort();
+ break;
+ case SbxLONG:
+ pUnoArgs[i] <<= (sal_Int32)pVar->GetLong();
+ break;
+ default:
+ pUnoArgs[i].setValue(0, ::getVoidCppuType());
+ break;
+ }
+ }
+ }
+
+ return pRet;
+}
+
+sal_Bool SwDoc::ExecMacro( const SvxMacro& rMacro, String* pRet, SbxArray* pArgs )
+{
+ ErrCode eErr = 0;
+ switch( rMacro.GetScriptType() )
+ {
+ case STARBASIC:
+ {
+ SbxBaseRef aRef;
+ SbxValue* pRetValue = new SbxValue;
+ aRef = pRetValue;
+ eErr = pDocShell->CallBasic( rMacro.GetMacName(),
+ rMacro.GetLibName(),
+ pArgs, pRet ? pRetValue : 0 );
+
+ if( pRet && SbxNULL < pRetValue->GetType() &&
+ SbxVOID != pRetValue->GetType() )
+ // gueltiger Wert, also setzen
+ *pRet = pRetValue->GetString();
+ }
+ break;
+ case JAVASCRIPT:
+ // ignore JavaScript calls
+ break;
+ case EXTENDED_STYPE:
+ {
+ Sequence<Any> *pUnoArgs = 0;
+ if( pArgs )
+ {
+ // better to rename the local function to lcl_translateBasic2Uno and
+ // a much shorter routine can be found in sfx2/source/doc/objmisc.cxx
+ pUnoArgs = lcl_docbasic_convertArgs( *pArgs );
+ }
+
+ if (!pUnoArgs)
+ {
+ pUnoArgs = new Sequence< Any > (0);
+ }
+
+ // TODO - return value is not handled
+ Any aRet;
+ Sequence< sal_Int16 > aOutArgsIndex;
+ Sequence< Any > aOutArgs;
+
+ OSL_TRACE( "SwDoc::ExecMacro URL is %s", ByteString( rMacro.GetMacName(),
+ RTL_TEXTENCODING_UTF8).GetBuffer() );
+
+ eErr = pDocShell->CallXScript(
+ rMacro.GetMacName(), *pUnoArgs, aRet, aOutArgsIndex, aOutArgs);
+
+ //*pRet = pRetValue->GetString();
+ // use the AnyConverter to return a String if appropriate?
+
+ // need to call something like lcl_translateUno2Basic
+ // pArgs = lcl_translateUno2Basic( pUnoArgs );
+
+ delete pUnoArgs;
+ break;
+ }
+ }
+
+ return 0 == eErr;
+}
+
+
+
+sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
+ sal_Bool bCheckPtr, SbxArray* pArgs, const Link* )
+{
+ if( !pDocShell ) // ohne DocShell geht das nicht!
+ return 0;
+
+ sal_uInt16 nRet = 0;
+ const SvxMacroTableDtor* pTbl = 0;
+ switch( rCallEvent.eType )
+ {
+ case EVENT_OBJECT_INETATTR:
+ if( bCheckPtr )
+ {
+ const SfxPoolItem* pItem;
+ sal_uInt32 n, nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT );
+ for( n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_INETFMT, n ) )
+ && rCallEvent.PTR.pINetAttr == pItem )
+ {
+ bCheckPtr = sal_False; // als Flag missbrauchen
+ break;
+ }
+ }
+ if( !bCheckPtr )
+ pTbl = rCallEvent.PTR.pINetAttr->GetMacroTbl();
+ break;
+
+ case EVENT_OBJECT_URLITEM:
+ case EVENT_OBJECT_IMAGE:
+ {
+ const SwFrmFmtPtr pFmt = (SwFrmFmtPtr)rCallEvent.PTR.pFmt;
+ if( bCheckPtr )
+ {
+ sal_uInt16 nPos = GetSpzFrmFmts()->GetPos( pFmt );
+ if( USHRT_MAX != nPos )
+ bCheckPtr = sal_False; // als Flag missbrauchen
+ }
+ if( !bCheckPtr )
+ pTbl = &pFmt->GetMacro().GetMacroTable();
+ }
+ break;
+
+ case EVENT_OBJECT_IMAGEMAP:
+ {
+ const IMapObject* pIMapObj = rCallEvent.PTR.IMAP.pIMapObj;
+ if( bCheckPtr )
+ {
+ const SwFrmFmtPtr pFmt = (SwFrmFmtPtr)rCallEvent.PTR.IMAP.pFmt;
+ sal_uInt16 nPos = GetSpzFrmFmts()->GetPos( pFmt );
+ const ImageMap* pIMap;
+ if( USHRT_MAX != nPos &&
+ 0 != (pIMap = pFmt->GetURL().GetMap()) )
+ {
+ for( nPos = pIMap->GetIMapObjectCount(); nPos; )
+ if( pIMapObj == pIMap->GetIMapObject( --nPos ))
+ {
+ bCheckPtr = sal_False; // als Flag missbrauchen
+ break;
+ }
+ }
+ }
+ if( !bCheckPtr )
+ pTbl = &pIMapObj->GetMacroTable();
+ }
+ break;
+ default:
+ break;
+ }
+
+ if( pTbl )
+ {
+ nRet = 0x1;
+ if( pTbl->IsKeyValid( nEvent ) )
+ {
+ const SvxMacro& rMacro = *pTbl->Get( nEvent );
+ if( STARBASIC == rMacro.GetScriptType() )
+ {
+ nRet += 0 == pDocShell->CallBasic( rMacro.GetMacName(),
+ rMacro.GetLibName(), pArgs ) ? 1 : 0;
+ }
+ else if( EXTENDED_STYPE == rMacro.GetScriptType() )
+ {
+ Sequence<Any> *pUnoArgs = 0;
+
+ if( pArgs )
+ {
+ pUnoArgs = lcl_docbasic_convertArgs( *pArgs );
+ }
+
+ if (!pUnoArgs)
+ {
+ pUnoArgs = new Sequence <Any> (0);
+ }
+
+ Any aRet;
+ Sequence< sal_Int16 > aOutArgsIndex;
+ Sequence< Any > aOutArgs;
+
+ OSL_TRACE( "SwDoc::CallEvent URL is %s", ByteString(
+ rMacro.GetMacName(), RTL_TEXTENCODING_UTF8).GetBuffer() );
+
+ nRet += 0 == pDocShell->CallXScript(
+ rMacro.GetMacName(), *pUnoArgs,aRet, aOutArgsIndex, aOutArgs) ? 1 : 0;
+
+ //*pRet = pRetValue->GetString();
+ // use the AnyConverter to return a String if appropriate?
+
+ // need to call something like lcl_translateUno2Basic
+ // pArgs = lcl_translateUno2Basic( pUnoArgs );
+
+ delete pUnoArgs;
+ }
+ // JavaScript calls are ignored
+ }
+ }
+ return nRet;
+}
+
+
+
+
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
new file mode 100644
index 000000000000..f0cc94b6ee19
--- /dev/null
+++ b/sw/source/core/doc/docbm.cxx
@@ -0,0 +1,1746 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <MarkManager.hxx>
+#include <bookmrk.hxx>
+#include <boost/bind.hpp>
+#include <cntfrm.hxx>
+#include <crossrefbookmark.hxx>
+#include <dcontact.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <xmloff/odffields.hxx>
+#include <editsh.hxx>
+#include <errhdl.hxx>
+#include <fmtanchr.hxx>
+#include <frmfmt.hxx>
+#include <functional>
+#include <hintids.hxx>
+#include <mvsave.hxx>
+#include <ndtxt.hxx>
+#include <node.hxx>
+#include <pam.hxx>
+#include <redline.hxx>
+#include <rolbck.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <sortedobjs.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <swserv.hxx>
+#include <swundo.hxx>
+#include <tools/pstm.hxx>
+#include <unocrsr.hxx>
+#include <viscrs.hxx>
+#include <stdio.h>
+
+
+using namespace ::std;
+using namespace ::boost;
+using namespace ::sw::mark;
+
+namespace
+{
+ static bool lcl_GreaterThan( const SwPosition& rPos, const SwNodeIndex& rNdIdx, const SwIndex* pIdx )
+ {
+ return pIdx ? ( rPos.nNode > rNdIdx || ( rPos.nNode == rNdIdx && rPos.nContent >= pIdx->GetIndex() )) : rPos.nNode >= rNdIdx;
+ }
+
+ static bool lcl_Lower( const SwPosition& rPos, const SwNodeIndex& rNdIdx, const SwIndex* pIdx )
+ {
+ return rPos.nNode < rNdIdx || ( pIdx && rPos.nNode == rNdIdx && rPos.nContent < pIdx->GetIndex() );
+ }
+
+ static bool lcl_MarkOrderingByStart(const IDocumentMarkAccess::pMark_t& rpFirst,
+ const IDocumentMarkAccess::pMark_t& rpSecond)
+ {
+ return rpFirst->GetMarkStart() < rpSecond->GetMarkStart();
+ }
+
+ static bool lcl_MarkOrderingByEnd(const IDocumentMarkAccess::pMark_t& rpFirst,
+ const IDocumentMarkAccess::pMark_t& rpSecond)
+ {
+ return rpFirst->GetMarkEnd() < rpSecond->GetMarkEnd();
+ }
+
+ static void lcl_InsertMarkSorted(IDocumentMarkAccess::container_t& io_vMarks,
+ const IDocumentMarkAccess::pMark_t& pMark)
+ {
+ io_vMarks.insert(
+ lower_bound(
+ io_vMarks.begin(),
+ io_vMarks.end(),
+ pMark,
+ &lcl_MarkOrderingByStart),
+ pMark);
+ }
+
+ static inline auto_ptr<SwPosition> lcl_PositionFromCntntNode(SwCntntNode * const pCntntNode, const bool bAtEnd=false)
+ {
+ auto_ptr<SwPosition> pResult(new SwPosition(*pCntntNode));
+ pResult->nContent.Assign(pCntntNode, bAtEnd ? pCntntNode->Len() : 0);
+ return pResult;
+ }
+
+ // return a position at the begin of rEnd, if it is a CntntNode
+ // else set it to the begin of the Node after rEnd, if there is one
+ // else set it to the end of the node before rStt
+ // else set it to the CntntNode of the Pos outside the Range
+ static inline auto_ptr<SwPosition> lcl_FindExpelPosition(const SwNodeIndex& rStt,
+ const SwNodeIndex& rEnd,
+ const SwPosition& rOtherPosition)
+ {
+ SwCntntNode * pNode = rEnd.GetNode().GetCntntNode();
+ SwNodeIndex aStt = SwNodeIndex(rStt);
+ SwNodeIndex aEnd = SwNodeIndex(rEnd);
+ bool bAtEnd = false;
+ if(!pNode)
+ pNode = rEnd.GetNodes().GoNext(&aEnd), bAtEnd = false;
+ if(!pNode)
+ pNode = rStt.GetNodes().GoPrevious(&aStt), bAtEnd = true;
+ if(pNode)
+ return lcl_PositionFromCntntNode(pNode, bAtEnd);
+ return auto_ptr<SwPosition>(new SwPosition(rOtherPosition));
+ };
+
+ static IMark* lcl_getMarkAfter(const IDocumentMarkAccess::container_t& rMarks, const SwPosition& rPos)
+ {
+ IDocumentMarkAccess::const_iterator_t pMarkAfter = upper_bound(
+ rMarks.begin(),
+ rMarks.end(),
+ rPos,
+ bind(&IMark::StartsAfter, _2, _1)); // finds the first that is starting after
+ if(pMarkAfter == rMarks.end()) return NULL;
+ return pMarkAfter->get();
+ };
+
+ static IMark* lcl_getMarkBefore(const IDocumentMarkAccess::container_t& rMarks, const SwPosition& rPos)
+ {
+ // candidates from which to choose the mark before
+ IDocumentMarkAccess::container_t vCandidates;
+ // no need to consider marks starting after rPos
+ IDocumentMarkAccess::const_iterator_t pCandidatesEnd = upper_bound(
+ rMarks.begin(),
+ rMarks.end(),
+ rPos,
+ bind(&IMark::StartsAfter, _2, _1));
+ vCandidates.reserve(pCandidatesEnd - rMarks.begin());
+ // only marks ending before are candidates
+ remove_copy_if(
+ rMarks.begin(),
+ pCandidatesEnd,
+ back_inserter(vCandidates),
+ bind(logical_not<bool>(), bind(&IMark::EndsBefore, _1, rPos)));
+ // no candidate left => we are in front of the first mark or there are none
+ if(!vCandidates.size()) return NULL;
+ // return the highest (last) candidate using mark end ordering
+ return max_element(vCandidates.begin(), vCandidates.end(), &lcl_MarkOrderingByEnd)->get();
+ }
+
+ static bool lcl_FixCorrectedMark(bool bChangedPos, bool bChangedOPos, MarkBase* io_pMark)
+ {
+ if( (bChangedPos || bChangedOPos) && io_pMark->IsExpanded() &&
+ io_pMark->GetOtherMarkPos().nNode.GetNode().FindTableBoxStartNode() !=
+ io_pMark->GetMarkPos().nNode.GetNode().FindTableBoxStartNode() )
+ {
+ if(!bChangedOPos)
+ io_pMark->SetMarkPos(io_pMark->GetOtherMarkPos());
+ io_pMark->ClearOtherMarkPos();
+ DdeBookmark * const pDdeBkmk = dynamic_cast< DdeBookmark*>(io_pMark);
+ if(pDdeBkmk && pDdeBkmk->IsServer())
+ pDdeBkmk->SetRefObject(NULL);
+ return true;
+ }
+ return false;
+ }
+
+ static IDocumentMarkAccess::iterator_t lcl_FindMark(
+ IDocumentMarkAccess::container_t& rMarks,
+ const IDocumentMarkAccess::pMark_t& rpMarkToFind)
+ {
+ IDocumentMarkAccess::iterator_t ppCurrentMark = lower_bound(
+ rMarks.begin(), rMarks.end(),
+ rpMarkToFind, &lcl_MarkOrderingByStart);
+ // since there are usually not too many marks on the same start
+ // position, we are not doing a bisect search for the upper bound
+ // but instead start to iterate from pMarkLow directly
+ while(ppCurrentMark != rMarks.end() && **ppCurrentMark == *rpMarkToFind)
+ {
+ if(ppCurrentMark->get() == rpMarkToFind.get())
+ {
+ //OSL_TRACE("found mark named '%s'",
+ // ::rtl::OUStringToOString(ppCurrentMark->get()->GetName(), RTL_TEXTENCODING_UTF8).getStr());
+ return ppCurrentMark;
+ }
+ ++ppCurrentMark;
+ }
+ // reached a mark starting on a later start pos or the end of the
+ // vector => not found
+ return rMarks.end();
+ };
+
+ static IDocumentMarkAccess::iterator_t lcl_FindMarkAtPos(
+ IDocumentMarkAccess::container_t& rMarks,
+ const SwPosition& rPos,
+ const IDocumentMarkAccess::MarkType eType)
+ {
+ for(IDocumentMarkAccess::iterator_t ppCurrentMark = lower_bound(
+ rMarks.begin(), rMarks.end(),
+ rPos,
+ bind(&IMark::StartsBefore, _1, _2));
+ ppCurrentMark != rMarks.end();
+ ++ppCurrentMark)
+ {
+ // Once we reach a mark starting after the target pos
+ // we do not need to continue
+ if(ppCurrentMark->get()->StartsAfter(rPos))
+ break;
+ if(IDocumentMarkAccess::GetType(**ppCurrentMark) == eType)
+ {
+ //OSL_TRACE("found mark named '%s'",
+ // ::rtl::OUStringToOString(ppCurrentMark->get()->GetName(), RTL_TEXTENCODING_UTF8).getStr());
+ return ppCurrentMark;
+ }
+ }
+ // reached a mark starting on a later start pos or the end of the
+ // vector => not found
+ return rMarks.end();
+ };
+
+ static IDocumentMarkAccess::const_iterator_t lcl_FindMarkByName(
+ const ::rtl::OUString& rName,
+ IDocumentMarkAccess::const_iterator_t ppMarksBegin,
+ IDocumentMarkAccess::const_iterator_t ppMarksEnd)
+ {
+ return find_if(
+ ppMarksBegin,
+ ppMarksEnd,
+ bind(&::rtl::OUString::equals, bind(&IMark::GetName, _1), rName));
+ }
+
+#if 0
+ static void lcl_DebugMarks(IDocumentMarkAccess::container_t vMarks)
+ {
+ OSL_TRACE("%d Marks", vMarks.size());
+ for(IDocumentMarkAccess::iterator_t ppMark = vMarks.begin();
+ ppMark != vMarks.end();
+ ppMark++)
+ {
+ IMark* pMark = ppMark->get();
+ ::rtl::OString sName = ::rtl::OUStringToOString(pMark->GetName(), RTL_TEXTENCODING_UTF8);
+ const SwPosition* const pStPos = &pMark->GetMarkStart();
+ const SwPosition* const pEndPos = &pMark->GetMarkEnd();
+ OSL_TRACE("%s %s %d,%d %d,%d",
+ typeid(*pMark).name(),
+ sName.getStr(),
+ pStPos->nNode.GetIndex(),
+ pStPos->nContent.GetIndex(),
+ pEndPos->nNode.GetIndex(),
+ pEndPos->nContent.GetIndex());
+ }
+ };
+#endif
+}
+
+IDocumentMarkAccess::MarkType IDocumentMarkAccess::GetType(const IMark& rBkmk)
+{
+ const std::type_info* const pMarkTypeInfo = &typeid(rBkmk);
+ // not using dynamic_cast<> here for performance
+ if(*pMarkTypeInfo == typeid(UnoMark))
+ return UNO_BOOKMARK;
+ else if(*pMarkTypeInfo == typeid(DdeBookmark))
+ return DDE_BOOKMARK;
+ else if(*pMarkTypeInfo == typeid(Bookmark))
+ return BOOKMARK;
+ else if(*pMarkTypeInfo == typeid(CrossRefHeadingBookmark))
+ return CROSSREF_HEADING_BOOKMARK;
+ else if(*pMarkTypeInfo == typeid(CrossRefNumItemBookmark))
+ return CROSSREF_NUMITEM_BOOKMARK;
+ else if(*pMarkTypeInfo == typeid(TextFieldmark))
+ return TEXT_FIELDMARK;
+ else if(*pMarkTypeInfo == typeid(CheckboxFieldmark))
+ return CHECKBOX_FIELDMARK;
+ else if(*pMarkTypeInfo == typeid(NavigatorReminder))
+ return NAVIGATOR_REMINDER;
+ else
+ {
+ OSL_ENSURE(false,
+ "IDocumentMarkAccess::GetType(..)"
+ " - unknown MarkType. This needs to be fixed!");
+ return UNO_BOOKMARK;
+ }
+}
+
+namespace sw { namespace mark
+{
+ MarkManager::MarkManager(SwDoc& rDoc)
+ : m_pDoc(&rDoc)
+ { }
+#if OSL_DEBUG_LEVEL > 1
+ void MarkManager::dumpFieldmarks( ) const
+ {
+ const_iterator_t pIt = m_vFieldmarks.begin();
+ for (; pIt != m_vFieldmarks.end( ); pIt++)
+ {
+ rtl::OUString str = (*pIt)->ToString();
+ OSL_TRACE("%s\n",
+ ::rtl::OUStringToOString(str, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+#endif
+ ::sw::mark::IMark* MarkManager::makeMark(const SwPaM& rPaM,
+ const ::rtl::OUString& rName,
+ const IDocumentMarkAccess::MarkType eType)
+ {
+#if 0
+ {
+ ::rtl::OString sName = ::rtl::OUStringToOString(rName, RTL_TEXTENCODING_UTF8);
+ const SwPosition* const pPos1 = rPaM.GetPoint();
+ const SwPosition* pPos2 = pPos1;
+ if(rPaM.HasMark())
+ pPos2 = rPaM.GetMark();
+ OSL_TRACE("%s %d,%d %d,%d",
+ sName.getStr(),
+ pPos1->nNode.GetIndex(),
+ pPos1->nContent.GetIndex(),
+ pPos2->nNode.GetIndex(),
+ pPos2->nContent.GetIndex());
+ }
+#endif
+ // see for example _SaveCntntIdx, Shells
+ OSL_PRECOND(m_vMarks.size() < USHRT_MAX,
+ "MarkManager::makeMark(..)"
+ " - more than USHRT_MAX marks are not supported correctly");
+ // There should only be one CrossRefBookmark per Textnode per Type
+ OSL_PRECOND(
+ (eType != CROSSREF_NUMITEM_BOOKMARK && eType != CROSSREF_HEADING_BOOKMARK)
+ || (lcl_FindMarkAtPos(m_vBookmarks, *rPaM.GetPoint(), eType) == m_vBookmarks.end()),
+ "MarkManager::makeMark(..)"
+ " - creating duplicate CrossRefBookmark");
+
+ // create mark
+ pMark_t pMark;
+ switch(eType)
+ {
+ case IDocumentMarkAccess::TEXT_FIELDMARK:
+ pMark = shared_ptr<IMark>(new TextFieldmark(rPaM));
+ break;
+ case IDocumentMarkAccess::CHECKBOX_FIELDMARK:
+ pMark = shared_ptr<IMark>(new CheckboxFieldmark(rPaM));
+ break;
+ case IDocumentMarkAccess::NAVIGATOR_REMINDER:
+ pMark = shared_ptr<IMark>(new NavigatorReminder(rPaM));
+ break;
+ case IDocumentMarkAccess::BOOKMARK:
+ pMark = shared_ptr<IMark>(new Bookmark(rPaM, KeyCode(), rName, ::rtl::OUString()));
+ break;
+ case IDocumentMarkAccess::DDE_BOOKMARK:
+ pMark = shared_ptr<IMark>(new DdeBookmark(rPaM));
+ break;
+ case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK:
+ pMark = shared_ptr<IMark>(new CrossRefHeadingBookmark(rPaM, KeyCode(), rName, ::rtl::OUString()));
+ break;
+ case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK:
+ pMark = shared_ptr<IMark>(new CrossRefNumItemBookmark(rPaM, KeyCode(), rName, ::rtl::OUString()));
+ break;
+ case IDocumentMarkAccess::UNO_BOOKMARK:
+ pMark = shared_ptr<IMark>(new UnoMark(rPaM));
+ break;
+ }
+ OSL_ENSURE(pMark.get(),
+ "MarkManager::makeMark(..)"
+ " - Mark was not created.");
+ MarkBase* pMarkBase = dynamic_cast<MarkBase*>(pMark.get());
+
+ if(pMark->GetMarkPos() != pMark->GetMarkStart())
+ pMarkBase->Swap();
+
+ // for performance reasons, we trust UnoMarks to have a (generated) unique name
+ if(eType != IDocumentMarkAccess::UNO_BOOKMARK)
+ pMarkBase->SetName(getUniqueMarkName(pMarkBase->GetName()));
+
+ // register mark
+ lcl_InsertMarkSorted(m_vMarks, pMark);
+ switch(eType)
+ {
+ case IDocumentMarkAccess::BOOKMARK:
+ case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK:
+ case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK:
+ // if(dynamic_cast<IBookmark*>)
+ lcl_InsertMarkSorted(m_vBookmarks, pMark);
+ break;
+ case IDocumentMarkAccess::TEXT_FIELDMARK:
+ case IDocumentMarkAccess::CHECKBOX_FIELDMARK:
+ // if(dynamic_cast<IFieldmark*>
+ lcl_InsertMarkSorted(m_vFieldmarks, pMark);
+ break;
+ case IDocumentMarkAccess::NAVIGATOR_REMINDER:
+ case IDocumentMarkAccess::DDE_BOOKMARK:
+ case IDocumentMarkAccess::UNO_BOOKMARK:
+ // no special array for these
+ break;
+ }
+ pMarkBase->InitDoc(m_pDoc);
+#if 0
+ OSL_TRACE("--- makeType ---");
+ OSL_TRACE("Marks");
+ lcl_DebugMarks(m_vMarks);
+ OSL_TRACE("Bookmarks");
+ lcl_DebugMarks(m_vBookmarks);
+ OSL_TRACE("Fieldmarks");
+ lcl_DebugMarks(m_vFieldmarks);
+#endif
+ return pMark.get();
+ }
+
+ ::sw::mark::IFieldmark* MarkManager::makeFieldBookmark( const SwPaM& rPaM,
+ const rtl::OUString& rName,
+ const rtl::OUString& rType )
+ {
+ sw::mark::IMark* pMark = makeMark( rPaM, rName,
+ IDocumentMarkAccess::TEXT_FIELDMARK );
+ sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark );
+ pFieldMark->SetFieldname( rType );
+
+ return pFieldMark;
+ }
+
+ ::sw::mark::IFieldmark* MarkManager::makeNoTextFieldBookmark( const SwPaM& rPaM,
+ const rtl::OUString& rName,
+ const rtl::OUString& rType)
+ {
+ sw::mark::IMark* pMark = makeMark( rPaM, rName,
+ IDocumentMarkAccess::CHECKBOX_FIELDMARK );
+ sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark );
+ pFieldMark->SetFieldname( rType );
+
+ return pFieldMark;
+ }
+
+ ::sw::mark::IMark* MarkManager::getMarkForTxtNode(const SwTxtNode& rTxtNode,
+ const IDocumentMarkAccess::MarkType eType)
+ {
+ SwPosition aPos(rTxtNode);
+ aPos.nContent.Assign(&(const_cast<SwTxtNode&>(rTxtNode)), 0);
+ const iterator_t ppExistingMark = lcl_FindMarkAtPos(m_vBookmarks, aPos, eType);
+ if(ppExistingMark != m_vBookmarks.end())
+ return ppExistingMark->get();
+ const SwPaM aPaM(aPos);
+ return makeMark(aPaM, ::rtl::OUString(), eType);
+ }
+
+ void MarkManager::repositionMark( ::sw::mark::IMark* const io_pMark,
+ const SwPaM& rPaM)
+ {
+ OSL_PRECOND(io_pMark->GetMarkPos().GetDoc() == m_pDoc,
+ "<MarkManager::repositionMark(..)>"
+ " - Mark is not in my doc.");
+ MarkBase* const pMarkBase = dynamic_cast< MarkBase* >(io_pMark);
+ pMarkBase->SetMarkPos(*(rPaM.GetPoint()));
+ if(rPaM.HasMark())
+ pMarkBase->SetOtherMarkPos(*(rPaM.GetMark()));
+ else
+ pMarkBase->ClearOtherMarkPos();
+
+ if(pMarkBase->GetMarkPos() != pMarkBase->GetMarkStart())
+ pMarkBase->Swap();
+
+ sortMarks();
+ }
+
+ bool MarkManager::renameMark(::sw::mark::IMark* io_pMark, const ::rtl::OUString& rNewName)
+ {
+ OSL_PRECOND(io_pMark->GetMarkPos().GetDoc() == m_pDoc,
+ "<MarkManager::repositionMark(..)>"
+ " - Mark is not in my doc.");
+ if(io_pMark->GetName() == rNewName)
+ return true;
+ if(findMark(rNewName) != getMarksEnd())
+ return false;
+ dynamic_cast< ::sw::mark::MarkBase* >(io_pMark)->SetName(rNewName);
+ return true;
+ }
+
+ void MarkManager::correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset)
+ {
+ const SwNode* const pOldNode = &rOldNode.GetNode();
+ SwPosition aNewPos(rNewPos);
+ aNewPos.nContent += nOffset;
+ bool isSortingNeeded = false;
+ for(iterator_t ppMark = m_vMarks.begin();
+ ppMark != m_vMarks.end();
+ ppMark++)
+ {
+ // is on position ??
+ bool bChangedPos = false, bChangedOPos = false;
+ ::sw::mark::MarkBase* pMark = dynamic_cast< ::sw::mark::MarkBase* >(ppMark->get());
+ if(&pMark->GetMarkPos().nNode.GetNode() == pOldNode)
+ {
+ pMark->SetMarkPos(aNewPos);
+ bChangedPos = true;
+ }
+ if (pMark->IsExpanded() &&
+ &pMark->GetOtherMarkPos().nNode.GetNode() == pOldNode)
+ {
+ pMark->SetMarkPos(aNewPos);
+ bChangedOPos= true;
+ }
+ // illegal selection? collapse the mark and restore sorting later
+ isSortingNeeded |= lcl_FixCorrectedMark(bChangedPos, bChangedOPos, pMark);
+ }
+ // restore sorting if needed
+ if(isSortingNeeded)
+ sortMarks();
+#if 0
+ OSL_TRACE("correctMarksAbsolute");
+ lcl_DebugMarks(m_vMarks);
+#endif
+ }
+
+ void MarkManager::correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset)
+ {
+ const SwNode* const pOldNode = &rOldNode.GetNode();
+ SwPosition aNewPos(rNewPos);
+ aNewPos.nContent += nOffset;
+ bool isSortingNeeded = false;
+ for(iterator_t ppMark = m_vMarks.begin();
+ ppMark != m_vMarks.end();
+ ppMark++)
+ {
+ // is on position ??
+ bool bChangedPos = false, bChangedOPos = false;
+ ::sw::mark::MarkBase* const pMark = dynamic_cast< ::sw::mark::MarkBase* >(ppMark->get());
+ if(&pMark->GetMarkPos().nNode.GetNode() == pOldNode)
+ {
+ SwPosition aNewPosRel(aNewPos);
+ aNewPosRel.nContent += pMark->GetMarkPos().nContent.GetIndex();
+ pMark->SetMarkPos(aNewPosRel);
+ bChangedPos = true;
+ }
+ if(pMark->IsExpanded() &&
+ &pMark->GetOtherMarkPos().nNode.GetNode() == pOldNode)
+ {
+ SwPosition aNewPosRel(aNewPos);
+ aNewPosRel.nContent += pMark->GetOtherMarkPos().nContent.GetIndex();
+ pMark->SetOtherMarkPos(aNewPosRel);
+ bChangedOPos = true;
+ }
+ // illegal selection? collapse the mark and restore sorting later
+ isSortingNeeded |= lcl_FixCorrectedMark(bChangedPos, bChangedOPos, pMark);
+ }
+ // restore sorting if needed
+ if(isSortingNeeded)
+ sortMarks();
+#if 0
+ OSL_TRACE("correctMarksRelative");
+ lcl_DebugMarks(m_vMarks);
+#endif
+ }
+
+ void MarkManager::deleteMarks(
+ const SwNodeIndex& rStt,
+ const SwNodeIndex& rEnd,
+ ::std::vector<SaveBookmark>* pSaveBkmk,
+ const SwIndex* pSttIdx,
+ const SwIndex* pEndIdx )
+ {
+ vector<const_iterator_t> vMarksToDelete;
+ bool isSortingNeeded = false;
+ // copy all bookmarks in the move area to a vector storing all position data as offset
+ // reassignment is performed after the move
+ for(iterator_t ppMark = m_vMarks.begin();
+ ppMark != m_vMarks.end();
+ ppMark++)
+ {
+ // navigator marks should not be moved
+ // TODO: Check if this might make them invalid
+ if(IDocumentMarkAccess::GetType(**ppMark) == NAVIGATOR_REMINDER)
+ continue;
+
+ ::sw::mark::MarkBase* pMark = dynamic_cast< ::sw::mark::MarkBase* >(ppMark->get());
+ // on position ??
+ bool isPosInRange = (lcl_GreaterThan(pMark->GetMarkPos(), rStt, pSttIdx) &&
+ lcl_Lower(pMark->GetMarkPos(), rEnd, pEndIdx));
+ bool isOtherPosInRange = (pMark->IsExpanded() &&
+ lcl_GreaterThan(pMark->GetOtherMarkPos(), rStt, pSttIdx) &&
+ lcl_Lower(pMark->GetOtherMarkPos(), rEnd, pEndIdx));
+ // special case: completely in range, touching the end?
+ if(pEndIdx &&
+ ((isOtherPosInRange
+ && pMark->GetMarkPos().nNode == rEnd
+ && pMark->GetMarkPos().nContent == *pEndIdx)
+ || (isPosInRange
+ && pMark->IsExpanded()
+ && pMark->GetOtherMarkPos().nNode == rEnd
+ && pMark->GetOtherMarkPos().nContent == *pEndIdx)))
+ {
+ isPosInRange = true, isOtherPosInRange = true;
+ }
+
+ if(isPosInRange && (isOtherPosInRange || !pMark->IsExpanded()))
+ {
+ // completely in range
+
+ // --> 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)
+ {
+ // the bookmark is partitially in the range
+ // move position of that is in the range out of it
+ auto_ptr<SwPosition> pNewPos;
+ if(pEndIdx)
+ pNewPos = auto_ptr<SwPosition>(new SwPosition(
+ rEnd,
+ *pEndIdx));
+ else
+ pNewPos = lcl_FindExpelPosition(
+ rStt,
+ rEnd,
+ isPosInRange ? pMark->GetOtherMarkPos() : pMark->GetMarkPos());
+
+ // --> 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);
+ }
+ // <--
+ }
+ }
+
+ // we just remembered the iterators to delete, so we do not need to search
+ // for the shared_ptr<> (the entry in m_vMarks) again
+ // reverse iteration, since erasing an entry invalidates iterators
+ // behind it (the iterators in vMarksToDelete are sorted)
+ for(vector<const_iterator_t>::reverse_iterator pppMark = vMarksToDelete.rbegin();
+ pppMark != vMarksToDelete.rend();
+ pppMark++)
+ {
+ deleteMark(*pppMark);
+ }
+ if(isSortingNeeded)
+ sortMarks();
+#if 0
+ OSL_TRACE("deleteMarks");
+ lcl_DebugMarks(m_vMarks);
+#endif
+ }
+
+ void MarkManager::deleteMark(const const_iterator_t ppMark)
+ {
+ if(ppMark == m_vMarks.end()) return;
+
+ switch(IDocumentMarkAccess::GetType(**ppMark))
+ {
+ case IDocumentMarkAccess::BOOKMARK:
+ case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK:
+ case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK:
+ // if(dynamic_cast<IBookmark*>)
+ {
+ IDocumentMarkAccess::iterator_t ppBookmark = lcl_FindMark(m_vBookmarks, *ppMark);
+ OSL_ENSURE(ppBookmark != m_vBookmarks.end(),
+ "<MarkManager::deleteMark(..)>"
+ " - Bookmark not found.");
+ m_vBookmarks.erase(ppBookmark);
+ break;
+ }
+ case IDocumentMarkAccess::TEXT_FIELDMARK:
+ case IDocumentMarkAccess::CHECKBOX_FIELDMARK:
+ // if(dynamic_cast<IFieldmark*>
+ {
+ IDocumentMarkAccess::iterator_t ppFieldmark = lcl_FindMark(m_vFieldmarks, *ppMark);
+ OSL_ENSURE(ppFieldmark != m_vFieldmarks.end(),
+ "<MarkManager::deleteMark(..)>"
+ " - Bookmark not found.");
+ m_vFieldmarks.erase(ppFieldmark);
+ break;
+ }
+ case IDocumentMarkAccess::NAVIGATOR_REMINDER:
+ case IDocumentMarkAccess::DDE_BOOKMARK:
+ case IDocumentMarkAccess::UNO_BOOKMARK:
+ // no special array for these
+ break;
+ }
+ DdeBookmark* const pDdeBookmark = dynamic_cast<DdeBookmark*>(ppMark->get());
+ if(pDdeBookmark)
+ pDdeBookmark->DeregisterFromDoc(m_pDoc);
+ m_vMarks.erase(m_vMarks.begin() + (ppMark - m_vMarks.begin())); // clumsy const-cast
+ }
+
+ void MarkManager::deleteMark(const IMark* const pMark)
+ {
+ OSL_PRECOND(pMark->GetMarkPos().GetDoc() == m_pDoc,
+ "<MarkManager::repositionMark(..)>"
+ " - Mark is not in my doc.");
+ // finds the last Mark that is starting before pMark
+ // (pMarkLow < pMark)
+ iterator_t pMarkLow = lower_bound(
+ m_vMarks.begin(), m_vMarks.end(),
+ pMark->GetMarkStart(),
+ bind(&IMark::StartsBefore, _1, _2));
+ // finds the first Mark that pMark is starting before
+ // (pMark < pMarkHigh)
+ //iterator_t pMarkHigh = upper_bound(
+ // pMarkLow, m_vMarks.end(),
+ // pMark->GetMarkStart(),
+ // bind(&IMark::StartsBefore, _2, _1));
+ // since it should be rare that pMark isnt found at all
+ // we skip the bisect search on the upper bound
+ iterator_t pMarkHigh = m_vMarks.end();
+ iterator_t pMarkFound = find_if(
+ pMarkLow, pMarkHigh,
+ bind(equal_to<const IMark*>(), bind(&shared_ptr<IMark>::get, _1), pMark));
+ if(pMarkFound != pMarkHigh)
+ deleteMark(pMarkFound);
+ }
+
+ void MarkManager::clearAllMarks()
+ {
+ m_vFieldmarks.clear();
+ m_vBookmarks.clear();
+#ifdef DEBUG
+ for(iterator_t pBkmk = m_vMarks.begin();
+ pBkmk != m_vMarks.end();
+ ++pBkmk)
+ OSL_ENSURE(pBkmk->unique(),
+ "<MarkManager::clearAllMarks(..)>"
+ " - a Bookmark is still in use.");
+#endif
+ m_vMarks.clear();
+ }
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::findMark(const ::rtl::OUString& rName) const
+ {
+ return lcl_FindMarkByName(rName, m_vMarks.begin(), m_vMarks.end());
+ }
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::findBookmark(const ::rtl::OUString& rName) const
+ {
+ return lcl_FindMarkByName(rName, m_vBookmarks.begin(), m_vBookmarks.end());
+ }
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::getMarksBegin() const
+ { return m_vMarks.begin(); }
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::getMarksEnd() const
+ { return m_vMarks.end(); }
+
+ sal_Int32 MarkManager::getMarksCount() const
+ { return m_vMarks.size(); }
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::getBookmarksBegin() const
+ { return m_vBookmarks.begin(); }
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::getBookmarksEnd() const
+ { return m_vBookmarks.end(); }
+
+ sal_Int32 MarkManager::getBookmarksCount() const
+ { return m_vBookmarks.size(); }
+
+ IFieldmark* MarkManager::getFieldmarkFor(const SwPosition& rPos) const
+ {
+ const_iterator_t pFieldmark = find_if(
+ m_vFieldmarks.begin(),
+ m_vFieldmarks.end( ),
+ bind(&IMark::IsCoveringPosition, _1, rPos));
+ if(pFieldmark == m_vFieldmarks.end()) return NULL;
+ return dynamic_cast<IFieldmark*>(pFieldmark->get());
+ }
+
+ IFieldmark* MarkManager::getFieldmarkAfter(const SwPosition& rPos) const
+ { return dynamic_cast<IFieldmark*>(lcl_getMarkAfter(m_vFieldmarks, rPos)); }
+
+ IFieldmark* MarkManager::getFieldmarkBefore(const SwPosition& rPos) const
+ { return dynamic_cast<IFieldmark*>(lcl_getMarkBefore(m_vFieldmarks, rPos)); }
+
+ ::rtl::OUString MarkManager::getUniqueMarkName(const ::rtl::OUString& rName) const
+ {
+ OSL_ENSURE(rName.getLength(),
+ "<MarkManager::getUniqueMarkName(..)>"
+ " - a name should be proposed");
+ if(findMark(rName) == getMarksEnd()) return rName;
+ ::rtl::OUStringBuffer sBuf;
+ ::rtl::OUString sTmp;
+ for(sal_Int32 nCnt = 1; nCnt < SAL_MAX_INT32; nCnt++)
+ {
+ sTmp = sBuf.append(rName).append(nCnt).makeStringAndClear();
+ if(findMark(sTmp) == getMarksEnd()) break;
+ }
+ return sTmp;
+ }
+
+ void MarkManager::sortMarks()
+ {
+ sort(m_vMarks.begin(), m_vMarks.end(), &lcl_MarkOrderingByStart);
+ sort(m_vBookmarks.begin(), m_vBookmarks.end(), &lcl_MarkOrderingByStart);
+ sort(m_vFieldmarks.begin(), m_vFieldmarks.end(), &lcl_MarkOrderingByStart);
+ }
+
+}} // namespace ::sw::mark
+
+
+// old implementation
+
+//SV_IMPL_OP_PTRARR_SORT(SwBookmarks, SwBookmarkPtr)
+
+#define PCURCRSR (_pCurrCrsr)
+#define FOREACHPAM_START(pSttCrsr) \
+ {\
+ SwPaM *_pStartCrsr = pSttCrsr, *_pCurrCrsr = pSttCrsr; \
+ do {
+
+#define FOREACHPAM_END() \
+ } while( (_pCurrCrsr=(SwPaM *)_pCurrCrsr->GetNext()) != _pStartCrsr ); \
+ }
+#define PCURSH ((SwCrsrShell*)_pStartShell)
+#define FOREACHSHELL_START( pEShell ) \
+ {\
+ ViewShell *_pStartShell = pEShell; \
+ do { \
+ if( _pStartShell->IsA( TYPE( SwCrsrShell )) ) \
+ {
+
+#define FOREACHSHELL_END( pEShell ) \
+ } \
+ } while((_pStartShell=(ViewShell*)_pStartShell->GetNext())!= pEShell ); \
+ }
+
+namespace
+{
+ // Aufbau vom Array: 2 longs,
+ // 1. Long enthaelt Type und Position im DocArray,
+ // 2. die ContentPosition
+ //
+ // CntntType --
+ // 0x8000 = Bookmark Pos1
+ // 0x8001 = Bookmark Pos2
+ // 0x2000 = Absatzgebundener Rahmen
+ // 0x2001 = Auto-Absatzgebundener Rahmen, der umgehaengt werden soll
+ // 0x1000 = Redline Mark
+ // 0x1001 = Redline Point
+ // 0x0800 = Crsr aus der CrsrShell Mark
+ // 0x0801 = Crsr aus der CrsrShell Point
+ // 0x0400 = UnoCrsr Mark
+ // 0x0401 = UnoCrsr Point
+ //
+
+ class _SwSaveTypeCountContent
+ {
+ union {
+ struct { sal_uInt16 nType, nCount; } TC;
+ sal_uLong nTypeCount;
+ } TYPECOUNT;
+ xub_StrLen nContent;
+
+ public:
+ _SwSaveTypeCountContent() { TYPECOUNT.nTypeCount = 0; nContent = 0; }
+ _SwSaveTypeCountContent( sal_uInt16 nType )
+ {
+ SetTypeAndCount( nType, 0 );
+ nContent = 0;
+ }
+ _SwSaveTypeCountContent( const SvULongs& rArr, sal_uInt16& rPos )
+ {
+ TYPECOUNT.nTypeCount = rArr[ rPos++ ];
+ nContent = static_cast<xub_StrLen>(rArr[ rPos++ ]);
+ }
+ void Add( SvULongs& rArr )
+ {
+ rArr.Insert( TYPECOUNT.nTypeCount, rArr.Count() );
+ rArr.Insert( nContent, rArr.Count() );
+ }
+
+ void SetType( sal_uInt16 n ) { TYPECOUNT.TC.nType = n; }
+ sal_uInt16 GetType() const { return TYPECOUNT.TC.nType; }
+ void IncType() { ++TYPECOUNT.TC.nType; }
+ void DecType() { --TYPECOUNT.TC.nType; }
+
+ void SetCount( sal_uInt16 n ) { TYPECOUNT.TC.nCount = n; }
+ sal_uInt16 GetCount() const { return TYPECOUNT.TC.nCount; }
+ sal_uInt16 IncCount() { return ++TYPECOUNT.TC.nCount; }
+ sal_uInt16 DecCount() { return --TYPECOUNT.TC.nCount; }
+
+ void SetTypeAndCount( sal_uInt16 nT, sal_uInt16 nC )
+ { TYPECOUNT.TC.nCount = nC; TYPECOUNT.TC.nType = nT; }
+
+ void SetContent( xub_StrLen n ) { nContent = n; }
+ xub_StrLen GetContent() const { return nContent; }
+ };
+
+ // #i59534: If a paragraph will be splitted we have to restore some redline positions
+ // This help function checks a position compared with a node and an content index
+
+ static const int BEFORE_NODE = 0; // Position before the given node index
+ static const int BEFORE_SAME_NODE = 1; // Same node index but content index before given content index
+ static const int SAME_POSITION = 2; // Same node index and samecontent index
+ static const int BEHIND_SAME_NODE = 3; // Same node index but content index behind given content index
+ static const int BEHIND_NODE = 4; // Position behind the given node index
+
+ static int lcl_RelativePosition( const SwPosition& rPos, sal_uLong nNode, xub_StrLen nCntnt )
+ {
+ sal_uLong nIndex = rPos.nNode.GetIndex();
+ int nReturn = BEFORE_NODE;
+ if( nIndex == nNode )
+ {
+ xub_StrLen nCntIdx = rPos.nContent.GetIndex();
+ if( nCntIdx < nCntnt )
+ nReturn = BEFORE_SAME_NODE;
+ else if( nCntIdx == nCntnt )
+ nReturn = SAME_POSITION;
+ else
+ nReturn = BEHIND_SAME_NODE;
+ }
+ else if( nIndex > nNode )
+ nReturn = BEHIND_NODE;
+ return nReturn;
+ }
+
+
+ static inline int lcl_Greater( const SwPosition& rPos, const SwNodeIndex& rNdIdx, const SwIndex* pIdx )
+ {
+ return rPos.nNode > rNdIdx || ( pIdx && rPos.nNode == rNdIdx && rPos.nContent > pIdx->GetIndex() );
+ }
+
+ static void lcl_ChkPaM( SvULongs& rSaveArr, sal_uLong nNode, xub_StrLen nCntnt,
+ const SwPaM& rPam, _SwSaveTypeCountContent& rSave,
+ sal_Bool bChkSelDirection )
+ {
+ // SelektionsRichtung beachten
+ bool bBound1IsStart = !bChkSelDirection ? sal_True :
+ ( *rPam.GetPoint() < *rPam.GetMark()
+ ? rPam.GetPoint() == &rPam.GetBound()
+ : rPam.GetMark() == &rPam.GetBound());
+
+ const SwPosition* pPos = &rPam.GetBound( sal_True );
+ if( pPos->nNode.GetIndex() == nNode &&
+ ( bBound1IsStart ? pPos->nContent.GetIndex() < nCntnt
+ : pPos->nContent.GetIndex() <= nCntnt ))
+ {
+ rSave.SetContent( pPos->nContent.GetIndex() );
+ rSave.Add( rSaveArr );
+ }
+
+ pPos = &rPam.GetBound( sal_False );
+ if( pPos->nNode.GetIndex() == nNode &&
+ ( (bBound1IsStart && bChkSelDirection)
+ ? pPos->nContent.GetIndex() <= nCntnt
+ : pPos->nContent.GetIndex() < nCntnt ))
+ {
+ rSave.SetContent( pPos->nContent.GetIndex() );
+ rSave.IncType();
+ rSave.Add( rSaveArr );
+ rSave.DecType();
+ }
+ }
+
+}
+
+
+// IDocumentMarkAccess for SwDoc
+
+IDocumentMarkAccess* SwDoc::getIDocumentMarkAccess()
+ { return static_cast< IDocumentMarkAccess* >(pMarkManager.get()); }
+
+const IDocumentMarkAccess* SwDoc::getIDocumentMarkAccess() const
+ { return static_cast< IDocumentMarkAccess* >(pMarkManager.get()); }
+
+// SaveBookmark
+
+SaveBookmark::SaveBookmark(
+ bool bSavePos,
+ bool bSaveOtherPos,
+ const IMark& rBkmk,
+ const SwNodeIndex & rMvPos,
+ const SwIndex* pIdx)
+ : m_aName(rBkmk.GetName())
+ , m_aShortName()
+ , m_aCode()
+ , m_bSavePos(bSavePos)
+ , m_bSaveOtherPos(bSaveOtherPos)
+ , m_eOrigBkmType(IDocumentMarkAccess::GetType(rBkmk))
+{
+ const IBookmark* const pBookmark = dynamic_cast< const IBookmark* >(&rBkmk);
+ if(pBookmark)
+ {
+ m_aShortName = pBookmark->GetShortName();
+ m_aCode = pBookmark->GetKeyCode();
+
+ ::sfx2::Metadatable const*const pMetadatable(
+ dynamic_cast< ::sfx2::Metadatable const* >(pBookmark));
+ if (pMetadatable)
+ {
+ m_pMetadataUndo = pMetadatable->CreateUndo();
+ }
+ }
+ m_nNode1 = rBkmk.GetMarkPos().nNode.GetIndex();
+ m_nCntnt1 = rBkmk.GetMarkPos().nContent.GetIndex();
+
+ if(m_bSavePos)
+ {
+ m_nNode1 -= rMvPos.GetIndex();
+ if(pIdx && !m_nNode1)
+ m_nCntnt1 -= pIdx->GetIndex();
+ }
+
+ if(rBkmk.IsExpanded())
+ {
+ m_nNode2 = rBkmk.GetOtherMarkPos().nNode.GetIndex();
+ m_nCntnt2 = rBkmk.GetOtherMarkPos().nContent.GetIndex();
+
+ if(m_bSaveOtherPos)
+ {
+ m_nNode2 -= rMvPos.GetIndex();
+ if(pIdx && !m_nNode2)
+ m_nCntnt2 -= pIdx->GetIndex();
+ }
+ }
+ else
+ m_nNode2 = ULONG_MAX, m_nCntnt2 = STRING_NOTFOUND;
+}
+
+void SaveBookmark::SetInDoc(
+ SwDoc* pDoc,
+ const SwNodeIndex& rNewPos,
+ const SwIndex* pIdx)
+{
+ SwPaM aPam(rNewPos.GetNode());
+ if(pIdx)
+ aPam.GetPoint()->nContent = *pIdx;
+
+ if(ULONG_MAX != m_nNode2)
+ {
+ aPam.SetMark();
+
+ if(m_bSaveOtherPos)
+ {
+ aPam.GetMark()->nNode += m_nNode2;
+ if(pIdx && !m_nNode2)
+ aPam.GetMark()->nContent += m_nCntnt2;
+ else
+ aPam.GetMark()->nContent.Assign(aPam.GetCntntNode(sal_False), m_nCntnt2);
+ }
+ else
+ {
+ aPam.GetMark()->nNode = m_nNode2;
+ aPam.GetMark()->nContent.Assign(aPam.GetCntntNode(sal_False), m_nCntnt2);
+ }
+ }
+
+ if(m_bSavePos)
+ {
+ aPam.GetPoint()->nNode += m_nNode1;
+
+ if(pIdx && !m_nNode1)
+ aPam.GetPoint()->nContent += m_nCntnt1;
+ else
+ aPam.GetPoint()->nContent.Assign(aPam.GetCntntNode(), m_nCntnt1);
+ }
+ else
+ {
+ aPam.GetPoint()->nNode = m_nNode1;
+ aPam.GetPoint()->nContent.Assign(aPam.GetCntntNode(), m_nCntnt1);
+ }
+
+ if(!aPam.HasMark()
+ || CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, sal_True))
+ {
+ ::sw::mark::IBookmark* const pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pDoc->getIDocumentMarkAccess()->makeMark(aPam, m_aName, m_eOrigBkmType));
+ if(pBookmark)
+ {
+ pBookmark->SetKeyCode(m_aCode);
+ pBookmark->SetShortName(m_aShortName);
+ if (m_pMetadataUndo)
+ {
+ ::sfx2::Metadatable * const pMeta(
+ dynamic_cast< ::sfx2::Metadatable* >(pBookmark));
+ OSL_ENSURE(pMeta, "metadata undo, but not metadatable?");
+ if (pMeta)
+ {
+ pMeta->RestoreMetadata(m_pMetadataUndo);
+ }
+ }
+ }
+ }
+}
+
+// _DelBookmarks, _{Save,Restore}CntntIdx
+
+void _DelBookmarks(
+ const SwNodeIndex& rStt,
+ const SwNodeIndex& rEnd,
+ ::std::vector<SaveBookmark> * pSaveBkmk,
+ const SwIndex* pSttIdx,
+ const SwIndex* pEndIdx)
+{
+ // illegal range ??
+ if(rStt.GetIndex() > rEnd.GetIndex()
+ || (rStt == rEnd && (!pSttIdx || pSttIdx->GetIndex() >= pEndIdx->GetIndex())))
+ return;
+ SwDoc* const pDoc = rStt.GetNode().GetDoc();
+
+ pDoc->getIDocumentMarkAccess()->deleteMarks(rStt, rEnd, pSaveBkmk, pSttIdx, pEndIdx);
+
+ // kopiere alle Redlines, die im Move Bereich stehen in ein
+ // Array, das alle Angaben auf die Position als Offset speichert.
+ // Die neue Zuordung erfolgt nach dem Moven.
+ SwRedlineTbl& rTbl = (SwRedlineTbl&)pDoc->GetRedlineTbl();
+ for(sal_uInt16 nCnt = 0; nCnt < rTbl.Count(); ++nCnt )
+ {
+ // liegt auf der Position ??
+ SwRedline* pRedl = rTbl[ nCnt ];
+
+ SwPosition *pRStt = &pRedl->GetBound(sal_True),
+ *pREnd = &pRedl->GetBound(sal_False);
+ if( *pRStt > *pREnd )
+ {
+ SwPosition *pTmp = pRStt; pRStt = pREnd, pREnd = pTmp;
+ }
+
+ if( lcl_Greater( *pRStt, rStt, pSttIdx ) && lcl_Lower( *pRStt, rEnd, pEndIdx ))
+ {
+ pRStt->nNode = rEnd;
+ if( pEndIdx )
+ pRStt->nContent = *pEndIdx;
+ else
+ {
+ sal_Bool bStt = sal_True;
+ SwCntntNode* pCNd = pRStt->nNode.GetNode().GetCntntNode();
+ if( !pCNd && 0 == ( pCNd = pDoc->GetNodes().GoNext( &pRStt->nNode )) )
+ {
+ bStt = sal_False;
+ pRStt->nNode = rStt;
+ if( 0 == ( pCNd = pDoc->GetNodes().GoPrevious( &pRStt->nNode )) )
+ {
+ pRStt->nNode = pREnd->nNode;
+ pCNd = pRStt->nNode.GetNode().GetCntntNode();
+ }
+ }
+ xub_StrLen nTmp = bStt ? 0 : pCNd->Len();
+ pRStt->nContent.Assign( pCNd, nTmp );
+ }
+ }
+ if( lcl_Greater( *pREnd, rStt, pSttIdx ) && lcl_Lower( *pREnd, rEnd, pEndIdx ))
+ {
+ pREnd->nNode = rStt;
+ if( pSttIdx )
+ pREnd->nContent = *pSttIdx;
+ else
+ {
+ sal_Bool bStt = sal_False;
+ SwCntntNode* pCNd = pREnd->nNode.GetNode().GetCntntNode();
+ if( !pCNd && 0 == ( pCNd = pDoc->GetNodes().GoPrevious( &pREnd->nNode )) )
+ {
+ bStt = sal_True;
+ pREnd->nNode = rEnd;
+ if( 0 == ( pCNd = pDoc->GetNodes().GoNext( &pREnd->nNode )) )
+ {
+ pREnd->nNode = pRStt->nNode;
+ pCNd = pREnd->nNode.GetNode().GetCntntNode();
+ }
+ }
+ xub_StrLen nTmp = bStt ? 0 : pCNd->Len();
+ pREnd->nContent.Assign( pCNd, nTmp );
+ }
+ }
+ }
+}
+
+void _SaveCntntIdx(SwDoc* pDoc,
+ sal_uLong nNode,
+ xub_StrLen nCntnt,
+ SvULongs& rSaveArr,
+ sal_uInt8 nSaveFly)
+{
+ // 1. Bookmarks
+ _SwSaveTypeCountContent aSave;
+ aSave.SetTypeAndCount( 0x8000, 0 );
+
+ IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+ const sal_Int32 nBkmks = pMarkAccess->getMarksCount();
+ for(; aSave.GetCount() < nBkmks; aSave.IncCount())
+ {
+ bool bEqual = false;
+ bool bLower = false;
+ const ::sw::mark::IMark* pBkmk = (pMarkAccess->getMarksBegin() + aSave.GetCount())->get();
+ if(pBkmk->GetMarkPos().nNode.GetIndex() == nNode
+ && pBkmk->GetMarkPos().nContent.GetIndex() <= nCntnt)
+ {
+ if(pBkmk->GetMarkPos().nContent.GetIndex() < nCntnt)
+ {
+ bLower = true; // a hint for the other position...
+ aSave.SetContent(pBkmk->GetMarkPos().nContent.GetIndex());
+ aSave.Add(rSaveArr);
+ }
+ else // if a bookmark position is equal nCntnt, the other position
+ bEqual = true; // has to decide if it is added to the array
+ }
+
+ if(pBkmk->IsExpanded()
+ && pBkmk->GetOtherMarkPos().nNode.GetIndex() == nNode
+ && pBkmk->GetOtherMarkPos().nContent.GetIndex() <= nCntnt)
+ {
+ if(bLower || pBkmk->GetOtherMarkPos().nContent.GetIndex() < nCntnt)
+ {
+ if(bEqual)
+ { // the other position is before, the (main) position is equal
+ aSave.SetContent(pBkmk->GetMarkPos().nContent.GetIndex());
+ aSave.Add(rSaveArr);
+ }
+ aSave.SetContent(pBkmk->GetOtherMarkPos().nContent.GetIndex());
+ aSave.IncType();
+ aSave.Add(rSaveArr);
+ aSave.DecType();
+ }
+ }
+ }
+
+ // 2. Redlines
+ aSave.SetTypeAndCount( 0x1000, 0 );
+ const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl();
+ for( ; aSave.GetCount() < rRedlTbl.Count(); aSave.IncCount() )
+ {
+ const SwRedline* pRdl = rRedlTbl[ aSave.GetCount() ];
+ int nPointPos = lcl_RelativePosition( *pRdl->GetPoint(), nNode, nCntnt );
+ int nMarkPos = pRdl->HasMark() ? lcl_RelativePosition( *pRdl->GetMark(), nNode, nCntnt ) :
+ nPointPos;
+ // #i59534: We have to store the positions inside the same node before the insert position
+ // and the one at the insert position if the corresponding Point/Mark position is before
+ // the insert position.
+ if( nPointPos == BEFORE_SAME_NODE ||
+ ( nPointPos == SAME_POSITION && nMarkPos < SAME_POSITION ) )
+ {
+ aSave.SetContent( pRdl->GetPoint()->nContent.GetIndex() );
+ aSave.IncType();
+ aSave.Add( rSaveArr );
+ aSave.DecType();
+ }
+ if( pRdl->HasMark() && ( nMarkPos == BEFORE_SAME_NODE ||
+ ( nMarkPos == SAME_POSITION && nPointPos < SAME_POSITION ) ) )
+ {
+ aSave.SetContent( pRdl->GetMark()->nContent.GetIndex() );
+ aSave.Add( rSaveArr );
+ }
+ }
+
+ // 4. Absatzgebundene Objekte
+ {
+ SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode();
+ if( pNode )
+ {
+
+ SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() );
+#if OSL_DEBUG_LEVEL > 1
+ static sal_Bool bViaDoc = sal_False;
+ if( bViaDoc )
+ pFrm = NULL;
+#endif
+ if( pFrm ) // gibt es ein Layout? Dann ist etwas billiger...
+ {
+ if( pFrm->GetDrawObjs() )
+ {
+ const SwSortedObjs& rDObj = *pFrm->GetDrawObjs();
+ for( sal_uInt32 n = rDObj.Count(); n; )
+ {
+ SwAnchoredObject* pObj = rDObj[ --n ];
+ const SwFrmFmt& rFmt = pObj->GetFrmFmt();
+ const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
+ SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
+ if ( pAPos &&
+ ( ( nSaveFly &&
+ FLY_AT_PARA == rAnchor.GetAnchorId() ) ||
+ ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) )
+ {
+ aSave.SetType( 0x2000 );
+ aSave.SetContent( pAPos->nContent.GetIndex() );
+
+ OSL_ENSURE( nNode == pAPos->nNode.GetIndex(),
+ "_SaveCntntIdx: Wrong Node-Index" );
+ if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
+ {
+ if( nCntnt <= aSave.GetContent() )
+ {
+ if( SAVEFLY_SPLIT == nSaveFly )
+ aSave.IncType(); // = 0x2001;
+ else
+ continue;
+ }
+ }
+ aSave.SetCount( pDoc->GetSpzFrmFmts()->Count() );
+ while( aSave.GetCount() &&
+ &rFmt != (*pDoc->GetSpzFrmFmts())[
+ aSave.DecCount() ] )
+ ; // nothing
+ OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[
+ aSave.GetCount() ],
+ "_SaveCntntIdx: Lost FrameFormat" );
+ aSave.Add( rSaveArr );
+ }
+ }
+ }
+ }
+ else // Schade, kein Layout, dann ist es eben etwas teurer...
+ {
+ for( aSave.SetCount( pDoc->GetSpzFrmFmts()->Count() );
+ aSave.GetCount() ; )
+ {
+ SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[
+ aSave.DecCount() ];
+ if ( RES_FLYFRMFMT != pFrmFmt->Which() &&
+ RES_DRAWFRMFMT != pFrmFmt->Which() )
+ continue;
+
+ const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
+ SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
+ if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) &&
+ ( FLY_AT_PARA == rAnchor.GetAnchorId() ||
+ FLY_AT_CHAR == rAnchor.GetAnchorId() ) )
+ {
+ aSave.SetType( 0x2000 );
+ aSave.SetContent( pAPos->nContent.GetIndex() );
+ if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
+ {
+ if( nCntnt <= aSave.GetContent() )
+ {
+ if( SAVEFLY_SPLIT == nSaveFly )
+ aSave.IncType(); // = 0x2001;
+ else
+ continue;
+ }
+ }
+ aSave.Add( rSaveArr );
+ }
+ }
+ }
+ }
+ }
+ // 5. CrsrShell
+ {
+ SwCrsrShell* pShell = pDoc->GetEditShell();
+ if( pShell )
+ {
+ aSave.SetTypeAndCount( 0x800, 0 );
+ FOREACHSHELL_START( pShell )
+ SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+ if( _pStkCrsr )
+ do {
+ lcl_ChkPaM( rSaveArr, nNode, nCntnt, *_pStkCrsr,
+ aSave, sal_False );
+ aSave.IncCount();
+ } while ( (_pStkCrsr != 0 ) &&
+ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+
+ FOREACHPAM_START( PCURSH->_GetCrsr() )
+ lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR,
+ aSave, sal_False );
+ aSave.IncCount();
+ FOREACHPAM_END()
+
+ FOREACHSHELL_END( pShell )
+ }
+ }
+ // 6. UnoCrsr
+ {
+ aSave.SetTypeAndCount( 0x400, 0 );
+ const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl();
+ for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ {
+ FOREACHPAM_START( rTbl[ n ] )
+ lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, sal_False );
+ aSave.IncCount();
+ FOREACHPAM_END()
+
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(rTbl[ n ]);
+ if( pUnoTblCrsr )
+ {
+ FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+ lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, sal_False );
+ aSave.IncCount();
+ FOREACHPAM_END()
+ }
+ }
+ }
+}
+
+
+void _RestoreCntntIdx(SwDoc* pDoc,
+ SvULongs& rSaveArr,
+ sal_uLong nNode,
+ xub_StrLen nOffset,
+ sal_Bool bAuto)
+{
+ SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
+ const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl();
+ SwSpzFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
+ IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+ sal_uInt16 n = 0;
+ while( n < rSaveArr.Count() )
+ {
+ _SwSaveTypeCountContent aSave( rSaveArr, n );
+ SwPosition* pPos = 0;
+ switch( aSave.GetType() )
+ {
+ case 0x8000:
+ {
+ MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get());
+ SwPosition aNewPos(pMark->GetMarkPos());
+ aNewPos.nNode = *pCNd;
+ aNewPos.nContent.Assign(pCNd, aSave.GetContent() + nOffset);
+ pMark->SetMarkPos(aNewPos);
+ }
+ break;
+ case 0x8001:
+ {
+ MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get());
+ SwPosition aNewPos(pMark->GetOtherMarkPos());
+ aNewPos.nNode = *pCNd;
+ aNewPos.nContent.Assign(pCNd, aSave.GetContent() + nOffset);
+ pMark->SetOtherMarkPos(aNewPos);
+ }
+ break;
+ case 0x1001:
+ pPos = (SwPosition*)rRedlTbl[ aSave.GetCount() ]->GetPoint();
+ break;
+ case 0x1000:
+ pPos = (SwPosition*)rRedlTbl[ aSave.GetCount() ]->GetMark();
+ break;
+ case 0x2000:
+ {
+ SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.GetCount() ];
+ const SwFmtAnchor& rFlyAnchor = pFrmFmt->GetAnchor();
+ if( rFlyAnchor.GetCntntAnchor() )
+ {
+ SwFmtAnchor aNew( rFlyAnchor );
+ SwPosition aNewPos( *rFlyAnchor.GetCntntAnchor() );
+ aNewPos.nNode = *pCNd;
+ if ( FLY_AT_CHAR == rFlyAnchor.GetAnchorId() )
+ {
+ aNewPos.nContent.Assign( pCNd,
+ aSave.GetContent() + nOffset );
+ }
+ else
+ {
+ aNewPos.nContent.Assign( 0, 0 );
+ }
+ aNew.SetAnchor( &aNewPos );
+ pFrmFmt->SetFmtAttr( aNew );
+ }
+ }
+ break;
+ case 0x2001:
+ if( bAuto )
+ {
+ SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.GetCount() ];
+ SfxPoolItem *pAnchor = (SfxPoolItem*)&pFrmFmt->GetAnchor();
+ pFrmFmt->NotifyClients( pAnchor, pAnchor );
+ }
+ break;
+
+ case 0x0800:
+ case 0x0801:
+ {
+ sal_uInt16 nCnt = 0;
+ SwCrsrShell* pShell = pDoc->GetEditShell();
+ if( pShell )
+ {
+ FOREACHSHELL_START( pShell )
+ SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+ if( _pStkCrsr )
+ do {
+ if( aSave.GetCount() == nCnt )
+ {
+ pPos = &_pStkCrsr->GetBound( 0x0800 ==
+ aSave.GetType() );
+ break;
+ }
+ ++nCnt;
+ } while ( (_pStkCrsr != 0 ) &&
+ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+
+ if( pPos )
+ break;
+
+ FOREACHPAM_START( PCURSH->_GetCrsr() )
+ if( aSave.GetCount() == nCnt )
+ {
+ pPos = &PCURCRSR->GetBound( 0x0800 ==
+ aSave.GetType() );
+ break;
+ }
+ ++nCnt;
+ FOREACHPAM_END()
+ if( pPos )
+ break;
+
+ FOREACHSHELL_END( pShell )
+ }
+ }
+ break;
+
+ case 0x0400:
+ case 0x0401:
+ {
+ sal_uInt16 nCnt = 0;
+ const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl();
+ for( sal_uInt16 i = 0; i < rTbl.Count(); ++i )
+ {
+ FOREACHPAM_START( rTbl[ i ] )
+ if( aSave.GetCount() == nCnt )
+ {
+ pPos = &PCURCRSR->GetBound( 0x0400 ==
+ aSave.GetType() );
+ break;
+ }
+ ++nCnt;
+ FOREACHPAM_END()
+ if( pPos )
+ break;
+
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(rTbl[ i ]);
+ if ( pUnoTblCrsr )
+ {
+ FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+ if( aSave.GetCount() == nCnt )
+ {
+ pPos = &PCURCRSR->GetBound( 0x0400 ==
+ aSave.GetType() );
+ break;
+ }
+ ++nCnt;
+ FOREACHPAM_END()
+ }
+ if ( pPos )
+ break;
+ }
+ }
+ break;
+ }
+
+ if( pPos )
+ {
+ pPos->nNode = *pCNd;
+ pPos->nContent.Assign( pCNd, aSave.GetContent() + nOffset );
+ }
+ }
+}
+
+void _RestoreCntntIdx(SvULongs& rSaveArr,
+ const SwNode& rNd,
+ xub_StrLen nLen,
+ xub_StrLen nChkLen)
+{
+ const SwDoc* pDoc = rNd.GetDoc();
+ const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl();
+ const SwSpzFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
+ const IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+ SwCntntNode* pCNd = (SwCntntNode*)rNd.GetCntntNode();
+
+ sal_uInt16 n = 0;
+ while( n < rSaveArr.Count() )
+ {
+ _SwSaveTypeCountContent aSave( rSaveArr, n );
+ if( aSave.GetContent() >= nChkLen )
+ rSaveArr[ n-1 ] -= nChkLen;
+ else
+ {
+ SwPosition* pPos = 0;
+ switch( aSave.GetType() )
+ {
+ case 0x8000:
+ {
+ MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get());
+ SwPosition aNewPos(pMark->GetMarkPos());
+ aNewPos.nNode = rNd;
+ aNewPos.nContent.Assign(pCNd, Min(aSave.GetContent(), nLen));
+ pMark->SetMarkPos(aNewPos);
+ }
+ break;
+ case 0x8001:
+ {
+ MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get());
+ SwPosition aNewPos(pMark->GetOtherMarkPos());
+ aNewPos.nNode = rNd;
+ aNewPos.nContent.Assign(pCNd, Min(aSave.GetContent(), nLen));
+ pMark->SetOtherMarkPos(aNewPos);
+ }
+ break;
+ case 0x1001:
+ pPos = (SwPosition*)rRedlTbl[ aSave.GetCount() ]->GetPoint();
+ break;
+ case 0x1000:
+ pPos = (SwPosition*)rRedlTbl[ aSave.GetCount() ]->GetMark();
+ break;
+ case 0x2000:
+ case 0x2001:
+ {
+ SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.GetCount() ];
+ const SwFmtAnchor& rFlyAnchor = pFrmFmt->GetAnchor();
+ if( rFlyAnchor.GetCntntAnchor() )
+ {
+ SwFmtAnchor aNew( rFlyAnchor );
+ SwPosition aNewPos( *rFlyAnchor.GetCntntAnchor() );
+ aNewPos.nNode = rNd;
+ if ( FLY_AT_CHAR == rFlyAnchor.GetAnchorId() )
+ {
+ aNewPos.nContent.Assign( pCNd, Min(
+ aSave.GetContent(), nLen ) );
+ }
+ else
+ {
+ aNewPos.nContent.Assign( 0, 0 );
+ }
+ aNew.SetAnchor( &aNewPos );
+ pFrmFmt->SetFmtAttr( aNew );
+ }
+ }
+ break;
+
+ case 0x0800:
+ case 0x0801:
+ {
+ sal_uInt16 nCnt = 0;
+ SwCrsrShell* pShell = pDoc->GetEditShell();
+ if( pShell )
+ {
+ FOREACHSHELL_START( pShell )
+ SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+ if( _pStkCrsr )
+ do {
+ if( aSave.GetCount() == nCnt )
+ {
+ pPos = &_pStkCrsr->GetBound( 0x0800 ==
+ aSave.GetType() );
+ break;
+ }
+ ++nCnt;
+ } while ( (_pStkCrsr != 0 ) &&
+ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+
+ if( pPos )
+ break;
+
+ FOREACHPAM_START( PCURSH->_GetCrsr() )
+ if( aSave.GetCount() == nCnt )
+ {
+ pPos = &PCURCRSR->GetBound( 0x0800 ==
+ aSave.GetType() );
+ break;
+ }
+ ++nCnt;
+ FOREACHPAM_END()
+ if( pPos )
+ break;
+
+ FOREACHSHELL_END( pShell )
+ }
+ }
+ break;
+
+ case 0x0400:
+ case 0x0401:
+ {
+ sal_uInt16 nCnt = 0;
+ const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl();
+ for( sal_uInt16 i = 0; i < rTbl.Count(); ++i )
+ {
+ FOREACHPAM_START( rTbl[ i ] )
+ if( aSave.GetCount() == nCnt )
+ {
+ pPos = &PCURCRSR->GetBound( 0x0400 ==
+ aSave.GetType() );
+ break;
+ }
+ ++nCnt;
+ FOREACHPAM_END()
+ if( pPos )
+ break;
+
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(rTbl[ i ]);
+ if ( pUnoTblCrsr )
+ {
+ FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+ if( aSave.GetCount() == nCnt )
+ {
+ pPos = &PCURCRSR->GetBound( 0x0400 ==
+ aSave.GetType() );
+ break;
+ }
+ ++nCnt;
+ FOREACHPAM_END()
+ }
+ if ( pPos )
+ break;
+ }
+ }
+ break;
+ }
+
+ if( pPos )
+ {
+ pPos->nNode = rNd;
+ pPos->nContent.Assign( pCNd, Min( aSave.GetContent(), nLen ) );
+ }
+ n -= 2;
+ rSaveArr.Remove( n, 2 );
+ }
+ }
+}
diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx
new file mode 100644
index 000000000000..95cdd4caed1b
--- /dev/null
+++ b/sw/source/core/doc/docchart.cxx
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/frame/XModel.hpp>
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+#include <float.h>
+#include <hintids.hxx>
+#include <vcl/window.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <ndindex.hxx>
+#include <swtable.hxx>
+#include <ndtxt.hxx>
+#include <ndole.hxx>
+#include <calc.hxx>
+#include <frmfmt.hxx>
+#include <cellfml.hxx>
+#include <viewsh.hxx>
+#include <ndole.hxx>
+#include <calbck.hxx>
+#include <cntfrm.hxx>
+#include <swtblfmt.hxx>
+#include <tblsel.hxx>
+#include <cellatr.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <unochart.hxx>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+
+void SwTable::UpdateCharts() const
+{
+ GetFrmFmt()->GetDoc()->UpdateCharts( GetFrmFmt()->GetName() );
+}
+
+sal_Bool SwTable::IsTblComplexForChart( const String& rSelection,
+ SwChartLines* pGetCLines ) const
+{
+ const SwTableBox* pSttBox, *pEndBox;
+ if( 2 < rSelection.Len() )
+ {
+ // spitze Klammern am Anfang & Ende enfernen
+ String sBox( rSelection );
+ if( '<' == sBox.GetChar( 0 ) ) sBox.Erase( 0, 1 );
+ if( '>' == sBox.GetChar( sBox.Len()-1 ) ) sBox.Erase( sBox.Len()-1 );
+
+ xub_StrLen nTrenner = sBox.Search( ':' );
+ ASSERT( STRING_NOTFOUND != nTrenner, "keine gueltige Selektion" );
+
+ pSttBox = GetTblBox( sBox.Copy( 0, nTrenner ));
+ pEndBox = GetTblBox( sBox.Copy( nTrenner+1 ));
+ }
+ else
+ {
+ const SwTableLines* pLns = &GetTabLines();
+ pSttBox = (*pLns)[ 0 ]->GetTabBoxes()[ 0 ];
+ while( !pSttBox->GetSttNd() )
+ // bis zur Content Box!
+ pSttBox = pSttBox->GetTabLines()[ 0 ]->GetTabBoxes()[ 0 ];
+
+ const SwTableBoxes* pBoxes = &(*pLns)[ pLns->Count()-1 ]->GetTabBoxes();
+ pEndBox = (*pBoxes)[ pBoxes->Count()-1 ];
+ while( !pEndBox->GetSttNd() )
+ {
+ // bis zur Content Box!
+ pLns = &pEndBox->GetTabLines();
+ pBoxes = &(*pLns)[ pLns->Count()-1 ]->GetTabBoxes();
+ pEndBox = (*pBoxes)[ pBoxes->Count()-1 ];
+ }
+ }
+
+ return !pSttBox || !pEndBox || !::ChkChartSel( *pSttBox->GetSttNd(),
+ *pEndBox->GetSttNd(), pGetCLines );
+}
+
+
+
+IMPL_LINK( SwDoc, DoUpdateAllCharts, Timer *, EMPTYARG )
+{
+ ViewShell* pVSh;
+ GetEditShell( &pVSh );
+ if( pVSh )
+ {
+ const SwFrmFmts& rTblFmts = *GetTblFrmFmts();
+ for( sal_uInt16 n = 0; n < rTblFmts.Count(); ++n )
+ {
+ SwTable* pTmpTbl;
+ const SwTableNode* pTblNd;
+ SwFrmFmt* pFmt = rTblFmts[ n ];
+
+ if( 0 != ( pTmpTbl = SwTable::FindTable( pFmt ) ) &&
+ 0 != ( pTblNd = pTmpTbl->GetTableNode() ) &&
+ pTblNd->GetNodes().IsDocNodes() )
+ {
+ _UpdateCharts( *pTmpTbl, *pVSh );
+ }
+ }
+ }
+ return 0;
+}
+
+void SwDoc::_UpdateCharts( const SwTable& rTbl, ViewShell& rVSh ) const
+{
+ String aName( rTbl.GetFrmFmt()->GetName() );
+ SwOLENode *pONd;
+ SwStartNode *pStNd;
+ SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+ while( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
+ {
+ aIdx++;
+ SwFrm* pFrm;
+ if( 0 != ( pONd = aIdx.GetNode().GetOLENode() ) &&
+ aName.Equals( pONd->GetChartTblName() ) &&
+ 0 != ( pFrm = pONd->getLayoutFrm( rVSh.GetLayout() ) ) )
+ {
+ SwChartDataProvider *pPCD = GetChartDataProvider();
+ if (pPCD)
+ pPCD->InvalidateTable( &rTbl );
+ // following this the framework will now take care of repainting
+ // the chart or it's replacement image...
+ }
+ aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
+ }
+}
+
+void SwDoc::UpdateCharts( const String &rName ) const
+{
+ SwTable* pTmpTbl = SwTable::FindTable( FindTblFmtByName( rName ) );
+ if( pTmpTbl )
+ {
+ ViewShell* pVSh;
+ GetEditShell( &pVSh );
+
+ if( pVSh )
+ _UpdateCharts( *pTmpTbl, *pVSh );
+ }
+}
+
+void SwDoc::SetTableName( SwFrmFmt& rTblFmt, const String &rNewName )
+{
+// sal_Bool bStop = 1;
+
+ const String aOldName( rTblFmt.GetName() );
+
+ sal_Bool bNameFound = 0 == rNewName.Len();
+ if( !bNameFound )
+ {
+ SwFrmFmt* pFmt;
+ const SwFrmFmts& rTbl = *GetTblFrmFmts();
+ for( sal_uInt16 i = rTbl.Count(); i; )
+ if( !( pFmt = rTbl[ --i ] )->IsDefault() &&
+ pFmt->GetName() == rNewName && IsUsed( *pFmt ) )
+ {
+ bNameFound = sal_True;
+ break;
+ }
+ }
+
+ if( !bNameFound )
+ rTblFmt.SetName( rNewName, sal_True );
+ else
+ rTblFmt.SetName( GetUniqueTblName(), sal_True );
+
+ SwStartNode *pStNd;
+ SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+ while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
+ {
+ aIdx++;
+ SwOLENode *pNd = aIdx.GetNode().GetOLENode();
+ if( pNd && aOldName == pNd->GetChartTblName() )
+ {
+ pNd->SetChartTblName( rNewName );
+
+ ViewShell* pVSh;
+ GetEditShell( &pVSh );
+
+ SwTable* pTable = SwTable::FindTable( &rTblFmt );
+ SwChartDataProvider *pPCD = GetChartDataProvider();
+ if (pPCD)
+ pPCD->InvalidateTable( pTable );
+ // following this the framework will now take care of repainting
+ // the chart or it's replacement image...
+ }
+ aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
+ }
+ SetModified();
+}
+
+
+SwChartDataProvider * SwDoc::GetChartDataProvider( bool bCreate ) const
+{
+ // since there must be only one instance of this object per document
+ // we need a mutex here
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if (bCreate && !aChartDataProviderImplRef.get())
+ {
+ aChartDataProviderImplRef = comphelper::ImplementationReference< SwChartDataProvider
+ , chart2::data::XDataProvider >( new SwChartDataProvider( this ) );
+ }
+ return aChartDataProviderImplRef.get();
+}
+
+
+void SwDoc::CreateChartInternalDataProviders( const SwTable *pTable )
+{
+ if (pTable)
+ {
+ String aName( pTable->GetFrmFmt()->GetName() );
+ SwOLENode *pONd;
+ SwStartNode *pStNd;
+ SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+ while (0 != (pStNd = aIdx.GetNode().GetStartNode()))
+ {
+ aIdx++;
+ if( 0 != ( pONd = aIdx.GetNode().GetOLENode() ) &&
+ aName.Equals( pONd->GetChartTblName() ) /* OLE node is chart? */ &&
+ 0 != (pONd->getLayoutFrm( GetCurrentLayout() )) /* chart frame is not hidden */ )
+ {
+ uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef();
+ if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
+ {
+ uno::Reference< chart2::XChartDocument > xChart( xIP->getComponent(), UNO_QUERY );
+ if (xChart.is())
+ xChart->createInternalDataProvider( sal_True );
+
+ // there may be more than one chart for each table thus we need to continue the loop...
+ }
+ }
+ aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
+ }
+ }
+}
+
+
+SwChartLockController_Helper & SwDoc::GetChartControllerHelper()
+{
+ if (!pChartControllerHelper)
+ {
+ pChartControllerHelper = new SwChartLockController_Helper( this );
+ }
+ return *pChartControllerHelper;
+}
+
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
new file mode 100644
index 000000000000..e0c550dff020
--- /dev/null
+++ b/sw/source/core/doc/doccomp.cxx
@@ -0,0 +1,1883 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <tools/list.hxx>
+#include <vcl/vclenum.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <docary.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <redline.hxx>
+#include <UndoRedline.hxx>
+#include <section.hxx>
+#include <tox.hxx>
+#include <docsh.hxx>
+
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+
+using namespace ::com::sun::star;
+
+
+class CompareLine
+{
+public:
+ CompareLine() {}
+ virtual ~CompareLine();
+
+ virtual sal_uLong GetHashValue() const = 0;
+ virtual sal_Bool Compare( const CompareLine& rLine ) const = 0;
+};
+
+DECLARE_LIST( CompareList, CompareLine* )
+
+class CompareData
+{
+ sal_uLong* pIndex;
+ sal_Bool* pChangedFlag;
+
+protected:
+ CompareList aLines;
+ sal_uLong nSttLineNum;
+
+ // Anfang und Ende beschneiden und alle anderen in das
+ // LinesArray setzen
+ virtual void CheckRanges( CompareData& ) = 0;
+
+public:
+ CompareData();
+ virtual ~CompareData();
+
+ // gibt es unterschiede?
+ sal_Bool HasDiffs( const CompareData& rData ) const;
+
+ // startet das Vergleichen und Erzeugen der Unterschiede zweier
+ // Dokumente
+ void CompareLines( CompareData& rData );
+ // lasse die Unterschiede anzeigen - ruft die beiden Methoden
+ // ShowInsert / ShowDelete. Diese bekommen die Start und EndLine-Nummer
+ // uebergeben. Die Abbildung auf den tatsaechline Inhalt muss die
+ // Ableitung uebernehmen!
+ sal_uLong ShowDiffs( const CompareData& rData );
+
+ virtual void ShowInsert( sal_uLong nStt, sal_uLong nEnd );
+ virtual void ShowDelete( const CompareData& rData, sal_uLong nStt,
+ sal_uLong nEnd, sal_uLong nInsPos );
+ virtual void CheckForChangesInLine( const CompareData& rData,
+ sal_uLong& nStt, sal_uLong& nEnd,
+ sal_uLong& nThisStt, sal_uLong& nThisEnd );
+
+ // Eindeutigen Index fuer eine Line setzen. Gleiche Lines haben den
+ // selben Index; auch in den anderen CompareData!
+ void SetIndex( sal_uLong nLine, sal_uLong nIndex );
+ sal_uLong GetIndex( sal_uLong nLine ) const
+ { return nLine < aLines.Count() ? pIndex[ nLine ] : 0; }
+
+ // setze/erfrage ob eine Zeile veraendert ist
+ void SetChanged( sal_uLong nLine, sal_Bool bFlag = sal_True );
+ sal_Bool GetChanged( sal_uLong nLine ) const
+ {
+ return (pChangedFlag && nLine < aLines.Count())
+ ? pChangedFlag[ nLine ]
+ : 0;
+ }
+
+ sal_uLong GetLineCount() const { return aLines.Count(); }
+ sal_uLong GetLineOffset() const { return nSttLineNum; }
+ const CompareLine* GetLine( sal_uLong nLine ) const
+ { return aLines.GetObject( nLine ); }
+ void InsertLine( CompareLine* pLine )
+ { aLines.Insert( pLine, LIST_APPEND ); }
+};
+
+class Hash
+{
+ struct _HashData
+ {
+ sal_uLong nNext, nHash;
+ const CompareLine* pLine;
+
+ _HashData()
+ : nNext( 0 ), nHash( 0 ), pLine(0) {}
+ };
+
+ sal_uLong* pHashArr;
+ _HashData* pDataArr;
+ sal_uLong nCount, nPrime;
+
+public:
+ Hash( sal_uLong nSize );
+ ~Hash();
+
+ void CalcHashValue( CompareData& rData );
+
+ sal_uLong GetCount() const { return nCount; }
+};
+
+class Compare
+{
+public:
+ class MovedData
+ {
+ sal_uLong* pIndex;
+ sal_uLong* pLineNum;
+ sal_uLong nCount;
+
+ public:
+ MovedData( CompareData& rData, sal_Char* pDiscard );
+ ~MovedData();
+
+ sal_uLong GetIndex( sal_uLong n ) const { return pIndex[ n ]; }
+ sal_uLong GetLineNum( sal_uLong n ) const { return pLineNum[ n ]; }
+ sal_uLong GetCount() const { return nCount; }
+ };
+
+private:
+ // Suche die verschobenen Lines
+ class CompareSequence
+ {
+ CompareData &rData1, &rData2;
+ const MovedData &rMoved1, &rMoved2;
+ long *pMemory, *pFDiag, *pBDiag;
+
+ void Compare( sal_uLong nStt1, sal_uLong nEnd1, sal_uLong nStt2, sal_uLong nEnd2 );
+ sal_uLong CheckDiag( sal_uLong nStt1, sal_uLong nEnd1,
+ sal_uLong nStt2, sal_uLong nEnd2, sal_uLong* pCost );
+ public:
+ CompareSequence( CompareData& rData1, CompareData& rData2,
+ const MovedData& rD1, const MovedData& rD2 );
+ ~CompareSequence();
+ };
+
+
+ static void CountDifference( const CompareData& rData, sal_uLong* pCounts );
+ static void SetDiscard( const CompareData& rData,
+ sal_Char* pDiscard, sal_uLong* pCounts );
+ static void CheckDiscard( sal_uLong nLen, sal_Char* pDiscard );
+ static sal_uLong SetChangedFlag( CompareData& rData, sal_Char* pDiscard, int bFirst );
+ static void ShiftBoundaries( CompareData& rData1, CompareData& rData2 );
+
+public:
+ Compare( sal_uLong nDiff, CompareData& rData1, CompareData& rData2 );
+};
+
+// ====================================================================
+
+CompareLine::~CompareLine() {}
+
+// ----------------------------------------------------------------------
+
+CompareData::CompareData()
+ : pIndex( 0 ), pChangedFlag( 0 ), nSttLineNum( 0 )
+{
+}
+
+CompareData::~CompareData()
+{
+ delete[] pIndex;
+ delete[] pChangedFlag;
+}
+
+void CompareData::SetIndex( sal_uLong nLine, sal_uLong nIndex )
+{
+ if( !pIndex )
+ {
+ pIndex = new sal_uLong[ aLines.Count() ];
+ memset( pIndex, 0, aLines.Count() * sizeof( sal_uLong ) );
+ }
+ if( nLine < aLines.Count() )
+ pIndex[ nLine ] = nIndex;
+}
+
+void CompareData::SetChanged( sal_uLong nLine, sal_Bool bFlag )
+{
+ if( !pChangedFlag )
+ {
+ pChangedFlag = new sal_Bool[ aLines.Count() +1 ];
+ memset( pChangedFlag, 0, aLines.Count() +1 * sizeof( sal_Bool ) );
+ }
+ if( nLine < aLines.Count() )
+ pChangedFlag[ nLine ] = bFlag;
+}
+
+void CompareData::CompareLines( CompareData& rData )
+{
+ CheckRanges( rData );
+
+ sal_uLong nDifferent;
+ {
+ Hash aH( GetLineCount() + rData.GetLineCount() + 1 );
+ aH.CalcHashValue( *this );
+ aH.CalcHashValue( rData );
+ nDifferent = aH.GetCount();
+ }
+ {
+ Compare aComp( nDifferent, *this, rData );
+ }
+}
+
+sal_uLong CompareData::ShowDiffs( const CompareData& rData )
+{
+ sal_uLong nLen1 = rData.GetLineCount(), nLen2 = GetLineCount();
+ sal_uLong nStt1 = 0, nStt2 = 0;
+ sal_uLong nCnt = 0;
+
+ while( nStt1 < nLen1 || nStt2 < nLen2 )
+ {
+ if( rData.GetChanged( nStt1 ) || GetChanged( nStt2 ) )
+ {
+ sal_uLong nSav1 = nStt1, nSav2 = nStt2;
+ while( nStt1 < nLen1 && rData.GetChanged( nStt1 )) ++nStt1;
+ while( nStt2 < nLen2 && GetChanged( nStt2 )) ++nStt2;
+
+ // rData ist das Original,
+ // this ist das, in das die Veraenderungen sollen
+ if( nSav2 != nStt2 && nSav1 != nStt1 )
+ CheckForChangesInLine( rData, nSav1, nStt1, nSav2, nStt2 );
+
+ if( nSav2 != nStt2 )
+ ShowInsert( nSav2, nStt2 );
+
+ if( nSav1 != nStt1 )
+ ShowDelete( rData, nSav1, nStt1, nStt2 );
+ ++nCnt;
+ }
+ ++nStt1, ++nStt2;
+ }
+ return nCnt;
+}
+
+sal_Bool CompareData::HasDiffs( const CompareData& rData ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uLong nLen1 = rData.GetLineCount(), nLen2 = GetLineCount();
+ sal_uLong nStt1 = 0, nStt2 = 0;
+
+ while( nStt1 < nLen1 || nStt2 < nLen2 )
+ {
+ if( rData.GetChanged( nStt1 ) || GetChanged( nStt2 ) )
+ {
+ bRet = sal_True;
+ break;
+ }
+ ++nStt1, ++nStt2;
+ }
+ return bRet;
+}
+
+void CompareData::ShowInsert( sal_uLong, sal_uLong )
+{
+}
+
+void CompareData::ShowDelete( const CompareData&, sal_uLong, sal_uLong, sal_uLong )
+{
+}
+
+void CompareData::CheckForChangesInLine( const CompareData& ,
+ sal_uLong&, sal_uLong&, sal_uLong&, sal_uLong& )
+{
+}
+
+// ----------------------------------------------------------------------
+
+Hash::Hash( sal_uLong nSize )
+ : nCount( 1 )
+{
+
+static const sal_uLong primes[] =
+{
+ 509,
+ 1021,
+ 2039,
+ 4093,
+ 8191,
+ 16381,
+ 32749,
+ 65521,
+ 131071,
+ 262139,
+ 524287,
+ 1048573,
+ 2097143,
+ 4194301,
+ 8388593,
+ 16777213,
+ 33554393,
+ 67108859, /* Preposterously large . . . */
+ 134217689,
+ 268435399,
+ 536870909,
+ 1073741789,
+ 2147483647,
+ 0
+};
+ int i;
+
+ pDataArr = new _HashData[ nSize ];
+ pDataArr[0].nNext = 0;
+ pDataArr[0].nHash = 0,
+ pDataArr[0].pLine = 0;
+
+ for( i = 0; primes[i] < nSize / 3; i++)
+ if( !primes[i] )
+ {
+ pHashArr = 0;
+ return;
+ }
+ nPrime = primes[ i ];
+ pHashArr = new sal_uLong[ nPrime ];
+ memset( pHashArr, 0, nPrime * sizeof( sal_uLong ) );
+}
+
+Hash::~Hash()
+{
+ delete[] pHashArr;
+ delete[] pDataArr;
+}
+
+void Hash::CalcHashValue( CompareData& rData )
+{
+ if( pHashArr )
+ {
+ for( sal_uLong n = 0; n < rData.GetLineCount(); ++n )
+ {
+ const CompareLine* pLine = rData.GetLine( n );
+ ASSERT( pLine, "wo ist die Line?" );
+ sal_uLong nH = pLine->GetHashValue();
+
+ sal_uLong* pFound = &pHashArr[ nH % nPrime ];
+ sal_uLong i;
+ for( i = *pFound; ; i = pDataArr[i].nNext )
+ if( !i )
+ {
+ i = nCount++;
+ pDataArr[i].nNext = *pFound;
+ pDataArr[i].nHash = nH;
+ pDataArr[i].pLine = pLine;
+ *pFound = i;
+ break;
+ }
+ else if( pDataArr[i].nHash == nH &&
+ pDataArr[i].pLine->Compare( *pLine ))
+ break;
+
+ rData.SetIndex( n, i );
+ }
+ }
+}
+
+// ----------------------------------------------------------------------
+
+Compare::Compare( sal_uLong nDiff, CompareData& rData1, CompareData& rData2 )
+{
+ MovedData *pMD1, *pMD2;
+ // Suche die unterschiedlichen Lines
+ {
+ sal_Char* pDiscard1 = new sal_Char[ rData1.GetLineCount() ];
+ sal_Char* pDiscard2 = new sal_Char[ rData2.GetLineCount() ];
+
+ sal_uLong* pCount1 = new sal_uLong[ nDiff ];
+ sal_uLong* pCount2 = new sal_uLong[ nDiff ];
+ memset( pCount1, 0, nDiff * sizeof( sal_uLong ));
+ memset( pCount2, 0, nDiff * sizeof( sal_uLong ));
+
+ // stelle fest, welche Indizies in den CompareData mehrfach vergeben wurden
+ CountDifference( rData1, pCount1 );
+ CountDifference( rData2, pCount2 );
+
+ // alle die jetzt nur einmal vorhanden sind, sind eingefuegt oder
+ // geloescht worden. Alle die im anderen auch vorhanden sind, sind
+ // verschoben worden
+ SetDiscard( rData1, pDiscard1, pCount2 );
+ SetDiscard( rData2, pDiscard2, pCount1 );
+
+ // die Arrays koennen wir wieder vergessen
+ delete [] pCount1; delete [] pCount2;
+
+ CheckDiscard( rData1.GetLineCount(), pDiscard1 );
+ CheckDiscard( rData2.GetLineCount(), pDiscard2 );
+
+ pMD1 = new MovedData( rData1, pDiscard1 );
+ pMD2 = new MovedData( rData2, pDiscard2 );
+
+ // die Arrays koennen wir wieder vergessen
+ delete [] pDiscard1; delete [] pDiscard2;
+ }
+
+ {
+ CompareSequence aTmp( rData1, rData2, *pMD1, *pMD2 );
+ }
+
+ ShiftBoundaries( rData1, rData2 );
+
+ delete pMD1;
+ delete pMD2;
+}
+
+
+
+void Compare::CountDifference( const CompareData& rData, sal_uLong* pCounts )
+{
+ sal_uLong nLen = rData.GetLineCount();
+ for( sal_uLong n = 0; n < nLen; ++n )
+ {
+ sal_uLong nIdx = rData.GetIndex( n );
+ ++pCounts[ nIdx ];
+ }
+}
+
+void Compare::SetDiscard( const CompareData& rData,
+ sal_Char* pDiscard, sal_uLong* pCounts )
+{
+ sal_uLong nLen = rData.GetLineCount();
+
+ // berechne Max in Abhanegigkeit zur LineAnzahl
+ sal_uInt16 nMax = 5;
+ sal_uLong n;
+
+ for( n = nLen / 64; ( n = n >> 2 ) > 0; )
+ nMax <<= 1;
+
+ for( n = 0; n < nLen; ++n )
+ {
+ sal_uLong nIdx = rData.GetIndex( n );
+ if( nIdx )
+ {
+ nIdx = pCounts[ nIdx ];
+ pDiscard[ n ] = !nIdx ? 1 : nIdx > nMax ? 2 : 0;
+ }
+ else
+ pDiscard[ n ] = 0;
+ }
+}
+
+void Compare::CheckDiscard( sal_uLong nLen, sal_Char* pDiscard )
+{
+ for( sal_uLong n = 0; n < nLen; ++n )
+ {
+ if( 2 == pDiscard[ n ] )
+ pDiscard[n] = 0;
+ else if( pDiscard[ n ] )
+ {
+ sal_uLong j;
+ sal_uLong length;
+ sal_uLong provisional = 0;
+
+ /* Find end of this run of discardable lines.
+ Count how many are provisionally discardable. */
+ for (j = n; j < nLen; j++)
+ {
+ if( !pDiscard[j] )
+ break;
+ if( 2 == pDiscard[j] )
+ ++provisional;
+ }
+
+ /* Cancel provisional discards at end, and shrink the run. */
+ while( j > n && 2 == pDiscard[j - 1] )
+ pDiscard[ --j ] = 0, --provisional;
+
+ /* Now we have the length of a run of discardable lines
+ whose first and last are not provisional. */
+ length = j - n;
+
+ /* If 1/4 of the lines in the run are provisional,
+ cancel discarding of all provisional lines in the run. */
+ if (provisional * 4 > length)
+ {
+ while (j > n)
+ if (pDiscard[--j] == 2)
+ pDiscard[j] = 0;
+ }
+ else
+ {
+ sal_uLong consec;
+ sal_uLong minimum = 1;
+ sal_uLong tem = length / 4;
+
+ /* MINIMUM is approximate square root of LENGTH/4.
+ A subrun of two or more provisionals can stand
+ when LENGTH is at least 16.
+ A subrun of 4 or more can stand when LENGTH >= 64. */
+ while ((tem = tem >> 2) > 0)
+ minimum *= 2;
+ minimum++;
+
+ /* Cancel any subrun of MINIMUM or more provisionals
+ within the larger run. */
+ for (j = 0, consec = 0; j < length; j++)
+ if (pDiscard[n + j] != 2)
+ consec = 0;
+ else if (minimum == ++consec)
+ /* Back up to start of subrun, to cancel it all. */
+ j -= consec;
+ else if (minimum < consec)
+ pDiscard[n + j] = 0;
+
+ /* Scan from beginning of run
+ until we find 3 or more nonprovisionals in a row
+ or until the first nonprovisional at least 8 lines in.
+ Until that point, cancel any provisionals. */
+ for (j = 0, consec = 0; j < length; j++)
+ {
+ if (j >= 8 && pDiscard[n + j] == 1)
+ break;
+ if (pDiscard[n + j] == 2)
+ consec = 0, pDiscard[n + j] = 0;
+ else if (pDiscard[n + j] == 0)
+ consec = 0;
+ else
+ consec++;
+ if (consec == 3)
+ break;
+ }
+
+ /* I advances to the last line of the run. */
+ n += length - 1;
+
+ /* Same thing, from end. */
+ for (j = 0, consec = 0; j < length; j++)
+ {
+ if (j >= 8 && pDiscard[n - j] == 1)
+ break;
+ if (pDiscard[n - j] == 2)
+ consec = 0, pDiscard[n - j] = 0;
+ else if (pDiscard[n - j] == 0)
+ consec = 0;
+ else
+ consec++;
+ if (consec == 3)
+ break;
+ }
+ }
+ }
+ }
+}
+
+// ----------------------------------------------------------------------
+
+Compare::MovedData::MovedData( CompareData& rData, sal_Char* pDiscard )
+ : pIndex( 0 ), pLineNum( 0 ), nCount( 0 )
+{
+ sal_uLong nLen = rData.GetLineCount();
+ sal_uLong n;
+
+ for( n = 0; n < nLen; ++n )
+ if( pDiscard[ n ] )
+ rData.SetChanged( n );
+ else
+ ++nCount;
+
+ if( nCount )
+ {
+ pIndex = new sal_uLong[ nCount ];
+ pLineNum = new sal_uLong[ nCount ];
+
+ for( n = 0, nCount = 0; n < nLen; ++n )
+ if( !pDiscard[ n ] )
+ {
+ pIndex[ nCount ] = rData.GetIndex( n );
+ pLineNum[ nCount++ ] = n;
+ }
+ }
+}
+
+Compare::MovedData::~MovedData()
+{
+ delete pIndex;
+ delete pLineNum;
+}
+
+// ----------------------------------------------------------------------
+
+ // Suche die verschobenen Lines
+Compare::CompareSequence::CompareSequence(
+ CompareData& rD1, CompareData& rD2,
+ const MovedData& rMD1, const MovedData& rMD2 )
+ : rData1( rD1 ), rData2( rD2 ), rMoved1( rMD1 ), rMoved2( rMD2 )
+{
+ sal_uLong nSize = rMD1.GetCount() + rMD2.GetCount() + 3;
+ pMemory = new long[ nSize * 2 ];
+ pFDiag = pMemory + ( rMD2.GetCount() + 1 );
+ pBDiag = pMemory + ( nSize + rMD2.GetCount() + 1 );
+
+ Compare( 0, rMD1.GetCount(), 0, rMD2.GetCount() );
+}
+
+Compare::CompareSequence::~CompareSequence()
+{
+ delete pMemory;
+}
+
+void Compare::CompareSequence::Compare( sal_uLong nStt1, sal_uLong nEnd1,
+ sal_uLong nStt2, sal_uLong nEnd2 )
+{
+ /* Slide down the bottom initial diagonal. */
+ while( nStt1 < nEnd1 && nStt2 < nEnd2 &&
+ rMoved1.GetIndex( nStt1 ) == rMoved2.GetIndex( nStt2 ))
+ ++nStt1, ++nStt2;
+
+ /* Slide up the top initial diagonal. */
+ while( nEnd1 > nStt1 && nEnd2 > nStt2 &&
+ rMoved1.GetIndex( nEnd1 - 1 ) == rMoved2.GetIndex( nEnd2 - 1 ))
+ --nEnd1, --nEnd2;
+
+ /* Handle simple cases. */
+ if( nStt1 == nEnd1 )
+ while( nStt2 < nEnd2 )
+ rData2.SetChanged( rMoved2.GetLineNum( nStt2++ ));
+
+ else if (nStt2 == nEnd2)
+ while (nStt1 < nEnd1)
+ rData1.SetChanged( rMoved1.GetLineNum( nStt1++ ));
+
+ else
+ {
+ sal_uLong c, d, b;
+
+ /* Find a point of correspondence in the middle of the files. */
+
+ d = CheckDiag( nStt1, nEnd1, nStt2, nEnd2, &c );
+ b = pBDiag[ d ];
+
+ if( 1 != c )
+ {
+ /* Use that point to split this problem into two subproblems. */
+ Compare( nStt1, b, nStt2, b - d );
+ /* This used to use f instead of b,
+ but that is incorrect!
+ It is not necessarily the case that diagonal d
+ has a snake from b to f. */
+ Compare( b, nEnd1, b - d, nEnd2 );
+ }
+ }
+}
+
+sal_uLong Compare::CompareSequence::CheckDiag( sal_uLong nStt1, sal_uLong nEnd1,
+ sal_uLong nStt2, sal_uLong nEnd2, sal_uLong* pCost )
+{
+ const long dmin = nStt1 - nEnd2; /* Minimum valid diagonal. */
+ const long dmax = nEnd1 - nStt2; /* Maximum valid diagonal. */
+ const long fmid = nStt1 - nStt2; /* Center diagonal of top-down search. */
+ const long bmid = nEnd1 - nEnd2; /* Center diagonal of bottom-up search. */
+
+ long fmin = fmid, fmax = fmid; /* Limits of top-down search. */
+ long bmin = bmid, bmax = bmid; /* Limits of bottom-up search. */
+
+ long c; /* Cost. */
+ long odd = (fmid - bmid) & 1; /* True if southeast corner is on an odd
+ diagonal with respect to the northwest. */
+
+ pFDiag[fmid] = nStt1;
+ pBDiag[bmid] = nEnd1;
+
+ for (c = 1;; ++c)
+ {
+ long d; /* Active diagonal. */
+ long big_snake = 0;
+
+ /* Extend the top-down search by an edit step in each diagonal. */
+ fmin > dmin ? pFDiag[--fmin - 1] = -1 : ++fmin;
+ fmax < dmax ? pFDiag[++fmax + 1] = -1 : --fmax;
+ for (d = fmax; d >= fmin; d -= 2)
+ {
+ long x, y, oldx, tlo = pFDiag[d - 1], thi = pFDiag[d + 1];
+
+ if (tlo >= thi)
+ x = tlo + 1;
+ else
+ x = thi;
+ oldx = x;
+ y = x - d;
+ while( sal_uLong(x) < nEnd1 && sal_uLong(y) < nEnd2 &&
+ rMoved1.GetIndex( x ) == rMoved2.GetIndex( y ))
+ ++x, ++y;
+ if (x - oldx > 20)
+ big_snake = 1;
+ pFDiag[d] = x;
+ if( odd && bmin <= d && d <= bmax && pBDiag[d] <= pFDiag[d] )
+ {
+ *pCost = 2 * c - 1;
+ return d;
+ }
+ }
+
+ /* Similar extend the bottom-up search. */
+ bmin > dmin ? pBDiag[--bmin - 1] = INT_MAX : ++bmin;
+ bmax < dmax ? pBDiag[++bmax + 1] = INT_MAX : --bmax;
+ for (d = bmax; d >= bmin; d -= 2)
+ {
+ long x, y, oldx, tlo = pBDiag[d - 1], thi = pBDiag[d + 1];
+
+ if (tlo < thi)
+ x = tlo;
+ else
+ x = thi - 1;
+ oldx = x;
+ y = x - d;
+ while( sal_uLong(x) > nStt1 && sal_uLong(y) > nStt2 &&
+ rMoved1.GetIndex( x - 1 ) == rMoved2.GetIndex( y - 1 ))
+ --x, --y;
+ if (oldx - x > 20)
+ big_snake = 1;
+ pBDiag[d] = x;
+ if (!odd && fmin <= d && d <= fmax && pBDiag[d] <= pFDiag[d])
+ {
+ *pCost = 2 * c;
+ return d;
+ }
+ }
+ }
+}
+
+void Compare::ShiftBoundaries( CompareData& rData1, CompareData& rData2 )
+{
+ for( int iz = 0; iz < 2; ++iz )
+ {
+ CompareData* pData = &rData1;
+ CompareData* pOtherData = &rData2;
+
+ sal_uLong i = 0;
+ sal_uLong j = 0;
+ sal_uLong i_end = pData->GetLineCount();
+ sal_uLong preceding = ULONG_MAX;
+ sal_uLong other_preceding = ULONG_MAX;
+
+ while (1)
+ {
+ sal_uLong start, other_start;
+
+ /* Scan forwards to find beginning of another run of changes.
+ Also keep track of the corresponding point in the other file. */
+
+ while( i < i_end && !pData->GetChanged( i ) )
+ {
+ while( pOtherData->GetChanged( j++ ))
+ /* Non-corresponding lines in the other file
+ will count as the preceding batch of changes. */
+ other_preceding = j;
+ i++;
+ }
+
+ if (i == i_end)
+ break;
+
+ start = i;
+ other_start = j;
+
+ while (1)
+ {
+ /* Now find the end of this run of changes. */
+
+ while( pData->GetChanged( ++i ))
+ ;
+
+ /* If the first changed line matches the following unchanged one,
+ and this run does not follow right after a previous run,
+ and there are no lines deleted from the other file here,
+ then classify the first changed line as unchanged
+ and the following line as changed in its place. */
+
+ /* You might ask, how could this run follow right after another?
+ Only because the previous run was shifted here. */
+
+ if( i != i_end &&
+ pData->GetIndex( start ) == pData->GetIndex( i ) &&
+ !pOtherData->GetChanged( j ) &&
+ !( start == preceding || other_start == other_preceding ))
+ {
+ pData->SetChanged( start++, 0 );
+ pData->SetChanged( i );
+ /* Since one line-that-matches is now before this run
+ instead of after, we must advance in the other file
+ to keep in synch. */
+ ++j;
+ }
+ else
+ break;
+ }
+
+ preceding = i;
+ other_preceding = j;
+ }
+
+ pData = &rData2;
+ pOtherData = &rData1;
+ }
+}
+
+/* */
+
+class SwCompareLine : public CompareLine
+{
+ const SwNode& rNode;
+public:
+ SwCompareLine( const SwNode& rNd );
+ virtual ~SwCompareLine();
+
+ virtual sal_uLong GetHashValue() const;
+ virtual sal_Bool Compare( const CompareLine& rLine ) const;
+
+ static sal_uLong GetTxtNodeHashValue( const SwTxtNode& rNd, sal_uLong nVal );
+ static sal_Bool CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd );
+ static sal_Bool CompareTxtNd( const SwTxtNode& rDstNd,
+ const SwTxtNode& rSrcNd );
+
+ sal_Bool ChangesInLine( const SwCompareLine& rLine,
+ SwPaM *& rpInsRing, SwPaM*& rpDelRing ) const;
+
+ const SwNode& GetNode() const { return rNode; }
+
+ const SwNode& GetEndNode() const;
+
+ // fuers Debugging!
+ String GetText() const;
+};
+
+class SwCompareData : public CompareData
+{
+ SwDoc& rDoc;
+ SwPaM *pInsRing, *pDelRing;
+
+ sal_uLong PrevIdx( const SwNode* pNd );
+ sal_uLong NextIdx( const SwNode* pNd );
+
+ virtual void CheckRanges( CompareData& );
+ virtual void ShowInsert( sal_uLong nStt, sal_uLong nEnd );
+ virtual void ShowDelete( const CompareData& rData, sal_uLong nStt,
+ sal_uLong nEnd, sal_uLong nInsPos );
+
+ virtual void CheckForChangesInLine( const CompareData& rData,
+ sal_uLong& nStt, sal_uLong& nEnd,
+ sal_uLong& nThisStt, sal_uLong& nThisEnd );
+
+public:
+ SwCompareData( SwDoc& rD ) : rDoc( rD ), pInsRing(0), pDelRing(0) {}
+ virtual ~SwCompareData();
+
+ void SetRedlinesToDoc( sal_Bool bUseDocInfo );
+};
+
+// ----------------------------------------------------------------
+
+SwCompareLine::SwCompareLine( const SwNode& rNd )
+ : rNode( rNd )
+{
+}
+
+SwCompareLine::~SwCompareLine()
+{
+}
+
+sal_uLong SwCompareLine::GetHashValue() const
+{
+ sal_uLong nRet = 0;
+ switch( rNode.GetNodeType() )
+ {
+ case ND_TEXTNODE:
+ nRet = GetTxtNodeHashValue( (SwTxtNode&)rNode, nRet );
+ break;
+
+ case ND_TABLENODE:
+ {
+ const SwNode* pEndNd = rNode.EndOfSectionNode();
+ SwNodeIndex aIdx( rNode );
+ while( &aIdx.GetNode() != pEndNd )
+ {
+ if( aIdx.GetNode().IsTxtNode() )
+ nRet = GetTxtNodeHashValue( (SwTxtNode&)aIdx.GetNode(), nRet );
+ aIdx++;
+ }
+ }
+ break;
+
+ case ND_SECTIONNODE:
+ {
+ String sStr( GetText() );
+ for( xub_StrLen n = 0; n < sStr.Len(); ++n )
+ ( nRet <<= 1 ) += sStr.GetChar( n );
+ }
+ break;
+
+ case ND_GRFNODE:
+ case ND_OLENODE:
+ // feste Id ? sollte aber nie auftauchen
+ break;
+ }
+ return nRet;
+}
+
+const SwNode& SwCompareLine::GetEndNode() const
+{
+ const SwNode* pNd = &rNode;
+ switch( rNode.GetNodeType() )
+ {
+ case ND_TABLENODE:
+ pNd = rNode.EndOfSectionNode();
+ break;
+
+ case ND_SECTIONNODE:
+ {
+ const SwSectionNode& rSNd = (SwSectionNode&)rNode;
+ const SwSection& rSect = rSNd.GetSection();
+ if( CONTENT_SECTION != rSect.GetType() || rSect.IsProtect() )
+ pNd = rNode.EndOfSectionNode();
+ }
+ break;
+ }
+ return *pNd;
+}
+
+sal_Bool SwCompareLine::Compare( const CompareLine& rLine ) const
+{
+ return CompareNode( rNode, ((SwCompareLine&)rLine).rNode );
+}
+
+namespace
+{
+ static String SimpleTableToText(const SwNode &rNode)
+ {
+ String sRet;
+ const SwNode* pEndNd = rNode.EndOfSectionNode();
+ SwNodeIndex aIdx( rNode );
+ while (&aIdx.GetNode() != pEndNd)
+ {
+ if (aIdx.GetNode().IsTxtNode())
+ {
+ if (sRet.Len())
+ {
+ sRet.Append( '\n' );
+ }
+ sRet.Append( aIdx.GetNode().GetTxtNode()->GetExpandTxt() );
+ }
+ aIdx++;
+ }
+ return sRet;
+ }
+}
+
+sal_Bool SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd )
+{
+ if( rSrcNd.GetNodeType() != rDstNd.GetNodeType() )
+ return sal_False;
+
+ sal_Bool bRet = sal_False;
+
+ switch( rDstNd.GetNodeType() )
+ {
+ case ND_TEXTNODE:
+ bRet = CompareTxtNd( (SwTxtNode&)rDstNd, (SwTxtNode&)rSrcNd );
+ break;
+
+ case ND_TABLENODE:
+ {
+ const SwTableNode& rTSrcNd = (SwTableNode&)rSrcNd;
+ const SwTableNode& rTDstNd = (SwTableNode&)rDstNd;
+
+ bRet = ( rTSrcNd.EndOfSectionIndex() - rTSrcNd.GetIndex() ) ==
+ ( rTDstNd.EndOfSectionIndex() - rTDstNd.GetIndex() );
+
+ // --> #i107826#: compare actual table content
+ if (bRet)
+ {
+ bRet = (SimpleTableToText(rSrcNd) == SimpleTableToText(rDstNd));
+ }
+ // <--
+ }
+ break;
+
+ case ND_SECTIONNODE:
+ {
+ const SwSectionNode& rSSrcNd = (SwSectionNode&)rSrcNd,
+ & rSDstNd = (SwSectionNode&)rDstNd;
+ const SwSection& rSrcSect = rSSrcNd.GetSection(),
+ & rDstSect = rSDstNd.GetSection();
+ SectionType eSrcSectType = rSrcSect.GetType(),
+ eDstSectType = rDstSect.GetType();
+ switch( eSrcSectType )
+ {
+ case CONTENT_SECTION:
+ bRet = CONTENT_SECTION == eDstSectType &&
+ rSrcSect.IsProtect() == rDstSect.IsProtect();
+ if( bRet && rSrcSect.IsProtect() )
+ {
+ // the only have they both the same size
+ bRet = ( rSSrcNd.EndOfSectionIndex() - rSSrcNd.GetIndex() ) ==
+ ( rSDstNd.EndOfSectionIndex() - rSDstNd.GetIndex() );
+ }
+ break;
+
+ case TOX_HEADER_SECTION:
+ case TOX_CONTENT_SECTION:
+ if( TOX_HEADER_SECTION == eDstSectType ||
+ TOX_CONTENT_SECTION == eDstSectType )
+ {
+ // the same type of TOX?
+ const SwTOXBase* pSrcTOX = rSrcSect.GetTOXBase();
+ const SwTOXBase* pDstTOX = rDstSect.GetTOXBase();
+ bRet = pSrcTOX && pDstTOX
+ && pSrcTOX->GetType() == pDstTOX->GetType()
+ && pSrcTOX->GetTitle() == pDstTOX->GetTitle()
+ && pSrcTOX->GetTypeName() == pDstTOX->GetTypeName()
+// && pSrcTOX->GetTOXName() == pDstTOX->GetTOXName()
+ ;
+ }
+ break;
+
+ case DDE_LINK_SECTION:
+ case FILE_LINK_SECTION:
+ bRet = eSrcSectType == eDstSectType &&
+ rSrcSect.GetLinkFileName() ==
+ rDstSect.GetLinkFileName();
+ break;
+ }
+ }
+ break;
+
+ case ND_ENDNODE:
+ bRet = rSrcNd.StartOfSectionNode()->GetNodeType() ==
+ rDstNd.StartOfSectionNode()->GetNodeType();
+
+ // --> #i107826#: compare actual table content
+ if (bRet && rSrcNd.StartOfSectionNode()->GetNodeType() == ND_TABLENODE)
+ {
+ bRet = CompareNode(
+ *rSrcNd.StartOfSectionNode(), *rDstNd.StartOfSectionNode());
+ }
+ // <--
+
+ break;
+ }
+ return bRet;
+}
+
+String SwCompareLine::GetText() const
+{
+ String sRet;
+ switch( rNode.GetNodeType() )
+ {
+ case ND_TEXTNODE:
+ sRet = ((SwTxtNode&)rNode).GetExpandTxt();
+ break;
+
+ case ND_TABLENODE:
+ {
+ sRet = SimpleTableToText(rNode);
+ sRet.InsertAscii( "Tabelle: ", 0 );
+ }
+ break;
+
+ case ND_SECTIONNODE:
+ {
+ sRet.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Section - Node:" ));
+
+ const SwSectionNode& rSNd = (SwSectionNode&)rNode;
+ const SwSection& rSect = rSNd.GetSection();
+ switch( rSect.GetType() )
+ {
+ case CONTENT_SECTION:
+ if( rSect.IsProtect() )
+ sRet.Append( String::CreateFromInt32(
+ rSNd.EndOfSectionIndex() - rSNd.GetIndex() ));
+ break;
+
+ case TOX_HEADER_SECTION:
+ case TOX_CONTENT_SECTION:
+ {
+ const SwTOXBase* pTOX = rSect.GetTOXBase();
+ if( pTOX )
+ sRet.Append( pTOX->GetTitle() )
+ .Append( pTOX->GetTypeName() )
+// .Append( pTOX->GetTOXName() )
+ .Append( String::CreateFromInt32( pTOX->GetType() ));
+ }
+ break;
+
+ case DDE_LINK_SECTION:
+ case FILE_LINK_SECTION:
+ sRet += rSect.GetLinkFileName();
+ break;
+ }
+ }
+ break;
+
+ case ND_GRFNODE:
+ sRet.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Grafik - Node:" ));
+ break;
+ case ND_OLENODE:
+ sRet.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "OLE - Node:" ));
+ break;
+ }
+ return sRet;
+}
+
+sal_uLong SwCompareLine::GetTxtNodeHashValue( const SwTxtNode& rNd, sal_uLong nVal )
+{
+ String sStr( rNd.GetExpandTxt() );
+ for( xub_StrLen n = 0; n < sStr.Len(); ++n )
+ ( nVal <<= 1 ) += sStr.GetChar( n );
+ return nVal;
+}
+
+sal_Bool SwCompareLine::CompareTxtNd( const SwTxtNode& rDstNd,
+ const SwTxtNode& rSrcNd )
+{
+ sal_Bool bRet = sal_False;
+ // erstmal ganz einfach!
+ if( rDstNd.GetTxt() == rSrcNd.GetTxt() )
+ {
+ // der Text ist gleich, aber sind die "Sonderattribute" (0xFF) auch
+ // dieselben??
+ bRet = sal_True;
+ }
+ return bRet;
+}
+
+sal_Bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine,
+ SwPaM *& rpInsRing, SwPaM*& rpDelRing ) const
+{
+ sal_Bool bRet = sal_False;
+ if( ND_TEXTNODE == rNode.GetNodeType() &&
+ ND_TEXTNODE == rLine.GetNode().GetNodeType() )
+ {
+ SwTxtNode& rDestNd = *(SwTxtNode*)rNode.GetTxtNode();
+ const SwTxtNode& rSrcNd = *rLine.GetNode().GetTxtNode();
+
+ xub_StrLen nDEnd = rDestNd.GetTxt().Len(), nSEnd = rSrcNd.GetTxt().Len();
+ xub_StrLen nStt;
+ xub_StrLen nEnd;
+
+ for( nStt = 0, nEnd = Min( nDEnd, nSEnd ); nStt < nEnd; ++nStt )
+ if( rDestNd.GetTxt().GetChar( nStt ) !=
+ rSrcNd.GetTxt().GetChar( nStt ) )
+ break;
+
+ while( nStt < nDEnd && nStt < nSEnd )
+ {
+ --nDEnd, --nSEnd;
+ if( rDestNd.GetTxt().GetChar( nDEnd ) !=
+ rSrcNd.GetTxt().GetChar( nSEnd ) )
+ {
+ ++nDEnd, ++nSEnd;
+ break;
+ }
+ }
+
+ if( nStt || !nDEnd || !nSEnd || nDEnd < rDestNd.GetTxt().Len() ||
+ nSEnd < rSrcNd.GetTxt().Len() )
+ {
+ // jetzt ist zwischen nStt bis nDEnd das neu eingefuegte
+ // und zwischen nStt und nSEnd das geloeschte
+ SwDoc* pDoc = rDestNd.GetDoc();
+ SwPaM aPam( rDestNd, nDEnd );
+ if( nStt != nDEnd )
+ {
+ SwPaM* pTmp = new SwPaM( *aPam.GetPoint(), rpInsRing );
+ if( !rpInsRing )
+ rpInsRing = pTmp;
+
+ pTmp->SetMark();
+ pTmp->GetMark()->nContent = nStt;
+ }
+
+ if( nStt != nSEnd )
+ {
+ {
+ ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
+ SwPaM aCpyPam( rSrcNd, nStt );
+ aCpyPam.SetMark();
+ aCpyPam.GetPoint()->nContent = nSEnd;
+ aCpyPam.GetDoc()->CopyRange( aCpyPam, *aPam.GetPoint(),
+ false );
+ }
+
+ SwPaM* pTmp = new SwPaM( *aPam.GetPoint(), rpDelRing );
+ if( !rpDelRing )
+ rpDelRing = pTmp;
+
+ pTmp->SetMark();
+ pTmp->GetMark()->nContent = nDEnd;
+
+ if( rpInsRing )
+ {
+ SwPaM* pCorr = (SwPaM*)rpInsRing->GetPrev();
+ if( *pCorr->GetPoint() == *pTmp->GetPoint() )
+ *pCorr->GetPoint() = *pTmp->GetMark();
+ }
+ }
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+// ----------------------------------------------------------------
+
+SwCompareData::~SwCompareData()
+{
+ if( pDelRing )
+ {
+ while( pDelRing->GetNext() != pDelRing )
+ delete pDelRing->GetNext();
+ delete pDelRing;
+ }
+ if( pInsRing )
+ {
+ while( pInsRing->GetNext() != pInsRing )
+ delete pInsRing->GetNext();
+ delete pInsRing;
+ }
+}
+
+sal_uLong SwCompareData::NextIdx( const SwNode* pNd )
+{
+ if( pNd->IsStartNode() )
+ {
+ const SwSectionNode* pSNd;
+ if( pNd->IsTableNode() ||
+ ( 0 != (pSNd = pNd->GetSectionNode() ) &&
+ ( CONTENT_SECTION != pSNd->GetSection().GetType() ||
+ pSNd->GetSection().IsProtect() ) ) )
+ pNd = pNd->EndOfSectionNode();
+ }
+ return pNd->GetIndex() + 1;
+}
+
+sal_uLong SwCompareData::PrevIdx( const SwNode* pNd )
+{
+ if( pNd->IsEndNode() )
+ {
+ const SwSectionNode* pSNd;
+ if( pNd->StartOfSectionNode()->IsTableNode() ||
+ ( 0 != (pSNd = pNd->StartOfSectionNode()->GetSectionNode() ) &&
+ ( CONTENT_SECTION != pSNd->GetSection().GetType() ||
+ pSNd->GetSection().IsProtect() ) ) )
+ pNd = pNd->StartOfSectionNode();
+ }
+ return pNd->GetIndex() - 1;
+}
+
+
+void SwCompareData::CheckRanges( CompareData& rData )
+{
+ const SwNodes& rSrcNds = ((SwCompareData&)rData).rDoc.GetNodes();
+ const SwNodes& rDstNds = rDoc.GetNodes();
+
+ const SwNode& rSrcEndNd = rSrcNds.GetEndOfContent();
+ const SwNode& rDstEndNd = rDstNds.GetEndOfContent();
+
+ sal_uLong nSrcSttIdx = NextIdx( rSrcEndNd.StartOfSectionNode() );
+ sal_uLong nSrcEndIdx = rSrcEndNd.GetIndex();
+
+ sal_uLong nDstSttIdx = NextIdx( rDstEndNd.StartOfSectionNode() );
+ sal_uLong nDstEndIdx = rDstEndNd.GetIndex();
+
+ while( nSrcSttIdx < nSrcEndIdx && nDstSttIdx < nDstEndIdx )
+ {
+ const SwNode* pSrcNd = rSrcNds[ nSrcSttIdx ];
+ const SwNode* pDstNd = rDstNds[ nDstSttIdx ];
+ if( !SwCompareLine::CompareNode( *pSrcNd, *pDstNd ))
+ break;
+
+ nSrcSttIdx = NextIdx( pSrcNd );
+ nDstSttIdx = NextIdx( pDstNd );
+ }
+
+ nSrcEndIdx = PrevIdx( &rSrcEndNd );
+ nDstEndIdx = PrevIdx( &rDstEndNd );
+ while( nSrcSttIdx < nSrcEndIdx && nDstSttIdx < nDstEndIdx )
+ {
+ const SwNode* pSrcNd = rSrcNds[ nSrcEndIdx ];
+ const SwNode* pDstNd = rDstNds[ nDstEndIdx ];
+ if( !SwCompareLine::CompareNode( *pSrcNd, *pDstNd ))
+ break;
+
+ nSrcEndIdx = PrevIdx( pSrcNd );
+ nDstEndIdx = PrevIdx( pDstNd );
+ }
+
+ while( nSrcSttIdx <= nSrcEndIdx )
+ {
+ const SwNode* pNd = rSrcNds[ nSrcSttIdx ];
+ rData.InsertLine( new SwCompareLine( *pNd ) );
+ nSrcSttIdx = NextIdx( pNd );
+ }
+
+ while( nDstSttIdx <= nDstEndIdx )
+ {
+ const SwNode* pNd = rDstNds[ nDstSttIdx ];
+ InsertLine( new SwCompareLine( *pNd ) );
+ nDstSttIdx = NextIdx( pNd );
+ }
+}
+
+
+void SwCompareData::ShowInsert( sal_uLong nStt, sal_uLong nEnd )
+{
+ SwPaM* pTmp = new SwPaM( ((SwCompareLine*)GetLine( nStt ))->GetNode(), 0,
+ ((SwCompareLine*)GetLine( nEnd-1 ))->GetEndNode(), 0,
+ pInsRing );
+ if( !pInsRing )
+ pInsRing = pTmp;
+
+ // #i65201#: These SwPaMs are calculated smaller than needed, see comment below
+
+}
+
+void SwCompareData::ShowDelete( const CompareData& rData, sal_uLong nStt,
+ sal_uLong nEnd, sal_uLong nInsPos )
+{
+ SwNodeRange aRg(
+ ((SwCompareLine*)rData.GetLine( nStt ))->GetNode(), 0,
+ ((SwCompareLine*)rData.GetLine( nEnd-1 ))->GetEndNode(), 1 );
+
+ sal_uInt16 nOffset = 0;
+ const CompareLine* pLine;
+ if( GetLineCount() == nInsPos )
+ {
+ pLine = GetLine( nInsPos-1 );
+ nOffset = 1;
+ }
+ else
+ pLine = GetLine( nInsPos );
+
+ const SwNode* pLineNd;
+ if( pLine )
+ {
+ if( nOffset )
+ pLineNd = &((SwCompareLine*)pLine)->GetEndNode();
+ else
+ pLineNd = &((SwCompareLine*)pLine)->GetNode();
+ }
+ else
+ {
+ pLineNd = &rDoc.GetNodes().GetEndOfContent();
+ nOffset = 0;
+ }
+
+ SwNodeIndex aInsPos( *pLineNd, nOffset );
+ SwNodeIndex aSavePos( aInsPos, -1 );
+
+ ((SwCompareData&)rData).rDoc.CopyWithFlyInFly( aRg, 0, aInsPos );
+ rDoc.SetModified();
+ aSavePos++;
+
+ // #i65201#: These SwPaMs are calculated when the (old) delete-redlines are hidden,
+ // they will be inserted when the delete-redlines are shown again.
+ // To avoid unwanted insertions of delete-redlines into these new redlines, what happens
+ // especially at the end of the document, I reduce the SwPaM by one node.
+ // Before the new redlines are inserted, they have to expand again.
+ SwPaM* pTmp = new SwPaM( aSavePos.GetNode(), aInsPos.GetNode(), 0, -1, pDelRing );
+ if( !pDelRing )
+ pDelRing = pTmp;
+
+ if( pInsRing )
+ {
+ SwPaM* pCorr = (SwPaM*)pInsRing->GetPrev();
+ if( *pCorr->GetPoint() == *pTmp->GetPoint() )
+ {
+ SwNodeIndex aTmpPos( pTmp->GetMark()->nNode, -1 );
+ *pCorr->GetPoint() = SwPosition( aTmpPos );
+ }
+ }
+}
+
+void SwCompareData::CheckForChangesInLine( const CompareData& rData,
+ sal_uLong& rStt, sal_uLong& rEnd,
+ sal_uLong& rThisStt, sal_uLong& rThisEnd )
+{
+ while( rStt < rEnd && rThisStt < rThisEnd )
+ {
+ SwCompareLine* pDstLn = (SwCompareLine*)GetLine( rThisStt );
+ SwCompareLine* pSrcLn = (SwCompareLine*)rData.GetLine( rStt );
+ if( !pDstLn->ChangesInLine( *pSrcLn, pInsRing, pDelRing ) )
+ break;
+
+ ++rStt;
+ ++rThisStt;
+ }
+}
+
+void SwCompareData::SetRedlinesToDoc( sal_Bool bUseDocInfo )
+{
+ SwPaM* pTmp = pDelRing;
+
+ // Bug #83296#: get the Author / TimeStamp from the "other"
+ // document info
+ sal_uInt16 nAuthor = rDoc.GetRedlineAuthor();
+ DateTime aTimeStamp;
+ SwDocShell *pDocShell(rDoc.GetDocShell());
+ DBG_ASSERT(pDocShell, "no SwDocShell");
+ if (pDocShell) {
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pDocShell->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps(
+ xDPS->getDocumentProperties());
+ DBG_ASSERT(xDocProps.is(), "Doc has no DocumentProperties");
+
+ if( bUseDocInfo && xDocProps.is() ) {
+ String aTmp( 1 == xDocProps->getEditingCycles()
+ ? xDocProps->getAuthor()
+ : xDocProps->getModifiedBy() );
+ util::DateTime uDT( 1 == xDocProps->getEditingCycles()
+ ? xDocProps->getCreationDate()
+ : xDocProps->getModificationDate() );
+ Date d(uDT.Day, uDT.Month, uDT.Year);
+ Time t(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds);
+ DateTime aDT(d,t);
+
+ if( aTmp.Len() )
+ {
+ nAuthor = rDoc.InsertRedlineAuthor( aTmp );
+ aTimeStamp = aDT;
+ }
+ }
+ }
+
+ if( pTmp )
+ {
+ SwRedlineData aRedlnData( nsRedlineType_t::REDLINE_DELETE, nAuthor, aTimeStamp,
+ aEmptyStr, 0, 0 );
+ do {
+ // #i65201#: Expand again, see comment above.
+ if( pTmp->GetPoint()->nContent == 0 )
+ {
+ pTmp->GetPoint()->nNode++;
+ pTmp->GetPoint()->nContent.Assign( pTmp->GetCntntNode(), 0 );
+ }
+ // --> mst 2010-05-17 #i101009#
+ // prevent redlines that end on structural end node
+ if (& rDoc.GetNodes().GetEndOfContent() ==
+ & pTmp->GetPoint()->nNode.GetNode())
+ {
+ pTmp->GetPoint()->nNode--;
+ SwCntntNode *const pContentNode( pTmp->GetCntntNode() );
+ pTmp->GetPoint()->nContent.Assign( pContentNode,
+ (pContentNode) ? pContentNode->Len() : 0 );
+ }
+ // <--
+
+ rDoc.DeleteRedline( *pTmp, false, USHRT_MAX );
+
+ if (rDoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, sal_False )) ;
+ rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ rDoc.AppendRedline( new SwRedline( aRedlnData, *pTmp ), true );
+
+ } while( pDelRing != ( pTmp = (SwPaM*)pTmp->GetNext() ));
+ }
+
+ pTmp = pInsRing;
+ if( pTmp )
+ {
+ do {
+ if( pTmp->GetPoint()->nContent == 0 )
+ {
+ pTmp->GetPoint()->nNode++;
+ pTmp->GetPoint()->nContent.Assign( pTmp->GetCntntNode(), 0 );
+ }
+ // --> mst 2010-05-17 #i101009#
+ // prevent redlines that end on structural end node
+ if (& rDoc.GetNodes().GetEndOfContent() ==
+ & pTmp->GetPoint()->nNode.GetNode())
+ {
+ pTmp->GetPoint()->nNode--;
+ SwCntntNode *const pContentNode( pTmp->GetCntntNode() );
+ pTmp->GetPoint()->nContent.Assign( pContentNode,
+ (pContentNode) ? pContentNode->Len() : 0 );
+ }
+ // <--
+ } while( pInsRing != ( pTmp = (SwPaM*)pTmp->GetNext() ));
+ SwRedlineData aRedlnData( nsRedlineType_t::REDLINE_INSERT, nAuthor, aTimeStamp,
+ aEmptyStr, 0, 0 );
+
+ // zusammenhaengende zusammenfassen
+ if( pTmp->GetNext() != pInsRing )
+ {
+ const SwCntntNode* pCNd;
+ do {
+ SwPosition& rSttEnd = *pTmp->End(),
+ & rEndStt = *((SwPaM*)pTmp->GetNext())->Start();
+ if( rSttEnd == rEndStt ||
+ (!rEndStt.nContent.GetIndex() &&
+ rEndStt.nNode.GetIndex() - 1 == rSttEnd.nNode.GetIndex() &&
+ 0 != ( pCNd = rSttEnd.nNode.GetNode().GetCntntNode() )
+ ? rSttEnd.nContent.GetIndex() == pCNd->Len()
+ : 0 ))
+ {
+ if( pTmp->GetNext() == pInsRing )
+ {
+ // liegen hintereinander also zusammen fassen
+ rEndStt = *pTmp->Start();
+ delete pTmp;
+ pTmp = pInsRing;
+ }
+ else
+ {
+ // liegen hintereinander also zusammen fassen
+ rSttEnd = *((SwPaM*)pTmp->GetNext())->End();
+ delete pTmp->GetNext();
+ }
+ }
+ else
+ pTmp = (SwPaM*)pTmp->GetNext();
+ } while( pInsRing != pTmp );
+ }
+
+ do {
+ if( rDoc.AppendRedline( new SwRedline( aRedlnData, *pTmp ), true) &&
+ rDoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, sal_True ));
+ rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ } while( pInsRing != ( pTmp = (SwPaM*)pTmp->GetNext() ));
+ }
+}
+
+/* */
+
+
+
+ // returnt (?die Anzahl der Unterschiede?) ob etwas unterschiedlich ist
+long SwDoc::CompareDoc( const SwDoc& rDoc )
+{
+ if( &rDoc == this )
+ return 0;
+
+ long nRet = 0;
+
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+ sal_Bool bDocWasModified = IsModified();
+ SwDoc& rSrcDoc = (SwDoc&)rDoc;
+ sal_Bool bSrcModified = rSrcDoc.IsModified();
+
+ RedlineMode_t eSrcRedlMode = rSrcDoc.GetRedlineMode();
+ rSrcDoc.SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT );
+ SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT));
+
+ SwCompareData aD0( rSrcDoc );
+ SwCompareData aD1( *this );
+
+ aD1.CompareLines( aD0 );
+
+ nRet = aD1.ShowDiffs( aD0 );
+
+ if( nRet )
+ {
+ SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_ON |
+ nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
+
+ aD1.SetRedlinesToDoc( !bDocWasModified );
+ SetModified();
+ }
+
+ rSrcDoc.SetRedlineMode( eSrcRedlMode );
+ SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
+
+ if( !bSrcModified )
+ rSrcDoc.ResetModified();
+
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+
+ return nRet;
+}
+
+
+class _SaveMergeRedlines : public Ring
+{
+ const SwRedline* pSrcRedl;
+ SwRedline* pDestRedl;
+public:
+ _SaveMergeRedlines( const SwNode& rDstNd,
+ const SwRedline& rSrcRedl, Ring* pRing );
+ sal_uInt16 InsertRedline();
+
+ SwRedline* GetDestRedline() { return pDestRedl; }
+};
+
+_SaveMergeRedlines::_SaveMergeRedlines( const SwNode& rDstNd,
+ const SwRedline& rSrcRedl, Ring* pRing )
+ : Ring( pRing ), pSrcRedl( &rSrcRedl )
+{
+ SwPosition aPos( rDstNd );
+
+ const SwPosition* pStt = rSrcRedl.Start();
+ if( rDstNd.IsCntntNode() )
+ aPos.nContent.Assign( ((SwCntntNode*)&rDstNd), pStt->nContent.GetIndex() );
+ pDestRedl = new SwRedline( rSrcRedl.GetRedlineData(), aPos );
+
+ if( nsRedlineType_t::REDLINE_DELETE == pDestRedl->GetType() )
+ {
+ // den Bereich als geloescht kennzeichnen
+ const SwPosition* pEnd = pStt == rSrcRedl.GetPoint()
+ ? rSrcRedl.GetMark()
+ : rSrcRedl.GetPoint();
+
+ pDestRedl->SetMark();
+ pDestRedl->GetPoint()->nNode += pEnd->nNode.GetIndex() -
+ pStt->nNode.GetIndex();
+ pDestRedl->GetPoint()->nContent.Assign( pDestRedl->GetCntntNode(),
+ pEnd->nContent.GetIndex() );
+ }
+}
+
+sal_uInt16 _SaveMergeRedlines::InsertRedline()
+{
+ sal_uInt16 nIns = 0;
+ SwDoc* pDoc = pDestRedl->GetDoc();
+
+ if( nsRedlineType_t::REDLINE_INSERT == pDestRedl->GetType() )
+ {
+ // der Teil wurde eingefuegt, also kopiere ihn aus dem SourceDoc
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+
+ SwNodeIndex aSaveNd( pDestRedl->GetPoint()->nNode, -1 );
+ xub_StrLen nSaveCnt = pDestRedl->GetPoint()->nContent.GetIndex();
+
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+ pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+
+ pSrcRedl->GetDoc()->CopyRange(
+ *const_cast<SwPaM*>(static_cast<const SwPaM*>(pSrcRedl)),
+ *pDestRedl->GetPoint(), false );
+
+ pDoc->SetRedlineMode_intern( eOld );
+
+ pDestRedl->SetMark();
+ aSaveNd++;
+ pDestRedl->GetMark()->nNode = aSaveNd;
+ pDestRedl->GetMark()->nContent.Assign( aSaveNd.GetNode().GetCntntNode(),
+ nSaveCnt );
+
+ if( GetPrev() != this )
+ {
+ SwPaM* pTmpPrev = ((_SaveMergeRedlines*)GetPrev())->pDestRedl;
+ if( pTmpPrev && *pTmpPrev->GetPoint() == *pDestRedl->GetPoint() )
+ *pTmpPrev->GetPoint() = *pDestRedl->GetMark();
+ }
+ }
+ else
+ {
+ //JP 21.09.98: Bug 55909
+ // falls im Doc auf gleicher Pos aber schon ein geloeschter oder
+ // eingefuegter ist, dann muss dieser gesplittet werden!
+ SwPosition* pDStt = pDestRedl->GetMark(),
+ * pDEnd = pDestRedl->GetPoint();
+ sal_uInt16 n = 0;
+
+ // zur StartPos das erste Redline suchen
+ if( !pDoc->GetRedline( *pDStt, &n ) && n )
+ --n;
+
+ const SwRedlineTbl& rRedlineTbl = pDoc->GetRedlineTbl();
+ for( ; n < rRedlineTbl.Count(); ++n )
+ {
+ SwRedline* pRedl = rRedlineTbl[ n ];
+ SwPosition* pRStt = pRedl->Start(),
+ * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark()
+ : pRedl->GetPoint();
+ if( nsRedlineType_t::REDLINE_DELETE == pRedl->GetType() ||
+ nsRedlineType_t::REDLINE_INSERT == pRedl->GetType() )
+ {
+ SwComparePosition eCmpPos = ComparePosition( *pDStt, *pDEnd, *pRStt, *pREnd );
+ switch( eCmpPos )
+ {
+ case POS_COLLIDE_START:
+ case POS_BEHIND:
+ break;
+
+ case POS_INSIDE:
+ case POS_EQUAL:
+ delete pDestRedl, pDestRedl = 0;
+ // break; -> kein break !!!!
+
+ case POS_COLLIDE_END:
+ case POS_BEFORE:
+ n = rRedlineTbl.Count();
+ break;
+
+ case POS_OUTSIDE:
+ {
+ SwRedline* pCpyRedl = new SwRedline(
+ pDestRedl->GetRedlineData(), *pDStt );
+ pCpyRedl->SetMark();
+ *pCpyRedl->GetPoint() = *pRStt;
+
+ SwUndoCompDoc *const pUndo =
+ (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoCompDoc( *pCpyRedl ) : 0;
+
+ // now modify doc: append redline, undo (and count)
+ pDoc->AppendRedline( pCpyRedl, true );
+ if( pUndo )
+ {
+ pDoc->GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ ++nIns;
+
+ *pDStt = *pREnd;
+
+ // dann solle man neu anfangen
+ n = USHRT_MAX;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ *pDEnd = *pRStt;
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ *pDStt = *pREnd;
+ break;
+ }
+ }
+ else if( *pDEnd <= *pRStt )
+ break;
+ }
+
+ }
+
+ if( pDestRedl )
+ {
+ SwUndoCompDoc *const pUndo = (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoCompDoc( *pDestRedl ) : 0;
+
+ // now modify doc: append redline, undo (and count)
+ bool bRedlineAccepted = pDoc->AppendRedline( pDestRedl, true );
+ if( pUndo )
+ {
+ pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ ++nIns;
+
+ // if AppendRedline has deleted our redline, we may not keep a
+ // reference to it
+ if( ! bRedlineAccepted )
+ pDestRedl = NULL;
+ }
+ return nIns;
+}
+
+// merge zweier Dokumente
+long SwDoc::MergeDoc( const SwDoc& rDoc )
+{
+ if( &rDoc == this )
+ return 0;
+
+ long nRet = 0;
+
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+
+ SwDoc& rSrcDoc = (SwDoc&)rDoc;
+ sal_Bool bSrcModified = rSrcDoc.IsModified();
+
+ RedlineMode_t eSrcRedlMode = rSrcDoc.GetRedlineMode();
+ rSrcDoc.SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_DELETE );
+ SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_DELETE );
+
+ SwCompareData aD0( rSrcDoc );
+ SwCompareData aD1( *this );
+
+ aD1.CompareLines( aD0 );
+
+ if( !aD1.HasDiffs( aD0 ) )
+ {
+ // jetzt wollen wir alle Redlines aus dem SourceDoc zu uns bekommen
+
+ // suche alle Insert - Redlines aus dem SourceDoc und bestimme
+ // deren Position im DestDoc
+ _SaveMergeRedlines* pRing = 0;
+ const SwRedlineTbl& rSrcRedlTbl = rSrcDoc.GetRedlineTbl();
+ sal_uLong nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex();
+ sal_uLong nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex();
+ for( sal_uInt16 n = 0; n < rSrcRedlTbl.Count(); ++n )
+ {
+ const SwRedline* pRedl = rSrcRedlTbl[ n ];
+ sal_uLong nNd = pRedl->GetPoint()->nNode.GetIndex();
+ RedlineType_t eType = pRedl->GetType();
+ if( nEndOfExtra < nNd &&
+ ( nsRedlineType_t::REDLINE_INSERT == eType || nsRedlineType_t::REDLINE_DELETE == eType ))
+ {
+ const SwNode* pDstNd = GetNodes()[
+ nMyEndOfExtra + nNd - nEndOfExtra ];
+
+ // Position gefunden. Dann muss im DestDoc auch
+ // in der Line das Redline eingefuegt werden
+ _SaveMergeRedlines* pTmp = new _SaveMergeRedlines(
+ *pDstNd, *pRedl, pRing );
+ if( !pRing )
+ pRing = pTmp;
+ }
+ }
+
+ if( pRing )
+ {
+ // dann alle ins DestDoc ueber nehmen
+ rSrcDoc.SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
+
+ SetRedlineMode((RedlineMode_t)(
+ nsRedlineMode_t::REDLINE_ON |
+ nsRedlineMode_t::REDLINE_SHOW_INSERT |
+ nsRedlineMode_t::REDLINE_SHOW_DELETE));
+
+ _SaveMergeRedlines* pTmp = pRing;
+
+ do {
+ nRet += pTmp->InsertRedline();
+ } while( pRing != ( pTmp = (_SaveMergeRedlines*)pTmp->GetNext() ));
+
+ while( pRing != pRing->GetNext() )
+ delete pRing->GetNext();
+ delete pRing;
+ }
+ }
+
+ rSrcDoc.SetRedlineMode( eSrcRedlMode );
+ if( !bSrcModified )
+ rSrcDoc.ResetModified();
+
+ SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
+
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+
+ return nRet;
+}
+
+
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
new file mode 100644
index 000000000000..6585b3359004
--- /dev/null
+++ b/sw/source/core/doc/doccorr.cxx
@@ -0,0 +1,358 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <doc.hxx>
+#include <node.hxx>
+#include <rootfrm.hxx>
+#include <editsh.hxx>
+#include <viscrs.hxx>
+#include <IMark.hxx>
+#include <bookmrk.hxx>
+#include <redline.hxx>
+#include <mvsave.hxx>
+#include <docary.hxx>
+#include <unocrsr.hxx>
+#include <swundo.hxx>
+#include <hints.hxx>
+
+/*
+ * MACROS um ueber alle CrsrShells zu iterieren
+ */
+#define PCURSH ((SwCrsrShell*)_pStartShell)
+#define FOREACHSHELL_START( pEShell ) \
+ {\
+ ViewShell *_pStartShell = pEShell; \
+ do { \
+ if( _pStartShell->IsA( TYPE( SwCrsrShell )) ) \
+ {
+
+#define FOREACHSHELL_END( pEShell ) \
+ } \
+ } while((_pStartShell=(ViewShell*)_pStartShell->GetNext())!= pEShell ); \
+ }
+
+#define PCURCRSR (_pCurrCrsr)
+#define FOREACHPAM_START(pSttCrsr) \
+ {\
+ SwPaM *_pStartCrsr = pSttCrsr, *_pCurrCrsr = pSttCrsr; \
+ do {
+
+#define FOREACHPAM_END() \
+ } while( (_pCurrCrsr=(SwPaM *)_pCurrCrsr->GetNext()) != _pStartCrsr ); \
+ }
+
+namespace
+{
+ // find the relevant section in which the SwUnoCrsr may wander.
+ // returns NULL if no restrictions apply
+ static const SwStartNode* lcl_FindUnoCrsrSection( const SwNode& rNode )
+ {
+ const SwStartNode* pStartNode = rNode.StartOfSectionNode();
+ while( ( pStartNode != NULL ) &&
+ ( pStartNode->StartOfSectionNode() != pStartNode ) &&
+ ( pStartNode->GetStartNodeType() == SwNormalStartNode ) )
+ pStartNode = pStartNode->StartOfSectionNode();
+
+ return pStartNode;
+ }
+
+ static inline bool lcl_PosCorrAbs(SwPosition & rPos,
+ const SwPosition& rStart,
+ const SwPosition& rEnd,
+ const SwPosition& rNewPos)
+ {
+ if ((rStart <= rPos) && (rPos <= rEnd))
+ {
+ rPos = rNewPos;
+ return true;
+ }
+ return false;
+ };
+
+ static inline bool lcl_PaMCorrAbs(SwPaM & rPam,
+ const SwPosition& rStart,
+ const SwPosition& rEnd,
+ const SwPosition& rNewPos)
+ {
+ bool bRet = false;
+ bRet |= lcl_PosCorrAbs(rPam.GetBound(true ), rStart, rEnd, rNewPos);
+ bRet |= lcl_PosCorrAbs(rPam.GetBound(false), rStart, rEnd, rNewPos);
+ return bRet;
+ };
+
+ static inline void lcl_PaMCorrRel1(SwPaM * pPam,
+ SwNode const * const pOldNode,
+ const SwPosition& rNewPos,
+ const xub_StrLen nCntIdx)
+ {
+ for(int nb = 0; nb < 2; ++nb)
+ if(&((pPam)->GetBound(sal_Bool(nb)).nNode.GetNode()) == pOldNode)
+ {
+ (pPam)->GetBound(sal_Bool(nb)).nNode = rNewPos.nNode;
+ (pPam)->GetBound(sal_Bool(nb)).nContent.Assign(
+ const_cast<SwIndexReg*>(rNewPos.nContent.GetIdxReg()),
+ nCntIdx + (pPam)->GetBound(sal_Bool(nb)).nContent.GetIndex());
+ }
+ }
+}
+
+
+void PaMCorrAbs( const SwPaM& rRange,
+ const SwPosition& rNewPos )
+{
+ SwPosition const aStart( *rRange.Start() );
+ SwPosition const aEnd( *rRange.End() );
+ SwPosition const aNewPos( rNewPos );
+ SwDoc *const pDoc = aStart.nNode.GetNode().GetDoc();
+ SwCrsrShell *const pShell = pDoc->GetEditShell();
+
+ if( pShell )
+ {
+ FOREACHSHELL_START( pShell )
+ SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+ if( _pStkCrsr )
+ do {
+ lcl_PaMCorrAbs( *_pStkCrsr, aStart, aEnd, aNewPos );
+ } while ( (_pStkCrsr != 0 ) &&
+ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+
+ FOREACHPAM_START( PCURSH->_GetCrsr() )
+ lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos );
+ FOREACHPAM_END()
+
+ if( PCURSH->IsTableMode() )
+ lcl_PaMCorrAbs( *PCURSH->GetTblCrs(), aStart, aEnd, aNewPos );
+
+ FOREACHSHELL_END( pShell )
+ }
+ {
+ SwUnoCrsrTbl& rTbl = const_cast<SwUnoCrsrTbl&>(pDoc->GetUnoCrsrTbl());
+
+ for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ {
+ SwUnoCrsr *const pUnoCursor = rTbl[ n ];
+
+ bool bChange = false; // has the UNO cursor been corrected?
+
+ // determine whether the UNO cursor will leave it's designated
+ // section
+ bool const bLeaveSection =
+ pUnoCursor->IsRemainInSection() &&
+ ( lcl_FindUnoCrsrSection( aNewPos.nNode.GetNode() ) !=
+ lcl_FindUnoCrsrSection(
+ pUnoCursor->GetPoint()->nNode.GetNode() ) );
+
+ FOREACHPAM_START( pUnoCursor )
+ bChange |= lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos );
+ FOREACHPAM_END()
+
+ SwUnoTableCrsr *const pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr *>(rTbl[ n ]);
+ if( pUnoTblCrsr )
+ {
+ FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+ bChange |=
+ lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos );
+ FOREACHPAM_END()
+ }
+
+ // if a UNO cursor leaves its designated section, we must inform
+ // (and invalidate) said cursor
+ if (bChange && bLeaveSection)
+ {
+ // the UNO cursor has left its section. We need to notify it!
+ SwMsgPoolItem aHint( RES_UNOCURSOR_LEAVES_SECTION );
+ pUnoCursor->ModifyNotification( &aHint, NULL );
+ }
+ }
+ }
+}
+
+void SwDoc::CorrAbs(const SwNodeIndex& rOldNode,
+ const SwPosition& rNewPos,
+ const xub_StrLen nOffset,
+ sal_Bool bMoveCrsr)
+{
+ SwCntntNode *const pCntntNode( rOldNode.GetNode().GetCntntNode() );
+ SwPaM const aPam(rOldNode, 0,
+ rOldNode, (pCntntNode) ? pCntntNode->Len() : 0);
+ SwPosition aNewPos(rNewPos);
+ aNewPos.nContent += nOffset;
+
+ getIDocumentMarkAccess()->correctMarksAbsolute(rOldNode, rNewPos, nOffset);
+ { // fix redlines
+ SwRedlineTbl& rTbl = *pRedlineTbl;
+ for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ {
+ // is on position ??
+ lcl_PaMCorrAbs(*rTbl[ n ], *aPam.Start(), *aPam.End(), aNewPos);
+ }
+ }
+
+ if(bMoveCrsr)
+ {
+ ::PaMCorrAbs(aPam, aNewPos);
+ }
+}
+
+void SwDoc::CorrAbs(const SwPaM& rRange,
+ const SwPosition& rNewPos,
+ sal_Bool bMoveCrsr)
+{
+ SwPosition aStart(*rRange.Start());
+ SwPosition aEnd(*rRange.End());
+ SwPosition aNewPos(rNewPos);
+
+ _DelBookmarks(aStart.nNode, aEnd.nNode, NULL,
+ &aStart.nContent, &aEnd.nContent);
+ if(bMoveCrsr)
+ ::PaMCorrAbs(rRange, rNewPos);
+}
+
+void SwDoc::CorrAbs(const SwNodeIndex& rStartNode,
+ const SwNodeIndex& rEndNode,
+ const SwPosition& rNewPos,
+ sal_Bool bMoveCrsr)
+{
+ _DelBookmarks(rStartNode, rEndNode);
+
+ if(bMoveCrsr)
+ {
+ SwCntntNode *const pCntntNode( rEndNode.GetNode().GetCntntNode() );
+ SwPaM const aPam(rStartNode, 0,
+ rEndNode, (pCntntNode) ? pCntntNode->Len() : 0);
+ ::PaMCorrAbs(aPam, rNewPos);
+ }
+}
+
+
+
+
+
+void PaMCorrRel( const SwNodeIndex &rOldNode,
+ const SwPosition &rNewPos,
+ const xub_StrLen nOffset )
+{
+ const SwNode* pOldNode = &rOldNode.GetNode();
+ SwPosition aNewPos( rNewPos );
+ const SwDoc* pDoc = pOldNode->GetDoc();
+
+ xub_StrLen nCntIdx = rNewPos.nContent.GetIndex() + nOffset;
+
+ SwCrsrShell* pShell = pDoc->GetEditShell();
+ if( pShell )
+ {
+ FOREACHSHELL_START( pShell )
+ SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+ if( _pStkCrsr )
+ do {
+ lcl_PaMCorrRel1( _pStkCrsr, pOldNode, aNewPos, nCntIdx );
+ } while ( (_pStkCrsr != 0 ) &&
+ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+
+ FOREACHPAM_START( PCURSH->_GetCrsr() )
+ lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx);
+ FOREACHPAM_END()
+
+ if( PCURSH->IsTableMode() )
+ lcl_PaMCorrRel1( PCURSH->GetTblCrs(), pOldNode, aNewPos, nCntIdx );
+
+ FOREACHSHELL_END( pShell )
+ }
+ {
+ SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl();
+ for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ {
+ FOREACHPAM_START( rTbl[ n ] )
+ lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx );
+ FOREACHPAM_END()
+
+ SwUnoTableCrsr* pUnoTblCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(rTbl[ n ]);
+ if( pUnoTblCrsr )
+ {
+ FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+ lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx );
+ FOREACHPAM_END()
+ }
+ }
+ }
+}
+
+void SwDoc::CorrRel(const SwNodeIndex& rOldNode,
+ const SwPosition& rNewPos,
+ const xub_StrLen nOffset,
+ sal_Bool bMoveCrsr)
+{
+ getIDocumentMarkAccess()->correctMarksRelative(rOldNode, rNewPos, nOffset);
+
+ { // dann die Redlines korrigieren
+ SwRedlineTbl& rTbl = *pRedlineTbl;
+ SwPosition aNewPos(rNewPos);
+ for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ {
+ // liegt auf der Position ??
+ lcl_PaMCorrRel1( rTbl[ n ], &rOldNode.GetNode(), aNewPos, aNewPos.nContent.GetIndex() + nOffset );
+ }
+ }
+
+ if(bMoveCrsr)
+ ::PaMCorrRel(rOldNode, rNewPos, nOffset);
+}
+
+
+SwEditShell* SwDoc::GetEditShell( ViewShell** ppSh ) const
+{
+ // Layout und OLE-Shells sollten vorhanden sein!
+ if( pCurrentView )
+ {
+ ViewShell *pSh = pCurrentView, *pVSh = pSh;
+ if( ppSh )
+ *ppSh = pSh;
+
+ // wir suchen uns eine EditShell, falls diese existiert
+ do {
+ if( pSh->IsA( TYPE( SwEditShell ) ) )
+ return (SwEditShell*)pSh;
+
+ } while( pVSh != ( pSh = (ViewShell*)pSh->GetNext() ));
+ }
+ else if( ppSh )
+ *ppSh = 0; //swmod 071029//swmod 071225
+
+ return 0;
+}
+
+::sw::IShellCursorSupplier * SwDoc::GetIShellCursorSupplier()
+{
+ return GetEditShell(0);
+}
+
diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx
new file mode 100644
index 000000000000..bef9ea1f254f
--- /dev/null
+++ b/sw/source/core/doc/docdde.cxx
@@ -0,0 +1,418 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <stdlib.h>
+
+#ifndef _APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#include <tools/urlobj.hxx>
+
+#define _SVSTDARR_STRINGS
+#include <svl/svstdarr.hxx>
+#include <sfx2/linkmgr.hxx> // LinkManager
+#include <unotools/charclass.hxx>
+#include <fmtcntnt.hxx>
+#include <doc.hxx>
+#include <swserv.hxx> // fuer Server-Funktionalitaet
+#include <IMark.hxx>
+#include <bookmrk.hxx>
+#include <section.hxx> // fuer SwSectionFmt
+#include <swtable.hxx> // fuer SwTable
+#include <node.hxx>
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <docary.hxx>
+#include <MarkManager.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+
+ static ::sw::mark::DdeBookmark* lcl_FindDdeBookmark(const IDocumentMarkAccess& rMarkAccess, const String& rName, bool bCaseSensitive)
+ {
+ //Iterating over all bookmarks, checking DdeBookmarks
+ const ::rtl::OUString sNameLc = bCaseSensitive ? rName : GetAppCharClass().lower(rName);
+ for(IDocumentMarkAccess::const_iterator_t ppMark = rMarkAccess.getMarksBegin();
+ ppMark != rMarkAccess.getMarksEnd();
+ ppMark++)
+ {
+ if (::sw::mark::DdeBookmark* const pBkmk = dynamic_cast< ::sw::mark::DdeBookmark*>(ppMark->get()))
+ {
+ if (
+ (bCaseSensitive && (pBkmk->GetName() == sNameLc)) ||
+ (!bCaseSensitive && GetAppCharClass().lower(pBkmk->GetName()) == String(sNameLc))
+ )
+ {
+ return pBkmk;
+ }
+ }
+ }
+ return NULL;
+ }
+}
+
+struct _FindItem
+{
+ const String m_Item;
+ SwTableNode* pTblNd;
+ SwSectionNode* pSectNd;
+
+ _FindItem(const String& rS)
+ : m_Item(rS), pTblNd(0), pSectNd(0)
+ {}
+};
+
+sal_Bool lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs, bool bCaseSensitive )
+{
+ _FindItem * const pItem( static_cast<_FindItem*>(pArgs) );
+ SwSection* pSect = rpSectFmt->GetSection();
+ if( pSect )
+ {
+ String sNm( (bCaseSensitive)
+ ? pSect->GetSectionName()
+ : GetAppCharClass().lower( pSect->GetSectionName() ));
+ String sCompare( (bCaseSensitive)
+ ? pItem->m_Item
+ : GetAppCharClass().lower( pItem->m_Item ) );
+ if( sNm == sCompare )
+ {
+ // gefunden, als erfrage die Daten
+ const SwNodeIndex* pIdx;
+ if( 0 != (pIdx = rpSectFmt->GetCntnt().GetCntntIdx() ) &&
+ &rpSectFmt->GetDoc()->GetNodes() == &pIdx->GetNodes() )
+ {
+ // eine Tabelle im normalen NodesArr
+ pItem->pSectNd = pIdx->GetNode().GetSectionNode();
+ return sal_False;
+ }
+//nein!! // sollte der Namen schon passen, der Rest aber nicht, dann haben wir
+ // sie nicht. Die Namen sind immer eindeutig.
+ }
+ }
+ return sal_True; // dann weiter
+}
+sal_Bool lcl_FindSectionCaseSensitive( const SwSectionFmtPtr& rpSectFmt, void* pArgs )
+{
+ return lcl_FindSection( rpSectFmt, pArgs, true );
+}
+sal_Bool lcl_FindSectionCaseInsensitive( const SwSectionFmtPtr& rpSectFmt, void* pArgs )
+{
+ return lcl_FindSection( rpSectFmt, pArgs, false );
+}
+
+
+
+sal_Bool lcl_FindTable( const SwFrmFmtPtr& rpTableFmt, void* pArgs )
+{
+ _FindItem * const pItem( static_cast<_FindItem*>(pArgs) );
+ String sNm( GetAppCharClass().lower( rpTableFmt->GetName() ));
+ if (sNm.Equals( pItem->m_Item ))
+ {
+ SwTable* pTmpTbl;
+ SwTableBox* pFBox;
+ if( 0 != ( pTmpTbl = SwTable::FindTable( rpTableFmt ) ) &&
+ 0 != ( pFBox = pTmpTbl->GetTabSortBoxes()[0] ) &&
+ pFBox->GetSttNd() &&
+ &rpTableFmt->GetDoc()->GetNodes() == &pFBox->GetSttNd()->GetNodes() )
+ {
+ // eine Tabelle im normalen NodesArr
+ pItem->pTblNd = (SwTableNode*)
+ pFBox->GetSttNd()->FindTableNode();
+ return sal_False;
+ }
+//nein! // sollte der Namen schon passen, der Rest aber nicht, dann haben wir
+ // sie nicht. Die Namen sind immer eindeutig.
+ }
+ return sal_True; // dann weiter
+}
+
+
+
+bool SwDoc::GetData( const String& rItem, const String& rMimeType,
+ uno::Any & rValue ) const
+{
+ //search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
+ bool bCaseSensitive = true;
+ while( true )
+ {
+ ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem, bCaseSensitive);
+ if(pBkmk)
+ return SwServerObject(*pBkmk).GetData(rValue, rMimeType);
+
+ // haben wir ueberhaupt das Item vorraetig?
+ String sItem( bCaseSensitive ? rItem : GetAppCharClass().lower(rItem));
+ _FindItem aPara( sItem );
+ ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(),
+ bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara );
+ if( aPara.pSectNd )
+ {
+ // gefunden, als erfrage die Daten
+ return SwServerObject( *aPara.pSectNd ).GetData( rValue, rMimeType );
+ }
+ if( !bCaseSensitive )
+ break;
+ bCaseSensitive = false;
+ }
+
+ _FindItem aPara( GetAppCharClass().lower( rItem ));
+ ((SwFrmFmts*)pTblFrmFmtTbl)->ForEach( 0, pTblFrmFmtTbl->Count(),
+ lcl_FindTable, &aPara );
+ if( aPara.pTblNd )
+ {
+ return SwServerObject( *aPara.pTblNd ).GetData( rValue, rMimeType );
+ }
+
+ return sal_False;
+}
+
+
+
+bool SwDoc::SetData( const String& rItem, const String& rMimeType,
+ const uno::Any & rValue )
+{
+ //search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
+ bool bCaseSensitive = true;
+ while( true )
+ {
+ ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem, bCaseSensitive);
+ if(pBkmk)
+ return SwServerObject(*pBkmk).SetData(rMimeType, rValue);
+
+ // haben wir ueberhaupt das Item vorraetig?
+ String sItem( bCaseSensitive ? rItem : GetAppCharClass().lower(rItem));
+ _FindItem aPara( sItem );
+ pSectionFmtTbl->ForEach( 0, pSectionFmtTbl->Count(), bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara );
+ if( aPara.pSectNd )
+ {
+ // gefunden, als erfrage die Daten
+ return SwServerObject( *aPara.pSectNd ).SetData( rMimeType, rValue );
+ }
+ if( !bCaseSensitive )
+ break;
+ bCaseSensitive = false;
+ }
+
+ String sItem(GetAppCharClass().lower(rItem));
+ _FindItem aPara( sItem );
+ pTblFrmFmtTbl->ForEach( 0, pTblFrmFmtTbl->Count(), lcl_FindTable, &aPara );
+ if( aPara.pTblNd )
+ {
+ return SwServerObject( *aPara.pTblNd ).SetData( rMimeType, rValue );
+ }
+
+ return sal_False;
+}
+
+
+
+::sfx2::SvLinkSource* SwDoc::CreateLinkSource(const String& rItem)
+{
+ SwServerObject* pObj = NULL;
+
+ //search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
+ bool bCaseSensitive = true;
+ while( true )
+ {
+ // bookmarks
+ ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem, bCaseSensitive);
+ if(pBkmk && pBkmk->IsExpanded()
+ && (0 == (pObj = pBkmk->GetRefObject())))
+ {
+ // mark found, but no link yet -> create hotlink
+ pObj = new SwServerObject(*pBkmk);
+ pBkmk->SetRefObject(pObj);
+ GetLinkManager().InsertServer(pObj);
+ }
+ if(pObj)
+ return pObj;
+
+ _FindItem aPara(bCaseSensitive ? rItem : GetAppCharClass().lower(rItem));
+ // sections
+ ((SwSectionFmts&)*pSectionFmtTbl).ForEach(0, pSectionFmtTbl->Count(), bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara);
+ if(aPara.pSectNd
+ && (0 == (pObj = aPara.pSectNd->GetSection().GetObject())))
+ {
+ // section found, but no link yet -> create hotlink
+ pObj = new SwServerObject( *aPara.pSectNd );
+ aPara.pSectNd->GetSection().SetRefObject( pObj );
+ GetLinkManager().InsertServer(pObj);
+ }
+ if(pObj)
+ return pObj;
+ if( !bCaseSensitive )
+ break;
+ bCaseSensitive = false;
+ }
+
+ _FindItem aPara( GetAppCharClass().lower(rItem) );
+ // tables
+ ((SwFrmFmts*)pTblFrmFmtTbl)->ForEach(0, pTblFrmFmtTbl->Count(), lcl_FindTable, &aPara);
+ if(aPara.pTblNd
+ && (0 == (pObj = aPara.pTblNd->GetTable().GetObject())))
+ {
+ // table found, but no link yet -> create hotlink
+ pObj = new SwServerObject(*aPara.pTblNd);
+ aPara.pTblNd->GetTable().SetRefObject(pObj);
+ GetLinkManager().InsertServer(pObj);
+ }
+ return pObj;
+}
+
+sal_Bool SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam,
+ SwNodeRange*& rpRange ) const
+{
+ // haben wir ueberhaupt das Item vorraetig?
+ rpPam = 0;
+ rpRange = 0;
+
+ String sItem( INetURLObject::decode( rStr, INET_HEX_ESCAPE,
+ INetURLObject::DECODE_WITH_CHARSET,
+ RTL_TEXTENCODING_UTF8 ));
+
+ xub_StrLen nPos = sItem.Search( cMarkSeperator );
+
+ const CharClass& rCC = GetAppCharClass();
+
+ // Erweiterung fuer die Bereiche, nicht nur Bookmarks/Bereiche linken,
+ // sondern auch Rahmen(Text!), Tabellen, Gliederungen:
+ if( STRING_NOTFOUND != nPos )
+ {
+ sal_Bool bWeiter = sal_False;
+ String sName( sItem.Copy( 0, nPos ) );
+ String sCmp( sItem.Copy( nPos + 1 ));
+ rCC.toLower( sItem );
+
+ _FindItem aPara( sName );
+
+ if( sCmp.EqualsAscii( pMarkToTable ) )
+ {
+ rCC.toLower( sName );
+ ((SwFrmFmts*)pTblFrmFmtTbl)->ForEach( 0, pTblFrmFmtTbl->Count(),
+ lcl_FindTable, &aPara );
+ if( aPara.pTblNd )
+ {
+ rpRange = new SwNodeRange( *aPara.pTblNd, 0,
+ *aPara.pTblNd->EndOfSectionNode(), 1 );
+ return sal_True;
+ }
+ }
+ else if( sCmp.EqualsAscii( pMarkToFrame ) )
+ {
+ SwNodeIndex* pIdx;
+ SwNode* pNd;
+ const SwFlyFrmFmt* pFlyFmt = FindFlyByName( sName );
+ if( pFlyFmt &&
+ 0 != ( pIdx = (SwNodeIndex*)pFlyFmt->GetCntnt().GetCntntIdx() ) &&
+ !( pNd = &pIdx->GetNode())->IsNoTxtNode() )
+ {
+ rpRange = new SwNodeRange( *pNd, 1, *pNd->EndOfSectionNode() );
+ return sal_True;
+ }
+ }
+ else if( sCmp.EqualsAscii( pMarkToRegion ) )
+ {
+ sItem = sName; // wird unten behandelt !
+ bWeiter = sal_True;
+ }
+ else if( sCmp.EqualsAscii( pMarkToOutline ) )
+ {
+ SwPosition aPos( SwNodeIndex( (SwNodes&)GetNodes() ));
+ if( GotoOutline( aPos, sName ))
+ {
+ SwNode* pNd = &aPos.nNode.GetNode();
+ //sal_uInt8 nLvl = pNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
+ const int nLvl = pNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end,zhaojianwei
+
+ const SwOutlineNodes& rOutlNds = GetNodes().GetOutLineNds();
+ sal_uInt16 nTmpPos;
+ rOutlNds.Seek_Entry( pNd, &nTmpPos );
+ rpRange = new SwNodeRange( aPos.nNode, 0, aPos.nNode );
+
+ // dann suche jetzt noch das Ende vom Bereich
+ for( ++nTmpPos;
+ nTmpPos < rOutlNds.Count() &&
+ nLvl < rOutlNds[ nTmpPos ]->GetTxtNode()->
+ //GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
+ GetAttrOutlineLevel()-1;//<-end,zhaojianwei
+ ++nTmpPos )
+ ; // es gibt keinen Block
+
+ if( nTmpPos < rOutlNds.Count() )
+ rpRange->aEnd = *rOutlNds[ nTmpPos ];
+ else
+ rpRange->aEnd = GetNodes().GetEndOfContent();
+ return sal_True;
+ }
+ }
+
+ if( !bWeiter )
+ return sal_False;
+ }
+
+ //search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
+ bool bCaseSensitive = true;
+ while( true )
+ {
+ ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, sItem, bCaseSensitive);
+ if(pBkmk)
+ {
+ if(pBkmk->IsExpanded())
+ rpPam = new SwPaM(
+ pBkmk->GetMarkPos(),
+ pBkmk->GetOtherMarkPos());
+ return static_cast<bool>(rpPam);
+ }
+
+ //
+ _FindItem aPara( bCaseSensitive ? sItem : rCC.lower( sItem ) );
+
+ if( pSectionFmtTbl->Count() )
+ {
+ ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(),
+ bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara );
+ if( aPara.pSectNd )
+ {
+ rpRange = new SwNodeRange( *aPara.pSectNd, 1,
+ *aPara.pSectNd->EndOfSectionNode() );
+ return sal_True;
+
+ }
+ }
+ if( !bCaseSensitive )
+ break;
+ bCaseSensitive = false;
+ }
+ return sal_False;
+}
+
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
new file mode 100644
index 000000000000..52228110afb5
--- /dev/null
+++ b/sw/source/core/doc/docdesc.cxx
@@ -0,0 +1,946 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <vcl/virdev.hxx>
+#include <svx/svdmodel.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/paperinf.hxx>
+#include "editeng/frmdiritem.hxx"
+#include <tools/urlobj.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/printer.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <fmtfsize.hxx>
+#include <fmthdft.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtpdsc.hxx>
+#include <ftninfo.hxx>
+#include <fesh.hxx>
+#include <ndole.hxx>
+#include <mdiexp.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <docary.hxx>
+#include <pagefrm.hxx> //Fuer DelPageDesc
+#include <rootfrm.hxx> //Fuer DelPageDesc
+#include <ndtxt.hxx>
+#include <frmtool.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+#include <docsh.hxx>
+#include <ndindex.hxx>
+#include <ftnidx.hxx>
+#include <fmtftn.hxx>
+#include <txtftn.hxx>
+#include <fntcache.hxx>
+#include <viewsh.hxx>
+#include <viewopt.hxx>
+#include <fldbas.hxx>
+#include <swwait.hxx>
+#include <GetMetricVal.hxx>
+#include <unotools/syslocale.hxx>
+#include <statstr.hrc>
+#include <switerator.hxx>
+#include <hints.hxx>
+#include <SwUndoPageDesc.hxx>
+#include <pagedeschint.hxx>
+#include <tgrditem.hxx>
+
+using namespace com::sun::star;
+
+static void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId,
+ SwFrmFmt &rFmt1,
+ SwFrmFmt &rFmt2 )
+{
+ // --> FME 2005-01-21 #i41075# Printer on demand
+ // This function does not require a printer anymore.
+ // The default page size is obtained from the application
+ //locale
+ // <--
+
+ SwFmtFrmSize aFrmSize( ATT_FIX_SIZE );
+ const Size aPhysSize = SvxPaperInfo::GetDefaultPaperSize();
+ aFrmSize.SetSize( aPhysSize );
+
+ //Auf Default-Raender vorbereiten.
+ //Raender haben eine defaultmaessige Mindestgroesse.
+ //wenn der Drucker einen groesseren Rand vorgibt, so
+ //ist mir dass auch recht.
+ // MIB 06/25/2002, #99397#: The HTML page desc had A4 as page size
+ // always. This has been changed to take the page size from the printer.
+ // Unfortunately, the margins of the HTML page desc are smaller than
+ // the margins used here in general, so one extra case is required.
+ // In the long term, this needs to be changed to always keep the
+ // margins from the page desc.
+ sal_Int32 nMinTop, nMinBottom, nMinLeft, nMinRight;
+ if( RES_POOLPAGE_HTML == nPoolFmtId )
+ {
+ nMinRight = nMinTop = nMinBottom = GetMetricVal( CM_1 );
+ nMinLeft = nMinRight * 2;
+ }
+ else if( MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() )
+ {
+ nMinTop = nMinBottom = nMinLeft = nMinRight = 1134; //2 Zentimeter
+ }
+ else
+ {
+ nMinTop = nMinBottom = 1440; //al la WW: 1Inch
+ nMinLeft = nMinRight = 1800; // 1,25 Inch
+ }
+
+ //Raender einstellen.
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ SvxULSpaceItem aUL( RES_UL_SPACE );
+
+ aUL.SetUpper( (sal_uInt16)nMinTop );
+ aUL.SetLower( (sal_uInt16)nMinBottom );
+ aLR.SetRight( nMinRight );
+ aLR.SetLeft( nMinLeft );
+
+ rFmt1.SetFmtAttr( aFrmSize );
+ rFmt1.SetFmtAttr( aLR );
+ rFmt1.SetFmtAttr( aUL );
+
+ rFmt2.SetFmtAttr( aFrmSize );
+ rFmt2.SetFmtAttr( aLR );
+ rFmt2.SetFmtAttr( aUL );
+}
+
+/*************************************************************************
+|*
+|* SwDoc::ChgPageDesc()
+|*
+|* Ersterstellung MA 25. Jan. 93
+|* Letzte Aenderung MA 01. Mar. 95
+|*
+|*************************************************************************/
+
+void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest,
+ const sal_Bool bPage = sal_True )
+{
+/////////////// !!!!!!!!!!!!!!!!
+//JP 03.03.99:
+// eigentlich sollte hier das Intersect von ItemSet benutzt werden, aber das
+// funktioniert nicht richtig, wenn man unterschiedliche WhichRanges hat.
+/////////////// !!!!!!!!!!!!!!!!
+ //Die interressanten Attribute uebernehmen.
+ sal_uInt16 __READONLY_DATA aIdArr[] = { RES_FRM_SIZE, RES_UL_SPACE,
+ RES_BACKGROUND, RES_SHADOW,
+ RES_COL, RES_COL,
+ RES_FRAMEDIR, RES_FRAMEDIR,
+ RES_TEXTGRID, RES_TEXTGRID,
+ // --> FME 2005-04-18 #i45539#
+ RES_HEADER_FOOTER_EAT_SPACING,
+ RES_HEADER_FOOTER_EAT_SPACING,
+ // <--
+ RES_UNKNOWNATR_CONTAINER,
+ RES_UNKNOWNATR_CONTAINER,
+ 0 };
+
+ const SfxPoolItem* pItem;
+ for( sal_uInt16 n = 0; aIdArr[ n ]; n += 2 )
+ {
+ for( sal_uInt16 nId = aIdArr[ n ]; nId <= aIdArr[ n+1]; ++nId )
+ {
+ // --> FME 2005-04-18 #i45539#
+ // bPage == true:
+ // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING
+ // bPage == false:
+ // All in aIdArr except from RES_COL and RES_PAPER_BIN:
+ // <--
+ if( ( bPage && RES_HEADER_FOOTER_EAT_SPACING != nId ) ||
+ ( !bPage && RES_COL != nId && RES_PAPER_BIN != nId ))
+ {
+ if( SFX_ITEM_SET == rSource.GetItemState( nId, sal_False, &pItem ))
+ rDest.SetFmtAttr( *pItem );
+ else
+ rDest.ResetFmtAttr( nId );
+ }
+ }
+ }
+
+ // auch Pool-, Hilfe-Id's uebertragen
+ rDest.SetPoolFmtId( rSource.GetPoolFmtId() );
+ rDest.SetPoolHelpId( rSource.GetPoolHelpId() );
+ rDest.SetPoolHlpFileId( rSource.GetPoolHlpFileId() );
+}
+
+
+void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
+{
+ ASSERT( i < aPageDescs.Count(), "PageDescs ueberindiziert." );
+
+ SwPageDesc *pDesc = aPageDescs[i];
+ SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo(new SwUndoPageDesc(*pDesc, rChged, this));
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ //Als erstes wird ggf. gespiegelt.
+ if ( rChged.GetUseOn() == nsUseOnPage::PD_MIRROR )
+ ((SwPageDesc&)rChged).Mirror();
+ else
+ //sonst Werte aus Master nach Left uebertragen.
+ ::lcl_DescSetAttr( ((SwPageDesc&)rChged).GetMaster(),
+ ((SwPageDesc&)rChged).GetLeft() );
+
+ //NumType uebernehmen.
+ if( rChged.GetNumType().GetNumberingType() != pDesc->GetNumType().GetNumberingType() )
+ {
+ pDesc->SetNumType( rChged.GetNumType() );
+ // JP 30.03.99: Bug 64121 - den Seitennummernfeldern bescheid sagen,
+ // das sich das Num-Format geaendert hat
+ GetSysFldType( RES_PAGENUMBERFLD )->UpdateFlds();
+ GetSysFldType( RES_REFPAGEGETFLD )->UpdateFlds();
+
+ // Wenn sich die Numerierungsart geaendert hat, koennte es QuoVadis/
+ // ErgoSum-Texte geben, die sich auf eine geaenderte Seite beziehen,
+ // deshalb werden die Fussnoten invalidiert
+ SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
+ for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+ {
+ SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
+ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+ pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
+ }
+ }
+
+ //Orientierung uebernehmen
+ pDesc->SetLandscape( rChged.GetLandscape() );
+
+ // #i46909# no undo if header or footer changed
+ bool bHeaderFooterChanged = false;
+
+ //Header abgleichen.
+ const SwFmtHeader &rHead = rChged.GetMaster().GetHeader();
+ if (undoGuard.UndoWasEnabled())
+ {
+ // #i46909# no undo if header or footer changed
+ // hat sich an den Nodes etwas veraendert ?
+ const SwFmtHeader &rOldHead = pDesc->GetMaster().GetHeader();
+ bHeaderFooterChanged |=
+ ( rHead.IsActive() != rOldHead.IsActive() ||
+ rChged.IsHeaderShared() != pDesc->IsHeaderShared() );
+ }
+ pDesc->GetMaster().SetFmtAttr( rHead );
+ if ( rChged.IsHeaderShared() || !rHead.IsActive() )
+ {
+ //Left teilt sich den Header mit dem Master.
+ pDesc->GetLeft().SetFmtAttr( pDesc->GetMaster().GetHeader() );
+ }
+ else if ( rHead.IsActive() )
+ { //Left bekommt einen eigenen Header verpasst wenn das Format nicht
+ //bereits einen hat.
+ //Wenn er bereits einen hat und dieser auf die gleiche Section
+ //wie der Rechte zeigt, so muss er einen eigenen bekommen. Der
+ //Inhalt wird sinnigerweise kopiert.
+ const SwFmtHeader &rLeftHead = pDesc->GetLeft().GetHeader();
+ if ( !rLeftHead.IsActive() )
+ {
+ SwFmtHeader aHead( MakeLayoutFmt( RND_STD_HEADERL, 0 ) );
+ pDesc->GetLeft().SetFmtAttr( aHead );
+ //Weitere Attribute (Raender, Umrandung...) uebernehmen.
+ ::lcl_DescSetAttr( *rHead.GetHeaderFmt(), *aHead.GetHeaderFmt(), sal_False);
+ }
+ else
+ {
+ const SwFrmFmt *pRight = rHead.GetHeaderFmt();
+ const SwFmtCntnt &aRCnt = pRight->GetCntnt();
+ const SwFmtCntnt &aLCnt = rLeftHead.GetHeaderFmt()->GetCntnt();
+ if( !aLCnt.GetCntntIdx() )
+ pDesc->GetLeft().SetFmtAttr( rChged.GetLeft().GetHeader() );
+ else if( (*aRCnt.GetCntntIdx()) == (*aLCnt.GetCntntIdx()) )
+ {
+ SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), "Header",
+ GetDfltFrmFmt() );
+ ::lcl_DescSetAttr( *pRight, *pFmt, sal_False );
+ //Der Bereich auf den das rechte Kopfattribut zeigt wird
+ //kopiert und der Index auf den StartNode in das linke
+ //Kopfattribut gehaengt.
+ SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() );
+ SwStartNode* pSttNd = GetNodes().MakeEmptySection( aTmp, SwHeaderStartNode );
+ SwNodeRange aRange( aRCnt.GetCntntIdx()->GetNode(), 0,
+ *aRCnt.GetCntntIdx()->GetNode().EndOfSectionNode() );
+ aTmp = *pSttNd->EndOfSectionNode();
+ GetNodes()._Copy( aRange, aTmp, sal_False );
+
+ pFmt->SetFmtAttr( SwFmtCntnt( pSttNd ) );
+ pDesc->GetLeft().SetFmtAttr( SwFmtHeader( pFmt ) );
+ }
+ else
+ ::lcl_DescSetAttr( *pRight,
+ *(SwFrmFmt*)rLeftHead.GetHeaderFmt(), sal_False );
+
+ }
+ }
+ pDesc->ChgHeaderShare( rChged.IsHeaderShared() );
+
+ //Footer abgleichen.
+ const SwFmtFooter &rFoot = rChged.GetMaster().GetFooter();
+ if (undoGuard.UndoWasEnabled())
+ {
+ // #i46909# no undo if header or footer changed
+ // hat sich an den Nodes etwas veraendert ?
+ const SwFmtFooter &rOldFoot = pDesc->GetMaster().GetFooter();
+ bHeaderFooterChanged |=
+ ( rFoot.IsActive() != rOldFoot.IsActive() ||
+ rChged.IsFooterShared() != pDesc->IsFooterShared() );
+ }
+ pDesc->GetMaster().SetFmtAttr( rFoot );
+ if ( rChged.IsFooterShared() || !rFoot.IsActive() )
+ //Left teilt sich den Header mit dem Master.
+ pDesc->GetLeft().SetFmtAttr( pDesc->GetMaster().GetFooter() );
+ else if ( rFoot.IsActive() )
+ { //Left bekommt einen eigenen Footer verpasst wenn das Format nicht
+ //bereits einen hat.
+ //Wenn er bereits einen hat und dieser auf die gleiche Section
+ //wie der Rechte zeigt, so muss er einen eigenen bekommen. Der
+ //Inhalt wird sinnigerweise kopiert.
+ const SwFmtFooter &rLeftFoot = pDesc->GetLeft().GetFooter();
+ if ( !rLeftFoot.IsActive() )
+ {
+ SwFmtFooter aFoot( MakeLayoutFmt( RND_STD_FOOTER, 0 ) );
+ pDesc->GetLeft().SetFmtAttr( aFoot );
+ //Weitere Attribute (Raender, Umrandung...) uebernehmen.
+ ::lcl_DescSetAttr( *rFoot.GetFooterFmt(), *aFoot.GetFooterFmt(), sal_False);
+ }
+ else
+ {
+ const SwFrmFmt *pRight = rFoot.GetFooterFmt();
+ const SwFmtCntnt &aRCnt = pRight->GetCntnt();
+ const SwFmtCntnt &aLCnt = rLeftFoot.GetFooterFmt()->GetCntnt();
+ if( !aLCnt.GetCntntIdx() )
+ pDesc->GetLeft().SetFmtAttr( rChged.GetLeft().GetFooter() );
+ else if( (*aRCnt.GetCntntIdx()) == (*aLCnt.GetCntntIdx()) )
+ {
+ SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), "Footer",
+ GetDfltFrmFmt() );
+ ::lcl_DescSetAttr( *pRight, *pFmt, sal_False );
+ //Der Bereich auf den das rechte Kopfattribut zeigt wird
+ //kopiert und der Index auf den StartNode in das linke
+ //Kopfattribut gehaengt.
+ SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() );
+ SwStartNode* pSttNd = GetNodes().MakeEmptySection( aTmp, SwFooterStartNode );
+ SwNodeRange aRange( aRCnt.GetCntntIdx()->GetNode(), 0,
+ *aRCnt.GetCntntIdx()->GetNode().EndOfSectionNode() );
+ aTmp = *pSttNd->EndOfSectionNode();
+ GetNodes()._Copy( aRange, aTmp, sal_False );
+
+ pFmt->SetFmtAttr( SwFmtCntnt( pSttNd ) );
+ pDesc->GetLeft().SetFmtAttr( SwFmtFooter( pFmt ) );
+ }
+ else
+ ::lcl_DescSetAttr( *pRight,
+ *(SwFrmFmt*)rLeftFoot.GetFooterFmt(), sal_False );
+ }
+ }
+ pDesc->ChgFooterShare( rChged.IsFooterShared() );
+
+ if ( pDesc->GetName() != rChged.GetName() )
+ pDesc->SetName( rChged.GetName() );
+
+ // Dadurch wird ein RegisterChange ausgeloest, wenn notwendig
+ pDesc->SetRegisterFmtColl( rChged.GetRegisterFmtColl() );
+
+ //Wenn sich das UseOn oder der Follow aendern muessen die
+ //Absaetze das erfahren.
+ sal_Bool bUseOn = sal_False;
+ sal_Bool bFollow = sal_False;
+ if ( pDesc->GetUseOn() != rChged.GetUseOn() )
+ { pDesc->SetUseOn( rChged.GetUseOn() );
+ bUseOn = sal_True;
+ }
+ if ( pDesc->GetFollow() != rChged.GetFollow() )
+ { if ( rChged.GetFollow() == &rChged )
+ { if ( pDesc->GetFollow() != pDesc )
+ { pDesc->SetFollow( pDesc );
+ bFollow = sal_True;
+ }
+ }
+ else
+ { pDesc->SetFollow( rChged.pFollow );
+ bFollow = sal_True;
+ }
+ }
+
+ if ( (bUseOn || bFollow) && pTmpRoot)
+ //Layot benachrichtigen!
+ {
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllCheckPageDescs));//swmod 080304
+ }
+
+ //Jetzt noch die Seiten-Attribute uebernehmen.
+ ::lcl_DescSetAttr( rChged.GetMaster(), pDesc->GetMaster() );
+ ::lcl_DescSetAttr( rChged.GetLeft(), pDesc->GetLeft() );
+
+ //Wenn sich FussnotenInfo veraendert, so werden die Seiten
+ //angetriggert.
+ if( !(pDesc->GetFtnInfo() == rChged.GetFtnInfo()) )
+ {
+ pDesc->SetFtnInfo( rChged.GetFtnInfo() );
+ SwMsgPoolItem aInfo( RES_PAGEDESC_FTNINFO );
+ {
+ pDesc->GetMaster().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) );
+ }
+ {
+ pDesc->GetLeft().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) );
+ }
+ }
+ SetModified();
+
+ // #i46909# no undo if header or footer changed
+ if( bHeaderFooterChanged )
+ {
+ GetIDocumentUndoRedo().DelAllUndoObj();
+ }
+}
+
+/*************************************************************************
+|*
+|* SwDoc::DelPageDesc()
+|*
+|* Beschreibung Alle Descriptoren, deren Follow auf den zu loeschenden
+|* zeigen muessen angepasst werden.
+|* Ersterstellung MA 25. Jan. 93
+|* Letzte Aenderung JP 04.09.95
+|*
+|*************************************************************************/
+
+// #i7983#
+void SwDoc::PreDelPageDesc(SwPageDesc * pDel)
+{
+ if (0 == pDel)
+ return;
+
+ // mba: test iteration as clients are removed while iteration
+ SwPageDescHint aHint( aPageDescs[0] );
+ pDel->CallSwClientNotify( aHint );
+
+ bool bHasLayout = HasLayout();
+ if ( pFtnInfo->DependsOn( pDel ) )
+ {
+ pFtnInfo->ChgPageDesc( aPageDescs[0] );
+ if ( bHasLayout )
+ {
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::CheckFtnPageDescs), false));
+ }
+ }
+ else if ( pEndNoteInfo->DependsOn( pDel ) )
+ {
+ pEndNoteInfo->ChgPageDesc( aPageDescs[0] );
+ if ( bHasLayout )
+ {
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::CheckFtnPageDescs), true));
+ }
+ }
+
+ for ( sal_uInt16 j = 0; j < aPageDescs.Count(); ++j )
+ {
+ if ( aPageDescs[j]->GetFollow() == pDel )
+ {
+ aPageDescs[j]->SetFollow( 0 );
+ if( bHasLayout )
+ {
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllCheckPageDescs));//swmod 080228
+ }
+ }
+ }
+}
+
+// #116530#
+void SwDoc::BroadcastStyleOperation(String rName, SfxStyleFamily eFamily,
+ sal_uInt16 nOp)
+{
+ if (pDocShell)
+ {
+ SfxStyleSheetBasePool * pPool = pDocShell->GetStyleSheetPool();
+
+ if (pPool)
+ {
+ pPool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase * pBase = pPool->Find(rName);
+
+ if (pBase != NULL)
+ pPool->Broadcast(SfxStyleSheetHint( nOp, *pBase ));
+ }
+ }
+}
+
+void SwDoc::DelPageDesc( sal_uInt16 i, sal_Bool bBroadcast )
+{
+ ASSERT( i < aPageDescs.Count(), "PageDescs ueberindiziert." );
+ ASSERT( i != 0, "Default Pagedesc loeschen is nicht." );
+ if ( i == 0 )
+ return;
+
+ SwPageDesc *pDel = aPageDescs[i];
+
+ // -> #116530#
+ if (bBroadcast)
+ BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_PAGE,
+ SFX_STYLESHEET_ERASED);
+ // <- #116530#
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo(new SwUndoPageDescDelete(*pDel, this));
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ PreDelPageDesc(pDel); // #i7983#
+
+ aPageDescs.Remove( i );
+ delete pDel;
+ SetModified();
+}
+
+
+
+/*************************************************************************
+|*
+|* SwDoc::MakePageDesc()
+|*
+|* Ersterstellung MA 25. Jan. 93
+|* Letzte Aenderung MA 20. Aug. 93
+|*
+|*************************************************************************/
+
+sal_uInt16 SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy,
+ sal_Bool bRegardLanguage, sal_Bool bBroadcast) // #116530#
+{
+ SwPageDesc *pNew;
+ if( pCpy )
+ {
+ pNew = new SwPageDesc( *pCpy );
+ pNew->SetName( rName );
+ if( rName != pCpy->GetName() )
+ {
+ pNew->SetPoolFmtId( USHRT_MAX );
+ pNew->SetPoolHelpId( USHRT_MAX );
+ pNew->SetPoolHlpFileId( UCHAR_MAX );
+ }
+ }
+ else
+ {
+ pNew = new SwPageDesc( rName, GetDfltFrmFmt(), this );
+ //Default-Seitenformat einstellen.
+ lcl_DefaultPageFmt( USHRT_MAX, pNew->GetMaster(), pNew->GetLeft() );
+
+ SvxFrameDirection aFrameDirection = bRegardLanguage ?
+ GetDefaultFrameDirection(GetAppLanguage())
+ : FRMDIR_HORI_LEFT_TOP;
+
+ pNew->GetMaster().SetFmtAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
+ pNew->GetLeft().SetFmtAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
+ }
+ aPageDescs.Insert( pNew, aPageDescs.Count() );
+
+ // -> #116530#
+ if (bBroadcast)
+ BroadcastStyleOperation(rName, SFX_STYLE_FAMILY_PAGE,
+ SFX_STYLESHEET_CREATED);
+ // <- #116530#
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // #116530#
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoPageDescCreate(pNew, this));
+ }
+
+ SetModified();
+ return (aPageDescs.Count()-1);
+}
+
+SwPageDesc* SwDoc::FindPageDescByName( const String& rName, sal_uInt16* pPos ) const
+{
+ SwPageDesc* pRet = 0;
+ if( pPos ) *pPos = USHRT_MAX;
+
+ for( sal_uInt16 n = 0, nEnd = aPageDescs.Count(); n < nEnd; ++n )
+ if( aPageDescs[ n ]->GetName() == rName )
+ {
+ pRet = aPageDescs[ n ];
+ if( pPos )
+ *pPos = n;
+ break;
+ }
+ return pRet;
+}
+
+/******************************************************************************
+ * Methode : void SwDoc::PrtDataChanged()
+ * Beschreibung:
+ * Erstellt : OK 27.10.94 10:20
+ * Aenderung : MA 26. Mar. 98
+ ******************************************************************************/
+
+void SwDoc::PrtDataChanged()
+{
+//!!!!!!!! Bei Aenderungen hier bitte ggf. InJobSetup im Sw3io mitpflegen
+
+ // --> FME 2005-01-21 #i41075#
+ ASSERT( get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) ||
+ 0 != getPrinter( sal_False ), "PrtDataChanged will be called recursive!" )
+ // <--
+ SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
+ SwWait *pWait = 0;
+ sal_Bool bEndAction = sal_False;
+
+ if( GetDocShell() )
+ GetDocShell()->UpdateFontList();
+
+ sal_Bool bDraw = sal_True;
+ if ( pTmpRoot )
+ {
+ ViewShell *pSh = GetCurrentViewShell();
+ if( !pSh->GetViewOptions()->getBrowseMode() ||
+ pSh->GetViewOptions()->IsPrtFormat() )
+ {
+ if ( GetDocShell() )
+ pWait = new SwWait( *GetDocShell(), sal_True );
+
+ pTmpRoot->StartAllAction();
+ bEndAction = sal_True;
+
+ bDraw = sal_False;
+ if( pDrawModel )
+ {
+ pDrawModel->SetAddExtLeading( get(IDocumentSettingAccess::ADD_EXT_LEADING) );
+ pDrawModel->SetRefDevice( getReferenceDevice( false ) );
+ }
+
+ pFntCache->Flush();
+
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_SIZE));//swmod 080304
+
+ if ( pSh )
+ {
+ do
+ {
+ pSh->InitPrt( pPrt );
+ pSh = (ViewShell*)pSh->GetNext();
+ }
+ while ( pSh != GetCurrentViewShell() );
+ }
+
+ }
+ } //swmod 080218
+ if ( bDraw && pDrawModel )
+ {
+ const sal_Bool bTmpAddExtLeading = get(IDocumentSettingAccess::ADD_EXT_LEADING);
+ if ( bTmpAddExtLeading != pDrawModel->IsAddExtLeading() )
+ pDrawModel->SetAddExtLeading( bTmpAddExtLeading );
+
+ OutputDevice* pOutDev = getReferenceDevice( false );
+ if ( pOutDev != pDrawModel->GetRefDevice() )
+ pDrawModel->SetRefDevice( pOutDev );
+ }
+
+ PrtOLENotify( sal_True );
+
+ if ( bEndAction )
+ pTmpRoot->EndAllAction(); //swmod 080218
+ delete pWait;
+}
+
+//Zur Laufzeit sammeln wir die GlobalNames der Server, die keine
+//Benachrichtigung zu Druckerwechseln wuenschen. Dadurch sparen wir
+//das Laden vieler Objekte (gluecklicherweise werden obendrein alle
+//Fremdobjekte unter einer ID abgebuildet). Init und DeInit vom Array
+//ist in init.cxx zu finden.
+extern SvPtrarr *pGlobalOLEExcludeList;
+
+void SwDoc::PrtOLENotify( sal_Bool bAll )
+{
+ SwFEShell *pShell = 0;
+ if ( GetCurrentViewShell() )
+ {
+ ViewShell *pSh = GetCurrentViewShell();
+ if ( !pSh->ISA(SwFEShell) )
+ do
+ { pSh = (ViewShell*)pSh->GetNext();
+ } while ( !pSh->ISA(SwFEShell) &&
+ pSh != GetCurrentViewShell() );
+
+ if ( pSh->ISA(SwFEShell) )
+ pShell = (SwFEShell*)pSh;
+ } //swmod 071107//swmod 071225
+ if ( !pShell )
+ {
+ //Das hat ohne Shell und damit ohne Client keinen Sinn, weil nur darueber
+ //die Kommunikation bezueglich der Groessenaenderung implementiert ist.
+ //Da wir keine Shell haben, merken wir uns diesen unguenstigen
+ //Zustand am Dokument, dies wird dann beim Erzeugen der ersten Shell
+ //nachgeholt.
+ mbOLEPrtNotifyPending = sal_True;
+ if ( bAll )
+ mbAllOLENotify = sal_True;
+ }
+ else
+ {
+ if ( mbAllOLENotify )
+ bAll = sal_True;
+
+ mbOLEPrtNotifyPending = mbAllOLENotify = sal_False;
+
+ SwOLENodes *pNodes = SwCntntNode::CreateOLENodesArray( *GetDfltGrfFmtColl(), !bAll );
+ if ( pNodes )
+ {
+ ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
+ 0, pNodes->Count(), GetDocShell());
+ GetCurrentLayout()->StartAllAction(); //swmod 080218
+
+ for( sal_uInt16 i = 0; i < pNodes->Count(); ++i )
+ {
+ ::SetProgressState( i, GetDocShell() );
+
+ SwOLENode* pOLENd = (*pNodes)[i];
+ pOLENd->SetOLESizeInvalid( sal_False );
+
+ //Ersteinmal die Infos laden und festellen ob das Teil nicht
+ //schon in der Exclude-Liste steht
+ SvGlobalName aName;
+
+ svt::EmbeddedObjectRef& xObj = pOLENd->GetOLEObj().GetObject();
+ if ( xObj.is() )
+ aName = SvGlobalName( xObj->getClassID() );
+ else //Noch nicht geladen
+ {
+ // TODO/LATER: retrieve ClassID of an unloaded object
+ // aName = ????
+ }
+
+ sal_Bool bFound = sal_False;
+ for ( sal_uInt16 j = 0;
+ j < pGlobalOLEExcludeList->Count() && !bFound;
+ ++j )
+ {
+ bFound = *(SvGlobalName*)(*pGlobalOLEExcludeList)[j] ==
+ aName;
+ }
+ if ( bFound )
+ continue;
+
+ //Kennen wir nicht, also muss das Objekt geladen werden.
+ //Wenn es keine Benachrichtigung wuenscht
+ if ( xObj.is() )
+ {
+ //TODO/LATER: needs MiscStatus for ResizeOnPrinterChange
+ /*
+ if ( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xRef->GetMiscStatus())
+ {
+ if ( pOLENd->GetFrm() )
+ {
+ xObj->OnDocumentPrinterChanged( pPrt );
+ pShell->CalcAndSetScale( xObj );//Client erzeugen lassen.
+ }
+ else
+ pOLENd->SetOLESizeInvalid( sal_True );
+ }
+ else */
+ pGlobalOLEExcludeList->Insert(
+ new SvGlobalName( aName ),
+ pGlobalOLEExcludeList->Count() );
+ }
+ }
+ delete pNodes;
+ GetCurrentLayout()->EndAllAction(); //swmod 080218
+ ::EndProgress( GetDocShell() );
+ }
+ }
+}
+
+IMPL_LINK( SwDoc, DoUpdateModifiedOLE, Timer *, )
+{
+ SwFEShell* pSh = (SwFEShell*)GetEditShell();
+ if( pSh )
+ {
+ mbOLEPrtNotifyPending = mbAllOLENotify = sal_False;
+
+ SwOLENodes *pNodes = SwCntntNode::CreateOLENodesArray( *GetDfltGrfFmtColl(), true );
+ if( pNodes )
+ {
+ ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
+ 0, pNodes->Count(), GetDocShell());
+ GetCurrentLayout()->StartAllAction(); //swmod 080218
+ SwMsgPoolItem aMsgHint( RES_UPDATE_ATTR );
+
+ for( sal_uInt16 i = 0; i < pNodes->Count(); ++i )
+ {
+ ::SetProgressState( i, GetDocShell() );
+
+ SwOLENode* pOLENd = (*pNodes)[i];
+ pOLENd->SetOLESizeInvalid( sal_False );
+
+ //Kennen wir nicht, also muss das Objekt geladen werden.
+ //Wenn es keine Benachrichtigung wuenscht
+ if( pOLENd->GetOLEObj().GetOleRef().is() ) //Kaputt?
+ {
+ //TODO/LATER: needs MiscStatus for ResizeOnPrinterChange
+ /*
+ if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE &
+ xRef->GetMiscStatus() )
+ {
+ if( pOLENd->GetFrm() )
+ {
+ xRef->OnDocumentPrinterChanged( pPrt );
+ pSh->CalcAndSetScale( xRef );//Client erzeugen lassen.
+ }
+ else
+ pOLENd->SetOLESizeInvalid( sal_True );
+ }*/
+ // repaint it
+ pOLENd->ModifyNotification( &aMsgHint, &aMsgHint );
+ }
+ }
+ GetCurrentLayout()->EndAllAction(); //swmod 080218
+ ::EndProgress( GetDocShell() );
+ delete pNodes;
+ }
+ }
+ return 0;
+}
+
+sal_Bool SwDoc::FindPageDesc( const String & rName, sal_uInt16 * pFound)
+{
+ sal_Bool bResult = sal_False;
+ sal_uInt16 nI;
+ for (nI = 0; nI < aPageDescs.Count(); nI++)
+ {
+ if (aPageDescs[nI]->GetName() == rName)
+ {
+ *pFound = nI;
+ bResult = sal_True;
+ break;
+ }
+ }
+
+ return bResult;
+}
+
+SwPageDesc * SwDoc::GetPageDesc( const String & rName )
+{
+ SwPageDesc * aResult = NULL;
+
+ sal_uInt16 nI;
+
+ if (FindPageDesc(rName, &nI))
+ aResult = aPageDescs[nI];
+
+ return aResult;
+}
+
+void SwDoc::DelPageDesc( const String & rName, sal_Bool bBroadcast ) // #116530#
+{
+ sal_uInt16 nI;
+
+ if (FindPageDesc(rName, &nI))
+ DelPageDesc(nI, bBroadcast); // #116530#
+}
+
+void SwDoc::ChgPageDesc( const String & rName, const SwPageDesc & rDesc)
+{
+ sal_uInt16 nI;
+
+ if (FindPageDesc(rName, &nI))
+ ChgPageDesc(nI, rDesc);
+}
+
+/*
+ * The HTML import cannot resist changing the page descriptions, I don't
+ * know why. This function is meant to check the page descriptors for invalid
+ * values.
+ */
+void SwDoc::CheckDefaultPageFmt()
+{
+ for ( sal_uInt16 i = 0; i < GetPageDescCnt(); ++i )
+ {
+ SwPageDesc& rDesc = _GetPageDesc( i );
+
+ SwFrmFmt& rMaster = rDesc.GetMaster();
+ SwFrmFmt& rLeft = rDesc.GetLeft();
+
+ const SwFmtFrmSize& rMasterSize = rMaster.GetFrmSize();
+ const SwFmtFrmSize& rLeftSize = rLeft.GetFrmSize();
+
+ const bool bSetSize = LONG_MAX == rMasterSize.GetWidth() ||
+ LONG_MAX == rMasterSize.GetHeight() ||
+ LONG_MAX == rLeftSize.GetWidth() ||
+ LONG_MAX == rLeftSize.GetHeight();
+
+ if ( bSetSize )
+ lcl_DefaultPageFmt( rDesc.GetPoolFmtId(), rDesc.GetMaster(), rDesc.GetLeft() );
+ }
+}
+
+void SwDoc::SetDefaultPageMode(bool bSquaredPageMode)
+{
+ if( !bSquaredPageMode == !IsSquaredPageMode() )
+ return;
+
+ const SwTextGridItem& rGrid =
+ (const SwTextGridItem&)GetDefault( RES_TEXTGRID );
+ SwTextGridItem aNewGrid = rGrid;
+ aNewGrid.SetSquaredMode(bSquaredPageMode);
+ aNewGrid.Init();
+ SetDefault(aNewGrid);
+
+ for ( sal_uInt16 i = 0; i < GetPageDescCnt(); ++i )
+ {
+ SwPageDesc& rDesc = _GetPageDesc( i );
+
+ SwFrmFmt& rMaster = rDesc.GetMaster();
+ SwFrmFmt& rLeft = rDesc.GetLeft();
+
+ SwTextGridItem aGrid((SwTextGridItem&)rMaster.GetFmtAttr(RES_TEXTGRID));
+ aGrid.SwitchPaperMode( bSquaredPageMode );
+ rMaster.SetFmtAttr(aGrid);
+ rLeft.SetFmtAttr(aGrid);
+ }
+}
+
+sal_Bool SwDoc::IsSquaredPageMode() const
+{
+ const SwTextGridItem& rGrid =
+ (const SwTextGridItem&)GetDefault( RES_TEXTGRID );
+ return rGrid.IsSquaredMode();
+}
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
new file mode 100644
index 000000000000..b18ccb6af8c4
--- /dev/null
+++ b/sw/source/core/doc/docdraw.cxx
@@ -0,0 +1,1103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <rtl/logfile.hxx>
+#include <vcl/outdev.hxx>
+#include <sfx2/printer.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/editeng.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/colritem.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdogrp.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/measfld.hxx>
+#include <svx/svdpool.hxx>
+#include <fmtanchr.hxx>
+#include <charatr.hxx>
+#include <frmfmt.hxx>
+#include <charfmt.hxx>
+#include <viewimp.hxx>
+#include <swhints.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <docsh.hxx>
+#include <rootfrm.hxx> //Damit der RootDtor gerufen wird.
+#include <poolfmt.hxx>
+#include <viewsh.hxx> // fuer MakeDrawView
+#include <drawdoc.hxx>
+#include <UndoDraw.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <dcontact.hxx>
+#include <dview.hxx>
+#include <mvsave.hxx>
+#include <flyfrm.hxx>
+#include <dflyobj.hxx>
+#include <svx/svdetc.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svx/svdpagv.hxx>
+#include <dcontact.hxx>
+#include <txtfrm.hxx>
+#include <frmfmt.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <fmtornt.hxx>
+#include <svx/svditer.hxx>
+#include <vector>
+#include <switerator.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::linguistic2;
+
+
+SV_IMPL_VARARR_SORT( _ZSortFlys, _ZSortFly )
+
+/*************************************************************************
+|*
+|* SwDoc::GroupSelection / SwDoc::UnGroupSelection
+|*
+|* Ersterstellung JP 21.08.95
+|* Letzte Aenderung JP 21.08.95
+|*
+|*************************************************************************/
+// OD 2004-04-01 #i26791# - local method to determine positioning and
+// alignment attributes for a drawing object, which is newly connected to
+// the layout. Used for a newly formed group object <SwDoc::GroupSelection(..)>
+// and the members of a destroyed group <SwDoc::UnGroupSelection(..)>
+void lcl_AdjustPositioningAttr( SwDrawFrmFmt* _pFrmFmt,
+ const SdrObject& _rSdrObj )
+{
+ const SwContact* pContact = GetUserCall( &_rSdrObj );
+ ASSERT( pContact, "<lcl_AdjustPositioningAttr(..)> - missing contact object." );
+
+ // determine position of new group object relative to its anchor frame position
+ SwTwips nHoriRelPos = 0;
+ SwTwips nVertRelPos = 0;
+ {
+ const SwFrm* pAnchorFrm = pContact->GetAnchoredObj( &_rSdrObj )->GetAnchorFrm();
+ ASSERT( !pAnchorFrm ||
+ !pAnchorFrm->IsTxtFrm() ||
+ !static_cast<const SwTxtFrm*>(pAnchorFrm)->IsFollow(),
+ "<lcl_AdjustPositioningAttr(..)> - anchor frame is a follow. Please inform OD." );
+ bool bVert = false;
+ bool bR2L = false;
+ // --> OD 2005-05-10 #i45952# - use anchor position of
+ // anchor frame, if it exist.
+ Point aAnchorPos;
+ if ( pAnchorFrm )
+ {
+ // --> OD 2005-05-10 #i45952#
+ aAnchorPos = pAnchorFrm->GetFrmAnchorPos( ::HasWrap( &_rSdrObj ) );
+ // <--
+ bVert = pAnchorFrm->IsVertical();
+ bR2L = pAnchorFrm->IsRightToLeft();
+ }
+ else
+ {
+ // --> OD 2005-05-10 #i45952#
+ aAnchorPos = _rSdrObj.GetAnchorPos();
+ // <--
+ // If no anchor frame exist - e.g. because no layout exists - the
+ // default layout direction is taken.
+ const SvxFrameDirectionItem* pDirItem =
+ static_cast<const SvxFrameDirectionItem*>(&(_pFrmFmt->GetAttrSet().GetPool()->GetDefaultItem( RES_FRAMEDIR )));
+ switch ( pDirItem->GetValue() )
+ {
+ case FRMDIR_VERT_TOP_LEFT:
+ {
+ // vertical from left-to-right - Badaa: supported now!
+ bVert = true;
+ bR2L = true;
+ //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
+ //ASSERT( false, "<lcl_AdjustPositioningAttr(..)> - vertical from left-to-right not supported." );
+ //End
+ }
+ break;
+ case FRMDIR_VERT_TOP_RIGHT:
+ {
+ // vertical from right-to-left
+ bVert = true;
+ bR2L = false;
+ }
+ break;
+ case FRMDIR_HORI_RIGHT_TOP:
+ {
+ // horizontal from right-to-left
+ bVert = false;
+ bR2L = true;
+ }
+ break;
+ case FRMDIR_HORI_LEFT_TOP:
+ {
+ // horizontal from left-to-right
+ bVert = false;
+ bR2L = false;
+ }
+ break;
+ }
+
+ }
+ // use geometry of drawing object
+ const SwRect aObjRect = _rSdrObj.GetSnapRect();
+
+ if ( bVert )
+ {
+ if ( bR2L ) {
+ //FRMDIR_VERT_TOP_LEFT
+ nHoriRelPos = aObjRect.Left() - aAnchorPos.X();
+ nVertRelPos = aObjRect.Top() - aAnchorPos.Y();
+ } else {
+ //FRMDIR_VERT_TOP_RIGHT
+ nHoriRelPos = aObjRect.Top() - aAnchorPos.Y();
+ nVertRelPos = aAnchorPos.X() - aObjRect.Right();
+ }
+ }
+ else if ( bR2L )
+ {
+ nHoriRelPos = aAnchorPos.X() - aObjRect.Right();
+ nVertRelPos = aObjRect.Top() - aAnchorPos.Y();
+ }
+ else
+ {
+ nHoriRelPos = aObjRect.Left() - aAnchorPos.X();
+ nVertRelPos = aObjRect.Top() - aAnchorPos.Y();
+ }
+ //End of SCMS
+ }
+
+ _pFrmFmt->SetFmtAttr( SwFmtHoriOrient( nHoriRelPos, text::HoriOrientation::NONE, text::RelOrientation::FRAME ) );
+ _pFrmFmt->SetFmtAttr( SwFmtVertOrient( nVertRelPos, text::VertOrientation::NONE, text::RelOrientation::FRAME ) );
+ // --> OD 2005-03-11 #i44334#, #i44681# - positioning attributes already set
+ _pFrmFmt->PosAttrSet();
+ // <--
+ // --> OD 2004-10-01 #i34750# - keep current object rectangle for drawing
+ // objects. The object rectangle is used on events from the drawing layer
+ // to adjust the positioning attributes - see <SwDrawContact::_Changed(..)>.
+ {
+ const SwAnchoredObject* pAnchoredObj = pContact->GetAnchoredObj( &_rSdrObj );
+ if ( pAnchoredObj->ISA(SwAnchoredDrawObject) )
+ {
+ const SwAnchoredDrawObject* pAnchoredDrawObj =
+ static_cast<const SwAnchoredDrawObject*>(pAnchoredObj);
+ const SwRect aObjRect = _rSdrObj.GetSnapRect();
+ const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
+ ->SetLastObjRect( aObjRect.SVRect() );
+ }
+ }
+ // <--
+}
+
+SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
+{
+ // OD 30.06.2003 #108784# - replace marked 'virtual' drawing objects by
+ // the corresponding 'master' drawing objects.
+ SwDrawView::ReplaceMarkedDrawVirtObjs( rDrawView );
+
+ const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
+ SwDrawFrmFmt *pFmt = 0L;
+ SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
+ sal_Bool bNoGroup = ( 0 == pObj->GetUpGroup() );
+ SwDrawContact* pNewContact = 0;
+ if( bNoGroup )
+ {
+ //Ankerattribut aufheben.
+ SwDrawContact *pMyContact = (SwDrawContact*)GetUserCall(pObj);
+ const SwFmtAnchor aAnch( pMyContact->GetFmt()->GetAnchor() );
+
+ SwUndoDrawGroup *const pUndo = (!GetIDocumentUndoRedo().DoesUndo())
+ ? 0
+ : new SwUndoDrawGroup( (sal_uInt16)rMrkList.GetMarkCount() );
+
+ // --> OD 2005-08-16 #i53320#
+ bool bGroupMembersNotPositioned( false );
+ {
+ SwAnchoredDrawObject* pAnchoredDrawObj =
+ static_cast<SwAnchoredDrawObject*>(pMyContact->GetAnchoredObj( pObj ));
+ bGroupMembersNotPositioned = pAnchoredDrawObj->NotYetPositioned();
+ }
+ // <--
+ //ContactObjekte und Formate vernichten.
+ for( sal_uInt16 i = 0; i < rMrkList.GetMarkCount(); ++i )
+ {
+ pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
+ SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj);
+
+ // --> OD 2005-08-16 #i53320#
+#ifdef DBG_UTIL
+ SwAnchoredDrawObject* pAnchoredDrawObj =
+ static_cast<SwAnchoredDrawObject*>(pContact->GetAnchoredObj( pObj ));
+ ASSERT( bGroupMembersNotPositioned == pAnchoredDrawObj->NotYetPositioned(),
+ "<SwDoc::GroupSelection(..)> - group members have different positioning status!" );
+#endif
+ // <--
+
+ pFmt = (SwDrawFrmFmt*)pContact->GetFmt();
+ //loescht sich selbst!
+ pContact->Changed(*pObj, SDRUSERCALL_DELETE, pObj->GetLastBoundRect() );
+ pObj->SetUserCall( 0 );
+
+ if( pUndo )
+ pUndo->AddObj( i, pFmt, pObj );
+ else
+ DelFrmFmt( pFmt );
+
+ // --> OD 2005-05-10 #i45952# - re-introduce position
+ // normalization of group member objects, because its anchor position
+ // is cleared, when they are grouped.
+ Point aAnchorPos( pObj->GetAnchorPos() );
+ pObj->NbcSetAnchorPos( Point( 0, 0 ) );
+ pObj->NbcMove( Size( aAnchorPos.X(), aAnchorPos.Y() ) );
+ // <--
+ }
+
+ pFmt = MakeDrawFrmFmt( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "DrawObject" )),
+ GetDfltFrmFmt() );
+ pFmt->SetFmtAttr( aAnch );
+ // --> OD 2004-10-25 #i36010# - set layout direction of the position
+ pFmt->SetPositionLayoutDir(
+ text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
+ // <--
+
+ rDrawView.GroupMarked();
+ ASSERT( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." );
+
+ SdrObject* pNewGroupObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
+ pNewContact = new SwDrawContact( pFmt, pNewGroupObj );
+ // --> OD 2004-11-22 #i35635#
+ pNewContact->MoveObjToVisibleLayer( pNewGroupObj );
+ // <--
+ pNewContact->ConnectToLayout();
+ // --> OD 2005-08-16 #i53320# - No adjustment of the positioning and
+ // alignment attributes, if group members aren't positioned yet.
+ if ( !bGroupMembersNotPositioned )
+ {
+ // OD 2004-04-01 #i26791# - Adjust positioning and alignment attributes.
+ lcl_AdjustPositioningAttr( pFmt, *pNewGroupObj );
+ }
+ // <--
+
+ if( pUndo )
+ {
+ pUndo->SetGroupFmt( pFmt );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ }
+ else
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ }
+
+ rDrawView.GroupMarked();
+ ASSERT( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." );
+ }
+
+ return pNewContact;
+}
+
+
+void SwDoc::UnGroupSelection( SdrView& rDrawView )
+{
+ bool const bUndo = GetIDocumentUndoRedo().DoesUndo();
+ if( bUndo )
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ }
+
+ // OD 30.06.2003 #108784# - replace marked 'virtual' drawing objects by
+ // the corresponding 'master' drawing objects.
+ SwDrawView::ReplaceMarkedDrawVirtObjs( rDrawView );
+
+ const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
+ // --> OD 2006-11-01 #130889#
+ std::vector< std::pair< SwDrawFrmFmt*, SdrObject* > >* pFmtsAndObjs( 0L );
+ const sal_uInt32 nMarkCount( rMrkList.GetMarkCount() );
+ // <--
+ if ( nMarkCount )
+ {
+ // --> OD 2006-11-01 #130889#
+ pFmtsAndObjs = new std::vector< std::pair< SwDrawFrmFmt*, SdrObject* > >[nMarkCount];
+ // <--
+ SdrObject *pMyObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
+ if( !pMyObj->GetUpGroup() )
+ {
+ String sDrwFmtNm( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM("DrawObject" )));
+ for ( sal_uInt16 i = 0; i < nMarkCount; ++i )
+ {
+ SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
+ if ( pObj->IsA( TYPE(SdrObjGroup) ) )
+ {
+ SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj);
+ SwFmtAnchor aAnch( pContact->GetFmt()->GetAnchor() );
+ SdrObjList *pLst = ((SdrObjGroup*)pObj)->GetSubList();
+
+ SwUndoDrawUnGroup* pUndo = 0;
+ if( bUndo )
+ {
+ pUndo = new SwUndoDrawUnGroup( (SdrObjGroup*)pObj );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ for ( sal_uInt16 i2 = 0; i2 < pLst->GetObjCount(); ++i2 )
+ {
+ SdrObject* pSubObj = pLst->GetObj( i2 );
+ SwDrawFrmFmt *pFmt = MakeDrawFrmFmt( sDrwFmtNm,
+ GetDfltFrmFmt() );
+ pFmt->SetFmtAttr( aAnch );
+ // --> OD 2004-10-25 #i36010# - set layout direction of the position
+ pFmt->SetPositionLayoutDir(
+ text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
+ // <--
+ // --> OD 2006-11-01 #130889#
+ // creation of <SwDrawContact> instances for the group
+ // members and its connection to the Writer layout is
+ // done after intrinsic ungrouping.
+// SwDrawContact* pContact = new SwDrawContact( pFmt, pSubObj );
+// // --> OD 2004-11-22 #i35635#
+// pContact->MoveObjToVisibleLayer( pSubObj );
+// // <--
+// pContact->ConnectToLayout();
+// // OD 2004-04-07 #i26791# - Adjust positioning and
+// // alignment attributes.
+// lcl_AdjustPositioningAttr( pFmt, *pSubObj );
+ pFmtsAndObjs[i].push_back( std::pair< SwDrawFrmFmt*, SdrObject* >( pFmt, pSubObj ) );
+ // <--
+
+ if( bUndo )
+ pUndo->AddObj( i2, pFmt );
+ }
+ }
+ }
+ }
+ }
+ rDrawView.UnGroupMarked();
+ // --> OD 2006-11-01 #130889#
+ // creation of <SwDrawContact> instances for the former group members and
+ // its connection to the Writer layout.
+ for ( sal_uInt32 i = 0; i < nMarkCount; ++i )
+ {
+ SwUndoDrawUnGroupConnectToLayout* pUndo = 0;
+ if( bUndo )
+ {
+ pUndo = new SwUndoDrawUnGroupConnectToLayout();
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ while ( pFmtsAndObjs[i].size() > 0 )
+ {
+ SwDrawFrmFmt* pFmt( pFmtsAndObjs[i].back().first );
+ SdrObject* pObj( pFmtsAndObjs[i].back().second );
+ pFmtsAndObjs[i].pop_back();
+
+ SwDrawContact* pContact = new SwDrawContact( pFmt, pObj );
+ pContact->MoveObjToVisibleLayer( pObj );
+ pContact->ConnectToLayout();
+ lcl_AdjustPositioningAttr( pFmt, *pObj );
+
+ if ( bUndo )
+ {
+ pUndo->AddFmtAndObj( pFmt, pObj );
+ }
+ }
+ }
+ delete [] pFmtsAndObjs;
+ // <--
+}
+
+/*************************************************************************
+|*
+|* SwDoc::DeleteSelection()
+|*
+|* Ersterstellung MA 14. Nov. 95
+|* Letzte Aenderung MA 14. Nov. 95
+|*
+|*************************************************************************/
+
+sal_Bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
+{
+ sal_Bool bCallBase = sal_False;
+ const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
+ if( rMrkList.GetMarkCount() )
+ {
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+ sal_uInt16 i;
+ sal_Bool bDelMarked = sal_True;
+
+ if( 1 == rMrkList.GetMarkCount() )
+ {
+ SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
+ if( pObj->ISA(SwVirtFlyDrawObj) )
+ {
+ SwFlyFrmFmt* pFrmFmt = (SwFlyFrmFmt*)
+ ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetFmt();
+ if( pFrmFmt )
+ {
+ DelLayoutFmt( pFrmFmt );
+ bDelMarked = sal_False;
+ }
+ }
+ }
+
+ for( i = 0; i < rMrkList.GetMarkCount(); ++i )
+ {
+ SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
+ if( !pObj->ISA(SwVirtFlyDrawObj) )
+ {
+ SwDrawContact *pC = (SwDrawContact*)GetUserCall(pObj);
+ SwDrawFrmFmt *pFrmFmt = (SwDrawFrmFmt*)pC->GetFmt();
+ if( pFrmFmt &&
+ FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() )
+ {
+ rDrawView.MarkObj( pObj, rDrawView.Imp().GetPageView(), sal_True );
+ --i;
+ DelLayoutFmt( pFrmFmt );
+ }
+ }
+ }
+
+ if( rMrkList.GetMarkCount() && bDelMarked )
+ {
+ SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
+ if( !pObj->GetUpGroup() )
+ {
+ SwUndoDrawDelete *const pUndo =
+ (!GetIDocumentUndoRedo().DoesUndo())
+ ? 0
+ : new SwUndoDrawDelete( (sal_uInt16)rMrkList.GetMarkCount() );
+
+ //ContactObjekte vernichten, Formate sicherstellen.
+ for( i = 0; i < rMrkList.GetMarkCount(); ++i )
+ {
+ const SdrMark& rMark = *rMrkList.GetMark( i );
+ pObj = rMark.GetMarkedSdrObj();
+ SwDrawContact *pContact = (SwDrawContact*)pObj->GetUserCall();
+ if( pContact ) // natuerlich nicht bei gruppierten Objekten
+ {
+ SwDrawFrmFmt *pFmt = (SwDrawFrmFmt*)pContact->GetFmt();
+ // OD 18.06.2003 #108784# - before delete of selection
+ // is performed, marked <SwDrawVirtObj>-objects have to
+ // be replaced by its reference objects.
+ // Thus, assert, if a <SwDrawVirt>-object is found in the mark list.
+ if ( pObj->ISA(SwDrawVirtObj) )
+ {
+ ASSERT( false,
+ "<SwDrawVirtObj> is still marked for delete. application will crash!" );
+ }
+ //loescht sich selbst!
+ pContact->Changed(*pObj, SDRUSERCALL_DELETE, pObj->GetLastBoundRect() );
+ pObj->SetUserCall( 0 );
+
+ if( pUndo )
+ pUndo->AddObj( i, pFmt, rMark );
+ else
+ DelFrmFmt( pFmt );
+ }
+ }
+
+ if( pUndo )
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ }
+ bCallBase = sal_True;
+ }
+ SetModified();
+
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+ }
+
+ return bCallBase;
+}
+
+/*************************************************************************
+|*
+|* SwDoc::DeleteSelection()
+|*
+|* Ersterstellung JP 11.01.96
+|* Letzte Aenderung JP 11.01.96
+|*
+|*************************************************************************/
+
+_ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn,
+ sal_uInt32 nArrOrdNum )
+ : pFmt( pFrmFmt ), pAnchor( pFlyAn ), nOrdNum( nArrOrdNum )
+{
+ // #i11176#
+ // This also needs to work when no layout exists. Thus, for
+ // FlyFrames an alternative method is used now in that case.
+ if( RES_FLYFRMFMT == pFmt->Which() )
+ {
+ if( pFmt->getIDocumentLayoutAccess()->GetCurrentViewShell() ) //swmod 071107//swmod 071225
+ {
+ // Schauen, ob es ein SdrObject dafuer gibt
+ SwFlyFrm* pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement( *pFrmFmt );
+ if( pFly )
+ nOrdNum = pFly->GetVirtDrawObj()->GetOrdNum();
+ }
+ else
+ {
+ // Schauen, ob es ein SdrObject dafuer gibt
+ SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *pFrmFmt );
+ if( pContact )
+ nOrdNum = pContact->GetMaster()->GetOrdNum();
+ }
+ }
+ else if( RES_DRAWFRMFMT == pFmt->Which() )
+ {
+ // Schauen, ob es ein SdrObject dafuer gibt
+ SwDrawContact* pContact = SwIterator<SwDrawContact,SwFmt>::FirstElement( *pFrmFmt );
+ if( pContact )
+ nOrdNum = pContact->GetMaster()->GetOrdNum();
+ }
+ else {
+ ASSERT( !this, "was ist das fuer ein Format?" );
+ }
+}
+
+/*************************************************************************/
+// Wird auch vom Sw3-Reader gerufen, wenn ein Fehler beim Einlesen
+// des Drawing Layers auftrat. In diesem Fall wird der Layer komplett
+// neu aufgebaut.
+
+// #75371#
+#include <svx/sxenditm.hxx>
+
+void SwDoc::InitDrawModel()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::InitDrawModel" );
+
+ //!!Achtung im sw3-Reader (sw3imp.cxx) gibt es aehnlichen Code, der
+ //mitgepfelgt werden muss.
+ if ( pDrawModel )
+ ReleaseDrawModel();
+
+ //DrawPool und EditEnginePool anlegen, diese gehoeren uns und werden
+ //dem Drawing nur mitgegeben. Im ReleaseDrawModel werden die Pools wieder
+ //zerstoert.
+ // 17.2.99: for Bug 73110 - for loading the drawing items. This must
+ // be loaded without RefCounts!
+ SfxItemPool *pSdrPool = new SdrItemPool( &GetAttrPool() );
+ // #75371# change DefaultItems for the SdrEdgeObj distance items
+ // to TWIPS.
+ if(pSdrPool)
+ {
+ const long nDefEdgeDist = ((500 * 72) / 127); // 1/100th mm in twips
+ pSdrPool->SetPoolDefaultItem(SdrEdgeNode1HorzDistItem(nDefEdgeDist));
+ pSdrPool->SetPoolDefaultItem(SdrEdgeNode1VertDistItem(nDefEdgeDist));
+ pSdrPool->SetPoolDefaultItem(SdrEdgeNode2HorzDistItem(nDefEdgeDist));
+ pSdrPool->SetPoolDefaultItem(SdrEdgeNode2VertDistItem(nDefEdgeDist));
+
+ // #i33700#
+ // Set shadow distance defaults as PoolDefaultItems. Details see bug.
+ pSdrPool->SetPoolDefaultItem(SdrShadowXDistItem((300 * 72) / 127));
+ pSdrPool->SetPoolDefaultItem(SdrShadowYDistItem((300 * 72) / 127));
+ }
+ SfxItemPool *pEEgPool = EditEngine::CreatePool( sal_False );
+ pSdrPool->SetSecondaryPool( pEEgPool );
+ if ( !GetAttrPool().GetFrozenIdRanges () )
+ GetAttrPool().FreezeIdRanges();
+ else
+ pSdrPool->FreezeIdRanges();
+
+ // SJ: #95129# set FontHeight pool defaults without changing static SdrEngineDefaults
+ GetAttrPool().SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ));
+
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create DrawDocument" );
+ //Das SdrModel gehoert dem Dokument, wir haben immer zwei Layer und eine
+ //Seite.
+ pDrawModel = new SwDrawDocument( this );
+
+ pDrawModel->EnableUndo( GetIDocumentUndoRedo().DoesUndo() );
+
+ String sLayerNm;
+ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Hell" ));
+ nHell = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+
+ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Heaven" ));
+ nHeaven = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+
+ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Controls" ));
+ nControls = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+
+ // OD 25.06.2003 #108784# - add invisible layers corresponding to the
+ // visible ones.
+ {
+ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHell" ));
+ nInvisibleHell = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+
+ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHeaven" ));
+ nInvisibleHeaven = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+
+ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleControls" ));
+ nInvisibleControls = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+ }
+
+ SdrPage* pMasterPage = pDrawModel->AllocPage( sal_False );
+ pDrawModel->InsertPage( pMasterPage );
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create DrawDocument" );
+
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create Spellchecker/Hyphenator" );
+ SdrOutliner& rOutliner = pDrawModel->GetDrawOutliner();
+ uno::Reference< XSpellChecker1 > xSpell = ::GetSpellChecker();
+ rOutliner.SetSpeller( xSpell );
+ uno::Reference<XHyphenator> xHyphenator( ::GetHyphenator() );
+ rOutliner.SetHyphenator( xHyphenator );
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create Spellchecker/Hyphenator" );
+
+ SetCalcFieldValueHdl(&rOutliner);
+ SetCalcFieldValueHdl(&pDrawModel->GetHitTestOutliner());
+
+ //JP 16.07.98: Bug 50193 - Linkmanager am Model setzen, damit
+ // dort ggfs. verlinkte Grafiken eingefuegt werden koennen
+ //JP 28.01.99: der WinWord Import benoetigt ihn auch
+ pDrawModel->SetLinkManager( &GetLinkManager() );
+ pDrawModel->SetAddExtLeading( get(IDocumentSettingAccess::ADD_EXT_LEADING) );
+
+ OutputDevice* pRefDev = getReferenceDevice( false );
+ if ( pRefDev )
+ pDrawModel->SetRefDevice( pRefDev );
+
+ pDrawModel->SetNotifyUndoActionHdl( LINK( this, SwDoc, AddDrawUndo ));
+ if ( pCurrentView )
+ {
+ ViewShell* pViewSh = pCurrentView;
+ do
+ {
+ SwRootFrm* pRoot = pViewSh->GetLayout();
+ if( pRoot && !pRoot->GetDrawPage() )
+ {
+ // Disable "multiple layout" for the moment:
+ // use pMasterPage instead of a new created SdrPage
+ // pDrawModel->AllocPage( FALSE );
+ // pDrawModel->InsertPage( pDrawPage );
+ SdrPage* pDrawPage = pMasterPage;
+ pRoot->SetDrawPage( pDrawPage );
+ pDrawPage->SetSize( pRoot->Frm().SSize() );
+ }
+ pViewSh = (ViewShell*)pViewSh->GetNext();
+ }while( pViewSh != pCurrentView );
+ }
+}
+
+/** method to notify drawing page view about the invisible layers
+
+ OD 26.06.2003 #108784#
+
+ @author OD
+*/
+void SwDoc::NotifyInvisibleLayers( SdrPageView& _rSdrPageView )
+{
+ String sLayerNm;
+ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHell" ));
+ _rSdrPageView.SetLayerVisible( sLayerNm, sal_False );
+
+ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHeaven" ));
+ _rSdrPageView.SetLayerVisible( sLayerNm, sal_False );
+
+ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleControls" ));
+ _rSdrPageView.SetLayerVisible( sLayerNm, sal_False );
+}
+
+/** method to determine, if a layer ID belongs to the visible ones.
+
+ OD 25.06.2003 #108784#
+ Note: If given layer ID is unknown, method asserts and returns <false>.
+
+ @author OD
+*/
+bool SwDoc::IsVisibleLayerId( const SdrLayerID& _nLayerId ) const
+{
+ bool bRetVal;
+
+ if ( _nLayerId == GetHeavenId() ||
+ _nLayerId == GetHellId() ||
+ _nLayerId == GetControlsId() )
+ {
+ bRetVal = true;
+ }
+ else if ( _nLayerId == GetInvisibleHeavenId() ||
+ _nLayerId == GetInvisibleHellId() ||
+ _nLayerId == GetInvisibleControlsId() )
+ {
+ bRetVal = false;
+ }
+ else
+ {
+ ASSERT( false, "<SwDoc::IsVisibleLayerId(..)> - unknown layer ID." );
+ bRetVal = false;
+ }
+
+ return bRetVal;
+}
+
+/** method to determine, if the corresponding visible layer ID for a invisible one.
+
+ OD 25.06.2003 #108784#
+ Note: If given layer ID is a visible one, method returns given layer ID.
+ Note: If given layer ID is unknown, method returns given layer ID.
+
+ @author OD
+*/
+SdrLayerID SwDoc::GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId )
+{
+ SdrLayerID nVisibleLayerId;
+
+ if ( _nInvisibleLayerId == GetInvisibleHeavenId() )
+ {
+ nVisibleLayerId = GetHeavenId();
+ }
+ else if ( _nInvisibleLayerId == GetInvisibleHellId() )
+ {
+ nVisibleLayerId = GetHellId();
+ }
+ else if ( _nInvisibleLayerId == GetInvisibleControlsId() )
+ {
+ nVisibleLayerId = GetControlsId();
+ }
+ else if ( _nInvisibleLayerId == GetHeavenId() ||
+ _nInvisibleLayerId == GetHellId() ||
+ _nInvisibleLayerId == GetControlsId() )
+ {
+ ASSERT( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID already an invisible one." );
+ nVisibleLayerId = _nInvisibleLayerId;
+ }
+ else
+ {
+ ASSERT( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID is unknown." );
+ nVisibleLayerId = _nInvisibleLayerId;
+ }
+
+ return nVisibleLayerId;
+}
+
+/** method to determine, if the corresponding invisible layer ID for a visible one.
+
+ OD 25.06.2003 #108784#
+ Note: If given layer ID is a invisible one, method returns given layer ID.
+ Note: If given layer ID is unknown, method returns given layer ID.
+
+ @author OD
+*/
+SdrLayerID SwDoc::GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId )
+{
+ SdrLayerID nInvisibleLayerId;
+
+ if ( _nVisibleLayerId == GetHeavenId() )
+ {
+ nInvisibleLayerId = GetInvisibleHeavenId();
+ }
+ else if ( _nVisibleLayerId == GetHellId() )
+ {
+ nInvisibleLayerId = GetInvisibleHellId();
+ }
+ else if ( _nVisibleLayerId == GetControlsId() )
+ {
+ nInvisibleLayerId = GetInvisibleControlsId();
+ }
+ else if ( _nVisibleLayerId == GetInvisibleHeavenId() ||
+ _nVisibleLayerId == GetInvisibleHellId() ||
+ _nVisibleLayerId == GetInvisibleControlsId() )
+ {
+ ASSERT( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID already an invisible one." );
+ nInvisibleLayerId = _nVisibleLayerId;
+ }
+ else
+ {
+ ASSERT( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID is unknown." );
+ nInvisibleLayerId = _nVisibleLayerId;
+ }
+
+ return nInvisibleLayerId;
+}
+
+/*************************************************************************/
+
+
+void SwDoc::ReleaseDrawModel()
+{
+ if ( pDrawModel )
+ {
+ //!!Den code im sw3io fuer Einfuegen Dokument mitpflegen!!
+
+ delete pDrawModel; pDrawModel = 0;
+ SfxItemPool *pSdrPool = GetAttrPool().GetSecondaryPool();
+
+ ASSERT( pSdrPool, "missing Pool" );
+ SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool();
+ ASSERT( !pEEgPool->GetSecondaryPool(), "i don't accept additional pools");
+ pSdrPool->Delete(); //Erst die Items vernichten lassen,
+ //dann erst die Verkettung loesen
+ GetAttrPool().SetSecondaryPool( 0 ); //Der ist ein muss!
+ pSdrPool->SetSecondaryPool( 0 ); //Der ist sicherer
+ SfxItemPool::Free(pSdrPool);
+ SfxItemPool::Free(pEEgPool);
+ }
+}
+
+/*************************************************************************/
+
+
+SdrModel* SwDoc::_MakeDrawModel()
+{
+ ASSERT( !pDrawModel, "_MakeDrawModel: Why?" );
+ InitDrawModel();
+ if ( pCurrentView )
+ {
+ ViewShell* pTmp = pCurrentView;
+ do
+ {
+ pTmp->MakeDrawView();
+ pTmp = (ViewShell*) pTmp->GetNext();
+ } while ( pTmp != pCurrentView );
+
+ //Broadcast, damit die FormShell mit der DrawView verbunden werden kann
+ if( GetDocShell() )
+ {
+ SfxSimpleHint aHnt( SW_BROADCAST_DRAWVIEWS_CREATED );
+ GetDocShell()->Broadcast( aHnt );
+ }
+ } //swmod 071029//swmod 071225
+ return pDrawModel;
+}
+
+/*************************************************************************/
+
+void SwDoc::DrawNotifyUndoHdl()
+{
+ pDrawModel->SetNotifyUndoActionHdl( Link() );
+}
+
+/*************************************************************************
+*
+* Am Outliner Link auf Methode fuer Felddarstellung in Editobjekten setzen
+*
+*************************************************************************/
+
+void SwDoc::SetCalcFieldValueHdl(Outliner* pOutliner)
+{
+ pOutliner->SetCalcFieldValueHdl(LINK(this, SwDoc, CalcFieldValueHdl));
+}
+
+/*************************************************************************
+|*
+|* Felder bzw URLs im Outliner erkennen und Darstellung festlegen
+|*
+\************************************************************************/
+
+IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo)
+{
+ if (pInfo)
+ {
+ const SvxFieldItem& rField = pInfo->GetField();
+ const SvxFieldData* pField = rField.GetField();
+
+ if (pField && pField->ISA(SvxDateField))
+ {
+ /******************************************************************
+ * Date-Field
+ ******************************************************************/
+ pInfo->SetRepresentation(
+ ((const SvxDateField*) pField)->GetFormatted(
+ *GetNumberFormatter( sal_True ), LANGUAGE_SYSTEM) );
+ }
+ else if (pField && pField->ISA(SvxURLField))
+ {
+ /******************************************************************
+ * URL-Field
+ ******************************************************************/
+
+ switch ( ((const SvxURLField*) pField)->GetFormat() )
+ {
+ case SVXURLFORMAT_APPDEFAULT: //!!! einstellbar an App???
+ case SVXURLFORMAT_REPR:
+ {
+ pInfo->SetRepresentation(
+ ((const SvxURLField*)pField)->GetRepresentation());
+ }
+ break;
+
+ case SVXURLFORMAT_URL:
+ {
+ pInfo->SetRepresentation(
+ ((const SvxURLField*)pField)->GetURL());
+ }
+ break;
+ }
+
+ sal_uInt16 nChrFmt;
+
+ if (IsVisitedURL(((const SvxURLField*)pField)->GetURL()))
+ nChrFmt = RES_POOLCHR_INET_VISIT;
+ else
+ nChrFmt = RES_POOLCHR_INET_NORMAL;
+
+ SwFmt *pFmt = GetCharFmtFromPool(nChrFmt);
+
+ Color aColor(COL_LIGHTBLUE);
+ if (pFmt)
+ aColor = pFmt->GetColor().GetValue();
+
+ pInfo->SetTxtColor(aColor);
+ }
+ else if (pField && pField->ISA(SdrMeasureField))
+ {
+ /******************************************************************
+ * Measure-Field
+ ******************************************************************/
+ pInfo->ClearFldColor();
+ }
+ else if ( pField && pField->ISA(SvxExtTimeField))
+ {
+ /******************************************************************
+ * Time-Field
+ ******************************************************************/
+ pInfo->SetRepresentation(
+ ((const SvxExtTimeField*) pField)->GetFormatted(
+ *GetNumberFormatter( sal_True ), LANGUAGE_SYSTEM) );
+ }
+ else
+ {
+ DBG_ERROR("unbekannter Feldbefehl");
+ pInfo->SetRepresentation( String( '?' ) );
+ }
+ }
+
+ return(0);
+}
+
+/* TFFDI: The functions formerly declared 'inline'
+ */
+const SdrModel* SwDoc::GetDrawModel() const { return pDrawModel; }
+SdrModel* SwDoc::GetDrawModel() { return pDrawModel; }
+SdrLayerID SwDoc::GetHeavenId() const { return nHeaven; }
+SdrLayerID SwDoc::GetHellId() const { return nHell; }
+SdrLayerID SwDoc::GetControlsId() const { return nControls; }
+SdrLayerID SwDoc::GetInvisibleHeavenId() const { return nInvisibleHeaven; }
+SdrLayerID SwDoc::GetInvisibleHellId() const { return nInvisibleHell; }
+SdrLayerID SwDoc::GetInvisibleControlsId() const { return nInvisibleControls; }
+SdrModel* SwDoc::GetOrCreateDrawModel() { return GetDrawModel() ? GetDrawModel() : _MakeDrawModel(); }
+
+// --> OD 2006-03-14 #i62875#
+namespace docfunc
+{
+ bool ExistsDrawObjs( SwDoc& p_rDoc )
+ {
+ bool bExistsDrawObjs( false );
+
+ if ( p_rDoc.GetDrawModel() &&
+ p_rDoc.GetDrawModel()->GetPage( 0 ) )
+ {
+ const SdrPage& rSdrPage( *(p_rDoc.GetDrawModel()->GetPage( 0 )) );
+
+ SdrObjListIter aIter( rSdrPage, IM_FLAT );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj( aIter.Next() );
+ if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
+ !dynamic_cast<SwFlyDrawObj*>(pObj) )
+ {
+ bExistsDrawObjs = true;
+ break;
+ }
+ }
+ }
+
+ return bExistsDrawObjs;
+ }
+
+ bool AllDrawObjsOnPage( SwDoc& p_rDoc )
+ {
+ bool bAllDrawObjsOnPage( true );
+
+ if ( p_rDoc.GetDrawModel() &&
+ p_rDoc.GetDrawModel()->GetPage( 0 ) )
+ {
+ const SdrPage& rSdrPage( *(p_rDoc.GetDrawModel()->GetPage( 0 )) );
+
+ SdrObjListIter aIter( rSdrPage, IM_FLAT );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj( aIter.Next() );
+ if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
+ !dynamic_cast<SwFlyDrawObj*>(pObj) )
+ {
+ SwDrawContact* pDrawContact =
+ dynamic_cast<SwDrawContact*>(::GetUserCall( pObj ));
+ if ( pDrawContact )
+ {
+ SwAnchoredDrawObject* pAnchoredDrawObj =
+ dynamic_cast<SwAnchoredDrawObject*>(pDrawContact->GetAnchoredObj( pObj ));
+
+ // error handling
+ {
+ if ( !pAnchoredDrawObj )
+ {
+ ASSERT( false,
+ "<docfunc::AllDrawObjsOnPage() - missing anchored draw object" );
+ bAllDrawObjsOnPage = false;
+ break;
+ }
+ }
+
+ if ( pAnchoredDrawObj->NotYetPositioned() )
+ {
+ // The drawing object isn't yet layouted.
+ // Thus, it isn't known, if all drawing objects are on page.
+ bAllDrawObjsOnPage = false;
+ break;
+ }
+ else if ( pAnchoredDrawObj->IsOutsidePage() )
+ {
+ bAllDrawObjsOnPage = false;
+ break;
+ }
+ }
+ else
+ {
+ // contact object of drawing object doesn't exists.
+ // Thus, the drawing object isn't yet positioned.
+ // Thus, it isn't known, if all drawing objects are on page.
+ bAllDrawObjsOnPage = false;
+ break;
+ }
+ }
+ }
+ }
+
+ return bAllDrawObjsOnPage;
+ }
+}
+// <--
+
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
new file mode 100644
index 000000000000..ef5ecb8c255c
--- /dev/null
+++ b/sw/source/core/doc/docedt.cxx
@@ -0,0 +1,2839 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <string.h> // fuer strchr()
+#include <hintids.hxx>
+
+#include <vcl/sound.hxx>
+#include <editeng/cscoitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <linguistic/lngprops.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/i18n/WordType.hdl>
+#include <unotools/charclass.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include <fmtanchr.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtpdsc.hxx>
+#include <txtftn.hxx>
+#include <acorrect.hxx> // Autokorrektur
+#include <IMark.hxx> // fuer SwBookmark
+#include <cntfrm.hxx> // fuers Spell
+#include <crsrsh.hxx>
+#include <doc.hxx>
+#include <UndoManager.hxx>
+#include <docsh.hxx>
+#include <docary.hxx>
+#include <doctxm.hxx> // beim Move: Verzeichnisse korrigieren
+#include <ftnidx.hxx>
+#include <ftninfo.hxx>
+#include <mdiexp.hxx> // Statusanzeige
+#include <mvsave.hxx> // Strukturen zum Sichern beim Move/Delete
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <redline.hxx>
+#include <rootfrm.hxx> // fuers UpdateFtn
+#include <splargs.hxx> // fuer Spell
+#include <swtable.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <txtfrm.hxx>
+#include <hints.hxx>
+#include <UndoSplitMove.hxx>
+#include <UndoRedline.hxx>
+#include <UndoOverwrite.hxx>
+#include <UndoInsert.hxx>
+#include <UndoDelete.hxx>
+#include <breakit.hxx>
+#include <hhcwrp.hxx>
+#include <breakit.hxx>
+#include <vcl/msgbox.hxx>
+#include "comcore.hrc"
+#include "editsh.hxx"
+#include <unoflatpara.hxx>
+#include <SwGrammarMarkUp.hxx>
+
+#include <vector>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::i18n;
+
+//using namespace ::utl;
+#ifndef S2U
+#define S2U(rString) OUString::createFromAscii(rString)
+#endif
+
+struct _SaveRedline
+{
+ SwRedline* pRedl;
+ sal_uInt32 nStt, nEnd;
+ xub_StrLen nSttCnt, nEndCnt;
+
+ _SaveRedline( SwRedline* pR, const SwNodeIndex& rSttIdx )
+ : pRedl( pR )
+ {
+ const SwPosition* pStt = pR->Start(),
+ * pEnd = pR->GetMark() == pStt ? pR->GetPoint() : pR->GetMark();
+ sal_uInt32 nSttIdx = rSttIdx.GetIndex();
+ nStt = pStt->nNode.GetIndex() - nSttIdx;
+ nSttCnt = pStt->nContent.GetIndex();
+ if( pR->HasMark() )
+ {
+ nEnd = pEnd->nNode.GetIndex() - nSttIdx;
+ nEndCnt = pEnd->nContent.GetIndex();
+ }
+
+ pRedl->GetPoint()->nNode = 0;
+ pRedl->GetPoint()->nContent.Assign( 0, 0 );
+ pRedl->GetMark()->nNode = 0;
+ pRedl->GetMark()->nContent.Assign( 0, 0 );
+ }
+
+ _SaveRedline( SwRedline* pR, const SwPosition& rPos )
+ : pRedl( pR )
+ {
+ const SwPosition* pStt = pR->Start(),
+ * pEnd = pR->GetMark() == pStt ? pR->GetPoint() : pR->GetMark();
+ sal_uInt32 nSttIdx = rPos.nNode.GetIndex();
+ nStt = pStt->nNode.GetIndex() - nSttIdx;
+ nSttCnt = pStt->nContent.GetIndex();
+ if( nStt == 0 )
+ nSttCnt = nSttCnt - rPos.nContent.GetIndex();
+ if( pR->HasMark() )
+ {
+ nEnd = pEnd->nNode.GetIndex() - nSttIdx;
+ nEndCnt = pEnd->nContent.GetIndex();
+ if( nEnd == 0 )
+ nEndCnt = nEndCnt - rPos.nContent.GetIndex();
+ }
+
+ pRedl->GetPoint()->nNode = 0;
+ pRedl->GetPoint()->nContent.Assign( 0, 0 );
+ pRedl->GetMark()->nNode = 0;
+ pRedl->GetMark()->nContent.Assign( 0, 0 );
+ }
+
+ void SetPos( sal_uInt32 nInsPos )
+ {
+ pRedl->GetPoint()->nNode = nInsPos + nStt;
+ pRedl->GetPoint()->nContent.Assign( pRedl->GetCntntNode(), nSttCnt );
+ if( pRedl->HasMark() )
+ {
+ pRedl->GetMark()->nNode = nInsPos + nEnd;
+ pRedl->GetMark()->nContent.Assign( pRedl->GetCntntNode(sal_False), nEndCnt );
+ }
+ }
+
+ void SetPos( const SwPosition& aPos )
+ {
+ pRedl->GetPoint()->nNode = aPos.nNode.GetIndex() + nStt;
+ pRedl->GetPoint()->nContent.Assign( pRedl->GetCntntNode(), nSttCnt + ( nStt == 0 ? aPos.nContent.GetIndex() : 0 ) );
+ if( pRedl->HasMark() )
+ {
+ pRedl->GetMark()->nNode = aPos.nNode.GetIndex() + nEnd;
+ pRedl->GetMark()->nContent.Assign( pRedl->GetCntntNode(sal_False), nEndCnt + ( nEnd == 0 ? aPos.nContent.GetIndex() : 0 ) );
+ }
+ }
+};
+
+SV_DECL_PTRARR_DEL( _SaveRedlines, _SaveRedline*, 0, 4 )
+
+SV_IMPL_VARARR( _SaveFlyArr, _SaveFly )
+SV_IMPL_PTRARR( _SaveRedlines, _SaveRedline* )
+
+bool lcl_MayOverwrite( const SwTxtNode *pNode, const xub_StrLen nPos )
+{
+ sal_Unicode cChr = pNode->GetTxt().GetChar( nPos );
+ return !( ( CH_TXTATR_BREAKWORD == cChr || CH_TXTATR_INWORD == cChr ) &&
+ (0 != pNode->GetTxtAttrForCharAt( nPos ) ) );
+}
+
+void lcl_SkipAttr( const SwTxtNode *pNode, SwIndex &rIdx, xub_StrLen &rStart )
+{
+ if( !lcl_MayOverwrite( pNode, rStart ) )
+ {
+ // ueberspringe alle SonderAttribute
+ do {
+ // "Beep" bei jedem ausgelassenen
+ Sound::Beep(SOUND_ERROR);
+ rIdx++;
+ } while( (rStart = rIdx.GetIndex()) < pNode->GetTxt().Len()
+ && !lcl_MayOverwrite(pNode, rStart) );
+ }
+}
+
+// -----------------------------------------------------------------
+
+void _RestFlyInRange( _SaveFlyArr & rArr, const SwNodeIndex& rSttIdx,
+ const SwNodeIndex* pInsertPos )
+{
+ SwPosition aPos( rSttIdx );
+ for( sal_uInt16 n = 0; n < rArr.Count(); ++n )
+ {
+ // neuen Anker anlegen
+ _SaveFly& rSave = rArr[n];
+ SwFrmFmt* pFmt = rSave.pFrmFmt;
+
+ if( rSave.bInsertPosition )
+ {
+ if( pInsertPos != NULL )
+ aPos.nNode = *pInsertPos;
+ else
+ aPos.nNode = rSttIdx.GetIndex();
+ }
+ else
+ aPos.nNode = rSttIdx.GetIndex() + rSave.nNdDiff;
+
+ aPos.nContent.Assign( 0, 0 );
+ SwFmtAnchor aAnchor( pFmt->GetAnchor() );
+ aAnchor.SetAnchor( &aPos );
+ pFmt->GetDoc()->GetSpzFrmFmts()->Insert(
+ pFmt, pFmt->GetDoc()->GetSpzFrmFmts()->Count() );
+ pFmt->SetFmtAttr( aAnchor );
+ SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode();
+ if( pCNd && pCNd->getLayoutFrm( pFmt->GetDoc()->GetCurrentLayout(), 0, 0, sal_False ) )
+ pFmt->MakeFrms();
+ }
+}
+
+void _SaveFlyInRange( const SwNodeRange& rRg, _SaveFlyArr& rArr )
+{
+ SwSpzFrmFmts& rFmts = *rRg.aStart.GetNode().GetDoc()->GetSpzFrmFmts();
+ for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+ {
+ SwFrmFmt *const pFmt = static_cast<SwFrmFmt*>(rFmts[n]);
+ SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor();
+ SwPosition const*const pAPos = pAnchor->GetCntntAnchor();
+ if (pAPos &&
+ ((FLY_AT_PARA == pAnchor->GetAnchorId()) ||
+ (FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
+ rRg.aStart <= pAPos->nNode && pAPos->nNode < rRg.aEnd )
+ {
+ _SaveFly aSave( pAPos->nNode.GetIndex() - rRg.aStart.GetIndex(),
+ pFmt, sal_False );
+ rArr.Insert( aSave, rArr.Count());
+ pFmt->DelFrms();
+ rFmts.Remove( n--, 1 );
+ }
+ }
+}
+
+void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
+ _SaveFlyArr& rArr, bool bMoveAllFlys )
+{
+ SwSpzFrmFmts& rFmts = *rPam.GetPoint()->nNode.GetNode().GetDoc()->GetSpzFrmFmts();
+ SwFrmFmt* pFmt;
+ const SwFmtAnchor* pAnchor;
+
+ const SwPosition* pPos = rPam.Start();
+ const SwNodeIndex& rSttNdIdx = pPos->nNode;
+ short nSttOff = (!bMoveAllFlys && rSttNdIdx.GetNode().IsCntntNode() &&
+ pPos->nContent.GetIndex()) ? 1 : 0;
+
+ pPos = rPam.GetPoint() == pPos ? rPam.GetMark() : rPam.GetPoint();
+ const SwNodeIndex& rEndNdIdx = pPos->nNode;
+ short nOff = ( bMoveAllFlys || ( rEndNdIdx.GetNode().IsCntntNode() &&
+ pPos->nContent == rEndNdIdx.GetNode().GetCntntNode()->Len() ))
+ ? 0 : 1;
+
+ const SwNodeIndex* pCntntIdx;
+
+ for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+ {
+ sal_Bool bInsPos = sal_False;
+ pFmt = (SwFrmFmt*)rFmts[n];
+ pAnchor = &pFmt->GetAnchor();
+ const SwPosition* pAPos = pAnchor->GetCntntAnchor();
+ if (pAPos &&
+ ((FLY_AT_PARA == pAnchor->GetAnchorId()) ||
+ (FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
+ // nicht verschieben, wenn die InsPos im CntntBereich vom Fly ist
+ ( 0 == ( pCntntIdx = pFmt->GetCntnt().GetCntntIdx() ) ||
+ !( *pCntntIdx < rInsPos &&
+ rInsPos < pCntntIdx->GetNode().EndOfSectionIndex() )) )
+ {
+ if( !bMoveAllFlys && rEndNdIdx == pAPos->nNode )
+ {
+ // wenn nur teil vom EndNode oder der EndNode und SttNode
+ // identisch sind, chaos::Anchor nicht anfassen
+ if( rSttNdIdx != pAPos->nNode )
+ {
+ // Anker nur an Anfang/Ende haengen
+ SwPosition aPos( rSttNdIdx );
+ SwFmtAnchor aAnchor( *pAnchor );
+ aAnchor.SetAnchor( &aPos );
+ pFmt->SetFmtAttr( aAnchor );
+// ((SwFmtAnchor*)pAnchor)->SetAnchor( &aPos );
+ }
+ }
+ else if( ( rSttNdIdx.GetIndex() + nSttOff <= pAPos->nNode.GetIndex()
+ && pAPos->nNode.GetIndex() <= rEndNdIdx.GetIndex() - nOff ) ||
+ 0 != ( bInsPos = rInsPos == pAPos->nNode ))
+
+ {
+ _SaveFly aSave( pAPos->nNode.GetIndex() - rSttNdIdx.GetIndex(),
+ pFmt, bInsPos );
+ rArr.Insert( aSave, rArr.Count());
+ pFmt->DelFrms();
+ rFmts.Remove( n--, 1 );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------
+
+// loesche und verschiebe alle "Fly's am Absatz", die in der SSelection
+// liegen. Steht am SPoint ein Fly, wird dieser auf den Mark verschoben.
+
+void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
+ const SwNodeIndex& rPtNdIdx )
+{
+ const sal_Bool bDelFwrd = rMkNdIdx.GetIndex() <= rPtNdIdx.GetIndex();
+
+ SwDoc* pDoc = rMkNdIdx.GetNode().GetDoc();
+ SwSpzFrmFmts& rTbl = *pDoc->GetSpzFrmFmts();
+ for ( sal_uInt16 i = rTbl.Count(); i; )
+ {
+ SwFrmFmt *pFmt = rTbl[--i];
+ const SwFmtAnchor &rAnch = pFmt->GetAnchor();
+ SwPosition const*const pAPos = rAnch.GetCntntAnchor();
+ if (pAPos &&
+ ((rAnch.GetAnchorId() == FLY_AT_PARA) ||
+ (rAnch.GetAnchorId() == FLY_AT_CHAR)) &&
+ ( bDelFwrd
+ ? rMkNdIdx < pAPos->nNode && pAPos->nNode <= rPtNdIdx
+ : rPtNdIdx <= pAPos->nNode && pAPos->nNode < rMkNdIdx ))
+ {
+ // nur den Anker verschieben ??
+ if( rPtNdIdx == pAPos->nNode )
+ {
+ SwFmtAnchor aAnch( pFmt->GetAnchor() );
+ SwPosition aPos( rMkNdIdx );
+ aAnch.SetAnchor( &aPos );
+ pFmt->SetFmtAttr( aAnch );
+ }
+ else
+ {
+ // wird der Fly geloescht muss auch im seinem Inhalt alle
+ // Flys geloescht werden !!
+ const SwFmtCntnt &rCntnt = pFmt->GetCntnt();
+ if( rCntnt.GetCntntIdx() )
+ {
+ DelFlyInRange( *rCntnt.GetCntntIdx(),
+ SwNodeIndex( *rCntnt.GetCntntIdx()->
+ GetNode().EndOfSectionNode() ));
+ // Position kann sich verschoben haben !
+ if( i > rTbl.Count() )
+ i = rTbl.Count();
+ else if( pFmt != rTbl[i] )
+ i = rTbl.GetPos( pFmt );
+ }
+
+ pDoc->DelLayoutFmt( pFmt );
+
+ // --> FME 2004-10-06 #117913# DelLayoutFmt can also
+ // trigger the deletion of objects.
+ if( i > rTbl.Count() )
+ i = rTbl.Count();
+ // <--
+ }
+ }
+ }
+}
+
+
+bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
+ const SwNodeIndex& rInsPos,
+ SwFtnIdxs& rFtnArr, SwFtnIdxs& rSaveArr,
+ const SwIndex* pSttCnt = 0, const SwIndex* pEndCnt = 0 )
+{
+ bool bUpdateFtn = sal_False;
+ const SwNodes& rNds = rInsPos.GetNodes();
+ const bool bDelFtn = rInsPos.GetIndex() < rNds.GetEndOfAutotext().GetIndex() &&
+ rSttNd.GetIndex() >= rNds.GetEndOfAutotext().GetIndex();
+ const bool bSaveFtn = !bDelFtn &&
+ rInsPos.GetIndex() >= rNds.GetEndOfExtras().GetIndex();
+ if( rFtnArr.Count() )
+ {
+
+ sal_uInt16 nPos;
+ rFtnArr.SeekEntry( rSttNd, &nPos );
+ SwTxtFtn* pSrch;
+ const SwNode* pFtnNd;
+
+ // loesche/sicher erstmal alle, die dahinter stehen
+ while( nPos < rFtnArr.Count() && ( pFtnNd =
+ &( pSrch = rFtnArr[ nPos ] )->GetTxtNode())->GetIndex()
+ <= rEndNd.GetIndex() )
+ {
+ xub_StrLen nFtnSttIdx = *pSrch->GetStart();
+ if( ( pEndCnt && pSttCnt )
+ ? (( &rSttNd.GetNode() == pFtnNd &&
+ pSttCnt->GetIndex() > nFtnSttIdx) ||
+ ( &rEndNd.GetNode() == pFtnNd &&
+ nFtnSttIdx >= pEndCnt->GetIndex() ))
+ : ( &rEndNd.GetNode() == pFtnNd ))
+ {
+ ++nPos; // weiter suchen
+ }
+ else
+ {
+ // dann weg damit
+ if( bDelFtn )
+ {
+ SwTxtNode& rTxtNd = (SwTxtNode&)pSrch->GetTxtNode();
+ SwIndex aIdx( &rTxtNd, nFtnSttIdx );
+ rTxtNd.EraseText( aIdx, 1 );
+ }
+ else
+ {
+ pSrch->DelFrms(0);
+ rFtnArr.Remove( nPos );
+ if( bSaveFtn )
+ rSaveArr.Insert( pSrch );
+ }
+ bUpdateFtn = sal_True;
+ }
+ }
+
+ while( nPos-- && ( pFtnNd = &( pSrch = rFtnArr[ nPos ] )->
+ GetTxtNode())->GetIndex() >= rSttNd.GetIndex() )
+ {
+ xub_StrLen nFtnSttIdx = *pSrch->GetStart();
+ if( !pEndCnt || !pSttCnt ||
+ !( (( &rSttNd.GetNode() == pFtnNd &&
+ pSttCnt->GetIndex() > nFtnSttIdx ) ||
+ ( &rEndNd.GetNode() == pFtnNd &&
+ nFtnSttIdx >= pEndCnt->GetIndex() )) ))
+ {
+ if( bDelFtn )
+ {
+ // dann weg damit
+ SwTxtNode& rTxtNd = (SwTxtNode&)pSrch->GetTxtNode();
+ SwIndex aIdx( &rTxtNd, nFtnSttIdx );
+ rTxtNd.EraseText( aIdx, 1 );
+ }
+ else
+ {
+ pSrch->DelFrms(0);
+ rFtnArr.Remove( nPos );
+ if( bSaveFtn )
+ rSaveArr.Insert( pSrch );
+ }
+ bUpdateFtn = sal_True;
+ }
+ }
+ }
+ // When moving from redline section into document content section, e.g.
+ // after loading a document with (delete-)redlines, the footnote array
+ // has to be adjusted... (#i70572)
+ if( bSaveFtn )
+ {
+ SwNodeIndex aIdx( rSttNd );
+ while( aIdx < rEndNd ) // Check the moved section
+ {
+ SwNode* pNode = &aIdx.GetNode();
+ if( pNode->IsTxtNode() ) // Looking for text nodes...
+ {
+ SwpHints *pHints =
+ static_cast<SwTxtNode*>(pNode)->GetpSwpHints();
+ if( pHints && pHints->HasFtn() ) //...with footnotes
+ {
+ bUpdateFtn = sal_True; // Heureka
+ sal_uInt16 nCount = pHints->Count();
+ for( sal_uInt16 i = 0; i < nCount; ++i )
+ {
+ SwTxtAttr *pAttr = pHints->GetTextHint( i );
+ if ( pAttr->Which() == RES_TXTATR_FTN )
+ {
+ rSaveArr.Insert( static_cast<SwTxtFtn*>(pAttr) );
+ }
+ }
+ }
+ }
+ ++aIdx;
+ }
+ }
+ return bUpdateFtn;
+}
+
+void lcl_SaveRedlines( const SwPaM& aPam, _SaveRedlines& rArr )
+{
+ SwDoc* pDoc = aPam.GetNode()->GetDoc();
+
+ const SwPosition* pStart = aPam.Start();
+ const SwPosition* pEnd = aPam.End();
+
+ // get first relevant redline
+ sal_uInt16 nCurrentRedline;
+ pDoc->GetRedline( *pStart, &nCurrentRedline );
+ if( nCurrentRedline > 0)
+ nCurrentRedline--;
+
+ // redline mode REDLINE_IGNORE|REDLINE_ON; save old mode
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+ pDoc->SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+
+ // iterate over relevant redlines and decide for each whether it should
+ // be saved, or split + saved
+ SwRedlineTbl& rRedlineTable = const_cast<SwRedlineTbl&>( pDoc->GetRedlineTbl() );
+ for( ; nCurrentRedline < rRedlineTable.Count(); nCurrentRedline++ )
+ {
+ SwRedline* pCurrent = rRedlineTable[ nCurrentRedline ];
+ SwComparePosition eCompare =
+ ComparePosition( *pCurrent->Start(), *pCurrent->End(),
+ *pStart, *pEnd);
+
+ // we must save this redline if it overlaps aPam
+ // (we may have to split it, too)
+ if( eCompare == POS_OVERLAP_BEHIND ||
+ eCompare == POS_OVERLAP_BEFORE ||
+ eCompare == POS_OUTSIDE ||
+ eCompare == POS_INSIDE ||
+ eCompare == POS_EQUAL )
+ {
+ rRedlineTable.Remove( nCurrentRedline-- );
+
+ // split beginning, if necessary
+ if( eCompare == POS_OVERLAP_BEFORE ||
+ eCompare == POS_OUTSIDE )
+ {
+
+ SwRedline* pNewRedline = new SwRedline( *pCurrent );
+ *pNewRedline->End() = *pStart;
+ *pCurrent->Start() = *pStart;
+ pDoc->AppendRedline( pNewRedline, true );
+ }
+
+ // split end, if necessary
+ if( eCompare == POS_OVERLAP_BEHIND ||
+ eCompare == POS_OUTSIDE )
+ {
+ SwRedline* pNewRedline = new SwRedline( *pCurrent );
+ *pNewRedline->Start() = *pEnd;
+ *pCurrent->End() = *pEnd;
+ pDoc->AppendRedline( pNewRedline, true );
+ }
+
+ // save the current redline
+ _SaveRedline* pSave = new _SaveRedline( pCurrent, *pStart );
+ rArr.C40_INSERT( _SaveRedline, pSave, rArr.Count() );
+ }
+ }
+
+ // restore old redline mode
+ pDoc->SetRedlineMode_intern( eOld );
+}
+
+void lcl_RestoreRedlines( SwDoc* pDoc, const SwPosition& rPos, _SaveRedlines& rArr )
+{
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+ pDoc->SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+
+ for( sal_uInt16 n = 0; n < rArr.Count(); ++n )
+ {
+ _SaveRedline* pSave = rArr[ n ];
+ pSave->SetPos( rPos );
+ pDoc->AppendRedline( pSave->pRedl, true );
+ }
+
+ pDoc->SetRedlineMode_intern( eOld );
+}
+
+
+void lcl_SaveRedlines( const SwNodeRange& rRg, _SaveRedlines& rArr )
+{
+ SwDoc* pDoc = rRg.aStart.GetNode().GetDoc();
+ sal_uInt16 nRedlPos;
+ SwPosition aSrchPos( rRg.aStart ); aSrchPos.nNode--;
+ aSrchPos.nContent.Assign( aSrchPos.nNode.GetNode().GetCntntNode(), 0 );
+ if( pDoc->GetRedline( aSrchPos, &nRedlPos ) && nRedlPos )
+ --nRedlPos;
+ else if( nRedlPos >= pDoc->GetRedlineTbl().Count() )
+ return ;
+
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+ pDoc->SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+ SwRedlineTbl& rRedlTbl = (SwRedlineTbl&)pDoc->GetRedlineTbl();
+
+ do {
+ SwRedline* pTmp = rRedlTbl[ nRedlPos ];
+
+ const SwPosition* pRStt = pTmp->Start(),
+ * pREnd = pTmp->GetMark() == pRStt
+ ? pTmp->GetPoint() : pTmp->GetMark();
+
+ if( pRStt->nNode < rRg.aStart )
+ {
+ if( pREnd->nNode > rRg.aStart && pREnd->nNode < rRg.aEnd )
+ {
+ // Kopie erzeugen und Ende vom Original ans Ende des
+ // MoveBereiches setzen. Die Kopie wird mit verschoben
+ SwRedline* pNewRedl = new SwRedline( *pTmp );
+ SwPosition* pTmpPos = pNewRedl->Start();
+ pTmpPos->nNode = rRg.aStart;
+ pTmpPos->nContent.Assign(
+ pTmpPos->nNode.GetNode().GetCntntNode(), 0 );
+
+ _SaveRedline* pSave = new _SaveRedline( pNewRedl, rRg.aStart );
+// rArr.Insert( pSave, rArr.Count() );
+ rArr.C40_INSERT( _SaveRedline, pSave, rArr.Count() );
+
+ pTmpPos = pTmp->End();
+ pTmpPos->nNode = rRg.aEnd;
+ pTmpPos->nContent.Assign(
+ pTmpPos->nNode.GetNode().GetCntntNode(), 0 );
+ }
+ else if( pREnd->nNode == rRg.aStart )
+ {
+ SwPosition* pTmpPos = pTmp->End();
+ pTmpPos->nNode = rRg.aEnd;
+ pTmpPos->nContent.Assign(
+ pTmpPos->nNode.GetNode().GetCntntNode(), 0 );
+ }
+ }
+ else if( pRStt->nNode < rRg.aEnd )
+ {
+ rRedlTbl.Remove( nRedlPos-- );
+ if( pREnd->nNode < rRg.aEnd ||
+ ( pREnd->nNode == rRg.aEnd && !pREnd->nContent.GetIndex()) )
+ {
+ // gesamt verschieben
+ _SaveRedline* pSave = new _SaveRedline( pTmp, rRg.aStart );
+// rArr.Insert( pSave, rArr.Count() );
+ rArr.C40_INSERT( _SaveRedline, pSave, rArr.Count() );
+ }
+ else
+ {
+ // aufsplitten
+ SwRedline* pNewRedl = new SwRedline( *pTmp );
+ SwPosition* pTmpPos = pNewRedl->End();
+ pTmpPos->nNode = rRg.aEnd;
+ pTmpPos->nContent.Assign(
+ pTmpPos->nNode.GetNode().GetCntntNode(), 0 );
+
+ _SaveRedline* pSave = new _SaveRedline( pNewRedl, rRg.aStart );
+// rArr.Insert( pSave, rArr.Count() );
+ rArr.C40_INSERT( _SaveRedline, pSave, rArr.Count() );
+
+ pTmpPos = pTmp->Start();
+ pTmpPos->nNode = rRg.aEnd;
+ pTmpPos->nContent.Assign(
+ pTmpPos->nNode.GetNode().GetCntntNode(), 0 );
+ pDoc->AppendRedline( pTmp, true );
+ }
+ }
+ else
+ break;
+
+ } while( ++nRedlPos < pDoc->GetRedlineTbl().Count() );
+ pDoc->SetRedlineMode_intern( eOld );
+}
+
+void lcl_RestoreRedlines( SwDoc* pDoc, sal_uInt32 nInsPos, _SaveRedlines& rArr )
+{
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+ pDoc->SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+
+ for( sal_uInt16 n = 0; n < rArr.Count(); ++n )
+ {
+ _SaveRedline* pSave = rArr[ n ];
+ pSave->SetPos( nInsPos );
+ pDoc->AppendRedline( pSave->pRedl, true );
+ }
+
+ pDoc->SetRedlineMode_intern( eOld );
+}
+
+// ------------------------------------------------------------------------
+// #i59534: Redo of insertion of multiple text nodes runs into trouble
+// because of unnecessary expanded redlines
+// From now on this class saves the redline positions of all redlines which ends exact at the
+// insert position (node _and_ content index)
+
+_SaveRedlEndPosForRestore::_SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx, xub_StrLen nCnt )
+ : pSavArr( 0 ), pSavIdx( 0 ), nSavCntnt( nCnt )
+{
+ SwNode& rNd = rInsIdx.GetNode();
+ SwDoc* pDest = rNd.GetDoc();
+ if( pDest->GetRedlineTbl().Count() )
+ {
+ sal_uInt16 nFndPos;
+ const SwPosition* pEnd;
+ SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetCntntNode(), nCnt ));
+ const SwRedline* pRedl = pDest->GetRedline( aSrcPos, &nFndPos );
+ while( nFndPos-- && *( pEnd = ( pRedl =
+ pDest->GetRedlineTbl()[ nFndPos ] )->End() ) == aSrcPos && *pRedl->Start() < aSrcPos )
+ {
+ if( !pSavArr )
+ {
+ pSavArr = new SvPtrarr( 2, 2 );
+ pSavIdx = new SwNodeIndex( rInsIdx, -1 );
+ }
+ void* p = (void*)pEnd;
+ pSavArr->Insert( p, pSavArr->Count() );
+ }
+ }
+}
+
+_SaveRedlEndPosForRestore::~_SaveRedlEndPosForRestore()
+{
+ if( pSavArr )
+ {
+ delete pSavArr;
+ delete pSavIdx;
+ }
+}
+
+void _SaveRedlEndPosForRestore::_Restore()
+{
+ (*pSavIdx)++;
+ SwCntntNode* pNode = pSavIdx->GetNode().GetCntntNode();
+ // If there's no content node at the remembered position, we will not restore the old position
+ // This may happen if a table (or section?) will be inserted.
+ if( pNode )
+ {
+ SwPosition aPos( *pSavIdx, SwIndex( pNode, nSavCntnt ));
+ for( sal_uInt16 n = pSavArr->Count(); n; )
+ *((SwPosition*)pSavArr->GetObject( --n )) = aPos;
+ }
+}
+
+
+// ------------------------------------------------------------------------
+
+// Loeschen einer vollstaendigen Section des NodesArray.
+// Der uebergebene Node steht irgendwo in der gewuenschten Section
+void SwDoc::DeleteSection( SwNode *pNode )
+{
+ ASSERT( pNode, "Kein Node uebergeben." );
+ SwStartNode* pSttNd = pNode->IsStartNode() ? (SwStartNode*)pNode
+ : pNode->StartOfSectionNode();
+ SwNodeIndex aSttIdx( *pSttNd ), aEndIdx( *pNode->EndOfSectionNode() );
+
+ // dann loesche mal alle Fly's, text::Bookmarks, ...
+ DelFlyInRange( aSttIdx, aEndIdx );
+ DeleteRedline( *pSttNd, true, USHRT_MAX );
+ _DelBookmarks(aSttIdx, aEndIdx);
+
+ {
+ // alle Crsr/StkCrsr/UnoCrsr aus dem Loeschbereich verschieben
+ SwNodeIndex aMvStt( aSttIdx, 1 );
+ CorrAbs( aMvStt, aEndIdx, SwPosition( aSttIdx ), sal_True );
+ }
+
+ GetNodes().DelNodes( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() + 1 );
+}
+
+
+void SwDoc::SetModified(SwPaM &rPaM)
+{
+ SwDataChanged aTmp( rPaM, 0 );
+ SetModified();
+}
+
+/*************************************************************************
+ * SwDoc::Overwrite()
+ ************************************************************************/
+
+bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
+{
+ SwPosition& rPt = *(SwPosition*)rRg.GetPoint();
+ if( pACEWord ) // Aufnahme in die Autokorrektur
+ {
+ if( 1 == rStr.Len() )
+ pACEWord->CheckChar( rPt, rStr.GetChar( 0 ) );
+ delete pACEWord, pACEWord = 0;
+ }
+
+ SwTxtNode *pNode = rPt.nNode.GetNode().GetTxtNode();
+ if(!pNode)
+ return sal_False;
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo(); // AppendUndo not always called
+ }
+
+ sal_uInt16 nOldAttrCnt = pNode->GetpSwpHints()
+ ? pNode->GetpSwpHints()->Count() : 0;
+ SwDataChanged aTmp( rRg, 0 );
+ SwIndex& rIdx = rPt.nContent;
+ xub_StrLen nStart = 0;
+
+ sal_Unicode c;
+ String aStr;
+
+ sal_Bool bOldExpFlg = pNode->IsIgnoreDontExpand();
+ pNode->SetIgnoreDontExpand( sal_True );
+
+ for( xub_StrLen nCnt = 0; nCnt < rStr.Len(); ++nCnt )
+ {
+ // hinter das Zeichen (zum aufspannen der Attribute !!)
+ nStart = rIdx.GetIndex();
+ if ( nStart < pNode->GetTxt().Len() )
+ {
+ lcl_SkipAttr( pNode, rIdx, nStart );
+ }
+ c = rStr.GetChar( nCnt );
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ bool bMerged(false);
+ if (GetIDocumentUndoRedo().DoesGroupUndo())
+ {
+ SwUndo *const pUndo = GetUndoManager().GetLastUndo();
+ SwUndoOverwrite *const pUndoOW(
+ dynamic_cast<SwUndoOverwrite *>(pUndo) );
+ if (pUndoOW)
+ {
+ // if CanGrouping() returns true it's already merged
+ bMerged = pUndoOW->CanGrouping( this, rPt, c );
+ }
+ }
+ if (!bMerged)
+ {
+ SwUndo *const pUndoOW( new SwUndoOverwrite(this, rPt, c) );
+ GetIDocumentUndoRedo().AppendUndo(pUndoOW);
+ }
+ }
+ else
+ {
+ // hinter das Zeichen (zum Aufspannen der Attribute !!)
+ if( nStart < pNode->GetTxt().Len() )
+ rIdx++;
+ pNode->InsertText( c, rIdx, INS_EMPTYEXPAND );
+ if( nStart+1 < rIdx.GetIndex() )
+ {
+ rIdx = nStart;
+ pNode->EraseText( rIdx, 1 );
+ rIdx++;
+ }
+ }
+ }
+ pNode->SetIgnoreDontExpand( bOldExpFlg );
+
+ sal_uInt16 nNewAttrCnt = pNode->GetpSwpHints()
+ ? pNode->GetpSwpHints()->Count() : 0;
+ if( nOldAttrCnt != nNewAttrCnt )
+ {
+ SwUpdateAttr aHint( 0, 0, 0 );
+ pNode->ModifyBroadcast( 0, &aHint, TYPE( SwCrsrShell ) );
+ }
+
+ if (!GetIDocumentUndoRedo().DoesUndo() &&
+ !IsIgnoreRedline() && GetRedlineTbl().Count())
+ {
+ SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() );
+ DeleteRedline( aPam, true, USHRT_MAX );
+ }
+ else if( IsRedlineOn() )
+ {
+ // FIXME: this redline is WRONG: there is no DELETE, and the skipped
+ // characters are also included in aPam
+ SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() );
+ AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ }
+
+ SetModified();
+ return sal_True;
+}
+
+
+bool SwDoc::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
+{
+ SwNodeIndex aIdx( rPaM.Start()->nNode );
+ sal_Bool bJoinTxt = aIdx.GetNode().IsTxtNode();
+ sal_Bool bOneNode = rPaM.GetPoint()->nNode == rPaM.GetMark()->nNode;
+ aIdx--; // vor den Move Bereich !!
+
+ bool bRet = MoveRange( rPaM, rPos, eMvFlags );
+ if( bRet && !bOneNode )
+ {
+ if( bJoinTxt )
+ aIdx++;
+ SwTxtNode * pTxtNd = aIdx.GetNode().GetTxtNode();
+ SwNodeIndex aNxtIdx( aIdx );
+ if( pTxtNd && pTxtNd->CanJoinNext( &aNxtIdx ) )
+ {
+ { // Block wegen SwIndex in den Node !!
+ CorrRel( aNxtIdx, SwPosition( aIdx, SwIndex( pTxtNd,
+ pTxtNd->GetTxt().Len() ) ), 0, sal_True );
+ }
+ pTxtNd->JoinNext();
+ }
+ }
+ return bRet;
+}
+
+// mst: it seems that this is mostly used by SwDoc internals; the only
+// way to call this from the outside seems to be the special case in
+// SwDoc::CopyRange (but i have not managed to actually hit that case)
+bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
+{
+ // keine Moves-Abfangen
+ const SwPosition *pStt = rPaM.Start(), *pEnd = rPaM.End();
+ if( !rPaM.HasMark() || *pStt >= *pEnd || (*pStt <= rPos && rPos < *pEnd))
+ return false;
+
+ // sicher die absatzgebundenen Flys, damit sie verschoben werden koennen.
+ _SaveFlyArr aSaveFlyArr;
+ _SaveFlyInRange( rPaM, rPos.nNode, aSaveFlyArr, 0 != ( DOC_MOVEALLFLYS & eMvFlags ) );
+
+ // save redlines (if DOC_MOVEREDLINES is used)
+ _SaveRedlines aSaveRedl( 0, 4 );
+ if( DOC_MOVEREDLINES & eMvFlags && GetRedlineTbl().Count() )
+ {
+ lcl_SaveRedlines( rPaM, aSaveRedl );
+
+ // #i17764# unfortunately, code below relies on undos being
+ // in a particular order, and presence of bookmarks
+ // will change this order. Hence, we delete bookmarks
+ // here without undo.
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+ _DelBookmarks(
+ pStt->nNode,
+ pEnd->nNode,
+ NULL,
+ &pStt->nContent,
+ &pEnd->nContent);
+ }
+
+
+ int bUpdateFtn = sal_False;
+ SwFtnIdxs aTmpFntIdx;
+
+ // falls Undo eingeschaltet, erzeuge das UndoMove-Objekt
+ SwUndoMove * pUndoMove = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ pUndoMove = new SwUndoMove( rPaM, rPos );
+ pUndoMove->SetMoveRedlines( eMvFlags == DOC_MOVEREDLINES );
+ }
+ else
+ {
+ bUpdateFtn = lcl_SaveFtn( pStt->nNode, pEnd->nNode, rPos.nNode,
+ GetFtnIdxs(), aTmpFntIdx,
+ &pStt->nContent, &pEnd->nContent );
+ }
+
+ sal_Bool bSplit = sal_False;
+ SwPaM aSavePam( rPos, rPos );
+
+ // stelle den SPoint an den Anfang vom Bereich (Definition)
+ if( rPaM.GetPoint() == pEnd )
+ rPaM.Exchange();
+
+ // in der EditShell wird nach dem Move ein JoinNext erzeugt, wenn
+ // vor und nach dem Move ein Text-Node steht.
+ SwTxtNode* pSrcNd = rPaM.GetPoint()->nNode.GetNode().GetTxtNode();
+ sal_Bool bCorrSavePam = pSrcNd && pStt->nNode != pEnd->nNode;
+
+ // werden ein oder mehr TextNodes bewegt, so wird
+ // im SwNodes::Move ein SplitNode erzeugt. Dieser Updated aber nicht
+ // den Cursor. Um das zu verhindern, wird hier ein TextNode angelegt,
+ // um die Updaterei der Indizies zu erhalten. Nach dem Move wird
+ // evt. der Node geloescht.
+
+ SwTxtNode * pTNd = rPos.nNode.GetNode().GetTxtNode();
+ if( pTNd && rPaM.GetPoint()->nNode != rPaM.GetMark()->nNode &&
+ ( rPos.nContent.GetIndex() || ( pTNd->Len() && bCorrSavePam )) )
+ {
+ bSplit = sal_True;
+ xub_StrLen nMkCntnt = rPaM.GetMark()->nContent.GetIndex();
+
+ SvULongs aBkmkArr( 15, 15 );
+ _SaveCntntIdx( this, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(),
+ aBkmkArr, SAVEFLY_SPLIT );
+
+ pTNd = static_cast<SwTxtNode*>(pTNd->SplitCntntNode( rPos ));
+
+ if( aBkmkArr.Count() )
+ _RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True );
+
+ // jetzt noch den Pam berichtigen !!
+ if( rPos.nNode == rPaM.GetMark()->nNode )
+ {
+ rPaM.GetMark()->nNode = rPos.nNode.GetIndex()-1;
+ rPaM.GetMark()->nContent.Assign( pTNd, nMkCntnt );
+ }
+ }
+
+ // setze den Pam um einen "Inhalt" zurueck; dadurch steht er immer
+ // ausserhalb des manipulierten Bereiches. Falls kein Inhalt mehr vor-
+ // handen, dann auf den StartNode (es ist immer einer vorhanden !!!)
+ sal_Bool bNullCntnt = !aSavePam.Move( fnMoveBackward, fnGoCntnt );
+ if( bNullCntnt )
+ {
+ aSavePam.GetPoint()->nNode--;
+ }
+
+ // kopiere alle Bookmarks, die im Move Bereich stehen in ein
+ // Array, das alle Angaben auf die Position als Offset speichert.
+ // Die neue Zuordung erfolgt nach dem Moven.
+ ::std::vector< ::sw::mark::SaveBookmark> aSaveBkmks;
+ _DelBookmarks(
+ pStt->nNode,
+ pEnd->nNode,
+ &aSaveBkmks,
+ &pStt->nContent,
+ &pEnd->nContent);
+
+ // falls durch die vorherigen Loeschungen (z.B. der Fussnoten) kein
+ // Bereich mehr existiert, ist das immernoch ein gueltiger Move!
+ if( *rPaM.GetPoint() != *rPaM.GetMark() )
+ {
+ // now do the actual move
+ GetNodes().MoveRange( rPaM, rPos, GetNodes() );
+
+ // after a MoveRange() the Mark is deleted
+ if ( rPaM.HasMark() ) // => no Move occurred!
+ {
+ delete pUndoMove;
+ return false;
+ }
+ }
+ else
+ rPaM.DeleteMark();
+
+ ASSERT( *aSavePam.GetMark() == rPos ||
+ ( aSavePam.GetMark()->nNode.GetNode().GetCntntNode() == NULL ),
+ "PaM wurde nicht verschoben, am Anfang/Ende keine ContentNodes?" );
+ *aSavePam.GetMark() = rPos;
+
+ rPaM.SetMark(); // um den neuen Bereich eine Sel. aufspannen
+ pTNd = aSavePam.GetNode()->GetTxtNode();
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // korrigiere erstmal den Content vom SavePam
+ if( bNullCntnt )
+ {
+ aSavePam.GetPoint()->nContent = 0;
+ }
+
+ // die Methode SwEditShell::Move() fuegt nach dem Move den Text-Node
+ // zusammen, in dem der rPaM steht. Wurde der Inhalt nach hinten
+ // geschoben und liegt der SPoint vom SavePam im naechsten Node, so
+ // muss beim Speichern vom Undo-Object das beachtet werden !!
+ SwTxtNode * pPamTxtNd = 0;
+
+ // wird ans SwUndoMove weitergegeben, das dann beim Undo JoinNext
+ // aufruft. (falls es hier nicht moeglich ist).
+ sal_Bool bJoin = bSplit && pTNd;
+ bCorrSavePam = bCorrSavePam &&
+ 0 != ( pPamTxtNd = rPaM.GetNode()->GetTxtNode() )
+ && pPamTxtNd->CanJoinNext()
+ && (*rPaM.GetPoint() <= *aSavePam.GetPoint());
+
+ // muessen am SavePam 2 Nodes zusammengefasst werden ??
+ if( bJoin && pTNd->CanJoinNext() )
+ {
+ pTNd->JoinNext();
+ // kein temp. sdbcx::Index bei &&
+ // es sollten wohl nur die Indexwerte verglichen werden.
+ if( bCorrSavePam && rPaM.GetPoint()->nNode.GetIndex()+1 ==
+ aSavePam.GetPoint()->nNode.GetIndex() )
+ {
+ aSavePam.GetPoint()->nContent += pPamTxtNd->Len();
+ }
+ bJoin = sal_False;
+ }
+// else if( !bCorrSavePam && !pSavePam->Move( fnMoveForward, fnGoCntnt ))
+ else if ( !aSavePam.Move( fnMoveForward, fnGoCntnt ) )
+ {
+ aSavePam.GetPoint()->nNode++;
+ }
+
+ // zwischen SPoint und GetMark steht jetzt der neu eingefuegte Bereich
+ pUndoMove->SetDestRange( aSavePam, *rPaM.GetPoint(),
+ bJoin, bCorrSavePam );
+ GetIDocumentUndoRedo().AppendUndo( pUndoMove );
+ }
+ else
+ {
+ bool bRemove = true;
+ // muessen am SavePam 2 Nodes zusammengefasst werden ??
+ if( bSplit && pTNd )
+ {
+ if( pTNd->CanJoinNext())
+ {
+ // --> 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;
+ }
+ }
+ if( bNullCntnt )
+ {
+ aSavePam.GetPoint()->nNode++;
+ aSavePam.GetPoint()->nContent.Assign( aSavePam.GetCntntNode(), 0 );
+ }
+ else if( bRemove ) // No move forward after joining with next paragraph
+ {
+ aSavePam.Move( fnMoveForward, fnGoCntnt );
+ }
+ }
+
+ // setze jetzt wieder die text::Bookmarks in das Dokument
+ *rPaM.GetMark() = *aSavePam.Start();
+ for(
+ ::std::vector< ::sw::mark::SaveBookmark>::iterator pBkmk = aSaveBkmks.begin();
+ pBkmk != aSaveBkmks.end();
+ ++pBkmk)
+ pBkmk->SetInDoc(
+ this,
+ rPaM.GetMark()->nNode,
+ &rPaM.GetMark()->nContent);
+ *rPaM.GetPoint() = *aSavePam.End();
+
+ // verschiebe die Flys an die neue Position
+ _RestFlyInRange( aSaveFlyArr, rPaM.Start()->nNode, &(rPos.nNode) );
+
+ // restore redlines (if DOC_MOVEREDLINES is used)
+ if( aSaveRedl.Count() )
+ {
+ lcl_RestoreRedlines( this, *aSavePam.Start(), aSaveRedl );
+ }
+
+ if( bUpdateFtn )
+ {
+ if( aTmpFntIdx.Count() )
+ {
+ GetFtnIdxs().Insert( &aTmpFntIdx );
+ aTmpFntIdx.Remove( sal_uInt16( 0 ), aTmpFntIdx.Count() );
+ }
+
+ GetFtnIdxs().UpdateAllFtn();
+ }
+
+ SetModified();
+ return true;
+}
+
+bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
+ SwMoveFlags eMvFlags )
+{
+ // bewegt alle Nodes an die neue Position. Dabei werden die
+ // text::Bookmarks mit verschoben !! (zur Zeit ohne Undo)
+
+ // falls durchs Move Fussnoten in den Sonderbereich kommen sollten,
+ // dann entferne sie jetzt.
+ //JP 13.07.95:
+ // ansonsten bei allen Fussnoten, die verschoben werden, die Frames
+ // loeschen und nach dem Move wieder aufbauen lassen (Fussnoten koennen
+ // die Seite wechseln). Zusaetzlich muss natuerlich die Sortierung
+ // der FtnIdx-Array wieder korrigiert werden.
+
+ int bUpdateFtn = sal_False;
+ SwFtnIdxs aTmpFntIdx;
+
+ SwUndoMove* pUndo = 0;
+ if ((DOC_CREATEUNDOOBJ & eMvFlags ) && GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoMove( this, rRange, rPos );
+ }
+ else
+ {
+ bUpdateFtn = lcl_SaveFtn( rRange.aStart, rRange.aEnd, rPos,
+ GetFtnIdxs(), aTmpFntIdx );
+ }
+
+ _SaveRedlines aSaveRedl( 0, 4 );
+ SvPtrarr aSavRedlInsPosArr( 0, 4 );
+ if( DOC_MOVEREDLINES & eMvFlags && GetRedlineTbl().Count() )
+ {
+ lcl_SaveRedlines( rRange, aSaveRedl );
+
+ // suche alle Redlines, die an der InsPos aufhoeren. Diese muessen
+ // nach dem Move wieder an die "alte" Position verschoben werden
+ sal_uInt16 nRedlPos = GetRedlinePos( rPos.GetNode(), USHRT_MAX );
+ if( USHRT_MAX != nRedlPos )
+ {
+ const SwPosition *pRStt, *pREnd;
+ do {
+ SwRedline* pTmp = GetRedlineTbl()[ nRedlPos ];
+ pRStt = pTmp->Start();
+ pREnd = pTmp->End();
+ if( pREnd->nNode == rPos && pRStt->nNode < rPos )
+ {
+ void* p = pTmp;
+ aSavRedlInsPosArr.Insert( p, aSavRedlInsPosArr.Count() );
+ }
+ } while( pRStt->nNode < rPos && ++nRedlPos < GetRedlineTbl().Count());
+ }
+ }
+
+ // kopiere alle Bookmarks, die im Move Bereich stehen in ein
+ // Array, das alle Angaben auf die Position als Offset speichert.
+ // Die neue Zuordung erfolgt nach dem Moven.
+ ::std::vector< ::sw::mark::SaveBookmark> aSaveBkmks;
+ _DelBookmarks(rRange.aStart, rRange.aEnd, &aSaveBkmks);
+
+ // sicher die absatzgebundenen Flys, damit verschoben werden koennen.
+ _SaveFlyArr aSaveFlyArr;
+ if( GetSpzFrmFmts()->Count() )
+ _SaveFlyInRange( rRange, aSaveFlyArr );
+
+ // vor die Position setzen, damit er nicht weitergeschoben wird
+ SwNodeIndex aIdx( rPos, -1 );
+
+ SwNodeIndex* pSaveInsPos = 0;
+ if( pUndo )
+ pSaveInsPos = new SwNodeIndex( rRange.aStart, -1 );
+
+ // verschiebe die Nodes
+ sal_Bool bNoDelFrms = 0 != (DOC_NO_DELFRMS & eMvFlags);
+ if( GetNodes()._MoveNodes( rRange, GetNodes(), rPos, !bNoDelFrms ) )
+ {
+ aIdx++; // wieder auf alte Position
+ if( pSaveInsPos )
+ (*pSaveInsPos)++;
+ }
+ else
+ {
+ aIdx = rRange.aStart;
+ delete pUndo, pUndo = 0;
+ }
+
+ // verschiebe die Flys an die neue Position
+ if( aSaveFlyArr.Count() )
+ _RestFlyInRange( aSaveFlyArr, aIdx, NULL );
+
+ // setze jetzt wieder die text::Bookmarks in das Dokument
+ for(
+ ::std::vector< ::sw::mark::SaveBookmark>::iterator pBkmk = aSaveBkmks.begin();
+ pBkmk != aSaveBkmks.end();
+ ++pBkmk)
+ pBkmk->SetInDoc(this, aIdx);
+
+ if( aSavRedlInsPosArr.Count() )
+ {
+ SwNode* pNewNd = &aIdx.GetNode();
+ for( sal_uInt16 n = 0; n < aSavRedlInsPosArr.Count(); ++n )
+ {
+ SwRedline* pTmp = (SwRedline*)aSavRedlInsPosArr[ n ];
+ if( USHRT_MAX != GetRedlineTbl().GetPos( pTmp ) )
+ {
+ SwPosition* pEnd = pTmp->End();
+ pEnd->nNode = aIdx;
+ pEnd->nContent.Assign( pNewNd->GetCntntNode(), 0 );
+ }
+ }
+ }
+
+ if( aSaveRedl.Count() )
+ lcl_RestoreRedlines( this, aIdx.GetIndex(), aSaveRedl );
+
+ if( pUndo )
+ {
+ pUndo->SetDestRange( aIdx, rPos, *pSaveInsPos );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ if( pSaveInsPos )
+ delete pSaveInsPos;
+
+ if( bUpdateFtn )
+ {
+ if( aTmpFntIdx.Count() )
+ {
+ GetFtnIdxs().Insert( &aTmpFntIdx );
+ aTmpFntIdx.Remove( sal_uInt16( 0 ), aTmpFntIdx.Count() );
+ }
+
+ GetFtnIdxs().UpdateAllFtn();
+ }
+
+ SetModified();
+ return sal_True;
+}
+
+/* #107318# Convert list of ranges of whichIds to a corresponding list
+ of whichIds*/
+SvUShorts * lcl_RangesToUShorts(sal_uInt16 * pRanges)
+{
+ SvUShorts * pResult = new SvUShorts();
+
+ int i = 0;
+ while (pRanges[i] != 0)
+ {
+ ASSERT(pRanges[i+1] != 0, "malformed ranges");
+
+ for (sal_uInt16 j = pRanges[i]; j < pRanges[i+1]; j++)
+ pResult->Insert(j, pResult->Count());
+
+ i += 2;
+ }
+
+ return pResult;
+}
+
+bool lcl_StrLenOverFlow( const SwPaM& rPam )
+{
+ // If we try to merge two paragraph we have to test if afterwards
+ // the string doesn't exceed the allowed string length
+ bool bRet = false;
+ if( rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
+ {
+ const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
+ const SwTxtNode* pEndNd = pEnd->nNode.GetNode().GetTxtNode();
+ if( (0 != pEndNd) && pStt->nNode.GetNode().IsTxtNode() )
+ {
+ sal_uInt64 nSum = pStt->nContent.GetIndex() +
+ pEndNd->GetTxt().Len() - pEnd->nContent.GetIndex();
+ if( nSum > STRING_LEN )
+ bRet = true;
+ }
+ }
+ return bRet;
+}
+
+void lcl_GetJoinFlags( SwPaM& rPam, sal_Bool& rJoinTxt, sal_Bool& rJoinPrev )
+{
+ rJoinTxt = sal_False;
+ rJoinPrev = sal_False;
+ if( rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
+ {
+ const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
+ SwTxtNode *pSttNd = pStt->nNode.GetNode().GetTxtNode();
+ if( pSttNd )
+ {
+ SwTxtNode *pEndNd = pEnd->nNode.GetNode().GetTxtNode();
+ rJoinTxt = 0 != pEndNd;
+ if( rJoinTxt )
+ {
+ bool bExchange = pStt == rPam.GetPoint();
+ if( !pStt->nContent.GetIndex() &&
+ pEndNd->GetTxt().Len() != pEnd->nContent.GetIndex() )
+ bExchange = !bExchange;
+ if( bExchange )
+ rPam.Exchange();
+ 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");
+ }
+ }
+ }
+}
+
+void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
+{
+ SwNodeIndex aIdx( rPam.GetPoint()->nNode );
+ SwTxtNode *pTxtNd = aIdx.GetNode().GetTxtNode();
+ SwNodeIndex aOldIdx( aIdx );
+ SwTxtNode *pOldTxtNd = pTxtNd;
+
+ if( pTxtNd && pTxtNd->CanJoinNext( &aIdx ) )
+ {
+ 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 !!
+ // (das loeschen vom Node geht auch am Undo vorbei !!!)
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+
+ /* PageBreaks, PageDesc, ColumnBreaks */
+ // Sollte an der Logik zum Kopieren der PageBreak's ...
+ // etwas geaendert werden, muss es auch im SwUndoDelete
+ // geandert werden. Dort wird sich das AUTO-PageBreak
+ // aus dem GetMarkNode kopiert.!!!
+
+ /* Der GetMarkNode */
+ if( ( pTxtNd = aIdx.GetNode().GetTxtNode())->HasSwAttrSet() )
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pTxtNd->GetpSwAttrSet()->GetItemState(
+ RES_BREAK, sal_False, &pItem ) )
+ pTxtNd->ResetAttr( RES_BREAK );
+ if( pTxtNd->HasSwAttrSet() &&
+ SFX_ITEM_SET == pTxtNd->GetpSwAttrSet()->GetItemState(
+ RES_PAGEDESC, sal_False, &pItem ) )
+ pTxtNd->ResetAttr( RES_PAGEDESC );
+ }
+
+ /* Der PointNode */
+ if( pOldTxtNd->HasSwAttrSet() )
+ {
+ const SfxPoolItem* pItem;
+ SfxItemSet aSet( pDoc->GetAttrPool(), aBreakSetRange );
+ const SfxItemSet* pSet = pOldTxtNd->GetpSwAttrSet();
+ if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK,
+ sal_False, &pItem ) )
+ aSet.Put( *pItem );
+ if( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC,
+ sal_False, &pItem ) )
+ aSet.Put( *pItem );
+ if( aSet.Count() )
+ pTxtNd->SetAttr( aSet );
+ }
+ pOldTxtNd->FmtToTxtAttr( pTxtNd );
+
+ SvULongs aBkmkArr( 15, 15 );
+ ::_SaveCntntIdx( pDoc, aOldIdx.GetIndex(),
+ pOldTxtNd->Len(), aBkmkArr );
+
+ SwIndex aAlphaIdx(pTxtNd);
+ pOldTxtNd->CutText( pTxtNd, aAlphaIdx, SwIndex(pOldTxtNd),
+ pOldTxtNd->Len() );
+ SwPosition aAlphaPos( aIdx, aAlphaIdx );
+ pDoc->CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, sal_True );
+
+ // verschiebe noch alle Bookmarks/TOXMarks
+ if( aBkmkArr.Count() )
+ ::_RestoreCntntIdx( pDoc, aBkmkArr, aIdx.GetIndex() );
+
+ // falls der uebergebene PaM nicht im Crsr-Ring steht,
+ // gesondert behandeln (z.B. Aufruf aus dem Auto-Format)
+ if( pOldTxtNd == rPam.GetBound( sal_True ).nContent.GetIdxReg() )
+ rPam.GetBound( sal_True ) = aAlphaPos;
+ if( pOldTxtNd == rPam.GetBound( sal_False ).nContent.GetIdxReg() )
+ rPam.GetBound( sal_False ) = aAlphaPos;
+ }
+ // jetzt nur noch den Node loeschen
+ pDoc->GetNodes().Delete( aOldIdx, 1 );
+ }
+ else
+ {
+ SwTxtNode* pDelNd = aIdx.GetNode().GetTxtNode();
+ if( pTxtNd->Len() )
+ pDelNd->FmtToTxtAttr( pTxtNd );
+ else
+ {
+ /* #107318# This case was missed:
+
+ <something></something> <-- pTxtNd
+ <other>ccc</other> <-- pDelNd
+
+ <something> and <other> are paragraph
+ attributes. The attribute <something> stayed if not
+ overwritten by an attribute in "ccc". Fixed by
+ first resetting all character attributes in first
+ paragraph (pTxtNd).
+ */
+ SvUShorts * pShorts =
+ lcl_RangesToUShorts(aCharFmtSetRange);
+ pTxtNd->ResetAttr(*pShorts);
+ delete pShorts;
+
+ if( pDelNd->HasSwAttrSet() )
+ {
+ // nur die Zeichenattribute kopieren
+ SfxItemSet aTmpSet( pDoc->GetAttrPool(), aCharFmtSetRange );
+ aTmpSet.Put( *pDelNd->GetpSwAttrSet() );
+ pTxtNd->SetAttr( aTmpSet );
+ }
+ }
+
+ 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();
+ }
+ }
+}
+
+static void
+lcl_CalcBreaks( ::std::vector<xub_StrLen> & rBreaks, SwPaM const & rPam )
+{
+ SwTxtNode const * const pTxtNode(
+ rPam.End()->nNode.GetNode().GetTxtNode() );
+ if (!pTxtNode)
+ return; // left-overlap only possible at end of selection...
+
+ const xub_StrLen nStart(rPam.Start()->nContent.GetIndex());
+ const xub_StrLen nEnd (rPam.End ()->nContent.GetIndex());
+ if (nEnd == pTxtNode->Len())
+ return; // paragraph selected until the end
+
+ for (xub_StrLen i = nStart; i < nEnd; ++i)
+ {
+ const sal_Unicode c(pTxtNode->GetTxt().GetChar(i));
+ if ((CH_TXTATR_INWORD == c) || (CH_TXTATR_BREAKWORD == c))
+ {
+ SwTxtAttr const * const pAttr( pTxtNode->GetTxtAttrForCharAt(i) );
+ if (pAttr && pAttr->GetEnd() && (*pAttr->GetEnd() > nEnd))
+ {
+ ASSERT(pAttr->HasDummyChar(), "GetTxtAttrForCharAt broken?");
+ rBreaks.push_back(i);
+ }
+ }
+ }
+}
+
+bool lcl_DoWithBreaks(SwDoc & rDoc, SwPaM & rPam,
+ bool (SwDoc::*pFunc)(SwPaM&, bool), const bool bForceJoinNext = false)
+{
+ ::std::vector<xub_StrLen> Breaks;
+
+ lcl_CalcBreaks(Breaks, rPam);
+
+ if (!Breaks.size())
+ {
+ return (rDoc.*pFunc)(rPam, bForceJoinNext);
+ }
+
+ // N.B.: deletion must be split into several parts if the text node
+ // contains a text attribute with end and with dummy character
+ // and the selection does not contain the text attribute completely,
+ // but overlaps its start (left), where the dummy character is.
+
+ SwPosition const & rSelectionEnd( *rPam.End() );
+
+ bool bRet( true );
+ // iterate from end to start, to avoid invalidating the offsets!
+ ::std::vector<xub_StrLen>::reverse_iterator iter( Breaks.rbegin() );
+ SwPaM aPam( rSelectionEnd, rSelectionEnd ); // end node!
+ SwPosition & rEnd( *aPam.End() );
+ SwPosition & rStart( *aPam.Start() );
+
+ while (iter != Breaks.rend())
+ {
+ rStart.nContent = *iter + 1;
+ if (rEnd.nContent > rStart.nContent) // check if part is empty
+ {
+ bRet &= (rDoc.*pFunc)(aPam, bForceJoinNext);
+ }
+ rEnd.nContent = *iter;
+ ++iter;
+ }
+
+ rStart = *rPam.Start(); // set to original start
+ if (rEnd.nContent > rStart.nContent) // check if part is empty
+ {
+ bRet &= (rDoc.*pFunc)(aPam, bForceJoinNext);
+ }
+
+ return bRet;
+}
+
+
+bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool )
+{
+ ASSERT( IsRedlineOn(), "DeleteAndJoinWithRedline: redline off" );
+
+ {
+ SwUndoRedlineDelete* pUndo = 0;
+ RedlineMode_t eOld = GetRedlineMode();
+ checkRedlining(eOld);
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+
+ //JP 06.01.98: MUSS noch optimiert werden!!!
+ SetRedlineMode(
+ (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ));
+
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+ pUndo = new SwUndoRedlineDelete( rPam, UNDO_DELETE );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ if( *rPam.GetPoint() != *rPam.GetMark() )
+ AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, rPam ), true);
+ SetModified();
+
+ if( pUndo )
+ {
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+ // ??? why the hell is the AppendUndo not below the
+ // CanGrouping, so this hideous cleanup wouldn't be necessary?
+ // bah, this is redlining, probably changing this would break it...
+ if (GetIDocumentUndoRedo().DoesGroupUndo())
+ {
+ SwUndo *const pLastUndo( GetUndoManager().GetLastUndo() );
+ SwUndoRedlineDelete *const pUndoRedlineDel(
+ dynamic_cast<SwUndoRedlineDelete*>(pLastUndo) );
+ if (pUndoRedlineDel)
+ {
+ bool const bMerged = pUndoRedlineDel->CanGrouping(*pUndo);
+ if (bMerged)
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+ SwUndo const*const pDeleted =
+ GetUndoManager().RemoveLastUndo();
+ OSL_ENSURE(pDeleted == pUndo,
+ "DeleteAndJoinWithRedlineImpl: "
+ "undo removed is not undo inserted?");
+ delete pDeleted;
+ }
+ }
+ }
+//JP 06.01.98: MUSS noch optimiert werden!!!
+SetRedlineMode( eOld );
+ }
+ return true;
+ }
+}
+
+bool SwDoc::DeleteAndJoinImpl( SwPaM & rPam,
+ const bool bForceJoinNext )
+{
+ sal_Bool bJoinTxt, bJoinPrev;
+ lcl_GetJoinFlags( rPam, bJoinTxt, bJoinPrev );
+ // --> OD 2009-08-20 #i100466#
+ if ( bForceJoinNext )
+ {
+ bJoinPrev = sal_False;
+ }
+ // <--
+ {
+ bool const bSuccess( DeleteRangeImpl( rPam ) );
+ if (!bSuccess)
+ return false;
+ }
+
+ if( bJoinTxt )
+ {
+ lcl_JoinText( rPam, bJoinPrev );
+ }
+
+ return true;
+}
+
+bool SwDoc::DeleteRangeImpl(SwPaM & rPam, const bool)
+{
+ // move all cursors out of the deleted range.
+ // but first copy the given PaM, because it could be a cursor that
+ // would be moved!
+ SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() );
+ ::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() );
+
+ bool const bSuccess( DeleteRangeImplImpl( aDelPam ) );
+ if (bSuccess)
+ { // now copy position from temp copy to given PaM
+ *rPam.GetPoint() = *aDelPam.GetPoint();
+ }
+
+ return bSuccess;
+}
+
+bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
+{
+ SwPosition *pStt = (SwPosition*)rPam.Start(), *pEnd = (SwPosition*)rPam.End();
+
+ if( !rPam.HasMark() || *pStt >= *pEnd )
+ return false;
+
+ if( pACEWord )
+ {
+ // ggfs. das gesicherte Word fuer die Ausnahme
+ if( pACEWord->IsDeleted() || pStt->nNode != pEnd->nNode ||
+ pStt->nContent.GetIndex() + 1 != pEnd->nContent.GetIndex() ||
+ !pACEWord->CheckDelChar( *pStt ))
+ delete pACEWord, pACEWord = 0;
+ }
+
+ {
+ // loesche alle leeren TextHints an der Mark-Position
+ SwTxtNode* pTxtNd = rPam.GetMark()->nNode.GetNode().GetTxtNode();
+ SwpHints* pHts;
+ if( pTxtNd && 0 != ( pHts = pTxtNd->GetpSwpHints()) && pHts->Count() )
+ {
+ const xub_StrLen *pEndIdx;
+ xub_StrLen nMkCntPos = rPam.GetMark()->nContent.GetIndex();
+ for( sal_uInt16 n = pHts->Count(); n; )
+ {
+ const SwTxtAttr* pAttr = (*pHts)[ --n ];
+ if( nMkCntPos > *pAttr->GetStart() )
+ break;
+
+ if( nMkCntPos == *pAttr->GetStart() &&
+ 0 != (pEndIdx = pAttr->GetEnd()) &&
+ *pEndIdx == *pAttr->GetStart() )
+ pTxtNd->DestroyAttr( pHts->Cut( n ) );
+ }
+ }
+ }
+
+ {
+ // Bug 26675: DataChanged vorm loeschen verschicken, dann bekommt
+ // man noch mit, welche Objecte sich im Bereich befinden.
+ // Danach koennen sie vor/hinter der Position befinden.
+ SwDataChanged aTmp( rPam, 0 );
+ }
+
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ bool bMerged(false);
+ if (GetIDocumentUndoRedo().DoesGroupUndo())
+ {
+ SwUndo *const pLastUndo( GetUndoManager().GetLastUndo() );
+ SwUndoDelete *const pUndoDelete(
+ dynamic_cast<SwUndoDelete *>(pLastUndo) );
+ if (pUndoDelete)
+ {
+ bMerged = pUndoDelete->CanGrouping( this, rPam );
+ // if CanGrouping() returns true it's already merged
+ }
+ }
+ if (!bMerged)
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( rPam ) );
+ }
+
+ SetModified();
+
+ return true;
+ }
+
+ if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ DeleteRedline( rPam, true, USHRT_MAX );
+
+ // loesche und verschiebe erstmal alle "Fly's am Absatz", die in der
+ // Selection liegen
+ DelFlyInRange(rPam.GetMark()->nNode, rPam.GetPoint()->nNode);
+ _DelBookmarks(
+ pStt->nNode,
+ pEnd->nNode,
+ NULL,
+ &pStt->nContent,
+ &pEnd->nContent);
+
+ SwNodeIndex aSttIdx( pStt->nNode );
+ SwCntntNode * pCNd = aSttIdx.GetNode().GetCntntNode();
+
+ do { // middle checked loop!
+ if( pCNd )
+ {
+ SwTxtNode * pStartTxtNode( pCNd->GetTxtNode() );
+ if ( pStartTxtNode )
+ {
+ // verschiebe jetzt noch den Inhalt in den neuen Node
+ sal_Bool bOneNd = pStt->nNode == pEnd->nNode;
+ xub_StrLen nLen = ( bOneNd ? pEnd->nContent.GetIndex()
+ : pCNd->Len() )
+ - pStt->nContent.GetIndex();
+
+ // falls schon leer, dann nicht noch aufrufen
+ if( nLen )
+ {
+ pStartTxtNode->EraseText( pStt->nContent, nLen );
+
+ if( !pStartTxtNode->Len() )
+ {
+ // METADATA: remove reference if empty (consider node deleted)
+ pStartTxtNode->RemoveMetadataReference();
+ }
+ }
+
+ if( bOneNd ) // das wars schon
+ break;
+
+ aSttIdx++;
+ }
+ else
+ {
+ // damit beim loeschen keine Indizies mehr angemeldet sind,
+ // wird hier der SwPaM aus dem Content entfernt !!
+ pStt->nContent.Assign( 0, 0 );
+ }
+ }
+
+ pCNd = pEnd->nNode.GetNode().GetCntntNode();
+ if( pCNd )
+ {
+ SwTxtNode * pEndTxtNode( pCNd->GetTxtNode() );
+ if( pEndTxtNode )
+ {
+ // falls schon leer, dann nicht noch aufrufen
+ if( pEnd->nContent.GetIndex() )
+ {
+ SwIndex aIdx( pCNd, 0 );
+ pEndTxtNode->EraseText( aIdx, pEnd->nContent.GetIndex() );
+
+ if( !pEndTxtNode->Len() )
+ {
+ // METADATA: remove reference if empty (consider node deleted)
+ pEndTxtNode->RemoveMetadataReference();
+ }
+ }
+ }
+ else
+ {
+ // damit beim Loeschen keine Indizies mehr angemeldet sind,
+ // wird hier der SwPaM aus dem Content entfernt !!
+ pEnd->nContent.Assign( 0, 0 );
+ }
+ }
+
+ // if the end is not a content node, delete it as well
+ sal_uInt32 nEnde = pEnd->nNode.GetIndex();
+ if( pCNd == NULL )
+ nEnde++;
+
+ if( aSttIdx != nEnde )
+ {
+ // loesche jetzt die Nodes in das NodesArary
+ GetNodes().Delete( aSttIdx, nEnde - aSttIdx.GetIndex() );
+ }
+
+ // falls der Node geloescht wurde, in dem der Cursor stand, so
+ // muss der Content im akt. Content angemeldet werden !!!
+ pStt->nContent.Assign( pStt->nNode.GetNode().GetCntntNode(),
+ pStt->nContent.GetIndex() );
+
+ // der PaM wird korrigiert, denn falls ueber Nodegrenzen geloescht
+ // wurde, so stehen sie in unterschieden Nodes. Auch die Selektion
+ // wird aufgehoben !
+ *pEnd = *pStt;
+ rPam.DeleteMark();
+
+ } while( sal_False );
+
+ if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ CompressRedlines();
+ SetModified();
+
+ return true;
+}
+
+// OD 2009-08-20 #i100466#
+// Add handling of new optional parameter <bForceJoinNext>
+bool SwDoc::DeleteAndJoin( SwPaM & rPam,
+ const bool bForceJoinNext )
+{
+ if ( lcl_StrLenOverFlow( rPam ) )
+ return false;
+
+ return lcl_DoWithBreaks( *this, rPam, (IsRedlineOn())
+ ? &SwDoc::DeleteAndJoinWithRedlineImpl
+ : &SwDoc::DeleteAndJoinImpl,
+ bForceJoinNext );
+}
+
+bool SwDoc::DeleteRange( SwPaM & rPam )
+{
+ return lcl_DoWithBreaks( *this, rPam, &SwDoc::DeleteRangeImpl );
+}
+
+
+void lcl_syncGrammarError( SwTxtNode &rTxtNode, linguistic2::ProofreadingResult& rResult,
+ xub_StrLen /*nBeginGrammarCheck*/, const ModelToViewHelper::ConversionMap* pConversionMap )
+{
+ if( rTxtNode.IsGrammarCheckDirty() )
+ return;
+ SwGrammarMarkUp* pWrong = rTxtNode.GetGrammarCheck();
+ linguistic2::SingleProofreadingError* pArray = rResult.aErrors.getArray();
+ sal_uInt16 i, j = 0;
+ if( pWrong )
+ {
+ for( i = 0; i < rResult.aErrors.getLength(); ++i )
+ {
+ const linguistic2::SingleProofreadingError &rError = rResult.aErrors[i];
+ xub_StrLen nStart = (xub_StrLen)ModelToViewHelper::ConvertToModelPosition( pConversionMap, rError.nErrorStart ).mnPos;
+ xub_StrLen nEnd = (xub_StrLen)ModelToViewHelper::ConvertToModelPosition( pConversionMap, rError.nErrorStart + rError.nErrorLength ).mnPos;
+ if( i != j )
+ pArray[j] = pArray[i];
+ if( pWrong->LookForEntry( nStart, nEnd ) )
+ ++j;
+ }
+ }
+ if( rResult.aErrors.getLength() > j )
+ rResult.aErrors.realloc( j );
+}
+
+
+uno::Any SwDoc::Spell( SwPaM& rPaM,
+ uno::Reference< XSpellChecker1 > &xSpeller,
+ sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
+ bool bGrammarCheck,
+ SwConversionArgs *pConvArgs ) const
+{
+ SwPosition* pSttPos = rPaM.Start(), *pEndPos = rPaM.End();
+ uno::Reference< beans::XPropertySet > xProp( ::GetLinguPropertySet() );
+
+ SwSpellArgs *pSpellArgs = 0;
+ //SwConversionArgs *pConvArgs = 0;
+ if (pConvArgs)
+ {
+ pConvArgs->SetStart(pSttPos->nNode.GetNode().GetTxtNode(), pSttPos->nContent);
+ pConvArgs->SetEnd( pEndPos->nNode.GetNode().GetTxtNode(), pEndPos->nContent );
+ }
+ else
+ pSpellArgs = new SwSpellArgs( xSpeller,
+ pSttPos->nNode.GetNode().GetTxtNode(), pSttPos->nContent,
+ pEndPos->nNode.GetNode().GetTxtNode(), pEndPos->nContent,
+ bGrammarCheck );
+
+ sal_uLong nCurrNd = pSttPos->nNode.GetIndex();
+ sal_uLong nEndNd = pEndPos->nNode.GetIndex();
+
+ uno::Any aRet;
+ if( nCurrNd <= nEndNd )
+ {
+ SwCntntFrm* pCntFrm;
+ sal_Bool bGoOn = sal_True;
+ while( bGoOn )
+ {
+ SwNode* pNd = GetNodes()[ nCurrNd ];
+ switch( pNd->GetNodeType() )
+ {
+ case ND_TEXTNODE:
+ if( 0 != ( pCntFrm = ((SwTxtNode*)pNd)->getLayoutFrm( GetCurrentLayout() )) )
+ {
+ // geschutze Cellen/Flys ueberspringen, ausgeblendete
+ //ebenfalls
+ if( pCntFrm->IsProtected() )
+ {
+ nCurrNd = pNd->EndOfSectionIndex();
+ }
+ else if( !((SwTxtFrm*)pCntFrm)->IsHiddenNow() )
+ {
+ if( pPageCnt && *pPageCnt && pPageSt )
+ {
+ sal_uInt16 nPageNr = pCntFrm->GetPhyPageNum();
+ if( !*pPageSt )
+ {
+ *pPageSt = nPageNr;
+ if( *pPageCnt < *pPageSt )
+ *pPageCnt = *pPageSt;
+ }
+ long nStat;
+ if( nPageNr >= *pPageSt )
+ nStat = nPageNr - *pPageSt + 1;
+ else
+ nStat = nPageNr + *pPageCnt - *pPageSt + 1;
+ ::SetProgressState( nStat, (SwDocShell*)GetDocShell() );
+ }
+ //Spell() changes the pSpellArgs in case an error is found
+ xub_StrLen nBeginGrammarCheck = 0;
+ xub_StrLen nEndGrammarCheck = 0;
+ if( pSpellArgs && pSpellArgs->bIsGrammarCheck)
+ {
+ nBeginGrammarCheck = pSpellArgs->pStartNode == pNd ? pSpellArgs->pStartIdx->GetIndex() : 0;
+ // if grammar checking starts inside of a sentence the start position has to be adjusted
+ if( nBeginGrammarCheck )
+ {
+ SwIndex aStartIndex( dynamic_cast< SwTxtNode* >( pNd ), nBeginGrammarCheck );
+ SwPosition aStart( *pNd, aStartIndex );
+ SwCursor aCrsr(aStart, 0, false);
+ SwPosition aOrigPos = *aCrsr.GetPoint();
+ aCrsr.GoSentence( SwCursor::START_SENT );
+ if( aOrigPos != *aCrsr.GetPoint() )
+ {
+ nBeginGrammarCheck = aCrsr.GetPoint()->nContent.GetIndex();
+ }
+ }
+ nEndGrammarCheck = pSpellArgs->pEndNode == pNd ? pSpellArgs->pEndIdx->GetIndex() : ((SwTxtNode*)pNd)->GetTxt().Len();
+ }
+
+ xub_StrLen nSpellErrorPosition = ((SwTxtNode*)pNd)->GetTxt().Len();
+ if( (!pConvArgs &&
+ ((SwTxtNode*)pNd)->Spell( pSpellArgs )) ||
+ ( pConvArgs &&
+ ((SwTxtNode*)pNd)->Convert( *pConvArgs )))
+ {
+ // Abbrechen und Position merken
+ pSttPos->nNode = nCurrNd;
+ pEndPos->nNode = nCurrNd;
+ nCurrNd = nEndNd;
+ if( pSpellArgs )
+ nSpellErrorPosition = pSpellArgs->pStartIdx->GetIndex() > pSpellArgs->pEndIdx->GetIndex() ?
+ pSpellArgs->pEndIdx->GetIndex() :
+ pSpellArgs->pStartIdx->GetIndex();
+ }
+
+
+ if( pSpellArgs && pSpellArgs->bIsGrammarCheck )
+ {
+ uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() );
+ if (xGCIterator.is())
+ {
+ String aText( ((SwTxtNode*)pNd)->GetTxt().Copy( nBeginGrammarCheck, nEndGrammarCheck - nBeginGrammarCheck ) );
+ uno::Reference< lang::XComponent > xDoc( ((SwDocShell*)GetDocShell())->GetBaseModel(), uno::UNO_QUERY );
+ // Expand the string:
+ rtl::OUString aExpandText;
+ const ModelToViewHelper::ConversionMap* pConversionMap =
+ ((SwTxtNode*)pNd)->BuildConversionMap( aExpandText );
+ // get XFlatParagraph to use...
+ uno::Reference< text::XFlatParagraph > xFlatPara = new SwXFlatParagraph( *((SwTxtNode*)pNd), aExpandText, pConversionMap );
+
+ // get error position of cursor in XFlatParagraph
+ sal_Int32 nGrammarErrorPosInText;
+ linguistic2::ProofreadingResult aResult;
+ sal_Int32 nGrammarErrors;
+ do
+ {
+ nGrammarErrorPosInText = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nBeginGrammarCheck );
+ aResult = xGCIterator->checkSentenceAtPosition(
+ xDoc, xFlatPara, aExpandText, lang::Locale(), nBeginGrammarCheck, -1, -1 );
+
+ lcl_syncGrammarError( *((SwTxtNode*)pNd), aResult, nBeginGrammarCheck, pConversionMap );
+
+ // get suggestions to use for the specific error position
+ nGrammarErrors = aResult.aErrors.getLength();
+ // if grammar checking doesn't have any progress then quit
+ if( aResult.nStartOfNextSentencePosition <= nBeginGrammarCheck )
+ break;
+ // prepare next iteration
+ nBeginGrammarCheck = (xub_StrLen)aResult.nStartOfNextSentencePosition;
+ }
+ while( nSpellErrorPosition > aResult.nBehindEndOfSentencePosition && !nGrammarErrors && aResult.nBehindEndOfSentencePosition < nEndGrammarCheck );
+
+ if( nGrammarErrors > 0 && nSpellErrorPosition >= aResult.nBehindEndOfSentencePosition )
+ {
+ aRet <<= aResult;
+ //put the cursor to the current error
+ const linguistic2::SingleProofreadingError &rError = aResult.aErrors[0];
+ nCurrNd = pNd->GetIndex();
+ pSttPos->nNode = nCurrNd;
+ pEndPos->nNode = nCurrNd;
+ pSpellArgs->pStartNode = ((SwTxtNode*)pNd);
+ pSpellArgs->pEndNode = ((SwTxtNode*)pNd);
+ pSpellArgs->pStartIdx->Assign(((SwTxtNode*)pNd), (xub_StrLen)ModelToViewHelper::ConvertToModelPosition( pConversionMap, rError.nErrorStart ).mnPos );
+ pSpellArgs->pEndIdx->Assign(((SwTxtNode*)pNd), (xub_StrLen)ModelToViewHelper::ConvertToModelPosition( pConversionMap, rError.nErrorStart + rError.nErrorLength ).mnPos );
+ nCurrNd = nEndNd;
+ }
+ }
+ }
+ }
+ }
+ break;
+ case ND_SECTIONNODE:
+ if( ( ((SwSectionNode*)pNd)->GetSection().IsProtect() ||
+ ((SwSectionNode*)pNd)->GetSection().IsHidden() ) )
+ nCurrNd = pNd->EndOfSectionIndex();
+ break;
+ case ND_ENDNODE:
+ {
+ break;
+ }
+ }
+
+ bGoOn = nCurrNd < nEndNd;
+ ++nCurrNd;
+ }
+ }
+
+ if( !aRet.hasValue() )
+ {
+ if (pConvArgs)
+ aRet <<= pConvArgs->aConvText;
+ else
+ aRet <<= pSpellArgs->xSpellAlt;
+ }
+ delete pSpellArgs;
+
+ return aRet;
+}
+
+class SwHyphArgs : public SwInterHyphInfo
+{
+ const SwNode *pStart;
+ const SwNode *pEnd;
+ SwNode *pNode;
+ sal_uInt16 *pPageCnt;
+ sal_uInt16 *pPageSt;
+
+ sal_uInt32 nNode;
+ xub_StrLen nPamStart;
+ xub_StrLen nPamLen;
+
+public:
+ SwHyphArgs( const SwPaM *pPam, const Point &rPoint,
+ sal_uInt16* pPageCount, sal_uInt16* pPageStart );
+ void SetPam( SwPaM *pPam ) const;
+ inline void SetNode( SwNode *pNew ) { pNode = pNew; }
+ inline const SwNode *GetNode() const { return pNode; }
+ inline void SetRange( const SwNode *pNew );
+ inline void NextNode() { ++nNode; }
+ inline sal_uInt16 *GetPageCnt() { return pPageCnt; }
+ inline sal_uInt16 *GetPageSt() { return pPageSt; }
+};
+
+SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCrsrPos,
+ sal_uInt16* pPageCount, sal_uInt16* pPageStart )
+ : SwInterHyphInfo( rCrsrPos ), pNode(0),
+ pPageCnt( pPageCount ), pPageSt( pPageStart )
+{
+ // Folgende Bedingungen muessen eingehalten werden:
+ // 1) es gibt mindestens eine Selektion
+ // 2) SPoint() == Start()
+ ASSERT( pPam->HasMark(), "SwDoc::Hyphenate: blowing in the wind");
+ ASSERT( *pPam->GetPoint() <= *pPam->GetMark(),
+ "SwDoc::Hyphenate: New York, New York");
+
+ const SwPosition *pPoint = pPam->GetPoint();
+ nNode = pPoint->nNode.GetIndex();
+
+ // Start einstellen
+ pStart = pPoint->nNode.GetNode().GetTxtNode();
+ nPamStart = pPoint->nContent.GetIndex();
+
+ // Ende und Laenge einstellen.
+ const SwPosition *pMark = pPam->GetMark();
+ pEnd = pMark->nNode.GetNode().GetTxtNode();
+ nPamLen = pMark->nContent.GetIndex();
+ if( pPoint->nNode == pMark->nNode )
+ nPamLen = nPamLen - pPoint->nContent.GetIndex();
+}
+
+inline void SwHyphArgs::SetRange( const SwNode *pNew )
+{
+ nStart = pStart == pNew ? nPamStart : 0;
+ nLen = pEnd == pNew ? nPamLen : STRING_NOTFOUND;
+}
+
+void SwHyphArgs::SetPam( SwPaM *pPam ) const
+{
+ if( !pNode )
+ *pPam->GetPoint() = *pPam->GetMark();
+ else
+ {
+ pPam->GetPoint()->nNode = nNode;
+ pPam->GetPoint()->nContent.Assign( pNode->GetCntntNode(), nWordStart );
+ pPam->GetMark()->nNode = nNode;
+ pPam->GetMark()->nContent.Assign( pNode->GetCntntNode(),
+ nWordStart + nWordLen );
+ ASSERT( nNode == pNode->GetIndex(),
+ "SwHyphArgs::SetPam: Pam desaster" );
+ }
+}
+
+// liefert sal_True zurueck, wenn es weitergehen soll.
+sal_Bool lcl_HyphenateNode( const SwNodePtr& rpNd, void* pArgs )
+{
+ // Hyphenate liefert sal_True zurueck, wenn eine Trennstelle anliegt
+ // und stellt pPam ein.
+ SwTxtNode *pNode = rpNd->GetTxtNode();
+ SwHyphArgs *pHyphArgs = (SwHyphArgs*)pArgs;
+ if( pNode )
+ {
+ SwCntntFrm* pCntFrm = pNode->getLayoutFrm( pNode->GetDoc()->GetCurrentLayout() );
+ if( pCntFrm && !((SwTxtFrm*)pCntFrm)->IsHiddenNow() )
+ {
+ sal_uInt16 *pPageSt = pHyphArgs->GetPageSt();
+ sal_uInt16 *pPageCnt = pHyphArgs->GetPageCnt();
+ if( pPageCnt && *pPageCnt && pPageSt )
+ {
+ sal_uInt16 nPageNr = pCntFrm->GetPhyPageNum();
+ if( !*pPageSt )
+ {
+ *pPageSt = nPageNr;
+ if( *pPageCnt < *pPageSt )
+ *pPageCnt = *pPageSt;
+ }
+ long nStat = nPageNr >= *pPageSt ? nPageNr - *pPageSt + 1
+ : nPageNr + *pPageCnt - *pPageSt + 1;
+ ::SetProgressState( nStat, (SwDocShell*)pNode->GetDoc()->GetDocShell() );
+ }
+ pHyphArgs->SetRange( rpNd );
+ if( pNode->Hyphenate( *pHyphArgs ) )
+ {
+ pHyphArgs->SetNode( rpNd );
+ return sal_False;
+ }
+ }
+ }
+ pHyphArgs->NextNode();
+ return sal_True;
+}
+
+uno::Reference< XHyphenatedWord > SwDoc::Hyphenate(
+ SwPaM *pPam, const Point &rCrsrPos,
+ sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
+{
+ ASSERT(this == pPam->GetDoc(), "SwDoc::Hyphenate: strangers in the night");
+
+ if( *pPam->GetPoint() > *pPam->GetMark() )
+ pPam->Exchange();
+
+ SwHyphArgs aHyphArg( pPam, rCrsrPos, pPageCnt, pPageSt );
+ SwNodeIndex aTmpIdx( pPam->GetMark()->nNode, 1 );
+ GetNodes().ForEach( pPam->GetPoint()->nNode, aTmpIdx,
+ lcl_HyphenateNode, &aHyphArg );
+ aHyphArg.SetPam( pPam );
+ return aHyphArg.GetHyphWord(); // will be set by lcl_HyphenateNode
+}
+
+
+sal_Bool lcl_GetTokenToParaBreak( String& rStr, String& rRet, sal_Bool bRegExpRplc )
+{
+ sal_Bool bRet = sal_False;
+ if( bRegExpRplc )
+ {
+ xub_StrLen nPos = 0;
+ String sPara( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "\\n" )));
+ while( STRING_NOTFOUND != ( nPos = rStr.Search( sPara, nPos )) )
+ {
+ // wurde das escaped?
+ if( nPos && '\\' == rStr.GetChar( nPos-1 ))
+ {
+ if( ++nPos >= rStr.Len() )
+ break;
+ }
+ else
+ {
+ rRet = rStr.Copy( 0, nPos );
+ rStr.Erase( 0, nPos + sPara.Len() );
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+ if( !bRet )
+ {
+ rRet = rStr;
+ rStr.Erase();
+ }
+ return bRet;
+}
+
+bool SwDoc::ReplaceRange( SwPaM& rPam, const String& rStr,
+ const bool bRegExReplace )
+{
+ // unfortunately replace works slightly differently from delete,
+ // so we cannot use lcl_DoWithBreaks here...
+
+ ::std::vector<xub_StrLen> Breaks;
+
+ SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
+ aPam.Normalize(sal_False);
+ if (aPam.GetPoint()->nNode != aPam.GetMark()->nNode)
+ {
+ aPam.Move(fnMoveBackward);
+ }
+ ASSERT((aPam.GetPoint()->nNode == aPam.GetMark()->nNode), "invalid pam?");
+
+ lcl_CalcBreaks(Breaks, aPam);
+
+ while (!Breaks.empty() // skip over prefix of dummy chars
+ && (aPam.GetMark()->nContent.GetIndex() == *Breaks.begin()) )
+ {
+ // skip!
+ ++aPam.GetMark()->nContent; // always in bounds if Breaks valid
+ Breaks.erase(Breaks.begin());
+ }
+ *rPam.Start() = *aPam.GetMark(); // update start of original pam w/ prefix
+
+ if (!Breaks.size())
+ {
+ return ReplaceRangeImpl(rPam, rStr, bRegExReplace); // original pam!
+ }
+
+ // N.B.: deletion must be split into several parts if the text node
+ // contains a text attribute with end and with dummy character
+ // and the selection does not contain the text attribute completely,
+ // but overlaps its start (left), where the dummy character is.
+
+ bool bRet( true );
+ // iterate from end to start, to avoid invalidating the offsets!
+ ::std::vector<xub_StrLen>::reverse_iterator iter( Breaks.rbegin() );
+ ASSERT(aPam.GetPoint() == aPam.End(), "wrong!");
+ SwPosition & rEnd( *aPam.End() );
+ SwPosition & rStart( *aPam.Start() );
+
+ // set end of temp pam to original end (undo Move backward above)
+ rEnd = *rPam.End();
+ // after first deletion, rEnd will point into the original text node again!
+
+ while (iter != Breaks.rend())
+ {
+ rStart.nContent = *iter + 1;
+ if (rEnd.nContent != rStart.nContent) // check if part is empty
+ {
+ bRet &= (IsRedlineOn())
+ ? DeleteAndJoinWithRedlineImpl(aPam)
+ : DeleteAndJoinImpl(aPam, false);
+ }
+ rEnd.nContent = *iter;
+ ++iter;
+ }
+
+ rStart = *rPam.Start(); // set to original start
+ ASSERT(rEnd.nContent > rStart.nContent, "replace part empty!");
+ if (rEnd.nContent > rStart.nContent) // check if part is empty
+ {
+ bRet &= ReplaceRangeImpl(aPam, rStr, bRegExReplace);
+ }
+
+ rPam = aPam; // update original pam (is this required?)
+
+ return bRet;
+}
+
+// N.B.: it is possible to call Replace with a PaM that spans 2 paragraphs:
+// search with regex for "$", then replace _all_
+bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
+ const bool bRegExReplace )
+{
+ if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark() )
+ return false;
+
+ sal_Bool bJoinTxt, bJoinPrev;
+ lcl_GetJoinFlags( rPam, bJoinTxt, bJoinPrev );
+
+ {
+ // dann eine Kopie vom Cursor erzeugen um alle Pams aus den
+ // anderen Sichten aus dem Loeschbereich zu verschieben
+ // ABER NICHT SICH SELBST !!
+ SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() );
+ ::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() );
+
+ SwPosition *pStt = (SwPosition*)aDelPam.Start(),
+ *pEnd = (SwPosition*)aDelPam.End();
+ ASSERT( pStt->nNode == pEnd->nNode ||
+ ( pStt->nNode.GetIndex() + 1 == pEnd->nNode.GetIndex() &&
+ !pEnd->nContent.GetIndex() ),
+ "invalid range: Point and Mark on different nodes" );
+ sal_Bool bOneNode = pStt->nNode == pEnd->nNode;
+
+ // eigenes Undo ????
+ String sRepl( rStr );
+ SwTxtNode* pTxtNd = pStt->nNode.GetNode().GetTxtNode();
+ xub_StrLen nStt = pStt->nContent.GetIndex(),
+ nEnd = bOneNode ? pEnd->nContent.GetIndex()
+ : pTxtNd->GetTxt().Len();
+
+ SwDataChanged aTmp( aDelPam, 0 );
+
+ if( IsRedlineOn() )
+ {
+ RedlineMode_t eOld = GetRedlineMode();
+ checkRedlining(eOld);
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+
+ // Bug 68584 - if any Redline will change (split!) the node
+ const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK );
+
+ //JP 06.01.98: MUSS noch optimiert werden!!!
+ SetRedlineMode(
+ (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ));
+
+ *aDelPam.GetPoint() = pBkmk->GetMarkPos();
+ if(pBkmk->IsExpanded())
+ *aDelPam.GetMark() = pBkmk->GetOtherMarkPos();
+ getIDocumentMarkAccess()->deleteMark(pBkmk);
+ pStt = aDelPam.Start();
+ pTxtNd = pStt->nNode.GetNode().GetTxtNode();
+ nStt = pStt->nContent.GetIndex();
+ }
+
+ if( sRepl.Len() )
+ {
+ // Attribute des 1. Zeichens ueber den ReplaceText setzen
+ SfxItemSet aSet( GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_TXTATR_WITHEND_END - 1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0 );
+ pTxtNd->GetAttr( aSet, nStt+1, nStt+1 );
+
+ aSet.ClearItem( RES_TXTATR_REFMARK );
+ aSet.ClearItem( RES_TXTATR_TOXMARK );
+ aSet.ClearItem( RES_TXTATR_CJK_RUBY );
+ aSet.ClearItem( RES_TXTATR_INETFMT );
+ aSet.ClearItem( RES_TXTATR_META );
+ aSet.ClearItem( RES_TXTATR_METAFIELD );
+
+ if( aDelPam.GetPoint() != aDelPam.End() )
+ aDelPam.Exchange();
+
+ // das Ende merken
+ SwNodeIndex aPtNd( aDelPam.GetPoint()->nNode, -1 );
+ xub_StrLen nPtCnt = aDelPam.GetPoint()->nContent.GetIndex();
+
+ sal_Bool bFirst = sal_True;
+ String sIns;
+ while ( lcl_GetTokenToParaBreak( sRepl, sIns, bRegExReplace ) )
+ {
+ InsertString( aDelPam, sIns );
+ if( bFirst )
+ {
+ SwNodeIndex aMkNd( aDelPam.GetMark()->nNode, -1 );
+ xub_StrLen nMkCnt = aDelPam.GetMark()->nContent.GetIndex();
+
+ SplitNode( *aDelPam.GetPoint(), false );
+
+ aMkNd++;
+ aDelPam.GetMark()->nNode = aMkNd;
+ aDelPam.GetMark()->nContent.Assign(
+ aMkNd.GetNode().GetCntntNode(), nMkCnt );
+ bFirst = sal_False;
+ }
+ else
+ SplitNode( *aDelPam.GetPoint(), false );
+ }
+ if( sIns.Len() )
+ {
+ InsertString( aDelPam, sIns );
+ }
+
+ SwPaM aTmpRange( *aDelPam.GetPoint() );
+ aTmpRange.SetMark();
+
+ aPtNd++;
+ aDelPam.GetPoint()->nNode = aPtNd;
+ aDelPam.GetPoint()->nContent.Assign( aPtNd.GetNode().GetCntntNode(),
+ nPtCnt);
+ *aTmpRange.GetMark() = *aDelPam.GetPoint();
+
+ RstTxtAttrs( aTmpRange );
+ InsertItemSet( aTmpRange, aSet, 0 );
+ }
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndoRD =
+ new SwUndoRedlineDelete( aDelPam, UNDO_REPLACE );
+ GetIDocumentUndoRedo().AppendUndo(pUndoRD);
+ }
+ AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, aDelPam ), true);
+
+ *rPam.GetMark() = *aDelPam.GetMark();
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ *aDelPam.GetPoint() = *rPam.GetPoint();
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+
+ // Bug 68584 - if any Redline will change (split!) the node
+ const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK );
+
+ SwIndex& rIdx = aDelPam.GetPoint()->nContent;
+ rIdx.Assign( 0, 0 );
+ aDelPam.GetMark()->nContent = rIdx;
+ rPam.GetPoint()->nNode = 0;
+ rPam.GetPoint()->nContent = rIdx;
+ *rPam.GetMark() = *rPam.GetPoint();
+//JP 06.01.98: MUSS noch optimiert werden!!!
+SetRedlineMode( eOld );
+
+ *rPam.GetPoint() = pBkmk->GetMarkPos();
+ if(pBkmk->IsExpanded())
+ *rPam.GetMark() = pBkmk->GetOtherMarkPos();
+ getIDocumentMarkAccess()->deleteMark(pBkmk);
+ }
+ bJoinTxt = sal_False;
+ }
+ else
+ {
+ if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ DeleteRedline( aDelPam, true, USHRT_MAX );
+
+ SwUndoReplace* pUndoRpl = 0;
+ bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo();
+ if (bDoesUndo)
+ {
+ pUndoRpl = new SwUndoReplace(aDelPam, sRepl, bRegExReplace);
+ GetIDocumentUndoRedo().AppendUndo(pUndoRpl);
+ }
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ if( aDelPam.GetPoint() != pStt )
+ aDelPam.Exchange();
+
+ SwNodeIndex aPtNd( pStt->nNode, -1 );
+ xub_StrLen nPtCnt = pStt->nContent.GetIndex();
+
+ // die Werte nochmal setzen, falls schohn Rahmen oder Fussnoten
+ // auf dem Text entfernt wurden!
+ nStt = nPtCnt;
+ nEnd = bOneNode ? pEnd->nContent.GetIndex()
+ : pTxtNd->GetTxt().Len();
+
+ sal_Bool bFirst = sal_True;
+ String sIns;
+ while ( lcl_GetTokenToParaBreak( sRepl, sIns, bRegExReplace ) )
+ {
+ if( !bFirst || nStt == pTxtNd->GetTxt().Len() )
+ {
+ InsertString( aDelPam, sIns );
+ }
+ else if( nStt < nEnd || sIns.Len() )
+ {
+ pTxtNd->ReplaceText( pStt->nContent, nEnd - nStt, sIns );
+ }
+ SplitNode( *pStt, false);
+ bFirst = sal_False;
+ }
+
+ if( bFirst || sIns.Len() )
+ {
+ if( !bFirst || nStt == pTxtNd->GetTxt().Len() )
+ {
+ InsertString( aDelPam, sIns );
+ }
+ else if( nStt < nEnd || sIns.Len() )
+ {
+ pTxtNd->ReplaceText( pStt->nContent, nEnd - nStt, sIns );
+ }
+ }
+
+ *rPam.GetMark() = *aDelPam.GetMark();
+
+ aPtNd++;
+ rPam.GetMark()->nNode = aPtNd;
+ rPam.GetMark()->nContent.Assign( aPtNd.GetNode().GetCntntNode(),
+ nPtCnt );
+ if( bJoinTxt )
+ rPam.Move( fnMoveBackward );
+
+ if( pUndoRpl )
+ {
+ pUndoRpl->SetEnd(rPam);
+ }
+ }
+ }
+
+ if( bJoinTxt )
+ lcl_JoinText( rPam, bJoinPrev );
+
+ SetModified();
+ return true;
+}
+
+ // speicher die akt. Werte fuer die automatische Aufnahme von Ausnahmen
+ // in die Autokorrektur
+void SwDoc::SetAutoCorrExceptWord( SwAutoCorrExceptWord* pNew )
+{
+ if( pACEWord && pNew != pACEWord )
+ delete pACEWord;
+ pACEWord = pNew;
+}
+
+bool SwDoc::DelFullPara( SwPaM& rPam )
+{
+ const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
+ const SwNode* pNd = &rStt.nNode.GetNode();
+ sal_uInt32 nSectDiff = pNd->StartOfSectionNode()->EndOfSectionIndex() -
+ pNd->StartOfSectionIndex();
+ sal_uInt32 nNodeDiff = rEnd.nNode.GetIndex() - rStt.nNode.GetIndex();
+
+ if ( nSectDiff-2 <= nNodeDiff || IsRedlineOn() ||
+ /* #i9185# Prevent getting the node after the end node (see below) */
+ rEnd.nNode.GetIndex() + 1 == GetNodes().Count() )
+ {
+ return sal_False;
+ }
+
+ // harte SeitenUmbrueche am nachfolgenden Node verschieben
+ sal_Bool bSavePageBreak = sal_False, bSavePageDesc = sal_False;
+
+ /* #i9185# This whould lead to a segmentation fault if not catched
+ above. */
+ sal_uLong nNextNd = rEnd.nNode.GetIndex() + 1;
+ SwTableNode *const pTblNd = GetNodes()[ nNextNd ]->GetTableNode();
+
+ if( pTblNd && pNd->IsCntntNode() )
+ {
+ SwFrmFmt* pTableFmt = pTblNd->GetTable().GetFrmFmt();
+//JP 24.08.98: will man wirklich den PageDesc/Break vom
+// nachfolgen Absatz ueberbuegeln?
+// const SwAttrSet& rAttrSet = pTableFmt->GetAttrSet();
+// if( SFX_ITEM_SET != rAttrSet.GetItemState( RES_PAGEDESC ) &&
+// SFX_ITEM_SET != rAttrSet.GetItemState( RES_BREAK ))
+ {
+ const SfxPoolItem *pItem;
+ const SfxItemSet* pSet = ((SwCntntNode*)pNd)->GetpSwAttrSet();
+ if( pSet && SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC,
+ sal_False, &pItem ) )
+ {
+ pTableFmt->SetFmtAttr( *pItem );
+ bSavePageDesc = sal_True;
+ }
+
+ if( pSet && SFX_ITEM_SET == pSet->GetItemState( RES_BREAK,
+ sal_False, &pItem ) )
+ {
+ pTableFmt->SetFmtAttr( *pItem );
+ bSavePageBreak = sal_True;
+ }
+ }
+ }
+
+ bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo();
+ if( bDoesUndo )
+ {
+ if( !rPam.HasMark() )
+ rPam.SetMark();
+ else if( rPam.GetPoint() == &rStt )
+ rPam.Exchange();
+ rPam.GetPoint()->nNode++;
+
+ SwCntntNode *pTmpNode = rPam.GetPoint()->nNode.GetNode().GetCntntNode();
+ rPam.GetPoint()->nContent.Assign( pTmpNode, 0 );
+ bool bGoNext = (0 == pTmpNode);
+ pTmpNode = rPam.GetMark()->nNode.GetNode().GetCntntNode();
+ rPam.GetMark()->nContent.Assign( pTmpNode, 0 );
+
+ GetIDocumentUndoRedo().ClearRedo();
+
+ SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() );
+ {
+ SwPosition aTmpPos( *aDelPam.GetPoint() );
+ if( bGoNext )
+ {
+ pTmpNode = GetNodes().GoNext( &aTmpPos.nNode );
+ aTmpPos.nContent.Assign( pTmpNode, 0 );
+ }
+ ::PaMCorrAbs( aDelPam, aTmpPos );
+ }
+
+ SwUndoDelete* pUndo = new SwUndoDelete( aDelPam, sal_True );
+
+ *rPam.GetPoint() = *aDelPam.GetPoint();
+ pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ else
+ {
+ SwNodeRange aRg( rStt.nNode, rEnd.nNode );
+ if( rPam.GetPoint() != &rEnd )
+ rPam.Exchange();
+
+ // versuche hinters Ende zu verschieben
+ if( !rPam.Move( fnMoveForward, fnGoNode ) )
+ {
+ // na gut, dann an den Anfang
+ rPam.Exchange();
+ if( !rPam.Move( fnMoveBackward, fnGoNode ))
+ {
+ ASSERT( sal_False, "kein Node mehr vorhanden" );
+ return sal_False;
+ }
+ }
+ // text::Bookmarks usw. verschieben
+ CorrAbs( aRg.aStart, aRg.aEnd, *rPam.GetPoint(), sal_True );
+
+ // was ist mit Fly's ??
+ {
+ // stehen noch FlyFrames rum, loesche auch diese
+ for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+ {
+ SwFrmFmt* pFly = (*GetSpzFrmFmts())[n];
+ const SwFmtAnchor* pAnchor = &pFly->GetAnchor();
+ SwPosition const*const pAPos = pAnchor->GetCntntAnchor();
+ if (pAPos &&
+ ((FLY_AT_PARA == pAnchor->GetAnchorId()) ||
+ (FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
+ aRg.aStart <= pAPos->nNode && pAPos->nNode <= aRg.aEnd )
+ {
+ DelLayoutFmt( pFly );
+ --n;
+ }
+ }
+ }
+
+ SwCntntNode *pTmpNode = rPam.GetBound( sal_True ).nNode.GetNode().GetCntntNode();
+ rPam.GetBound( sal_True ).nContent.Assign( pTmpNode, 0 );
+ pTmpNode = rPam.GetBound( sal_False ).nNode.GetNode().GetCntntNode();
+ rPam.GetBound( sal_False ).nContent.Assign( pTmpNode, 0 );
+ GetNodes().Delete( aRg.aStart, nNodeDiff+1 );
+ }
+ rPam.DeleteMark();
+ SetModified();
+
+ return sal_True;
+}
+
+
+void SwDoc::TransliterateText(
+ const SwPaM& rPaM,
+ utl::TransliterationWrapper& rTrans )
+{
+ SwUndoTransliterate *const pUndo = (GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoTransliterate( rPaM, rTrans )
+ : 0;
+
+ const SwPosition* pStt = rPaM.Start(),
+ * pEnd = rPaM.End();
+ sal_uLong nSttNd = pStt->nNode.GetIndex(),
+ nEndNd = pEnd->nNode.GetIndex();
+ xub_StrLen nSttCnt = pStt->nContent.GetIndex(),
+ nEndCnt = pEnd->nContent.GetIndex();
+
+ SwTxtNode* pTNd = pStt->nNode.GetNode().GetTxtNode();
+ if( pStt == pEnd && pTNd ) // no selection?
+ {
+ // set current word as 'area of effect'
+
+ Boundary aBndry;
+ if( pBreakIt->GetBreakIter().is() )
+ aBndry = pBreakIt->GetBreakIter()->getWordBoundary(
+ pTNd->GetTxt(), nSttCnt,
+ pBreakIt->GetLocale( pTNd->GetLang( nSttCnt ) ),
+ WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
+ sal_True );
+
+ if( aBndry.startPos < nSttCnt && nSttCnt < aBndry.endPos )
+ {
+ nSttCnt = (xub_StrLen)aBndry.startPos;
+ nEndCnt = (xub_StrLen)aBndry.endPos;
+ }
+ }
+
+ if( nSttNd != nEndNd ) // is more than one text node involved?
+ {
+ // iterate over all effected text nodes, the first and the last one
+ // may be incomplete because the selection starts and/or ends there
+
+ SwNodeIndex aIdx( pStt->nNode );
+ if( nSttCnt )
+ {
+ aIdx++;
+ if( pTNd )
+ pTNd->TransliterateText( rTrans, nSttCnt, pTNd->GetTxt().Len(), pUndo );
+ }
+
+ for( ; aIdx.GetIndex() < nEndNd; aIdx++ )
+ {
+ if( 0 != ( pTNd = aIdx.GetNode().GetTxtNode() ))
+ pTNd->TransliterateText( rTrans, 0, pTNd->GetTxt().Len(), pUndo );
+ }
+
+ if( nEndCnt && 0 != ( pTNd = pEnd->nNode.GetNode().GetTxtNode() ))
+ pTNd->TransliterateText( rTrans, 0, nEndCnt, pUndo );
+ }
+ else if( pTNd && nSttCnt < nEndCnt )
+ pTNd->TransliterateText( rTrans, nSttCnt, nEndCnt, pUndo );
+
+ if( pUndo )
+ {
+ if( pUndo->HasData() )
+ {
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ else
+ delete pUndo;
+ }
+ SetModified();
+}
+
+
+#define MAX_REDLINE_COUNT 250
+// -----------------------------------------------------------------------------
+void SwDoc::checkRedlining(RedlineMode_t& _rReadlineMode)
+{
+ const SwRedlineTbl& rRedlineTbl = GetRedlineTbl();
+ SwEditShell* pEditShell = GetEditShell();
+ Window* pParent = pEditShell ? pEditShell->GetWin() : NULL;
+ if ( pParent && !mbReadlineChecked && rRedlineTbl.Count() > MAX_REDLINE_COUNT
+ && !((_rReadlineMode & nsRedlineMode_t::REDLINE_SHOW_DELETE) == nsRedlineMode_t::REDLINE_SHOW_DELETE) )
+ {
+ WarningBox aWarning( pParent,SW_RES(MSG_DISABLE_READLINE_QUESTION));
+ sal_uInt16 nResult = aWarning.Execute();
+ mbReadlineChecked = sal_True;
+ if ( nResult == RET_YES )
+ {
+ sal_Int32 nMode = (sal_Int32)_rReadlineMode;
+ nMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE;
+ _rReadlineMode = (RedlineMode_t)nMode;
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+
+void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat ) const
+{
+ // This is a modified version of SwDoc::TransliterateText
+ const SwPosition* pStt = rPaM.Start();
+ const SwPosition* pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark()
+ : rPaM.GetPoint();
+
+ const sal_uLong nSttNd = pStt->nNode.GetIndex();
+ const sal_uLong nEndNd = pEnd->nNode.GetIndex();
+
+ const xub_StrLen nSttCnt = pStt->nContent.GetIndex();
+ const xub_StrLen nEndCnt = pEnd->nContent.GetIndex();
+
+ const SwTxtNode* pTNd = pStt->nNode.GetNode().GetTxtNode();
+ if( pStt == pEnd && pTNd ) // no region ?
+ {
+ // do nothing
+ return;
+ }
+
+ if( nSttNd != nEndNd )
+ {
+ SwNodeIndex aIdx( pStt->nNode );
+ if( nSttCnt )
+ {
+ aIdx++;
+ if( pTNd )
+ pTNd->CountWords( rStat, nSttCnt, pTNd->GetTxt().Len() );
+ }
+
+ for( ; aIdx.GetIndex() < nEndNd; aIdx++ )
+ if( 0 != ( pTNd = aIdx.GetNode().GetTxtNode() ))
+ pTNd->CountWords( rStat, 0, pTNd->GetTxt().Len() );
+
+ if( nEndCnt && 0 != ( pTNd = pEnd->nNode.GetNode().GetTxtNode() ))
+ pTNd->CountWords( rStat, 0, nEndCnt );
+ }
+ else if( pTNd && nSttCnt < nEndCnt )
+ pTNd->CountWords( rStat, nSttCnt, nEndCnt );
+}
+
+void SwDoc::RemoveLeadingWhiteSpace(const SwPosition & rPos )
+{
+ const SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
+ if ( pTNd )
+ {
+ const String& rTxt = pTNd->GetTxt();
+ xub_StrLen nIdx = 0;
+ sal_Unicode cCh;
+ while( nIdx < rTxt.Len() &&
+ ( '\t' == ( cCh = rTxt.GetChar( nIdx ) ) ||
+ ( ' ' == cCh ) ) )
+ ++nIdx;
+
+ if ( nIdx > 0 )
+ {
+ SwPaM aPam(rPos);
+ aPam.GetPoint()->nContent = 0;
+ aPam.SetMark();
+ aPam.GetMark()->nContent = nIdx;
+ DeleteRange( aPam );
+ }
+ }
+}
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
new file mode 100644
index 000000000000..89552c3b1ad9
--- /dev/null
+++ b/sw/source/core/doc/docfld.cxx
@@ -0,0 +1,2824 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#include <string.h>
+#include <float.h>
+#include <tools/datetime.hxx>
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_ULONGS
+#include <svl/svarray.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/charclass.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <cntfrm.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <swtable.hxx>
+#include <calc.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <tox.hxx>
+#include <txttxmrk.hxx>
+#include <docfld.hxx> // fuer Expression-Felder
+#include <docufld.hxx>
+#include <ddefld.hxx>
+#include <usrfld.hxx>
+#include <expfld.hxx>
+#include <dbfld.hxx>
+#include <flddat.hxx>
+#include <chpfld.hxx>
+#include <reffld.hxx>
+#include <flddropdown.hxx>
+#include <dbmgr.hxx>
+#include <section.hxx>
+#include <cellatr.hxx>
+#include <docary.hxx>
+#include <authfld.hxx>
+#include <txtinet.hxx>
+#include <fmtcntnt.hxx>
+#include <poolfmt.hrc> // fuer InitFldTypes
+
+#include <SwUndoField.hxx>
+#include "switerator.hxx"
+
+using namespace ::com::sun::star::uno;
+
+extern sal_Bool IsFrameBehind( const SwTxtNode& rMyNd, sal_uInt16 nMySttPos,
+ const SwTxtNode& rBehindNd, sal_uInt16 nSttPos );
+
+SV_IMPL_OP_PTRARR_SORT( _SetGetExpFlds, _SetGetExpFldPtr )
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen einfuegen
+ --------------------------------------------------------------------*/
+/*
+ * Implementierung der Feldfunktionen am Doc
+ * Return immer einen gueltigen Pointer auf den Typ. Wenn er also neu
+ * zugefuegt oder schon vorhanden ist.
+ */
+
+SwFieldType* SwDoc::InsertFldType(const SwFieldType &rFldTyp)
+{
+ sal_uInt16 nSize = pFldTypes->Count(),
+ nFldWhich = rFldTyp.Which();
+
+ sal_uInt16 i = INIT_FLDTYPES;
+
+ switch( nFldWhich )
+ {
+ case RES_SETEXPFLD:
+ //JP 29.01.96: SequenceFelder beginnen aber bei INIT_FLDTYPES - 3!!
+ // Sonst gibt es doppelte Nummernkreise!!
+ //MIB 14.03.95: Ab sofort verlaesst sich auch der SW3-Reader
+ //beim Aufbau der String-Pools und beim Einlesen von SetExp-Feldern
+ //hierauf
+ if( nsSwGetSetExpType::GSE_SEQ & ((SwSetExpFieldType&)rFldTyp).GetType() )
+ i -= INIT_SEQ_FLDTYPES;
+ // kein break;
+ case RES_DBFLD:
+ case RES_USERFLD:
+ case RES_DDEFLD:
+ {
+ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+ String sFldNm( rFldTyp.GetName() );
+ for( ; i < nSize; ++i )
+ if( nFldWhich == (*pFldTypes)[i]->Which() &&
+ rSCmp.isEqual( sFldNm, (*pFldTypes)[i]->GetName() ))
+ return (*pFldTypes)[i];
+ }
+ break;
+
+ case RES_AUTHORITY:
+ for( ; i < nSize; ++i )
+ if( nFldWhich == (*pFldTypes)[i]->Which() )
+ return (*pFldTypes)[i];
+ break;
+
+ default:
+ for( i = 0; i < nSize; ++i )
+ if( nFldWhich == (*pFldTypes)[i]->Which() )
+ return (*pFldTypes)[i];
+ }
+
+ SwFieldType* pNew = rFldTyp.Copy();
+ switch( nFldWhich )
+ {
+ case RES_DDEFLD:
+ ((SwDDEFieldType*)pNew)->SetDoc( this );
+ break;
+
+ case RES_DBFLD:
+ case RES_TABLEFLD:
+ case RES_DATETIMEFLD:
+ case RES_GETEXPFLD:
+ ((SwValueFieldType*)pNew)->SetDoc( this );
+ break;
+
+ case RES_USERFLD:
+ case RES_SETEXPFLD:
+ ((SwValueFieldType*)pNew)->SetDoc( this );
+ // JP 29.07.96: opt. FeldListe fuer den Calculator vorbereiten:
+ pUpdtFlds->InsertFldType( *pNew );
+ break;
+ case RES_AUTHORITY :
+ ((SwAuthorityFieldType*)pNew)->SetDoc( this );
+ break;
+ }
+
+ pFldTypes->Insert( pNew, nSize );
+ SetModified();
+
+ return (*pFldTypes)[ nSize ];
+}
+
+void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp )
+{
+ // der FeldTyp wurde als geloescht gekennzeichnet und aus dem
+ // Array entfernt. Nun muss man nach diesem wieder suchen.
+ // - Ist der nicht vorhanden, dann kann er eingefuegt werden.
+ // - Wird genau der gleiche Typ gefunden, dann muss der geloeschte
+ // einen anderen Namen erhalten.
+
+ sal_uInt16 nSize = pFldTypes->Count(), nFldWhich = rFldTyp.Which();
+ sal_uInt16 i = INIT_FLDTYPES;
+
+ ASSERT( RES_SETEXPFLD == nFldWhich ||
+ RES_USERFLD == nFldWhich ||
+ RES_DDEFLD == nFldWhich, "Falscher FeldTyp" );
+
+ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+ const String& rFldNm = rFldTyp.GetName();
+ SwFieldType* pFnd;
+
+ for( ; i < nSize; ++i )
+ if( nFldWhich == (pFnd = (*pFldTypes)[i])->Which() &&
+ rSCmp.isEqual( rFldNm, pFnd->GetName() ) )
+ {
+ // neuen Namen suchen
+ sal_uInt16 nNum = 1;
+ do {
+ String sSrch( rFldNm );
+ sSrch.Append( String::CreateFromInt32( nNum ));
+ for( i = INIT_FLDTYPES; i < nSize; ++i )
+ if( nFldWhich == (pFnd = (*pFldTypes)[i])->Which() &&
+ rSCmp.isEqual( sSrch, pFnd->GetName() ) )
+ break;
+
+ if( i >= nSize ) // nicht gefunden
+ {
+ ((String&)rFldNm) = sSrch;
+ break; // raus aus der While-Schleife
+ }
+ ++nNum;
+ } while( sal_True );
+ break;
+ }
+
+ // nicht gefunden, also eintragen und Flag loeschen
+ pFldTypes->Insert( &rFldTyp, nSize );
+ switch( nFldWhich )
+ {
+ case RES_SETEXPFLD:
+ ((SwSetExpFieldType&)rFldTyp).SetDeleted( sal_False );
+ break;
+ case RES_USERFLD:
+ ((SwUserFieldType&)rFldTyp).SetDeleted( sal_False );
+ break;
+ case RES_DDEFLD:
+ ((SwDDEFieldType&)rFldTyp).SetDeleted( sal_False );
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen loeschen
+ --------------------------------------------------------------------*/
+
+void SwDoc::RemoveFldType(sal_uInt16 nFld)
+{
+ ASSERT( INIT_FLDTYPES <= nFld, "keine InitFields loeschen" );
+ /*
+ * Abheangige Felder vorhanden -> ErrRaise
+ */
+ sal_uInt16 nSize = pFldTypes->Count();
+ if(nFld < nSize)
+ {
+ SwFieldType* pTmp = (*pFldTypes)[nFld];
+
+ // JP 29.07.96: opt. FeldListe fuer den Calculator vorbereiten:
+ sal_uInt16 nWhich = pTmp->Which();
+ switch( nWhich )
+ {
+ case RES_SETEXPFLD:
+ case RES_USERFLD:
+ pUpdtFlds->RemoveFldType( *pTmp );
+ // kein break;
+ case RES_DDEFLD:
+ if( pTmp->GetDepends() && !IsUsed( *pTmp ) )
+ {
+ if( RES_SETEXPFLD == nWhich )
+ ((SwSetExpFieldType*)pTmp)->SetDeleted( sal_True );
+ else if( RES_USERFLD == nWhich )
+ ((SwUserFieldType*)pTmp)->SetDeleted( sal_True );
+ else
+ ((SwDDEFieldType*)pTmp)->SetDeleted( sal_True );
+ nWhich = 0;
+ }
+ break;
+ }
+
+ if( nWhich )
+ {
+ ASSERT( !pTmp->GetDepends(), "Abhaengige vorh.!" );
+ // Feldtype loschen
+ delete pTmp;
+ }
+ pFldTypes->Remove( nFld );
+ SetModified();
+ }
+}
+
+const SwFldTypes* SwDoc::GetFldTypes() const
+{
+ return pFldTypes;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Den ersten Typen mit ResId und Namen finden
+ --------------------------------------------------------------------*/
+
+SwFieldType* SwDoc::GetFldType( sal_uInt16 nResId, const String& rName,
+ bool bDbFieldMatching // used in some UNO calls for RES_DBFLD
+ // to use different string matching code
+ // #i51815#
+ ) const
+{
+ sal_uInt16 nSize = pFldTypes->Count(), i = 0;
+ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+
+ switch( nResId )
+ {
+ case RES_SETEXPFLD:
+ //JP 29.01.96: SequenceFelder beginnen aber bei INIT_FLDTYPES - 3!!
+ // Sonst gibt es doppelte Nummernkreise!!
+ //MIB 14.03.95: Ab sofort verlaesst sich auch der SW3-Reader
+ //beim Aufbau der String-Pools und beim Einlesen von SetExp-Feldern
+ //hierauf
+ i = INIT_FLDTYPES - INIT_SEQ_FLDTYPES;
+ break;
+
+ case RES_DBFLD:
+ case RES_USERFLD:
+ case RES_DDEFLD:
+ case RES_AUTHORITY:
+ i = INIT_FLDTYPES;
+ break;
+ }
+
+ SwFieldType* pRet = 0;
+ for( ; i < nSize; ++i )
+ {
+ SwFieldType* pFldType = (*pFldTypes)[i];
+
+ String aFldName( pFldType->GetName() );
+ if (bDbFieldMatching && nResId == RES_DBFLD) // #i51815#
+ aFldName.SearchAndReplaceAll(DB_DELIM, '.');
+
+ if( nResId == pFldType->Which() &&
+ rSCmp.isEqual( rName, aFldName ))
+ {
+ pRet = pFldType;
+ break;
+ }
+ }
+ return pRet;
+}
+
+
+/*************************************************************************
+|* SwDoc::UpdateFlds()
+|* Beschreibung Felder updaten
+*************************************************************************/
+/*
+ * Alle sollen neu evaluiert werden.
+ */
+
+void SwDoc::UpdateFlds( SfxPoolItem *pNewHt, bool bCloseDB )
+{
+ // Modify() fuer jeden Feldtypen rufen,
+ // abhaengige SwTxtFld werden benachrichtigt ...
+
+ for( sal_uInt16 i=0; i < pFldTypes->Count(); ++i)
+ {
+ switch( (*pFldTypes)[i]->Which() )
+ {
+ // Tabellen-Felder als vorletztes Updaten
+ // Referenzen als letztes Updaten
+ case RES_GETREFFLD:
+ case RES_TABLEFLD:
+ case RES_DBFLD:
+ case RES_JUMPEDITFLD:
+ case RES_REFPAGESETFLD: // werden nie expandiert!
+ break;
+
+ case RES_DDEFLD:
+ {
+ if( !pNewHt )
+ {
+ SwMsgPoolItem aUpdateDDE( RES_UPDATEDDETBL );
+ (*pFldTypes)[i]->ModifyNotification( 0, &aUpdateDDE );
+ }
+ else
+ (*pFldTypes)[i]->ModifyNotification( 0, pNewHt );
+ break;
+ }
+ case RES_GETEXPFLD:
+ case RES_SETEXPFLD:
+ case RES_HIDDENTXTFLD:
+ case RES_HIDDENPARAFLD:
+ // Expression-Felder werden gesondert behandelt
+ if( !pNewHt )
+ break;
+ default:
+ (*pFldTypes)[i]->ModifyNotification ( 0, pNewHt );
+ }
+ }
+
+ if( !IsExpFldsLocked() )
+ UpdateExpFlds( 0, sal_False ); // Expression-Felder Updaten
+
+ // Tabellen
+ UpdateTblFlds(pNewHt);
+
+ // Referenzen
+ UpdateRefFlds(pNewHt);
+
+ if( bCloseDB )
+ GetNewDBMgr()->CloseAll();
+
+ // Nur bei KomplettUpdate evaluieren
+ SetModified();
+}
+
+/******************************************************************************
+ * void SwDoc::UpdateUsrFlds()
+ ******************************************************************************/
+
+void SwDoc::UpdateUsrFlds()
+{
+ SwCalc* pCalc = 0;
+ const SwFieldType* pFldType;
+ for( sal_uInt16 i = INIT_FLDTYPES; i < pFldTypes->Count(); ++i )
+ if( RES_USERFLD == ( pFldType = (*pFldTypes)[i] )->Which() )
+ {
+ if( !pCalc )
+ pCalc = new SwCalc( *this );
+ ((SwUserFieldType*)pFldType)->GetValue( *pCalc );
+ }
+
+ if( pCalc )
+ {
+ delete pCalc;
+ SetModified();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Referenzfelder und TableFelder erneuern
+ --------------------------------------------------------------------*/
+
+void SwDoc::UpdateRefFlds( SfxPoolItem* pHt )
+{
+ SwFieldType* pFldType;
+ for( sal_uInt16 i = 0; i < pFldTypes->Count(); ++i )
+ if( RES_GETREFFLD == ( pFldType = (*pFldTypes)[i] )->Which() )
+ pFldType->ModifyNotification( 0, pHt );
+}
+
+void SwDoc::UpdateTblFlds( SfxPoolItem* pHt )
+{
+ ASSERT( !pHt || RES_TABLEFML_UPDATE == pHt->Which(),
+ "Was ist das fuer ein MessageItem?" );
+
+ SwFieldType* pFldType(0);
+
+ for (sal_uInt16 i = 0; i < pFldTypes->Count(); ++i)
+ {
+ if( RES_TABLEFLD == ( pFldType = (*pFldTypes)[i] )->Which() )
+ {
+ SwTableFmlUpdate* pUpdtFld = 0;
+ if( pHt && RES_TABLEFML_UPDATE == pHt->Which() )
+ pUpdtFld = (SwTableFmlUpdate*)pHt;
+
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType );
+ for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
+ {
+ if( pFmtFld->GetTxtFld() )
+ {
+ SwTblField* pFld = (SwTblField*)pFmtFld->GetFld();
+
+ if( pUpdtFld )
+ {
+ // bestimme Tabelle, in der das Feld steht
+ const SwTableNode* pTblNd;
+ const SwTxtNode& rTxtNd = pFmtFld->GetTxtFld()->GetTxtNode();
+ if( !rTxtNd.GetNodes().IsDocNodes() ||
+ 0 == ( pTblNd = rTxtNd.FindTableNode() ) )
+ continue;
+
+ switch( pUpdtFld->eFlags )
+ {
+ case TBL_CALC:
+ // setze das Value-Flag zurueck
+ // JP 17.06.96: interne Darstellung auf alle Formeln
+ // (Referenzen auf andere Tabellen!!!)
+ if( nsSwExtendedSubType::SUB_CMD & pFld->GetSubType() )
+ pFld->PtrToBoxNm( pUpdtFld->pTbl );
+ else
+ pFld->ChgValid( sal_False );
+ break;
+ case TBL_BOXNAME:
+ // ist es die gesuchte Tabelle ??
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ // zur externen Darstellung
+ pFld->PtrToBoxNm( pUpdtFld->pTbl );
+ break;
+ case TBL_BOXPTR:
+ // zur internen Darstellung
+ // JP 17.06.96: interne Darstellung auf alle Formeln
+ // (Referenzen auf andere Tabellen!!!)
+ pFld->BoxNmToPtr( pUpdtFld->pTbl );
+ break;
+ case TBL_RELBOXNAME:
+ // ist es die gesuchte Tabelle ??
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ // zur relativen Darstellung
+ pFld->ToRelBoxNm( pUpdtFld->pTbl );
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ // setze bei allen das Value-Flag zurueck
+ pFld->ChgValid( sal_False );
+ }
+ }
+
+ break;
+ }
+ pFldType = 0;
+ }
+
+ // und dann noch alle Tabellen Box Formeln abklappern
+ const SfxPoolItem* pItem;
+ sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA );
+ for (sal_uInt32 i = 0; i < nMaxItems; ++i)
+ {
+ if( 0 != (pItem = GetAttrPool().GetItem2( RES_BOXATR_FORMULA, i ) ) &&
+ ((SwTblBoxFormula*)pItem)->GetDefinedIn() )
+ {
+ ((SwTblBoxFormula*)pItem)->ChangeState( pHt );
+ }
+ }
+
+
+ // alle Felder/Boxen sind jetzt invalide, also kann das Rechnen anfangen
+ if( pHt && ( RES_TABLEFML_UPDATE != pHt->Which() ||
+ TBL_CALC != ((SwTableFmlUpdate*)pHt)->eFlags ))
+ return ;
+
+ SwCalc* pCalc = 0;
+
+ if( pFldType )
+ {
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType );
+ for( SwFmtFld* pFmtFld = aIter.Last(); pFmtFld; pFmtFld = aIter.Previous() )
+ {
+ // start calculation at the end
+ // new fields are inserted at the beginning of the modify chain
+ // that gives faster calculation on import
+ // mba: do we really need this "optimization"? Is it still valid?
+ SwTblField* pFld;
+ if( !pFmtFld->GetTxtFld() || (nsSwExtendedSubType::SUB_CMD &
+ (pFld = (SwTblField*)pFmtFld->GetFld())->GetSubType() ))
+ continue;
+
+ // muss neu berechnet werden (und ist keine textuelle Anzeige)
+ if( !pFld->IsValid() )
+ {
+ // bestimme Tabelle, in der das Feld steht
+ const SwTxtNode& rTxtNd = pFmtFld->GetTxtFld()->GetTxtNode();
+ if( !rTxtNd.GetNodes().IsDocNodes() )
+ continue;
+ const SwTableNode* pTblNd = rTxtNd.FindTableNode();
+ if( !pTblNd )
+ continue;
+
+ // falls dieses Feld nicht in der zu updatenden
+ // Tabelle steht, ueberspringen !!
+ if( pHt && &pTblNd->GetTable() !=
+ ((SwTableFmlUpdate*)pHt)->pTbl )
+ continue;
+
+ if( !pCalc )
+ pCalc = new SwCalc( *this );
+
+ // bestimme die Werte aller SetExpresion Felder, die
+ // bis zur Tabelle gueltig sind
+ SwFrm* pFrm = 0;
+ if( pTblNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
+ {
+ // steht im Sonderbereich, wird teuer !!
+ Point aPt; // den im Layout 1. Frame returnen - Tab.Kopfzeile !!
+ pFrm = rTxtNd.getLayoutFrm( GetCurrentLayout(), &aPt );
+ if( pFrm )
+ {
+ SwPosition aPos( *pTblNd );
+ if( GetBodyTxtNode( *this, aPos, *pFrm ) )
+ FldsToCalc( *pCalc, _SetGetExpFld(
+ aPos.nNode, pFmtFld->GetTxtFld(),
+ &aPos.nContent ));
+ else
+ pFrm = 0;
+ }
+ }
+ if( !pFrm )
+ {
+ // einen Index fuers bestimmen vom TextNode anlegen
+ SwNodeIndex aIdx( rTxtNd );
+ FldsToCalc( *pCalc,
+ _SetGetExpFld( aIdx, pFmtFld->GetTxtFld() ));
+ }
+
+ SwTblCalcPara aPara( *pCalc, pTblNd->GetTable() );
+ pFld->CalcField( aPara );
+ if( aPara.IsStackOverFlow() )
+ {
+ if( aPara.CalcWithStackOverflow() )
+ pFld->CalcField( aPara );
+#ifdef DBG_UTIL
+ else
+ {
+ // mind. ein ASSERT
+ ASSERT( !this, "die Kettenformel konnte nicht errechnet werden" );
+ }
+#endif
+ }
+ pCalc->SetCalcError( CALC_NOERR );
+ }
+ pFmtFld->ModifyNotification( 0, pHt );
+ }
+ }
+
+ // dann berechene noch die Formeln an den Boxen
+ for (sal_uInt32 i = 0; i < nMaxItems; ++i )
+ {
+ if( 0 != (pItem = GetAttrPool().GetItem2( RES_BOXATR_FORMULA, i ) ) &&
+ ((SwTblBoxFormula*)pItem)->GetDefinedIn() &&
+ !((SwTblBoxFormula*)pItem)->IsValid() )
+ {
+ SwTblBoxFormula* pFml = (SwTblBoxFormula*)pItem;
+ SwTableBox* pBox = pFml->GetTableBox();
+ if( pBox && pBox->GetSttNd() &&
+ pBox->GetSttNd()->GetNodes().IsDocNodes() )
+ {
+ const SwTableNode* pTblNd = pBox->GetSttNd()->FindTableNode();
+ if( !pHt || &pTblNd->GetTable() ==
+ ((SwTableFmlUpdate*)pHt)->pTbl )
+ {
+ double nValue;
+ if( !pCalc )
+ pCalc = new SwCalc( *this );
+
+ // bestimme die Werte aller SetExpresion Felder, die
+ // bis zur Tabelle gueltig sind
+ SwFrm* pFrm = 0;
+ if( pTblNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
+ {
+ // steht im Sonderbereich, wird teuer !!
+ Point aPt; // den im Layout 1. Frame returnen - Tab.Kopfzeile !!
+ SwNodeIndex aCNdIdx( *pTblNd, +2 );
+ SwCntntNode* pCNd = aCNdIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetNodes().GoNext( &aCNdIdx );
+
+ if( pCNd && 0 != (pFrm = pCNd->getLayoutFrm( GetCurrentLayout(), &aPt )) )
+ {
+ SwPosition aPos( *pCNd );
+ if( GetBodyTxtNode( *this, aPos, *pFrm ) )
+ FldsToCalc( *pCalc, _SetGetExpFld( aPos.nNode ));
+ else
+ pFrm = 0;
+ }
+ }
+ if( !pFrm )
+ {
+ // einen Index fuers bestimmen vom TextNode anlegen
+ SwNodeIndex aIdx( *pTblNd );
+ FldsToCalc( *pCalc, _SetGetExpFld( aIdx ));
+ }
+
+ SwTblCalcPara aPara( *pCalc, pTblNd->GetTable() );
+ pFml->Calc( aPara, nValue );
+
+ if( aPara.IsStackOverFlow() )
+ {
+ if( aPara.CalcWithStackOverflow() )
+ pFml->Calc( aPara, nValue );
+#ifdef DBG_UTIL
+ else
+ {
+ // mind. ein ASSERT
+ ASSERT( !this, "die Kettenformel konnte nicht errechnet werden" );
+ }
+#endif
+ }
+
+ SwFrmFmt* pFmt = pBox->ClaimFrmFmt();
+ SfxItemSet aTmp( GetAttrPool(),
+ RES_BOXATR_BEGIN,RES_BOXATR_END-1 );
+
+ if( pCalc->IsCalcError() )
+ nValue = DBL_MAX;
+ aTmp.Put( SwTblBoxValue( nValue ));
+ if( SFX_ITEM_SET != pFmt->GetItemState( RES_BOXATR_FORMAT ))
+ aTmp.Put( SwTblBoxNumFormat( 0 ));
+ pFmt->SetFmtAttr( aTmp );
+
+ pCalc->SetCalcError( CALC_NOERR );
+ }
+ }
+ }
+ }
+
+ if( pCalc )
+ delete pCalc;
+}
+
+void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt )
+{
+ SwFieldType* pFldType;
+ for( sal_uInt16 i = 0; i < INIT_FLDTYPES; ++i )
+ switch( ( pFldType = (*pFldTypes)[ i ] )->Which() )
+ {
+ case RES_PAGENUMBERFLD:
+ case RES_CHAPTERFLD:
+ case RES_GETEXPFLD:
+ case RES_REFPAGEGETFLD:
+ pFldType->ModifyNotification( 0, pMsgHnt );
+ break;
+ case RES_DOCSTATFLD:
+ pFldType->ModifyNotification( 0, 0 );
+ break;
+ }
+ SetNewFldLst(true);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+// ---- Loesche alle nicht referenzierten FeldTypen eines Dokumentes --
+void SwDoc::GCFieldTypes()
+{
+ for( sal_uInt16 n = pFldTypes->Count(); n > INIT_FLDTYPES; )
+ if( !(*pFldTypes)[ --n ]->GetDepends() )
+ RemoveFldType( n );
+}
+
+void SwDoc::LockExpFlds()
+{
+ ++nLockExpFld;
+}
+
+void SwDoc::UnlockExpFlds()
+{
+ if( nLockExpFld )
+ --nLockExpFld;
+}
+
+bool SwDoc::IsExpFldsLocked() const
+{
+ return 0 != nLockExpFld;
+}
+
+SwDocUpdtFld& SwDoc::GetUpdtFlds() const
+{
+ return *pUpdtFlds;
+}
+
+bool SwDoc::IsNewFldLst() const
+{
+ return mbNewFldLst;
+}
+
+void SwDoc::SetNewFldLst(bool bFlag)
+{
+ mbNewFldLst = bFlag;
+}
+
+
+//----------------------------------------------------------------------
+
+// der StartIndex kann optional mit angegeben werden (z.B. wenn dieser
+// zuvor schon mal erfragt wurde - ist sonst eine virtuelle Methode !!)
+
+_SetGetExpFld::_SetGetExpFld( const SwNodeIndex& rNdIdx, const SwTxtFld* pFld,
+ const SwIndex* pIdx )
+{
+ eSetGetExpFldType = TEXTFIELD;
+ CNTNT.pTxtFld = pFld;
+ nNode = rNdIdx.GetIndex();
+ if( pIdx )
+ nCntnt = pIdx->GetIndex();
+ else if( pFld )
+ nCntnt = *pFld->GetStart();
+ else
+ nCntnt = 0;
+}
+
+_SetGetExpFld::_SetGetExpFld( const SwNodeIndex& rNdIdx,
+ const SwTxtINetFmt& rINet, const SwIndex* pIdx )
+{
+ eSetGetExpFldType = TEXTINET;
+ CNTNT.pTxtINet = &rINet;
+ nNode = rNdIdx.GetIndex();
+ if( pIdx )
+ nCntnt = pIdx->GetIndex();
+ else
+ nCntnt = *rINet.GetStart();
+}
+
+ //Erweiterung fuer Sections:
+ // diese haben immer als Content-Position 0xffff !!
+ // Auf dieser steht nie ein Feld, maximal bis STRING_MAXLEN moeglich
+_SetGetExpFld::_SetGetExpFld( const SwSectionNode& rSectNd,
+ const SwPosition* pPos )
+{
+ eSetGetExpFldType = SECTIONNODE;
+ CNTNT.pSection = &rSectNd.GetSection();
+
+ if( pPos )
+ {
+ nNode = pPos->nNode.GetIndex();
+ nCntnt = pPos->nContent.GetIndex();
+ }
+ else
+ {
+ nNode = rSectNd.GetIndex();
+ nCntnt = 0;
+ }
+}
+
+_SetGetExpFld::_SetGetExpFld( const SwTableBox& rTBox, const SwPosition* pPos )
+{
+ eSetGetExpFldType = TABLEBOX;
+ CNTNT.pTBox = &rTBox;
+
+ if( pPos )
+ {
+ nNode = pPos->nNode.GetIndex();
+ nCntnt = pPos->nContent.GetIndex();
+ }
+ else
+ {
+ nNode = 0;
+ nCntnt = 0;
+ if( rTBox.GetSttNd() )
+ {
+ SwNodeIndex aIdx( *rTBox.GetSttNd() );
+ const SwCntntNode* pNd = aIdx.GetNode().GetNodes().GoNext( &aIdx );
+ if( pNd )
+ nNode = pNd->GetIndex();
+ }
+ }
+}
+
+_SetGetExpFld::_SetGetExpFld( const SwNodeIndex& rNdIdx,
+ const SwTxtTOXMark& rTOX,
+ const SwIndex* pIdx )
+{
+ eSetGetExpFldType = TEXTTOXMARK;
+ CNTNT.pTxtTOX = &rTOX;
+ nNode = rNdIdx.GetIndex();
+ if( pIdx )
+ nCntnt = pIdx->GetIndex();
+ else
+ nCntnt = *rTOX.GetStart();
+}
+
+_SetGetExpFld::_SetGetExpFld( const SwPosition& rPos )
+{
+ eSetGetExpFldType = CRSRPOS;
+ CNTNT.pPos = &rPos;
+ nNode = rPos.nNode.GetIndex();
+ nCntnt = rPos.nContent.GetIndex();
+}
+
+_SetGetExpFld::_SetGetExpFld( const SwFlyFrmFmt& rFlyFmt,
+ const SwPosition* pPos )
+{
+ eSetGetExpFldType = FLYFRAME;
+ CNTNT.pFlyFmt = &rFlyFmt;
+ if( pPos )
+ {
+ nNode = pPos->nNode.GetIndex();
+ nCntnt = pPos->nContent.GetIndex();
+ }
+ else
+ {
+ const SwFmtCntnt& rCntnt = rFlyFmt.GetCntnt();
+ nNode = rCntnt.GetCntntIdx()->GetIndex() + 1;
+ nCntnt = 0;
+ }
+}
+
+void _SetGetExpFld::GetPos( SwPosition& rPos ) const
+{
+ rPos.nNode = nNode;
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), nCntnt );
+}
+
+void _SetGetExpFld::GetPosOfContent( SwPosition& rPos ) const
+{
+ const SwNode* pNd = GetNodeFromCntnt();
+ if( pNd )
+ pNd = pNd->GetCntntNode();
+
+ if( pNd )
+ {
+ rPos.nNode = *pNd;
+ rPos.nContent.Assign( (SwCntntNode*)pNd,GetCntPosFromCntnt() );
+ }
+ else
+ {
+ rPos.nNode = nNode;
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), nCntnt );
+ }
+}
+
+void _SetGetExpFld::SetBodyPos( const SwCntntFrm& rFrm )
+{
+ if( !rFrm.IsInDocBody() )
+ {
+ SwNodeIndex aIdx( *rFrm.GetNode() );
+ SwDoc& rDoc = *aIdx.GetNodes().GetDoc();
+ SwPosition aPos( aIdx );
+#ifdef DBG_UTIL
+ ASSERT( ::GetBodyTxtNode( rDoc, aPos, rFrm ), "wo steht das Feld" );
+#else
+ ::GetBodyTxtNode( rDoc, aPos, rFrm );
+#endif
+ nNode = aPos.nNode.GetIndex();
+ nCntnt = aPos.nContent.GetIndex();
+ }
+}
+
+sal_Bool _SetGetExpFld::operator<( const _SetGetExpFld& rFld ) const
+{
+ if( nNode < rFld.nNode || ( nNode == rFld.nNode && nCntnt < rFld.nCntnt ))
+ return sal_True;
+ else if( nNode != rFld.nNode || nCntnt != rFld.nCntnt )
+ return sal_False;
+
+ const SwNode *pFirst = GetNodeFromCntnt(),
+ *pNext = rFld.GetNodeFromCntnt();
+
+ // Position gleich: nur weiter wenn beide FeldPointer besetzt sind !!
+ if( !pFirst || !pNext )
+ return sal_False;
+
+ // gleiche Section ??
+ if( pFirst->StartOfSectionNode() != pNext->StartOfSectionNode() )
+ {
+ // sollte einer in der Tabelle stehen ?
+ const SwNode *pFirstStt, *pNextStt;
+ const SwTableNode* pTblNd = pFirst->FindTableNode();
+ if( pTblNd )
+ pFirstStt = pTblNd->StartOfSectionNode();
+ else
+ pFirstStt = pFirst->StartOfSectionNode();
+
+ if( 0 != ( pTblNd = pNext->FindTableNode() ) )
+ pNextStt = pTblNd->StartOfSectionNode();
+ else
+ pNextStt = pNext->StartOfSectionNode();
+
+ if( pFirstStt != pNextStt )
+ {
+ if( pFirst->IsTxtNode() && pNext->IsTxtNode() &&
+ ( pFirst->FindFlyStartNode() || pNext->FindFlyStartNode() ))
+ {
+ return ::IsFrameBehind( *(SwTxtNode*)pNext, nCntnt,
+ *(SwTxtNode*)pFirst, nCntnt );
+ }
+ return pFirstStt->GetIndex() < pNextStt->GetIndex();
+ }
+ }
+
+ // ist gleiche Section, dann Feld im gleichen Node ?
+ if( pFirst != pNext )
+ return pFirst->GetIndex() < pNext->GetIndex();
+
+ // gleicher Node in der Section, dann Position im Node
+ return GetCntPosFromCntnt() < rFld.GetCntPosFromCntnt();
+}
+
+const SwNode* _SetGetExpFld::GetNodeFromCntnt() const
+{
+ const SwNode* pRet = 0;
+ if( CNTNT.pTxtFld )
+ switch( eSetGetExpFldType )
+ {
+ case TEXTFIELD:
+ pRet = &CNTNT.pTxtFld->GetTxtNode();
+ break;
+
+ case TEXTINET:
+ pRet = &CNTNT.pTxtINet->GetTxtNode();
+ break;
+
+ case SECTIONNODE:
+ pRet = CNTNT.pSection->GetFmt()->GetSectionNode();
+ break;
+
+ case CRSRPOS:
+ pRet = &CNTNT.pPos->nNode.GetNode();
+ break;
+
+ case TEXTTOXMARK:
+ pRet = &CNTNT.pTxtTOX->GetTxtNode();
+ break;
+
+ case TABLEBOX:
+ if( CNTNT.pTBox->GetSttNd() )
+ {
+ SwNodeIndex aIdx( *CNTNT.pTBox->GetSttNd() );
+ pRet = aIdx.GetNode().GetNodes().GoNext( &aIdx );
+ }
+ break;
+
+ case FLYFRAME:
+ {
+ SwNodeIndex aIdx( *CNTNT.pFlyFmt->GetCntnt().GetCntntIdx() );
+ pRet = aIdx.GetNode().GetNodes().GoNext( &aIdx );
+ }
+ break;
+ }
+ return pRet;
+}
+
+xub_StrLen _SetGetExpFld::GetCntPosFromCntnt() const
+{
+ sal_uInt16 nRet = 0;
+ if( CNTNT.pTxtFld )
+ switch( eSetGetExpFldType )
+ {
+ case TEXTFIELD:
+ case TEXTINET:
+ case TEXTTOXMARK:
+ nRet = *CNTNT.pTxtFld->GetStart();
+ break;
+ case CRSRPOS:
+ nRet = CNTNT.pPos->nContent.GetIndex();
+ break;
+ default:
+ break;
+ }
+ return nRet;
+}
+
+_HashStr::_HashStr( const String& rName, const String& rText,
+ _HashStr* pNxt )
+ : SwHash( rName ), aSetStr( rText )
+{
+ pNext = pNxt;
+}
+
+// suche nach dem Namen, ist er vorhanden, returne seinen String, sonst
+// einen LeerString
+void LookString( SwHash** ppTbl, sal_uInt16 nSize, const String& rName,
+ String& rRet, sal_uInt16* pPos )
+{
+ rRet = rName;
+ rRet.EraseLeadingChars().EraseTrailingChars();
+ SwHash* pFnd = Find( rRet, ppTbl, nSize, pPos );
+ if( pFnd )
+ rRet = ((_HashStr*)pFnd)->aSetStr;
+ else
+ rRet.Erase();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+String lcl_GetDBVarName( SwDoc& rDoc, SwDBNameInfField& rDBFld )
+{
+ SwDBData aDBData( rDBFld.GetDBData( &rDoc ));
+ String sDBNumNm;
+ SwDBData aDocData = rDoc.GetDBData();
+
+ if( aDBData != aDocData )
+ {
+ sDBNumNm = aDBData.sDataSource;
+ sDBNumNm += DB_DELIM;
+ sDBNumNm += String(aDBData.sCommand);
+ sDBNumNm += DB_DELIM;
+ }
+ sDBNumNm += SwFieldType::GetTypeStr(TYP_DBSETNUMBERFLD);
+
+ return sDBNumNm;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void lcl_CalcFld( SwDoc& rDoc, SwCalc& rCalc, const _SetGetExpFld& rSGEFld,
+ SwNewDBMgr* pMgr )
+{
+ const SwTxtFld* pTxtFld = rSGEFld.GetFld();
+ if( !pTxtFld )
+ return ;
+
+ const SwField* pFld = pTxtFld->GetFld().GetFld();
+ const sal_uInt16 nFldWhich = pFld->GetTyp()->Which();
+
+ if( RES_SETEXPFLD == nFldWhich )
+ {
+ SwSbxValue aValue;
+ if( nsSwGetSetExpType::GSE_EXPR & pFld->GetSubType() )
+ aValue.PutDouble( ((SwSetExpField*)pFld)->GetValue() );
+ else
+ // Erweiterung fuers Rechnen mit Strings
+ aValue.PutString( ((SwSetExpField*)pFld)->GetExpStr() );
+
+ // setze im Calculator den neuen Wert
+ rCalc.VarChange( pFld->GetTyp()->GetName(), aValue );
+ }
+ else if( pMgr )
+ {
+ switch( nFldWhich )
+ {
+ case RES_DBNUMSETFLD:
+ {
+ SwDBNumSetField* pDBFld = (SwDBNumSetField*)pFld;
+
+ SwDBData aDBData(pDBFld->GetDBData(&rDoc));
+
+ if( pDBFld->IsCondValid() &&
+ pMgr->OpenDataSource( aDBData.sDataSource, aDBData.sCommand ))
+ rCalc.VarChange( lcl_GetDBVarName( rDoc, *pDBFld),
+ pDBFld->GetFormat() );
+ }
+ break;
+ case RES_DBNEXTSETFLD:
+ {
+ SwDBNextSetField* pDBFld = (SwDBNextSetField*)pFld;
+ SwDBData aDBData(pDBFld->GetDBData(&rDoc));
+ if( !pDBFld->IsCondValid() ||
+ !pMgr->OpenDataSource( aDBData.sDataSource, aDBData.sCommand ))
+ break;
+
+ String sDBNumNm(lcl_GetDBVarName( rDoc, *pDBFld));
+ SwCalcExp* pExp = rCalc.VarLook( sDBNumNm );
+ if( pExp )
+ rCalc.VarChange( sDBNumNm, pExp->nValue.GetLong() + 1 );
+ }
+ break;
+
+ }
+ }
+}
+
+void SwDoc::FldsToCalc( SwCalc& rCalc, const _SetGetExpFld& rToThisFld )
+{
+ // erzeuge die Sortierteliste aller SetFelder
+ pUpdtFlds->MakeFldList( *this, mbNewFldLst, GETFLD_CALC );
+ mbNewFldLst = sal_False;
+
+ SwNewDBMgr* pMgr = GetNewDBMgr();
+ pMgr->CloseAll(sal_False);
+
+ if( pUpdtFlds->GetSortLst()->Count() )
+ {
+ sal_uInt16 nLast;
+ _SetGetExpFld* pFld = (_SetGetExpFld*)&rToThisFld;
+ if( pUpdtFlds->GetSortLst()->Seek_Entry( pFld, &nLast ) )
+ ++nLast;
+
+ const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData();
+ for( sal_uInt16 n = 0; n < nLast; ++n, ++ppSortLst )
+ lcl_CalcFld( *this, rCalc, **ppSortLst, pMgr );
+ }
+
+ pMgr->CloseAll(sal_False);
+}
+
+void SwDoc::FldsToCalc( SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt )
+{
+ // erzeuge die Sortierteliste aller SetFelder
+ pUpdtFlds->MakeFldList( *this, mbNewFldLst, GETFLD_CALC );
+ mbNewFldLst = sal_False;
+
+ SwNewDBMgr* pMgr = GetNewDBMgr();
+ pMgr->CloseAll(sal_False);
+
+ const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData();
+
+ for( sal_uInt16 n = pUpdtFlds->GetSortLst()->Count();
+ n &&
+ ( (*ppSortLst)->GetNode() < nLastNd ||
+ ( (*ppSortLst)->GetNode() == nLastNd && (*ppSortLst)->GetCntnt() <= nLastCnt )
+ );
+ --n, ++ppSortLst )
+ lcl_CalcFld( *this, rCalc, **ppSortLst, pMgr );
+
+ pMgr->CloseAll(sal_False);
+}
+
+void SwDoc::FldsToExpand( SwHash**& ppHashTbl, sal_uInt16& rTblSize,
+ const _SetGetExpFld& rToThisFld )
+{
+ // erzeuge die Sortierteliste aller SetFelder
+ pUpdtFlds->MakeFldList( *this, mbNewFldLst, GETFLD_EXPAND );
+ mbNewFldLst = sal_False;
+
+ // HashTabelle fuer alle String Ersetzungen, wird "one the fly" gefuellt
+ // (versuche eine "ungerade"-Zahl zu erzeugen)
+ rTblSize = (( pUpdtFlds->GetSortLst()->Count() / 7 ) + 1 ) * 7;
+ ppHashTbl = new SwHash*[ rTblSize ];
+ memset( ppHashTbl, 0, sizeof( _HashStr* ) * rTblSize );
+
+ sal_uInt16 nLast;
+ {
+ _SetGetExpFld* pTmp = (_SetGetExpFld*)&rToThisFld;
+ if( pUpdtFlds->GetSortLst()->Seek_Entry( pTmp, &nLast ) )
+ ++nLast;
+ }
+
+ sal_uInt16 nPos;
+ SwHash* pFnd;
+ String aNew;
+ const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData();
+ for( ; nLast; --nLast, ++ppSortLst )
+ {
+ const SwTxtFld* pTxtFld = (*ppSortLst)->GetFld();
+ if( !pTxtFld )
+ continue;
+
+ const SwField* pFld = pTxtFld->GetFld().GetFld();
+ switch( pFld->GetTyp()->Which() )
+ {
+ case RES_SETEXPFLD:
+ if( nsSwGetSetExpType::GSE_STRING & pFld->GetSubType() )
+ {
+ // setze in der HashTabelle den neuen Wert
+ // ist die "Formel" ein Feld ??
+ SwSetExpField* pSFld = (SwSetExpField*)pFld;
+ LookString( ppHashTbl, rTblSize, pSFld->GetFormula(), aNew );
+
+ if( !aNew.Len() ) // nichts gefunden, dann ist
+ aNew = pSFld->GetFormula(); // die Formel der neue Wert
+
+ // OD 11.02.2003 #i3141# - update expression of field as in
+ // method <SwDoc::UpdateExpFlds(..)> for string/text fields
+ pSFld->ChgExpStr( aNew );
+
+ // suche den Namen vom Feld
+ aNew = ((SwSetExpFieldType*)pSFld->GetTyp())->GetSetRefName();
+ // Eintrag vorhanden ?
+ pFnd = Find( aNew, ppHashTbl, rTblSize, &nPos );
+ if( pFnd )
+ // Eintrag in der HashTabelle aendern
+ ((_HashStr*)pFnd)->aSetStr = pSFld->GetExpStr();
+ else
+ // neuen Eintrag einfuegen
+ *(ppHashTbl + nPos ) = new _HashStr( aNew,
+ pSFld->GetExpStr(), (_HashStr*)*(ppHashTbl + nPos) );
+ }
+ break;
+ case RES_DBFLD:
+ {
+ const String& rName = pFld->GetTyp()->GetName();
+
+ // Eintrag in den HashTable eintragen
+ // Eintrag vorhanden ?
+ pFnd = Find( rName, ppHashTbl, rTblSize, &nPos );
+ String const value(pFld->ExpandField(IsClipBoard()));
+ if( pFnd )
+ {
+ // Eintrag in der HashTabelle aendern
+ static_cast<_HashStr*>(pFnd)->aSetStr = value;
+ }
+ else
+ {
+ // neuen Eintrag einfuegen
+ *(ppHashTbl + nPos ) = new _HashStr( rName,
+ value, static_cast<_HashStr *>(*(ppHashTbl + nPos)));
+ }
+ }
+ break;
+ }
+ }
+}
+
+
+void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds )
+{
+ if( IsExpFldsLocked() || IsInReading() )
+ return;
+
+ sal_Bool bOldInUpdateFlds = pUpdtFlds->IsInUpdateFlds();
+ pUpdtFlds->SetInUpdateFlds( sal_True );
+
+ pUpdtFlds->MakeFldList( *this, sal_True, GETFLD_ALL );
+ mbNewFldLst = sal_False;
+
+ if( !pUpdtFlds->GetSortLst()->Count() )
+ {
+ if( bUpdRefFlds )
+ UpdateRefFlds(NULL);
+
+ pUpdtFlds->SetInUpdateFlds( bOldInUpdateFlds );
+ pUpdtFlds->SetFieldsDirty( sal_False );
+ return ;
+ }
+
+ sal_uInt16 nWhich, n;
+
+ // HashTabelle fuer alle String Ersetzungen, wird "one the fly" gefuellt
+ // (versuche eine "ungerade"-Zahl zu erzeugen)
+ sal_uInt16 nStrFmtCnt = (( pFldTypes->Count() / 7 ) + 1 ) * 7;
+ SwHash** pHashStrTbl = new SwHash*[ nStrFmtCnt ];
+ memset( pHashStrTbl, 0, sizeof( _HashStr* ) * nStrFmtCnt );
+
+ {
+ const SwFieldType* pFldType;
+ // gesondert behandeln:
+ for( n = pFldTypes->Count(); n; )
+ switch( ( pFldType = (*pFldTypes)[ --n ] )->Which() )
+ {
+ case RES_USERFLD:
+ {
+ // Eintrag vorhanden ?
+ sal_uInt16 nPos;
+ const String& rNm = pFldType->GetName();
+ String sExpand(((SwUserFieldType*)pFldType)->Expand(nsSwGetSetExpType::GSE_STRING, 0, 0));
+ SwHash* pFnd = Find( rNm, pHashStrTbl, nStrFmtCnt, &nPos );
+ if( pFnd )
+ // Eintrag in der HashTabelle aendern ??
+ ((_HashStr*)pFnd)->aSetStr = sExpand;
+ else
+ // neuen Eintrag einfuegen
+ *(pHashStrTbl + nPos ) = new _HashStr( rNm, sExpand,
+ (_HashStr*)*(pHashStrTbl + nPos) );
+ }
+ break;
+ case RES_SETEXPFLD:
+ ((SwSetExpFieldType*)pFldType)->SetOutlineChgNd( 0 );
+ break;
+ }
+ }
+
+ // Ok, das Array ist soweit mit allen Feldern gefuellt, dann rechne mal
+ SwCalc aCalc( *this );
+
+ String sDBNumNm( SwFieldType::GetTypeStr( TYP_DBSETNUMBERFLD ) );
+
+ // aktuelle Datensatznummer schon vorher einstellen
+ SwNewDBMgr* pMgr = GetNewDBMgr();
+ pMgr->CloseAll(sal_False);
+/*
+ if(pMgr && pMgr->OpenDB(DBMGR_STD, GetDBDesc(), sal_False))
+ {
+ if(!pMgr->IsInMerge() )
+ pMgr->ToFirstSelectedRecord(DBMGR_STD);
+
+ aCalc.VarChange( sDBNumNm, pMgr->GetCurSelectedRecordId(DBMGR_STD));
+ }
+*/
+
+ String aNew;
+ const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData();
+ for( n = pUpdtFlds->GetSortLst()->Count(); n; --n, ++ppSortLst )
+ {
+ SwSection* pSect = (SwSection*)(*ppSortLst)->GetSection();
+ if( pSect )
+ {
+ //!SECTION
+
+// if( pGFld->IsInBodyTxt() )
+ SwSbxValue aValue = aCalc.Calculate(
+ pSect->GetCondition() );
+ if(!aValue.IsVoidValue())
+ pSect->SetCondHidden( aValue.GetBool() );
+ continue;
+ }
+
+ SwTxtFld* pTxtFld = (SwTxtFld*)(*ppSortLst)->GetFld();
+ if( !pTxtFld )
+ {
+ ASSERT( !this, "was ist es denn nun" );
+ continue;
+ }
+
+ SwFmtFld* pFmtFld = (SwFmtFld*)&pTxtFld->GetFld();
+ SwField* pFld = pFmtFld->GetFld();
+
+ switch( nWhich = pFld->GetTyp()->Which() )
+ {
+ case RES_HIDDENTXTFLD:
+ {
+ SwHiddenTxtField* pHFld = (SwHiddenTxtField*)pFld;
+ SwSbxValue aValue = aCalc.Calculate( pHFld->GetPar1() );
+ sal_Bool bValue = !aValue.GetBool();
+ if(!aValue.IsVoidValue())
+ {
+ pHFld->SetValue( bValue );
+ // Feld Evaluieren
+ pHFld->Evaluate(this);
+ }
+ }
+ break;
+ case RES_HIDDENPARAFLD:
+ {
+ SwHiddenParaField* pHPFld = (SwHiddenParaField*)pFld;
+ SwSbxValue aValue = aCalc.Calculate( pHPFld->GetPar1() );
+ sal_Bool bValue = aValue.GetBool();
+ if(!aValue.IsVoidValue())
+ pHPFld->SetHidden( bValue );
+ }
+ break;
+ case RES_DBSETNUMBERFLD:
+ {
+ ((SwDBSetNumberField*)pFld)->Evaluate(this);
+ aCalc.VarChange( sDBNumNm, ((SwDBSetNumberField*)pFld)->GetSetNumber());
+ }
+ break;
+ case RES_DBNEXTSETFLD:
+ case RES_DBNUMSETFLD:
+ UpdateDBNumFlds( *(SwDBNameInfField*)pFld, aCalc );
+ break;
+ case RES_DBFLD:
+ {
+ // Feld Evaluieren
+ ((SwDBField*)pFld)->Evaluate();
+
+ SwDBData aTmpDBData(((SwDBField*)pFld)->GetDBData());
+
+ if( pMgr->IsDataSourceOpen(aTmpDBData.sDataSource, aTmpDBData.sCommand, sal_False))
+ aCalc.VarChange( sDBNumNm, pMgr->GetSelectedRecordId(aTmpDBData.sDataSource, aTmpDBData.sCommand, aTmpDBData.nCommandType));
+
+ const String& rName = pFld->GetTyp()->GetName();
+
+ // Wert fuer den Calculator setzen
+//JP 10.02.96: GetValue macht hier doch keinen Sinn
+// ((SwDBField*)pFld)->GetValue();
+
+//!OK aCalc.VarChange(aName, ((SwDBField*)pFld)->GetValue(aCalc));
+
+ // Eintrag in den HashTable eintragen
+ // Eintrag vorhanden ?
+ sal_uInt16 nPos;
+ SwHash* pFnd = Find( rName, pHashStrTbl, nStrFmtCnt, &nPos );
+ String const value(pFld->ExpandField(IsClipBoard()));
+ if( pFnd )
+ {
+ // Eintrag in der HashTabelle aendern
+ static_cast<_HashStr*>(pFnd)->aSetStr = value;
+ }
+ else
+ {
+ // neuen Eintrag einfuegen
+ *(pHashStrTbl + nPos ) = new _HashStr( rName,
+ value, static_cast<_HashStr *>(*(pHashStrTbl + nPos)));
+ }
+ }
+ break;
+ case RES_GETEXPFLD:
+ case RES_SETEXPFLD:
+ {
+ if( nsSwGetSetExpType::GSE_STRING & pFld->GetSubType() ) // String Ersetzung
+ {
+ if( RES_GETEXPFLD == nWhich )
+ {
+ SwGetExpField* pGFld = (SwGetExpField*)pFld;
+
+ if( (!pUpdtFld || pUpdtFld == pTxtFld )
+ && pGFld->IsInBodyTxt() )
+ {
+ LookString( pHashStrTbl, nStrFmtCnt,
+ pGFld->GetFormula(), aNew );
+ pGFld->ChgExpStr( aNew );
+ }
+ }
+ else
+ {
+ SwSetExpField* pSFld = (SwSetExpField*)pFld;
+ // ist die "Formel" ein Feld ??
+ LookString( pHashStrTbl, nStrFmtCnt,
+ pSFld->GetFormula(), aNew );
+
+ if( !aNew.Len() ) // nichts gefunden, dann ist die
+ aNew = pSFld->GetFormula(); // Formel der neue Wert
+
+ // nur ein spezielles FeldUpdaten ?
+ if( !pUpdtFld || pUpdtFld == pTxtFld )
+ pSFld->ChgExpStr( aNew );
+
+ // suche den Namen vom Feld
+ aNew = ((SwSetExpFieldType*)pSFld->GetTyp())->GetSetRefName();
+ // Eintrag vorhanden ?
+ sal_uInt16 nPos;
+ SwHash* pFnd = Find( aNew, pHashStrTbl, nStrFmtCnt, &nPos );
+ if( pFnd )
+ // Eintrag in der HashTabelle aendern
+ ((_HashStr*)pFnd)->aSetStr = pSFld->GetExpStr();
+ else
+ // neuen Eintrag einfuegen
+ *(pHashStrTbl + nPos ) = pFnd = new _HashStr( aNew,
+ pSFld->GetExpStr(),
+ (_HashStr*)*(pHashStrTbl + nPos) );
+
+ // Erweiterung fuers Rechnen mit Strings
+ SwSbxValue aValue;
+ aValue.PutString( ((_HashStr*)pFnd)->aSetStr );
+ aCalc.VarChange( aNew, aValue );
+ }
+ }
+ else // Formel neu berechnen
+ {
+ if( RES_GETEXPFLD == nWhich )
+ {
+ SwGetExpField* pGFld = (SwGetExpField*)pFld;
+
+ if( (!pUpdtFld || pUpdtFld == pTxtFld )
+ && pGFld->IsInBodyTxt() )
+ {
+ SwSbxValue aValue = aCalc.Calculate(
+ pGFld->GetFormula());
+ if(!aValue.IsVoidValue())
+ pGFld->SetValue(aValue.GetDouble() );
+ }
+ }
+ else
+ {
+ SwSetExpField* pSFld = (SwSetExpField*)pFld;
+ SwSetExpFieldType* pSFldTyp = (SwSetExpFieldType*)pFld->GetTyp();
+ aNew = pSFldTyp->GetName();
+
+ SwNode* pSeqNd = 0;
+
+ if( pSFld->IsSequenceFld() )
+ {
+ const sal_uInt8 nLvl = pSFldTyp->GetOutlineLvl();
+ if( MAXLEVEL > nLvl )
+ {
+ // dann teste, ob die Nummer neu aufsetzen muss
+ pSeqNd = GetNodes()[ (*ppSortLst)->GetNode() ];
+
+ const SwTxtNode* pOutlNd = pSeqNd->
+ FindOutlineNodeOfLevel( nLvl );
+ if( pSFldTyp->GetOutlineChgNd() != pOutlNd )
+ {
+ pSFldTyp->SetOutlineChgNd( pOutlNd );
+ aCalc.VarChange( aNew, 0 );
+ }
+ }
+ }
+
+ aNew += '=';
+ aNew += pSFld->GetFormula();
+
+ SwSbxValue aValue = aCalc.Calculate( aNew );
+ double nErg = aValue.GetDouble();
+ // nur ein spezielles Feld updaten ?
+ if( !aValue.IsVoidValue() && (!pUpdtFld || pUpdtFld == pTxtFld) )
+ {
+ pSFld->SetValue( nErg );
+
+ if( pSeqNd )
+ pSFldTyp->SetChapter( *pSFld, *pSeqNd );
+ }
+ }
+ }
+ }
+ } // switch
+
+ pFmtFld->ModifyNotification( 0, 0 ); // Formatierung anstossen
+
+ if( pUpdtFld == pTxtFld ) // sollte nur dieses geupdatet werden
+ {
+ if( RES_GETEXPFLD == nWhich || // nur GetFeld oder
+ RES_HIDDENTXTFLD == nWhich || // HiddenTxt?
+ RES_HIDDENPARAFLD == nWhich) // HiddenParaFld?
+ break; // beenden
+ pUpdtFld = 0; // ab jetzt alle Updaten
+ }
+ }
+
+ pMgr->CloseAll(sal_False);
+ // HashTabelle wieder loeschen
+ ::DeleteHashTable( pHashStrTbl, nStrFmtCnt );
+
+ // Referenzfelder updaten
+ if( bUpdRefFlds )
+ UpdateRefFlds(NULL);
+
+ pUpdtFlds->SetInUpdateFlds( bOldInUpdateFlds );
+ pUpdtFlds->SetFieldsDirty( sal_False );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDoc::UpdateDBNumFlds( SwDBNameInfField& rDBFld, SwCalc& rCalc )
+{
+ SwNewDBMgr* pMgr = GetNewDBMgr();
+
+ sal_uInt16 nFldType = rDBFld.Which();
+
+ sal_Bool bPar1 = rCalc.Calculate( rDBFld.GetPar1() ).GetBool();
+
+ if( RES_DBNEXTSETFLD == nFldType )
+ ((SwDBNextSetField&)rDBFld).SetCondValid( bPar1 );
+ else
+ ((SwDBNumSetField&)rDBFld).SetCondValid( bPar1 );
+
+ if( rDBFld.GetRealDBData().sDataSource.getLength() )
+ {
+ // Eine bestimmte Datenbank bearbeiten
+ if( RES_DBNEXTSETFLD == nFldType )
+ ((SwDBNextSetField&)rDBFld).Evaluate(this);
+ else
+ ((SwDBNumSetField&)rDBFld).Evaluate(this);
+
+ SwDBData aTmpDBData( rDBFld.GetDBData(this) );
+
+ if( pMgr->OpenDataSource( aTmpDBData.sDataSource, aTmpDBData.sCommand, -1, false ))
+ rCalc.VarChange( lcl_GetDBVarName( *this, rDBFld),
+ pMgr->GetSelectedRecordId(aTmpDBData.sDataSource, aTmpDBData.sCommand, aTmpDBData.nCommandType) );
+ }
+ else
+ {
+ DBG_ERROR("TODO: what should happen with unnamed DBFields?");
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDoc::_InitFieldTypes() // wird vom CTOR gerufen!!
+{
+ // Feldtypen
+ sal_uInt16 nFldType = 0;
+ pFldTypes->Insert( new SwDateTimeFieldType(this), nFldType++ );
+ pFldTypes->Insert( new SwChapterFieldType, nFldType++ );
+ pFldTypes->Insert( new SwPageNumberFieldType, nFldType++ );
+ pFldTypes->Insert( new SwAuthorFieldType, nFldType++ );
+ pFldTypes->Insert( new SwFileNameFieldType(this), nFldType++ );
+ pFldTypes->Insert( new SwDBNameFieldType(this), nFldType++);
+ pFldTypes->Insert( new SwGetExpFieldType(this), nFldType++ );
+ pFldTypes->Insert( new SwGetRefFieldType( this ), nFldType++ );
+ pFldTypes->Insert( new SwHiddenTxtFieldType, nFldType++ );
+ pFldTypes->Insert( new SwPostItFieldType(this), nFldType++ );
+ pFldTypes->Insert( new SwDocStatFieldType(this), nFldType++);
+ pFldTypes->Insert( new SwDocInfoFieldType(this), nFldType++);
+ pFldTypes->Insert( new SwInputFieldType( this ), nFldType++ );
+ pFldTypes->Insert( new SwTblFieldType( this ), nFldType++);
+ pFldTypes->Insert( new SwMacroFieldType(this), nFldType++ );
+ pFldTypes->Insert( new SwHiddenParaFieldType, nFldType++ );
+ pFldTypes->Insert( new SwDBNextSetFieldType, nFldType++ );
+ pFldTypes->Insert( new SwDBNumSetFieldType, nFldType++ );
+ pFldTypes->Insert( new SwDBSetNumberFieldType, nFldType++ );
+ pFldTypes->Insert( new SwTemplNameFieldType(this), nFldType++);
+ pFldTypes->Insert( new SwTemplNameFieldType(this),nFldType++);
+ pFldTypes->Insert( new SwExtUserFieldType, nFldType++ );
+ pFldTypes->Insert( new SwRefPageSetFieldType, nFldType++ );
+ pFldTypes->Insert( new SwRefPageGetFieldType( this ), nFldType++ );
+ pFldTypes->Insert( new SwJumpEditFieldType( this ), nFldType++ );
+ pFldTypes->Insert( new SwScriptFieldType( this ), nFldType++ );
+ pFldTypes->Insert( new SwCombinedCharFieldType, nFldType++ );
+ pFldTypes->Insert( new SwDropDownFieldType, nFldType++ );
+
+ // Types muessen am Ende stehen !!
+ // Im InsertFldType wird davon ausgegangen !!!!
+ // MIB 14.04.95: Im Sw3StringPool::Setup (sw3imp.cxx) und
+ // lcl_sw3io_InSetExpField (sw3field.cxx) jetzt auch
+ pFldTypes->Insert( new SwSetExpFieldType(this,
+ SW_RESSTR(STR_POOLCOLL_LABEL_ABB), nsSwGetSetExpType::GSE_SEQ), nFldType++);
+ pFldTypes->Insert( new SwSetExpFieldType(this,
+ SW_RESSTR(STR_POOLCOLL_LABEL_TABLE), nsSwGetSetExpType::GSE_SEQ),nFldType++);
+ pFldTypes->Insert( new SwSetExpFieldType(this,
+ SW_RESSTR(STR_POOLCOLL_LABEL_FRAME), nsSwGetSetExpType::GSE_SEQ),nFldType++);
+ pFldTypes->Insert( new SwSetExpFieldType(this,
+ SW_RESSTR(STR_POOLCOLL_LABEL_DRAWING), nsSwGetSetExpType::GSE_SEQ),nFldType++);
+
+ ASSERT( nFldType == INIT_FLDTYPES, "Bad initsize: SwFldTypes" );
+}
+
+void SwDoc::InsDelFldInFldLst( bool bIns, const SwTxtFld& rFld )
+{
+ if( !mbNewFldLst || !IsInDtor() )
+ pUpdtFlds->InsDelFldInFldLst( bIns, rFld );
+}
+
+SwDBData SwDoc::GetDBData()
+{
+ return GetDBDesc();
+}
+
+const SwDBData& SwDoc::GetDBDesc()
+{
+ if(!aDBData.sDataSource.getLength())
+ {
+ const sal_uInt16 nSize = pFldTypes->Count();
+ for(sal_uInt16 i = 0; i < nSize && !aDBData.sDataSource.getLength(); ++i)
+ {
+ SwFieldType& rFldType = *((*pFldTypes)[i]);
+ sal_uInt16 nWhich = rFldType.Which();
+ if(IsUsed(rFldType))
+ {
+ switch(nWhich)
+ {
+ case RES_DBFLD:
+ case RES_DBNEXTSETFLD:
+ case RES_DBNUMSETFLD:
+ case RES_DBSETNUMBERFLD:
+ {
+ SwIterator<SwFmtFld,SwFieldType> aIter( rFldType );
+ for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() )
+ {
+ if(pFld->IsFldInDoc())
+ {
+ if(RES_DBFLD == nWhich)
+ aDBData =
+ (static_cast < SwDBFieldType * > (pFld->GetFld()->GetTyp()))
+ ->GetDBData();
+ else
+ aDBData = (static_cast < SwDBNameInfField* > (pFld->GetFld()))->GetRealDBData();
+ break;
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ if(!aDBData.sDataSource.getLength())
+ aDBData = GetNewDBMgr()->GetAddressDBName();
+ return aDBData;
+}
+
+void SwDoc::SetInitDBFields( sal_Bool b )
+{
+ GetNewDBMgr()->SetInitDBFields( b );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Alle von Feldern verwendete Datenbanken herausfinden
+ --------------------------------------------------------------------*/
+String lcl_DBDataToString(const SwDBData& rData)
+{
+ String sRet = rData.sDataSource;
+ sRet += DB_DELIM;
+ sRet += (String)rData.sCommand;
+ sRet += DB_DELIM;
+ sRet += String::CreateFromInt32(rData.nCommandType);
+ return sRet;
+}
+void SwDoc::GetAllUsedDB( SvStringsDtor& rDBNameList,
+ const SvStringsDtor* pAllDBNames )
+{
+ SvStringsDtor aUsedDBNames;
+ SvStringsDtor aAllDBNames;
+
+ if( !pAllDBNames )
+ {
+ GetAllDBNames( aAllDBNames );
+ pAllDBNames = &aAllDBNames;
+ }
+
+ SwSectionFmts& rArr = GetSections();
+ for (sal_uInt16 n = rArr.Count(); n; )
+ {
+ SwSection* pSect = rArr[ --n ]->GetSection();
+
+ if( pSect )
+ {
+ String aCond( pSect->GetCondition() );
+ AddUsedDBToList( rDBNameList, FindUsedDBs( *pAllDBNames,
+ aCond, aUsedDBNames ) );
+ aUsedDBNames.DeleteAndDestroy( 0, aUsedDBNames.Count() );
+ }
+ }
+
+ const SfxPoolItem* pItem;
+ sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
+ for (sal_uInt32 n = 0; n < nMaxItems; ++n)
+ {
+ if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) ))
+ continue;
+
+ const SwFmtFld* pFmtFld = (SwFmtFld*)pItem;
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+ continue;
+
+ const SwField* pFld = pFmtFld->GetFld();
+ switch( pFld->GetTyp()->Which() )
+ {
+ case RES_DBFLD:
+ AddUsedDBToList( rDBNameList,
+ lcl_DBDataToString(((SwDBField*)pFld)->GetDBData() ));
+ break;
+
+ case RES_DBSETNUMBERFLD:
+ case RES_DBNAMEFLD:
+ AddUsedDBToList( rDBNameList,
+ lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData() ));
+ break;
+
+ case RES_DBNUMSETFLD:
+ case RES_DBNEXTSETFLD:
+ AddUsedDBToList( rDBNameList,
+ lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData() ));
+ // kein break // JP: ist das so richtig ??
+
+ case RES_HIDDENTXTFLD:
+ case RES_HIDDENPARAFLD:
+ AddUsedDBToList(rDBNameList, FindUsedDBs( *pAllDBNames,
+ pFld->GetPar1(), aUsedDBNames ));
+ aUsedDBNames.DeleteAndDestroy( 0, aUsedDBNames.Count() );
+ break;
+
+ case RES_SETEXPFLD:
+ case RES_GETEXPFLD:
+ case RES_TABLEFLD:
+ AddUsedDBToList(rDBNameList, FindUsedDBs( *pAllDBNames,
+ pFld->GetFormula(), aUsedDBNames ));
+ aUsedDBNames.DeleteAndDestroy( 0, aUsedDBNames.Count() );
+ break;
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDoc::GetAllDBNames( SvStringsDtor& rAllDBNames )
+{
+ SwNewDBMgr* pMgr = GetNewDBMgr();
+
+ const SwDSParamArr& rArr = pMgr->GetDSParamArray();
+ for(sal_uInt16 i = 0; i < rArr.Count(); i++)
+ {
+ SwDSParam* pParam = rArr[i];
+ String* pStr = new String( pParam->sDataSource );
+ (*pStr) += DB_DELIM;
+ (*pStr) += (String)pParam->sCommand;
+ rAllDBNames.Insert( pStr, rAllDBNames.Count() );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SvStringsDtor& SwDoc::FindUsedDBs( const SvStringsDtor& rAllDBNames,
+ const String& rFormel,
+ SvStringsDtor& rUsedDBNames )
+{
+ const CharClass& rCC = GetAppCharClass();
+ String sFormel( rFormel);
+#ifndef UNX
+ rCC.toUpper( sFormel );
+#endif
+
+ xub_StrLen nPos;
+ for (sal_uInt16 i = 0; i < rAllDBNames.Count(); ++i )
+ {
+ const String* pStr = rAllDBNames.GetObject(i);
+
+ if( STRING_NOTFOUND != (nPos = sFormel.Search( *pStr )) &&
+ sFormel.GetChar( nPos + pStr->Len() ) == '.' &&
+ (!nPos || !rCC.isLetterNumeric( sFormel, nPos - 1 )))
+ {
+ // Tabellenname suchen
+ xub_StrLen nEndPos;
+ nPos += pStr->Len() + 1;
+ if( STRING_NOTFOUND != (nEndPos = sFormel.Search('.', nPos)) )
+ {
+ String* pDBNm = new String( *pStr );
+ pDBNm->Append( DB_DELIM );
+ pDBNm->Append( sFormel.Copy( nPos, nEndPos - nPos ));
+ rUsedDBNames.Insert( pDBNm, rUsedDBNames.Count() );
+ }
+ }
+ }
+ return rUsedDBNames;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDoc::AddUsedDBToList( SvStringsDtor& rDBNameList,
+ const SvStringsDtor& rUsedDBNames )
+{
+ for (sal_uInt16 i = 0; i < rUsedDBNames.Count(); i++)
+ AddUsedDBToList( rDBNameList, *rUsedDBNames.GetObject(i) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDoc::AddUsedDBToList( SvStringsDtor& rDBNameList, const String& rDBName)
+{
+ if( !rDBName.Len() )
+ return;
+
+#ifdef UNX
+ for( sal_uInt16 i = 0; i < rDBNameList.Count(); ++i )
+ if( rDBName == rDBNameList.GetObject(i)->GetToken(0) )
+ return;
+#else
+ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+ for( sal_uInt16 i = 0; i < rDBNameList.Count(); ++i )
+ if( rSCmp.isEqual( rDBName, rDBNameList.GetObject(i)->GetToken(0) ) )
+ return;
+#endif
+
+ SwDBData aData;
+ aData.sDataSource = rDBName.GetToken(0, DB_DELIM);
+ aData.sCommand = rDBName.GetToken(1, DB_DELIM);
+ aData.nCommandType = -1;
+ GetNewDBMgr()->CreateDSData(aData);
+ String* pNew = new String( rDBName );
+ rDBNameList.Insert( pNew, rDBNameList.Count() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames,
+ const String& rNewName )
+{
+ SwDBData aNewDBData;
+ aNewDBData.sDataSource = rNewName.GetToken(0, DB_DELIM);
+ aNewDBData.sCommand = rNewName.GetToken(1, DB_DELIM);
+ aNewDBData.nCommandType = (short)rNewName.GetToken(2, DB_DELIM).ToInt32();
+
+ String sFormel;
+
+ SwSectionFmts& rArr = GetSections();
+ for (sal_uInt16 n = rArr.Count(); n; )
+ {
+ SwSection* pSect = rArr[ --n ]->GetSection();
+
+ if( pSect )
+ {
+ sFormel = pSect->GetCondition();
+ ReplaceUsedDBs( rOldNames, rNewName, sFormel);
+ pSect->SetCondition(sFormel);
+ }
+ }
+
+ const SfxPoolItem* pItem;
+ sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
+
+ for (sal_uInt32 n = 0; n < nMaxItems; ++n )
+ {
+ if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) ))
+ continue;
+
+ SwFmtFld* pFmtFld = (SwFmtFld*)pItem;
+ SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+ continue;
+
+ SwField* pFld = pFmtFld->GetFld();
+ sal_Bool bExpand = sal_False;
+
+ switch( pFld->GetTyp()->Which() )
+ {
+ case RES_DBFLD:
+ if( IsNameInArray( rOldNames, lcl_DBDataToString(((SwDBField*)pFld)->GetDBData())))
+ {
+ SwDBFieldType* pOldTyp = (SwDBFieldType*)pFld->GetTyp();
+
+ SwDBFieldType* pTyp = (SwDBFieldType*)InsertFldType(
+ SwDBFieldType(this, pOldTyp->GetColumnName(), aNewDBData));
+
+ pFmtFld->RegisterToFieldType( *pTyp );
+ pFld->ChgTyp(pTyp);
+
+ ((SwDBField*)pFld)->ClearInitialized();
+ ((SwDBField*)pFld)->InitContent();
+
+ bExpand = sal_True;
+ }
+ break;
+
+ case RES_DBSETNUMBERFLD:
+ case RES_DBNAMEFLD:
+ if( IsNameInArray( rOldNames,
+ lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData())))
+ {
+ ((SwDBNameInfField*)pFld)->SetDBData(aNewDBData);
+ bExpand = sal_True;
+ }
+ break;
+
+ case RES_DBNUMSETFLD:
+ case RES_DBNEXTSETFLD:
+ if( IsNameInArray( rOldNames,
+ lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData())))
+ {
+ ((SwDBNameInfField*)pFld)->SetDBData(aNewDBData);
+ bExpand = sal_True;
+ }
+ // kein break;
+ case RES_HIDDENTXTFLD:
+ case RES_HIDDENPARAFLD:
+ sFormel = pFld->GetPar1();
+ ReplaceUsedDBs( rOldNames, rNewName, sFormel);
+ pFld->SetPar1( sFormel );
+ bExpand = sal_True;
+ break;
+
+ case RES_SETEXPFLD:
+ case RES_GETEXPFLD:
+ case RES_TABLEFLD:
+ sFormel = pFld->GetFormula();
+ ReplaceUsedDBs( rOldNames, rNewName, sFormel);
+ pFld->SetPar2( sFormel );
+ bExpand = sal_True;
+ break;
+ }
+
+ if (bExpand)
+ pTxtFld->ExpandAlways();
+ }
+ SetModified();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDoc::ReplaceUsedDBs( const SvStringsDtor& rUsedDBNames,
+ const String& rNewName, String& rFormel )
+{
+ const CharClass& rCC = GetAppCharClass();
+ String sFormel(rFormel);
+ String sNewName( rNewName );
+ sNewName.SearchAndReplace( DB_DELIM, '.');
+ //the command type is not part of the condition
+ sNewName = sNewName.GetToken(0, DB_DELIM);
+ String sUpperNewNm( sNewName );
+
+
+ for( sal_uInt16 i = 0; i < rUsedDBNames.Count(); ++i )
+ {
+ String sDBName( *rUsedDBNames.GetObject( i ) );
+
+ sDBName.SearchAndReplace( DB_DELIM, '.');
+ //cut off command type
+ sDBName = sDBName.GetToken(0, DB_DELIM);
+ if( !sDBName.Equals( sUpperNewNm ))
+ {
+ xub_StrLen nPos = 0;
+
+ while ((nPos = sFormel.Search(sDBName, nPos)) != STRING_NOTFOUND)
+ {
+ if( sFormel.GetChar( nPos + sDBName.Len() ) == '.' &&
+ (!nPos || !rCC.isLetterNumeric( sFormel, nPos - 1 )))
+ {
+ rFormel.Erase( nPos, sDBName.Len() );
+ rFormel.Insert( sNewName, nPos );
+ //prevent re-searching - this is useless and provokes
+ //endless loops when names containing each other and numbers are exchanged
+ //e.g.: old ?12345.12345 new: i12345.12345
+ nPos = nPos + sNewName.Len();
+ sFormel = rFormel;
+ }
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwDoc::IsNameInArray( const SvStringsDtor& rArr, const String& rName )
+{
+#ifdef UNX
+ for( sal_uInt16 i = 0; i < rArr.Count(); ++i )
+ if( rName == *rArr[ i ] )
+ return sal_True;
+#else
+ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+ for( sal_uInt16 i = 0; i < rArr.Count(); ++i )
+ if( rSCmp.isEqual( rName, *rArr[ i] ))
+ return sal_True;
+#endif
+ return sal_False;
+}
+
+void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime )
+{
+ sal_Bool bIsModified = IsModified();
+
+ sal_uLong nDate, nTime;
+ if( pNewDateTime )
+ {
+ nDate = pNewDateTime->GetDate();
+ nTime = pNewDateTime->GetTime();
+ }
+ else
+ {
+ nDate = Date().GetDate();
+ nTime = Time().GetTime();
+ }
+
+ sal_uInt16 aTypes[5] = {
+ /*0*/ RES_DOCINFOFLD,
+ /*1*/ RES_AUTHORFLD,
+ /*2*/ RES_EXTUSERFLD,
+ /*3*/ RES_FILENAMEFLD,
+ /*4*/ RES_DATETIMEFLD }; // MUSS am Ende stehen!!
+
+ sal_uInt16 nStt = bOnlyTimeDate ? 4 : 0;
+
+ for( ; nStt < 5; ++nStt )
+ {
+ SwFieldType* pFldType = GetSysFldType( aTypes[ nStt ] );
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType );
+ for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() )
+ {
+ if( pFld && pFld->GetTxtFld() )
+ {
+ sal_Bool bChgd = sal_False;
+ switch( aTypes[ nStt ] )
+ {
+ case RES_DOCINFOFLD:
+ if( ((SwDocInfoField*)pFld->GetFld())->IsFixed() )
+ {
+ bChgd = sal_True;
+ SwDocInfoField* pDocInfFld = (SwDocInfoField*)pFld->GetFld();
+ pDocInfFld->SetExpansion( ((SwDocInfoFieldType*)
+ pDocInfFld->GetTyp())->Expand(
+ pDocInfFld->GetSubType(),
+ pDocInfFld->GetFormat(),
+ pDocInfFld->GetLanguage(),
+ pDocInfFld->GetName() ) );
+ }
+ break;
+
+ case RES_AUTHORFLD:
+ if( ((SwAuthorField*)pFld->GetFld())->IsFixed() )
+ {
+ bChgd = sal_True;
+ SwAuthorField* pAuthorFld = (SwAuthorField*)pFld->GetFld();
+ pAuthorFld->SetExpansion( ((SwAuthorFieldType*)
+ pAuthorFld->GetTyp())->Expand(
+ pAuthorFld->GetFormat() ) );
+ }
+ break;
+
+ case RES_EXTUSERFLD:
+ if( ((SwExtUserField*)pFld->GetFld())->IsFixed() )
+ {
+ bChgd = sal_True;
+ SwExtUserField* pExtUserFld = (SwExtUserField*)pFld->GetFld();
+ pExtUserFld->SetExpansion( ((SwExtUserFieldType*)
+ pExtUserFld->GetTyp())->Expand(
+ pExtUserFld->GetSubType(),
+ pExtUserFld->GetFormat()));
+ }
+ break;
+
+ case RES_DATETIMEFLD:
+ if( ((SwDateTimeField*)pFld->GetFld())->IsFixed() )
+ {
+ bChgd = sal_True;
+ ((SwDateTimeField*)pFld->GetFld())->SetDateTime(
+ DateTime(Date(nDate), Time(nTime)) );
+ }
+ break;
+
+ case RES_FILENAMEFLD:
+ if( ((SwFileNameField*)pFld->GetFld())->IsFixed() )
+ {
+ bChgd = sal_True;
+ SwFileNameField* pFileNameFld =
+ (SwFileNameField*)pFld->GetFld();
+ pFileNameFld->SetExpansion( ((SwFileNameFieldType*)
+ pFileNameFld->GetTyp())->Expand(
+ pFileNameFld->GetFormat() ) );
+ }
+ break;
+ }
+
+ // Formatierung anstossen
+ if( bChgd )
+ pFld->ModifyNotification( 0, 0 );
+ }
+ }
+ }
+
+ if( !bIsModified )
+ ResetModified();
+}
+
+bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLong nLen )
+{
+ // teste ggfs. mal, ob die angegbenen Nodes ueberhaupt Felder beinhalten.
+ // wenn nicht, braucht das Flag nicht veraendert werden.
+ sal_Bool bFldsFnd = sal_False;
+ if( b && pChk && !GetUpdtFlds().IsFieldsDirty() && !IsInDtor()
+ // ?? was ist mit Undo, da will man es doch auch haben !!
+ /*&& &pChk->GetNodes() == &GetNodes()*/ )
+ {
+ b = sal_False;
+ if( !nLen )
+ ++nLen;
+ sal_uLong nStt = pChk->GetIndex();
+ const SwNodes& rNds = pChk->GetNodes();
+ while( nLen-- )
+ {
+ const SwTxtNode* pTNd = rNds[ nStt++ ]->GetTxtNode();
+ if( pTNd )
+ {
+ if( //pTNd->GetFmtColl() && //#outline level,zhaojianwei
+ // MAXLEVEL > pTNd->GetTxtColl()->GetOutlineLevel() )
+ pTNd->GetAttrOutlineLevel() != 0 )//<-end,zhaojianwei
+ // Kapitelfelder aktualisieren
+ b = sal_True;
+ else if( pTNd->GetpSwpHints() && pTNd->GetSwpHints().Count() )
+ for( sal_uInt16 n = 0, nEnd = pTNd->GetSwpHints().Count();
+ n < nEnd; ++n )
+ {
+ const SwTxtAttr* pAttr = pTNd->GetSwpHints()[ n ];
+ if( RES_TXTATR_FIELD == pAttr->Which() )
+ {
+ b = sal_True;
+ break;
+ }
+ }
+
+ if( b )
+ break;
+ }
+ }
+ bFldsFnd = b;
+ }
+ GetUpdtFlds().SetFieldsDirty( b );
+ return bFldsFnd;
+}
+/* -----------------------------21.12.99 12:55--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDoc::ChangeAuthorityData( const SwAuthEntry* pNewData )
+{
+ const sal_uInt16 nSize = pFldTypes->Count();
+
+ for( sal_uInt16 i = INIT_FLDTYPES; i < nSize; ++i )
+ {
+ SwFieldType* pFldType = (*pFldTypes)[i];
+ if( RES_AUTHORITY == pFldType->Which() )
+ {
+ SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)pFldType;
+ pAuthType->ChangeEntryContent(pNewData);
+ break;
+ }
+ }
+
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDocUpdtFld::InsDelFldInFldLst( sal_Bool bIns, const SwTxtFld& rFld )
+{
+ sal_uInt16 nWhich = rFld.GetFld().GetFld()->GetTyp()->Which();
+ switch( nWhich )
+ {
+ case RES_DBFLD:
+ case RES_SETEXPFLD:
+ case RES_HIDDENPARAFLD:
+ case RES_HIDDENTXTFLD:
+ case RES_DBNUMSETFLD:
+ case RES_DBNEXTSETFLD:
+ case RES_DBSETNUMBERFLD:
+ case RES_GETEXPFLD:
+ break; // diese muessen ein-/ausgetragen werden!
+
+ default:
+ return;
+ }
+
+ SetFieldsDirty( sal_True );
+ if( !pFldSortLst )
+ {
+ if( !bIns ) // keine Liste vorhanden und loeschen
+ return; // dann nichts tun
+ pFldSortLst = new _SetGetExpFlds( 64, 16 );
+ }
+
+ if( bIns ) // neu einfuegen:
+ GetBodyNode( rFld, nWhich );
+ else
+ {
+ // ueber den pTxtFld Pointer suchen. Ist zwar eine Sortierte
+ // Liste, aber nach Node-Positionen sortiert. Bis dieser
+ // bestimmt ist, ist das Suchen nach dem Pointer schon fertig
+ for( sal_uInt16 n = 0; n < pFldSortLst->Count(); ++n )
+ if( &rFld == (*pFldSortLst)[ n ]->GetPointer() )
+ pFldSortLst->DeleteAndDestroy( n--, 1 );
+ // ein Feld kann mehrfach vorhanden sein!
+ }
+}
+
+void SwDocUpdtFld::MakeFldList( SwDoc& rDoc, int bAll, int eGetMode )
+{
+ if( !pFldSortLst || bAll || !( eGetMode & nFldLstGetMode ) ||
+ rDoc.GetNodes().Count() != nNodes )
+ _MakeFldList( rDoc, eGetMode );
+}
+
+void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
+{
+ // neue Version: gehe ueber alle Felder vom Attribut-Pool
+ if( pFldSortLst )
+ delete pFldSortLst;
+ pFldSortLst = new _SetGetExpFlds( 64, 16 );
+
+ /// OD 09.08.2002 [#101207#,#101216#,#101778#] - consider and unhide sections
+ /// with hide condition, only in mode GETFLD_ALL (<eGetMode == GETFLD_ALL>)
+ /// notes by OD:
+ /// eGetMode == GETFLD_CALC in call from methods SwDoc::FldsToCalc
+ /// eGetMode == GETFLD_EXPAND in call from method SwDoc::FldsToExpand
+ /// eGetMode == GETFLD_ALL in call from method SwDoc::UpdateExpFlds
+ /// I figured out that hidden section only have to be shown,
+ /// if fields have updated (call by SwDoc::UpdateExpFlds) and thus
+ /// the hide conditions of section have to be updated.
+ /// For correct updating the hide condition of a section, its position
+ /// have to be known in order to insert the hide condition as a new
+ /// expression field into the sorted field list (<pFldSortLst>).
+ if ( eGetMode == GETFLD_ALL )
+ // zuerst die Bereiche einsammeln. Alle die ueber Bedingung
+ // gehiddet sind, wieder mit Frames versorgen, damit die darin
+ // enthaltenen Felder richtig einsortiert werden!!!
+ {
+ // damit die Frames richtig angelegt werden, muessen sie in der
+ // Reihenfolgen von oben nach unten expandiert werden
+ SvULongs aTmpArr;
+ SwSectionFmts& rArr = rDoc.GetSections();
+ SwSectionNode* pSectNd;
+ sal_uInt16 nArrStt = 0;
+ sal_uLong nSttCntnt = rDoc.GetNodes().GetEndOfExtras().GetIndex();
+
+ for (sal_uInt16 n = rArr.Count(); n; )
+ {
+ SwSection* pSect = rArr[ --n ]->GetSection();
+ if( pSect && pSect->IsHidden() && pSect->GetCondition().Len() &&
+ 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ))
+ {
+ sal_uLong nIdx = pSectNd->GetIndex();
+ sal_uInt16 i;
+
+ for( i = 0; i < aTmpArr.Count() && aTmpArr[ i ] < nIdx; ++i )
+ ;
+ aTmpArr.Insert( nIdx, i );
+ if( nIdx < nSttCntnt )
+ ++nArrStt;
+ }
+ }
+
+ // erst alle anzeigen, damit die Frames vorhanden sind. Mit deren
+ // Position wird das BodyAnchor ermittelt.
+ // Dafuer erst den ContentBereich, dann die Sonderbereiche!!!
+ for (sal_uInt16 n = nArrStt; n < aTmpArr.Count(); ++n)
+ {
+ pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode();
+ ASSERT( pSectNd, "Wo ist mein SectionNode" );
+ pSectNd->GetSection().SetCondHidden( sal_False );
+ }
+ for (sal_uInt16 n = 0; n < nArrStt; ++n)
+ {
+ pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode();
+ ASSERT( pSectNd, "Wo ist mein SectionNode" );
+ pSectNd->GetSection().SetCondHidden( sal_False );
+ }
+
+ // so, erst jetzt alle sortiert in die Liste eintragen
+ for (sal_uInt16 n = 0; n < aTmpArr.Count(); ++n)
+ {
+ GetBodyNode( *rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode() );
+ }
+ }
+
+ String sTrue( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "sal_True" ))),
+ sFalse( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "sal_False" )));
+
+ sal_Bool bIsDBMgr = 0 != rDoc.GetNewDBMgr();
+ sal_uInt16 nWhich, n;
+ const String* pFormel = 0;
+ const SfxPoolItem* pItem;
+ sal_uInt32 nMaxItems = rDoc.GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
+ for( n = 0; n < nMaxItems; ++n )
+ {
+ if( 0 == (pItem = rDoc.GetAttrPool().GetItem2( RES_TXTATR_FIELD, n )) )
+ continue;
+
+ const SwFmtFld* pFmtFld = (SwFmtFld*)pItem;
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+ continue;
+
+ const SwField* pFld = pFmtFld->GetFld();
+ switch( nWhich = pFld->GetTyp()->Which() )
+ {
+ case RES_DBSETNUMBERFLD:
+ case RES_GETEXPFLD:
+ if( GETFLD_ALL == eGetMode )
+ pFormel = &sTrue;
+ break;
+
+ case RES_DBFLD:
+ if( GETFLD_EXPAND & eGetMode )
+ pFormel = &sTrue;
+ break;
+
+ case RES_SETEXPFLD:
+ /// OD 04.10.2002 #102894#
+ /// fields of subtype <string> have also been add
+ /// for calculation (eGetMode == GETFLD_CALC).
+ /// Thus, add fields of subtype <string> in all modes
+ /// (eGetMode == GETFLD_EXPAND||GETFLD_CALC||GETFLD_ALL)
+ /// and fields of other subtypes only in the modes
+ /// (eGetMode == GETFLD_CALC||GETFLD_ALL)
+ /* "old" if construct - not deleted for history and code review
+ if( ( nsSwGetSetExpType::GSE_STRING & pFld->GetSubType()
+ ? GETFLD_EXPAND : GETFLD_CALC )
+ & eGetMode )
+ */
+ if ( !(eGetMode == GETFLD_EXPAND) ||
+ (nsSwGetSetExpType::GSE_STRING & pFld->GetSubType()) )
+ {
+ pFormel = &sTrue;
+ }
+ break;
+
+ case RES_HIDDENPARAFLD:
+ if( GETFLD_ALL == eGetMode )
+ {
+ pFormel = &pFld->GetPar1();
+ if( !pFormel->Len() || pFormel->Equals( sFalse ))
+ ((SwHiddenParaField*)pFld)->SetHidden( sal_False );
+ else if( pFormel->Equals( sTrue ))
+ ((SwHiddenParaField*)pFld)->SetHidden( sal_True );
+ else
+ break;
+
+ pFormel = 0;
+ // Formatierung anstossen
+ ((SwFmtFld*)pFmtFld)->ModifyNotification( 0, 0 );
+ }
+ break;
+
+ case RES_HIDDENTXTFLD:
+ if( GETFLD_ALL == eGetMode )
+ {
+ pFormel = &pFld->GetPar1();
+ if( !pFormel->Len() || pFormel->Equals( sFalse ))
+ ((SwHiddenTxtField*)pFld)->SetValue( sal_True );
+ else if( pFormel->Equals( sTrue ))
+ ((SwHiddenTxtField*)pFld)->SetValue( sal_False );
+ else
+ break;
+
+ pFormel = 0;
+
+ // Feld Evaluieren
+ ((SwHiddenTxtField*)pFld)->Evaluate(&rDoc);
+ // Formatierung anstossen
+ ((SwFmtFld*)pFmtFld)->ModifyNotification( 0, 0 );
+ }
+ break;
+
+ case RES_DBNUMSETFLD:
+ {
+ SwDBData aDBData(((SwDBNumSetField*)pFld)->GetDBData(&rDoc));
+
+ if (
+ (bIsDBMgr && rDoc.GetNewDBMgr()->OpenDataSource(aDBData.sDataSource, aDBData.sCommand)) &&
+ (GETFLD_ALL == eGetMode || (GETFLD_CALC & eGetMode && ((SwDBNumSetField*)pFld)->IsCondValid()))
+ )
+ {
+ pFormel = &pFld->GetPar1();
+ }
+ }
+ break;
+ case RES_DBNEXTSETFLD:
+ {
+ SwDBData aDBData(((SwDBNextSetField*)pFld)->GetDBData(&rDoc));
+
+ if (
+ (bIsDBMgr && rDoc.GetNewDBMgr()->OpenDataSource(aDBData.sDataSource, aDBData.sCommand)) &&
+ (GETFLD_ALL == eGetMode || (GETFLD_CALC & eGetMode && ((SwDBNextSetField*)pFld)->IsCondValid()))
+ )
+ {
+ pFormel = &pFld->GetPar1();
+ }
+ }
+ break;
+ }
+
+ if( pFormel && pFormel->Len() )
+ {
+ GetBodyNode( *pTxtFld, nWhich );
+ pFormel = 0;
+ }
+ }
+ nFldLstGetMode = static_cast<sal_uInt8>( eGetMode );
+ nNodes = rDoc.GetNodes().Count();
+
+#ifdef JP_DEBUG
+ {
+ SvFileStream sOut( "f:\\x.x", STREAM_STD_WRITE );
+ sOut.Seek( STREAM_SEEK_TO_END );
+ sOut << "------------------" << endl;
+ const _SetGetExpFldPtr* pSortLst = pFldSortLst->GetData();
+ for( sal_uInt16 n = pFldSortLst->Count(); n; --n, ++pSortLst )
+ {
+ String sStr( (*pSortLst)->GetNode() );
+ sStr += "\t, ";
+ sStr += (*pSortLst)->GetCntnt();
+ sStr += "\tNode: ";
+ sStr += (*pSortLst)->GetFld()->GetTxtNode().StartOfSectionIndex();
+ sStr += "\tPos: ";
+ sStr += *(*pSortLst)->GetFld()->GetStart();
+ sStr += "\tType: ";
+ sStr += (*pSortLst)->GetFld()->GetFld().GetFld()->GetTyp()->Which();
+
+ sOut << sStr.GetStr() << endl;
+ }
+ }
+#endif
+ // JP_DEBUG
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDocUpdtFld::GetBodyNode( const SwTxtFld& rTFld, sal_uInt16 nFldWhich )
+{
+ const SwTxtNode& rTxtNd = rTFld.GetTxtNode();
+ const SwDoc& rDoc = *rTxtNd.GetDoc();
+
+ // immer den ersten !! (in Tab-Headline, Kopf-/Fuss )
+ Point aPt;
+ const SwCntntFrm* pFrm = rTxtNd.getLayoutFrm( rDoc.GetCurrentLayout(), &aPt, 0, sal_False );
+
+ _SetGetExpFld* pNew = NULL;
+ sal_Bool bIsInBody = sal_False;
+
+ if( !pFrm || pFrm->IsInDocBody() )
+ {
+ // einen Index fuers bestimmen vom TextNode anlegen
+ SwNodeIndex aIdx( rTxtNd );
+ bIsInBody = rDoc.GetNodes().GetEndOfExtras().GetIndex() < aIdx.GetIndex();
+
+ // #104291# dvo: We don't want to update fields in redlines, or those
+ // in frames whose anchor is in redline. However, we do want to update
+ // fields in hidden sections. So: In order to be updated, a field 1)
+ // must have a frame, or 2) it must be in the document body.
+ if( (pFrm != NULL) || bIsInBody )
+ pNew = new _SetGetExpFld( aIdx, &rTFld );
+ }
+ else
+ {
+ // einen Index fuers bestimmen vom TextNode anlegen
+ SwPosition aPos( rDoc.GetNodes().GetEndOfPostIts() );
+#ifdef DBG_UTIL
+ ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" );
+#else
+ GetBodyTxtNode( rDoc, aPos, *pFrm );
+#endif
+ pNew = new _SetGetExpFld( aPos.nNode, &rTFld, &aPos.nContent );
+ }
+
+ // bei GetExp.-/DB.-Felder immer das BodyTxtFlag setzen
+ if( RES_GETEXPFLD == nFldWhich )
+ {
+ SwGetExpField* pGetFld = (SwGetExpField*)rTFld.GetFld().GetFld();
+ pGetFld->ChgBodyTxtFlag( bIsInBody );
+ }
+ else if( RES_DBFLD == nFldWhich )
+ {
+ SwDBField* pDBFld = (SwDBField*)rTFld.GetFld().GetFld();
+ pDBFld->ChgBodyTxtFlag( bIsInBody );
+ }
+
+ if( pNew != NULL )
+ if( !pFldSortLst->Insert( pNew ))
+ delete pNew;
+}
+
+void SwDocUpdtFld::GetBodyNode( const SwSectionNode& rSectNd )
+{
+ const SwDoc& rDoc = *rSectNd.GetDoc();
+ _SetGetExpFld* pNew = 0;
+
+ if( rSectNd.GetIndex() < rDoc.GetNodes().GetEndOfExtras().GetIndex() )
+ {
+ do { // middle check loop
+
+ // dann muessen wir uns mal den Anker besorgen!
+ // einen Index fuers bestimmen vom TextNode anlegen
+ SwPosition aPos( rSectNd );
+ SwCntntNode* pCNd = rDoc.GetNodes().GoNext( &aPos.nNode ); // zum naechsten ContentNode
+
+ if( !pCNd || !pCNd->IsTxtNode() )
+ break;
+
+ // immer den ersten !! (in Tab-Headline, Kopf-/Fuss )
+ Point aPt;
+ const SwCntntFrm* pFrm = pCNd->getLayoutFrm( rDoc.GetCurrentLayout(), &aPt, 0, sal_False );
+ if( !pFrm )
+ break;
+
+#ifdef DBG_UTIL
+ ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" );
+#else
+ GetBodyTxtNode( rDoc, aPos, *pFrm );
+#endif
+ pNew = new _SetGetExpFld( rSectNd, &aPos );
+
+ } while( sal_False );
+ }
+
+ if( !pNew )
+ pNew = new _SetGetExpFld( rSectNd );
+
+ if( !pFldSortLst->Insert( pNew ))
+ delete pNew;
+}
+
+void SwDocUpdtFld::InsertFldType( const SwFieldType& rType )
+{
+ String sFldName;
+ switch( rType.Which() )
+ {
+ case RES_USERFLD :
+ sFldName = ((SwUserFieldType&)rType).GetName();
+ break;
+ case RES_SETEXPFLD:
+ sFldName = ((SwSetExpFieldType&)rType).GetName();
+ break;
+ default:
+ ASSERT( !this, "kein gueltiger FeldTyp" );
+ }
+
+ if( sFldName.Len() )
+ {
+ SetFieldsDirty( sal_True );
+ // suchen und aus der HashTabelle entfernen
+ GetAppCharClass().toLower( sFldName );
+ sal_uInt16 n;
+
+ SwHash* pFnd = Find( sFldName, GetFldTypeTable(), TBLSZ, &n );
+
+ if( !pFnd )
+ {
+ SwCalcFldType* pNew = new SwCalcFldType( sFldName, &rType );
+ pNew->pNext = aFldTypeTable[ n ];
+ aFldTypeTable[ n ] = pNew;
+ }
+ }
+}
+
+void SwDocUpdtFld::RemoveFldType( const SwFieldType& rType )
+{
+ String sFldName;
+ switch( rType.Which() )
+ {
+ case RES_USERFLD :
+ sFldName = ((SwUserFieldType&)rType).GetName();
+ break;
+ case RES_SETEXPFLD:
+ sFldName = ((SwSetExpFieldType&)rType).GetName();
+ break;
+ }
+
+ if( sFldName.Len() )
+ {
+ SetFieldsDirty( sal_True );
+ // suchen und aus der HashTabelle entfernen
+ GetAppCharClass().toLower( sFldName );
+ sal_uInt16 n;
+
+ SwHash* pFnd = Find( sFldName, GetFldTypeTable(), TBLSZ, &n );
+ if( pFnd )
+ {
+ if( aFldTypeTable[ n ] == pFnd )
+ aFldTypeTable[ n ] = (SwCalcFldType*)pFnd->pNext;
+ else
+ {
+ SwHash* pPrev = aFldTypeTable[ n ];
+ while( pPrev->pNext != pFnd )
+ pPrev = pPrev->pNext;
+ pPrev->pNext = pFnd->pNext;
+ }
+ pFnd->pNext = 0;
+ delete pFnd;
+ }
+ }
+}
+
+SwDocUpdtFld::SwDocUpdtFld()
+ : pFldSortLst(0), nFldUpdtPos(LONG_MAX), nFldLstGetMode(0)
+{
+ bInUpdateFlds = bFldsDirty = sal_False;
+ memset( aFldTypeTable, 0, sizeof( aFldTypeTable ) );
+}
+
+SwDocUpdtFld::~SwDocUpdtFld()
+{
+ delete pFldSortLst;
+
+ for( sal_uInt16 n = 0; n < TBLSZ; ++n )
+ delete aFldTypeTable[n];
+}
+
+// #111840#
+bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld,
+ SwMsgPoolItem * pMsgHnt,
+ bool bUpdateFlds)
+{
+ ASSERT(pDstTxtFld, "no field to update!");
+
+ sal_Bool bTblSelBreak = sal_False;
+
+ SwFmtFld * pDstFmtFld = (SwFmtFld*)&pDstTxtFld->GetFld();
+ SwField * pDstFld = pDstFmtFld->GetFld();
+ sal_uInt16 nFldWhich = rSrcFld.GetTyp()->Which();
+ SwNodeIndex aTblNdIdx(pDstTxtFld->GetTxtNode());
+
+ if (pDstFld->GetTyp()->Which() ==
+ rSrcFld.GetTyp()->Which())
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwPosition aPosition( pDstTxtFld->GetTxtNode() );
+ aPosition.nContent = *pDstTxtFld->GetStart();
+
+ SwUndo *const pUndo( new SwUndoFieldFromDoc(
+ aPosition, *pDstFld, rSrcFld, pMsgHnt, bUpdateFlds) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ // Das gefundene Feld wird angepasst ...
+ //pDstFld->ChangeFormat( rSrcFld.GetFormat() );
+ //pDstFld->SetLanguage( rSrcFld.GetLanguage() );
+
+ SwField * pNewFld = rSrcFld.CopyField();
+ pDstFmtFld->SetFld(pNewFld);
+
+ switch( nFldWhich )
+ {
+ case RES_SETEXPFLD:
+ case RES_GETEXPFLD:
+ case RES_HIDDENTXTFLD:
+ case RES_HIDDENPARAFLD:
+ UpdateExpFlds( pDstTxtFld, true );
+ break;
+
+ case RES_TABLEFLD:
+ {
+ const SwTableNode* pTblNd =
+ IsIdxInTbl(aTblNdIdx);
+ if( pTblNd )
+ {
+ SwTableFmlUpdate aTblUpdate( &pTblNd->
+ GetTable() );
+ if (bUpdateFlds)
+ UpdateTblFlds( &aTblUpdate );
+ else
+ pNewFld->GetTyp()->ModifyNotification(0, &aTblUpdate);
+
+ if (! bUpdateFlds)
+ bTblSelBreak = sal_True;
+ }
+ }
+ break;
+
+ case RES_MACROFLD:
+ if( bUpdateFlds && pDstTxtFld->GetpTxtNode() )
+ (pDstTxtFld->GetpTxtNode())->
+ ModifyNotification( 0, pDstFmtFld );
+ break;
+
+ case RES_DBNAMEFLD:
+ case RES_DBNEXTSETFLD:
+ case RES_DBNUMSETFLD:
+ case RES_DBSETNUMBERFLD:
+ ChgDBData(((SwDBNameInfField*) pNewFld)->GetRealDBData());
+ pNewFld->GetTyp()->UpdateFlds();
+
+ break;
+
+ case RES_DBFLD:
+ {
+ // JP 10.02.96: ChgValue aufrufen, damit
+ //die Format- aenderung den ContentString
+ //richtig setzt
+ SwDBField* pDBFld = (SwDBField*)pNewFld;
+ if (pDBFld->IsInitialized())
+ pDBFld->ChgValue( pDBFld->GetValue(), sal_True );
+
+ pDBFld->ClearInitialized();
+ pDBFld->InitContent();
+ }
+ // kein break;
+
+ default:
+ pDstFmtFld->ModifyNotification( 0, pMsgHnt );
+ }
+
+ // Die Felder die wir berechnen koennen werden hier expli.
+ // zum Update angestossen.
+ if( nFldWhich == RES_USERFLD )
+ UpdateUsrFlds();
+ }
+
+ return bTblSelBreak;
+}
+
+bool SwDoc::PutValueToField(const SwPosition & rPos,
+ const Any& rVal, sal_uInt16 nWhich)
+{
+ Any aOldVal;
+ SwField * pField = GetField(rPos);
+
+
+ if (GetIDocumentUndoRedo().DoesUndo() &&
+ pField->QueryValue(aOldVal, nWhich))
+ {
+ SwUndo *const pUndo(new SwUndoFieldFromAPI(rPos, aOldVal, rVal, nWhich));
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ return pField->PutValue(rVal, nWhich);
+}
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
new file mode 100644
index 000000000000..58af4176849a
--- /dev/null
+++ b/sw/source/core/doc/docfly.cxx
@@ -0,0 +1,1021 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <svl/itemiter.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/svdmark.hxx>
+#include <fmtfsize.hxx>
+#include <fmtornt.hxx>
+#include <fmtsrnd.hxx>
+#include <dcontact.hxx>
+
+#include <ndgrf.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <ndindex.hxx>
+#include <docary.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtanchr.hxx>
+#include <txtflcnt.hxx>
+#include <fmtflcnt.hxx>
+#include <txtfrm.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <flyfrms.hxx>
+#include <frmtool.hxx>
+#include <frmfmt.hxx>
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <tblsel.hxx>
+#include <swundo.hxx>
+#include <swtable.hxx>
+#include <crstate.hxx>
+#include <UndoCore.hxx>
+#include <UndoAttribute.hxx>
+#include <fmtcnct.hxx>
+#include <dflyobj.hxx>
+#include <undoflystrattr.hxx>
+#include <switerator.hxx>
+
+extern sal_uInt16 GetHtmlMode( const SwDocShell* );
+
+
+using namespace ::com::sun::star;
+
+sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType ) const
+{
+ const SwSpzFrmFmts& rFmts = *GetSpzFrmFmts();
+ sal_uInt16 nSize = rFmts.Count();
+ sal_uInt16 nCount = 0;
+ const SwNodeIndex* pIdx;
+ for ( sal_uInt16 i = 0; i < nSize; i++)
+ {
+ const SwFrmFmt* pFlyFmt = rFmts[ i ];
+ if( RES_FLYFRMFMT == pFlyFmt->Which()
+ && 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() )
+ && pIdx->GetNodes().IsDocNodes()
+ )
+ {
+ const SwNode* pNd = GetNodes()[ pIdx->GetIndex() + 1 ];
+
+ switch( eType )
+ {
+ case FLYCNTTYPE_FRM:
+ if(!pNd->IsNoTxtNode())
+ nCount++;
+ break;
+
+ case FLYCNTTYPE_GRF:
+ if( pNd->IsGrfNode() )
+ nCount++;
+ break;
+
+ case FLYCNTTYPE_OLE:
+ if(pNd->IsOLENode())
+ nCount++;
+ break;
+
+ default:
+ nCount++;
+ }
+ }
+ }
+ return nCount;
+}
+
+// If you change this, also update SwXFrameEnumeration in unocoll.
+SwFrmFmt* SwDoc::GetFlyNum( sal_uInt16 nIdx, FlyCntType eType )
+{
+ SwSpzFrmFmts& rFmts = *GetSpzFrmFmts();
+ SwFrmFmt* pRetFmt = 0;
+ sal_uInt16 nSize = rFmts.Count();
+ const SwNodeIndex* pIdx;
+ sal_uInt16 nCount = 0;
+ for( sal_uInt16 i = 0; !pRetFmt && i < nSize; ++i )
+ {
+ SwFrmFmt* pFlyFmt = rFmts[ i ];
+ if( RES_FLYFRMFMT == pFlyFmt->Which()
+ && 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() )
+ && pIdx->GetNodes().IsDocNodes()
+ )
+ {
+ const SwNode* pNd = GetNodes()[ pIdx->GetIndex() + 1 ];
+ switch( eType )
+ {
+ case FLYCNTTYPE_FRM:
+ if( !pNd->IsNoTxtNode() && nIdx == nCount++)
+ pRetFmt = pFlyFmt;
+ break;
+ case FLYCNTTYPE_GRF:
+ if(pNd->IsGrfNode() && nIdx == nCount++ )
+ pRetFmt = pFlyFmt;
+ break;
+ case FLYCNTTYPE_OLE:
+ if(pNd->IsOLENode() && nIdx == nCount++)
+ pRetFmt = pFlyFmt;
+ break;
+ default:
+ if(nIdx == nCount++)
+ pRetFmt = pFlyFmt;
+ }
+ }
+ }
+ return pRetFmt;
+}
+
+Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch,
+ const SwFrmFmt* pFlyFmt )
+{
+ Point aRet;
+ if( rDoc.GetCurrentViewShell() ) //swmod 071107//swmod 071225
+ switch( rAnch.GetAnchorId() )
+ {
+ case FLY_AS_CHAR:
+ if( pFlyFmt && rAnch.GetCntntAnchor() )
+ {
+ const SwFrm* pOld = ((SwFlyFrmFmt*)pFlyFmt)->GetFrm( &aRet, sal_False );
+ if( pOld )
+ aRet = pOld->Frm().Pos();
+ }
+ break;
+
+ case FLY_AT_PARA:
+ case FLY_AT_CHAR: // LAYER_IMPL
+ if( rAnch.GetCntntAnchor() )
+ {
+ const SwPosition *pPos = rAnch.GetCntntAnchor();
+ const SwCntntNode* pNd = pPos->nNode.GetNode().GetCntntNode();
+ const SwFrm* pOld = pNd ? pNd->getLayoutFrm( rDoc.GetCurrentLayout(), &aRet, 0, sal_False ) : 0;
+ if( pOld )
+ aRet = pOld->Frm().Pos();
+ }
+ break;
+
+ case FLY_AT_FLY: // LAYER_IMPL
+ if( rAnch.GetCntntAnchor() )
+ {
+ const SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)rAnch.GetCntntAnchor()->
+ nNode.GetNode().GetFlyFmt();
+ const SwFrm* pOld = pFmt ? pFmt->GetFrm( &aRet, sal_False ) : 0;
+ if( pOld )
+ aRet = pOld->Frm().Pos();
+ }
+ break;
+
+ case FLY_AT_PAGE:
+ {
+ sal_uInt16 nPgNum = rAnch.GetPageNum();
+ const SwPageFrm *pPage = (SwPageFrm*)rDoc.GetCurrentLayout()->Lower();
+ for( sal_uInt16 i = 1; (i <= nPgNum) && pPage; ++i,
+ pPage = (const SwPageFrm*)pPage->GetNext() )
+ if( i == nPgNum )
+ {
+ aRet = pPage->Frm().Pos();
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return aRet;
+}
+
+#define MAKEFRMS 0
+#define IGNOREANCHOR 1
+#define DONTMAKEFRMS 2
+
+sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, sal_Bool bNewFrms )
+{
+ //Ankerwechsel sind fast immer in alle 'Richtungen' erlaubt.
+ //Ausnahme: Absatz- bzw. Zeichengebundene Rahmen duerfen wenn sie in
+ //Kopf-/Fusszeilen stehen nicht Seitengebunden werden.
+ const SwFmtAnchor &rOldAnch = rFmt.GetAnchor();
+ const RndStdIds nOld = rOldAnch.GetAnchorId();
+
+ SwFmtAnchor aNewAnch( (SwFmtAnchor&)rSet.Get( RES_ANCHOR ) );
+ RndStdIds nNew = aNewAnch.GetAnchorId();
+
+ // ist der neue ein gueltiger Anker?
+ if( !aNewAnch.GetCntntAnchor() && (FLY_AT_FLY == nNew ||
+ (FLY_AT_PARA == nNew) || (FLY_AS_CHAR == nNew) ||
+ (FLY_AT_CHAR == nNew) ))
+ {
+ return IGNOREANCHOR;
+ }
+
+ if( nOld == nNew )
+ return DONTMAKEFRMS;
+
+
+ Point aOldAnchorPos( ::lcl_FindAnchorLayPos( *this, rOldAnch, &rFmt ));
+ Point aNewAnchorPos( ::lcl_FindAnchorLayPos( *this, aNewAnch, 0 ));
+
+ //Die alten Frms vernichten. Dabei werden die Views implizit gehidet und
+ //doppeltes hiden waere so eine art Show!
+ rFmt.DelFrms();
+
+ if ( FLY_AS_CHAR == nOld )
+ {
+ //Bei InCntnt's wird es spannend: Das TxtAttribut muss vernichtet
+ //werden. Leider reisst dies neben den Frms auch noch das Format mit
+ //in sein Grab. Um dass zu unterbinden loesen wir vorher die
+ //Verbindung zwischen Attribut und Format.
+ const SwPosition *pPos = rOldAnch.GetCntntAnchor();
+ SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
+ ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
+ const xub_StrLen nIdx = pPos->nContent.GetIndex();
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
+ ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
+ "Missing FlyInCnt-Hint." );
+ ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == &rFmt,
+ "Wrong TxtFlyCnt-Hint." );
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt();
+
+ //Die Verbindung ist geloest, jetzt muss noch das Attribut vernichtet
+ //werden.
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
+ }
+
+ //Endlich kann das Attribut gesetzt werden. Es muss das erste Attribut
+ //sein; Undo depends on it!
+ rFmt.SetFmtAttr( aNewAnch );
+
+ //Positionskorrekturen
+ const SfxPoolItem* pItem;
+ switch( nNew )
+ {
+ case FLY_AS_CHAR:
+ //Wenn keine Positionsattribute hereinkommen, dann muss dafuer
+ //gesorgt werden, das keine unerlaubte automatische Ausrichtung
+ //bleibt.
+ {
+ const SwPosition *pPos = aNewAnch.GetCntntAnchor();
+ SwTxtNode *pNd = pPos->nNode.GetNode().GetTxtNode();
+ ASSERT( pNd, "Crsr steht nicht auf TxtNode." );
+
+ SwFmtFlyCnt aFmt( static_cast<SwFlyFrmFmt*>(&rFmt) );
+ pNd->InsertItem( aFmt, pPos->nContent.GetIndex(), 0 );
+ }
+
+ if( SFX_ITEM_SET != rSet.GetItemState( RES_VERT_ORIENT, sal_False, &pItem ))
+ {
+ SwFmtVertOrient aOldV( rFmt.GetVertOrient() );
+ sal_Bool bSet = sal_True;
+ switch( aOldV.GetVertOrient() )
+ {
+ case text::VertOrientation::LINE_TOP: aOldV.SetVertOrient( text::VertOrientation::TOP ); break;
+ case text::VertOrientation::LINE_CENTER: aOldV.SetVertOrient( text::VertOrientation::CENTER); break;
+ case text::VertOrientation::LINE_BOTTOM: aOldV.SetVertOrient( text::VertOrientation::BOTTOM); break;
+ case text::VertOrientation::NONE: aOldV.SetVertOrient( text::VertOrientation::CENTER); break;
+ default:
+ bSet = sal_False;
+ }
+ if( bSet )
+ rSet.Put( aOldV );
+ }
+ break;
+
+ case FLY_AT_PARA:
+ case FLY_AT_CHAR: // LAYER_IMPL
+ case FLY_AT_FLY: // LAYER_IMPL
+ case FLY_AT_PAGE:
+ {
+ //Wenn keine Positionsattribute hereinschneien korrigieren wir
+ //die Position so, dass die Dokumentkoordinaten des Flys erhalten
+ //bleiben.
+ //Chg: Wenn sich in den Positionsattributen lediglich die
+ //Ausrichtung veraendert (text::RelOrientation::FRAME vs. text::RelOrientation::PRTAREA), dann wird die
+ //Position ebenfalls korrigiert.
+ if( SFX_ITEM_SET != rSet.GetItemState( RES_HORI_ORIENT, sal_False, &pItem ))
+ pItem = 0;
+
+ SwFmtHoriOrient aOldH( rFmt.GetHoriOrient() );
+
+ if( text::HoriOrientation::NONE == aOldH.GetHoriOrient() && ( !pItem ||
+ aOldH.GetPos() == ((SwFmtHoriOrient*)pItem)->GetPos() ))
+ {
+ SwTwips nPos = (FLY_AS_CHAR == nOld) ? 0 : aOldH.GetPos();
+ nPos += aOldAnchorPos.X() - aNewAnchorPos.X();
+
+ if( pItem )
+ {
+ SwFmtHoriOrient* pH = (SwFmtHoriOrient*)pItem;
+ aOldH.SetHoriOrient( pH->GetHoriOrient() );
+ aOldH.SetRelationOrient( pH->GetRelationOrient() );
+ }
+ aOldH.SetPos( nPos );
+ rSet.Put( aOldH );
+ }
+
+ if( SFX_ITEM_SET != rSet.GetItemState( RES_VERT_ORIENT, sal_False, &pItem ))
+ pItem = 0;
+ SwFmtVertOrient aOldV( rFmt.GetVertOrient() );
+
+ // OD 2004-05-14 #i28922# - correction: compare <aOldV.GetVertOrient()
+ // with <text::VertOrientation::NONE>
+ if( text::VertOrientation::NONE == aOldV.GetVertOrient() && (!pItem ||
+ aOldV.GetPos() == ((SwFmtVertOrient*)pItem)->GetPos() ) )
+ {
+ SwTwips nPos = (FLY_AS_CHAR == nOld) ? 0 : aOldV.GetPos();
+ nPos += aOldAnchorPos.Y() - aNewAnchorPos.Y();
+ if( pItem )
+ {
+ SwFmtVertOrient* pV = (SwFmtVertOrient*)pItem;
+ aOldV.SetVertOrient( pV->GetVertOrient() );
+ aOldV.SetRelationOrient( pV->GetRelationOrient() );
+ }
+ aOldV.SetPos( nPos );
+ rSet.Put( aOldV );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ if( bNewFrms )
+ rFmt.MakeFrms();
+
+ return MAKEFRMS;
+}
+
+static bool
+lcl_SetFlyFrmAttr(SwDoc & rDoc,
+ sal_Int8 (SwDoc::*pSetFlyFrmAnchor)(SwFrmFmt &, SfxItemSet &, sal_Bool),
+ SwFrmFmt & rFlyFmt, SfxItemSet & rSet)
+{
+ // #i32968# Inserting columns in the frame causes MakeFrmFmt to put two
+ // objects of type SwUndoFrmFmt on the undo stack. We don't want them.
+ ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
+
+ //Ist das Ankerattribut dabei? Falls ja ueberlassen wir die Verarbeitung
+ //desselben einer Spezialmethode. Sie Returnt sal_True wenn der Fly neu
+ //erzeugt werden muss (z.B. weil ein Wechsel des FlyTyps vorliegt).
+ sal_Int8 const nMakeFrms =
+ (SFX_ITEM_SET == rSet.GetItemState( RES_ANCHOR, sal_False ))
+ ? (rDoc.*pSetFlyFrmAnchor)( rFlyFmt, rSet, sal_False )
+ : DONTMAKEFRMS;
+
+ const SfxPoolItem* pItem;
+ SfxItemIter aIter( rSet );
+ SfxItemSet aTmpSet( rDoc.GetAttrPool(), aFrmFmtSetRange );
+ sal_uInt16 nWhich = aIter.GetCurItem()->Which();
+ do {
+ switch( nWhich )
+ {
+ case RES_FILL_ORDER:
+ case RES_BREAK:
+ case RES_PAGEDESC:
+ case RES_CNTNT:
+ case RES_FOOTER:
+ OSL_ENSURE(false, ":-) unknown Attribute for Fly.");
+ // kein break;
+ case RES_CHAIN:
+ rSet.ClearItem( nWhich );
+ break;
+ case RES_ANCHOR:
+ if( DONTMAKEFRMS != nMakeFrms )
+ break;
+
+ default:
+ if( !IsInvalidItem( aIter.GetCurItem() ) && ( SFX_ITEM_SET !=
+ rFlyFmt.GetAttrSet().GetItemState( nWhich, sal_True, &pItem ) ||
+ *pItem != *aIter.GetCurItem() ))
+ aTmpSet.Put( *aIter.GetCurItem() );
+ break;
+ }
+
+ if( aIter.IsAtEnd() )
+ break;
+
+ } while( 0 != ( nWhich = aIter.NextItem()->Which() ) );
+
+ if( aTmpSet.Count() )
+ rFlyFmt.SetFmtAttr( aTmpSet );
+
+ if( MAKEFRMS == nMakeFrms )
+ rFlyFmt.MakeFrms();
+
+ return aTmpSet.Count() || MAKEFRMS == nMakeFrms;
+}
+
+sal_Bool SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet )
+{
+ if( !rSet.Count() )
+ return sal_False;
+
+ ::std::auto_ptr<SwUndoFmtAttrHelper> pSaveUndo;
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it
+ pSaveUndo.reset( new SwUndoFmtAttrHelper( rFlyFmt ) );
+ }
+
+ bool const bRet =
+ lcl_SetFlyFrmAttr(*this, &SwDoc::SetFlyFrmAnchor, rFlyFmt, rSet);
+
+ if ( pSaveUndo.get() )
+ {
+ if ( pSaveUndo->GetUndo() )
+ {
+ GetIDocumentUndoRedo().AppendUndo( pSaveUndo->ReleaseUndo() );
+ }
+ }
+
+ SetModified();
+
+ return bRet;
+}
+
+// --> OD 2009-07-20 #i73249#
+void SwDoc::SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt,
+ const String& sNewTitle )
+{
+ if ( rFlyFrmFmt.GetObjTitle() == sNewTitle )
+ {
+ return;
+ }
+
+ ::sw::DrawUndoGuard const drawUndoGuard(GetIDocumentUndoRedo());
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt,
+ UNDO_FLYFRMFMT_TITLE,
+ rFlyFrmFmt.GetObjTitle(),
+ sNewTitle ) );
+ }
+
+ rFlyFrmFmt.SetObjTitle( sNewTitle, true );
+
+ SetModified();
+}
+
+void SwDoc::SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt,
+ const String& sNewDescription )
+{
+ if ( rFlyFrmFmt.GetObjDescription() == sNewDescription )
+ {
+ return;
+ }
+
+ ::sw::DrawUndoGuard const drawUndoGuard(GetIDocumentUndoRedo());
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt,
+ UNDO_FLYFRMFMT_DESCRIPTION,
+ rFlyFrmFmt.GetObjDescription(),
+ sNewDescription ) );
+ }
+
+ rFlyFrmFmt.SetObjDescription( sNewDescription, true );
+
+ SetModified();
+}
+// <--
+
+sal_Bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt,
+ SfxItemSet* pSet, sal_Bool bKeepOrient )
+{
+ sal_Bool bChgAnchor = sal_False, bFrmSz = sal_False;
+
+ const SwFmtFrmSize aFrmSz( rFmt.GetFrmSize() );
+ const SwFmtVertOrient aVert( rFmt.GetVertOrient() );
+ const SwFmtHoriOrient aHori( rFmt.GetHoriOrient() );
+
+ SwUndoSetFlyFmt* pUndo = 0;
+ bool const bUndo = GetIDocumentUndoRedo().DoesUndo();
+ if (bUndo)
+ {
+ pUndo = new SwUndoSetFlyFmt( rFmt, rNewFmt );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ // #i32968# Inserting columns in the section causes MakeFrmFmt to put
+ // 2 objects of type SwUndoFrmFmt on the undo stack. We don't want them.
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ //Erstmal die Spalten setzen, sonst gibts nix als Aerger mit dem
+ //Set/Reset/Abgleich usw.
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET != rNewFmt.GetAttrSet().GetItemState( RES_COL ))
+ rFmt.ResetFmtAttr( RES_COL );
+
+ if( rFmt.DerivedFrom() != &rNewFmt )
+ {
+ rFmt.SetDerivedFrom( &rNewFmt );
+
+ // 1. wenn nicht automatisch -> ignorieren, sonst -> wech
+ // 2. wech damit, MB!
+ if( SFX_ITEM_SET == rNewFmt.GetAttrSet().GetItemState( RES_FRM_SIZE, sal_False ))
+ {
+ rFmt.ResetFmtAttr( RES_FRM_SIZE );
+ bFrmSz = sal_True;
+ }
+
+ const SfxItemSet* pAsk = pSet;
+ if( !pAsk ) pAsk = &rNewFmt.GetAttrSet();
+ if( SFX_ITEM_SET == pAsk->GetItemState( RES_ANCHOR, sal_False, &pItem )
+ && ((SwFmtAnchor*)pItem)->GetAnchorId() !=
+ rFmt.GetAnchor().GetAnchorId() )
+ {
+ if( pSet )
+ bChgAnchor = MAKEFRMS == SetFlyFrmAnchor( rFmt, *pSet, sal_False );
+ else
+ {
+ //JP 23.04.98: muss den FlyFmt-Range haben, denn im SetFlyFrmAnchor
+ // werden Attribute in diesen gesetzt!
+ SfxItemSet aFlySet( *rNewFmt.GetAttrSet().GetPool(),
+ rNewFmt.GetAttrSet().GetRanges() );
+ aFlySet.Put( *pItem );
+ bChgAnchor = MAKEFRMS == SetFlyFrmAnchor( rFmt, aFlySet, sal_False);
+ }
+ }
+ }
+
+ //Hori und Vert nur dann resetten, wenn in der Vorlage eine
+ //automatische Ausrichtung eingestellt ist, anderfalls den alten Wert
+ //wieder hineinstopfen.
+ //JP 09.06.98: beim Update der RahmenVorlage sollte der Fly NICHT
+ // seine Orientierng verlieren (diese wird nicht geupdatet!)
+ //OS: #96584# text::HoriOrientation::NONE and text::VertOrientation::NONE are allowed now
+ if (!bKeepOrient)
+ {
+ rFmt.ResetFmtAttr(RES_VERT_ORIENT);
+ rFmt.ResetFmtAttr(RES_HORI_ORIENT);
+ }
+
+ rFmt.ResetFmtAttr( RES_PRINT, RES_SURROUND );
+ rFmt.ResetFmtAttr( RES_LR_SPACE, RES_UL_SPACE );
+ rFmt.ResetFmtAttr( RES_BACKGROUND, RES_COL );
+ rFmt.ResetFmtAttr( RES_URL, RES_EDIT_IN_READONLY );
+
+ if( !bFrmSz )
+ rFmt.SetFmtAttr( aFrmSz );
+
+ if( bChgAnchor )
+ rFmt.MakeFrms();
+
+ if( pUndo )
+ pUndo->DeRegisterFromFormat( rFmt );
+
+ SetModified();
+
+ return bChgAnchor;
+}
+
+void SwDoc::GetGrfNms( const SwFlyFrmFmt& rFmt, String* pGrfName,
+ String* pFltName ) const
+{
+ SwNodeIndex aIdx( *rFmt.GetCntnt().GetCntntIdx(), 1 );
+ const SwGrfNode* pGrfNd = aIdx.GetNode().GetGrfNode();
+ if( pGrfNd && pGrfNd->IsLinkedFile() )
+ pGrfNd->GetFileFilterNms( pGrfName, pFltName );
+}
+
+sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
+ RndStdIds _eAnchorType,
+ const sal_Bool _bSameOnly,
+ const sal_Bool _bPosCorr )
+{
+ ASSERT( GetCurrentLayout(), "Ohne Layout geht gar nichts" ); //swmod 080218
+
+ if ( !_rMrkList.GetMarkCount() ||
+ _rMrkList.GetMark( 0 )->GetMarkedSdrObj()->GetUpGroup() )
+ {
+ return false;
+ }
+
+ GetIDocumentUndoRedo().StartUndo( UNDO_INSATTR, NULL );
+
+ sal_Bool bUnmark = sal_False;
+ for ( sal_uInt16 i = 0; i < _rMrkList.GetMarkCount(); ++i )
+ {
+ SdrObject* pObj = _rMrkList.GetMark( i )->GetMarkedSdrObj();
+ if ( !pObj->ISA(SwVirtFlyDrawObj) )
+ {
+ SwDrawContact* pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
+
+ // OD 27.06.2003 #108784# - consider, that drawing object has
+ // no user call. E.g.: a 'virtual' drawing object is disconnected by
+ // the anchor type change of the 'master' drawing object.
+ // Continue with next selected object and assert, if this isn't excepted.
+ if ( !pContact )
+ {
+#ifdef DBG_UTIL
+ bool bNoUserCallExcepted =
+ pObj->ISA(SwDrawVirtObj) &&
+ !static_cast<SwDrawVirtObj*>(pObj)->IsConnected();
+ ASSERT( bNoUserCallExcepted, "SwDoc::ChgAnchor(..) - no contact at selected drawing object" );
+#endif
+ continue;
+ }
+
+ // OD 2004-03-29 #i26791#
+ const SwFrm* pOldAnchorFrm = pContact->GetAnchorFrm( pObj );
+ const SwFrm* pNewAnchorFrm = pOldAnchorFrm;
+
+ // --> OD 2006-03-01 #i54336#
+ // Instead of only keeping the index position for an as-character
+ // anchored object the complete <SwPosition> is kept, because the
+ // anchor index position could be moved, if the object again is
+ // anchored as character.
+// xub_StrLen nIndx = STRING_NOTFOUND;
+ const SwPosition* pOldAsCharAnchorPos( 0L );
+ const RndStdIds eOldAnchorType = pContact->GetAnchorId();
+ if ( !_bSameOnly && eOldAnchorType == FLY_AS_CHAR )
+ {
+ pOldAsCharAnchorPos = new SwPosition( pContact->GetCntntAnchor() );
+ }
+ // <--
+
+ if ( _bSameOnly )
+ _eAnchorType = eOldAnchorType;
+
+ SwFmtAnchor aNewAnch( _eAnchorType );
+ Rectangle aObjRect( pContact->GetAnchoredObj( pObj )->GetObjRect().SVRect() );
+ const Point aPt( aObjRect.TopLeft() );
+
+ switch ( _eAnchorType )
+ {
+ case FLY_AT_PARA:
+ case FLY_AT_CHAR:
+ {
+ const Point aNewPoint = pOldAnchorFrm &&
+ ( pOldAnchorFrm->IsVertical() ||
+ pOldAnchorFrm->IsRightToLeft() )
+ ? aObjRect.TopRight()
+ : aPt;
+
+ // OD 18.06.2003 #108784# - allow drawing objects in header/footer
+ pNewAnchorFrm = ::FindAnchor( pOldAnchorFrm, aNewPoint, false );
+ if ( pNewAnchorFrm->IsTxtFrm() && ((SwTxtFrm*)pNewAnchorFrm)->IsFollow() )
+ {
+ pNewAnchorFrm = ((SwTxtFrm*)pNewAnchorFrm)->FindMaster();
+ }
+ if ( pNewAnchorFrm->IsProtected() )
+ {
+ pNewAnchorFrm = 0;
+ }
+ else
+ {
+ SwPosition aPos( *((SwCntntFrm*)pNewAnchorFrm)->GetNode() );
+ aNewAnch.SetType( _eAnchorType );
+ aNewAnch.SetAnchor( &aPos );
+ }
+ }
+ break;
+
+ case FLY_AT_FLY: // LAYER_IMPL
+ {
+ //Ausgehend von der linken oberen Ecke des Fly den
+ //dichtesten SwFlyFrm suchen.
+ SwFrm *pTxtFrm;
+ {
+ SwCrsrMoveState aState( MV_SETONLYTEXT );
+ SwPosition aPos( GetNodes() );
+ Point aPoint( aPt );
+ aPoint.X() -= 1;
+ GetCurrentLayout()->GetCrsrOfst( &aPos, aPoint, &aState );
+ // OD 20.06.2003 #108784# - consider that drawing objects
+ // can be in header/footer. Thus, <GetFrm()> by left-top-corner
+ pTxtFrm = aPos.nNode.GetNode().
+ GetCntntNode()->getLayoutFrm( GetCurrentLayout(), &aPt, 0, sal_False );
+ }
+ const SwFrm *pTmp = ::FindAnchor( pTxtFrm, aPt );
+ pNewAnchorFrm = pTmp->FindFlyFrm();
+ if( pNewAnchorFrm && !pNewAnchorFrm->IsProtected() )
+ {
+ const SwFrmFmt *pTmpFmt = ((SwFlyFrm*)pNewAnchorFrm)->GetFmt();
+ const SwFmtCntnt& rCntnt = pTmpFmt->GetCntnt();
+ SwPosition aPos( *rCntnt.GetCntntIdx() );
+ aNewAnch.SetAnchor( &aPos );
+ break;
+ }
+
+ aNewAnch.SetType( FLY_AT_PAGE );
+ // no break
+ }
+ case FLY_AT_PAGE:
+ {
+ pNewAnchorFrm = GetCurrentLayout()->Lower();
+ while ( pNewAnchorFrm && !pNewAnchorFrm->Frm().IsInside( aPt ) )
+ pNewAnchorFrm = pNewAnchorFrm->GetNext();
+ if ( !pNewAnchorFrm )
+ continue;
+
+ aNewAnch.SetPageNum( ((SwPageFrm*)pNewAnchorFrm)->GetPhyPageNum());
+ }
+ break;
+ case FLY_AS_CHAR:
+ if( _bSameOnly ) // Positions/Groessenaenderung
+ {
+ if( !pOldAnchorFrm )
+ {
+ pContact->ConnectToLayout();
+ pOldAnchorFrm = pContact->GetAnchorFrm();
+ }
+ ((SwTxtFrm*)pOldAnchorFrm)->Prepare();
+ }
+ else // Ankerwechsel
+ {
+ // OD 18.06.2003 #108784# - allow drawing objects in header/footer
+ pNewAnchorFrm = ::FindAnchor( pOldAnchorFrm, aPt, false );
+ if( pNewAnchorFrm->IsProtected() )
+ {
+ pNewAnchorFrm = 0;
+ break;
+ }
+
+ bUnmark = ( 0 != i );
+ Point aPoint( aPt );
+ aPoint.X() -= 1; // nicht im DrawObj landen!!
+ aNewAnch.SetType( FLY_AS_CHAR );
+ SwPosition aPos( *((SwCntntFrm*)pNewAnchorFrm)->GetNode() );
+ if ( pNewAnchorFrm->Frm().IsInside( aPoint ) )
+ {
+ // es muss ein TextNode gefunden werden, denn nur dort
+ // ist ein inhaltsgebundenes DrawObjekt zu verankern
+ SwCrsrMoveState aState( MV_SETONLYTEXT );
+ GetCurrentLayout()->GetCrsrOfst( &aPos, aPoint, &aState ); //swmod 080218
+ }
+ else
+ {
+ SwCntntNode &rCNd = (SwCntntNode&)
+ *((SwCntntFrm*)pNewAnchorFrm)->GetNode();
+ if ( pNewAnchorFrm->Frm().Bottom() < aPt.Y() )
+ rCNd.MakeStartIndex( &aPos.nContent );
+ else
+ rCNd.MakeEndIndex( &aPos.nContent );
+ }
+ aNewAnch.SetAnchor( &aPos );
+ SetAttr( aNewAnch, *pContact->GetFmt() );
+ // OD 2004-04-13 #i26791# - adjust vertical positioning to
+ // 'center to baseline'
+ SetAttr( SwFmtVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME ), *pContact->GetFmt() );
+ SwTxtNode *pNd = aPos.nNode.GetNode().GetTxtNode();
+ ASSERT( pNd, "Cursor not positioned at TxtNode." );
+
+ SwFmtFlyCnt aFmt( pContact->GetFmt() );
+ pNd->InsertItem( aFmt, aPos.nContent.GetIndex(), 0 );
+ }
+ break;
+ default:
+ ASSERT( !this, "unexpected AnchorId." );
+ }
+
+ if ( (FLY_AS_CHAR != _eAnchorType) &&
+ pNewAnchorFrm &&
+ ( !_bSameOnly || pNewAnchorFrm != pOldAnchorFrm ) )
+ {
+ // OD 2004-04-06 #i26791# - Direct object positioning no longer
+ // needed. Apply of attributes (method call <SetAttr(..)>) takes
+ // care of the invalidation of the object position.
+ SetAttr( aNewAnch, *pContact->GetFmt() );
+ if ( _bPosCorr )
+ {
+ // --> OD 2004-08-24 #i33313# - consider not connected
+ // 'virtual' drawing objects
+ if ( pObj->ISA(SwDrawVirtObj) &&
+ !static_cast<SwDrawVirtObj*>(pObj)->IsConnected() )
+ {
+ SwRect aNewObjRect( aObjRect );
+ static_cast<SwAnchoredDrawObject*>(pContact->GetAnchoredObj( 0L ))
+ ->AdjustPositioningAttr( pNewAnchorFrm,
+ &aNewObjRect );
+
+ }
+ else
+ {
+ static_cast<SwAnchoredDrawObject*>(pContact->GetAnchoredObj( pObj ))
+ ->AdjustPositioningAttr( pNewAnchorFrm );
+ }
+ }
+ }
+
+ // --> OD 2006-03-01 #i54336#
+ if ( pNewAnchorFrm && pOldAsCharAnchorPos )
+ {
+ //Bei InCntnt's wird es spannend: Das TxtAttribut muss vernichtet
+ //werden. Leider reisst dies neben den Frms auch noch das Format mit
+ //in sein Grab. Um dass zu unterbinden loesen wir vorher die
+ //Verbindung zwischen Attribut und Format.
+ const xub_StrLen nIndx( pOldAsCharAnchorPos->nContent.GetIndex() );
+ SwTxtNode* pTxtNode( pOldAsCharAnchorPos->nNode.GetNode().GetTxtNode() );
+ ASSERT( pTxtNode, "<SwDoc::ChgAnchor(..)> - missing previous anchor text node for as-character anchored object" );
+ ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt( nIndx, RES_TXTATR_FLYCNT );
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt();
+
+ //Die Verbindung ist geloest, jetzt muss noch das Attribut vernichtet
+ //werden.
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIndx, nIndx );
+ delete pOldAsCharAnchorPos;
+ }
+ // <--
+ }
+ }
+
+ GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ SetModified();
+
+ return bUnmark;
+}
+
+
+int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest )
+{
+ //Die Source darf noch keinen Follow haben.
+ const SwFmtChain &rOldChain = rSource.GetChain();
+ if ( rOldChain.GetNext() )
+ return SW_CHAIN_SOURCE_CHAINED;
+
+ //Ziel darf natuerlich nicht gleich Source sein und es
+ //darf keine geschlossene Kette entstehen.
+ const SwFrmFmt *pFmt = &rDest;
+ do {
+ if( pFmt == &rSource )
+ return SW_CHAIN_SELF;
+ pFmt = pFmt->GetChain().GetNext();
+ } while ( pFmt );
+
+ //Auch eine Verkettung von Innen nach aussen oder von aussen
+ //nach innen ist nicht zulaessig.
+ if( rDest.IsLowerOf( rSource ) || rSource .IsLowerOf( rDest ) )
+ return SW_CHAIN_SELF;
+
+ //Das Ziel darf noch keinen Master haben.
+ const SwFmtChain &rChain = rDest.GetChain();
+ if( rChain.GetPrev() )
+ return SW_CHAIN_IS_IN_CHAIN;
+
+ //Das Ziel muss leer sein.
+ const SwNodeIndex* pCntIdx = rDest.GetCntnt().GetCntntIdx();
+ if( !pCntIdx )
+ return SW_CHAIN_NOT_FOUND;
+
+ SwNodeIndex aNxtIdx( *pCntIdx, 1 );
+ const SwTxtNode* pTxtNd = aNxtIdx.GetNode().GetTxtNode();
+ if( !pTxtNd )
+ return SW_CHAIN_NOT_FOUND;
+
+ const sal_uLong nFlySttNd = pCntIdx->GetIndex();
+ if( 2 != ( pCntIdx->GetNode().EndOfSectionIndex() - nFlySttNd ) ||
+ pTxtNd->GetTxt().Len() )
+ return SW_CHAIN_NOT_EMPTY;
+
+ sal_uInt16 nArrLen = GetSpzFrmFmts()->Count();
+ for( sal_uInt16 n = 0; n < nArrLen; ++n )
+ {
+ const SwFmtAnchor& rAnchor = (*GetSpzFrmFmts())[ n ]->GetAnchor();
+ sal_uLong nTstSttNd;
+ // OD 11.12.2003 #i20622# - to-frame anchored objects are allowed.
+ if ( ((rAnchor.GetAnchorId() == FLY_AT_PARA) ||
+ (rAnchor.GetAnchorId() == FLY_AT_CHAR)) &&
+ 0 != rAnchor.GetCntntAnchor() &&
+ nFlySttNd <= ( nTstSttNd =
+ rAnchor.GetCntntAnchor()->nNode.GetIndex() ) &&
+ nTstSttNd < nFlySttNd + 2 )
+ {
+ return SW_CHAIN_NOT_EMPTY;
+ }
+ }
+
+ //Auf die richtige Area muessen wir auch noch einen Blick werfen.
+ //Beide Flys muessen im selben Bereich (Body, Head/Foot, Fly) sitzen
+ //Wenn die Source nicht der selektierte Rahmen ist, so reicht es
+ //Wenn ein passender gefunden wird (Der Wunsch kann z.B. von der API
+ //kommen).
+
+ // both in the same fly, header, footer or on the page?
+ const SwFmtAnchor &rSrcAnchor = rSource.GetAnchor(),
+ &rDstAnchor = rDest.GetAnchor();
+ sal_uLong nEndOfExtras = GetNodes().GetEndOfExtras().GetIndex();
+ sal_Bool bAllowed = sal_False;
+ if ( FLY_AT_PAGE == rSrcAnchor.GetAnchorId() )
+ {
+ if ( (FLY_AT_PAGE == rDstAnchor.GetAnchorId()) ||
+ ( rDstAnchor.GetCntntAnchor() &&
+ rDstAnchor.GetCntntAnchor()->nNode.GetIndex() > nEndOfExtras ))
+ bAllowed = sal_True;
+ }
+ else if( rSrcAnchor.GetCntntAnchor() && rDstAnchor.GetCntntAnchor() )
+ {
+ const SwNodeIndex &rSrcIdx = rSrcAnchor.GetCntntAnchor()->nNode,
+ &rDstIdx = rDstAnchor.GetCntntAnchor()->nNode;
+ const SwStartNode* pSttNd = 0;
+ if( rSrcIdx == rDstIdx ||
+ ( !pSttNd &&
+ 0 != ( pSttNd = rSrcIdx.GetNode().FindFlyStartNode() ) &&
+ pSttNd == rDstIdx.GetNode().FindFlyStartNode() ) ||
+ ( !pSttNd &&
+ 0 != ( pSttNd = rSrcIdx.GetNode().FindFooterStartNode() ) &&
+ pSttNd == rDstIdx.GetNode().FindFooterStartNode() ) ||
+ ( !pSttNd &&
+ 0 != ( pSttNd = rSrcIdx.GetNode().FindHeaderStartNode() ) &&
+ pSttNd == rDstIdx.GetNode().FindHeaderStartNode() ) ||
+ ( !pSttNd && rDstIdx.GetIndex() > nEndOfExtras &&
+ rSrcIdx.GetIndex() > nEndOfExtras ))
+ bAllowed = sal_True;
+ }
+
+ return bAllowed ? SW_CHAIN_OK : SW_CHAIN_WRONG_AREA;
+}
+
+int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest )
+{
+ int nErr = Chainable( rSource, rDest );
+ if ( !nErr )
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_CHAINE, NULL );
+
+ SwFlyFrmFmt& rDestFmt = (SwFlyFrmFmt&)rDest;
+
+ //Follow an den Master haengen.
+ SwFmtChain aChain = rDestFmt.GetChain();
+ aChain.SetPrev( &(SwFlyFrmFmt&)rSource );
+ SetAttr( aChain, rDestFmt );
+
+ SfxItemSet aSet( GetAttrPool(), RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_CHAIN, RES_CHAIN, 0 );
+
+ //Follow an den Master haengen.
+ aChain.SetPrev( &(SwFlyFrmFmt&)rSource );
+ SetAttr( aChain, rDestFmt );
+
+ //Master an den Follow haengen und dafuer sorgen, dass der Master
+ //eine fixierte Hoehe hat.
+ aChain = rSource.GetChain();
+ aChain.SetNext( &rDestFmt );
+ aSet.Put( aChain );
+
+ SwFmtFrmSize aSize( rSource.GetFrmSize() );
+ if ( aSize.GetHeightSizeType() != ATT_FIX_SIZE )
+ {
+ SwFlyFrm *pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement( rSource );
+ if ( pFly )
+ aSize.SetHeight( pFly->Frm().Height() );
+ aSize.SetHeightSizeType( ATT_FIX_SIZE );
+ aSet.Put( aSize );
+ }
+ SetAttr( aSet, rSource );
+
+ GetIDocumentUndoRedo().EndUndo( UNDO_CHAINE, NULL );
+ }
+ return nErr;
+}
+
+void SwDoc::Unchain( SwFrmFmt &rFmt )
+{
+ SwFmtChain aChain( rFmt.GetChain() );
+ if ( aChain.GetNext() )
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_UNCHAIN, NULL );
+ SwFrmFmt *pFollow = aChain.GetNext();
+ aChain.SetNext( 0 );
+ SetAttr( aChain, rFmt );
+ aChain = pFollow->GetChain();
+ aChain.SetPrev( 0 );
+ SetAttr( aChain, *pFollow );
+ GetIDocumentUndoRedo().EndUndo( UNDO_UNCHAIN, NULL );
+ }
+}
+
+
+
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
new file mode 100644
index 000000000000..67999d21381c
--- /dev/null
+++ b/sw/source/core/doc/docfmt.cxx
@@ -0,0 +1,2678 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+
+
+#define _ZFORLIST_DECLARE_TABLE
+#define _SVSTDARR_USHORTSSORT
+#define _SVSTDARR_USHORTS
+#include <hintids.hxx>
+#include <rtl/logfile.hxx>
+#include <svl/itemiter.hxx>
+#include <sfx2/app.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <svl/whiter.hxx>
+#ifndef _ZFORLIST_HXX //autogen
+#define _ZFORLIST_DECLARE_TABLE
+#include <svl/zforlist.hxx>
+#endif
+#include <comphelper/processfactory.hxx>
+#include <unotools/misccfg.hxx>
+#include <com/sun/star/i18n/WordType.hdl>
+#include <fmtpdsc.hxx>
+#include <fmthdft.hxx>
+#include <fmtcntnt.hxx>
+#include <frmatr.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <rootfrm.hxx>
+#include <pagefrm.hxx>
+#include <hints.hxx> // fuer SwHyphenBug (in SetDefault)
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <UndoCore.hxx>
+#include <UndoAttribute.hxx>
+#include <ndgrf.hxx>
+#include <pagedesc.hxx> // Fuer Sonderbehandlung in InsFrmFmt
+#include <rolbck.hxx> // Undo-Attr
+#include <mvsave.hxx> // servieren: Veraenderungen erkennen
+#include <txatbase.hxx>
+#include <swtable.hxx>
+#include <swtblfmt.hxx>
+#include <charfmt.hxx>
+#include <docary.hxx>
+#include <paratr.hxx>
+#include <redline.hxx>
+#include <reffld.hxx>
+#include <txtinet.hxx>
+#include <fmtinfmt.hxx>
+#include <breakit.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <fmtautofmt.hxx>
+#include <istyleaccess.hxx>
+#include <SwUndoFmt.hxx>
+#include <docsh.hxx>
+
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+SV_IMPL_PTRARR(SwFrmFmts,SwFrmFmtPtr)
+SV_IMPL_PTRARR(SwCharFmts,SwCharFmtPtr)
+
+//Spezifische Frameformate (Rahmen)
+SV_IMPL_PTRARR(SwSpzFrmFmts,SwFrmFmtPtr)
+
+/*
+ * interne Funktionen
+ */
+
+sal_Bool SetTxtFmtCollNext( const SwTxtFmtCollPtr& rpTxtColl, void* pArgs )
+{
+ SwTxtFmtColl *pDel = (SwTxtFmtColl*) pArgs;
+ if ( &rpTxtColl->GetNextTxtFmtColl() == pDel )
+ {
+ rpTxtColl->SetNextTxtFmtColl( *rpTxtColl );
+ }
+ return sal_True;
+}
+
+/*
+ * Zuruecksetzen der harten Formatierung fuer Text
+ */
+
+// Uebergabeparameter fuer _Rst und lcl_SetTxtFmtColl
+struct ParaRstFmt
+{
+ SwFmtColl* pFmtColl;
+ SwHistory* pHistory;
+ const SwPosition *pSttNd, *pEndNd;
+ const SfxItemSet* pDelSet;
+ sal_uInt16 nWhich;
+ bool bReset;
+ // --> OD 2007-11-06 #i62575#
+ bool bResetListAttrs;
+ // <--
+ bool bResetAll;
+ bool bInclRefToxMark;
+
+ bool bKeepOutlineLevelAttr; //#outline level,add by zhaojianwei
+
+ ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd,
+ SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0 )
+ : pFmtColl(0),
+ pHistory(pHst),
+ pSttNd(pStt),
+ pEndNd(pEnd),
+ pDelSet(pSet),
+ nWhich(nWhch),
+ // --> OD 2007-11-06 #i62675#
+ bReset( false ),
+ bResetListAttrs( false ),
+ // <--
+ bResetAll( true ),
+ bInclRefToxMark( false ),
+ bKeepOutlineLevelAttr( false ) //#outline level,add by zhaojianwei
+ {}
+
+ ParaRstFmt( SwHistory* pHst )
+ : pFmtColl(0),
+ pHistory(pHst),
+ pSttNd(0),
+ pEndNd(0),
+ pDelSet(0),
+ nWhich(0),
+ // --> OD 2007-11-06 #i62675#
+ bReset( false ),
+ bResetListAttrs( false ),
+ // <--
+ bResetAll( true ),
+ bInclRefToxMark( false ),
+ bKeepOutlineLevelAttr( false ) //#outline level,add by zhaojianwei
+ {}
+};
+
+/* in pArgs steht die ChrFmtTablle vom Dokument
+ * (wird bei Selectionen am Start/Ende und bei keiner SSelection benoetigt)
+ */
+
+sal_Bool lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs )
+{
+ ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
+ SwTxtNode * pTxtNode = (SwTxtNode*)rpNd->GetTxtNode();
+ if( pTxtNode && pTxtNode->GetpSwpHints() )
+ {
+ SwIndex aSt( pTxtNode, 0 );
+ sal_uInt16 nEnd = pTxtNode->Len();
+
+ if( &pPara->pSttNd->nNode.GetNode() == pTxtNode &&
+ pPara->pSttNd->nContent.GetIndex() )
+ aSt = pPara->pSttNd->nContent.GetIndex();
+
+ if( &pPara->pEndNd->nNode.GetNode() == rpNd )
+ nEnd = pPara->pEndNd->nContent.GetIndex();
+
+ if( pPara->pHistory )
+ {
+ // fuers Undo alle Attribute sichern
+ SwRegHistory aRHst( *pTxtNode, pPara->pHistory );
+ pTxtNode->GetpSwpHints()->Register( &aRHst );
+ pTxtNode->RstAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich,
+ pPara->pDelSet, pPara->bInclRefToxMark );
+ if( pTxtNode->GetpSwpHints() )
+ pTxtNode->GetpSwpHints()->DeRegister();
+ }
+ else
+ pTxtNode->RstAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich,
+ pPara->pDelSet, pPara->bInclRefToxMark );
+ }
+ return sal_True;
+}
+
+sal_Bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
+{
+ ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
+ SwCntntNode* pNode = (SwCntntNode*)rpNd->GetCntntNode();
+ if( pNode && pNode->HasSwAttrSet() )
+ {
+ const sal_Bool bLocked = pNode->IsModifyLocked();
+ pNode->LockModify();
+
+ SwDoc* pDoc = pNode->GetDoc();
+
+ // --> OD 2008-04-14 #refactorlists#
+ // remove unused attribute RES_LR_SPACE
+ // add list attributes
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_PAGEDESC, RES_BREAK,
+ RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
+ RES_PARATR_OUTLINELEVEL,RES_PARATR_OUTLINELEVEL,//#outline level,removed by zhaojianwei
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
+ 0 );
+ const SfxItemSet* pSet = pNode->GetpSwAttrSet();
+
+ // --> OD 2008-04-15 #refactorlists#
+// std::vector<sal_uInt16> aClearWhichIds;
+ SvUShorts aClearWhichIds;
+ // <--
+ // --> OD 2008-04-15 #refactorlists#
+ // restoring all paragraph list attributes
+ {
+ SfxItemSet aListAttrSet( pDoc->GetAttrPool(),
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
+ 0 );
+ aListAttrSet.Set( *pSet );
+ if ( aListAttrSet.Count() )
+ {
+ aSet.Put( aListAttrSet );
+ SfxItemIter aIter( aListAttrSet );
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ while( pItem )
+ {
+ aClearWhichIds.Insert( pItem->Which(), aClearWhichIds.Count() );
+ pItem = aIter.NextItem();
+ }
+ }
+ }
+ // <--
+
+ const SfxPoolItem* pItem;
+ // sal_uInt16 __READONLY_DATA aSavIds[ 3 ] = { RES_PAGEDESC, RES_BREAK, //#outline level,removed by zhaojianwei
+ // RES_PARATR_NUMRULE };
+ //for( sal_uInt16 n = 0; n < 3; ++n )
+ sal_uInt16 __READONLY_DATA aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK, //->add by zhaojianwei
+ RES_PARATR_NUMRULE,
+ RES_PARATR_OUTLINELEVEL };
+ for( sal_uInt16 n = 0; n < 4; ++n ) //<-end,zhaojianwei
+ {
+ if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], sal_False, &pItem ))
+ {
+ bool bSave = false;
+ switch( aSavIds[ n ] )
+ {
+ case RES_PAGEDESC:
+ bSave = 0 != ((SwFmtPageDesc*)pItem)->GetPageDesc();
+ break;
+ case RES_BREAK:
+ bSave = SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak();
+ break;
+ case RES_PARATR_NUMRULE:
+ {
+ bSave = 0 != ((SwNumRuleItem*)pItem)->GetValue().Len();
+ }
+ break;
+ case RES_PARATR_OUTLINELEVEL: //#outline level,add by zhaojianwei
+ {
+ bSave = pPara && pPara->bKeepOutlineLevelAttr;
+ }
+ break; //<-end,zhaojianwei
+ }
+ if( bSave )
+ {
+ aSet.Put( *pItem );
+ // --> OD 2008-04-15 #refactorlists#
+// aClearWhichIds.push_back( aSavIds[n] );
+ aClearWhichIds.Insert( aSavIds[n], aClearWhichIds.Count() );
+ }
+ }
+ }
+
+ // --> OD 2008-04-14 #refactorlists#
+ // do not clear items directly from item set and only clear to be kept
+ // attributes, if no deletion item set is found.
+// pNode->ClearItemsFromAttrSet( aClearWhichIds );
+ const bool bKeepAttributes =
+ !pPara || !pPara->pDelSet || pPara->pDelSet->Count() == 0;
+ if ( bKeepAttributes )
+ {
+ pNode->ResetAttr( aClearWhichIds );
+ }
+ // <--
+
+ if( !bLocked )
+ pNode->UnlockModify();
+
+ if( pPara )
+ {
+ SwRegHistory aRegH( pNode, *pNode, pPara->pHistory );
+
+ if( pPara->pDelSet && pPara->pDelSet->Count() )
+ {
+ // --> OD 2008-04-15 #refactorlists#
+ ASSERT( !bKeepAttributes,
+ "<lcl_RstAttr(..)> - certain attributes are kept, but not needed. -> please inform OD" );
+ // <--
+ SfxItemIter aIter( *pPara->pDelSet );
+ pItem = aIter.FirstItem();
+ while( sal_True )
+ {
+ // --> OD 2008-04-14 #refactorlists#
+ //
+ if ( ( pItem->Which() != RES_PAGEDESC &&
+ pItem->Which() != RES_BREAK &&
+ pItem->Which() != RES_PARATR_NUMRULE ) ||
+ ( aSet.GetItemState( pItem->Which(), sal_False ) != SFX_ITEM_SET ) )
+ {
+ pNode->ResetAttr( pItem->Which() );
+ }
+ // <--
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+ }
+ else if( pPara->bResetAll )
+ pNode->ResetAllAttr();
+ else
+ pNode->ResetAttr( RES_PARATR_BEGIN, POOLATTR_END - 1 );
+ }
+ else
+ pNode->ResetAllAttr();
+
+ // --> OD 2008-04-15 #refactorlists#
+ // only restore saved attributes, if needed
+ if ( bKeepAttributes && aSet.Count() )
+ // <--
+ {
+ pNode->LockModify();
+
+ pNode->SetAttr( aSet );
+
+ if( !bLocked )
+ pNode->UnlockModify();
+ }
+ }
+ return sal_True;
+}
+
+void SwDoc::RstTxtAttrs(const SwPaM &rRg, sal_Bool bInclRefToxMark )
+{
+ SwHistory* pHst = 0;
+ SwDataChanged aTmp( rRg, 0 );
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg, RES_CHRFMT );
+ pHst = &pUndo->GetHistory();
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
+ ParaRstFmt aPara( pStt, pEnd, pHst );
+ aPara.bInclRefToxMark = ( bInclRefToxMark == sal_True );
+ GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
+ lcl_RstTxtAttr, &aPara );
+ SetModified();
+}
+
+void SwDoc::ResetAttrs( const SwPaM &rRg,
+ sal_Bool bTxtAttr,
+ const SvUShortsSort* pAttrs,
+ // --> OD 2008-11-28 #b96644#
+ const bool bSendDataChangedEvents )
+ // <--
+{
+ SwPaM* pPam = (SwPaM*)&rRg;
+ if( !bTxtAttr && pAttrs && pAttrs->Count() &&
+ RES_TXTATR_END > (*pAttrs)[ 0 ] )
+ bTxtAttr = sal_True;
+
+ if( !rRg.HasMark() )
+ {
+ SwTxtNode* pTxtNd = rRg.GetPoint()->nNode.GetNode().GetTxtNode();
+ if( !pTxtNd )
+ return ;
+
+ pPam = new SwPaM( *rRg.GetPoint() );
+
+ SwIndex& rSt = pPam->GetPoint()->nContent;
+ sal_uInt16 nMkPos, nPtPos = rSt.GetIndex();
+
+ // JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut
+ // dann wird dessen Bereich genommen
+ SwTxtAttr const*const pURLAttr(
+ pTxtNd->GetTxtAttrAt(rSt.GetIndex(), RES_TXTATR_INETFMT));
+ if (pURLAttr && pURLAttr->GetINetFmt().GetValue().Len())
+ {
+ nMkPos = *pURLAttr->GetStart();
+ nPtPos = *pURLAttr->GetEnd();
+ }
+ else
+ {
+ Boundary aBndry;
+ if( pBreakIt->GetBreakIter().is() )
+ aBndry = pBreakIt->GetBreakIter()->getWordBoundary(
+ pTxtNd->GetTxt(), nPtPos,
+ pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
+ WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
+ sal_True );
+
+ if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos )
+ {
+ nMkPos = (xub_StrLen)aBndry.startPos;
+ nPtPos = (xub_StrLen)aBndry.endPos;
+ }
+ else
+ {
+ nPtPos = nMkPos = rSt.GetIndex();
+ if( bTxtAttr )
+ pTxtNd->DontExpandFmt( rSt, sal_True );
+ }
+ }
+
+ rSt = nMkPos;
+ pPam->SetMark();
+ pPam->GetPoint()->nContent = nPtPos;
+ }
+
+ // --> OD 2008-11-28 #i96644#
+// SwDataChanged aTmp( *pPam, 0 );
+ std::auto_ptr< SwDataChanged > pDataChanged;
+ if ( bSendDataChangedEvents )
+ {
+ pDataChanged.reset( new SwDataChanged( *pPam, 0 ) );
+ }
+ // <--
+ SwHistory* pHst = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg,
+ static_cast<sal_uInt16>(bTxtAttr ? RES_CONDTXTFMTCOLL : RES_TXTFMTCOLL ));
+ if( pAttrs && pAttrs->Count() )
+ {
+ pUndo->SetAttrs( *pAttrs );
+ }
+ pHst = &pUndo->GetHistory();
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End();
+ ParaRstFmt aPara( pStt, pEnd, pHst );
+
+ // mst: not including META here; it seems attrs with CH_TXTATR are omitted
+ sal_uInt16 __FAR_DATA aResetableSetRange[] = {
+ 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_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+ RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+ };
+
+ SfxItemSet aDelSet( GetAttrPool(), aResetableSetRange );
+ if( pAttrs && pAttrs->Count() )
+ {
+ for( sal_uInt16 n = pAttrs->Count(); n; )
+ if( POOLATTR_END > (*pAttrs)[ --n ] )
+ aDelSet.Put( *GetDfltAttr( (*pAttrs)[ n ] ));
+
+ if( aDelSet.Count() )
+ aPara.pDelSet = &aDelSet;
+ }
+
+ sal_Bool bAdd = sal_True;
+ SwNodeIndex aTmpStt( pStt->nNode );
+ SwNodeIndex aTmpEnd( pEnd->nNode );
+ if( pStt->nContent.GetIndex() ) // nur ein Teil
+ {
+ // dann spaeter aufsetzen und alle CharFmtAttr -> TxtFmtAttr
+ SwTxtNode* pTNd = aTmpStt.GetNode().GetTxtNode();
+ if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
+ {
+ SfxItemIter aIter( *pTNd->GetpSwAttrSet() );
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END );
+
+ while( sal_True )
+ {
+ if( IsInRange( aCharFmtSetRange, pItem->Which() ))
+ {
+ pTNd->GetOrCreateSwpHints();
+
+ aCharSet.Put( *pItem );
+
+ if( pHst )
+ {
+ SwRegHistory aRegH( pTNd, *pTNd, pHst );
+ pTNd->ResetAttr( pItem->Which() );
+ }
+ else
+ pTNd->ResetAttr( pItem->Which() );
+ }
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+
+ if ( aCharSet.Count() )
+ {
+ if ( pHst )
+ {
+ SwRegHistory history( pTNd, *pTNd, pHst );
+ history.InsertItems( aCharSet, 0, pTNd->GetTxt().Len(),
+ nsSetAttrMode::SETATTR_NOFORMATATTR );
+ }
+ else
+ {
+ SwTxtAttr* pNew =
+ MakeTxtAttr( *this, aCharSet, 0, pTNd->GetTxt().Len() );
+ pTNd->InsertHint( pNew );
+ }
+ }
+ }
+
+ aTmpStt++;
+ }
+ if( pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetCntntNode()->Len() )
+ // dann spaeter aufsetzen und alle CharFmtAttr -> TxtFmtAttr
+ aTmpEnd++, bAdd = sal_False;
+ else if( pStt->nNode != pEnd->nNode || !pStt->nContent.GetIndex() )
+ {
+ SwTxtNode* pTNd = aTmpEnd.GetNode().GetTxtNode();
+ if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
+ {
+ SfxItemIter aIter( *pTNd->GetpSwAttrSet() );
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ while( sal_True )
+ {
+ if( IsInRange( aCharFmtSetRange, pItem->Which() ))
+ {
+ SwTxtAttr* pTAttr = MakeTxtAttr( *this,
+ const_cast<SfxPoolItem&>(*pItem),
+ 0, pTNd->GetTxt().Len() );
+ 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 );
+ }
+ else
+ pTNd->ResetAttr( pItem->Which() );
+ }
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+ }
+ }
+
+ if( aTmpStt < aTmpEnd )
+ GetNodes().ForEach( pStt->nNode, aTmpEnd, lcl_RstAttr, &aPara );
+ else if( !rRg.HasMark() )
+ {
+ aPara.bResetAll = false ;
+ ::lcl_RstAttr( &pStt->nNode.GetNode(), &aPara );
+ aPara.bResetAll = true ;
+ }
+
+ if( bTxtAttr )
+ {
+ if( bAdd )
+ aTmpEnd++;
+ GetNodes().ForEach( pStt->nNode, aTmpEnd, lcl_RstTxtAttr, &aPara );
+ }
+
+ if( pPam != &rRg )
+ delete pPam;
+
+ SetModified();
+}
+
+#define DELETECHARSETS if ( bDelete ) { delete pCharSet; delete pOtherSet; }
+
+// Einfuegen der Hints nach Inhaltsformen;
+// wird in SwDoc::Insert(..., SwFmtHint &rHt) benutzt
+
+static bool
+lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
+ const SetAttrMode nFlags, SwUndoAttr *const pUndo)
+{
+ // teil die Sets auf (fuer Selektion in Nodes)
+ const SfxItemSet* pCharSet = 0;
+ const SfxItemSet* pOtherSet = 0;
+ bool bDelete = false;
+ bool bCharAttr = false;
+ bool bOtherAttr = false;
+
+ // Check, if we can work with rChgSet or if we have to create additional SfxItemSets
+ if ( 1 == rChgSet.Count() )
+ {
+ SfxItemIter aIter( rChgSet );
+ const SfxPoolItem* pItem = aIter.FirstItem();
+ const sal_uInt16 nWhich = pItem->Which();
+
+ if ( isCHRATR(nWhich) ||
+ (RES_TXTATR_CHARFMT == nWhich) ||
+ (RES_TXTATR_INETFMT == nWhich) ||
+ (RES_TXTATR_AUTOFMT == nWhich) ||
+ (RES_TXTATR_UNKNOWN_CONTAINER == nWhich) )
+ {
+ pCharSet = &rChgSet;
+ bCharAttr = true;
+ }
+
+ if ( isPARATR(nWhich)
+ // --> OD 2008-02-25 #refactorlists#
+ || isPARATR_LIST(nWhich)
+ // <--
+ || isFRMATR(nWhich)
+ || isGRFATR(nWhich)
+ || isUNKNOWNATR(nWhich) )
+ {
+ pOtherSet = &rChgSet;
+ bOtherAttr = true;
+ }
+ }
+
+ // Build new itemset if either
+ // - rChgSet.Count() > 1 or
+ // - The attribute in rChgSet does not belong to one of the above categories
+ if ( !bCharAttr && !bOtherAttr )
+ {
+ SfxItemSet* pTmpCharItemSet = new SfxItemSet( pDoc->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_TXTATR_AUTOFMT, RES_TXTATR_AUTOFMT,
+ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ 0 );
+
+ SfxItemSet* pTmpOtherItemSet = new SfxItemSet( pDoc->GetAttrPool(),
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ // --> OD 2008-02-25 #refactorlists#
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ // <--
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_GRFATR_BEGIN, RES_GRFATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0 );
+
+ pTmpCharItemSet->Put( rChgSet );
+ pTmpOtherItemSet->Put( rChgSet );
+
+ pCharSet = pTmpCharItemSet;
+ pOtherSet = pTmpOtherItemSet;
+
+ bDelete = true;
+ }
+
+ SwHistory* pHistory = pUndo ? &pUndo->GetHistory() : 0;
+ bool bRet = false;
+ const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
+ SwCntntNode* pNode = pStt->nNode.GetNode().GetCntntNode();
+
+ if( pNode && pNode->IsTxtNode() )
+ {
+ // -> #i27615#
+ if (rRg.IsInFrontOfLabel())
+ {
+ SwTxtNode * pTxtNd = pNode->GetTxtNode();
+ SwNumRule * pNumRule = pTxtNd->GetNumRule();
+
+ // --> OD 2005-10-24 #126346# - make code robust:
+ if ( !pNumRule )
+ {
+ ASSERT( false,
+ "<InsAttr(..)> - PaM in front of label, but text node has no numbering rule set. This is a serious defect, please inform OD." );
+ DELETECHARSETS
+ return false;
+ }
+ // <--
+
+ SwNumFmt aNumFmt = pNumRule->Get(static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()));
+ SwCharFmt * pCharFmt =
+ pDoc->FindCharFmtByName(aNumFmt.GetCharFmtName());
+
+ if (pCharFmt)
+ {
+ if (pHistory)
+ pHistory->Add(pCharFmt->GetAttrSet(), *pCharFmt);
+
+ if ( pCharSet )
+ pCharFmt->SetFmtAttr(*pCharSet);
+ }
+
+ DELETECHARSETS
+ return true;
+ }
+ // <- #i27615#
+
+ const SwIndex& rSt = pStt->nContent;
+
+ // Attribute ohne Ende haben keinen Bereich
+ if ( !bCharAttr && !bOtherAttr )
+ {
+ SfxItemSet aTxtSet( pDoc->GetAttrPool(),
+ RES_TXTATR_NOEND_BEGIN, RES_TXTATR_NOEND_END-1 );
+ aTxtSet.Put( rChgSet );
+ if( aTxtSet.Count() )
+ {
+ SwRegHistory history( pNode, *pNode, pHistory );
+ bRet = history.InsertItems(
+ aTxtSet, rSt.GetIndex(), rSt.GetIndex(), nFlags ) || bRet;
+
+ if (bRet && (pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline()
+ && pDoc->GetRedlineTbl().Count())))
+ {
+ SwPaM aPam( pStt->nNode, pStt->nContent.GetIndex()-1,
+ pStt->nNode, pStt->nContent.GetIndex() );
+
+ if( pUndo )
+ pUndo->SaveRedlineData( aPam, sal_True );
+
+ if( pDoc->IsRedlineOn() )
+ pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ else
+ pDoc->SplitRedline( aPam );
+ }
+ }
+ }
+
+ // TextAttribute mit Ende expandieren nie ihren Bereich
+ if ( !bCharAttr && !bOtherAttr )
+ {
+ // CharFmt wird gesondert behandelt !!!
+ // JP 22.08.96: URL-Attribute auch!!
+ // TEST_TEMP ToDo: AutoFmt!
+ SfxItemSet aTxtSet( pDoc->GetAttrPool(),
+ RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK,
+ RES_TXTATR_META, RES_TXTATR_METAFIELD,
+ RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
+ 0 );
+
+ aTxtSet.Put( rChgSet );
+ if( aTxtSet.Count() )
+ {
+ sal_uInt16 nInsCnt = rSt.GetIndex();
+ sal_uInt16 nEnd = pStt->nNode == pEnd->nNode
+ ? pEnd->nContent.GetIndex()
+ : pNode->Len();
+ SwRegHistory history( pNode, *pNode, pHistory );
+ bRet = history.InsertItems( aTxtSet, nInsCnt, nEnd, nFlags )
+ || bRet;
+
+ if (bRet && (pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline()
+ && pDoc->GetRedlineTbl().Count())))
+ {
+ // wurde Text-Inhalt eingefuegt? (RefMark/TOXMarks ohne Ende)
+ sal_Bool bTxtIns = nInsCnt != rSt.GetIndex();
+ // wurde Inhalt eingefuegt oder ueber die Selektion gesetzt?
+ SwPaM aPam( pStt->nNode, bTxtIns ? nInsCnt + 1 : nEnd,
+ pStt->nNode, nInsCnt );
+ if( pUndo )
+ pUndo->SaveRedlineData( aPam, bTxtIns );
+
+ if( pDoc->IsRedlineOn() )
+ pDoc->AppendRedline( new SwRedline( bTxtIns
+ ? nsRedlineType_t::REDLINE_INSERT : nsRedlineType_t::REDLINE_FORMAT, aPam ), true);
+ else if( bTxtIns )
+ pDoc->SplitRedline( aPam );
+ }
+ }
+ }
+ }
+
+ // bei PageDesc's, die am Node gesetzt werden, muss immer das
+ // Auto-Flag gesetzt werden!!
+ if( pOtherSet && pOtherSet->Count() )
+ {
+ SwTableNode* pTblNd;
+ const SwFmtPageDesc* pDesc;
+ if( SFX_ITEM_SET == pOtherSet->GetItemState( RES_PAGEDESC,
+ sal_False, (const SfxPoolItem**)&pDesc ))
+ {
+ if( pNode )
+ {
+ // Auto-Flag setzen, nur in Vorlagen ist ohne Auto !
+ SwFmtPageDesc aNew( *pDesc );
+ // Bug 38479: AutoFlag wird jetzt in der WrtShell gesetzt
+ // aNew.SetAuto();
+
+ // Tabellen kennen jetzt auch Umbrueche
+ if( 0 == (nFlags & nsSetAttrMode::SETATTR_APICALL) &&
+ 0 != ( pTblNd = pNode->FindTableNode() ) )
+ {
+ SwTableNode* pCurTblNd = pTblNd;
+ while ( 0 != ( pCurTblNd = pCurTblNd->StartOfSectionNode()->FindTableNode() ) )
+ pTblNd = pCurTblNd;
+
+ // dann am Tabellen Format setzen
+ SwFrmFmt* pFmt = pTblNd->GetTable().GetFrmFmt();
+ SwRegHistory aRegH( pFmt, *pTblNd, pHistory );
+ pFmt->SetFmtAttr( aNew );
+ bRet = true;
+ }
+ else
+ {
+ SwRegHistory aRegH( pNode, *pNode, pHistory );
+ bRet = pNode->SetAttr( aNew ) || bRet;
+ }
+ }
+
+ // bOtherAttr = true means that pOtherSet == rChgSet. In this case
+ // we know, that there is only one attribute in pOtherSet. We cannot
+ // perform the following operations, instead we return:
+ if ( bOtherAttr )
+ return bRet;
+
+ const_cast<SfxItemSet*>(pOtherSet)->ClearItem( RES_PAGEDESC );
+ if( !pOtherSet->Count() )
+ {
+ DELETECHARSETS
+ return bRet;
+ }
+ }
+
+ // Tabellen kennen jetzt auch Umbrueche
+ const SvxFmtBreakItem* pBreak;
+ if( pNode && 0 == (nFlags & nsSetAttrMode::SETATTR_APICALL) &&
+ 0 != (pTblNd = pNode->FindTableNode() ) &&
+ SFX_ITEM_SET == pOtherSet->GetItemState( RES_BREAK,
+ sal_False, (const SfxPoolItem**)&pBreak ) )
+ {
+ SwTableNode* pCurTblNd = pTblNd;
+ while ( 0 != ( pCurTblNd = pCurTblNd->StartOfSectionNode()->FindTableNode() ) )
+ pTblNd = pCurTblNd;
+
+ // dann am Tabellen Format setzen
+ SwFrmFmt* pFmt = pTblNd->GetTable().GetFrmFmt();
+ SwRegHistory aRegH( pFmt, *pTblNd, pHistory );
+ pFmt->SetFmtAttr( *pBreak );
+ bRet = true;
+
+ // bOtherAttr = true means that pOtherSet == rChgSet. In this case
+ // we know, that there is only one attribute in pOtherSet. We cannot
+ // perform the following operations, instead we return:
+ if ( bOtherAttr )
+ return bRet;
+
+ const_cast<SfxItemSet*>(pOtherSet)->ClearItem( RES_BREAK );
+ if( !pOtherSet->Count() )
+ {
+ DELETECHARSETS
+ return bRet;
+ }
+ }
+
+ {
+ // wenns eine PoolNumRule ist, diese ggfs. anlegen
+ const SwNumRuleItem* pRule;
+ sal_uInt16 nPoolId;
+ if( SFX_ITEM_SET == pOtherSet->GetItemState( RES_PARATR_NUMRULE,
+ sal_False, (const SfxPoolItem**)&pRule ) &&
+ !pDoc->FindNumRulePtr( pRule->GetValue() ) &&
+ USHRT_MAX != (nPoolId = SwStyleNameMapper::GetPoolIdFromUIName ( pRule->GetValue(),
+ nsSwGetPoolIdFromName::GET_POOLID_NUMRULE )) )
+ pDoc->GetNumRuleFromPool( nPoolId );
+ }
+
+ }
+
+ if( !rRg.HasMark() ) // kein Bereich
+ {
+ if( !pNode )
+ {
+ DELETECHARSETS
+ return bRet;
+ }
+
+ if( pNode->IsTxtNode() && pCharSet && pCharSet->Count() )
+ {
+ SwTxtNode* pTxtNd = static_cast<SwTxtNode*>(pNode);
+ const SwIndex& rSt = pStt->nContent;
+ sal_uInt16 nMkPos, nPtPos = rSt.GetIndex();
+ const String& rStr = pTxtNd->GetTxt();
+
+ // JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut
+ // dann wird dessen Bereich genommen
+ SwTxtAttr const*const pURLAttr(
+ pTxtNd->GetTxtAttrAt(rSt.GetIndex(), RES_TXTATR_INETFMT));
+ if (pURLAttr && pURLAttr->GetINetFmt().GetValue().Len())
+ {
+ nMkPos = *pURLAttr->GetStart();
+ nPtPos = *pURLAttr->GetEnd();
+ }
+ else
+ {
+ Boundary aBndry;
+ if( pBreakIt->GetBreakIter().is() )
+ aBndry = pBreakIt->GetBreakIter()->getWordBoundary(
+ pTxtNd->GetTxt(), nPtPos,
+ pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
+ WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
+ sal_True );
+
+ if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos )
+ {
+ nMkPos = (xub_StrLen)aBndry.startPos;
+ nPtPos = (xub_StrLen)aBndry.endPos;
+ }
+ else
+ nPtPos = nMkPos = rSt.GetIndex();
+ }
+
+ // erstmal die zu ueberschreibenden Attribute aus dem
+ // SwpHintsArray entfernen, wenn die Selektion den gesamten
+ // Absatz umspannt. (Diese Attribute werden als FormatAttr.
+ // eingefuegt und verdraengen nie die TextAttr.!)
+ if( !(nFlags & nsSetAttrMode::SETATTR_DONTREPLACE ) &&
+ pTxtNd->HasHints() && !nMkPos && nPtPos == rStr.Len() )
+ {
+ SwIndex aSt( pTxtNd );
+ if( pHistory )
+ {
+ // fuers Undo alle Attribute sichern
+ SwRegHistory aRHst( *pTxtNd, pHistory );
+ pTxtNd->GetpSwpHints()->Register( &aRHst );
+ pTxtNd->RstAttr( aSt, nPtPos, 0, pCharSet );
+ if( pTxtNd->GetpSwpHints() )
+ pTxtNd->GetpSwpHints()->DeRegister();
+ }
+ else
+ pTxtNd->RstAttr( aSt, nPtPos, 0, pCharSet );
+ }
+
+ // the SwRegHistory inserts the attribute into the TxtNode!
+ SwRegHistory history( pNode, *pNode, pHistory );
+ bRet = history.InsertItems( *pCharSet, nMkPos, nPtPos, nFlags )
+ || bRet;
+
+ if( pDoc->IsRedlineOn() )
+ {
+ SwPaM aPam( *pNode, nMkPos, *pNode, nPtPos );
+
+ if( pUndo )
+ pUndo->SaveRedlineData( aPam, sal_False );
+ pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_FORMAT, aPam ), true);
+ }
+ }
+ if( pOtherSet && pOtherSet->Count() )
+ {
+ SwRegHistory aRegH( pNode, *pNode, pHistory );
+ bRet = pNode->SetAttr( *pOtherSet ) || bRet;
+ }
+
+ DELETECHARSETS
+ return bRet;
+ }
+
+ if( pDoc->IsRedlineOn() && pCharSet && pCharSet->Count() )
+ {
+ if( pUndo )
+ pUndo->SaveRedlineData( rRg, sal_False );
+ pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_FORMAT, rRg ), true);
+ }
+
+ /* jetzt wenn Bereich */
+ sal_uLong nNodes = 0;
+
+ SwNodeIndex aSt( pDoc->GetNodes() );
+ SwNodeIndex aEnd( pDoc->GetNodes() );
+ SwIndex aCntEnd( pEnd->nContent );
+
+ if( pNode )
+ {
+ sal_uInt16 nLen = pNode->Len();
+ if( pStt->nNode != pEnd->nNode )
+ aCntEnd.Assign( pNode, nLen );
+
+ if( pStt->nContent.GetIndex() != 0 || aCntEnd.GetIndex() != nLen )
+ {
+ // the SwRegHistory inserts the attribute into the TxtNode!
+ if( pNode->IsTxtNode() && pCharSet && pCharSet->Count() )
+ {
+ SwRegHistory history( pNode, *pNode, pHistory );
+ bRet = history.InsertItems(*pCharSet,
+ pStt->nContent.GetIndex(), aCntEnd.GetIndex(), nFlags)
+ || bRet;
+ }
+
+ if( pOtherSet && pOtherSet->Count() )
+ {
+ SwRegHistory aRegH( pNode, *pNode, pHistory );
+ bRet = pNode->SetAttr( *pOtherSet ) || bRet;
+ }
+
+ // lediglich Selektion in einem Node.
+ if( pStt->nNode == pEnd->nNode )
+ {
+ DELETECHARSETS
+ return bRet;
+ }
+ ++nNodes;
+ aSt.Assign( pStt->nNode.GetNode(), +1 );
+ }
+ else
+ aSt = pStt->nNode;
+ aCntEnd = pEnd->nContent; // aEnd wurde veraendert !!
+ }
+ else
+ aSt.Assign( pStt->nNode.GetNode(), +1 );
+
+ // aSt zeigt jetzt auf den ersten vollen Node
+
+ /*
+ * die Selektion umfasst mehr als einen Node
+ */
+ if( pStt->nNode < pEnd->nNode )
+ {
+ pNode = pEnd->nNode.GetNode().GetCntntNode();
+ if(pNode)
+ {
+ sal_uInt16 nLen = pNode->Len();
+ if( aCntEnd.GetIndex() != nLen )
+ {
+ // the SwRegHistory inserts the attribute into the TxtNode!
+ if( pNode->IsTxtNode() && pCharSet && pCharSet->Count() )
+ {
+ SwRegHistory history( pNode, *pNode, pHistory );
+ history.InsertItems(*pCharSet,
+ 0, aCntEnd.GetIndex(), nFlags);
+ }
+
+ if( pOtherSet && pOtherSet->Count() )
+ {
+ SwRegHistory aRegH( pNode, *pNode, pHistory );
+ pNode->SetAttr( *pOtherSet );
+ }
+
+ ++nNodes;
+ aEnd = pEnd->nNode;
+ }
+ else
+ aEnd.Assign( pEnd->nNode.GetNode(), +1 );
+ }
+ else
+ aEnd = pEnd->nNode;
+ }
+ else
+ aEnd.Assign( pEnd->nNode.GetNode(), +1 );
+
+ // aEnd zeigt jetzt HINTER den letzten voll Node
+
+ /* Bearbeitung der vollstaendig selektierten Nodes. */
+// alle Attribute aus dem Set zuruecksetzen !!
+ if( pCharSet && pCharSet->Count() && !( nsSetAttrMode::SETATTR_DONTREPLACE & nFlags ) )
+ {
+
+ ParaRstFmt aPara( pStt, pEnd, pHistory, 0, pCharSet );
+ pDoc->GetNodes().ForEach( aSt, aEnd, lcl_RstTxtAttr, &aPara );
+ }
+
+ sal_Bool bCreateSwpHints = pCharSet && (
+ SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_CHARFMT, sal_False ) ||
+ SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_INETFMT, sal_False ) );
+
+ for(; aSt < aEnd; aSt++ )
+ {
+ pNode = aSt.GetNode().GetCntntNode();
+ if( !pNode )
+ continue;
+
+ SwTxtNode* pTNd = pNode->GetTxtNode();
+ if( pHistory )
+ {
+ SwRegHistory aRegH( pNode, *pNode, pHistory );
+ SwpHints *pSwpHints;
+
+ if( pTNd && pCharSet && pCharSet->Count() )
+ {
+ pSwpHints = bCreateSwpHints ? &pTNd->GetOrCreateSwpHints()
+ : pTNd->GetpSwpHints();
+ if( pSwpHints )
+ pSwpHints->Register( &aRegH );
+
+ pTNd->SetAttr( *pCharSet, 0, pTNd->GetTxt().Len(), nFlags );
+ if( pSwpHints )
+ pSwpHints->DeRegister();
+ }
+ if( pOtherSet && pOtherSet->Count() )
+ pNode->SetAttr( *pOtherSet );
+ }
+ else
+ {
+ if( pTNd && pCharSet && pCharSet->Count() )
+ pTNd->SetAttr( *pCharSet, 0, pTNd->GetTxt().Len(), nFlags );
+ if( pOtherSet && pOtherSet->Count() )
+ pNode->SetAttr( *pOtherSet );
+ }
+ ++nNodes;
+ }
+
+ DELETECHARSETS
+ return (nNodes != 0) || bRet;
+}
+
+
+bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt,
+ const SetAttrMode nFlags )
+{
+ SwDataChanged aTmp( rRg, 0 );
+ SwUndoAttr* pUndoAttr = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ pUndoAttr = new SwUndoAttr( rRg, rHt, nFlags );
+ }
+
+ SfxItemSet aSet( GetAttrPool(), rHt.Which(), rHt.Which() );
+ aSet.Put( rHt );
+ bool bRet = lcl_InsAttr( this, rRg, aSet, nFlags, pUndoAttr );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndoAttr );
+ }
+
+ if( bRet )
+ SetModified();
+ return bRet;
+}
+
+bool SwDoc::InsertItemSet ( const SwPaM &rRg, const SfxItemSet &rSet,
+ const SetAttrMode nFlags )
+{
+ SwDataChanged aTmp( rRg, 0 );
+ SwUndoAttr* pUndoAttr = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ pUndoAttr = new SwUndoAttr( rRg, rSet, nFlags );
+ }
+
+ bool bRet = lcl_InsAttr( this, rRg, rSet, nFlags, pUndoAttr );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndoAttr );
+ }
+
+ if( bRet )
+ SetModified();
+ return bRet;
+}
+
+
+ // Setze das Attribut im angegebenen Format. Ist Undo aktiv, wird
+ // das alte in die Undo-History aufgenommen
+void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFmt& rFmt )
+{
+ SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() );
+ aSet.Put( rAttr );
+ SetAttr( aSet, rFmt );
+}
+
+
+ // Setze das Attribut im angegebenen Format. Ist Undo aktiv, wird
+ // das alte in die Undo-History aufgenommen
+void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt )
+{
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndoFmtAttrHelper aTmp( rFmt );
+ rFmt.SetFmtAttr( rSet );
+ if ( aTmp.GetUndo() )
+ {
+ GetIDocumentUndoRedo().AppendUndo( aTmp.ReleaseUndo() );
+ }
+ else
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ }
+ }
+ else
+ {
+ rFmt.SetFmtAttr( rSet );
+ }
+ SetModified();
+}
+
+// --> OD 2008-02-12 #newlistlevelattrs#
+void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId,
+ SwFmt& rChangedFormat )
+{
+ SwUndo *const pUndo = (GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoFmtResetAttr( rChangedFormat, nWhichId )
+ : 0;
+
+ const sal_Bool bAttrReset = rChangedFormat.ResetFmtAttr( nWhichId );
+
+ if ( bAttrReset )
+ {
+ if ( pUndo )
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+
+ SetModified();
+ }
+ else if ( pUndo )
+ delete pUndo;
+}
+// <--
+
+int lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth,
+ SvxTabStopItem& rChgTabStop )
+{
+ // dann aender bei allen TabStop die default's auf den neuen Wert
+ // !!! Achtung: hier wird immer auf dem PoolAttribut gearbeitet,
+ // damit nicht in allen Sets die gleiche Berechnung
+ // auf dem gleichen TabStop (gepoolt!) vorgenommen
+ // wird. Als Modify wird ein FmtChg verschickt.
+
+ sal_uInt16 nOldCnt = rChgTabStop.Count();
+ if( !nOldCnt || nOldWidth == nNewWidth )
+ return sal_False;
+
+ // suche den Anfang der Defaults
+ SvxTabStop* pTabs = ((SvxTabStop*)rChgTabStop.GetStart())
+ + (nOldCnt-1);
+ sal_uInt16 n;
+
+ for( n = nOldCnt; n ; --n, --pTabs )
+ if( SVX_TAB_ADJUST_DEFAULT != pTabs->GetAdjustment() )
+ break;
+ ++n;
+ if( n < nOldCnt ) // die DefTabStops loeschen
+ rChgTabStop.Remove( n, nOldCnt - n );
+ return sal_True;
+}
+
+// Setze das Attribut als neues default Attribut in diesem Dokument.
+// Ist Undo aktiv, wird das alte in die Undo-History aufgenommen
+void SwDoc::SetDefault( const SfxPoolItem& rAttr )
+{
+ SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() );
+ aSet.Put( rAttr );
+ SetDefault( aSet );
+}
+
+void SwDoc::SetDefault( const SfxItemSet& rSet )
+{
+ if( !rSet.Count() )
+ return;
+
+ SwModify aCallMod( 0 );
+ SwAttrSet aOld( GetAttrPool(), rSet.GetRanges() ),
+ aNew( GetAttrPool(), rSet.GetRanges() );
+ SfxItemIter aIter( rSet );
+ sal_uInt16 nWhich;
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ SfxItemPool* pSdrPool = GetAttrPool().GetSecondaryPool();
+ while( sal_True )
+ {
+ sal_Bool bCheckSdrDflt = sal_False;
+ nWhich = pItem->Which();
+ aOld.Put( GetAttrPool().GetDefaultItem( nWhich ) );
+ GetAttrPool().SetPoolDefaultItem( *pItem );
+ aNew.Put( GetAttrPool().GetDefaultItem( nWhich ) );
+
+ if (isCHRATR(nWhich) || isTXTATR(nWhich))
+ {
+ aCallMod.Add( pDfltTxtFmtColl );
+ aCallMod.Add( pDfltCharFmt );
+ bCheckSdrDflt = 0 != pSdrPool;
+ }
+ else if ( isPARATR(nWhich) ||
+ // --> OD 2008-02-25 #refactorlists#
+ isPARATR_LIST(nWhich) )
+ // <--
+ {
+ aCallMod.Add( pDfltTxtFmtColl );
+ bCheckSdrDflt = 0 != pSdrPool;
+ }
+ else if (isGRFATR(nWhich))
+ {
+ aCallMod.Add( pDfltGrfFmtColl );
+ }
+ else if (isFRMATR(nWhich))
+ {
+ aCallMod.Add( pDfltGrfFmtColl );
+ aCallMod.Add( pDfltTxtFmtColl );
+ aCallMod.Add( pDfltFrmFmt );
+ }
+ else if (isBOXATR(nWhich))
+ {
+ aCallMod.Add( pDfltFrmFmt );
+ }
+
+ // copy also the defaults
+ if( bCheckSdrDflt )
+ {
+ sal_uInt16 nEdtWhich, nSlotId;
+ if( 0 != (nSlotId = GetAttrPool().GetSlotId( nWhich ) ) &&
+ nSlotId != nWhich &&
+ 0 != (nEdtWhich = pSdrPool->GetWhich( nSlotId )) &&
+ nSlotId != nEdtWhich )
+ {
+ SfxPoolItem* pCpy = pItem->Clone();
+ pCpy->SetWhich( nEdtWhich );
+ pSdrPool->SetPoolDefaultItem( *pCpy );
+ delete pCpy;
+ }
+ }
+
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+
+ if( aNew.Count() && aCallMod.GetDepends() )
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoDefaultAttr( aOld ) );
+ }
+
+ const SfxPoolItem* pTmpItem;
+ if( ( SFX_ITEM_SET ==
+ aNew.GetItemState( RES_PARATR_TABSTOP, sal_False, &pTmpItem ) ) &&
+ ((SvxTabStopItem*)pTmpItem)->Count() )
+ {
+ // TabStop-Aenderungen behandeln wir erstmal anders:
+ // dann aender bei allen TabStop die dafault's auf den neuen Wert
+ // !!! Achtung: hier wird immer auf dem PoolAttribut gearbeitet,
+ // damit nicht in allen Sets die gleiche Berechnung
+ // auf dem gleichen TabStop (gepoolt!) vorgenommen
+ // wird. Als Modify wird ein FmtChg verschickt.
+ SwTwips nNewWidth = (*(SvxTabStopItem*)pTmpItem)[ 0 ].GetTabPos(),
+ nOldWidth = ((SvxTabStopItem&)aOld.Get(RES_PARATR_TABSTOP))[ 0 ].GetTabPos();
+
+ int bChg = sal_False;
+ sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_PARATR_TABSTOP );
+ for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+ if( 0 != (pTmpItem = GetAttrPool().GetItem2( RES_PARATR_TABSTOP, n ) ))
+ bChg |= lcl_SetNewDefTabStops( nOldWidth, nNewWidth,
+ *(SvxTabStopItem*)pTmpItem );
+
+ aNew.ClearItem( RES_PARATR_TABSTOP );
+ aOld.ClearItem( RES_PARATR_TABSTOP );
+ if( bChg )
+ {
+ SwFmtChg aChgFmt( pDfltCharFmt );
+ // dann sage mal den Frames bescheid
+ aCallMod.ModifyNotification( &aChgFmt, &aChgFmt );
+ }
+ }
+ }
+
+ if( aNew.Count() && aCallMod.GetDepends() )
+ {
+ SwAttrSetChg aChgOld( aOld, aOld );
+ SwAttrSetChg aChgNew( aNew, aNew );
+ aCallMod.ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+
+ // und die default-Formate wieder beim Object austragen
+ SwClient* pDep;
+ while( 0 != ( pDep = (SwClient*)aCallMod.GetDepends()) )
+ aCallMod.Remove( pDep );
+
+ SetModified();
+}
+
+ // Erfrage das Default Attribut in diesem Dokument.
+const SfxPoolItem& SwDoc::GetDefault( sal_uInt16 nFmtHint ) const
+{
+ return GetAttrPool().GetDefaultItem( nFmtHint );
+}
+
+/*
+ * Loeschen der Formate
+ */
+void SwDoc::DelCharFmt(sal_uInt16 nFmt, sal_Bool bBroadcast)
+{
+ SwCharFmt * pDel = (*pCharFmtTbl)[nFmt];
+
+ if (bBroadcast)
+ BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_CHAR,
+ SFX_STYLESHEET_ERASED);
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo * pUndo =
+ new SwUndoCharFmtDelete(pDel, this);
+
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ pCharFmtTbl->DeleteAndDestroy(nFmt);
+
+ SetModified();
+}
+
+void SwDoc::DelCharFmt( SwCharFmt *pFmt, sal_Bool bBroadcast )
+{
+ sal_uInt16 nFmt = pCharFmtTbl->GetPos( pFmt );
+ ASSERT( USHRT_MAX != nFmt, "Fmt not found," );
+
+ DelCharFmt( nFmt, bBroadcast );
+}
+
+void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, sal_Bool bBroadcast )
+{
+ if( pFmt->ISA( SwTableBoxFmt ) || pFmt->ISA( SwTableLineFmt ))
+ {
+ ASSERT( !this, "Format steht nicht mehr im DocArray, "
+ "kann per delete geloescht werden" );
+ delete pFmt;
+ }
+ else
+ {
+
+ //Das Format muss in einem der beiden Arrays stehen, in welchem
+ //werden wir schon merken.
+ sal_uInt16 nPos;
+ if ( USHRT_MAX != ( nPos = pFrmFmtTbl->GetPos( pFmt )) )
+ {
+ if (bBroadcast)
+ BroadcastStyleOperation(pFmt->GetName(),
+ SFX_STYLE_FAMILY_FRAME,
+ SFX_STYLESHEET_ERASED);
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo * pUndo = new SwUndoFrmFmtDelete(pFmt, this);
+
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ pFrmFmtTbl->DeleteAndDestroy( nPos );
+ }
+ else
+ {
+ nPos = GetSpzFrmFmts()->GetPos( pFmt );
+ ASSERT( nPos != USHRT_MAX, "FrmFmt not found." );
+ if( USHRT_MAX != nPos )
+ GetSpzFrmFmts()->DeleteAndDestroy( nPos );
+ }
+ }
+}
+
+void SwDoc::DelTblFrmFmt( SwTableFmt *pFmt )
+{
+ sal_uInt16 nPos = pTblFrmFmtTbl->GetPos( pFmt );
+ ASSERT( USHRT_MAX != nPos, "Fmt not found," );
+ pTblFrmFmtTbl->DeleteAndDestroy( nPos );
+}
+
+/*
+ * Erzeugen der Formate
+ */
+SwFlyFrmFmt *SwDoc::MakeFlyFrmFmt( const String &rFmtName,
+ SwFrmFmt *pDerivedFrom )
+{
+ SwFlyFrmFmt *pFmt = new SwFlyFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom );
+ GetSpzFrmFmts()->Insert(pFmt, GetSpzFrmFmts()->Count());
+ SetModified();
+ return pFmt;
+}
+
+SwDrawFrmFmt *SwDoc::MakeDrawFrmFmt( const String &rFmtName,
+ SwFrmFmt *pDerivedFrom )
+{
+ SwDrawFrmFmt *pFmt = new SwDrawFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom);
+ GetSpzFrmFmts()->Insert(pFmt,GetSpzFrmFmts()->Count());
+ SetModified();
+ return pFmt;
+}
+
+
+sal_uInt16 SwDoc::GetTblFrmFmtCount(sal_Bool bUsed) const
+{
+ sal_uInt16 nCount = pTblFrmFmtTbl->Count();
+ if(bUsed)
+ {
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
+ for ( sal_uInt16 i = nCount; i; )
+ {
+ if((*pTblFrmFmtTbl)[--i]->GetInfo( aGetHt ))
+
+ --nCount;
+ }
+ }
+
+ return nCount;
+}
+
+
+SwFrmFmt& SwDoc::GetTblFrmFmt(sal_uInt16 nFmt, sal_Bool bUsed ) const
+{
+ sal_uInt16 nRemoved = 0;
+ if(bUsed)
+ {
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
+ for ( sal_uInt16 i = 0; i <= nFmt; i++ )
+ {
+ while ( (*pTblFrmFmtTbl)[ i + nRemoved]->GetInfo( aGetHt ))
+ {
+ nRemoved++;
+ }
+ }
+ }
+ return *((*pTblFrmFmtTbl)[nRemoved + nFmt]);
+}
+
+SwTableFmt* SwDoc::MakeTblFrmFmt( const String &rFmtName,
+ SwFrmFmt *pDerivedFrom )
+{
+ SwTableFmt* pFmt = new SwTableFmt( GetAttrPool(), rFmtName, pDerivedFrom );
+ pTblFrmFmtTbl->Insert( pFmt, pTblFrmFmtTbl->Count() );
+ SetModified();
+
+ return pFmt;
+}
+
+SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName,
+ SwFrmFmt *pDerivedFrom,
+ sal_Bool bBroadcast, sal_Bool bAuto)
+{
+
+ SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom );
+
+ pFmt->SetAuto(bAuto);
+ pFrmFmtTbl->Insert( pFmt, pFrmFmtTbl->Count());
+ SetModified();
+
+ if (bBroadcast)
+ {
+ BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
+ SFX_STYLESHEET_CREATED);
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo * pUndo = new SwUndoFrmFmtCreate(pFmt, pDerivedFrom, this);
+
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ }
+
+ return pFmt;
+}
+
+SwFmt *SwDoc::_MakeFrmFmt(const String &rFmtName,
+ SwFmt *pDerivedFrom,
+ sal_Bool bBroadcast, sal_Bool bAuto)
+{
+ SwFrmFmt *pFrmFmt = dynamic_cast<SwFrmFmt*>(pDerivedFrom);
+ pFrmFmt = MakeFrmFmt( rFmtName, pFrmFmt, bBroadcast, bAuto );
+ return dynamic_cast<SwFmt*>(pFrmFmt);
+}
+
+
+// --> OD 2005-01-13 #i40550# - add parameter <bAuto> - not relevant
+SwCharFmt *SwDoc::MakeCharFmt( const String &rFmtName,
+ SwCharFmt *pDerivedFrom,
+ sal_Bool bBroadcast,
+ sal_Bool )
+// <--
+{
+ SwCharFmt *pFmt = new SwCharFmt( GetAttrPool(), rFmtName, pDerivedFrom );
+ pCharFmtTbl->Insert( pFmt, pCharFmtTbl->Count() );
+ pFmt->SetAuto( sal_False );
+ SetModified();
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo * pUndo = new SwUndoCharFmtCreate(pFmt, pDerivedFrom, this);
+
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ if (bBroadcast)
+ {
+ BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_CHAR,
+ SFX_STYLESHEET_CREATED);
+ }
+
+ return pFmt;
+}
+
+SwFmt *SwDoc::_MakeCharFmt(const String &rFmtName,
+ SwFmt *pDerivedFrom,
+ sal_Bool bBroadcast, sal_Bool bAuto)
+{
+ SwCharFmt *pCharFmt = dynamic_cast<SwCharFmt*>(pDerivedFrom);
+ pCharFmt = MakeCharFmt( rFmtName, pCharFmt, bBroadcast, bAuto );
+ return dynamic_cast<SwFmt*>(pCharFmt);
+}
+
+
+/*
+ * Erzeugen der FormatCollections
+ */
+// TXT
+// --> OD 2005-01-13 #i40550# - add parameter <bAuto> - not relevant
+SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const String &rFmtName,
+ SwTxtFmtColl *pDerivedFrom,
+ sal_Bool bBroadcast,
+ sal_Bool )
+// <--
+{
+ SwTxtFmtColl *pFmtColl = new SwTxtFmtColl( GetAttrPool(), rFmtName,
+ pDerivedFrom );
+ pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count());
+ pFmtColl->SetAuto( sal_False );
+ SetModified();
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo * pUndo = new SwUndoTxtFmtCollCreate(pFmtColl, pDerivedFrom,
+ this);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ if (bBroadcast)
+ BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
+ SFX_STYLESHEET_CREATED);
+
+ return pFmtColl;
+}
+
+SwFmt *SwDoc::_MakeTxtFmtColl(const String &rFmtName,
+ SwFmt *pDerivedFrom,
+ sal_Bool bBroadcast, sal_Bool bAuto)
+{
+ SwTxtFmtColl *pTxtFmtColl = dynamic_cast<SwTxtFmtColl*>(pDerivedFrom);
+ pTxtFmtColl = MakeTxtFmtColl( rFmtName, pTxtFmtColl, bBroadcast, bAuto );
+ return dynamic_cast<SwFmt*>(pTxtFmtColl);
+}
+
+
+//FEATURE::CONDCOLL
+SwConditionTxtFmtColl* SwDoc::MakeCondTxtFmtColl( const String &rFmtName,
+ SwTxtFmtColl *pDerivedFrom,
+ sal_Bool bBroadcast)
+{
+ SwConditionTxtFmtColl*pFmtColl = new SwConditionTxtFmtColl( GetAttrPool(),
+ rFmtName, pDerivedFrom );
+ pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count());
+ pFmtColl->SetAuto( sal_False );
+ SetModified();
+
+ if (bBroadcast)
+ BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
+ SFX_STYLESHEET_CREATED);
+
+ return pFmtColl;
+}
+//FEATURE::CONDCOLL
+
+// GRF
+
+SwGrfFmtColl* SwDoc::MakeGrfFmtColl( const String &rFmtName,
+ SwGrfFmtColl *pDerivedFrom )
+{
+ SwGrfFmtColl *pFmtColl = new SwGrfFmtColl( GetAttrPool(), rFmtName,
+ pDerivedFrom );
+ pGrfFmtCollTbl->Insert( pFmtColl, pGrfFmtCollTbl->Count() );
+ pFmtColl->SetAuto( sal_False );
+ SetModified();
+ return pFmtColl;
+}
+
+void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, sal_Bool bBroadcast)
+{
+ ASSERT( nFmtColl, "Remove fuer Coll 0." );
+
+ // Wer hat die zu loeschende als Next
+ SwTxtFmtColl *pDel = (*pTxtFmtCollTbl)[nFmtColl];
+ if( pDfltTxtFmtColl == pDel )
+ return; // default nie loeschen !!
+
+ if (bBroadcast)
+ BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_PARA,
+ SFX_STYLESHEET_ERASED);
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndoTxtFmtCollDelete * pUndo =
+ new SwUndoTxtFmtCollDelete(pDel, this);
+
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ // Die FmtColl austragen
+ pTxtFmtCollTbl->Remove(nFmtColl);
+ // Next korrigieren
+ pTxtFmtCollTbl->ForEach( 1, pTxtFmtCollTbl->Count(),
+ &SetTxtFmtCollNext, pDel );
+ delete pDel;
+ SetModified();
+}
+
+void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, sal_Bool bBroadcast )
+{
+ sal_uInt16 nFmt = pTxtFmtCollTbl->GetPos( pColl );
+ ASSERT( USHRT_MAX != nFmt, "Collection not found," );
+ DelTxtFmtColl( nFmt, bBroadcast );
+}
+
+sal_Bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
+{
+ // ParaSetFmtColl * pPara = (ParaSetFmtColl*)pArgs;
+ SwCntntNode* pCNd = (SwCntntNode*)rpNode->GetTxtNode();
+ if( pCNd )
+ {
+ ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
+
+ SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl);
+ if ( pPara->bReset )
+ {
+
+ if( pFmt->GetAttrOutlineLevel() == 0 && pPara )
+ pPara->bKeepOutlineLevelAttr = true;
+
+ lcl_RstAttr( pCNd, pPara );
+
+ // --> OD 2007-11-06 #i62675#
+ // --> OD 2008-04-15 #refactorlists#
+ // check, if paragraph style has changed
+ if ( pPara->bResetListAttrs &&
+ pFmt != pCNd->GetFmtColl() &&
+ pFmt->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET )
+ {
+ // --> OD 2009-09-07 #b6876367#
+ // Check, if the list style of the paragraph will change.
+ bool bChangeOfListStyleAtParagraph( true );
+ SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) );
+ ASSERT( pTNd,
+ "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" );
+ {
+ SwNumRule* pNumRuleAtParagraph( pTNd->GetNumRule() );
+ if ( pNumRuleAtParagraph )
+ {
+ const SwNumRuleItem& rNumRuleItemAtParagraphStyle =
+ pFmt->GetNumRule();
+ if ( rNumRuleItemAtParagraphStyle.GetValue() ==
+ pNumRuleAtParagraph->GetName() )
+ {
+ bChangeOfListStyleAtParagraph = false;
+ }
+ }
+ }
+
+ if ( bChangeOfListStyleAtParagraph )
+ {
+ // --> OD 2008-04-08 #refactorlists#
+ std::auto_ptr< SwRegHistory > pRegH;
+ if ( pPara->pHistory )
+ {
+ pRegH.reset( new SwRegHistory( pTNd, *pTNd, pPara->pHistory ) );
+ }
+
+ pCNd->ResetAttr( RES_PARATR_NUMRULE );
+
+ // reset all list attributes
+ pCNd->ResetAttr( RES_PARATR_LIST_LEVEL );
+ pCNd->ResetAttr( RES_PARATR_LIST_ISRESTART );
+ pCNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE );
+ pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED );
+ pCNd->ResetAttr( RES_PARATR_LIST_ID );
+ }
+ // <--
+ }
+ // <--
+ }
+
+ // erst in die History aufnehmen, damit ggfs. alte Daten
+ // gesichert werden koennen
+ if( pPara->pHistory )
+ pPara->pHistory->Add( pCNd->GetFmtColl(), pCNd->GetIndex(),
+ ND_TEXTNODE );
+
+ pCNd->ChgFmtColl( pFmt );
+
+ pPara->nWhich++;
+ }
+ return sal_True;
+}
+
+sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg,
+ SwTxtFmtColl *pFmt,
+ bool bReset,
+ bool bResetListAttrs )
+{
+ SwDataChanged aTmp( rRg, 0 );
+ const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
+ SwHistory* pHst = 0;
+ sal_Bool bRet = sal_True;
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // --> OD 2008-04-15 #refactorlists#
+ SwUndoFmtColl* pUndo = new SwUndoFmtColl( rRg, pFmt,
+ bReset,
+ bResetListAttrs );
+ // <--
+ pHst = pUndo->GetHistory();
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ ParaRstFmt aPara( pStt, pEnd, pHst );
+ aPara.pFmtColl = pFmt;
+ aPara.bReset = bReset;
+ // --> OD 2007-11-06 #i62675#
+ aPara.bResetListAttrs = bResetListAttrs;
+ // <--
+
+ GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
+ lcl_SetTxtFmtColl, &aPara );
+ if( !aPara.nWhich )
+ bRet = sal_False; // keinen gueltigen Node gefunden
+
+ if( bRet )
+ SetModified();
+ return bRet;
+}
+
+
+// ---- Kopiere die Formate in sich selbst (SwDoc) ----------------------
+
+SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt,
+ const SvPtrarr& rFmtArr,
+ FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt )
+{
+ // kein-Autoformat || default Format || Collection-Format
+ // dann suche danach.
+ if( !rFmt.IsAuto() || !rFmt.GetRegisteredIn() )
+ for( sal_uInt16 n = 0; n < rFmtArr.Count(); n++ )
+ {
+ // ist die Vorlage schon im Doc vorhanden ??
+ if( ((SwFmt*)rFmtArr[n])->GetName().Equals( rFmt.GetName() ))
+ return (SwFmt*)rFmtArr[n];
+ }
+
+ // suche erstmal nach dem "Parent"
+ SwFmt* pParent = (SwFmt*)&rDfltFmt;
+ if( rFmt.DerivedFrom() && pParent != rFmt.DerivedFrom() )
+ pParent = CopyFmt( *rFmt.DerivedFrom(), rFmtArr,
+ fnCopyFmt, rDfltFmt );
+
+ // erzeuge das Format und kopiere die Attribute
+ // --> OD 2005-01-13 #i40550#
+ SwFmt* pNewFmt = (this->*fnCopyFmt)( rFmt.GetName(), pParent, sal_False, sal_True );
+ // <--
+ pNewFmt->SetAuto( rFmt.IsAuto() );
+ pNewFmt->CopyAttrs( rFmt, sal_True ); // kopiere Attribute
+
+ pNewFmt->SetPoolFmtId( rFmt.GetPoolFmtId() );
+ pNewFmt->SetPoolHelpId( rFmt.GetPoolHelpId() );
+
+ // HelpFile-Id immer auf dflt setzen !!
+ pNewFmt->SetPoolHlpFileId( UCHAR_MAX );
+
+ return pNewFmt;
+}
+
+
+// ---- kopiere das Frame-Format --------
+SwFrmFmt* SwDoc::CopyFrmFmt( const SwFrmFmt& rFmt )
+{
+
+ return (SwFrmFmt*)CopyFmt( rFmt, *GetFrmFmts(), &SwDoc::_MakeFrmFmt,
+ *GetDfltFrmFmt() );
+}
+
+// ---- kopiere das Char-Format --------
+SwCharFmt* SwDoc::CopyCharFmt( const SwCharFmt& rFmt )
+{
+ return (SwCharFmt*)CopyFmt( rFmt, *GetCharFmts(),
+ &SwDoc::_MakeCharFmt,
+ *GetDfltCharFmt() );
+}
+
+
+// --- Kopiere TextNodes ----
+
+SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl )
+{
+ SwTxtFmtColl* pNewColl = FindTxtFmtCollByName( rColl.GetName() );
+ if( pNewColl )
+ return pNewColl;
+
+ // suche erstmal nach dem "Parent"
+ SwTxtFmtColl* pParent = pDfltTxtFmtColl;
+ if( pParent != rColl.DerivedFrom() )
+ pParent = CopyTxtColl( *(SwTxtFmtColl*)rColl.DerivedFrom() );
+
+
+//FEATURE::CONDCOLL
+ if( RES_CONDTXTFMTCOLL == rColl.Which() )
+ {
+ pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), rColl.GetName(),
+ pParent);
+ pTxtFmtCollTbl->Insert( pNewColl, pTxtFmtCollTbl->Count() );
+ pNewColl->SetAuto( sal_False );
+ SetModified();
+
+ // Kopiere noch die Bedingungen
+ ((SwConditionTxtFmtColl*)pNewColl)->SetConditions(
+ ((SwConditionTxtFmtColl&)rColl).GetCondColls() );
+ }
+ else
+//FEATURE::CONDCOLL
+ pNewColl = MakeTxtFmtColl( rColl.GetName(), pParent );
+
+ // kopiere jetzt noch die Auto-Formate oder kopiere die Attribute
+ pNewColl->CopyAttrs( rColl, sal_True );
+
+ // setze noch den Outline-Level
+ //if( NO_NUMBERING != rColl.GetOutlineLevel() ) //#outline level,zhaojianwei
+ // pNewColl->SetOutlineLevel( rColl.GetOutlineLevel() );
+ if(rColl.IsAssignedToListLevelOfOutlineStyle())
+ pNewColl->AssignToListLevelOfOutlineStyle(rColl.GetAssignedOutlineStyleLevel());//<-end,zhaojianwei
+ //<-end
+ pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() );
+ pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
+
+ // HelpFile-Id immer auf dflt setzen !!
+ pNewColl->SetPoolHlpFileId( UCHAR_MAX );
+
+ if( &rColl.GetNextTxtFmtColl() != &rColl )
+ pNewColl->SetNextTxtFmtColl( *CopyTxtColl( rColl.GetNextTxtFmtColl() ));
+
+ // ggfs. die NumRule erzeugen
+ if( this != rColl.GetDoc() )
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pNewColl->GetItemState( RES_PARATR_NUMRULE,
+ sal_False, &pItem ))
+ {
+ const SwNumRule* pRule;
+ const String& rName = ((SwNumRuleItem*)pItem)->GetValue();
+ if( rName.Len() &&
+ 0 != ( pRule = rColl.GetDoc()->FindNumRulePtr( rName )) &&
+ !pRule->IsAutoRule() )
+ {
+ SwNumRule* pDestRule = FindNumRulePtr( rName );
+ if( pDestRule )
+ pDestRule->SetInvalidRule( sal_True );
+ else
+ MakeNumRule( rName, pRule );
+ }
+ }
+ }
+ return pNewColl;
+}
+
+// --- Kopiere GrafikNodes ----
+
+SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl )
+{
+ SwGrfFmtColl* pNewColl = FindGrfFmtCollByName( rColl.GetName() );
+ if( pNewColl )
+ return pNewColl;
+
+ // suche erstmal nach dem "Parent"
+ SwGrfFmtColl* pParent = pDfltGrfFmtColl;
+ if( pParent != rColl.DerivedFrom() )
+ pParent = CopyGrfColl( *(SwGrfFmtColl*)rColl.DerivedFrom() );
+
+ // falls nicht, so kopiere sie
+ pNewColl = MakeGrfFmtColl( rColl.GetName(), pParent );
+
+ // noch die Attribute kopieren
+ pNewColl->CopyAttrs( rColl );
+
+ pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() );
+ pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
+
+ // HelpFile-Id immer auf dflt setzen !!
+ pNewColl->SetPoolHlpFileId( UCHAR_MAX );
+
+ return pNewColl;
+}
+
+SwPageDesc* lcl_FindPageDesc( const SwPageDescs& rArr, const String& rName )
+{
+ for( sal_uInt16 n = rArr.Count(); n; )
+ {
+ SwPageDesc* pDesc = rArr[ --n ];
+ if( pDesc->GetName() == rName )
+ return pDesc;
+ }
+ return 0;
+}
+
+void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr,
+ SvPtrarr& rDestArr,
+ FNCopyFmt fnCopyFmt,
+ SwFmt& rDfltFmt )
+{
+ sal_uInt16 nSrc;
+ SwFmt* pSrc, *pDest;
+
+ // 1. Schritt alle Formate anlegen (das 0. ueberspringen - Default!)
+ for( nSrc = rSourceArr.Count(); nSrc > 1; )
+ {
+ pSrc = (SwFmt*)rSourceArr[ --nSrc ];
+ if( pSrc->IsDefault() || pSrc->IsAuto() )
+ continue;
+
+ if( 0 == FindFmtByName( rDestArr, pSrc->GetName() ) )
+ {
+ if( RES_CONDTXTFMTCOLL == pSrc->Which() )
+ MakeCondTxtFmtColl( pSrc->GetName(), (SwTxtFmtColl*)&rDfltFmt );
+ else
+ // --> OD 2005-01-13 #i40550#
+ (this->*fnCopyFmt)( pSrc->GetName(), &rDfltFmt, sal_False, sal_True );
+ // <--
+ }
+ }
+
+ // 2. Schritt alle Attribute kopieren, richtige Parents setzen
+ for( nSrc = rSourceArr.Count(); nSrc > 1; )
+ {
+ pSrc = (SwFmt*)rSourceArr[ --nSrc ];
+ if( pSrc->IsDefault() || pSrc->IsAuto() )
+ continue;
+
+ pDest = FindFmtByName( rDestArr, pSrc->GetName() );
+ pDest->SetAuto( sal_False );
+ pDest->DelDiffs( *pSrc );
+
+ // #i94285#: existing <SwFmtPageDesc> instance, before copying attributes
+ const SfxPoolItem* pItem;
+ if( &GetAttrPool() != pSrc->GetAttrSet().GetPool() &&
+ SFX_ITEM_SET == pSrc->GetAttrSet().GetItemState(
+ RES_PAGEDESC, sal_False, &pItem ) &&
+ ((SwFmtPageDesc*)pItem)->GetPageDesc() )
+ {
+ SwFmtPageDesc aPageDesc( *(SwFmtPageDesc*)pItem );
+ const String& rNm = aPageDesc.GetPageDesc()->GetName();
+ SwPageDesc* pPageDesc = ::lcl_FindPageDesc( aPageDescs, rNm );
+ if( !pPageDesc )
+ {
+ pPageDesc = aPageDescs[ MakePageDesc( rNm ) ];
+ }
+ aPageDesc.RegisterToPageDesc( *pPageDesc );
+ SwAttrSet aTmpAttrSet( pSrc->GetAttrSet() );
+ aTmpAttrSet.Put( aPageDesc );
+ pDest->SetFmtAttr( aTmpAttrSet );
+ }
+ else
+ {
+ pDest->SetFmtAttr( pSrc->GetAttrSet() );
+ }
+
+ pDest->SetPoolFmtId( pSrc->GetPoolFmtId() );
+ pDest->SetPoolHelpId( pSrc->GetPoolHelpId() );
+
+ // HelpFile-Id immer auf dflt setzen !!
+ pDest->SetPoolHlpFileId( UCHAR_MAX );
+
+ if( pSrc->DerivedFrom() )
+ pDest->SetDerivedFrom( FindFmtByName( rDestArr,
+ pSrc->DerivedFrom()->GetName() ) );
+ if( RES_TXTFMTCOLL == pSrc->Which() ||
+ RES_CONDTXTFMTCOLL == pSrc->Which() )
+ {
+ SwTxtFmtColl* pSrcColl = (SwTxtFmtColl*)pSrc,
+ * pDstColl = (SwTxtFmtColl*)pDest;
+ if( &pSrcColl->GetNextTxtFmtColl() != pSrcColl )
+ pDstColl->SetNextTxtFmtColl( *(SwTxtFmtColl*)FindFmtByName(
+ rDestArr, pSrcColl->GetNextTxtFmtColl().GetName() ) );
+
+ // setze noch den Outline-Level
+ //if( NO_NUMBERING != pSrcColl->GetOutlineLevel() ) //#outline level,zhaojianwei
+ // pDstColl->SetOutlineLevel( pSrcColl->GetOutlineLevel() );
+ if(pSrcColl->IsAssignedToListLevelOfOutlineStyle())
+ pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());//<-end,zhaojianwei
+ //<-end
+
+//FEATURE::CONDCOLL
+ if( RES_CONDTXTFMTCOLL == pSrc->Which() )
+ // Kopiere noch die Bedingungen
+ // aber erst die alten loeschen!
+ ((SwConditionTxtFmtColl*)pDstColl)->SetConditions(
+ ((SwConditionTxtFmtColl*)pSrc)->GetCondColls() );
+//FEATURE::CONDCOLL
+ }
+ }
+}
+
+void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader,
+ const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
+{
+ // jetzt noch Header-/Footer-Attribute richtig behandeln
+ // Contenten Nodes Dokumentuebergreifend kopieren!
+ sal_uInt16 nAttr = static_cast<sal_uInt16>( bCpyHeader ? RES_HEADER : RES_FOOTER );
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET != rSrcFmt.GetAttrSet().GetItemState( nAttr, sal_False, &pItem ))
+ return ;
+
+ // Im Header steht noch der Verweis auf das Format aus dem
+ // anderen Document!!
+ SfxPoolItem* pNewItem = pItem->Clone();
+
+ SwFrmFmt* pOldFmt;
+ if( bCpyHeader )
+ pOldFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt();
+ else
+ pOldFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt();
+
+ if( pOldFmt )
+ {
+ SwFrmFmt* pNewFmt = new SwFrmFmt( GetAttrPool(), "CpyDesc",
+ GetDfltFrmFmt() );
+ pNewFmt->CopyAttrs( *pOldFmt, sal_True );
+
+ if( SFX_ITEM_SET == pNewFmt->GetAttrSet().GetItemState(
+ RES_CNTNT, sal_False, &pItem ))
+ {
+ SwFmtCntnt* pCntnt = (SwFmtCntnt*)pItem;
+ if( pCntnt->GetCntntIdx() )
+ {
+ SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() );
+ const SwNodes& rSrcNds = rSrcFmt.GetDoc()->GetNodes();
+ SwStartNode* pSttNd = GetNodes().MakeEmptySection( aTmpIdx,
+ bCpyHeader
+ ? SwHeaderStartNode
+ : SwFooterStartNode );
+ const SwNode& rCSttNd = pCntnt->GetCntntIdx()->GetNode();
+ SwNodeRange aRg( rCSttNd, 0, *rCSttNd.EndOfSectionNode() );
+ aTmpIdx = *pSttNd->EndOfSectionNode();
+ rSrcNds._Copy( aRg, aTmpIdx );
+ aTmpIdx = *pSttNd;
+ rSrcFmt.GetDoc()->CopyFlyInFlyImpl( aRg, 0, aTmpIdx );
+ pNewFmt->SetFmtAttr( SwFmtCntnt( pSttNd ));
+ }
+ else
+ pNewFmt->ResetFmtAttr( RES_CNTNT );
+ }
+ if( bCpyHeader )
+ ((SwFmtHeader*)pNewItem)->RegisterToFormat(*pNewFmt);
+ else
+ ((SwFmtFooter*)pNewItem)->RegisterToFormat(*pNewFmt);
+ rDestFmt.SetFmtAttr( *pNewItem );
+ }
+ delete pNewItem;
+}
+
+void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
+ sal_Bool bCopyPoolIds )
+{
+ sal_Bool bNotifyLayout = sal_False;
+ SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
+
+ rDstDesc.SetLandscape( rSrcDesc.GetLandscape() );
+ rDstDesc.SetNumType( rSrcDesc.GetNumType() );
+ if( rDstDesc.ReadUseOn() != rSrcDesc.ReadUseOn() )
+ {
+ rDstDesc.WriteUseOn( rSrcDesc.ReadUseOn() );
+ bNotifyLayout = sal_True;
+ }
+
+ if( bCopyPoolIds )
+ {
+ rDstDesc.SetPoolFmtId( rSrcDesc.GetPoolFmtId() );
+ rDstDesc.SetPoolHelpId( rSrcDesc.GetPoolHelpId() );
+ // HelpFile-Id immer auf dflt setzen !!
+ rDstDesc.SetPoolHlpFileId( UCHAR_MAX );
+ }
+
+ if( rSrcDesc.GetFollow() != &rSrcDesc )
+ {
+ SwPageDesc* pFollow = ::lcl_FindPageDesc( aPageDescs,
+ rSrcDesc.GetFollow()->GetName() );
+ if( !pFollow )
+ {
+ // dann mal kopieren
+ sal_uInt16 nPos = MakePageDesc( rSrcDesc.GetFollow()->GetName() );
+ pFollow = aPageDescs[ nPos ];
+ CopyPageDesc( *rSrcDesc.GetFollow(), *pFollow );
+ }
+ rDstDesc.SetFollow( pFollow );
+ bNotifyLayout = sal_True;
+ }
+
+ // die Header/Footer-Attribute werden gesondert kopiert, die Content-
+ // Sections muessen vollstaendig mitgenommen werden!
+ {
+ SfxItemSet aAttrSet( rSrcDesc.GetMaster().GetAttrSet() );
+ aAttrSet.ClearItem( RES_HEADER );
+ aAttrSet.ClearItem( RES_FOOTER );
+
+ rDstDesc.GetMaster().DelDiffs( aAttrSet );
+ rDstDesc.GetMaster().SetFmtAttr( aAttrSet );
+
+ aAttrSet.ClearItem();
+ aAttrSet.Put( rSrcDesc.GetLeft().GetAttrSet() );
+ aAttrSet.ClearItem( RES_HEADER );
+ aAttrSet.ClearItem( RES_FOOTER );
+
+ rDstDesc.GetLeft().DelDiffs( aAttrSet );
+ rDstDesc.GetLeft().SetFmtAttr( aAttrSet );
+ }
+
+ CopyHeader( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
+ CopyFooter( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
+ if( !rDstDesc.IsHeaderShared() )
+ CopyHeader( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
+ else
+ rDstDesc.GetLeft().SetFmtAttr( rDstDesc.GetMaster().GetHeader() );
+
+ if( !rDstDesc.IsFooterShared() )
+ CopyFooter( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
+ else
+ rDstDesc.GetLeft().SetFmtAttr( rDstDesc.GetMaster().GetFooter() );
+
+ if( bNotifyLayout && pTmpRoot )
+ {
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();//swmod 080225
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllCheckPageDescs));//swmod 080226
+ }
+
+ //Wenn sich FussnotenInfo veraendert, so werden die Seiten
+ //angetriggert.
+ if( !(rDstDesc.GetFtnInfo() == rSrcDesc.GetFtnInfo()) )
+ {
+ rDstDesc.SetFtnInfo( rSrcDesc.GetFtnInfo() );
+ SwMsgPoolItem aInfo( RES_PAGEDESC_FTNINFO );
+ {
+ rDstDesc.GetMaster().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) );
+ }
+ {
+ rDstDesc.GetLeft().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) );
+ }
+ }
+}
+
+void SwDoc::ReplaceStyles( SwDoc& rSource )
+{
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ CopyFmtArr( *rSource.pCharFmtTbl, *pCharFmtTbl,
+ &SwDoc::_MakeCharFmt, *pDfltCharFmt );
+ CopyFmtArr( *rSource.pFrmFmtTbl, *pFrmFmtTbl,
+ &SwDoc::_MakeFrmFmt, *pDfltFrmFmt );
+ CopyFmtArr( *rSource.pTxtFmtCollTbl, *pTxtFmtCollTbl,
+ &SwDoc::_MakeTxtFmtColl, *pDfltTxtFmtColl );
+
+ // und jetzt noch die Seiten-Vorlagen
+ sal_uInt16 nCnt = rSource.aPageDescs.Count();
+ if( nCnt )
+ {
+ // ein anderes Doc -> Numberformatter muessen gemergt werden
+ SwTblNumFmtMerge aTNFM( rSource, *this );
+
+ // 1. Schritt alle Formate anlegen (das 0. ueberspringen - Default!)
+ while( nCnt )
+ {
+ SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ];
+ if( 0 == ::lcl_FindPageDesc( aPageDescs, pSrc->GetName() ) )
+ MakePageDesc( pSrc->GetName() );
+ }
+
+ // 2. Schritt alle Attribute kopieren, richtige Parents setzen
+ for( nCnt = rSource.aPageDescs.Count(); nCnt; )
+ {
+ SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ];
+ CopyPageDesc( *pSrc, *::lcl_FindPageDesc( aPageDescs, pSrc->GetName() ));
+ }
+ }
+
+ //JP 08.04.99: und dann sind da noch die Numerierungs-Vorlagen
+ nCnt = rSource.GetNumRuleTbl().Count();
+ if( nCnt )
+ {
+ const SwNumRuleTbl& rArr = rSource.GetNumRuleTbl();
+ for( sal_uInt16 n = 0; n < nCnt; ++n )
+ {
+ const SwNumRule& rR = *rArr[ n ];
+ if( !rR.IsAutoRule() )
+ {
+ SwNumRule* pNew = FindNumRulePtr( rR.GetName());
+ if( pNew )
+ pNew->CopyNumRule( this, rR );
+ else
+ MakeNumRule( rR.GetName(), &rR );
+ }
+ }
+ }
+
+ if (undoGuard.UndoWasEnabled())
+ {
+ // nodes array was modified!
+ GetIDocumentUndoRedo().DelAllUndoObj();
+ }
+
+ SetModified();
+}
+
+SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr,
+ const String& rName ) const
+{
+ SwFmt* pFnd = 0;
+ for( sal_uInt16 n = 0; n < rFmtArr.Count(); n++ )
+ {
+ // ist die Vorlage schon im Doc vorhanden ??
+ if( ((SwFmt*)rFmtArr[n])->GetName() == rName )
+ {
+ pFnd = (SwFmt*)rFmtArr[n];
+ break;
+ }
+ }
+ return pFnd;
+}
+
+void SwDoc::MoveLeftMargin( const SwPaM& rPam, sal_Bool bRight, sal_Bool bModulus )
+{
+ SwHistory* pHistory = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndoMoveLeftMargin* pUndo = new SwUndoMoveLeftMargin( rPam, bRight,
+ bModulus );
+ pHistory = &pUndo->GetHistory();
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+
+ const SvxTabStopItem& rTabItem = (SvxTabStopItem&)GetDefault( RES_PARATR_TABSTOP );
+ sal_uInt16 nDefDist = rTabItem.Count() ?
+ static_cast<sal_uInt16>(rTabItem[0].GetTabPos()) : 1134;
+ const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
+ SwNodeIndex aIdx( rStt.nNode );
+ while( aIdx <= rEnd.nNode )
+ {
+ SwTxtNode* pTNd = aIdx.GetNode().GetTxtNode();
+ if( pTNd )
+ {
+ SvxLRSpaceItem aLS( (SvxLRSpaceItem&)pTNd->SwCntntNode::GetAttr( RES_LR_SPACE ) );
+
+ // --> FME 2008-09-16 #i93873# See also lcl_MergeListLevelIndentAsLRSpaceItem in thints.cxx
+ if ( pTNd->AreListLevelIndentsApplicable() )
+ {
+ const SwNumRule* pRule = pTNd->GetNumRule();
+ if ( pRule )
+ {
+ const int nListLevel = pTNd->GetActualListLevel();
+ if ( nListLevel >= 0 )
+ {
+ const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(nListLevel));
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aLS.SetTxtLeft( rFmt.GetIndentAt() );
+ aLS.SetTxtFirstLineOfst( static_cast<short>(rFmt.GetFirstLineIndent()) );
+ }
+ }
+ }
+ }
+
+ long nNext = aLS.GetTxtLeft();
+ if( bModulus )
+ nNext = ( nNext / nDefDist ) * nDefDist;
+
+ if( bRight )
+ nNext += nDefDist;
+ else
+ nNext -= nDefDist;
+
+ aLS.SetTxtLeft( nNext );
+
+ SwRegHistory aRegH( pTNd, *pTNd, pHistory );
+ pTNd->SetAttr( aLS );
+ }
+ aIdx++;
+ }
+ SetModified();
+}
+
+sal_Bool SwDoc::DontExpandFmt( const SwPosition& rPos, sal_Bool bFlag )
+{
+ sal_Bool bRet = sal_False;
+ SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+ if( pTxtNd )
+ {
+ bRet = pTxtNd->DontExpandFmt( rPos.nContent, bFlag );
+ if( bRet && GetIDocumentUndoRedo().DoesUndo() )
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoDontExpandFmt(rPos) );
+ }
+ }
+ return bRet;
+}
+
+SwTableBoxFmt* SwDoc::MakeTableBoxFmt()
+{
+ SwTableBoxFmt* pFmt = new SwTableBoxFmt( GetAttrPool(), aEmptyStr,
+ pDfltFrmFmt );
+ SetModified();
+ return pFmt;
+}
+
+SwTableLineFmt* SwDoc::MakeTableLineFmt()
+{
+ SwTableLineFmt* pFmt = new SwTableLineFmt( GetAttrPool(), aEmptyStr,
+ pDfltFrmFmt );
+ SetModified();
+ return pFmt;
+}
+
+void SwDoc::_CreateNumberFormatter()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::_CreateNumberFormatter" );
+
+ ASSERT( !pNumberFormatter, "ist doch schon vorhanden" );
+
+
+ LanguageType eLang = LANGUAGE_SYSTEM; //System::GetLanguage();
+/* ((const SvxLanguageItem&)GetAttrPool().
+ GetDefaultItem( RES_CHRATR_LANGUAGE )).GetLanguage();
+*/
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ pNumberFormatter = new SvNumberFormatter( xMSF, eLang );
+ pNumberFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL );
+ pNumberFormatter->SetYear2000(static_cast<sal_uInt16>(::utl::MiscCfg().GetYear2000()));
+
+}
+
+SwTblNumFmtMerge::SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest )
+ : pNFmt( 0 )
+{
+ // ein anderes Doc -> Numberformatter muessen gemergt werden
+ SvNumberFormatter* pN;
+ if( &rSrc != &rDest && 0 != ( pN = ((SwDoc&)rSrc).GetNumberFormatter( sal_False ) ))
+ ( pNFmt = rDest.GetNumberFormatter( sal_True ))->MergeFormatter( *pN );
+
+ if( &rSrc != &rDest )
+ ((SwGetRefFieldType*)rSrc.GetSysFldType( RES_GETREFFLD ))->
+ MergeWithOtherDoc( rDest );
+}
+
+SwTblNumFmtMerge::~SwTblNumFmtMerge()
+{
+ if( pNFmt )
+ pNFmt->ClearMergeTable();
+}
+
+
+void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId,
+ const SfxItemSet* pSet )
+{
+ SwPaM aPam( rPos );
+ SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
+
+ if( mbIsAutoFmtRedline && pTNd )
+ {
+ // dann das Redline Object anlegen
+ const SwTxtFmtColl& rColl = *pTNd->GetTxtColl();
+ SwRedline* pRedl = new SwRedline( nsRedlineType_t::REDLINE_FMTCOLL, aPam );
+ pRedl->SetMark();
+
+ // interressant sind nur die Items, die vom Set NICHT wieder
+ // in den Node gesetzt werden. Also muss man die Differenz nehmen
+ SwRedlineExtraData_FmtColl aExtraData( rColl.GetName(),
+ rColl.GetPoolFmtId() );
+ if( pSet && pTNd->HasSwAttrSet() )
+ {
+ SfxItemSet aTmp( *pTNd->GetpSwAttrSet() );
+ aTmp.Differentiate( *pSet );
+ // das Adjust Item behalten wir extra
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pTNd->GetpSwAttrSet()->GetItemState(
+ RES_PARATR_ADJUST, sal_False, &pItem ))
+ aTmp.Put( *pItem );
+ aExtraData.SetItemSet( aTmp );
+ }
+ pRedl->SetExtraData( &aExtraData );
+
+// !!!!!!!!! Undo fehlt noch !!!!!!!!!!!!!!!!!!
+ AppendRedline( pRedl, true );
+ }
+
+ SetTxtFmtColl( aPam, GetTxtCollFromPool( nPoolId ) );
+
+ if( pSet && pTNd && pSet->Count() )
+ {
+ aPam.SetMark();
+ aPam.GetMark()->nContent.Assign( pTNd, pTNd->GetTxt().Len() );
+ InsertItemSet( aPam, *pSet, 0 );
+ }
+}
+
+void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet )
+{
+ SwTxtNode* pTNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode();
+
+ RedlineMode_t eOld = GetRedlineMode();
+
+ if( mbIsAutoFmtRedline && pTNd )
+ {
+ // dann das Redline Object anlegen
+ SwRedline* pRedl = new SwRedline( nsRedlineType_t::REDLINE_FORMAT, rPam );
+ if( !pRedl->HasMark() )
+ pRedl->SetMark();
+
+ // interressant sind nur die Items, die vom Set NICHT wieder
+ // in den Node gesetzt werden. Also muss man die Differenz nehmen
+ SwRedlineExtraData_Format aExtraData( rSet );
+
+/*
+ if( pSet && pTNd->HasSwAttrSet() )
+ {
+ SfxItemSet aTmp( *pTNd->GetpSwAttrSet() );
+ aTmp.Differentiate( *pSet );
+ // das Adjust Item behalten wir extra
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pTNd->GetpSwAttrSet()->GetItemState(
+ RES_PARATR_ADJUST, sal_False, &pItem ))
+ aTmp.Put( *pItem );
+ aExtraData.SetItemSet( aTmp );
+ }
+*/
+ pRedl->SetExtraData( &aExtraData );
+
+// !!!!!!!!! Undo fehlt noch !!!!!!!!!!!!!!!!!!
+ AppendRedline( pRedl, true );
+
+ SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ }
+
+ InsertItemSet( rPam, rSet, nsSetAttrMode::SETATTR_DONTEXPAND );
+ SetRedlineMode_intern( eOld );
+}
+
+void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet)
+{
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // copying <rSet> to <aSet>
+ SfxItemSet aSet(rSet);
+ // remove from <aSet> all items, which are already set at the format
+ aSet.Differentiate(rFmt.GetAttrSet());
+ // <aSet> contains now all *new* items for the format
+
+ // copying current format item set to <aOldSet>
+ SfxItemSet aOldSet(rFmt.GetAttrSet());
+ // insert new items into <aOldSet>
+ aOldSet.Put(aSet);
+ // invalidate all new items in <aOldSet> in order to clear these items,
+ // if the undo action is triggered.
+ {
+ SfxItemIter aIter(aSet);
+
+ const SfxPoolItem * pItem = aIter.FirstItem();
+ while (pItem != NULL)
+ {
+ aOldSet.InvalidateItem(pItem->Which());
+
+ pItem = aIter.NextItem();
+ }
+ }
+
+ SwUndo * pUndo = new SwUndoFmtAttr(aOldSet, rFmt);
+
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ rFmt.SetFmtAttr(rSet);
+}
+
+void SwDoc::RenameFmt(SwFmt & rFmt, const String & sNewName,
+ sal_Bool bBroadcast)
+{
+ SfxStyleFamily eFamily = SFX_STYLE_FAMILY_ALL;
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo * pUndo = NULL;
+
+ switch (rFmt.Which())
+ {
+ case RES_CHRFMT:
+ pUndo = new SwUndoRenameCharFmt(rFmt.GetName(), sNewName, this);
+ eFamily = SFX_STYLE_FAMILY_PARA;
+ break;
+ case RES_TXTFMTCOLL:
+ pUndo = new SwUndoRenameFmtColl(rFmt.GetName(), sNewName, this);
+ eFamily = SFX_STYLE_FAMILY_CHAR;
+ break;
+ case RES_FRMFMT:
+ pUndo = new SwUndoRenameFrmFmt(rFmt.GetName(), sNewName, this);
+ eFamily = SFX_STYLE_FAMILY_FRAME;
+ break;
+
+ default:
+ break;
+ }
+
+ if (pUndo)
+ {
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ }
+
+ rFmt.SetName(sNewName);
+
+ if (bBroadcast)
+ BroadcastStyleOperation(sNewName, eFamily, SFX_STYLESHEET_MODIFIED);
+}
+
+// --> OD 2006-09-27 #i69627#
+namespace docfunc
+{
+ bool HasOutlineStyleToBeWrittenAsNormalListStyle( SwDoc& rDoc )
+ {
+ // If a parent paragraph style of one of the parargraph styles, which
+ // are assigned to the list levels of the outline style, has a list style
+ // set or inherits a list style from its parent style, the outline style
+ // has to be written as a normal list style to the OpenDocument file
+ // format or the OpenOffice.org file format.
+ bool bRet( false );
+
+ const SwTxtFmtColls* pTxtFmtColls( rDoc.GetTxtFmtColls() );
+ if ( pTxtFmtColls )
+ {
+ const sal_uInt16 nCount = pTxtFmtColls->Count();
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ {
+ SwTxtFmtColl* pTxtFmtColl = (*pTxtFmtColls)[i];
+
+ if ( pTxtFmtColl->IsDefault() ||
+ // pTxtFmtColl->GetOutlineLevel() == NO_NUMBERING ) //#outline level,zhaojianwei
+ ! pTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() ) //<-end,zhaojianwei
+ {
+ continue;
+ }
+
+ const SwTxtFmtColl* pParentTxtFmtColl =
+ dynamic_cast<const SwTxtFmtColl*>( pTxtFmtColl->DerivedFrom());
+ if ( !pParentTxtFmtColl )
+ continue;
+
+ if ( SFX_ITEM_SET == pParentTxtFmtColl->GetItemState( RES_PARATR_NUMRULE ) )
+ {
+ // --> OD 2009-11-12 #i106218#
+ // consider that the outline style is set
+ const SwNumRuleItem& rDirectItem = pParentTxtFmtColl->GetNumRule();
+ if ( rDirectItem.GetValue() != rDoc.GetOutlineNumRule()->GetName() )
+ {
+ bRet = true;
+ break;
+ }
+ // <--
+ }
+ }
+
+ }
+ return bRet;
+ }
+}
+// <--
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
new file mode 100644
index 000000000000..e268f283df2b
--- /dev/null
+++ b/sw/source/core/doc/docftn.cxx
@@ -0,0 +1,531 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <ftnidx.hxx>
+#include <rootfrm.hxx>
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <pam.hxx>
+#include <pagedesc.hxx>
+#include <charfmt.hxx>
+#include <UndoAttribute.hxx>
+#include <hints.hxx>
+#include <rolbck.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <ndtxt.hxx>
+#include <poolfmt.hxx>
+#include <ftninfo.hxx>
+
+/*********************** SwFtnInfo ***************************/
+
+SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
+{
+ if( rInfo.GetFtnTxtColl() )
+ rInfo.GetFtnTxtColl()->Add(this);
+ else if ( GetRegisteredIn())
+ GetRegisteredInNonConst()->Remove(this);
+
+ if ( rInfo.aPageDescDep.GetRegisteredIn() )
+ ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
+ else if ( aPageDescDep.GetRegisteredIn() )
+ ((SwModify*)aPageDescDep.GetRegisteredIn())->Remove( &aPageDescDep );
+
+ if ( rInfo.aCharFmtDep.GetRegisteredIn() )
+ ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
+ else if ( aCharFmtDep.GetRegisteredIn() )
+ ((SwModify*)aCharFmtDep.GetRegisteredIn())->Remove( &aCharFmtDep );
+
+ if ( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
+ ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
+ &aAnchorCharFmtDep );
+ else if( aAnchorCharFmtDep.GetRegisteredIn() )
+ ((SwModify*)aAnchorCharFmtDep.GetRegisteredIn())->Remove(
+ &aAnchorCharFmtDep );
+
+ aFmt = rInfo.aFmt;
+ nFtnOffset = rInfo.nFtnOffset;
+ m_bEndNote = rInfo.m_bEndNote;
+ sPrefix = rInfo.sPrefix;
+ sSuffix = rInfo.sSuffix;
+ return *this;
+}
+
+
+sal_Bool SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const
+{
+ return aPageDescDep.GetRegisteredIn() ==
+ rInfo.aPageDescDep.GetRegisteredIn() &&
+ aCharFmtDep.GetRegisteredIn() ==
+ rInfo.aCharFmtDep.GetRegisteredIn() &&
+ aAnchorCharFmtDep.GetRegisteredIn() ==
+ rInfo.aAnchorCharFmtDep.GetRegisteredIn() &&
+ GetFtnTxtColl() == rInfo.GetFtnTxtColl() &&
+ aFmt.GetNumberingType() == rInfo.aFmt.GetNumberingType() &&
+ nFtnOffset == rInfo.nFtnOffset &&
+ m_bEndNote == rInfo.m_bEndNote &&
+ sPrefix == rInfo.sPrefix &&
+ sSuffix == rInfo.sSuffix;
+}
+
+
+SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
+ SwClient( rInfo.GetFtnTxtColl() ),
+ aPageDescDep( this, 0 ),
+ aCharFmtDep( this, 0 ),
+ aAnchorCharFmtDep( this, 0 ),
+ sPrefix( rInfo.sPrefix ),
+ sSuffix( rInfo.sSuffix ),
+ m_bEndNote( true ),
+ aFmt( rInfo.aFmt ),
+ nFtnOffset( rInfo.nFtnOffset )
+{
+ if( rInfo.aPageDescDep.GetRegisteredIn() )
+ ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
+
+ if( rInfo.aCharFmtDep.GetRegisteredIn() )
+ ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
+
+ if( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
+ ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
+ &aAnchorCharFmtDep );
+}
+
+SwEndNoteInfo::SwEndNoteInfo(SwTxtFmtColl *pFmt) :
+ SwClient(pFmt),
+ aPageDescDep( this, 0 ),
+ aCharFmtDep( this, 0 ),
+ aAnchorCharFmtDep( this, 0 ),
+ m_bEndNote( true ),
+ nFtnOffset( 0 )
+{
+ aFmt.SetNumberingType(SVX_NUM_ROMAN_LOWER);
+}
+
+SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const
+{
+ if ( !aPageDescDep.GetRegisteredIn() )
+ {
+ SwPageDesc *pDesc = rDoc.GetPageDescFromPool( static_cast<sal_uInt16>(
+ m_bEndNote ? RES_POOLPAGE_ENDNOTE : RES_POOLPAGE_FOOTNOTE ) );
+ pDesc->Add( &((SwClient&)aPageDescDep) );
+ }
+
+ return (SwPageDesc*)( aPageDescDep.GetRegisteredIn() );
+}
+
+bool SwEndNoteInfo::KnowsPageDesc() const
+{
+ return (aPageDescDep.GetRegisteredIn() != 0);
+}
+
+bool SwEndNoteInfo::DependsOn( const SwPageDesc* pDesc ) const
+{
+ return ( aPageDescDep.GetRegisteredIn() == pDesc );
+}
+
+void SwEndNoteInfo::ChgPageDesc( SwPageDesc *pDesc )
+{
+ pDesc->Add( &((SwClient&)aPageDescDep) );
+}
+
+void SwEndNoteInfo::SetFtnTxtColl(SwTxtFmtColl& rFmt)
+{
+ rFmt.Add(this);
+}
+
+SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const
+{
+ if ( !aCharFmtDep.GetRegisteredIn() )
+ {
+ SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
+ m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) );
+ pFmt->Add( &((SwClient&)aCharFmtDep) );
+ }
+ return (SwCharFmt*)aCharFmtDep.GetRegisteredIn();
+}
+
+void SwEndNoteInfo::SetCharFmt( SwCharFmt* pChFmt )
+{
+ DBG_ASSERT(pChFmt, "kein CharFmt?");
+ pChFmt->Add( &((SwClient&)aCharFmtDep) );
+}
+
+SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const
+{
+ if( !aAnchorCharFmtDep.GetRegisteredIn() )
+ {
+ SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
+ m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) );
+ pFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
+ }
+ return (SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn();
+}
+
+void SwEndNoteInfo::SetAnchorCharFmt( SwCharFmt* pChFmt )
+{
+ DBG_ASSERT(pChFmt, "kein CharFmt?");
+ pChFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
+}
+
+void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+{
+ sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+
+ if( RES_ATTRSET_CHG == nWhich ||
+ RES_FMT_CHG == nWhich )
+ {
+ SwDoc* pDoc;
+ if( aCharFmtDep.GetRegisteredIn() )
+ pDoc = ((SwCharFmt*)aCharFmtDep.GetRegisteredIn())->GetDoc();
+ else
+ pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc();
+ SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs();
+ for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+ {
+ SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
+ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+ if ( rFtn.IsEndNote() == m_bEndNote )
+ {
+ pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
+ }
+ }
+ }
+ else
+ CheckRegistration( pOld, pNew );
+}
+
+SwFtnInfo& SwFtnInfo::operator=(const SwFtnInfo& rInfo)
+{
+ SwEndNoteInfo::operator=(rInfo);
+ aQuoVadis = rInfo.aQuoVadis;
+ aErgoSum = rInfo.aErgoSum;
+ ePos = rInfo.ePos;
+ eNum = rInfo.eNum;
+ return *this;
+}
+
+
+sal_Bool SwFtnInfo::operator==( const SwFtnInfo& rInfo ) const
+{
+ return ePos == rInfo.ePos &&
+ eNum == rInfo.eNum &&
+ SwEndNoteInfo::operator==(rInfo) &&
+ aQuoVadis == rInfo.aQuoVadis &&
+ aErgoSum == rInfo.aErgoSum;
+}
+
+
+SwFtnInfo::SwFtnInfo(const SwFtnInfo& rInfo) :
+ SwEndNoteInfo( rInfo ),
+ aQuoVadis( rInfo.aQuoVadis ),
+ aErgoSum( rInfo.aErgoSum ),
+ ePos( rInfo.ePos ),
+ eNum( rInfo.eNum )
+{
+ m_bEndNote = false;
+}
+
+SwFtnInfo::SwFtnInfo(SwTxtFmtColl *pFmt) :
+ SwEndNoteInfo( pFmt ),
+ ePos( FTNPOS_PAGE ),
+ eNum( FTNNUM_DOC )
+{
+ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+ m_bEndNote = false;
+}
+
+/*********************** SwDoc ***************************/
+
+
+void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo)
+{
+ SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
+ if( !(GetFtnInfo() == rInfo) )
+ {
+ const SwFtnInfo &rOld = GetFtnInfo();
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld) );
+ }
+
+ sal_Bool bFtnPos = rInfo.ePos != rOld.ePos;
+ sal_Bool bFtnDesc = rOld.ePos == FTNPOS_CHAPTER &&
+ rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this );
+ sal_Bool bExtra = rInfo.aQuoVadis != rOld.aQuoVadis ||
+ rInfo.aErgoSum != rOld.aErgoSum ||
+ rInfo.aFmt.GetNumberingType() != rOld.aFmt.GetNumberingType() ||
+ rInfo.GetPrefix() != rOld.GetPrefix() ||
+ rInfo.GetSuffix() != rOld.GetSuffix();
+ SwCharFmt *pOldChrFmt = rOld.GetCharFmt( *this ),
+ *pNewChrFmt = rInfo.GetCharFmt( *this );
+ sal_Bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
+
+ *pFtnInfo = rInfo;
+
+ if (pTmpRoot)
+ {
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();//swmod 080304
+ if ( bFtnPos )
+ //pTmpRoot->RemoveFtns();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllRemoveFtns));//swmod 080305
+ else
+ {
+ //pTmpRoot->UpdateFtnNums();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::UpdateFtnNums));//swmod 080304
+ if ( bFtnDesc )
+ //pTmpRoot->CheckFtnPageDescs( FALSE );
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::CheckFtnPageDescs), sal_False));//swmod 080304
+ if ( bExtra )
+ {
+ //Fuer die Benachrichtung bezueglich ErgoSum usw. sparen wir uns
+ //extra-Code und nutzen die vorhandenen Wege.
+ SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
+ for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+ {
+ SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
+ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+ if ( !rFtn.IsEndNote() )
+ pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
+ }
+ }
+ }
+ } //swmod 080219
+ if( FTNNUM_PAGE != rInfo.eNum )
+ GetFtnIdxs().UpdateAllFtn();
+ else if( bFtnChrFmts )
+ {
+ SwFmtChg aOld( pOldChrFmt );
+ SwFmtChg aNew( pNewChrFmt );
+ pFtnInfo->ModifyNotification( &aOld, &aNew );
+ }
+
+ // --> OD 2008-01-09 #i81002#
+ // no update during loading
+ if ( !IsInReading() )
+ {
+ UpdateRefFlds(NULL);
+ }
+ SetModified();
+ }
+}
+
+void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
+{
+ SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
+ if( !(GetEndNoteInfo() == rInfo) )
+ {
+ if(GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ sal_Bool bNumChg = rInfo.nFtnOffset != GetEndNoteInfo().nFtnOffset;
+ // this seems to be an optimization: UpdateAllFtn() is only called
+ // if the offset changes; if the offset is the same,
+ // but type/prefix/suffix changes, just set new numbers.
+ bool const bExtra = !bNumChg &&
+ ( (rInfo.aFmt.GetNumberingType() !=
+ GetEndNoteInfo().aFmt.GetNumberingType())
+ || (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix())
+ || (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix())
+ );
+ sal_Bool bFtnDesc = rInfo.GetPageDesc( *this ) !=
+ GetEndNoteInfo().GetPageDesc( *this );
+ SwCharFmt *pOldChrFmt = GetEndNoteInfo().GetCharFmt( *this ),
+ *pNewChrFmt = rInfo.GetCharFmt( *this );
+ sal_Bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
+
+ *pEndNoteInfo = rInfo;
+
+ if ( pTmpRoot )
+ {
+ if ( bFtnDesc )
+ //pTmpRoot->CheckFtnPageDescs( TRUE );
+ {
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::CheckFtnPageDescs), sal_True));//swmod 080304
+ }
+ if ( bExtra )
+ {
+ //Fuer die Benachrichtung bezueglich ErgoSum usw. sparen wir uns
+ //extra-Code und nutzen die vorhandenen Wege.
+ SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
+ for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+ {
+ SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
+ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+ if ( rFtn.IsEndNote() )
+ pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
+ }
+ }
+ } //swmod 080219
+ if( bNumChg )
+ GetFtnIdxs().UpdateAllFtn();
+ else if( bFtnChrFmts )
+ {
+ SwFmtChg aOld( pOldChrFmt );
+ SwFmtChg aNew( pNewChrFmt );
+ pEndNoteInfo->ModifyNotification( &aOld, &aNew );
+ }
+
+ // --> OD 2008-01-09 #i81002#
+ // no update during loading
+ if ( !IsInReading() )
+ {
+ UpdateRefFlds(NULL);
+ }
+ SetModified();
+ }
+}
+
+
+bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
+ sal_uInt16 nNumber, bool bIsEndNote )
+{
+ SwFtnIdxs& rFtnArr = GetFtnIdxs();
+ SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
+
+ const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
+ const sal_uLong nSttNd = pStt->nNode.GetIndex();
+ const xub_StrLen nSttCnt = pStt->nContent.GetIndex();
+ const sal_uLong nEndNd = pEnd->nNode.GetIndex();
+ const xub_StrLen nEndCnt = pEnd->nContent.GetIndex();
+
+ sal_uInt16 nPos;
+ rFtnArr.SeekEntry( pStt->nNode, &nPos );
+
+ SwUndoChangeFootNote* pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it
+ pUndo = new SwUndoChangeFootNote( rPam, rNumStr, nNumber, bIsEndNote );
+ }
+
+ SwTxtFtn* pTxtFtn;
+ sal_uLong nIdx;
+ sal_Bool bChg = sal_False;
+ sal_Bool bTypeChgd = sal_False;
+ sal_uInt16 n = nPos; // sichern
+ while( nPos < rFtnArr.Count() &&
+ (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ nPos++ ] )))
+ < nEndNd || ( nIdx == nEndNd &&
+ nEndCnt >= *pTxtFtn->GetStart() )) )
+ if( nIdx > nSttNd || ( nIdx == nSttNd &&
+ nSttCnt <= *pTxtFtn->GetStart() ) )
+ {
+ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+ if( /*rFtn.GetNumber() != nNumber ||*/
+ rFtn.GetNumStr() != rNumStr ||
+ rFtn.IsEndNote() != bIsEndNote )
+ {
+ bChg = sal_True;
+ if ( pUndo )
+ {
+ pUndo->GetHistory().Add( *pTxtFtn );
+ }
+
+ pTxtFtn->SetNumber( nNumber, &rNumStr );
+ if( rFtn.IsEndNote() != bIsEndNote )
+ {
+ ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote );
+ bTypeChgd = sal_True;
+ pTxtFtn->CheckCondColl();
+ //#i11339# dispose UNO wrapper when a footnote is changed to an endnote or vice versa
+ SwPtrMsgPoolItem aMsgHint( RES_FOOTNOTE_DELETED, (void*)&pTxtFtn->GetAttr() );
+ GetUnoCallBack()->ModifyNotification( &aMsgHint, &aMsgHint );
+ }
+ }
+ }
+
+ nPos = n; // nach vorne gibt es auch noch welche !
+ while( nPos &&
+ (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ --nPos ] )))
+ > nSttNd || ( nIdx == nSttNd &&
+ nSttCnt <= *pTxtFtn->GetStart() )) )
+ if( nIdx < nEndNd || ( nIdx == nEndNd &&
+ nEndCnt >= *pTxtFtn->GetStart() ) )
+ {
+ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+ if( /*rFtn.GetNumber() != nNumber ||*/
+ rFtn.GetNumStr() != rNumStr ||
+ rFtn.IsEndNote() != bIsEndNote )
+ {
+ bChg = sal_True;
+ if ( pUndo )
+ {
+ pUndo->GetHistory().Add( *pTxtFtn );
+ }
+
+ pTxtFtn->SetNumber( nNumber, &rNumStr );
+ if( rFtn.IsEndNote() != bIsEndNote )
+ {
+ ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote );
+ bTypeChgd = sal_True;
+ pTxtFtn->CheckCondColl();
+ }
+ }
+ }
+
+ // wer muss angestossen werden ??
+ if( bChg )
+ {
+ if( pUndo )
+ {
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ if ( bTypeChgd )
+ rFtnArr.UpdateAllFtn();
+ if( FTNNUM_PAGE != GetFtnInfo().eNum )
+ {
+ if ( !bTypeChgd )
+ rFtnArr.UpdateAllFtn();
+ }
+ else if( pTmpRoot )
+ //
+ {
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::UpdateFtnNums));
+ } //swmod 080304pTmpRoot->UpdateFtnNums(); //swmod 080219
+ SetModified();
+ }
+ else
+ delete pUndo;
+ return bChg;
+}
+
+
+
+
+
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
new file mode 100644
index 000000000000..26d9c75e2140
--- /dev/null
+++ b/sw/source/core/doc/docglbl.cxx
@@ -0,0 +1,855 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <unotools/tempfile.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <fmtinfmt.hxx>
+#include <fmtanchr.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <docary.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <docsh.hxx>
+#include <globdoc.hxx>
+#include <shellio.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <section.hxx>
+#include <doctxm.hxx>
+#include <poolfmt.hxx>
+#include <switerator.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+
+using namespace ::com::sun::star;
+
+enum SwSplitDocType
+{
+ SPLITDOC_TO_GLOBALDOC,
+ SPLITDOC_TO_HTML
+};
+
+sal_Bool SwDoc::GenerateGlobalDoc( const String& rPath,
+ const SwTxtFmtColl* pSplitColl )
+{
+ return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, pSplitColl );
+}
+
+//#outline level,add by zhaojianwei
+sal_Bool SwDoc::GenerateGlobalDoc( const String& rPath, int nOutlineLevel )
+{
+ return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, nOutlineLevel );
+}
+sal_Bool SwDoc::GenerateHTMLDoc( const String& rPath, int nOutlineLevel )
+{
+ return SplitDoc( SPLITDOC_TO_HTML, rPath, nOutlineLevel );
+}
+//<-end,zhaojianwei
+
+sal_Bool SwDoc::GenerateHTMLDoc( const String& rPath,
+ const SwTxtFmtColl* pSplitColl )
+{
+#ifdef JP_TEST
+ if( !pSplitColl )
+ {
+ sal_uInt8 nLvl = 1;
+ const SwTxtFmtColls& rFmtColls =*GetTxtFmtColls();
+ for( sal_uInt16 n = rFmtColls.Count(); n; )
+ //if( nLvl == rFmtColls[ --n ]->GetOutlineLevel() )//#outline level,zhaojianwei
+ if( nLvl == rFmtColls[ --n ]->GetAttrOutlineLevel() -1 )//<-end,zhaojianwei 0814
+ {
+ pSplitColl = rFmtColls[ n ];
+ break;
+ }
+
+ if( !pSplitColl )
+ pSplitColl = GetTxtCollFromPool( RES_POOLCOLL_HEADLINE2 );
+ }
+#endif
+
+ return SplitDoc( SPLITDOC_TO_HTML, rPath, pSplitColl );
+}
+
+sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath,
+ const SwTxtFmtColl* pSplitColl )
+{
+ // ueber alle Node der Vorlage Iterieren und dafuer einzelne
+ // Dokumente erzeugen und in diesem gegen
+ // - gelinkte Bereiche (GlobalDoc)
+ // - Links (HTML)
+ // austauschen.
+ // Am Ende wird dieses Doc als GlobalDoc/HTML-Doc gespreichert.
+ if( !pDocShell || !pDocShell->GetMedium() ||
+ ( SPLITDOC_TO_GLOBALDOC == eDocType && get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) )
+ return sal_False;
+
+ sal_uInt16 nOutl = 0;
+ SwOutlineNodes* pOutlNds = (SwOutlineNodes*)&GetNodes().GetOutLineNds();
+ SwNodePtr pSttNd;
+
+ if( pSplitColl )
+ {
+ // wenn keine OutlineNumerierung ist, dann benutze eigenes Array
+ // und sammel die Nodes zusammen.
+ //if( NO_NUMBERING == pSplitColl->GetOutlineLevel() )//#outline level,zhaojianwei
+ if( pSplitColl->GetAttrOutlineLevel() == 0 )//<-end,zhaojianwei, 0814
+ {
+ pOutlNds = new SwOutlineNodes( 8, 8 );
+ SwIterator<SwTxtNode,SwFmtColl> aIter( *pSplitColl );
+ for( SwTxtNode* pTNd = aIter.First(); pTNd; pTNd = aIter.Next() )
+ if( pTNd->GetNodes().IsDocNodes() )
+ pOutlNds->Insert( pTNd );
+
+ if( !pOutlNds->Count() )
+ {
+ delete pOutlNds;
+ return sal_False;
+ }
+ }
+ }
+ else
+ {
+ // dann suche die Gliederungs - Vorlage, der 1. Ebene
+ const SwTxtFmtColls& rFmtColls =*GetTxtFmtColls();
+ for( sal_uInt16 n = rFmtColls.Count(); n; )
+ //if( !rFmtColls[ --n ]->GetOutlineLevel() )//#outline level,zhaojianwei
+ if ( rFmtColls[ --n ]->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei
+ {
+ pSplitColl = rFmtColls[ n ];
+ break;
+ }
+
+ if( !pSplitColl )
+ return sal_False;
+ }
+
+ const SfxFilter* pFilter;
+ switch( eDocType )
+ {
+ case SPLITDOC_TO_HTML:
+ pFilter = SwIoSystem::GetFilterOfFormat( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "HTML" )));
+ break;
+
+ default:
+// case SPLITDOC_TO_GLOBALDOC:
+ pFilter = SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii( FILTER_XML ));
+ eDocType = SPLITDOC_TO_GLOBALDOC;
+ break;
+ }
+
+ if( !pFilter )
+ return sal_False;
+
+ // Undo/Redline aufjedenfall abschalten
+ GetIDocumentUndoRedo().DoUndo(false);
+ SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON));
+
+ String sExt( pFilter->GetSuffixes().GetToken(0, ',') );
+ if( !sExt.Len() )
+ sExt.AssignAscii( "sxw" );
+ if( '.' != sExt.GetChar( 0 ) )
+ sExt.Insert( '.', 0 );
+
+ INetURLObject aEntry(rPath);
+ String sLeading(aEntry.GetBase());
+ aEntry.removeSegment();
+ String sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
+ utl::TempFile aTemp(sLeading,&sExt,&sPath );
+ aTemp.EnableKillingFile();
+
+ DateTime aTmplDate;
+ {
+ Time a2Min( 0 ); a2Min.SetMin( 2 );
+ aTmplDate += a2Min;
+ }
+
+
+ // alle Ungueltigen ueberspringen
+ while( nOutl < pOutlNds->Count() &&
+ pOutlNds->GetObject( nOutl )->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
+ ++nOutl;
+
+ do {
+ pSttNd = 0;
+
+ SwNodePtr pNd;
+ for( ; nOutl < pOutlNds->Count(); ++nOutl )
+ if( ( pNd = pOutlNds->GetObject( nOutl ))->GetTxtNode()->
+ GetTxtColl() == pSplitColl &&
+ !pNd->FindTableNode() )
+ {
+ pSttNd = pNd;
+ break;
+ }
+
+ if( pSttNd )
+ {
+ SwNodePtr pEndNd = 0;
+ for( ++nOutl; nOutl < pOutlNds->Count(); ++nOutl )
+ {
+ pNd = pOutlNds->GetObject( nOutl );
+ SwTxtFmtColl* pTColl = pNd->GetTxtNode()->GetTxtColl();
+
+ //if( ( pTColl == pSplitColl || //#outline level,zhaojianwei
+ // ( NO_NUMBERING != pSplitColl->GetOutlineLevel() &&
+ // pTColl->GetOutlineLevel() <
+ // pSplitColl->GetOutlineLevel() )) &&
+ // !pNd->FindTableNode() )
+ if( ( pTColl == pSplitColl ||
+ ( pSplitColl->GetAttrOutlineLevel() > 0 &&
+ pTColl->GetAttrOutlineLevel() > 0 &&
+ pTColl->GetAttrOutlineLevel() <
+ pSplitColl->GetAttrOutlineLevel() )) &&
+ !pNd->FindTableNode() ) //<-end,zhaojianwei
+ {
+ pEndNd = pNd;
+
+ break;
+ }
+ }
+ SwNodeIndex aEndIdx( pEndNd ? *pEndNd
+ : GetNodes().GetEndOfContent() );
+
+ // die Nodes komplett rausschreiben
+ String sFileName;
+ if( pSttNd->GetIndex() + 1 < aEndIdx.GetIndex() )
+ {
+ SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL ));
+ if( xDocSh->DoInitNew( 0 ) )
+ {
+ SwDoc* pDoc = ((SwDocShell*)(&xDocSh))->GetDoc();
+
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ ((SwDocShell*)(&xDocSh))->GetModel(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps(
+ xDPS->getDocumentProperties());
+ DBG_ASSERT(xDocProps.is(), "Doc has no DocumentProperties");
+ // the GlobalDoc is the template
+ xDocProps->setTemplateName(aEmptyStr);
+ ::util::DateTime uDT(aTmplDate.Get100Sec(),
+ aTmplDate.GetSec(), aTmplDate.GetMin(),
+ aTmplDate.GetHour(), aTmplDate.GetDay(),
+ aTmplDate.GetMonth(), aTmplDate.GetYear());
+ xDocProps->setTemplateDate(uDT);
+ xDocProps->setTemplateURL(rPath);
+ //JP 14.06.99: Set the text of the "split para" as title
+ // from the new doc. Is the current doc has
+ // a title, insert it at begin.
+ String sTitle( xDocProps->getTitle() );
+ if( sTitle.Len() )
+ sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ));
+ sTitle += ((SwTxtNode*)pSttNd)->GetExpandTxt();
+ xDocProps->setTitle( sTitle );
+
+ // Vorlagen ersetzen
+ pDoc->ReplaceStyles( *this );
+
+ // KapitelNumerierung uebernehmen
+ if( pOutlineRule )
+ pDoc->SetOutlineNumRule( *pOutlineRule );
+
+ SwNodeRange aRg( *pSttNd, 0, aEndIdx.GetNode() );
+ SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() );
+ GetNodes()._Copy( aRg, aTmpIdx, sal_False );
+
+ // den initialen TextNode loeschen
+ SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 2 );
+ if( aIdx.GetIndex() + 1 !=
+ pDoc->GetNodes().GetEndOfContent().GetIndex() )
+ pDoc->GetNodes().Delete( aIdx, 1 );
+
+ // alle Flys in dem Bereich
+ CopyFlyInFlyImpl( aRg, 0, aIdx );
+
+
+ // und noch alle Bookmarks
+ // ?????
+
+ utl::TempFile aTempFile2(sLeading,&sExt,&sPath );
+ sFileName = aTempFile2.GetURL();
+ SfxMedium* pTmpMed = new SfxMedium( sFileName,
+ STREAM_STD_READWRITE, sal_True );
+ pTmpMed->SetFilter( pFilter );
+
+ // fuer den HTML-Filter mussen wir aber ein Layout
+ // haben, damit Textrahmen/Controls/OLE-Objecte korrekt
+ // als Grafik exportiert werden koennen.
+ if( SPLITDOC_TO_HTML == eDocType &&
+ pDoc->GetSpzFrmFmts()->Count() )
+ {
+ /* SfxViewFrame* pFrame = */
+ SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
+ }
+ xDocSh->DoSaveAs( *pTmpMed );
+ xDocSh->DoSaveCompleted( pTmpMed );
+
+ // beim Fehler wird keine FileLinkSection eingefuegt
+ if( xDocSh->GetError() )
+ sFileName.Erase();
+ }
+ xDocSh->DoClose();
+ }
+
+ // dann koennen ja die Bereiche eingefuegt werden
+ if( sFileName.Len() )
+ {
+ switch( eDocType )
+ {
+ case SPLITDOC_TO_HTML:
+ {
+ // loesche alle Nodes im Bereich und setze im "Start-
+ // Node" den Link auf das gespeicherte Doc
+ sal_uLong nNodeDiff = aEndIdx.GetIndex() -
+ pSttNd->GetIndex() - 1;
+ if( nNodeDiff )
+ {
+ SwPaM aTmp( *pSttNd, aEndIdx.GetNode(), 1, -1 );
+ aTmp.GetPoint()->nContent.Assign( 0, 0 );
+ aTmp.GetMark()->nContent.Assign( 0, 0 );
+ SwNodeIndex aSIdx( aTmp.GetMark()->nNode );
+ SwNodeIndex aEIdx( aTmp.GetPoint()->nNode );
+
+ // versuche hinters Ende zu verschieben
+ if( !aTmp.Move( fnMoveForward, fnGoNode ) )
+ {
+ // na gut, dann an den Anfang
+ aTmp.Exchange();
+ if( !aTmp.Move( fnMoveBackward, fnGoNode ))
+ {
+ ASSERT( sal_False, "kein Node mehr vorhanden" );
+ }
+ }
+ // Bookmarks usw. verschieben
+ CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), sal_True);
+
+ // stehen noch FlyFrames rum, loesche auch diese
+ for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+ {
+ SwFrmFmt* pFly = (*GetSpzFrmFmts())[n];
+ const SwFmtAnchor* pAnchor = &pFly->GetAnchor();
+ SwPosition const*const pAPos =
+ pAnchor->GetCntntAnchor();
+ if (pAPos &&
+ ((FLY_AT_PARA == pAnchor->GetAnchorId()) ||
+ (FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
+ aSIdx <= pAPos->nNode &&
+ pAPos->nNode < aEIdx )
+ {
+ DelLayoutFmt( pFly );
+ --n;
+ }
+ }
+
+ GetNodes().Delete( aSIdx, nNodeDiff );
+ }
+
+ // dann setze im StartNode noch den Link:
+ SwFmtINetFmt aINet( sFileName , aEmptyStr );
+ SwTxtNode* pTNd = (SwTxtNode*)pSttNd;
+ pTNd->InsertItem( aINet, 0, pTNd->GetTxt().Len() );
+
+ // wenn der nicht mehr gefunden wird, kann das nur
+ // ein Bug sein!
+ if( !pOutlNds->Seek_Entry( pSttNd, &nOutl ))
+ pSttNd = 0;
+ ++nOutl;
+ }
+ break;
+
+ default:
+ {
+ String sNm( INetURLObject( sFileName ).GetName() );
+ SwSectionData aSectData( FILE_LINK_SECTION,
+ GetUniqueSectionName( &sNm ));
+ SwSectionFmt* pFmt = MakeSectionFmt( 0 );
+ aSectData.SetLinkFileName(sFileName);
+ aSectData.SetProtectFlag(true);
+
+ aEndIdx--; // im InsertSection ist Ende inclusive
+ while( aEndIdx.GetNode().IsStartNode() )
+ aEndIdx--;
+
+ // JP 06.07.99 - Bug 67361 - is any Section ends or
+ // starts in the new sectionrange, they must end or
+ // start before or behind the range!
+ SwSectionNode* pSectNd = pSttNd->FindSectionNode();
+ while( pSectNd && pSectNd->EndOfSectionIndex()
+ <= aEndIdx.GetIndex() )
+ {
+ const SwNode* pSectEnd = pSectNd->EndOfSectionNode();
+ if( pSectNd->GetIndex() + 1 ==
+ pSttNd->GetIndex() )
+ {
+ sal_Bool bMvIdx = aEndIdx == *pSectEnd;
+ DelSectionFmt( pSectNd->GetSection().GetFmt() );
+ if( bMvIdx )
+ aEndIdx--;
+ }
+ else
+ {
+ SwNodeRange aRg( *pSttNd, *pSectEnd );
+ SwNodeIndex aIdx( *pSectEnd, 1 );
+ GetNodes()._MoveNodes( aRg, GetNodes(), aIdx );
+ }
+ pSectNd = pSttNd->FindSectionNode();
+ }
+
+ pSectNd = aEndIdx.GetNode().FindSectionNode();
+ while( pSectNd && pSectNd->GetIndex() >
+ pSttNd->GetIndex() )
+ {
+ // #i15712# don't attempt to split sections if
+ // they are fully enclosed in [pSectNd,aEndIdx].
+ if( aEndIdx < pSectNd->EndOfSectionIndex() )
+ {
+ SwNodeRange aRg( *pSectNd, 1, aEndIdx, 1 );
+ SwNodeIndex aIdx( *pSectNd );
+ GetNodes()._MoveNodes( aRg, GetNodes(), aIdx );
+ }
+
+ pSectNd = pSttNd->FindSectionNode();
+ }
+
+ // -> #i26762#
+ // Ensure order of start and end of section is sane.
+ SwNodeIndex aStartIdx(*pSttNd);
+
+ if (aEndIdx >= aStartIdx)
+ {
+ pSectNd = GetNodes().InsertTextSection(aStartIdx,
+ *pFmt, aSectData, 0, &aEndIdx, false);
+ }
+ else
+ {
+ pSectNd = GetNodes().InsertTextSection(aEndIdx,
+ *pFmt, aSectData, 0, &aStartIdx, false);
+ }
+ // <- #i26762#
+
+ pSectNd->GetSection().CreateLink( CREATE_CONNECT );
+ }
+ break;
+ }
+ }
+ }
+ } while( pSttNd );
+
+// if( pOutlNds != (SwOutlineNodes*)&GetNodes().GetOutLineNds();
+ if( pOutlNds != &GetNodes().GetOutLineNds() )
+ delete pOutlNds;
+
+ switch( eDocType )
+ {
+ case SPLITDOC_TO_HTML:
+ if( get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
+ {
+ // dann alles verbliebenen Bereiche aufheben
+ while( GetSections().Count() )
+ DelSectionFmt( GetSections()[ 0 ] );
+
+ SfxFilterContainer* pFCntnr = pDocShell->GetFactory().GetFilterContainer();
+ pFilter = pFCntnr->GetFilter4EA( pFilter->GetTypeName(), SFX_FILTER_EXPORT );
+ }
+ break;
+
+// case SPLITDOC_TO_GLOBALDOC:
+ default:
+ // dann das Globaldoc speichern
+ set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true);
+ set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, false);
+ }
+
+ // Medium istn't locked after reopen the document. Bug 91462
+ SfxRequest aReq( SID_SAVEASDOC, SFX_CALLMODE_SYNCHRON, GetAttrPool() );
+ aReq.AppendItem( SfxStringItem( SID_FILE_NAME, rPath ) );
+ aReq.AppendItem( SfxBoolItem( SID_SAVETO, sal_True ) );
+ if(pFilter)
+ aReq.AppendItem( SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) );
+ const SfxBoolItem *pRet = (const SfxBoolItem*)pDocShell->ExecuteSlot( aReq );
+
+ return pRet && pRet->GetValue();
+}
+
+//#outline level,add by zhaojianwei
+sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, int nOutlineLevel )
+{
+ if( !pDocShell || !pDocShell->GetMedium() ||
+ ( SPLITDOC_TO_GLOBALDOC == eDocType && get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) )
+ return sal_False;
+
+ sal_uInt16 nOutl = 0;
+ SwOutlineNodes* pOutlNds = (SwOutlineNodes*)&GetNodes().GetOutLineNds();
+ SwNodePtr pSttNd;
+
+ const SfxFilter* pFilter;
+ switch( eDocType )
+ {
+ case SPLITDOC_TO_HTML:
+ pFilter = SwIoSystem::GetFilterOfFormat( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "HTML" )));
+ break;
+
+ default:
+// case SPLITDOC_TO_GLOBALDOC:
+ pFilter = SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii( FILTER_XML ));
+ eDocType = SPLITDOC_TO_GLOBALDOC;
+ break;
+ }
+
+ if( !pFilter )
+ return sal_False;
+
+ // Undo/Redline aufjedenfall abschalten
+ GetIDocumentUndoRedo().DoUndo(false);
+ SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON));
+
+ String sExt( pFilter->GetSuffixes().GetToken(0, ',') );
+ if( !sExt.Len() )
+ sExt.AssignAscii( "sxw" );
+ if( '.' != sExt.GetChar( 0 ) )
+ sExt.Insert( '.', 0 );
+
+ INetURLObject aEntry(rPath);
+ String sLeading(aEntry.GetBase());
+ aEntry.removeSegment();
+ String sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
+ utl::TempFile aTemp(sLeading,&sExt,&sPath );
+ aTemp.EnableKillingFile();
+
+ DateTime aTmplDate;
+ {
+ Time a2Min( 0 ); a2Min.SetMin( 2 );
+ aTmplDate += a2Min;
+ }
+
+
+ // alle Ungueltigen ueberspringen
+ while( nOutl < pOutlNds->Count() &&
+ pOutlNds->GetObject( nOutl )->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
+ ++nOutl;
+
+ do {
+ pSttNd = 0;
+
+ SwNodePtr pNd;
+ for( ; nOutl < pOutlNds->Count(); ++nOutl )
+ if( ( pNd = pOutlNds->GetObject( nOutl ))->GetTxtNode()->GetAttrOutlineLevel() == nOutlineLevel &&
+ !pNd->FindTableNode() )
+ {
+ pSttNd = pNd;
+ break;
+ }
+
+ if( pSttNd )
+ {
+ SwNodePtr pEndNd = 0;
+ for( ++nOutl; nOutl < pOutlNds->Count(); ++nOutl )
+ {
+ pNd = pOutlNds->GetObject( nOutl );
+
+ const int nLevel = pNd->GetTxtNode()->GetAttrOutlineLevel();
+
+ if( ( 0 < nLevel && nLevel <= nOutlineLevel ) &&
+ !pNd->FindTableNode() )
+ {
+ pEndNd = pNd;
+
+ break;
+ }
+ }
+ SwNodeIndex aEndIdx( pEndNd ? *pEndNd
+ : GetNodes().GetEndOfContent() );
+
+ String sFileName;
+ if( pSttNd->GetIndex() + 1 < aEndIdx.GetIndex() )
+ {
+ SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL ));
+ if( xDocSh->DoInitNew( 0 ) )
+ {
+ SwDoc* pDoc = ((SwDocShell*)(&xDocSh))->GetDoc();
+
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ ((SwDocShell*)(&xDocSh))->GetModel(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps(
+ xDPS->getDocumentProperties());
+ DBG_ASSERT(xDocProps.is(), "Doc has no DocumentProperties");
+ // the GlobalDoc is the template
+ xDocProps->setTemplateName(aEmptyStr);
+ ::util::DateTime uDT(aTmplDate.Get100Sec(),
+ aTmplDate.GetSec(), aTmplDate.GetMin(),
+ aTmplDate.GetHour(), aTmplDate.GetDay(),
+ aTmplDate.GetMonth(), aTmplDate.GetYear());
+ xDocProps->setTemplateDate(uDT);
+ xDocProps->setTemplateURL(rPath);
+ //JP 14.06.99: Set the text of the "split para" as title
+ // from the new doc. Is the current doc has
+ // a title, insert it at begin.
+ String sTitle( xDocProps->getTitle() );
+ if( sTitle.Len() )
+ sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ));
+ sTitle += ((SwTxtNode*)pSttNd)->GetExpandTxt();
+ xDocProps->setTitle( sTitle );
+
+ // Vorlagen ersetzen
+ pDoc->ReplaceStyles( *this );
+
+ // KapitelNumerierung uebernehmen
+ if( pOutlineRule )
+ pDoc->SetOutlineNumRule( *pOutlineRule );
+
+ SwNodeRange aRg( *pSttNd, 0, aEndIdx.GetNode() );
+ SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() );
+ GetNodes()._Copy( aRg, aTmpIdx, sal_False );
+
+ // den initialen TextNode loeschen
+ SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 2 );
+ if( aIdx.GetIndex() + 1 !=
+ pDoc->GetNodes().GetEndOfContent().GetIndex() )
+ pDoc->GetNodes().Delete( aIdx, 1 );
+
+ // alle Flys in dem Bereich
+ CopyFlyInFlyImpl( aRg, 0, aIdx );
+
+
+ // und noch alle Bookmarks
+ // ?????
+
+ utl::TempFile aTempFile2(sLeading,&sExt,&sPath );
+ sFileName = aTempFile2.GetURL();
+ SfxMedium* pTmpMed = new SfxMedium( sFileName,
+ STREAM_STD_READWRITE, sal_True );
+ pTmpMed->SetFilter( pFilter );
+
+ // fuer den HTML-Filter mussen wir aber ein Layout
+ // haben, damit Textrahmen/Controls/OLE-Objecte korrekt
+ // als Grafik exportiert werden koennen.
+ if( SPLITDOC_TO_HTML == eDocType &&
+ pDoc->GetSpzFrmFmts()->Count() )
+ {
+ /* SfxViewFrame* pFrame = */
+ SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
+ }
+ xDocSh->DoSaveAs( *pTmpMed );
+ xDocSh->DoSaveCompleted( pTmpMed );
+
+ // beim Fehler wird keine FileLinkSection eingefuegt
+ if( xDocSh->GetError() )
+ sFileName.Erase();
+ }
+ xDocSh->DoClose();
+ }
+
+ // dann koennen ja die Bereiche eingefuegt werden
+ if( sFileName.Len() )
+ {
+ switch( eDocType )
+ {
+ case SPLITDOC_TO_HTML:
+ {
+ // loesche alle Nodes im Bereich und setze im "Start-
+ // Node" den Link auf das gespeicherte Doc
+ sal_uLong nNodeDiff = aEndIdx.GetIndex() -
+ pSttNd->GetIndex() - 1;
+ if( nNodeDiff )
+ {
+ SwPaM aTmp( *pSttNd, aEndIdx.GetNode(), 1, -1 );
+ aTmp.GetPoint()->nContent.Assign( 0, 0 );
+ aTmp.GetMark()->nContent.Assign( 0, 0 );
+ SwNodeIndex aSIdx( aTmp.GetMark()->nNode );
+ SwNodeIndex aEIdx( aTmp.GetPoint()->nNode );
+
+ // versuche hinters Ende zu verschieben
+ if( !aTmp.Move( fnMoveForward, fnGoNode ) )
+ {
+ // na gut, dann an den Anfang
+ aTmp.Exchange();
+ if( !aTmp.Move( fnMoveBackward, fnGoNode ))
+ {
+ ASSERT( sal_False, "kein Node mehr vorhanden" );
+ }
+ }
+ // Bookmarks usw. verschieben
+ CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), sal_True);
+
+ // stehen noch FlyFrames rum, loesche auch diese
+ for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+ {
+ SwFrmFmt* pFly = (*GetSpzFrmFmts())[n];
+ const SwFmtAnchor* pAnchor = &pFly->GetAnchor();
+ SwPosition const*const pAPos =
+ pAnchor->GetCntntAnchor();
+ if (pAPos &&
+ ((FLY_AT_PARA == pAnchor->GetAnchorId()) ||
+ (FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
+ aSIdx <= pAPos->nNode &&
+ pAPos->nNode < aEIdx )
+ {
+ DelLayoutFmt( pFly );
+ --n;
+ }
+ }
+
+ GetNodes().Delete( aSIdx, nNodeDiff );
+ }
+
+ // dann setze im StartNode noch den Link:
+ SwFmtINetFmt aINet( sFileName , aEmptyStr );
+ SwTxtNode* pTNd = (SwTxtNode*)pSttNd;
+ pTNd->InsertItem( aINet, 0, pTNd->GetTxt().Len() );
+
+ // wenn der nicht mehr gefunden wird, kann das nur
+ // ein Bug sein!
+ if( !pOutlNds->Seek_Entry( pSttNd, &nOutl ))
+ pSttNd = 0;
+ ++nOutl;
+ }
+ break;
+
+ default:
+ {
+ String sNm( INetURLObject( sFileName ).GetName() );
+ SwSectionData aSectData( FILE_LINK_SECTION,
+ GetUniqueSectionName( &sNm ));
+ SwSectionFmt* pFmt = MakeSectionFmt( 0 );
+ aSectData.SetLinkFileName(sFileName);
+ aSectData.SetProtectFlag(true);
+
+ aEndIdx--; // im InsertSection ist Ende inclusive
+ while( aEndIdx.GetNode().IsStartNode() )
+ aEndIdx--;
+
+ // JP 06.07.99 - Bug 67361 - is any Section ends or
+ // starts in the new sectionrange, they must end or
+ // start before or behind the range!
+ SwSectionNode* pSectNd = pSttNd->FindSectionNode();
+ while( pSectNd && pSectNd->EndOfSectionIndex()
+ <= aEndIdx.GetIndex() )
+ {
+ const SwNode* pSectEnd = pSectNd->EndOfSectionNode();
+ if( pSectNd->GetIndex() + 1 ==
+ pSttNd->GetIndex() )
+ {
+ sal_Bool bMvIdx = aEndIdx == *pSectEnd;
+ DelSectionFmt( pSectNd->GetSection().GetFmt() );
+ if( bMvIdx )
+ aEndIdx--;
+ }
+ else
+ {
+ SwNodeRange aRg( *pSttNd, *pSectEnd );
+ SwNodeIndex aIdx( *pSectEnd, 1 );
+ GetNodes()._MoveNodes( aRg, GetNodes(), aIdx );
+ }
+ pSectNd = pSttNd->FindSectionNode();
+ }
+
+ pSectNd = aEndIdx.GetNode().FindSectionNode();
+ while( pSectNd && pSectNd->GetIndex() >
+ pSttNd->GetIndex() )
+ {
+ if( aEndIdx < pSectNd->EndOfSectionIndex() )
+ {
+ SwNodeRange aRg( *pSectNd, 1, aEndIdx, 1 );
+ SwNodeIndex aIdx( *pSectNd );
+ GetNodes()._MoveNodes( aRg, GetNodes(), aIdx );
+ }
+
+ pSectNd = pSttNd->FindSectionNode();
+ }
+
+ SwNodeIndex aStartIdx(*pSttNd);
+
+ if (aEndIdx >= aStartIdx)
+ {
+ pSectNd = GetNodes().InsertTextSection(aStartIdx,
+ *pFmt, aSectData, 0, &aEndIdx, false);
+ }
+ else
+ {
+ pSectNd = GetNodes().InsertTextSection(aEndIdx,
+ *pFmt, aSectData, 0, &aStartIdx, false);
+ }
+
+ pSectNd->GetSection().CreateLink( CREATE_CONNECT );
+ }
+ break;
+ }
+ }
+ }
+ } while( pSttNd );
+
+ if( pOutlNds != &GetNodes().GetOutLineNds() )
+ delete pOutlNds;
+
+ switch( eDocType )
+ {
+ case SPLITDOC_TO_HTML:
+ if( get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
+ {
+ while( GetSections().Count() )
+ DelSectionFmt( GetSections()[ 0 ] );
+
+ SfxFilterContainer* pFCntnr = pDocShell->GetFactory().GetFilterContainer();
+ pFilter = pFCntnr->GetFilter4EA( pFilter->GetTypeName(), SFX_FILTER_EXPORT );
+ }
+ break;
+
+// case SPLITDOC_TO_GLOBALDOC:
+ default:
+ set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true);
+ set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, false);
+ }
+
+ SfxRequest aReq( SID_SAVEASDOC, SFX_CALLMODE_SYNCHRON, GetAttrPool() );
+ aReq.AppendItem( SfxStringItem( SID_FILE_NAME, rPath ) );
+ aReq.AppendItem( SfxBoolItem( SID_SAVETO, sal_True ) );
+ if(pFilter)
+ aReq.AppendItem( SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) );
+ const SfxBoolItem *pRet = (const SfxBoolItem*)pDocShell->ExecuteSlot( aReq );
+
+ return pRet && pRet->GetValue();
+}//<-end,zhaojianwei
+
diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx
new file mode 100644
index 000000000000..610a8fb170b8
--- /dev/null
+++ b/sw/source/core/doc/docglos.cxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <shellio.hxx>
+#include <pam.hxx>
+#include <swundo.hxx>
+#include <ndtxt.hxx>
+#include <acorrect.hxx>
+#include <crsrsh.hxx>
+#include <docsh.hxx>
+
+
+using namespace ::com::sun::star;
+
+
+/// copy document properties via public interface
+static void lcl_copyDocumentProperties(
+ uno::Reference<document::XDocumentProperties> i_xSource,
+ uno::Reference<document::XDocumentProperties> i_xTarget) {
+ DBG_ASSERT(i_xSource.is(), "null reference");
+ DBG_ASSERT(i_xTarget.is(), "null reference");
+
+ i_xTarget->setAuthor(i_xSource->getAuthor());
+ i_xTarget->setGenerator(i_xSource->getGenerator());
+ i_xTarget->setCreationDate(i_xSource->getCreationDate());
+ i_xTarget->setTitle(i_xSource->getTitle());
+ i_xTarget->setSubject(i_xSource->getSubject());
+ i_xTarget->setDescription(i_xSource->getDescription());
+ i_xTarget->setKeywords(i_xSource->getKeywords());
+ i_xTarget->setLanguage(i_xSource->getLanguage());
+ i_xTarget->setModifiedBy(i_xSource->getModifiedBy());
+ i_xTarget->setModificationDate(i_xSource->getModificationDate());
+ i_xTarget->setPrintedBy(i_xSource->getPrintedBy());
+ i_xTarget->setPrintDate(i_xSource->getPrintDate());
+ i_xTarget->setTemplateName(i_xSource->getTemplateName());
+ i_xTarget->setTemplateURL(i_xSource->getTemplateURL());
+ i_xTarget->setTemplateDate(i_xSource->getTemplateDate());
+ i_xTarget->setAutoloadURL(i_xSource->getAutoloadURL());
+ i_xTarget->setAutoloadSecs(i_xSource->getAutoloadSecs());
+ i_xTarget->setDefaultTarget(i_xSource->getDefaultTarget());
+ i_xTarget->setDocumentStatistics(i_xSource->getDocumentStatistics());
+ i_xTarget->setEditingCycles(i_xSource->getEditingCycles());
+ i_xTarget->setEditingDuration(i_xSource->getEditingDuration());
+
+ uno::Reference<beans::XPropertySet> xSourceUDSet(
+ i_xSource->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertyContainer> xTargetUD(
+ i_xTarget->getUserDefinedProperties());
+ uno::Reference<beans::XPropertySet> xTargetUDSet(xTargetUD,
+ uno::UNO_QUERY_THROW);
+ uno::Sequence<beans::Property> tgtprops
+ = xTargetUDSet->getPropertySetInfo()->getProperties();
+ for (sal_Int32 i = 0; i < tgtprops.getLength(); ++i) {
+ try {
+ xTargetUD->removeProperty(tgtprops [i].Name);
+ } catch (uno::Exception &) {
+ // ignore
+ }
+ }
+ try {
+ uno::Reference<beans::XPropertySetInfo> xSetInfo
+ = xSourceUDSet->getPropertySetInfo();
+ uno::Sequence<beans::Property> srcprops = xSetInfo->getProperties();
+ for (sal_Int32 i = 0; i < srcprops.getLength(); ++i) {
+ ::rtl::OUString name = srcprops[i].Name;
+ xTargetUD->addProperty(name, srcprops[i].Attributes,
+ xSourceUDSet->getPropertyValue(name));
+ }
+ } catch (uno::Exception &) {
+ // ignore
+ }
+}
+
+/* -----------------22.07.99 11:47-------------------
+ Description: inserts an AutoText block
+ --------------------------------------------------*/
+sal_Bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry,
+ SwPaM& rPaM, SwCrsrShell* pShell )
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nIdx = rBlock.GetIndex( rEntry );
+ if( (sal_uInt16) -1 != nIdx )
+ {
+ // Bug #70238# ask the TextOnly-Flag before BeginGetDoc, because
+ // the method closed the Storage!
+ sal_Bool bSav_IsInsGlossary = mbInsOnlyTxtGlssry;
+ mbInsOnlyTxtGlssry = rBlock.IsOnlyTextBlock( nIdx );
+
+ if( rBlock.BeginGetDoc( nIdx ) )
+ {
+ SwDoc* pGDoc = rBlock.GetDoc();
+
+ // alle FixFelder aktualisieren. Dann aber auch mit der
+ // richtigen DocInfo!
+ // FIXME: UGLY: Because we cannot limit the range in which to do
+ // field updates, we must update the fixed fields at the glossary
+ // entry document.
+ // To be able to do this, we copy the document properties of the
+ // target document to the glossary document
+// DBG_ASSERT(GetDocShell(), "no SwDocShell"); // may be clipboard!
+ DBG_ASSERT(pGDoc->GetDocShell(), "no SwDocShell at glossary");
+ if (GetDocShell() && pGDoc->GetDocShell()) {
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetDocShell()->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps(
+ xDPS->getDocumentProperties() );
+ uno::Reference<document::XDocumentPropertiesSupplier> xGlosDPS(
+ pGDoc->GetDocShell()->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xGlosDocProps(
+ xGlosDPS->getDocumentProperties() );
+ lcl_copyDocumentProperties(xDocProps, xGlosDocProps);
+ }
+ pGDoc->SetFixFields(false, NULL);
+
+ //StartAllAction();
+ LockExpFlds();
+
+ SwNodeIndex aStt( pGDoc->GetNodes().GetEndOfExtras(), 1 );
+ SwCntntNode* pCntntNd = pGDoc->GetNodes().GoNext( &aStt );
+ const SwTableNode* pTblNd = pCntntNd->FindTableNode();
+ SwPaM aCpyPam( pTblNd ? *(SwNode*)pTblNd : *(SwNode*)pCntntNd );
+ aCpyPam.SetMark();
+
+ // dann bis zum Ende vom Nodes Array
+ aCpyPam.GetPoint()->nNode = pGDoc->GetNodes().GetEndOfContent().GetIndex()-1;
+ pCntntNd = aCpyPam.GetCntntNode();
+ aCpyPam.GetPoint()->nContent.Assign( pCntntNd, pCntntNd->Len() );
+
+ GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL );
+ SwPaM *_pStartCrsr = &rPaM, *__pStartCrsr = _pStartCrsr;
+ do {
+
+ SwPosition& rInsPos = *_pStartCrsr->GetPoint();
+ SwStartNode* pBoxSttNd = (SwStartNode*)rInsPos.nNode.GetNode().
+ FindTableBoxStartNode();
+
+ if( pBoxSttNd && 2 == pBoxSttNd->EndOfSectionIndex() -
+ pBoxSttNd->GetIndex() &&
+ aCpyPam.GetPoint()->nNode != aCpyPam.GetMark()->nNode )
+ {
+ // es wird mehr als 1 Node in die akt. Box kopiert.
+ // Dann muessen die BoxAttribute aber entfernt werden.
+ ClearBoxNumAttrs( rInsPos.nNode );
+ }
+
+ SwDontExpandItem aACD;
+ aACD.SaveDontExpandItems( rInsPos );
+
+ pGDoc->CopyRange( aCpyPam, rInsPos, false );
+
+ aACD.RestoreDontExpandItems( rInsPos );
+ if( pShell )
+ pShell->SaveTblBoxCntnt( &rInsPos );
+ } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) !=
+ __pStartCrsr );
+ GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL );
+
+ UnlockExpFlds();
+ if( !IsExpFldsLocked() )
+ UpdateExpFlds(NULL, true);
+ bRet = sal_True;
+ }
+ mbInsOnlyTxtGlssry = bSav_IsInsGlossary;
+ }
+ rBlock.EndGetDoc();
+ return bRet;
+}
+
+
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
new file mode 100644
index 000000000000..1d7531e5504d
--- /dev/null
+++ b/sw/source/core/doc/doclay.cxx
@@ -0,0 +1,2440 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <unotools/linguprops.hxx>
+#include <unotools/lingucfg.hxx>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <hintids.hxx>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <sfx2/progress.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/opaqitem.hxx>
+#include <editeng/prntitem.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/svdouno.hxx>
+#include <svx/fmpage.hxx>
+#include <editeng/frmdiritem.hxx>
+
+#include <swmodule.hxx>
+#include <modcfg.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <rtl/logfile.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <fchrfmt.hxx>
+#include <errhdl.hxx>
+#include <frmatr.hxx>
+#include <txatbase.hxx>
+#include <fmtfld.hxx>
+#include <fmtornt.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtanchr.hxx>
+#include <fmtfsize.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtflcnt.hxx>
+#include <fmtcnct.hxx>
+#include <frmfmt.hxx>
+#include <dcontact.hxx>
+#include <txtflcnt.hxx>
+#include <docfld.hxx> // fuer Expression-Felder
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <ndnotxt.hxx>
+#include <ndole.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <rootfrm.hxx>
+#include <pagefrm.hxx>
+#include <cntfrm.hxx>
+#include <flyfrm.hxx>
+#include <fesh.hxx>
+#include <docsh.hxx>
+#include <dflyobj.hxx>
+#include <dcontact.hxx>
+#include <swundo.hxx>
+#include <flypos.hxx>
+#include <UndoInsert.hxx>
+#include <expfld.hxx> // InsertLabel
+#include <poolfmt.hxx> // PoolVorlagen-Id's
+#include <docary.hxx>
+#include <swtable.hxx>
+#include <tblsel.hxx>
+#include <viewopt.hxx>
+#include <fldupde.hxx>
+#include <txtftn.hxx>
+#include <ftnidx.hxx>
+#include <ftninfo.hxx>
+#include <pagedesc.hxx>
+#include <PostItMgr.hxx>
+#include <comcore.hrc> // STR-ResId's
+
+// #i11176#
+#include <unoframe.hxx>
+// OD 2004-05-24 #i28701#
+#include <sortedobjs.hxx>
+
+// --> OD 2004-07-26 #i32089#
+#include <vector>
+// <--
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+#define DEF_FLY_WIDTH 2268 //Defaultbreite fuer FlyFrms (2268 == 4cm)
+
+/* #109161# */
+static bool lcl_IsItemSet(const SwCntntNode & rNode, sal_uInt16 which)
+{
+ bool bResult = false;
+
+ if (SFX_ITEM_SET == rNode.GetSwAttrSet().GetItemState(which))
+ bResult = true;
+
+ return bResult;
+}
+
+/*************************************************************************
+|*
+|* SwDoc::MakeLayoutFmt()
+|*
+|* Beschreibung Erzeugt ein neues Format das in seinen Einstellungen
+|* Defaultmaessig zu dem Request passt. Das Format wird in das
+|* entsprechende Formate-Array gestellt.
+|* Wenn bereits ein passendes Format existiert, so wird dies
+|* zurueckgeliefert.
+|* Ersterstellung MA 22. Sep. 92
+|* Letzte Aenderung JP 08.05.98
+|*
+|*************************************************************************/
+
+SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet )
+{
+ SwFrmFmt *pFmt = 0;
+ const sal_Bool bMod = IsModified();
+ sal_Bool bHeader = sal_False;
+
+ switch ( eRequest )
+ {
+ case RND_STD_HEADER:
+ case RND_STD_HEADERL:
+ case RND_STD_HEADERR:
+ {
+ bHeader = sal_True;
+ // kein break, es geht unten weiter
+ }
+ case RND_STD_FOOTER:
+ case RND_STD_FOOTERL:
+ case RND_STD_FOOTERR:
+ {
+ pFmt = new SwFrmFmt( GetAttrPool(),
+ (bHeader ? "Header" : "Footer"),
+ GetDfltFrmFmt() );
+
+ SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() );
+ SwStartNode* pSttNd =
+ GetNodes().MakeTextSection
+ ( aTmpIdx,
+ bHeader ? SwHeaderStartNode : SwFooterStartNode,
+ GetTxtCollFromPool(static_cast<sal_uInt16>( bHeader
+ ? ( eRequest == RND_STD_HEADERL
+ ? RES_POOLCOLL_HEADERL
+ : eRequest == RND_STD_HEADERR
+ ? RES_POOLCOLL_HEADERR
+ : RES_POOLCOLL_HEADER )
+ : ( eRequest == RND_STD_FOOTERL
+ ? RES_POOLCOLL_FOOTERL
+ : eRequest == RND_STD_FOOTERR
+ ? RES_POOLCOLL_FOOTERR
+ : RES_POOLCOLL_FOOTER )
+ ) ) );
+ pFmt->SetFmtAttr( SwFmtCntnt( pSttNd ));
+
+ if( pSet ) // noch ein paar Attribute setzen ?
+ pFmt->SetFmtAttr( *pSet );
+
+ // JP: warum zuruecksetzen ??? Doc. ist doch veraendert ???
+ // bei den Fly auf jedenfall verkehrt !!
+ if ( !bMod )
+ ResetModified();
+ }
+ break;
+
+ case RND_DRAW_OBJECT:
+ {
+ pFmt = MakeDrawFrmFmt( aEmptyStr, GetDfltFrmFmt() );
+ if( pSet ) // noch ein paar Attribute setzen ?
+ pFmt->SetFmtAttr( *pSet );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoInsLayFmt(pFmt, 0, 0));
+ }
+ }
+ break;
+
+#ifdef DBG_UTIL
+ case FLY_AT_PAGE:
+ case FLY_AT_CHAR:
+ case FLY_AT_FLY:
+ case FLY_AT_PARA:
+ case FLY_AS_CHAR:
+ ASSERT( false, "use new interface instead: SwDoc::MakeFlySection!" );
+ break;
+#endif
+
+ default:
+ ASSERT( !this,
+ "Layoutformat mit ungueltigem Request angefordert." );
+
+ }
+ return pFmt;
+}
+/*************************************************************************
+|*
+|* SwDoc::DelLayoutFmt()
+|*
+|* Beschreibung Loescht das angegebene Format, der Inhalt wird mit
+|* geloescht.
+|* Ersterstellung MA 23. Sep. 92
+|* Letzte Aenderung MA 05. Feb. 93
+|*
+|*************************************************************************/
+
+void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt )
+{
+ //Verkettung von Rahmen muss ggf. zusammengefuehrt werden.
+ //Bevor die Frames vernichtet werden, damit die Inhalte der Rahmen
+ //ggf. entsprechend gerichtet werden.
+ const SwFmtChain &rChain = pFmt->GetChain();
+ if ( rChain.GetPrev() )
+ {
+ SwFmtChain aChain( rChain.GetPrev()->GetChain() );
+ aChain.SetNext( rChain.GetNext() );
+ SetAttr( aChain, *rChain.GetPrev() );
+ }
+ if ( rChain.GetNext() )
+ {
+ SwFmtChain aChain( rChain.GetNext()->GetChain() );
+ aChain.SetPrev( rChain.GetPrev() );
+ SetAttr( aChain, *rChain.GetNext() );
+ }
+
+ const SwNodeIndex* pCntIdx = pFmt->GetCntnt().GetCntntIdx();
+ if (pCntIdx && !GetIDocumentUndoRedo().DoesUndo())
+ {
+ //Verbindung abbauen, falls es sich um ein OLE-Objekt handelt.
+ SwOLENode* pOLENd = GetNodes()[ pCntIdx->GetIndex()+1 ]->GetOLENode();
+ if( pOLENd && pOLENd->GetOLEObj().IsOleRef() )
+ {
+ /*
+ SwDoc* pDoc = (SwDoc*)pFmt->GetDoc();
+ if( pDoc )
+ {
+ SfxObjectShell* p = pDoc->GetPersist();
+ if( p ) // muss da sein
+ {
+ SvInfoObjectRef aRef( p->Find( pOLENd->GetOLEObj().GetName() ) );
+ if( aRef.Is() )
+ aRef->SetObj(0);
+ }
+ } */
+
+ // TODO/MBA: the old object closed the object, cleared all references to it, but didn't remove it from the container.
+ // I have no idea, why, nobody could explain it - so I do my very best to mimic this behavior
+ //uno::Reference < util::XCloseable > xClose( pOLENd->GetOLEObj().GetOleRef(), uno::UNO_QUERY );
+ //if ( xClose.is() )
+ {
+ try
+ {
+ pOLENd->GetOLEObj().GetOleRef()->changeState( embed::EmbedStates::LOADED );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+
+ //pOLENd->GetOLEObj().GetOleRef() = 0;
+ }
+ }
+
+ //Frms vernichten.
+ pFmt->DelFrms();
+
+ // erstmal sind nur Fly's Undofaehig
+ const sal_uInt16 nWh = pFmt->Which();
+ if (GetIDocumentUndoRedo().DoesUndo() &&
+ (RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh))
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoDelLayFmt( pFmt ));
+ }
+ else
+ {
+ // --> OD 2004-07-26 #i32089# - delete at-frame anchored objects
+ if ( nWh == RES_FLYFRMFMT )
+ {
+ // determine frame formats of at-frame anchored objects
+ const SwNodeIndex* pCntntIdx = pFmt->GetCntnt().GetCntntIdx();
+ if ( pCntntIdx )
+ {
+ const SwSpzFrmFmts* pTbl = pFmt->GetDoc()->GetSpzFrmFmts();
+ if ( pTbl )
+ {
+ std::vector<SwFrmFmt*> aToDeleteFrmFmts;
+ const sal_uLong nNodeIdxOfFlyFmt( pCntntIdx->GetIndex() );
+
+ for ( sal_uInt16 i = 0; i < pTbl->Count(); ++i )
+ {
+ SwFrmFmt* pTmpFmt = (*pTbl)[i];
+ const SwFmtAnchor &rAnch = pTmpFmt->GetAnchor();
+ if ( rAnch.GetAnchorId() == FLY_AT_FLY &&
+ rAnch.GetCntntAnchor()->nNode.GetIndex() == nNodeIdxOfFlyFmt )
+ {
+ aToDeleteFrmFmts.push_back( pTmpFmt );
+ }
+ }
+
+ // delete found frame formats
+ while ( !aToDeleteFrmFmts.empty() )
+ {
+ SwFrmFmt* pTmpFmt = aToDeleteFrmFmts.back();
+ pFmt->GetDoc()->DelLayoutFmt( pTmpFmt );
+
+ aToDeleteFrmFmts.pop_back();
+ }
+ }
+ }
+ }
+ // <--
+
+ //Inhalt Loeschen.
+ if( pCntIdx )
+ {
+ SwNode *pNode = &pCntIdx->GetNode();
+ ((SwFmtCntnt&)pFmt->GetFmtAttr( RES_CNTNT )).SetNewCntntIdx( 0 );
+ DeleteSection( pNode );
+ }
+
+ // ggfs. bei Zeichengebundenen Flys das Zeichen loeschen
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+ if ((FLY_AS_CHAR == rAnchor.GetAnchorId()) && rAnchor.GetCntntAnchor())
+ {
+ const SwPosition* pPos = rAnchor.GetCntntAnchor();
+ SwTxtNode *pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+
+ // attribute is still in text node, delete it
+ if ( pTxtNd )
+ {
+ SwTxtFlyCnt* const pAttr = static_cast<SwTxtFlyCnt*>(
+ pTxtNd->GetTxtAttrForCharAt( pPos->nContent.GetIndex(),
+ RES_TXTATR_FLYCNT ));
+ if ( pAttr && (pAttr->GetFlyCnt().GetFrmFmt() == pFmt) )
+ {
+ // dont delete, set pointer to 0
+ const_cast<SwFmtFlyCnt&>(pAttr->GetFlyCnt()).SetFlyFmt();
+ SwIndex aIdx( pPos->nContent );
+ pTxtNd->EraseText( aIdx, 1 );
+ }
+ }
+ }
+
+ DelFrmFmt( pFmt );
+ }
+ SetModified();
+}
+
+/*************************************************************************
+|*
+|* SwDoc::CopyLayoutFmt()
+|*
+|* Beschreibung Kopiert das angegebene Format pSrc in pDest und
+|* returnt pDest. Wenn es noch kein pDest gibt, wird
+|* eins angelegt.
+|* JP: steht das Source Format in einem anderen
+|* Dokument, so kopiere auch dann noch richtig !!
+|* Vom chaos::Anchor-Attribut wird die Position immer
+|* auf 0 gesetzt !!!
+|*
+|* Ersterstellung BP 18.12.92
+|* Letzte Aenderung MA 17. Jul. 96
+|*
+|*************************************************************************/
+
+SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource,
+ const SwFmtAnchor& rNewAnchor,
+ bool bSetTxtFlyAtt, bool bMakeFrms )
+{
+ const bool bFly = RES_FLYFRMFMT == rSource.Which();
+ const bool bDraw = RES_DRAWFRMFMT == rSource.Which();
+ ASSERT( bFly || bDraw, "this method only works for fly or draw" );
+
+ SwDoc* pSrcDoc = (SwDoc*)rSource.GetDoc();
+
+ // #108784# may we copy this object?
+ // We may, unless it's 1) it's a control (and therfore a draw)
+ // 2) anchored in a header/footer
+ // 3) anchored (to paragraph?)
+ bool bMayNotCopy = false;
+ if( bDraw )
+ {
+ const SwDrawContact* pDrawContact =
+ static_cast<const SwDrawContact*>( rSource.FindContactObj() );
+
+ bMayNotCopy =
+ ((FLY_AT_PARA == rNewAnchor.GetAnchorId()) ||
+ (FLY_AT_FLY == rNewAnchor.GetAnchorId()) ||
+ (FLY_AT_CHAR == rNewAnchor.GetAnchorId())) &&
+ rNewAnchor.GetCntntAnchor() &&
+ IsInHeaderFooter( rNewAnchor.GetCntntAnchor()->nNode ) &&
+ pDrawContact != NULL &&
+ pDrawContact->GetMaster() != NULL &&
+ CheckControlLayer( pDrawContact->GetMaster() );
+ }
+
+ // just return if we can't copy this
+ if( bMayNotCopy )
+ return NULL;
+
+ SwFrmFmt* pDest = GetDfltFrmFmt();
+ if( rSource.GetRegisteredIn() != pSrcDoc->GetDfltFrmFmt() )
+ pDest = CopyFrmFmt( *(SwFrmFmt*)rSource.GetRegisteredIn() );
+ if( bFly )
+ {
+ // #i11176#
+ // To do a correct cloning concerning the ZOrder for all objects
+ // it is necessary to actually create a draw object for fly frames, too.
+ // These are then added to the DrawingLayer (which needs to exist).
+ // Together with correct sorting of all drawinglayer based objects
+ // before cloning ZOrder transfer works correctly then.
+ SwFlyFrmFmt *pFormat = MakeFlyFrmFmt( rSource.GetName(), pDest );
+ pDest = pFormat;
+
+ SwXFrame::GetOrCreateSdrObject(pFormat);
+ }
+ else
+ pDest = MakeDrawFrmFmt( aEmptyStr, pDest );
+
+ // alle anderen/neue Attribute kopieren.
+ pDest->CopyAttrs( rSource );
+
+ //Chains werden nicht kopiert.
+ pDest->ResetFmtAttr( RES_CHAIN );
+
+ if( bFly )
+ {
+ //Der Inhalt wird dupliziert.
+ const SwNode& rCSttNd = rSource.GetCntnt().GetCntntIdx()->GetNode();
+ SwNodeRange aRg( rCSttNd, 1, *rCSttNd.EndOfSectionNode() );
+
+ SwNodeIndex aIdx( GetNodes().GetEndOfAutotext() );
+ SwStartNode* pSttNd = GetNodes().MakeEmptySection( aIdx, SwFlyStartNode );
+
+ // erst den chaos::Anchor/CntntIndex setzen, innerhalb des Kopierens
+ // auf die Werte zugegriffen werden kann (DrawFmt in Kopf-/Fusszeilen)
+ aIdx = *pSttNd;
+ SwFmtCntnt aAttr( rSource.GetCntnt() );
+ aAttr.SetNewCntntIdx( &aIdx );
+ pDest->SetFmtAttr( aAttr );
+ pDest->SetFmtAttr( rNewAnchor );
+
+ if( !mbCopyIsMove || this != pSrcDoc )
+ {
+ if( mbInReading )
+ pDest->SetName( aEmptyStr );
+ else
+ {
+ // Teste erstmal ob der Name schon vergeben ist.
+ // Wenn ja -> neuen generieren
+ sal_Int8 nNdTyp = aRg.aStart.GetNode().GetNodeType();
+
+ String sOld( pDest->GetName() );
+ pDest->SetName( aEmptyStr );
+ if( FindFlyByName( sOld, nNdTyp ) ) // einen gefunden
+ switch( nNdTyp )
+ {
+ case ND_GRFNODE: sOld = GetUniqueGrfName(); break;
+ case ND_OLENODE: sOld = GetUniqueOLEName(); break;
+ default: sOld = GetUniqueFrameName(); break;
+ }
+
+ pDest->SetName( sOld );
+ }
+ }
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0));
+ }
+
+ // sorge dafuer das auch Fly's in Fly's kopiert werden
+ aIdx = *pSttNd->EndOfSectionNode();
+ pSrcDoc->CopyWithFlyInFly( aRg, 0, aIdx, sal_False, sal_True, sal_True );
+ }
+ else
+ {
+ ASSERT( RES_DRAWFRMFMT == rSource.Which(), "Weder Fly noch Draw." );
+ // OD 2005-08-02 #i52780# - Note: moving object to visible layer not needed.
+ SwDrawContact* pSourceContact = (SwDrawContact *)rSource.FindContactObj();
+
+ SwDrawContact* pContact = new SwDrawContact( (SwDrawFrmFmt*)pDest,
+ CloneSdrObj( *pSourceContact->GetMaster(),
+ mbCopyIsMove && this == pSrcDoc ) );
+ // --> OD 2005-05-23 #i49730# - notify draw frame format
+ // that position attributes are already set, if the position attributes
+ // are already set at the source draw frame format.
+ if ( pDest->ISA(SwDrawFrmFmt) &&
+ rSource.ISA(SwDrawFrmFmt) &&
+ static_cast<const SwDrawFrmFmt&>(rSource).IsPosAttrSet() )
+ {
+ static_cast<SwDrawFrmFmt*>(pDest)->PosAttrSet();
+ }
+ // <--
+
+ if( pDest->GetAnchor() == rNewAnchor )
+ {
+ // OD 03.07.2003 #108784# - do *not* connect to layout, if
+ // a <MakeFrms> will not be called.
+ if ( bMakeFrms )
+ {
+ pContact->ConnectToLayout( &rNewAnchor );
+ }
+ }
+ else
+ pDest->SetFmtAttr( rNewAnchor );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0));
+ }
+ }
+
+ if (bSetTxtFlyAtt && (FLY_AS_CHAR == rNewAnchor.GetAnchorId()))
+ {
+ const SwPosition* pPos = rNewAnchor.GetCntntAnchor();
+ SwFmtFlyCnt aFmt( pDest );
+ pPos->nNode.GetNode().GetTxtNode()->InsertItem(
+ aFmt, pPos->nContent.GetIndex(), 0 );
+ }
+
+ if( bMakeFrms )
+ pDest->MakeFrms();
+
+ return pDest;
+}
+
+SdrObject* SwDoc::CloneSdrObj( const SdrObject& rObj, sal_Bool bMoveWithinDoc,
+ sal_Bool bInsInPage )
+{
+ // --> OD 2005-08-08 #i52858# - method name changed
+ SdrPage *pPg = GetOrCreateDrawModel()->GetPage( 0 );
+ // <--
+ if( !pPg )
+ {
+ pPg = GetDrawModel()->AllocPage( sal_False );
+ GetDrawModel()->InsertPage( pPg );
+ }
+
+ SdrObject *pObj = rObj.Clone();
+ if( bMoveWithinDoc && FmFormInventor == pObj->GetObjInventor() )
+ {
+ // bei Controls muss der Name erhalten bleiben
+ uno::Reference< awt::XControlModel > xModel = ((SdrUnoObj*)pObj)->GetUnoControlModel();
+ uno::Any aVal;
+ uno::Reference< beans::XPropertySet > xSet(xModel, uno::UNO_QUERY);
+ OUString sName( rtl::OUString::createFromAscii("Name") );
+ if( xSet.is() )
+ aVal = xSet->getPropertyValue( sName );
+ if( bInsInPage )
+ pPg->InsertObject( pObj );
+ if( xSet.is() )
+ xSet->setPropertyValue( sName, aVal );
+ }
+ else if( bInsInPage )
+ pPg->InsertObject( pObj );
+
+ // OD 02.07.2003 #108784# - for drawing objects: set layer of cloned object
+ // to invisible layer
+ SdrLayerID nLayerIdForClone = rObj.GetLayer();
+ if ( !pObj->ISA(SwFlyDrawObj) &&
+ !pObj->ISA(SwVirtFlyDrawObj) &&
+ !IS_TYPE(SdrObject,pObj) )
+ {
+ if ( IsVisibleLayerId( nLayerIdForClone ) )
+ {
+ nLayerIdForClone = GetInvisibleLayerIdByVisibleOne( nLayerIdForClone );
+ }
+ }
+ pObj->SetLayer( nLayerIdForClone );
+
+
+ return pObj;
+}
+
+SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos,
+ const SwCntntNode& rNode,
+ RndStdIds eRequestId,
+ const SfxItemSet* pFlySet,
+ SwFrmFmt* pFrmFmt )
+{
+ if( !pFrmFmt )
+ pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_FRAME );
+
+ String sName;
+ if( !mbInReading )
+ switch( rNode.GetNodeType() )
+ {
+ case ND_GRFNODE: sName = GetUniqueGrfName(); break;
+ case ND_OLENODE: sName = GetUniqueOLEName(); break;
+ default: sName = GetUniqueFrameName(); break;
+ }
+ SwFlyFrmFmt* pFmt = MakeFlyFrmFmt( sName, pFrmFmt );
+
+ //Inhalt erzeugen und mit dem Format verbinden.
+ //CntntNode erzeugen und in die Autotextsection stellen
+ SwNodeRange aRange( GetNodes().GetEndOfAutotext(), -1,
+ GetNodes().GetEndOfAutotext() );
+ GetNodes().SectionDown( &aRange, SwFlyStartNode );
+
+ pFmt->SetFmtAttr( SwFmtCntnt( rNode.StartOfSectionNode() ));
+
+
+ const SwFmtAnchor* pAnchor = 0;
+ if( pFlySet )
+ {
+ pFlySet->GetItemState( RES_ANCHOR, sal_False,
+ (const SfxPoolItem**)&pAnchor );
+ if( SFX_ITEM_SET == pFlySet->GetItemState( RES_CNTNT, sal_False ))
+ {
+ SfxItemSet aTmpSet( *pFlySet );
+ aTmpSet.ClearItem( RES_CNTNT );
+ pFmt->SetFmtAttr( aTmpSet );
+ }
+ else
+ pFmt->SetFmtAttr( *pFlySet );
+ }
+
+ // Anker noch nicht gesetzt ?
+ RndStdIds eAnchorId = pAnchor ? pAnchor->GetAnchorId()
+ : pFmt->GetAnchor().GetAnchorId();
+ // --> OD 2010-01-07 #i107811#
+ // Assure that at-page anchored fly frames have a page num or a content anchor set.
+ if ( !pAnchor ||
+ ( FLY_AT_PAGE != pAnchor->GetAnchorId() &&
+ !pAnchor->GetCntntAnchor() ) ||
+ ( FLY_AT_PAGE == pAnchor->GetAnchorId() &&
+ !pAnchor->GetCntntAnchor() &&
+ pAnchor->GetPageNum() == 0 ) )
+ {
+ // dann setze ihn, wird im Undo gebraucht
+ SwFmtAnchor aAnch( pFmt->GetAnchor() );
+ if (pAnchor && (FLY_AT_FLY == pAnchor->GetAnchorId()))
+ {
+ SwPosition aPos( *rAnchPos.nNode.GetNode().FindFlyStartNode() );
+ aAnch.SetAnchor( &aPos );
+ eAnchorId = FLY_AT_FLY;
+ }
+ else
+ {
+ if( eRequestId != aAnch.GetAnchorId() &&
+ SFX_ITEM_SET != pFmt->GetItemState( RES_ANCHOR, sal_True ) )
+ {
+ aAnch.SetType( eRequestId );
+ }
+
+ eAnchorId = aAnch.GetAnchorId();
+ if ( FLY_AT_PAGE != eAnchorId ||
+ ( FLY_AT_PAGE == eAnchorId &&
+ ( !pAnchor ||
+ aAnch.GetPageNum() == 0 ) ) )
+ {
+ aAnch.SetAnchor( &rAnchPos );
+ }
+ }
+ // <--
+ pFmt->SetFmtAttr( aAnch );
+ }
+ else
+ eAnchorId = pFmt->GetAnchor().GetAnchorId();
+
+ if ( FLY_AS_CHAR == eAnchorId )
+ {
+ xub_StrLen nStt = rAnchPos.nContent.GetIndex();
+ SwTxtNode * pTxtNode = rAnchPos.nNode.GetNode().GetTxtNode();
+
+ ASSERT(pTxtNode!= 0, "There should be a SwTxtNode!");
+
+ if (pTxtNode != NULL)
+ {
+ SwFmtFlyCnt aFmt( pFmt );
+ pTxtNode->InsertItem( aFmt, nStt, nStt );
+ }
+ }
+
+ if( SFX_ITEM_SET != pFmt->GetAttrSet().GetItemState( RES_FRM_SIZE ))
+ {
+ SwFmtFrmSize aFmtSize( ATT_VAR_SIZE, 0, DEF_FLY_WIDTH );
+ const SwNoTxtNode* pNoTxtNode = rNode.GetNoTxtNode();
+ if( pNoTxtNode )
+ {
+ //Groesse einstellen.
+ Size aSize( pNoTxtNode->GetTwipSize() );
+ if( MINFLY > aSize.Width() )
+ aSize.Width() = DEF_FLY_WIDTH;
+ aFmtSize.SetWidth( aSize.Width() );
+ if( aSize.Height() )
+ {
+ aFmtSize.SetHeight( aSize.Height() );
+ aFmtSize.SetHeightSizeType( ATT_FIX_SIZE );
+ }
+ }
+ pFmt->SetFmtAttr( aFmtSize );
+ }
+
+ // Frames anlegen
+ if( GetCurrentViewShell() )
+ pFmt->MakeFrms(); // ??? //swmod 071108//swmod 071225
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ sal_uLong nNodeIdx = rAnchPos.nNode.GetIndex();
+ xub_StrLen nCntIdx = rAnchPos.nContent.GetIndex();
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoInsLayFmt( pFmt, nNodeIdx, nCntIdx ));
+ }
+
+ SetModified();
+ return pFmt;
+}
+
+SwFlyFrmFmt* SwDoc::MakeFlySection( RndStdIds eAnchorType,
+ const SwPosition* pAnchorPos,
+ const SfxItemSet* pFlySet,
+ SwFrmFmt* pFrmFmt, sal_Bool bCalledFromShell )
+{
+ SwFlyFrmFmt* pFmt = 0;
+ sal_Bool bCallMake = sal_True;
+ if ( !pAnchorPos && (FLY_AT_PAGE != eAnchorType) )
+ {
+ const SwFmtAnchor* pAnch;
+ if( (pFlySet && SFX_ITEM_SET == pFlySet->GetItemState(
+ RES_ANCHOR, sal_False, (const SfxPoolItem**)&pAnch )) ||
+ ( pFrmFmt && SFX_ITEM_SET == pFrmFmt->GetItemState(
+ RES_ANCHOR, sal_True, (const SfxPoolItem**)&pAnch )) )
+ {
+ if ( (FLY_AT_PAGE != pAnch->GetAnchorId()) )
+ {
+ pAnchorPos = pAnch->GetCntntAnchor();
+ if (pAnchorPos)
+ {
+ bCallMake = sal_False;
+ }
+ }
+ }
+ }
+
+ if( bCallMake )
+ {
+ if( !pFrmFmt )
+ pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_FRAME );
+
+ sal_uInt16 nCollId = static_cast<sal_uInt16>(
+ get(IDocumentSettingAccess::HTML_MODE) ? RES_POOLCOLL_TEXT : RES_POOLCOLL_FRAME );
+
+ /* #109161# If there exists no adjust item in the paragraph
+ style for the content node of the new fly section
+ propagate an existing adjust item at the anchor to the new
+ content node. */
+ SwCntntNode * pNewTxtNd = GetNodes().MakeTxtNode
+ (SwNodeIndex( GetNodes().GetEndOfAutotext()),
+ GetTxtCollFromPool( nCollId ));
+ SwCntntNode * pAnchorNode = pAnchorPos->nNode.GetNode().GetCntntNode();
+
+ const SfxPoolItem * pItem = NULL;
+
+ if (bCalledFromShell && !lcl_IsItemSet(*pNewTxtNd, RES_PARATR_ADJUST) &&
+ SFX_ITEM_SET == pAnchorNode->GetSwAttrSet().
+ GetItemState(RES_PARATR_ADJUST, sal_True, &pItem))
+ static_cast<SwCntntNode *>(pNewTxtNd)->SetAttr(*pItem);
+
+ pFmt = _MakeFlySection( *pAnchorPos, *pNewTxtNd,
+ eAnchorType, pFlySet, pFrmFmt );
+ }
+ return pFmt;
+}
+
+SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
+ const SwSelBoxes* pSelBoxes,
+ SwFrmFmt *pParent )
+{
+ SwFmtAnchor& rAnch = (SwFmtAnchor&)rSet.Get( RES_ANCHOR );
+
+ GetIDocumentUndoRedo().StartUndo( UNDO_INSLAYFMT, NULL );
+
+ SwFlyFrmFmt* pFmt = MakeFlySection( rAnch.GetAnchorId(), rPam.GetPoint(),
+ &rSet, pParent );
+
+ // Wenn Inhalt selektiert ist, so wird dieser jetzt zum Inhalt des
+ // neuen Rahmen. Sprich er wird in die entspr. Sektion des NodesArr
+ //gemoved.
+
+ if( pFmt )
+ {
+ do { // middle check loop
+ const SwFmtCntnt &rCntnt = pFmt->GetCntnt();
+ ASSERT( rCntnt.GetCntntIdx(), "Kein Inhalt vorbereitet." );
+ SwNodeIndex aIndex( *(rCntnt.GetCntntIdx()), 1 );
+ SwCntntNode *pNode = aIndex.GetNode().GetCntntNode();
+
+ // ACHTUNG: nicht einen Index auf dem Stack erzeugen, sonst
+ // kann der CntntnNode am Ende nicht geloscht werden !!
+ SwPosition aPos( aIndex );
+ aPos.nContent.Assign( pNode, 0 );
+
+ if( pSelBoxes && pSelBoxes->Count() )
+ {
+ // Tabellenselection
+ // kopiere Teile aus einer Tabelle: lege eine Tabelle mit der
+ // Breite der Originalen an und move (kopiere/loesche) die
+ // selektierten Boxen. Die Groessen werden prozentual
+ // korrigiert.
+
+ SwTableNode* pTblNd = (SwTableNode*)(*pSelBoxes)[0]->
+ GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ break;
+
+ SwTable& rTbl = pTblNd->GetTable();
+
+ // ist die gesamte Tabelle selektiert ?
+ if( pSelBoxes->Count() == rTbl.GetTabSortBoxes().Count() )
+ {
+ // verschiebe die gesamte Tabelle
+ SwNodeRange aRg( *pTblNd, 0, *pTblNd->EndOfSectionNode(), 1 );
+
+ // wird die gesamte Tabelle verschoben und steht diese
+ // in einem FlyFrame, dann erzeuge dahinter einen neuen
+ // TextNode. Dadurch bleibt dieser Fly erhalten !
+ if( aRg.aEnd.GetNode().IsEndNode() )
+ GetNodes().MakeTxtNode( aRg.aStart,
+ (SwTxtFmtColl*)GetDfltTxtFmtColl() );
+
+ MoveNodeRange( aRg, aPos.nNode, DOC_MOVEDEFAULT );
+ }
+ else
+ {
+ rTbl.MakeCopy( this, aPos, *pSelBoxes );
+ // Don't delete a part of a table with row span!!
+ // You could delete the content instead -> ToDo
+ //rTbl.DeleteSel( this, *pSelBoxes, 0, 0, sal_True, sal_True );
+ }
+
+ // wenn Tabelle im Rahmen, dann ohne nachfolgenden TextNode
+ aIndex = rCntnt.GetCntntIdx()->GetNode().EndOfSectionIndex() - 1;
+ ASSERT( aIndex.GetNode().GetTxtNode(),
+ "hier sollte ein TextNode stehen" );
+ aPos.nContent.Assign( 0, 0 ); // Index abmelden !!
+ GetNodes().Delete( aIndex, 1 );
+
+//JP erstmal ein Hack, solange keine Flys/Headers/Footers Undofaehig sind
+// werden erstmal alle Undo - Objecte geloescht.
+if( GetIDocumentUndoRedo().DoesUndo() )
+{
+ GetIDocumentUndoRedo().DelAllUndoObj();
+}
+
+ }
+ else
+ {
+/*
+ // alle Pams verschieben
+ SwPaM* pTmp = (SwPaM*)&rPam;
+ do {
+ if( pTmp->HasMark() &&
+ *pTmp->GetPoint() != *pTmp->GetMark() )
+ MoveAndJoin( *pTmp, aPos );
+ } while( &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() ) );
+*/
+ // copy all Pams and then delete all
+ SwPaM* pTmp = (SwPaM*)&rPam;
+ sal_Bool bOldFlag = mbCopyIsMove;
+ bool const bOldUndo = GetIDocumentUndoRedo().DoesUndo();
+ mbCopyIsMove = sal_True;
+ GetIDocumentUndoRedo().DoUndo(false);
+ do {
+ if( pTmp->HasMark() &&
+ *pTmp->GetPoint() != *pTmp->GetMark() )
+ {
+ CopyRange( *pTmp, aPos, false );
+ }
+ pTmp = static_cast<SwPaM*>(pTmp->GetNext());
+ } while ( &rPam != pTmp );
+ mbCopyIsMove = bOldFlag;
+ GetIDocumentUndoRedo().DoUndo(bOldUndo);
+
+ pTmp = (SwPaM*)&rPam;
+ do {
+ if( pTmp->HasMark() &&
+ *pTmp->GetPoint() != *pTmp->GetMark() )
+ {
+ DeleteAndJoin( *pTmp );
+ }
+ pTmp = static_cast<SwPaM*>(pTmp->GetNext());
+ } while ( &rPam != pTmp );
+ }
+ } while( sal_False );
+ }
+
+ SetModified();
+
+ GetIDocumentUndoRedo().EndUndo( UNDO_INSLAYFMT, NULL );
+
+ return pFmt;
+}
+
+
+ //Einfuegen eines DrawObjectes. Das Object muss bereits im DrawModel
+ // angemeldet sein.
+SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
+ SdrObject& rDrawObj,
+ const SfxItemSet* pFlyAttrSet,
+ SwFrmFmt* pDefFmt )
+{
+ SwDrawFrmFmt *pFmt = MakeDrawFrmFmt( aEmptyStr,
+ pDefFmt ? pDefFmt : GetDfltFrmFmt() );
+
+ const SwFmtAnchor* pAnchor = 0;
+ if( pFlyAttrSet )
+ {
+ pFlyAttrSet->GetItemState( RES_ANCHOR, sal_False,
+ (const SfxPoolItem**)&pAnchor );
+ pFmt->SetFmtAttr( *pFlyAttrSet );
+ }
+
+ RndStdIds eAnchorId = pAnchor ? pAnchor->GetAnchorId()
+ : pFmt->GetAnchor().GetAnchorId();
+
+ // Anker noch nicht gesetzt ?
+ // DrawObjecte duerfen niemals in Kopf-/Fusszeilen landen.
+ const bool bIsAtCntnt = (FLY_AT_PAGE != eAnchorId);
+
+ const SwNodeIndex* pChkIdx = 0;
+ if( !pAnchor )
+ {
+ pChkIdx = &rRg.GetPoint()->nNode;
+ }
+ else if( bIsAtCntnt )
+ {
+ pChkIdx = pAnchor->GetCntntAnchor()
+ ? &pAnchor->GetCntntAnchor()->nNode
+ : &rRg.GetPoint()->nNode;
+ }
+
+ // OD 24.06.2003 #108784# - allow drawing objects in header/footer, but
+ // control objects aren't allowed in header/footer.
+ if( pChkIdx &&
+ ::CheckControlLayer( &rDrawObj ) &&
+ IsInHeaderFooter( *pChkIdx ) )
+ {
+ pFmt->SetFmtAttr( SwFmtAnchor( eAnchorId = FLY_AT_PAGE ) );
+ }
+ else if( !pAnchor || (bIsAtCntnt && !pAnchor->GetCntntAnchor() ))
+ {
+ // dann setze ihn, wird im Undo gebraucht
+ SwFmtAnchor aAnch( pAnchor ? *pAnchor : pFmt->GetAnchor() );
+ eAnchorId = aAnch.GetAnchorId();
+ if( FLY_AT_FLY == eAnchorId )
+ {
+ SwPosition aPos( *rRg.GetNode()->FindFlyStartNode() );
+ aAnch.SetAnchor( &aPos );
+ }
+ else
+ {
+ aAnch.SetAnchor( rRg.GetPoint() );
+ if ( FLY_AT_PAGE == eAnchorId )
+ {
+ eAnchorId = rDrawObj.ISA( SdrUnoObj )
+ ? FLY_AS_CHAR : FLY_AT_PARA;
+ aAnch.SetType( eAnchorId );
+ }
+ }
+ pFmt->SetFmtAttr( aAnch );
+ }
+
+ // bei als Zeichen gebundenen Draws das Attribut im Absatz setzen
+ if ( FLY_AS_CHAR == eAnchorId )
+ {
+ xub_StrLen nStt = rRg.GetPoint()->nContent.GetIndex();
+ SwFmtFlyCnt aFmt( pFmt );
+ rRg.GetPoint()->nNode.GetNode().GetTxtNode()->InsertItem(
+ aFmt, nStt, nStt );
+ }
+
+ SwDrawContact* pContact = new SwDrawContact( pFmt, &rDrawObj );
+
+ // ggfs. Frames anlegen
+ if( GetCurrentViewShell() )
+ {
+ pFmt->MakeFrms();
+ // --> OD 2005-02-09 #i42319# - follow-up of #i35635#
+ // move object to visible layer
+ // --> OD 2007-07-10 #i79391#
+ if ( pContact->GetAnchorFrm() )
+ {
+ pContact->MoveObjToVisibleLayer( &rDrawObj );
+ }
+ // <--
+ }
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoInsLayFmt(pFmt, 0, 0) );
+ }
+
+ SetModified();
+ return pFmt;
+}
+
+/*************************************************************************
+|*
+|* SwDoc::GetAllFlyFmts
+|*
+|* Ersterstellung MA 14. Jul. 93
+|* Letzte Aenderung MD 23. Feb. 95
+|*
+|*************************************************************************/
+
+/*sal_Bool TstFlyRange( const SwPaM* pPam, sal_uInt32 nFlyPos )
+{
+ sal_Bool bOk = sal_False;
+ const SwPaM* pTmp = pPam;
+ do {
+ bOk = pTmp->Start()->nNode.GetIndex() < nFlyPos &&
+ pTmp->End()->nNode.GetIndex() > nFlyPos;
+ } while( !bOk && pPam != ( pTmp = (const SwPaM*)pTmp->GetNext() ));
+ return bOk;
+}
+*/
+/* -----------------------------04.04.00 10:55--------------------------------
+ paragraph frames - o.k. if the PaM includes the paragraph from the beginning
+ to the beginning of the next paragraph at least
+ frames at character - o.k. if the pam start at least at the same position
+ as the frame
+ ---------------------------------------------------------------------------*/
+sal_Bool TstFlyRange( const SwPaM* pPam, const SwPosition* pFlyPos,
+ RndStdIds nAnchorId )
+{
+ sal_Bool bOk = sal_False;
+ const SwPaM* pTmp = pPam;
+ do {
+ const sal_uInt32 nFlyIndex = pFlyPos->nNode.GetIndex();
+ const SwPosition* pPaMStart = pTmp->Start();
+ const SwPosition* pPaMEnd = pTmp->End();
+ const sal_uInt32 nPamStartIndex = pPaMStart->nNode.GetIndex();
+ const sal_uInt32 nPamEndIndex = pPaMEnd->nNode.GetIndex();
+ if (FLY_AT_PARA == nAnchorId)
+ bOk = (nPamStartIndex < nFlyIndex && nPamEndIndex > nFlyIndex) ||
+ (((nPamStartIndex == nFlyIndex) && (pPaMStart->nContent.GetIndex() == 0)) &&
+ (nPamEndIndex > nFlyIndex));
+ else
+ {
+ xub_StrLen nFlyContentIndex = pFlyPos->nContent.GetIndex();
+ xub_StrLen nPamEndContentIndex = pPaMEnd->nContent.GetIndex();
+ bOk = (nPamStartIndex < nFlyIndex &&
+ (( nPamEndIndex > nFlyIndex )||
+ ((nPamEndIndex == nFlyIndex) &&
+ (nPamEndContentIndex > nFlyContentIndex))) )
+ ||
+ (((nPamStartIndex == nFlyIndex) &&
+ (pPaMStart->nContent.GetIndex() <= nFlyContentIndex)) &&
+ ((nPamEndIndex > nFlyIndex) ||
+ (nPamEndContentIndex > nFlyContentIndex )));
+ }
+
+ } while( !bOk && pPam != ( pTmp = (const SwPaM*)pTmp->GetNext() ));
+ return bOk;
+}
+
+
+void SwDoc::GetAllFlyFmts( SwPosFlyFrms& rPosFlyFmts,
+ const SwPaM* pCmpRange, sal_Bool bDrawAlso ) const
+{
+ SwPosFlyFrm *pFPos = 0;
+ SwFrmFmt *pFly;
+
+ // erstmal alle Absatzgebundenen einsammeln
+ for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+ {
+ pFly = (*GetSpzFrmFmts())[ n ];
+ bool bDrawFmt = bDrawAlso ? RES_DRAWFRMFMT == pFly->Which() : false;
+ bool bFlyFmt = RES_FLYFRMFMT == pFly->Which();
+ if( bFlyFmt || bDrawFmt )
+ {
+ const SwFmtAnchor& rAnchor = pFly->GetAnchor();
+ SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
+ if (pAPos &&
+ ((FLY_AT_PARA == rAnchor.GetAnchorId()) ||
+ (FLY_AT_FLY == rAnchor.GetAnchorId()) ||
+ (FLY_AT_CHAR == rAnchor.GetAnchorId())))
+ {
+ if( pCmpRange &&
+ !TstFlyRange( pCmpRange, pAPos, rAnchor.GetAnchorId() ))
+ continue; // kein gueltiger FlyFrame
+ pFPos = new SwPosFlyFrm( pAPos->nNode, pFly, rPosFlyFmts.Count() );
+ rPosFlyFmts.Insert( pFPos );
+ }
+ }
+ }
+
+ // kein Layout oder nur ein Teil, dann wars das
+ // Seitenbezogen Flys nur, wenn vollstaendig "gewuenscht" wird !
+ if( !GetCurrentViewShell() || pCmpRange ) //swmod 071108//swmod 071225
+ return;
+
+ pFPos = 0;
+ SwPageFrm *pPage = (SwPageFrm*)GetCurrentLayout()->GetLower(); //swmod 080218
+ while( pPage )
+ {
+ if( pPage->GetSortedObjs() )
+ {
+ SwSortedObjs &rObjs = *pPage->GetSortedObjs();
+ for( sal_uInt16 i = 0; i < rObjs.Count(); ++i)
+ {
+ SwAnchoredObject* pAnchoredObj = rObjs[i];
+ if ( pAnchoredObj->ISA(SwFlyFrm) )
+ pFly = &(pAnchoredObj->GetFrmFmt());
+ else if ( bDrawAlso )
+ pFly = &(pAnchoredObj->GetFrmFmt());
+ else
+ continue;
+
+ const SwFmtAnchor& rAnchor = pFly->GetAnchor();
+ if ((FLY_AT_PARA != rAnchor.GetAnchorId()) &&
+ (FLY_AT_FLY != rAnchor.GetAnchorId()) &&
+ (FLY_AT_CHAR != rAnchor.GetAnchorId()))
+ {
+ const SwCntntFrm * pCntntFrm = pPage->FindFirstBodyCntnt();
+ if ( !pCntntFrm )
+ {
+ //Oops! Eine leere Seite. Damit der Rahmen nicht ganz
+ //verlorengeht (RTF) suchen wir schnell den letzen
+ //Cntnt der vor der Seite steht.
+ SwPageFrm *pPrv = (SwPageFrm*)pPage->GetPrev();
+ while ( !pCntntFrm && pPrv )
+ {
+ pCntntFrm = pPrv->FindFirstBodyCntnt();
+ pPrv = (SwPageFrm*)pPrv->GetPrev();
+ }
+ }
+ if ( pCntntFrm )
+ {
+ SwNodeIndex aIdx( *pCntntFrm->GetNode() );
+ pFPos = new SwPosFlyFrm( aIdx, pFly, rPosFlyFmts.Count() );
+ }
+ }
+ if ( pFPos )
+ {
+ rPosFlyFmts.Insert( pFPos );
+ pFPos = 0;
+ }
+ }
+ }
+ pPage = (SwPageFrm*)pPage->GetNext();
+ }
+}
+
+/*************************************************************************
+|*
+|* SwDoc::InsertLabel()
+|*
+|* Ersterstellung MA 11. Feb. 94
+|* Letzte Aenderung MA 12. Nov. 97
+|*
+|*************************************************************************/
+
+/* #i6447# changed behaviour if lcl_CpyAttr:
+
+ If the old item set contains the item to set (no inheritance) copy the item
+ into the new set.
+
+ If the old item set contains the item by inheritance and the new set
+ contains the item, too:
+ If the two items differ copy the item from the old set to the new set.
+
+ Otherwise the new set will not be changed.
+*/
+
+void lcl_CpyAttr( SfxItemSet &rNewSet, const SfxItemSet &rOldSet, sal_uInt16 nWhich )
+{
+ const SfxPoolItem *pOldItem = NULL, *pNewItem = NULL;
+
+ rOldSet.GetItemState( nWhich, sal_False, &pOldItem);
+ if (pOldItem != NULL)
+ rNewSet.Put( *pOldItem );
+ else
+ {
+ pOldItem = rOldSet.GetItem( nWhich, sal_True);
+ if (pOldItem != NULL)
+ {
+ pNewItem = rNewSet.GetItem( nWhich, sal_True);
+ if (pNewItem != NULL)
+ {
+ if (*pOldItem != *pNewItem)
+ rNewSet.Put( *pOldItem );
+ }
+ else {
+ ASSERT(0, "What am I doing here?");
+ }
+ }
+ else {
+ ASSERT(0, "What am I doing here?");
+ }
+ }
+
+}
+
+
+static SwFlyFrmFmt *
+lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
+ SwUndoInsertLabel *const pUndo,
+ SwLabelType const eType, String const& rTxt, String const& rSeparator,
+ const String& rNumberingSeparator,
+ const sal_Bool bBefore, const sal_uInt16 nId, const sal_uLong nNdIdx,
+ const String& rCharacterStyle,
+ const sal_Bool bCpyBrd )
+{
+ ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
+
+ sal_Bool bTable = sal_False; //Um etwas Code zu sparen.
+
+ //Erstmal das Feld bauen, weil ueber den Namen die TxtColl besorgt werden
+ //muss
+ OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.GetFldTypes()->Count(),
+ "FldType index out of bounds." );
+ SwFieldType *pType = (nId != USHRT_MAX) ? (*rDoc.GetFldTypes())[nId] : NULL;
+ OSL_ENSURE(!pType || pType->Which() == RES_SETEXPFLD, "wrong Id for Label");
+
+ SwTxtFmtColl * pColl = NULL;
+ if( pType )
+ {
+ for( sal_uInt16 i = pTxtFmtCollTbl->Count(); i; )
+ {
+ if( (*pTxtFmtCollTbl)[ --i ]->GetName() == pType->GetName() )
+ {
+ pColl = (*pTxtFmtCollTbl)[i];
+ break;
+ }
+ }
+ DBG_ASSERT( pColl, "no text collection found" );
+ }
+
+ if( !pColl )
+ {
+ pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_LABEL );
+ }
+
+ SwTxtNode *pNew = NULL;
+ SwFlyFrmFmt* pNewFmt = NULL;
+
+ switch ( eType )
+ {
+ case LTYPE_TABLE:
+ bTable = sal_True;
+ /* Kein Break hier */
+ case LTYPE_FLY:
+ //Am Anfang/Ende der Fly-Section den entsprechenden Node mit Feld
+ //einfuegen (Frame wird automatisch erzeugt).
+ {
+ SwStartNode *pSttNd = rDoc.GetNodes()[nNdIdx]->GetStartNode();
+ ASSERT( pSttNd, "Kein StartNode in InsertLabel." );
+ sal_uLong nNode;
+ if( bBefore )
+ {
+ nNode = pSttNd->GetIndex();
+ if( !bTable )
+ ++nNode;
+ }
+ else
+ {
+ nNode = pSttNd->EndOfSectionIndex();
+ if( bTable )
+ ++nNode;
+ }
+
+ if( pUndo )
+ pUndo->SetNodePos( nNode );
+
+ //Node fuer Beschriftungsabsatz erzeugen.
+ SwNodeIndex aIdx( rDoc.GetNodes(), nNode );
+ pNew = rDoc.GetNodes().MakeTxtNode( aIdx, pColl );
+ }
+ break;
+
+ case LTYPE_OBJECT:
+ {
+ //Rahmen zerstoeren, neuen Rahmen einfuegen, entsprechenden
+ // Node mit Feld in den neuen Rahmen, den alten Rahmen mit
+ // dem Object (Grafik/Ole) absatzgebunden in den neuen Rahmen,
+ // Frames erzeugen.
+
+ //Erstmal das Format zum Fly besorgen und das Layout entkoppeln.
+ SwFrmFmt *pOldFmt = rDoc.GetNodes()[nNdIdx]->GetFlyFmt();
+ ASSERT( pOldFmt, "Format des Fly nicht gefunden." );
+ // --> OD #i115719#
+ // <title> and <description> attributes are lost when calling <DelFrms()>.
+ // Thus, keep them and restore them after the calling <MakeFrms()>
+ const bool bIsSwFlyFrmFmtInstance( dynamic_cast<SwFlyFrmFmt*>(pOldFmt) != 0 );
+ const String sTitle( bIsSwFlyFrmFmtInstance
+ ? static_cast<SwFlyFrmFmt*>(pOldFmt)->GetObjTitle()
+ : String() );
+ const String sDescription( bIsSwFlyFrmFmtInstance
+ ? static_cast<SwFlyFrmFmt*>(pOldFmt)->GetObjDescription()
+ : String() );
+ // <--
+ pOldFmt->DelFrms();
+
+ pNewFmt = rDoc.MakeFlyFrmFmt( rDoc.GetUniqueFrameName(),
+ rDoc.GetFrmFmtFromPool(RES_POOLFRM_FRAME) );
+
+ /* #i6447#: Only the selected items are copied from the old
+ format. */
+ SfxItemSet* pNewSet = pNewFmt->GetAttrSet().Clone( sal_True );
+
+
+ //Diejenigen Attribute uebertragen die auch gesetzt sind,
+ //andere sollen weiterhin aus den Vorlagen gueltig werden.
+ lcl_CpyAttr( *pNewSet, pOldFmt->GetAttrSet(), RES_PRINT );
+ lcl_CpyAttr( *pNewSet, pOldFmt->GetAttrSet(), RES_OPAQUE );
+ lcl_CpyAttr( *pNewSet, pOldFmt->GetAttrSet(), RES_PROTECT );
+ lcl_CpyAttr( *pNewSet, pOldFmt->GetAttrSet(), RES_SURROUND );
+ lcl_CpyAttr( *pNewSet, pOldFmt->GetAttrSet(), RES_VERT_ORIENT );
+ lcl_CpyAttr( *pNewSet, pOldFmt->GetAttrSet(), RES_HORI_ORIENT );
+ lcl_CpyAttr( *pNewSet, pOldFmt->GetAttrSet(), RES_LR_SPACE );
+ lcl_CpyAttr( *pNewSet, pOldFmt->GetAttrSet(), RES_UL_SPACE );
+ lcl_CpyAttr( *pNewSet, pOldFmt->GetAttrSet(), RES_BACKGROUND );
+ if( bCpyBrd )
+ {
+ // JP 07.07.99: Bug 67029 - if at Grafik no BoxItem but
+ // in the new Format is any, then set the
+ // default item in the new Set. Because
+ // the Size of the Grafik have never been
+ // changed!
+ const SfxPoolItem *pItem;
+ if( SFX_ITEM_SET == pOldFmt->GetAttrSet().
+ GetItemState( RES_BOX, sal_True, &pItem ))
+ pNewSet->Put( *pItem );
+ else if( SFX_ITEM_SET == pNewFmt->GetAttrSet().
+ GetItemState( RES_BOX, sal_True ))
+ pNewSet->Put( *GetDfltAttr( RES_BOX ) );
+
+ if( SFX_ITEM_SET == pOldFmt->GetAttrSet().
+ GetItemState( RES_SHADOW, sal_True, &pItem ))
+ pNewSet->Put( *pItem );
+ else if( SFX_ITEM_SET == pNewFmt->GetAttrSet().
+ GetItemState( RES_SHADOW, sal_True ))
+ pNewSet->Put( *GetDfltAttr( RES_SHADOW ) );
+ }
+ else
+ {
+ //Die Attribute hart setzen, weil sie sonst aus der
+ // Vorlage kommen koenten und dann passt die
+ // Grossenberechnung nicht mehr.
+ pNewSet->Put( SvxBoxItem(RES_BOX) );
+ pNewSet->Put( SvxShadowItem(RES_SHADOW) );
+
+ }
+
+ //Anker immer uebertragen, ist sowieso ein hartes Attribut.
+ pNewSet->Put( pOldFmt->GetAnchor() );
+
+ //In der Hoehe soll der neue Varabel sein!
+ SwFmtFrmSize aFrmSize( pOldFmt->GetFrmSize() );
+ aFrmSize.SetHeightSizeType( ATT_MIN_SIZE );
+ pNewSet->Put( aFrmSize );
+
+ SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection(
+ SwNodeIndex( rDoc.GetNodes().GetEndOfAutotext() ),
+ SwFlyStartNode, pColl );
+ pNewSet->Put( SwFmtCntnt( pSttNd ));
+
+ pNewFmt->SetFmtAttr( *pNewSet );
+
+ //Bei InCntnt's wird es spannend: Das TxtAttribut muss
+ //vernichtet werden. Leider reisst dies neben den Frms auch
+ //noch das Format mit in sein Grab. Um dass zu unterbinden
+ //loesen wir vorher die Verbindung zwischen Attribut und Format.
+
+ const SwFmtAnchor& rAnchor = pNewFmt->GetAnchor();
+ if ( FLY_AS_CHAR == rAnchor.GetAnchorId() )
+ {
+ const SwPosition *pPos = rAnchor.GetCntntAnchor();
+ SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
+ ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
+ const xub_StrLen nIdx = pPos->nContent.GetIndex();
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt(nIdx, RES_TXTATR_FLYCNT);
+
+ ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
+ "Missing FlyInCnt-Hint." );
+ ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pOldFmt,
+ "Wrong TxtFlyCnt-Hint." );
+
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt(
+ pNewFmt );
+ }
+
+
+ //Der Alte soll keinen Umlauf haben, und er soll oben/mittig
+ //ausgerichtet sein.
+ //Ausserdem soll die Breite 100% betragen und bei Aenderungen
+ //Die Hoehe mit anpassen.
+ pNewSet->ClearItem();
+
+ pNewSet->Put( SwFmtSurround( SURROUND_NONE ) );
+ pNewSet->Put( SvxOpaqueItem( RES_OPAQUE, sal_True ) );
+ pNewSet->Put( SwFmtVertOrient( text::VertOrientation::TOP ) );
+ pNewSet->Put( SwFmtHoriOrient( text::HoriOrientation::CENTER ) );
+
+ aFrmSize = pOldFmt->GetFrmSize();
+ aFrmSize.SetWidthPercent( 100 );
+ aFrmSize.SetHeightPercent( 255 );
+ pNewSet->Put( aFrmSize );
+
+ //Die Attribute setzen wir hart, weil sie sonst aus der Vorlage
+ //kommen koenten und dann passt die Grossenberechnung nicht mehr.
+ if( bCpyBrd )
+ {
+ pNewSet->Put( SvxBoxItem(RES_BOX) );
+ pNewSet->Put( SvxShadowItem(RES_SHADOW) );
+ }
+ pNewSet->Put( SvxLRSpaceItem(RES_LR_SPACE) );
+ pNewSet->Put( SvxULSpaceItem(RES_UL_SPACE) );
+
+ //Der Alte ist absatzgebunden, und zwar am Absatz im neuen.
+ SwFmtAnchor aAnch( FLY_AT_PARA );
+ SwNodeIndex aAnchIdx( *pNewFmt->GetCntnt().GetCntntIdx(), 1 );
+ pNew = aAnchIdx.GetNode().GetTxtNode();
+ SwPosition aPos( aAnchIdx );
+ aAnch.SetAnchor( &aPos );
+ pNewSet->Put( aAnch );
+
+ if( pUndo )
+ pUndo->SetFlys( *pOldFmt, *pNewSet, *pNewFmt );
+ else
+ pOldFmt->SetFmtAttr( *pNewSet );
+
+ delete pNewSet;
+
+ //Nun nur noch die Flys erzeugen lassen. Das ueberlassen
+ //wir vorhanden Methoden (insb. fuer InCntFlys etwas aufwendig).
+ pNewFmt->MakeFrms();
+ // --> OD #i115719#
+ if ( bIsSwFlyFrmFmtInstance )
+ {
+ static_cast<SwFlyFrmFmt*>(pOldFmt)->SetObjTitle( sTitle );
+ static_cast<SwFlyFrmFmt*>(pOldFmt)->SetObjDescription( sDescription );
+ }
+ // <--
+ }
+ break;
+
+ default:
+ OSL_ENSURE(false, "unknown LabelType?");
+ }
+ ASSERT( pNew, "No Label inserted" );
+ if( pNew )
+ {
+ //#i61007# order of captions
+ sal_Bool bOrderNumberingFirst = SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst();
+ //String aufbereiten
+ String aTxt;
+ if( bOrderNumberingFirst )
+ {
+ aTxt = rNumberingSeparator;
+ }
+ if( pType)
+ {
+ aTxt += pType->GetName();
+ if( !bOrderNumberingFirst )
+ aTxt += ' ';
+ }
+ xub_StrLen nIdx = aTxt.Len();
+ if( rTxt.Len() > 0 )
+ {
+ aTxt += rSeparator;
+ }
+ xub_StrLen nSepIdx = aTxt.Len();
+ aTxt += rTxt;
+
+ //String einfuegen
+ SwIndex aIdx( pNew, 0 );
+ pNew->InsertText( aTxt, aIdx );
+
+ //
+ //Feld einfuegen
+ if(pType)
+ {
+ SwSetExpField aFld( (SwSetExpFieldType*)pType, aEmptyStr, SVX_NUM_ARABIC);
+ if( bOrderNumberingFirst )
+ nIdx = 0;
+ SwFmtFld aFmt( aFld );
+ pNew->InsertItem( aFmt, nIdx, nIdx );
+ if(rCharacterStyle.Len())
+ {
+ SwCharFmt* pCharFmt = rDoc.FindCharFmtByName(rCharacterStyle);
+ if( !pCharFmt )
+ {
+ const sal_uInt16 nMyId = SwStyleNameMapper::GetPoolIdFromUIName(rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ pCharFmt = rDoc.GetCharFmtFromPool( nMyId );
+ }
+ if (pCharFmt)
+ {
+ SwFmtCharFmt aCharFmt( pCharFmt );
+ pNew->InsertItem( aCharFmt, 0,
+ nSepIdx + 1, nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
+ }
+ }
+
+ if ( bTable )
+ {
+ if ( bBefore )
+ {
+ if ( !pNew->GetSwAttrSet().GetKeep().GetValue() )
+ pNew->SetAttr( SvxFmtKeepItem( sal_True, RES_KEEP ) );
+ }
+ else
+ {
+ SwTableNode *const pNd =
+ rDoc.GetNodes()[nNdIdx]->GetStartNode()->GetTableNode();
+ SwTable &rTbl = pNd->GetTable();
+ if ( !rTbl.GetFrmFmt()->GetKeep().GetValue() )
+ rTbl.GetFrmFmt()->SetFmtAttr( SvxFmtKeepItem( sal_True, RES_KEEP ) );
+ if ( pUndo )
+ pUndo->SetUndoKeep();
+ }
+ }
+ rDoc.SetModified();
+ }
+
+ return pNewFmt;
+}
+
+SwFlyFrmFmt *
+SwDoc::InsertLabel(
+ SwLabelType const eType, String const& rTxt, String const& rSeparator,
+ String const& rNumberingSeparator,
+ sal_Bool const bBefore, sal_uInt16 const nId, sal_uLong const nNdIdx,
+ String const& rCharacterStyle,
+ sal_Bool const bCpyBrd )
+{
+ SwUndoInsertLabel * pUndo(0);
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoInsertLabel(
+ eType, rTxt, rSeparator, rNumberingSeparator,
+ bBefore, nId, rCharacterStyle, bCpyBrd );
+ }
+
+ SwFlyFrmFmt *const pNewFmt = lcl_InsertLabel(*this, pTxtFmtCollTbl, pUndo,
+ eType, rTxt, rSeparator, rNumberingSeparator, bBefore,
+ nId, nNdIdx, rCharacterStyle, bCpyBrd);
+
+ if (pUndo)
+ {
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ else
+ {
+ GetIDocumentUndoRedo().DelAllUndoObj();
+ }
+
+ return pNewFmt;
+}
+
+
+/*************************************************************************
+|*
+|* SwDoc::InsertDrawLabel()
+|*
+|* Ersterstellung MIB 7. Dez. 98
+|* Letzte Aenderung MIB 7. Dez. 98
+|*
+|*************************************************************************/
+
+static SwFlyFrmFmt *
+lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
+ SwUndoInsertLabel *const pUndo, SwDrawFrmFmt *const pOldFmt,
+ String const& rTxt,
+ const String& rSeparator,
+ const String& rNumberSeparator,
+ const sal_uInt16 nId,
+ const String& rCharacterStyle,
+ SdrObject& rSdrObj )
+{
+ ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
+ ::sw::DrawUndoGuard const drawUndoGuard(rDoc.GetIDocumentUndoRedo());
+
+ // Erstmal das Feld bauen, weil ueber den Namen die TxtColl besorgt
+ // werden muss
+ OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.GetFldTypes()->Count(),
+ "FldType index out of bounds" );
+ SwFieldType *pType = nId != USHRT_MAX ? (*rDoc.GetFldTypes())[nId] : 0;
+ OSL_ENSURE( !pType || pType->Which() == RES_SETEXPFLD, "Wrong label id" );
+
+ SwTxtFmtColl *pColl = NULL;
+ if( pType )
+ {
+ for( sal_uInt16 i = pTxtFmtCollTbl->Count(); i; )
+ {
+ if( (*pTxtFmtCollTbl)[ --i ]->GetName() == pType->GetName() )
+ {
+ pColl = (*pTxtFmtCollTbl)[i];
+ break;
+ }
+ }
+ DBG_ASSERT( pColl, "no text collection found" );
+ }
+
+ if( !pColl )
+ {
+ pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_LABEL );
+ }
+
+ SwTxtNode* pNew = NULL;
+ SwFlyFrmFmt* pNewFmt = NULL;
+
+ // Rahmen zerstoeren, neuen Rahmen einfuegen, entsprechenden
+ // Node mit Feld in den neuen Rahmen, den alten Rahmen mit
+ // dem Object (Grafik/Ole) absatzgebunden in den neuen Rahmen,
+ // Frames erzeugen.
+
+ // OD 27.11.2003 #112045# - Keep layer ID of drawing object before removing
+ // its frames.
+ // Note: The layer ID is passed to the undo and have to be the correct value.
+ // Removing the frames of the drawing object changes its layer.
+ const SdrLayerID nLayerId = rSdrObj.GetLayer();
+
+ pOldFmt->DelFrms();
+
+ //Bei InCntnt's wird es spannend: Das TxtAttribut muss
+ //vernichtet werden. Leider reisst dies neben den Frms auch
+ //noch das Format mit in sein Grab. Um dass zu unterbinden
+ //loesen wir vorher die Verbindung zwischen Attribut und Format.
+ SfxItemSet* pNewSet = pOldFmt->GetAttrSet().Clone( sal_False );
+
+ // Ggf. Groesse und Position des Rahmens schuetzen
+ if ( rSdrObj.IsMoveProtect() || rSdrObj.IsResizeProtect() )
+ {
+ SvxProtectItem aProtect(RES_PROTECT);
+ aProtect.SetCntntProtect( sal_False );
+ aProtect.SetPosProtect( rSdrObj.IsMoveProtect() );
+ aProtect.SetSizeProtect( rSdrObj.IsResizeProtect() );
+ pNewSet->Put( aProtect );
+ }
+
+ // Umlauf uebernehmen
+ lcl_CpyAttr( *pNewSet, pOldFmt->GetAttrSet(), RES_SURROUND );
+
+ // Den Rahmen ggf. in den Hintergrund schicken.
+ // OD 02.07.2003 #108784# - consider 'invisible' hell layer.
+ if ( rDoc.GetHellId() != nLayerId &&
+ rDoc.GetInvisibleHellId() != nLayerId )
+ {
+ SvxOpaqueItem aOpaque( RES_OPAQUE );
+ aOpaque.SetValue( sal_True );
+ pNewSet->Put( aOpaque );
+ }
+
+ // Position uebernehmen
+ // OD 2004-04-15 #i26791# - use directly the positioning attributes of
+ // the drawing object.
+ pNewSet->Put( pOldFmt->GetHoriOrient() );
+ pNewSet->Put( pOldFmt->GetVertOrient() );
+
+ pNewSet->Put( pOldFmt->GetAnchor() );
+
+ //In der Hoehe soll der neue Varabel sein!
+ Size aSz( rSdrObj.GetCurrentBoundRect().GetSize() );
+ SwFmtFrmSize aFrmSize( ATT_MIN_SIZE, aSz.Width(), aSz.Height() );
+ pNewSet->Put( aFrmSize );
+
+ // Abstaende auf den neuen Rahmen uebertragen. Eine Umrandung
+ // gibt es beu Zeichen-Objekten nicht, also muss sie geloescht
+ // werden.
+ // MA: Falsch sie wird nicht gesetzt, denn die aus der Vorlage
+ // soll ruhig wirksam werden
+ pNewSet->Put( pOldFmt->GetLRSpace() );
+ pNewSet->Put( pOldFmt->GetULSpace() );
+
+ SwStartNode* pSttNd =
+ rDoc.GetNodes().MakeTextSection(
+ SwNodeIndex( rDoc.GetNodes().GetEndOfAutotext() ),
+ SwFlyStartNode, pColl );
+
+ pNewFmt = rDoc.MakeFlyFrmFmt( rDoc.GetUniqueFrameName(),
+ rDoc.GetFrmFmtFromPool( RES_POOLFRM_FRAME ) );
+
+ // JP 28.10.99: Bug 69487 - set border and shadow to default if the
+ // template contains any.
+ if( SFX_ITEM_SET == pNewFmt->GetAttrSet().GetItemState( RES_BOX, sal_True ))
+ pNewSet->Put( *GetDfltAttr( RES_BOX ) );
+
+ if( SFX_ITEM_SET == pNewFmt->GetAttrSet().GetItemState(RES_SHADOW,sal_True))
+ pNewSet->Put( *GetDfltAttr( RES_SHADOW ) );
+
+ pNewFmt->SetFmtAttr( SwFmtCntnt( pSttNd ));
+ pNewFmt->SetFmtAttr( *pNewSet );
+
+ const SwFmtAnchor& rAnchor = pNewFmt->GetAnchor();
+ if ( FLY_AS_CHAR == rAnchor.GetAnchorId() )
+ {
+ const SwPosition *pPos = rAnchor.GetCntntAnchor();
+ SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
+ ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
+ const xub_StrLen nIdx = pPos->nContent.GetIndex();
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
+
+#ifdef DBG_UTIL
+ ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
+ "Missing FlyInCnt-Hint." );
+ ASSERT( pHnt && ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).
+ GetFrmFmt() == (SwFrmFmt*)pOldFmt,
+ "Wrong TxtFlyCnt-Hint." );
+#endif
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt( pNewFmt );
+ }
+
+
+ //Der Alte soll keinen Umlauf haben, und er soll oben/mittig
+ //ausgerichtet sein.
+ pNewSet->ClearItem();
+
+ pNewSet->Put( SwFmtSurround( SURROUND_NONE ) );
+ if (nLayerId == rDoc.GetHellId())
+ {
+ rSdrObj.SetLayer( rDoc.GetHeavenId() );
+ }
+ // OD 02.07.2003 #108784# - consider drawing objects in 'invisible' hell layer
+ else if (nLayerId == rDoc.GetInvisibleHellId())
+ {
+ rSdrObj.SetLayer( rDoc.GetInvisibleHeavenId() );
+ }
+ pNewSet->Put( SvxLRSpaceItem( RES_LR_SPACE ) );
+ pNewSet->Put( SvxULSpaceItem( RES_UL_SPACE ) );
+
+ // OD 2004-04-15 #i26791# - set position of the drawing object, which is labeled.
+ pNewSet->Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ) );
+ pNewSet->Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ) );
+
+ //Der Alte ist absatzgebunden, und zwar am Absatz im neuen.
+ SwFmtAnchor aAnch( FLY_AT_PARA );
+ SwNodeIndex aAnchIdx( *pNewFmt->GetCntnt().GetCntntIdx(), 1 );
+ pNew = aAnchIdx.GetNode().GetTxtNode();
+ SwPosition aPos( aAnchIdx );
+ aAnch.SetAnchor( &aPos );
+ pNewSet->Put( aAnch );
+
+ if( pUndo )
+ {
+ pUndo->SetFlys( *pOldFmt, *pNewSet, *pNewFmt );
+ // OD 2004-04-15 #i26791# - position no longer needed
+ pUndo->SetDrawObj( nLayerId );
+ }
+ else
+ pOldFmt->SetFmtAttr( *pNewSet );
+
+ delete pNewSet;
+
+ //Nun nur noch die Flys erzeugen lassen. Das ueberlassen
+ //wir vorhanden Methoden (insb. fuer InCntFlys etwas aufwendig).
+ pNewFmt->MakeFrms();
+
+ ASSERT( pNew, "No Label inserted" );
+
+ if( pNew )
+ {
+ //#i61007# order of captions
+ sal_Bool bOrderNumberingFirst = SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst();
+
+ // prepare string
+ String aTxt;
+ if( bOrderNumberingFirst )
+ {
+ aTxt = rNumberSeparator;
+ }
+ if ( pType )
+ {
+ aTxt += pType->GetName();
+ if( !bOrderNumberingFirst )
+ aTxt += ' ';
+ }
+ xub_StrLen nIdx = aTxt.Len();
+ aTxt += rSeparator;
+ xub_StrLen nSepIdx = aTxt.Len();
+ aTxt += rTxt;
+
+ // insert text
+ SwIndex aIdx( pNew, 0 );
+ pNew->InsertText( aTxt, aIdx );
+
+ // insert field
+ if ( pType )
+ {
+ SwSetExpField aFld( (SwSetExpFieldType*)pType, aEmptyStr, SVX_NUM_ARABIC );
+ if( bOrderNumberingFirst )
+ nIdx = 0;
+ SwFmtFld aFmt( aFld );
+ pNew->InsertItem( aFmt, nIdx, nIdx );
+ if ( rCharacterStyle.Len() )
+ {
+ SwCharFmt * pCharFmt = rDoc.FindCharFmtByName(rCharacterStyle);
+ if ( !pCharFmt )
+ {
+ const sal_uInt16 nMyId = SwStyleNameMapper::GetPoolIdFromUIName( rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ pCharFmt = rDoc.GetCharFmtFromPool( nMyId );
+ }
+ if ( pCharFmt )
+ {
+ SwFmtCharFmt aCharFmt( pCharFmt );
+ pNew->InsertItem( aCharFmt, 0, nSepIdx + 1,
+ nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
+ }
+ }
+ }
+
+ return pNewFmt;
+}
+
+SwFlyFrmFmt* SwDoc::InsertDrawLabel(
+ String const& rTxt,
+ String const& rSeparator,
+ String const& rNumberSeparator,
+ sal_uInt16 const nId,
+ String const& rCharacterStyle,
+ SdrObject& rSdrObj )
+{
+ SwDrawContact *const pContact =
+ static_cast<SwDrawContact*>(GetUserCall( &rSdrObj ));
+ OSL_ENSURE( RES_DRAWFRMFMT == pContact->GetFmt()->Which(),
+ "InsertDrawLabel(): not a DrawFrmFmt" );
+ if (!pContact)
+ return 0;
+
+ SwDrawFrmFmt* pOldFmt = (SwDrawFrmFmt *)pContact->GetFmt();
+ if (!pOldFmt)
+ return 0;
+
+ SwUndoInsertLabel * pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ pUndo = new SwUndoInsertLabel(
+ LTYPE_DRAW, rTxt, rSeparator, rNumberSeparator, sal_False,
+ nId, rCharacterStyle, sal_False );
+ }
+
+ SwFlyFrmFmt *const pNewFmt = lcl_InsertDrawLabel(
+ *this, pTxtFmtCollTbl, pUndo, pOldFmt,
+ rTxt, rSeparator, rNumberSeparator, nId, rCharacterStyle, rSdrObj);
+
+ if (pUndo)
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ else
+ {
+ GetIDocumentUndoRedo().DelAllUndoObj();
+ }
+
+ return pNewFmt;
+}
+
+
+/*************************************************************************
+|*
+|* IDocumentTimerAccess-methods
+|*
+|*************************************************************************/
+
+void SwDoc::StartIdling()
+{
+ mbStartIdleTimer = sal_True;
+ if( !mIdleBlockCount )
+ aIdleTimer.Start();
+}
+
+void SwDoc::StopIdling()
+{
+ mbStartIdleTimer = sal_False;
+ aIdleTimer.Stop();
+}
+
+void SwDoc::BlockIdling()
+{
+ aIdleTimer.Stop();
+ ++mIdleBlockCount;
+}
+
+void SwDoc::UnblockIdling()
+{
+ --mIdleBlockCount;
+ if( !mIdleBlockCount && mbStartIdleTimer && !aIdleTimer.IsActive() )
+ aIdleTimer.Start();
+}
+
+
+/*************************************************************************
+|*
+|* SwDoc::DoIdleJobs()
+|*
+|* Ersterstellung OK 30.03.94
+|* Letzte Aenderung MA 09. Jun. 95
+|*
+|*************************************************************************/
+
+IMPL_LINK( SwDoc, DoIdleJobs, Timer *, pTimer )
+{
+#ifdef TIMELOG
+ static ::rtl::Logfile* pModLogFile = 0;
+ if( !pModLogFile )
+ pModLogFile = new ::rtl::Logfile( "First DoIdleJobs" );
+#endif
+
+ SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
+ if( pTmpRoot &&
+ !SfxProgress::GetActiveProgress( pDocShell ) )
+ {
+ ViewShell *pSh, *pStartSh;
+ pSh = pStartSh = GetCurrentViewShell();
+ do {
+ if( pSh->ActionPend() )
+ {
+ if( pTimer )
+ pTimer->Start();
+ return 0;
+ }
+ pSh = (ViewShell*)pSh->GetNext();
+ } while( pSh != pStartSh );
+
+ if( pTmpRoot->IsNeedGrammarCheck() )
+ {
+ sal_Bool bIsOnlineSpell = pSh->GetViewOptions()->IsOnlineSpell();
+ sal_Bool bIsAutoGrammar = sal_False;
+ SvtLinguConfig().GetProperty( ::rtl::OUString::createFromAscii(
+ UPN_IS_GRAMMAR_AUTO ) ) >>= bIsAutoGrammar;
+
+ if (bIsOnlineSpell && bIsAutoGrammar)
+ StartGrammarChecking( *this );
+ }
+ SwFldUpdateFlags nFldUpdFlag;
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();//swmod 080320
+ std::set<SwRootFrm*>::iterator pLayIter = aAllLayouts.begin();
+ for ( ;pLayIter != aAllLayouts.end();pLayIter++ )
+ {
+ if ((*pLayIter)->IsIdleFormat())
+ {
+ (*pLayIter)->GetCurrShell()->LayoutIdle();
+ break;
+ }
+ }
+ bool bAllValid = pLayIter == aAllLayouts.end() ? 1 : 0;
+ if( bAllValid && ( AUTOUPD_FIELD_ONLY ==
+ ( nFldUpdFlag = getFieldUpdateFlags(true) )
+ || AUTOUPD_FIELD_AND_CHARTS == nFldUpdFlag ) &&
+ GetUpdtFlds().IsFieldsDirty() &&
+ !GetUpdtFlds().IsInUpdateFlds() &&
+ !IsExpFldsLocked()
+ // das umschalten der Feldname fuehrt zu keinem Update der
+ // Felder, also der "Hintergrund-Update" immer erfolgen
+ /* && !pStartSh->GetViewOptions()->IsFldName()*/ )
+ {
+ // chaos::Action-Klammerung!
+ GetUpdtFlds().SetInUpdateFlds( sal_True );
+
+ pTmpRoot->StartAllAction();
+
+ // no jump on update of fields #i85168#
+ const sal_Bool bOldLockView = pStartSh->IsViewLocked();
+ pStartSh->LockView( sal_True );
+
+ GetSysFldType( RES_CHAPTERFLD )->ModifyNotification( 0, 0 ); // KapitelFld
+ UpdateExpFlds( 0, sal_False ); // Expression-Felder Updaten
+ UpdateTblFlds(NULL); // Tabellen
+ UpdateRefFlds(NULL); // Referenzen
+
+ pTmpRoot->EndAllAction();
+
+ pStartSh->LockView( bOldLockView );
+
+ GetUpdtFlds().SetInUpdateFlds( sal_False );
+ GetUpdtFlds().SetFieldsDirty( sal_False );
+ }
+ } //swmod 080219
+#ifdef TIMELOG
+ if( pModLogFile && 1 != (long)pModLogFile )
+ delete pModLogFile, ((long&)pModLogFile) = 1;
+#endif
+ if( pTimer )
+ pTimer->Start();
+ return 0;
+}
+
+IMPL_STATIC_LINK( SwDoc, BackgroundDone, SvxBrushItem*, EMPTYARG )
+{
+ ViewShell *pSh, *pStartSh;
+ pSh = pStartSh = pThis->GetCurrentViewShell(); //swmod 071108//swmod 071225
+ if( pStartSh )
+ do {
+ if( pSh->GetWin() )
+ {
+ //Fuer Repaint mir virtuellen Device sorgen.
+ pSh->LockPaint();
+ pSh->UnlockPaint( sal_True );
+ }
+ pSh = (ViewShell*)pSh->GetNext();
+ } while( pSh != pStartSh );
+ return 0;
+}
+
+static String lcl_GetUniqueFlyName( const SwDoc* pDoc, sal_uInt16 nDefStrId )
+{
+ ResId aId( nDefStrId, *pSwResMgr );
+ String aName( aId );
+ xub_StrLen nNmLen = aName.Len();
+
+ const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
+
+ sal_uInt16 nNum, nTmp, nFlagSize = ( rFmts.Count() / 8 ) +2;
+ sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
+ sal_uInt16 n;
+
+ memset( pSetFlags, 0, nFlagSize );
+
+ for( n = 0; n < rFmts.Count(); ++n )
+ {
+ const SwFrmFmt* pFlyFmt = rFmts[ n ];
+ if( RES_FLYFRMFMT == pFlyFmt->Which() &&
+ pFlyFmt->GetName().Match( aName ) == nNmLen )
+ {
+ // Nummer bestimmen und das Flag setzen
+ nNum = static_cast< sal_uInt16 >( pFlyFmt->GetName().Copy( nNmLen ).ToInt32() );
+ if( nNum-- && nNum < rFmts.Count() )
+ pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
+ }
+ }
+
+ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+ nNum = rFmts.Count();
+ for( n = 0; n < nFlagSize; ++n )
+ if( 0xff != ( nTmp = pSetFlags[ n ] ))
+ {
+ // also die Nummer bestimmen
+ nNum = n * 8;
+ while( nTmp & 1 )
+ ++nNum, nTmp >>= 1;
+ break;
+ }
+
+ delete [] pSetFlags;
+ return aName += String::CreateFromInt32( ++nNum );
+}
+
+String SwDoc::GetUniqueGrfName() const
+{
+ return lcl_GetUniqueFlyName( this, STR_GRAPHIC_DEFNAME );
+}
+
+String SwDoc::GetUniqueOLEName() const
+{
+ return lcl_GetUniqueFlyName( this, STR_OBJECT_DEFNAME );
+}
+
+String SwDoc::GetUniqueFrameName() const
+{
+ return lcl_GetUniqueFlyName( this, STR_FRAME_DEFNAME );
+}
+
+const SwFlyFrmFmt* SwDoc::FindFlyByName( const String& rName, sal_Int8 nNdTyp ) const
+{
+ const SwSpzFrmFmts& rFmts = *GetSpzFrmFmts();
+ for( sal_uInt16 n = rFmts.Count(); n; )
+ {
+ const SwFrmFmt* pFlyFmt = rFmts[ --n ];
+ const SwNodeIndex* pIdx;
+ if( RES_FLYFRMFMT == pFlyFmt->Which() && pFlyFmt->GetName() == rName &&
+ 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() ) &&
+ pIdx->GetNode().GetNodes().IsDocNodes() )
+ {
+ if( nNdTyp )
+ {
+ // dann noch auf den richtigen Node-Typ abfragen
+ const SwNode* pNd = GetNodes()[ pIdx->GetIndex()+1 ];
+ if( nNdTyp == ND_TEXTNODE
+ ? !pNd->IsNoTxtNode()
+ : nNdTyp == pNd->GetNodeType() )
+ return (SwFlyFrmFmt*)pFlyFmt;
+ }
+ else
+ return (SwFlyFrmFmt*)pFlyFmt;
+ }
+ }
+ return 0;
+}
+
+void SwDoc::SetFlyName( SwFlyFrmFmt& rFmt, const String& rName )
+{
+ String sName( rName );
+ if( !rName.Len() || FindFlyByName( rName ) )
+ {
+ sal_uInt16 nTyp = STR_FRAME_DEFNAME;
+ const SwNodeIndex* pIdx = rFmt.GetCntnt().GetCntntIdx();
+ if( pIdx && pIdx->GetNode().GetNodes().IsDocNodes() )
+ switch( GetNodes()[ pIdx->GetIndex() + 1 ]->GetNodeType() )
+ {
+ case ND_GRFNODE: nTyp = STR_GRAPHIC_DEFNAME; break;
+ case ND_OLENODE: nTyp = STR_OBJECT_DEFNAME; break;
+ }
+ sName = lcl_GetUniqueFlyName( this, nTyp );
+ }
+ rFmt.SetName( sName, sal_True );
+ SetModified();
+}
+
+void SwDoc::SetAllUniqueFlyNames()
+{
+ sal_uInt16 n, nFlyNum = 0, nGrfNum = 0, nOLENum = 0;
+
+ ResId nFrmId( STR_FRAME_DEFNAME, *pSwResMgr ),
+ nGrfId( STR_GRAPHIC_DEFNAME, *pSwResMgr ),
+ nOLEId( STR_OBJECT_DEFNAME, *pSwResMgr );
+ String sFlyNm( nFrmId );
+ String sGrfNm( nGrfId );
+ String sOLENm( nOLEId );
+
+ if( 255 < ( n = GetSpzFrmFmts()->Count() ))
+ n = 255;
+ SwSpzFrmFmts aArr( (sal_Int8)n, 10 );
+ SwFrmFmtPtr pFlyFmt;
+ sal_Bool bLoadedFlag = sal_True; // noch etwas fuers Layout
+
+ for( n = GetSpzFrmFmts()->Count(); n; )
+ {
+ if( RES_FLYFRMFMT == (pFlyFmt = (*GetSpzFrmFmts())[ --n ])->Which() )
+ {
+ sal_uInt16 *pNum = 0;
+ xub_StrLen nLen;
+ const String& rNm = pFlyFmt->GetName();
+ if( rNm.Len() )
+ {
+ if( rNm.Match( sGrfNm ) == ( nLen = sGrfNm.Len() ))
+ pNum = &nGrfNum;
+ else if( rNm.Match( sFlyNm ) == ( nLen = sFlyNm.Len() ))
+ pNum = &nFlyNum;
+ else if( rNm.Match( sOLENm ) == ( nLen = sOLENm.Len() ))
+ pNum = &nOLENum;
+
+ if ( pNum && *pNum < ( nLen = static_cast< xub_StrLen >( rNm.Copy( nLen ).ToInt32() ) ) )
+ *pNum = nLen;
+ }
+ else
+ // das wollen wir nachher setzen
+ aArr.Insert( pFlyFmt, aArr.Count() );
+
+ }
+ if( bLoadedFlag )
+ {
+ const SwFmtAnchor& rAnchor = pFlyFmt->GetAnchor();
+ if (((FLY_AT_PAGE == rAnchor.GetAnchorId()) &&
+ rAnchor.GetCntntAnchor()) ||
+ // oder werden DrawObjecte rel. zu irgendetwas ausgerichtet?
+ ( RES_DRAWFRMFMT == pFlyFmt->Which() && (
+ SFX_ITEM_SET == pFlyFmt->GetItemState(
+ RES_VERT_ORIENT )||
+ SFX_ITEM_SET == pFlyFmt->GetItemState(
+ RES_HORI_ORIENT ))) )
+ {
+ bLoadedFlag = sal_False;
+ }
+ }
+ }
+
+ const SwNodeIndex* pIdx;
+
+ for( n = aArr.Count(); n; )
+ if( 0 != ( pIdx = ( pFlyFmt = aArr[ --n ])->GetCntnt().GetCntntIdx() )
+ && pIdx->GetNode().GetNodes().IsDocNodes() )
+ {
+ sal_uInt16 nNum;
+ String sNm;
+ switch( GetNodes()[ pIdx->GetIndex() + 1 ]->GetNodeType() )
+ {
+ case ND_GRFNODE:
+ sNm = sGrfNm;
+ nNum = ++nGrfNum;
+ break;
+ case ND_OLENODE:
+ sNm = sOLENm;
+ nNum = ++nOLENum;
+ break;
+ default:
+ sNm = sFlyNm;
+ nNum = ++nFlyNum;
+ break;
+ }
+ pFlyFmt->SetName( sNm += String::CreateFromInt32( nNum ));
+ }
+ aArr.Remove( 0, aArr.Count() );
+
+ if( GetFtnIdxs().Count() )
+ {
+ SwTxtFtn::SetUniqueSeqRefNo( *this );
+ // --> FME 2005-08-02 #i52775# Chapter footnotes did not
+ // get updated correctly. Calling UpdateAllFtn() instead of
+ // UpdateFtn() solves this problem, but I do not dare to
+ // call UpdateAllFtn() in all cases: Safety first.
+ if ( FTNNUM_CHAPTER == GetFtnInfo().eNum )
+ {
+ GetFtnIdxs().UpdateAllFtn();
+ }
+ // <--
+ else
+ {
+ SwNodeIndex aTmp( GetNodes() );
+ GetFtnIdxs().UpdateFtn( aTmp );
+ }
+ }
+
+ // neues Document und keine seitengebundenen Rahmen/DrawObjecte gefunden,
+ // die an einem Node verankert sind.
+ if( bLoadedFlag )
+ SetLoaded( sal_True );
+}
+
+sal_Bool SwDoc::IsInHeaderFooter( const SwNodeIndex& rIdx ) const
+{
+ // gibt es ein Layout, dann ueber das laufen!!
+ // (Das kann dann auch Fly in Fly in Kopfzeile !)
+ // MIB 9.2.98: Wird auch vom sw3io benutzt, um festzustellen, ob sich
+ // ein Redline-Objekt in einer Kopf- oder Fusszeile befindet. Da
+ // Redlines auch an Start- und Endnodes haengen, muss der Index nicht
+ // unbedingt der eines Content-Nodes sein.
+ SwNode* pNd = &rIdx.GetNode();
+ if( pNd->IsCntntNode() && pCurrentView )//swmod 071029//swmod 071225
+ {
+ const SwFrm *pFrm = pNd->GetCntntNode()->getLayoutFrm( GetCurrentLayout() );
+ if( pFrm )
+ {
+ const SwFrm *pUp = pFrm->GetUpper();
+ while ( pUp && !pUp->IsHeaderFrm() && !pUp->IsFooterFrm() )
+ {
+ if ( pUp->IsFlyFrm() )
+ pUp = ((SwFlyFrm*)pUp)->GetAnchorFrm();
+ pUp = pUp->GetUpper();
+ }
+ if ( pUp )
+ return sal_True;
+
+ return sal_False;
+ }
+ }
+
+
+ const SwNode* pFlyNd = pNd->FindFlyStartNode();
+ while( pFlyNd )
+ {
+ // dann ueber den Anker nach oben "hangeln"
+ sal_uInt16 n;
+ for( n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+ {
+ const SwFrmFmt* pFmt = (*GetSpzFrmFmts())[ n ];
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if( pIdx && pFlyNd == &pIdx->GetNode() )
+ {
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+ if ((FLY_AT_PAGE == rAnchor.GetAnchorId()) ||
+ !rAnchor.GetCntntAnchor() )
+ {
+ return sal_False;
+ }
+
+ pNd = &rAnchor.GetCntntAnchor()->nNode.GetNode();
+ pFlyNd = pNd->FindFlyStartNode();
+ break;
+ }
+ }
+ if( n >= GetSpzFrmFmts()->Count() )
+ {
+ ASSERT( mbInReading, "Fly-Section aber kein Format gefunden" );
+ return sal_False;
+ }
+ }
+
+ return 0 != pNd->FindHeaderStartNode() ||
+ 0 != pNd->FindFooterStartNode();
+}
+
+short SwDoc::GetTextDirection( const SwPosition& rPos,
+ const Point* pPt ) const
+{
+ short nRet = -1;
+
+ SwCntntNode *pNd = rPos.nNode.GetNode().GetCntntNode();
+
+ // --> OD 2005-02-21 #i42921# - use new method <SwCntntNode::GetTextDirection(..)>
+ if ( pNd )
+ {
+ nRet = pNd->GetTextDirection( rPos, pPt );
+ }
+ if ( nRet == -1 )
+ // <--
+ {
+ const SvxFrameDirectionItem* pItem = 0;
+ if( pNd )
+ {
+ // in a flyframe? Then look at that for the correct attribute
+ const SwFrmFmt* pFlyFmt = pNd->GetFlyFmt();
+ while( pFlyFmt )
+ {
+ pItem = &pFlyFmt->GetFrmDir();
+ if( FRMDIR_ENVIRONMENT == pItem->GetValue() )
+ {
+ pItem = 0;
+ const SwFmtAnchor* pAnchor = &pFlyFmt->GetAnchor();
+ if ((FLY_AT_PAGE != pAnchor->GetAnchorId()) &&
+ pAnchor->GetCntntAnchor())
+ {
+ pFlyFmt = pAnchor->GetCntntAnchor()->nNode.
+ GetNode().GetFlyFmt();
+ }
+ else
+ pFlyFmt = 0;
+ }
+ else
+ pFlyFmt = 0;
+ }
+
+ if( !pItem )
+ {
+ const SwPageDesc* pPgDsc = pNd->FindPageDesc( sal_False );
+ if( pPgDsc )
+ pItem = &pPgDsc->GetMaster().GetFrmDir();
+ }
+ }
+ if( !pItem )
+ pItem = (SvxFrameDirectionItem*)&GetAttrPool().GetDefaultItem(
+ RES_FRAMEDIR );
+ nRet = pItem->GetValue();
+ }
+ return nRet;
+}
+
+sal_Bool SwDoc::IsInVerticalText( const SwPosition& rPos, const Point* pPt ) const
+{
+ const short nDir = GetTextDirection( rPos, pPt );
+ return FRMDIR_VERT_TOP_RIGHT == nDir || FRMDIR_VERT_TOP_LEFT == nDir;
+}
+
+void SwDoc::SetCurrentViewShell( ViewShell* pNew )
+{
+ pCurrentView = pNew;
+}
+
+SwLayouter* SwDoc::GetLayouter()
+{
+ return pLayouter;
+}
+
+const SwLayouter* SwDoc::GetLayouter() const
+{
+ return pLayouter;
+}
+
+void SwDoc::SetLayouter( SwLayouter* pNew )
+{
+ pLayouter = pNew;
+}
+
+const ViewShell *SwDoc::GetCurrentViewShell() const
+{
+ return pCurrentView;
+}
+
+ViewShell *SwDoc::GetCurrentViewShell()
+{
+ return pCurrentView;
+} //swmod 080219 It must be able to communicate to a ViewShell.This is going to be removedd later.
+
+const SwRootFrm *SwDoc::GetCurrentLayout() const
+{
+ if(GetCurrentViewShell())
+ return GetCurrentViewShell()->GetLayout();
+ return 0;
+}
+
+SwRootFrm *SwDoc::GetCurrentLayout()
+{
+ if(GetCurrentViewShell())
+ return GetCurrentViewShell()->GetLayout();
+ return 0;
+}
+
+bool SwDoc::HasLayout() const
+{
+ // if there is a view, there is always a layout
+ return (pCurrentView != 0);
+}
+
+std::set<SwRootFrm*> SwDoc::GetAllLayouts()
+{
+ std::set<SwRootFrm*> aAllLayouts;
+ ViewShell *pStart = GetCurrentViewShell();
+ ViewShell *pTemp = pStart;
+ if ( pTemp )
+ {
+ do
+ {
+ if (pTemp->GetLayout())
+ {
+ aAllLayouts.insert(pTemp->GetLayout());
+ pTemp = (ViewShell*)pTemp->GetNext();
+ }
+ } while(pTemp!=pStart);
+ }
+
+ return aAllLayouts;
+}//swmod 070825
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
new file mode 100644
index 000000000000..98ad5724f10d
--- /dev/null
+++ b/sw/source/core/doc/docnew.cxx
@@ -0,0 +1,1269 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+#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>
+#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
+#include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
+
+#include <unotools/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/virdev.hxx>
+#include <rtl/logfile.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <svl/macitem.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdogrp.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <svl/zforlist.hxx>
+#include <unotools/compatibility.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svx/svdpage.hxx>
+#include <paratr.hxx>
+#include <fchrfmt.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtanchr.hxx>
+#include <fmtfsize.hxx>
+#include <fmtfordr.hxx>
+#include <fmtpdsc.hxx>
+#include <pvprtdat.hxx>
+#include <rootfrm.hxx> //Damit der RootDtor gerufen wird.
+#include <layouter.hxx>
+#include <pagedesc.hxx> //Damit die PageDescs zerstoert werden koennen.
+#include <ndtxt.hxx>
+#include <printdata.hxx>
+#include <docfld.hxx>
+#include <ftninfo.hxx>
+#include <ftnidx.hxx>
+#include <docstat.hxx>
+#include <charfmt.hxx>
+#include <frmfmt.hxx>
+#include <rolbck.hxx> // Undo-Attr, SwHistory
+#include <poolfmt.hxx> // fuer die Pool-Vorlage
+#include <dbmgr.hxx>
+#include <docsh.hxx>
+#include <acorrect.hxx> // fuer die autom. Aufnahme von Ausnahmen
+#include <visiturl.hxx> // fuer die URL-Change Benachrichtigung
+#include <docary.hxx>
+#include <lineinfo.hxx>
+#include <drawdoc.hxx>
+#include <linkenum.hxx>
+#include <fldupde.hxx>
+#include <extinput.hxx>
+#include <viewsh.hxx>
+#include <doctxm.hxx>
+#include <shellres.hxx>
+#include <breakit.hxx>
+#include <laycache.hxx>
+#include <mvsave.hxx>
+#include <istyleaccess.hxx>
+#include <swstylemanager.hxx>
+#include <IGrammarContact.hxx>
+#include <tblsel.hxx>
+#include <MarkManager.hxx>
+#include <UndoManager.hxx>
+#include <unochart.hxx>
+
+#include <cmdid.h> // fuer den dflt - Printer in SetJob
+
+
+// --> OD 2006-04-19 #b6375613#
+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+// <--
+
+// --> OD 2007-03-16 #i73788#
+#include <pausethreadstarting.hxx>
+// <--
+#include <numrule.hxx>
+// --> OD 2008-03-13 #refactorlists#
+#include <list.hxx>
+#include <listfunc.hxx>
+// <--
+
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+#include <sfx2/Metadatable.hxx>
+#include <fmtmeta.hxx> // MetaFieldManager
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::document;
+
+const sal_Char __FAR_DATA sFrmFmtStr[] = "Frameformat";
+const sal_Char __FAR_DATA sEmptyPageStr[] = "Empty Page";
+const sal_Char __FAR_DATA sColumnCntStr[] = "Columncontainer";
+const sal_Char __FAR_DATA sCharFmtStr[] = "Zeichenformat";
+const sal_Char __FAR_DATA sTxtCollStr[] = "Textformatvorlage";
+const sal_Char __FAR_DATA sGrfCollStr[] = "Graphikformatvorlage";
+
+SV_IMPL_PTRARR( SwNumRuleTbl, SwNumRulePtr)
+SV_IMPL_PTRARR( SwTxtFmtColls, SwTxtFmtCollPtr)
+SV_IMPL_PTRARR( SwGrfFmtColls, SwGrfFmtCollPtr)
+
+/*
+ * global functions...
+ */
+
+ uno::Reference< linguistic2::XProofreadingIterator > SwDoc::GetGCIterator() const
+{
+ if (!m_xGCIterator.is() && SvtLinguConfig().HasGrammarChecker())
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr( utl::getProcessServiceFactory() );
+ if (xMgr.is())
+ {
+ try
+ {
+ rtl::OUString aServiceName( rtl::OUString::createFromAscii("com.sun.star.linguistic2.ProofreadingIterator") );
+ m_xGCIterator = uno::Reference< linguistic2::XProofreadingIterator >
+ ( xMgr->createInstance( aServiceName ), uno::UNO_QUERY_THROW );
+ }
+ catch (uno::Exception &)
+ {
+ DBG_ERROR( "No GCIterator" );
+ }
+ }
+ }
+
+ return m_xGCIterator;
+}
+
+void StartGrammarChecking( SwDoc &rDoc )
+{
+ // check for a visible view
+ bool bVisible = false;
+ const SwDocShell *pDocShell = rDoc.GetDocShell();
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, sal_False );
+ while (pFrame && !bVisible)
+ {
+ if (pFrame->IsVisible())
+ bVisible = true;
+ pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, sal_False );
+ }
+
+ //!! only documents with visible views need to be checked
+ //!! (E.g. don't check temporary documents created for printing, see printing of notes and selections.
+ //!! Those get created on the fly and get hard deleted a bit later as well, and no one should have
+ //!! a uno reference to them)
+ if (bVisible)
+ {
+ uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( rDoc.GetGCIterator() );
+ if ( xGCIterator.is() )
+ {
+ uno::Reference< lang::XComponent > xDoc( rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
+ uno::Reference< text::XFlatParagraphIteratorProvider > xFPIP( xDoc, uno::UNO_QUERY );
+
+ // start automatic background checking if not active already
+ if ( xFPIP.is() && !xGCIterator->isProofreading( xDoc ) )
+ xGCIterator->startProofreading( xDoc, xFPIP );
+ }
+ }
+}
+
+/*
+ * interne Funktionen
+ */
+
+
+
+sal_Bool lcl_DelFmtIndizes( const SwFrmFmtPtr& rpFmt, void* )
+{
+ SwFmtCntnt &rFmtCntnt = (SwFmtCntnt&)rpFmt->GetCntnt();
+ if ( rFmtCntnt.GetCntntIdx() )
+ rFmtCntnt.SetNewCntntIdx( 0 );
+ SwFmtAnchor &rFmtAnchor = (SwFmtAnchor&)rpFmt->GetAnchor();
+ if ( rFmtAnchor.GetCntntAnchor() )
+ rFmtAnchor.SetAnchor( 0 );
+ return sal_True;
+}
+
+/*
+ * exportierte Methoden
+ */
+
+SwDoc::SwDoc()
+ : m_pNodes( new SwNodes(this) )
+ ,
+ mpAttrPool(new SwAttrPool(this)),
+ pMarkManager(new ::sw::mark::MarkManager(*this)),
+ m_pMetaFieldManager(new ::sw::MetaFieldManager()),
+ m_pUndoManager(new ::sw::UndoManager(
+ ::std::auto_ptr<SwNodes>(new SwNodes(this)), *this, *this, *this)),
+ 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() ),
+ pTOXTypes( new SwTOXTypes() ),
+ pDefTOXBases( new SwDefTOXBase_Impl() ),
+ pCurrentView( 0 ), //swmod 071225
+ pDrawModel( 0 ),
+ 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 ),
+ pLinkMgr( new sfx2::LinkManager( 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 SwModify(0)),
+ mpGrammarContact( 0 ),
+ aChartDataProviderImplRef(),
+ pChartControllerHelper( 0 ),
+ // --> OD 2007-10-31 #i83479#
+ mpListItemsList( new tImplSortedNodeNumList() ),
+ // <--
+ m_pXmlIdRegistry(),
+ 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),
+ // --> OD 2005-02-11 #i38810#
+ mbLinksUpdated( sal_False ),
+ mbClipBoard( false ),
+ mbColumnSelection( false ),
+ // i#78591#
+ mbProtectForm(false),
+ mbLastBrowseMode( false ),
+ n32DummyCompatabilityOptions1(0),
+ n32DummyCompatabilityOptions2(0),
+ mbStartIdleTimer(sal_False)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::SwDoc" );
+
+ mbGlossDoc =
+ mbModified =
+ mbDtor =
+ mbPageNums =
+ mbLoaded =
+ mbUpdateExpFld =
+ mbNewDoc =
+ mbCopyIsMove =
+ mbInReading =
+ mbInXMLImport =
+ mbUpdateTOX =
+ mbInLoadAsynchron =
+ mbHTMLMode =
+ mbInCallModified =
+ mbIsGlobalDoc =
+ mbGlblDocSaveLinks =
+ mbIsLabelDoc =
+ mbIsAutoFmtRedline =
+ mbOLEPrtNotifyPending =
+ mbAllOLENotify =
+ mbIsRedlineMove =
+ mbInsOnlyTxtGlssry =
+ mbContains_MSVBasic =
+ mbKernAsianPunctuation =
+#ifdef DBG_UTIL
+ mbXMLExport =
+#endif
+ // --> OD 2006-03-21 #b6375613#
+ mbApplyWorkaroundForB6375613 =
+ // <--
+ false;
+
+ 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;
+ mbParaSpaceMax = aOptions.IsAddSpacing();
+ mbParaSpaceMaxAtPages = aOptions.IsAddSpacingAtPages();
+ mbTabCompat = !aOptions.IsUseOurTabStops();
+ mbUseVirtualDevice = !aOptions.IsUsePrtDevice();
+ mbAddExternalLeading = !aOptions.IsNoExtLeading();
+ mbOldLineSpacing = aOptions.IsUseLineSpacing();
+ mbAddParaSpacingToTableCells = aOptions.IsAddTableSpacing();
+ mbUseFormerObjectPos = aOptions.IsUseObjectPositioning();
+ mbUseFormerTextWrapping = aOptions.IsUseOurTextWrapping();
+ mbConsiderWrapOnObjPos = aOptions.IsConsiderWrappingStyle();
+ mbMathBaselineAlignment = false; // default for *old* documents is 'off'
+ mbAddFlyOffsets = false; // hidden
+ mbOldNumbering = false; // hidden
+ mbUseHiResolutionVirtualDevice = true; // hidden
+ mbIgnoreFirstLineIndentInNumbering = false; // hidden
+ mbDoNotJustifyLinesWithManualBreak = !aOptions.IsExpandWordSpace();
+ mbDoNotResetParaAttrsForNumFont = false; // hidden
+ mbOutlineLevelYieldsOutlineRule = false; // hidden
+ mbTableRowKeep = false; // hidden
+ mbIgnoreTabsAndBlanksForLineCalculation = false; // hidden
+ mbDoNotCaptureDrawObjsOnPage = false; // hidden
+ mbClipAsCharacterAnchoredWriterFlyFrames= false; // hidden
+ mbUnixForceZeroExtLeading = false; // hidden
+ mbOldPrinterMetrics = false; // hidden
+ mbTabRelativeToIndent = true; // hidden
+ // --> OD 2008-06-05 #i89181#
+ mbTabAtLeftIndentForParagraphsInList = false; // hidden
+ // <--
+
+ //
+ // COMPATIBILITY FLAGS END
+ //
+
+ pMacroTable = new SvxMacroTableDtor;
+
+ mpGrammarContact = ::createGrammarContact();
+
+ /*
+ * Defaultformate und DefaultFormatsammlungen (FmtColl)
+ * werden an der Position 0 in das jeweilige Array eingetragen.
+ * Die Formate der FmtColls sind von den Defaultformaten
+ * abgeleitet und stehen auch in der Liste.
+ */
+ /* 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(GetUndoManager().GetUndoNodes().GetEndOfContent()),
+ pDfltTxtFmtColl );
+ new SwTxtNode( SwNodeIndex( GetNodes().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
+ InitTOXTypes();
+
+ // --> OD 2008-03-07 #refactorlists#
+ // pass empty item set containing the paragraph's list attributes
+ // as ignorable items to the stype manager.
+ {
+ SfxItemSet aIgnorableParagraphItems( GetAttrPool(),
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ 0 );
+ pStyleAccess = createStyleManager( &aIgnorableParagraphItems );
+ }
+ // <--
+
+ ResetModified();
+}
+
+/*
+ * Besonderheiten: an der Position 0 des Arrays der Formate und
+ * der GDI-Objekte befindet sich ein Member der Klasse SwDoc.
+ * Dieser darf also keinesfalls durch delete geloescht
+ * werden!!!!!!!!!!
+ */
+
+
+SwDoc::~SwDoc()
+{
+ // nothing here should create Undo actions!
+ GetIDocumentUndoRedo().DoUndo(false);
+
+ if (pDocShell)
+ {
+ pDocShell->SetUndoManager(0);
+ }
+
+ // --> OD 2007-03-16 #i73788#
+ SwPauseThreadStarting aPauseThreadStarting;
+ // <--
+
+ // --> OD 2007-11-01 #i83479#
+ delete mpListItemsList;
+ mpListItemsList = 0;
+ // <--
+
+ // clean up chart related structures...
+ // Note: the chart data provider gets already diposed in ~SwDocShell
+ // since all UNO API related functionality requires an existing SwDocShell
+ // this assures that dipose gets called if there is need for it.
+ aChartDataProviderImplRef.reset();
+ delete pChartControllerHelper;
+
+ delete mpGrammarContact;
+ mpGrammarContact = 0;
+
+ //!! needs to be done to destroy a possible SwFmtDrop format that may
+ //!! be connected to a char format which may not otherwise be removed
+ //!! and thus would leave a unremoved SwFmt object. (TL)
+ //!! (this is case is not possible via UI but via API...)
+ SwFmtDrop aDrop;
+ SetDefault(aDrop);
+ //!! same for SwFmtCharFmt
+ SwFmtCharFmt aCharFmt(NULL);
+ SetDefault(aCharFmt);
+
+ StopIdling(); // stop idle timer
+
+ delete pUnoCallBack, pUnoCallBack = 0;
+ delete pURLStateChgd;
+
+ delete pLayouter;
+ // --> OD 2005-09-05 #125370#
+ pLayouter = 0L;
+ // <--
+
+ // Undo-Benachrichtigung vom Draw abschalten
+ if( pDrawModel )
+ {
+ DrawNotifyUndoHdl();
+ ClrContourCache();
+ }
+
+ delete pPgPViewPrtData;
+
+ mbDtor = sal_True;
+
+ delete pRedlineTbl;
+ delete pUnoCrsrTbl;
+ delete pAutoFmtRedlnComment;
+
+ if( pUpdtFlds )
+ delete pUpdtFlds;
+
+ if( pACEWord )
+ delete pACEWord;
+
+ // die BaseLinks freigeben.
+ {
+ for( sal_uInt16 n = pLinkMgr->GetServers().Count(); n; )
+ pLinkMgr->GetServers()[ --n ]->Closed();
+
+ if( pLinkMgr->GetLinks().Count() )
+ pLinkMgr->Remove( 0, pLinkMgr->GetLinks().Count() );
+ }
+
+ // die KapitelNummern / Nummern muessen vor den Vorlage geloescht werden
+ // ansonsten wird noch staendig geupdatet !!!
+ m_pNodes->pOutlineNds->Remove(sal_uInt16(0), m_pNodes->pOutlineNds->Count());
+ SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() );
+ rUndoNodes.pOutlineNds->Remove(sal_uInt16(0), rUndoNodes.pOutlineNds->Count());
+
+ pFtnIdxs->Remove( sal_uInt16(0), pFtnIdxs->Count() );
+
+ // indices could be registered in attributes
+ m_pUndoManager->DelAllUndoObj();
+
+ // in den BookMarks sind Indizies auf den Content. Diese muessen vorm
+ // loesche der Nodes geloescht werden.
+ pMarkManager->clearAllMarks();
+ DELETEZ( pMacroTable );
+
+ if( pExtInputRing )
+ {
+ Ring* pTmp = pExtInputRing;
+ pExtInputRing = 0;
+ while( pTmp->GetNext() != pTmp )
+ delete pTmp->GetNext();
+ delete pTmp;
+ }
+
+//JP: alt - loeschen ohne Flag ist teuer; Modify wird verschickt!
+// aTOXTypes.DeleteAndDestroy( 0, aTOXTypes.Count() );
+ {
+ for( sal_uInt16 n = pTOXTypes->Count(); n; )
+ {
+ (*pTOXTypes)[ --n ]->SetInDocDTOR();
+ delete (*pTOXTypes)[ n ];
+ }
+ pTOXTypes->Remove( 0, pTOXTypes->Count() );
+ }
+ delete pDefTOXBases;
+
+ //Im einen oder anderen FrmFormat koennen noch Indizes angemeldet sein,
+ //Diese muessen spaetestens jetzt zerstoert werden.
+ pFrmFmtTbl->ForEach( &lcl_DelFmtIndizes, this );
+ pSpzFrmFmtTbl->ForEach( &lcl_DelFmtIndizes, this );
+ ((SwFrmFmts&)*pSectionFmtTbl).ForEach( &lcl_DelFmtIndizes, this );
+
+ //Die Formate, die hier hinter stehen sind von den DefaultFormaten
+ //abhaengig. Erst nach dem Loeschen der FmtIndizes weil der Inhalt von
+ //Kopf-/Fussbereichen geloescht wird. Wenn dort noch Indizes von Flys
+ //angemeldet sind gibts was an die Ohren.
+ aPageDescs.DeleteAndDestroy( 0, aPageDescs.Count() );
+
+ // Inhaltssections loeschen
+ // nicht erst durch den SwNodes-DTOR, damit Formate
+ // keine Abhaengigen mehr haben.
+ m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() );
+ rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
+
+ // Formate loeschen, spaeter mal permanent machen.
+
+ // Delete fuer Collections
+ // damit die Abhaengigen wech sind
+ pFtnInfo->ReleaseCollection();
+ pEndNoteInfo->ReleaseCollection();
+
+ ASSERT( pDfltTxtFmtColl == (*pTxtFmtCollTbl)[0],
+ "Default-Text-Collection muss immer am Anfang stehen" );
+
+ // JP 27.01.98: opt.: ausgehend davon, das Standard als 2. im Array
+ // steht, sollte das als letztes geloescht werden, damit
+ // die ganze Umhaengerei der Formate vermieden wird!
+ if( 2 < pTxtFmtCollTbl->Count() )
+ pTxtFmtCollTbl->DeleteAndDestroy( 2, pTxtFmtCollTbl->Count()-2 );
+ pTxtFmtCollTbl->DeleteAndDestroy( 1, pTxtFmtCollTbl->Count()-1 );
+ delete pTxtFmtCollTbl;
+
+ ASSERT( pDfltGrfFmtColl == (*pGrfFmtCollTbl)[0],
+ "Default-Grf-Collection muss immer am Anfang stehen" );
+
+ pGrfFmtCollTbl->DeleteAndDestroy( 1, pGrfFmtCollTbl->Count()-1 );
+// ergibt sich automatisch - kein _DEL Array!
+// pGrfFmtCollTbl->Remove( 0, n );
+ delete pGrfFmtCollTbl;
+
+ /*
+ * Defaultformate und DefaultFormatsammlungen (FmtColl)
+ * sind an der Position 0 der jeweiligen Arrays eingetragen.
+ * Damit sie nicht vom DTOR der Array's zum 2.mal geloescht werden,
+ * nehme sie aus dem Array.
+ */
+ pFrmFmtTbl->Remove( 0 );
+ pCharFmtTbl->Remove( 0 );
+
+ // Delete fuer pPrt
+ DELETEZ( pPrt );
+ DELETEZ( pNewDBMgr );
+
+ // Alle Flys muessen vor dem Drawing Model zerstoert werden,
+ // da Flys noch DrawContacts enthalten koennen, wenn wegen
+ // eines Lesefehlers kein Layout aufgebaut wurde.
+ pSpzFrmFmtTbl->DeleteAndDestroy( 0, pSpzFrmFmtTbl->Count() );
+
+ //Erst jetzt das Model zerstoeren, die Zeichenobjekte - die ja auch
+ //im Undo herumlungern - wollen noch ihre Attribute beim Model entfernen.
+ //Ausserdem koennen vorher noch DrawContacts existieren.
+ ReleaseDrawModel();
+ //JP 28.01.99: DrawModel vorm LinkManager zerstoeren, da am DrawModel
+ // dieser immer gesetzt ist.
+ DELETEZ( pLinkMgr );
+
+ //Tables vor dem loeschen der Defaults leeren, sonst GPF wegen Def-Abhaengigen.
+ //Die Arrays sollten (wegen includes) bei Gelegenheit auch zu Pointern werden.
+ delete pFrmFmtTbl;
+ delete pSpzFrmFmtTbl;
+
+ delete pStyleAccess;
+
+ delete pCharFmtTbl;
+ delete pSectionFmtTbl;
+ delete pTblFrmFmtTbl;
+ delete pDfltTxtFmtColl;
+ delete pDfltGrfFmtColl;
+ delete pNumRuleTbl;
+
+ // --> OD 2008-03-26 #refactorlists#
+ {
+ for ( std::hash_map< String, SwList*, StringHash >::iterator
+ aListIter = maLists.begin();
+ aListIter != maLists.end();
+ ++aListIter )
+ {
+ delete (*aListIter).second;
+ }
+ maLists.clear();
+ }
+ maListStyleLists.clear();
+ // <--
+
+ delete pPrtData;
+ delete pNumberFormatter;
+ delete pFtnInfo;
+ delete pEndNoteInfo;
+ delete pLineNumberInfo;
+ delete pFtnIdxs;
+ delete pFldTypes;
+ delete pTOXTypes;
+ delete pDocStat;
+ delete pEmptyPageFmt;
+ delete pColumnContFmt;
+ delete pDfltCharFmt;
+ delete pDfltFrmFmt;
+ delete pLayoutCache;
+ delete pVirDev;
+
+ SfxItemPool::Free(mpAttrPool);
+}
+
+//---------------------------------------------------
+
+VirtualDevice& SwDoc::CreateVirtualDevice_() const
+{
+ VirtualDevice* pNewVir = new VirtualDevice( 1 );
+
+ // <--
+ pNewVir->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
+
+ // --> FME 2006-10-09 #i60945# External leading compatibility for unix systems.
+ if ( get(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING ) )
+ pNewVir->Compat_ZeroExtleadBug();
+ // <--
+
+ MapMode aMapMode( pNewVir->GetMapMode() );
+ aMapMode.SetMapUnit( MAP_TWIP );
+ pNewVir->SetMapMode( aMapMode );
+
+ const_cast<SwDoc*>(this)->setVirtualDevice( pNewVir, true, true );
+ return *pVirDev;
+}
+
+//---------------------------------------------------
+
+SfxPrinter& SwDoc::CreatePrinter_() const
+{
+ ASSERT( ! pPrt, "Do not call CreatePrinter_(), call getPrinter() instead" )
+
+#if OSL_DEBUG_LEVEL > 1
+ ASSERT( false, "Printer will be created!" )
+#endif
+
+ // wir erzeugen einen default SfxPrinter.
+ // Das ItemSet wird vom Sfx geloescht!
+ SfxItemSet *pSet = new SfxItemSet( ((SwDoc*)this)->GetAttrPool(),
+ FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
+ SID_HTML_MODE, SID_HTML_MODE,
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ 0 );
+
+ SfxPrinter* pNewPrt = new SfxPrinter( pSet );
+ const_cast<SwDoc*>(this)->setPrinter( pNewPrt, true, true );
+ return *pPrt;
+}
+//---------------------------------------------------
+
+void SwDoc::SetDocShell( SwDocShell* pDSh )
+{
+ if( pDocShell != pDSh )
+ {
+ if (pDocShell)
+ {
+ pDocShell->SetUndoManager(0);
+ }
+ pDocShell = pDSh;
+ if (pDocShell)
+ {
+ pDocShell->SetUndoManager(& GetUndoManager());
+ }
+
+ pLinkMgr->SetPersist( pDocShell );
+ //JP 27.08.98: Bug 55570 - DocShell Pointer auch am DrawModel setzen
+ if( pDrawModel )
+ {
+ ((SwDrawDocument*)pDrawModel)->SetObjectShell( pDocShell );
+ pDrawModel->SetPersist( pDocShell );
+ ASSERT( pDrawModel->GetPersist() == GetPersist(),
+ "draw model's persist is out of sync" );
+ }
+ }
+}
+
+
+// Convenience-Methode, um uebermaessige Includes von docsh.hxx
+// zu vermeiden
+
+
+
+uno::Reference < embed::XStorage > SwDoc::GetDocStorage()
+{
+ if( pDocShell )
+ return pDocShell->GetStorage();
+ if( pLinkMgr->GetPersist() )
+ return pLinkMgr->GetPersist()->GetStorage();
+ return NULL;
+}
+
+
+
+SfxObjectShell* SwDoc::GetPersist() const
+{
+ return pDocShell ? pDocShell : pLinkMgr->GetPersist();
+}
+
+
+void SwDoc::ClearDoc()
+{
+ GetIDocumentUndoRedo().DelAllUndoObj();
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ // Undo-Benachrichtigung vom Draw abschalten
+ if( pDrawModel )
+ {
+ DrawNotifyUndoHdl();
+ ClrContourCache();
+ }
+
+ // stehen noch FlyFrames rum, loesche auch diese
+ sal_uInt16 n;
+ while ( 0 != (n = GetSpzFrmFmts()->Count()) )
+ DelLayoutFmt((*pSpzFrmFmtTbl)[n-1]);
+ ASSERT( !pDrawModel || !pDrawModel->GetPage(0)->GetObjCount(),
+ "not all DrawObjects removed from the page" );
+
+ pRedlineTbl->DeleteAndDestroy( 0, pRedlineTbl->Count() );
+
+ if( pACEWord )
+ delete pACEWord;
+
+ // in den BookMarks sind Indizies auf den Content. Diese muessen vorm
+ // loesche der Nodes geloescht werden.
+ pMarkManager->clearAllMarks();
+ InitTOXTypes();
+
+ // create a dummy pagedesc for the layout
+ sal_uInt16 nDummyPgDsc = MakePageDesc( String::CreateFromAscii( "?DUMMY?" ));
+ SwPageDesc* pDummyPgDsc = aPageDescs[ nDummyPgDsc ];
+
+ SwNodeIndex aSttIdx( *GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
+ // den ersten immer wieder neu anlegen (ohne Attribute/Vorlagen/...)
+ SwTxtNode* pFirstNd = GetNodes().MakeTxtNode( aSttIdx, pDfltTxtFmtColl );
+
+ if( pCurrentView ) //swmod 071029//swmod 071225
+ {
+ // set the layout to the dummy pagedesc
+ pFirstNd->SetAttr( SwFmtPageDesc( pDummyPgDsc ));
+
+ SwPosition aPos( *pFirstNd, SwIndex( pFirstNd ));
+ SwPaM const tmpPaM(aSttIdx, SwNodeIndex(GetNodes().GetEndOfContent()));
+ ::PaMCorrAbs(tmpPaM, aPos);
+ }
+
+ GetNodes().Delete( aSttIdx,
+ GetNodes().GetEndOfContent().GetIndex() - aSttIdx.GetIndex() );
+
+ // --> OD 2006-02-28 #i62440#
+ // destruction of numbering rules and creation of new outline rule
+ // *after* the document nodes are deleted.
+ pOutlineRule = NULL;
+ pNumRuleTbl->DeleteAndDestroy( 0, pNumRuleTbl->Count() );
+ // creation of new outline numbering rule
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ pOutlineRule = new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ),
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode(),
+ // <--
+ OUTLINE_RULE );
+ // <--
+ AddNumRule(pOutlineRule);
+ // --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()>
+ pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) );
+ // <--
+ // <--
+
+ //remove the dummy pagedec from the array and delete all the old ones
+ aPageDescs.Remove( nDummyPgDsc );
+ aPageDescs.DeleteAndDestroy( 0, aPageDescs.Count() );
+
+ // Delete fuer Collections
+ // damit die Abhaengigen wech sind
+ pFtnInfo->ReleaseCollection();
+ pEndNoteInfo->ReleaseCollection();
+
+ // JP 27.01.98: opt.: ausgehend davon, das Standard als 2. im Array
+ // steht, sollte das als letztes geloescht werden, damit
+ // die ganze Umhaengerei der Formate vermieden wird!
+ if( 2 < pTxtFmtCollTbl->Count() )
+ pTxtFmtCollTbl->DeleteAndDestroy( 2, pTxtFmtCollTbl->Count()-2 );
+ pTxtFmtCollTbl->DeleteAndDestroy( 1, pTxtFmtCollTbl->Count()-1 );
+ pGrfFmtCollTbl->DeleteAndDestroy( 1, pGrfFmtCollTbl->Count()-1 );
+ pCharFmtTbl->DeleteAndDestroy( 1, pCharFmtTbl->Count()-1 );
+
+ if( pCurrentView )
+ {
+ // search the FrameFormat of the root frm. This is not allowed to delete
+ pFrmFmtTbl->Remove( pFrmFmtTbl->GetPos( pCurrentView->GetLayout()->GetFmt() ) );
+ pFrmFmtTbl->DeleteAndDestroy( 1, pFrmFmtTbl->Count()-1 );
+ pFrmFmtTbl->Insert( pCurrentView->GetLayout()->GetFmt(), pFrmFmtTbl->Count() );
+ }
+ else //swmod 071029//swmod 071225
+ pFrmFmtTbl->DeleteAndDestroy( 1, pFrmFmtTbl->Count()-1 );
+
+ xForbiddenCharsTable.unbind();
+
+ pFldTypes->DeleteAndDestroy( INIT_FLDTYPES,
+ pFldTypes->Count() - INIT_FLDTYPES );
+
+ delete pNumberFormatter, pNumberFormatter = 0;
+
+ GetPageDescFromPool( RES_POOLPAGE_STANDARD );
+ pFirstNd->ChgFmtColl( GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
+ nDummyPgDsc = aPageDescs.Count();
+ aPageDescs.Insert( pDummyPgDsc, nDummyPgDsc );
+ // set the layout back to the new standard pagedesc
+ pFirstNd->ResetAllAttr();
+ // delete now the dummy pagedesc
+ DelPageDesc( nDummyPgDsc );
+}
+
+void SwDoc::SetPreViewPrtData( const SwPagePreViewPrtData* pNew )
+{
+ if( pNew )
+ {
+ if( pPgPViewPrtData )
+ *pPgPViewPrtData = *pNew;
+ else
+ pPgPViewPrtData = new SwPagePreViewPrtData( *pNew );
+ }
+ else if( pPgPViewPrtData )
+ DELETEZ( pPgPViewPrtData );
+ SetModified();
+}
+/* -----------------------------06.01.00 14:03--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwModify* SwDoc::GetUnoCallBack() const
+{
+ return pUnoCallBack;
+}
+
+/*-----------------28.5.2001 10:06------------------
+ * SwDoc:
+ * Reading and writing of the layout cache.
+ *--------------------------------------------------*/
+
+void SwDoc::ReadLayoutCache( SvStream& rStream )
+{
+ if( !pLayoutCache )
+ pLayoutCache = new SwLayoutCache();
+ if( !pLayoutCache->IsLocked() )
+ {
+ pLayoutCache->GetLockCount() |= 0x8000;
+ pLayoutCache->Read( rStream );
+ pLayoutCache->GetLockCount() &= 0x7fff;
+ }
+}
+
+void SwDoc::WriteLayoutCache( SvStream& rStream )
+{
+ pLayoutCache->Write( rStream, *this );
+}
+
+IGrammarContact* getGrammarContact( const SwTxtNode& rTxtNode )
+{
+ const SwDoc* pDoc = rTxtNode.GetDoc();
+ if( !pDoc || pDoc->IsInDtor() )
+ return 0;
+ return pDoc->getGrammarContact();
+}
+
+// --> FME 2005-02-25 #i42634# Moved common code of SwReader::Read() and
+// SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks():
+void SwDoc::UpdateLinks( sal_Bool bUI )
+{
+ SfxObjectCreateMode eMode;
+ sal_uInt16 nLinkMode = getLinkUpdateMode( true );
+ sal_uInt16 nUpdateDocMode = GetDocShell()->GetUpdateDocMode();
+ if( GetDocShell() &&
+ (nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) &&
+ GetLinkManager().GetLinks().Count() &&
+ SFX_CREATE_MODE_INTERNAL !=
+ ( eMode = GetDocShell()->GetCreateMode()) &&
+ SFX_CREATE_MODE_ORGANIZER != eMode &&
+ SFX_CREATE_MODE_PREVIEW != eMode &&
+ !GetDocShell()->IsPreview() )
+ {
+ ViewShell* pVSh = 0;
+ sal_Bool bAskUpdate = nLinkMode == MANUAL;
+ sal_Bool bUpdate = sal_True;
+ switch(nUpdateDocMode)
+ {
+ case document::UpdateDocMode::NO_UPDATE: bUpdate = sal_False;break;
+ case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = sal_False; break;
+ case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = sal_True; break;
+ }
+ if( bUpdate && (bUI || !bAskUpdate) )
+ {
+ SfxMedium* pMedium = GetDocShell()->GetMedium();
+ SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0;
+ Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0;
+ if( GetCurrentViewShell() && !GetEditShell( &pVSh ) && !pVSh ) //swmod 071108//swmod 071225
+ {
+ ViewShell aVSh( *this, 0, 0 );
+
+ SET_CURR_SHELL( &aVSh );
+ GetLinkManager().UpdateAllLinks( bAskUpdate , sal_True, sal_False, pDlgParent );
+ }
+ else
+ GetLinkManager().UpdateAllLinks( bAskUpdate, sal_True, sal_False, pDlgParent );
+ }
+ }
+
+}
+// <--
+// --> OD 2006-04-19 #b6375613#
+void SwDoc::SetApplyWorkaroundForB6375613( bool p_bApplyWorkaroundForB6375613 )
+{
+ if ( mbApplyWorkaroundForB6375613 != p_bApplyWorkaroundForB6375613 )
+ {
+ mbApplyWorkaroundForB6375613 = p_bApplyWorkaroundForB6375613;
+
+ uno::Reference< document::XDocumentInfoSupplier > xDoc(
+ GetDocShell()->GetBaseModel(),
+ uno::UNO_QUERY);
+ if ( xDoc.is() )
+ {
+ uno::Reference< beans::XPropertyContainer > xDocInfo(
+ xDoc->getDocumentInfo(),
+ uno::UNO_QUERY );
+ if ( xDocInfo.is() )
+ {
+ try
+ {
+ if ( mbApplyWorkaroundForB6375613 )
+ {
+ xDocInfo->addProperty(
+ rtl::OUString::createFromAscii("WorkaroundForB6375613Applied"),
+ beans::PropertyAttribute::TRANSIENT | beans::PropertyAttribute::REMOVABLE,
+ uno::makeAny( false ) );
+ }
+ else
+ {
+ xDocInfo->removeProperty( rtl::OUString::createFromAscii("WorkaroundForB6375613Applied") );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+}
+// <--
+
+::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;
+}
+
+::sw::MetaFieldManager &
+SwDoc::GetMetaFieldManager()
+{
+ return *m_pMetaFieldManager;
+}
+
+::sw::UndoManager &
+SwDoc::GetUndoManager()
+{
+ return *m_pUndoManager;
+}
+
+::sw::UndoManager const&
+SwDoc::GetUndoManager() const
+{
+ return *m_pUndoManager;
+}
+
+IDocumentUndoRedo &
+SwDoc::GetIDocumentUndoRedo()
+{
+ return *m_pUndoManager;
+}
+
+IDocumentUndoRedo const&
+SwDoc::GetIDocumentUndoRedo() const
+{
+ return *m_pUndoManager;
+}
+
+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---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
+{
+ SwDoc* pRet = new SwDoc;
+ //copy settings
+ sal_uInt16 __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 );
+
+ sal_uInt16 nWhich;
+ sal_uInt16 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 );
+
+ pRet->n32DummyCompatabilityOptions1 = n32DummyCompatabilityOptions1;
+ pRet->n32DummyCompatabilityOptions2 = n32DummyCompatabilityOptions2;
+ 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
+ //
+ pRet->ReplaceStyles( * const_cast< SwDoc*>( this ));
+
+ // we have to use pointer here, since the callee has to decide whether SfxObjectShellLock or SfxObjectShellRef should be used
+ // sometimes the object will be returned with refcount set to 0 ( if no DoInitNew is done )
+ SfxObjectShell* pRetShell = new SwDocShell( pRet, SFX_CREATE_MODE_STANDARD );
+ if( bCallInitNew )
+ {
+ // it could happen that DoInitNew creates model, that increases the refcount of the object
+ pRetShell->DoInitNew();
+ }
+
+ //copy content
+ pRet->Paste( *this );
+
+ // remove the temporary shell if it is there as it was done before
+ pRet->SetTmpDocShell( (SfxObjectShell*)NULL );
+
+ return pRetShell;
+}
+/*-- 08.05.2009 10:52:40---------------------------------------------------
+ copy document content - code from SwFEShell::Paste( SwDoc* , sal_Bool )
+ -----------------------------------------------------------------------*/
+void SwDoc::Paste( const SwDoc& rSource )
+{
+// this has to be empty const sal_uInt16 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->GetIDocumentUndoRedo().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.CopyRange( aCpyPam, rInsPos, true );
+
+ {
+ aIndexBefore++;
+ SwPaM aPaM(SwPosition(aIndexBefore),
+ SwPosition(rInsPos.nNode));
+
+ 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 ( sal_uInt16 i = 0; i < rSource.GetSpzFrmFmts()->Count(); ++i )
+ {
+ sal_Bool bInsWithFmt = sal_True;
+ const SwFrmFmt& rCpyFmt = *(*rSource.GetSpzFrmFmts())[i];
+ if( bInsWithFmt )
+ {
+ SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
+ if (FLY_AT_PAGE == aAnchor.GetAnchorId())
+ {
+ aAnchor.SetPageNum( aAnchor.GetPageNum() /*+ nStartPageNumber - */);
+ }
+ else
+ continue;
+ this->CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
+ }
+ }
+ }
+ }
+
+ this->GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL );
+
+ UnlockExpFlds();
+ UpdateFlds(NULL, false);
+}
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
new file mode 100644
index 000000000000..72e1010da86c
--- /dev/null
+++ b/sw/source/core/doc/docnum.cxx
@@ -0,0 +1,2953 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <tools/resid.hxx>
+#include <editeng/lrspitem.hxx>
+#include <ftninfo.hxx>
+#include <ftnidx.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <doctxm.hxx> // pTOXBaseRing
+#include <poolfmt.hxx>
+#include <UndoCore.hxx>
+#include <UndoRedline.hxx>
+#include <UndoNumbering.hxx>
+#include <swundo.hxx>
+#include <SwUndoFmt.hxx>
+#include <rolbck.hxx>
+#include <paratr.hxx>
+#include <docary.hxx>
+#include <mvsave.hxx>
+#include <txtfrm.hxx>
+#include <pamtyp.hxx>
+#include <redline.hxx>
+#include <comcore.hrc>
+#include <editeng/adjitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <frmatr.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <SwNodeNum.hxx>
+#include <list.hxx>
+#include <listfunc.hxx>
+#include <switerator.hxx>
+
+#include <map>
+
+inline sal_uInt8 GetUpperLvlChg( sal_uInt8 nCurLvl, sal_uInt8 nLevel, sal_uInt16 nMask )
+{
+ if( 1 < nLevel )
+ {
+ if( nCurLvl + 1 >= nLevel )
+ nCurLvl -= nLevel - 1;
+ else
+ nCurLvl = 0;
+ }
+ return static_cast<sal_uInt8>((nMask - 1) & ~(( 1 << nCurLvl ) - 1));
+}
+
+void SwDoc::SetOutlineNumRule( const SwNumRule& rRule )
+{
+ if( pOutlineRule )
+ (*pOutlineRule) = rRule;
+ else
+ {
+ pOutlineRule = new SwNumRule( rRule );
+
+ AddNumRule(pOutlineRule); // #i36749#
+ }
+
+ pOutlineRule->SetRuleType( OUTLINE_RULE );
+ // --> OD 2008-07-08 #i91400#
+ pOutlineRule->SetName( String::CreateFromAscii(
+ SwNumRule::GetOutlineRuleName() ),
+ *this);
+ // <--
+ // --> OD 2006-09-21 #i69522#
+ // assure that the outline numbering rule is an automatic rule
+ pOutlineRule->SetAutoRule( sal_True );
+ // <--
+
+ // teste ob die evt. gesetzen CharFormate in diesem Document
+ // definiert sind
+ pOutlineRule->CheckCharFmts( this );
+
+ // --> OD 2008-05-13 #refactorlists#
+ // notify text nodes, which are registered at the outline style, about the
+ // changed outline style
+ SwNumRule::tTxtNodeList aTxtNodeList;
+ pOutlineRule->GetTxtNodeList( aTxtNodeList );
+ for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin();
+ aIter != aTxtNodeList.end(); ++aIter )
+ {
+ SwTxtNode* pTxtNd = *aIter;
+ pTxtNd->NumRuleChgd();
+ // --> OD 2009-01-20 #i94152#
+ // assure that list level corresponds to outline level
+ if ( pTxtNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle() &&
+ pTxtNd->GetAttrListLevel() != pTxtNd->GetTxtColl()->GetAssignedOutlineStyleLevel() )
+ {
+ pTxtNd->SetAttrListLevel( pTxtNd->GetTxtColl()->GetAssignedOutlineStyleLevel() );
+ }
+ // <--
+ }
+ // <--
+
+ PropagateOutlineRule();
+ pOutlineRule->SetInvalidRule(sal_True);
+ UpdateNumRule();
+
+ // gibt es Fussnoten && gilt Kapitelweises Nummerieren, dann updaten
+ if( GetFtnIdxs().Count() && FTNNUM_CHAPTER == GetFtnInfo().eNum )
+ GetFtnIdxs().UpdateAllFtn();
+
+ UpdateExpFlds(NULL, true);
+
+ SetModified();
+}
+
+void SwDoc::PropagateOutlineRule()
+{
+ for (sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); n++)
+ {
+ SwTxtFmtColl *pColl = (*pTxtFmtCollTbl)[n];
+
+ // if (NO_NUMBERING != pColl->GetOutlineLevel())//#outline level,zhaojianwei
+ if(pColl->IsAssignedToListLevelOfOutlineStyle())//<-end,zhaojianwei
+ {
+ // --> OD 2006-11-20 #i71764#
+ // Check only the list style, which is set at the paragraph style
+ const SwNumRuleItem & rCollRuleItem = pColl->GetNumRule( sal_False );
+ // <--
+
+ // --> OD 2006-11-20 #i71764#
+ // Check on document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE no longer needed.
+ if ( rCollRuleItem.GetValue().Len() == 0 )
+ // <--
+ {
+ SwNumRule * pMyOutlineRule = GetOutlineNumRule();
+
+ if (pMyOutlineRule)
+ {
+ SwNumRuleItem aNumItem( pMyOutlineRule->GetName() );
+
+ pColl->SetFmtAttr(aNumItem);
+ }
+ }
+ }
+ }
+}
+
+ // Hoch-/Runterstufen
+sal_Bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset )
+{
+ if( !GetNodes().GetOutLineNds().Count() || !nOffset )
+ return sal_False;
+
+ // den Bereich feststellen
+ const SwOutlineNodes& rOutlNds = GetNodes().GetOutLineNds();
+ const SwNodePtr pSttNd = (SwNodePtr)&rPam.Start()->nNode.GetNode();
+ const SwNodePtr pEndNd = (SwNodePtr)&rPam.End()->nNode.GetNode();
+ sal_uInt16 nSttPos, nEndPos;
+
+ if( !rOutlNds.Seek_Entry( pSttNd, &nSttPos ) &&
+ !nSttPos-- )
+ // wir stehen in keiner "Outline-Section"
+ return sal_False;
+
+ if( rOutlNds.Seek_Entry( pEndNd, &nEndPos ) )
+ ++nEndPos;
+
+ // jetzt haben wir unseren Bereich im OutlineNodes-Array
+ // dann prufe ersmal, ob nicht unterebenen aufgehoben werden
+ // (Stufung ueber die Grenzen)
+ sal_uInt16 n;
+
+ // so, dann koennen wir:
+ // 1. Vorlagen-Array anlegen
+ SwTxtFmtColl* aCollArr[ MAXLEVEL ];
+ memset( aCollArr, 0, sizeof( SwTxtFmtColl* ) * MAXLEVEL );
+
+ for( n = 0; n < pTxtFmtCollTbl->Count(); ++n )
+ {
+ //sal_uInt8 nLevel = (*pTxtFmtCollTbl)[ n ]->GetOutlineLevel();//#outline level,zhaojianwei
+ //if( nLevel < MAXLEVEL )
+ // aCollArr[ nLevel ] = (*pTxtFmtCollTbl)[ n ];
+ if((*pTxtFmtCollTbl)[ n ]->IsAssignedToListLevelOfOutlineStyle())
+ {
+ const int nLevel = (*pTxtFmtCollTbl)[ n ]->GetAssignedOutlineStyleLevel();
+ aCollArr[ nLevel ] = (*pTxtFmtCollTbl)[ n ];
+ }//<-end,zhaojianwei
+ }
+
+ /* --> #111107# */
+ /* Find the last occupied level (backward). */
+ for (n = MAXLEVEL - 1; n > 0; n--)
+ {
+ if (aCollArr[n] != 0)
+ break;
+ }
+
+ /* If an occupied level is found, choose next level (which IS
+ unoccupied) until a valid level is found. If no occupied level
+ was found n is 0 and aCollArr[0] is 0. In this case no demoting
+ is possible. */
+ if (aCollArr[n] != 0)
+ {
+ while (n < MAXLEVEL - 1)
+ {
+ n++;
+
+ SwTxtFmtColl *aTmpColl =
+ GetTxtCollFromPool(static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n));
+
+ //if (aTmpColl->GetOutlineLevel() == n)//#outline level,zhaojianwei
+ if( aTmpColl->IsAssignedToListLevelOfOutlineStyle() &&
+ aTmpColl->GetAssignedOutlineStyleLevel() == n )//<-end,zhaojianwei
+ {
+ aCollArr[n] = aTmpColl;
+ break;
+ }
+ }
+ }
+
+ /* Find the first occupied level (forward). */
+ for (n = 0; n < MAXLEVEL - 1; n++)
+ {
+ if (aCollArr[n] != 0)
+ break;
+ }
+
+ /* If an occupied level is found, choose previous level (which IS
+ unoccupied) until a valid level is found. If no occupied level
+ was found n is MAXLEVEL - 1 and aCollArr[MAXLEVEL - 1] is 0. In
+ this case no demoting is possible. */
+ if (aCollArr[n] != 0)
+ {
+ while (n > 0)
+ {
+ n--;
+
+ SwTxtFmtColl *aTmpColl =
+ GetTxtCollFromPool(static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n));
+
+ //if (aTmpColl->GetOutlineLevel() == n)//#outline level,zhaojianwei
+ if( aTmpColl->IsAssignedToListLevelOfOutlineStyle() &&
+ aTmpColl->GetAssignedOutlineStyleLevel() == n )//<-end,zhaojianwei
+ {
+ aCollArr[n] = aTmpColl;
+ break;
+ }
+ }
+ }
+ /* <-- #111107# */
+
+ /* --> #i13747#
+
+ Build a move table that states from which level an outline will
+
+ be moved to which other level. */
+
+ /* the move table
+
+ aMoveArr[n] = m: replace aCollArr[n] with aCollArr[m]
+ */
+ int aMoveArr[MAXLEVEL];
+ int nStep; // step size for searching in aCollArr: -1 or 1
+ int nNum; // amount of steps for stepping in aCollArr
+
+ if (nOffset < 0)
+ {
+ nStep = -1;
+ nNum = -nOffset;
+ }
+ else
+ {
+ nStep = 1;
+ nNum = nOffset;
+ }
+
+ /* traverse aCollArr */
+ for (n = 0; n < MAXLEVEL; n++)
+ {
+ /* If outline level n has an assigned paragraph style step
+ nNum steps forwards (nStep == 1) or backwards (nStep ==
+ -1). One step is to go to the next non-null entry in
+ aCollArr in the selected direction. If nNum steps were
+ possible write the index of the entry found to aCollArr[n],
+ i.e. outline level n will be replaced by outline level
+ aCollArr[n].
+
+ If outline level n has no assigned paragraph style
+ aMoveArr[n] is set to -1.
+ */
+ if (aCollArr[n] != NULL)
+ {
+ sal_uInt16 m = n;
+ int nCount = nNum;
+
+ while (nCount > 0 && m + nStep >= 0 && m + nStep < MAXLEVEL)
+ {
+ m = static_cast<sal_uInt16>(m + nStep);
+
+ if (aCollArr[m] != NULL)
+ nCount--;
+ }
+
+ if (nCount == 0)
+ aMoveArr[n] = m;
+ else
+ aMoveArr[n] = -1;
+
+ }
+ else
+ aMoveArr[n] = -1;
+ }
+
+ /* If moving of the outline levels is applicable, i.e. for all
+ outline levels occuring in the document there has to be a valid
+ target outline level implied by aMoveArr. */
+ bool bMoveApplicable = true;
+ for (n = nSttPos; n < nEndPos; n++)
+ {
+ SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode();
+ SwTxtFmtColl* pColl = pTxtNd->GetTxtColl();
+// int nLevel = pColl->GetOutlineLevel();//#outline level,zhaojianwei
+// if (aMoveArr[nLevel] == -1)
+// bMoveApplicable = false;
+ if( pColl->IsAssignedToListLevelOfOutlineStyle() )
+ {
+ const int nLevel = pColl->GetAssignedOutlineStyleLevel();
+ if (aMoveArr[nLevel] == -1)
+ bMoveApplicable = false;
+ }//<-end,zhaojianwei
+ // --> OD 2008-12-16 #i70748#
+ // Check on outline level attribute of text node, if text node is
+ // not an outline via a to outline style assigned paragraph style.
+ else
+ {
+ const int nNewOutlineLevel = pTxtNd->GetAttrOutlineLevel() + nOffset;
+ if ( nNewOutlineLevel < 1 || nNewOutlineLevel > MAXLEVEL )
+ {
+ bMoveApplicable = false;
+ }
+ }
+ // <--
+ }
+
+ if (! bMoveApplicable )
+ return sal_False;
+
+ /* <-- #i13747 # */
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().StartUndo(UNDO_OUTLINE_LR, NULL);
+ SwUndo *const pUndoOLR( new SwUndoOutlineLeftRight( rPam, nOffset ) );
+ GetIDocumentUndoRedo().AppendUndo(pUndoOLR);
+ }
+
+ // 2. allen Nodes die neue Vorlage zuweisen
+
+ n = nSttPos;
+ while( n < nEndPos)
+ {
+ SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode();
+ SwTxtFmtColl* pColl = pTxtNd->GetTxtColl();
+
+ if( pColl->IsAssignedToListLevelOfOutlineStyle() )
+ {
+ // ASSERT(pColl->GetOutlineLevel() < MAXLEVEL, //#outline level,removed by zhaojianwei
+ // "non outline node in outline nodes?");
+ //int nLevel = pColl->GetOutlineLevel();
+ const int nLevel = pColl->GetAssignedOutlineStyleLevel();//#outline level,add by zhaojianwei
+
+ ASSERT(aMoveArr[nLevel] >= 0,
+ "move table: current TxtColl not found when building table!");
+
+
+ if (nLevel < MAXLEVEL && aMoveArr[nLevel] >= 0)
+ {
+ pColl = aCollArr[ aMoveArr[nLevel] ];
+
+ if (pColl != NULL)
+ pColl = (SwTxtFmtColl*)pTxtNd->ChgFmtColl( pColl );
+ }
+
+ }
+ else if( pTxtNd->GetAttrOutlineLevel() > 0) //#outline level,add by zhaojianwei
+ {
+ int nLevel = pTxtNd->GetAttrOutlineLevel() + nOffset;
+ if( 0 <= nLevel && nLevel <= MAXLEVEL)
+ pTxtNd->SetAttrOutlineLevel( nLevel );
+
+ }//<-end,zhaojianwei
+
+ n++;
+ // Undo ???
+ }
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().EndUndo(UNDO_OUTLINE_LR, NULL);
+ }
+
+ ChkCondColls();
+ SetModified();
+
+ return sal_True;
+}
+
+
+
+ // Hoch-/Runter - Verschieben !
+sal_Bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset )
+{
+ // kein Verschiebung in den Sonderbereichen
+ const SwPosition& rStt = *rPam.Start(),
+ & rEnd = &rStt == rPam.GetPoint() ? *rPam.GetMark()
+ : *rPam.GetPoint();
+ if( !GetNodes().GetOutLineNds().Count() || !nOffset ||
+ (rStt.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex()) ||
+ (rEnd.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex()))
+ {
+ return sal_False;
+ }
+
+ sal_uInt16 nAktPos = 0;
+ SwNodeIndex aSttRg( rStt.nNode ), aEndRg( rEnd.nNode );
+
+ //sal_uInt8 nOutLineLevel = NO_NUMBERING; //#outline level,zhaojianwei
+ int nOutLineLevel = MAXLEVEL; //<-end,zhaojianwei
+ SwNode* pSrch = &aSttRg.GetNode();
+ //if( pSrch->IsTxtNode() ) //#outline level,zhaojianwei
+ // nOutLineLevel = static_cast<sal_uInt8>(((SwTxtNode*)pSrch)->GetOutlineLevel());
+ if( pSrch->IsTxtNode())
+ nOutLineLevel = static_cast<sal_uInt8>(((SwTxtNode*)pSrch)->GetAttrOutlineLevel()-1);//<-end,zhaojianwei
+ SwNode* pEndSrch = &aEndRg.GetNode();
+ if( !GetNodes().GetOutLineNds().Seek_Entry( pSrch, &nAktPos ) )
+ {
+ if( !nAktPos )
+ return sal_False; // Promoting or demoting before the first outline => no.
+ if( --nAktPos )
+ aSttRg = *GetNodes().GetOutLineNds()[ nAktPos ];
+ else if( 0 > nOffset )
+ return sal_False; // Promoting at the top of document?!
+ else
+ aSttRg = *GetNodes().GetEndOfContent().StartOfSectionNode();
+ }
+ sal_uInt16 nTmpPos = 0;
+ // If the given range ends at an outlined text node we have to decide if it has to be a part of
+ // the moving range or not. Normally it will be a sub outline of our chapter
+ // and has to be moved, too. But if the chapter ends with a table(or a section end),
+ // the next text node will be choosen and this could be the next outline of the same level.
+ // The criteria has to be the outline level: sub level => incorporate, same/higher level => no.
+ if( GetNodes().GetOutLineNds().Seek_Entry( pEndSrch, &nTmpPos ) )
+ {
+ if( !pEndSrch->IsTxtNode() || pEndSrch == pSrch ||
+ //nOutLineLevel < ((SwTxtNode*)pEndSrch)->GetOutlineLevel() )//#outline level,zhaojianwei
+ nOutLineLevel < ((SwTxtNode*)pEndSrch)->GetAttrOutlineLevel()-1 )//<-end,zhaojianwei
+ ++nTmpPos; // For sub outlines only!
+ }
+
+ aEndRg = nTmpPos < GetNodes().GetOutLineNds().Count()
+ ? *GetNodes().GetOutLineNds()[ nTmpPos ]
+ : GetNodes().GetEndOfContent();
+ if( nOffset >= 0 )
+ nAktPos = nTmpPos;
+ if( aEndRg == aSttRg )
+ {
+ ASSERT( false, "Moving outlines: Surprising selection" );
+ aEndRg++;
+ }
+
+ const SwNode* pNd;
+ // The following code corrects the range to handle sections (start/end nodes)
+ // The range will be extended if the least node before the range is a start node
+ // which ends inside the range => The complete section will be moved.
+ // The range will be shrinked if the last position is a start node.
+ // The range will be shrinked if the last node is an end node which starts before the range.
+ aSttRg--;
+ while( aSttRg.GetNode().IsStartNode() )
+ {
+ pNd = aSttRg.GetNode().EndOfSectionNode();
+ if( pNd->GetIndex() >= aEndRg.GetIndex() )
+ break;
+ aSttRg--;
+ }
+ aSttRg++;
+
+ aEndRg--;
+ while( aEndRg.GetNode().IsStartNode() )
+ aEndRg--;
+ while( aEndRg.GetNode().IsEndNode() )
+ {
+ pNd = aEndRg.GetNode().StartOfSectionNode();
+ if( pNd->GetIndex() >= aSttRg.GetIndex() )
+ break;
+ aEndRg--;
+ }
+ aEndRg++;
+
+ // calculation of the new position
+ if( nOffset < 0 && nAktPos < sal_uInt16(-nOffset) )
+ pNd = GetNodes().GetEndOfContent().StartOfSectionNode();
+ else if( nAktPos + nOffset >= GetNodes().GetOutLineNds().Count() )
+ pNd = &GetNodes().GetEndOfContent();
+ else
+ pNd = GetNodes().GetOutLineNds()[ nAktPos + nOffset ];
+
+ sal_uLong nNewPos = pNd->GetIndex();
+
+ // And now a correction of the insert position if necessary...
+ SwNodeIndex aInsertPos( *pNd, -1 );
+ while( aInsertPos.GetNode().IsStartNode() )
+ {
+ // Just before the insert position starts a section:
+ // when I'm moving forward I do not want to enter the section,
+ // when I'm moving backward I want to stay in the section if I'm already a part of,
+ // I want to stay outside if I was outside before.
+ if( nOffset < 0 )
+ {
+ pNd = aInsertPos.GetNode().EndOfSectionNode();
+ if( pNd->GetIndex() >= aEndRg.GetIndex() )
+ break;
+ }
+ aInsertPos--;
+ --nNewPos;
+ }
+ if( nOffset >= 0 )
+ {
+ // When just before the insert position a section ends, it is okay when I'm moving backward
+ // because I want to stay outside the section.
+ // When moving forward I've to check if I started inside or outside the section
+ // because I don't want to enter of leave such a section
+ while( aInsertPos.GetNode().IsEndNode() )
+ {
+ pNd = aInsertPos.GetNode().StartOfSectionNode();
+ if( pNd->GetIndex() >= aSttRg.GetIndex() )
+ break;
+ aInsertPos--;
+ --nNewPos;
+ }
+ }
+ // We do not want to move into tables (at the moment)
+ aInsertPos++;
+ pNd = &aInsertPos.GetNode();
+ if( pNd->IsTableNode() )
+ pNd = pNd->StartOfSectionNode();
+ if( pNd->FindTableNode() )
+ return sal_False;
+
+ ASSERT( aSttRg.GetIndex() > nNewPos || nNewPos >= aEndRg.GetIndex(),
+ "Position liegt im MoveBereich" );
+
+ // wurde ein Position in den Sonderbereichen errechnet, dann
+ // setze die Position auf den Dokumentanfang.
+ // Sollten da Bereiche oder Tabellen stehen, so werden sie nach
+ // hinten verschoben.
+ nNewPos = Max( nNewPos, GetNodes().GetEndOfExtras().GetIndex() + 2 );
+
+ long nOffs = nNewPos - ( 0 < nOffset ? aEndRg.GetIndex() : aSttRg.GetIndex());
+ SwPaM aPam( aSttRg, aEndRg, 0, -1 );
+ return MoveParagraph( aPam, nOffs, sal_True );
+}
+
+
+sal_uInt16 lcl_FindOutlineName( const SwNodes& rNds, const String& rName,
+ sal_Bool bExact )
+{
+ sal_uInt16 nSavePos = USHRT_MAX;
+ const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
+ for( sal_uInt16 n = 0; n < rOutlNds.Count(); ++n )
+ {
+ SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode();
+ String sTxt( pTxtNd->GetExpandTxt() );
+ if( sTxt.Equals( rName ) )
+ {
+ // "exact" gefunden, setze Pos auf den Node
+ nSavePos = n;
+ break;
+ }
+ else if( !bExact && USHRT_MAX == nSavePos &&
+ COMPARE_EQUAL == sTxt.CompareTo( rName, rName.Len()) )
+ {
+ // dann vielleicht nur den den 1.Teil vom Text gefunden
+ nSavePos = n;
+ }
+ }
+
+ return nSavePos;
+}
+
+
+
+sal_uInt16 lcl_FindOutlineNum( const SwNodes& rNds, String& rName )
+{
+ // Gueltig Nummern sind (immer nur Offsets!!!):
+ // ([Nummer]+\.)+ (als regulaerer Ausdruck!)
+ // (Nummer gefolgt von Punkt, zum 5 Wiederholungen)
+ // also: "1.1.", "1.", "1.1.1."
+ xub_StrLen nPos = 0;
+ String sNum = rName.GetToken( 0, '.', nPos );
+ if( STRING_NOTFOUND == nPos )
+ return USHRT_MAX; // ungueltige Nummer!!!
+
+ sal_uInt16 nLevelVal[ MAXLEVEL ]; // Nummern aller Levels
+ memset( nLevelVal, 0, MAXLEVEL * sizeof( nLevelVal[0] ));
+ sal_uInt8 nLevel = 0;
+ String sName( rName );
+
+ while( STRING_NOTFOUND != nPos )
+ {
+ sal_uInt16 nVal = 0;
+ sal_Unicode c;
+ for( sal_uInt16 n = 0; n < sNum.Len(); ++n )
+ if( '0' <= ( c = sNum.GetChar( n )) && c <= '9' )
+ {
+ nVal *= 10; nVal += c - '0';
+ }
+ else if( nLevel )
+ break; // "fast" gueltige Nummer
+ else
+ return USHRT_MAX; // ungueltige Nummer!!!
+
+ if( MAXLEVEL > nLevel )
+ nLevelVal[ nLevel++ ] = nVal;
+
+ sName.Erase( 0, nPos );
+ nPos = 0;
+ sNum = sName.GetToken( 0, '.', nPos );
+ // #i4533# without this check all parts delimited by a dot are treated as outline numbers
+ if(!ByteString(sNum, gsl_getSystemTextEncoding()).IsNumericAscii())
+ nPos = STRING_NOTFOUND;
+ }
+ rName = sName; // das ist der nachfolgende Text.
+
+ // alle Levels gelesen, dann suche mal im Document nach dieser
+ // Gliederung:
+ const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
+ // OS: ohne OutlineNodes lohnt die Suche nicht
+ // und man spart sich einen Absturz #42958#
+ if(!rOutlNds.Count())
+ return USHRT_MAX;
+ SwTxtNode* pNd;
+ nPos = 0;
+ //search in the existing outline nodes for the required outline num array
+ for( ; nPos < rOutlNds.Count(); ++nPos )
+ {
+ pNd = rOutlNds[ nPos ]->GetTxtNode();
+ //sal_uInt8 nLvl = pNd->GetTxtColl()->GetOutlineLevel(); //#outline level,zhaojianwei
+ const int nLvl = pNd->GetAttrOutlineLevel()-1; //<-end,zhaojianwei
+ if( nLvl == nLevel - 1)
+ {
+ // check for the outline num
+ // --> OD 2005-11-02 #i51089 - TUNING#
+ // --> OD 2006-09-22 #i68289#
+ // Assure, that text node has the correct numbering level. Otherwise,
+ // its number vector will not fit to the searched level.
+// if ( pNd->GetNum() )
+ if ( pNd->GetNum() &&
+ pNd->GetActualListLevel() == ( nLevel - 1 ) )
+ // <--
+ {
+ const SwNodeNum & rNdNum = *(pNd->GetNum());
+ SwNumberTree::tNumberVector aLevelVal = rNdNum.GetNumberVector();
+ //now compare with the one searched for
+ bool bEqual = true;
+ for( sal_uInt8 n = 0; (n < nLevel) && bEqual; ++n )
+ {
+ bEqual = aLevelVal[n] == nLevelVal[n];
+ }
+ if(bEqual)
+ {
+ break;
+ }
+ }
+ else
+ {
+ // --> OD 2006-01-12 #126588#
+ // A text node, which has an outline paragraph style applied and
+ // has as hard attribute 'no numbering' set, has an outline level,
+ // but no numbering tree node. Thus, consider this situation in
+ // the assertion condition.
+ ASSERT( !pNd->GetNumRule(),
+ "<lcl_FindOutlineNum(..)> - text node with outline level and numbering rule, but without numbering tree node. This is a serious defect -> inform OD" );
+ }
+ }
+ }
+ if( nPos >= rOutlNds.Count() )
+ nPos = USHRT_MAX;
+ return nPos;
+}
+
+ // zu diesem Gliederungspunkt
+
+
+ // JP 13.06.96:
+ // im Namen kann eine Nummer oder/und der Text stehen.
+ // zuerst wird ueber die Nummer versucht den richtigen Eintrag zu finden.
+ // Gibt es diesen, dann wird ueber den Text verglichen, od es der
+ // gewuenschte ist. Ist das nicht der Fall, wird noch mal nur ueber den
+ // Text gesucht. Wird dieser gefunden ist es der Eintrag. Ansonsten der,
+ // der ueber die Nummer gefunden wurde.
+ // Ist keine Nummer angegeben, dann nur den Text suchen.
+
+sal_Bool SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const
+{
+ if( rName.Len() )
+ {
+ const SwOutlineNodes& rOutlNds = GetNodes().GetOutLineNds();
+
+ // 1. Schritt: ueber die Nummer:
+ String sName( rName );
+ sal_uInt16 nFndPos = ::lcl_FindOutlineNum( GetNodes(), sName );
+ if( USHRT_MAX != nFndPos )
+ {
+ SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode();
+ String sExpandedText = pNd->GetExpandTxt();
+ //#i4533# leading numbers followed by a dot have been remove while
+ //searching for the outline position
+ //to compensate this they must be removed from the paragraphs text content, too
+ sal_uInt16 nPos = 0;
+ String sTempNum;
+ while(sExpandedText.Len() && (sTempNum = sExpandedText.GetToken(0, '.', nPos)).Len() &&
+ STRING_NOTFOUND != nPos &&
+ ByteString(sTempNum, gsl_getSystemTextEncoding()).IsNumericAscii())
+ {
+ sExpandedText.Erase(0, nPos);
+ nPos = 0;
+ }
+
+ if( !sExpandedText.Equals( sName ) )
+ {
+ sal_uInt16 nTmp = ::lcl_FindOutlineName( GetNodes(), sName, sal_True );
+ if( USHRT_MAX != nTmp ) // ueber den Namen gefunden
+ {
+ nFndPos = nTmp;
+ pNd = rOutlNds[ nFndPos ]->GetTxtNode();
+ }
+ }
+ rPos.nNode = *pNd;
+ rPos.nContent.Assign( pNd, 0 );
+ return sal_True;
+ }
+
+ nFndPos = ::lcl_FindOutlineName( GetNodes(), rName, sal_False );
+ if( USHRT_MAX != nFndPos )
+ {
+ SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode();
+ rPos.nNode = *pNd;
+ rPos.nContent.Assign( pNd, 0 );
+ return sal_True;
+ }
+
+ // --> OD 2006-09-22 #i68289#
+ // additional search on hyperlink URL without its outline numbering part
+ if ( !sName.Equals( rName ) )
+ {
+ nFndPos = ::lcl_FindOutlineName( GetNodes(), sName, sal_False );
+ if( USHRT_MAX != nFndPos )
+ {
+ SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode();
+ rPos.nNode = *pNd;
+ rPos.nContent.Assign( pNd, 0 );
+ return sal_True;
+ }
+ }
+ // <--
+ }
+ return sal_False;
+}
+
+/* */
+
+// --- Nummerierung -----------------------------------------
+
+// --> OD 2008-02-19 #refactorlists#
+//void SwNumRuleInfo::MakeList( SwDoc& rDoc, sal_Bool )
+//{
+// SwNumRule* pRule = rDoc.FindNumRulePtr(rName);
+
+// // no rule, no fun.
+// if ( !pRule )
+// return;
+
+// //
+// // 1. Case: Information already available at pRule:
+// //
+// if (pRule->GetTxtNodeList())
+// {
+// // copy list to own pList pointer:
+// aList = *pRule->GetTxtNodeList();
+// return;
+// }
+
+// //
+// // 2. Case: Information has to be generated from scratch:
+// //
+
+// if (pRule->IsOutlineRule())
+// {
+// const SwOutlineNodes & rOutlineNodes = rDoc.GetNodes().GetOutLineNds();
+
+// for (sal_uInt16 i = 0; i < rOutlineNodes.Count(); ++i)
+// {
+// SwTxtNode & aNode = *((SwTxtNode *) rOutlineNodes[i]);
+
+// if (pRule == aNode.GetNumRule())
+// AddNode(aNode);
+// }
+// }
+// {
+// SwModify* pMod;
+// const SfxPoolItem* pItem;
+// sal_uInt16 i, nMaxItems = rDoc.GetAttrPool().GetItemCount
+// ( RES_PARATR_NUMRULE);
+// for( i = 0; i < nMaxItems; ++i )
+// {
+// pItem = rDoc.GetAttrPool().GetItem( RES_PARATR_NUMRULE, i );
+// if( 0 != pItem)
+// {
+// pMod = (SwModify*)((SwNumRuleItem*)pItem)->GetDefinedIn();
+// if (0 != pMod &&
+// ((SwNumRuleItem*)pItem)->GetValue().Len() &&
+// ((SwNumRuleItem*)pItem)->GetValue() == rName )
+// {
+// if( pMod->IsA( TYPE( SwFmt )) )
+// pMod->GetInfo( *this );
+// else
+// {
+// SwTxtNode* pModTxtNode = (SwTxtNode*)pMod;
+
+// // #115901#
+// if( pModTxtNode->GetNodes().IsDocNodes())
+// {
+// AddNode( *pModTxtNode );
+// }
+// }
+// }
+// }
+// }
+// }
+
+// // --> FME 2004-11-03 #i36571# The numrule and this info structure should
+// // have different instances of the list:
+// // --> OD 2006-09-12 #i69145#
+// // method <SwNumRule::SetList(..)> copies content of list provided by the parameter
+// pRule->SetTxtNodeList( aList );
+// // <--
+//}
+// <--
+
+
+void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule )
+{
+ SwNumRule* pOld = rDoc.FindNumRulePtr( rRule.GetName() );
+ ASSERT( pOld, "ohne die alte NumRule geht gar nichts" );
+
+ sal_uInt16 nChgFmtLevel = 0, nMask = 1;
+ sal_uInt8 n;
+
+ for( n = 0; n < MAXLEVEL; ++n, nMask <<= 1 )
+ {
+ const SwNumFmt& rOldFmt = pOld->Get( n ),
+ & rNewFmt = rRule.Get( n );
+
+ if( rOldFmt != rNewFmt )
+ {
+ nChgFmtLevel |= nMask;
+ }
+ else if( SVX_NUM_NUMBER_NONE > rNewFmt.GetNumberingType() && 1 < rNewFmt.GetIncludeUpperLevels() &&
+ 0 != (nChgFmtLevel & GetUpperLvlChg( n, rNewFmt.GetIncludeUpperLevels(),nMask )) )
+ nChgFmtLevel |= nMask;
+ }
+
+ if( !nChgFmtLevel ) // es wurde nichts veraendert?
+ {
+ // --> OD 2006-04-27 #i64311#
+ const bool bInvalidateNumRule( pOld->IsContinusNum() != rRule.IsContinusNum() );
+ // <--
+ pOld->CheckCharFmts( &rDoc );
+ pOld->SetContinusNum( rRule.IsContinusNum() );
+ // --> OD 2008-06-17 #i87166#
+ // Do NOT change list style type
+// pOld->SetRuleType( rRule.GetRuleType() );
+ // <--
+ // --> OD 2006-04-27 #i64311#
+ if ( bInvalidateNumRule )
+ {
+ pOld->SetInvalidRule(sal_True);
+ }
+ // <--
+ return ;
+ }
+
+ // --> OD 2008-02-19 #refactorlists#
+// SwNumRuleInfo* pUpd = new SwNumRuleInfo( rRule.GetName() );
+// pUpd->MakeList( rDoc );
+
+// sal_uInt8 nLvl;
+// for( sal_uLong nFirst = 0, nLast = pUpd->GetList().Count();
+// nFirst < nLast; ++nFirst )
+// {
+// SwTxtNode* pTxtNd = pUpd->GetList().GetObject( nFirst );
+// nLvl = static_cast<sal_uInt8>(pTxtNd->GetLevel());
+
+// if( nLvl < MAXLEVEL )
+// {
+// if( nChgFmtLevel & ( 1 << nLvl ))
+// {
+// pTxtNd->NumRuleChgd();
+// }
+// }
+// }
+ SwNumRule::tTxtNodeList aTxtNodeList;
+ pOld->GetTxtNodeList( aTxtNodeList );
+ sal_uInt8 nLvl( 0 );
+ for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin();
+ aIter != aTxtNodeList.end(); ++aIter )
+ {
+ SwTxtNode* pTxtNd = *aIter;
+ nLvl = static_cast<sal_uInt8>(pTxtNd->GetActualListLevel());
+
+ if( nLvl < MAXLEVEL )
+ {
+ if( nChgFmtLevel & ( 1 << nLvl ))
+ {
+ pTxtNd->NumRuleChgd();
+ }
+ }
+ }
+ // <--
+
+ for( n = 0; n < MAXLEVEL; ++n )
+ if( nChgFmtLevel & ( 1 << n ))
+ pOld->Set( n, rRule.GetNumFmt( n ));
+
+ pOld->CheckCharFmts( &rDoc );
+ pOld->SetInvalidRule(sal_True);
+ pOld->SetContinusNum( rRule.IsContinusNum() );
+ // --> OD 2008-06-17 #i87166#
+ // Do NOT change list style type
+// pOld->SetRuleType( rRule.GetRuleType() );
+ // <--
+
+ // --> OD 2008-02-19 #refactorlists#
+// delete pUpd;
+ // <--
+
+ rDoc.UpdateNumRule();
+}
+
+// OD 2008-02-08 #newlistlevelattrs# - add handling of parameter <bResetIndentAttrs>
+// --> OD 2008-03-17 #refactorlists#
+void SwDoc::SetNumRule( const SwPaM& rPam,
+ const SwNumRule& rRule,
+ const bool bCreateNewList,
+ const String sContinuedListId,
+ sal_Bool bSetItem,
+ const bool bResetIndentAttrs )
+{
+ SwUndoInsNum * pUndo = NULL;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // Start/End for attributes!
+ GetIDocumentUndoRedo().StartUndo( UNDO_INSNUM, NULL );
+ pUndo = new SwUndoInsNum( rPam, rRule );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ SwNumRule * pNew = FindNumRulePtr( rRule.GetName() );
+ bool bUpdateRule = false;
+
+ if( !pNew )
+ {
+ pNew = (*pNumRuleTbl)[ MakeNumRule( rRule.GetName(), &rRule ) ];
+ }
+ else if (rRule != *pNew)
+ {
+ bUpdateRule = true;
+ }
+
+ if (bUpdateRule)
+ {
+ if( pUndo )
+ {
+ pUndo->SaveOldNumRule( *pNew );
+ ::lcl_ChgNumRule( *this, rRule );
+ pUndo->SetLRSpaceEndPos();
+ }
+ else
+ {
+ ::lcl_ChgNumRule( *this, rRule );
+ }
+ }
+
+ // --> OD 2008-03-17 #refactorlists#
+ if ( bSetItem )
+ {
+ if ( bCreateNewList )
+ {
+ String sListId;
+ if ( !bUpdateRule )
+ {
+ // apply list id of list, which has been created for the new list style
+ sListId = pNew->GetDefaultListId();
+ }
+ else
+ {
+ // create new list and apply its list id
+ SwList* pNewList = createList( String(), pNew->GetName() );
+ ASSERT( pNewList,
+ "<SwDoc::SetNumRule(..)> - could not create new list. Serious defect -> please inform OD." );
+ sListId = pNewList->GetListId();
+ }
+ InsertPoolItem( rPam,
+ SfxStringItem( RES_PARATR_LIST_ID, sListId ), 0 );
+ }
+ else if ( sContinuedListId.Len() > 0 )
+ {
+ // apply given list id
+ InsertPoolItem( rPam,
+ SfxStringItem( RES_PARATR_LIST_ID, sContinuedListId ), 0 );
+ }
+ }
+ // <--
+
+ if ( ! rPam.HasMark())
+ {
+ SwTxtNode * pTxtNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode();
+ // --> OD 2006-10-19 #134160#
+ // consider case that the PaM doesn't denote a text node - e.g. it denotes a graphic node
+ if ( pTxtNd )
+ {
+ SwNumRule * pRule = pTxtNd->GetNumRule();
+
+ if (pRule && pRule->GetName() == pNew->GetName())
+ {
+ bSetItem = sal_False;
+ // --> OD 2008-06-02 #refactorlists#
+ if ( !pTxtNd->IsInList() )
+ {
+ pTxtNd->AddToList();
+ }
+ // <--
+ }
+ // --> OD 2005-10-26 #b6340308# - only clear numbering attribute at
+ // text node, if at paragraph style the new numbering rule is found.
+ else if ( !pRule )
+ {
+ SwTxtFmtColl* pColl = pTxtNd->GetTxtColl();
+ if ( pColl )
+ {
+ SwNumRule* pCollRule = FindNumRulePtr(pColl->GetNumRule().GetValue());
+ if ( pCollRule && pCollRule->GetName() == pNew->GetName() )
+ {
+ pTxtNd->ResetAttr( RES_PARATR_NUMRULE );
+ bSetItem = sal_False;
+ }
+ }
+ }
+ // <--
+ }
+ // <--
+ }
+
+ // --> OD 2009-08-18 #i103817#
+ if ( bSetItem )
+ // <--
+ {
+ InsertPoolItem( rPam, SwNumRuleItem( pNew->GetName() ), 0 );
+ }
+
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ if ( bResetIndentAttrs &&
+ pNew && pNew->Get( 0 ).GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ SvUShortsSort aResetAttrsArray;
+ aResetAttrsArray.Insert( RES_LR_SPACE );
+ // --> OD 2010-10-05 #i114929#
+ // On a selection setup a corresponding Point-and-Mark in order to get
+ // the indentation attribute reset on all paragraphs touched by the selection
+ if ( rPam.HasMark() &&
+ rPam.End()->nNode.GetNode().GetTxtNode() )
+ {
+ SwPaM aPam( rPam.Start()->nNode,
+ rPam.End()->nNode );
+ aPam.Start()->nContent = 0;
+ aPam.End()->nContent = rPam.End()->nNode.GetNode().GetTxtNode()->Len();
+ ResetAttrs( aPam, sal_False, &aResetAttrsArray );
+ }
+ else
+ {
+ ResetAttrs( rPam, sal_False, &aResetAttrsArray );
+ }
+ // <--
+ }
+ // <--
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().EndUndo( UNDO_INSNUM, NULL );
+ }
+
+ SetModified();
+}
+
+void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted)
+{
+ if ( bCounted )
+ {
+ SvUShortsSort aResetAttrsArray;
+ aResetAttrsArray.Insert( RES_PARATR_LIST_ISCOUNTED );
+ // --> OD 2010-10-05 #i114929#
+ // On a selection setup a corresponding Point-and-Mark in order to get
+ // the list-is-counted attribute reset on all paragraphs touched by the selection
+ if ( rPam.HasMark() &&
+ rPam.End()->nNode.GetNode().GetTxtNode() )
+ {
+ SwPaM aPam( rPam.Start()->nNode,
+ rPam.End()->nNode );
+ aPam.Start()->nContent = 0;
+ aPam.End()->nContent = rPam.End()->nNode.GetNode().GetTxtNode()->Len();
+ ResetAttrs( aPam, sal_False, &aResetAttrsArray );
+ }
+ else
+ {
+ ResetAttrs( rPam, sal_False, &aResetAttrsArray );
+ }
+ // <--
+ }
+ else
+ {
+ InsertPoolItem( rPam,
+ SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, sal_False ), 0 );
+ }
+}
+
+void SwDoc::SetNumRuleStart( const SwPosition& rPos, sal_Bool bFlag )
+{
+ SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+
+ if (pTxtNd)
+ {
+ const SwNumRule* pRule = pTxtNd->GetNumRule();
+ if( pRule && !bFlag != !pTxtNd->IsListRestart())
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoNumRuleStart(rPos, bFlag) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ pTxtNd->SetListRestart(bFlag ? true : false);
+
+ SetModified();
+ }
+ }
+}
+
+void SwDoc::SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt )
+{
+ SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+
+ if (pTxtNd)
+ {
+ // --> OD 2008-02-27 #refactorlists#
+// const SwNumRule* pRule = pTxtNd->GetNumRule();
+// if( pRule && nStt != pTxtNd->GetListRestartValue() )
+// {
+// if( DoesUndo() )
+// {
+// ClearRedo();
+// AppendUndo( new SwUndoNumRuleStart( rPos, nStt ));
+// }
+// }
+// pTxtNd->SetListRestartValue(nStt);
+
+// SetModified();
+ if ( !pTxtNd->HasAttrListRestartValue() ||
+ pTxtNd->GetAttrListRestartValue() != nStt )
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoNumRuleStart(rPos, nStt) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ pTxtNd->SetAttrListRestartValue( nStt );
+
+ SetModified();
+ }
+ // <--
+ }
+}
+
+ // loeschen geht nur, wenn die Rule niemand benutzt!
+sal_Bool SwDoc::DelNumRule( const String& rName, sal_Bool bBroadcast )
+{
+ sal_uInt16 nPos = FindNumRule( rName );
+
+ // --> OD 2007-12-17 #151213#
+ if ( (*pNumRuleTbl)[ nPos ] == GetOutlineNumRule() )
+ {
+ ASSERT( false,
+ "<SwDoc::DelNumRule(..)> - No deletion of outline list style. This is serious defect - please inform OD" );
+ return sal_False;
+ }
+ // <--
+
+ if( USHRT_MAX != nPos && !IsUsed( *(*pNumRuleTbl)[ nPos ] ))
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo * pUndo =
+ new SwUndoNumruleDelete(*(*pNumRuleTbl)[nPos], this);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ if (bBroadcast)
+ BroadcastStyleOperation(rName, SFX_STYLE_FAMILY_PSEUDO,
+ SFX_STYLESHEET_ERASED);
+
+ // --> OD 2008-04-02 #refactorlists#
+ deleteListForListStyle( rName );
+ {
+ // delete further list, which have the deleted list style as default list style
+ std::vector< SwList* > aListsForDeletion;
+ tHashMapForLists::iterator aListIter = maLists.begin();
+ while ( aListIter != maLists.end() )
+ {
+ SwList* pList = (*aListIter).second;
+ if ( pList->GetDefaultListStyleName() == rName )
+ {
+ aListsForDeletion.push_back( pList );
+ }
+
+ ++aListIter;
+ }
+ while ( aListsForDeletion.size() > 0 )
+ {
+ SwList* pList = aListsForDeletion.back();
+ aListsForDeletion.pop_back();
+ deleteList( pList->GetListId() );
+ }
+ }
+ // <--
+ // --> FME 2004-11-02 #i34097# DeleteAndDestroy deletes rName if
+ // rName is directly taken from the numrule.
+ const String aTmpName( rName );
+ // <--
+ pNumRuleTbl->DeleteAndDestroy( nPos );
+ maNumRuleMap.erase(aTmpName);
+
+ SetModified();
+ return sal_True;
+ }
+ return sal_False;
+}
+
+// #106897#
+void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule, const String * pName )
+{
+ // #106897#
+ SwNumRule* pRule = FindNumRulePtr( pName ? *pName : rRule.GetName() );
+ if( pRule )
+ {
+ SwUndoInsNum* pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoInsNum( *pRule, rRule );
+ pUndo->GetHistory();
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ ::lcl_ChgNumRule( *this, rRule );
+
+ if( pUndo )
+ pUndo->SetLRSpaceEndPos();
+
+ SetModified();
+ }
+}
+
+sal_Bool SwDoc::RenameNumRule(const String & rOldName, const String & rNewName,
+ sal_Bool bBroadcast)
+{
+ sal_Bool bResult = sal_False;
+ SwNumRule * pNumRule = FindNumRulePtr(rOldName);
+
+ if (pNumRule)
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo * pUndo = new SwUndoNumruleRename(rOldName, rNewName, this);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ // --> OD 2008-02-19 #refactorlists#
+// SwNumRuleInfo aInfo(rOldName);
+// aInfo.MakeList(*this);
+ SwNumRule::tTxtNodeList aTxtNodeList;
+ pNumRule->GetTxtNodeList( aTxtNodeList );
+ // <--
+
+ // --> OD 2008-07-08 #i91400#
+ pNumRule->SetName( rNewName, *this );
+ // <--
+
+ SwNumRuleItem aItem(rNewName);
+ // --> OD 2008-02-19 #refactorlists#
+// for (sal_uLong nI = 0; nI < aInfo.GetList().Count(); ++nI)
+// {
+// SwTxtNode * pTxtNd = aInfo.GetList().GetObject(nI);
+// pTxtNd->SwCntntNode::SetAttr(aItem);
+// }
+ for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin();
+ aIter != aTxtNodeList.end(); ++aIter )
+ {
+ SwTxtNode * pTxtNd = *aIter;
+ pTxtNd->SetAttr(aItem);
+ }
+ // <--
+
+ bResult = sal_True;
+
+ if (bBroadcast)
+ BroadcastStyleOperation(rOldName, SFX_STYLE_FAMILY_PSEUDO,
+ SFX_STYLESHEET_MODIFIED);
+ }
+
+ return bResult;
+}
+
+void SwDoc::StopNumRuleAnimations( OutputDevice* pOut )
+{
+ for( sal_uInt16 n = GetNumRuleTbl().Count(); n; )
+ {
+ SwNumRule::tTxtNodeList aTxtNodeList;
+ GetNumRuleTbl()[ --n ]->GetTxtNodeList( aTxtNodeList );
+ for ( SwNumRule::tTxtNodeList::iterator aTxtNodeIter = aTxtNodeList.begin();
+ aTxtNodeIter != aTxtNodeList.end(); ++aTxtNodeIter )
+ {
+ SwTxtNode* pTNd = *aTxtNodeIter;
+ SwIterator<SwTxtFrm,SwTxtNode> aIter(*pTNd);
+ for(SwTxtFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() )
+ if( pFrm->HasAnimation() )
+ pFrm->StopAnimation( pOut );
+ }
+ }
+}
+
+sal_Bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
+ const String& rOldRule, const String& rNewRule )
+{
+ sal_Bool bRet = sal_False;
+ SwNumRule *pOldRule = FindNumRulePtr( rOldRule ),
+ *pNewRule = FindNumRulePtr( rNewRule );
+ if( pOldRule && pNewRule && pOldRule != pNewRule )
+ {
+ // --> OD 2008-02-19 #refactorlists#
+ SwUndoInsNum* pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // Start/End for attributes!
+ GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ pUndo = new SwUndoInsNum( rPos, *pNewRule, rOldRule );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ // --> OD 2008-02-19 #refactorlists#
+ // apply new list style <pNewRule> to all text nodes, which have the
+ // old list style <pOldNRule> applied and belong to the same list as
+ // the text node of the given <SwPosition>.
+// SwNumRuleInfo aUpd( rOldRule );
+// aUpd.MakeList( *this );
+
+// if (aUpd.GetList().Count() > 0) // #106897#
+ SwNumRule::tTxtNodeList aTxtNodeList;
+ pOldRule->GetTxtNodeList( aTxtNodeList );
+ if ( aTxtNodeList.size() > 0 )
+ {
+// // Position suchen und bestimme ob ein Node davor oder dahinter
+// // einen Start erzwingt
+// SwTxtNode* pTxtNd;
+// sal_uLong nFndPos, nFirst, nLast;
+
+// if( TABLE_ENTRY_NOTFOUND != aUpd.GetList().SearchKey(
+// rPos.nNode.GetIndex(), &nFndPos ))
+// ++nFndPos;
+
+// for( nLast = nFndPos; nLast < aUpd.GetList().Count(); ++nLast )
+// {
+// pTxtNd = aUpd.GetList().GetObject( nLast );
+// if(pTxtNd->IsRestart())
+// break;
+// }
+// for( nFirst = nFndPos; nFirst; )
+// {
+// pTxtNd = aUpd.GetList().GetObject( --nFirst );
+// if( pTxtNd->IsRestart() )
+// break;
+// }
+// // dann neue Numerierung ueber diesen Bereich
+// // definieren und den Start am Anfang/Ende zurueck setzen
+// pTxtNd = aUpd.GetList().GetObject( nFirst );
+// if( pTxtNd->IsRestart() )
+// {
+// pTxtNd->SetRestart(false);
+// if( pUndo )
+// pUndo->SetSttNum( pTxtNd->GetIndex() );
+// }
+
+ SwRegHistory aRegH( pUndo ? pUndo->GetHistory() : 0 );
+ sal_uInt16 nChgFmtLevel = 0;
+ for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
+ {
+ const SwNumFmt& rOldFmt = pOldRule->Get( n ),
+ & rNewFmt = pNewRule->Get( n );
+
+ if( rOldFmt.GetAbsLSpace() != rNewFmt.GetAbsLSpace() ||
+ rOldFmt.GetFirstLineOffset() != rNewFmt.GetFirstLineOffset() )
+ nChgFmtLevel |= ( 1 << n );
+ }
+
+ const SwTxtNode* pGivenTxtNode = rPos.nNode.GetNode().GetTxtNode();
+ SwNumRuleItem aRule( rNewRule );
+// for( ; nFirst < nLast; ++nFirst )
+// {
+// pTxtNd = aUpd.GetList().GetObject( nFirst );
+
+// aRegH.RegisterInModify( pTxtNd, *pTxtNd );
+
+// pTxtNd->SwCntntNode::SetAttr( aRule );
+// pTxtNd->NumRuleChgd();
+// }
+ for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin();
+ aIter != aTxtNodeList.end(); ++aIter )
+ {
+ SwTxtNode* pTxtNd = *aIter;
+
+ if ( pGivenTxtNode &&
+ pGivenTxtNode->GetListId() == pTxtNd->GetListId() )
+ {
+ aRegH.RegisterInModify( pTxtNd, *pTxtNd );
+
+ pTxtNd->SetAttr( aRule );
+ pTxtNd->NumRuleChgd();
+ }
+ }
+ GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ SetModified();
+
+ bRet = sal_True; // #106897#
+ }
+ }
+
+ return bRet;
+}
+
+// --> OD 2008-03-18 #refactorlists#
+namespace
+{
+ struct ListStyleData
+ {
+ SwNumRule* pReplaceNumRule;
+ bool bCreateNewList;
+ String sListId;
+
+ ListStyleData()
+ : pReplaceNumRule( 0 ),
+ bCreateNewList( false ),
+ sListId()
+ {}
+ };
+}
+// <--
+
+void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM)
+{
+ ASSERT( rPaM.GetDoc() == this, "need same doc" );
+
+ // --> OD 2008-03-18 #refactorlists#
+// map<SwNumRule *, SwNumRule *> aMyNumRuleMap;
+ ::std::map<SwNumRule *, ListStyleData> aMyNumRuleMap;
+ // <--
+
+ sal_uLong nStt = rPaM.Start()->nNode.GetIndex();
+ sal_uLong nEnd = rPaM.End()->nNode.GetIndex();
+
+ bool bFirst = true;
+
+ for (sal_uLong n = nStt; n <= nEnd; n++)
+ {
+ SwTxtNode * pCNd = GetNodes()[n]->GetTxtNode();
+
+ if (pCNd)
+ {
+ SwNumRule * pRule = pCNd->GetNumRule();
+
+ if (pRule && pRule->IsAutoRule() && ! pRule->IsOutlineRule())
+ {
+ // --> OD 2008-03-18 #refactorlists#
+// SwNumRule * pReplaceNumRule = aMyNumRuleMap[pRule];
+ ListStyleData aListStyleData = aMyNumRuleMap[pRule];
+
+// if (! pReplaceNumRule)
+ if ( aListStyleData.pReplaceNumRule == 0 )
+ {
+ if (bFirst)
+ {
+ SwPosition aPos(*pCNd);
+ aListStyleData.pReplaceNumRule =
+ const_cast<SwNumRule *>
+ (SearchNumRule( aPos, false, pCNd->HasNumber(),
+ false, 0,
+ aListStyleData.sListId, true ));
+ }
+
+// if (! pReplaceNumRule)
+ if ( aListStyleData.pReplaceNumRule == 0 )
+ {
+// pReplaceNumRule = new SwNumRule(*pRule);
+// pReplaceNumRule->SetName(GetUniqueNumRuleName());
+ aListStyleData.pReplaceNumRule = new SwNumRule(*pRule);
+ // --> OD 2008-07-08 #i91400#
+ aListStyleData.pReplaceNumRule->SetName(
+ GetUniqueNumRuleName(), *this );
+ // <--
+ aListStyleData.bCreateNewList = true;
+ }
+
+// aMyNumRuleMap[pRule] = pReplaceNumRule;
+ aMyNumRuleMap[pRule] = aListStyleData;
+ }
+
+ SwPaM aPam(*pCNd);
+
+ SetNumRule( aPam, *aListStyleData.pReplaceNumRule,
+ aListStyleData.bCreateNewList,
+ aListStyleData.sListId );
+ if ( aListStyleData.bCreateNewList )
+ {
+ aListStyleData.bCreateNewList = false;
+ aListStyleData.sListId = pCNd->GetListId();
+ aMyNumRuleMap[pRule] = aListStyleData;
+ }
+ // <--
+
+ bFirst = false;
+ }
+ }
+ }
+}
+
+sal_Bool SwDoc::NoNum( const SwPaM& rPam )
+{
+
+ sal_Bool bRet = SplitNode( *rPam.GetPoint(), false );
+ // ist ueberhaupt Nummerierung im Spiel ?
+ if( bRet )
+ {
+ // NoNum setzen und Upaten
+ const SwNodeIndex& rIdx = rPam.GetPoint()->nNode;
+ SwTxtNode* pNd = rIdx.GetNode().GetTxtNode();
+ const SwNumRule* pRule = pNd->GetNumRule();
+ if( pRule )
+ {
+ pNd->SetCountedInList(false);
+
+ SetModified();
+ }
+ else
+ bRet = sal_False; // keine Nummerierung , ?? oder immer sal_True ??
+ }
+ return bRet;
+}
+
+void SwDoc::DelNumRules( const SwPaM& rPam )
+{
+ sal_uLong nStt = rPam.GetPoint()->nNode.GetIndex(),
+ nEnd = rPam.GetMark()->nNode.GetIndex();
+ if( nStt > nEnd )
+ {
+ sal_uLong nTmp = nStt; nStt = nEnd; nEnd = nTmp;
+ }
+
+ SwUndoDelNum* pUndo;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoDelNum( rPam );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ else
+ pUndo = 0;
+
+ SwRegHistory aRegH( pUndo ? pUndo->GetHistory() : 0 );
+
+ SwNumRuleItem aEmptyRule( aEmptyStr );
+ const SwNode* pOutlNd = 0;
+ for( ; nStt <= nEnd; ++nStt )
+ {
+ SwTxtNode* pTNd = GetNodes()[ nStt ]->GetTxtNode();
+ // --> OD 2008-03-13 #refactorlists#
+// if( pTNd && 0 != ( pItem = pTNd->GetNoCondAttr(
+// RES_PARATR_NUMRULE, sal_True ) ) &&
+// ( pName = &((SwNumRuleItem*)pItem)->GetValue())->Len() )
+ SwNumRule* pNumRuleOfTxtNode = pTNd ? pTNd->GetNumRule() : 0;
+ if ( pTNd && pNumRuleOfTxtNode )
+ // <--
+ {
+ // recognize changes of attribute for undo
+ aRegH.RegisterInModify( pTNd, *pTNd );
+
+ if( pUndo )
+ pUndo->AddNode( *pTNd, sal_False );
+
+ // directly set list style attribute is reset, otherwise empty
+ // list style is applied
+ const SfxItemSet* pAttrSet = pTNd->GetpSwAttrSet();
+ if ( pAttrSet &&
+ pAttrSet->GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET )
+ pTNd->ResetAttr( RES_PARATR_NUMRULE );
+ else
+ pTNd->SetAttr( aEmptyRule );
+
+ // --> OD 2008-03-26 #refactorlists#
+ pTNd->ResetAttr( RES_PARATR_LIST_ID );
+ pTNd->ResetAttr( RES_PARATR_LIST_LEVEL );
+ pTNd->ResetAttr( RES_PARATR_LIST_ISRESTART );
+ pTNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE );
+ pTNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED );
+ // <--
+
+ if( RES_CONDTXTFMTCOLL == pTNd->GetFmtColl()->Which() )
+ pTNd->ChkCondColl();
+ //else if( !pOutlNd && NO_NUMBERING != //#outline level,zhaojianwei
+ // ((SwTxtFmtColl*)pTNd->GetFmtColl())->GetOutlineLevel() )
+ else if( !pOutlNd &&
+ ((SwTxtFmtColl*)pTNd->GetFmtColl())->IsAssignedToListLevelOfOutlineStyle() )//<-end,zhaojianwei
+ pOutlNd = pTNd;
+ }
+ }
+
+ // dann noch alle Updaten
+ UpdateNumRule();
+
+ if( pOutlNd )
+ GetNodes().UpdtOutlineIdx( *pOutlNd );
+}
+
+void SwDoc::InvalidateNumRules()
+{
+ for (sal_uInt16 n = 0; n < pNumRuleTbl->Count(); ++n)
+ (*pNumRuleTbl)[n]->SetInvalidRule(sal_True);
+}
+
+ // zum naechsten/vorhergehenden Punkt auf gleicher Ebene
+
+sal_Bool lcl_IsNumOk( sal_uInt8 nSrchNum, sal_uInt8& rLower, sal_uInt8& rUpper,
+ sal_Bool bOverUpper, sal_uInt8 nNumber )
+{
+ // --> OD 2008-04-02 #refactorlists#
+ ASSERT( nNumber < MAXLEVEL,
+ "<lcl_IsNumOk(..)> - misusage of method" );
+ // <--
+
+ sal_Bool bRet = sal_False;
+ {
+ if( bOverUpper ? nSrchNum == nNumber : nSrchNum >= nNumber )
+ bRet = sal_True;
+ else if( nNumber > rLower )
+ rLower = nNumber;
+ else if( nNumber < rUpper )
+ rUpper = nNumber;
+ }
+ return bRet;
+}
+
+sal_Bool lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx )
+{
+ sal_Bool bRet = sal_False;
+ const SwNode& rNd = rIdx.GetNode();
+ switch( rNd.GetNodeType() )
+ {
+ case ND_ENDNODE:
+ bRet = SwTableBoxStartNode == rNd.StartOfSectionNode()->GetStartNodeType() ||
+ rNd.StartOfSectionNode()->IsSectionNode();
+ break;
+
+ case ND_STARTNODE:
+ bRet = SwTableBoxStartNode == ((SwStartNode&)rNd).GetStartNodeType();
+ break;
+
+ case ND_SECTIONNODE: // der ist erlaubt, also weiter
+ bRet = sal_True;
+ break;
+ }
+ return bRet;
+}
+
+sal_Bool lcl_GotoNextPrevNum( SwPosition& rPos, sal_Bool bNext,
+ sal_Bool bOverUpper, sal_uInt8* pUpper, sal_uInt8* pLower )
+{
+ const SwTxtNode* pNd = rPos.nNode.GetNode().GetTxtNode();
+ const SwNumRule* pRule;
+ if( !pNd || 0 == ( pRule = pNd->GetNumRule()))
+ return sal_False;
+
+ sal_uInt8 nSrchNum = static_cast<sal_uInt8>(pNd->GetActualListLevel());
+
+ SwNodeIndex aIdx( rPos.nNode );
+ if( ! pNd->IsCountedInList() )
+ {
+ // falls gerade mal NO_NUMLEVEL an ist, so such den vorherigen Node
+ // mit Nummerierung
+ sal_Bool bError = sal_False;
+ do {
+ aIdx--;
+ if( aIdx.GetNode().IsTxtNode() )
+ {
+ pNd = aIdx.GetNode().GetTxtNode();
+ pRule = pNd->GetNumRule();
+
+ sal_uInt8 nTmpNum;
+
+ if( pRule )
+ {
+ nTmpNum = static_cast<sal_uInt8>(pNd->GetActualListLevel());
+ if( !( ! pNd->IsCountedInList() &&
+ (nTmpNum >= nSrchNum )) )
+ break; // gefunden
+ }
+ else
+ bError = sal_True;
+ }
+ else
+ bError = !lcl_IsValidPrevNextNumNode( aIdx );
+
+ } while( !bError );
+ if( bError )
+ return sal_False;
+ }
+
+ sal_uInt8 nLower = nSrchNum, nUpper = nSrchNum;
+ sal_Bool bRet = sal_False;
+
+ const SwTxtNode* pLast;
+ if( bNext )
+ aIdx++, pLast = pNd;
+ else
+ aIdx--, pLast = 0;
+
+ while( bNext ? ( aIdx.GetIndex() < aIdx.GetNodes().Count() - 1 )
+ : aIdx.GetIndex() )
+ {
+ if( aIdx.GetNode().IsTxtNode() )
+ {
+ pNd = aIdx.GetNode().GetTxtNode();
+ pRule = pNd->GetNumRule();
+ if( pRule )
+ {
+ if( ::lcl_IsNumOk( nSrchNum, nLower, nUpper, bOverUpper,
+ static_cast<sal_uInt8>(pNd->GetActualListLevel()) ))
+ {
+ rPos.nNode = aIdx;
+ rPos.nContent.Assign( (SwTxtNode*)pNd, 0 );
+ bRet = sal_True;
+ break;
+ }
+ else
+ pLast = pNd;
+ }
+ else
+ break;
+ }
+ else if( !lcl_IsValidPrevNextNumNode( aIdx ))
+ break;
+
+ if( bNext )
+ aIdx++;
+ else
+ aIdx--;
+ }
+
+ if( !bRet && !bOverUpper && pLast ) // nicht ueber hoehere Nummmern, aber bis Ende
+ {
+ if( bNext )
+ {
+ rPos.nNode = aIdx;
+ if( aIdx.GetNode().IsCntntNode() )
+ rPos.nContent.Assign( aIdx.GetNode().GetCntntNode(), 0 );
+ }
+ else
+ {
+ rPos.nNode.Assign( *pLast );
+ rPos.nContent.Assign( (SwTxtNode*)pLast, 0 );
+ }
+ bRet = sal_True;
+ }
+
+ if( bRet )
+ {
+ if( pUpper )
+ *pUpper = nUpper;
+ if( pLower )
+ *pLower = nLower;
+ }
+ return bRet;
+}
+
+sal_Bool SwDoc::GotoNextNum( SwPosition& rPos, sal_Bool bOverUpper,
+ sal_uInt8* pUpper, sal_uInt8* pLower )
+{
+ return ::lcl_GotoNextPrevNum( rPos, sal_True, bOverUpper, pUpper, pLower );
+}
+
+// -> #i23731#
+// --> OD 2008-03-18 #refactorlists# - add output parameter <sListId>
+const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos,
+ const bool bForward,
+ const bool bNum,
+ const bool bOutline,
+ int nNonEmptyAllowed,
+ String& sListId,
+ const bool bInvestigateStartNode)
+{
+ const SwNumRule * pResult = NULL;
+ SwTxtNode * pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+ SwNode * pStartFromNode = pTxtNd;
+
+ if (pTxtNd)
+ {
+ SwNodeIndex aIdx(rPos.nNode);
+
+ // --> OD 2005-10-20 #i55391#
+ // - the start node has also been investigated, if requested.
+ const SwNode * pNode = NULL;
+ do
+ {
+ // --> OD 2005-10-20 #i55391#
+ if ( !bInvestigateStartNode )
+ {
+ if (bForward)
+ aIdx++;
+ else
+ aIdx--;
+ }
+ // <--
+ if (aIdx.GetNode().IsTxtNode())
+ {
+ pTxtNd = aIdx.GetNode().GetTxtNode();
+
+ const SwNumRule * pNumRule = pTxtNd->GetNumRule();
+ if (pNumRule)
+ {
+ if ( ( pNumRule->IsOutlineRule() == ( bOutline ? sal_True : sal_False ) ) && // #115901#
+ ( ( bNum && pNumRule->Get(0).IsEnumeration()) ||
+ ( !bNum && pNumRule->Get(0).IsItemize() ) ) ) // #i22362#, #i29560#
+ {
+ pResult = pTxtNd->GetNumRule();
+ // --> OD 2008-03-18 #refactorlists#
+ // provide also the list id, to which the text node belongs.
+ sListId = pTxtNd->GetListId();
+ }
+
+ break;
+ }
+ else if (pTxtNd->Len() > 0 || NULL != pTxtNd->GetNumRule())
+ {
+ if (nNonEmptyAllowed == 0)
+ break;
+
+ nNonEmptyAllowed--;
+
+ if (nNonEmptyAllowed < 0)
+ nNonEmptyAllowed = -1;
+ }
+ }
+
+ // --> OD 2005-10-20 #i55391#
+ if ( bInvestigateStartNode )
+ {
+ if (bForward)
+ aIdx++;
+ else
+ aIdx--;
+ }
+ // <--
+
+ pNode = &aIdx.GetNode();
+ }
+ while (!(pNode == GetNodes().DocumentSectionStartNode(pStartFromNode) ||
+ pNode == GetNodes().DocumentSectionEndNode(pStartFromNode)));
+ // <--
+ }
+
+ return pResult;
+}
+// <- #i23731#
+
+sal_Bool SwDoc::GotoPrevNum( SwPosition& rPos, sal_Bool bOverUpper,
+ sal_uInt8* pUpper, sal_uInt8* pLower )
+{
+ return ::lcl_GotoNextPrevNum( rPos, sal_False, bOverUpper, pUpper, pLower );
+}
+
+sal_Bool SwDoc::NumUpDown( const SwPaM& rPam, sal_Bool bDown )
+{
+ sal_uLong nStt = rPam.GetPoint()->nNode.GetIndex(),
+ nEnd = rPam.GetMark()->nNode.GetIndex();
+ if( nStt > nEnd )
+ {
+ sal_uLong nTmp = nStt; nStt = nEnd; nEnd = nTmp;
+ }
+
+ // -> #115901# outline nodes are promoted or demoted differently
+ bool bOnlyOutline = true;
+ bool bOnlyNonOutline = true;
+ for (sal_uLong n = nStt; n <= nEnd; n++)
+ {
+ SwTxtNode * pTxtNd = GetNodes()[n]->GetTxtNode();
+
+ if (pTxtNd)
+ {
+ SwNumRule * pRule = pTxtNd->GetNumRule();
+
+ if (pRule)
+ {
+ if (pRule->IsOutlineRule())
+ bOnlyNonOutline = false;
+ else
+ bOnlyOutline = false;
+ }
+ }
+ }
+ // <- #115901#
+
+ sal_Bool bRet = sal_True;
+ char nDiff = bDown ? 1 : -1;
+
+ // ->#115901#
+ if (bOnlyOutline)
+ bRet = OutlineUpDown(rPam, nDiff);
+ else if (bOnlyNonOutline)
+ {
+ /* --> #i24560#
+
+ Only promote or demote if all selected paragraphs are
+ promotable resp. demotable.
+
+ */
+ for (sal_uLong nTmp = nStt; nTmp <= nEnd; ++nTmp)
+ {
+ SwTxtNode* pTNd = GetNodes()[ nTmp ]->GetTxtNode();
+
+ // --> OD 2006-10-19 #134160# - make code robust:
+ // consider case that the node doesn't denote a text node.
+ if ( pTNd )
+ {
+ SwNumRule * pRule = pTNd->GetNumRule();
+
+ if (pRule)
+ {
+ sal_uInt8 nLevel = static_cast<sal_uInt8>(pTNd->GetActualListLevel());
+ if( (-1 == nDiff && 0 >= nLevel) ||
+ (1 == nDiff && MAXLEVEL - 1 <= nLevel))
+ bRet = sal_False;
+ }
+ }
+ // <--
+ }
+
+ if( bRet )
+ {
+ /* <-- #i24560# */
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoNumUpDown(rPam, nDiff) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ String sNumRule;
+
+ for(sal_uLong nTmp = nStt; nTmp <= nEnd; ++nTmp )
+ {
+ SwTxtNode* pTNd = GetNodes()[ nTmp ]->GetTxtNode();
+
+ if( pTNd)
+ {
+ SwNumRule * pRule = pTNd->GetNumRule();
+
+ if (pRule)
+ {
+ sal_uInt8 nLevel = static_cast<sal_uInt8>(pTNd->GetActualListLevel());
+ nLevel = nLevel + nDiff;
+
+ pTNd->SetAttrListLevel(nLevel);
+ }
+ }
+ }
+
+ ChkCondColls();
+ SetModified();
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutlMv )
+{
+ const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
+
+ sal_uLong nStIdx = pStt->nNode.GetIndex();
+ sal_uLong nEndIdx = pEnd->nNode.GetIndex();
+
+ // Here are some sophisticated checks whether the wished PaM will be moved or not.
+ // For moving outlines (bIsOutlMv) I've already done some checks, so here are two different
+ // checks...
+ SwNode *pTmp1;
+ SwNode *pTmp2;
+ if( bIsOutlMv )
+ {
+ // For moving chapters (outline) the following reason will deny the move:
+ // if a start node is inside the moved area and its end node outside or vice versa.
+ // If a start node is the first moved paragraph, its end node has to be within the moved
+ // area, too (e.g. as last node).
+ // If an end node is the last node of the moved area, its start node has to be a part of
+ // the moved section, too.
+ pTmp1 = GetNodes()[ nStIdx ];
+ if( pTmp1->IsStartNode() )
+ { // First is a start node
+ pTmp2 = pTmp1->EndOfSectionNode();
+ if( pTmp2->GetIndex() > nEndIdx )
+ return sal_False; // Its end node is behind the moved range
+ }
+ pTmp1 = pTmp1->StartOfSectionNode()->EndOfSectionNode();
+ if( pTmp1->GetIndex() <= nEndIdx )
+ return sal_False; // End node inside but start node before moved range => no.
+ pTmp1 = GetNodes()[ nEndIdx ];
+ if( pTmp1->IsEndNode() )
+ { // The last one is an end node
+ pTmp1 = pTmp1->StartOfSectionNode();
+ if( pTmp1->GetIndex() < nStIdx )
+ return sal_False; // Its start node is before the moved range.
+ }
+ pTmp1 = pTmp1->StartOfSectionNode();
+ if( pTmp1->GetIndex() >= nStIdx )
+ return sal_False; // A start node which ends behind the moved area => no.
+ }
+
+ sal_uLong nInStIdx, nInEndIdx;
+ long nOffs = nOffset;
+ if( nOffset > 0 )
+ {
+ nInEndIdx = nEndIdx;
+ nEndIdx += nOffset;
+ ++nOffs;
+ }
+ else
+ {
+ //Impossible to move to negative index
+ if( sal_uLong(abs( nOffset )) > nStIdx)
+ return sal_False;
+
+ nInEndIdx = nStIdx - 1;
+ nStIdx += nOffset;
+ }
+ nInStIdx = nInEndIdx + 1;
+ // Folgende Absatzbloecke sollen vertauscht werden:
+ // [ nStIdx, nInEndIdx ] mit [ nInStIdx, nEndIdx ]
+
+ if( nEndIdx >= GetNodes().GetEndOfContent().GetIndex() )
+ return sal_False;
+
+ if( !bIsOutlMv )
+ { // And here the restrictions for moving paragraphs other than chapters (outlines)
+ // The plan is to exchange [nStIdx,nInEndIdx] and [nStartIdx,nEndIdx]
+ // It will checked if the both "start" nodes as well as the both "end" notes belongs to
+ // the same start-end-section. This is more restrictive than the conditions checked above.
+ // E.g. a paragraph will not escape from a section or be inserted to another section.
+ pTmp1 = GetNodes()[ nStIdx ]->StartOfSectionNode();
+ pTmp2 = GetNodes()[ nInStIdx ]->StartOfSectionNode();
+ if( pTmp1 != pTmp2 )
+ return sal_False; // "start" nodes in different sections
+ pTmp1 = GetNodes()[ nEndIdx ];
+ bool bIsEndNode = pTmp1->IsEndNode();
+ if( !pTmp1->IsStartNode() )
+ {
+ pTmp1 = pTmp1->StartOfSectionNode();
+ if( bIsEndNode ) // For end nodes the first start node is of course inside the range,
+ pTmp1 = pTmp1->StartOfSectionNode(); // I've to check the start node of the start node.
+ }
+ pTmp1 = pTmp1->EndOfSectionNode();
+ pTmp2 = GetNodes()[ nInEndIdx ];
+ if( !pTmp2->IsStartNode() )
+ {
+ bIsEndNode = pTmp2->IsEndNode();
+ pTmp2 = pTmp2->StartOfSectionNode();
+ if( bIsEndNode )
+ pTmp2 = pTmp2->StartOfSectionNode();
+ }
+ pTmp2 = pTmp2->EndOfSectionNode();
+ if( pTmp1 != pTmp2 )
+ return sal_False; // The "end" notes are in different sections
+ }
+
+ // auf Redlining testen - darf die Selektion ueberhaupt verschoben
+ // werden?
+ if( !IsIgnoreRedline() )
+ {
+ sal_uInt16 nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_DELETE );
+ if( USHRT_MAX != nRedlPos )
+ {
+ SwPosition aStPos( *pStt ), aEndPos( *pEnd );
+ aStPos.nContent = 0;
+ SwCntntNode* pCNd = pEnd->nNode.GetNode().GetCntntNode();
+ aEndPos.nContent = pCNd ? pCNd->Len() : 1;
+ sal_Bool bCheckDel = sal_True;
+
+ // es existiert fuer den Bereich irgendein Redline-Delete-Object
+ for( ; nRedlPos < GetRedlineTbl().Count(); ++nRedlPos )
+ {
+ const SwRedline* pTmp = GetRedlineTbl()[ nRedlPos ];
+ if( !bCheckDel || nsRedlineType_t::REDLINE_DELETE == pTmp->GetType() )
+ {
+ const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End();
+ switch( ComparePosition( *pRStt, *pREnd, aStPos, aEndPos ))
+ {
+ case POS_COLLIDE_START:
+ case POS_BEHIND: // Pos1 liegt hinter Pos2
+ nRedlPos = GetRedlineTbl().Count();
+ break;
+
+ case POS_COLLIDE_END:
+ case POS_BEFORE: // Pos1 liegt vor Pos2
+ break;
+ case POS_INSIDE: // Pos1 liegt vollstaendig in Pos2
+ // ist erlaubt, aber checke dann alle nachfolgenden
+ // auf Ueberlappungen
+ bCheckDel = sal_False;
+ break;
+
+ case POS_OUTSIDE: // Pos2 liegt vollstaendig in Pos1
+ case POS_EQUAL: // Pos1 ist genauso gross wie Pos2
+ case POS_OVERLAP_BEFORE: // Pos1 ueberlappt Pos2 am Anfang
+ case POS_OVERLAP_BEHIND: // Pos1 ueberlappt Pos2 am Ende
+ return sal_False;
+ }
+ }
+ }
+ }
+ }
+
+ {
+ // DataChanged vorm verschieben verschicken, dann bekommt
+ // man noch mit, welche Objecte sich im Bereich befinden.
+ // Danach koennen sie vor/hinter der Position befinden.
+ SwDataChanged aTmp( rPam, 0 );
+ }
+
+ SwNodeIndex aIdx( nOffset > 0 ? pEnd->nNode : pStt->nNode, nOffs );
+ SwNodeRange aMvRg( pStt->nNode, 0, pEnd->nNode, +1 );
+
+ SwRedline* pOwnRedl = 0;
+ if( IsRedlineOn() )
+ {
+ // wenn der Bereich komplett im eigenen Redline liegt, kann es
+ // verschoben werden!
+ sal_uInt16 nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_INSERT );
+ if( USHRT_MAX != nRedlPos )
+ {
+ SwRedline* pTmp = GetRedlineTbl()[ nRedlPos ];
+ const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End();
+ SwRedline aTmpRedl( nsRedlineType_t::REDLINE_INSERT, rPam );
+ const SwCntntNode* pCEndNd = pEnd->nNode.GetNode().GetCntntNode();
+ // liegt komplett im Bereich, und ist auch der eigene Redline?
+ if( aTmpRedl.IsOwnRedline( *pTmp ) &&
+ (pRStt->nNode < pStt->nNode ||
+ (pRStt->nNode == pStt->nNode && !pRStt->nContent.GetIndex()) ) &&
+ (pEnd->nNode < pREnd->nNode ||
+ (pEnd->nNode == pREnd->nNode &&
+ pCEndNd ? pREnd->nContent.GetIndex() == pCEndNd->Len()
+ : !pREnd->nContent.GetIndex() )) )
+ {
+ pOwnRedl = pTmp;
+ if( nRedlPos + 1 < GetRedlineTbl().Count() )
+ {
+ pTmp = GetRedlineTbl()[ nRedlPos+1 ];
+ if( *pTmp->Start() == *pREnd )
+ // dann doch nicht!
+ pOwnRedl = 0;
+ }
+
+ if( pOwnRedl &&
+ !( pRStt->nNode <= aIdx && aIdx <= pREnd->nNode ))
+ {
+ // nicht in sich selbst, dann auch nicht moven
+ pOwnRedl = 0;
+ }
+ }
+ }
+
+ if( !pOwnRedl )
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+
+ // zuerst das Insert, dann das Loeschen
+ SwPosition aInsPos( aIdx );
+ aInsPos.nContent.Assign( aIdx.GetNode().GetCntntNode(), 0 );
+
+ SwPaM aPam( pStt->nNode, aMvRg.aEnd );
+
+ SwPaM& rOrigPam = (SwPaM&)rPam;
+ rOrigPam.DeleteMark();
+ rOrigPam.GetPoint()->nNode = aIdx.GetIndex() - 1;
+
+ sal_Bool bDelLastPara = !aInsPos.nNode.GetNode().IsCntntNode();
+
+ /* #101076# When copying to a non-content node Copy will
+ insert a paragraph before that node and insert before
+ that inserted node. Copy creates an SwUndoInserts that
+ does not cover the extra paragraph. Thus we insert the
+ extra paragraph ourselves, _with_ correct undo
+ information. */
+ if (bDelLastPara)
+ {
+ /* aInsPos points to the non-content node. Move it to
+ the previous content node. */
+ SwPaM aInsPam(aInsPos);
+ sal_Bool bMoved = aInsPam.Move(fnMoveBackward);
+ ASSERT(bMoved, "No content node found!");
+
+ if (bMoved)
+ {
+ /* Append the new node after the content node
+ found. The new position to insert the moved
+ paragraph at is before the inserted
+ paragraph. */
+ AppendTxtNode(*aInsPam.GetPoint());
+ aInsPos = *aInsPam.GetPoint();
+ }
+ }
+
+ CopyRange( aPam, aInsPos, false );
+ if( bDelLastPara )
+ {
+ // dann muss der letzte leere Node wieder entfernt werden
+ aIdx = aInsPos.nNode;
+ SwCntntNode* pCNd = GetNodes().GoPrevious( &aInsPos.nNode );
+ xub_StrLen nCLen = 0; if( pCNd ) nCLen = pCNd->Len();
+ aInsPos.nContent.Assign( pCNd, nCLen );
+
+ // alle die im zu loeschenden Node stehen, mussen auf den
+ // naechsten umgestezt werden
+ SwPosition* pPos;
+ for( sal_uInt16 n = 0; n < GetRedlineTbl().Count(); ++n )
+ {
+ SwRedline* pTmp = GetRedlineTbl()[ n ];
+ if( ( pPos = &pTmp->GetBound(sal_True))->nNode == aIdx )
+ {
+ pPos->nNode++;
+ pPos->nContent.Assign( pPos->nNode.GetNode().GetCntntNode(),0);
+ }
+ if( ( pPos = &pTmp->GetBound(sal_False))->nNode == aIdx )
+ {
+ pPos->nNode++;
+ pPos->nContent.Assign( pPos->nNode.GetNode().GetCntntNode(),0);
+ }
+ }
+ CorrRel( aIdx, aInsPos, 0, sal_False );
+
+ pCNd->JoinNext();
+ }
+
+ rOrigPam.GetPoint()->nNode++;
+ rOrigPam.GetPoint()->nContent.Assign( rOrigPam.GetCntntNode(), 0 );
+
+ RedlineMode_t eOld = GetRedlineMode();
+ checkRedlining(eOld);
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ //JP 06.01.98: MUSS noch optimiert werden!!!
+ SetRedlineMode(
+ (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
+ SwUndo *const pUndo(new SwUndoRedlineDelete(aPam, UNDO_DELETE));
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ SwRedline* pNewRedline = new SwRedline( nsRedlineType_t::REDLINE_DELETE, aPam );
+
+ // #101654# prevent assertion from aPam's target being deleted
+ // (Alternatively, one could just let aPam go out of scope, but
+ // that requires touching a lot of code.)
+ aPam.GetBound(sal_True).nContent.Assign( NULL, 0 );
+ aPam.GetBound(sal_False).nContent.Assign( NULL, 0 );
+
+ AppendRedline( pNewRedline, true );
+
+//JP 06.01.98: MUSS noch optimiert werden!!!
+SetRedlineMode( eOld );
+ GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ SetModified();
+
+ return sal_True;
+ }
+ }
+
+ if( !pOwnRedl && !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ {
+ SwPaM aTemp(aIdx);
+ SplitRedline(aTemp);
+ }
+
+ sal_uLong nRedlSttNd(0), nRedlEndNd(0);
+ if( pOwnRedl )
+ {
+ const SwPosition *pRStt = pOwnRedl->Start(), *pREnd = pOwnRedl->End();
+ nRedlSttNd = pRStt->nNode.GetIndex();
+ nRedlEndNd = pREnd->nNode.GetIndex();
+ }
+
+ SwUndoMoveNum* pUndo = 0;
+ sal_uLong nMoved = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoMoveNum( rPam, nOffset, bIsOutlMv );
+ nMoved = rPam.End()->nNode.GetIndex() - rPam.Start()->nNode.GetIndex() + 1;
+ }
+
+
+ MoveNodeRange( aMvRg, aIdx, DOC_MOVEREDLINES );
+
+ if( pUndo )
+ {
+ // i57907: Under circumstances (sections at the end of a chapter)
+ // the rPam.Start() is not moved to the new position.
+ // But aIdx should be at the new end position and as long as the number of moved paragraphs
+ // is nMoved, I know, where the new position is.
+ pUndo->SetStartNode( aIdx.GetIndex() - nMoved );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ if( pOwnRedl )
+ {
+ SwPosition *pRStt = pOwnRedl->Start(), *pREnd = pOwnRedl->End();
+ if( pRStt->nNode.GetIndex() != nRedlSttNd )
+ {
+ pRStt->nNode = nRedlSttNd;
+ pRStt->nContent.Assign( pRStt->nNode.GetNode().GetCntntNode(),0);
+ }
+ if( pREnd->nNode.GetIndex() != nRedlEndNd )
+ {
+ pREnd->nNode = nRedlEndNd;
+ SwCntntNode* pCNd = pREnd->nNode.GetNode().GetCntntNode();
+ xub_StrLen nL = 0; if( pCNd ) nL = pCNd->Len();
+ pREnd->nContent.Assign( pCNd, nL );
+ }
+ }
+
+ SetModified();
+ return sal_True;
+}
+
+sal_Bool SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, sal_Bool bDel )
+{
+ sal_Bool bResult = sal_False;
+ SwTxtNode * pTxtNd = rIdx.GetNode().GetTxtNode();
+
+ if (pTxtNd && pTxtNd->GetNumRule() != NULL &&
+ (pTxtNd->HasNumber() || pTxtNd->HasBullet()))
+ {
+ if ( !pTxtNd->IsCountedInList() == !bDel)
+ {
+ sal_Bool bOldNum = bDel; // == pTxtNd->IsCounted();
+ sal_Bool bNewNum = bDel ? sal_False : sal_True;
+ pTxtNd->SetCountedInList(bNewNum ? true : false);
+
+ SetModified();
+
+ bResult = sal_True;
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndoNumOrNoNum * pUndo =
+ new SwUndoNumOrNoNum(rIdx, bOldNum, bNewNum);
+
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ }
+ else if (bDel && pTxtNd->GetNumRule(sal_False) &&
+ pTxtNd->GetActualListLevel() >= 0 &&
+ pTxtNd->GetActualListLevel() < MAXLEVEL)
+ {
+ SwPaM aPam(*pTxtNd);
+
+ DelNumRules(aPam);
+
+ bResult = sal_True;
+ }
+ }
+
+ return bResult;
+}
+
+SwNumRule* SwDoc::GetCurrNumRule( const SwPosition& rPos ) const
+{
+ SwNumRule* pRet = 0;
+ SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
+
+ if( pTNd )
+ {
+ // --> OD 2008-02-20 #refactorlists#
+// pTNd->SyncNumberAndNumRule();
+ // <--
+ pRet = pTNd->GetNumRule();
+ }
+
+ return pRet;
+}
+
+sal_uInt16 SwDoc::FindNumRule( const String& rName ) const
+{
+ for( sal_uInt16 n = pNumRuleTbl->Count(); n; )
+ if( (*pNumRuleTbl)[ --n ]->GetName() == rName )
+ return n;
+
+ return USHRT_MAX;
+}
+
+SwNumRule* SwDoc::FindNumRulePtr( const String& rName ) const
+{
+ SwNumRule * pResult = 0;
+
+ pResult = maNumRuleMap[rName];
+
+ if ( !pResult )
+ {
+ for (sal_uInt16 n = 0; n < pNumRuleTbl->Count(); ++n)
+ {
+ if ((*pNumRuleTbl)[n]->GetName() == rName)
+ {
+ pResult = (*pNumRuleTbl)[n];
+
+ break;
+ }
+ }
+ }
+
+ return pResult;
+}
+
+// #i36749#
+void SwDoc::AddNumRule(SwNumRule * pRule)
+{
+ pNumRuleTbl->Insert(pRule, pNumRuleTbl->Count());
+ maNumRuleMap[pRule->GetName()] = pRule;
+ pRule->SetNumRuleMap(&maNumRuleMap);
+
+ // --> OD 2008-03-26 #refactorlists#
+ createListForListStyle( pRule->GetName() );
+ // <--
+}
+
+// --> OD 2008-02-11 #newlistlevelattrs#
+sal_uInt16 SwDoc::MakeNumRule( const String &rName,
+ const SwNumRule* pCpy,
+ sal_Bool bBroadcast,
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode )
+{
+ SwNumRule* pNew;
+ if( pCpy )
+ {
+ pNew = new SwNumRule( *pCpy );
+
+ // --> OD 2008-07-08 #i91400#
+ pNew->SetName( GetUniqueNumRuleName( &rName ), *this );
+ // <--
+ if( pNew->GetName() != rName )
+ {
+ pNew->SetPoolFmtId( USHRT_MAX );
+ pNew->SetPoolHelpId( USHRT_MAX );
+ pNew->SetPoolHlpFileId( UCHAR_MAX );
+ // --> OD 2008-04-03 #refactorlists#
+ pNew->SetDefaultListId( String() );
+ // <--
+ }
+ pNew->CheckCharFmts( this );
+ }
+ else
+ {
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ pNew = new SwNumRule( GetUniqueNumRuleName( &rName ),
+ eDefaultNumberFormatPositionAndSpaceMode );
+ // <--
+ }
+
+ sal_uInt16 nRet = pNumRuleTbl->Count();
+
+ AddNumRule(pNew); // #i36749#
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo * pUndo = new SwUndoNumruleCreate(pNew, this);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ if (bBroadcast)
+ BroadcastStyleOperation(pNew->GetName(), SFX_STYLE_FAMILY_PSEUDO,
+ SFX_STYLESHEET_CREATED);
+
+ return nRet;
+}
+
+String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) const
+{
+ String aName;
+ if( bAutoNum )
+ {
+ long n = Time().GetTime();
+ n += Date().GetDate();
+ aName = String::CreateFromInt32( n );
+ if( pChkStr && !pChkStr->Len() )
+ pChkStr = 0;
+ }
+ else if( pChkStr && pChkStr->Len() )
+ aName = *pChkStr;
+ else
+ {
+ pChkStr = 0;
+ aName = SW_RESSTR( STR_NUMRULE_DEFNAME );
+ }
+
+ sal_uInt16 nNum(0), nTmp, nFlagSize = ( pNumRuleTbl->Count() / 8 ) +2;
+ sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
+ memset( pSetFlags, 0, nFlagSize );
+
+ xub_StrLen nNmLen = aName.Len();
+ if( !bAutoNum && pChkStr )
+ {
+ while( nNmLen-- && '0' <= aName.GetChar( nNmLen ) &&
+ '9' >= aName.GetChar( nNmLen ) )
+ ; //nop
+
+ if( ++nNmLen < aName.Len() )
+ {
+ aName.Erase( nNmLen );
+ pChkStr = 0;
+ }
+ }
+
+ const SwNumRule* pNumRule;
+ sal_uInt16 n;
+
+ for( n = 0; n < pNumRuleTbl->Count(); ++n )
+ if( 0 != ( pNumRule = (*pNumRuleTbl)[ n ] ) )
+ {
+ const String& rNm = pNumRule->GetName();
+ if( rNm.Match( aName ) == nNmLen )
+ {
+ // Nummer bestimmen und das Flag setzen
+ nNum = (sal_uInt16)rNm.Copy( nNmLen ).ToInt32();
+ if( nNum-- && nNum < pNumRuleTbl->Count() )
+ pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
+ }
+ if( pChkStr && pChkStr->Equals( rNm ) )
+ pChkStr = 0;
+ }
+
+ if( !pChkStr )
+ {
+ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+ nNum = pNumRuleTbl->Count();
+ for( n = 0; n < nFlagSize; ++n )
+ if( 0xff != ( nTmp = pSetFlags[ n ] ))
+ {
+ // also die Nummer bestimmen
+ nNum = n * 8;
+ while( nTmp & 1 )
+ ++nNum, nTmp >>= 1;
+ break;
+ }
+
+ }
+ delete [] pSetFlags;
+ if( pChkStr && pChkStr->Len() )
+ return *pChkStr;
+ return aName += String::CreateFromInt32( ++nNum );
+}
+
+void SwDoc::UpdateNumRule()
+{
+ const SwNumRuleTbl& rNmTbl = GetNumRuleTbl();
+ for( sal_uInt16 n = 0; n < rNmTbl.Count(); ++n )
+ if( rNmTbl[ n ]->IsInvalidRule() )
+ rNmTbl[ n ]->Validate();
+}
+
+// --> OD 2008-04-02 #refactorlists#
+void SwDoc::MarkListLevel( const String& sListId,
+ const int nListLevel,
+ const sal_Bool bValue )
+{
+ SwList* pList = getListByName( sListId );
+
+ if ( pList )
+ {
+ MarkListLevel( *pList, nListLevel, bValue );
+ }
+}
+
+void SwDoc::MarkListLevel( SwList& rList,
+ const int nListLevel,
+ const sal_Bool bValue )
+{
+ // Set new marked list level and notify all affected nodes of the changed mark.
+ rList.MarkListLevel( nListLevel, bValue );
+}
+// <- #i27615#
+// <--
+
+// #i23726#
+sal_Bool SwDoc::IsFirstOfNumRule(SwPosition & rPos)
+{
+ sal_Bool bResult = sal_False;
+ SwTxtNode * pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+
+ if (pTxtNode)
+ {
+ SwNumRule * pNumRule = pTxtNode->GetNumRule();
+
+ if (pNumRule)
+ bResult = pTxtNode->IsFirstOfNumRule();
+ }
+
+ return bResult;
+}
+
+// --> OD 2007-10-26 #i83479#
+// implementation for interface <IDocumentListItems>
+bool SwDoc::lessThanNodeNum::operator()( const SwNodeNum* pNodeNumOne,
+ const SwNodeNum* pNodeNumTwo ) const
+{
+ return pNodeNumOne->LessThan( *pNodeNumTwo );
+}
+
+void SwDoc::addListItem( const SwNodeNum& rNodeNum )
+{
+ if ( mpListItemsList == 0 )
+ {
+ return;
+ }
+
+ const bool bAlreadyInserted(
+ mpListItemsList->find( &rNodeNum ) != mpListItemsList->end() );
+ ASSERT( !bAlreadyInserted,
+ "<SwDoc::InsertListItem(..)> - <SwNodeNum> instance already registered as numbered item!" );
+ if ( !bAlreadyInserted )
+ {
+ mpListItemsList->insert( &rNodeNum );
+ }
+}
+
+void SwDoc::removeListItem( const SwNodeNum& rNodeNum )
+{
+ if ( mpListItemsList == 0 )
+ {
+ return;
+ }
+
+ const tImplSortedNodeNumList::size_type nDeleted = mpListItemsList->erase( &rNodeNum );
+ if ( nDeleted > 1 )
+ {
+ ASSERT( false,
+ "<SwDoc::RemoveListItem(..)> - <SwNodeNum> was registered more than once as numbered item!" );
+ }
+}
+
+String SwDoc::getListItemText( const SwNodeNum& rNodeNum,
+ const bool bWithNumber,
+ const bool bWithSpacesForLevel ) const
+{
+ return rNodeNum.GetTxtNode()
+ ? rNodeNum.GetTxtNode()->GetExpandTxt( 0, STRING_LEN, bWithNumber,
+ bWithNumber, bWithSpacesForLevel )
+ : String();
+}
+
+void SwDoc::getListItems( tSortedNodeNumList& orNodeNumList ) const
+{
+ orNodeNumList.clear();
+ orNodeNumList.reserve( mpListItemsList->size() );
+
+ tImplSortedNodeNumList::iterator aIter;
+ tImplSortedNodeNumList::iterator aEndIter = mpListItemsList->end();
+ for ( aIter = mpListItemsList->begin(); aIter != aEndIter; ++aIter )
+ {
+ orNodeNumList.push_back( (*aIter) );
+ }
+}
+
+void SwDoc::getNumItems( tSortedNodeNumList& orNodeNumList ) const
+{
+ orNodeNumList.clear();
+ orNodeNumList.reserve( mpListItemsList->size() );
+
+ tImplSortedNodeNumList::iterator aIter;
+ tImplSortedNodeNumList::iterator aEndIter = mpListItemsList->end();
+ for ( aIter = mpListItemsList->begin(); aIter != aEndIter; ++aIter )
+ {
+ const SwNodeNum* pNodeNum = (*aIter);
+ if ( pNodeNum->IsCounted() &&
+ pNodeNum->GetTxtNode() && pNodeNum->GetTxtNode()->HasNumber() )
+ {
+ orNodeNumList.push_back( pNodeNum );
+ }
+ }
+}
+// <--
+
+// --> OD 2007-11-15 #i83479#
+// implementation for interface <IDocumentOutlineNodes>
+sal_Int32 SwDoc::getOutlineNodesCount() const
+{
+ return GetNodes().GetOutLineNds().Count();
+}
+
+int SwDoc::getOutlineLevel( const sal_Int32 nIdx ) const
+{
+ return GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]->
+ // GetTxtNode()->GetOutlineLevel(); //#outline level,zhaojianwei
+ GetTxtNode()->GetAttrOutlineLevel()-1; //<-end,zhaojianwei
+}
+
+String SwDoc::getOutlineText( const sal_Int32 nIdx,
+ const bool bWithNumber,
+ const bool bWithSpacesForLevel ) const
+{
+ return GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]->
+ GetTxtNode()->GetExpandTxt( 0, STRING_LEN, bWithNumber,
+ bWithNumber, bWithSpacesForLevel );
+}
+
+SwTxtNode* SwDoc::getOutlineNode( const sal_Int32 nIdx ) const
+{
+ return GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]->GetTxtNode();
+}
+
+void SwDoc::getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const
+{
+ orOutlineNodeList.clear();
+ orOutlineNodeList.reserve( getOutlineNodesCount() );
+
+ const sal_uInt16 nOutlCount( static_cast<sal_uInt16>(getOutlineNodesCount()) );
+ for ( sal_uInt16 i = 0; i < nOutlCount; ++i )
+ {
+ orOutlineNodeList.push_back(
+ GetNodes().GetOutLineNds()[i]->GetTxtNode() );
+ }
+}
+// <--
+
+// --> OD 2008-03-26 #refactorlists#
+// implementation of interface IDocumentListsAccess
+SwList* SwDoc::createList( String sListId,
+ const String sDefaultListStyleName )
+{
+ if ( sListId.Len() == 0 )
+ {
+ sListId = listfunc::CreateUniqueListId( *this );
+ }
+
+ if ( getListByName( sListId ) )
+ {
+ ASSERT( false,
+ "<SwDoc::createList(..)> - provided list id already used. Serious defect -> please inform OD." );
+ return 0;
+ }
+
+ SwNumRule* pDefaultNumRuleForNewList = FindNumRulePtr( sDefaultListStyleName );
+ if ( !pDefaultNumRuleForNewList )
+ {
+ ASSERT( false,
+ "<SwDoc::createList(..)> - for provided default list style name no list style is found. Serious defect -> please inform OD." );
+ return 0;
+ }
+
+ SwList* pNewList = new SwList( sListId, *pDefaultNumRuleForNewList, GetNodes() );
+ maLists[sListId] = pNewList;
+
+ return pNewList;
+}
+
+void SwDoc::deleteList( const String sListId )
+{
+ SwList* pList = getListByName( sListId );
+ if ( pList )
+ {
+ maLists.erase( sListId );
+ delete pList;
+ }
+}
+
+SwList* SwDoc::getListByName( const String sListId ) const
+{
+ SwList* pList = 0;
+
+ std::hash_map< String, SwList*, StringHash >::const_iterator
+ aListIter = maLists.find( sListId );
+ if ( aListIter != maLists.end() )
+ {
+ pList = (*aListIter).second;
+ }
+
+ return pList;
+}
+
+SwList* SwDoc::createListForListStyle( const String sListStyleName )
+{
+ if ( sListStyleName.Len() == 0 )
+ {
+ ASSERT( false,
+ "<SwDoc::createListForListStyle(..)> - no list style name provided. Serious defect -> please inform OD." );
+ return 0;
+ }
+
+ if ( getListForListStyle( sListStyleName ) )
+ {
+ ASSERT( false,
+ "<SwDoc::createListForListStyle(..)> - a list for the provided list style name already exists. Serious defect -> please inform OD." );
+ return 0;
+ }
+
+ SwNumRule* pNumRule = FindNumRulePtr( sListStyleName );
+ if ( !pNumRule )
+ {
+ ASSERT( false,
+ "<SwDoc::createListForListStyle(..)> - for provided list style name no list style is found. Serious defect -> please inform OD." );
+ return 0;
+ }
+
+ String sListId( pNumRule->GetDefaultListId() ); // can be empty String
+ if ( getListByName( sListId ) )
+ {
+ sListId = String();
+ }
+ SwList* pNewList = createList( sListId, sListStyleName );
+ maListStyleLists[sListStyleName] = pNewList;
+ pNumRule->SetDefaultListId( pNewList->GetListId() );
+
+ return pNewList;
+}
+
+SwList* SwDoc::getListForListStyle( const String sListStyleName ) const
+{
+ SwList* pList = 0;
+
+ std::hash_map< String, SwList*, StringHash >::const_iterator
+ aListIter = maListStyleLists.find( sListStyleName );
+ if ( aListIter != maListStyleLists.end() )
+ {
+ pList = (*aListIter).second;
+ }
+
+ return pList;
+}
+
+void SwDoc::deleteListForListStyle( const String sListStyleName )
+{
+ String sListId;
+ {
+ SwList* pList = getListForListStyle( sListStyleName );
+ ASSERT( pList,
+ "<SwDoc::deleteListForListStyle(..)> - misusage of method: no list found for given list style name" );
+ if ( pList )
+ {
+ sListId = pList->GetListId();
+ }
+ }
+ if ( sListId.Len() > 0 )
+ {
+ maListStyleLists.erase( sListStyleName );
+ deleteList( sListId );
+ }
+}
+// <--
+// --> OD 2008-07-08 #i91400#
+void SwDoc::trackChangeOfListStyleName( const String sListStyleName,
+ const String sNewListStyleName )
+{
+ SwList* pList = getListForListStyle( sListStyleName );
+ ASSERT( pList,
+ "<SwDoc::changeOfListStyleName(..)> - misusage of method: no list found for given list style name" );
+
+ if ( pList != 0 )
+ {
+ maListStyleLists.erase( sListStyleName );
+ maListStyleLists[sNewListStyleName] = pList;
+ }
+}
+// <--
+
+// --> OD 2008-03-13 #refactorlists#
+namespace listfunc
+{
+ const String MakeListIdUnique( const SwDoc& rDoc,
+ const String aSuggestedUniqueListId )
+ {
+ long nHitCount = 0;
+ String aTmpStr = aSuggestedUniqueListId;
+ while ( rDoc.getListByName( aTmpStr ) )
+ {
+ ++nHitCount;
+ aTmpStr = aSuggestedUniqueListId;
+ aTmpStr += String::CreateFromInt32( nHitCount );
+ }
+
+ return aTmpStr;
+ }
+ const String CreateUniqueListId( const SwDoc& rDoc )
+ {
+ // --> OD 2008-08-06 #i92478#
+ String aNewListId = String::CreateFromAscii( "list" );
+ // <--
+ sal_Int64 n = Time().GetTime();
+ n += Date().GetDate();
+ n += rand();
+ // --> OD 2008-08-06 #i92478#
+ aNewListId += String::CreateFromInt64( n );
+ // <--
+
+ return MakeListIdUnique( rDoc, aNewListId );
+ }
+}
+// <--
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
new file mode 100644
index 000000000000..b46cf1e101c0
--- /dev/null
+++ b/sw/source/core/doc/docredln.cxx
@@ -0,0 +1,3868 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <tools/shl.hxx>
+#include <svl/itemiter.hxx>
+#include <sfx2/app.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <swmodule.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <docary.hxx>
+#include <ndtxt.hxx>
+#include <redline.hxx>
+#include <swundo.hxx>
+#include <UndoCore.hxx>
+#include <UndoRedline.hxx>
+#include <hints.hxx>
+#include <pamtyp.hxx>
+#include <poolfmt.hxx>
+#include <viewsh.hxx>
+#include <rootfrm.hxx>
+
+#include <comcore.hrc>
+
+using namespace com::sun::star;
+
+TYPEINIT1(SwRedlineHint, SfxHint);
+
+#ifndef DBG_UTIL
+
+ #define _CHECK_REDLINE( pDoc )
+ #define _DEBUG_REDLINE( pDoc )
+
+#else
+
+#define _ERROR_PREFIX "redline table corrupted: "
+
+ // helper function for lcl_CheckRedline
+ // 1. make sure that pPos->nContent points into pPos->nNode
+ // (or into the 'special' no-content-node-IndexReg)
+ // 2. check that position is valid and doesn't point behind text
+ void lcl_CheckPosition( const SwPosition* pPos )
+ {
+ SwPosition aComparePos( *pPos );
+ aComparePos.nContent.Assign(
+ aComparePos.nNode.GetNode().GetCntntNode(), 0 );
+ DBG_ASSERT( pPos->nContent.GetIdxReg() ==
+ aComparePos.nContent.GetIdxReg(),
+ _ERROR_PREFIX "illegal position" );
+
+ SwTxtNode* pTxtNode = pPos->nNode.GetNode().GetTxtNode();
+ if( pTxtNode == NULL )
+ {
+ DBG_ASSERT( pPos->nContent == 0,
+ _ERROR_PREFIX "non-text-node with content" );
+ }
+ else
+ {
+ DBG_ASSERT( pPos->nContent >= 0 &&
+ pPos->nContent <= pTxtNode->Len(),
+ _ERROR_PREFIX "index behind text" );
+ }
+ }
+
+ void lcl_CheckPam( const SwPaM* pPam )
+ {
+ DBG_ASSERT( pPam != NULL, _ERROR_PREFIX "illegal argument" );
+ lcl_CheckPosition( pPam->GetPoint() );
+ lcl_CheckPosition( pPam->GetMark() );
+ }
+
+ // check validity of the redline table. Checks redline bounds, and make
+ // sure the redlines are sorted and non-overlapping.
+ void lcl_CheckRedline( const SwDoc* pDoc )
+ {
+ const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+
+ // verify valid redline positions
+ for( sal_uInt16 i = 0; i < rTbl.Count(); ++i )
+ lcl_CheckPam( rTbl[ i ] );
+
+ for( sal_uInt16 j = 0; j < rTbl.Count(); ++j )
+ {
+ // check for empty redlines
+ DBG_ASSERT( ( *(rTbl[j]->GetPoint()) != *(rTbl[j]->GetMark()) ) ||
+ ( rTbl[j]->GetContentIdx() != NULL ),
+ _ERROR_PREFIX "empty redline" );
+ }
+
+ // verify proper redline sorting
+ for( sal_uInt16 n = 1; n < rTbl.Count(); ++n )
+ {
+ const SwRedline* pPrev = rTbl[ n-1 ];
+ const SwRedline* pCurrent = rTbl[ n ];
+
+ // check redline sorting
+ DBG_ASSERT( *pPrev->Start() <= *pCurrent->Start(),
+ _ERROR_PREFIX "not sorted correctly" );
+
+ // check for overlapping redlines
+ DBG_ASSERT( *pPrev->End() <= *pCurrent->Start(),
+ _ERROR_PREFIX "overlapping redlines" );
+ }
+ }
+
+ #define _CHECK_REDLINE( pDoc ) lcl_CheckRedline( pDoc );
+
+ void lcl_DebugRedline( const SwDoc* pDoc )
+ {
+ static sal_uInt16 nWatch = 0;
+ const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ {
+ sal_uInt16 nDummy = 0;
+ const SwRedline* pCurrent = rTbl[ n ];
+ const SwRedline* pNext = n+1 < rTbl.Count() ? rTbl[ n+1 ] : 0;
+ if( pCurrent == pNext )
+ ++nDummy;
+ if( n == nWatch )
+ ++nDummy; // Possible debugger breakpoint
+ }
+ }
+
+ #define _DEBUG_REDLINE( pDoc ) lcl_DebugRedline( pDoc );
+
+#endif
+
+SV_IMPL_OP_PTRARR_SORT( _SwRedlineTbl, SwRedlinePtr )
+
+RedlineMode_t SwDoc::GetRedlineMode() const
+{
+ return eRedlineMode;
+}
+
+void SwDoc::SetRedlineMode( RedlineMode_t eMode )
+{
+ if( eRedlineMode != eMode )
+ {
+ if( (nsRedlineMode_t::REDLINE_SHOW_MASK & eRedlineMode) != (nsRedlineMode_t::REDLINE_SHOW_MASK & eMode)
+ || 0 == (nsRedlineMode_t::REDLINE_SHOW_MASK & eMode) )
+ {
+ bool bSaveInXMLImportFlag = IsInXMLImport();
+ SetInXMLImport( false );
+ // und dann alles verstecken, anzeigen
+ void (SwRedline::*pFnc)( sal_uInt16 ) = 0;
+
+ switch( nsRedlineMode_t::REDLINE_SHOW_MASK & eMode )
+ {
+ case nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE :
+ pFnc = &SwRedline::Show;
+ break;
+ case nsRedlineMode_t::REDLINE_SHOW_INSERT:
+ pFnc = &SwRedline::Hide;
+ break;
+ case nsRedlineMode_t::REDLINE_SHOW_DELETE:
+ pFnc = &SwRedline::ShowOriginal;
+ break;
+
+ default:
+ pFnc = &SwRedline::Hide;
+ eMode = (RedlineMode_t)(eMode | nsRedlineMode_t::REDLINE_SHOW_INSERT);
+ break;
+ }
+
+ _CHECK_REDLINE( this )
+
+ if( pFnc )
+ for( sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop )
+ for( sal_uInt16 i = 0; i < pRedlineTbl->Count(); ++i )
+ ((*pRedlineTbl)[ i ]->*pFnc)( nLoop );
+ _CHECK_REDLINE( this )
+ SetInXMLImport( bSaveInXMLImportFlag );
+ }
+ eRedlineMode = eMode;
+ SetModified();
+ }
+}
+
+bool SwDoc::IsRedlineOn() const
+{
+ return IDocumentRedlineAccess::IsRedlineOn(eRedlineMode);
+}
+
+bool SwDoc::IsIgnoreRedline() const
+{
+ return (nsRedlineMode_t::REDLINE_IGNORE & eRedlineMode);
+}
+
+void SwDoc::SetRedlineMode_intern(RedlineMode_t eMode)
+{
+ eRedlineMode = eMode;
+}
+
+const SwRedlineTbl& SwDoc::GetRedlineTbl() const
+{
+ return *pRedlineTbl;
+}
+
+bool SwDoc::IsRedlineMove() const
+{
+ return mbIsRedlineMove;
+}
+
+void SwDoc::SetRedlineMove(bool bFlag)
+{
+ mbIsRedlineMove = bFlag;
+}
+
+const uno::Sequence <sal_Int8>& SwDoc::GetRedlinePassword() const
+{
+ return aRedlinePasswd;
+}
+
+inline bool IsPrevPos( const SwPosition rPos1, const SwPosition rPos2 )
+{
+ const SwCntntNode* pCNd;
+ return 0 == rPos2.nContent.GetIndex() &&
+ rPos2.nNode.GetIndex() - 1 == rPos1.nNode.GetIndex() &&
+ 0 != ( pCNd = rPos1.nNode.GetNode().GetCntntNode() )
+ ? rPos1.nContent.GetIndex() == pCNd->Len()
+ : false;
+}
+
+#ifdef DEBUG
+bool CheckPosition( const SwPosition* pStt, const SwPosition* pEnd )
+{
+ int nError = 0;
+ SwNode* pSttNode = &pStt->nNode.GetNode();
+ SwNode* pEndNode = &pEnd->nNode.GetNode();
+ SwNode* pSttTab = pSttNode->StartOfSectionNode()->FindTableNode();
+ SwNode* pEndTab = pEndNode->StartOfSectionNode()->FindTableNode();
+ SwNode* pSttStart = pSttNode;
+ while( pSttStart && (!pSttStart->IsStartNode() || pSttStart->IsSectionNode() ||
+ pSttStart->IsTableNode() ) )
+ pSttStart = pSttStart->StartOfSectionNode();
+ SwNode* pEndStart = pEndNode;
+ while( pEndStart && (!pEndStart->IsStartNode() || pEndStart->IsSectionNode() ||
+ pEndStart->IsTableNode() ) )
+ pEndStart = pEndStart->StartOfSectionNode();
+ if( pSttTab != pEndTab )
+ nError = 1;
+ if( !pSttTab && pSttStart != pEndStart )
+ nError |= 2;
+ if( nError )
+ nError += 10;
+ return nError != 0;
+}
+#endif
+
+/*
+
+Text heisst, nicht von Redline "verseuchter" Text.
+
+Verhalten von Insert-Redline:
+ - im Text - Redline Object einfuegen
+ - im InsertRedline (eigenes) - ignorieren, bestehendes wird
+ aufgespannt
+ - im InsertRedline (andere) - Insert Redline aufsplitten
+ Redline Object einfuegen
+ - in DeleteRedline - Delete Redline aufsplitten oder
+ am Ende/Anfang verschieben
+
+Verhalten von Delete-Redline:
+ - im Text - Redline Object einfuegen
+ - im DeleteRedline (eigenes/andere) - ignorieren
+ - im InsertRedline (eigenes) - ignorieren, Zeichen aber loeschen
+ - im InsertRedline (andere) - Insert Redline aufsplitten
+ Redline Object einfuegen
+ - Ueberlappung von Text und - Text in eigenen Insert loeschen,
+ eigenem Insert im andereren Text aufspannen (bis
+ zum Insert!
+ - Ueberlappung von Text und - Redline Object einfuegen, der
+ anderem Insert andere Insert wird vom Delete
+ ueberlappt
+*/
+
+bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
+{
+#if 0
+// #i93179# disabled: ASSERT in ~SwIndexReg #ifdef DBG_UTIL
+ SwRedline aCopy( *pNewRedl );
+#endif
+ bool bError = true;
+ _CHECK_REDLINE( this )
+
+ if( IsRedlineOn() && !IsShowOriginal( eRedlineMode ) &&
+ pNewRedl->GetAuthorString().Len() )
+ {
+ pNewRedl->InvalidateRange();
+
+ if( mbIsAutoFmtRedline )
+ {
+ pNewRedl->SetAutoFmtFlag();
+ if( pAutoFmtRedlnComment && pAutoFmtRedlnComment->Len() )
+ {
+ pNewRedl->SetComment( *pAutoFmtRedlnComment );
+ pNewRedl->SetSeqNo( nAutoFmtRedlnCommentNo );
+ }
+ }
+
+ SwPosition* pStt = pNewRedl->Start(),
+ * pEnd = pStt == pNewRedl->GetPoint() ? pNewRedl->GetMark()
+ : pNewRedl->GetPoint();
+ {
+ SwTxtNode* pTxtNode = pStt->nNode.GetNode().GetTxtNode();
+ if( pTxtNode == NULL )
+ {
+ if( pStt->nContent > 0 )
+ {
+ DBG_ASSERT( false, "Redline start: non-text-node with content" );
+ pStt->nContent = 0;
+ }
+ }
+ else
+ {
+ if( pStt->nContent > pTxtNode->Len() )
+ {
+ DBG_ASSERT( false, "Redline start: index behind text" );
+ pStt->nContent = pTxtNode->Len();
+ }
+ }
+ pTxtNode = pEnd->nNode.GetNode().GetTxtNode();
+ if( pTxtNode == NULL )
+ {
+ if( pEnd->nContent > 0 )
+ {
+ DBG_ASSERT( false, "Redline end: non-text-node with content" );
+ pEnd->nContent = 0;
+ }
+ }
+ else
+ {
+ if( pEnd->nContent > pTxtNode->Len() )
+ {
+ DBG_ASSERT( false, "Redline end: index behind text" );
+ pEnd->nContent = pTxtNode->Len();
+ }
+ }
+ }
+ if( ( *pStt == *pEnd ) &&
+ ( pNewRedl->GetContentIdx() == NULL ) )
+ { // Do not insert empty redlines
+ delete pNewRedl;
+ return sal_False;
+ }
+ sal_Bool bCompress = sal_False;
+ sal_uInt16 n = 0;
+ // zur StartPos das erste Redline suchen
+ if( !GetRedline( *pStt, &n ) && n )
+ --n;
+ bool bDec = false;
+
+ for( ; pNewRedl && n < pRedlineTbl->Count(); bDec ? n : ++n )
+ {
+ bDec = false;
+#ifdef DVO_TEST
+ _CHECK_REDLINE( this )
+#endif
+
+ SwRedline* pRedl = (*pRedlineTbl)[ n ];
+ SwPosition* pRStt = pRedl->Start(),
+ * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark()
+ : pRedl->GetPoint();
+
+ // #i8518# remove empty redlines while we're at it
+ if( ( *pRStt == *pREnd ) &&
+ ( pRedl->GetContentIdx() == NULL ) )
+ {
+ pRedlineTbl->DeleteAndDestroy(n);
+ continue;
+ }
+
+ SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRStt, *pREnd );
+
+ switch( pNewRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ switch( pRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ if( pRedl->IsOwnRedline( *pNewRedl ) )
+ {
+ bool bDelete = false;
+
+ // ggfs. verschmelzen?
+ if( (( POS_BEHIND == eCmpPos &&
+ IsPrevPos( *pREnd, *pStt ) ) ||
+ ( POS_COLLIDE_START == eCmpPos ) ||
+ ( POS_OVERLAP_BEHIND == eCmpPos ) ) &&
+ pRedl->CanCombine( *pNewRedl ) &&
+ ( n+1 >= pRedlineTbl->Count() ||
+ ( *(*pRedlineTbl)[ n+1 ]->Start() >= *pEnd &&
+ *(*pRedlineTbl)[ n+1 ]->Start() != *pREnd ) ) )
+ {
+ pRedl->SetEnd( *pEnd, pREnd );
+ if( !pRedl->HasValidRange() )
+ {
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl );
+ }
+
+ bError = false;
+ bDelete = true;
+ }
+ else if( (( POS_BEFORE == eCmpPos &&
+ IsPrevPos( *pEnd, *pRStt ) ) ||
+ ( POS_COLLIDE_END == eCmpPos ) ||
+ ( POS_OVERLAP_BEFORE == eCmpPos ) ) &&
+ pRedl->CanCombine( *pNewRedl ) &&
+ ( !n ||
+ *(*pRedlineTbl)[ n-1 ]->End() != *pRStt ))
+ {
+ pRedl->SetStart( *pStt, pRStt );
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl );
+
+ bError = false;
+ bDelete = true;
+ }
+ else if ( POS_OUTSIDE == eCmpPos )
+ {
+ // #107164# own insert-over-insert
+ // redlines: just scrap the inside ones
+ pRedlineTbl->Remove( n );
+ bDec = true;
+ }
+ // <- #107164#
+ else if( POS_OVERLAP_BEHIND == eCmpPos )
+ {
+ *pStt = *pREnd;
+ if( ( *pStt == *pEnd ) &&
+ ( pNewRedl->GetContentIdx() == NULL ) )
+ bDelete = true;
+ }
+ else if( POS_OVERLAP_BEFORE == eCmpPos )
+ {
+ *pEnd = *pRStt;
+ if( ( *pStt == *pEnd ) &&
+ ( pNewRedl->GetContentIdx() == NULL ) )
+ bDelete = true;
+ }
+ else if( POS_INSIDE == eCmpPos || POS_EQUAL == eCmpPos)
+ bDelete = true;
+
+ if( bDelete )
+ {
+ delete pNewRedl, pNewRedl = 0;
+ bCompress = sal_True;
+ }
+ }
+ else if( POS_INSIDE == eCmpPos )
+ {
+ // aufsplitten
+ if( *pEnd != *pREnd )
+ {
+ SwRedline* pCpy = new SwRedline( *pRedl );
+ pCpy->SetStart( *pEnd );
+ pRedlineTbl->Insert( pCpy );
+ }
+ pRedl->SetEnd( *pStt, pREnd );
+ if( ( *pStt == *pRStt ) &&
+ ( pRedl->GetContentIdx() == NULL ) )
+ {
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else if( !pRedl->HasValidRange() )
+ {
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl );
+ }
+ }
+ else if ( POS_OUTSIDE == eCmpPos )
+ {
+ // #102366# handle overlapping redlines in broken
+ // documents
+
+ // split up the new redline, since it covers the
+ // existing redline. Insert the first part, and
+ // progress with the remainder as usual
+ SwRedline* pSplit = new SwRedline( *pNewRedl );
+ pSplit->SetEnd( *pRStt );
+ pNewRedl->SetStart( *pREnd );
+ pRedlineTbl->Insert( pSplit );
+ if( *pStt == *pEnd && pNewRedl->GetContentIdx() == NULL )
+ {
+ delete pNewRedl;
+ pNewRedl = 0;
+ bCompress = true;
+ }
+ }
+ else if ( POS_OVERLAP_BEHIND == eCmpPos )
+ {
+ // #107164# handle overlapping redlines in broken
+ // documents
+ pNewRedl->SetStart( *pREnd );
+ }
+ else if ( POS_OVERLAP_BEFORE == eCmpPos )
+ {
+ // #107164# handle overlapping redlines in broken
+ // documents
+ *pEnd = *pRStt;
+ if( ( *pStt == *pEnd ) &&
+ ( pNewRedl->GetContentIdx() == NULL ) )
+ {
+ delete pNewRedl;
+ pNewRedl = 0;
+ bCompress = true;
+ }
+ }
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ if( POS_INSIDE == eCmpPos )
+ {
+ // aufsplitten
+ if( *pEnd != *pREnd )
+ {
+ SwRedline* pCpy = new SwRedline( *pRedl );
+ pCpy->SetStart( *pEnd );
+ pRedlineTbl->Insert( pCpy );
+ }
+ pRedl->SetEnd( *pStt, pREnd );
+ if( ( *pStt == *pRStt ) &&
+ ( pRedl->GetContentIdx() == NULL ) )
+ {
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else if( !pRedl->HasValidRange() )
+ {
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl, n );
+ }
+ }
+ else if ( POS_OUTSIDE == eCmpPos )
+ {
+ // #102366# handle overlapping redlines in broken
+ // documents
+
+ // split up the new redline, since it covers the
+ // existing redline. Insert the first part, and
+ // progress with the remainder as usual
+ SwRedline* pSplit = new SwRedline( *pNewRedl );
+ pSplit->SetEnd( *pRStt );
+ pNewRedl->SetStart( *pREnd );
+ pRedlineTbl->Insert( pSplit );
+ if( *pStt == *pEnd && pNewRedl->GetContentIdx() == NULL )
+ {
+ delete pNewRedl;
+ pNewRedl = 0;
+ bCompress = true;
+ }
+ }
+ else if ( POS_EQUAL == eCmpPos )
+ {
+ // #112895# handle identical redlines in broken
+ // documents - delete old (delete) redline
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else if ( POS_OVERLAP_BEHIND == eCmpPos )
+ { // Another workaround for broken redlines (#107164#)
+ pNewRedl->SetStart( *pREnd );
+ }
+ break;
+ case nsRedlineType_t::REDLINE_FORMAT:
+ switch( eCmpPos )
+ {
+ case POS_OVERLAP_BEFORE:
+ pRedl->SetStart( *pEnd, pRStt );
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl, n );
+ bDec = true;
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ pRedl->SetEnd( *pStt, pREnd );
+ if( *pStt == *pRStt && pRedl->GetContentIdx() == NULL )
+ {
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ break;
+
+ case POS_EQUAL:
+ case POS_OUTSIDE:
+ // ueberlappt den akt. komplett oder hat gleiche
+ // Ausdehung, dann muss der alte geloescht werden
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ break;
+
+ case POS_INSIDE:
+ // ueberlappt den akt. komplett, dann muss
+ // der neue gesplittet oder verkuertzt werden
+ if( *pEnd != *pREnd )
+ {
+ if( *pEnd != *pRStt )
+ {
+ SwRedline* pNew = new SwRedline( *pRedl );
+ pNew->SetStart( *pEnd );
+ pRedl->SetEnd( *pStt, pREnd );
+ if( *pStt == *pRStt && pRedl->GetContentIdx() == NULL )
+ pRedlineTbl->DeleteAndDestroy( n );
+ AppendRedline( pNew, bCallDelete );
+ n = 0; // neu Aufsetzen
+ bDec = true;
+ }
+ }
+ else
+ pRedl->SetEnd( *pStt, pREnd );
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_DELETE:
+ switch( pRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_DELETE:
+ switch( eCmpPos )
+ {
+ case POS_OUTSIDE:
+ {
+ // ueberlappt den akt. komplett
+ // dann muss der neue gesplittet werden
+ if( *pEnd != *pREnd )
+ {
+ SwRedline* pNew = new SwRedline( *pNewRedl );
+ pNew->SetStart( *pREnd );
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ AppendRedline( pNew, bCallDelete );
+ n = 0; // neu Aufsetzen
+ bDec = true;
+ }
+ else
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ }
+ break;
+
+ case POS_INSIDE:
+ case POS_EQUAL:
+ delete pNewRedl, pNewRedl = 0;
+ bCompress = sal_True;
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ case POS_OVERLAP_BEHIND:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+// 1 == pRedl->GetStackCount() &&
+ pRedl->CanCombine( *pNewRedl ))
+ {
+ // dann kann das zusammengefasst werden, sprich
+ // der neue deckt das schon ab.
+ if( POS_OVERLAP_BEHIND == eCmpPos )
+ pNewRedl->SetStart( *pRStt, pStt );
+ else
+ pNewRedl->SetEnd( *pREnd, pEnd );
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else if( POS_OVERLAP_BEHIND == eCmpPos )
+ pNewRedl->SetStart( *pREnd, pStt );
+ else
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ break;
+
+ case POS_COLLIDE_START:
+ case POS_COLLIDE_END:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+// 1 == pRedl->GetStackCount() &&
+ pRedl->CanCombine( *pNewRedl ) )
+ {
+ if( IsHideChanges( eRedlineMode ))
+ {
+ // dann erstmal sichtbar machen, bevor
+ // die zusammengefasst werden koennen!
+ // Damit pNew auch beim Verschieben der
+ // Indizies behandelt wird, erstmal
+ // temporaer einfuegen
+ pRedlineTbl->SavePtrInArr( pNewRedl );
+ pRedl->Show();
+ pRedlineTbl->Remove( pRedlineTbl->GetPos(pNewRedl ));
+ pRStt = pRedl->Start();
+ pREnd = pRedl->End();
+ }
+
+ // dann kann das zusammengefasst werden, sprich
+ // der neue deckt das schon ab.
+ if( POS_COLLIDE_START == eCmpPos )
+ pNewRedl->SetStart( *pRStt, pStt );
+ else
+ pNewRedl->SetEnd( *pREnd, pEnd );
+
+ // delete current (below), and restart process with
+ // previous
+ sal_uInt16 nToBeDeleted = n;
+ bDec = true;
+
+ // #107359# Do it again, Sam!
+ // If you can do it for them, you can do it for me.
+ if( *(pNewRedl->Start()) <= *pREnd )
+ {
+ // Whoooah, we just extended the new 'redline'
+ // beyond previous redlines, so better start
+ // again. Of course this is not supposed to
+ // happen, and in an ideal world it doesn't,
+ // but unfortunately this code is buggy and
+ // totally rotten so it does happen and we
+ // better fix it.
+ n = 0;
+ bDec = true;
+ }
+
+ pRedlineTbl->DeleteAndDestroy( nToBeDeleted );
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_INSERT:
+ {
+ // b62341295: Do not throw away redlines
+ // even if they are not allowed to be combined
+ RedlineMode_t eOld = eRedlineMode;
+ if( !( eOld & nsRedlineMode_t::REDLINE_DONTCOMBINE_REDLINES ) &&
+ pRedl->IsOwnRedline( *pNewRedl ) )
+ {
+
+// auf NONE setzen, damit das Delete::Redo die RedlineDaten wieder richtig
+// zusammen fasst! Der ShowMode muss erhalten bleiben!
+ eRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
+ switch( eCmpPos )
+ {
+ case POS_EQUAL:
+ bCompress = sal_True;
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ // kein break!
+
+ case POS_INSIDE:
+ if( bCallDelete )
+ {
+ eRedlineMode = (RedlineMode_t)(eRedlineMode | nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES);
+
+ // #98863# DeleteAndJoin does not yield the
+ // desired result if there is no paragraph to
+ // join with, i.e. at the end of the document.
+ // For this case, we completely delete the
+ // paragraphs (if, of course, we also start on
+ // a paragraph boundary).
+ if( (pStt->nContent == 0) &&
+ pEnd->nNode.GetNode().IsEndNode() )
+ {
+ pEnd->nNode--;
+ pEnd->nContent.Assign(
+ pEnd->nNode.GetNode().GetTxtNode(), 0);
+ DelFullPara( *pNewRedl );
+ }
+ else
+ DeleteAndJoin( *pNewRedl );
+
+ bCompress = sal_True;
+ }
+ delete pNewRedl, pNewRedl = 0;
+ break;
+
+ case POS_OUTSIDE:
+ {
+ pRedlineTbl->Remove( n );
+ bDec = true;
+ // damit pNew auch beim Verschieben der Indizies
+ // behandelt wird, erstmal temp. einfuegen
+ if( bCallDelete )
+ {
+ pRedlineTbl->SavePtrInArr( pNewRedl );
+ DeleteAndJoin( *pRedl );
+ sal_uInt16 nFnd = pRedlineTbl->GetPos(pNewRedl );
+ if( USHRT_MAX != nFnd )
+ pRedlineTbl->Remove( nFnd );
+ else
+ pNewRedl = 0;
+ }
+ delete pRedl;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ {
+ SwPaM aPam( *pRStt, *pEnd );
+
+ if( *pEnd == *pREnd )
+ pRedlineTbl->DeleteAndDestroy( n );
+ else
+ {
+ pRedl->SetStart( *pEnd, pRStt );
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl, n );
+ }
+
+ if( bCallDelete )
+ {
+ // damit pNew auch beim Verschieben der Indizies
+ // behandelt wird, erstmal temp. einfuegen
+ pRedlineTbl->SavePtrInArr( pNewRedl );
+ DeleteAndJoin( aPam );
+ sal_uInt16 nFnd = pRedlineTbl->GetPos(pNewRedl );
+ if( USHRT_MAX != nFnd )
+ pRedlineTbl->Remove( nFnd );
+ else
+ pNewRedl = 0;
+ n = 0; // neu Aufsetzen
+ }
+ bDec = true;
+ }
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ {
+ SwPaM aPam( *pStt, *pREnd );
+
+ if( *pStt == *pRStt )
+ {
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else
+ pRedl->SetEnd( *pStt, pREnd );
+
+ if( bCallDelete )
+ {
+ // damit pNew auch beim Verschieben der Indizies
+ // behandelt wird, erstmal temp. einfuegen
+ pRedlineTbl->SavePtrInArr( pNewRedl );
+ DeleteAndJoin( aPam );
+ sal_uInt16 nFnd = pRedlineTbl->GetPos(pNewRedl );
+ if( USHRT_MAX != nFnd )
+ pRedlineTbl->Remove( nFnd );
+ else
+ pNewRedl = 0;
+ n = 0; // neu Aufsetzen
+ bDec = true;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ eRedlineMode = eOld;
+ }
+ else
+ {
+ // it may be necessary to split the existing redline in
+ // two. In this case, pRedl will be changed to cover
+ // only part of it's former range, and pNew will cover
+ // the remainder.
+ SwRedline* pNew = 0;
+
+ switch( eCmpPos )
+ {
+ case POS_EQUAL:
+ {
+ pRedl->PushData( *pNewRedl );
+ delete pNewRedl, pNewRedl = 0;
+ if( IsHideChanges( eRedlineMode ))
+ pRedl->Hide();
+ bCompress = sal_True;
+ }
+ break;
+
+ case POS_INSIDE:
+ {
+ if( *pRStt == *pStt )
+ {
+ // --> mst 2010-05-17 #i97421#
+ // redline w/out extent loops
+ if (*pStt != *pEnd)
+ // <--
+ {
+ pNewRedl->PushData( *pRedl, sal_False );
+ pRedl->SetStart( *pEnd, pRStt );
+ // re-insert
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl, n );
+ bDec = true;
+ }
+ }
+ else
+ {
+ pNewRedl->PushData( *pRedl, sal_False );
+ if( *pREnd != *pEnd )
+ {
+ pNew = new SwRedline( *pRedl );
+ pNew->SetStart( *pEnd );
+ }
+ pRedl->SetEnd( *pStt, pREnd );
+ if( !pRedl->HasValidRange() )
+ {
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl, n );
+ }
+ }
+ }
+ break;
+
+ case POS_OUTSIDE:
+ {
+ pRedl->PushData( *pNewRedl );
+ if( *pEnd == *pREnd )
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ else
+ {
+ pNew = new SwRedline( *pNewRedl );
+ pNew->SetEnd( *pRStt );
+ pNewRedl->SetStart( *pREnd, pStt );
+ }
+ bCompress = sal_True;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ {
+ if( *pEnd == *pREnd )
+ {
+ pRedl->PushData( *pNewRedl );
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ if( IsHideChanges( eRedlineMode ))
+ {
+ pRedlineTbl->SavePtrInArr( pNewRedl );
+ pRedl->Hide();
+ pRedlineTbl->Remove(
+ pRedlineTbl->GetPos(pNewRedl ));
+ }
+ }
+ else
+ {
+ pNew = new SwRedline( *pRedl );
+ pNew->PushData( *pNewRedl );
+ pNew->SetEnd( *pEnd );
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ pRedl->SetStart( *pNew->End(), pRStt ) ;
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl );
+ bDec = true;
+ }
+ }
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ {
+ if( *pStt == *pRStt )
+ {
+ pRedl->PushData( *pNewRedl );
+ pNewRedl->SetStart( *pREnd, pStt );
+ if( IsHideChanges( eRedlineMode ))
+ {
+ pRedlineTbl->SavePtrInArr( pNewRedl );
+ pRedl->Hide();
+ pRedlineTbl->Remove(
+ pRedlineTbl->GetPos(pNewRedl ));
+ }
+ }
+ else
+ {
+ pNew = new SwRedline( *pRedl );
+ pNew->PushData( *pNewRedl );
+ pNew->SetStart( *pStt );
+ pNewRedl->SetStart( *pREnd, pStt );
+ pRedl->SetEnd( *pNew->Start(), pREnd );
+ if( !pRedl->HasValidRange() )
+ {
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl );
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ // insert the pNew part (if it exists)
+ if( pNew )
+ {
+ // AppendRedline( pNew, bCallDelete );
+ //sal_Bool bRet =
+ pRedlineTbl->Insert( pNew );
+
+ // pNew must be deleted if Insert() wasn't
+ // successful. But that can't happen, since pNew is
+ // part of the original pRedl redline.
+ // ASSERT( bRet, "Can't insert existing redline?" );
+
+ // restart (now with pRedl being split up)
+ n = 0;
+ bDec = true;
+ }
+ }
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT:
+ switch( eCmpPos )
+ {
+ case POS_OVERLAP_BEFORE:
+ pRedl->SetStart( *pEnd, pRStt );
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl, n );
+ bDec = true;
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ pRedl->SetEnd( *pStt, pREnd );
+ break;
+
+ case POS_EQUAL:
+ case POS_OUTSIDE:
+ // ueberlappt den akt. komplett oder hat gleiche
+ // Ausdehung, dann muss der alte geloescht werden
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ break;
+
+ case POS_INSIDE:
+ // ueberlappt den akt. komplett, dann muss
+ // der neue gesplittet oder verkuertzt werden
+ if( *pEnd != *pREnd )
+ {
+ if( *pEnd != *pRStt )
+ {
+ SwRedline* pNew = new SwRedline( *pRedl );
+ pNew->SetStart( *pEnd );
+ pRedl->SetEnd( *pStt, pREnd );
+ if( ( *pStt == *pRStt ) &&
+ ( pRedl->GetContentIdx() == NULL ) )
+ pRedlineTbl->DeleteAndDestroy( n );
+ AppendRedline( pNew, bCallDelete );
+ n = 0; // neu Aufsetzen
+ bDec = true;
+ }
+ }
+ else
+ pRedl->SetEnd( *pStt, pREnd );
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT:
+ switch( pRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ case nsRedlineType_t::REDLINE_DELETE:
+ switch( eCmpPos )
+ {
+ case POS_OVERLAP_BEFORE:
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ pNewRedl->SetStart( *pREnd, pStt );
+ break;
+
+ case POS_EQUAL:
+ case POS_INSIDE:
+ delete pNewRedl, pNewRedl = 0;
+ break;
+
+ case POS_OUTSIDE:
+ // ueberlappt den akt. komplett, dann muss
+ // der neue gesplittet oder verkuerzt werden
+ if( *pEnd != *pREnd )
+ {
+ if( *pEnd != *pRStt )
+ {
+ SwRedline* pNew = new SwRedline( *pNewRedl );
+ pNew->SetStart( *pREnd );
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ AppendRedline( pNew, bCallDelete );
+ n = 0; // neu Aufsetzen
+ bDec = true;
+ }
+ }
+ else
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ break;
+ default:
+ break;
+ }
+ break;
+ case nsRedlineType_t::REDLINE_FORMAT:
+ switch( eCmpPos )
+ {
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ {
+ // ueberlappt den akt. komplett oder hat gleiche
+ // Ausdehnung, dann muss der alte geloescht werden
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ break;
+
+ case POS_INSIDE:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+ pRedl->CanCombine( *pNewRedl ))
+ // ein eigenes kann komplett ignoriert werden
+ delete pNewRedl, pNewRedl = 0;
+
+ else if( *pREnd == *pEnd )
+ // ansonsten nur den akt. verkuerzen
+ pRedl->SetEnd( *pStt, pREnd );
+ else if( *pRStt == *pStt )
+ {
+ // ansonsten nur den akt. verkuerzen
+ pRedl->SetStart( *pEnd, pRStt );
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl, n );
+ bDec = true;
+ }
+ else
+ {
+ // liegt komplett im akt.
+ // dann muss der gesplittet werden
+ SwRedline* pNew = new SwRedline( *pRedl );
+ pNew->SetStart( *pEnd );
+ pRedl->SetEnd( *pStt, pREnd );
+ AppendRedline( pNew, bCallDelete );
+ n = 0; // neu Aufsetzen
+ bDec = true;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ case POS_OVERLAP_BEHIND:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+ pRedl->CanCombine( *pNewRedl ))
+ {
+ // dann kann das zusammengefasst werden, sprich
+ // der neue deckt das schon ab.
+ if( POS_OVERLAP_BEHIND == eCmpPos )
+ pNewRedl->SetStart( *pRStt, pStt );
+ else
+ pNewRedl->SetEnd( *pREnd, pEnd );
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = 0;
+ }
+ else if( POS_OVERLAP_BEHIND == eCmpPos )
+ pNewRedl->SetStart( *pREnd, pStt );
+ else
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ break;
+
+ case POS_COLLIDE_END:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+ pRedl->CanCombine( *pNewRedl ) && n &&
+ *(*pRedlineTbl)[ n-1 ]->End() < *pStt )
+ {
+ // dann kann das zusammengefasst werden, sprich
+ // der neue deckt das schon ab.
+ pNewRedl->SetEnd( *pREnd, pEnd );
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ break;
+ case POS_COLLIDE_START:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+ pRedl->CanCombine( *pNewRedl ) &&
+ n+1 < pRedlineTbl->Count() &&
+ *(*pRedlineTbl)[ n+1 ]->Start() < *pEnd )
+ {
+ // dann kann das zusammengefasst werden, sprich
+ // der neue deckt das schon ab.
+ pNewRedl->SetStart( *pRStt, pStt );
+ pRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+
+
+ case nsRedlineType_t::REDLINE_FMTCOLL:
+ // wie soll das verhalten sein????
+ // erstmal so einfuegen
+ break;
+ default:
+ break;
+ }
+ }
+
+ if( pNewRedl )
+ {
+ if( ( *pStt == *pEnd ) &&
+ ( pNewRedl->GetContentIdx() == NULL ) )
+ { // Do not insert empty redlines
+ delete pNewRedl;
+ pNewRedl = 0;
+ }
+ else
+ pRedlineTbl->Insert( pNewRedl );
+ }
+
+ if( bCompress )
+ CompressRedlines();
+ }
+ else
+ {
+ if( bCallDelete && nsRedlineType_t::REDLINE_DELETE == pNewRedl->GetType() )
+ {
+ RedlineMode_t eOld = eRedlineMode;
+// auf NONE setzen, damit das Delete::Redo die RedlineDaten wieder richtig
+// zusammen fasst! Der ShowMode muss erhalten bleiben!
+ eRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
+ DeleteAndJoin( *pNewRedl );
+ eRedlineMode = eOld;
+ }
+ delete pNewRedl, pNewRedl = 0;
+ }
+ _CHECK_REDLINE( this )
+
+ return ( 0 != pNewRedl ) || !bError;
+}
+
+void SwDoc::CompressRedlines()
+{
+ _CHECK_REDLINE( this )
+
+ void (SwRedline::*pFnc)(sal_uInt16) = 0;
+ switch( nsRedlineMode_t::REDLINE_SHOW_MASK & eRedlineMode )
+ {
+ case nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE:
+ pFnc = &SwRedline::Show;
+ break;
+ case nsRedlineMode_t::REDLINE_SHOW_INSERT:
+ pFnc = &SwRedline::Hide;
+ break;
+ }
+
+ // versuche gleiche zusammenzufassen
+ for( sal_uInt16 n = 1; n < pRedlineTbl->Count(); ++n )
+ {
+ SwRedline* pPrev = (*pRedlineTbl)[ n-1 ],
+ * pCur = (*pRedlineTbl)[ n ];
+ const SwPosition* pPrevStt = pPrev->Start(),
+ * pPrevEnd = pPrevStt == pPrev->GetPoint()
+ ? pPrev->GetMark() : pPrev->GetPoint();
+ const SwPosition* pCurStt = pCur->Start(),
+ * pCurEnd = pCurStt == pCur->GetPoint()
+ ? pCur->GetMark() : pCur->GetPoint();
+ if( *pPrevEnd == *pCurStt && pPrev->CanCombine( *pCur ) &&
+ pPrevStt->nNode.GetNode().StartOfSectionNode() ==
+ pCurEnd->nNode.GetNode().StartOfSectionNode() &&
+ !pCurEnd->nNode.GetNode().StartOfSectionNode()->IsTableNode() )
+ {
+ // dann koennen die zusammen gefasst werden
+ pPrev->Show();
+ pCur->Show();
+
+ pPrev->SetEnd( *pCur->End() );
+ pRedlineTbl->DeleteAndDestroy( n );
+ --n;
+ if( pFnc )
+ (pPrev->*pFnc)(0);
+ }
+ }
+ _CHECK_REDLINE( this )
+}
+
+bool SwDoc::SplitRedline( const SwPaM& rRange )
+{
+ sal_Bool bChg = sal_False;
+ sal_uInt16 n = 0;
+ const SwPosition* pStt = rRange.Start(),
+ * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark()
+ : rRange.GetPoint();
+ GetRedline( *pStt, &n );
+ for( ; n < pRedlineTbl->Count() ; ++n )
+ {
+ SwRedline* pTmp = (*pRedlineTbl)[ n ];
+ SwPosition* pTStt = pTmp->Start(),
+ * pTEnd = pTStt == pTmp->GetPoint() ? pTmp->GetMark()
+ : pTmp->GetPoint();
+ if( *pTStt <= *pStt && *pStt <= *pTEnd &&
+ *pTStt <= *pEnd && *pEnd <= *pTEnd )
+ {
+ bChg = sal_True;
+ int nn = 0;
+ if( *pStt == *pTStt )
+ nn += 1;
+ if( *pEnd == *pTEnd )
+ nn += 2;
+
+ SwRedline* pNew = 0;
+ switch( nn )
+ {
+ case 0:
+ pNew = new SwRedline( *pTmp );
+ pTmp->SetEnd( *pStt, pTEnd );
+ pNew->SetStart( *pEnd );
+ break;
+
+ case 1:
+ *pTStt = *pEnd;
+ break;
+
+ case 2:
+ *pTEnd = *pStt;
+ break;
+
+ case 3:
+ pTmp->InvalidateRange();
+ pRedlineTbl->DeleteAndDestroy( n-- );
+ pTmp = 0;
+ break;
+ }
+ if( pTmp && !pTmp->HasValidRange() )
+ {
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pTmp, n );
+ }
+ if( pNew )
+ pRedlineTbl->Insert( pNew, n );
+ }
+ else if( *pEnd < *pTStt )
+ break;
+ }
+ return bChg;
+}
+
+bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo,
+ sal_uInt16 nDelType )
+{
+ if( nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES & eRedlineMode ||
+ !rRange.HasMark() || *rRange.GetMark() == *rRange.GetPoint() )
+ return sal_False;
+
+ sal_Bool bChg = sal_False;
+
+ if (bSaveInUndo && GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndoRedline* pUndo = new SwUndoRedline( UNDO_REDLINE, rRange );
+ if( pUndo->GetRedlSaveCount() )
+ {
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ else
+ delete pUndo;
+ }
+
+ const SwPosition* pStt = rRange.Start(),
+ * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark()
+ : rRange.GetPoint();
+ sal_uInt16 n = 0;
+ GetRedline( *pStt, &n );
+ for( ; n < pRedlineTbl->Count() ; ++n )
+ {
+ SwRedline* pRedl = (*pRedlineTbl)[ n ];
+ if( USHRT_MAX != nDelType && nDelType != pRedl->GetType() )
+ continue;
+
+ SwPosition* pRStt = pRedl->Start(),
+ * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark()
+ : pRedl->GetPoint();
+ sal_Bool bDel = sal_False;
+ switch( ComparePosition( *pStt, *pEnd, *pRStt, *pREnd ) )
+ {
+ case POS_EQUAL:
+ case POS_OUTSIDE:
+ bDel = sal_True;
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ if( *pEnd == *pREnd )
+ bDel = sal_True;
+ else
+ {
+ pRedl->InvalidateRange();
+ pRedl->SetStart( *pEnd, pRStt );
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl );
+ --n;
+ }
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ if( *pStt == *pRStt )
+ bDel = sal_True;
+ else
+ {
+ pRedl->InvalidateRange();
+ pRedl->SetEnd( *pStt, pREnd );
+ if( !pRedl->HasValidRange() )
+ {
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl );
+ --n;
+ }
+ }
+ break;
+
+ case POS_INSIDE:
+ {
+ // der muss gesplittet werden
+ pRedl->InvalidateRange();
+ if( *pRStt == *pStt )
+ {
+ pRedl->SetStart( *pEnd, pRStt );
+ // neu einsortieren
+ pRedlineTbl->Remove( n );
+ pRedlineTbl->Insert( pRedl );
+ --n;
+ }
+ else
+ {
+ SwRedline* pCpy;
+ if( *pREnd != *pEnd )
+ {
+ pCpy = new SwRedline( *pRedl );
+ pCpy->SetStart( *pEnd );
+ }
+ else
+ pCpy = 0;
+ pRedl->SetEnd( *pStt, pREnd );
+ if( !pRedl->HasValidRange() )
+ {
+ // neu einsortieren
+ pRedlineTbl->Remove( pRedlineTbl->GetPos( pRedl ));
+ pRedlineTbl->Insert( pRedl );
+ --n;
+ }
+ if( pCpy )
+ pRedlineTbl->Insert( pCpy );
+ }
+ }
+ break;
+
+ case POS_COLLIDE_END:
+ case POS_BEFORE:
+ n = pRedlineTbl->Count();
+ break;
+ default:
+ break;
+ }
+
+ if( bDel )
+ {
+ pRedl->InvalidateRange();
+ pRedlineTbl->DeleteAndDestroy( n-- );
+ bChg = sal_True;
+ }
+ }
+
+ if( bChg )
+ SetModified();
+
+ return bChg;
+}
+
+bool SwDoc::DeleteRedline( const SwStartNode& rNode, bool bSaveInUndo,
+ sal_uInt16 nDelType )
+{
+ SwPaM aTemp(*rNode.EndOfSectionNode(), rNode);
+ return DeleteRedline(aTemp, bSaveInUndo, nDelType);
+}
+
+sal_uInt16 SwDoc::GetRedlinePos( const SwNode& rNd, sal_uInt16 nType ) const
+{
+ const sal_uLong nNdIdx = rNd.GetIndex();
+ for( sal_uInt16 n = 0; n < pRedlineTbl->Count() ; ++n )
+ {
+ const SwRedline* pTmp = (*pRedlineTbl)[ n ];
+ sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(),
+ nMk = pTmp->GetMark()->nNode.GetIndex();
+ if( nPt < nMk ) { long nTmp = nMk; nMk = nPt; nPt = nTmp; }
+
+ if( ( USHRT_MAX == nType || nType == pTmp->GetType()) &&
+ nMk <= nNdIdx && nNdIdx <= nPt )
+ return n;
+
+ if( nMk > nNdIdx )
+ break;
+ }
+ return USHRT_MAX;
+}
+
+const SwRedline* SwDoc::GetRedline( const SwPosition& rPos,
+ sal_uInt16* pFndPos ) const
+{
+ sal_uInt16 nO = pRedlineTbl->Count(), nM, nU = 0;
+ if( nO > 0 )
+ {
+ nO--;
+ while( nU <= nO )
+ {
+ nM = nU + ( nO - nU ) / 2;
+ const SwRedline* pRedl = (*pRedlineTbl)[ nM ];
+ const SwPosition* pStt = pRedl->Start();
+ const SwPosition* pEnd = pStt == pRedl->GetPoint()
+ ? pRedl->GetMark()
+ : pRedl->GetPoint();
+ if( pEnd == pStt
+ ? *pStt == rPos
+ : ( *pStt <= rPos && rPos < *pEnd ) )
+ {
+ /* #107318# returned wrong redline ???*/
+ while( nM && rPos == *(*pRedlineTbl)[ nM - 1 ]->End() &&
+ rPos == *(*pRedlineTbl)[ nM - 1 ]->Start() )
+ {
+ --nM;
+ pRedl = (*pRedlineTbl)[ nM ];
+ }
+
+ if( pFndPos )
+ *pFndPos = nM;
+ return pRedl;
+ }
+ else if( *pEnd <= rPos )
+ nU = nM + 1;
+ else if( nM == 0 )
+ {
+ if( pFndPos )
+ *pFndPos = nU;
+ return 0;
+ }
+ else
+ nO = nM - 1;
+ }
+ }
+ if( pFndPos )
+ *pFndPos = nU;
+ return 0;
+}
+
+typedef sal_Bool (*Fn_AcceptReject)( SwRedlineTbl& rArr, sal_uInt16& rPos,
+ sal_Bool bCallDelete,
+ const SwPosition* pSttRng,
+ const SwPosition* pEndRng);
+
+sal_Bool lcl_AcceptRedline( SwRedlineTbl& rArr, sal_uInt16& rPos,
+ sal_Bool bCallDelete,
+ const SwPosition* pSttRng = 0,
+ const SwPosition* pEndRng = 0 )
+{
+ sal_Bool bRet = sal_True;
+ SwRedline* pRedl = rArr[ rPos ];
+ SwPosition *pRStt = 0, *pREnd = 0;
+ SwComparePosition eCmp = POS_OUTSIDE;
+ if( pSttRng && pEndRng )
+ {
+ pRStt = pRedl->Start();
+ pREnd = pRedl->End();
+ eCmp = ComparePosition( *pSttRng, *pEndRng, *pRStt, *pREnd );
+ }
+
+ pRedl->InvalidateRange();
+
+ switch( pRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ case nsRedlineType_t::REDLINE_FORMAT:
+ {
+ sal_Bool bCheck = sal_False, bReplace = sal_False;
+ switch( eCmp )
+ {
+ case POS_INSIDE:
+ if( *pSttRng == *pRStt )
+ pRedl->SetStart( *pEndRng, pRStt );
+ else
+ {
+ if( *pEndRng != *pREnd )
+ {
+ // aufsplitten
+ SwRedline* pNew = new SwRedline( *pRedl );
+ pNew->SetStart( *pEndRng );
+ rArr.Insert( pNew ); ++rPos;
+ }
+ pRedl->SetEnd( *pSttRng, pREnd );
+ bCheck = sal_True;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ pRedl->SetStart( *pEndRng, pRStt );
+ bReplace = sal_True;
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ pRedl->SetEnd( *pSttRng, pREnd );
+ bCheck = sal_True;
+ break;
+
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ rArr.DeleteAndDestroy( rPos-- );
+ break;
+
+ default:
+ bRet = sal_False;
+ }
+
+ if( bReplace || ( bCheck && !pRedl->HasValidRange() ))
+ {
+ // neu einsortieren
+ rArr.Remove( rArr.GetPos( pRedl ));
+ rArr.Insert( pRedl );
+ }
+ }
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ {
+ SwDoc& rDoc = *pRedl->GetDoc();
+ const SwPosition *pDelStt = 0, *pDelEnd = 0;
+ sal_Bool bDelRedl = sal_False;
+ switch( eCmp )
+ {
+ case POS_INSIDE:
+ if( bCallDelete )
+ {
+ pDelStt = pSttRng;
+ pDelEnd = pEndRng;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ if( bCallDelete )
+ {
+ pDelStt = pRStt;
+ pDelEnd = pEndRng;
+ }
+ break;
+ case POS_OVERLAP_BEHIND:
+ if( bCallDelete )
+ {
+ pDelStt = pREnd;
+ pDelEnd = pSttRng;
+ }
+ break;
+
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ {
+ rArr.Remove( rPos-- );
+ bDelRedl = sal_True;
+ if( bCallDelete )
+ {
+ pDelStt = pRedl->Start();
+ pDelEnd = pRedl->End();
+ }
+ }
+ break;
+ default:
+ bRet = sal_False;
+ }
+
+ if( pDelStt && pDelEnd )
+ {
+ SwPaM aPam( *pDelStt, *pDelEnd );
+ SwCntntNode* pCSttNd = pDelStt->nNode.GetNode().GetCntntNode();
+ SwCntntNode* pCEndNd = pDelEnd->nNode.GetNode().GetCntntNode();
+
+ if( bDelRedl )
+ delete pRedl;
+
+ RedlineMode_t eOld = rDoc.GetRedlineMode();
+ rDoc.SetRedlineMode_intern( (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE)));
+
+ if( pCSttNd && pCEndNd )
+ rDoc.DeleteAndJoin( aPam );
+ else
+ {
+ rDoc.DeleteRange( aPam );
+
+ if( pCSttNd && !pCEndNd )
+ {
+ aPam.GetBound( sal_True ).nContent.Assign( 0, 0 );
+ aPam.GetBound( sal_False ).nContent.Assign( 0, 0 );
+ aPam.DeleteMark();
+ rDoc.DelFullPara( aPam );
+ }
+ }
+ rDoc.SetRedlineMode_intern( eOld );
+ }
+ else if( bDelRedl )
+ delete pRedl;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_FMTCOLL:
+ rArr.DeleteAndDestroy( rPos-- );
+ break;
+
+ default:
+ bRet = sal_False;
+ }
+ return bRet;
+}
+
+sal_Bool lcl_RejectRedline( SwRedlineTbl& rArr, sal_uInt16& rPos,
+ sal_Bool bCallDelete,
+ const SwPosition* pSttRng = 0,
+ const SwPosition* pEndRng = 0 )
+{
+ sal_Bool bRet = sal_True;
+ SwRedline* pRedl = rArr[ rPos ];
+ SwPosition *pRStt = 0, *pREnd = 0;
+ SwComparePosition eCmp = POS_OUTSIDE;
+ if( pSttRng && pEndRng )
+ {
+ pRStt = pRedl->Start();
+ pREnd = pRedl->End();
+ eCmp = ComparePosition( *pSttRng, *pEndRng, *pRStt, *pREnd );
+ }
+
+ pRedl->InvalidateRange();
+
+ switch( pRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ {
+ SwDoc& rDoc = *pRedl->GetDoc();
+ const SwPosition *pDelStt = 0, *pDelEnd = 0;
+ sal_Bool bDelRedl = sal_False;
+ switch( eCmp )
+ {
+ case POS_INSIDE:
+ if( bCallDelete )
+ {
+ pDelStt = pSttRng;
+ pDelEnd = pEndRng;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ if( bCallDelete )
+ {
+ pDelStt = pRStt;
+ pDelEnd = pEndRng;
+ }
+ break;
+ case POS_OVERLAP_BEHIND:
+ if( bCallDelete )
+ {
+ pDelStt = pREnd;
+ pDelEnd = pSttRng;
+ }
+ break;
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ {
+ // dann den Bereich wieder loeschen
+ rArr.Remove( rPos-- );
+ bDelRedl = sal_True;
+ if( bCallDelete )
+ {
+ pDelStt = pRedl->Start();
+ pDelEnd = pRedl->End();
+ }
+ }
+ break;
+
+ default:
+ bRet = sal_False;
+ }
+ if( pDelStt && pDelEnd )
+ {
+ SwPaM aPam( *pDelStt, *pDelEnd );
+
+ SwCntntNode* pCSttNd = pDelStt->nNode.GetNode().GetCntntNode();
+ SwCntntNode* pCEndNd = pDelEnd->nNode.GetNode().GetCntntNode();
+
+ if( bDelRedl )
+ delete pRedl;
+
+ RedlineMode_t eOld = rDoc.GetRedlineMode();
+ rDoc.SetRedlineMode_intern( (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE)));
+
+ if( pCSttNd && pCEndNd )
+ rDoc.DeleteAndJoin( aPam );
+ else
+ {
+ rDoc.DeleteRange( aPam );
+
+ if( pCSttNd && !pCEndNd )
+ {
+ aPam.GetBound( sal_True ).nContent.Assign( 0, 0 );
+ aPam.GetBound( sal_False ).nContent.Assign( 0, 0 );
+ aPam.DeleteMark();
+ rDoc.DelFullPara( aPam );
+ }
+ }
+ rDoc.SetRedlineMode_intern( eOld );
+ }
+ else if( bDelRedl )
+ delete pRedl;
+ }
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ {
+ SwRedline* pNew = 0;
+ sal_Bool bCheck = sal_False, bReplace = sal_False;
+
+ switch( eCmp )
+ {
+ case POS_INSIDE:
+ {
+ if( 1 < pRedl->GetStackCount() )
+ {
+ pNew = new SwRedline( *pRedl );
+ pNew->PopData();
+ }
+ if( *pSttRng == *pRStt )
+ {
+ pRedl->SetStart( *pEndRng, pRStt );
+ bReplace = sal_True;
+ if( pNew )
+ pNew->SetEnd( *pEndRng );
+ }
+ else
+ {
+ if( *pEndRng != *pREnd )
+ {
+ // aufsplitten
+ SwRedline* pCpy = new SwRedline( *pRedl );
+ pCpy->SetStart( *pEndRng );
+ rArr.Insert( pCpy ); ++rPos;
+ if( pNew )
+ pNew->SetEnd( *pEndRng );
+ }
+
+ pRedl->SetEnd( *pSttRng, pREnd );
+ bCheck = sal_True;
+ if( pNew )
+ pNew->SetStart( *pSttRng );
+ }
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ if( 1 < pRedl->GetStackCount() )
+ {
+ pNew = new SwRedline( *pRedl );
+ pNew->PopData();
+ }
+ pRedl->SetStart( *pEndRng, pRStt );
+ bReplace = sal_True;
+ if( pNew )
+ pNew->SetEnd( *pEndRng );
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ if( 1 < pRedl->GetStackCount() )
+ {
+ pNew = new SwRedline( *pRedl );
+ pNew->PopData();
+ }
+ pRedl->SetEnd( *pSttRng, pREnd );
+ bCheck = sal_True;
+ if( pNew )
+ pNew->SetStart( *pSttRng );
+ break;
+
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ if( !pRedl->PopData() )
+ // das RedlineObject loeschen reicht
+ rArr.DeleteAndDestroy( rPos-- );
+ break;
+
+ default:
+ bRet = sal_False;
+ }
+
+ if( pNew )
+ {
+ rArr.Insert( pNew ); ++rPos;
+ }
+
+ if( bReplace || ( bCheck && !pRedl->HasValidRange() ))
+ {
+ // neu einsortieren
+ rArr.Remove( rArr.GetPos( pRedl ));
+ rArr.Insert( pRedl );
+ }
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT:
+ case nsRedlineType_t::REDLINE_FMTCOLL:
+ {
+ if( pRedl->GetExtraData() )
+ pRedl->GetExtraData()->Reject( *pRedl );
+ rArr.DeleteAndDestroy( rPos-- );
+ }
+ break;
+
+ default:
+ bRet = sal_False;
+ }
+ return bRet;
+}
+
+
+const SwRedline* lcl_FindCurrRedline( const SwPosition& rSttPos,
+ sal_uInt16& rPos,
+ sal_Bool bNext = sal_True )
+{
+ const SwRedline* pFnd = 0;
+ const SwRedlineTbl& rArr = rSttPos.nNode.GetNode().GetDoc()->GetRedlineTbl();
+ for( ; rPos < rArr.Count() ; ++rPos )
+ {
+ const SwRedline* pTmp = rArr[ rPos ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ const SwPosition* pRStt = pTmp->Start(),
+ * pREnd = pRStt == pTmp->GetPoint() ? pTmp->GetMark()
+ : pTmp->GetPoint();
+ if( bNext ? *pRStt <= rSttPos : *pRStt < rSttPos )
+ {
+ if( bNext ? *pREnd > rSttPos : *pREnd >= rSttPos )
+ {
+ pFnd = pTmp;
+ break;
+ }
+ }
+ else
+ break;
+ }
+ }
+ return pFnd;
+}
+
+// #111827#
+int lcl_AcceptRejectRedl( Fn_AcceptReject fn_AcceptReject,
+ SwRedlineTbl& rArr, sal_Bool bCallDelete,
+ const SwPaM& rPam)
+{
+ sal_uInt16 n = 0;
+ int nCount = 0; // #111827#
+
+ const SwPosition* pStt = rPam.Start(),
+ * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark()
+ : rPam.GetPoint();
+ const SwRedline* pFnd = lcl_FindCurrRedline( *pStt, n, sal_True );
+ if( pFnd && // neu ein Teil davon?
+ ( *pFnd->Start() != *pStt || *pFnd->End() > *pEnd ))
+ {
+ // dann nur die TeilSelektion aufheben
+ if( (*fn_AcceptReject)( rArr, n, bCallDelete, pStt, pEnd ))
+ nCount++; // #111827#
+ ++n;
+ }
+
+ for( ; n < rArr.Count(); ++n )
+ {
+ SwRedline* pTmp = rArr[ n ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ if( *pTmp->End() <= *pEnd )
+ {
+ if( (*fn_AcceptReject)( rArr, n, bCallDelete, 0, 0 ))
+ nCount++; // #111827#
+ }
+ else
+ {
+ if( *pTmp->Start() < *pEnd )
+ {
+ // dann nur in der TeilSelektion aufheben
+ if( (*fn_AcceptReject)( rArr, n, bCallDelete, pStt, pEnd ))
+ nCount++; // #111827#
+ }
+ break;
+ }
+ }
+ }
+ return nCount; // #111827#
+}
+
+void lcl_AdjustRedlineRange( SwPaM& rPam )
+{
+ // die Selektion steht nur im ContentBereich. Wenn es aber Redlines
+ // davor oder dahinter auf nicht ContentNodes stehen, dann erweiter die
+ // die Selection auf diese
+ SwPosition* pStt = rPam.Start(),
+ * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark()
+ : rPam.GetPoint();
+ SwDoc* pDoc = rPam.GetDoc();
+ if( !pStt->nContent.GetIndex() &&
+ !pDoc->GetNodes()[ pStt->nNode.GetIndex() - 1 ]->IsCntntNode() )
+ {
+ const SwRedline* pRedl = pDoc->GetRedline( *pStt, 0 );
+ if( pRedl )
+ {
+ const SwPosition* pRStt = pRedl->Start();
+ if( !pRStt->nContent.GetIndex() && pRStt->nNode.GetIndex() ==
+ pStt->nNode.GetIndex() - 1 )
+ *pStt = *pRStt;
+ }
+ }
+ if( pEnd->nNode.GetNode().IsCntntNode() &&
+ !pDoc->GetNodes()[ pEnd->nNode.GetIndex() + 1 ]->IsCntntNode() &&
+ pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetCntntNode()->Len() )
+ {
+ const SwRedline* pRedl = pDoc->GetRedline( *pEnd, 0 );
+ if( pRedl )
+ {
+ const SwPosition* pREnd = pRedl->End();
+ if( !pREnd->nContent.GetIndex() && pREnd->nNode.GetIndex() ==
+ pEnd->nNode.GetIndex() + 1 )
+ *pEnd = *pREnd;
+ }
+ }
+}
+
+
+bool SwDoc::AcceptRedline( sal_uInt16 nPos, bool bCallDelete )
+{
+ sal_Bool bRet = sal_False;
+
+ // aufjedenfall auf sichtbar umschalten
+ if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
+ (nsRedlineMode_t::REDLINE_SHOW_MASK & eRedlineMode) )
+ SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | eRedlineMode));
+
+ SwRedline* pTmp = (*pRedlineTbl)[ nPos ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // #111827#
+ SwRewriter aRewriter;
+
+ aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr());
+ GetIDocumentUndoRedo().StartUndo(UNDO_ACCEPT_REDLINE, &aRewriter);
+ }
+
+ int nLoopCnt = 2;
+ sal_uInt16 nSeqNo = pTmp->GetSeqNo();
+
+ do {
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoAcceptRedline(*pTmp) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ bRet |= lcl_AcceptRedline( *pRedlineTbl, nPos, bCallDelete );
+
+ if( nSeqNo )
+ {
+ if( USHRT_MAX == nPos )
+ nPos = 0;
+ sal_uInt16 nFndPos = 2 == nLoopCnt
+ ? pRedlineTbl->FindNextSeqNo( nSeqNo, nPos )
+ : pRedlineTbl->FindPrevSeqNo( nSeqNo, nPos );
+ if( USHRT_MAX != nFndPos || ( 0 != ( --nLoopCnt ) &&
+ USHRT_MAX != ( nFndPos =
+ pRedlineTbl->FindPrevSeqNo( nSeqNo, nPos ))) )
+ pTmp = (*pRedlineTbl)[ nPos = nFndPos ];
+ else
+ nLoopCnt = 0;
+ }
+ else
+ nLoopCnt = 0;
+
+ } while( nLoopCnt );
+
+ if( bRet )
+ {
+ CompressRedlines();
+ SetModified();
+ }
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
+ }
+ return bRet;
+}
+
+bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete )
+{
+ // aufjedenfall auf sichtbar umschalten
+ if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
+ (nsRedlineMode_t::REDLINE_SHOW_MASK & eRedlineMode) )
+ SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | eRedlineMode));
+
+ // die Selektion steht nur im ContentBereich. Wenn es aber Redlines
+ // davor oder dahinter auf nicht ContentNodes stehen, dann erweiter die
+ // die Selection auf diese
+ SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
+ lcl_AdjustRedlineRange( aPam );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_ACCEPT_REDLINE, NULL );
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoAcceptRedline( aPam ));
+ }
+
+ // #111827#
+ int nRet = lcl_AcceptRejectRedl( lcl_AcceptRedline, *pRedlineTbl,
+ bCallDelete, aPam );
+ if( nRet > 0 )
+ {
+ CompressRedlines();
+ SetModified();
+ }
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // #111827#
+ String aTmpStr;
+
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, String::CreateFromInt32(nRet));
+ aTmpStr = aRewriter.Apply(String(SW_RES(STR_N_REDLINES)));
+ }
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, aTmpStr);
+
+ GetIDocumentUndoRedo().EndUndo( UNDO_ACCEPT_REDLINE, &aRewriter );
+ }
+ return nRet != 0;
+}
+
+bool SwDoc::RejectRedline( sal_uInt16 nPos, bool bCallDelete )
+{
+ sal_Bool bRet = sal_False;
+
+ // aufjedenfall auf sichtbar umschalten
+ if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
+ (nsRedlineMode_t::REDLINE_SHOW_MASK & eRedlineMode) )
+ SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | eRedlineMode));
+
+ SwRedline* pTmp = (*pRedlineTbl)[ nPos ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // #111827#
+ SwRewriter aRewriter;
+
+ aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr());
+ GetIDocumentUndoRedo().StartUndo(UNDO_REJECT_REDLINE, &aRewriter);
+ }
+
+ int nLoopCnt = 2;
+ sal_uInt16 nSeqNo = pTmp->GetSeqNo();
+
+ do {
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoRejectRedline( *pTmp ) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ bRet |= lcl_RejectRedline( *pRedlineTbl, nPos, bCallDelete );
+
+ if( nSeqNo )
+ {
+ if( USHRT_MAX == nPos )
+ nPos = 0;
+ sal_uInt16 nFndPos = 2 == nLoopCnt
+ ? pRedlineTbl->FindNextSeqNo( nSeqNo, nPos )
+ : pRedlineTbl->FindPrevSeqNo( nSeqNo, nPos );
+ if( USHRT_MAX != nFndPos || ( 0 != ( --nLoopCnt ) &&
+ USHRT_MAX != ( nFndPos =
+ pRedlineTbl->FindPrevSeqNo( nSeqNo, nPos ))) )
+ pTmp = (*pRedlineTbl)[ nPos = nFndPos ];
+ else
+ nLoopCnt = 0;
+ }
+ else
+ nLoopCnt = 0;
+
+ } while( nLoopCnt );
+
+ if( bRet )
+ {
+ CompressRedlines();
+ SetModified();
+ }
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
+ }
+ return bRet;
+}
+
+bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete )
+{
+ // aufjedenfall auf sichtbar umschalten
+ if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
+ (nsRedlineMode_t::REDLINE_SHOW_MASK & eRedlineMode) )
+ SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | eRedlineMode));
+
+ // die Selektion steht nur im ContentBereich. Wenn es aber Redlines
+ // davor oder dahinter auf nicht ContentNodes stehen, dann erweiter die
+ // die Selection auf diese
+ SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
+ lcl_AdjustRedlineRange( aPam );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_REJECT_REDLINE, NULL );
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoRejectRedline(aPam) );
+ }
+
+ // #111827#
+ int nRet = lcl_AcceptRejectRedl( lcl_RejectRedline, *pRedlineTbl,
+ bCallDelete, aPam );
+ if( nRet > 0 )
+ {
+ CompressRedlines();
+ SetModified();
+ }
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // #111827#
+ String aTmpStr;
+
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, String::CreateFromInt32(nRet));
+ aTmpStr = aRewriter.Apply(String(SW_RES(STR_N_REDLINES)));
+ }
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, aTmpStr);
+
+ GetIDocumentUndoRedo().EndUndo( UNDO_REJECT_REDLINE, &aRewriter );
+ }
+
+ return nRet != 0;
+}
+
+const SwRedline* SwDoc::SelNextRedline( SwPaM& rPam ) const
+{
+ rPam.DeleteMark();
+ rPam.SetMark();
+
+ SwPosition& rSttPos = *rPam.GetPoint();
+ SwPosition aSavePos( rSttPos );
+ sal_Bool bRestart;
+
+ // sollte die StartPos auf dem letzen gueligen ContentNode stehen,
+ // dann aufjedenfall das naechste Redline nehmen
+ sal_uInt16 n = 0;
+ const SwRedline* pFnd = lcl_FindCurrRedline( rSttPos, n, sal_True );
+ if( pFnd )
+ {
+ const SwPosition* pEnd = pFnd->End();
+ if( !pEnd->nNode.GetNode().IsCntntNode() )
+ {
+ SwNodeIndex aTmp( pEnd->nNode );
+ SwCntntNode* pCNd = GetNodes().GoPrevSection( &aTmp );
+ if( !pCNd || ( aTmp == rSttPos.nNode &&
+ pCNd->Len() == rSttPos.nContent.GetIndex() ))
+ pFnd = 0;
+ }
+ if( pFnd )
+ rSttPos = *pFnd->End();
+ }
+
+ do {
+ bRestart = sal_False;
+
+ for( ; !pFnd && n < pRedlineTbl->Count(); ++n )
+ {
+ pFnd = (*pRedlineTbl)[ n ];
+ if( pFnd->HasMark() && pFnd->IsVisible() )
+ {
+ *rPam.GetMark() = *pFnd->Start();
+ rSttPos = *pFnd->End();
+ break;
+ }
+ else
+ pFnd = 0;
+ }
+
+ if( pFnd )
+ {
+ // alle vom gleichen Typ und Author, die hinter einander liegen
+ // zu einer Selektion zusammenfassen.
+ const SwPosition* pPrevEnd = pFnd->End();
+ while( ++n < pRedlineTbl->Count() )
+ {
+ const SwRedline* pTmp = (*pRedlineTbl)[ n ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ const SwPosition *pRStt;
+ if( pFnd->GetType() == pTmp->GetType() &&
+ pFnd->GetAuthor() == pTmp->GetAuthor() &&
+ ( *pPrevEnd == *( pRStt = pTmp->Start() ) ||
+ IsPrevPos( *pPrevEnd, *pRStt )) )
+ {
+ pPrevEnd = pTmp->End();
+ rSttPos = *pPrevEnd;
+ }
+ else
+ break;
+ }
+ }
+ }
+
+ if( pFnd )
+ {
+ const SwRedline* pSaveFnd = pFnd;
+
+ SwCntntNode* pCNd;
+ SwNodeIndex* pIdx = &rPam.GetMark()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = GetNodes().GoNextSection( pIdx )) )
+ {
+ if( *pIdx <= rPam.GetPoint()->nNode )
+ rPam.GetMark()->nContent.Assign( pCNd, 0 );
+ else
+ pFnd = 0;
+ }
+
+ if( pFnd )
+ {
+ pIdx = &rPam.GetPoint()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = GetNodes().GoPrevSection( pIdx )) )
+ {
+ if( *pIdx >= rPam.GetMark()->nNode )
+ rPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ else
+ pFnd = 0;
+ }
+ }
+
+ if( !pFnd || *rPam.GetMark() == *rPam.GetPoint() )
+ {
+ if( n < pRedlineTbl->Count() )
+ {
+ bRestart = sal_True;
+ *rPam.GetPoint() = *pSaveFnd->End();
+ }
+ else
+ {
+ rPam.DeleteMark();
+ *rPam.GetPoint() = aSavePos;
+ }
+ pFnd = 0;
+ }
+ }
+ } while( bRestart );
+
+ return pFnd;
+}
+
+const SwRedline* SwDoc::SelPrevRedline( SwPaM& rPam ) const
+{
+ rPam.DeleteMark();
+ rPam.SetMark();
+
+ SwPosition& rSttPos = *rPam.GetPoint();
+ SwPosition aSavePos( rSttPos );
+ sal_Bool bRestart;
+
+ // sollte die StartPos auf dem ersten gueligen ContentNode stehen,
+ // dann aufjedenfall das vorherige Redline nehmen
+ sal_uInt16 n = 0;
+ const SwRedline* pFnd = lcl_FindCurrRedline( rSttPos, n, sal_False );
+ if( pFnd )
+ {
+ const SwPosition* pStt = pFnd->Start();
+ if( !pStt->nNode.GetNode().IsCntntNode() )
+ {
+ SwNodeIndex aTmp( pStt->nNode );
+ SwCntntNode* pCNd = GetNodes().GoNextSection( &aTmp );
+ if( !pCNd || ( aTmp == rSttPos.nNode &&
+ !rSttPos.nContent.GetIndex() ))
+ pFnd = 0;
+ }
+ if( pFnd )
+ rSttPos = *pFnd->Start();
+ }
+
+ do {
+ bRestart = sal_False;
+
+ while( !pFnd && 0 < n )
+ {
+ pFnd = (*pRedlineTbl)[ --n ];
+ if( pFnd->HasMark() && pFnd->IsVisible() )
+ {
+ *rPam.GetMark() = *pFnd->End();
+ rSttPos = *pFnd->Start();
+ }
+ else
+ pFnd = 0;
+ }
+
+ if( pFnd )
+ {
+ // alle vom gleichen Typ und Author, die hinter einander liegen
+ // zu einer Selektion zusammenfassen.
+ const SwPosition* pNextStt = pFnd->Start();
+ while( 0 < n )
+ {
+ const SwRedline* pTmp = (*pRedlineTbl)[ --n ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ const SwPosition *pREnd;
+ if( pFnd->GetType() == pTmp->GetType() &&
+ pFnd->GetAuthor() == pTmp->GetAuthor() &&
+ ( *pNextStt == *( pREnd = pTmp->End() ) ||
+ IsPrevPos( *pREnd, *pNextStt )) )
+ {
+ pNextStt = pTmp->Start();
+ rSttPos = *pNextStt;
+ }
+ else
+ {
+ ++n;
+ break;
+ }
+ }
+ }
+ }
+
+ if( pFnd )
+ {
+ const SwRedline* pSaveFnd = pFnd;
+
+ SwCntntNode* pCNd;
+ SwNodeIndex* pIdx = &rPam.GetMark()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = GetNodes().GoPrevSection( pIdx )) )
+ {
+ if( *pIdx >= rPam.GetPoint()->nNode )
+ rPam.GetMark()->nContent.Assign( pCNd, pCNd->Len() );
+ else
+ pFnd = 0;
+ }
+
+ if( pFnd )
+ {
+ pIdx = &rPam.GetPoint()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = GetNodes().GoNextSection( pIdx )) )
+ {
+ if( *pIdx <= rPam.GetMark()->nNode )
+ rPam.GetPoint()->nContent.Assign( pCNd, 0 );
+ else
+ pFnd = 0;
+ }
+ }
+
+ if( !pFnd || *rPam.GetMark() == *rPam.GetPoint() )
+ {
+ if( n )
+ {
+ bRestart = sal_True;
+ *rPam.GetPoint() = *pSaveFnd->Start();
+ }
+ else
+ {
+ rPam.DeleteMark();
+ *rPam.GetPoint() = aSavePos;
+ }
+ pFnd = 0;
+ }
+ }
+ } while( bRestart );
+
+ return pFnd;
+}
+
+// Kommentar am Redline setzen
+bool SwDoc::SetRedlineComment( const SwPaM& rPaM, const String& rS )
+{
+ sal_Bool bRet = sal_False;
+ const SwPosition* pStt = rPaM.Start(),
+ * pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark()
+ : rPaM.GetPoint();
+ sal_uInt16 n = 0;
+ if( lcl_FindCurrRedline( *pStt, n, sal_True ) )
+ {
+ for( ; n < pRedlineTbl->Count(); ++n )
+ {
+ bRet = sal_True;
+ SwRedline* pTmp = (*pRedlineTbl)[ n ];
+ if( pStt != pEnd && *pTmp->Start() > *pEnd )
+ break;
+
+ pTmp->SetComment( rS );
+ if( *pTmp->End() >= *pEnd )
+ break;
+ }
+ }
+ if( bRet )
+ SetModified();
+
+ return bRet;
+}
+
+// legt gebenenfalls einen neuen Author an
+sal_uInt16 SwDoc::GetRedlineAuthor()
+{
+ return SW_MOD()->GetRedlineAuthor();
+}
+
+ // fuer die Reader usw. - neuen Author in die Tabelle eintragen
+sal_uInt16 SwDoc::InsertRedlineAuthor( const String& rNew )
+{
+ return SW_MOD()->InsertRedlineAuthor(rNew);
+}
+
+void SwDoc::UpdateRedlineAttr()
+{
+ const SwRedlineTbl& rTbl = GetRedlineTbl();
+ for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ {
+ SwRedline* pRedl = rTbl[ n ];
+ if( pRedl->IsVisible() )
+ pRedl->InvalidateRange();
+ }
+}
+
+ // setze Kommentar-Text fuers Redline, das dann per AppendRedline
+ // hereinkommt. Wird vom Autoformat benutzt. 0-Pointer setzt den Modus
+ // wieder zurueck. Pointer wird nicht kopiert, muss also gueltig bleiben!
+void SwDoc::SetAutoFmtRedlineComment( const String* pTxt, sal_uInt16 nSeqNo )
+{
+ mbIsAutoFmtRedline = 0 != pTxt;
+ if( pTxt )
+ {
+ if( !pAutoFmtRedlnComment )
+ pAutoFmtRedlnComment = new String( *pTxt );
+ else
+ *pAutoFmtRedlnComment = *pTxt;
+ }
+ else if( pAutoFmtRedlnComment )
+ delete pAutoFmtRedlnComment, pAutoFmtRedlnComment = 0;
+
+ nAutoFmtRedlnCommentNo = nSeqNo;
+}
+
+void SwDoc::SetRedlinePassword(
+ /*[in]*/const uno::Sequence <sal_Int8>& rNewPassword)
+{
+ aRedlinePasswd = rNewPassword;
+ SetModified();
+}
+
+/* */
+
+sal_Bool SwRedlineTbl::Insert( SwRedlinePtr& p, sal_Bool bIns )
+{
+ sal_Bool bRet = sal_False;
+ if( p->HasValidRange() )
+ {
+ bRet = _SwRedlineTbl::Insert( p );
+ p->CallDisplayFunc();
+ }
+ else if( bIns )
+ bRet = InsertWithValidRanges( p );
+ else
+ {
+ ASSERT( !this, "Redline: falscher Bereich" );
+ }
+ return bRet;
+}
+
+sal_Bool SwRedlineTbl::Insert( SwRedlinePtr& p, sal_uInt16& rP, sal_Bool bIns )
+{
+ sal_Bool bRet = sal_False;
+ if( p->HasValidRange() )
+ {
+ bRet = _SwRedlineTbl::Insert( p, rP );
+ p->CallDisplayFunc();
+ }
+ else if( bIns )
+ bRet = InsertWithValidRanges( p, &rP );
+ else
+ {
+ ASSERT( !this, "Redline: falscher Bereich" );
+ }
+ return bRet;
+}
+
+sal_Bool SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, sal_uInt16* pInsPos )
+{
+ // erzeuge aus den Selektion gueltige "Teilbereiche".
+ sal_Bool bAnyIns = sal_False;
+ SwPosition* pStt = p->Start(),
+ * pEnd = pStt == p->GetPoint() ? p->GetMark() : p->GetPoint();
+ SwPosition aNewStt( *pStt );
+ SwNodes& rNds = aNewStt.nNode.GetNodes();
+ SwCntntNode* pC;
+
+ if( !aNewStt.nNode.GetNode().IsCntntNode() )
+ {
+ pC = rNds.GoNext( &aNewStt.nNode );
+ if( pC )
+ aNewStt.nContent.Assign( pC, 0 );
+ else
+ aNewStt.nNode = rNds.GetEndOfContent();
+ }
+
+ SwRedline* pNew = 0;
+ sal_uInt16 nInsPos;
+
+ if( aNewStt < *pEnd )
+ do {
+ if( !pNew )
+ pNew = new SwRedline( p->GetRedlineData(), aNewStt );
+ else
+ {
+ pNew->DeleteMark();
+ *pNew->GetPoint() = aNewStt;
+ }
+
+ pNew->SetMark();
+ GoEndSection( pNew->GetPoint() );
+ // i60396: If the redlines starts before a table but the table is the last member
+ // of the section, the GoEndSection will end inside the table.
+ // This will result in an incorrect redline, so we've to go back
+ SwNode* pTab = pNew->GetPoint()->nNode.GetNode().StartOfSectionNode()->FindTableNode();
+ // We end in a table when pTab != 0
+ if( pTab && !pNew->GetMark()->nNode.GetNode().StartOfSectionNode()->FindTableNode() )
+ { // but our Mark was outside the table => Correction
+ do
+ {
+ // We want to be before the table
+ *pNew->GetPoint() = SwPosition(*pTab);
+ pC = GoPreviousNds( &pNew->GetPoint()->nNode, sal_False ); // here we are.
+ if( pC )
+ pNew->GetPoint()->nContent.Assign( pC, 0 );
+ pTab = pNew->GetPoint()->nNode.GetNode().StartOfSectionNode()->FindTableNode();
+ }while( pTab ); // If there is another table we have to repeat our step backwards
+ }
+
+ if( *pNew->GetPoint() > *pEnd )
+ {
+ pC = 0;
+ if( aNewStt.nNode != pEnd->nNode )
+ do {
+ SwNode& rCurNd = aNewStt.nNode.GetNode();
+ if( rCurNd.IsStartNode() )
+ {
+ if( rCurNd.EndOfSectionIndex() < pEnd->nNode.GetIndex() )
+ aNewStt.nNode = *rCurNd.EndOfSectionNode();
+ else
+ break;
+ }
+ else if( rCurNd.IsCntntNode() )
+ pC = rCurNd.GetCntntNode();
+ aNewStt.nNode++;
+ } while( aNewStt.nNode.GetIndex() < pEnd->nNode.GetIndex() );
+
+ if( aNewStt.nNode == pEnd->nNode )
+ aNewStt.nContent = pEnd->nContent;
+ else if( pC )
+ {
+ aNewStt.nNode = *pC;
+ aNewStt.nContent.Assign( pC, pC->Len() );
+ }
+
+ if( aNewStt <= *pEnd )
+ *pNew->GetPoint() = aNewStt;
+ }
+ else
+ aNewStt = *pNew->GetPoint();
+#ifdef DEBUG
+ CheckPosition( pNew->GetPoint(), pNew->GetMark() );
+#endif
+ if( *pNew->GetPoint() != *pNew->GetMark() &&
+ _SwRedlineTbl::Insert( pNew, nInsPos ) )
+ {
+ pNew->CallDisplayFunc();
+ bAnyIns = sal_True;
+ pNew = 0;
+ if( pInsPos && *pInsPos < nInsPos )
+ *pInsPos = nInsPos;
+ }
+
+ if( aNewStt >= *pEnd ||
+ 0 == (pC = rNds.GoNext( &aNewStt.nNode )) )
+ break;
+
+ aNewStt.nContent.Assign( pC, 0 );
+
+ } while( aNewStt < *pEnd );
+
+ delete pNew;
+ delete p, p = 0;
+ return bAnyIns;
+}
+
+void SwRedlineTbl::Remove( sal_uInt16 nP, sal_uInt16 nL )
+{
+ SwDoc* pDoc = 0;
+ if( !nP && nL && nL == _SwRedlineTbl::Count() )
+ pDoc = _SwRedlineTbl::GetObject( 0 )->GetDoc();
+
+ _SwRedlineTbl::Remove( nP, nL );
+
+ ViewShell* pSh;
+ if( pDoc && !pDoc->IsInDtor() &&
+ 0 != ( pSh = pDoc->GetCurrentViewShell()) ) //swmod 071108//swmod 071225
+ pSh->InvalidateWindows( SwRect( 0, 0, LONG_MAX, LONG_MAX ) );
+}
+
+void SwRedlineTbl::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL )
+{
+ SwDoc* pDoc = 0;
+ if( !nP && nL && nL == _SwRedlineTbl::Count() )
+ pDoc = _SwRedlineTbl::GetObject( 0 )->GetDoc();
+
+ _SwRedlineTbl::DeleteAndDestroy( nP, nL );
+
+ ViewShell* pSh;
+ if( pDoc && !pDoc->IsInDtor() &&
+ 0 != ( pSh = pDoc->GetCurrentViewShell() ) ) //swmod 071108//swmod 071225
+ pSh->InvalidateWindows( SwRect( 0, 0, LONG_MAX, LONG_MAX ) );
+}
+
+// suche den naechsten oder vorherigen Redline mit dergleichen Seq.No
+// Mit dem Lookahead kann die Suche eingeschraenkt werden. 0 oder
+// USHRT_MAX suchen im gesamten Array.
+sal_uInt16 SwRedlineTbl::FindNextOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead ) const
+{
+ return nSttPos + 1 < _SwRedlineTbl::Count()
+ ? FindNextSeqNo( _SwRedlineTbl::GetObject( nSttPos )
+ ->GetSeqNo(), nSttPos+1, nLookahead )
+ : USHRT_MAX;
+}
+
+sal_uInt16 SwRedlineTbl::FindPrevOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead ) const
+{
+ return nSttPos ? FindPrevSeqNo( _SwRedlineTbl::GetObject(
+ nSttPos )->GetSeqNo(),
+ nSttPos-1, nLookahead )
+ : USHRT_MAX;
+}
+
+sal_uInt16 SwRedlineTbl::FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
+ sal_uInt16 nLookahead ) const
+{
+ sal_uInt16 nRet = USHRT_MAX, nEnd;
+ if( nSeqNo && nSttPos < _SwRedlineTbl::Count() )
+ {
+ nEnd = _SwRedlineTbl::Count();
+ if( nLookahead && USHRT_MAX != nLookahead &&
+ nSttPos + nLookahead < _SwRedlineTbl::Count() )
+ nEnd = nSttPos + nLookahead;
+
+ for( ; nSttPos < nEnd; ++nSttPos )
+ if( nSeqNo == _SwRedlineTbl::GetObject( nSttPos )->GetSeqNo() )
+ {
+ nRet = nSttPos;
+ break;
+ }
+ }
+ return nRet;
+}
+
+sal_uInt16 SwRedlineTbl::FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
+ sal_uInt16 nLookahead ) const
+{
+ sal_uInt16 nRet = USHRT_MAX, nEnd;
+ if( nSeqNo && nSttPos < _SwRedlineTbl::Count() )
+ {
+ nEnd = 0;
+ if( nLookahead && USHRT_MAX != nLookahead && nSttPos > nLookahead )
+ nEnd = nSttPos - nLookahead;
+
+ ++nSttPos;
+ while( nSttPos > nEnd )
+ if( nSeqNo == _SwRedlineTbl::GetObject( --nSttPos )->GetSeqNo() )
+ {
+ nRet = nSttPos;
+ break;
+ }
+ }
+ return nRet;
+}
+
+/* */
+
+SwRedlineExtraData::~SwRedlineExtraData()
+{
+}
+
+void SwRedlineExtraData::Accept( SwPaM& ) const
+{
+}
+
+void SwRedlineExtraData::Reject( SwPaM& ) const
+{
+}
+
+int SwRedlineExtraData::operator == ( const SwRedlineExtraData& ) const
+{
+ return sal_False;
+}
+
+
+SwRedlineExtraData_FmtColl::SwRedlineExtraData_FmtColl( const String& rColl,
+ sal_uInt16 nPoolFmtId,
+ const SfxItemSet* pItemSet )
+ : sFmtNm(rColl), pSet(0), nPoolId(nPoolFmtId)
+{
+ if( pItemSet && pItemSet->Count() )
+ pSet = new SfxItemSet( *pItemSet );
+}
+
+SwRedlineExtraData_FmtColl::~SwRedlineExtraData_FmtColl()
+{
+ delete pSet;
+}
+
+SwRedlineExtraData* SwRedlineExtraData_FmtColl::CreateNew() const
+{
+ return new SwRedlineExtraData_FmtColl( sFmtNm, nPoolId, pSet );
+}
+
+void SwRedlineExtraData_FmtColl::Reject( SwPaM& rPam ) const
+{
+ SwDoc* pDoc = rPam.GetDoc();
+
+// was ist mit Undo ? ist das abgeschaltet ??
+ SwTxtFmtColl* pColl = USHRT_MAX == nPoolId
+ ? pDoc->FindTxtFmtCollByName( sFmtNm )
+ : pDoc->GetTxtCollFromPool( nPoolId );
+ if( pColl )
+ pDoc->SetTxtFmtColl( rPam, pColl, false );
+
+ if( pSet )
+ {
+ rPam.SetMark();
+ SwPosition& rMark = *rPam.GetMark();
+ SwTxtNode* pTNd = rMark.nNode.GetNode().GetTxtNode();
+ if( pTNd )
+ {
+ rMark.nContent.Assign( pTNd, pTNd->GetTxt().Len() );
+
+ if( pTNd->HasSwAttrSet() )
+ {
+ // nur die setzen, die nicht mehr vorhanden sind. Andere
+ // koennen jetzt veraendert drin stehen, aber die werden
+ // nicht angefasst.
+ SfxItemSet aTmp( *pSet );
+ aTmp.Differentiate( *pTNd->GetpSwAttrSet() );
+ pDoc->InsertItemSet( rPam, aTmp, 0 );
+ }
+ else
+ {
+ pDoc->InsertItemSet( rPam, *pSet, 0 );
+ }
+ }
+ rPam.DeleteMark();
+ }
+}
+
+int SwRedlineExtraData_FmtColl::operator == ( const SwRedlineExtraData& r) const
+{
+ const SwRedlineExtraData_FmtColl& rCmp = (SwRedlineExtraData_FmtColl&)r;
+ return sFmtNm == rCmp.sFmtNm && nPoolId == rCmp.nPoolId &&
+ ( ( !pSet && !rCmp.pSet ) ||
+ ( pSet && rCmp.pSet && *pSet == *rCmp.pSet ) );
+}
+
+void SwRedlineExtraData_FmtColl::SetItemSet( const SfxItemSet& rSet )
+{
+ delete pSet;
+ if( rSet.Count() )
+ pSet = new SfxItemSet( rSet );
+ else
+ pSet = 0;
+}
+
+
+SwRedlineExtraData_Format::SwRedlineExtraData_Format( const SfxItemSet& rSet )
+{
+ SfxItemIter aIter( rSet );
+ const SfxPoolItem* pItem = aIter.FirstItem();
+ while( sal_True )
+ {
+ aWhichIds.Insert( pItem->Which(), aWhichIds.Count() );
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+}
+
+SwRedlineExtraData_Format::SwRedlineExtraData_Format(
+ const SwRedlineExtraData_Format& rCpy )
+ : SwRedlineExtraData(), aWhichIds( (sal_uInt8)rCpy.aWhichIds.Count() )
+{
+ aWhichIds.Insert( &rCpy.aWhichIds, 0 );
+}
+
+SwRedlineExtraData_Format::~SwRedlineExtraData_Format()
+{
+}
+
+SwRedlineExtraData* SwRedlineExtraData_Format::CreateNew() const
+{
+ return new SwRedlineExtraData_Format( *this );
+}
+
+void SwRedlineExtraData_Format::Reject( SwPaM& rPam ) const
+{
+ SwDoc* pDoc = rPam.GetDoc();
+
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+ pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE)));
+
+ // eigentlich muesste hier das Attribut zurueck gesetzt werden!!!
+ for( sal_uInt16 n = 0, nEnd = aWhichIds.Count(); n < nEnd; ++n )
+ {
+ pDoc->InsertPoolItem( rPam, *GetDfltAttr( aWhichIds[ n ] ),
+ nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
+
+ pDoc->SetRedlineMode_intern( eOld );
+}
+
+int SwRedlineExtraData_Format::operator == ( const SwRedlineExtraData& rCmp ) const
+{
+ int nRet = 1;
+ sal_uInt16 n = 0, nEnd = aWhichIds.Count();
+ if( nEnd != ((SwRedlineExtraData_Format&)rCmp).aWhichIds.Count() )
+ nRet = 0;
+ else
+ for( ; n < nEnd; ++n )
+ if( ((SwRedlineExtraData_Format&)rCmp).aWhichIds[n] != aWhichIds[n])
+ {
+ nRet = 0;
+ break;
+ }
+ return nRet;
+}
+
+/* */
+
+SwRedlineData::SwRedlineData( RedlineType_t eT, sal_uInt16 nAut )
+ : pNext( 0 ), pExtraData( 0 ), eType( eT ), nAuthor( nAut ), nSeqNo( 0 )
+{
+ aStamp.SetSec( 0 );
+ aStamp.Set100Sec( 0 );
+}
+
+SwRedlineData::SwRedlineData( const SwRedlineData& rCpy, sal_Bool bCpyNext )
+ :
+ pNext( (bCpyNext && rCpy.pNext) ? new SwRedlineData( *rCpy.pNext ) : 0 ),
+ pExtraData( rCpy.pExtraData ? rCpy.pExtraData->CreateNew() : 0 ),
+ sComment( rCpy.sComment ), aStamp( rCpy.aStamp ), eType( rCpy.eType ),
+ nAuthor( rCpy.nAuthor ), nSeqNo( rCpy.nSeqNo )
+{
+}
+
+ // fuer sw3io: pNext geht in eigenen Besitz ueber!
+SwRedlineData::SwRedlineData(RedlineType_t eT, sal_uInt16 nAut, const DateTime& rDT,
+ const String& rCmnt, SwRedlineData *pNxt, SwRedlineExtraData* pData)
+ : pNext(pNxt), pExtraData(pData), sComment(rCmnt), aStamp(rDT),
+ eType(eT), nAuthor(nAut), nSeqNo(0)
+{
+}
+
+SwRedlineData::~SwRedlineData()
+{
+ delete pExtraData;
+ delete pNext;
+}
+
+ // ExtraData wird kopiert, der Pointer geht also NICHT in den Besitz
+ // des RedlineObjectes!
+void SwRedlineData::SetExtraData( const SwRedlineExtraData* pData )
+{
+ delete pExtraData;
+
+ if( pData )
+ pExtraData = pData->CreateNew();
+ else
+ pExtraData = 0;
+}
+
+// #111827#
+String SwRedlineData::GetDescr() const
+{
+ String aResult;
+
+ aResult += String(SW_RES(STR_REDLINE_INSERT + GetType()));
+
+ return aResult;
+}
+
+/* */
+
+SwRedline::SwRedline(RedlineType_t eTyp, const SwPaM& rPam )
+ : SwPaM( *rPam.GetMark(), *rPam.GetPoint() ),
+ pRedlineData( new SwRedlineData( eTyp, GetDoc()->GetRedlineAuthor() ) ),
+ pCntntSect( 0 )
+{
+ bDelLastPara = bIsLastParaDelete = sal_False;
+ bIsVisible = sal_True;
+ if( !rPam.HasMark() )
+ DeleteMark();
+}
+
+SwRedline::SwRedline( const SwRedlineData& rData, const SwPaM& rPam )
+ : SwPaM( *rPam.GetMark(), *rPam.GetPoint() ),
+ pRedlineData( new SwRedlineData( rData )),
+ pCntntSect( 0 )
+{
+ bDelLastPara = bIsLastParaDelete = sal_False;
+ bIsVisible = sal_True;
+ if( !rPam.HasMark() )
+ DeleteMark();
+}
+
+SwRedline::SwRedline( const SwRedlineData& rData, const SwPosition& rPos )
+ : SwPaM( rPos ),
+ pRedlineData( new SwRedlineData( rData )),
+ pCntntSect( 0 )
+{
+ bDelLastPara = bIsLastParaDelete = sal_False;
+ bIsVisible = sal_True;
+}
+
+SwRedline::SwRedline( const SwRedline& rCpy )
+ : SwPaM( *rCpy.GetMark(), *rCpy.GetPoint() ),
+ pRedlineData( new SwRedlineData( *rCpy.pRedlineData )),
+ pCntntSect( 0 )
+{
+ bDelLastPara = bIsLastParaDelete = sal_False;
+ bIsVisible = sal_True;
+ if( !rCpy.HasMark() )
+ DeleteMark();
+}
+
+SwRedline::~SwRedline()
+{
+ if( pCntntSect )
+ {
+ // dann den Content Bereich loeschen
+ if( !GetDoc()->IsInDtor() )
+ GetDoc()->DeleteSection( &pCntntSect->GetNode() );
+ delete pCntntSect;
+ }
+ delete pRedlineData;
+}
+
+// liegt eine gueltige Selektion vor?
+sal_Bool SwRedline::HasValidRange() const
+{
+ const SwNode* pPtNd = &GetPoint()->nNode.GetNode(),
+ * pMkNd = &GetMark()->nNode.GetNode();
+ if( pPtNd->StartOfSectionNode() == pMkNd->StartOfSectionNode() &&
+ !pPtNd->StartOfSectionNode()->IsTableNode() &&
+ // JP 18.5.2001: Bug 87222 - invalid if points on the end of content
+ // DVO 25.03.2002: #96530# end-of-content only invalid if no content
+ // index exists
+ ( pPtNd != pMkNd || GetContentIdx() != NULL ||
+ pPtNd != &pPtNd->GetNodes().GetEndOfContent() )
+ )
+ return sal_True;
+ return sal_False;
+}
+
+void SwRedline::CallDisplayFunc( sal_uInt16 nLoop )
+{
+ switch( nsRedlineMode_t::REDLINE_SHOW_MASK & GetDoc()->GetRedlineMode() )
+ {
+ case nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE:
+ Show( nLoop );
+ break;
+ case nsRedlineMode_t::REDLINE_SHOW_INSERT:
+ Hide( nLoop );
+ break;
+ case nsRedlineMode_t::REDLINE_SHOW_DELETE:
+ ShowOriginal( nLoop );
+ break;
+ }
+}
+
+void SwRedline::Show( sal_uInt16 nLoop )
+{
+ if( 1 <= nLoop )
+ {
+ SwDoc* pDoc = GetDoc();
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+ pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+
+ switch( GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT: // Inhalt wurde eingefuegt
+ bIsVisible = sal_True;
+ MoveFromSection();
+ break;
+
+ case nsRedlineType_t::REDLINE_DELETE: // Inhalt wurde geloescht
+ bIsVisible = sal_True;
+ MoveFromSection();
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT: // Attributierung wurde angewendet
+ case nsRedlineType_t::REDLINE_TABLE: // TabellenStruktur wurde veraendert
+ InvalidateRange();
+ break;
+ default:
+ break;
+ }
+ pDoc->SetRedlineMode_intern( eOld );
+ }
+}
+
+void SwRedline::Hide( sal_uInt16 nLoop )
+{
+ SwDoc* pDoc = GetDoc();
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+ pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+
+ switch( GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT: // Inhalt wurde eingefuegt
+ bIsVisible = sal_True;
+ if( 1 <= nLoop )
+ MoveFromSection();
+ break;
+
+ case nsRedlineType_t::REDLINE_DELETE: // Inhalt wurde geloescht
+ bIsVisible = sal_False;
+ switch( nLoop )
+ {
+ case 0: MoveToSection(); break;
+ case 1: CopyToSection(); break;
+ case 2: DelCopyOfSection(); break;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT: // Attributierung wurde angewendet
+ case nsRedlineType_t::REDLINE_TABLE: // TabellenStruktur wurde veraendert
+ if( 1 <= nLoop )
+ InvalidateRange();
+ break;
+ default:
+ break;
+ }
+ pDoc->SetRedlineMode_intern( eOld );
+}
+
+void SwRedline::ShowOriginal( sal_uInt16 nLoop )
+{
+ SwDoc* pDoc = GetDoc();
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+ SwRedlineData* pCur;
+
+ pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+
+ // bestimme den Type, ist der erste auf Stack
+ for( pCur = pRedlineData; pCur->pNext; )
+ pCur = pCur->pNext;
+
+ switch( pCur->eType )
+ {
+ case nsRedlineType_t::REDLINE_INSERT: // Inhalt wurde eingefuegt
+ bIsVisible = sal_False;
+ switch( nLoop )
+ {
+ case 0: MoveToSection(); break;
+ case 1: CopyToSection(); break;
+ case 2: DelCopyOfSection(); break;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_DELETE: // Inhalt wurde geloescht
+ bIsVisible = sal_True;
+ if( 1 <= nLoop )
+ MoveFromSection();
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT: // Attributierung wurde angewendet
+ case nsRedlineType_t::REDLINE_TABLE: // TabellenStruktur wurde veraendert
+ if( 1 <= nLoop )
+ InvalidateRange();
+ break;
+ default:
+ break;
+ }
+ pDoc->SetRedlineMode_intern( eOld );
+}
+
+
+void SwRedline::InvalidateRange() // das Layout anstossen
+{
+ sal_uLong nSttNd = GetMark()->nNode.GetIndex(),
+ nEndNd = GetPoint()->nNode.GetIndex();
+ sal_uInt16 nSttCnt = GetMark()->nContent.GetIndex(),
+ nEndCnt = GetPoint()->nContent.GetIndex();
+
+ if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt ))
+ {
+ sal_uLong nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp;
+ nTmp = nSttCnt; nSttCnt = nEndCnt; nEndCnt = (sal_uInt16)nTmp;
+ }
+
+ SwUpdateAttr aHt( 0, 0, RES_FMT_CHG );
+ SwNodes& rNds = GetDoc()->GetNodes();
+ SwNode* pNd;
+ for( sal_uLong n = nSttNd; n <= nEndNd; ++n )
+ if( ND_TEXTNODE == ( pNd = rNds[ n ] )->GetNodeType() )
+ {
+ aHt.nStart = n == nSttNd ? nSttCnt : 0;
+ aHt.nEnd = n == nEndNd ? nEndCnt : ((SwTxtNode*)pNd)->GetTxt().Len();
+ ((SwTxtNode*)pNd)->ModifyNotification( &aHt, &aHt );
+ }
+}
+
+/*************************************************************************
+ * SwRedline::CalcStartEnd()
+ * Calculates the start and end position of the intersection rTmp and
+ * text node nNdIdx
+ *************************************************************************/
+
+void SwRedline::CalcStartEnd( sal_uLong nNdIdx, sal_uInt16& nStart, sal_uInt16& nEnd ) const
+{
+ const SwPosition *pRStt = Start(), *pREnd = End();
+ if( pRStt->nNode < nNdIdx )
+ {
+ if( pREnd->nNode > nNdIdx )
+ {
+ nStart = 0; // Absatz ist komplett enthalten
+ nEnd = STRING_LEN;
+ }
+ else
+ {
+ ASSERT( pREnd->nNode == nNdIdx,
+ "SwRedlineItr::Seek: GetRedlinePos Error" );
+ nStart = 0; // Absatz wird vorne ueberlappt
+ nEnd = pREnd->nContent.GetIndex();
+ }
+ }
+ else if( pRStt->nNode == nNdIdx )
+ {
+ nStart = pRStt->nContent.GetIndex();
+ if( pREnd->nNode == nNdIdx )
+ nEnd = pREnd->nContent.GetIndex(); // Innerhalb des Absatzes
+ else
+ nEnd = STRING_LEN; // Absatz wird hinten ueberlappt
+ }
+ else
+ {
+ nStart = STRING_LEN;
+ nEnd = STRING_LEN;
+ }
+}
+
+void SwRedline::MoveToSection()
+{
+ if( !pCntntSect )
+ {
+ const SwPosition* pStt = Start(),
+ * pEnd = pStt == GetPoint() ? GetMark() : GetPoint();
+
+ SwDoc* pDoc = GetDoc();
+ SwPaM aPam( *pStt, *pEnd );
+ SwCntntNode* pCSttNd = pStt->nNode.GetNode().GetCntntNode();
+ SwCntntNode* pCEndNd = pEnd->nNode.GetNode().GetCntntNode();
+
+ if( !pCSttNd )
+ {
+ // damit die Indizies der anderen Redlines nicht mitverschoben
+ // werden, diese aufs Ende setzen (ist exclusive).
+ const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ {
+ SwRedline* pRedl = rTbl[ n ];
+ if( pRedl->GetBound(sal_True) == *pStt )
+ pRedl->GetBound(sal_True) = *pEnd;
+ if( pRedl->GetBound(sal_False) == *pStt )
+ pRedl->GetBound(sal_False) = *pEnd;
+ }
+ }
+
+ SwStartNode* pSttNd;
+ SwNodes& rNds = pDoc->GetNodes();
+ if( pCSttNd || pCEndNd )
+ {
+ SwTxtFmtColl* pColl = (pCSttNd && pCSttNd->IsTxtNode() )
+ ? ((SwTxtNode*)pCSttNd)->GetTxtColl()
+ : (pCEndNd && pCEndNd->IsTxtNode() )
+ ? ((SwTxtNode*)pCEndNd)->GetTxtColl()
+ : pDoc->GetTxtCollFromPool(
+ RES_POOLCOLL_STANDARD );
+
+ pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ),
+ SwNormalStartNode, pColl );
+ SwTxtNode* pTxtNd = rNds[ pSttNd->GetIndex() + 1 ]->GetTxtNode();
+
+ SwNodeIndex aNdIdx( *pTxtNd );
+ SwPosition aPos( aNdIdx, SwIndex( pTxtNd ));
+ if( pCSttNd && pCEndNd )
+ pDoc->MoveAndJoin( aPam, aPos, IDocumentContentOperations::DOC_MOVEDEFAULT );
+ else
+ {
+ if( pCSttNd && !pCEndNd )
+ bDelLastPara = sal_True;
+ pDoc->MoveRange( aPam, aPos,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
+ }
+ }
+ else
+ {
+ pSttNd = rNds.MakeEmptySection( SwNodeIndex( rNds.GetEndOfRedlines() ),
+ SwNormalStartNode );
+
+ SwPosition aPos( *pSttNd->EndOfSectionNode() );
+ pDoc->MoveRange( aPam, aPos,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
+ }
+ pCntntSect = new SwNodeIndex( *pSttNd );
+
+ if( pStt == GetPoint() )
+ Exchange();
+
+ DeleteMark();
+ }
+ else
+ InvalidateRange();
+}
+
+void SwRedline::CopyToSection()
+{
+ if( !pCntntSect )
+ {
+ const SwPosition* pStt = Start(),
+ * pEnd = pStt == GetPoint() ? GetMark() : GetPoint();
+
+ SwCntntNode* pCSttNd = pStt->nNode.GetNode().GetCntntNode();
+ SwCntntNode* pCEndNd = pEnd->nNode.GetNode().GetCntntNode();
+
+ SwStartNode* pSttNd;
+ SwDoc* pDoc = GetDoc();
+ SwNodes& rNds = pDoc->GetNodes();
+
+ sal_Bool bSaveCopyFlag = pDoc->IsCopyIsMove(),
+ bSaveRdlMoveFlg = pDoc->IsRedlineMove();
+ pDoc->SetCopyIsMove( sal_True );
+
+ // #100619# The IsRedlineMove() flag causes the behaviour of the
+ // SwDoc::_CopyFlyInFly method to change, which will eventually be
+ // called by the pDoc->Copy line below (through SwDoc::_Copy,
+ // SwDoc::CopyWithFlyInFly). This rather obscure bugfix was introduced
+ // for #63198# and #64896#, and apparently never really worked.
+ pDoc->SetRedlineMove( pStt->nContent == 0 );
+
+ if( pCSttNd )
+ {
+ SwTxtFmtColl* pColl = (pCSttNd && pCSttNd->IsTxtNode() )
+ ? ((SwTxtNode*)pCSttNd)->GetTxtColl()
+ : pDoc->GetTxtCollFromPool(
+ RES_POOLCOLL_STANDARD );
+
+ pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ),
+ SwNormalStartNode, pColl );
+
+ SwNodeIndex aNdIdx( *pSttNd, 1 );
+ SwTxtNode* pTxtNd = aNdIdx.GetNode().GetTxtNode();
+ SwPosition aPos( aNdIdx, SwIndex( pTxtNd ));
+ pDoc->CopyRange( *this, aPos, false );
+
+ // JP 08.10.98: die Vorlage vom EndNode ggfs. mit uebernehmen
+ // - ist im Doc::Copy nicht erwuenscht
+ if( pCEndNd && pCEndNd != pCSttNd )
+ {
+ SwCntntNode* pDestNd = aPos.nNode.GetNode().GetCntntNode();
+ if( pDestNd )
+ {
+ if( pDestNd->IsTxtNode() && pCEndNd->IsTxtNode() )
+ ((SwTxtNode*)pCEndNd)->CopyCollFmt(
+ *(SwTxtNode*)pDestNd );
+ else
+ pDestNd->ChgFmtColl( pCEndNd->GetFmtColl() );
+ }
+ }
+ }
+ else
+ {
+ pSttNd = rNds.MakeEmptySection( SwNodeIndex( rNds.GetEndOfRedlines() ),
+ SwNormalStartNode );
+
+ if( pCEndNd )
+ {
+ SwPosition aPos( *pSttNd->EndOfSectionNode() );
+ pDoc->CopyRange( *this, aPos, false );
+ }
+ else
+ {
+ SwNodeIndex aInsPos( *pSttNd->EndOfSectionNode() );
+ SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 );
+ pDoc->CopyWithFlyInFly( aRg, 0, aInsPos );
+ }
+ }
+ pCntntSect = new SwNodeIndex( *pSttNd );
+
+ pDoc->SetCopyIsMove( bSaveCopyFlag );
+ pDoc->SetRedlineMove( bSaveRdlMoveFlg );
+ }
+}
+
+void SwRedline::DelCopyOfSection()
+{
+ if( pCntntSect )
+ {
+ const SwPosition* pStt = Start(),
+ * pEnd = pStt == GetPoint() ? GetMark() : GetPoint();
+
+ SwDoc* pDoc = GetDoc();
+ SwPaM aPam( *pStt, *pEnd );
+ SwCntntNode* pCSttNd = pStt->nNode.GetNode().GetCntntNode();
+ SwCntntNode* pCEndNd = pEnd->nNode.GetNode().GetCntntNode();
+
+ if( !pCSttNd )
+ {
+ // damit die Indizies der anderen Redlines nicht mitverschoben
+ // werden, diese aufs Ende setzen (ist exclusive).
+ const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ {
+ SwRedline* pRedl = rTbl[ n ];
+ if( pRedl->GetBound(sal_True) == *pStt )
+ pRedl->GetBound(sal_True) = *pEnd;
+ if( pRedl->GetBound(sal_False) == *pStt )
+ pRedl->GetBound(sal_False) = *pEnd;
+ }
+ }
+
+ if( pCSttNd && pCEndNd )
+ {
+ // --> 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 )
+ bDelLastPara = sal_True;
+ pDoc->DeleteRange( aPam );
+
+ if( bDelLastPara )
+ {
+ // #100611# To prevent dangling references to the paragraph to
+ // be deleted, redline that point into this paragraph should be
+ // moved to the new end position. Since redlines in the redline
+ // table are sorted and the pEnd position is an endnode (see
+ // bDelLastPara condition above), only redlines before the
+ // current ones can be affected.
+ const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ sal_uInt16 n = rTbl.GetPos( this );
+ ASSERT( n != USHRT_MAX, "How strange. We don't exist!" );
+ for( sal_Bool bBreak = sal_False; !bBreak && n > 0; )
+ {
+ --n;
+ bBreak = sal_True;
+ if( rTbl[ n ]->GetBound(sal_True) == *aPam.GetPoint() )
+ {
+ rTbl[ n ]->GetBound(sal_True) = *pEnd;
+ bBreak = sal_False;
+ }
+ if( rTbl[ n ]->GetBound(sal_False) == *aPam.GetPoint() )
+ {
+ rTbl[ n ]->GetBound(sal_False) = *pEnd;
+ bBreak = sal_False;
+ }
+ }
+
+ SwPosition aEnd( *pEnd );
+ *GetPoint() = *pEnd;
+ *GetMark() = *pEnd;
+ DeleteMark();
+
+ aPam.GetBound( sal_True ).nContent.Assign( 0, 0 );
+ aPam.GetBound( sal_False ).nContent.Assign( 0, 0 );
+ aPam.DeleteMark();
+ pDoc->DelFullPara( aPam );
+ }
+ }
+ else
+ {
+ pDoc->DeleteRange( aPam );
+ }
+
+ if( pStt == GetPoint() )
+ Exchange();
+
+ DeleteMark();
+ }
+}
+
+void SwRedline::MoveFromSection()
+{
+ if( pCntntSect )
+ {
+ SwDoc* pDoc = GetDoc();
+ const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ SvPtrarr aBeforeArr( 16, 16 ), aBehindArr( 16, 16 );
+ sal_uInt16 nMyPos = rTbl.GetPos( this );
+ ASSERT( this, "this nicht im Array?" );
+ sal_Bool bBreak = sal_False;
+ sal_uInt16 n;
+
+ for( n = nMyPos+1; !bBreak && n < rTbl.Count(); ++n )
+ {
+ bBreak = sal_True;
+ if( rTbl[ n ]->GetBound(sal_True) == *GetPoint() )
+ {
+ void* pTmp = &rTbl[ n ]->GetBound(sal_True);
+ aBehindArr.Insert( pTmp, aBehindArr.Count());
+ bBreak = sal_False;
+ }
+ if( rTbl[ n ]->GetBound(sal_False) == *GetPoint() )
+ {
+ void* pTmp = &rTbl[ n ]->GetBound(sal_False);
+ aBehindArr.Insert( pTmp, aBehindArr.Count() );
+ bBreak = sal_False;
+ }
+ }
+ for( bBreak = sal_False, n = nMyPos; !bBreak && n ; )
+ {
+ --n;
+ bBreak = sal_True;
+ if( rTbl[ n ]->GetBound(sal_True) == *GetPoint() )
+ {
+ void* pTmp = &rTbl[ n ]->GetBound(sal_True);
+ aBeforeArr.Insert( pTmp, aBeforeArr.Count() );
+ bBreak = sal_False;
+ }
+ if( rTbl[ n ]->GetBound(sal_False) == *GetPoint() )
+ {
+ void* pTmp = &rTbl[ n ]->GetBound(sal_False);
+ aBeforeArr.Insert( pTmp, aBeforeArr.Count() );
+ bBreak = sal_False;
+ }
+ }
+
+ // --> OD 2009-03-17 #i95711#
+ const SwNode* pKeptCntntSectNode( &pCntntSect->GetNode() );
+ // <--
+ {
+ SwPaM aPam( pCntntSect->GetNode(),
+ *pCntntSect->GetNode().EndOfSectionNode(), 1,
+ ( bDelLastPara ? -2 : -1 ) );
+ SwCntntNode* pCNd = aPam.GetCntntNode();
+ if( pCNd )
+ aPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ else
+ aPam.GetPoint()->nNode++;
+
+ SwFmtColl* pColl = pCNd && pCNd->Len() && aPam.GetPoint()->nNode !=
+ aPam.GetMark()->nNode
+ ? pCNd->GetFmtColl() : 0;
+
+ SwNodeIndex aNdIdx( GetPoint()->nNode, -1 );
+ sal_uInt16 nPos = GetPoint()->nContent.GetIndex();
+
+ SwPosition aPos( *GetPoint() );
+ if( bDelLastPara && *aPam.GetPoint() == *aPam.GetMark() )
+ {
+ aPos.nNode--;
+
+ pDoc->AppendTxtNode( aPos );
+ }
+ else
+ {
+ pDoc->MoveRange( aPam, aPos,
+ IDocumentContentOperations::DOC_MOVEALLFLYS );
+ }
+
+ SetMark();
+ *GetPoint() = aPos;
+ GetMark()->nNode = aNdIdx.GetIndex() + 1;
+ pCNd = GetMark()->nNode.GetNode().GetCntntNode();
+ GetMark()->nContent.Assign( pCNd, nPos );
+
+ if( bDelLastPara )
+ {
+ GetPoint()->nNode++;
+ GetPoint()->nContent.Assign( pCNd = GetCntntNode(), 0 );
+ bDelLastPara = sal_False;
+ }
+ else if( pColl )
+ pCNd = GetCntntNode();
+
+ if( pColl && pCNd )
+ pCNd->ChgFmtColl( pColl );
+ }
+ // --> OD 2009-03-17 #i95771#
+ // Under certain conditions the previous <SwDoc::Move(..)> has already
+ // remove the change tracking section of this <SwRedline> instance from
+ // the change tracking nodes area.
+ // Thus, check, if <pCntntSect> still points to the change tracking section
+ // by comparing it with the "indexed" <SwNode> instance copied before
+ // perform the intrinsic move.
+ // Note: Such condition is e.g. a "delete" change tracking only containing a table.
+ if ( &pCntntSect->GetNode() == pKeptCntntSectNode )
+ {
+ pDoc->DeleteSection( &pCntntSect->GetNode() );
+ }
+ // <--
+ delete pCntntSect, pCntntSect = 0;
+
+ // #100611# adjustment of redline table positions must take start and
+ // end into account, not point and mark.
+ for( n = 0; n < aBeforeArr.Count(); ++n )
+ *(SwPosition*)aBeforeArr[ n ] = *Start();
+ for( n = 0; n < aBehindArr.Count(); ++n )
+ *(SwPosition*)aBehindArr[ n ] = *End();
+ }
+ else
+ InvalidateRange();
+}
+
+// fuers Undo
+void SwRedline::SetContentIdx( const SwNodeIndex* pIdx )
+{
+ if( pIdx && !pCntntSect )
+ {
+ pCntntSect = new SwNodeIndex( *pIdx );
+ bIsVisible = sal_False;
+ }
+ else if( !pIdx && pCntntSect )
+ {
+ delete pCntntSect, pCntntSect = 0;
+ bIsVisible = sal_False;
+ }
+#ifdef DBG_UTIL
+ else
+ ASSERT( !this, "das ist keine gueltige Operation" );
+#endif
+}
+
+sal_Bool SwRedline::CanCombine( const SwRedline& rRedl ) const
+{
+ return IsVisible() && rRedl.IsVisible() &&
+ pRedlineData->CanCombine( *rRedl.pRedlineData );
+}
+
+void SwRedline::PushData( const SwRedline& rRedl, sal_Bool bOwnAsNext )
+{
+// SwRedlineData* pNew = new SwRedlineData( rRedl.GetType(),
+// rRedl.GetAuthor() );
+ SwRedlineData* pNew = new SwRedlineData( *rRedl.pRedlineData, sal_False );
+ if( bOwnAsNext )
+ {
+ pNew->pNext = pRedlineData;
+ pRedlineData = pNew;
+ }
+ else
+ {
+ pNew->pNext = pRedlineData->pNext;
+ pRedlineData->pNext = pNew;
+ }
+}
+
+sal_Bool SwRedline::PopData()
+{
+ if( !pRedlineData->pNext )
+ return sal_False;
+ SwRedlineData* pCur = pRedlineData;
+ pRedlineData = pCur->pNext;
+ pCur->pNext = 0;
+ delete pCur;
+ return sal_True;
+}
+
+sal_uInt16 SwRedline::GetStackCount() const
+{
+ sal_uInt16 nRet = 1;
+ for( SwRedlineData* pCur = pRedlineData; pCur->pNext; ++nRet )
+ pCur = pCur->pNext;
+ return nRet;
+}
+
+// -> #111827#
+sal_uInt16 SwRedline::GetAuthor( sal_uInt16 nPos ) const
+{
+ return GetRedlineData(nPos).nAuthor;
+}
+
+const String& SwRedline::GetAuthorString( sal_uInt16 nPos ) const
+{
+ return SW_MOD()->GetRedlineAuthor(GetRedlineData(nPos).nAuthor);
+}
+
+const DateTime& SwRedline::GetTimeStamp( sal_uInt16 nPos ) const
+{
+ return GetRedlineData(nPos).aStamp;
+}
+
+RedlineType_t SwRedline::GetRealType( sal_uInt16 nPos ) const
+{
+ return GetRedlineData(nPos).eType;
+}
+
+const String& SwRedline::GetComment( sal_uInt16 nPos ) const
+{
+ return GetRedlineData(nPos).sComment;
+}
+// <- #111827#
+
+int SwRedline::operator==( const SwRedline& rCmp ) const
+{
+ return this == &rCmp;
+}
+
+int SwRedline::operator<( const SwRedline& rCmp ) const
+{
+ sal_Bool nResult = sal_False;
+
+ if (*Start() < *rCmp.Start())
+ nResult = sal_True;
+ else if (*Start() == *rCmp.Start())
+ if (*End() < *rCmp.End())
+ nResult = sal_True;
+
+ return nResult;
+}
+
+// -> #111827#
+const SwRedlineData & SwRedline::GetRedlineData(sal_uInt16 nPos) const
+{
+ SwRedlineData * pCur = pRedlineData;
+
+ while (nPos > 0 && NULL != pCur->pNext)
+ {
+ pCur = pCur->pNext;
+
+ nPos--;
+ }
+
+ ASSERT( 0 == nPos, "Pos angabe ist zu gross" );
+
+ return *pCur;
+}
+
+String SwRedline::GetDescr(sal_uInt16 nPos)
+{
+ String aResult;
+
+ // get description of redline data (e.g.: "insert $1")
+ aResult = GetRedlineData(nPos).GetDescr();
+
+ SwPaM * pPaM = NULL;
+ bool bDeletePaM = false;
+
+ // if this redline is visible the content is in this PaM
+ if (NULL == pCntntSect)
+ {
+ pPaM = this;
+ }
+ else // otherwise it is saved in pCntntSect
+ {
+ SwNodeIndex aTmpIdx( *pCntntSect->GetNode().EndOfSectionNode() );
+ pPaM = new SwPaM(*pCntntSect, aTmpIdx );
+ bDeletePaM = true;
+ }
+
+ // replace $1 in description by description of the redlines text
+ String aTmpStr;
+ aTmpStr += String(SW_RES(STR_START_QUOTE));
+ aTmpStr += ShortenString(pPaM->GetTxt(), nUndoStringLength,
+ String(SW_RES(STR_LDOTS)));
+ aTmpStr += String(SW_RES(STR_END_QUOTE));
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, aTmpStr);
+
+ aResult = aRewriter.Apply(aResult);
+
+ if (bDeletePaM)
+ delete pPaM;
+
+ return aResult;
+}
+// <- #111827#
+
+
+bool SwDoc::IsInRedlines(const SwNode & rNode) const
+{
+ SwPosition aPos(rNode);
+ SwNode & rEndOfRedlines = GetNodes().GetEndOfRedlines();
+ SwPaM aPam(SwPosition(*rEndOfRedlines.StartOfSectionNode()),
+ SwPosition(rEndOfRedlines));
+
+ return aPam.ContainsPosition(aPos) ? true : false;
+}
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
new file mode 100644
index 000000000000..c8703ab6adcb
--- /dev/null
+++ b/sw/source/core/doc/docruby.cxx
@@ -0,0 +1,361 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <string.h> // fuer strchr()
+
+#include <com/sun/star/i18n/UnicodeType.hdl>
+#include <com/sun/star/i18n/WordType.hdl>
+
+#include <unotools/charclass.hxx>
+
+#include <hintids.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <docary.hxx>
+#include <mvsave.hxx> // Strukturen zum Sichern beim Move/Delete
+#include <ndtxt.hxx>
+#include <txatbase.hxx>
+#include <rubylist.hxx>
+#include <pam.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <breakit.hxx>
+#include <crsskip.hxx>
+
+SV_IMPL_PTRARR( SwRubyList, SwRubyListEntryPtr )
+
+using namespace ::com::sun::star::i18n;
+
+
+/*
+ * Members in the list:
+ * - String - the orig text
+ * - SwFmtRuby - the ruby attribut
+ *
+ *
+ */
+sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList,
+ sal_uInt16 nMode )
+{
+ const SwPaM *_pStartCrsr = (SwPaM*)rPam.GetNext(),
+ *__pStartCrsr = _pStartCrsr;
+ sal_Bool bCheckEmpty = &rPam != _pStartCrsr;
+ do {
+ const SwPosition* pStt = _pStartCrsr->Start(),
+ * pEnd = pStt == _pStartCrsr->GetPoint()
+ ? _pStartCrsr->GetMark()
+ : _pStartCrsr->GetPoint();
+ if( !bCheckEmpty || ( pStt != pEnd && *pStt != *pEnd ))
+ {
+ SwPaM aPam( *pStt );
+ do {
+ SwRubyListEntry* pNew = new SwRubyListEntry;
+ if( pEnd != pStt )
+ {
+ aPam.SetMark();
+ *aPam.GetMark() = *pEnd;
+ }
+ if( _SelectNextRubyChars( aPam, *pNew, nMode ))
+ {
+ rList.Insert( pNew, rList.Count() );
+ aPam.DeleteMark();
+ }
+ else
+ {
+ delete pNew;
+ if( *aPam.GetPoint() < *pEnd )
+ {
+ // goto next paragraph
+ aPam.DeleteMark();
+ aPam.Move( fnMoveForward, fnGoNode );
+ }
+ else
+ break;
+ }
+ } while( 30 > rList.Count() && *aPam.GetPoint() < *pEnd );
+ }
+ } while( 30 > rList.Count() &&
+ (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr );
+
+ return rList.Count();
+}
+
+sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
+ sal_uInt16 nMode )
+{
+ GetIDocumentUndoRedo().StartUndo( UNDO_SETRUBYATTR, NULL );
+ SvUShortsSort aDelArr;
+ aDelArr.Insert( RES_TXTATR_CJK_RUBY );
+
+ sal_uInt16 nListEntry = 0;
+
+ const SwPaM *_pStartCrsr = (SwPaM*)rPam.GetNext(),
+ *__pStartCrsr = _pStartCrsr;
+ sal_Bool bCheckEmpty = &rPam != _pStartCrsr;
+ do {
+ const SwPosition* pStt = _pStartCrsr->Start(),
+ * pEnd = pStt == _pStartCrsr->GetPoint()
+ ? _pStartCrsr->GetMark()
+ : _pStartCrsr->GetPoint();
+ if( !bCheckEmpty || ( pStt != pEnd && *pStt != *pEnd ))
+ {
+
+ SwPaM aPam( *pStt );
+ do {
+ SwRubyListEntry aCheckEntry;
+ if( pEnd != pStt )
+ {
+ aPam.SetMark();
+ *aPam.GetMark() = *pEnd;
+ }
+ if( _SelectNextRubyChars( aPam, aCheckEntry, nMode ))
+ {
+ const SwRubyListEntry* pEntry = rList[ nListEntry++ ];
+ if( aCheckEntry.GetRubyAttr() != pEntry->GetRubyAttr() )
+ {
+ // set/reset the attribut
+ if( pEntry->GetRubyAttr().GetText().Len() )
+ {
+ InsertPoolItem( aPam, pEntry->GetRubyAttr(), 0 );
+ }
+ else
+ {
+ ResetAttrs( aPam, sal_True, &aDelArr );
+ }
+ }
+
+ if( aCheckEntry.GetText() != pEntry->GetText() &&
+ pEntry->GetText().Len() )
+ {
+ // text is changed, so replace the original
+ ReplaceRange( aPam, pEntry->GetText(), false );
+ }
+ aPam.DeleteMark();
+ }
+ else
+ {
+ if( *aPam.GetPoint() < *pEnd )
+ {
+ // goto next paragraph
+ aPam.DeleteMark();
+ aPam.Move( fnMoveForward, fnGoNode );
+ }
+ else
+ {
+ const SwRubyListEntry* pEntry = rList[ nListEntry++ ];
+
+ // set/reset the attribut
+ if( pEntry->GetRubyAttr().GetText().Len() &&
+ pEntry->GetText().Len() )
+ {
+ InsertString( aPam, pEntry->GetText() );
+ aPam.SetMark();
+ aPam.GetMark()->nContent -= pEntry->GetText().Len();
+ InsertPoolItem( aPam, pEntry->GetRubyAttr(),
+ nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
+ else
+ break;
+ aPam.DeleteMark();
+ }
+ }
+ } while( nListEntry < rList.Count() && *aPam.GetPoint() < *pEnd );
+ }
+ } while( 30 > rList.Count() &&
+ (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr );
+
+ GetIDocumentUndoRedo().EndUndo( UNDO_SETRUBYATTR, NULL );
+
+ return nListEntry;
+}
+
+sal_Bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_uInt16 )
+{
+ // Point must be the startposition, Mark is optional the end position
+ SwPosition* pPos = rPam.GetPoint();
+ const SwTxtNode* pTNd = pPos->nNode.GetNode().GetTxtNode();
+ const String* pTxt = &pTNd->GetTxt();
+ xub_StrLen nStart = pPos->nContent.GetIndex(), nEnd = pTxt->Len();
+
+ sal_Bool bHasMark = rPam.HasMark();
+ if( bHasMark )
+ {
+ // in the same node?
+ if( rPam.GetMark()->nNode == pPos->nNode )
+ {
+ // then use that end
+ xub_StrLen nTEnd = rPam.GetMark()->nContent.GetIndex();
+ if( nTEnd < nEnd )
+ nEnd = nTEnd;
+ }
+ rPam.DeleteMark();
+ }
+
+ // ----- search the start
+ // --- look where a ruby attribut starts
+ sal_uInt16 nHtIdx = USHRT_MAX;
+ const SwpHints* pHts = pTNd->GetpSwpHints();
+ const SwTxtAttr* pAttr = 0;
+ if( pHts )
+ {
+ const SwTxtAttr* pHt;
+ for( nHtIdx = 0; nHtIdx < pHts->Count(); ++nHtIdx )
+ if( RES_TXTATR_CJK_RUBY == ( pHt = (*pHts)[ nHtIdx ])->Which() &&
+ *pHt->GetAnyEnd() > nStart )
+ {
+ if( *pHt->GetStart() < nEnd )
+ {
+ pAttr = pHt;
+ if( !bHasMark && nStart > *pAttr->GetStart() )
+ {
+ nStart = *pAttr->GetStart();
+ pPos->nContent = nStart;
+ }
+ }
+ break;
+ }
+ }
+
+ if( !bHasMark && nStart && ( !pAttr || nStart != *pAttr->GetStart()) )
+ {
+ // skip to the word begin!
+ long nWordStt = pBreakIt->GetBreakIter()->getWordBoundary(
+ *pTxt, nStart,
+ pBreakIt->GetLocale( pTNd->GetLang( nStart )),
+ WordType::ANYWORD_IGNOREWHITESPACES,
+ sal_True ).startPos;
+ if( nWordStt < nStart && -1 != nWordStt )
+ {
+ nStart = (xub_StrLen)nWordStt;
+ pPos->nContent = nStart;
+ }
+ }
+
+ sal_Bool bAlphaNum = sal_False;
+ long nWordEnd = nEnd;
+ CharClass& rCC = GetAppCharClass();
+ while( nStart < nEnd )
+ {
+ if( pAttr && nStart == *pAttr->GetStart() )
+ {
+ pPos->nContent = nStart;
+ if( !rPam.HasMark() )
+ {
+ rPam.SetMark();
+ pPos->nContent = *pAttr->GetAnyEnd();
+ if( pPos->nContent.GetIndex() > nEnd )
+ pPos->nContent = nEnd;
+ rEntry.SetRubyAttr( pAttr->GetRuby() );
+ }
+ break;
+ }
+
+ sal_Int32 nChType = rCC.getType( *pTxt, nStart );
+ sal_Bool bIgnoreChar = sal_False, bIsAlphaNum = sal_False, bChkNxtWrd = sal_False;
+ switch( nChType )
+ {
+ case UnicodeType::UPPERCASE_LETTER:
+ case UnicodeType::LOWERCASE_LETTER:
+ case UnicodeType::TITLECASE_LETTER:
+ case UnicodeType::DECIMAL_DIGIT_NUMBER:
+ bChkNxtWrd = bIsAlphaNum = sal_True;
+ break;
+
+ case UnicodeType::SPACE_SEPARATOR:
+ case UnicodeType::CONTROL:
+/*??*/ case UnicodeType::PRIVATE_USE:
+ case UnicodeType::START_PUNCTUATION:
+ case UnicodeType::END_PUNCTUATION:
+ bIgnoreChar = sal_True;
+ break;
+
+
+ case UnicodeType::OTHER_LETTER:
+ bChkNxtWrd = sal_True;
+ // no break!
+// case UnicodeType::UNASSIGNED:
+// case UnicodeType::MODIFIER_LETTER:
+// case UnicodeType::NON_SPACING_MARK:
+// case UnicodeType::ENCLOSING_MARK:
+// case UnicodeType::COMBINING_SPACING_MARK:
+// case UnicodeType::LETTER_NUMBER:
+// case UnicodeType::OTHER_NUMBER:
+// case UnicodeType::LINE_SEPARATOR:
+// case UnicodeType::PARAGRAPH_SEPARATOR:
+// case UnicodeType::FORMAT:
+// case UnicodeType::SURROGATE:
+// case UnicodeType::DASH_PUNCTUATION:
+// case UnicodeType::CONNECTOR_PUNCTUATION:
+///*?? */case UnicodeType::OTHER_PUNCTUATION:
+//--> char '!' is to ignore!
+// case UnicodeType::MATH_SYMBOL:
+// case UnicodeType::CURRENCY_SYMBOL:
+// case UnicodeType::MODIFIER_SYMBOL:
+// case UnicodeType::OTHER_SYMBOL:
+// case UnicodeType::INITIAL_PUNCTUATION:
+// case UnicodeType::FINAL_PUNCTUATION:
+ default:
+ bIsAlphaNum = sal_False;
+ break;
+ }
+
+ if( rPam.HasMark() )
+ {
+ if( bIgnoreChar || bIsAlphaNum != bAlphaNum || nStart >= nWordEnd )
+ break;
+ }
+ else if( !bIgnoreChar )
+ {
+ rPam.SetMark();
+ bAlphaNum = bIsAlphaNum;
+ if( bChkNxtWrd && pBreakIt->GetBreakIter().is() )
+ {
+ // search the end of this word
+ nWordEnd = pBreakIt->GetBreakIter()->getWordBoundary(
+ *pTxt, nStart,
+ pBreakIt->GetLocale( pTNd->GetLang( nStart )),
+ WordType::ANYWORD_IGNOREWHITESPACES,
+ sal_True ).endPos;
+ if( 0 > nWordEnd || nWordEnd > nEnd || nWordEnd == nStart )
+ nWordEnd = nEnd;
+ }
+ }
+ pTNd->GoNext( &pPos->nContent, CRSR_SKIP_CHARS );
+ nStart = pPos->nContent.GetIndex();
+ }
+
+ nStart = rPam.GetMark()->nContent.GetIndex();
+ rEntry.SetText( pTxt->Copy( nStart,
+ rPam.GetPoint()->nContent.GetIndex() - nStart ));
+ return rPam.HasMark();
+}
+
+SwRubyListEntry::~SwRubyListEntry()
+{
+}
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
new file mode 100644
index 000000000000..497e00b70125
--- /dev/null
+++ b/sw/source/core/doc/docsort.cxx
@@ -0,0 +1,1036 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <rtl/math.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/CollatorOptions.hpp>
+#include <comphelper/processfactory.hxx>
+#include <editeng/unolingu.hxx>
+#include <docary.hxx>
+#include <fmtanchr.hxx>
+#include <frmfmt.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <node.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <swtable.hxx>
+#include <swundo.hxx>
+#include <sortopt.hxx>
+#include <docsort.hxx>
+#include <UndoSort.hxx>
+#include <UndoRedline.hxx>
+#include <hints.hxx>
+#include <tblsel.hxx>
+#include <cellatr.hxx>
+#include <redline.hxx>
+#include <node2lay.hxx>
+#include <unochart.hxx>
+
+#if OSL_DEBUG_LEVEL > 1
+//nur zum debugen
+#include <cellatr.hxx>
+#endif
+
+using namespace ::com::sun::star::lang;
+
+SwSortOptions* SwSortElement::pOptions = 0;
+SwDoc* SwSortElement::pDoc = 0;
+const FlatFndBox* SwSortElement::pBox = 0;
+CollatorWrapper* SwSortElement::pSortCollator = 0;
+Locale* SwSortElement::pLocale = 0;
+String* SwSortElement::pLastAlgorithm = 0;
+LocaleDataWrapper* SwSortElement::pLclData = 0;
+
+SV_IMPL_OP_PTRARR_SORT( SwSortElements, SwSortElementPtr );
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ein Sortierelement fuers Sort konstruieren
+ --------------------------------------------------------------------*/
+
+
+void SwSortElement::Init( SwDoc* pD, const SwSortOptions& rOpt,
+ FlatFndBox* pFltBx )
+{
+ ASSERT( !pDoc && !pOptions && !pBox, "wer hat das Finit vergessen?" );
+ pDoc = pD;
+ pOptions = new SwSortOptions( rOpt );
+ pBox = pFltBx;
+
+ LanguageType nLang = rOpt.nLanguage;
+ switch ( nLang )
+ {
+ case LANGUAGE_NONE:
+ case LANGUAGE_DONTKNOW:
+ nLang = (LanguageType)GetAppLanguage();
+ break;
+ }
+ pLocale = new Locale( SvxCreateLocale( nLang ) );
+
+ pSortCollator = new CollatorWrapper(
+ ::comphelper::getProcessServiceFactory() );
+// pSortCollator->loadCollatorAlgorithm( sAlgorithm, aLocale,
+// rOpt.bIgnoreCase ? SW_COLLATOR_IGNORES : 0 );
+}
+
+
+void SwSortElement::Finit()
+{
+ delete pOptions, pOptions = 0;
+ delete pLocale, pLocale = 0;
+ delete pLastAlgorithm, pLastAlgorithm = 0;
+ delete pSortCollator, pSortCollator = 0;
+ delete pLclData, pLclData = 0;
+ pDoc = 0;
+ pBox = 0;
+}
+
+
+SwSortElement::~SwSortElement()
+{
+}
+
+
+double SwSortElement::StrToDouble( const String& rStr ) const
+{
+ if( !pLclData )
+ pLclData = new LocaleDataWrapper(
+ ::comphelper::getProcessServiceFactory(), *pLocale );
+
+ rtl_math_ConversionStatus eStatus;
+ sal_Int32 nEnd;
+ double nRet = ::rtl::math::stringToDouble( rStr,
+ pLclData->getNumDecimalSep().GetChar(0),
+ pLclData->getNumThousandSep().GetChar(0),
+ &eStatus, &nEnd );
+
+ if( rtl_math_ConversionStatus_Ok != eStatus || nEnd == 0 )
+ nRet = 0.0;
+ return nRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Operatoren zum Vergleichen
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwSortElement::operator==(const SwSortElement& )
+{
+ return sal_False;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Kleiner-Operator fuers sortieren
+ --------------------------------------------------------------------*/
+
+sal_Bool SwSortElement::operator<(const SwSortElement& rCmp)
+{
+
+ // der eigentliche Vergleich
+ //
+ for(sal_uInt16 nKey = 0; nKey < pOptions->aKeys.Count(); ++nKey)
+ {
+ const SwSortElement *pOrig, *pCmp;
+
+ const SwSortKey* pSrtKey = pOptions->aKeys[ nKey ];
+ if( pSrtKey->eSortOrder == SRT_ASCENDING )
+ pOrig = this, pCmp = &rCmp;
+ else
+ pOrig = &rCmp, pCmp = this;
+
+ if( pSrtKey->bIsNumeric )
+ {
+ double n1 = pOrig->GetValue( nKey );
+ double n2 = pCmp->GetValue( nKey );
+
+ if( n1 == n2 )
+ continue;
+
+ return n1 < n2;
+ }
+ else
+ {
+ if( !pLastAlgorithm || *pLastAlgorithm != pSrtKey->sSortType )
+ {
+ if( pLastAlgorithm )
+ *pLastAlgorithm = pSrtKey->sSortType;
+ else
+ pLastAlgorithm = new String( pSrtKey->sSortType );
+ pSortCollator->loadCollatorAlgorithm( *pLastAlgorithm,
+ *pLocale,
+ pOptions->bIgnoreCase ? SW_COLLATOR_IGNORES : 0 );
+ }
+
+ sal_Int32 nCmp = pSortCollator->compareString(
+ pOrig->GetKey( nKey ), pCmp->GetKey( nKey ));
+ if( 0 == nCmp )
+ continue;
+
+ return -1 == nCmp;
+ }
+ }
+ return sal_False;
+}
+
+double SwSortElement::GetValue( sal_uInt16 nKey ) const
+{
+ return StrToDouble( GetKey( nKey ));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: SortierElemente fuer Text
+ --------------------------------------------------------------------*/
+
+
+SwSortTxtElement::SwSortTxtElement(const SwNodeIndex& rPos)
+ : nOrg(rPos.GetIndex()), aPos(rPos)
+{
+}
+
+
+SwSortTxtElement::~SwSortTxtElement()
+{
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Key ermitteln
+ --------------------------------------------------------------------*/
+
+
+String SwSortTxtElement::GetKey(sal_uInt16 nId) const
+{
+ SwTxtNode* pTxtNd = aPos.GetNode().GetTxtNode();
+ if( !pTxtNd )
+ return aEmptyStr;
+
+ // fuer TextNodes
+ const String& rStr = pTxtNd->GetTxt();
+
+ sal_Unicode nDeli = pOptions->cDeli;
+ sal_uInt16 nDCount = pOptions->aKeys[nId]->nColumnId, i = 1;
+ xub_StrLen nStart = 0;
+
+ // Den Delimitter suchen
+ while( nStart != STRING_NOTFOUND && i < nDCount)
+ if( STRING_NOTFOUND != ( nStart = rStr.Search( nDeli, nStart ) ) )
+ {
+ nStart++;
+ i++;
+ }
+
+ // naechsten Delimitter gefunden oder Ende des Strings und Kopieren
+ xub_StrLen nEnd = rStr.Search( nDeli, nStart+1 );
+ return rStr.Copy( nStart, nEnd-nStart );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sortier-Elemente fuer Tabellen
+ --------------------------------------------------------------------*/
+
+SwSortBoxElement::SwSortBoxElement( sal_uInt16 nRC )
+ : nRow( nRC )
+{
+}
+
+
+SwSortBoxElement::~SwSortBoxElement()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Schluessel zu einer Zelle ermitteln
+ --------------------------------------------------------------------*/
+
+
+String SwSortBoxElement::GetKey(sal_uInt16 nKey) const
+{
+ const _FndBox* pFndBox;
+ sal_uInt16 nCol = pOptions->aKeys[nKey]->nColumnId-1;
+
+ if( SRT_ROWS == pOptions->eDirection )
+ pFndBox = pBox->GetBox(nCol, nRow); // Zeilen sortieren
+ else
+ pFndBox = pBox->GetBox(nRow, nCol); // Spalten sortieren
+
+ // Den Text rausfieseln
+ String aRetStr;
+ if( pFndBox )
+ { // StartNode holen und ueberlesen
+ const SwTableBox* pMyBox = pFndBox->GetBox();
+ ASSERT(pMyBox, "Keine atomare Box");
+
+ if( pMyBox->GetSttNd() )
+ {
+ // ueber alle TextNodes der Box
+ const SwNode *pNd = 0, *pEndNd = pMyBox->GetSttNd()->EndOfSectionNode();
+ for( sal_uLong nIdx = pMyBox->GetSttIdx() + 1; pNd != pEndNd; ++nIdx )
+ if( ( pNd = pDoc->GetNodes()[ nIdx ])->IsTxtNode() )
+ aRetStr += ((SwTxtNode*)pNd)->GetTxt();
+ }
+ }
+ return aRetStr;
+}
+
+double SwSortBoxElement::GetValue( sal_uInt16 nKey ) const
+{
+ const _FndBox* pFndBox;
+ sal_uInt16 nCol = pOptions->aKeys[nKey]->nColumnId-1;
+
+ if( SRT_ROWS == pOptions->eDirection )
+ pFndBox = pBox->GetBox(nCol, nRow); // Zeilen sortieren
+ else
+ pFndBox = pBox->GetBox(nRow, nCol); // Spalten sortieren
+
+ double nVal;
+ if( pFndBox )
+ {
+ const SwFmt *pFmt = pFndBox->GetBox()->GetFrmFmt();
+ if (pFmt->GetTblBoxNumFmt().GetValue() & NUMBERFORMAT_TEXT)
+ nVal = SwSortElement::GetValue( nKey );
+ else
+ nVal = pFmt->GetTblBoxValue().GetValue();
+ }
+ else
+ nVal = 0;
+
+ return nVal;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Text sortieren im Document
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
+{
+ // pruefen ob Rahmen im Text
+ const SwPosition *pStart = rPaM.Start(), *pEnd = rPaM.End();
+ // Index auf den Start der Selektion
+
+ for ( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+ {
+ SwFrmFmt *const pFmt = static_cast<SwFrmFmt*>((*GetSpzFrmFmts())[n]);
+ SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor();
+ SwPosition const*const pAPos = pAnchor->GetCntntAnchor();
+
+ if (pAPos && (FLY_AT_PARA == pAnchor->GetAnchorId()) &&
+ pStart->nNode <= pAPos->nNode && pAPos->nNode <= pEnd->nNode )
+ return sal_False;
+ }
+
+ // pruefe ob nur TextNodes in der Selection liegen
+ {
+ sal_uLong nStart = pStart->nNode.GetIndex(),
+ nEnd = pEnd->nNode.GetIndex();
+ while( nStart <= nEnd )
+ // Iterieren ueber einen selektierten Bereich
+ if( !GetNodes()[ nStart++ ]->IsTxtNode() )
+ return sal_False;
+ }
+
+ bool const bUndo = GetIDocumentUndoRedo().DoesUndo();
+ if( bUndo )
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ }
+
+ SwPaM* pRedlPam = 0;
+ SwUndoRedlineSort* pRedlUndo = 0;
+ SwUndoSort* pUndoSort = 0;
+
+ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ {
+ pRedlPam = new SwPaM( pStart->nNode, pEnd->nNode, -1, 1 );
+ SwCntntNode* pCNd = pRedlPam->GetCntntNode( sal_False );
+ if( pCNd )
+ pRedlPam->GetMark()->nContent = pCNd->Len();
+
+ if( IsRedlineOn() && !IsShowOriginal( GetRedlineMode() ) )
+ {
+ if( bUndo )
+ {
+ pRedlUndo = new SwUndoRedlineSort( *pRedlPam,rOpt );
+ GetIDocumentUndoRedo().DoUndo(false);
+ }
+ // erst den Bereich kopieren, dann
+ SwNodeIndex aEndIdx( pEnd->nNode, 1 );
+ SwNodeRange aRg( pStart->nNode, aEndIdx );
+ GetNodes()._Copy( aRg, aEndIdx );
+
+ // Bereich neu ist von pEnd->nNode+1 bis aEndIdx
+ DeleteRedline( *pRedlPam, true, USHRT_MAX );
+
+ pRedlPam->GetMark()->nNode.Assign( pEnd->nNode.GetNode(), 1 );
+ pCNd = pRedlPam->GetCntntNode( sal_False );
+ pRedlPam->GetMark()->nContent.Assign( pCNd, 0 );
+
+ pRedlPam->GetPoint()->nNode.Assign( aEndIdx.GetNode() );
+ pCNd = pRedlPam->GetCntntNode( sal_True );
+ xub_StrLen nCLen = 0;
+ if( !pCNd &&
+ 0 != (pCNd = GetNodes()[ aEndIdx.GetIndex()-1 ]->GetCntntNode()))
+ {
+ nCLen = pCNd->Len();
+ pRedlPam->GetPoint()->nNode.Assign( *pCNd );
+ }
+ pRedlPam->GetPoint()->nContent.Assign( pCNd, nCLen );
+
+ if( pRedlUndo )
+ pRedlUndo->SetValues( rPaM );
+ }
+ else
+ {
+ DeleteRedline( *pRedlPam, true, USHRT_MAX );
+ delete pRedlPam, pRedlPam = 0;
+ }
+ }
+
+ SwNodeIndex aStart(pStart->nNode);
+ SwSortElement::Init( this, rOpt );
+ SwSortElements aSortArr;
+ while( aStart <= pEnd->nNode )
+ {
+ // Iterieren ueber einen selektierten Bereich
+ SwSortTxtElement* pSE = new SwSortTxtElement( aStart );
+ aSortArr.Insert(pSE);
+ aStart++;
+ }
+
+ // Und jetzt der Akt: Verschieben von Nodes und immer schoen auf UNDO
+ // achten
+ //
+ sal_uLong nBeg = pStart->nNode.GetIndex();
+ SwNodeRange aRg( aStart, aStart );
+
+ if( bUndo && !pRedlUndo )
+ {
+ pUndoSort = new SwUndoSort(rPaM, rOpt);
+ GetIDocumentUndoRedo().AppendUndo(pUndoSort);
+ }
+
+ GetIDocumentUndoRedo().DoUndo(false);
+
+ for ( sal_uInt16 n = 0; n < aSortArr.Count(); ++n )
+ {
+ SwSortTxtElement* pBox = (SwSortTxtElement*)aSortArr[n];
+ aStart = nBeg + n;
+ aRg.aStart = pBox->aPos.GetIndex();
+ aRg.aEnd = aRg.aStart.GetIndex() + 1;
+
+ // Nodes verschieben
+ MoveNodeRange( aRg, aStart,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
+
+ // Undo Verschiebungen einpflegen
+ if(pUndoSort)
+ pUndoSort->Insert(pBox->nOrg, nBeg + n);
+ }
+ // Alle Elemente aus dem SortArray loeschen
+ aSortArr.DeleteAndDestroy(0, aSortArr.Count());
+ SwSortElement::Finit();
+
+ if( pRedlPam )
+ {
+ if( pRedlUndo )
+ {
+ pRedlUndo->SetSaveRange( *pRedlPam );
+ // UGLY: temp. enable Undo
+ GetIDocumentUndoRedo().DoUndo(true);
+ GetIDocumentUndoRedo().AppendUndo( pRedlUndo );
+ GetIDocumentUndoRedo().DoUndo(false);
+ }
+
+ // nBeg is start of sorted range
+ SwNodeIndex aSttIdx( GetNodes(), nBeg );
+
+ // the copied range is deleted
+ SwRedline *const pDeleteRedline(
+ new SwRedline( nsRedlineType_t::REDLINE_DELETE, *pRedlPam ));
+
+ // pRedlPam points to nodes that may be deleted (hidden) by
+ // AppendRedline, so adjust it beforehand to prevent ASSERT
+ pRedlPam->GetPoint()->nNode = aSttIdx;
+ SwCntntNode* pCNd = aSttIdx.GetNode().GetCntntNode();
+ pRedlPam->GetPoint()->nContent.Assign( pCNd, 0 );
+
+ AppendRedline(pDeleteRedline, true);
+
+ // the sorted range is inserted
+ AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlPam ), true);
+
+ if( pRedlUndo )
+ {
+ SwNodeIndex aInsEndIdx( pRedlPam->GetMark()->nNode, -1 );
+ pRedlPam->GetMark()->nNode = aInsEndIdx;
+ SwCntntNode *const pPrevNode =
+ pRedlPam->GetMark()->nNode.GetNode().GetCntntNode();
+ pRedlPam->GetMark()->nContent.Assign( pPrevNode, pPrevNode->Len() );
+
+ pRedlUndo->SetValues( *pRedlPam );
+ }
+
+ if( pRedlUndo )
+ pRedlUndo->SetOffset( aSttIdx );
+
+ delete pRedlPam, pRedlPam = 0;
+ }
+ GetIDocumentUndoRedo().DoUndo( bUndo );
+ if( bUndo )
+ {
+ GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
+
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Tabelle sortieren im Document
+ --------------------------------------------------------------------*/
+
+sal_Bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
+{
+ // uebers SwDoc fuer Undo !!
+ ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ // Auf gehts sortieren
+ // suche alle Boxen / Lines
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aPara( rBoxes, &aFndBox );
+ pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara );;
+ }
+
+ if(!aFndBox.GetLines().Count())
+ return sal_False;
+
+ if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ DeleteRedline( *pTblNd, true, USHRT_MAX );
+
+ sal_uInt16 nStart = 0;
+ if( pTblNd->GetTable().GetRowsToRepeat() > 0 && rOpt.eDirection == SRT_ROWS )
+ {
+ // Oberste seleketierte Zeile
+ _FndLines& rLines = aFndBox.GetLines();
+
+ while( nStart < rLines.Count() )
+ {
+ // Verschachtelung durch Split Merge beachten,
+ // die oberste rausholen
+ SwTableLine* pLine = rLines[nStart]->GetLine();
+ while ( pLine->GetUpper() )
+ pLine = pLine->GetUpper()->GetUpper();
+
+ if( pTblNd->GetTable().IsHeadline( *pLine ) )
+ nStart++;
+ else
+ break;
+ }
+ // Alle selektierten in der HeaderLine ? -> kein Offset
+ if( nStart == rLines.Count() )
+ nStart = 0;
+ }
+
+ // umschalten auf relative Formeln
+ SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() );
+ aMsgHnt.eFlags = TBL_RELBOXNAME;
+ UpdateTblFlds( &aMsgHnt );
+
+ // Tabelle als flache Array-Struktur
+ FlatFndBox aFlatBox(this, aFndBox);
+
+ if(!aFlatBox.IsSymmetric())
+ return sal_False;
+
+ // MIB 9.7.97: HTML-Layout loeschen
+ pTblNd->GetTable().SetHTMLTableLayout( 0 );
+
+ // --> FME 2004-11-26 #i37739# A simple 'MakeFrms' after the node sorting
+ // does not work if the table is inside a frame and has no prev/next.
+ SwNode2Layout aNode2Layout( *pTblNd );
+ // <--
+
+ // loesche die Frames der Tabelle
+ pTblNd->DelFrms();
+ // ? TL_CHART2: ?
+
+ SwUndoSort* pUndoSort = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndoSort = new SwUndoSort( rBoxes[0]->GetSttIdx(),
+ rBoxes[rBoxes.Count()-1]->GetSttIdx(),
+ *pTblNd, rOpt, aFlatBox.HasItemSets() );
+ GetIDocumentUndoRedo().AppendUndo(pUndoSort);
+ }
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ // SchluesselElemente einsortieren
+ sal_uInt16 nCount = (rOpt.eDirection == SRT_ROWS) ?
+ aFlatBox.GetRows() : aFlatBox.GetCols();
+
+ // SortList nach Schluessel sortieren
+ SwSortElement::Init( this, rOpt, &aFlatBox );
+ SwSortElements aSortList;
+
+ // wenn die HeaderLine wiederholt wird und die
+ // Zeilen sortiert werden 1.Zeile nicht mitsortieren
+ sal_uInt16 i;
+
+ for( i = nStart; i < nCount; ++i)
+ {
+ SwSortBoxElement* pEle = new SwSortBoxElement( i );
+ aSortList.Insert(pEle);
+ }
+
+ // nach Sortierung verschieben
+ SwMovedBoxes aMovedList;
+ for(i=0; i < aSortList.Count(); ++i)
+ {
+ SwSortBoxElement* pBox = (SwSortBoxElement*)aSortList[i];
+ if(rOpt.eDirection == SRT_ROWS)
+ MoveRow(this, aFlatBox, pBox->nRow, i + nStart, aMovedList, pUndoSort);
+ else
+ MoveCol(this, aFlatBox, pBox->nRow, i + nStart, aMovedList, pUndoSort);
+ }
+
+ // Restore table frames:
+ // --> FME 2004-11-26 #i37739# A simple 'MakeFrms' after the node sorting
+ // does not work if the table is inside a frame and has no prev/next.
+ const sal_uLong nIdx = pTblNd->GetIndex();
+ aNode2Layout.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 );
+ // <--
+
+ // TL_CHART2: need to inform chart of probably changed cell names
+ UpdateCharts( pTblNd->GetTable().GetFrmFmt()->GetName() );
+
+ // Alle Elemente aus dem SortArray loeschen
+ aSortList.DeleteAndDestroy( 0, aSortList.Count() );
+ SwSortElement::Finit();
+
+ SetModified();
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zeilenweise verschieben
+ --------------------------------------------------------------------*/
+
+
+void MoveRow(SwDoc* pDoc, const FlatFndBox& rBox, sal_uInt16 nS, sal_uInt16 nT,
+ SwMovedBoxes& rMovedList, SwUndoSort* pUD)
+{
+ for( sal_uInt16 i=0; i < rBox.GetCols(); ++i )
+ { // Alte Zellen-Pos bestimmen und merken
+ const _FndBox* pSource = rBox.GetBox(i, nS);
+
+ // neue Zellen-Pos
+ const _FndBox* pTarget = rBox.GetBox(i, nT);
+
+ const SwTableBox* pT = pTarget->GetBox();
+ const SwTableBox* pS = pSource->GetBox();
+
+ sal_Bool bMoved = rMovedList.GetPos(pT) != USHRT_MAX;
+
+ // und verschieben
+ MoveCell(pDoc, pS, pT, bMoved, pUD);
+
+ rMovedList.Insert(pS, rMovedList.Count() );
+
+ if( pS != pT )
+ {
+ SwFrmFmt* pTFmt = (SwFrmFmt*)pT->GetFrmFmt();
+ const SfxItemSet* pSSet = rBox.GetItemSet( i, nS );
+
+ if( pSSet ||
+ SFX_ITEM_SET == pTFmt->GetItemState( RES_BOXATR_FORMAT ) ||
+ SFX_ITEM_SET == pTFmt->GetItemState( RES_BOXATR_FORMULA ) ||
+ SFX_ITEM_SET == pTFmt->GetItemState( RES_BOXATR_VALUE ) )
+ {
+ pTFmt = ((SwTableBox*)pT)->ClaimFrmFmt();
+ pTFmt->LockModify();
+ if( pTFmt->ResetFmtAttr( RES_BOXATR_FORMAT, RES_BOXATR_VALUE ) )
+ pTFmt->ResetFmtAttr( RES_VERT_ORIENT );
+
+ if( pSSet )
+ pTFmt->SetFmtAttr( *pSSet );
+ pTFmt->UnlockModify();
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Spaltenweise verschieben
+ --------------------------------------------------------------------*/
+
+
+void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, sal_uInt16 nS, sal_uInt16 nT,
+ SwMovedBoxes& rMovedList, SwUndoSort* pUD)
+{
+ for(sal_uInt16 i=0; i < rBox.GetRows(); ++i)
+ { // Alte Zellen-Pos bestimmen und merken
+ const _FndBox* pSource = rBox.GetBox(nS, i);
+
+ // neue Zellen-Pos
+ const _FndBox* pTarget = rBox.GetBox(nT, i);
+
+ // und verschieben
+ const SwTableBox* pT = pTarget->GetBox();
+ const SwTableBox* pS = pSource->GetBox();
+
+ // und verschieben
+ sal_Bool bMoved = rMovedList.GetPos(pT) != USHRT_MAX;
+ MoveCell(pDoc, pS, pT, bMoved, pUD);
+
+ rMovedList.Insert(pS, rMovedList.Count() );
+
+ if( pS != pT )
+ {
+ SwFrmFmt* pTFmt = (SwFrmFmt*)pT->GetFrmFmt();
+ const SfxItemSet* pSSet = rBox.GetItemSet( nS, i );
+
+ if( pSSet ||
+ SFX_ITEM_SET == pTFmt->GetItemState( RES_BOXATR_FORMAT ) ||
+ SFX_ITEM_SET == pTFmt->GetItemState( RES_BOXATR_FORMULA ) ||
+ SFX_ITEM_SET == pTFmt->GetItemState( RES_BOXATR_VALUE ) )
+ {
+ pTFmt = ((SwTableBox*)pT)->ClaimFrmFmt();
+ pTFmt->LockModify();
+ if( pTFmt->ResetFmtAttr( RES_BOXATR_FORMAT, RES_BOXATR_VALUE ) )
+ pTFmt->ResetFmtAttr( RES_VERT_ORIENT );
+
+ if( pSSet )
+ pTFmt->SetFmtAttr( *pSSet );
+ pTFmt->UnlockModify();
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Eine einzelne Zelle verschieben
+ --------------------------------------------------------------------*/
+
+
+void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar,
+ sal_Bool bMovedBefore, SwUndoSort* pUD)
+{
+ ASSERT(pSource && pTar,"Fehlende Quelle oder Ziel");
+
+ if(pSource == pTar)
+ return;
+
+ if(pUD)
+ pUD->Insert( pSource->GetName(), pTar->GetName() );
+
+ // Pam Quelle auf den ersten ContentNode setzen
+ SwNodeRange aRg( *pSource->GetSttNd(), 0, *pSource->GetSttNd() );
+ SwNode* pNd = pDoc->GetNodes().GoNext( &aRg.aStart );
+
+ // wurde die Zelle (Source) nicht verschoben
+ // -> einen Leer-Node einfuegen und den Rest verschieben
+ // ansonsten steht der Mark auf dem ersten Content-Node
+ if( pNd->StartOfSectionNode() == pSource->GetSttNd() )
+ pNd = pDoc->GetNodes().MakeTxtNode( aRg.aStart,
+ (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
+ aRg.aEnd = *pNd->EndOfSectionNode();
+
+ // Ist das Ziel leer(1 leerer Node vorhanden)
+ // -> diesen loeschen und move
+ // Ziel
+ SwNodeIndex aTar( *pTar->GetSttNd() );
+ pNd = pDoc->GetNodes().GoNext( &aTar ); // naechsten ContentNode
+ sal_uLong nCount = pNd->EndOfSectionIndex() - pNd->StartOfSectionIndex();
+
+ sal_Bool bDelFirst = sal_False;
+ if( nCount == 2 )
+ {
+ ASSERT( pNd->GetCntntNode(), "Kein ContentNode");
+ bDelFirst = !pNd->GetCntntNode()->Len() && bMovedBefore;
+ }
+
+ if(!bDelFirst)
+ { // Es besteht schon Inhalt -> alter I n h a l t Section Down
+ SwNodeRange aRgTar( aTar.GetNode(), 0, *pNd->EndOfSectionNode() );
+ pDoc->GetNodes().SectionDown( &aRgTar );
+ }
+
+ // Einfuegen der Source
+ SwNodeIndex aIns( *pTar->GetSttNd()->EndOfSectionNode() );
+ pDoc->MoveNodeRange( aRg, aIns,
+ IDocumentContentOperations::DOC_MOVEDEFAULT );
+
+ // Falls erster Node leer -> weg damit
+ if(bDelFirst)
+ pDoc->GetNodes().Delete( aTar, 1 );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zweidimensionales Array aus FndBoxes generieren
+ --------------------------------------------------------------------*/
+
+
+FlatFndBox::FlatFndBox(SwDoc* pDocPtr, const _FndBox& rBox) :
+ pDoc(pDocPtr),
+ rBoxRef(rBox),
+ pArr(0),
+ ppItemSets(0),
+ nRow(0),
+ nCol(0)
+{ // Ist das Array symmetrisch
+ if((bSym = CheckLineSymmetry(rBoxRef)) != 0)
+ {
+ // Spalten/Reihen-Anzahl ermitteln
+ nCols = GetColCount(rBoxRef);
+ nRows = GetRowCount(rBoxRef);
+
+ // lineares Array anlegen
+ pArr = new _FndBoxPtr[ nRows * nCols ];
+ _FndBox** ppTmp = (_FndBox**)pArr;
+ memset( ppTmp, 0, sizeof(_FndBoxPtr) * nRows * nCols );
+
+
+ FillFlat( rBoxRef );
+ }
+}
+
+
+FlatFndBox::~FlatFndBox()
+{
+ _FndBox** ppTmp = (_FndBox**)pArr;
+ delete [] ppTmp;
+
+ if( ppItemSets )
+ delete [] ppItemSets;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Alle Lines einer Box muessen gleichviel Boxen haben
+ --------------------------------------------------------------------*/
+
+
+sal_Bool FlatFndBox::CheckLineSymmetry(const _FndBox& rBox)
+{
+ const _FndLines &rLines = rBox.GetLines();
+ sal_uInt16 nBoxes(0);
+
+ // UeberLines iterieren
+ for(sal_uInt16 i=0; i < rLines.Count(); ++i)
+ { // Die Boxen einer Line
+ _FndLine* pLn = rLines[i];
+ const _FndBoxes& rBoxes = pLn->GetBoxes();
+
+ // Anzahl der Boxen aller Lines ungleich -> keine Symmetrie
+ if( i && nBoxes != rBoxes.Count())
+ return sal_False;
+
+ nBoxes = rBoxes.Count();
+ if( !CheckBoxSymmetry( *pLn ) )
+ return sal_False;
+ }
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Box auf Symmetrie pruefen
+ Alle Boxen einer Line muessen gleichviele Lines haben
+ --------------------------------------------------------------------*/
+
+
+sal_Bool FlatFndBox::CheckBoxSymmetry(const _FndLine& rLn)
+{
+ const _FndBoxes &rBoxes = rLn.GetBoxes();
+ sal_uInt16 nLines(0);
+
+ // Ueber Boxes iterieren
+ for(sal_uInt16 i=0; i < rBoxes.Count(); ++i)
+ { // Die Boxen einer Line
+ _FndBox* pBox = rBoxes[i];
+ const _FndLines& rLines = pBox->GetLines();
+
+ // Anzahl der Boxen aller Lines ungleich -> keine Symmetrie
+ if( i && nLines != rLines.Count() )
+ return sal_False;
+
+ nLines = rLines.Count();
+ if( nLines && !CheckLineSymmetry( *pBox ) )
+ return sal_False;
+ }
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: max Anzahl der Spalten (Boxes)
+ --------------------------------------------------------------------*/
+
+
+sal_uInt16 FlatFndBox::GetColCount(const _FndBox& rBox)
+{
+ const _FndLines& rLines = rBox.GetLines();
+ // Ueber Lines iterieren
+ if( !rLines.Count() )
+ return 1;
+
+ sal_uInt16 nSum = 0;
+ for( sal_uInt16 i=0; i < rLines.Count(); ++i )
+ {
+ // Die Boxen einer Line
+ sal_uInt16 nCount = 0;
+ const _FndBoxes& rBoxes = rLines[i]->GetBoxes();
+ for( sal_uInt16 j=0; j < rBoxes.Count(); ++j )
+ // Rekursiv wirder ueber die Lines Iterieren
+ nCount += rBoxes[j]->GetLines().Count()
+ ? GetColCount(*rBoxes[j]) : 1;
+
+ if( nSum < nCount )
+ nSum = nCount;
+ }
+ return nSum;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: max Anzahl der Zeilen (Lines)
+ --------------------------------------------------------------------*/
+
+
+sal_uInt16 FlatFndBox::GetRowCount(const _FndBox& rBox)
+{
+ const _FndLines& rLines = rBox.GetLines();
+ if( !rLines.Count() )
+ return 1;
+
+ sal_uInt16 nLines = 0;
+ for(sal_uInt16 i=0; i < rLines.Count(); ++i)
+ { // Die Boxen einer Line
+ const _FndBoxes& rBoxes = rLines[i]->GetBoxes();
+ sal_uInt16 nLn = 1;
+ for(sal_uInt16 j=0; j < rBoxes.Count(); ++j)
+ if( rBoxes[j]->GetLines().Count() )
+ // Rekursiv ueber die Lines Iterieren
+ nLn = Max(GetRowCount(*rBoxes[j]), nLn);
+
+ nLines = nLines + nLn;
+ }
+ return nLines;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: lineares Array aus atomaren FndBoxes erzeugen
+ --------------------------------------------------------------------*/
+
+
+void FlatFndBox::FillFlat(const _FndBox& rBox, sal_Bool bLastBox)
+{
+ sal_Bool bModRow = sal_False;
+ const _FndLines& rLines = rBox.GetLines();
+
+ // Ueber Lines iterieren
+ sal_uInt16 nOldRow = nRow;
+ for( sal_uInt16 i=0; i < rLines.Count(); ++i )
+ {
+ // Die Boxen einer Line
+ const _FndBoxes& rBoxes = rLines[i]->GetBoxes();
+ sal_uInt16 nOldCol = nCol;
+ for( sal_uInt16 j = 0; j < rBoxes.Count(); ++j )
+ {
+ // Die Box pruefen ob es eine atomare Box ist
+ const _FndBox* pBox = rBoxes[ j ];
+
+ if( !pBox->GetLines().Count() )
+ {
+ // peichern
+ sal_uInt16 nOff = nRow * nCols + nCol;
+ *(pArr + nOff) = pBox;
+
+ // sicher die Formel/Format/Value Werte
+ const SwFrmFmt* pFmt = pBox->GetBox()->GetFrmFmt();
+ if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMAT ) ||
+ SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMULA ) ||
+ SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_VALUE ) )
+ {
+ SfxItemSet* pSet = new SfxItemSet( pDoc->GetAttrPool(),
+ RES_BOXATR_FORMAT, RES_BOXATR_VALUE,
+ RES_VERT_ORIENT, RES_VERT_ORIENT, 0 );
+ pSet->Put( pFmt->GetAttrSet() );
+ if( !ppItemSets )
+ {
+ ppItemSets = new SfxItemSet*[ nRows * nCols ];
+ memset( ppItemSets, 0, sizeof(SfxItemSet*) * nRows * nCols );
+ }
+ *(ppItemSets + nOff ) = pSet;
+ }
+
+ bModRow = sal_True;
+ }
+ else
+ {
+ // Rekursiv wieder ueber die Lines einer Box Iterieren
+ FillFlat( *pBox, ( j == rBoxes.Count()-1 ) );
+ }
+ nCol++;
+ }
+ if(bModRow)
+ nRow++;
+ nCol = nOldCol;
+ }
+ if(!bLastBox)
+ nRow = nOldRow;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zugriff auf eine bestimmte Zelle
+ --------------------------------------------------------------------*/
+
+
+const _FndBox* FlatFndBox::GetBox(sal_uInt16 n_Col, sal_uInt16 n_Row) const
+{
+ sal_uInt16 nOff = n_Row * nCols + n_Col;
+ const _FndBox* pTmp = *(pArr + nOff);
+
+ ASSERT(n_Col < nCols && n_Row < nRows && pTmp, "unzulaessiger Array-Zugriff");
+ return pTmp;
+}
+
+const SfxItemSet* FlatFndBox::GetItemSet(sal_uInt16 n_Col, sal_uInt16 n_Row) const
+{
+ ASSERT( !ppItemSets || ( n_Col < nCols && n_Row < nRows), "unzulaessiger Array-Zugriff");
+
+ return ppItemSets ? *(ppItemSets + (n_Row * nCols + n_Col )) : 0;
+}
+
+
diff --git a/sw/source/core/doc/docstat.cxx b/sw/source/core/doc/docstat.cxx
new file mode 100644
index 000000000000..ee44bf142de3
--- /dev/null
+++ b/sw/source/core/doc/docstat.cxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <docstat.hxx>
+
+
+/************************************************************************
+ * SwDocStat::SwDocStat()
+ ************************************************************************/
+
+SwDocStat::SwDocStat() :
+ nTbl(0),
+ nGrf(0),
+ nOLE(0),
+ nPage(1),
+ nPara(1),
+ nAllPara(1),
+ nWord(0),
+ nChar(0),
+ bModified(sal_True)
+{}
+
+/************************************************************************
+ * void SwDocStat::Reset()
+ ************************************************************************/
+
+void SwDocStat::Reset()
+{
+ nTbl = 0;
+ nGrf = 0;
+ nOLE = 0;
+ nPage = 1;
+ nPara = 1;
+ nAllPara= 1;
+ nWord = 0;
+ nChar = 0;
+ bModified = sal_True;
+}
+
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
new file mode 100644
index 000000000000..ce17a146d40f
--- /dev/null
+++ b/sw/source/core/doc/doctxm.cxx
@@ -0,0 +1,2441 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <limits.h>
+#include <hintids.hxx>
+
+#define _SVSTDARR_STRINGSSORT
+#include <svl/svstdarr.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <sot/clsids.hxx>
+#include <docsh.hxx>
+#include <ndole.hxx>
+#include <txttxmrk.hxx>
+#include <fmtinfmt.hxx>
+#include <fmtpdsc.hxx>
+#include <frmfmt.hxx>
+#include <fmtfsize.hxx>
+#include <frmatr.hxx>
+#include <pagedesc.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pagefrm.hxx>
+#include <ndtxt.hxx>
+#include <swtable.hxx>
+#include <doctxm.hxx>
+#include <txmsrt.hxx>
+#include <rolbck.hxx>
+#include <poolfmt.hxx>
+#include <txtfrm.hxx>
+#include <rootfrm.hxx>
+#include <UndoAttribute.hxx>
+#include <swundo.hxx>
+#include <mdiexp.hxx>
+#include <docary.hxx>
+#include <charfmt.hxx>
+#include <fchrfmt.hxx>
+#include <fldbas.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <expfld.hxx>
+#include <chpfld.hxx>
+#include <mvsave.hxx>
+#include <node2lay.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <breakit.hxx>
+#include <editsh.hxx>
+#include <scriptinfo.hxx>
+#include <switerator.hxx>
+
+using namespace ::com::sun::star;
+
+const sal_Unicode cNumRepl = '@';
+const sal_Unicode cEndPageNum = '~';
+const sal_Char __FAR_DATA sPageDeli[] = ", ";
+
+SV_IMPL_PTRARR(SwTOXSortTabBases, SwTOXSortTabBasePtr)
+
+TYPEINIT2( SwTOXBaseSection, SwTOXBase, SwSection ); // fuers RTTI
+
+struct LinkStruct
+{
+ SwFmtINetFmt aINetFmt;
+ xub_StrLen nStartTextPos, nEndTextPos;
+
+ LinkStruct( const String& rURL, xub_StrLen nStart, xub_StrLen nEnd )
+ : aINetFmt( rURL, aEmptyStr),
+ nStartTextPos( nStart),
+ nEndTextPos(nEnd) {}
+};
+
+typedef LinkStruct* LinkStructPtr;
+SV_DECL_PTRARR(LinkStructArr, LinkStructPtr, 0, 5 )
+SV_IMPL_PTRARR(LinkStructArr, LinkStructPtr)
+
+sal_uInt16 SwDoc::GetTOIKeys( SwTOIKeyType eTyp, SvStringsSort& rArr ) const
+{
+ if( rArr.Count() )
+ rArr.Remove( sal_uInt16(0), rArr.Count() );
+
+ // dann mal ueber den Pool und alle Primary oder Secondary heraussuchen
+ const SwTxtTOXMark* pMark;
+ const SfxPoolItem* pItem;
+ const SwTOXType* pTOXType;
+ sal_uInt32 i, nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK );
+ for( i = 0; i < nMaxItems; ++i )
+ if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_TOXMARK, i ) ) &&
+ 0!= ( pTOXType = ((SwTOXMark*)pItem)->GetTOXType()) &&
+ TOX_INDEX == pTOXType->GetType() &&
+ 0 != ( pMark = ((SwTOXMark*)pItem)->GetTxtTOXMark() ) &&
+ pMark->GetpTxtNd() &&
+ pMark->GetpTxtNd()->GetNodes().IsDocNodes() )
+ {
+ const String* pStr;
+ if( TOI_PRIMARY == eTyp )
+ pStr = &((SwTOXMark*)pItem)->GetPrimaryKey();
+ else
+ pStr = &((SwTOXMark*)pItem)->GetSecondaryKey();
+
+ if( pStr->Len() )
+ rArr.Insert( (StringPtr)pStr );
+ }
+
+ return rArr.Count();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: aktuelle Verzeichnismarkierungen ermitteln
+ --------------------------------------------------------------------*/
+
+
+sal_uInt16 SwDoc::GetCurTOXMark( const SwPosition& rPos,
+ SwTOXMarks& rArr ) const
+{
+ // search on Position rPos for all SwTOXMarks
+ SwTxtNode *const pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+ if( !pTxtNd || !pTxtNd->GetpSwpHints() )
+ return 0;
+
+ const SwpHints & rHts = *pTxtNd->GetpSwpHints();
+ const SwTxtAttr* pHt;
+ xub_StrLen nSttIdx;
+ const xub_StrLen *pEndIdx;
+
+ xub_StrLen nAktPos = rPos.nContent.GetIndex();
+
+ for( sal_uInt16 n = 0; n < rHts.Count(); ++n )
+ {
+ if( RES_TXTATR_TOXMARK != (pHt = rHts[n])->Which() )
+ continue;
+ if( ( nSttIdx = *pHt->GetStart() ) < nAktPos )
+ {
+ // pruefe Ende mit ab
+ if( 0 == ( pEndIdx = pHt->GetEnd() ) ||
+ *pEndIdx <= nAktPos )
+ continue; // weiter suchen
+ }
+ else if( nSttIdx > nAktPos )
+ // ist Start vom Hint groesser als rPos, dann abbrechen. Denn
+ // die Attribute sind nach Start sortiert !
+ break;
+
+ const SwTOXMark* pTMark = &pHt->GetTOXMark();
+ rArr.Insert( pTMark, rArr.Count() );
+ }
+ return rArr.Count();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Marke loeschen
+ --------------------------------------------------------------------*/
+
+void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark )
+{
+ // hole den TextNode und
+ const SwTxtTOXMark* pTxtTOXMark = pTOXMark->GetTxtTOXMark();
+ ASSERT( pTxtTOXMark, "Kein TxtTOXMark, kann nicht geloescht werden" );
+
+ SwTxtNode& rTxtNd = const_cast<SwTxtNode&>(pTxtTOXMark->GetTxtNode());
+ ASSERT( rTxtNd.GetpSwpHints(), "kann nicht geloescht werden" );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // save attributes for Undo
+ SwUndoResetAttr* pUndo = new SwUndoResetAttr(
+ SwPosition( rTxtNd, SwIndex( &rTxtNd, *pTxtTOXMark->GetStart() ) ),
+ RES_TXTATR_TOXMARK );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+
+ SwRegHistory aRHst( rTxtNd, &pUndo->GetHistory() );
+ rTxtNd.GetpSwpHints()->Register( &aRHst );
+ }
+
+ rTxtNd.DeleteAttribute( const_cast<SwTxtTOXMark*>(pTxtTOXMark) );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ if( rTxtNd.GetpSwpHints() )
+ rTxtNd.GetpSwpHints()->DeRegister();
+ }
+ SetModified();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Traveln zwischen TOXMarks
+ --------------------------------------------------------------------*/
+
+class CompareNodeCntnt
+{
+ sal_uLong nNode;
+ xub_StrLen nCntnt;
+public:
+ CompareNodeCntnt( sal_uLong nNd, xub_StrLen nCnt )
+ : nNode( nNd ), nCntnt( nCnt ) {}
+
+ int operator==( const CompareNodeCntnt& rCmp )
+ { return nNode == rCmp.nNode && nCntnt == rCmp.nCntnt; }
+ int operator!=( const CompareNodeCntnt& rCmp )
+ { return nNode != rCmp.nNode || nCntnt != rCmp.nCntnt; }
+ int operator< ( const CompareNodeCntnt& rCmp )
+ { return nNode < rCmp.nNode ||
+ ( nNode == rCmp.nNode && nCntnt < rCmp.nCntnt); }
+ int operator<=( const CompareNodeCntnt& rCmp )
+ { return nNode < rCmp.nNode ||
+ ( nNode == rCmp.nNode && nCntnt <= rCmp.nCntnt); }
+ int operator> ( const CompareNodeCntnt& rCmp )
+ { return nNode > rCmp.nNode ||
+ ( nNode == rCmp.nNode && nCntnt > rCmp.nCntnt); }
+ int operator>=( const CompareNodeCntnt& rCmp )
+ { return nNode > rCmp.nNode ||
+ ( nNode == rCmp.nNode && nCntnt >= rCmp.nCntnt); }
+};
+
+const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark,
+ SwTOXSearch eDir, sal_Bool bInReadOnly )
+{
+ const SwTxtTOXMark* pMark = rCurTOXMark.GetTxtTOXMark();
+ ASSERT(pMark, "pMark==0 Ungueltige TxtTOXMark");
+
+ const SwTxtNode *pTOXSrc = pMark->GetpTxtNd();
+
+ CompareNodeCntnt aAbsIdx( pTOXSrc->GetIndex(), *pMark->GetStart() );
+ CompareNodeCntnt aPrevPos( 0, 0 );
+ CompareNodeCntnt aNextPos( ULONG_MAX, STRING_NOTFOUND );
+ CompareNodeCntnt aMax( 0, 0 );
+ CompareNodeCntnt aMin( ULONG_MAX, STRING_NOTFOUND );
+
+ const SwTOXMark* pNew = 0;
+ const SwTOXMark* pMax = &rCurTOXMark;
+ const SwTOXMark* pMin = &rCurTOXMark;
+
+ const SwTOXType* pType = rCurTOXMark.GetTOXType();
+ SwTOXMarks aMarks;
+ SwTOXMark::InsertTOXMarks( aMarks, *pType );
+
+ const SwTOXMark* pTOXMark;
+ const SwCntntFrm* pCFrm;
+ Point aPt;
+ for( sal_Int32 nMark=0; nMark<aMarks.Count(); nMark++ )
+ {
+ pTOXMark = aMarks[nMark];
+ if( pTOXMark != &rCurTOXMark &&
+ 0 != ( pMark = pTOXMark->GetTxtTOXMark()) &&
+ 0 != ( pTOXSrc = pMark->GetpTxtNd() ) &&
+ 0 != ( pCFrm = pTOXSrc->getLayoutFrm( GetCurrentLayout(), &aPt, 0, sal_False )) &&
+ ( bInReadOnly || !pCFrm->IsProtected() ))
+ {
+ CompareNodeCntnt aAbsNew( pTOXSrc->GetIndex(), *pMark->GetStart() );
+ switch( eDir )
+ {
+ //Die untenstehenden etwas komplizierter ausgefallen Ausdruecke
+ //dienen dazu auch ueber Eintraege auf der selben (!) Position
+ //traveln zu koennen. Wenn einer Zeit hat mag er sie mal
+ //optimieren.
+
+ case TOX_SAME_PRV:
+ if( pTOXMark->GetText() != rCurTOXMark.GetText() )
+ break;
+ /* no break here */
+ case TOX_PRV:
+ if ( (aAbsNew < aAbsIdx && aAbsNew > aPrevPos &&
+ aPrevPos != aAbsIdx && aAbsNew != aAbsIdx ) ||
+ (aAbsIdx == aAbsNew &&
+ (sal_uLong(&rCurTOXMark) > sal_uLong(pTOXMark) &&
+ (!pNew ||
+ (pNew && (aPrevPos < aAbsIdx ||
+ sal_uLong(pNew) < sal_uLong(pTOXMark)))))) ||
+ (aPrevPos == aAbsNew && aAbsIdx != aAbsNew &&
+ sal_uLong(pTOXMark) > sal_uLong(pNew)) )
+ {
+ pNew = pTOXMark;
+ aPrevPos = aAbsNew;
+ if ( aAbsNew >= aMax )
+ {
+ aMax = aAbsNew;
+ pMax = pTOXMark;
+ }
+ }
+ break;
+
+ case TOX_SAME_NXT:
+ if( pTOXMark->GetText() != rCurTOXMark.GetText() )
+ break;
+ /* no break here */
+ case TOX_NXT:
+ if ( (aAbsNew > aAbsIdx && aAbsNew < aNextPos &&
+ aNextPos != aAbsIdx && aAbsNew != aAbsIdx ) ||
+ (aAbsIdx == aAbsNew &&
+ (sal_uLong(&rCurTOXMark) < sal_uLong(pTOXMark) &&
+ (!pNew ||
+ (pNew && (aNextPos > aAbsIdx ||
+ sal_uLong(pNew) > sal_uLong(pTOXMark)))))) ||
+ (aNextPos == aAbsNew && aAbsIdx != aAbsNew &&
+ sal_uLong(pTOXMark) < sal_uLong(pNew)) )
+ {
+ pNew = pTOXMark;
+ aNextPos = aAbsNew;
+ if ( aAbsNew <= aMin )
+ {
+ aMin = aAbsNew;
+ pMin = pTOXMark;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+
+ // kein Nachfolger wurde gefunden
+ // Min oder Max benutzen
+ if(!pNew)
+ {
+ switch(eDir)
+ {
+ case TOX_PRV:
+ case TOX_SAME_PRV:
+ pNew = pMax;
+ break;
+ case TOX_NXT:
+ case TOX_SAME_NXT:
+ pNew = pMin;
+ break;
+ default:
+ pNew = &rCurTOXMark;
+ }
+ }
+ return *pNew;
+}
+
+
+const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
+ const SwTOXBase& rTOX,
+ const SfxItemSet* pSet,
+ sal_Bool bExpand )
+{
+ GetIDocumentUndoRedo().StartUndo( UNDO_INSTOX, NULL );
+
+ String sSectNm( rTOX.GetTOXName() );
+ sSectNm = GetUniqueTOXBaseName( *rTOX.GetTOXType(), &sSectNm );
+ SwPaM aPam( rPos );
+ SwSectionData aSectionData( TOX_CONTENT_SECTION, sSectNm );
+ SwTOXBaseSection *const pNewSection = dynamic_cast<SwTOXBaseSection *>(
+ InsertSwSection( aPam, aSectionData, & rTOX, pSet, false ));
+ if (pNewSection)
+ {
+ SwSectionNode *const pSectNd = pNewSection->GetFmt()->GetSectionNode();
+ pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
+
+ if( bExpand )
+ {
+ // OD 19.03.2003 #106329# - add value for 2nd parameter = true to
+ // indicate, that a creation of a new table of content has to be performed.
+ // Value of 1st parameter = default value.
+ pNewSection->Update( 0, true );
+ }
+ else if( 1 == rTOX.GetTitle().Len() && IsInReading() )
+ // insert title of TOX
+ {
+ // then insert the headline section
+ SwNodeIndex aIdx( *pSectNd, +1 );
+
+ SwTxtNode* pHeadNd = GetNodes().MakeTxtNode( aIdx,
+ GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
+
+ String sNm( pNewSection->GetTOXName() );
+// ??Resource
+sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" ));
+
+ SwSectionData headerData( TOX_HEADER_SECTION, sNm );
+
+ SwNodeIndex aStt( *pHeadNd ); aIdx--;
+ SwSectionFmt* pSectFmt = MakeSectionFmt( 0 );
+ GetNodes().InsertTextSection(
+ aStt, *pSectFmt, headerData, 0, &aIdx, true, false);
+ }
+ }
+
+ GetIDocumentUndoRedo().EndUndo( UNDO_INSTOX, NULL );
+
+ return pNewSection;
+}
+
+
+
+const SwTOXBaseSection* SwDoc::InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd,
+ const SwTOXBase& rTOX,
+ const SfxItemSet* pSet )
+{
+ // check for recursiv TOX
+ SwNode* pNd = GetNodes()[ nSttNd ];
+ SwSectionNode* pSectNd = pNd->FindSectionNode();
+ while( pSectNd )
+ {
+ SectionType eT = pSectNd->GetSection().GetType();
+ if( TOX_HEADER_SECTION == eT || TOX_CONTENT_SECTION == eT )
+ return 0;
+ pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode();
+ }
+
+ String sSectNm( rTOX.GetTOXName() );
+ sSectNm = GetUniqueTOXBaseName(*rTOX.GetTOXType(), &sSectNm);
+
+ SwSectionData aSectionData( TOX_CONTENT_SECTION, sSectNm );
+
+ SwNodeIndex aStt( GetNodes(), nSttNd ), aEnd( GetNodes(), nEndNd );
+ SwSectionFmt* pFmt = MakeSectionFmt( 0 );
+ if(pSet)
+ pFmt->SetFmtAttr(*pSet);
+
+// --aEnd; // im InsertSection ist Ende inclusive
+
+ SwSectionNode *const pNewSectionNode =
+ GetNodes().InsertTextSection(aStt, *pFmt, aSectionData, &rTOX, &aEnd);
+ if (!pNewSectionNode)
+ {
+ DelSectionFmt( pFmt );
+ return 0;
+ }
+
+ SwTOXBaseSection *const pNewSection(
+ dynamic_cast<SwTOXBaseSection*>(& pNewSectionNode->GetSection()));
+ pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
+ return pNewSection;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuelles Verzeichnis ermitteln
+ --------------------------------------------------------------------*/
+
+const SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) const
+{
+ const SwNode& rNd = rPos.nNode.GetNode();
+ const SwSectionNode* pSectNd = rNd.FindSectionNode();
+ while( pSectNd )
+ {
+ SectionType eT = pSectNd->GetSection().GetType();
+ if( TOX_CONTENT_SECTION == eT )
+ {
+ ASSERT( pSectNd->GetSection().ISA( SwTOXBaseSection ),
+ "keine TOXBaseSection!" );
+ SwTOXBaseSection& rTOXSect = (SwTOXBaseSection&)
+ pSectNd->GetSection();
+ return &rTOXSect;
+ }
+ pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode();
+ }
+ return 0;
+}
+
+const SwAttrSet& SwDoc::GetTOXBaseAttrSet(const SwTOXBase& rTOXBase) const
+{
+ ASSERT( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" );
+ const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase;
+ SwSectionFmt* pFmt = rTOXSect.GetFmt();
+ ASSERT( pFmt, "invalid TOXBaseSection!" );
+ return pFmt->GetAttrSet();
+}
+
+const SwTOXBase* SwDoc::GetDefaultTOXBase( TOXTypes eTyp, sal_Bool bCreate )
+{
+ SwTOXBase** prBase = 0;
+ switch(eTyp)
+ {
+ case TOX_CONTENT: prBase = &pDefTOXBases->pContBase; break;
+ case TOX_INDEX: prBase = &pDefTOXBases->pIdxBase; break;
+ case TOX_USER: prBase = &pDefTOXBases->pUserBase; break;
+ case TOX_TABLES: prBase = &pDefTOXBases->pTblBase; break;
+ case TOX_OBJECTS: prBase = &pDefTOXBases->pObjBase; break;
+ case TOX_ILLUSTRATIONS: prBase = &pDefTOXBases->pIllBase; break;
+ case TOX_AUTHORITIES: prBase = &pDefTOXBases->pAuthBase; break;
+ }
+ if(!(*prBase) && bCreate)
+ {
+ SwForm aForm(eTyp);
+ const SwTOXType* pType = GetTOXType(eTyp, 0);
+ (*prBase) = new SwTOXBase(pType, aForm, 0, pType->GetTypeName());
+ }
+ return (*prBase);
+}
+
+void SwDoc::SetDefaultTOXBase(const SwTOXBase& rBase)
+{
+ SwTOXBase** prBase = 0;
+ switch(rBase.GetType())
+ {
+ case TOX_CONTENT: prBase = &pDefTOXBases->pContBase; break;
+ case TOX_INDEX: prBase = &pDefTOXBases->pIdxBase; break;
+ case TOX_USER: prBase = &pDefTOXBases->pUserBase; break;
+ case TOX_TABLES: prBase = &pDefTOXBases->pTblBase; break;
+ case TOX_OBJECTS: prBase = &pDefTOXBases->pObjBase; break;
+ case TOX_ILLUSTRATIONS: prBase = &pDefTOXBases->pIllBase; break;
+ case TOX_AUTHORITIES: prBase = &pDefTOXBases->pAuthBase; break;
+ }
+ if(*prBase)
+ delete (*prBase);
+ (*prBase) = new SwTOXBase(rBase);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis loeschen
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, sal_Bool bDelNodes )
+{
+ // its only delete the TOX, not the nodes
+ sal_Bool bRet = sal_False;
+ ASSERT( rTOXBase.ISA( SwTOXBaseSection ), "keine TOXBaseSection!" );
+
+ const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase;
+ SwSectionFmt* pFmt = rTOXSect.GetFmt();
+ if( pFmt )
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_CLEARTOXRANGE, NULL );
+
+ /* Save the start node of the TOX' section. */
+ SwSectionNode * pMyNode = pFmt->GetSectionNode();
+ /* Save start node of section's surrounding. */
+ SwNode * pStartNd = pMyNode->StartOfSectionNode();
+
+ /* Look for point where to move the cursors in the area to
+ delete to. This is done by first searching forward from the
+ end of the TOX' section. If no content node is found behind
+ the TOX one is searched before it. If this is not
+ successfull, too, insert new text node behind the end of
+ the TOX' section. The cursors from the TOX' section will be
+ moved to the content node found or the new text node. */
+
+ /* Set PaM to end of TOX' section and search following content node.
+
+ aSearchPam will contain the point where to move the cursors
+ to. */
+ SwPaM aSearchPam(*pMyNode->EndOfSectionNode());
+ SwPosition aEndPos(*pStartNd->EndOfSectionNode());
+ if (! aSearchPam.Move() /* no content node found */
+ || *aSearchPam.GetPoint() >= aEndPos /* content node found
+ outside surrounding */
+ )
+ {
+ /* Set PaM to beginning of TOX' section and search previous
+ content node */
+ SwPaM aTmpPam(*pMyNode);
+ aSearchPam = aTmpPam;
+ SwPosition aStartPos(*pStartNd);
+
+ if ( ! aSearchPam.Move(fnMoveBackward) /* no content node found */
+ || *aSearchPam.GetPoint() <= aStartPos /* content node
+ found outside
+ surrounding */
+ )
+ {
+ /* There is no content node in the surrounding of
+ TOX'. Append text node behind TOX' section. */
+
+ SwPosition aInsPos(*pMyNode->EndOfSectionNode());
+ AppendTxtNode(aInsPos);
+
+ SwPaM aTmpPam1(aInsPos);
+ aSearchPam = aTmpPam1;
+ }
+ }
+
+
+ /* PaM containing the TOX. */
+ SwPaM aPam(*pMyNode->EndOfSectionNode(), *pMyNode);
+
+ /* Move cursors contained in TOX to point determined above. */
+ PaMCorrAbs(aPam, *aSearchPam.GetPoint());
+
+ if( !bDelNodes )
+ {
+ SwSections aArr( 0, 4 );
+ sal_uInt16 nCnt = pFmt->GetChildSections( aArr, SORTSECT_NOT, sal_False );
+ for( sal_uInt16 n = 0; n < nCnt; ++n )
+ {
+ SwSection* pSect = aArr[ n ];
+ if( TOX_HEADER_SECTION == pSect->GetType() )
+ {
+ DelSectionFmt( pSect->GetFmt(), bDelNodes );
+ }
+ }
+ }
+
+ DelSectionFmt( pFmt, bDelNodes );
+
+ GetIDocumentUndoRedo().EndUndo( UNDO_CLEARTOXRANGE, NULL );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnistypen verwalten
+ --------------------------------------------------------------------*/
+
+sal_uInt16 SwDoc::GetTOXTypeCount(TOXTypes eTyp) const
+{
+ const SwTOXTypePtr * ppTTypes = pTOXTypes->GetData();
+ sal_uInt16 nCnt = 0;
+ for( sal_uInt16 n = 0; n < pTOXTypes->Count(); ++n, ++ppTTypes )
+ if( eTyp == (*ppTTypes)->GetType() )
+ ++nCnt;
+ return nCnt;
+}
+
+const SwTOXType* SwDoc::GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const
+{
+ const SwTOXTypePtr * ppTTypes = pTOXTypes->GetData();
+ sal_uInt16 nCnt = 0;
+ for( sal_uInt16 n = 0; n < pTOXTypes->Count(); ++n, ++ppTTypes )
+ if( eTyp == (*ppTTypes)->GetType() && nCnt++ == nId )
+ return (*ppTTypes);
+ return 0;
+}
+
+
+const SwTOXType* SwDoc::InsertTOXType( const SwTOXType& rTyp )
+{
+ SwTOXType * pNew = new SwTOXType( rTyp );
+ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+ return pNew;
+}
+
+String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
+ const String* pChkStr ) const
+{
+ sal_uInt16 n;
+ const SwSectionNode* pSectNd;
+ const SwSection* pSect;
+
+ if(pChkStr && !pChkStr->Len())
+ pChkStr = 0;
+ String aName( rType.GetTypeName() );
+ xub_StrLen nNmLen = aName.Len();
+
+ sal_uInt16 nNum = 0;
+ sal_uInt16 nTmp = 0;
+ sal_uInt16 nFlagSize = ( pSectionFmtTbl->Count() / 8 ) +2;
+ sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
+ memset( pSetFlags, 0, nFlagSize );
+
+ for( n = 0; n < pSectionFmtTbl->Count(); ++n )
+ if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( sal_False ) )&&
+ TOX_CONTENT_SECTION == (pSect = &pSectNd->GetSection())->GetType())
+ {
+ const String& rNm = pSect->GetSectionName();
+ if( rNm.Match( aName ) == nNmLen )
+ {
+ // Nummer bestimmen und das Flag setzen
+ nNum = (sal_uInt16)rNm.Copy( nNmLen ).ToInt32();
+ if( nNum-- && nNum < pSectionFmtTbl->Count() )
+ pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
+ }
+ if( pChkStr && pChkStr->Equals( rNm ) )
+ pChkStr = 0;
+ }
+
+ if( !pChkStr )
+ {
+ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+ nNum = pSectionFmtTbl->Count();
+ for( n = 0; n < nFlagSize; ++n )
+ if( 0xff != ( nTmp = pSetFlags[ n ] ))
+ {
+ // also die Nummer bestimmen
+ nNum = n * 8;
+ while( nTmp & 1 )
+ ++nNum, nTmp >>= 1;
+ break;
+ }
+ }
+ delete [] pSetFlags;
+ if( pChkStr )
+ return *pChkStr;
+ return aName += String::CreateFromInt32( ++nNum );
+}
+
+sal_Bool SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName)
+{
+ ASSERT( rTOXBase.ISA( SwTOXBaseSection ),
+ "keine TOXBaseSection!" );
+ SwTOXBaseSection* pTOX = (SwTOXBaseSection*)&rTOXBase;
+
+ String sTmp = GetUniqueTOXBaseName(*rTOXBase.GetTOXType(), &rName);
+ sal_Bool bRet = sTmp == rName;
+ if(bRet)
+ {
+ pTOX->SetTOXName(rName);
+ pTOX->SetSectionName(rName);
+ SetModified();
+ }
+ return bRet;
+}
+
+
+const SwTxtNode* lcl_FindChapterNode( const SwNode& rNd, sal_uInt8 nLvl = 0 )
+{
+ const SwNode* pNd = &rNd;
+ if( pNd->GetNodes().GetEndOfExtras().GetIndex() > pNd->GetIndex() )
+ {
+ // then find the "Anchor" (Body) position
+ Point aPt;
+ SwNode2Layout aNode2Layout( *pNd, pNd->GetIndex() );
+ const SwFrm* pFrm = aNode2Layout.GetFrm( &aPt, 0, sal_False );
+
+ if( pFrm )
+ {
+ SwPosition aPos( *pNd );
+ pNd = GetBodyTxtNode( *pNd->GetDoc(), aPos, *pFrm );
+ ASSERT( pNd, "wo steht der Absatz" );
+ }
+ }
+ return pNd ? pNd->FindOutlineNodeOfLevel( nLvl ) : 0;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis-Klasse
+ --------------------------------------------------------------------*/
+
+SwTOXBaseSection::SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFmt & rFmt)
+ : SwTOXBase( rBase )
+ , SwSection( TOX_CONTENT_SECTION, aEmptyStr, rFmt )
+{
+ SetProtect( rBase.IsProtected() );
+ SetSectionName( GetTOXName() );
+}
+
+
+SwTOXBaseSection::~SwTOXBaseSection()
+{
+}
+
+
+sal_Bool SwTOXBaseSection::SetPosAtStartEnd( SwPosition& rPos, sal_Bool bAtStart ) const
+{
+ sal_Bool bRet = sal_False;
+ const SwSectionNode* pSectNd = GetFmt()->GetSectionNode();
+ if( pSectNd )
+ {
+ SwCntntNode* pCNd;
+ xub_StrLen nC = 0;
+ if( bAtStart )
+ {
+ rPos.nNode = *pSectNd;
+ pCNd = pSectNd->GetDoc()->GetNodes().GoNext( &rPos.nNode );
+ }
+ else
+ {
+ rPos.nNode = *pSectNd->EndOfSectionNode();
+ pCNd = pSectNd->GetDoc()->GetNodes().GoPrevious( &rPos.nNode );
+ if( pCNd ) nC = pCNd->Len();
+ }
+ rPos.nContent.Assign( pCNd, nC );
+ bRet = sal_True;
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnisinhalt zusammensammeln
+ --------------------------------------------------------------------*/
+
+void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
+ const bool _bNewTOX )//swmodtest 080307
+{
+ const SwSectionNode* pSectNd;
+ if( !SwTOXBase::GetRegisteredIn()->GetDepends() ||
+ !GetFmt() || 0 == (pSectNd = GetFmt()->GetSectionNode() ) ||
+ !pSectNd->GetNodes().IsDocNodes() ||
+ IsHiddenFlag() )
+ return;
+
+ SwDoc* pDoc = (SwDoc*)pSectNd->GetDoc();
+
+ DBG_ASSERT(pDoc != NULL, "Where is the document?");
+
+ if(pAttr && pDoc && GetFmt())
+ pDoc->ChgFmt(*GetFmt(), *pAttr);
+
+ // OD 18.03.2003 #106329# - determine default page description, which
+ // will be used by the content nodes, if no approriate one is found.
+ const SwPageDesc* pDefaultPageDesc;
+ {
+ pDefaultPageDesc =
+ pSectNd->GetSection().GetFmt()->GetPageDesc().GetPageDesc();
+ if ( !_bNewTOX && !pDefaultPageDesc )
+ {
+ // determine page description of table-of-content
+ sal_uInt32 nPgDescNdIdx = pSectNd->GetIndex() + 1;
+ sal_uInt32* pPgDescNdIdx = &nPgDescNdIdx;
+ pDefaultPageDesc = pSectNd->FindPageDesc( sal_False, pPgDescNdIdx );
+ if ( nPgDescNdIdx < pSectNd->GetIndex() )
+ {
+ pDefaultPageDesc = 0;
+ }
+ }
+ // OD 28.04.2003 #109166# - consider end node of content section in the
+ // node array.
+ if ( !pDefaultPageDesc &&
+ ( pSectNd->EndOfSectionNode()->GetIndex() <
+ (pSectNd->GetNodes().GetEndOfContent().GetIndex() - 1) )
+ )
+ {
+ // determine page description of content after table-of-content
+ SwNodeIndex aIdx( *(pSectNd->EndOfSectionNode()) );
+ const SwCntntNode* pNdAfterTOX = pSectNd->GetNodes().GoNext( &aIdx );
+ const SwAttrSet& aNdAttrSet = pNdAfterTOX->GetSwAttrSet();
+ const SvxBreak eBreak = aNdAttrSet.GetBreak().GetBreak();
+ if ( !( eBreak == SVX_BREAK_PAGE_BEFORE ||
+ eBreak == SVX_BREAK_PAGE_BOTH )
+ )
+ {
+ pDefaultPageDesc = pNdAfterTOX->FindPageDesc( sal_False );
+ }
+ }
+ // OD 28.04.2003 #109166# - consider start node of content section in
+ // the node array.
+ if ( !pDefaultPageDesc &&
+ ( pSectNd->GetIndex() >
+ (pSectNd->GetNodes().GetEndOfContent().StartOfSectionIndex() + 1) )
+ )
+ {
+ // determine page description of content before table-of-content
+ SwNodeIndex aIdx( *pSectNd );
+ pDefaultPageDesc =
+ pSectNd->GetNodes().GoPrevious( &aIdx )->FindPageDesc( sal_False );
+
+ }
+ if ( !pDefaultPageDesc )
+ {
+ // determine default page description
+ pDefaultPageDesc =
+ &const_cast<const SwDoc *>(pDoc)->GetPageDesc( 0 );
+ }
+ }
+
+ pDoc->SetModified();
+
+ // get current Language
+ SwTOXInternational aIntl( GetLanguage(),
+ TOX_INDEX == GetTOXType()->GetType() ?
+ GetOptions() : 0,
+ GetSortAlgorithm() );
+
+ aSortArr.DeleteAndDestroy( 0, aSortArr.Count() );
+
+ // find the first layout node for this TOX, if it only find the content
+ // in his own chapter
+ const SwTxtNode* pOwnChapterNode = IsFromChapter()
+ ? ::lcl_FindChapterNode( *pSectNd, 0 )
+ : 0;
+
+ SwNode2Layout aN2L( *pSectNd );
+ ((SwSectionNode*)pSectNd)->DelFrms();
+
+ // remove old content an insert one empty textnode (to hold the layout!)
+ SwTxtNode* pFirstEmptyNd;
+ {
+ pDoc->DeleteRedline( *pSectNd, true, USHRT_MAX );
+
+ SwNodeIndex aSttIdx( *pSectNd, +1 );
+ SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() );
+ pFirstEmptyNd = pDoc->GetNodes().MakeTxtNode( aEndIdx,
+ pDoc->GetTxtCollFromPool( RES_POOLCOLL_TEXT ) );
+
+ {
+ // Task 70995 - save and restore PageDesc and Break Attributes
+ SwNodeIndex aNxtIdx( aSttIdx );
+ const SwCntntNode* pCNd = aNxtIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = pDoc->GetNodes().GoNext( &aNxtIdx );
+ if( pCNd->HasSwAttrSet() )
+ {
+ SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange );
+ aBrkSet.Put( *pCNd->GetpSwAttrSet() );
+ if( aBrkSet.Count() )
+ pFirstEmptyNd->SetAttr( aBrkSet );
+ }
+ }
+ aEndIdx--;
+ SwPosition aPos( aEndIdx, SwIndex( pFirstEmptyNd, 0 ));
+ pDoc->CorrAbs( aSttIdx, aEndIdx, aPos, sal_True );
+
+ // delete all before
+ DelFlyInRange( aSttIdx, aEndIdx );
+ _DelBookmarks( aSttIdx, aEndIdx );
+
+ pDoc->GetNodes().Delete( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() );
+
+ }
+
+ //
+ // insert title of TOX
+ if( GetTitle().Len() )
+ {
+ // then insert the headline section
+ SwNodeIndex aIdx( *pSectNd, +1 );
+
+ SwTxtNode* pHeadNd = pDoc->GetNodes().MakeTxtNode( aIdx,
+ GetTxtFmtColl( FORM_TITLE ) );
+ pHeadNd->InsertText( GetTitle(), SwIndex( pHeadNd ) );
+
+ String sNm( GetTOXName() );
+// ??Resource
+sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" ));
+
+ SwSectionData headerData( TOX_HEADER_SECTION, sNm );
+
+ SwNodeIndex aStt( *pHeadNd ); aIdx--;
+ SwSectionFmt* pSectFmt = pDoc->MakeSectionFmt( 0 );
+ pDoc->GetNodes().InsertTextSection(
+ aStt, *pSectFmt, headerData, 0, &aIdx, true, false);
+ }
+
+ // jetzt waere ein prima Zeitpunkt, um die Numerierung zu updaten
+ pDoc->UpdateNumRule();
+
+ if( GetCreateType() & nsSwTOXElement::TOX_MARK )
+ UpdateMarks( aIntl, pOwnChapterNode );
+
+ if( GetCreateType() & nsSwTOXElement::TOX_OUTLINELEVEL )
+ UpdateOutline( pOwnChapterNode );
+
+ if( GetCreateType() & nsSwTOXElement::TOX_TEMPLATE )
+ UpdateTemplate( pOwnChapterNode );
+
+ if( GetCreateType() & nsSwTOXElement::TOX_OLE ||
+ TOX_OBJECTS == SwTOXBase::GetType())
+ UpdateCntnt( nsSwTOXElement::TOX_OLE, pOwnChapterNode );
+
+ if( GetCreateType() & nsSwTOXElement::TOX_TABLE ||
+ (TOX_TABLES == SwTOXBase::GetType() && IsFromObjectNames()) )
+ UpdateTable( pOwnChapterNode );
+
+ if( GetCreateType() & nsSwTOXElement::TOX_GRAPHIC ||
+ (TOX_ILLUSTRATIONS == SwTOXBase::GetType() && IsFromObjectNames()))
+ UpdateCntnt( nsSwTOXElement::TOX_GRAPHIC, pOwnChapterNode );
+
+ if( GetSequenceName().Len() && !IsFromObjectNames() &&
+ (TOX_TABLES == SwTOXBase::GetType() ||
+ TOX_ILLUSTRATIONS == SwTOXBase::GetType() ) )
+ UpdateSequence( pOwnChapterNode );
+
+ if( GetCreateType() & nsSwTOXElement::TOX_FRAME )
+ UpdateCntnt( nsSwTOXElement::TOX_FRAME, pOwnChapterNode );
+
+ if(TOX_AUTHORITIES == SwTOXBase::GetType())
+ UpdateAuthorities( aIntl );
+
+ // Bei Bedarf Alphadelimitter einfuegen (nur bei Stichwoertern)
+ //
+ if( TOX_INDEX == SwTOXBase::GetType() &&
+ ( GetOptions() & nsSwTOIOptions::TOI_ALPHA_DELIMITTER ) )
+ InsertAlphaDelimitter( aIntl );
+
+ // sortierte Liste aller Verzeichnismarken und Verzeichnisbereiche
+ void* p = 0;
+ String* pStr = 0;
+ sal_uInt16 nCnt = 0, nFormMax = GetTOXForm().GetFormMax();
+ SvStringsDtor aStrArr( (sal_uInt8)nFormMax );
+ SvPtrarr aCollArr( (sal_uInt8)nFormMax );
+ for( ; nCnt < nFormMax; ++nCnt )
+ {
+ aCollArr.Insert( p, nCnt );
+ aStrArr.Insert( pStr, nCnt );
+ }
+
+ SwNodeIndex aInsPos( *pFirstEmptyNd, 1 );
+ for( nCnt = 0; nCnt < aSortArr.Count(); ++nCnt )
+ {
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+
+ // setze den Text in das Verzeichniss
+ sal_uInt16 nLvl = aSortArr[ nCnt ]->GetLevel();
+ SwTxtFmtColl* pColl = (SwTxtFmtColl*)aCollArr[ nLvl ];
+ if( !pColl )
+ {
+ pColl = GetTxtFmtColl( nLvl );
+ aCollArr.Remove( nLvl );
+ p = pColl;
+ aCollArr.Insert( p , nLvl );
+ }
+
+ // Generierung: dynamische TabStops setzen
+ SwTxtNode* pTOXNd = pDoc->GetNodes().MakeTxtNode( aInsPos , pColl );
+ aSortArr[ nCnt ]->pTOXNd = pTOXNd;
+
+ // Generierung: Form auswerten und Platzhalter
+ // fuer die Seitennummer eintragen
+ //if it is a TOX_INDEX and the SwForm IsCommaSeparated()
+ // then a range of entries must be generated into one paragraph
+ sal_uInt16 nRange = 1;
+ if(TOX_INDEX == SwTOXBase::GetType() &&
+ GetTOXForm().IsCommaSeparated() &&
+ aSortArr[nCnt]->GetType() == TOX_SORT_INDEX)
+ {
+ const SwTOXMark& rMark = aSortArr[nCnt]->pTxtMark->GetTOXMark();
+ const String sPrimKey = rMark.GetPrimaryKey();
+ const String sSecKey = rMark.GetSecondaryKey();
+ const SwTOXMark* pNextMark = 0;
+ while(aSortArr.Count() > (nCnt + nRange)&&
+ aSortArr[nCnt + nRange]->GetType() == TOX_SORT_INDEX &&
+ 0 != (pNextMark = &(aSortArr[nCnt + nRange]->pTxtMark->GetTOXMark())) &&
+ pNextMark->GetPrimaryKey() == sPrimKey &&
+ pNextMark->GetSecondaryKey() == sSecKey)
+ nRange++;
+ }
+ // OD 18.03.2003 #106329# - pass node index of table-of-content section
+ // and default page description to method <GenerateText(..)>.
+ GenerateText( nCnt, nRange, aStrArr, pSectNd->GetIndex(), pDefaultPageDesc );
+ nCnt += nRange - 1;
+ }
+
+ // delete the first dummy node and remove all Cursor into the prev node
+ aInsPos = *pFirstEmptyNd;
+ {
+ SwPaM aCorPam( *pFirstEmptyNd );
+ aCorPam.GetPoint()->nContent.Assign( pFirstEmptyNd, 0 );
+ if( !aCorPam.Move( fnMoveForward ) )
+ aCorPam.Move( fnMoveBackward );
+ SwNodeIndex aEndIdx( aInsPos, 1 );
+ pDoc->CorrAbs( aInsPos, aEndIdx, *aCorPam.GetPoint(), sal_True );
+
+ // Task 70995 - save and restore PageDesc and Break Attributes
+ if( pFirstEmptyNd->HasSwAttrSet() )
+ {
+ if( GetTitle().Len() )
+ aEndIdx = *pSectNd;
+ else
+ aEndIdx = *pFirstEmptyNd;
+ SwCntntNode* pCNd = pDoc->GetNodes().GoNext( &aEndIdx );
+ if( pCNd ) // Robust against defect documents, e.g. i60336
+ pCNd->SetAttr( *pFirstEmptyNd->GetpSwAttrSet() );
+ }
+ }
+
+ // now create the new Frames
+ sal_uLong nIdx = pSectNd->GetIndex();
+ // don't delete if index is empty
+ if(nIdx + 2 < pSectNd->EndOfSectionIndex())
+ pDoc->GetNodes().Delete( aInsPos, 1 );
+
+ aN2L.RestoreUpperFrms( pDoc->GetNodes(), nIdx, nIdx + 1 );
+ std::set<SwRootFrm*> aAllLayouts = pDoc->GetAllLayouts();
+ for ( std::set<SwRootFrm*>::iterator pLayoutIter = aAllLayouts.begin(); pLayoutIter != aAllLayouts.end(); pLayoutIter++)
+ {
+ SwFrm::CheckPageDescs( (SwPageFrm*)(*pLayoutIter)->Lower() );
+ }//swmod 080310
+
+ SetProtect( SwTOXBase::IsProtected() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: AlphaDelimitter einfuegen
+ --------------------------------------------------------------------*/
+
+
+void SwTOXBaseSection::InsertAlphaDelimitter( const SwTOXInternational& rIntl )
+{
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+ String sDeli, sLastDeli;
+ sal_uInt16 i = 0;
+ while( i < aSortArr.Count() )
+ {
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+
+ sal_uInt16 nLevel = aSortArr[i]->GetLevel();
+
+ // Alpha-Delimitter ueberlesen
+ if( nLevel == FORM_ALPHA_DELIMITTER )
+ continue;
+
+ String sMyString, sMyStringReading;
+ aSortArr[i]->GetTxt( sMyString, sMyStringReading );
+
+ sDeli = rIntl.GetIndexKey( sMyString, sMyStringReading,
+ aSortArr[i]->GetLocale() );
+
+ // Delimitter schon vorhanden ??
+ if( sDeli.Len() && sLastDeli != sDeli )
+ {
+ // alle kleiner Blank wollen wir nicht haben -> sind Sonderzeichen
+ if( ' ' <= sDeli.GetChar( 0 ) )
+ {
+ SwTOXCustom* pCst = new SwTOXCustom( sDeli, aEmptyStr, FORM_ALPHA_DELIMITTER,
+ rIntl, aSortArr[i]->GetLocale() );
+ aSortArr.Insert( pCst, i++ );
+ }
+ sLastDeli = sDeli;
+ }
+
+ // Skippen bis gleibhes oder kleineres Level erreicht ist
+ do {
+ i++;
+ } while (i < aSortArr.Count() && aSortArr[i]->GetLevel() > nLevel);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Template auswerten
+ --------------------------------------------------------------------*/
+
+SwTxtFmtColl* SwTOXBaseSection::GetTxtFmtColl( sal_uInt16 nLevel )
+{
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+ const String& rName = GetTOXForm().GetTemplate( nLevel );
+ SwTxtFmtColl* pColl = rName.Len() ? pDoc->FindTxtFmtCollByName(rName) :0;
+ if( !pColl )
+ {
+ sal_uInt16 nPoolFmt = 0;
+ const TOXTypes eMyType = SwTOXBase::GetType();
+ switch( eMyType )
+ {
+ case TOX_INDEX: nPoolFmt = RES_POOLCOLL_TOX_IDXH; break;
+ case TOX_USER:
+ if( nLevel < 6 )
+ nPoolFmt = RES_POOLCOLL_TOX_USERH;
+ else
+ nPoolFmt = RES_POOLCOLL_TOX_USER6 - 6;
+ break;
+ case TOX_ILLUSTRATIONS: nPoolFmt = RES_POOLCOLL_TOX_ILLUSH; break;
+ case TOX_OBJECTS: nPoolFmt = RES_POOLCOLL_TOX_OBJECTH; break;
+ case TOX_TABLES: nPoolFmt = RES_POOLCOLL_TOX_TABLESH; break;
+ case TOX_AUTHORITIES: nPoolFmt = RES_POOLCOLL_TOX_AUTHORITIESH; break;
+
+ case TOX_CONTENT:
+ // im Content Bereich gibt es einen Sprung!
+ if( nLevel < 6 )
+ nPoolFmt = RES_POOLCOLL_TOX_CNTNTH;
+ else
+ nPoolFmt = RES_POOLCOLL_TOX_CNTNT6 - 6;
+ break;
+ }
+
+ if(eMyType == TOX_AUTHORITIES && nLevel)
+ nPoolFmt = nPoolFmt + 1;
+ else if(eMyType == TOX_INDEX && nLevel)
+ {
+ //pool: Level 1,2,3, Delimiter
+ //SwForm: Delimiter, Level 1,2,3
+ nPoolFmt += 1 == nLevel ? nLevel + 3 : nLevel - 1;
+ }
+ else
+ nPoolFmt = nPoolFmt + nLevel;
+ pColl = pDoc->GetTxtCollFromPool( nPoolFmt );
+ }
+ return pColl;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aus Markierungen erzeugen
+ --------------------------------------------------------------------*/
+
+void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl,
+ const SwTxtNode* pOwnChapterNode )
+{
+ const SwTOXType* pType = (SwTOXType*) SwTOXBase::GetRegisteredIn();
+ if( !pType->GetDepends() )
+ return;
+
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+ TOXTypes eTOXTyp = GetTOXType()->GetType();
+ SwIterator<SwTOXMark,SwTOXType> aIter( *pType );
+
+ SwTxtTOXMark* pTxtMark;
+ SwTOXMark* pMark;
+ for( pMark = aIter.First(); pMark; pMark = aIter.Next() )
+ {
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+
+ if( pMark->GetTOXType()->GetType() == eTOXTyp &&
+ 0 != ( pTxtMark = pMark->GetTxtTOXMark() ) )
+ {
+ const SwTxtNode* pTOXSrc = pTxtMark->GetpTxtNd();
+ // nur TOXMarks einfuegen die im Doc stehen
+ // nicht die, die im UNDO stehen
+ //
+ // if selected use marks from the same chapter only
+ if( pTOXSrc->GetNodes().IsDocNodes() &&
+ pTOXSrc->GetTxt().Len() && pTOXSrc->GetDepends() &&
+ pTOXSrc->getLayoutFrm( pDoc->GetCurrentLayout() ) &&
+ (!IsFromChapter() || ::lcl_FindChapterNode( *pTOXSrc, 0 ) == pOwnChapterNode ) &&
+ !pTOXSrc->HasHiddenParaField() &&
+ !SwScriptInfo::IsInHiddenRange( *pTOXSrc, *pTxtMark->GetStart() ) )
+ {
+ SwTOXSortTabBase* pBase = 0;
+ if(TOX_INDEX == eTOXTyp)
+ {
+ // Stichwortverzeichnismarkierung
+ lang::Locale aLocale;
+ if ( pBreakIt->GetBreakIter().is() )
+ {
+ aLocale = pBreakIt->GetLocale(
+ pTOXSrc->GetLang( *pTxtMark->GetStart() ) );
+ }
+
+ pBase = new SwTOXIndex( *pTOXSrc, pTxtMark,
+ GetOptions(), FORM_ENTRY, rIntl, aLocale );
+ InsertSorted(pBase);
+ if(GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY &&
+ pTxtMark->GetTOXMark().GetPrimaryKey().Len())
+ {
+ pBase = new SwTOXIndex( *pTOXSrc, pTxtMark,
+ GetOptions(), FORM_PRIMARY_KEY, rIntl, aLocale );
+ InsertSorted(pBase);
+ if(pTxtMark->GetTOXMark().GetSecondaryKey().Len())
+ {
+ pBase = new SwTOXIndex( *pTOXSrc, pTxtMark,
+ GetOptions(), FORM_SECONDARY_KEY, rIntl, aLocale );
+ InsertSorted(pBase);
+ }
+ }
+ }
+ else if( TOX_USER == eTOXTyp ||
+ pMark->GetLevel() <= GetLevel())
+ { // Inhaltsberzeichnismarkierung
+ // also used for user marks
+ pBase = new SwTOXContent( *pTOXSrc, pTxtMark, rIntl );
+ InsertSorted(pBase);
+ }
+ }
+ }
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnisinhalt aus Gliederungsebene generieren
+ --------------------------------------------------------------------*/
+
+
+void SwTOXBaseSection::UpdateOutline( const SwTxtNode* pOwnChapterNode )
+{
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+ SwNodes& rNds = pDoc->GetNodes();
+
+ const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
+ for( sal_uInt16 n = 0; n < rOutlNds.Count(); ++n )
+ {
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+ SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode();
+ if( pTxtNd && pTxtNd->Len() && pTxtNd->GetDepends() &&
+ //sal_uInt16(pTxtNd->GetTxtColl()->GetOutlineLevel()+1) <= GetLevel() && //#outline level,zhaojianwei
+ sal_uInt16( pTxtNd->GetAttrOutlineLevel()) <= GetLevel() && //<-end,zhaojianwei
+ pTxtNd->getLayoutFrm( pDoc->GetCurrentLayout() ) &&
+ !pTxtNd->HasHiddenParaField() &&
+ !pTxtNd->HasHiddenCharAttribute( true ) &&
+ ( !IsFromChapter() ||
+ ::lcl_FindChapterNode( *pTxtNd, 0 ) == pOwnChapterNode ))
+ {
+ SwTOXPara * pNew = new SwTOXPara( *pTxtNd, nsSwTOXElement::TOX_OUTLINELEVEL );
+ InsertSorted( pNew );
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnisinhalt aus Vorlagenbereichen generieren
+ --------------------------------------------------------------------*/
+
+void SwTOXBaseSection::UpdateTemplate( const SwTxtNode* pOwnChapterNode )
+{
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+ for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+ {
+ String sTmpStyleNames = GetStyleNames(i);
+ sal_uInt16 nTokenCount = sTmpStyleNames.GetTokenCount(TOX_STYLE_DELIMITER);
+ for( sal_uInt16 nStyle = 0; nStyle < nTokenCount; ++nStyle )
+ {
+ SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName(
+ sTmpStyleNames.GetToken( nStyle,
+ TOX_STYLE_DELIMITER ));
+ //TODO: no outline Collections in content indexes if OutlineLevels are already included
+ if( !pColl ||
+ ( TOX_CONTENT == SwTOXBase::GetType() &&
+ GetCreateType() & nsSwTOXElement::TOX_OUTLINELEVEL &&
+ //NO_NUMBERING != pColl->GetOutlineLevel() ) )//#outline level,zhaojianwei
+ pColl->IsAssignedToListLevelOfOutlineStyle()) )//<-end,zhaojianwei
+ continue;
+
+ SwIterator<SwTxtNode,SwFmtColl> aIter( *pColl );
+ for( SwTxtNode* pTxtNd = aIter.First(); pTxtNd; pTxtNd = aIter.Next() )
+ {
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+
+ if( pTxtNd->GetTxt().Len() && pTxtNd->getLayoutFrm( pDoc->GetCurrentLayout() ) &&
+ pTxtNd->GetNodes().IsDocNodes() &&
+ ( !IsFromChapter() || pOwnChapterNode ==
+ ::lcl_FindChapterNode( *pTxtNd, 0 ) ) )
+ {
+ SwTOXPara * pNew = new SwTOXPara( *pTxtNd, nsSwTOXElement::TOX_TEMPLATE, i + 1 );
+ InsertSorted(pNew);
+ }
+ }
+ }
+ }
+}
+
+/* -----------------14.07.99 09:59-------------------
+ Description: generate content from sequence fields
+ --------------------------------------------------*/
+void SwTOXBaseSection::UpdateSequence( const SwTxtNode* pOwnChapterNode )
+{
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+ SwFieldType* pSeqFld = pDoc->GetFldType(RES_SETEXPFLD, GetSequenceName(), false);
+ if(!pSeqFld)
+ return;
+
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pSeqFld );
+ for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
+ {
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ if(!pTxtFld)
+ continue;
+ const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+
+ if( rTxtNode.GetTxt().Len() && rTxtNode.getLayoutFrm( pDoc->GetCurrentLayout() ) &&
+ rTxtNode.GetNodes().IsDocNodes() &&
+ ( !IsFromChapter() ||
+ ::lcl_FindChapterNode( rTxtNode, 0 ) == pOwnChapterNode ) )
+ {
+ SwTOXPara * pNew = new SwTOXPara( rTxtNode, nsSwTOXElement::TOX_SEQUENCE, 1 );
+ //set indexes if the number or the reference text are to be displayed
+ if( GetCaptionDisplay() == CAPTION_TEXT )
+ {
+ pNew->SetStartIndex(
+ SwGetExpField::GetReferenceTextPos( *pFmtFld, *pDoc ));
+ }
+ else if(GetCaptionDisplay() == CAPTION_NUMBER)
+ {
+ pNew->SetEndIndex(*pTxtFld->GetStart() + 1);
+ }
+ InsertSorted(pNew);
+ }
+ }
+}
+
+void SwTOXBaseSection::UpdateAuthorities( const SwTOXInternational& rIntl )
+{
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+ SwFieldType* pAuthFld = pDoc->GetFldType(RES_AUTHORITY, aEmptyStr, false);
+ if(!pAuthFld)
+ return;
+
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pAuthFld );
+ for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
+ {
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ //undo
+ if(!pTxtFld)
+ continue;
+ const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+
+// const SwTxtNode* pChapterCompareNode = 0;
+
+ if( rTxtNode.GetTxt().Len() && rTxtNode.getLayoutFrm( pDoc->GetCurrentLayout() ) &&
+ rTxtNode.GetNodes().IsDocNodes() /*&&
+ (!IsFromChapter() || pChapterCompareNode == pOwnChapterNode) */)
+ {
+ //#106485# the body node has to be used!
+ SwCntntFrm *pFrm = rTxtNode.getLayoutFrm( pDoc->GetCurrentLayout() );
+ SwPosition aFldPos(rTxtNode);
+ const SwTxtNode* pTxtNode = 0;
+ if(pFrm && !pFrm->IsInDocBody())
+ pTxtNode = GetBodyTxtNode( *pDoc, aFldPos, *pFrm );
+ if(!pTxtNode)
+ pTxtNode = &rTxtNode;
+ SwTOXAuthority* pNew = new SwTOXAuthority( *pTxtNode, *pFmtFld, rIntl );
+
+ InsertSorted(pNew);
+ }
+ }
+}
+
+long lcl_IsSOObject( const SvGlobalName& rFactoryNm )
+{
+ static struct _SoObjType {
+ long nFlag;
+ // GlobalNameId
+ struct _GlobalNameIds {
+ sal_uInt32 n1;
+ sal_uInt16 n2, n3;
+ sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15;
+ } aGlNmIds[4];
+ } aArr[] = {
+ { nsSwTOOElements::TOO_MATH,
+ { {SO3_SM_CLASSID_60},{SO3_SM_CLASSID_50},
+ {SO3_SM_CLASSID_40},{SO3_SM_CLASSID_30} } },
+ { nsSwTOOElements::TOO_CHART,
+ { {SO3_SCH_CLASSID_60},{SO3_SCH_CLASSID_50},
+ {SO3_SCH_CLASSID_40},{SO3_SCH_CLASSID_30} } },
+ { nsSwTOOElements::TOO_CALC,
+ { {SO3_SC_CLASSID_60},{SO3_SC_CLASSID_50},
+ {SO3_SC_CLASSID_40},{SO3_SC_CLASSID_30} } },
+ { nsSwTOOElements::TOO_DRAW_IMPRESS,
+ { {SO3_SIMPRESS_CLASSID_60},{SO3_SIMPRESS_CLASSID_50},
+ {SO3_SIMPRESS_CLASSID_40},{SO3_SIMPRESS_CLASSID_30} } },
+ { nsSwTOOElements::TOO_DRAW_IMPRESS,
+ { {SO3_SDRAW_CLASSID_60},{SO3_SDRAW_CLASSID_50}}},
+ { 0,{{0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0} } }
+ };
+
+ long nRet = 0;
+ for( const _SoObjType* pArr = aArr; !nRet && pArr->nFlag; ++pArr )
+ for ( int n = 0; n < 4; ++n )
+ {
+ const _SoObjType::_GlobalNameIds& rId = pArr->aGlNmIds[ n ];
+ if( !rId.n1 )
+ break;
+ SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
+ rId.b8, rId.b9, rId.b10, rId.b11,
+ rId.b12, rId.b13, rId.b14, rId.b15 );
+ if( rFactoryNm == aGlbNm )
+ {
+ nRet = pArr->nFlag;
+ break;
+ }
+ }
+
+ return nRet;
+}
+
+void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType,
+ const SwTxtNode* pOwnChapterNode )
+{
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+ SwNodes& rNds = pDoc->GetNodes();
+ // auf den 1. Node der 1. Section
+ sal_uLong nIdx = rNds.GetEndOfAutotext().StartOfSectionIndex() + 2,
+ nEndIdx = rNds.GetEndOfAutotext().GetIndex();
+
+ while( nIdx < nEndIdx )
+ {
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+
+ SwNode* pNd = rNds[ nIdx ];
+ SwCntntNode* pCNd = 0;
+ switch( eMyType )
+ {
+ case nsSwTOXElement::TOX_FRAME:
+ if( !pNd->IsNoTxtNode() )
+ {
+ pCNd = pNd->GetCntntNode();
+ if( !pCNd )
+ {
+ SwNodeIndex aTmp( *pNd );
+ pCNd = rNds.GoNext( &aTmp );
+ }
+ }
+ break;
+ case nsSwTOXElement::TOX_GRAPHIC:
+ if( pNd->IsGrfNode() )
+ pCNd = (SwCntntNode*)pNd;
+ break;
+ case nsSwTOXElement::TOX_OLE:
+ if( pNd->IsOLENode() )
+ {
+ sal_Bool bInclude = sal_True;
+ if(TOX_OBJECTS == SwTOXBase::GetType())
+ {
+ SwOLENode* pOLENode = pNd->GetOLENode();
+ long nMyOLEOptions = GetOLEOptions();
+ SwOLEObj& rOLEObj = pOLENode->GetOLEObj();
+
+ if( rOLEObj.IsOleRef() ) //Noch nicht geladen
+ {
+ SvGlobalName aTmpName = SvGlobalName( rOLEObj.GetOleRef()->getClassID() );
+ long nObj = ::lcl_IsSOObject( aTmpName );
+ bInclude = ( (nMyOLEOptions & nsSwTOOElements::TOO_OTHER) && 0 == nObj)
+ || (0 != (nMyOLEOptions & nObj));
+ }
+ else
+ {
+ DBG_ERROR("OLE-object nicht geladen?");
+ bInclude = sal_False;
+ }
+ }
+
+ if(bInclude)
+ pCNd = (SwCntntNode*)pNd;
+ }
+ break;
+ default: break;
+ }
+
+ if( pCNd )
+ {
+ //find node in body text
+ int nSetLevel = USHRT_MAX;
+
+ //#111105# tables of tables|illustrations|objects don't support hierarchies
+ if( IsLevelFromChapter() &&
+ TOX_TABLES != SwTOXBase::GetType() &&
+ TOX_ILLUSTRATIONS != SwTOXBase::GetType() &&
+ TOX_OBJECTS != SwTOXBase::GetType() )
+ {
+ const SwTxtNode* pOutlNd = ::lcl_FindChapterNode( *pCNd,
+ MAXLEVEL - 1 );
+ if( pOutlNd )
+ {
+ //sal_uInt16 nTmp = pOutlNd->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
+ //if( nTmp < NO_NUMBERING )
+ // nSetLevel = nTmp + 1;
+ if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle())
+ nSetLevel = pOutlNd->GetTxtColl()->GetAttrOutlineLevel() ;//<-end,zhaojianwei
+ }
+ }
+
+ if( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && ( !IsFromChapter() ||
+ ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode ))
+ {
+ SwTOXPara * pNew = new SwTOXPara( *pCNd, eMyType,
+ ( USHRT_MAX != nSetLevel )
+ ? static_cast<sal_uInt16>(nSetLevel)
+ : FORM_ALPHA_DELIMITTER );
+ InsertSorted( pNew );
+ }
+ }
+
+ nIdx = pNd->StartOfSectionNode()->EndOfSectionIndex() + 2; // 2 == End-/StartNode
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Tabelleneintraege zusammensuchen
+ --------------------------------------------------------------------*/
+
+void SwTOXBaseSection::UpdateTable( const SwTxtNode* pOwnChapterNode )
+{
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+ SwNodes& rNds = pDoc->GetNodes();
+ const SwFrmFmts& rArr = *pDoc->GetTblFrmFmts();
+
+ for( sal_uInt16 n = 0; n < rArr.Count(); ++n )
+ {
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+
+ SwTable* pTmpTbl = SwTable::FindTable( rArr[ n ] );
+ SwTableBox* pFBox;
+ if( pTmpTbl && 0 != (pFBox = pTmpTbl->GetTabSortBoxes()[0] ) &&
+ pFBox->GetSttNd() && pFBox->GetSttNd()->GetNodes().IsDocNodes() )
+ {
+ const SwTableNode* pTblNd = pFBox->GetSttNd()->FindTableNode();
+ SwNodeIndex aCntntIdx( *pTblNd, 1 );
+
+ SwCntntNode* pCNd;
+ while( 0 != ( pCNd = rNds.GoNext( &aCntntIdx ) ) &&
+ aCntntIdx.GetIndex() < pTblNd->EndOfSectionIndex() )
+ {
+ if( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && (!IsFromChapter() ||
+ ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode ))
+ {
+ SwTOXTable * pNew = new SwTOXTable( *pCNd );
+ if( IsLevelFromChapter() && TOX_TABLES != SwTOXBase::GetType())
+ {
+ const SwTxtNode* pOutlNd =
+ ::lcl_FindChapterNode( *pCNd, MAXLEVEL - 1 );
+ if( pOutlNd )
+ {
+ //sal_uInt16 nTmp = pOutlNd->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
+ //if( nTmp < NO_NUMBERING )
+ // pNew->SetLevel( nTmp + 1 );
+ if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle())
+ {
+ const int nTmp = pOutlNd->GetTxtColl()->GetAttrOutlineLevel();
+ pNew->SetLevel( static_cast<sal_uInt16>(nTmp) );//<-end ,zhaojianwei
+ }
+ }
+ }
+ InsertSorted(pNew);
+ break;
+ }
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: String generieren anhand der Form
+ SonderZeichen 0-31 und 255 entfernen
+ --------------------------------------------------------------------*/
+
+String lcl_GetNumString( const SwTOXSortTabBase& rBase, sal_Bool bUsePrefix, sal_uInt8 nLevel )
+{
+ String sRet;
+
+ if( !rBase.pTxtMark && rBase.aTOXSources.Count() > 0 )
+ { // nur wenn es keine Marke ist
+ const SwTxtNode* pNd = rBase.aTOXSources[0].pNd->GetTxtNode();
+ if( pNd )
+ {
+ const SwNumRule* pRule = pNd->GetNumRule();
+
+ if( pRule && pNd->GetActualListLevel() < MAXLEVEL )
+ sRet = pNd->GetNumString(bUsePrefix, nLevel);
+ }
+ }
+ return sRet;
+}
+
+// OD 18.03.2003 #106329# - add parameter <_TOXSectNdIdx> and <_pDefaultPageDesc>
+// in order to control, which page description is used, no appropriate one is found.
+void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx,
+ sal_uInt16 nCount,
+ SvStringsDtor& ,
+ const sal_uInt32 _nTOXSectNdIdx,
+ const SwPageDesc* _pDefaultPageDesc )
+{
+ LinkStructArr aLinkArr;
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+
+ //pTOXNd is only set at the first mark
+ SwTxtNode* pTOXNd = (SwTxtNode*)aSortArr[nArrayIdx]->pTOXNd;
+ String& rTxt = (String&)pTOXNd->GetTxt();
+ rTxt.Erase();
+ for(sal_uInt16 nIndex = nArrayIdx; nIndex < nArrayIdx + nCount; nIndex++)
+ {
+ if(nIndex > nArrayIdx)
+ rTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " )); // comma separation
+ // String mit dem Pattern aus der Form initialisieren
+ const SwTOXSortTabBase& rBase = *aSortArr[nIndex];
+ sal_uInt16 nLvl = rBase.GetLevel();
+ ASSERT( nLvl < GetTOXForm().GetFormMax(), "ungueltiges FORM_LEVEL");
+
+ SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+ xub_StrLen nLinkStartPosition = STRING_NOTFOUND;
+ String sLinkCharacterStyle; //default to "Default" character style - which is none
+ String sURL;
+ // create an enumerator
+ // #i21237#
+ SwFormTokens aPattern = GetTOXForm().GetPattern(nLvl);
+ SwFormTokens::iterator aIt = aPattern.begin();
+ // remove text from node
+ while(aIt != aPattern.end()) // #i21237#
+ {
+ SwFormToken aToken = *aIt; // #i21237#
+ xub_StrLen nStartCharStyle = rTxt.Len();
+ switch( aToken.eTokenType )
+ {
+ case TOKEN_ENTRY_NO:
+ // fuer Inhaltsverzeichnis Numerierung
+ rTxt.Insert( lcl_GetNumString( rBase, aToken.nChapterFormat == CF_NUMBER, static_cast<sal_uInt8>(aToken.nOutlineLevel - 1)) );
+ break;
+
+ case TOKEN_ENTRY_TEXT:
+ {
+ SwIndex aIdx( pTOXNd, rTxt.Len() );
+ rBase.FillText( *pTOXNd, aIdx );
+ }
+ break;
+
+ case TOKEN_ENTRY:
+ {
+ // fuer Inhaltsverzeichnis Numerierung
+ rTxt.Insert( lcl_GetNumString( rBase, sal_True, MAXLEVEL ));
+
+ SwIndex aIdx( pTOXNd, rTxt.Len() );
+ rBase.FillText( *pTOXNd, aIdx );
+ }
+ break;
+
+ case TOKEN_TAB_STOP:
+ if (aToken.bWithTab) // #i21237#
+ rTxt.Append('\t');
+ //
+
+ if(SVX_TAB_ADJUST_END > aToken.eTabAlign)
+ {
+ const SvxLRSpaceItem& rLR =
+ (SvxLRSpaceItem&)pTOXNd->
+ SwCntntNode::GetAttr( RES_LR_SPACE, sal_True );
+
+ long nTabPosition = aToken.nTabStopPosition;
+ if( !GetTOXForm().IsRelTabPos() && rLR.GetTxtLeft() )
+ nTabPosition -= rLR.GetTxtLeft();
+ aTStops.Insert( SvxTabStop( nTabPosition,
+ aToken.eTabAlign,
+ cDfltDecimalChar,
+ aToken.cTabFillChar ));
+ }
+ else
+ {
+ const SwPageDesc* pPageDesc = ((SwFmtPageDesc&)pTOXNd->
+ SwCntntNode::GetAttr( RES_PAGEDESC )).GetPageDesc();
+
+ sal_Bool bCallFindRect = sal_True;
+ long nRightMargin;
+ if( pPageDesc )
+ {
+ const SwFrm* pFrm = pTOXNd->getLayoutFrm( pDoc->GetCurrentLayout(), 0, 0, sal_True );
+ if( !pFrm || 0 == ( pFrm = pFrm->FindPageFrm() ) ||
+ pPageDesc != ((SwPageFrm*)pFrm)->GetPageDesc() )
+ // dann muss man ueber den PageDesc gehen
+ bCallFindRect = sal_False;
+ }
+
+ SwRect aNdRect;
+ if( bCallFindRect )
+ aNdRect = pTOXNd->FindLayoutRect( sal_True );
+
+ if( aNdRect.IsEmpty() )
+ {
+ // dann hilft alles nichts, wir muessen ueber die Seiten-
+ // vorlage gehen.
+ // OD 18.03.2003 #106329# - call
+ sal_uInt32 nPgDescNdIdx = pTOXNd->GetIndex() + 1;
+ sal_uInt32* pPgDescNdIdx = &nPgDescNdIdx;
+ pPageDesc = pTOXNd->FindPageDesc( sal_False, pPgDescNdIdx );
+ if ( !pPageDesc ||
+ *pPgDescNdIdx < _nTOXSectNdIdx )
+ {
+ // use default page description, if none is found
+ // or the found one is given by a node before the
+ // table-of-content section.
+ pPageDesc = _pDefaultPageDesc;
+ }
+
+ const SwFrmFmt& rPgDscFmt = pPageDesc->GetMaster();
+ nRightMargin = rPgDscFmt.GetFrmSize().GetWidth() -
+ rPgDscFmt.GetLRSpace().GetLeft() -
+ rPgDscFmt.GetLRSpace().GetRight();
+ }
+ else
+ nRightMargin = aNdRect.Width();
+ //#i24363# tab stops relative to indent
+ if( pDoc->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) )
+ {
+ //left margin of paragraph style
+ const SvxLRSpaceItem& rLRSpace = pTOXNd->GetTxtColl()->GetLRSpace();
+ nRightMargin -= rLRSpace.GetLeft();
+ nRightMargin -= rLRSpace.GetTxtFirstLineOfst();
+ }
+
+ aTStops.Insert( SvxTabStop( nRightMargin, SVX_TAB_ADJUST_RIGHT,
+ cDfltDecimalChar,
+ aToken.cTabFillChar ));
+ }
+ break;
+
+ case TOKEN_TEXT:
+ rTxt.Append( aToken.sText );
+ break;
+
+ case TOKEN_PAGE_NUMS:
+ // Platzhalter fuer Seitennummer(n) es wird nur der erste beachtet
+ //
+ {
+ // Die Anzahl der gleichen Eintrage bestimmt die Seitennummern-Pattern
+ //
+ sal_uInt16 nSize = rBase.aTOXSources.Count();
+ if( nSize > 0 )
+ {
+ String aInsStr( cNumRepl );
+ for(sal_uInt16 i=1; i < nSize; ++i)
+ {
+ aInsStr.AppendAscii( sPageDeli );
+ aInsStr += cNumRepl;
+ }
+ aInsStr += cEndPageNum;
+ rTxt.Append( aInsStr );
+ }
+// // Tab entfernen, wenn keine Seitennummer
+// else if( rTxt.Len() && '\t' == rTxt.GetChar( rTxt.Len() - 1 ))
+// rTxt.Erase( rTxt.Len()-1, 1 );
+ }
+ break;
+
+ case TOKEN_CHAPTER_INFO:
+ {
+ // ein bischen trickreich: suche irgend einen Frame
+ const SwTOXSource* pTOXSource = 0;
+ if(rBase.aTOXSources.Count())
+ pTOXSource = &rBase.aTOXSources[0];
+
+ // --> OD 2008-02-14 #i53420#
+// if( pTOXSource && pTOXSource->pNd
+// pTOXSource->pNd->IsTxtNode() )
+ if ( pTOXSource && pTOXSource->pNd &&
+ pTOXSource->pNd->IsCntntNode() )
+ // <--
+ {
+ const SwCntntFrm* pFrm = pTOXSource->pNd->getLayoutFrm( pDoc->GetCurrentLayout() );
+ if( pFrm )
+ {
+ SwChapterFieldType aFldTyp;
+ SwChapterField aFld( &aFldTyp, aToken.nChapterFormat );
+ aFld.SetLevel( static_cast<sal_uInt8>(aToken.nOutlineLevel - 1) );
+ // --> OD 2008-02-14 #i53420#
+// aFld.ChangeExpansion( pFrm, (SwTxtNode*)pTOXSource->pNd, sal_True );
+ aFld.ChangeExpansion( pFrm,
+ dynamic_cast<const SwCntntNode*>(pTOXSource->pNd),
+ sal_True );
+ // <--
+ //---> i89791
+ // OD 2008-06-26 - continue to support CF_NUMBER
+ // and CF_NUM_TITLE in order to handle ODF 1.0/1.1
+ // written by OOo 3.x in the same way as OOo 2.x
+ // would handle them.
+ if ( CF_NUM_NOPREPST_TITLE == aToken.nChapterFormat ||
+ CF_NUMBER == aToken.nChapterFormat )
+ rTxt.Insert(aFld.GetNumber()); //get the string number without pre/postfix
+ else if ( CF_NUMBER_NOPREPST == aToken.nChapterFormat ||
+ CF_NUM_TITLE == aToken.nChapterFormat )
+ //<---
+ {
+ rTxt += aFld.GetNumber();
+ rTxt += ' ';
+ rTxt += aFld.GetTitle();
+ }
+ else if(CF_TITLE == aToken.nChapterFormat)
+ rTxt += aFld.GetTitle();
+ }
+ }
+ }
+ break;
+
+ case TOKEN_LINK_START:
+ nLinkStartPosition = rTxt.Len();
+ sLinkCharacterStyle = aToken.sCharStyleName;
+ break;
+
+ case TOKEN_LINK_END:
+ //TODO: only paired start/end tokens are valid
+ if( STRING_NOTFOUND != nLinkStartPosition)
+ {
+ SwIndex aIdx( pTOXNd, nLinkStartPosition );
+ //pTOXNd->Erase( aIdx, SwForm::nFormLinkSttLen );
+ xub_StrLen nEnd = rTxt.Len();
+
+ if( !sURL.Len() )
+ {
+ sURL = rBase.GetURL();
+ if( !sURL.Len() )
+ break;
+ }
+ LinkStruct* pNewLink = new LinkStruct(sURL, nLinkStartPosition,
+ nEnd);
+ pNewLink->aINetFmt.SetVisitedFmt(sLinkCharacterStyle);
+ pNewLink->aINetFmt.SetINetFmt(sLinkCharacterStyle);
+ if(sLinkCharacterStyle.Len())
+ {
+ sal_uInt16 nPoolId =
+ SwStyleNameMapper::GetPoolIdFromUIName( sLinkCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ pNewLink->aINetFmt.SetVisitedFmtId(nPoolId);
+ pNewLink->aINetFmt.SetINetFmtId(nPoolId);
+ }
+ else
+ {
+ pNewLink->aINetFmt.SetVisitedFmtId(USHRT_MAX);
+ pNewLink->aINetFmt.SetINetFmtId(USHRT_MAX);
+ }
+ aLinkArr.Insert( pNewLink, aLinkArr.Count() );
+ nLinkStartPosition = STRING_NOTFOUND;
+ sLinkCharacterStyle.Erase();
+ }
+ break;
+
+ case TOKEN_AUTHORITY:
+ {
+ ToxAuthorityField eField = (ToxAuthorityField)aToken.nAuthorityField;
+ SwIndex aIdx( pTOXNd, rTxt.Len() );
+ rBase.FillText( *pTOXNd, aIdx, static_cast<sal_uInt16>(eField) );
+ }
+ break;
+ case TOKEN_END: break;
+ }
+
+ if( aToken.sCharStyleName.Len() )
+ {
+ SwCharFmt* pCharFmt;
+ if( USHRT_MAX != aToken.nPoolId )
+ pCharFmt = pDoc->GetCharFmtFromPool( aToken.nPoolId );
+ else
+ pCharFmt = pDoc->FindCharFmtByName( aToken.sCharStyleName);
+
+ if (pCharFmt)
+ {
+ SwFmtCharFmt aFmt( pCharFmt );
+ pTOXNd->InsertItem( aFmt, nStartCharStyle,
+ rTxt.Len(), nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
+ }
+
+ aIt++; // #i21237#
+ }
+
+ pTOXNd->SetAttr( aTStops );
+ }
+
+ if(aLinkArr.Count())
+ for(sal_uInt16 i = 0; i < aLinkArr.Count(); ++i )
+ {
+ LinkStruct* pTmp = aLinkArr.GetObject(i);
+ pTOXNd->InsertItem( pTmp->aINetFmt, pTmp->nStartTextPos,
+ pTmp->nEndTextPos);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seitennummer errechnen und nach dem Formatieren
+ eintragen
+ --------------------------------------------------------------------*/
+
+void SwTOXBaseSection::UpdatePageNum()
+{
+ if( !aSortArr.Count() )
+ return ;
+
+ // die aktuellen Seitennummern ins Verzeichnis eintragen
+ SwPageFrm* pAktPage = 0;
+ sal_uInt16 nPage = 0;
+ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+
+ SwTOXInternational aIntl( GetLanguage(),
+ TOX_INDEX == GetTOXType()->GetType() ?
+ GetOptions() : 0,
+ GetSortAlgorithm() );
+
+ for( sal_uInt16 nCnt = 0; nCnt < aSortArr.Count(); ++nCnt )
+ {
+ // Schleife ueber alle SourceNodes
+ SvUShorts aNums; //Die Seitennummern
+ SvPtrarr aDescs; //Die PageDescriptoren passend zu den Seitennummern.
+ SvUShorts* pMainNums = 0; // contains page numbers of main entries
+
+ // process run in lines
+ sal_uInt16 nRange = 0;
+ if(GetTOXForm().IsCommaSeparated() &&
+ aSortArr[nCnt]->GetType() == TOX_SORT_INDEX)
+ {
+ const SwTOXMark& rMark = aSortArr[nCnt]->pTxtMark->GetTOXMark();
+ const String sPrimKey = rMark.GetPrimaryKey();
+ const String sSecKey = rMark.GetSecondaryKey();
+ const SwTOXMark* pNextMark = 0;
+ while(aSortArr.Count() > (nCnt + nRange)&&
+ aSortArr[nCnt + nRange]->GetType() == TOX_SORT_INDEX &&
+ 0 != (pNextMark = &(aSortArr[nCnt + nRange]->pTxtMark->GetTOXMark())) &&
+ pNextMark->GetPrimaryKey() == sPrimKey &&
+ pNextMark->GetSecondaryKey() == sSecKey)
+ nRange++;
+ }
+ else
+ nRange = 1;
+
+ for(sal_uInt16 nRunInEntry = nCnt; nRunInEntry < nCnt + nRange; nRunInEntry++)
+ {
+ SwTOXSortTabBase* pSortBase = aSortArr[nRunInEntry];
+ sal_uInt16 nSize = pSortBase->aTOXSources.Count();
+ sal_uInt16 i;
+ for( sal_uInt16 j = 0; j < nSize; ++j )
+ {
+ ::SetProgressState( 0, pDoc->GetDocShell() );
+
+ SwTOXSource& rTOXSource = pSortBase->aTOXSources[j];
+ if( rTOXSource.pNd )
+ {
+ SwCntntFrm* pFrm = rTOXSource.pNd->getLayoutFrm( pDoc->GetCurrentLayout() );
+ ASSERT( pFrm || pDoc->IsUpdateTOX(), "TOX, no Frame found");
+ if( !pFrm )
+ continue;
+ if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->HasFollow() )
+ {
+ // dann suche den richtigen heraus
+ SwTxtFrm* pNext = (SwTxtFrm*)pFrm;
+ while( 0 != ( pNext = (SwTxtFrm*)pFrm->GetFollow() )
+ && rTOXSource.nPos >= pNext->GetOfst() )
+ pFrm = pNext;
+ }
+
+ SwPageFrm* pTmpPage = pFrm->FindPageFrm();
+ if( pTmpPage != pAktPage )
+ {
+ nPage = pTmpPage->GetVirtPageNum();
+ pAktPage = pTmpPage;
+ }
+
+ // sortiert einfuegen
+ for( i = 0; i < aNums.Count() && aNums[i] < nPage; ++i )
+ ;
+
+ if( i >= aNums.Count() || aNums[ i ] != nPage )
+ {
+ aNums.Insert( nPage, i );
+ aDescs.Insert( (void*)pAktPage->GetPageDesc(), i );
+ }
+ // is it a main entry?
+ if(TOX_SORT_INDEX == pSortBase->GetType() &&
+ rTOXSource.bMainEntry)
+ {
+ if(!pMainNums)
+ pMainNums = new SvUShorts;
+ pMainNums->Insert(nPage, pMainNums->Count());
+ }
+ }
+ }
+ // einfuegen der Seitennummer in den Verzeichnis-Text-Node
+ const SwTOXSortTabBase* pBase = aSortArr[ nCnt ];
+ if(pBase->pTOXNd)
+ {
+ const SwTxtNode* pTxtNd = pBase->pTOXNd->GetTxtNode();
+ ASSERT( pTxtNd, "kein TextNode, falsches Verzeichnis" );
+
+ _UpdatePageNum( (SwTxtNode*)pTxtNd, aNums, aDescs, pMainNums,
+ aIntl );
+ }
+ DELETEZ(pMainNums);
+ aNums.Remove(0, aNums.Count());
+ }
+ }
+ // nach dem Setzen der richtigen Seitennummer, das Mapping-Array
+ // wieder loeschen !!
+ aSortArr.DeleteAndDestroy( 0, aSortArr.Count() );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Austausch der Seitennummer-Platzhalter
+ --------------------------------------------------------------------*/
+
+// search for the page no in the array of main entry page numbers
+sal_Bool lcl_HasMainEntry( const SvUShorts* pMainEntryNums, sal_uInt16 nToFind )
+{
+ for(sal_uInt16 i = 0; pMainEntryNums && i < pMainEntryNums->Count(); ++i)
+ if(nToFind == (*pMainEntryNums)[i])
+ return sal_True;
+ return sal_False;
+}
+
+void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd,
+ const SvUShorts& rNums,
+ const SvPtrarr & rDescs,
+ const SvUShorts* pMainEntryNums,
+ const SwTOXInternational& rIntl )
+{
+ //collect starts end ends of main entry character style
+ SvUShorts* pCharStyleIdx = pMainEntryNums ? new SvUShorts : 0;
+
+ String sSrchStr( cNumRepl );
+ sSrchStr.AppendAscii( sPageDeli ) += cNumRepl;
+ xub_StrLen nStartPos = pNd->GetTxt().Search( sSrchStr );
+ ( sSrchStr = cNumRepl ) += cEndPageNum;
+ xub_StrLen nEndPos = pNd->GetTxt().Search( sSrchStr );
+ sal_uInt16 i;
+
+ if( STRING_NOTFOUND == nEndPos || !rNums.Count() )
+ return;
+
+ if( STRING_NOTFOUND == nStartPos || nStartPos > nEndPos)
+ nStartPos = nEndPos;
+
+ sal_uInt16 nOld = rNums[0],
+ nBeg = nOld,
+ nCount = 0;
+ String aNumStr( SvxNumberType( ((SwPageDesc*)rDescs[0])->GetNumType() ).
+ GetNumStr( nBeg ) );
+ if( pCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg ))
+ {
+ sal_uInt16 nTemp = 0;
+ pCharStyleIdx->Insert( nTemp, pCharStyleIdx->Count());
+ }
+
+ // Platzhalter loeschen
+ SwIndex aPos(pNd, nStartPos);
+ SwCharFmt* pPageNoCharFmt = 0;
+ SwpHints* pHints = pNd->GetpSwpHints();
+ if(pHints)
+ for(sal_uInt16 nHintIdx = 0; nHintIdx < pHints->GetStartCount(); nHintIdx++)
+ {
+ SwTxtAttr* pAttr = pHints->GetStart(nHintIdx);
+ xub_StrLen nTmpEnd = pAttr->GetEnd() ? *pAttr->GetEnd() : 0;
+ if( nStartPos >= *pAttr->GetStart() &&
+ (nStartPos + 2) <= nTmpEnd &&
+ pAttr->Which() == RES_TXTATR_CHARFMT)
+ {
+ pPageNoCharFmt = pAttr->GetCharFmt().GetCharFmt();
+ break;
+ }
+ }
+ pNd->EraseText(aPos, nEndPos - nStartPos + 2);
+
+ for( i = 1; i < rNums.Count(); ++i)
+ {
+ SvxNumberType aType( ((SwPageDesc*)rDescs[i])->GetNumType() );
+ if( TOX_INDEX == SwTOXBase::GetType() )
+ { // Zusammenfassen f. ff.
+ // Alle folgenden aufaddieren
+ // break up if main entry starts or ends and
+ // insert a char style index
+ sal_Bool bMainEntryChanges = lcl_HasMainEntry(pMainEntryNums, nOld)
+ != lcl_HasMainEntry(pMainEntryNums, rNums[i]);
+
+ if(nOld == rNums[i]-1 && !bMainEntryChanges &&
+ 0 != (GetOptions() & (nsSwTOIOptions::TOI_FF|nsSwTOIOptions::TOI_DASH)))
+ nCount++;
+ else
+ {
+ // ff. f. alten Wert flushen
+ if(GetOptions() & nsSwTOIOptions::TOI_FF)
+ {
+ if ( nCount >= 1 )
+ aNumStr += rIntl.GetFollowingText( nCount > 1 );
+ }
+ else
+ {
+ if(nCount >= 2 )
+ aNumStr += '-';
+ else if(nCount == 1 )
+ aNumStr.AppendAscii( sPageDeli );
+//#58127# Wenn nCount == 0, dann steht die einzige Seitenzahl schon im aNumStr!
+ if(nCount)
+ aNumStr += aType.GetNumStr( nBeg + nCount );
+ }
+
+ // neuen String anlegen
+ nBeg = rNums[i];
+ aNumStr.AppendAscii( sPageDeli );
+ //the change of the character style must apply after sPageDeli is appended
+ if(pCharStyleIdx && bMainEntryChanges)
+ pCharStyleIdx->Insert(aNumStr.Len(),
+ pCharStyleIdx->Count());
+ aNumStr += aType.GetNumStr( nBeg );
+ nCount = 0;
+ }
+ nOld = rNums[i];
+ }
+ else
+ { // Alle Nummern eintragen
+ aNumStr += aType.GetNumStr( sal_uInt16(rNums[i]) );
+ if(i != (rNums.Count()-1))
+ aNumStr.AppendAscii( sPageDeli );
+ }
+ }
+ // Bei Ende und ff. alten Wert flushen
+ if( TOX_INDEX == SwTOXBase::GetType() )
+ {
+ if(GetOptions() & nsSwTOIOptions::TOI_FF)
+ {
+ if( nCount >= 1 )
+ aNumStr += rIntl.GetFollowingText( nCount > 1 );
+ }
+ else
+ {
+ if(nCount >= 2)
+ aNumStr +='-';
+ else if(nCount == 1)
+ aNumStr.AppendAscii( sPageDeli );
+//#58127# Wenn nCount == 0, dann steht die einzige Seitenzahl schon im aNumStr!
+ if(nCount)
+ aNumStr += SvxNumberType( ((SwPageDesc*)rDescs[i-1])->
+ GetNumType() ).GetNumStr( nBeg+nCount );
+ }
+ }
+ pNd->InsertText( aNumStr, aPos,
+ static_cast<IDocumentContentOperations::InsertFlags>(
+ IDocumentContentOperations::INS_EMPTYEXPAND |
+ IDocumentContentOperations::INS_FORCEHINTEXPAND) );
+ if(pPageNoCharFmt)
+ {
+ SwFmtCharFmt aCharFmt( pPageNoCharFmt );
+ pNd->InsertItem(aCharFmt, nStartPos, nStartPos + aNumStr.Len(), nsSetAttrMode::SETATTR_DONTEXPAND);
+ }
+
+ //now the main entries should get there character style
+ if(pCharStyleIdx && pCharStyleIdx->Count() && GetMainEntryCharStyle().Len())
+ {
+ // eventually the last index must me appended
+ if(pCharStyleIdx->Count()&0x01)
+ pCharStyleIdx->Insert(aNumStr.Len(), pCharStyleIdx->Count());
+
+ //search by name
+ SwDoc* pDoc = pNd->GetDoc();
+ sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( GetMainEntryCharStyle(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ SwCharFmt* pCharFmt = 0;
+ if(USHRT_MAX != nPoolId)
+ pCharFmt = pDoc->GetCharFmtFromPool(nPoolId);
+ else
+ pCharFmt = pDoc->FindCharFmtByName( GetMainEntryCharStyle() );
+ if(!pCharFmt)
+ pCharFmt = pDoc->MakeCharFmt(GetMainEntryCharStyle(), 0);
+
+ //find the page numbers in aNumStr and set the character style
+ xub_StrLen nOffset = pNd->GetTxt().Len() - aNumStr.Len();
+ SwFmtCharFmt aCharFmt(pCharFmt);
+ for(sal_uInt16 j = 0; j < pCharStyleIdx->Count(); j += 2)
+ {
+ xub_StrLen nStartIdx = (*pCharStyleIdx)[j] + nOffset;
+ xub_StrLen nEndIdx = (*pCharStyleIdx)[j + 1] + nOffset;
+ pNd->InsertItem(aCharFmt, nStartIdx, nEndIdx, nsSetAttrMode::SETATTR_DONTEXPAND);
+ }
+
+ }
+ delete pCharStyleIdx;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sortiert einfuegen in das SortArr
+ --------------------------------------------------------------------*/
+
+void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
+{
+ Range aRange(0, aSortArr.Count());
+ if( TOX_INDEX == SwTOXBase::GetType() && pNew->pTxtMark )
+ {
+ const SwTOXMark& rMark = pNew->pTxtMark->GetTOXMark();
+ // Schluessel auswerten
+ // Den Bereich ermitteln, in dem einzufuegen ist
+ if( 0 == (GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY) &&
+ rMark.GetPrimaryKey().Len() )
+ {
+ aRange = GetKeyRange( rMark.GetPrimaryKey(),
+ rMark.GetPrimaryKeyReading(),
+ *pNew, FORM_PRIMARY_KEY, aRange );
+
+ if( rMark.GetSecondaryKey().Len() )
+ aRange = GetKeyRange( rMark.GetSecondaryKey(),
+ rMark.GetSecondaryKeyReading(),
+ *pNew, FORM_SECONDARY_KEY, aRange );
+ }
+ }
+ //search for identical entries and remove the trailing one
+ if(TOX_AUTHORITIES == SwTOXBase::GetType())
+ {
+ for(short i = (short)aRange.Min(); i < (short)aRange.Max(); ++i)
+ {
+ SwTOXSortTabBase* pOld = aSortArr[i];
+ if(*pOld == *pNew)
+ {
+ if(*pOld < *pNew)
+ {
+ delete pNew;
+ return;
+ }
+ else
+ {
+ // remove the old content
+ aSortArr.DeleteAndDestroy( i, 1 );
+ aRange.Max()--;
+ break;
+ }
+ }
+ }
+ }
+
+ // find position and insert
+ //
+ short i;
+
+ for( i = (short)aRange.Min(); i < (short)aRange.Max(); ++i)
+ { // nur auf gleicher Ebene pruefen
+ //
+ SwTOXSortTabBase* pOld = aSortArr[i];
+ if(*pOld == *pNew)
+ {
+ if(TOX_AUTHORITIES != SwTOXBase::GetType())
+ {
+ // Eigener Eintrag fuer Doppelte oder Keywords
+ //
+ if( pOld->GetType() == TOX_SORT_CUSTOM &&
+ pNew->GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY)
+ continue;
+
+ if(!(pNew->GetOptions() & nsSwTOIOptions::TOI_SAME_ENTRY))
+ { // Eigener Eintrag
+ aSortArr.Insert(pNew, i );
+ return;
+ }
+ // Eintrag schon vorhanden in Referenzliste aufnehmen
+ pOld->aTOXSources.Insert( pNew->aTOXSources[0],
+ pOld->aTOXSources.Count() );
+
+ delete pNew;
+ return;
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Bibliography entries cannot be found here");
+#endif
+ }
+ if(*pNew < *pOld)
+ break;
+ }
+ // SubLevel Skippen
+ while( TOX_INDEX == SwTOXBase::GetType() && i < aRange.Max() &&
+ aSortArr[i]->GetLevel() > pNew->GetLevel() )
+ i++;
+
+ // An Position i wird eingefuegt
+ aSortArr.Insert(pNew, i );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Schluessel-Bereich suchen und evtl einfuegen
+ --------------------------------------------------------------------*/
+
+Range SwTOXBaseSection::GetKeyRange(const String& rStr, const String& rStrReading,
+ const SwTOXSortTabBase& rNew,
+ sal_uInt16 nLevel, const Range& rRange )
+{
+ const SwTOXInternational& rIntl = *rNew.pTOXIntl;
+ String sToCompare(rStr);
+ String sToCompareReading(rStrReading);
+
+ if( 0 != (nsSwTOIOptions::TOI_INITIAL_CAPS & GetOptions()) )
+ {
+ String sUpper( rIntl.ToUpper( sToCompare, 0 ));
+ sToCompare.Erase( 0, 1 ).Insert( sUpper, 0 );
+ }
+
+ ASSERT(rRange.Min() >= 0 && rRange.Max() >= 0, "Min Max < 0");
+
+ const sal_uInt16 nMin = (sal_uInt16)rRange.Min();
+ const sal_uInt16 nMax = (sal_uInt16)rRange.Max();
+
+ sal_uInt16 i;
+
+ for( i = nMin; i < nMax; ++i)
+ {
+ SwTOXSortTabBase* pBase = aSortArr[i];
+
+ String sMyString, sMyStringReading;
+ pBase->GetTxt( sMyString, sMyStringReading );
+
+ if( rIntl.IsEqual( sMyString, sMyStringReading, pBase->GetLocale(),
+ sToCompare, sToCompareReading, rNew.GetLocale() ) &&
+ pBase->GetLevel() == nLevel )
+ break;
+ }
+ if(i == nMax)
+ { // Falls nicht vorhanden erzeugen und einfuegen
+ //
+ SwTOXCustom* pKey = new SwTOXCustom( sToCompare, sToCompareReading, nLevel, rIntl,
+ rNew.GetLocale() );
+ for(i = nMin; i < nMax; ++i)
+ {
+ if(nLevel == aSortArr[i]->GetLevel() && *pKey < *(aSortArr[i]))
+ break;
+ }
+ aSortArr.Insert(pKey, i );
+ }
+ sal_uInt16 nStart = i+1;
+ sal_uInt16 nEnd = aSortArr.Count();
+
+ // Ende des Bereiches suchen
+ for(i = nStart; i < aSortArr.Count(); ++i)
+ {
+ if(aSortArr[i]->GetLevel() <= nLevel)
+ { nEnd = i;
+ break;
+ }
+ }
+ return Range(nStart, nEnd);
+}
+
+
+sal_Bool SwTOXBase::IsTOXBaseInReadonly() const
+{
+ const SwTOXBaseSection *pSect = PTR_CAST(SwTOXBaseSection, this);
+ sal_Bool bRet = sal_False;
+ const SwSectionNode* pSectNode;
+ if(pSect && pSect->GetFmt() &&
+ 0 != (pSectNode = pSect->GetFmt()->GetSectionNode()))
+ {
+ const SwDocShell* pDocSh;
+ bRet = (0 != (pDocSh = pSectNode->GetDoc()->GetDocShell()) &&
+ pDocSh->IsReadOnly()) ||
+ (0 != (pSectNode = pSectNode->StartOfSectionNode()->FindSectionNode())&&
+ pSectNode->GetSection().IsProtectFlag());
+
+ }
+ return bRet;
+}
+
+const SfxItemSet* SwTOXBase::GetAttrSet() const
+{
+ const SwTOXBaseSection *pSect = PTR_CAST(SwTOXBaseSection, this);
+ if(pSect && pSect->GetFmt())
+ return &pSect->GetFmt()->GetAttrSet();
+ return 0;
+}
+
+void SwTOXBase::SetAttrSet( const SfxItemSet& rSet )
+{
+ SwTOXBaseSection *pSect = PTR_CAST(SwTOXBaseSection, this);
+ if( pSect && pSect->GetFmt() )
+ pSect->GetFmt()->SetFmtAttr( rSet );
+}
+
+sal_Bool SwTOXBase::GetInfo( SfxPoolItem& rInfo ) const
+{
+ switch( rInfo.Which() )
+ {
+ case RES_CONTENT_VISIBLE:
+ {
+ SwTOXBaseSection *pSect = PTR_CAST(SwTOXBaseSection, this);
+ if( pSect && pSect->GetFmt() )
+ pSect->GetFmt()->GetInfo( rInfo );
+ }
+ return sal_False;
+ }
+ return sal_True;
+}
+
diff --git a/sw/source/core/doc/docxforms.cxx b/sw/source/core/doc/docxforms.cxx
new file mode 100644
index 000000000000..febab662a8fa
--- /dev/null
+++ b/sw/source/core/doc/docxforms.cxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <doc.hxx>
+#include <docsh.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XModule.hpp>
+#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/xforms/XFormsUIHelper1.hpp>
+#include <unotools/processfactory.hxx>
+#include <tools/diagnose_ex.h>
+
+
+using namespace ::com::sun::star;
+
+using uno::Reference;
+using uno::XInterface;
+using uno::UNO_QUERY;
+using uno::makeAny;
+using uno::Exception;
+using container::XNameContainer;
+using xforms::XModel;
+using frame::XModule;
+using xforms::XFormsUIHelper1;
+using rtl::OUString;
+
+
+Reference<XNameContainer> SwDoc::getXForms() const
+{
+ return xXForms;
+}
+
+bool SwDoc::isXForms() const
+{
+ return xXForms.is();
+}
+
+Reference<XInterface> lcl_createInstance( const sal_Char* pServiceName )
+{
+ DBG_ASSERT( pServiceName != NULL, "no service name" );
+ return utl::getProcessServiceFactory()->createInstance(
+ OUString::createFromAscii( pServiceName ) );
+}
+
+void SwDoc::initXForms( bool bCreateDefaultModel )
+{
+ DBG_ASSERT( ! isXForms(), "please initialize only once" );
+
+ try
+ {
+ // create XForms components
+ xXForms.set( lcl_createInstance( "com.sun.star.xforms.XForms" ),
+ UNO_QUERY );
+ DBG_ASSERT( xXForms.is(), "can't create XForms container" );
+
+ // change our module identifier, to be able to have a dedicated UI
+ Reference< XModule > xModule;
+ SwDocShell* pShell( GetDocShell() );
+ if ( pShell )
+ xModule = xModule.query( pShell->GetModel() );
+ DBG_ASSERT( xModule.is(), "SwDoc::initXForms: no XModule at the document!" );
+ if ( xModule.is() )
+ xModule->setIdentifier( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xforms.XMLFormDocument" ) ) );
+
+ // create default model
+ if( bCreateDefaultModel && xXForms.is() )
+ {
+ OUString sName(RTL_CONSTASCII_USTRINGPARAM("Model 1"));
+ Reference<XModel> xModel(
+ lcl_createInstance( "com.sun.star.xforms.Model" ),
+ UNO_QUERY );
+ DBG_ASSERT( xModel.is(), "no model?" );
+ if( xModel.is() )
+ {
+ xModel->setID( sName );
+ Reference<XFormsUIHelper1>( xModel, UNO_QUERY )->newInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Instance 1")),
+ OUString(), sal_True );
+ xModel->initialize();
+ xXForms->insertByName( sName, makeAny( xModel ) );
+ }
+ DBG_ASSERT( xXForms->hasElements(), "can't create XForms model" );
+ }
+
+ DBG_ASSERT( isXForms(), "initialization failed" );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx
new file mode 100644
index 000000000000..93d177aed548
--- /dev/null
+++ b/sw/source/core/doc/extinput.cxx
@@ -0,0 +1,300 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/i18n/ScriptType.hpp>
+
+#include <editeng/langitem.hxx>
+#include <editeng/scripttypeitem.hxx>
+
+#include <vcl/keycodes.hxx>
+#include <vcl/cmdevt.hxx>
+
+#include <hintids.hxx>
+#include <extinput.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <index.hxx>
+#include <ndtxt.hxx>
+#include <txtfrm.hxx>
+#include <swundo.hxx>
+
+
+using namespace ::com::sun::star;
+
+SwExtTextInput::SwExtTextInput( const SwPaM& rPam, Ring* pRing )
+ : SwPaM( *rPam.GetPoint(), (SwPaM*)pRing ),
+ eInputLanguage(LANGUAGE_DONTKNOW)
+{
+ bIsOverwriteCursor = sal_False;
+ bInsText = sal_True;
+}
+
+SwExtTextInput::~SwExtTextInput()
+{
+ SwDoc *const pDoc = GetDoc();
+ if (pDoc->IsInDtor()) { return; /* #i58606# */ }
+
+ SwTxtNode* pTNd = GetPoint()->nNode.GetNode().GetTxtNode();
+ if( pTNd )
+ {
+ SwIndex& rIdx = GetPoint()->nContent;
+ xub_StrLen nSttCnt = rIdx.GetIndex(),
+ nEndCnt = GetMark()->nContent.GetIndex();
+ if( nEndCnt != nSttCnt )
+ {
+ if( nEndCnt < nSttCnt )
+ {
+ xub_StrLen n = nEndCnt; nEndCnt = nSttCnt; nSttCnt = n;
+ }
+
+ // damit Undo / Redlining usw. richtig funktioniert,
+ // muss ueber die Doc-Schnittstellen gegangen werden !!!
+ if(eInputLanguage != LANGUAGE_DONTKNOW)
+ {
+ // --> FME 2005-02-11 #i41974# Only set language attribute
+ // for CJK/CTL scripts.
+ bool bLang = true;
+ // <--
+ sal_uInt16 nWhich = RES_CHRATR_LANGUAGE;
+ switch(GetI18NScriptTypeOfLanguage(eInputLanguage))
+ {
+ case i18n::ScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break;
+ case i18n::ScriptType::COMPLEX: nWhich = RES_CHRATR_CTL_LANGUAGE; break;
+ default: bLang = false;
+ }
+ if ( bLang )
+ {
+ SvxLanguageItem aLangItem( eInputLanguage, nWhich );
+ pDoc->InsertPoolItem(*this, aLangItem, 0 );
+ }
+ }
+ rIdx = nSttCnt;
+ String sTxt( pTNd->GetTxt().Copy( nSttCnt, nEndCnt - nSttCnt ));
+ if( bIsOverwriteCursor && sOverwriteText.Len() )
+ {
+ xub_StrLen nLen = sTxt.Len();
+ if( nLen > sOverwriteText.Len() )
+ {
+ rIdx += sOverwriteText.Len();
+ pTNd->EraseText( rIdx, nLen - sOverwriteText.Len() );
+ rIdx = nSttCnt;
+ pTNd->ReplaceText( rIdx, sOverwriteText.Len(),
+ sOverwriteText );
+ if( bInsText )
+ {
+ rIdx = nSttCnt;
+ pDoc->GetIDocumentUndoRedo().StartUndo(
+ UNDO_OVERWRITE, NULL );
+ pDoc->Overwrite( *this, sTxt.Copy( 0,
+ sOverwriteText.Len() ));
+ pDoc->InsertString( *this,
+ sTxt.Copy( sOverwriteText.Len() ) );
+ pDoc->GetIDocumentUndoRedo().EndUndo(
+ UNDO_OVERWRITE, NULL );
+ }
+ }
+ else
+ {
+ pTNd->ReplaceText( rIdx, nLen,
+ sOverwriteText.Copy( 0, nLen ));
+ if( bInsText )
+ {
+ rIdx = nSttCnt;
+ pDoc->Overwrite( *this, sTxt );
+ }
+ }
+ }
+ else
+ {
+ pTNd->EraseText( rIdx, nEndCnt - nSttCnt );
+
+ if( bInsText )
+ {
+ pDoc->InsertString( *this, sTxt );
+ }
+ }
+ }
+ }
+}
+
+void SwExtTextInput::SetInputData( const CommandExtTextInputData& rData )
+{
+ SwTxtNode* pTNd = GetPoint()->nNode.GetNode().GetTxtNode();
+ if( pTNd )
+ {
+ xub_StrLen nSttCnt = GetPoint()->nContent.GetIndex(),
+ nEndCnt = GetMark()->nContent.GetIndex();
+ if( nEndCnt < nSttCnt )
+ {
+ xub_StrLen n = nEndCnt; nEndCnt = nSttCnt; nSttCnt = n;
+ }
+
+ SwIndex aIdx( pTNd, nSttCnt );
+ const String& rNewStr = rData.GetText();
+
+ if( bIsOverwriteCursor && sOverwriteText.Len() )
+ {
+ xub_StrLen nReplace = nEndCnt - nSttCnt;
+ if( rNewStr.Len() < nReplace )
+ {
+ // then we must insert from the saved original text
+ // some characters
+ nReplace = nReplace - rNewStr.Len();
+ aIdx += rNewStr.Len();
+ pTNd->ReplaceText( aIdx, nReplace,
+ sOverwriteText.Copy( rNewStr.Len(), nReplace ));
+ aIdx = nSttCnt;
+ nReplace = rNewStr.Len();
+ }
+ else if( sOverwriteText.Len() < nReplace )
+ {
+ nReplace = nReplace - sOverwriteText.Len();
+ aIdx += sOverwriteText.Len();
+ pTNd->EraseText( aIdx, nReplace );
+ aIdx = nSttCnt;
+ nReplace = sOverwriteText.Len();
+ }
+ else if( (nReplace = sOverwriteText.Len()) > rNewStr.Len() )
+ nReplace = rNewStr.Len();
+
+ pTNd->ReplaceText( aIdx, nReplace, rNewStr );
+ if( !HasMark() )
+ SetMark();
+ GetMark()->nContent = aIdx;
+ }
+ else
+ {
+ if( nSttCnt < nEndCnt )
+ {
+ pTNd->EraseText( aIdx, nEndCnt - nSttCnt );
+ }
+
+ pTNd->InsertText( rNewStr, aIdx,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
+ if( !HasMark() )
+ SetMark();
+ }
+
+ GetPoint()->nContent = nSttCnt;
+
+ if( aAttrs.Count() )
+ aAttrs.Remove( 0, aAttrs.Count() );
+ if( rData.GetTextAttr() )
+ aAttrs.Insert( rData.GetTextAttr(), rData.GetText().Len(), 0 );
+ }
+}
+
+void SwExtTextInput::SetOverwriteCursor( sal_Bool bFlag )
+{
+ bIsOverwriteCursor = bFlag;
+
+ SwTxtNode* pTNd;
+ if( bIsOverwriteCursor &&
+ 0 != (pTNd = GetPoint()->nNode.GetNode().GetTxtNode()) )
+ {
+ xub_StrLen nSttCnt = GetPoint()->nContent.GetIndex(),
+ nEndCnt = GetMark()->nContent.GetIndex();
+ sOverwriteText = pTNd->GetTxt().Copy( nEndCnt < nSttCnt ? nEndCnt
+ : nSttCnt );
+ if( sOverwriteText.Len() )
+ {
+ xub_StrLen nInWrdAttrPos = sOverwriteText.Search( CH_TXTATR_INWORD ),
+ nWrdAttrPos = sOverwriteText.Search( CH_TXTATR_BREAKWORD );
+ if( nWrdAttrPos < nInWrdAttrPos )
+ nInWrdAttrPos = nWrdAttrPos;
+ if( STRING_NOTFOUND != nInWrdAttrPos )
+ sOverwriteText.Erase( nInWrdAttrPos );
+ }
+ }
+}
+
+// die Doc Schnittstellen:
+
+SwExtTextInput* SwDoc::CreateExtTextInput( const SwPaM& rPam )
+{
+ SwExtTextInput* pNew = new SwExtTextInput( rPam, pExtInputRing );
+ if( !pExtInputRing )
+ pExtInputRing = pNew;
+ pNew->SetMark();
+ return pNew;
+}
+
+void SwDoc::DeleteExtTextInput( SwExtTextInput* pDel )
+{
+ if( pDel == pExtInputRing )
+ {
+ if( pDel->GetNext() != pExtInputRing )
+ pExtInputRing = (SwPaM*)pDel->GetNext();
+ else
+ pExtInputRing = 0;
+ }
+ delete pDel;
+}
+
+SwExtTextInput* SwDoc::GetExtTextInput( const SwNode& rNd,
+ xub_StrLen nCntntPos ) const
+{
+ SwExtTextInput* pRet = 0;
+ if( pExtInputRing )
+ {
+ sal_uLong nNdIdx = rNd.GetIndex();
+ SwExtTextInput* pTmp = (SwExtTextInput*)pExtInputRing;
+ do {
+ sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(),
+ nMk = pTmp->GetMark()->nNode.GetIndex();
+ xub_StrLen nPtCnt = pTmp->GetPoint()->nContent.GetIndex(),
+ nMkCnt = pTmp->GetMark()->nContent.GetIndex();
+
+ if( nPt < nMk || ( nPt == nMk && nPtCnt < nMkCnt ))
+ {
+ sal_uLong nTmp = nMk; nMk = nPt; nPt = nTmp;
+ nTmp = nMkCnt; nMkCnt = nPtCnt; nPtCnt = (xub_StrLen)nTmp;
+ }
+
+ if( nMk <= nNdIdx && nNdIdx <= nPt &&
+ ( STRING_NOTFOUND == nCntntPos ||
+ ( nMkCnt <= nCntntPos && nCntntPos <= nPtCnt )))
+ {
+ pRet = pTmp;
+ break;
+ }
+ } while( pExtInputRing != (pTmp = (SwExtTextInput*)pExtInputRing ) );
+ }
+ return pRet;
+}
+
+SwExtTextInput* SwDoc::GetExtTextInput() const
+{
+ ASSERT( !pExtInputRing || pExtInputRing == pExtInputRing->GetNext(),
+ "more then one InputEngine available" );
+ return (SwExtTextInput*)pExtInputRing;
+}
+
+
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
new file mode 100644
index 000000000000..19638c159bc1
--- /dev/null
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -0,0 +1,716 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <hintids.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <doc.hxx> // fuer GetAttrPool
+#include <errhdl.hxx>
+#include <fmtcol.hxx>
+#include <fmtcolfunc.hxx>
+#include <hints.hxx>
+#include <calc.hxx>
+#include <node.hxx>
+#include <numrule.hxx>
+#include <paratr.hxx>
+#include <switerator.hxx>
+#include <svl/intitem.hxx>
+
+TYPEINIT1( SwTxtFmtColl, SwFmtColl );
+TYPEINIT1( SwGrfFmtColl, SwFmtColl );
+TYPEINIT1( SwConditionTxtFmtColl, SwTxtFmtColl );
+TYPEINIT1( SwCollCondition, SwClient );
+
+SV_IMPL_PTRARR( SwFmtCollConditions, SwCollConditionPtr );
+
+// --> OD 2008-03-04 #refactorlists#
+namespace TxtFmtCollFunc
+{
+
+ // --> OD 2006-11-22 #i71574#
+ void CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle(
+ SwFmt* pFmt,
+ const SwNumRuleItem* pNewNumRuleItem )
+ {
+ SwTxtFmtColl* pTxtFmtColl = dynamic_cast<SwTxtFmtColl*>(pFmt);
+ if ( !pTxtFmtColl )
+ {
+ #if OSL_DEBUG_LEVEL > 1
+ ASSERT( false,
+ "<TxtFmtCollFunc::CheckTxtFmtCollFuncForDeletionOfAssignmentToOutlineStyle> - misuse of method - it's only for instances of <SwTxtFmtColl>" );
+ #endif
+ return;
+ }
+
+ // --> OD 2007-01-24 #i73790#
+ // if ( pTxtFmtColl->AssignedToListLevelOfOutlineStyle() )
+ if ( !pTxtFmtColl->StayAssignedToListLevelOfOutlineStyle() &&
+ pTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() )
+ // <--
+ {
+ if ( !pNewNumRuleItem )
+ {
+ pTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, sal_False, (const SfxPoolItem**)&pNewNumRuleItem );
+ }
+ if ( pNewNumRuleItem )
+ {
+ String sNumRuleName = pNewNumRuleItem->GetValue();
+ if ( sNumRuleName.Len() == 0 ||
+ sNumRuleName != pTxtFmtColl->GetDoc()->GetOutlineNumRule()->GetName() )
+ {
+ // delete assignment of paragraph style to list level of outline style.
+ pTxtFmtColl->DeleteAssignmentToListLevelOfOutlineStyle();
+ }
+ }
+ }
+ }
+ // <--
+
+ SwNumRule* GetNumRule( SwTxtFmtColl& rTxtFmtColl )
+ {
+ SwNumRule* pNumRule( 0 );
+
+ const SwNumRuleItem* pNumRuleItem( 0 );
+ rTxtFmtColl.GetItemState( RES_PARATR_NUMRULE, sal_False, (const SfxPoolItem**)&pNumRuleItem );
+ if ( pNumRuleItem )
+ {
+ const String sNumRuleName = pNumRuleItem->GetValue();
+ if ( sNumRuleName.Len() > 0 )
+ {
+ pNumRule = rTxtFmtColl.GetDoc()->FindNumRulePtr( sNumRuleName );
+ }
+ }
+
+ return pNumRule;
+ }
+
+ void AddToNumRule( SwTxtFmtColl& rTxtFmtColl )
+ {
+ SwNumRule* pNumRule = GetNumRule( rTxtFmtColl );
+ if ( pNumRule )
+ {
+ pNumRule->AddParagraphStyle( rTxtFmtColl );
+ }
+ }
+
+ void RemoveFromNumRule( SwTxtFmtColl& rTxtFmtColl )
+ {
+ SwNumRule* pNumRule = GetNumRule( rTxtFmtColl );
+ if ( pNumRule )
+ {
+ pNumRule->RemoveParagraphStyle( rTxtFmtColl );
+ }
+ }
+} // end of namespace TxtFmtCollFunc
+// <--
+
+/*
+ * SwTxtFmtColl TXT
+ */
+
+void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+{
+ if( GetDoc()->IsInDtor() )
+ {
+ SwFmtColl::Modify( pOld, pNew );
+ return;
+ }
+
+ // --> OD 2006-06-16 #i66431# - adjust type of <bNewParent>
+ bool bNewParent( false );
+ // <--
+ SvxULSpaceItem *pNewULSpace = 0, *pOldULSpace = 0;
+ SvxLRSpaceItem *pNewLRSpace = 0, *pOldLRSpace = 0;
+ SvxFontHeightItem* aFontSizeArr[3] = {0,0,0};
+ // --> OD 2006-10-17 #i70223#
+ const bool bAssignedToListLevelOfOutlineStyle(IsAssignedToListLevelOfOutlineStyle());//#outline level ,zhaojianwei
+ const SwNumRuleItem* pNewNumRuleItem( 0L );
+ // <--
+
+ SwAttrSetChg *pNewChgSet = 0, *pOldChgSet = 0;
+
+ switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 )
+ {
+ case RES_ATTRSET_CHG:
+ // nur neu berechnen, wenn nicht wir der "Versender" sind !!!
+ pNewChgSet = (SwAttrSetChg*)pNew;
+ pOldChgSet = (SwAttrSetChg*)pOld;
+ pNewChgSet->GetChgSet()->GetItemState(
+ RES_LR_SPACE, sal_False, (const SfxPoolItem**)&pNewLRSpace );
+ pNewChgSet->GetChgSet()->GetItemState(
+ RES_UL_SPACE, sal_False, (const SfxPoolItem**)&pNewULSpace );
+ pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_FONTSIZE,
+ sal_False, (const SfxPoolItem**)&(aFontSizeArr[0]) );
+ pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_CJK_FONTSIZE,
+ sal_False, (const SfxPoolItem**)&(aFontSizeArr[1]) );
+ pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_CTL_FONTSIZE,
+ sal_False, (const SfxPoolItem**)&(aFontSizeArr[2]) );
+ // --> OD 2006-10-17 #i70223#
+ // --> OD 2007-12-19 #i84745#
+ // check, if attribute set is applied to this paragraph style
+ if ( bAssignedToListLevelOfOutlineStyle &&
+ pNewChgSet->GetTheChgdSet() == &GetAttrSet() )
+ {
+ pNewChgSet->GetChgSet()->GetItemState( RES_PARATR_NUMRULE, sal_False,
+ (const SfxPoolItem**)&pNewNumRuleItem );
+ }
+ // <--
+
+ break;
+
+ case RES_FMT_CHG:
+ if( GetAttrSet().GetParent() )
+ {
+ const SfxItemSet* pParent = GetAttrSet().GetParent();
+ pNewLRSpace = (SvxLRSpaceItem*)&pParent->Get( RES_LR_SPACE );
+ pNewULSpace = (SvxULSpaceItem*)&pParent->Get( RES_UL_SPACE );
+ aFontSizeArr[0] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_FONTSIZE );
+ aFontSizeArr[1] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_CJK_FONTSIZE );
+ aFontSizeArr[2] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_CTL_FONTSIZE );
+ // --> OD 2006-06-16 #i66431#
+ // modify has to be propagated, because of new parent format.
+ bNewParent = true;
+ // <--
+ }
+ break;
+
+ case RES_LR_SPACE:
+ pNewLRSpace = (SvxLRSpaceItem*)pNew;
+ break;
+ case RES_UL_SPACE:
+ pNewULSpace = (SvxULSpaceItem*)pNew;
+ break;
+ case RES_CHRATR_FONTSIZE:
+ aFontSizeArr[0] = (SvxFontHeightItem*)pNew;
+ break;
+ case RES_CHRATR_CJK_FONTSIZE:
+ aFontSizeArr[1] = (SvxFontHeightItem*)pNew;
+ break;
+ case RES_CHRATR_CTL_FONTSIZE:
+ aFontSizeArr[2] = (SvxFontHeightItem*)pNew;
+ break;
+ // --> OD 2006-10-17 #i70223#
+ case RES_PARATR_NUMRULE:
+ {
+ if ( bAssignedToListLevelOfOutlineStyle )
+ {
+ pNewNumRuleItem = (SwNumRuleItem*)pNew;
+ }
+ }
+ default:
+ break;
+ }
+
+ // --> OD 2006-10-17 #i70223#
+ if ( bAssignedToListLevelOfOutlineStyle && pNewNumRuleItem )
+ {
+ TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle(
+ this, pNewNumRuleItem );
+ }
+ // <--
+
+ int bWeiter = sal_True;
+
+ // dann pruefe doch mal gegen die eigenen Attribute
+ if( pNewLRSpace && SFX_ITEM_SET == GetItemState( RES_LR_SPACE, sal_False,
+ (const SfxPoolItem**)&pOldLRSpace ))
+ {
+ int bChg = sal_False;
+ if( pOldLRSpace != pNewLRSpace ) // verhinder Rekursion (SetAttr!!)
+ {
+ SvxLRSpaceItem aNew( *pOldLRSpace );
+ // wir hatten eine relative Angabe -> neu berechnen
+ if( 100 != aNew.GetPropLeft() )
+ {
+ long nTmp = aNew.GetLeft(); // alten zum Vergleichen
+ aNew.SetLeft( pNewLRSpace->GetLeft(), aNew.GetPropLeft() );
+ bChg |= nTmp != aNew.GetLeft();
+ }
+ // wir hatten eine relative Angabe -> neu berechnen
+ if( 100 != aNew.GetPropRight() )
+ {
+ long nTmp = aNew.GetRight(); // alten zum Vergleichen
+ aNew.SetRight( pNewLRSpace->GetRight(), aNew.GetPropRight() );
+ bChg |= nTmp != aNew.GetRight();
+ }
+ // wir hatten eine relative Angabe -> neu berechnen
+ if( 100 != aNew.GetPropTxtFirstLineOfst() )
+ {
+ short nTmp = aNew.GetTxtFirstLineOfst(); // alten zum Vergleichen
+ aNew.SetTxtFirstLineOfst( pNewLRSpace->GetTxtFirstLineOfst(),
+ aNew.GetPropTxtFirstLineOfst() );
+ bChg |= nTmp != aNew.GetTxtFirstLineOfst();
+ }
+ if( bChg )
+ {
+ SetFmtAttr( aNew );
+ bWeiter = 0 != pOldChgSet || bNewParent;
+ }
+ // bei uns absolut gesetzt -> nicht weiter propagieren, es sei
+ // denn es wird bei uns gesetzt!
+ else if( pNewChgSet )
+ bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
+ }
+ }
+
+ if( pNewULSpace && SFX_ITEM_SET == GetItemState(
+ RES_UL_SPACE, sal_False, (const SfxPoolItem**)&pOldULSpace ) &&
+ pOldULSpace != pNewULSpace ) // verhinder Rekursion (SetAttr!!)
+ {
+ SvxULSpaceItem aNew( *pOldULSpace );
+ int bChg = sal_False;
+ // wir hatten eine relative Angabe -> neu berechnen
+ if( 100 != aNew.GetPropUpper() )
+ {
+ sal_uInt16 nTmp = aNew.GetUpper(); // alten zum Vergleichen
+ aNew.SetUpper( pNewULSpace->GetUpper(), aNew.GetPropUpper() );
+ bChg |= nTmp != aNew.GetUpper();
+ }
+ // wir hatten eine relative Angabe -> neu berechnen
+ if( 100 != aNew.GetPropLower() )
+ {
+ sal_uInt16 nTmp = aNew.GetLower(); // alten zum Vergleichen
+ aNew.SetLower( pNewULSpace->GetLower(), aNew.GetPropLower() );
+ bChg |= nTmp != aNew.GetLower();
+ }
+ if( bChg )
+ {
+ SetFmtAttr( aNew );
+ bWeiter = 0 != pOldChgSet || bNewParent;
+ }
+ // bei uns absolut gesetzt -> nicht weiter propagieren, es sei
+ // denn es wird bei uns gesetzt!
+ else if( pNewChgSet )
+ bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
+ }
+
+
+ for( int nC = 0, nArrLen = sizeof(aFontSizeArr) / sizeof( aFontSizeArr[0]);
+ nC < nArrLen; ++nC )
+ {
+ SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize;
+ if( pFSize && SFX_ITEM_SET == GetItemState(
+ pFSize->Which(), sal_False, (const SfxPoolItem**)&pOldFSize ) &&
+ // verhinder Rekursion (SetAttr!!)
+ pFSize != pOldFSize )
+ {
+ if( 100 == pOldFSize->GetProp() &&
+ SFX_MAPUNIT_RELATIVE == pOldFSize->GetPropUnit() )
+ {
+ // bei uns absolut gesetzt -> nicht weiter propagieren, es sei
+ // denn es wird bei uns gesetzt!
+ if( pNewChgSet )
+ bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
+ }
+ else
+ {
+ // wir hatten eine relative Angabe -> neu berechnen
+ sal_uInt32 nTmp = pOldFSize->GetHeight(); // alten zum Vergleichen
+ SvxFontHeightItem aNew(240 , 100, pFSize->Which());
+ aNew.SetHeight( pFSize->GetHeight(), pOldFSize->GetProp(),
+ pOldFSize->GetPropUnit() );
+ if( nTmp != aNew.GetHeight() )
+ {
+ SetFmtAttr( aNew );
+ bWeiter = 0 != pOldChgSet || bNewParent;
+ }
+ // bei uns absolut gesetzt -> nicht weiter propagieren, es sei
+ // denn es wird bei uns gesetzt!
+ else if( pNewChgSet )
+ bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
+ }
+ }
+ }
+
+ if( bWeiter )
+ SwFmtColl::Modify( pOld, pNew );
+}
+
+sal_Bool SwTxtFmtColl::IsAtDocNodeSet() const
+{
+ SwIterator<SwCntntNode,SwFmtColl> aIter( *this );
+ const SwNodes& rNds = GetDoc()->GetNodes();
+ for( SwCntntNode* pNode = aIter.First(); pNode; pNode = aIter.Next() )
+ if( &(pNode->GetNodes()) == &rNds )
+ return sal_True;
+
+ return sal_False;
+}
+
+// --> OD 2008-03-04 #refactorlists#
+sal_Bool SwTxtFmtColl::SetFmtAttr( const SfxPoolItem& rAttr )
+{
+ const bool bIsNumRuleItem = rAttr.Which() == RES_PARATR_NUMRULE;
+ if ( bIsNumRuleItem )
+ {
+ TxtFmtCollFunc::RemoveFromNumRule( *this );
+ }
+
+ const sal_Bool bRet = SwFmtColl::SetFmtAttr( rAttr );
+
+ if ( bIsNumRuleItem )
+ {
+ TxtFmtCollFunc::AddToNumRule( *this );
+ }
+
+ return bRet;
+}
+
+sal_Bool SwTxtFmtColl::SetFmtAttr( const SfxItemSet& rSet )
+{
+ const bool bIsNumRuleItemAffected =
+ rSet.GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET;
+ if ( bIsNumRuleItemAffected )
+ {
+ TxtFmtCollFunc::RemoveFromNumRule( *this );
+ }
+
+ const sal_Bool bRet = SwFmtColl::SetFmtAttr( rSet );
+
+ if ( bIsNumRuleItemAffected )
+ {
+ TxtFmtCollFunc::AddToNumRule( *this );
+ }
+
+ return bRet;
+}
+
+sal_Bool SwTxtFmtColl::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
+{
+ const bool bIsNumRuleItemAffected =
+ ( nWhich2 != 0 && nWhich2 > nWhich1 )
+ ? ( nWhich1 <= RES_PARATR_NUMRULE &&
+ RES_PARATR_NUMRULE <= nWhich2 )
+ : nWhich1 == RES_PARATR_NUMRULE;
+ if ( bIsNumRuleItemAffected )
+ {
+ TxtFmtCollFunc::RemoveFromNumRule( *this );
+ }
+
+ const sal_Bool bRet = SwFmtColl::ResetFmtAttr( nWhich1, nWhich2 );
+
+ return bRet;
+}
+// <--
+
+// --> OD 2007-01-24 #i73790#
+sal_uInt16 SwTxtFmtColl::ResetAllFmtAttr()
+{
+ const bool bOldState( mbStayAssignedToListLevelOfOutlineStyle );
+ mbStayAssignedToListLevelOfOutlineStyle = true;
+ // --> OD 2008-12-16 #i70748#
+ // Outline level is no longer a member, it is a attribute now.
+ // Thus, it needs to be restored, if the paragraph style is assigned
+ // to the outline style
+ const int nAssignedOutlineStyleLevel = IsAssignedToListLevelOfOutlineStyle()
+ ? GetAssignedOutlineStyleLevel()
+ : -1;
+ // <--
+
+ sal_uInt16 nRet = SwFmtColl::ResetAllFmtAttr();
+
+ // --> OD 2008-12-16 #i70748#
+ if ( nAssignedOutlineStyleLevel != -1 )
+ {
+ AssignToListLevelOfOutlineStyle( nAssignedOutlineStyleLevel );
+ }
+ // <--
+
+ mbStayAssignedToListLevelOfOutlineStyle = bOldState;
+
+ return nRet;
+}
+// <--
+
+// --> OD 2008-02-13 #newlistlevelattrs#
+bool SwTxtFmtColl::AreListLevelIndentsApplicable() const
+{
+ bool bAreListLevelIndentsApplicable( true );
+
+ if ( GetItemState( RES_PARATR_NUMRULE ) != SFX_ITEM_SET )
+ {
+ // no list style applied to paragraph style
+ bAreListLevelIndentsApplicable = false;
+ }
+ else if ( GetItemState( RES_LR_SPACE, sal_False ) == SFX_ITEM_SET )
+ {
+ // paragraph style has hard-set indent attributes
+ bAreListLevelIndentsApplicable = false;
+ }
+ else if ( GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET )
+ {
+ // list style is directly applied to paragraph style and paragraph
+ // style has no hard-set indent attributes
+ bAreListLevelIndentsApplicable = true;
+ }
+ else
+ {
+ // list style is applied through one of the parent paragraph styles and
+ // paragraph style has no hard-set indent attributes
+
+ // check parent paragraph styles
+ const SwTxtFmtColl* pColl = dynamic_cast<const SwTxtFmtColl*>(DerivedFrom());
+ while ( pColl )
+ {
+ if ( pColl->GetAttrSet().GetItemState( RES_LR_SPACE, sal_False ) == SFX_ITEM_SET )
+ {
+ // indent attributes found in the paragraph style hierarchy.
+ bAreListLevelIndentsApplicable = false;
+ break;
+ }
+
+ if ( pColl->GetAttrSet().GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET )
+ {
+ // paragraph style with the list style found and until now no
+ // indent attributes are found in the paragraph style hierarchy.
+ bAreListLevelIndentsApplicable = true;
+ break;
+ }
+
+ pColl = dynamic_cast<const SwTxtFmtColl*>(pColl->DerivedFrom());
+ ASSERT( pColl,
+ "<SwTxtFmtColl::AreListLevelIndentsApplicable()> - something wrong in paragraph style hierarchy. The applied list style is not found." );
+ }
+ }
+
+ return bAreListLevelIndentsApplicable;
+}
+// <--
+
+//FEATURE::CONDCOLL
+
+SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
+ sal_uLong nSubCond )
+ : SwClient( pColl ), nCondition( nMasterCond )
+{
+ aSubCondition.nSubCondition = nSubCond;
+}
+
+
+SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
+ const String& rSubExp )
+ : SwClient( pColl ), nCondition( nMasterCond )
+{
+ if( USRFLD_EXPRESSION & nCondition )
+ aSubCondition.pFldExpression = new String( rSubExp );
+ else
+ aSubCondition.nSubCondition = 0;
+}
+
+
+SwCollCondition::SwCollCondition( const SwCollCondition& rCopy )
+ : SwClient( (SwModify*)rCopy.GetRegisteredIn() ), nCondition( rCopy.nCondition )
+{
+ if( USRFLD_EXPRESSION & rCopy.nCondition )
+ aSubCondition.pFldExpression = new String( *rCopy.GetFldExpression() );
+ else
+ aSubCondition.nSubCondition = rCopy.aSubCondition.nSubCondition;
+}
+
+
+SwCollCondition::~SwCollCondition()
+{
+ if( USRFLD_EXPRESSION & nCondition )
+ delete aSubCondition.pFldExpression;
+}
+
+void SwCollCondition::RegisterToFormat( SwFmt& rFmt )
+{
+ rFmt.Add( this );
+}
+
+
+
+int SwCollCondition::operator==( const SwCollCondition& rCmp ) const
+{
+ int nRet = 0;
+ if( nCondition == rCmp.nCondition )
+ {
+ if( USRFLD_EXPRESSION & nCondition )
+ {
+ // in der SubCondition steht die Expression fuer das UserFeld
+ const String* pTmp = aSubCondition.pFldExpression;
+ if( !pTmp )
+ pTmp = rCmp.aSubCondition.pFldExpression;
+ if( pTmp )
+ {
+ SwTxtFmtColl* pColl = GetTxtFmtColl();
+ if( !pColl )
+ pColl = rCmp.GetTxtFmtColl();
+
+ if( pColl )
+ {
+ SwCalc aCalc( *pColl->GetDoc() );
+ nRet = 0 != aCalc.Calculate( *pTmp ).GetBool();
+ }
+ }
+ }
+ else if( aSubCondition.nSubCondition ==
+ rCmp.aSubCondition.nSubCondition )
+ nRet = 1;
+ }
+ return nRet;
+}
+
+
+void SwCollCondition::SetCondition( sal_uLong nCond, sal_uLong nSubCond )
+{
+ if( USRFLD_EXPRESSION & nCondition )
+ delete aSubCondition.pFldExpression;
+ nCondition = nCond;
+ aSubCondition.nSubCondition = nSubCond;
+}
+
+
+SwConditionTxtFmtColl::~SwConditionTxtFmtColl()
+{
+}
+
+const SwCollCondition* SwConditionTxtFmtColl::HasCondition(
+ const SwCollCondition& rCond ) const
+{
+ const SwCollCondition* pFnd = 0;
+ sal_uInt16 n;
+
+ for( n = 0; n < aCondColls.Count(); ++n )
+ if( *( pFnd = aCondColls[ n ]) == rCond )
+ break;
+
+ return n < aCondColls.Count() ? pFnd : 0;
+}
+
+
+void SwConditionTxtFmtColl::InsertCondition( const SwCollCondition& rCond )
+{
+ for( sal_uInt16 n = 0; n < aCondColls.Count(); ++n )
+ if( *aCondColls[ n ] == rCond )
+ {
+ aCondColls.DeleteAndDestroy( n );
+ break;
+ }
+
+ // nicht gefunden -> als einfuegen
+ SwCollCondition* pNew = new SwCollCondition( rCond );
+ aCondColls.Insert( pNew, aCondColls.Count() );
+}
+
+
+sal_Bool SwConditionTxtFmtColl::RemoveCondition( const SwCollCondition& rCond )
+{
+ sal_Bool bRet = sal_False;
+ for( sal_uInt16 n = 0; n < aCondColls.Count(); ++n )
+ if( *aCondColls[ n ] == rCond )
+ {
+ aCondColls.DeleteAndDestroy( n );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls )
+{
+ // Kopiere noch die Bedingungen
+ // aber erst die alten loeschen!
+ if( aCondColls.Count() )
+ aCondColls.DeleteAndDestroy( 0, aCondColls.Count() );
+ SwDoc& rDoc = *GetDoc();
+ for( sal_uInt16 n = 0; n < rCndClls.Count(); ++n )
+ {
+ SwCollCondition* pFnd = rCndClls[ n ];
+ SwTxtFmtColl* pTmpColl = pFnd->GetTxtFmtColl()
+ ? rDoc.CopyTxtColl( *pFnd->GetTxtFmtColl() )
+ : 0;
+ SwCollCondition* pNew;
+ if( USRFLD_EXPRESSION & pFnd->GetCondition() )
+ pNew = new SwCollCondition( pTmpColl, pFnd->GetCondition(),
+ *pFnd->GetFldExpression() );
+ else
+ pNew = new SwCollCondition( pTmpColl, pFnd->GetCondition(),
+ pFnd->GetSubCondition() );
+ aCondColls.Insert( pNew, n );
+ }
+}
+//#outline level, zhaojianwei
+void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel)
+{
+ ASSERT( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtFmtColl: Level Out Of Range" );
+ SetFmtAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL,
+ static_cast<sal_uInt16>(nLevel) ) );
+}
+
+int SwTxtFmtColl::GetAttrOutlineLevel() const
+{
+ return ((const SfxUInt16Item &)GetFmtAttr(RES_PARATR_OUTLINELEVEL)).GetValue();
+}
+
+int SwTxtFmtColl::GetAssignedOutlineStyleLevel() const
+{
+ ASSERT( IsAssignedToListLevelOfOutlineStyle(),
+ "<SwTxtFmtColl::GetAssignedOutlineStyleLevel()> - misuse of method");
+ return GetAttrOutlineLevel() - 1;
+}
+
+void SwTxtFmtColl::AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
+{
+ mbAssignedToOutlineStyle = true;
+ SetAttrOutlineLevel(nAssignedListLevel+1);
+
+ // --> OD 2009-03-18 #i100277#
+ SwIterator<SwTxtFmtColl,SwFmtColl> aIter( *this );
+ SwTxtFmtColl* pDerivedTxtFmtColl = aIter.First();
+ while ( pDerivedTxtFmtColl != 0 )
+ {
+ if ( !pDerivedTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() )
+ {
+ if ( pDerivedTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_DEFAULT )
+ {
+ SwNumRuleItem aItem(aEmptyStr);
+ pDerivedTxtFmtColl->SetFmtAttr( aItem );
+ }
+ if ( pDerivedTxtFmtColl->GetItemState( RES_PARATR_OUTLINELEVEL, sal_False ) == SFX_ITEM_DEFAULT )
+ {
+ pDerivedTxtFmtColl->SetAttrOutlineLevel( 0 );
+ }
+ }
+
+ pDerivedTxtFmtColl = aIter.Next();
+ }
+ // <--
+}
+
+void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle()
+{
+ mbAssignedToOutlineStyle = false;
+ ResetFmtAttr(RES_PARATR_OUTLINELEVEL);
+}
+//<-end,zhaojianwei
+
+//FEATURE::CONDCOLL
diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx
new file mode 100644
index 000000000000..40579fddd960
--- /dev/null
+++ b/sw/source/core/doc/ftnidx.cxx
@@ -0,0 +1,399 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <ftninfo.hxx>
+#include <doc.hxx>
+#include <ftnidx.hxx>
+#include <ndtxt.hxx>
+#include <ndindex.hxx>
+#include <section.hxx>
+#include <fmtftntx.hxx>
+#include <rootfrm.hxx>
+
+
+_SV_IMPL_SORTAR_ALG( _SwFtnIdxs, SwTxtFtnPtr )
+sal_Bool _SwFtnIdxs::Seek_Entry( const SwTxtFtnPtr rSrch, sal_uInt16* pFndPos ) const
+{
+ sal_uLong nIdx = _SwTxtFtn_GetIndex( rSrch );
+ xub_StrLen nCntIdx = *rSrch->GetStart();
+
+ sal_uInt16 nO = Count(), nM, nU = 0;
+ if( nO > 0 )
+ {
+ nO--;
+ while( nU <= nO )
+ {
+ nM = nU + ( nO - nU ) / 2;
+ sal_uLong nFndIdx = _SwTxtFtn_GetIndex( (*this)[ nM ] );
+ if( nFndIdx == nIdx && *(*this)[ nM ]->GetStart() == nCntIdx )
+ {
+ if( pFndPos )
+ *pFndPos = nM;
+ return sal_True;
+ }
+ else if( nFndIdx < nIdx ||
+ (nFndIdx == nIdx && *(*this)[ nM ]->GetStart() < nCntIdx ))
+ nU = nM + 1;
+ else if( nM == 0 )
+ {
+ if( pFndPos )
+ *pFndPos = nU;
+ return sal_False;
+ }
+ else
+ nO = nM - 1;
+ }
+ }
+ if( pFndPos )
+ *pFndPos = nU;
+ return sal_False;
+}
+
+
+void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt )
+{
+ if( !Count() )
+ return;
+
+ // besorge erstmal das Nodes-Array ueber den StartIndex der ersten Fussnote
+ SwDoc* pDoc = rStt.GetNode().GetDoc();
+ if( pDoc->IsInReading() )
+ return ;
+ SwTxtFtn* pTxtFtn;
+
+ const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
+ const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo();
+
+ //Fuer normale Fussnoten werden Chapter- und Dokumentweise Nummerierung
+ //getrennt behandelt. Fuer Endnoten gibt es nur die Dokumentweise
+ //Nummerierung.
+ if( FTNNUM_CHAPTER == rFtnInfo.eNum )
+ {
+ const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
+ const SwNode* pCapStt = &pDoc->GetNodes().GetEndOfExtras();
+ sal_uLong nCapEnd = pDoc->GetNodes().GetEndOfContent().GetIndex();
+ if( rOutlNds.Count() )
+ {
+ // suche den Start des Kapitels, in den rStt steht.
+ sal_uInt16 n;
+
+ for( n = 0; n < rOutlNds.Count(); ++n )
+ if( rOutlNds[ n ]->GetIndex() > rStt.GetIndex() )
+ break; // gefunden
+ //else if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() ) //#outline level,zhaojianwei
+ else if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 ) //<-end,zhaojianwei
+ pCapStt = rOutlNds[ n ]; // Start eines neuen Kapitels
+ // dann suche jetzt noch das Ende vom Bereich
+ for( ; n < rOutlNds.Count(); ++n )
+ //if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei
+ if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei
+ {
+ nCapEnd = rOutlNds[ n ]->GetIndex(); // Ende des gefundenen Kapitels
+ break;
+ }
+ }
+
+ sal_uInt16 nPos, nFtnNo = 1;
+ if( SeekEntry( *pCapStt, &nPos ) && nPos )
+ {
+ // gehe nach vorne bis der Index nicht mehr gleich ist
+ const SwNode* pCmpNd = &rStt.GetNode();
+ while( nPos && pCmpNd == &((*this)[ --nPos ]->GetTxtNode()) )
+ ;
+ ++nPos;
+ }
+
+ if( nPos == Count() ) // nichts gefunden
+ return;
+
+ if( !rOutlNds.Count() )
+ nFtnNo = nPos+1;
+
+ for( ; nPos < Count(); ++nPos )
+ {
+ pTxtFtn = (*this)[ nPos ];
+ if( pTxtFtn->GetTxtNode().GetIndex() >= nCapEnd )
+ break;
+
+ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+ if( !rFtn.GetNumStr().Len() && !rFtn.IsEndNote() &&
+ !SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr( *pTxtFtn ))
+ pTxtFtn->SetNumber( rFtnInfo.nFtnOffset + nFtnNo++,
+ &rFtn.GetNumStr() );
+ }
+ }
+
+ SwUpdFtnEndNtAtEnd aNumArr;
+
+ // sal_Bool, damit hier auch bei Chapter-Einstellung die Endnoten
+ // durchlaufen.
+ const sal_Bool bEndNoteOnly = FTNNUM_DOC != rFtnInfo.eNum;
+
+ sal_uInt16 nPos, nFtnNo = 1, nEndNo = 1;
+ sal_uLong nUpdNdIdx = rStt.GetIndex();
+ for( nPos = 0; nPos < Count(); ++nPos )
+ {
+ pTxtFtn = (*this)[ nPos ];
+ if( nUpdNdIdx <= pTxtFtn->GetTxtNode().GetIndex() )
+ break;
+
+ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+ if( !rFtn.GetNumStr().Len() )
+ {
+ if( !aNumArr.ChkNumber( *pTxtFtn ) )
+ {
+ if( pTxtFtn->GetFtn().IsEndNote() )
+ nEndNo++;
+ else
+ nFtnNo++;
+ }
+ }
+ }
+
+ // ab nPos bei allen FootNotes die Array-Nummer setzen
+ for( ; nPos < Count(); ++nPos )
+ {
+ pTxtFtn = (*this)[ nPos ];
+ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+ if( !rFtn.GetNumStr().Len() )
+ {
+ sal_uInt16 nSectNo = aNumArr.ChkNumber( *pTxtFtn );
+ if( !nSectNo && ( rFtn.IsEndNote() || !bEndNoteOnly ))
+ nSectNo = rFtn.IsEndNote()
+ ? rEndInfo.nFtnOffset + nEndNo++
+ : rFtnInfo.nFtnOffset + nFtnNo++;
+
+ if( nSectNo )
+ {
+ if( rFtn.IsEndNote() )
+ pTxtFtn->SetNumber( nSectNo, &rFtn.GetNumStr() );
+ else
+ pTxtFtn->SetNumber( nSectNo, &rFtn.GetNumStr() );
+ }
+ }
+ }
+ // Pageweise wird vom MA erfuellt !!
+}
+
+
+void SwFtnIdxs::UpdateAllFtn()
+{
+ if( !Count() )
+ return;
+
+ // besorge erstmal das Nodes-Array ueber den StartIndex der
+ // ersten Fussnote
+ SwDoc* pDoc = (SwDoc*) (*this)[ 0 ]->GetTxtNode().GetDoc();
+ SwTxtFtn* pTxtFtn;
+ const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
+ const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo();
+
+ SwUpdFtnEndNtAtEnd aNumArr;
+
+ SwRootFrm* pTmpRoot = pDoc->GetCurrentLayout();//swmod 080305
+ std::set<SwRootFrm*> aAllLayouts = pDoc->GetAllLayouts();
+ //Fuer normale Fussnoten werden Chapter- und Dokumentweise Nummerierung
+ //getrennt behandelt. Fuer Endnoten gibt es nur die Dokumentweise
+ //Nummerierung.
+ if( FTNNUM_CHAPTER == rFtnInfo.eNum )
+ {
+ const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
+ sal_uInt16 nNo = 1, // Nummer fuer die Fussnoten
+ nFtnIdx = 0; // Index in das FtnIdx-Array
+ for( sal_uInt16 n = 0; n < rOutlNds.Count(); ++n )
+ {
+ if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei
+ {
+ sal_uLong nCapStt = rOutlNds[ n ]->GetIndex(); // Start eines neuen Kapitels
+ for( ; nFtnIdx < Count(); ++nFtnIdx )
+ {
+ pTxtFtn = (*this)[ nFtnIdx ];
+ if( pTxtFtn->GetTxtNode().GetIndex() >= nCapStt )
+ break;
+
+ // Endnoten nur Dokumentweise
+ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+ if( !rFtn.IsEndNote() && !rFtn.GetNumStr().Len() &&
+ !SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr( *pTxtFtn ))
+ pTxtFtn->SetNumber( rFtnInfo.nFtnOffset + nNo++,
+ &rFtn.GetNumStr() );
+ }
+ if( nFtnIdx >= Count() )
+ break; // ok alles geupdatet
+ nNo = 1;
+ }
+ }
+
+ for( nNo = 1; nFtnIdx < Count(); ++nFtnIdx )
+ {
+ //Endnoten nur Dokumentweise
+ pTxtFtn = (*this)[ nFtnIdx ];
+ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+ if( !rFtn.IsEndNote() && !rFtn.GetNumStr().Len() &&
+ !SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr( *pTxtFtn ))
+ pTxtFtn->SetNumber( rFtnInfo.nFtnOffset + nNo++,
+ &rFtn.GetNumStr() );
+ }
+
+ }
+
+ // sal_Bool, damit hier auch bei Chapter-Einstellung die Endnoten
+ // durchlaufen.
+ const sal_Bool bEndNoteOnly = FTNNUM_DOC != rFtnInfo.eNum;
+ sal_uInt16 nFtnNo = 0, nEndNo = 0;
+ for( sal_uInt16 nPos = 0; nPos < Count(); ++nPos )
+ {
+ pTxtFtn = (*this)[ nPos ];
+ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+ if( !rFtn.GetNumStr().Len() )
+ {
+ sal_uInt16 nSectNo = aNumArr.ChkNumber( *pTxtFtn );
+ if( !nSectNo && ( rFtn.IsEndNote() || !bEndNoteOnly ))
+ nSectNo = rFtn.IsEndNote()
+ ? rEndInfo.nFtnOffset + (++nEndNo)
+ : rFtnInfo.nFtnOffset + (++nFtnNo);
+
+ if( nSectNo )
+ {
+ if( rFtn.IsEndNote() )
+ pTxtFtn->SetNumber( nSectNo, &rFtn.GetNumStr() );
+ else
+ pTxtFtn->SetNumber( nSectNo, &rFtn.GetNumStr() );
+ }
+ }
+ }
+
+ if( pTmpRoot && FTNNUM_PAGE == rFtnInfo.eNum )
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::UpdateFtnNums));//swmod 0
+}
+
+SwTxtFtn* SwFtnIdxs::SeekEntry( const SwNodeIndex& rPos, sal_uInt16* pFndPos ) const
+{
+ sal_uLong nIdx = rPos.GetIndex();
+
+ sal_uInt16 nO = Count(), nM, nU = 0;
+ if( nO > 0 )
+ {
+ nO--;
+ while( nU <= nO )
+ {
+ nM = nU + ( nO - nU ) / 2;
+ sal_uLong nNdIdx = _SwTxtFtn_GetIndex( (*this)[ nM ] );
+ if( nNdIdx == nIdx )
+ {
+ if( pFndPos )
+ *pFndPos = nM;
+ return (*this)[ nM ];
+ }
+ else if( nNdIdx < nIdx )
+ nU = nM + 1;
+ else if( nM == 0 )
+ {
+ if( pFndPos )
+ *pFndPos = nU;
+ return 0;
+ }
+ else
+ nO = nM - 1;
+ }
+ }
+ if( pFndPos )
+ *pFndPos = nU;
+ return 0;
+}
+
+/* */
+
+const SwSectionNode* SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr(
+ const SwTxtFtn& rTxtFtn )
+{
+ sal_uInt16 nWh = static_cast<sal_uInt16>( rTxtFtn.GetFtn().IsEndNote() ?
+ RES_END_AT_TXTEND : RES_FTN_AT_TXTEND );
+ sal_uInt16 nVal;
+ const SwSectionNode* pNd = rTxtFtn.GetTxtNode().FindSectionNode();
+ while( pNd && FTNEND_ATTXTEND_OWNNUMSEQ != ( nVal =
+ ((const SwFmtFtnAtTxtEnd&)pNd->GetSection().GetFmt()->
+ GetFmtAttr( nWh, sal_True )).GetValue() ) &&
+ FTNEND_ATTXTEND_OWNNUMANDFMT != nVal )
+ pNd = pNd->StartOfSectionNode()->FindSectionNode();
+
+ return pNd;
+}
+
+sal_uInt16 SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn,
+ const SwSectionNode& rNd )
+{
+ sal_uInt16 nRet = 0, nWh;
+ SvPtrarr* pArr;
+ SvUShorts* pNum;
+ if( rTxtFtn.GetFtn().IsEndNote() )
+ {
+ pArr = &aEndSects;
+ pNum = &aEndNums;
+ nWh = RES_END_AT_TXTEND;
+ }
+ else
+ {
+ pArr = &aFtnSects;
+ pNum = &aFtnNums;
+ nWh = RES_FTN_AT_TXTEND;
+ }
+ void* pNd = (void*)&rNd;
+
+ for( sal_uInt16 n = pArr->Count(); n; )
+ if( pArr->GetObject( --n ) == pNd )
+ {
+ nRet = ++pNum->GetObject( n );
+ break;
+ }
+
+ if( !nRet )
+ {
+ pArr->Insert( pNd, pArr->Count() );
+ nRet = ((SwFmtFtnEndAtTxtEnd&)rNd.GetSection().GetFmt()->
+ GetFmtAttr( nWh )).GetOffset();
+ ++nRet;
+ pNum->Insert( nRet, pNum->Count() );
+ }
+ return nRet;
+}
+
+sal_uInt16 SwUpdFtnEndNtAtEnd::ChkNumber( const SwTxtFtn& rTxtFtn )
+{
+ const SwSectionNode* pSectNd = FindSectNdWithEndAttr( rTxtFtn );
+ return pSectNd ? GetNumber( rTxtFtn, *pSectNd ) : 0;
+}
+
+
+
+
diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx
new file mode 100644
index 000000000000..607bb4f79c2e
--- /dev/null
+++ b/sw/source/core/doc/gctable.cxx
@@ -0,0 +1,451 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <editeng/boxitem.hxx>
+#include <tblrwcl.hxx>
+#include <swtblfmt.hxx>
+
+
+inline const SvxBorderLine* GetLineTB( const SvxBoxItem* pBox, sal_Bool bTop )
+{
+ return bTop ? pBox->GetTop() : pBox->GetBottom();
+}
+
+
+sal_Bool _SwGCBorder_BoxBrd::CheckLeftBorderOfFormat( const SwFrmFmt& rFmt )
+{
+ const SvxBorderLine* pBrd;
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rFmt.GetItemState( RES_BOX, sal_True, &pItem ) &&
+ 0 != ( pBrd = ((SvxBoxItem*)pItem)->GetLeft() ) )
+ {
+ if( *pBrdLn == *pBrd )
+ bAnyBorderFnd = sal_True;
+ return sal_True;
+ }
+ return sal_False;
+}
+
+
+
+sal_Bool lcl_GCBorder_ChkBoxBrd_L( const SwTableLine*& rpLine, void* pPara )
+{
+ const SwTableBox* pBox = rpLine->GetTabBoxes()[ 0 ];
+ return lcl_GCBorder_ChkBoxBrd_B( pBox, pPara );
+}
+
+sal_Bool lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& rpBox, void* pPara )
+{
+ sal_Bool bRet = sal_True;
+ if( rpBox->GetTabLines().Count() )
+ {
+ for( sal_uInt16 n = 0, nLines = rpBox->GetTabLines().Count();
+ n < nLines && bRet; ++n )
+ {
+ const SwTableLine* pLine = rpBox->GetTabLines()[ n ];
+ bRet = lcl_GCBorder_ChkBoxBrd_L( pLine, pPara );
+ }
+ }
+ else
+ {
+ _SwGCBorder_BoxBrd* pBPara = (_SwGCBorder_BoxBrd*)pPara;
+ bRet = pBPara->CheckLeftBorderOfFormat( *rpBox->GetFrmFmt() );
+ }
+ return bRet;
+}
+
+sal_Bool lcl_GCBorder_GetLastBox_L( const SwTableLine*& rpLine, void* pPara )
+{
+ const SwTableBoxes& rBoxes = rpLine->GetTabBoxes();
+ const SwTableBox* pBox = rBoxes[ rBoxes.Count()-1 ];
+ ::lcl_GCBorder_GetLastBox_B( pBox, pPara );
+ return sal_True;
+}
+
+sal_Bool lcl_GCBorder_GetLastBox_B( const SwTableBox*& rpBox, void* pPara )
+{
+ SwTableLines& rLines = (SwTableLines&)rpBox->GetTabLines();
+ if( rLines.Count() )
+ rLines.ForEach( &lcl_GCBorder_GetLastBox_L, pPara );
+ else
+ ((SwTableBoxes*)pPara)->Insert( rpBox, ((SwTableBoxes*)pPara)->Count() );
+ return sal_True;
+}
+
+// suche das "Ende" der vorgegebene BorderLine. Returnt wird die "Layout"Pos!
+sal_uInt16 lcl_FindEndPosOfBorder( const SwCollectTblLineBoxes& rCollTLB,
+ const SvxBorderLine& rBrdLn, sal_uInt16& rStt, sal_Bool bTop )
+{
+ sal_uInt16 nPos, nLastPos = 0;
+ for( sal_uInt16 nEnd = rCollTLB.Count(); rStt < nEnd; ++rStt )
+ {
+ const SfxPoolItem* pItem;
+ const SvxBorderLine* pBrd;
+ const SwTableBox& rBox = rCollTLB.GetBox( rStt, &nPos );
+
+ if( SFX_ITEM_SET != rBox.GetFrmFmt()->GetItemState(RES_BOX,sal_True, &pItem )
+ || 0 == ( pBrd = GetLineTB( (SvxBoxItem*)pItem, bTop ))
+ || !( *pBrd == rBrdLn ))
+ break;
+ nLastPos = nPos;
+ }
+ return nLastPos;
+}
+
+inline const SvxBorderLine* lcl_GCBorder_GetBorder( const SwTableBox& rBox,
+ sal_Bool bTop,
+ const SfxPoolItem** ppItem )
+{
+ return SFX_ITEM_SET == rBox.GetFrmFmt()->GetItemState( RES_BOX, sal_True, ppItem )
+ ? GetLineTB( (SvxBoxItem*)*ppItem, bTop )
+ : 0;
+}
+
+void lcl_GCBorder_DelBorder( const SwCollectTblLineBoxes& rCollTLB,
+ sal_uInt16& rStt, sal_Bool bTop,
+ const SvxBorderLine& rLine,
+ const SfxPoolItem* pItem,
+ sal_uInt16 nEndPos,
+ SwShareBoxFmts* pShareFmts )
+{
+ SwTableBox* pBox = (SwTableBox*)&rCollTLB.GetBox( rStt );
+ sal_uInt16 nNextPos;
+ const SvxBorderLine* pLn = &rLine;
+
+ do {
+ if( pLn && *pLn == rLine )
+ {
+ SvxBoxItem aBox( *(SvxBoxItem*)pItem );
+ if( bTop )
+ aBox.SetLine( 0, BOX_LINE_TOP );
+ else
+ aBox.SetLine( 0, BOX_LINE_BOTTOM );
+
+ if( pShareFmts )
+ pShareFmts->SetAttr( *pBox, aBox );
+ else
+ pBox->ClaimFrmFmt()->SetFmtAttr( aBox );
+ }
+
+ if( ++rStt >= rCollTLB.Count() )
+ break;
+
+ pBox = (SwTableBox*)&rCollTLB.GetBox( rStt, &nNextPos );
+ if( nNextPos > nEndPos )
+ break;
+
+ pLn = lcl_GCBorder_GetBorder( *pBox, bTop, &pItem );
+
+ } while( sal_True );
+}
+
+
+sal_Bool lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara )
+{
+ _SwGCLineBorder* pGCPara = (_SwGCLineBorder*)pPara;
+
+ // zuerst die rechte Kante mit der linken Kante der naechsten Box
+ // innerhalb dieser Line
+ {
+ _SwGCBorder_BoxBrd aBPara;
+ const SvxBorderLine* pBrd;
+ const SfxPoolItem* pItem;
+ const SwTableBoxes& rBoxes = rpLine->GetTabBoxes();
+ for( sal_uInt16 n = 0, nBoxes = rBoxes.Count() - 1; n < nBoxes; ++n )
+ {
+ SwTableBoxes aBoxes;
+ {
+ const SwTableBox* pBox = rBoxes[ n ];
+ if( pBox->GetSttNd() )
+ aBoxes.Insert( pBox, 0 );
+ else
+ lcl_GCBorder_GetLastBox_B( pBox, &aBoxes );
+ }
+
+ SwTableBox* pBox;
+ for( sal_uInt16 i = aBoxes.Count(); i; )
+ if( SFX_ITEM_SET == (pBox = aBoxes[ --i ])->GetFrmFmt()->
+ GetItemState( RES_BOX, sal_True, &pItem ) &&
+ 0 != ( pBrd = ((SvxBoxItem*)pItem)->GetRight() ) )
+ {
+ aBPara.SetBorder( *pBrd );
+ const SwTableBox* pNextBox = rBoxes[n+1];
+ if( lcl_GCBorder_ChkBoxBrd_B( pNextBox, &aBPara ) &&
+ aBPara.IsAnyBorderFound() )
+ {
+ SvxBoxItem aBox( *(SvxBoxItem*)pItem );
+ aBox.SetLine( 0, BOX_LINE_RIGHT );
+ if( pGCPara->pShareFmts )
+ pGCPara->pShareFmts->SetAttr( *pBox, aBox );
+ else
+ pBox->ClaimFrmFmt()->SetFmtAttr( aBox );
+ }
+ }
+
+ aBoxes.Remove( 0, aBoxes.Count() );
+ }
+ }
+
+ // und jetzt die eigene untere Kante mit der nachfolgenden oberen Kante
+ if( !pGCPara->IsLastLine() )
+ {
+ SwCollectTblLineBoxes aBottom( sal_False );
+ SwCollectTblLineBoxes aTop( sal_True );
+
+ ::lcl_Line_CollectBox( rpLine, &aBottom );
+
+ const SwTableLine* pNextLine = (*pGCPara->pLines)[ pGCPara->nLinePos+1 ];
+ ::lcl_Line_CollectBox( pNextLine, &aTop );
+
+ // dann entferne mal alle "doppelten" gleichen Lines
+ sal_uInt16 nBtmPos, nTopPos,
+ nSttBtm = 0, nSttTop = 0,
+ nEndBtm = aBottom.Count(), nEndTop = aTop.Count();
+
+ const SwTableBox *pBtmBox = &aBottom.GetBox( nSttBtm++, &nBtmPos ),
+ *pTopBox = &aTop.GetBox( nSttTop++, &nTopPos );
+ const SfxPoolItem *pBtmItem = 0, *pTopItem = 0;
+ const SvxBorderLine *pBtmLine(0), *pTopLine(0);
+ sal_Bool bGetTopItem = sal_True, bGetBtmItem = sal_True;
+
+ do {
+ if( bGetBtmItem )
+ pBtmLine = lcl_GCBorder_GetBorder( *pBtmBox, sal_False, &pBtmItem );
+ if( bGetTopItem )
+ pTopLine = lcl_GCBorder_GetBorder( *pTopBox, sal_True, &pTopItem );
+
+ if( pTopLine && pBtmLine && *pTopLine == *pBtmLine )
+ {
+ // dann kann einer entfernt werden, aber welche?
+ sal_uInt16 nSavSttBtm = nSttBtm, nSavSttTop = nSttTop;
+ sal_uInt16 nBtmEndPos = ::lcl_FindEndPosOfBorder( aBottom,
+ *pTopLine, nSttBtm, sal_False );
+ if( !nBtmEndPos ) nBtmEndPos = nBtmPos;
+ sal_uInt16 nTopEndPos = ::lcl_FindEndPosOfBorder( aTop,
+ *pTopLine, nSttTop, sal_True );
+ if( !nTopEndPos ) nTopEndPos = nTopPos;
+
+
+ if( nTopEndPos <= nBtmEndPos )
+ {
+ // dann die TopBorder bis zur BottomEndPos loeschen
+ nSttTop = nSavSttTop;
+ if( nTopPos <= nBtmEndPos )
+ lcl_GCBorder_DelBorder( aTop, --nSttTop, sal_True,
+ *pBtmLine, pTopItem, nBtmEndPos,
+ pGCPara->pShareFmts );
+ else
+ nSttBtm = nSavSttBtm;
+ }
+ else
+ {
+ // sonst die BottomBorder bis zur TopEndPos loeschen
+ nSttBtm = nSavSttBtm;
+ if( nBtmPos <= nTopEndPos )
+ lcl_GCBorder_DelBorder( aBottom, --nSttBtm, sal_False,
+ *pTopLine, pBtmItem, nTopEndPos,
+ pGCPara->pShareFmts );
+ else
+ nSttTop = nSavSttTop;
+ }
+ nTopPos = nBtmPos;
+ }
+
+ if( nTopPos == nBtmPos )
+ {
+ if( nSttBtm >= nEndBtm || nSttTop >= nEndTop )
+ break;
+
+ pBtmBox = &aBottom.GetBox( nSttBtm++, &nBtmPos );
+ pTopBox = &aTop.GetBox( nSttTop++, &nTopPos );
+ bGetTopItem = bGetBtmItem = sal_True;
+ }
+ else if( nTopPos < nBtmPos )
+ {
+ if( nSttTop >= nEndTop )
+ break;
+ pTopBox = &aTop.GetBox( nSttTop++, &nTopPos );
+ bGetTopItem = sal_True;
+ bGetBtmItem = sal_False;
+ }
+ else
+ {
+ if( nSttBtm >= nEndBtm )
+ break;
+ pBtmBox = &aBottom.GetBox( nSttBtm++, &nBtmPos );
+ bGetTopItem = sal_False;
+ bGetBtmItem = sal_True;
+ }
+
+ } while( sal_True );
+ }
+
+ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_GC_Box_Border, pPara );
+
+ ++pGCPara->nLinePos;
+
+ return sal_True;
+}
+
+sal_Bool lcl_GC_Box_Border( const SwTableBox*& rpBox, void* pPara )
+{
+ if( rpBox->GetTabLines().Count() )
+ {
+ _SwGCLineBorder aPara( *rpBox );
+ aPara.pShareFmts = ((_SwGCLineBorder*)pPara)->pShareFmts;
+ ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_GC_Line_Border, &aPara );
+ }
+ return sal_True;
+}
+
+struct _GCLinePara
+{
+ SwTableLines* pLns;
+ SwShareBoxFmts* pShareFmts;
+
+ _GCLinePara( SwTableLines& rLns, _GCLinePara* pPara = 0 )
+ : pLns( &rLns ), pShareFmts( pPara ? pPara->pShareFmts : 0 )
+ {}
+};
+
+sal_Bool lcl_MergeGCBox( const SwTableBox*& rpTblBox, void* pPara )
+{
+ SwTableBox*& rpBox = (SwTableBox*&)rpTblBox;
+ sal_uInt16 n, nLen = rpBox->GetTabLines().Count();
+ if( nLen )
+ {
+ // ACHTUNG: die Anzahl der Lines kann sich aendern!
+ _GCLinePara aPara( rpBox->GetTabLines(), (_GCLinePara*)pPara );
+ for( n = 0; n < rpBox->GetTabLines().Count() &&
+ lcl_MergeGCLine( *(rpBox->GetTabLines().GetData() + n), &aPara );
+ ++n )
+ ;
+
+ if( 1 == rpBox->GetTabLines().Count() )
+ {
+ // Box mit einer Line, dann verschiebe alle Boxen der Line
+ // hinter diese Box in der Parent-Line und loesche diese Box
+ SwTableLine* pInsLine = rpBox->GetUpper();
+ SwTableLine* pCpyLine = rpBox->GetTabLines()[0];
+ sal_uInt16 nInsPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, rpBox );
+ for( n = 0; n < pCpyLine->GetTabBoxes().Count(); ++n )
+ pCpyLine->GetTabBoxes()[n]->SetUpper( pInsLine );
+
+ pInsLine->GetTabBoxes().Insert( &pCpyLine->GetTabBoxes(), nInsPos+1 );
+ pCpyLine->GetTabBoxes().Remove( 0, n );
+ // loesche alte die Box mit der Line
+ pInsLine->GetTabBoxes().DeleteAndDestroy( nInsPos );
+
+ return sal_False; // neu aufsetzen
+ }
+ }
+ return sal_True;
+}
+
+sal_Bool lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara )
+{
+ SwTableLine* pLn = (SwTableLine*)rpLine;
+ sal_uInt16 nLen = pLn->GetTabBoxes().Count();
+ if( nLen )
+ {
+ _GCLinePara* pGCPara = (_GCLinePara*)pPara;
+ while( 1 == nLen )
+ {
+ // es gibt eine Box mit Lines
+ SwTableBox* pBox = pLn->GetTabBoxes()[0];
+ if( !pBox->GetTabLines().Count() )
+ break;
+
+ SwTableLine* pLine = pBox->GetTabLines()[0];
+
+ // pLine wird zu der aktuellen, also der rpLine,
+ // die restlichen werden ins LinesArray hinter der akt.
+ // verschoben.
+ // Das LinesArray ist im pPara!
+ nLen = pBox->GetTabLines().Count();
+
+ SwTableLines& rLns = *pGCPara->pLns;
+ const SwTableLine* pTmp = pLn;
+ sal_uInt16 nInsPos = rLns.GetPos( pTmp );
+ ASSERT( USHRT_MAX != nInsPos, "Line nicht gefunden!" );
+
+ SwTableBox* pUpper = pLn->GetUpper();
+
+ rLns.Remove( nInsPos, 1 ); // die Line dem aus Array loeschen
+ rLns.Insert( &pBox->GetTabLines(), nInsPos );
+
+ // JP 31.03.99: Bug 60000 - die Attribute der zu loeschenden
+ // Line an die "eingefuegten" uebertragen
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pLn->GetFrmFmt()->GetItemState(
+ RES_BACKGROUND, sal_True, &pItem ))
+ {
+ SwTableLines& rBoxLns = pBox->GetTabLines();
+ for( sal_uInt16 nLns = 0; nLns < nLen; ++nLns )
+ if( SFX_ITEM_SET != rBoxLns[ nLns ]->GetFrmFmt()->
+ GetItemState( RES_BACKGROUND, sal_True ))
+ pGCPara->pShareFmts->SetAttr( *rBoxLns[ nLns ], *pItem );
+ }
+
+ pBox->GetTabLines().Remove( 0, nLen ); // Lines aus Array loeschen
+
+ delete pLn;
+
+ // Abhaengigkeit neu setzen
+ while( nLen-- )
+ rLns[ nInsPos++ ]->SetUpper( pUpper );
+
+ pLn = pLine; // und neu setzen
+ nLen = pLn->GetTabBoxes().Count();
+ }
+
+ // ACHTUNG: die Anzahl der Boxen kann sich aendern!
+ for( nLen = 0; nLen < pLn->GetTabBoxes().Count(); ++nLen )
+ if( !lcl_MergeGCBox( *(pLn->GetTabBoxes().GetData() + nLen ), pPara ))
+ --nLen;
+ }
+ return sal_True;
+}
+
+ // Struktur ein wenig aufraeumen
+void SwTable::GCLines()
+{
+ // ACHTUNG: die Anzahl der Lines kann sich aendern!
+ _GCLinePara aPara( GetTabLines() );
+ SwShareBoxFmts aShareFmts;
+ aPara.pShareFmts = &aShareFmts;
+ for( sal_uInt16 n = 0; n < GetTabLines().Count() &&
+ lcl_MergeGCLine( *(GetTabLines().GetData() + n ), &aPara ); ++n )
+ ;
+}
+
+
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
new file mode 100644
index 000000000000..c4e89fc12576
--- /dev/null
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -0,0 +1,1897 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include "hintids.hxx"
+
+//#define TEST_DELAYED_RESIZE
+
+#ifdef TEST_DELAYED_RESIZE
+#include <vcl/sound.hxx>
+#endif
+#include <vcl/wrkwin.hxx>
+#include <vcl/svapp.hxx>
+#include <sot/storage.hxx>
+#include <fmtornt.hxx>
+#include <fmtfsize.hxx>
+#include <frmfmt.hxx>
+#include <docary.hxx>
+#include "ndtxt.hxx"
+#include "doc.hxx"
+#include "swtable.hxx"
+#include "rootfrm.hxx"
+#include "docsh.hxx"
+#include "flyfrm.hxx"
+#include "poolfmt.hxx"
+#include "viewsh.hxx"
+#include "tabfrm.hxx"
+#include "viewopt.hxx"
+#include "htmltbl.hxx"
+#include "ndindex.hxx"
+#include "switerator.hxx"
+
+using namespace ::com::sun::star;
+
+
+#define COLFUZZY 20
+#define MAX_TABWIDTH (USHRT_MAX - 2001)
+
+
+class SwHTMLTableLayoutConstraints
+{
+ sal_uInt16 nRow; // Start-Zeile
+ sal_uInt16 nCol; // Start-Spalte
+ sal_uInt16 nColSpan; // COLSPAN der Zelle
+
+ SwHTMLTableLayoutConstraints *pNext; // die naechste Bedingung
+
+ sal_uLong nMinNoAlign, nMaxNoAlign; // Zwischenergebnisse AL-Pass 1
+
+public:
+
+ SwHTMLTableLayoutConstraints( sal_uLong nMin, sal_uLong nMax, sal_uInt16 nRow,
+ sal_uInt16 nCol, sal_uInt16 nColSp );
+ ~SwHTMLTableLayoutConstraints();
+
+ sal_uLong GetMinNoAlign() const { return nMinNoAlign; }
+ sal_uLong GetMaxNoAlign() const { return nMaxNoAlign; }
+
+ SwHTMLTableLayoutConstraints *InsertNext( SwHTMLTableLayoutConstraints *pNxt );
+ SwHTMLTableLayoutConstraints* GetNext() const { return pNext; }
+
+ sal_uInt16 GetRow() const { return nRow; }
+
+ sal_uInt16 GetColSpan() const { return nColSpan; }
+ sal_uInt16 GetColumn() const { return nCol; }
+};
+
+/* */
+
+SwHTMLTableLayoutCnts::SwHTMLTableLayoutCnts( const SwStartNode *pSttNd,
+ SwHTMLTableLayout* pTab,
+ sal_Bool bNoBrTag,
+ SwHTMLTableLayoutCnts* pNxt ) :
+ pNext( pNxt ), pBox( 0 ), pTable( pTab ), pStartNode( pSttNd ),
+ nPass1Done( 0 ), nWidthSet( 0 ), bNoBreakTag( bNoBrTag )
+{}
+
+SwHTMLTableLayoutCnts::~SwHTMLTableLayoutCnts()
+{
+ delete pNext;
+ delete pTable;
+}
+
+const SwStartNode *SwHTMLTableLayoutCnts::GetStartNode() const
+{
+ return pBox ? pBox->GetSttNd() : pStartNode;
+}
+
+
+/* */
+
+SwHTMLTableLayoutCell::SwHTMLTableLayoutCell( SwHTMLTableLayoutCnts *pCnts,
+ sal_uInt16 nRSpan, sal_uInt16 nCSpan,
+ sal_uInt16 nWidth, sal_Bool bPrcWidth,
+ sal_Bool bNWrapOpt ) :
+ pContents( pCnts ),
+ nRowSpan( nRSpan ), nColSpan( nCSpan ),
+ nWidthOption( nWidth ), bPrcWidthOption( bPrcWidth ),
+ bNoWrapOption( bNWrapOpt )
+{}
+
+SwHTMLTableLayoutCell::~SwHTMLTableLayoutCell()
+{
+ if( nRowSpan==1 && nColSpan==1 )
+ {
+ delete pContents;
+ }
+}
+
+/* */
+
+SwHTMLTableLayoutColumn::SwHTMLTableLayoutColumn( sal_uInt16 nWidth,
+ sal_Bool bRelWidth,
+ sal_Bool bLBorder ) :
+ nMinNoAlign(MINLAY), nMaxNoAlign(MINLAY), nAbsMinNoAlign(MINLAY),
+ nMin(0), nMax(0),
+ nAbsColWidth(0), nRelColWidth(0),
+ nWidthOption( nWidth ), bRelWidthOption( bRelWidth ),
+ bLeftBorder( bLBorder )
+{}
+
+
+/* */
+
+SwHTMLTableLayoutConstraints::SwHTMLTableLayoutConstraints(
+ sal_uLong nMin, sal_uLong nMax, sal_uInt16 nRw, sal_uInt16 nColumn, sal_uInt16 nColSp ):
+ nRow( nRw ), nCol( nColumn ), nColSpan( nColSp ),
+ pNext( 0 ),
+ nMinNoAlign( nMin ), nMaxNoAlign( nMax )
+{}
+
+SwHTMLTableLayoutConstraints::~SwHTMLTableLayoutConstraints()
+{
+ delete pNext;
+}
+
+SwHTMLTableLayoutConstraints *SwHTMLTableLayoutConstraints::InsertNext(
+ SwHTMLTableLayoutConstraints *pNxt )
+{
+ SwHTMLTableLayoutConstraints *pPrev = 0;
+ SwHTMLTableLayoutConstraints *pConstr = this;
+ while( pConstr )
+ {
+ if( pConstr->GetRow() > pNxt->GetRow() ||
+ pConstr->GetColumn() > pNxt->GetColumn() )
+ break;
+ pPrev = pConstr;
+ pConstr = pConstr->GetNext();
+ }
+
+ if( pPrev )
+ {
+ pNxt->pNext = pPrev->GetNext();
+ pPrev->pNext = pNxt;
+ pConstr = this;
+ }
+ else
+ {
+ pNxt->pNext = this;
+ pConstr = pNxt;
+ }
+
+ return pConstr;
+}
+
+/* */
+
+typedef SwHTMLTableLayoutColumn *SwHTMLTableLayoutColumnPtr;
+typedef SwHTMLTableLayoutCell *SwHTMLTableLayoutCellPtr;
+
+SwHTMLTableLayout::SwHTMLTableLayout(
+ const SwTable * pSwTbl,
+ sal_uInt16 nRws, sal_uInt16 nCls, sal_Bool bColsOpt, sal_Bool bColTgs,
+ sal_uInt16 nWdth, sal_Bool bPrcWdth, sal_uInt16 nBorderOpt,
+ sal_uInt16 nCellPad, sal_uInt16 nCellSp, SvxAdjust eAdjust,
+ sal_uInt16 nLMargin, sal_uInt16 nRMargin,
+ sal_uInt16 nBWidth, sal_uInt16 nLeftBWidth,
+ sal_uInt16 nRightBWidth,
+ sal_uInt16 nInhLeftBWidth, sal_uInt16 nInhRightBWidth ) :
+ aColumns( new SwHTMLTableLayoutColumnPtr[nCls] ),
+ aCells( new SwHTMLTableLayoutCellPtr[nRws*nCls] ),
+ pSwTable( pSwTbl ), pLeftFillerBox( 0 ), pRightFillerBox( 0 ),
+ nMin( 0 ), nMax( 0 ),
+ nRows( nRws ), nCols( nCls ),
+ nLeftMargin( nLMargin ), nRightMargin( nRMargin ),
+ nInhAbsLeftSpace( 0 ), nInhAbsRightSpace( 0 ),
+ nRelLeftFill( 0 ), nRelRightFill( 0 ),
+ nRelTabWidth( 0 ), nWidthOption( nWdth ),
+ nCellPadding( nCellPad ), nCellSpacing( nCellSp ), nBorder( nBorderOpt ),
+ nLeftBorderWidth( nLeftBWidth ), nRightBorderWidth( nRightBWidth ),
+ nInhLeftBorderWidth( nInhLeftBWidth ),
+ nInhRightBorderWidth( nInhRightBWidth ),
+ nBorderWidth( nBWidth ),
+ nDelayedResizeAbsAvail( 0 ), nLastResizeAbsAvail( 0 ),
+ nPass1Done( 0 ), nWidthSet( 0 ), eTableAdjust( eAdjust ),
+ bColsOption( bColsOpt ), bColTags( bColTgs ),
+ bPrcWidthOption( bPrcWdth ), bUseRelWidth( sal_False ),
+ bMustResize( sal_True ), bExportable( sal_True ), bBordersChanged( sal_False ),
+ bMustNotResize( sal_False ), bMustNotRecalc( sal_False )
+{
+ aResizeTimer.SetTimeoutHdl( STATIC_LINK( this, SwHTMLTableLayout,
+ DelayedResize_Impl ) );
+}
+
+SwHTMLTableLayout::~SwHTMLTableLayout()
+{
+ sal_uInt16 i;
+
+ for( i = 0; i < nCols; i++ )
+ delete aColumns[i];
+ delete[] aColumns;
+
+ sal_uInt16 nCount = nRows*nCols;
+ for( i=0; i<nCount; i++ )
+ delete aCells[i];
+ delete[] aCells;
+}
+
+// Die Breiten der Umrandung werden zunaechst wie in Netscape berechnet:
+// Aussere Umrandung: BORDER + CELLSPACING + CELLPADDING
+// Innere Umrandung: CELLSPACING + CELLPADDING
+// Allerdings wird die Breite der Umrandung im SW trotzdem beachtet, wenn
+// bSwBorders gesetzt ist, damit nicht faellschlich umgebrochen wird.
+// MIB 27.6.97: Dabei muss auch der Abstand zum Inhalt berueckichtigt werden,
+// und zwar auch dann, wenn wenn nur die gegenueberliegende Seite
+// eine Umrandung hat.
+sal_uInt16 SwHTMLTableLayout::GetLeftCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan,
+ sal_Bool bSwBorders ) const
+{
+ sal_uInt16 nSpace = nCellSpacing + nCellPadding;
+
+ if( nCol == 0 )
+ {
+ nSpace = nSpace + nBorder;
+
+ if( bSwBorders && nSpace < nLeftBorderWidth )
+ nSpace = nLeftBorderWidth;
+ }
+ else if( bSwBorders )
+ {
+ if( GetColumn(nCol)->HasLeftBorder() )
+ {
+ if( nSpace < nBorderWidth )
+ nSpace = nBorderWidth;
+ }
+ else if( nCol+nColSpan == nCols && nRightBorderWidth &&
+ nSpace < MIN_BORDER_DIST )
+ {
+ ASSERT( !nCellPadding, "GetLeftCellSpace: CELLPADDING!=0" );
+ // Wenn die Gegenueberliegende Seite umrandet ist muessen
+ // wir zumindest den minimalen Abstand zum Inhalt
+ // beruecksichtigen. (Koennte man zusaetzlich auch an
+ // nCellPadding festmachen.)
+ nSpace = MIN_BORDER_DIST;
+ }
+ }
+
+ return nSpace;
+}
+
+sal_uInt16 SwHTMLTableLayout::GetRightCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan,
+ sal_Bool bSwBorders ) const
+{
+ sal_uInt16 nSpace = nCellPadding;
+
+ if( nCol+nColSpan == nCols )
+ {
+ nSpace += nBorder + nCellSpacing;
+ if( bSwBorders && nSpace < nRightBorderWidth )
+ nSpace = nRightBorderWidth;
+ }
+ else if( bSwBorders && GetColumn(nCol)->HasLeftBorder() &&
+ nSpace < MIN_BORDER_DIST )
+ {
+ ASSERT( !nCellPadding, "GetRightCellSpace: CELLPADDING!=0" );
+ // Wenn die Gegenueberliegende Seite umrandet ist muessen
+ // wir zumindest den minimalen Abstand zum Inhalt
+ // beruecksichtigen. (Koennte man zusaetzlich auch an
+ // nCellPadding festmachen.)
+ nSpace = MIN_BORDER_DIST;
+ }
+
+ return nSpace;
+}
+
+void SwHTMLTableLayout::AddBorderWidth( sal_uLong &rMin, sal_uLong &rMax,
+ sal_uLong &rAbsMin,
+ sal_uInt16 nCol, sal_uInt16 nColSpan,
+ sal_Bool bSwBorders ) const
+{
+ sal_uLong nAdd = GetLeftCellSpace( nCol, nColSpan, bSwBorders ) +
+ GetRightCellSpace( nCol, nColSpan, bSwBorders );
+
+ rMin += nAdd;
+ rMax += nAdd;
+ rAbsMin += nAdd;
+}
+
+void SwHTMLTableLayout::SetBoxWidth( SwTableBox *pBox, sal_uInt16 nCol,
+ sal_uInt16 nColSpan ) const
+{
+ SwFrmFmt *pFrmFmt = pBox->GetFrmFmt();
+
+ // die Breite der Box berechnen
+ SwTwips nFrmWidth = 0;
+ while( nColSpan-- )
+ nFrmWidth += GetColumn( nCol++ )->GetRelColWidth();
+
+ // und neu setzen
+
+ pFrmFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nFrmWidth, 0 ));
+}
+
+void SwHTMLTableLayout::GetAvail( sal_uInt16 nCol, sal_uInt16 nColSpan,
+ sal_uInt16& rAbsAvail, sal_uInt16& rRelAvail ) const
+{
+ rAbsAvail = 0;
+ rRelAvail = 0;
+ for( sal_uInt16 i=nCol; i<nCol+nColSpan;i++ )
+ {
+ const SwHTMLTableLayoutColumn *pColumn = GetColumn(i);
+ rAbsAvail = rAbsAvail + pColumn->GetAbsColWidth();
+ rRelAvail = rRelAvail + pColumn->GetRelColWidth();
+ }
+}
+
+sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByVisArea( const SwDoc& rDoc )
+{
+ ViewShell *pVSh = 0;
+ rDoc.GetEditShell( &pVSh );
+ if( pVSh )
+ {
+ return (sal_uInt16)pVSh->GetBrowseWidth();
+ }
+
+ return 0;
+}
+
+sal_uInt16 SwHTMLTableLayout::GetBrowseWidth( const SwDoc& rDoc )
+{
+ // Wenn ein Layout da ist, koennen wir die Breite dort herholen.
+ const SwRootFrm *pRootFrm = rDoc.GetCurrentLayout(); //swmod 080218
+ if( pRootFrm )
+ {
+ const SwFrm *pPageFrm = pRootFrm->GetLower();
+ if( pPageFrm )
+ return (sal_uInt16)pPageFrm->Prt().Width();
+ }
+
+ // --> OD 2010-05-12 #i91658#
+ // Assertion removed which state that no browse width is available.
+ // Investigation reveals that all calls can handle the case that no browse
+ // width is provided.
+ return GetBrowseWidthByVisArea( rDoc );
+ // <--
+}
+
+sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByTabFrm(
+ const SwTabFrm& rTabFrm ) const
+{
+ SwTwips nWidth = 0;
+
+ const SwFrm *pUpper = rTabFrm.GetUpper();
+ if( MayBeInFlyFrame() && pUpper->IsFlyFrm() &&
+ ((const SwFlyFrm *)pUpper)->GetAnchorFrm() )
+ {
+ // Wenn die Tabelle in einem selbst angelegten Rahmen steht, dann ist
+ // die Breite Ankers und nicht die Breite Rahmens von Bedeutung.
+ // Bei Absatz-gebundenen Rahmen werden Absatz-Einzuege nicht beachtet.
+ const SwFrm *pAnchor = ((const SwFlyFrm *)pUpper)->GetAnchorFrm();
+ if( pAnchor->IsTxtFrm() )
+ nWidth = pAnchor->Frm().Width();
+ else
+ nWidth = pAnchor->Prt().Width();
+ }
+ else
+ {
+ nWidth = pUpper->Prt().Width();
+ }
+
+ SwTwips nUpperDummy = 0;
+ long nRightOffset = 0,
+ nLeftOffset = 0;
+ rTabFrm.CalcFlyOffsets( nUpperDummy, nLeftOffset, nRightOffset );
+ nWidth -= (nLeftOffset + nRightOffset);
+
+ return nWidth < USHRT_MAX ? static_cast<sal_uInt16>(nWidth) : USHRT_MAX;
+}
+
+sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByTable( const SwDoc& rDoc ) const
+{
+ sal_uInt16 nBrowseWidth = 0;
+ SwTabFrm* pFrm = SwIterator<SwTabFrm,SwFmt>::FirstElement( *pSwTable->GetFrmFmt() );
+ if( pFrm )
+ {
+ nBrowseWidth = GetBrowseWidthByTabFrm( *pFrm );
+ }
+ else
+ {
+ nBrowseWidth = SwHTMLTableLayout::GetBrowseWidth( rDoc );
+ }
+
+ return nBrowseWidth;
+}
+
+const SwStartNode *SwHTMLTableLayout::GetAnyBoxStartNode() const
+{
+ const SwStartNode *pBoxSttNd;
+
+ const SwTableBox* pBox = pSwTable->GetTabLines()[0]->GetTabBoxes()[0];
+ while( 0 == (pBoxSttNd = pBox->GetSttNd()) )
+ {
+ ASSERT( pBox->GetTabLines().Count() > 0,
+ "Box ohne Start-Node und Lines" );
+ ASSERT( pBox->GetTabLines()[0]->GetTabBoxes().Count() > 0,
+ "Line ohne Boxen" );
+ pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0];
+ }
+
+ return pBoxSttNd;
+}
+
+SwFrmFmt *SwHTMLTableLayout::FindFlyFrmFmt() const
+{
+ const SwTableNode *pTblNd = GetAnyBoxStartNode()->FindTableNode();
+ ASSERT( pTblNd, "Kein Table-Node?" );
+ return pTblNd->GetFlyFmt();
+}
+
+static void lcl_GetMinMaxSize( sal_uLong& rMinNoAlignCnts, sal_uLong& rMaxNoAlignCnts,
+ sal_uLong& rAbsMinNoAlignCnts,
+#ifdef FIX41370
+ sal_Bool& rHR,
+#endif
+ SwTxtNode *pTxtNd, sal_uLong nIdx, sal_Bool bNoBreak )
+{
+ pTxtNd->GetMinMaxSize( nIdx, rMinNoAlignCnts, rMaxNoAlignCnts,
+ rAbsMinNoAlignCnts );
+ ASSERT( rAbsMinNoAlignCnts <= rMinNoAlignCnts,
+ "GetMinMaxSize: absmin > min" );
+ ASSERT( rMinNoAlignCnts <= rMaxNoAlignCnts,
+ "GetMinMaxSize: max > min" );
+
+ //Bei einen <PRE>-Absatz entspricht die maximale Breite der
+ // minimalen breite
+ const SwFmtColl *pColl = &pTxtNd->GetAnyFmtColl();
+ while( pColl && !pColl->IsDefault() &&
+ (USER_FMT & pColl->GetPoolFmtId()) )
+ {
+ pColl = (const SwFmtColl *)pColl->DerivedFrom();
+ }
+
+ // <NOBR> in der gesamten Zelle bezieht sich auf Text, aber nicht
+ // auf Tabellen. Netscape beruecksichtigt dies nur fuer Grafiken.
+ if( (pColl && RES_POOLCOLL_HTML_PRE==pColl->GetPoolFmtId()) || bNoBreak )
+ {
+ rMinNoAlignCnts = rMaxNoAlignCnts;
+ rAbsMinNoAlignCnts = rMaxNoAlignCnts;
+ }
+#ifdef FIX41370
+ else if( pColl && RES_POOLCOLL_HTML_HR==pColl->GetPoolFmtId() )
+ {
+ rHR |= !pTxtNd->HasSwAttrSet() ||
+ SFX_ITEM_SET != pTxtNd->GetpSwAttrSet()
+ ->GetItemState( RES_LR_SPACE, sal_False );
+ }
+#endif
+}
+
+void SwHTMLTableLayout::AutoLayoutPass1()
+{
+ nPass1Done++;
+
+ ClearPass1Info();
+
+ sal_Bool bFixRelWidths = sal_False;
+ sal_uInt16 i;
+
+ SwHTMLTableLayoutConstraints *pConstraints = 0;
+
+ for( i=0; i<nCols; i++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ pColumn->ClearPass1Info( !HasColTags() );
+ sal_uInt16 nMinColSpan = USHRT_MAX; // Spaltenzahl, auf die sich dir
+ // berechnete Breite bezieht
+ sal_uInt16 nColSkip = USHRT_MAX; // Wie viele Spalten muessen
+ // uebersprungen werden
+
+ for( sal_uInt16 j=0; j<nRows; j++ )
+ {
+ SwHTMLTableLayoutCell *pCell = GetCell(j,i);
+ SwHTMLTableLayoutCnts *pCnts = pCell->GetContents();
+
+ // fix #31488#: Zum Ermitteln der naechsten zu berechnenden
+ // Spalte muessen alle Zeilen herangezogen werden
+ sal_uInt16 nColSpan = pCell->GetColSpan();
+ if( nColSpan < nColSkip )
+ nColSkip = nColSpan;
+
+ if( !pCnts || (pCnts && !pCnts->IsPass1Done(nPass1Done)) )
+ {
+ // die Zelle ist leer oder ihr Inhalt wurde nich nicht
+ // bearbeitet
+ if( nColSpan < nMinColSpan )
+ nMinColSpan = nColSpan;
+
+ sal_uLong nMinNoAlignCell = 0;
+ sal_uLong nMaxNoAlignCell = 0;
+ sal_uLong nAbsMinNoAlignCell = 0;
+ sal_uLong nMaxTableCell = 0;
+ sal_uLong nAbsMinTableCell = 0;
+#ifdef FIX41370
+ sal_Bool bHR = sal_False;
+#endif
+
+ while( pCnts )
+ {
+ const SwStartNode *pSttNd = pCnts->GetStartNode();
+ if( pSttNd )
+ {
+ const SwDoc *pDoc = pSttNd->GetDoc();
+ sal_uLong nIdx = pSttNd->GetIndex();
+ while( !(pDoc->GetNodes()[nIdx])->IsEndNode() )
+ {
+ SwTxtNode *pTxtNd = (pDoc->GetNodes()[nIdx])->GetTxtNode();
+ if( pTxtNd )
+ {
+ sal_uLong nMinNoAlignCnts = 0;
+ sal_uLong nMaxNoAlignCnts = 0;
+ sal_uLong nAbsMinNoAlignCnts = 0;
+
+ lcl_GetMinMaxSize( nMinNoAlignCnts,
+ nMaxNoAlignCnts,
+ nAbsMinNoAlignCnts,
+#ifdef FIX41370
+ bHR,
+#endif
+ pTxtNd, nIdx,
+ pCnts->HasNoBreakTag() );
+
+ if( nMinNoAlignCnts > nMinNoAlignCell )
+ nMinNoAlignCell = nMinNoAlignCnts;
+ if( nMaxNoAlignCnts > nMaxNoAlignCell )
+ nMaxNoAlignCell = nMaxNoAlignCnts;
+ if( nAbsMinNoAlignCnts > nAbsMinNoAlignCell )
+ nAbsMinNoAlignCell = nAbsMinNoAlignCnts;
+ }
+ else
+ {
+ SwTableNode *pTabNd = (pDoc->GetNodes()[nIdx])->GetTableNode();
+ if( pTabNd )
+ {
+ SwHTMLTableLayout *pChild = pTabNd->GetTable().GetHTMLTableLayout();
+ if( pChild )
+ {
+ pChild->AutoLayoutPass1();
+ sal_uLong nMaxTableCnts = pChild->nMax;
+ sal_uLong nAbsMinTableCnts = pChild->nMin;
+
+ // Eine feste Tabellen-Breite wird als Minimum
+ // und Maximum gleichzeitig uebernommen
+ if( !pChild->bPrcWidthOption && pChild->nWidthOption )
+ {
+ sal_uLong nTabWidth = pChild->nWidthOption;
+ if( nTabWidth >= nAbsMinTableCnts )
+ {
+ nMaxTableCnts = nTabWidth;
+ nAbsMinTableCnts = nTabWidth;
+ }
+ else
+ {
+ nMaxTableCnts = nAbsMinTableCnts;
+ }
+ }
+
+ if( nMaxTableCnts > nMaxTableCell )
+ nMaxTableCell = nMaxTableCnts;
+ if( nAbsMinTableCnts > nAbsMinTableCell )
+ nAbsMinTableCell = nAbsMinTableCnts;
+ }
+ nIdx = pTabNd->EndOfSectionNode()->GetIndex();
+ }
+ }
+ nIdx++;
+ }
+ }
+ else
+ {
+ ASSERT( !this, "Sub tables in HTML import?" )
+ SwHTMLTableLayout *pChild = pCnts->GetTable();
+ pChild->AutoLayoutPass1();
+ sal_uLong nMaxTableCnts = pChild->nMax;
+ sal_uLong nAbsMinTableCnts = pChild->nMin;
+
+ // Eine feste Tabellen-Breite wird als Minimum
+ // und Maximum gleichzeitig uebernommen
+ if( !pChild->bPrcWidthOption && pChild->nWidthOption )
+ {
+ sal_uLong nTabWidth = pChild->nWidthOption;
+ if( nTabWidth >= nAbsMinTableCnts )
+ {
+ nMaxTableCnts = nTabWidth;
+ nAbsMinTableCnts = nTabWidth;
+ }
+ else
+ {
+ nMaxTableCnts = nAbsMinTableCnts;
+ }
+ }
+
+ if( nMaxTableCnts > nMaxTableCell )
+ nMaxTableCell = nMaxTableCnts;
+ if( nAbsMinTableCnts > nAbsMinTableCell )
+ nAbsMinTableCell = nAbsMinTableCnts;
+ }
+ pCnts->SetPass1Done( nPass1Done );
+ pCnts = pCnts->GetNext();
+ }
+
+// War frueher hinter AddBorderWidth
+ // Wenn die Breite einer Tabelle in der Zelle breiter ist als
+ // das, was wir fuer sonstigen Inhalt berechnet haben, mussen
+ // wir die Breite der Tabelle nutzen
+ if( nMaxTableCell > nMaxNoAlignCell )
+ nMaxNoAlignCell = nMaxTableCell;
+ if( nAbsMinTableCell > nAbsMinNoAlignCell )
+ {
+ nAbsMinNoAlignCell = nAbsMinTableCell;
+ if( nMinNoAlignCell < nAbsMinNoAlignCell )
+ nMinNoAlignCell = nAbsMinNoAlignCell;
+ if( nMaxNoAlignCell < nMinNoAlignCell )
+ nMaxNoAlignCell = nMinNoAlignCell;
+ }
+// War frueher hinter AddBorderWidth
+
+ sal_Bool bRelWidth = pCell->IsPrcWidthOption();
+ sal_uInt16 nWidth = pCell->GetWidthOption();
+
+ // Eine NOWRAP-Option bezieht sich auf Text und auf
+ // Tabellen, wird aber bei fester Zellenbreite
+ // nicht uebernommen. Stattdessen wirkt die angegebene
+ // Zellenbreite wie eine Mindestbreite.
+ if( pCell->HasNoWrapOption() )
+ {
+ if( nWidth==0 || bRelWidth )
+ {
+ nMinNoAlignCell = nMaxNoAlignCell;
+ nAbsMinNoAlignCell = nMaxNoAlignCell;
+ }
+ else
+ {
+ if( nWidth>nMinNoAlignCell )
+ nMinNoAlignCell = nWidth;
+ if( nWidth>nAbsMinNoAlignCell )
+ nAbsMinNoAlignCell = nWidth;
+ }
+ }
+#ifdef FIX41370
+ else if( bHR && nWidth>0 && !bRelWidth )
+ {
+ // Ein kleiner Hack, um einen Bug in Netscape 4.0
+ // nachzubilden (siehe #41370#). Wenn eine Zelle eine
+ // fixe Breite besitzt und gleichzeitig ein HR, wird
+ // sie nie schmaler als die angegebene Breite.
+ // (Genaugenomen scheint die Zelle nie schmaler zu werden
+ // als die HR-Linie, denn wenn man fuer die Linie eine
+ // Breite angibt, die breiter ist als die der Zelle, dann
+ // wird die Zelle so breit wie die Linie. Das bekommen wir
+ // natuerlich nicht hin.)
+ if( nWidth>nMinNoAlignCell )
+ nMinNoAlignCell = nWidth;
+ if( nWidth>nAbsMinNoAlignCell )
+ nAbsMinNoAlignCell = nWidth;
+ }
+#endif
+
+ // Mindestbreite fuer Inhalt einhalten
+ if( nMinNoAlignCell < MINLAY )
+ nMinNoAlignCell = MINLAY;
+ if( nMaxNoAlignCell < MINLAY )
+ nMaxNoAlignCell = MINLAY;
+ if( nAbsMinNoAlignCell < MINLAY )
+ nAbsMinNoAlignCell = MINLAY;
+
+ // Umrandung und Abstand zum Inhalt beachten.
+ AddBorderWidth( nMinNoAlignCell, nMaxNoAlignCell,
+ nAbsMinNoAlignCell, i, nColSpan );
+
+ if( 1==nColSpan )
+ {
+ // die Werte direkt uebernehmen
+ pColumn->MergeMinMaxNoAlign( nMinNoAlignCell,
+ nMaxNoAlignCell,
+ nAbsMinNoAlignCell );
+
+ // bei den WIDTH angaben gewinnt die breiteste
+ if( !HasColTags() )
+ pColumn->MergeCellWidthOption( nWidth, bRelWidth );
+ }
+ else
+ {
+ // die Angaben erst am Ende, und zwar zeilenweise von
+ // links nach rechts bearbeiten
+
+ // Wann welche Werte wie uebernommen werden ist weiter
+ // unten erklaert.
+ if( !HasColTags() && nWidth && !bRelWidth )
+ {
+ sal_uLong nAbsWidth = nWidth, nDummy = 0, nDummy2 = 0;
+ AddBorderWidth( nAbsWidth, nDummy, nDummy2,
+ i, nColSpan, sal_False );
+
+ if( nAbsWidth >= nMinNoAlignCell )
+ {
+ nMaxNoAlignCell = nAbsWidth;
+ if( HasColsOption() )
+ nMinNoAlignCell = nAbsWidth;
+ }
+ else if( nAbsWidth >= nAbsMinNoAlignCell )
+ {
+ nMaxNoAlignCell = nAbsWidth;
+ nMinNoAlignCell = nAbsWidth;
+ }
+ else
+ {
+ nMaxNoAlignCell = nAbsMinNoAlignCell;
+ nMinNoAlignCell = nAbsMinNoAlignCell;
+ }
+ }
+ else if( HasColsOption() || HasColTags() )
+ nMinNoAlignCell = nAbsMinNoAlignCell;
+
+ SwHTMLTableLayoutConstraints *pConstr =
+ new SwHTMLTableLayoutConstraints( nMinNoAlignCell,
+ nMaxNoAlignCell, j, i, nColSpan );
+ if( pConstraints )
+ pConstraints = pConstraints->InsertNext( pConstr );
+ else
+ pConstraints = pConstr;
+ }
+ }
+ }
+
+ ASSERT( nMinColSpan>0 && nColSkip>0 && nColSkip <= nMinColSpan,
+ "Layout Pass 1: Da werden Spalten vergessen!" );
+ ASSERT( nMinColSpan!=USHRT_MAX,
+ "Layout Pass 1: unnoetiger Schleifendurchlauf oder Bug" );
+
+ if( 1==nMinColSpan )
+ {
+ // es gibt Zellen mit COLSPAN 1 und demnach auch sinnvolle
+ // Werte in pColumn
+
+ // Werte anhand folgender Tabelle (Netscape 4.0 pv 3) uebernehmen:
+ //
+ // WIDTH: kein COLS COLS
+ //
+ // keine min = min min = absmin
+ // max = max max = max
+ //
+ // >= min min = min min = width
+ // max = width max = width
+ //
+ // >= absmin min = wdith(*) min = width
+ // max = width max = width
+ //
+ // < absmin min = absmin min = absmin
+ // max = absmin max = absmin
+ //
+ // (*) Netscape benutzt hier die Mindestbreite ohne einen
+ // Umbruch vor der letzten Grafik. Haben wir (noch?) nicht,
+ // also belassen wir es bei width.^
+
+ if( pColumn->GetWidthOption() && !pColumn->IsRelWidthOption() )
+ {
+ // absolute Breiten als Minimal- und Maximalbreite
+ // uebernehmen.
+ sal_uLong nAbsWidth = pColumn->GetWidthOption();
+ sal_uLong nDummy = 0, nDummy2 = 0;
+ AddBorderWidth( nAbsWidth, nDummy, nDummy2, i, 1, sal_False );
+
+ if( nAbsWidth >= pColumn->GetMinNoAlign() )
+ {
+ pColumn->SetMinMax( HasColsOption() ? nAbsWidth
+ : pColumn->GetMinNoAlign(),
+ nAbsWidth );
+ }
+ else if( nAbsWidth >= pColumn->GetAbsMinNoAlign() )
+ {
+ pColumn->SetMinMax( nAbsWidth, nAbsWidth );
+ }
+ else
+ {
+ pColumn->SetMinMax( pColumn->GetAbsMinNoAlign(),
+ pColumn->GetAbsMinNoAlign() );
+ }
+ }
+ else
+ {
+ pColumn->SetMinMax( HasColsOption() ? pColumn->GetAbsMinNoAlign()
+ : pColumn->GetMinNoAlign(),
+ pColumn->GetMaxNoAlign() );
+ }
+ }
+ else if( USHRT_MAX!=nMinColSpan )
+ {
+ // kann irgendwas !=0 sein, weil es durch die Constraints
+ // angepasst wird.
+ pColumn->SetMinMax( MINLAY, MINLAY );
+
+ // die naechsten Spalten muessen nicht bearbeitet werden
+ i += (nColSkip-1);
+ }
+
+ nMin += pColumn->GetMin();
+ nMax += pColumn->GetMax();
+ bFixRelWidths |= pColumn->IsRelWidthOption();
+ }
+
+ // jetzt noch die Constrains verarbeiten
+ SwHTMLTableLayoutConstraints *pConstr = pConstraints;
+ while( pConstr )
+ {
+ // Erstmal muss die Breite analog zu den den Spaltenbreiten
+ // aufbereitet werden
+ sal_uInt16 nCol = pConstr->GetColumn();
+ sal_uInt16 nColSpan = pConstr->GetColSpan();
+ sal_uLong nConstrMin = pConstr->GetMinNoAlign();
+ sal_uLong nConstrMax = pConstr->GetMaxNoAlign();
+
+ // jetzt holen wir uns die bisherige Breite der ueberspannten
+ // Spalten
+ sal_uLong nColsMin = 0;
+ sal_uLong nColsMax = 0;
+ for( sal_uInt16 j=nCol; j<nCol+nColSpan; j++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( j );
+ nColsMin += pColumn->GetMin();
+ nColsMax += pColumn->GetMax();
+ }
+
+ if( nColsMin<nConstrMin )
+ {
+ // den Minimalwert anteilig auf die Spalten verteilen
+ sal_uLong nMinD = nConstrMin-nColsMin;
+
+ if( nConstrMin > nColsMax )
+ {
+ // Anteilig anhand der Mindestbreiten
+ sal_uInt16 nEndCol = nCol+nColSpan;
+ sal_uLong nDiff = nMinD;
+ for( sal_uInt16 ic=nCol; ic<nEndCol; ic++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( ic );
+
+ sal_uLong nColMin = pColumn->GetMin();
+ sal_uLong nColMax = pColumn->GetMax();
+
+ nMin -= nColMin;
+ sal_uLong nAdd = ic<nEndCol-1 ? (nColMin * nMinD) / nColsMin
+ : nDiff;
+ nColMin += nAdd;
+ nMin += nColMin;
+ ASSERT( nDiff >= nAdd, "Ooops: nDiff stimmt nicht mehr" );
+ nDiff -= nAdd;
+
+ if( nColMax < nColMin )
+ {
+ nMax -= nColMax;
+ nColsMax -= nColMax;
+ nColMax = nColMin;
+ nMax += nColMax;
+ nColsMax += nColMax;
+ }
+
+ pColumn->SetMinMax( nColMin, nColMax );
+ }
+ }
+ else
+ {
+ // Anteilig anhand der Differenz zwischen Max und Min
+ for( sal_uInt16 ic=nCol; ic<nCol+nColSpan; ic++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( ic );
+
+ sal_uLong nDiff = pColumn->GetMax()-pColumn->GetMin();
+ if( nMinD < nDiff )
+ nDiff = nMinD;
+
+ pColumn->AddToMin( nDiff );
+
+ ASSERT( pColumn->GetMax() >= pColumn->GetMin(),
+ "Wieso ist die SPalte auf einmal zu schmal?" )
+
+ nMin += nDiff;
+ nMinD -= nDiff;
+ }
+ }
+ }
+
+ if( !HasColTags() && nColsMax<nConstrMax )
+ {
+ sal_uLong nMaxD = nConstrMax-nColsMax;
+
+ for( sal_uInt16 ic=nCol; ic<nCol+nColSpan; ic++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( ic );
+
+ nMax -= pColumn->GetMax();
+
+ pColumn->AddToMax( (pColumn->GetMax() * nMaxD) / nColsMax );
+
+ nMax += pColumn->GetMax();
+ }
+ }
+
+ pConstr = pConstr->GetNext();
+ }
+
+
+ if( bFixRelWidths )
+ {
+ if( HasColTags() )
+ {
+ // Zum Anpassen der relativen Breiten werden im 1. Schritt die
+ // Minmalbreiten aller anzupassenden Zellen jeweils mit der
+ // relativen Breite einer Spalte multipliziert. Dadurch stimmen
+ // dann die Breitenverhaeltnisse der Spalten untereinander.
+ // Ausserdem wird der Faktor berechnet, um den die Zelle dadurch
+ // breiter gworden ist als die Minmalbreite.
+ // Im 2. Schritt werden dann die berechneten Breiten durch diesen
+ // Faktor geteilt. Dadurch bleibt die Breite (nimd.) einer Zelle
+ // erhalten und dient als Ausgangsbasis fuer die andern Breiten.
+ // Es werden auch hier nur die Maximalbreiten beeinflusst!
+
+ sal_uLong nAbsMin = 0; // absolte Min-Breite alter Spalten mit
+ // relativer Breite
+ sal_uLong nRel = 0; // Summe der relativen Breiten aller Spalten
+ for( i=0; i<nCols; i++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() )
+ {
+ nAbsMin += pColumn->GetMin();
+ nRel += pColumn->GetWidthOption();
+ }
+ }
+
+ sal_uLong nQuot = ULONG_MAX;
+ for( i=0; i<nCols; i++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ if( pColumn->IsRelWidthOption() )
+ {
+ nMax -= pColumn->GetMax();
+ if( pColumn->GetWidthOption() && pColumn->GetMin() )
+ {
+ pColumn->SetMax( nAbsMin * pColumn->GetWidthOption() );
+ sal_uLong nColQuot = pColumn->GetMax() / pColumn->GetMin();
+ if( nColQuot<nQuot )
+ nQuot = nColQuot;
+ }
+ }
+ }
+ ASSERT( 0==nRel || nQuot!=ULONG_MAX,
+ "Wo sind die relativen Spalten geblieben?" );
+ for( i=0; i<nCols; i++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ if( pColumn->IsRelWidthOption() )
+ {
+ if( pColumn->GetWidthOption() )
+ pColumn->SetMax( pColumn->GetMax() / nQuot );
+ else
+ pColumn->SetMax( pColumn->GetMin() );
+ ASSERT( pColumn->GetMax() >= pColumn->GetMin(),
+ "Maximale Spaltenbreite kleiner als Minimale" );
+ nMax += pColumn->GetMax();
+ }
+ }
+ }
+ else
+ {
+ sal_uInt16 nRel = 0; // Summe der relativen Breiten aller Spalten
+ sal_uInt16 nRelCols = 0; // Anzahl Spalten mit relativer Angabe
+ sal_uLong nRelMax = 0; // Anteil am Maximum dieser Spalten
+ for( i=0; i<nCols; i++ )
+ {
+ ASSERT( nRel<=100, "relative Breite aller Spalten>100%" );
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() )
+ {
+ // Sicherstellen, dass die relativen breiten nicht
+ // ueber 100% landen
+ sal_uInt16 nColWidth = pColumn->GetWidthOption();
+ if( nRel+nColWidth > 100 )
+ {
+ nColWidth = 100 - nRel;
+ pColumn->SetWidthOption( nColWidth, sal_True, sal_False );
+ }
+ nRelMax += pColumn->GetMax();
+ nRel = nRel + nColWidth;
+ nRelCols++;
+ }
+ else if( !pColumn->GetMin() )
+ {
+ // Die Spalte ist leer (wurde also auschliesslich
+ // durch COLSPAN erzeugt) und darf deshalb auch
+ // keine %-Breite zugewiesen bekommen.
+ nRelCols++;
+ }
+ }
+
+ // Eventuell noch vorhandene Prozente werden auf die Spalten ohne
+ // eine Breiten-Angabe verteilt. Wie in Netscape werden die
+ // verbleibenden Prozente enstprechend der Verhaeltnisse
+ // der Maximalbreiten der in Frage kommenden Spalten
+ // untereinander verteilt.
+ // ??? Wie beruecksichtigen bei den Maximalbreiten auch Spalten
+ // mit fester Breite. Ist das richtig???
+ if( nRel < 100 && nRelCols < nCols )
+ {
+ sal_uInt16 nRelLeft = 100 - nRel;
+ sal_uLong nFixMax = nMax - nRelMax;
+ for( i=0; i<nCols; i++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ if( !pColumn->IsRelWidthOption() &&
+ !pColumn->GetWidthOption() &&
+ pColumn->GetMin() )
+ {
+ // den Rest bekommt die naechste Spalte
+ sal_uInt16 nColWidth =
+ (sal_uInt16)((pColumn->GetMax() * nRelLeft) / nFixMax);
+ pColumn->SetWidthOption( nColWidth, sal_True, sal_False );
+ }
+ }
+ }
+
+ // nun die Maximalbreiten entsprechend anpassen
+ sal_uLong nQuotMax = ULONG_MAX;
+ sal_uLong nOldMax = nMax;
+ nMax = 0;
+ for( i=0; i<nCols; i++ )
+ {
+ // Spalten mit %-Angaben werden enstprechend angepasst.
+ // Spalten, die
+ // - keine %-Angabe besitzen und in einer Tabelle mit COLS
+ // oder WIDTH vorkommen, oder
+ // - als Breite 0% angegeben haben erhalten die Minimalbreite
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() )
+ {
+ sal_uLong nNewMax;
+ sal_uLong nColQuotMax;
+ if( !nWidthOption )
+ {
+ nNewMax = nOldMax * pColumn->GetWidthOption();
+ nColQuotMax = nNewMax / pColumn->GetMax();
+ }
+ else
+ {
+ nNewMax = nMin * pColumn->GetWidthOption();
+ nColQuotMax = nNewMax / pColumn->GetMin();
+ }
+ pColumn->SetMax( nNewMax );
+ if( nColQuotMax < nQuotMax )
+ nQuotMax = nColQuotMax;
+ }
+ else if( HasColsOption() || nWidthOption ||
+ (pColumn->IsRelWidthOption() &&
+ !pColumn->GetWidthOption()) )
+ pColumn->SetMax( pColumn->GetMin() );
+ }
+ // und durch den Quotienten teilen
+ ASSERT( nQuotMax!=ULONG_MAX, "Wo sind die relativen Spalten geblieben?" );
+ for( i=0; i<nCols; i++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() )
+ {
+ if( pColumn->GetWidthOption() )
+ {
+ pColumn->SetMax( pColumn->GetMax() / nQuotMax );
+ ASSERT( pColumn->GetMax() >= pColumn->GetMin(),
+ "Minimalbreite ein Spalte Groesser Maximum" );
+ if( pColumn->GetMax() < pColumn->GetMin() )
+ pColumn->SetMax( pColumn->GetMin() );
+ }
+ }
+ nMax += pColumn->GetMax();
+ }
+ }
+ }
+
+ delete pConstraints;
+}
+
+// nAbsAvail ist der verfuegbare Platz in TWIPS.
+// nRelAvail ist der auf USHRT_MAX bezogene verfuegbare Platz oder 0
+// nAbsSpace ist der Anteil von nAbsAvail, der durch der umgebende Zelle
+// fur die Umrandung und den Abstand zum Inhalt reserviert ist.
+void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAvail,
+ sal_uInt16 nAbsLeftSpace,
+ sal_uInt16 nAbsRightSpace,
+ sal_uInt16 nParentInhAbsSpace )
+{
+ // Erstmal fuehren wie jede Menge Plausibilaets-Test durch
+
+ // Eine abolute zur Verfuegung stehende Breite muss immer uebergeben
+ // werden.
+ ASSERT( nAbsAvail, "AutoLayout Pass 2: Keine absolute Breite gegeben" );
+
+ // Eine realtive zur Verfuegung stehende Breite darf nur und muss fuer
+ // Tabellen in Tabellen uebergeben
+ ASSERT( IsTopTable() == (nRelAvail==0),
+ "AutoLayout Pass 2: Rel. Breite bei Tab in Tab oder umgekehrt" );
+
+ // Die Minimalbreite der Tabelle darf natuerlich nie groesser sein
+ // als das die Maximalbreite.
+ ASSERT( nMin<=nMax, "AutoLayout Pass2: nMin > nMax" );
+
+ // Die verfuegbare Breite, fuer die die Tabelle berechnet wurde, merken.
+ // (Dies ist ein guter Ort, denn hier kommer wir bei der Erstberechnung
+ // der Tabelle aus dem Parser und bei jedem _Resize-Aufruf vorbei.)
+ nLastResizeAbsAvail = nAbsAvail;
+
+ // Schritt 1: Der verfuegbar Platz wird an linke/rechte Raender,
+ // vorhandene Filler-Zellen und Abstande angepasst
+
+ // Abstand zum Inhalt und Unrandung
+ sal_uInt16 nAbsLeftFill = 0, nAbsRightFill = 0;
+ if( !IsTopTable() &&
+ GetMin() + nAbsLeftSpace + nAbsRightSpace <= nAbsAvail )
+ {
+ nAbsLeftFill = nAbsLeftSpace;
+ nAbsRightFill = nAbsRightSpace;
+ }
+
+ // Linker und rechter Abstand
+ if( nLeftMargin || nRightMargin )
+ {
+ if( IsTopTable() )
+ {
+ // fuer die Top-Table beruecksichtigen wir die Raender immer,
+ // den die Minimalbreite der Tabelle wird hier nie unterschritten
+ nAbsAvail -= (nLeftMargin + nRightMargin);
+ }
+ else if( GetMin() + nLeftMargin + nRightMargin <= nAbsAvail )
+ {
+ // sonst beruecksichtigen wir die Raender nur, wenn auch Platz
+ // fuer sie da ist (nMin ist hier bereits berechnet!)
+ nAbsLeftFill = nAbsLeftFill + nLeftMargin;
+ nAbsRightFill = nAbsRightFill + nRightMargin;
+ }
+ }
+
+ // Filler-Zellen
+ if( !IsTopTable() )
+ {
+ if( pLeftFillerBox && nAbsLeftFill<MINLAY+nInhLeftBorderWidth )
+ nAbsLeftFill = MINLAY+nInhLeftBorderWidth;
+ if( pRightFillerBox && nAbsRightFill<MINLAY+nInhRightBorderWidth )
+ nAbsRightFill = MINLAY+nInhRightBorderWidth;
+ }
+
+ // Anpassen des verfuegbaren Platzes.
+ nRelLeftFill = 0;
+ nRelRightFill = 0;
+ if( !IsTopTable() && (nAbsLeftFill>0 || nAbsRightFill) )
+ {
+ sal_uLong nAbsLeftFillL = nAbsLeftFill, nAbsRightFillL = nAbsRightFill;
+
+ nRelLeftFill = (sal_uInt16)((nAbsLeftFillL * nRelAvail) / nAbsAvail);
+ nRelRightFill = (sal_uInt16)((nAbsRightFillL * nRelAvail) / nAbsAvail);
+
+ nAbsAvail -= (nAbsLeftFill + nAbsRightFill);
+ if( nRelAvail )
+ nRelAvail -= (nRelLeftFill + nRelRightFill);
+ }
+
+
+ // Schritt 2: Die absolute Tabellenbreite wird berechnet.
+ sal_uInt16 nAbsTabWidth = 0;
+ bUseRelWidth = sal_False;
+ if( nWidthOption )
+ {
+ if( bPrcWidthOption )
+ {
+ ASSERT( nWidthOption<=100, "Prozentangabe zu gross" );
+ if( nWidthOption > 100 )
+ nWidthOption = 100;
+
+ // Die absolute Breite entspricht den angegeben Prozent der
+ // zur Verfuegung stehenden Breite.
+ // Top-Tabellen bekommen nur eine relative Breite, wenn der
+ // verfuegbare Platz *echt groesser* ist als die Minimalbreite.
+ // ACHTUNG: Das "echte groesser" ist noetig, weil der Wechsel
+ // von einer relativen Breite zu einer absoluten Breite durch
+ // Resize sonst zu einer Endlosschleife fuehrt.
+ // Weil bei Tabellen in Rahmen kein Resize aufgerufen wird,
+ // wenn der Rahmen eine nicht-relative Breite besitzt, koennen
+ // wir da solche Spielchen nicht spielen
+ // MIB 19.2.98: Wegen fix #47394# spielen wir solche Spielchen
+ // jetzt doch. Dort war eine Grafik in einer 1%-breiten
+ // Tabelle und hat da natuerlich nicht hineingepasst.
+ nAbsTabWidth = (sal_uInt16)( ((sal_uLong)nAbsAvail * nWidthOption) / 100 );
+ if( IsTopTable() &&
+ ( /*MayBeInFlyFrame() ||*/ (sal_uLong)nAbsTabWidth > nMin ) )
+ {
+ nRelAvail = USHRT_MAX;
+ bUseRelWidth = sal_True;
+ }
+ }
+ else
+ {
+ nAbsTabWidth = nWidthOption;
+ if( nAbsTabWidth > MAX_TABWIDTH )
+ nAbsTabWidth = MAX_TABWIDTH;
+
+ // Tabellen in Tabellen duerfen niemals breiter werden als der
+ // verfuegbare Platz.
+ if( !IsTopTable() && nAbsTabWidth > nAbsAvail )
+ nAbsTabWidth = nAbsAvail;
+ }
+ }
+
+ ASSERT( IsTopTable() || nAbsTabWidth<=nAbsAvail,
+ "AutoLayout Pass2: nAbsTabWidth > nAbsAvail fuer Tab in Tab" );
+ ASSERT( !nRelAvail || nAbsTabWidth<=nAbsAvail,
+ "AutoLayout Pass2: nAbsTabWidth > nAbsAvail fuer relative Breite" );
+
+ // Catch fuer die beiden Asserts von oben (man weiss ja nie!)
+ if( (!IsTopTable() || nRelAvail>0) && nAbsTabWidth>nAbsAvail )
+ nAbsTabWidth = nAbsAvail;
+
+
+ // Schritt 3: Bestimmen der Spaltenbreiten und ggf. auch der
+ // absoluten und relativen Tabellenbreiten.
+ if( (!IsTopTable() && nMin > (sal_uLong)nAbsAvail) ||
+ nMin > MAX_TABWIDTH )
+ {
+ // Wenn
+ // - das Minumum einer inneren Tabelle groesser ist als der
+ // verfuegbare Platz, oder
+ // - das Minumum einer Top-Table groesser ist als USHRT_MAX
+ // muss die Tabelle an den verfuegbaren Platz bzw. USHRT_MAX
+ // abgepasst werden. Dabei bleiben die Verhaeltnisse der Breiten
+ // untereinander erhalten.
+
+ nAbsTabWidth = IsTopTable() ? MAX_TABWIDTH : nAbsAvail;
+ nRelTabWidth = (nRelAvail ? nRelAvail : nAbsTabWidth );
+
+ // First of all, we check wether we can fit the layout constrains,
+ // that are: Every cell's width excluding the borders must be at least
+ // MINLAY:
+
+ sal_uLong nRealMin = 0;
+ for( sal_uInt16 i=0; i<nCols; i++ )
+ {
+ sal_uLong nRealColMin = MINLAY, nDummy1, nDummy2;
+ AddBorderWidth( nRealColMin, nDummy1, nDummy2, i, 1 );
+ nRealMin += nRealColMin;
+ }
+ if( (nRealMin >= nAbsTabWidth) || (nRealMin >= nMin) )
+ {
+ // "Nichts geht mehr". We cannot get the minimum column widths
+ // the layout wants to have.
+
+ sal_uInt16 nAbs = 0, nRel = 0;
+ SwHTMLTableLayoutColumn *pColumn;
+ for( sal_uInt16 i=0; i<nCols-1; i++ )
+ {
+ pColumn = GetColumn( i );
+ sal_uLong nColMin = pColumn->GetMin();
+ if( nColMin <= USHRT_MAX )
+ {
+ pColumn->SetAbsColWidth(
+ (sal_uInt16)((nColMin * nAbsTabWidth) / nMin) );
+ pColumn->SetRelColWidth(
+ (sal_uInt16)((nColMin * nRelTabWidth) / nMin) );
+ }
+ else
+ {
+ double nColMinD = nColMin;
+ pColumn->SetAbsColWidth(
+ (sal_uInt16)((nColMinD * nAbsTabWidth) / nMin) );
+ pColumn->SetRelColWidth(
+ (sal_uInt16)((nColMinD * nRelTabWidth) / nMin) );
+ }
+
+ nAbs = nAbs + (sal_uInt16)pColumn->GetAbsColWidth();
+ nRel = nRel + (sal_uInt16)pColumn->GetRelColWidth();
+ }
+ pColumn = GetColumn( nCols-1 );
+ pColumn->SetAbsColWidth( nAbsTabWidth - nAbs );
+ pColumn->SetRelColWidth( nRelTabWidth - nRel );
+ }
+ else
+ {
+ sal_uLong nDistAbs = nAbsTabWidth - nRealMin;
+ sal_uLong nDistRel = nRelTabWidth - nRealMin;
+ sal_uLong nDistMin = nMin - nRealMin;
+ sal_uInt16 nAbs = 0, nRel = 0;
+ SwHTMLTableLayoutColumn *pColumn;
+ for( sal_uInt16 i=0; i<nCols-1; i++ )
+ {
+ pColumn = GetColumn( i );
+ sal_uLong nColMin = pColumn->GetMin();
+ sal_uLong nRealColMin = MINLAY, nDummy1, nDummy2;
+ AddBorderWidth( nRealColMin, nDummy1, nDummy2, i, 1 );
+
+ if( nColMin <= USHRT_MAX )
+ {
+ pColumn->SetAbsColWidth(
+ (sal_uInt16)((((nColMin-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) );
+ pColumn->SetRelColWidth(
+ (sal_uInt16)((((nColMin-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) );
+ }
+ else
+ {
+ double nColMinD = nColMin;
+ pColumn->SetAbsColWidth(
+ (sal_uInt16)((((nColMinD-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) );
+ pColumn->SetRelColWidth(
+ (sal_uInt16)((((nColMinD-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) );
+ }
+
+ nAbs = nAbs + (sal_uInt16)pColumn->GetAbsColWidth();
+ nRel = nRel + (sal_uInt16)pColumn->GetRelColWidth();
+ }
+ pColumn = GetColumn( nCols-1 );
+ pColumn->SetAbsColWidth( nAbsTabWidth - nAbs );
+ pColumn->SetRelColWidth( nRelTabWidth - nRel );
+ }
+ }
+ else if( nMax <= (sal_uLong)(nAbsTabWidth ? nAbsTabWidth : nAbsAvail) )
+ {
+ // Wenn
+ // - die Tabelle eine fixe Breite besitzt und das Maximum der
+ // Tabelle kleiner ist, oder
+ // - das Maximum kleiner ist als der verfuegbare Platz
+ // kann das Maximum direkt uebernommen werden bzw. die Tabelle nur
+ // unter Beruecksichtigung des Maxumums an die fixe Breite
+ // angepasst werden.
+
+ // Keine fixe Breite, dann das Maximum nehmen.
+ if( !nAbsTabWidth )
+ nAbsTabWidth = (sal_uInt16)nMax;
+
+ // Eine Top-Table darf auch beriter werden als der verfuegbare Platz.
+ if( nAbsTabWidth > nAbsAvail )
+ {
+ ASSERT( IsTopTable(),
+ "Tabelle in Tabelle soll breiter werden als umgebende Zelle" );
+ nAbsAvail = nAbsTabWidth;
+ }
+
+ // Nur den Anteil der relativen Breite verwenden, der auch fuer
+ // die absolute Breite verwendet wuerde.
+ sal_uLong nAbsTabWidthL = nAbsTabWidth;
+ nRelTabWidth =
+ ( nRelAvail ? (sal_uInt16)((nAbsTabWidthL * nRelAvail) / nAbsAvail)
+ : nAbsTabWidth );
+
+ // Gibt es Spalten mit und Spalten ohne %-Angabe?
+ sal_uLong nFixMax = nMax;
+ for( sal_uInt16 i=0; i<nCols; i++ )
+ {
+ const SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption()>0 )
+ nFixMax -= pColumn->GetMax();
+ }
+
+ if( nFixMax > 0 && nFixMax < nMax )
+ {
+ // ja, dann den zu verteilenden Platz nur auf die Spalten
+ // mit %-Angabe verteilen.
+
+ // In diesem (und nur in diesem) Fall gibt es Spalten,
+ // die ihre Maximalbreite genau einhalten, also weder
+ // schmaler noch breiter werden. Beim zurueckrechnen der
+ // absoluten Breite aus der relativen Breite kann es
+ // zu Rundungsfehlern kommen (bug #45598#). Um die auszugeleichen
+ // werden zuerst die fixen Breiten entsprechend korrigiert
+ // eingestellt und erst danach die relativen.
+
+ sal_uInt16 nAbs = 0, nRel = 0;
+ sal_uInt16 nFixedCols = 0;
+ sal_uInt16 i;
+
+ for( i = 0; i < nCols; i++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ if( !pColumn->IsRelWidthOption() || !pColumn->GetWidthOption() )
+ {
+ // Die Spalte behaelt ihre Breite bei.
+ nFixedCols++;
+ sal_uLong nColMax = pColumn->GetMax();
+ pColumn->SetAbsColWidth( (sal_uInt16)nColMax );
+
+ sal_uLong nRelColWidth =
+ (nColMax * nRelTabWidth) / nAbsTabWidth;
+ sal_uLong nChkWidth =
+ (nRelColWidth * nAbsTabWidth) / nRelTabWidth;
+ if( nChkWidth < nColMax )
+ nRelColWidth++;
+ else if( nChkWidth > nColMax )
+ nRelColWidth--;
+ pColumn->SetRelColWidth( (sal_uInt16)nRelColWidth );
+
+ nAbs = nAbs + (sal_uInt16)nColMax;
+ nRel = nRel + (sal_uInt16)nRelColWidth;
+ }
+ }
+
+ // Zu verteilende Anteile des Maximums und der relativen und
+ // absoluten Breiten. nFixMax entspricht an dieser Stelle
+ // nAbs, so dass man gleich nFixMax haette nehmen koennen.
+ // Der Code ist so aber verstaendlicher.
+ ASSERT( nFixMax == nAbs, "Zwei Schleifen, zwei Summen?" )
+ sal_uLong nDistMax = nMax - nFixMax;
+ sal_uInt16 nDistAbsTabWidth = nAbsTabWidth - nAbs;
+ sal_uInt16 nDistRelTabWidth = nRelTabWidth - nRel;
+
+ for( i=0; i<nCols; i++ )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
+ if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() > 0 )
+ {
+ // Die Spalte wird anteilig breiter.
+ nFixedCols++;
+ if( nFixedCols == nCols )
+ {
+ pColumn->SetAbsColWidth( nAbsTabWidth-nAbs );
+ pColumn->SetRelColWidth( nRelTabWidth-nRel );
+ }
+ else
+ {
+ sal_uLong nColMax = pColumn->GetMax();
+ pColumn->SetAbsColWidth(
+ (sal_uInt16)((nColMax * nDistAbsTabWidth) / nDistMax) );
+ pColumn->SetRelColWidth(
+ (sal_uInt16)((nColMax * nDistRelTabWidth) / nDistMax) );
+ }
+ nAbs = nAbs + pColumn->GetAbsColWidth();
+ nRel = nRel + pColumn->GetRelColWidth();
+ }
+ }
+ ASSERT( nCols==nFixedCols, "Spalte vergessen!" );
+ }
+ else
+ {
+ // nein, dann den zu verteilenden Platz auf alle Spalten
+ // gleichmaessig vertilen.
+ for( sal_uInt16 i=0; i<nCols; i++ )
+ {
+ sal_uLong nColMax = GetColumn( i )->GetMax();
+ GetColumn( i )->SetAbsColWidth(
+ (sal_uInt16)((nColMax * nAbsTabWidth) / nMax) );
+ GetColumn( i )->SetRelColWidth(
+ (sal_uInt16)((nColMax * nRelTabWidth) / nMax) );
+ }
+ }
+ }
+ else
+ {
+ // den ueber die Minimalbreite herausgehenden Platz entsprechend
+ // den einzelnen Spalten anteilig zuschlagen
+ if( !nAbsTabWidth )
+ nAbsTabWidth = nAbsAvail;
+ if( nAbsTabWidth < nMin )
+ nAbsTabWidth = (sal_uInt16)nMin;
+
+ if( nAbsTabWidth > nAbsAvail )
+ {
+ ASSERT( IsTopTable(),
+ "Tabelle in Tabelle soll breiter werden als Platz da ist" );
+ nAbsAvail = nAbsTabWidth;
+ }
+
+ sal_uLong nAbsTabWidthL = nAbsTabWidth;
+ nRelTabWidth =
+ ( nRelAvail ? (sal_uInt16)((nAbsTabWidthL * nRelAvail) / nAbsAvail)
+ : nAbsTabWidth );
+ double nW = nAbsTabWidth - nMin;
+ double nD = (nMax==nMin ? 1 : nMax-nMin);
+ sal_uInt16 nAbs = 0, nRel = 0;
+ for( sal_uInt16 i=0; i<nCols-1; i++ )
+ {
+ double nd = GetColumn( i )->GetMax() - GetColumn( i )->GetMin();
+ sal_uLong nAbsColWidth = GetColumn( i )->GetMin() + (sal_uLong)((nd*nW)/nD);
+ sal_uLong nRelColWidth = nRelAvail
+ ? (nAbsColWidth * nRelTabWidth) / nAbsTabWidth
+ : nAbsColWidth;
+
+ GetColumn( i )->SetAbsColWidth( (sal_uInt16)nAbsColWidth );
+ GetColumn( i )->SetRelColWidth( (sal_uInt16)nRelColWidth );
+ nAbs = nAbs + (sal_uInt16)nAbsColWidth;
+ nRel = nRel + (sal_uInt16)nRelColWidth;
+ }
+ GetColumn( nCols-1 )->SetAbsColWidth( nAbsTabWidth - nAbs );
+ GetColumn( nCols-1 )->SetRelColWidth( nRelTabWidth - nRel );
+
+ }
+
+ // Schritt 4: Fuer Tabellen in Tabellen kann es links und/oder rechts
+ // noch Ausgleichzellen geben. Deren Breite wird jetzt berechnet.
+ nInhAbsLeftSpace = 0;
+ nInhAbsRightSpace = 0;
+ if( !IsTopTable() && (nRelLeftFill>0 || nRelRightFill>0 ||
+ nAbsTabWidth<nAbsAvail) )
+ {
+ // Die Breite von zusaetzlichen Zellen zur Ausrichtung der
+ // inneren Tabelle bestimmen
+ sal_uInt16 nAbsDist = (sal_uInt16)(nAbsAvail-nAbsTabWidth);
+ sal_uInt16 nRelDist = (sal_uInt16)(nRelAvail-nRelTabWidth);
+ sal_uInt16 nParentInhAbsLeftSpace = 0, nParentInhAbsRightSpace = 0;
+
+ // Groesse und Position der zusaetzlichen Zellen bestimmen
+ switch( eTableAdjust )
+ {
+ case SVX_ADJUST_RIGHT:
+ nAbsLeftFill = nAbsLeftFill + nAbsDist;
+ nRelLeftFill = nRelLeftFill + nRelDist;
+ nParentInhAbsLeftSpace = nParentInhAbsSpace;
+ break;
+ case SVX_ADJUST_CENTER:
+ {
+ sal_uInt16 nAbsLeftDist = nAbsDist / 2;
+ nAbsLeftFill = nAbsLeftFill + nAbsLeftDist;
+ nAbsRightFill += nAbsDist - nAbsLeftDist;
+ sal_uInt16 nRelLeftDist = nRelDist / 2;
+ nRelLeftFill = nRelLeftFill + nRelLeftDist;
+ nRelRightFill += nRelDist - nRelLeftDist;
+ nParentInhAbsLeftSpace = nParentInhAbsSpace / 2;
+ nParentInhAbsRightSpace = nParentInhAbsSpace -
+ nParentInhAbsLeftSpace;
+ }
+ break;
+ case SVX_ADJUST_LEFT:
+ default:
+ nAbsRightFill = nAbsRightFill + nAbsDist;
+ nRelRightFill = nRelRightFill + nRelDist;
+ nParentInhAbsRightSpace = nParentInhAbsSpace;
+ break;
+ }
+
+ ASSERT( !pLeftFillerBox || nRelLeftFill>0,
+ "Fuer linke Filler-Box ist keine Breite da!" );
+ ASSERT( !pRightFillerBox || nRelRightFill>0,
+ "Fuer rechte Filler-Box ist keine Breite da!" );
+
+ // Filler-Breiten werden auf die ausseren Spalten geschlagen, wenn
+ // es nach dem ersten Durchlauf keine Boxen fuer sie gibt (nWidth>0)
+ // oder ihre Breite zu klein wuerde oder wenn es COL-Tags gibt und
+ // die Filler-Breite der Umrandung-Breite entspricht (dann haben wir
+ // die Tabelle wahrscheinlich selbst exportiert)
+ if( nRelLeftFill && !pLeftFillerBox &&
+ ( nWidthSet>0 || nAbsLeftFill<MINLAY+nInhLeftBorderWidth ||
+ (HasColTags() && nAbsLeftFill < nAbsLeftSpace+nParentInhAbsLeftSpace+20) ) )
+// (nAbsLeftFill<MINLAY || nAbsLeftFill<=nAbsLeftSpace) )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( 0 );
+ pColumn->SetAbsColWidth( pColumn->GetAbsColWidth()+nAbsLeftFill );
+ pColumn->SetRelColWidth( pColumn->GetRelColWidth()+nRelLeftFill );
+ nRelLeftFill = 0;
+ nInhAbsLeftSpace = nAbsLeftSpace + nParentInhAbsLeftSpace;
+ }
+ if( nRelRightFill && !pRightFillerBox &&
+ ( nWidthSet>0 || nAbsRightFill<MINLAY+nInhRightBorderWidth ||
+ (HasColTags() && nAbsRightFill < nAbsRightSpace+nParentInhAbsRightSpace+20) ) )
+// (nAbsRightFill<MINLAY || nAbsRightFill<=nAbsRightSpace) )
+ {
+ SwHTMLTableLayoutColumn *pColumn = GetColumn( nCols-1 );
+ pColumn->SetAbsColWidth( pColumn->GetAbsColWidth()+nAbsRightFill );
+ pColumn->SetRelColWidth( pColumn->GetRelColWidth()+nRelRightFill );
+ nRelRightFill = 0;
+ nInhAbsRightSpace = nAbsRightSpace + nParentInhAbsRightSpace;
+ }
+ }
+}
+
+static sal_Bool lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara );
+
+static sal_Bool lcl_ResizeBox( const SwTableBox*& rpBox, void* pPara )
+{
+ sal_uInt16 *pWidth = (sal_uInt16 *)pPara;
+
+ if( !rpBox->GetSttNd() )
+ {
+ sal_uInt16 nWidth = 0;
+ ((SwTableBox *)rpBox)->GetTabLines().ForEach( &lcl_ResizeLine, &nWidth );
+ rpBox->GetFrmFmt()->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth, 0 ));
+ *pWidth = *pWidth + nWidth;
+ }
+ else
+ {
+ *pWidth = *pWidth + (sal_uInt16)rpBox->GetFrmFmt()->GetFrmSize().GetSize().Width();
+ }
+
+ return sal_True;
+}
+
+static sal_Bool lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara )
+{
+ sal_uInt16 *pWidth = (sal_uInt16 *)pPara;
+#ifdef DBG_UTIL
+ sal_uInt16 nOldWidth = *pWidth;
+#endif
+ *pWidth = 0;
+ ((SwTableLine *)rpLine)->GetTabBoxes().ForEach( &lcl_ResizeBox, pWidth );
+
+#ifdef DBG_UTIL
+ ASSERT( !nOldWidth || Abs(*pWidth-nOldWidth) < COLFUZZY,
+ "Zeilen einer Box sind unterschiedlich lang" );
+#endif
+
+ return sal_True;
+}
+
+void SwHTMLTableLayout::SetWidths( sal_Bool bCallPass2, sal_uInt16 nAbsAvail,
+ sal_uInt16 nRelAvail, sal_uInt16 nAbsLeftSpace,
+ sal_uInt16 nAbsRightSpace,
+ sal_uInt16 nParentInhAbsSpace )
+{
+ // SetWidth muss am Ende einmal mehr fuer jede Zelle durchlaufen
+ // worden sein.
+ nWidthSet++;
+
+ // Schritt 0: Wenn noetig, wird hier noch der Pass2 des Layout-Alogithmus
+ // aufgerufen.
+ if( bCallPass2 )
+ AutoLayoutPass2( nAbsAvail, nRelAvail, nAbsLeftSpace, nAbsRightSpace,
+ nParentInhAbsSpace );
+
+ // Schritt 1: Setzten der neuen Breite an allen Content-Boxen.
+ // Da die Boxen nichts von der HTML-Tabellen-Struktur wissen, wird
+ // ueber die HTML-Tabellen-Struktur iteriert. Fuer Tabellen in Tabellen
+ // in Tabellen wird rekursiv SetWidth aufgerufen.
+ for( sal_uInt16 i=0; i<nRows; i++ )
+ {
+ for( sal_uInt16 j=0; j<nCols; j++ )
+ {
+ SwHTMLTableLayoutCell *pCell = GetCell( i, j );
+
+ SwHTMLTableLayoutCnts* pCntnts = pCell->GetContents();
+ while( pCntnts && !pCntnts->IsWidthSet(nWidthSet) )
+ {
+ SwTableBox *pBox = pCntnts->GetTableBox();
+ if( pBox )
+ {
+ SetBoxWidth( pBox, j, pCell->GetColSpan() );
+ }
+ else
+ {
+ sal_uInt16 nAbs = 0, nRel = 0, nLSpace = 0, nRSpace = 0,
+ nInhSpace = 0;
+ if( bCallPass2 )
+ {
+ sal_uInt16 nColSpan = pCell->GetColSpan();
+ GetAvail( j, nColSpan, nAbs, nRel );
+ nLSpace = GetLeftCellSpace( j, nColSpan );
+ nRSpace = GetRightCellSpace( j, nColSpan );
+ nInhSpace = GetInhCellSpace( j, nColSpan );
+ }
+ pCntnts->GetTable()->SetWidths( bCallPass2, nAbs, nRel,
+ nLSpace, nRSpace,
+ nInhSpace );
+ }
+
+ pCntnts->SetWidthSet( nWidthSet );
+ pCntnts = pCntnts->GetNext();
+ }
+ }
+ }
+
+ // Schritt 2: Wenn eine Top-Tabelle vorliegt, werden jetzt die Formate
+ // der Nicht-Content-Boxen angepasst. Da diese aufgrund der
+ // Garbage-Collection in der HTML-Tabelle nicht bekannt sind, muessen
+ // wir hier ueber die Tabelle iterieren. Bei der Gelegenheit wird auch
+ // das Tabellen-Frameformat angepasst. Fuer Tabellen in Tabellen werden
+ // stattdessen die Breiten der Filler-Zellen gesetzt.
+ if( IsTopTable() )
+ {
+ sal_uInt16 nCalcTabWidth = 0;
+ ((SwTable *)pSwTable)->GetTabLines().ForEach( &lcl_ResizeLine,
+ &nCalcTabWidth );
+ ASSERT( Abs( nRelTabWidth-nCalcTabWidth ) < COLFUZZY,
+ "Tabellebreite stimmt nicht mit Zeilenbreite ueberein." );
+
+ // Beim Anpassen des Tabellen-Formats dieses locken, weil sonst
+ // die Boxformate erneut angepasst werden. Ausserdem muss eine
+ // evtl. vorhandene %-Angabe in jedem Fall erhalten bleiben.
+ SwFrmFmt *pFrmFmt = pSwTable->GetFrmFmt();
+ ((SwTable *)pSwTable)->LockModify();
+ SwFmtFrmSize aFrmSize( pFrmFmt->GetFrmSize() );
+ aFrmSize.SetWidth( nRelTabWidth );
+ sal_Bool bRel = bUseRelWidth &&
+ text::HoriOrientation::FULL!=pFrmFmt->GetHoriOrient().GetHoriOrient();
+ aFrmSize.SetWidthPercent( (sal_uInt8)(bRel ? nWidthOption : 0) );
+ pFrmFmt->SetFmtAttr( aFrmSize );
+ ((SwTable *)pSwTable)->UnlockModify();
+
+ // Wenn die Tabelle in einem Rahmen steht, muss auch noch dessen
+ // breite angepasst werden.
+ if( MayBeInFlyFrame() )
+ {
+ SwFrmFmt *pFlyFrmFmt = FindFlyFrmFmt();
+ if( pFlyFrmFmt )
+ {
+ SwFmtFrmSize aFlyFrmSize( ATT_VAR_SIZE, nRelTabWidth, MINLAY );
+
+ if( bUseRelWidth )
+ {
+ // Bei %-Angaben wird die Breite auf das Minimum gesetzt.
+ aFlyFrmSize.SetWidth( nMin > USHRT_MAX ? USHRT_MAX
+ : nMin );
+ aFlyFrmSize.SetWidthPercent( (sal_uInt8)nWidthOption );
+ }
+ pFlyFrmFmt->SetFmtAttr( aFlyFrmSize );
+ }
+ }
+
+#ifdef DBG_UTIL
+ {
+ // steht im tblrwcl.cxx
+ extern void _CheckBoxWidth( const SwTableLine&, SwTwips );
+
+ // checke doch mal ob die Tabellen korrekte Breiten haben
+ SwTwips nSize = pSwTable->GetFrmFmt()->GetFrmSize().GetWidth();
+ const SwTableLines& rLines = pSwTable->GetTabLines();
+ for( sal_uInt16 n = 0; n < rLines.Count(); ++n )
+ _CheckBoxWidth( *rLines[ n ], nSize );
+ }
+#endif
+
+ }
+ else
+ {
+ if( pLeftFillerBox )
+ {
+ pLeftFillerBox->GetFrmFmt()->SetFmtAttr(
+ SwFmtFrmSize( ATT_VAR_SIZE, nRelLeftFill, 0 ));
+ }
+ if( pRightFillerBox )
+ {
+ pRightFillerBox->GetFrmFmt()->SetFmtAttr(
+ SwFmtFrmSize( ATT_VAR_SIZE, nRelRightFill, 0 ));
+ }
+ }
+}
+
+void SwHTMLTableLayout::_Resize( sal_uInt16 nAbsAvail, sal_Bool bRecalc )
+{
+ // Wenn bRecalc gestzt ist, hat sich am Inhalt der Tabelle etwas
+ // geaendert. Es muss dann der erste Pass noch einmal durchgefuehrt
+ // werden.
+ if( bRecalc )
+ AutoLayoutPass1();
+
+ SwRootFrm *pRoot = (SwRootFrm*)GetDoc()->GetCurrentViewShell()->GetLayout();
+ if ( pRoot && pRoot->IsCallbackActionEnabled() )
+ pRoot->StartAllAction(); //swmod 071108//swmod 071225
+
+ // Sonst koennen die Breiten gesetzt werden, wobei zuvor aber jewils
+ // noch der Pass 2 laufen muss.
+ SetWidths( sal_True, nAbsAvail );
+
+ if ( pRoot && pRoot->IsCallbackActionEnabled() )
+ pRoot->EndAllAction( sal_True ); //True per VirDev (Browsen ruhiger) //swmod 071108//swmod 071225
+}
+
+IMPL_STATIC_LINK( SwHTMLTableLayout, DelayedResize_Impl, void*, EMPTYARG )
+{
+#ifdef TEST_DELAYED_RESIZE
+ Sound::Beep( SOUND_WARNING );
+#endif
+ pThis->aResizeTimer.Stop();
+ pThis->_Resize( pThis->nDelayedResizeAbsAvail,
+ pThis->bDelayedResizeRecalc );
+
+ return 0;
+}
+
+
+sal_Bool SwHTMLTableLayout::Resize( sal_uInt16 nAbsAvail, sal_Bool bRecalc,
+ sal_Bool bForce, sal_uLong nDelay )
+{
+ if( 0 == nAbsAvail )
+ return sal_False;
+ ASSERT( IsTopTable(), "Resize darf nur an Top-Tabellen aufgerufen werden" );
+
+ // Darf die Tabelle uberhaupt Resized werden oder soll sie es trotzdem?
+ if( bMustNotResize && !bForce )
+ return sal_False;
+
+ // Darf ein Recalc der Tabelle durchgefuehrt werden?
+ if( bMustNotRecalc && !bForce )
+ bRecalc = sal_False;
+
+ const SwDoc *pDoc = GetDoc();
+
+ // Wenn es ein Layout gibt, wurde evtl. die Groesse der Root-Frames
+ // und nicht die der VisArea uebergeben. Wenn wir nicht in einem Rahmen
+ // stehen, muss die Tabelle allerdings fuer die VisArea berechnet werden,
+ // weil sond die Umschaltung von relativ nach absolut nicht funktioniert.
+ if( pDoc->GetCurrentViewShell() && pDoc->GetCurrentViewShell()->GetViewOptions()->getBrowseMode() )
+ {
+ const sal_uInt16 nVisAreaWidth = GetBrowseWidthByVisArea( *pDoc );
+ if( nVisAreaWidth < nAbsAvail && !FindFlyFrmFmt() )
+ nAbsAvail = nVisAreaWidth;
+ }
+
+ if( nDelay==0 && aResizeTimer.IsActive() )
+ {
+ // Wenn beim Aufruf eines synchronen Resize noch ein asynchrones
+ // Resize aussteht, dann werden nur die neuen Werte uebernommen.
+
+ bRecalc |= bDelayedResizeRecalc;
+ nDelayedResizeAbsAvail = nAbsAvail;
+ return sal_False;
+ }
+
+ // Optimierung:
+ // Wenn die Minima/Maxima nicht neu berechnet werden sollen und
+ // - die Breite der Tabelle nie neu berechnet werden muss, oder
+ // - die Tabelle schon fuer die uebergebene Breite berechnet wurde, oder
+ // - der verfuegbare Platz kleiner oder gleich der Minimalbreite ist
+ // und die Tabelle bereits die Minimalbreite besitzt, oder
+ // - der verfuegbare Platz groesser ist als die Maximalbreite und
+ // die Tabelle bereits die Maximalbreite besitzt
+ // wird sich an der Tabelle nichts aendern.
+ if( !bRecalc && ( !bMustResize ||
+ (nLastResizeAbsAvail==nAbsAvail) ||
+ (nAbsAvail<=nMin && nRelTabWidth==nMin) ||
+ (!bPrcWidthOption && nAbsAvail>=nMax && nRelTabWidth==nMax) ) )
+ return sal_False;
+
+ if( nDelay==HTMLTABLE_RESIZE_NOW )
+ {
+ if( aResizeTimer.IsActive() )
+ aResizeTimer.Stop();
+ _Resize( nAbsAvail, bRecalc );
+ }
+ else if( nDelay > 0 )
+ {
+ nDelayedResizeAbsAvail = nAbsAvail;
+ bDelayedResizeRecalc = bRecalc;
+ aResizeTimer.SetTimeout( nDelay );
+ aResizeTimer.Start();
+#ifdef TEST_DELAYED_RESIZE
+ Sound::Beep( SOUND_DEFAULT );
+#endif
+ }
+ else
+ {
+ _Resize( nAbsAvail, bRecalc );
+ }
+
+ return sal_True;
+}
+
+void SwHTMLTableLayout::BordersChanged( sal_uInt16 nAbsAvail, sal_Bool bRecalc )
+{
+ bBordersChanged = sal_True;
+
+ Resize( nAbsAvail, bRecalc );
+}
+
+
diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx
new file mode 100644
index 000000000000..c29e7a80c665
--- /dev/null
+++ b/sw/source/core/doc/lineinfo.cxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "doc.hxx"
+#include "lineinfo.hxx"
+#include "charfmt.hxx"
+#include "poolfmt.hxx"
+#include "rootfrm.hxx"
+#include "viewsh.hxx"
+#include <set>
+void SwDoc::SetLineNumberInfo( const SwLineNumberInfo &rNew )
+{
+ SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
+ if ( pTmpRoot &&
+ (rNew.IsCountBlankLines() != pLineNumberInfo->IsCountBlankLines() ||
+ rNew.IsRestartEachPage() != pLineNumberInfo->IsRestartEachPage()) )
+ {
+ std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();//swmod 080225
+ pTmpRoot->StartAllAction();
+ // FME 2007-08-14 #i80120# Invalidate size, because ChgThisLines()
+ // is only (onny may only be) called by the formatting routines
+ //pTmpRoot->InvalidateAllCntnt( INV_LINENUM | INV_SIZE );
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_LINENUM | INV_SIZE));//swmod 080226
+ pTmpRoot->EndAllAction();
+ } //swmod 080219
+ *pLineNumberInfo = rNew;
+ SetModified();
+}
+
+const SwLineNumberInfo& SwDoc::GetLineNumberInfo() const
+{
+ return *pLineNumberInfo;
+}
+
+SwLineNumberInfo::SwLineNumberInfo() :
+ nPosFromLeft( MM50 ),
+ nCountBy( 5 ),
+ nDividerCountBy( 3 ),
+ ePos( LINENUMBER_POS_LEFT ),
+ bPaintLineNumbers( sal_False ),
+ bCountBlankLines( sal_True ),
+ bCountInFlys( sal_False ),
+ bRestartEachPage( sal_False )
+{
+}
+
+SwLineNumberInfo::SwLineNumberInfo(const SwLineNumberInfo &rCpy ) : SwClient(),
+ aType( rCpy.GetNumType() ),
+ aDivider( rCpy.GetDivider() ),
+ nPosFromLeft( rCpy.GetPosFromLeft() ),
+ nCountBy( rCpy.GetCountBy() ),
+ nDividerCountBy( rCpy.GetDividerCountBy() ),
+ ePos( rCpy.GetPos() ),
+ bPaintLineNumbers( rCpy.IsPaintLineNumbers() ),
+ bCountBlankLines( rCpy.IsCountBlankLines() ),
+ bCountInFlys( rCpy.IsCountInFlys() ),
+ bRestartEachPage( rCpy.IsRestartEachPage() )
+{
+ if ( rCpy.GetRegisteredIn() )
+ ((SwModify*)rCpy.GetRegisteredIn())->Add( this );
+}
+
+SwLineNumberInfo& SwLineNumberInfo::operator=(const SwLineNumberInfo &rCpy)
+{
+ if ( rCpy.GetRegisteredIn() )
+ ((SwModify*)rCpy.GetRegisteredIn())->Add( this );
+ else if ( GetRegisteredIn() )
+ GetRegisteredInNonConst()->Remove( this );
+
+ aType = rCpy.GetNumType();
+ aDivider = rCpy.GetDivider();
+ nPosFromLeft = rCpy.GetPosFromLeft();
+ nCountBy = rCpy.GetCountBy();
+ nDividerCountBy = rCpy.GetDividerCountBy();
+ ePos = rCpy.GetPos();
+ bPaintLineNumbers = rCpy.IsPaintLineNumbers();
+ bCountBlankLines = rCpy.IsCountBlankLines();
+ bCountInFlys = rCpy.IsCountInFlys();
+ bRestartEachPage = rCpy.IsRestartEachPage();
+
+ return *this;
+}
+
+sal_Bool SwLineNumberInfo::operator==( const SwLineNumberInfo& rInf ) const
+{
+ return GetRegisteredIn() == rInf.GetRegisteredIn() &&
+ aType.GetNumberingType() == rInf.GetNumType().GetNumberingType() &&
+ aDivider == rInf.GetDivider() &&
+ nPosFromLeft == rInf.GetPosFromLeft() &&
+ nCountBy == rInf.GetCountBy() &&
+ nDividerCountBy == rInf.GetDividerCountBy() &&
+ ePos == rInf.GetPos() &&
+ bPaintLineNumbers == rInf.IsPaintLineNumbers() &&
+ bCountBlankLines == rInf.IsCountBlankLines() &&
+ bCountInFlys == rInf.IsCountInFlys() &&
+ bRestartEachPage == rInf.IsRestartEachPage();
+}
+
+
+SwCharFmt* SwLineNumberInfo::GetCharFmt( IDocumentStylePoolAccess& rIDSPA ) const
+{
+ if ( !GetRegisteredIn() )
+ {
+ SwCharFmt* pFmt = rIDSPA.GetCharFmtFromPool( RES_POOLCHR_LINENUM );
+ pFmt->Add( (SwClient*)this );
+ }
+ return (SwCharFmt*)GetRegisteredIn();
+}
+
+void SwLineNumberInfo::SetCharFmt( SwCharFmt *pChFmt )
+{
+ ASSERT( pChFmt, "SetCharFmt, 0 is not a valid pointer" );
+ pChFmt->Add( this );
+}
+
+void SwLineNumberInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+{
+ CheckRegistration( pOld, pNew );
+ SwDoc *pDoc = ((SwCharFmt*)GetRegisteredIn())->GetDoc();
+ SwRootFrm* pRoot = pDoc->GetCurrentLayout();
+ if( pRoot )
+ {
+ pRoot->StartAllAction();
+ std::set<SwRootFrm*> aAllLayouts = pDoc->GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllAddPaintRect));//swmod 080305
+ //pRoot->GetCurrShell()->AddPaintRect( pRoot->Frm() );
+ pRoot->EndAllAction();
+ }
+}
+
diff --git a/sw/source/core/doc/list.cxx b/sw/source/core/doc/list.cxx
new file mode 100644
index 000000000000..81f139bba99e
--- /dev/null
+++ b/sw/source/core/doc/list.cxx
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+
+#include <list.hxx>
+
+#include <vector>
+#include <numrule.hxx>
+#include <ndarr.hxx>
+#include <node.hxx>
+#include <pam.hxx>
+#include <SwNodeNum.hxx>
+
+// ----------------------------------------------------------------------------
+// SwListImpl
+// implementation class for SwList
+// ----------------------------------------------------------------------------
+class SwListImpl
+{
+ public:
+ SwListImpl( const String sListId,
+ SwNumRule& rDefaultListStyle,
+ const SwNodes& rNodes );
+ ~SwListImpl();
+
+ const String GetListId() const;
+
+ const String GetDefaultListStyleName() const;
+
+ void InsertListItem( SwNodeNum& rNodeNum,
+ const int nLevel );
+ void RemoveListItem( SwNodeNum& rNodeNum );
+
+ void InvalidateListTree();
+ void ValidateListTree();
+
+ void MarkListLevel( const int nListLevel,
+ const sal_Bool bValue );
+
+ bool IsListLevelMarked( const int nListLevel ) const;
+
+ private:
+ // unique identifier of the list
+ const String msListId;
+ // default list style for the list items, identified by the list style name
+ String msDefaultListStyleName;
+
+ // list trees for certain document ranges
+ typedef std::pair<SwNodeNum*, SwPaM*> tListTreeForRange;
+ typedef std::vector<tListTreeForRange> tListTrees;
+ tListTrees maListTrees;
+
+ int mnMarkedListLevel;
+
+ void NotifyItemsOnListLevel( const int nLevel );
+};
+
+SwListImpl::SwListImpl( const String sListId,
+ SwNumRule& rDefaultListStyle,
+ const SwNodes& rNodes )
+ : msListId( sListId ),
+ msDefaultListStyleName( rDefaultListStyle.GetName() ),
+ maListTrees(),
+ mnMarkedListLevel( MAXLEVEL )
+{
+ // create empty list trees for the document ranges
+ const SwNode* pNode = rNodes[0];
+ do
+ {
+ SwPaM aPam( *pNode, *pNode->EndOfSectionNode() );
+
+ SwNodeNum* pNumberTreeRootNode = new SwNodeNum( &rDefaultListStyle );
+ SwPaM* pPam = new SwPaM( *(aPam.Start()), *(aPam.End()) );
+ tListTreeForRange aListTreeForRange( pNumberTreeRootNode, pPam );
+ maListTrees.push_back( aListTreeForRange );
+
+ pNode = pNode->EndOfSectionNode();
+ if (pNode != &rNodes.GetEndOfContent())
+ {
+ sal_uLong nIndex = pNode->GetIndex();
+ nIndex++;
+ pNode = rNodes[nIndex];
+ }
+ }
+ while ( pNode != &rNodes.GetEndOfContent() );
+}
+
+SwListImpl::~SwListImpl()
+{
+ tListTrees::iterator aNumberTreeIter;
+ for ( aNumberTreeIter = maListTrees.begin();
+ aNumberTreeIter != maListTrees.end();
+ ++aNumberTreeIter )
+ {
+ SwNodeNum::HandleNumberTreeRootNodeDelete( *((*aNumberTreeIter).first) );
+ delete (*aNumberTreeIter).first;
+ delete (*aNumberTreeIter).second;
+ }
+}
+
+const String SwListImpl::GetListId() const
+{
+ return msListId;
+}
+
+const String SwListImpl::GetDefaultListStyleName() const
+{
+ return msDefaultListStyleName;
+}
+
+void SwListImpl::InsertListItem( SwNodeNum& rNodeNum,
+ const int nLevel )
+{
+ const SwPosition aPosOfNodeNum( rNodeNum.GetPosition() );
+ const SwNodes* pNodesOfNodeNum = &(aPosOfNodeNum.nNode.GetNode().GetNodes());
+
+ tListTrees::const_iterator aNumberTreeIter;
+ for ( aNumberTreeIter = maListTrees.begin();
+ aNumberTreeIter != maListTrees.end();
+ ++aNumberTreeIter )
+ {
+ const SwPosition* pStart = (*aNumberTreeIter).second->Start();
+ const SwPosition* pEnd = (*aNumberTreeIter).second->End();
+ const SwNodes* pRangeNodes = &(pStart->nNode.GetNode().GetNodes());
+
+ if ( pRangeNodes == pNodesOfNodeNum &&
+ *pStart <= aPosOfNodeNum && aPosOfNodeNum <= *pEnd)
+ {
+ (*aNumberTreeIter).first->AddChild( &rNodeNum, nLevel );
+
+ break;
+ }
+ }
+}
+
+void SwListImpl::RemoveListItem( SwNodeNum& rNodeNum )
+{
+ rNodeNum.RemoveMe();
+}
+
+void SwListImpl::InvalidateListTree()
+{
+ tListTrees::iterator aNumberTreeIter;
+ for ( aNumberTreeIter = maListTrees.begin();
+ aNumberTreeIter != maListTrees.end();
+ ++aNumberTreeIter )
+ {
+ (*aNumberTreeIter).first->InvalidateTree();
+ }
+}
+
+void SwListImpl::ValidateListTree()
+{
+ tListTrees::iterator aNumberTreeIter;
+ for ( aNumberTreeIter = maListTrees.begin();
+ aNumberTreeIter != maListTrees.end();
+ ++aNumberTreeIter )
+ {
+ (*aNumberTreeIter).first->NotifyInvalidChildren();
+ }
+}
+
+void SwListImpl::MarkListLevel( const int nListLevel,
+ const sal_Bool bValue )
+{
+ if ( bValue )
+ {
+ if ( nListLevel != mnMarkedListLevel )
+ {
+ if ( mnMarkedListLevel != MAXLEVEL )
+ {
+ // notify former marked list nodes
+ NotifyItemsOnListLevel( mnMarkedListLevel );
+ }
+
+ mnMarkedListLevel = nListLevel;
+
+ // notify new marked list nodes
+ NotifyItemsOnListLevel( mnMarkedListLevel );
+ }
+ }
+ else
+ {
+ if ( mnMarkedListLevel != MAXLEVEL )
+ {
+ // notify former marked list nodes
+ NotifyItemsOnListLevel( mnMarkedListLevel );
+ }
+
+ mnMarkedListLevel = MAXLEVEL;
+ }
+}
+
+bool SwListImpl::IsListLevelMarked( const int nListLevel ) const
+{
+ return nListLevel == mnMarkedListLevel;
+}
+
+void SwListImpl::NotifyItemsOnListLevel( const int nLevel )
+{
+ tListTrees::iterator aNumberTreeIter;
+ for ( aNumberTreeIter = maListTrees.begin();
+ aNumberTreeIter != maListTrees.end();
+ ++aNumberTreeIter )
+ {
+ (*aNumberTreeIter).first->NotifyNodesOnListLevel( nLevel );
+ }
+}
+
+// ----------------------------------------------------------------------------
+// SwList
+// ----------------------------------------------------------------------------
+SwList::SwList( const String sListId,
+ SwNumRule& rDefaultListStyle,
+ const SwNodes& rNodes )
+ : mpListImpl( new SwListImpl( sListId, rDefaultListStyle, rNodes ) )
+{
+}
+
+SwList::~SwList()
+{
+ delete mpListImpl;
+}
+
+const String SwList::GetListId() const
+{
+ return mpListImpl->GetListId();
+}
+
+const String SwList::GetDefaultListStyleName() const
+{
+ return mpListImpl->GetDefaultListStyleName();
+}
+
+void SwList::InsertListItem( SwNodeNum& rNodeNum,
+ const int nLevel )
+{
+ mpListImpl->InsertListItem( rNodeNum, nLevel );
+}
+
+void SwList::RemoveListItem( SwNodeNum& rNodeNum )
+{
+ mpListImpl->RemoveListItem( rNodeNum );
+}
+
+void SwList::InvalidateListTree()
+{
+ mpListImpl->InvalidateListTree();
+}
+
+void SwList::ValidateListTree()
+{
+ mpListImpl->ValidateListTree();
+}
+
+void SwList::MarkListLevel( const int nListLevel,
+ const sal_Bool bValue )
+{
+ mpListImpl->MarkListLevel( nListLevel, bValue );
+}
+
+bool SwList::IsListLevelMarked( const int nListLevel ) const
+{
+ return mpListImpl->IsListLevelMarked( nListLevel );
+}
+
+//void SwList::ContinueList( SwList& rList )
+//{
+// mpListImpl->ContinueList( rList );
+//}
+//const SwList* SwList::GetContinuedList() const
+//{
+// return mpListImpl->GetContinuedList();
+//}
+//void SwList::ClearContinuation()
+//{
+// mpListImpl->ClearContinuation();
+//}
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
new file mode 100644
index 000000000000..74da906022f6
--- /dev/null
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -0,0 +1,1098 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/print.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/svapp.hxx>
+#include <svtools/imapobj.hxx>
+#include <svtools/imap.hxx>
+#include <svl/urihelper.hxx>
+#include <svtools/soerr.hxx>
+#include <sfx2/progress.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/printer.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/colritem.hxx>
+#include <svx/xoutbmp.hxx>
+#include <vcl/window.hxx>
+#include <fmturl.hxx>
+#include <fmtsrnd.hxx>
+#include <frmfmt.hxx>
+#include <swrect.hxx>
+#include <fesh.hxx>
+#include <doc.hxx>
+#include <flyfrm.hxx>
+#include <frmtool.hxx>
+#include <viewopt.hxx>
+#include <viewimp.hxx>
+#include <pam.hxx>
+#include <hints.hxx>
+#include <rootfrm.hxx>
+#include <dflyobj.hxx>
+#include <pagefrm.hxx>
+#include <notxtfrm.hxx>
+#include <grfatr.hxx>
+#include <charatr.hxx>
+#include <fmtornt.hxx>
+#include <ndnotxt.hxx>
+#include <ndgrf.hxx>
+#include <ndole.hxx>
+#include <swregion.hxx>
+#include <poolfmt.hxx>
+#include <mdiexp.hxx>
+#include <swwait.hxx>
+#include <comcore.hrc>
+#include <accessibilityoptions.hxx>
+#include <com/sun/star/embed/EmbedMisc.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+
+#include <svtools/embedhlp.hxx>
+#include <svtools/chartprettypainter.hxx>
+// --> OD 2009-03-05 #i99665#
+#include <dview.hxx>
+// <--
+
+using namespace com::sun::star;
+
+#define DEFTEXTSIZE 12
+
+extern void ClrContourCache( const SdrObject *pObj ); // TxtFly.Cxx
+
+
+inline sal_Bool GetRealURL( const SwGrfNode& rNd, String& rTxt )
+{
+ sal_Bool bRet = rNd.GetFileFilterNms( &rTxt, 0 );
+ if( bRet )
+ rTxt = URIHelper::removePassword( rTxt, INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS);
+ return bRet;
+}
+
+void lcl_PaintReplacement( const SwRect &rRect, const String &rText,
+ const ViewShell &rSh, const SwNoTxtFrm *pFrm,
+ sal_Bool bDefect )
+{
+ static Font *pFont = 0;
+ if ( !pFont )
+ {
+ pFont = new Font();
+ pFont->SetWeight( WEIGHT_BOLD );
+ pFont->SetStyleName( aEmptyStr );
+ pFont->SetName( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "Arial Unicode" )));
+ pFont->SetFamily( FAMILY_SWISS );
+ pFont->SetTransparent( sal_True );
+ }
+
+ Color aCol( COL_RED );
+ FontUnderline eUnderline = UNDERLINE_NONE;
+ const SwFmtURL &rURL = pFrm->FindFlyFrm()->GetFmt()->GetURL();
+ if( rURL.GetURL().Len() || rURL.GetMap() )
+ {
+ sal_Bool bVisited = sal_False;
+ if ( rURL.GetMap() )
+ {
+ ImageMap *pMap = (ImageMap*)rURL.GetMap();
+ for( sal_uInt16 i = 0; i < pMap->GetIMapObjectCount(); i++ )
+ {
+ IMapObject *pObj = pMap->GetIMapObject( i );
+ if( rSh.GetDoc()->IsVisitedURL( pObj->GetURL() ) )
+ {
+ bVisited = sal_True;
+ break;
+ }
+ }
+ }
+ else if ( rURL.GetURL().Len() )
+ bVisited = rSh.GetDoc()->IsVisitedURL( rURL.GetURL() );
+
+ SwFmt *pFmt = rSh.GetDoc()->GetFmtFromPool( static_cast<sal_uInt16>
+ (bVisited ? RES_POOLCHR_INET_VISIT : RES_POOLCHR_INET_NORMAL ) );
+ aCol = pFmt->GetColor().GetValue();
+ eUnderline = pFmt->GetUnderline().GetLineStyle();
+ }
+
+ pFont->SetUnderline( eUnderline );
+ pFont->SetColor( aCol );
+
+ const BitmapEx& rBmp = ViewShell::GetReplacementBitmap( bDefect != sal_False );
+ Graphic::DrawEx( rSh.GetOut(), rText, *pFont, rBmp, rRect.Pos(), rRect.SSize() );
+}
+
+/*************************************************************************
+|*
+|* SwGrfFrm::SwGrfFrm(ViewShell * const,SwGrfNode *)
+|*
+|* Beschreibung
+|* Ersterstellung JP 05.03.91
+|* Letzte Aenderung MA 03. Mar. 93
+|*
+*************************************************************************/
+
+
+SwNoTxtFrm::SwNoTxtFrm(SwNoTxtNode * const pNode, SwFrm* pSib )
+ : SwCntntFrm( pNode, pSib )
+{
+ InitCtor();
+}
+
+// Initialisierung: z.Zt. Eintragen des Frames im Cache
+
+
+void SwNoTxtFrm::InitCtor()
+{
+ nType = FRMC_NOTXT;
+ // Das Gewicht der Grafik ist 0, wenn sie noch nicht
+ // gelesen ist, < 0, wenn ein Lesefehler auftrat und
+ // Ersatzdarstellung angewendet werden musste und >0,
+ // wenn sie zur Verfuegung steht.
+ nWeight = 0;
+}
+
+/*************************************************************************
+|*
+|* SwNoTxtNode::MakeFrm()
+|*
+|* Beschreibung
+|* Ersterstellung JP 05.03.91
+|* Letzte Aenderung MA 03. Mar. 93
+|*
+*************************************************************************/
+
+
+SwCntntFrm *SwNoTxtNode::MakeFrm( SwFrm* pSib )
+{
+ return new SwNoTxtFrm(this, pSib);
+}
+
+/*************************************************************************
+|*
+|* SwNoTxtFrm::~SwNoTxtFrm()
+|*
+|* Beschreibung
+|* Ersterstellung JP 05.03.91
+|* Letzte Aenderung MA 30. Apr. 96
+|*
+*************************************************************************/
+
+SwNoTxtFrm::~SwNoTxtFrm()
+{
+ StopAnimation();
+}
+
+/*************************************************************************
+|*
+|* void SwNoTxtFrm::Modify( SwHint * pOld, SwHint * pNew )
+|*
+|* Beschreibung
+|* Ersterstellung JP 05.03.91
+|* Letzte Aenderung JP 05.03.91
+|*
+*************************************************************************/
+
+void SetOutDev( ViewShell *pSh, OutputDevice *pOut )
+{
+ pSh->pOut = pOut;
+}
+
+
+
+
+void lcl_ClearArea( const SwFrm &rFrm,
+ OutputDevice &rOut, const SwRect& rPtArea,
+ const SwRect &rGrfArea )
+{
+ SwRegionRects aRegion( rPtArea, 4, 4 );
+ aRegion -= rGrfArea;
+
+ if ( aRegion.Count() )
+ {
+ const SvxBrushItem *pItem; const Color *pCol; SwRect aOrigRect;
+ if ( rFrm.GetBackgroundBrush( pItem, pCol, aOrigRect, sal_False ) )
+ for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ ::DrawGraphic( pItem, &rOut, aOrigRect, aRegion[i] );
+ else
+ {
+ // OD 2004-04-23 #116347#
+ rOut.Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
+ rOut.SetFillColor( rFrm.getRootFrm()->GetCurrShell()->Imp()->GetRetoucheColor());
+ rOut.SetLineColor();
+ for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ rOut.DrawRect( aRegion[i].SVRect() );
+ rOut.Pop();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* void SwNoTxtFrm::Paint()
+|*
+|* Beschreibung
+|* Ersterstellung JP 05.03.91
+|* Letzte Aenderung MA 10. Jan. 97
+|*
+*************************************************************************/
+
+void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
+{
+ if ( Frm().IsEmpty() )
+ return;
+
+ const ViewShell* pSh = getRootFrm()->GetCurrShell();
+ if( !pSh->GetViewOptions()->IsGraphic() )
+ {
+ StopAnimation();
+ // OD 10.01.2003 #i6467# - no paint of placeholder for page preview
+ if ( pSh->GetWin() && !pSh->IsPreView() )
+ {
+ const SwNoTxtNode* pNd = GetNode()->GetNoTxtNode();
+ String aTxt( pNd->GetTitle() );
+ if ( !aTxt.Len() && pNd->IsGrfNode() )
+ GetRealURL( *(SwGrfNode*)pNd, aTxt );
+ if( !aTxt.Len() )
+ aTxt = FindFlyFrm()->GetFmt()->GetName();
+ lcl_PaintReplacement( Frm(), aTxt, *pSh, this, sal_False );
+ }
+ return;
+ }
+
+ if( pSh->GetAccessibilityOptions()->IsStopAnimatedGraphics() ||
+ // --> FME 2004-06-21 #i9684# Stop animation during printing/pdf export
+ !pSh->GetWin() )
+ // <--
+ StopAnimation();
+
+ SfxProgress::EnterLock(); //Keine Progress-Reschedules im Paint (SwapIn)
+
+ OutputDevice *pOut = pSh->GetOut();
+ pOut->Push();
+ sal_Bool bClip = sal_True;
+ PolyPolygon aPoly;
+
+ SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode();
+ SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
+ if( pGrfNd )
+ pGrfNd->SetFrameInPaint( sal_True );
+
+ // OD 16.04.2003 #i13147# - add 2nd parameter with value <sal_True> to
+ // method call <FindFlyFrm().GetContour(..)> to indicate that it is called
+ // for paint in order to avoid load of the intrinsic graphic.
+ if ( ( !pOut->GetConnectMetaFile() ||
+ !pSh->GetWin() ) &&
+ FindFlyFrm()->GetContour( aPoly, sal_True )
+ )
+ {
+ pOut->SetClipRegion( aPoly );
+ bClip = sal_False;
+ }
+
+ SwRect aOrigPaint( rRect );
+ if ( HasAnimation() && pSh->GetWin() )
+ {
+ aOrigPaint = Frm(); aOrigPaint += Prt().Pos();
+ }
+
+ SwRect aGrfArea( Frm() );
+ SwRect aPaintArea( aGrfArea );
+ aPaintArea._Intersection( aOrigPaint );
+
+ SwRect aNormal( Frm().Pos() + Prt().Pos(), Prt().SSize() );
+ aNormal.Justify(); //Normalisiertes Rechteck fuer die Vergleiche
+
+ if( aPaintArea.IsOver( aNormal ) )
+ {
+ // berechne die 4 zu loeschenden Rechtecke
+ if( pSh->GetWin() )
+ ::lcl_ClearArea( *this, *pSh->GetOut(), aPaintArea, aNormal );
+
+ // in der Schnittmenge vom PaintBereich und der Bitmap liegt
+ // der absolut sichtbare Bereich vom Frame
+ aPaintArea._Intersection( aNormal );
+
+ if ( bClip )
+ pOut->IntersectClipRegion( aPaintArea.SVRect() );
+ /// OD 25.09.2002 #99739# - delete unused 3rd parameter
+ PaintPicture( pOut, aGrfArea );
+ }
+ else
+ // wenn nicht sichtbar, loesche einfach den angegebenen Bereich
+ lcl_ClearArea( *this, *pSh->GetOut(), aPaintArea, SwRect() );
+ if( pGrfNd )
+ pGrfNd->SetFrameInPaint( sal_False );
+
+ pOut->Pop();
+ SfxProgress::LeaveLock();
+}
+
+/*************************************************************************
+|*
+|* void lcl_CalcRect( Point & aPt, Size & aDim,
+|* sal_uInt16 nMirror )
+|*
+|* Beschreibung Errechne die Position und die Groesse der Grafik im
+|* Frame, entsprechen der aktuellen Grafik-Attribute
+|*
+|* Parameter Point& die Position im Frame ( auch Return-Wert )
+|* Size& die Groesse der Grafik ( auch Return-Wert )
+|* MirrorGrf akt. Spiegelungs-Attribut
+|* Ersterstellung JP 04.03.91
+|* Letzte Aenderung JP 31.08.94
+|*
+*************************************************************************/
+
+
+void lcl_CalcRect( Point& rPt, Size& rDim, sal_uInt16 nMirror )
+{
+ if( nMirror == RES_MIRROR_GRAPH_VERT || nMirror == RES_MIRROR_GRAPH_BOTH )
+ {
+ rPt.X() += rDim.Width() -1;
+ rDim.Width() = -rDim.Width();
+ }
+
+ if( nMirror == RES_MIRROR_GRAPH_HOR || nMirror == RES_MIRROR_GRAPH_BOTH )
+ {
+ rPt.Y() += rDim.Height() -1;
+ rDim.Height() = -rDim.Height();
+ }
+}
+
+/*************************************************************************
+|*
+|* void SwNoTxtFrm::GetGrfArea()
+|*
+|* Beschreibung Errechne die Position und die Groesse der Bitmap
+|* innerhalb des uebergebenem Rechtecks.
+|*
+|* Ersterstellung JP 03.09.91
+|* Letzte Aenderung MA 11. Oct. 94
+|*
+*************************************************************************/
+
+void SwNoTxtFrm::GetGrfArea( SwRect &rRect, SwRect* pOrigRect,
+ sal_Bool ) const
+{
+ // JP 23.01.2001: currently only used for scaling, cropping and mirroring
+ // the contour of graphics!
+ // all other is handled by the GraphicObject
+
+ //In rRect wird das sichbare Rechteck der Grafik gesteckt.
+ //In pOrigRect werden Pos+Size der Gesamtgrafik gesteck.
+
+ const SwAttrSet& rAttrSet = GetNode()->GetSwAttrSet();
+ const SwCropGrf& rCrop = rAttrSet.GetCropGrf();
+ sal_uInt16 nMirror = rAttrSet.GetMirrorGrf().GetValue();
+
+ if( rAttrSet.GetMirrorGrf().IsGrfToggle() )
+ {
+ if( !(FindPageFrm()->GetVirtPageNum() % 2) )
+ {
+ switch ( nMirror )
+ {
+ case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT; break;
+ case RES_MIRROR_GRAPH_VERT: nMirror = RES_MIRROR_GRAPH_DONT; break;
+ case RES_MIRROR_GRAPH_HOR: nMirror = RES_MIRROR_GRAPH_BOTH; break;
+ default: nMirror = RES_MIRROR_GRAPH_HOR; break;
+ }
+ }
+ }
+
+ //Grafik wird vom Node eingelesen falls notwendig. Kann aber schiefgehen.
+ long nLeftCrop, nRightCrop, nTopCrop, nBottomCrop;
+ Size aOrigSz( ((SwNoTxtNode*)GetNode())->GetTwipSize() );
+ if ( !aOrigSz.Width() )
+ {
+ aOrigSz.Width() = Prt().Width();
+ nLeftCrop = -rCrop.GetLeft();
+ nRightCrop = -rCrop.GetRight();
+ }
+ else
+ {
+ nLeftCrop = Max( aOrigSz.Width() -
+ (rCrop.GetRight() + rCrop.GetLeft()), long(1) );
+ const double nScale = double(Prt().Width()) / double(nLeftCrop);
+ nLeftCrop = long(nScale * -rCrop.GetLeft() );
+ nRightCrop = long(nScale * -rCrop.GetRight() );
+ }
+
+ // crop values have to be mirrored too
+ if( nMirror == RES_MIRROR_GRAPH_VERT || nMirror == RES_MIRROR_GRAPH_BOTH )
+ {
+ long nTmpCrop = nLeftCrop;
+ nLeftCrop = nRightCrop;
+ nRightCrop= nTmpCrop;
+ }
+
+ if( !aOrigSz.Height() )
+ {
+ aOrigSz.Height() = Prt().Height();
+ nTopCrop = -rCrop.GetTop();
+ nBottomCrop= -rCrop.GetBottom();
+ }
+ else
+ {
+ nTopCrop = Max( aOrigSz.Height() - (rCrop.GetTop() + rCrop.GetBottom()), long(1) );
+ const double nScale = double(Prt().Height()) / double(nTopCrop);
+ nTopCrop = long(nScale * -rCrop.GetTop() );
+ nBottomCrop= long(nScale * -rCrop.GetBottom() );
+ }
+
+ // crop values have to be mirrored too
+ if( nMirror == RES_MIRROR_GRAPH_HOR || nMirror == RES_MIRROR_GRAPH_BOTH )
+ {
+ long nTmpCrop = nTopCrop;
+ nTopCrop = nBottomCrop;
+ nBottomCrop= nTmpCrop;
+ }
+
+ Size aVisSz( Prt().SSize() );
+ Size aGrfSz( aVisSz );
+ Point aVisPt( Frm().Pos() + Prt().Pos() );
+ Point aGrfPt( aVisPt );
+
+ //Erst das 'sichtbare' Rect einstellen.
+ if ( nLeftCrop > 0 )
+ {
+ aVisPt.X() += nLeftCrop;
+ aVisSz.Width() -= nLeftCrop;
+ }
+ if ( nTopCrop > 0 )
+ {
+ aVisPt.Y() += nTopCrop;
+ aVisSz.Height() -= nTopCrop;
+ }
+ if ( nRightCrop > 0 )
+ aVisSz.Width() -= nRightCrop;
+ if ( nBottomCrop > 0 )
+ aVisSz.Height() -= nBottomCrop;
+
+ rRect.Pos ( aVisPt );
+ rRect.SSize( aVisSz );
+
+ //Ggf. Die Gesamtgrafik berechnen
+ if ( pOrigRect )
+ {
+ Size aTmpSz( aGrfSz );
+ aGrfPt.X() += nLeftCrop;
+ aTmpSz.Width() -= nLeftCrop + nRightCrop;
+ aGrfPt.Y() += nTopCrop;
+ aTmpSz.Height()-= nTopCrop + nBottomCrop;
+
+ if( RES_MIRROR_GRAPH_DONT != nMirror )
+ lcl_CalcRect( aGrfPt, aTmpSz, nMirror );
+
+ pOrigRect->Pos ( aGrfPt );
+ pOrigRect->SSize( aTmpSz );
+ }
+}
+
+/*************************************************************************
+|*
+|* Size SwNoTxtFrm::GetSize()
+|*
+|* Beschreibung Gebe die Groesse des umgebenen FLys und
+|* damit die der Grafik zurueck.
+|* Ersterstellung JP 04.03.91
+|* Letzte Aenderung JP 31.08.94
+|*
+*************************************************************************/
+
+
+const Size& SwNoTxtFrm::GetSize() const
+{
+ // gebe die Groesse des Frames zurueck
+ const SwFrm *pFly = FindFlyFrm();
+ if( !pFly )
+ pFly = this;
+ return pFly->Prt().SSize();
+}
+
+/*************************************************************************
+|*
+|* SwNoTxtFrm::MakeAll()
+|*
+|* Ersterstellung MA 29. Nov. 96
+|* Letzte Aenderung MA 29. Nov. 96
+|*
+*************************************************************************/
+
+
+void SwNoTxtFrm::MakeAll()
+{
+ SwCntntNotify aNotify( this );
+ SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
+ const SwBorderAttrs &rAttrs = *aAccess.Get();
+
+ while ( !bValidPos || !bValidSize || !bValidPrtArea )
+ {
+ MakePos();
+
+ if ( !bValidSize )
+ Frm().Width( GetUpper()->Prt().Width() );
+
+ MakePrtArea( rAttrs );
+
+ if ( !bValidSize )
+ { bValidSize = sal_True;
+ Format();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SwNoTxtFrm::Format()
+|*
+|* Beschreibung Errechne die Groesse der Bitmap, wenn noetig
+|* Ersterstellung JP 11.03.91
+|* Letzte Aenderung MA 13. Mar. 96
+|*
+*************************************************************************/
+
+
+void SwNoTxtFrm::Format( const SwBorderAttrs * )
+{
+ const Size aNewSize( GetSize() );
+
+ // hat sich die Hoehe geaendert?
+ SwTwips nChgHght = IsVertical() ?
+ (SwTwips)(aNewSize.Width() - Prt().Width()) :
+ (SwTwips)(aNewSize.Height() - Prt().Height());
+ if( nChgHght > 0)
+ Grow( nChgHght );
+ else if( nChgHght < 0)
+ Shrink( Min(Prt().Height(), -nChgHght) );
+}
+
+/*************************************************************************
+|*
+|* SwNoTxtFrm::GetCharRect()
+|*
+|* Beschreibung
+|* Ersterstellung SS 29-Apr-1991
+|* Letzte Aenderung MA 10. Oct. 94
+|*
+|*************************************************************************/
+
+
+sal_Bool SwNoTxtFrm::GetCharRect( SwRect &rRect, const SwPosition& rPos,
+ SwCrsrMoveState *pCMS ) const
+{
+ if ( &rPos.nNode.GetNode() != (SwNode*)GetNode() )
+ return sal_False;
+
+ Calc();
+ SwRect aFrameRect( Frm() );
+ rRect = aFrameRect;
+ rRect.Pos( Frm().Pos() + Prt().Pos() );
+ rRect.SSize( Prt().SSize() );
+
+ rRect.Justify();
+
+ // liegt die Bitmap ueberhaupt im sichtbaren Berich ?
+ if( !aFrameRect.IsOver( rRect ) )
+ {
+ // wenn nicht dann steht der Cursor auf dem Frame
+ rRect = aFrameRect;
+ rRect.Width( 1 );
+ }
+ else
+ rRect._Intersection( aFrameRect );
+
+ if ( pCMS )
+ {
+ if ( pCMS->bRealHeight )
+ {
+ pCMS->aRealHeight.Y() = rRect.Height();
+ pCMS->aRealHeight.X() = 0;
+ }
+ }
+
+ return sal_True;
+}
+
+
+sal_Bool SwNoTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& ,
+ SwCrsrMoveState* ) const
+{
+ SwCntntNode* pCNd = (SwCntntNode*)GetNode();
+ pPos->nNode = *pCNd;
+ pPos->nContent.Assign( pCNd, 0 );
+ return sal_True;
+}
+
+#define CLEARCACHE( pNd ) {\
+ (pNd)->GetGrfObj().ReleaseFromCache();\
+ SwFlyFrm* pFly = FindFlyFrm();\
+ if( pFly && pFly->GetFmt()->GetSurround().IsContour() )\
+ {\
+ ClrContourCache( pFly->GetVirtDrawObj() );\
+ pFly->NotifyBackground( FindPageFrm(), Prt(), PREP_FLY_ATTR_CHG );\
+ }\
+}
+
+void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+{
+ sal_uInt16 nWhich = pNew ? pNew->Which() : pOld ? pOld->Which() : 0;
+
+ // --> OD 2007-03-06 #i73788#
+ // no <SwCntntFrm::Modify(..)> for RES_LINKED_GRAPHIC_STREAM_ARRIVED
+ if ( RES_GRAPHIC_PIECE_ARRIVED != nWhich &&
+ RES_GRAPHIC_ARRIVED != nWhich &&
+ RES_GRF_REREAD_AND_INCACHE != nWhich &&
+ RES_LINKED_GRAPHIC_STREAM_ARRIVED != nWhich )
+ // <--
+ {
+ SwCntntFrm::Modify( pOld, pNew );
+ }
+
+ sal_Bool bComplete = sal_True;
+
+ switch( nWhich )
+ {
+ case RES_OBJECTDYING:
+ break;
+
+ case RES_GRF_REREAD_AND_INCACHE:
+ if( ND_GRFNODE == GetNode()->GetNodeType() )
+ {
+ bComplete = sal_False;
+ SwGrfNode* pNd = (SwGrfNode*) GetNode();
+
+ ViewShell *pVSh = 0;
+ pNd->GetDoc()->GetEditShell( &pVSh );
+ if( pVSh )
+ {
+ GraphicAttr aAttr;
+ if( pNd->GetGrfObj().IsCached( pVSh->GetOut(), Point(),
+ Prt().SSize(), &pNd->GetGraphicAttr( aAttr, this ) ))
+ {
+ ViewShell *pSh = pVSh;
+ do {
+ SET_CURR_SHELL( pSh );
+ if( pSh->GetWin() )
+ {
+ if( pSh->IsPreView() )
+ ::RepaintPagePreview( pSh, Frm().SVRect() );
+ else
+ pSh->GetWin()->Invalidate( Frm().SVRect() );
+ }
+ } while( pVSh != (pSh = (ViewShell*)pSh->GetNext() ));
+ }
+ else
+ pNd->SwapIn();
+ }
+ }
+ break;
+
+ case RES_UPDATE_ATTR:
+ case RES_FMT_CHG:
+ CLEARCACHE( (SwGrfNode*) GetNode() )
+ break;
+
+ case RES_ATTRSET_CHG:
+ {
+ sal_uInt16 n;
+ for( n = RES_GRFATR_BEGIN; n < RES_GRFATR_END; ++n )
+ if( SFX_ITEM_SET == ((SwAttrSetChg*)pOld)->GetChgSet()->
+ GetItemState( n, sal_False ))
+ {
+ CLEARCACHE( (SwGrfNode*) GetNode() )
+ break;
+ }
+ if( RES_GRFATR_END == n ) // not found
+ return ;
+ }
+ break;
+
+ case RES_GRAPHIC_PIECE_ARRIVED:
+ case RES_GRAPHIC_ARRIVED:
+ // --> OD 2007-03-06 #i73788#
+ // handle RES_LINKED_GRAPHIC_STREAM_ARRIVED as RES_GRAPHIC_ARRIVED
+ case RES_LINKED_GRAPHIC_STREAM_ARRIVED:
+ // <--
+ if ( GetNode()->GetNodeType() == ND_GRFNODE )
+ {
+ bComplete = sal_False;
+ SwGrfNode* pNd = (SwGrfNode*) GetNode();
+
+ CLEARCACHE( pNd )
+
+ SwRect aRect( Frm() );
+
+ ViewShell *pVSh = 0;
+ pNd->GetDoc()->GetEditShell( &pVSh );
+ if( !pVSh )
+ break;
+
+ ViewShell *pSh = pVSh;
+ do {
+ SET_CURR_SHELL( pSh );
+ if( pSh->IsPreView() )
+ {
+ if( pSh->GetWin() )
+ ::RepaintPagePreview( pSh, aRect );
+ }
+ else if ( pSh->VisArea().IsOver( aRect ) &&
+ OUTDEV_WINDOW == pSh->GetOut()->GetOutDevType() )
+ {
+ // OD 27.11.2002 #105519# - invalidate instead of painting
+ pSh->GetWin()->Invalidate( aRect.SVRect() );
+ }
+
+ pSh = (ViewShell *)pSh->GetNext();
+ } while( pSh != pVSh );
+ }
+ break;
+
+ default:
+ if ( !pNew || !isGRFATR(nWhich) )
+ return;
+ }
+
+ if( bComplete )
+ {
+ InvalidatePrt();
+ SetCompletePaint();
+ }
+}
+
+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.
+/// OD 25.09.2002 #99739# - delete unused 3rd parameter.
+/// OD 25.09.2002 #99739# - use aligned rectangle for drawing graphic.
+/// OD 25.09.2002 #99739# - pixel-align coordinations for drawing graphic.
+void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) const
+{
+ ViewShell* pShell = getRootFrm()->GetCurrShell();
+
+ SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode();
+ SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
+ SwOLENode* pOLENd = rNoTNd.GetOLENode();
+
+ const sal_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 );
+
+ 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 )
+ {
+ sal_Bool bForceSwap = sal_False, bContinue = sal_True;
+ GraphicObject& rGrfObj = pGrfNd->GetGrfObj();
+
+ GraphicAttr aGrfAttr;
+ pGrfNd->GetGraphicAttr( aGrfAttr, this );
+
+ if( !bPrn )
+ {
+ // --> OD 2007-01-02 #i73788#
+ if ( pGrfNd->IsLinkedInputStreamReady() )
+ {
+ pGrfNd->UpdateLinkWithInputStream();
+ }
+ // <--
+ // --> OD 2008-01-30 #i85717#
+ // --> OD 2008-07-21 #i90395# - check, if asynchronous retrieval
+ // if input stream for the graphic is possible
+// else if( GRAPHIC_DEFAULT == rGrfObj.GetType() &&
+ else if ( ( rGrfObj.GetType() == GRAPHIC_DEFAULT ||
+ rGrfObj.GetType() == GRAPHIC_NONE ) &&
+ pGrfNd->IsLinkedFile() &&
+ pGrfNd->IsAsyncRetrieveInputStreamPossible() )
+ // <--
+ {
+ Size aTmpSz;
+ ::sfx2::SvLinkSource* pGrfObj = pGrfNd->GetLink()->GetObj();
+ if( !pGrfObj ||
+ !pGrfObj->IsDataComplete() ||
+ !(aTmpSz = pGrfNd->GetTwipSize()).Width() ||
+ !aTmpSz.Height() || !pGrfNd->GetAutoFmtLvl() )
+ {
+ // --> OD 2006-12-22 #i73788#
+ pGrfNd->TriggerAsyncRetrieveInputStream();
+ // <--
+ }
+ String aTxt( pGrfNd->GetTitle() );
+ if ( !aTxt.Len() )
+ GetRealURL( *pGrfNd, aTxt );
+ ::lcl_PaintReplacement( aAlignedGrfArea, aTxt, *pShell, this, sal_False );
+ bContinue = sal_False;
+ }
+ else if( rGrfObj.IsCached( pOut, aAlignedGrfArea.Pos(),
+ aAlignedGrfArea.SSize(), &aGrfAttr ))
+ {
+ rGrfObj.DrawWithPDFHandling( *pOut,
+ aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(),
+ &aGrfAttr );
+ bContinue = sal_False;
+ }
+ }
+
+ if( bContinue )
+ {
+ const sal_Bool bSwapped = rGrfObj.IsSwappedOut();
+ const sal_Bool bSwappedIn = 0 != pGrfNd->SwapIn( bPrn );
+ if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic())
+ {
+ const sal_Bool bAnimate = rGrfObj.IsAnimated() &&
+ !pShell->IsPreView() &&
+ !pShell->GetAccessibilityOptions()->IsStopAnimatedGraphics() &&
+ // --> FME 2004-06-21 #i9684# Stop animation during printing/pdf export
+ pShell->GetWin();
+ // <--
+
+ if( bAnimate &&
+ FindFlyFrm() != ::GetFlyFromMarked( 0, pShell ))
+ {
+ OutputDevice* pVout;
+ if( pOut == pShell->GetOut() && SwRootFrm::FlushVout() )
+ pVout = pOut, pOut = pShell->GetOut();
+ else if( pShell->GetWin() &&
+ OUTDEV_VIRDEV == pOut->GetOutDevType() )
+ pVout = pOut, pOut = pShell->GetWin();
+ else
+ pVout = 0;
+
+ ASSERT( OUTDEV_VIRDEV != pOut->GetOutDevType() ||
+ pShell->GetViewOptions()->IsPDFExport(),
+ "pOut sollte kein virtuelles Device sein" );
+
+ rGrfObj.StartAnimation( pOut, aAlignedGrfArea.Pos(),
+ aAlignedGrfArea.SSize(), long(this),
+ 0, GRFMGR_DRAW_STANDARD, pVout );
+ }
+ else
+ rGrfObj.DrawWithPDFHandling( *pOut,
+ aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(),
+ &aGrfAttr );
+ }
+ else
+ {
+ sal_uInt16 nResId = 0;
+ if( bSwappedIn )
+ {
+ if( GRAPHIC_NONE == rGrfObj.GetType() )
+ nResId = STR_COMCORE_READERROR;
+ else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
+ nResId = STR_COMCORE_CANT_SHOW;
+ }
+ ((SwNoTxtFrm*)this)->nWeight = -1;
+ String aText;
+ if ( !nResId &&
+ !(aText = pGrfNd->GetTitle()).Len() &&
+ (!GetRealURL( *pGrfNd, aText ) || !aText.Len()))
+ {
+ nResId = STR_COMCORE_READERROR;
+ }
+ if ( nResId )
+ aText = SW_RESSTR( nResId );
+
+ ::lcl_PaintReplacement( aAlignedGrfArea, aText, *pShell, this, sal_True );
+ }
+
+ //Beim Drucken duerfen wir nicht die Grafiken sammeln...
+ if( bSwapped && bPrn )
+ bForceSwap = sal_True;
+ }
+ if( bForceSwap )
+ pGrfNd->SwapOut();
+ }
+ else if( bIsChart
+ //charts must be painted resolution dependent!! #i82893#, #i75867#
+ && ChartPrettyPainter::ShouldPrettyPaintChartOnThisDevice( pOut )
+ && svt::EmbeddedObjectRef::TryRunningState( pOLENd->GetOLEObj().GetOleRef() )
+ && ChartPrettyPainter::DoPrettyPaintChart( uno::Reference< frame::XModel >(
+ pOLENd->GetOLEObj().GetOleRef()->getComponent(), uno::UNO_QUERY), pOut, aAlignedGrfArea.SVRect() ) )
+ {
+ (void)(0);//all was done in if statement
+ }
+ else if( pOLENd )
+ {
+ // --> OD 2009-03-05 #i99665#
+ // Adjust AntiAliasing mode at output device for chart OLE
+ const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
+ if ( pOLENd->IsChart() &&
+ pShell->Imp()->GetDrawView()->IsAntiAliasing() )
+ {
+ const sal_uInt16 nAntialiasingForChartOLE =
+ nFormerAntialiasingAtOutput | ANTIALIASING_PIXELSNAPHAIRLINE;
+ pOut->SetAntialiasing( nAntialiasingForChartOLE );
+ }
+ // <--
+
+ Point aPosition(aAlignedGrfArea.Pos());
+ Size aSize(aAlignedGrfArea.SSize());
+
+ // Im BrowseModus gibt es nicht unbedingt einen Drucker und
+ // damit kein JobSetup, also legen wir eines an ...
+ const JobSetup* pJobSetup = pOLENd->getIDocumentDeviceAccess()->getJobsetup();
+ sal_Bool bDummyJobSetup = 0 == pJobSetup;
+ if( bDummyJobSetup )
+ pJobSetup = new JobSetup();
+
+ // #i42323#
+ // The reason for #114233# is gone, so i remove it again
+ //TODO/LATER: is it a problem that the JopSetup isn't used?
+ //xRef->DoDraw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), *pJobSetup );
+
+ // get hi-contrast image, but never for printing
+ Graphic* pGraphic = NULL;
+ if (pOut && !bPrn && Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ pGraphic = pOLENd->GetHCGraphic();
+
+ // when it is not possible to get HC-representation, the original image should be used
+ if ( !pGraphic )
+ pGraphic = pOLENd->GetGraphic();
+
+ if ( pGraphic && pGraphic->GetType() != GRAPHIC_NONE )
+ {
+ pGraphic->Draw( pOut, aPosition, aSize );
+
+ // shade the representation if the object is activated outplace
+ uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef();
+ if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::ACTIVE )
+ {
+ ::svt::EmbeddedObjectRef::DrawShading( Rectangle( aPosition, aSize ), pOut );
+ }
+ }
+ else
+ ::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut );
+
+ if( bDummyJobSetup )
+ delete pJobSetup; // ... und raeumen wieder auf.
+
+ sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
+ if ( !bPrn && pShell->ISA( SwCrsrShell ) &&
+ nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+ {
+ const SwFlyFrm *pFly = FindFlyFrm();
+ ASSERT( pFly, "OLE not in FlyFrm" );
+ ((SwFEShell*)pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm());
+ }
+
+ // --> OD 2009-03-05 #i99665#
+ if ( pOLENd->IsChart() &&
+ pShell->Imp()->GetDrawView()->IsAntiAliasing() )
+ {
+ pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
+ }
+ // <--
+ }
+}
+
+
+sal_Bool SwNoTxtFrm::IsTransparent() const
+{
+ const ViewShell* pSh = getRootFrm()->GetCurrShell();
+ if ( !pSh || !pSh->GetViewOptions()->IsGraphic() )
+ return sal_True;
+
+ const SwGrfNode *pNd;
+ if( 0 != (pNd = GetNode()->GetGrfNode()) )
+ return pNd->IsTransparent();
+
+ //#29381# OLE sind immer Transparent.
+ return sal_True;
+}
+
+
+void SwNoTxtFrm::StopAnimation( OutputDevice* pOut ) const
+{
+ //animierte Grafiken anhalten
+ SwGrfNode* pGrfNd = (SwGrfNode*)GetNode()->GetGrfNode();
+ if( pGrfNd && pGrfNd->IsAnimated() )
+ pGrfNd->GetGrfObj().StopAnimation( pOut, long(this) );
+}
+
+
+sal_Bool SwNoTxtFrm::HasAnimation() const
+{
+ const SwGrfNode* pGrfNd = GetNode()->GetGrfNode();
+ return pGrfNd && pGrfNd->IsAnimated();
+}
+
+
+
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
new file mode 100644
index 000000000000..ee1b832fd777
--- /dev/null
+++ b/sw/source/core/doc/number.cxx
@@ -0,0 +1,1694 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#include <string.h>
+#include <vcl/font.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/numitem.hxx>
+#include <fmtornt.hxx>
+#include <doc.hxx>
+#include <pam.hxx>
+#include <charfmt.hxx>
+#include <paratr.hxx>
+#include <frmfmt.hxx>
+#include <ndtxt.hxx>
+#include <docary.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <SwStyleNameMapper.hxx>
+// --> OD 2006-06-28 #b6440955#
+// Needed to load default bullet list configuration
+#include <unotools/configitem.hxx>
+// <--
+#include <numrule.hxx>
+#include <SwNodeNum.hxx>
+
+#include <hash_map>
+// --> OD 2008-02-19 #refactorlists#
+#include <list.hxx>
+#include <algorithm>
+// <--
+// --> OD 2008-06-06 #i89178#
+#include <unotools/saveopt.hxx>
+// <--
+// --> OD 2008-07-08 #i91400#
+#include <IDocumentListsAccess.hxx>
+// <--
+
+using namespace ::com::sun::star;
+
+
+sal_uInt16 SwNumRule::nRefCount = 0;
+SwNumFmt* SwNumRule::aBaseFmts[ RULE_END ][ MAXLEVEL ] = {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
+// --> OD 2008-02-11 #newlistlevelattrs#
+SwNumFmt* SwNumRule::aLabelAlignmentBaseFmts[ RULE_END ][ MAXLEVEL ] = {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
+
+char sOutline[] = "Outline";
+char* SwNumRule::pDefOutlineName = sOutline;
+
+// #i30312#
+sal_uInt16 SwNumRule::aDefNumIndents[ MAXLEVEL ] = {
+//inch: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
+ 1440/4, 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, 1440*7/4, 1440*2,
+ 1440*9/4, 1440*5/2
+};
+
+const SwNumFmt& SwNumRule::Get( sal_uInt16 i ) const
+{
+ ASSERT_ID( i < MAXLEVEL && eRuleType < RULE_END, ERR_NUMLEVEL);
+ return aFmts[ i ]
+ ? *aFmts[ i ]
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ : ( meDefaultNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION
+ ? *aBaseFmts[ eRuleType ][ i ]
+ : *aLabelAlignmentBaseFmts[ eRuleType ][ i ] );
+ // <--
+}
+
+const SwNumFmt* SwNumRule::GetNumFmt( sal_uInt16 i ) const
+{
+ const SwNumFmt * pResult = NULL;
+
+ ASSERT_ID( i < MAXLEVEL && eRuleType < RULE_END, ERR_NUMLEVEL);
+ if ( i < MAXLEVEL && eRuleType < RULE_END)
+ {
+ pResult = aFmts[ i ];
+ }
+
+ return pResult;
+}
+
+// --> OD 2008-07-08 #i91400#
+void SwNumRule::SetName( const String & rName,
+ IDocumentListsAccess& rDocListAccess)
+// <--
+{
+ if ( sName != rName )
+ {
+ if (pNumRuleMap)
+ {
+ pNumRuleMap->erase(sName);
+ (*pNumRuleMap)[rName] = this;
+
+ // --> OD 2008-07-08 #i91400#
+ if ( GetDefaultListId().Len() > 0 )
+ {
+ rDocListAccess.trackChangeOfListStyleName( sName, rName );
+ }
+ // <--
+ }
+
+ sName = rName;
+ }
+}
+
+// --> OD 2008-02-19 #refactorlists#
+void SwNumRule::GetTxtNodeList( SwNumRule::tTxtNodeList& rTxtNodeList ) const
+{
+ rTxtNodeList = maTxtNodeList;
+}
+
+SwNumRule::tTxtNodeList::size_type SwNumRule::GetTxtNodeListSize() const
+{
+ return maTxtNodeList.size();
+}
+
+void SwNumRule::AddTxtNode( SwTxtNode& rTxtNode )
+{
+ tTxtNodeList::iterator aIter =
+ std::find( maTxtNodeList.begin(), maTxtNodeList.end(), &rTxtNode );
+
+ if ( aIter == maTxtNodeList.end() )
+ {
+ maTxtNodeList.push_back( &rTxtNode );
+ }
+}
+
+void SwNumRule::RemoveTxtNode( SwTxtNode& rTxtNode )
+{
+ tTxtNodeList::iterator aIter =
+ std::find( maTxtNodeList.begin(), maTxtNodeList.end(), &rTxtNode );
+
+ if ( aIter != maTxtNodeList.end() )
+ {
+ maTxtNodeList.erase( aIter );
+ }
+}
+// <--
+
+void SwNumRule::SetNumRuleMap(std::hash_map<String, SwNumRule *, StringHash> *
+ _pNumRuleMap)
+{
+ pNumRuleMap = _pNumRuleMap;
+}
+
+sal_uInt16 SwNumRule::GetNumIndent( sal_uInt8 nLvl )
+{
+ ASSERT( MAXLEVEL > nLvl, "NumLevel is out of range" );
+ return aDefNumIndents[ nLvl ];
+}
+
+sal_uInt16 SwNumRule::GetBullIndent( sal_uInt8 nLvl )
+{
+ ASSERT( MAXLEVEL > nLvl, "NumLevel is out of range" );
+ return aDefNumIndents[ nLvl ];
+}
+
+
+
+static void lcl_SetRuleChgd( SwTxtNode& rNd, sal_uInt8 nLevel )
+{
+ if( rNd.GetActualListLevel() == nLevel )
+ rNd.NumRuleChgd();
+}
+/* -----------------------------22.02.01 13:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwNumFmt::SwNumFmt() :
+ SvxNumberFormat(SVX_NUM_ARABIC),
+ SwClient( 0 ),
+ pVertOrient(new SwFmtVertOrient( 0, text::VertOrientation::NONE))
+{
+}
+/* -----------------------------22.02.01 13:42--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwNumFmt::SwNumFmt( const SwNumFmt& rFmt) :
+ SvxNumberFormat(rFmt),
+ SwClient( rFmt.GetRegisteredInNonConst() ),
+ pVertOrient(new SwFmtVertOrient( 0, rFmt.GetVertOrient()))
+{
+ sal_Int16 eMyVertOrient = rFmt.GetVertOrient();
+ SetGraphicBrush( rFmt.GetBrush(), &rFmt.GetGraphicSize(),
+ &eMyVertOrient);
+}
+/* -----------------------------22.02.01 13:58--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwNumFmt::SwNumFmt(const SvxNumberFormat& rNumFmt, SwDoc* pDoc) :
+ SvxNumberFormat(rNumFmt),
+ pVertOrient(new SwFmtVertOrient( 0, rNumFmt.GetVertOrient()))
+{
+ sal_Int16 eMyVertOrient = rNumFmt.GetVertOrient();
+ SetGraphicBrush( rNumFmt.GetBrush(), &rNumFmt.GetGraphicSize(),
+ &eMyVertOrient);
+ const String& rCharStyleName = rNumFmt.SvxNumberFormat::GetCharFmtName();
+ if( rCharStyleName.Len() )
+ {
+ SwCharFmt* pCFmt = pDoc->FindCharFmtByName( rCharStyleName );
+ if( !pCFmt )
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rCharStyleName,
+ nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ pCFmt = nId != USHRT_MAX
+ ? pDoc->GetCharFmtFromPool( nId )
+ : pDoc->MakeCharFmt( rCharStyleName, 0 );
+ }
+ pCFmt->Add( this );
+ }
+ else if( GetRegisteredIn() )
+ GetRegisteredInNonConst()->Remove( this );
+
+}
+/* -----------------------------22.02.01 13:42--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwNumFmt::~SwNumFmt()
+{
+ delete pVertOrient;
+}
+/* -----------------------------02.07.01 15:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNumFmt::NotifyGraphicArrived()
+{
+ if( GetCharFmt() )
+ UpdateNumNodes( (SwDoc*)GetCharFmt()->GetDoc() );
+}
+
+// #i22362#
+sal_Bool SwNumFmt::IsEnumeration() const
+{
+ // --> FME 2004-08-12 #i30655# native numbering did not work any longer
+ // using this code. Therefore HBRINKM and I agreed upon defining
+ // IsEnumeration() as !IsItemize()
+ return !IsItemize();
+ // <--
+
+ /*
+ sal_Bool bResult;
+
+ switch(GetNumberingType())
+ {
+ case SVX_NUM_CHARS_UPPER_LETTER:
+ case SVX_NUM_CHARS_LOWER_LETTER:
+ case SVX_NUM_ROMAN_UPPER:
+ case SVX_NUM_ROMAN_LOWER:
+ case SVX_NUM_ARABIC:
+ case SVX_NUM_PAGEDESC:
+ case SVX_NUM_CHARS_UPPER_LETTER_N:
+ case SVX_NUM_CHARS_LOWER_LETTER_N:
+ bResult = sal_True;
+
+ break;
+
+ default:
+ bResult = sal_False;
+ }
+
+ return bResult;
+ */
+}
+
+// #i29560#
+sal_Bool SwNumFmt::IsItemize() const
+{
+ sal_Bool bResult;
+
+ switch(GetNumberingType())
+ {
+ case SVX_NUM_CHAR_SPECIAL:
+ case SVX_NUM_BITMAP:
+ bResult = sal_True;
+
+ break;
+
+ default:
+ bResult = sal_False;
+ }
+
+ return bResult;
+
+}
+
+
+/* -----------------------------23.02.01 09:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwNumFmt& SwNumFmt::operator=( const SwNumFmt& rNumFmt)
+{
+ SvxNumberFormat::operator=(rNumFmt);
+ if( rNumFmt.GetRegisteredIn() )
+ rNumFmt.GetRegisteredInNonConst()->Add( this );
+ else if( GetRegisteredIn() )
+ GetRegisteredInNonConst()->Remove( this );
+ return *this;
+}
+/* -----------------------------23.02.01 09:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwNumFmt::operator==( const SwNumFmt& rNumFmt) const
+{
+ sal_Bool bRet = SvxNumberFormat::operator==(rNumFmt) &&
+ GetRegisteredIn() == rNumFmt.GetRegisteredIn();
+ return bRet;
+}
+
+/* -----------------------------22.02.01 13:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNumFmt::SetCharFmt( SwCharFmt* pChFmt)
+{
+ if( pChFmt )
+ pChFmt->Add( this );
+ else if( GetRegisteredIn() )
+ GetRegisteredInNonConst()->Remove( this );
+}
+/* -----------------------------22.02.01 13:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNumFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+{
+ // dann suche mal in dem Doc nach dem NumRules-Object, in dem dieses
+ // NumFormat gesetzt ist. Das Format muss es nicht geben!
+ const SwCharFmt* pFmt = 0;
+ sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+ switch( nWhich )
+ {
+ case RES_ATTRSET_CHG:
+ case RES_FMT_CHG:
+ pFmt = GetCharFmt();
+ break;
+ }
+
+ if( pFmt && !pFmt->GetDoc()->IsInDtor() )
+ UpdateNumNodes( (SwDoc*)pFmt->GetDoc() );
+ else
+ CheckRegistration( pOld, pNew );
+}
+/* -----------------------------23.02.01 11:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNumFmt::SetCharFmtName(const String& rSet)
+{
+ SvxNumberFormat::SetCharFmtName(rSet);
+}
+/* -----------------------------22.02.01 13:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const String& SwNumFmt::GetCharFmtName() const
+{
+ if((SwCharFmt*)GetRegisteredIn())
+ return ((SwCharFmt*)GetRegisteredIn())->GetName();
+ else
+ return aEmptyStr;
+}
+
+void SwNumFmt::ForgetCharFmt()
+{
+ if ( GetRegisteredIn() )
+ GetRegisteredInNonConst()->Remove( this );
+}
+
+/* -----------------------------22.02.01 16:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNumFmt::SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize,
+ const sal_Int16* pOrient)
+{
+ if(pOrient)
+ pVertOrient->SetVertOrient( *pOrient );
+ SvxNumberFormat::SetGraphicBrush( pBrushItem, pSize, pOrient);
+}
+/* -----------------------------22.02.01 16:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNumFmt::SetVertOrient(sal_Int16 eSet)
+{
+ SvxNumberFormat::SetVertOrient(eSet);
+}
+/* -----------------------------22.02.01 16:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int16 SwNumFmt::GetVertOrient() const
+{
+ return SvxNumberFormat::GetVertOrient();
+}
+/* -----------------------------22.02.01 13:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNumFmt::UpdateNumNodes( SwDoc* pDoc )
+{
+ sal_Bool bDocIsModified = pDoc->IsModified();
+ sal_Bool bFnd = sal_False;
+ const SwNumRule* pRule;
+ for( sal_uInt16 n = pDoc->GetNumRuleTbl().Count(); !bFnd && n; )
+ {
+ pRule = pDoc->GetNumRuleTbl()[ --n ];
+ for( sal_uInt8 i = 0; i < MAXLEVEL; ++i )
+ if( pRule->GetNumFmt( i ) == this )
+ {
+ // --> OD 2008-02-19 #refactorlists#
+// const String& rRuleNm = pRule->GetName();
+
+// SwModify* pMod;
+// const SfxPoolItem* pItem;
+// sal_uInt16 k, nMaxItems = pDoc->GetAttrPool().GetItemCount(
+// RES_PARATR_NUMRULE );
+// for( k = 0; k < nMaxItems; ++k )
+// if( 0 != (pItem = pDoc->GetAttrPool().GetItem(
+// RES_PARATR_NUMRULE, k ) ) &&
+// 0 != ( pMod = (SwModify*)((SwNumRuleItem*)pItem)->
+// GetDefinedIn()) &&
+// ((SwNumRuleItem*)pItem)->GetValue() == rRuleNm )
+// {
+// if( pMod->IsA( TYPE( SwFmt )) )
+// {
+// SwNumRuleInfo aInfo( rRuleNm );
+// pMod->GetInfo( aInfo );
+
+// for( sal_uLong nFirst = 0, nLast = aInfo.GetList().Count();
+// nFirst < nLast; ++nFirst )
+// lcl_SetRuleChgd(
+// *aInfo.GetList().GetObject( nFirst ), i );
+// }
+// else if( ((SwTxtNode*)pMod)->GetNodes().IsDocNodes() )
+// lcl_SetRuleChgd( *(SwTxtNode*)pMod, i );
+// }
+ SwNumRule::tTxtNodeList aTxtNodeList;
+ pRule->GetTxtNodeList( aTxtNodeList );
+ for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin();
+ aIter != aTxtNodeList.end(); ++aIter )
+ {
+ lcl_SetRuleChgd( *(*aIter), i );
+ }
+ // <--
+ bFnd = sal_True;
+ break;
+ }
+ }
+
+ if( bFnd && !bDocIsModified )
+ pDoc->ResetModified();
+}
+/* -----------------------------31.05.01 16:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SwFmtVertOrient* SwNumFmt::GetGraphicOrientation() const
+{
+ sal_Int16 eOrient = SvxNumberFormat::GetVertOrient();
+ if(text::VertOrientation::NONE == eOrient)
+ return 0;
+ else
+ {
+ pVertOrient->SetVertOrient(eOrient);
+ return pVertOrient;
+ }
+}
+
+#ifdef DBG_UTIL
+long int SwNumRule::nInstances = 0;
+#endif
+
+// --> OD 2008-02-11 #newlistlevelattrs#
+// handle new parameter <eDefaultNumberFormatPositionAndSpaceMode>
+SwNumRule::SwNumRule( const String& rNm,
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode,
+ SwNumRuleType eType,
+ sal_Bool bAutoFlg )
+ : maTxtNodeList(),
+ // --> OD 2008-03-03 #refactorlists#
+ maParagraphStyleList(),
+ // <--
+ pNumRuleMap(0),
+ sName( rNm ),
+ eRuleType( eType ),
+ nPoolFmtId( USHRT_MAX ),
+ nPoolHelpId( USHRT_MAX ),
+ nPoolHlpFileId( UCHAR_MAX ),
+ bAutoRuleFlag( bAutoFlg ),
+ bInvalidRuleFlag( sal_True ),
+ bContinusNum( sal_False ),
+ bAbsSpaces( sal_False ),
+ // --> OD 2005-10-21 - initialize member <mbCountPhantoms>
+ mbCountPhantoms( true ),
+ // <--
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ meDefaultNumberFormatPositionAndSpaceMode( eDefaultNumberFormatPositionAndSpaceMode ),
+ // <--
+ // --> OD 2008-04-03 #refactorlists#
+ msDefaultListId()
+ // <--
+{
+#ifdef DBG_UTIL
+ nSerial = nInstances++;
+#endif
+
+ if( !nRefCount++ ) // zum erstmal, also initialisiern
+ {
+ SwNumFmt* pFmt;
+ sal_uInt8 n;
+
+ // numbering:
+ // position-and-space mode LABEL_WIDTH_AND_POSITION:
+ for( n = 0; n < MAXLEVEL; ++n )
+ {
+ pFmt = new SwNumFmt;
+ pFmt->SetIncludeUpperLevels( 1 );
+ pFmt->SetStart( 1 );
+ pFmt->SetLSpace( lNumIndent );
+ pFmt->SetAbsLSpace( lNumIndent + SwNumRule::GetNumIndent( n ) );
+ pFmt->SetFirstLineOffset( lNumFirstLineOffset );
+ pFmt->SetSuffix( aDotStr );
+ // --> OD 2006-06-29 #b6440955#
+ pFmt->SetBulletChar( numfunc::GetBulletChar(n));
+ // <--
+ SwNumRule::aBaseFmts[ NUM_RULE ][ n ] = pFmt;
+ }
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ // position-and-space mode LABEL_ALIGNMENT
+ // first line indent of general numbering in inch: -0,25 inch
+ const long cFirstLineIndent = -1440/4;
+ // indent values of general numbering in inch:
+ // 0,5 0,75 1,0 1,25 1,5
+ // 1,75 2,0 2,25 2,5 2,75
+ const long cIndentAt[ MAXLEVEL ] = {
+ 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2,
+ 1440*7/4, 1440*2, 1440*9/4, 1440*5/2, 1440*11/4 };
+ for( n = 0; n < MAXLEVEL; ++n )
+ {
+ pFmt = new SwNumFmt;
+ pFmt->SetIncludeUpperLevels( 1 );
+ pFmt->SetStart( 1 );
+ // --> OD 2008-01-15 #newlistlevelattrs#
+ pFmt->SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT );
+ pFmt->SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ pFmt->SetListtabPos( cIndentAt[ n ] );
+ pFmt->SetFirstLineIndent( cFirstLineIndent );
+ pFmt->SetIndentAt( cIndentAt[ n ] );
+ // <--
+ pFmt->SetSuffix( aDotStr );
+ pFmt->SetBulletChar( numfunc::GetBulletChar(n));
+ SwNumRule::aLabelAlignmentBaseFmts[ NUM_RULE ][ n ] = pFmt;
+ }
+ // <--
+
+ // outline:
+ // position-and-space mode LABEL_WIDTH_AND_POSITION:
+ for( n = 0; n < MAXLEVEL; ++n )
+ {
+ pFmt = new SwNumFmt;
+ pFmt->SetNumberingType(SVX_NUM_NUMBER_NONE);
+ pFmt->SetIncludeUpperLevels( MAXLEVEL );
+ pFmt->SetStart( 1 );
+ pFmt->SetCharTextDistance( lOutlineMinTextDistance );
+ // --> OD 2006-06-29 #b6440955#
+ pFmt->SetBulletChar( numfunc::GetBulletChar(n));
+ // <--
+ SwNumRule::aBaseFmts[ OUTLINE_RULE ][ n ] = pFmt;
+ }
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ // position-and-space mode LABEL_ALIGNMENT:
+ // indent values of default outline numbering in inch:
+ // 0,3 0,4 0,5 0,6 0,7
+ // 0,8 0,9 1,0 1,1 1,2
+ const long cOutlineIndentAt[ MAXLEVEL ] = {
+ 1440*3/10, 1440*2/5, 1440/2, 1440*3/5, 1440*7/10,
+ 1440*4/5, 1440*9/10, 1440, 1440*11/10, 1440*6/5 };
+ for( n = 0; n < MAXLEVEL; ++n )
+ {
+ pFmt = new SwNumFmt;
+ pFmt->SetNumberingType(SVX_NUM_NUMBER_NONE);
+ pFmt->SetIncludeUpperLevels( MAXLEVEL );
+ pFmt->SetStart( 1 );
+ pFmt->SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT );
+ pFmt->SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ pFmt->SetListtabPos( cOutlineIndentAt[ n ] );
+ pFmt->SetFirstLineIndent( -cOutlineIndentAt[ n ] );
+ pFmt->SetIndentAt( cOutlineIndentAt[ n ] );
+ pFmt->SetBulletChar( numfunc::GetBulletChar(n));
+ SwNumRule::aLabelAlignmentBaseFmts[ OUTLINE_RULE ][ n ] = pFmt;
+ }
+ // <--
+ }
+ memset( aFmts, 0, sizeof( aFmts ));
+ ASSERT( sName.Len(), "NumRule ohne Namen!" );
+}
+
+SwNumRule::SwNumRule( const SwNumRule& rNumRule )
+ : maTxtNodeList(),
+ // --> OD 2008-03-03 #refactorlists#
+ maParagraphStyleList(),
+ // <--
+ pNumRuleMap(0),
+ sName( rNumRule.sName ),
+ eRuleType( rNumRule.eRuleType ),
+ nPoolFmtId( rNumRule.GetPoolFmtId() ),
+ nPoolHelpId( rNumRule.GetPoolHelpId() ),
+ nPoolHlpFileId( rNumRule.GetPoolHlpFileId() ),
+ bAutoRuleFlag( rNumRule.bAutoRuleFlag ),
+ bInvalidRuleFlag( sal_True ),
+ bContinusNum( rNumRule.bContinusNum ),
+ bAbsSpaces( rNumRule.bAbsSpaces ),
+ // --> OD 2005-10-21 - initialize member <mbCountPhantoms>
+ mbCountPhantoms( true ),
+ // <--
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ meDefaultNumberFormatPositionAndSpaceMode( rNumRule.meDefaultNumberFormatPositionAndSpaceMode ),
+ // <--
+ // --> OD 2008-04-03 #refactorlists#
+ msDefaultListId( rNumRule.msDefaultListId )
+ // <--
+{
+#ifdef DBG_UTIL
+ nSerial = nInstances++;
+#endif
+
+ ++nRefCount;
+ memset( aFmts, 0, sizeof( aFmts ));
+ for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
+ if( rNumRule.aFmts[ n ] )
+ Set( n, *rNumRule.aFmts[ n ] );
+}
+
+SwNumRule::~SwNumRule()
+{
+ for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
+ delete aFmts[ n ];
+
+ if (pNumRuleMap)
+ {
+ pNumRuleMap->erase(GetName());
+ }
+
+ if( !--nRefCount ) // der letzte macht die Tuer zu
+ {
+ // Nummerierung:
+ SwNumFmt** ppFmts = (SwNumFmt**)SwNumRule::aBaseFmts;
+ int n;
+
+ for( n = 0; n < MAXLEVEL; ++n, ++ppFmts )
+ delete *ppFmts, *ppFmts = 0;
+
+ // Gliederung:
+ for( n = 0; n < MAXLEVEL; ++n, ++ppFmts )
+ delete *ppFmts, *ppFmts = 0;
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ ppFmts = (SwNumFmt**)SwNumRule::aLabelAlignmentBaseFmts;
+ for( n = 0; n < MAXLEVEL; ++n, ++ppFmts )
+ delete *ppFmts, *ppFmts = 0;
+ for( n = 0; n < MAXLEVEL; ++n, ++ppFmts )
+ delete *ppFmts, *ppFmts = 0;
+ // <--
+ }
+
+ // --> OD 2008-02-19 #refactorlists#
+ maTxtNodeList.clear();
+ maParagraphStyleList.clear();
+ // <--
+}
+
+void SwNumRule::CheckCharFmts( SwDoc* pDoc )
+{
+ SwCharFmt* pFmt;
+ for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
+ if( aFmts[ n ] && 0 != ( pFmt = aFmts[ n ]->GetCharFmt() ) &&
+ pFmt->GetDoc() != pDoc )
+ {
+ // dann kopieren!
+ SwNumFmt* pNew = new SwNumFmt( *aFmts[ n ] );
+ pNew->SetCharFmt( pDoc->CopyCharFmt( *pFmt ) );
+ delete aFmts[ n ];
+ aFmts[ n ] = pNew;
+ }
+}
+
+SwNumRule& SwNumRule::operator=( const SwNumRule& rNumRule )
+{
+ if( this != &rNumRule )
+ {
+ for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
+ Set( n, rNumRule.aFmts[ n ] );
+
+ eRuleType = rNumRule.eRuleType;
+ sName = rNumRule.sName;
+ bAutoRuleFlag = rNumRule.bAutoRuleFlag;
+ bInvalidRuleFlag = sal_True;
+ bContinusNum = rNumRule.bContinusNum;
+ bAbsSpaces = rNumRule.bAbsSpaces;
+ nPoolFmtId = rNumRule.GetPoolFmtId();
+ nPoolHelpId = rNumRule.GetPoolHelpId();
+ nPoolHlpFileId = rNumRule.GetPoolHlpFileId();
+ }
+ return *this;
+}
+
+
+sal_Bool SwNumRule::operator==( const SwNumRule& rRule ) const
+{
+ sal_Bool bRet = eRuleType == rRule.eRuleType &&
+ sName == rRule.sName &&
+ bAutoRuleFlag == rRule.bAutoRuleFlag &&
+ bContinusNum == rRule.bContinusNum &&
+ bAbsSpaces == rRule.bAbsSpaces &&
+ nPoolFmtId == rRule.GetPoolFmtId() &&
+ nPoolHelpId == rRule.GetPoolHelpId() &&
+ nPoolHlpFileId == rRule.GetPoolHlpFileId();
+ if( bRet )
+ {
+ for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
+ if( !( rRule.Get( n ) == Get( n ) ))
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ return bRet;
+}
+
+
+void SwNumRule::Set( sal_uInt16 i, const SwNumFmt& rNumFmt )
+{
+ ASSERT( i < MAXLEVEL, "Serious defect, please inform OD" )
+ if( i < MAXLEVEL )
+ {
+ if( !aFmts[ i ] || !(rNumFmt == Get( i )) )
+ {
+ delete aFmts[ i ];
+ aFmts[ i ] = new SwNumFmt( rNumFmt );
+ bInvalidRuleFlag = sal_True;
+ }
+ }
+}
+
+void SwNumRule::Set( sal_uInt16 i, const SwNumFmt* pNumFmt )
+{
+ ASSERT( i < MAXLEVEL, "Serious defect, please inform OD" )
+ if( i >= MAXLEVEL )
+ return;
+ SwNumFmt* pOld = aFmts[ i ];
+ if( !pOld )
+ {
+ if( pNumFmt )
+ {
+ aFmts[ i ] = new SwNumFmt( *pNumFmt );
+ bInvalidRuleFlag = sal_True;
+ }
+ }
+ else if( !pNumFmt )
+ delete pOld, aFmts[ i ] = 0, bInvalidRuleFlag = sal_True;
+ else if( *pOld != *pNumFmt )
+ *pOld = *pNumFmt, bInvalidRuleFlag = sal_True;
+}
+
+
+String SwNumRule::MakeNumString( const SwNodeNum& rNum, sal_Bool bInclStrings,
+ sal_Bool bOnlyArabic ) const
+{
+ String aStr;
+
+ if (rNum.IsCounted())
+ aStr = MakeNumString(rNum.GetNumberVector(),
+ bInclStrings, bOnlyArabic, MAXLEVEL);
+
+ return aStr;
+}
+
+String SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
+ const sal_Bool bInclStrings,
+ const sal_Bool bOnlyArabic,
+ const unsigned int _nRestrictToThisLevel ) const
+{
+ String aStr;
+
+ unsigned int nLevel = rNumVector.size() - 1;
+ // --> OD 2005-10-17 #126238#
+ if ( nLevel > _nRestrictToThisLevel )
+ {
+ nLevel = _nRestrictToThisLevel;
+ }
+ // <--
+
+ if (nLevel < MAXLEVEL)
+ {
+ const SwNumFmt& rMyNFmt = Get( static_cast<sal_uInt16>(nLevel) );
+ // --> OD 2006-06-02 #b6432095#
+ // - levels with numbering none has to provide prefix and suffix string
+// if( SVX_NUM_NUMBER_NONE != rMyNFmt.GetNumberingType() )
+ // <--
+ {
+ sal_uInt8 i = static_cast<sal_uInt8>(nLevel);
+
+ if( !IsContinusNum() &&
+ // --> OD 2006-09-19 #i69672#
+ // - do not include upper levels, if level isn't numbered.
+ rMyNFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE &&
+ // <--
+ rMyNFmt.GetIncludeUpperLevels() ) // nur der eigene Level ?
+ {
+ sal_uInt8 n = rMyNFmt.GetIncludeUpperLevels();
+ if( 1 < n )
+ {
+ if( i+1 >= n )
+ i -= n - 1;
+ else
+ i = 0;
+ }
+ }
+
+ for( ; i <= nLevel; ++i )
+ {
+ const SwNumFmt& rNFmt = Get( i );
+ if( SVX_NUM_NUMBER_NONE == rNFmt.GetNumberingType() )
+ {
+ // Soll aus 1.1.1 --> 2. NoNum --> 1..1 oder 1.1 ??
+ // if( i != rNum.nMyLevel )
+ // aStr += aDotStr;
+ continue;
+ }
+
+ if( rNumVector[ i ] )
+ {
+ if( bOnlyArabic )
+ aStr += String::CreateFromInt32( rNumVector[ i ] );
+ else
+ aStr += rNFmt.GetNumStr( rNumVector[ i ] );
+ }
+ else
+ aStr += '0'; // alle 0-Level sind eine 0
+ if( i != nLevel && aStr.Len() )
+ aStr += aDotStr;
+ }
+
+ //JP 14.12.99: the type dont have any number, so dont append
+ // the Post-/Prefix String
+ if( bInclStrings && !bOnlyArabic &&
+ SVX_NUM_CHAR_SPECIAL != rMyNFmt.GetNumberingType() &&
+ SVX_NUM_BITMAP != rMyNFmt.GetNumberingType() )
+ {
+ aStr.Insert( rMyNFmt.GetPrefix(), 0 );
+ aStr += rMyNFmt.GetSuffix();
+ }
+ }
+ }
+
+ return aStr;
+}
+
+// --> OD 2007-09-07 #i81002#
+String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum,
+ const bool bInclSuperiorNumLabels,
+ const sal_uInt8 nRestrictInclToThisLevel ) const
+{
+ String aRefNumStr;
+
+ if ( rNodeNum.GetLevelInListTree() >= 0 )
+ {
+ const SwNodeNum* pWorkingNodeNum( &rNodeNum );
+ do
+ {
+ bool bMakeNumStringForPhantom( false );
+ if ( pWorkingNodeNum->IsPhantom() )
+ {
+ SwNumFmt aFmt( Get( static_cast<sal_uInt16>(pWorkingNodeNum->GetLevelInListTree()) ) );
+ bMakeNumStringForPhantom = aFmt.IsEnumeration() &&
+ SVX_NUM_NUMBER_NONE != aFmt.GetNumberingType();
+
+ }
+ if ( bMakeNumStringForPhantom ||
+ ( !pWorkingNodeNum->IsPhantom() &&
+ pWorkingNodeNum->GetTxtNode() &&
+ pWorkingNodeNum->GetTxtNode()->HasNumber() ) )
+ {
+ aRefNumStr.Insert( MakeNumString( pWorkingNodeNum->GetNumberVector() ), 0 );
+ }
+ else if ( aRefNumStr.Len() > 0 )
+ {
+ aRefNumStr.Insert( String::CreateFromAscii(" "), 0 );
+ }
+
+ if ( bInclSuperiorNumLabels && pWorkingNodeNum->GetLevelInListTree() > 0 )
+ {
+ sal_uInt8 n = Get( static_cast<sal_uInt16>(pWorkingNodeNum->GetLevelInListTree()) ).GetIncludeUpperLevels();
+ pWorkingNodeNum = dynamic_cast<SwNodeNum*>(pWorkingNodeNum->GetParent());
+ // skip parents, whose list label is already contained in the actual list label.
+ while ( pWorkingNodeNum && n > 1 )
+ {
+ pWorkingNodeNum = dynamic_cast<SwNodeNum*>(pWorkingNodeNum->GetParent());
+ --n;
+ }
+ }
+ else
+ {
+ break;
+ }
+ } while ( pWorkingNodeNum &&
+ pWorkingNodeNum->GetLevelInListTree() >= 0 &&
+ static_cast<sal_uInt8>(pWorkingNodeNum->GetLevelInListTree()) >= nRestrictInclToThisLevel );
+ }
+
+ return aRefNumStr;
+}
+
+// ----- Copy-Methode vom SwNumRule ------
+
+ // eine Art Copy-Constructor, damit die Num-Formate auch an den
+ // richtigen CharFormaten eines Dokumentes haengen !!
+ // (Kopiert die NumFormate und returnt sich selbst)
+
+SwNumRule& SwNumRule::CopyNumRule( SwDoc* pDoc, const SwNumRule& rNumRule )
+{
+ for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
+ {
+ Set( n, rNumRule.aFmts[ n ] );
+ if( aFmts[ n ] && aFmts[ n ]->GetCharFmt() &&
+ USHRT_MAX == pDoc->GetCharFmts()->GetPos( aFmts[n]->GetCharFmt() ))
+ // ueber unterschiedliche Dokumente kopieren, dann
+ // kopiere das entsprechende Char-Format ins neue
+ // Dokument.
+ aFmts[n]->SetCharFmt( pDoc->CopyCharFmt( *aFmts[n]->
+ GetCharFmt() ) );
+ }
+ eRuleType = rNumRule.eRuleType;
+ sName = rNumRule.sName;
+ bAutoRuleFlag = rNumRule.bAutoRuleFlag;
+ nPoolFmtId = rNumRule.GetPoolFmtId();
+ nPoolHelpId = rNumRule.GetPoolHelpId();
+ nPoolHlpFileId = rNumRule.GetPoolHlpFileId();
+ bInvalidRuleFlag = sal_True;
+ return *this;
+}
+/* -----------------30.10.98 08:33-------------------
+ *
+ * --------------------------------------------------*/
+void SwNumRule::SetSvxRule(const SvxNumRule& rNumRule, SwDoc* pDoc)
+{
+ for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
+ {
+ const SvxNumberFormat* pSvxFmt = rNumRule.Get(n);
+ delete aFmts[n];
+ aFmts[n] = pSvxFmt ? new SwNumFmt(*pSvxFmt, pDoc) : 0;
+ }
+
+ bInvalidRuleFlag = sal_True;
+ bContinusNum = rNumRule.IsContinuousNumbering();
+}
+/* -----------------30.10.98 08:33-------------------
+ *
+ * --------------------------------------------------*/
+SvxNumRule SwNumRule::MakeSvxNumRule() const
+{
+ SvxNumRule aRule(NUM_CONTINUOUS|NUM_CHAR_TEXT_DISTANCE|NUM_CHAR_STYLE|
+ NUM_ENABLE_LINKED_BMP|NUM_ENABLE_EMBEDDED_BMP,
+ MAXLEVEL, bContinusNum,
+ eRuleType ==
+ NUM_RULE ?
+ SVX_RULETYPE_NUMBERING :
+ SVX_RULETYPE_OUTLINE_NUMBERING );
+ for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
+ {
+ SwNumFmt aNumFmt = Get(n);
+ if(aNumFmt.GetCharFmt())
+ aNumFmt.SetCharFmtName(aNumFmt.GetCharFmt()->GetName());
+ aRule.SetLevel(n, aNumFmt, aFmts[n] != 0);
+ }
+ return aRule;
+}
+
+void SwNumRule::SetInvalidRule(sal_Bool bFlag)
+{
+ if (bFlag)
+ {
+ // --> OD 2008-03-13 #refactorlists#
+// tPamAndNums::iterator aIt;
+// for (aIt = aNumberRanges.begin(); aIt != aNumberRanges.end(); aIt++)
+// (*aIt).second->InvalidateTree();
+ std::set< SwList* > aLists;
+ tTxtNodeList::iterator aIter;
+ for ( aIter = maTxtNodeList.begin(); aIter != maTxtNodeList.end(); ++aIter )
+ {
+ const SwTxtNode* pTxtNode = *aIter;
+ // --> OD 2010-06-04 #i111681# - applying patch from cmc
+// aLists.insert( pTxtNode->GetDoc()->getListByName( pTxtNode->GetListId() ) );
+ SwList* pList = pTxtNode->GetDoc()->getListByName( pTxtNode->GetListId() );
+ ASSERT( pList, "<SwNumRule::SetInvalidRule(..)> - list at which the text node is registered at does not exist. This is a serious issue --> please inform OD.");
+ if ( pList )
+ {
+ aLists.insert( pList );
+ }
+ // <--
+ }
+ std::for_each( aLists.begin(), aLists.end(),
+ std::mem_fun( &SwList::InvalidateListTree ) );
+ // <--
+ }
+
+ bInvalidRuleFlag = bFlag;
+}
+
+// --> OD 2008-06-16 #i90078#
+// #i23725#, #i23726#
+//void SwNumRule::Indent(short nAmount, int nLevel, int nReferenceLevel,
+// sal_Bool bRelative, sal_Bool bFirstLine, sal_Bool bCheckGtZero)
+//{
+// int nStartLevel = 0;
+// int nEndLevel = MAXLEVEL - 1;
+// sal_Bool bGotInvalid = sal_False;
+
+// if (nLevel >= 0)
+// nStartLevel = nEndLevel = nLevel;
+
+// int i;
+// short nRealAmount = nAmount;
+
+// if (! bRelative)
+// {
+// if (bFirstLine)
+// {
+// if (nReferenceLevel >= 0)
+// nAmount = nAmount - Get(static_cast<sal_uInt16>(nReferenceLevel)).GetFirstLineOffset();
+// else
+// nAmount = nAmount - Get(static_cast<sal_uInt16>(nStartLevel)).GetFirstLineOffset();
+// }
+
+// sal_Bool bFirst = sal_True;
+
+// if (nReferenceLevel >= 0)
+// nRealAmount = nAmount - Get(static_cast<sal_uInt16>(nReferenceLevel)).GetAbsLSpace();
+// else
+// for (i = nStartLevel; i < nEndLevel + 1; i++)
+// {
+// short nTmp = nAmount - Get(static_cast<sal_uInt16>(i)).GetAbsLSpace();
+
+// if (bFirst || nTmp > nRealAmount)
+// {
+// nRealAmount = nTmp;
+// bFirst = sal_False;
+// }
+// }
+// }
+
+// if (nRealAmount < 0)
+// for (i = nStartLevel; i < nEndLevel + 1; i++)
+// if (Get(static_cast<sal_uInt16>(i)).GetAbsLSpace() + nRealAmount < 0)
+// nRealAmount = -Get(static_cast<sal_uInt16>(i)).GetAbsLSpace();
+
+// for (i = nStartLevel; i < nEndLevel + 1; i++)
+// {
+// short nNew = Get(static_cast<sal_uInt16>(i)).GetAbsLSpace() + nRealAmount;
+
+// if (bCheckGtZero && nNew < 0)
+// nNew = 0;
+
+// SwNumFmt aTmpNumFmt(Get(static_cast<sal_uInt16>(i)));
+// aTmpNumFmt.SetAbsLSpace(nNew);
+
+// Set(static_cast<sal_uInt16>(i), aTmpNumFmt);
+
+// bGotInvalid = sal_True;
+// }
+
+// if (bGotInvalid)
+// SetInvalidRule(bGotInvalid);
+//}
+
+// change indent of all list levels by given difference
+void SwNumRule::ChangeIndent( const short nDiff )
+{
+ for ( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
+ {
+ SwNumFmt aTmpNumFmt( Get(i) );
+
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
+ aTmpNumFmt.GetPositionAndSpaceMode() );
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ short nNewIndent = nDiff +
+ aTmpNumFmt.GetAbsLSpace();
+ if ( nNewIndent < 0 )
+ {
+ nNewIndent = 0;
+ }
+ aTmpNumFmt.SetAbsLSpace( nNewIndent );
+ }
+ else if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ // --> OD 2009-01-20 #i93399#
+ // adjust also the list tab position, if a list tab stop is applied
+ if ( aTmpNumFmt.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
+ {
+ const long nNewListTab = aTmpNumFmt.GetListtabPos() + nDiff;
+ aTmpNumFmt.SetListtabPos( nNewListTab );
+ }
+ // <--
+ const long nNewIndent = nDiff +
+ aTmpNumFmt.GetIndentAt();
+ aTmpNumFmt.SetIndentAt( nNewIndent );
+ }
+
+ Set( i, aTmpNumFmt );
+ }
+
+ SetInvalidRule( sal_True );
+}
+
+// set indent of certain list level to given value
+void SwNumRule::SetIndent( const short nNewIndent,
+ const sal_uInt16 nListLevel )
+{
+ SwNumFmt aTmpNumFmt( Get(nListLevel) );
+
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
+ aTmpNumFmt.GetPositionAndSpaceMode() );
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aTmpNumFmt.SetAbsLSpace( nNewIndent );
+ }
+ else if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ // --> OD 2009-01-20 #i93399#
+ // adjust also the list tab position, if a list tab stop is applied
+ if ( aTmpNumFmt.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
+ {
+ const long nNewListTab = aTmpNumFmt.GetListtabPos() +
+ ( nNewIndent - aTmpNumFmt.GetIndentAt() );
+ aTmpNumFmt.SetListtabPos( nNewListTab );
+ }
+ // <--
+ aTmpNumFmt.SetIndentAt( nNewIndent );
+ }
+
+ SetInvalidRule( sal_True );
+}
+
+// set indent of first list level to given value and change other list level's
+// indents accordingly
+void SwNumRule::SetIndentOfFirstListLevelAndChangeOthers( const short nNewIndent )
+{
+ SwNumFmt aTmpNumFmt( Get(0) );
+
+ short nDiff( 0 );
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
+ aTmpNumFmt.GetPositionAndSpaceMode() );
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ nDiff = nNewIndent
+ - aTmpNumFmt.GetFirstLineOffset()
+ - aTmpNumFmt.GetAbsLSpace();
+ }
+ else if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ nDiff = static_cast<short>(nNewIndent
+ - aTmpNumFmt.GetIndentAt());
+ }
+ if ( nDiff != 0 )
+ {
+ ChangeIndent( nDiff );
+ }
+}
+// <--
+
+void SwNumRule::Validate()
+{
+ // --> OD 2008-03-13 #refactorlists#
+// tPamAndNums::iterator aIt;
+// for (aIt = aNumberRanges.begin(); aIt != aNumberRanges.end(); aIt++)
+// (*aIt).second->NotifyInvalidChildren();
+ std::set< SwList* > aLists;
+ tTxtNodeList::iterator aIter;
+ for ( aIter = maTxtNodeList.begin(); aIter != maTxtNodeList.end(); ++aIter )
+ {
+ const SwTxtNode* pTxtNode = *aIter;
+ aLists.insert( pTxtNode->GetDoc()->getListByName( pTxtNode->GetListId() ) );
+ }
+ std::for_each( aLists.begin(), aLists.end(),
+ std::mem_fun( &SwList::ValidateListTree ) );
+ // <--
+
+ SetInvalidRule(sal_False);
+}
+
+bool SwNumRule::IsCountPhantoms() const
+{
+ return mbCountPhantoms;
+}
+
+void SwNumRule::SetCountPhantoms(bool bCountPhantoms)
+{
+ mbCountPhantoms = bCountPhantoms;
+}
+
+// --> OD 2008-03-03 #refactorlists#
+SwNumRule::tParagraphStyleList::size_type SwNumRule::GetParagraphStyleListSize() const
+{
+ return maParagraphStyleList.size();
+}
+
+void SwNumRule::AddParagraphStyle( SwTxtFmtColl& rTxtFmtColl )
+{
+ tParagraphStyleList::iterator aIter =
+ std::find( maParagraphStyleList.begin(), maParagraphStyleList.end(), &rTxtFmtColl );
+
+ if ( aIter == maParagraphStyleList.end() )
+ {
+ maParagraphStyleList.push_back( &rTxtFmtColl );
+ }
+}
+
+void SwNumRule::RemoveParagraphStyle( SwTxtFmtColl& rTxtFmtColl )
+{
+ tParagraphStyleList::iterator aIter =
+ std::find( maParagraphStyleList.begin(), maParagraphStyleList.end(), &rTxtFmtColl );
+
+ if ( aIter != maParagraphStyleList.end() )
+ {
+ maParagraphStyleList.erase( aIter );
+ }
+}
+// <--
+
+// --> OD 2006-06-27 #b6440955#
+namespace numfunc
+{
+ /** class containing default bullet list configuration data
+
+ @author OD
+ */
+ class SwDefBulletConfig : private utl::ConfigItem
+ {
+ public:
+ static SwDefBulletConfig* getInstance()
+ {
+ if ( mpInstance == 0 )
+ {
+ mpInstance = new SwDefBulletConfig;
+ }
+
+ return mpInstance;
+ }
+
+ inline const String& GetFontname() const
+ {
+ return msFontname;
+ }
+ // --> OD 2008-06-02 #i63395#
+ inline bool IsFontnameUserDefined() const
+ {
+ return mbUserDefinedFontname;
+ }
+ // <--
+ inline const Font& GetFont() const
+ {
+ return *mpFont;
+ }
+ inline short GetFontWeight() const
+ {
+ return static_cast<short>(meFontWeight);
+ }
+ inline short GetFontItalic() const
+ {
+ return static_cast<short>(meFontItalic);
+ }
+ inline sal_Unicode GetChar( sal_uInt8 p_nListLevel ) const
+ {
+ if ( p_nListLevel > MAXLEVEL )
+ {
+ p_nListLevel = MAXLEVEL;
+ }
+
+ return mnLevelChars[p_nListLevel];
+ }
+
+ private:
+ SwDefBulletConfig();
+
+ /** sets internal default bullet configuration data to default values
+
+ @author OD
+ */
+ void SetToDefault();
+
+ /** returns sequence of default bullet configuration property names
+
+ @author OD
+ */
+ uno::Sequence<rtl::OUString> GetPropNames() const;
+
+ /** loads default bullet configuration properties and applies
+ values to internal data
+
+ @author OD
+ */
+ void LoadConfig();
+
+ /** initialize font instance for default bullet list
+
+ @author OD
+ */
+ void InitFont();
+
+ /** catches notification about changed default bullet configuration data
+
+ @author OD
+ */
+ virtual void Notify( const uno::Sequence<rtl::OUString>& aPropertyNames );
+ virtual void Commit();
+
+ static SwDefBulletConfig* mpInstance;
+
+ // default bullet list configuration data
+ String msFontname;
+ // --> OD 2008-06-02 #i63395#
+ bool mbUserDefinedFontname;
+ // <--
+ FontWeight meFontWeight;
+ FontItalic meFontItalic;
+ sal_Unicode mnLevelChars[MAXLEVEL];
+
+ // default bullet list font instance
+ Font* mpFont;
+ };
+
+ SwDefBulletConfig* SwDefBulletConfig::mpInstance = 0;
+
+ SwDefBulletConfig::SwDefBulletConfig()
+ : ConfigItem( rtl::OUString::createFromAscii("Office.Writer/Numbering/DefaultBulletList") ),
+ // --> OD 2008-06-02 #i63395#
+ // default bullet font is now OpenSymbol
+ msFontname( String::CreateFromAscii("OpenSymbol") ),
+ mbUserDefinedFontname( false ),
+ // <--
+ meFontWeight( WEIGHT_DONTKNOW ),
+ meFontItalic( ITALIC_NONE ),
+ mpFont( 0 )
+ {
+ SetToDefault();
+ LoadConfig();
+ InitFont();
+
+ // enable notification for changes on default bullet configuration change
+ EnableNotification( GetPropNames() );
+ }
+
+ void SwDefBulletConfig::SetToDefault()
+ {
+ // --> OD 2008-06-02 #i63395#
+ // default bullet font name is now OpenSymbol
+// msFontname = String::CreateFromAscii("StarSymbol");
+ msFontname = String::CreateFromAscii("OpenSymbol");
+ mbUserDefinedFontname = false;
+ // <--
+ meFontWeight = WEIGHT_DONTKNOW;
+ meFontItalic = ITALIC_NONE;
+
+ // --> OD 2008-06-03 #i63395#
+ // new bullet characters
+// mnLevelChars[0] = 0x25cf;
+// mnLevelChars[1] = 0x25cb;
+// mnLevelChars[2] = 0x25a0;
+// mnLevelChars[3] = 0x25cf;
+// mnLevelChars[4] = 0x25cb;
+// mnLevelChars[5] = 0x25a0;
+// mnLevelChars[6] = 0x25cf;
+// mnLevelChars[7] = 0x25cb;
+// mnLevelChars[8] = 0x25a0;
+// mnLevelChars[9] = 0x25cf;
+ mnLevelChars[0] = 0x2022;
+ mnLevelChars[1] = 0x25e6;
+ mnLevelChars[2] = 0x25aa;
+ mnLevelChars[3] = 0x2022;
+ mnLevelChars[4] = 0x25e6;
+ mnLevelChars[5] = 0x25aa;
+ mnLevelChars[6] = 0x2022;
+ mnLevelChars[7] = 0x25e6;
+ mnLevelChars[8] = 0x25aa;
+ mnLevelChars[9] = 0x2022;
+ // <--
+ }
+
+ uno::Sequence<rtl::OUString> SwDefBulletConfig::GetPropNames() const
+ {
+ uno::Sequence<rtl::OUString> aPropNames(13);
+ rtl::OUString* pNames = aPropNames.getArray();
+ pNames[0] = rtl::OUString::createFromAscii("BulletFont/FontFamilyname");
+ pNames[1] = rtl::OUString::createFromAscii("BulletFont/FontWeight");
+ pNames[2] = rtl::OUString::createFromAscii("BulletFont/FontItalic");
+ pNames[3] = rtl::OUString::createFromAscii("BulletCharLvl1");
+ pNames[4] = rtl::OUString::createFromAscii("BulletCharLvl2");
+ pNames[5] = rtl::OUString::createFromAscii("BulletCharLvl3");
+ pNames[6] = rtl::OUString::createFromAscii("BulletCharLvl4");
+ pNames[7] = rtl::OUString::createFromAscii("BulletCharLvl5");
+ pNames[8] = rtl::OUString::createFromAscii("BulletCharLvl6");
+ pNames[9] = rtl::OUString::createFromAscii("BulletCharLvl7");
+ pNames[10] = rtl::OUString::createFromAscii("BulletCharLvl8");
+ pNames[11] = rtl::OUString::createFromAscii("BulletCharLvl9");
+ pNames[12] = rtl::OUString::createFromAscii("BulletCharLvl10");
+
+ return aPropNames;
+ }
+
+ void SwDefBulletConfig::LoadConfig()
+ {
+ uno::Sequence<rtl::OUString> aPropNames = GetPropNames();
+ uno::Sequence<uno::Any> aValues =
+ GetProperties( aPropNames );
+ const uno::Any* pValues = aValues.getConstArray();
+ ASSERT( aValues.getLength() == aPropNames.getLength(),
+ "<SwDefBulletConfig::SwDefBulletConfig()> - GetProperties failed")
+ if ( aValues.getLength() == aPropNames.getLength() )
+ {
+ for ( int nProp = 0; nProp < aPropNames.getLength(); ++nProp )
+ {
+ if ( pValues[nProp].hasValue() )
+ {
+ switch ( nProp )
+ {
+ case 0:
+ {
+ rtl::OUString aStr;
+ pValues[nProp] >>= aStr;
+ msFontname = aStr;
+ // --> OD 2008-06-02 #i63395#
+ mbUserDefinedFontname = true;
+ // <--
+ }
+ break;
+ case 1:
+ case 2:
+ {
+ sal_uInt8 nTmp = 0;
+ pValues[nProp] >>= nTmp;
+ if ( nProp == 1 )
+ meFontWeight = static_cast<FontWeight>(nTmp);
+ else if ( nProp == 2 )
+ meFontItalic = static_cast<FontItalic>(nTmp);
+ }
+ break;
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ {
+ sal_Unicode cChar = sal_Unicode();
+ pValues[nProp] >>= cChar;
+ mnLevelChars[nProp-3] = cChar;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ void SwDefBulletConfig::InitFont()
+ {
+ delete mpFont;
+
+ mpFont = new Font( msFontname, aEmptyStr, Size( 0, 14 ) );
+ mpFont->SetWeight( meFontWeight );
+ mpFont->SetItalic( meFontItalic );
+ }
+
+ void SwDefBulletConfig::Notify( const uno::Sequence<rtl::OUString>& )
+ {
+ SetToDefault();
+ LoadConfig();
+ InitFont();
+ }
+
+ void SwDefBulletConfig::Commit()
+ {
+ }
+
+ const String& GetDefBulletFontname()
+ {
+ return SwDefBulletConfig::getInstance()->GetFontname();
+ }
+
+ // --> OD 2008-06-02 #i63395#
+ bool IsDefBulletFontUserDefined()
+ {
+ return SwDefBulletConfig::getInstance()->IsFontnameUserDefined();
+ }
+ // <--
+
+ const Font& GetDefBulletFont()
+ {
+ return SwDefBulletConfig::getInstance()->GetFont();
+ }
+
+ sal_Unicode GetBulletChar( sal_uInt8 nLevel )
+ {
+ return SwDefBulletConfig::getInstance()->GetChar( nLevel );
+ }
+
+ /** class containing configuration data about user interface behavior
+ regarding lists and list items.
+
+ OD 2007-10-01 #b660435#
+ configuration item about behavior of <TAB>/<SHIFT-TAB>-key at first
+ position of first list item
+
+ @author OD
+ */
+ class SwNumberingUIBehaviorConfig : private utl::ConfigItem
+ {
+ public:
+ static SwNumberingUIBehaviorConfig* getInstance()
+ {
+ if ( mpInstance == 0 )
+ {
+ mpInstance = new SwNumberingUIBehaviorConfig();
+ }
+
+ return mpInstance;
+ }
+
+ inline sal_Bool ChangeIndentOnTabAtFirstPosOfFirstListItem() const
+ {
+ return mbChangeIndentOnTabAtFirstPosOfFirstListItem;
+ }
+
+ private:
+ SwNumberingUIBehaviorConfig();
+
+ /** sets internal configuration data to default values
+
+ @author OD
+ */
+ void SetToDefault();
+
+ /** returns sequence of configuration property names
+
+ @author OD
+ */
+ com::sun::star::uno::Sequence<rtl::OUString> GetPropNames() const;
+
+ /** loads configuration properties and applies values to internal data
+
+ @author OD
+ */
+ void LoadConfig();
+
+ /** catches notification about changed configuration data
+
+ @author OD
+ */
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames );
+ virtual void Commit();
+
+ static SwNumberingUIBehaviorConfig* mpInstance;
+
+ // configuration data
+ sal_Bool mbChangeIndentOnTabAtFirstPosOfFirstListItem;
+ };
+
+ SwNumberingUIBehaviorConfig* SwNumberingUIBehaviorConfig::mpInstance = 0;
+
+ SwNumberingUIBehaviorConfig::SwNumberingUIBehaviorConfig()
+ : ConfigItem( rtl::OUString::createFromAscii("Office.Writer/Numbering/UserInterfaceBehavior") ),
+ mbChangeIndentOnTabAtFirstPosOfFirstListItem( sal_True )
+ {
+ SetToDefault();
+ LoadConfig();
+
+ // enable notification for changes on configuration change
+ EnableNotification( GetPropNames() );
+ }
+
+ void SwNumberingUIBehaviorConfig::SetToDefault()
+ {
+ mbChangeIndentOnTabAtFirstPosOfFirstListItem = sal_True;
+ }
+
+ com::sun::star::uno::Sequence<rtl::OUString> SwNumberingUIBehaviorConfig::GetPropNames() const
+ {
+ com::sun::star::uno::Sequence<rtl::OUString> aPropNames(1);
+ rtl::OUString* pNames = aPropNames.getArray();
+ pNames[0] = rtl::OUString::createFromAscii("ChangeIndentOnTabAtFirstPosOfFirstListItem");
+
+ return aPropNames;
+ }
+
+ void SwNumberingUIBehaviorConfig::Commit() {}
+
+ void SwNumberingUIBehaviorConfig::LoadConfig()
+ {
+ com::sun::star::uno::Sequence<rtl::OUString> aPropNames = GetPropNames();
+ com::sun::star::uno::Sequence<com::sun::star::uno::Any> aValues =
+ GetProperties( aPropNames );
+ const com::sun::star::uno::Any* pValues = aValues.getConstArray();
+ ASSERT( aValues.getLength() == aPropNames.getLength(),
+ "<SwNumberingUIBehaviorConfig::LoadConfig()> - GetProperties failed")
+ if ( aValues.getLength() == aPropNames.getLength() )
+ {
+ for ( int nProp = 0; nProp < aPropNames.getLength(); ++nProp )
+ {
+ if ( pValues[nProp].hasValue() )
+ {
+ switch ( nProp )
+ {
+ case 0:
+ {
+ pValues[nProp] >>= mbChangeIndentOnTabAtFirstPosOfFirstListItem;
+ }
+ break;
+ default:
+ {
+ ASSERT( false,
+ "<SwNumberingUIBehaviorConfig::LoadConfig()> - unknown configuration property")
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void SwNumberingUIBehaviorConfig::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames )
+ {
+ (void) aPropertyNames;
+ SetToDefault();
+ LoadConfig();
+ }
+
+ sal_Bool ChangeIndentOnTabAtFirstPosOfFirstListItem()
+ {
+ return SwNumberingUIBehaviorConfig::getInstance()->ChangeIndentOnTabAtFirstPosOfFirstListItem();
+ }
+
+ // --> OD 2008-06-06 #i89178#
+ SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
+ {
+ SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode;
+ SvtSaveOptions aSaveOptions;
+ switch ( aSaveOptions.GetODFDefaultVersion() )
+ {
+ case SvtSaveOptions::ODFVER_010:
+ case SvtSaveOptions::ODFVER_011:
+ {
+ ePosAndSpaceMode = SvxNumberFormat::LABEL_WIDTH_AND_POSITION;
+ }
+ break;
+ default: // ODFVER_UNKNOWN or ODFVER_012
+ {
+ ePosAndSpaceMode = SvxNumberFormat::LABEL_ALIGNMENT;
+ }
+ }
+
+ return ePosAndSpaceMode;
+ }
+ // <--
+}
+// <--
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
new file mode 100644
index 000000000000..961983007e2a
--- /dev/null
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -0,0 +1,2591 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <i18npool/mslangid.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <editeng/paperinf.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/opaqitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/cmapitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/charrotateitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <editeng/emphitem.hxx>
+#include <editeng/scriptspaceitem.hxx>
+#include <viewopt.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <fmtanchr.hxx>
+#include <fmtornt.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtfsize.hxx>
+#include <poolfmt.hxx>
+#include <paratr.hxx>
+#include <pagedesc.hxx>
+#include <frmtool.hxx>
+#include <charfmt.hxx>
+#include <docary.hxx>
+#include <fmtcol.hxx>
+#include <ndtxt.hxx>
+#include <fmtline.hxx>
+#include <poolfmt.hrc>
+#include <GetMetricVal.hxx>
+#include <numrule.hxx>
+
+
+using namespace ::com::sun::star;
+
+const sal_uInt16 PT_3 = 3 * 20; // 3 pt
+const sal_uInt16 PT_6 = 6 * 20; // 6 pt
+const sal_uInt16 PT_7 = 7 * 20; // 6 pt
+const sal_uInt16 PT_8 = 8 * 20; // 8 pt
+const sal_uInt16 PT_9 = 9 * 20; // 9 pt
+const sal_uInt16 PT_10 = 10 * 20; // 10 pt
+const sal_uInt16 PT_11 = 11 * 20; // 11 pt
+const sal_uInt16 PT_12 = 12 * 20; // 12 pt
+const sal_uInt16 PT_14 = 14 * 20; // 14 pt
+const sal_uInt16 PT_16 = 16 * 20; // 16 pt
+const sal_uInt16 PT_18 = 18 * 20; // 18 pt
+const sal_uInt16 PT_22 = 22 * 20; // 22 pt
+const sal_uInt16 PT_24 = 24 * 20; // 22 pt
+
+
+//const sal_uInt16 HTML_PARSPACE = ((CM_05 * 7) / 10);
+#define HTML_PARSPACE GetMetricVal( CM_05 )
+
+static const sal_Char __FAR_DATA sKomma[] = ", ";
+
+static const sal_uInt16 aHeadlineSizes[ 2 * MAXLEVEL ] = {
+// PT_16, PT_14, PT_14, PT_12, PT_12, // normal
+//JP 10.12.96: jetzt soll alles prozentual sein:
+ 115, 100, 100, 85, 85,
+ 75, 75, 75, 75, 75, // normal
+// PT_22, PT_16, PT_12, PT_11, PT_9 // HTML-Mode
+ PT_24, PT_18, PT_14, PT_12, PT_10,
+ PT_7, PT_7, PT_7, PT_7, PT_7 // HTML-Mode
+};
+
+long lcl_GetRightMargin( SwDoc& rDoc )
+{
+ // sorge dafuer, dass die Druckereinstellungen in die Standard-
+ // Seitenvorlage uebernommen wurden.
+ const SwFrmFmt& rPgDscFmt =
+ const_cast<const SwDoc *>(&rDoc)->GetPageDesc( 0 ).GetMaster();
+ const SvxLRSpaceItem& rLR = rPgDscFmt.GetLRSpace();
+ const long nLeft = rLR.GetLeft();
+ const long nRight = rLR.GetRight();
+ const long nWidth = rPgDscFmt.GetFrmSize().GetWidth();
+ return nWidth - nLeft - nRight;
+}
+
+void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem )
+{
+ rSet.Put( rItem );
+ sal_uInt16 nWhCJK = 0, nWhCTL = 0;
+ switch( rItem.Which() )
+ {
+ case RES_CHRATR_FONTSIZE:
+ nWhCJK = RES_CHRATR_CJK_FONTSIZE, nWhCTL = RES_CHRATR_CTL_FONTSIZE;
+ break;
+ case RES_CHRATR_FONT:
+ nWhCJK = RES_CHRATR_CJK_FONT, nWhCTL = RES_CHRATR_CTL_FONT;
+ break;
+ case RES_CHRATR_LANGUAGE:
+ nWhCJK = RES_CHRATR_CJK_LANGUAGE, nWhCTL = RES_CHRATR_CTL_LANGUAGE;
+ break;
+ case RES_CHRATR_POSTURE:
+ nWhCJK = RES_CHRATR_CJK_POSTURE, nWhCTL = RES_CHRATR_CTL_POSTURE;
+ break;
+ case RES_CHRATR_WEIGHT:
+ nWhCJK = RES_CHRATR_CJK_WEIGHT, nWhCTL = RES_CHRATR_CTL_WEIGHT;
+ break;
+ }
+
+ if( nWhCJK )
+ rSet.Put( rItem, nWhCJK );
+ if( nWhCTL )
+ rSet.Put( rItem, nWhCTL );
+}
+
+void lcl_SetDfltFont( sal_uInt16 nFntType, SfxItemSet& rSet )
+{
+ static struct {
+ sal_uInt16 nResLngId;
+ sal_uInt16 nResFntId;
+ } aArr[ 3 ] = {
+ { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT },
+ { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT },
+ { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT }
+ };
+ for( sal_uInt16 n = 0; n < 3; ++n )
+ {
+ sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem(
+ aArr[n].nResLngId )).GetLanguage();
+ Font aFnt( OutputDevice::GetDefaultFont( nFntType,
+ nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
+
+ rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
+ aEmptyStr, aFnt.GetPitch(),
+ aFnt.GetCharSet(), aArr[n].nResFntId ));
+ }
+}
+
+void lcl_SetDfltFont( sal_uInt16 nLatinFntType, sal_uInt16 nCJKFntType,
+ sal_uInt16 nCTLFntType, SfxItemSet& rSet )
+{
+ static struct {
+ sal_uInt16 nResLngId;
+ sal_uInt16 nResFntId;
+ sal_uInt16 nFntType;
+ } aArr[ 3 ] = {
+ { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT, 0 },
+ { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT, 0 },
+ { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT, 0 }
+ };
+ aArr[0].nFntType = nLatinFntType;
+ aArr[1].nFntType = nCJKFntType;
+ aArr[2].nFntType = nCTLFntType;
+
+ for( sal_uInt16 n = 0; n < 3; ++n )
+ {
+ sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem(
+ aArr[n].nResLngId )).GetLanguage();
+ Font aFnt( OutputDevice::GetDefaultFont( aArr[n].nFntType,
+ nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
+
+ rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
+ aEmptyStr, aFnt.GetPitch(),
+ aFnt.GetCharSet(), aArr[n].nResFntId ));
+ }
+}
+
+void lcl_SetHeadline( SwDoc* pDoc, SwTxtFmtColl* pColl,
+ SfxItemSet& rSet,
+ sal_uInt16 nOutLvlBits, sal_uInt8 nLevel, sal_Bool bItalic )
+{
+ SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
+ SvxFontHeightItem aHItem(240, 100, RES_CHRATR_FONTSIZE);
+ const bool bHTMLMode = pDoc->get(IDocumentSettingAccess::HTML_MODE);
+ if( bHTMLMode )
+ aHItem.SetHeight( aHeadlineSizes[ MAXLEVEL + nLevel ] );
+ else
+ aHItem.SetHeight( PT_14, aHeadlineSizes[ nLevel ] );
+ SetAllScriptItem( rSet, aHItem );
+
+ if( bItalic && !bHTMLMode )
+ SetAllScriptItem( rSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) );
+
+ if( bHTMLMode )
+ {
+ ::lcl_SetDfltFont( DEFAULTFONT_LATIN_TEXT, DEFAULTFONT_CJK_TEXT,
+ DEFAULTFONT_CTL_TEXT, rSet );
+ }
+
+ if( pColl )
+ {
+ if( !( nOutLvlBits & ( 1 << nLevel )) )
+ {
+ //pColl->SetOutlineLevel( nLevel ); //#outline level zhaojianwei
+ pColl->AssignToListLevelOfOutlineStyle(nLevel);//<-end,zhaojianwei
+ if( !bHTMLMode )
+ {
+ SwNumRule * pOutlineRule = pDoc->GetOutlineNumRule();
+ const SwNumFmt& rNFmt = pOutlineRule->Get( nLevel );
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ if ( rNFmt.GetPositionAndSpaceMode() ==
+ SvxNumberFormat::LABEL_WIDTH_AND_POSITION &&
+ ( rNFmt.GetAbsLSpace() || rNFmt.GetFirstLineOffset() ) )
+ // <--
+ {
+ SvxLRSpaceItem aLR( (SvxLRSpaceItem&)pColl->GetFmtAttr( RES_LR_SPACE ) );
+ aLR.SetTxtFirstLineOfstValue( rNFmt.GetFirstLineOffset() );
+ aLR.SetTxtLeft( rNFmt.GetAbsLSpace() );
+ pColl->SetFmtAttr( aLR );
+ }
+
+ // --> OD 2006-11-20 #i71764#
+ // Check on document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE no longer needed.
+ // All paragraph styles, which are assigned to a level of the
+ // outline style has to have the outline style set as its list style.
+ {
+ SwNumRuleItem aItem(pOutlineRule->GetName());
+
+ pColl->SetFmtAttr(aItem);
+ }
+ // <--
+ }
+ }
+ pColl->SetNextTxtFmtColl( *pDoc->GetTxtCollFromPool(
+ RES_POOLCOLL_TEXT ));
+ }
+}
+
+
+
+void lcl_SetRegister( SwDoc* pDoc, SfxItemSet& rSet, sal_uInt16 nFact,
+ sal_Bool bHeader, sal_Bool bTab )
+{
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ sal_uInt16 nLeft = nFact ? GetMetricVal( CM_05 ) * nFact : 0;
+ aLR.SetTxtLeft( nLeft );
+
+ rSet.Put( aLR );
+ if( bHeader )
+ {
+ SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
+ SetAllScriptItem( rSet, SvxFontHeightItem( PT_16, 100, RES_CHRATR_FONTSIZE ) );
+ }
+ if( bTab )
+ {
+ long nRightMargin = lcl_GetRightMargin( *pDoc );
+ SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+ aTStops.Insert( SvxTabStop( nRightMargin - nLeft,
+ SVX_TAB_ADJUST_RIGHT,
+ cDfltDecimalChar, '.' ));
+ rSet.Put( aTStops );
+ }
+}
+
+
+
+void lcl_SetNumBul( SwDoc* pDoc, SwTxtFmtColl* pColl,
+ SfxItemSet& rSet,
+ sal_uInt16 nNxt, SwTwips nEZ, SwTwips nLeft,
+ SwTwips nUpper, SwTwips nLower )
+{
+
+ SvxLRSpaceItem aLR( RES_LR_SPACE ); SvxULSpaceItem aUL( RES_UL_SPACE );
+ aLR.SetTxtFirstLineOfst( sal_uInt16(nEZ) ); aLR.SetTxtLeft( sal_uInt16(nLeft) );
+ aUL.SetUpper( sal_uInt16(nUpper) ); aUL.SetLower( sal_uInt16(nLower) );
+ rSet.Put( aLR );
+ rSet.Put( aUL );
+
+ if( !pColl )
+ pColl->SetNextTxtFmtColl( *pDoc->GetTxtCollFromPool( nNxt ));
+}
+
+
+
+// Gebe die "Auto-Collection" mit der Id zurueck. Existiert
+// sie noch nicht, dann erzeuge sie
+// Ist der String-Pointer definiert, dann erfrage nur die
+// Beschreibung der Attribute, !! es legt keine Vorlage an !!
+
+SvxFrameDirection GetDefaultFrameDirection(sal_uLong nLanguage)
+{
+ SvxFrameDirection eResult = (MsLangId::isRightToLeft( static_cast<LanguageType>(nLanguage)) ?
+ FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP);
+ return eResult;
+}
+
+SwTxtFmtColl* SwDoc::GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage )
+{
+ ASSERT(
+ (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) ||
+ (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) ||
+ (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) ||
+ (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) ||
+ (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
+ (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END),
+ "Falsche AutoFormat-Id" );
+
+ SwTxtFmtColl* pNewColl;
+ sal_uInt16 nOutLvlBits = 0;
+ for( sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); ++n )
+ {
+ if( nId == ( pNewColl = (*pTxtFmtCollTbl)[ n ] )->GetPoolFmtId() )
+ {
+ return pNewColl;
+ }
+ //if( pNewColl->GetOutlineLevel() < MAXLEVEL ) //#outline level,zhaojianwei
+ //nOutLvlBits |= ( 1 << pNewColl->GetOutlineLevel() );
+ if( pNewColl->IsAssignedToListLevelOfOutlineStyle())
+ nOutLvlBits |= ( 1 << pNewColl->GetAssignedOutlineStyleLevel() );//<-end,zhaojianwei
+ }
+
+ // bis hierher nicht gefunden -> neu anlegen
+ sal_uInt16 nResId = 0;
+ if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
+ nResId = RC_POOLCOLL_TEXT_BEGIN - RES_POOLCOLL_TEXT_BEGIN;
+ else if (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END)
+ nResId = RC_POOLCOLL_LISTS_BEGIN - RES_POOLCOLL_LISTS_BEGIN;
+ else if (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END)
+ nResId = RC_POOLCOLL_EXTRA_BEGIN - RES_POOLCOLL_EXTRA_BEGIN;
+ else if (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END)
+ nResId = RC_POOLCOLL_REGISTER_BEGIN - RES_POOLCOLL_REGISTER_BEGIN;
+ else if (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END)
+ nResId = RC_POOLCOLL_DOC_BEGIN - RES_POOLCOLL_DOC_BEGIN;
+ else if (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END)
+ nResId = RC_POOLCOLL_HTML_BEGIN - RES_POOLCOLL_HTML_BEGIN;
+
+ ASSERT( nResId, "Ungueltige Pool-ID" );
+ if( !nResId )
+ return GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
+
+ ResId aResId( nResId + nId, *pSwResMgr );
+ String aNm( aResId );
+
+ // ein Set fuer alle zusetzenden Attribute
+ SwAttrSet aSet( GetAttrPool(), aTxtFmtCollSetRange );
+ sal_uInt16 nParent = GetPoolParent( nId );
+
+ {
+
+//FEATURE::CONDCOLL
+ if(::IsConditionalByPoolId( nId ))
+ pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), aNm, !nParent
+ ? pDfltTxtFmtColl
+ : GetTxtCollFromPool( nParent ));
+ else
+//FEATURE::CONDCOLL
+ pNewColl = new SwTxtFmtColl( GetAttrPool(), aNm, !nParent
+ ? pDfltTxtFmtColl
+ : GetTxtCollFromPool( nParent ));
+ pNewColl->SetPoolFmtId( nId );
+ pTxtFmtCollTbl->Insert( pNewColl, pTxtFmtCollTbl->Count() );
+ }
+
+ switch( nId )
+ {
+ // allgemeine Inhaltsformen
+ case RES_POOLCOLL_STANDARD:
+ /* #111214# koreans do not like SvxScriptItem(sal_True) */
+ if (bRegardLanguage)
+ {
+ sal_uLong nAppLanguage = GetAppLanguage();
+ if (GetDefaultFrameDirection(nAppLanguage) ==
+ FRMDIR_HORI_RIGHT_TOP)
+ {
+ SvxAdjustItem aAdjust(SVX_ADJUST_RIGHT, RES_PARATR_ADJUST );
+ aSet.Put(aAdjust);
+ }
+ if (nAppLanguage == LANGUAGE_KOREAN)
+ {
+ SvxScriptSpaceItem aScriptSpace(sal_False, RES_PARATR_SCRIPTSPACE);
+ aSet.Put(aScriptSpace);
+ }
+ }
+ break;
+
+ case RES_POOLCOLL_TEXT: // Textkoerper
+ {
+ SvxULSpaceItem aUL( 0, PT_6, RES_UL_SPACE );
+ if( get(IDocumentSettingAccess::HTML_MODE) ) aUL.SetLower( HTML_PARSPACE );
+ aSet.Put( aUL );
+ }
+ break;
+ case RES_POOLCOLL_TEXT_IDENT: // Textkoerper Einzug
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetTxtFirstLineOfst( GetMetricVal( CM_05 ));
+ aSet.Put( aLR );
+ }
+ break;
+ case RES_POOLCOLL_TEXT_NEGIDENT: // Textkoerper neg. Einzug
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 ));
+ aLR.SetTxtLeft( GetMetricVal( CM_1 ));
+ SvxTabStopItem aTStops(RES_PARATR_TABSTOP); aTStops.Insert( SvxTabStop( 0 ));
+
+ aSet.Put( aLR );
+ aSet.Put( aTStops );
+ }
+ break;
+ case RES_POOLCOLL_TEXT_MOVE: // Textkoerper Einrueckung
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetTxtLeft( GetMetricVal( CM_05 ));
+ aSet.Put( aLR );
+ }
+ break;
+
+ case RES_POOLCOLL_CONFRONTATION: // Textkoerper Gegenueberstellung
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetTxtFirstLineOfst( - short( GetMetricVal( CM_1 ) * 4 +
+ GetMetricVal( CM_05)) );
+ aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 5 );
+ SvxTabStopItem aTStops( RES_PARATR_TABSTOP ); aTStops.Insert( SvxTabStop( 0 ));
+
+ aSet.Put( aLR );
+ aSet.Put( aTStops );
+ }
+ break;
+ case RES_POOLCOLL_MARGINAL: // Textkoerper maginalie
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 4 );
+ aSet.Put( aLR );
+ }
+ break;
+
+ case RES_POOLCOLL_HEADLINE_BASE: // Basis Ueberschrift
+ {
+ static const sal_uInt16 aFntInit[] = {
+ DEFAULTFONT_LATIN_HEADING, RES_CHRATR_FONT,
+ RES_CHRATR_LANGUAGE, LANGUAGE_ENGLISH_US,
+ DEFAULTFONT_CJK_HEADING, RES_CHRATR_CJK_FONT,
+ RES_CHRATR_CJK_LANGUAGE, LANGUAGE_ENGLISH_US,
+ DEFAULTFONT_CTL_HEADING, RES_CHRATR_CTL_FONT,
+ RES_CHRATR_CTL_LANGUAGE, LANGUAGE_ARABIC_SAUDI_ARABIA,
+ 0
+ };
+
+ for( const sal_uInt16* pArr = aFntInit; *pArr; pArr += 4 )
+ {
+ sal_uInt16 nLng = ((SvxLanguageItem&)GetDefault( *(pArr+2) )).GetLanguage();
+ if( LANGUAGE_DONTKNOW == nLng )
+ nLng = *(pArr+3);
+
+ Font aFnt( OutputDevice::GetDefaultFont( *pArr,
+ nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
+
+ aSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
+ aEmptyStr, aFnt.GetPitch(),
+ aFnt.GetCharSet(), *(pArr+1) ));
+ }
+
+ SvxFontHeightItem aFntSize( PT_14, 100, RES_CHRATR_FONTSIZE );
+ SvxULSpaceItem aUL( PT_12, PT_6, RES_UL_SPACE );
+ if( get(IDocumentSettingAccess::HTML_MODE) )
+ aUL.SetLower( HTML_PARSPACE );
+ aSet.Put( SvxFmtKeepItem( sal_True, RES_KEEP ));
+
+ pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool( RES_POOLCOLL_TEXT ));
+
+ aSet.Put( aUL );
+ SetAllScriptItem( aSet, aFntSize );
+ }
+ break;
+
+ case RES_POOLCOLL_NUMBUL_BASE: // Basis Numerierung/Aufzaehlung
+ break;
+
+ case RES_POOLCOLL_GREETING: // Grussformel
+ case RES_POOLCOLL_REGISTER_BASE: // Basis Verzeichnisse
+ case RES_POOLCOLL_SIGNATURE: // Unterschrift
+ case RES_POOLCOLL_TABLE: // Tabelle-Inhalt
+ {
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+
+ case RES_POOLCOLL_HEADLINE1: // Ueberschrift 1
+ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 0, sal_False );
+ break;
+ case RES_POOLCOLL_HEADLINE2: // Ueberschrift 2
+ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 1, sal_True );
+ break;
+ case RES_POOLCOLL_HEADLINE3: // Ueberschrift 3
+ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 2, sal_False );
+ break;
+ case RES_POOLCOLL_HEADLINE4: // Ueberschrift 4
+ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 3, sal_True );
+ break;
+ case RES_POOLCOLL_HEADLINE5: // Ueberschrift 5
+ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 4, sal_False );
+ break;
+ case RES_POOLCOLL_HEADLINE6: // Ueberschrift 6
+ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 5, sal_False );
+ break;
+ case RES_POOLCOLL_HEADLINE7: // Ueberschrift 7
+ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 6, sal_False );
+ break;
+ case RES_POOLCOLL_HEADLINE8: // Ueberschrift 8
+ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 7, sal_False );
+ break;
+ case RES_POOLCOLL_HEADLINE9: // Ueberschrift 9
+ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 8, sal_False );
+ break;
+ case RES_POOLCOLL_HEADLINE10: // Ueberschrift 10
+ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 9, sal_False );
+ break;
+
+
+ // Sonderbereiche:
+ // Kopfzeilen
+ case RES_POOLCOLL_HEADER:
+ case RES_POOLCOLL_HEADERL:
+ case RES_POOLCOLL_HEADERR:
+ // Fusszeilen
+ case RES_POOLCOLL_FOOTER:
+ case RES_POOLCOLL_FOOTERL:
+ case RES_POOLCOLL_FOOTERR:
+ {
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+
+ long nRightMargin = lcl_GetRightMargin( *this );
+
+ SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+ aTStops.Insert( SvxTabStop( nRightMargin / 2, SVX_TAB_ADJUST_CENTER ) );
+ aTStops.Insert( SvxTabStop( nRightMargin, SVX_TAB_ADJUST_RIGHT ) );
+
+ aSet.Put( aTStops );
+ }
+ break;
+
+ case RES_POOLCOLL_TABLE_HDLN:
+ {
+ SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
+ aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) );
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+
+ case RES_POOLCOLL_FOOTNOTE: // Fussnote
+ case RES_POOLCOLL_ENDNOTE:
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 ));
+ aLR.SetTxtLeft( GetMetricVal( CM_05 ));
+ SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) );
+ aSet.Put( aLR );
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+
+ case RES_POOLCOLL_LABEL: // Beschriftung-Basis
+ {
+ SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetUpper( PT_6 ); aUL.SetLower( PT_6 );
+ aSet.Put( aUL );
+ SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) );
+ SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) );
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+
+ case RES_POOLCOLL_FRAME: // Rahmen Inhalt
+ case RES_POOLCOLL_LABEL_ABB: // Beschriftung-Abbildung
+ case RES_POOLCOLL_LABEL_TABLE: // Beschriftung-Tabelle
+ case RES_POOLCOLL_LABEL_FRAME: // Beschriftung-Rahmen
+ case RES_POOLCOLL_LABEL_DRAWING: // Beschriftung-Zeichnung
+ break;
+
+ case RES_POOLCOLL_JAKETADRESS: // UmschlagAdresse
+ {
+ SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 );
+ aSet.Put( aUL );
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+
+ case RES_POOLCOLL_SENDADRESS: // AbsenderAdresse
+ {
+ if( get(IDocumentSettingAccess::HTML_MODE) )
+ SetAllScriptItem( aSet, SvxPostureItem(ITALIC_NORMAL, RES_CHRATR_POSTURE) );
+ else
+ {
+ SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 );
+ aSet.Put( aUL );
+ }
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+
+ // Benutzer-Verzeichnisse:
+ case RES_POOLCOLL_TOX_USERH: // Header
+ lcl_SetRegister( this, aSet, 0, sal_True, sal_False );
+ {
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+ case RES_POOLCOLL_TOX_USER1: // 1. Ebene
+ lcl_SetRegister( this, aSet, 0, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_USER2: // 2. Ebene
+ lcl_SetRegister( this, aSet, 1, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_USER3: // 3. Ebene
+ lcl_SetRegister( this, aSet, 2, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_USER4: // 4. Ebene
+ lcl_SetRegister( this, aSet, 3, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_USER5: // 5. Ebene
+ lcl_SetRegister( this, aSet, 4, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_USER6: // 6. Ebene
+ lcl_SetRegister( this, aSet, 5, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_USER7: // 7. Ebene
+ lcl_SetRegister( this, aSet, 6, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_USER8: // 8. Ebene
+ lcl_SetRegister( this, aSet, 7, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_USER9: // 9. Ebene
+ lcl_SetRegister( this, aSet, 8, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_USER10: // 10. Ebene
+ lcl_SetRegister( this, aSet, 9, sal_False, sal_True );
+ break;
+
+ // Index-Verzeichnisse
+ case RES_POOLCOLL_TOX_IDXH: // Header
+ lcl_SetRegister( this, aSet, 0, sal_True, sal_False );
+ {
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+ case RES_POOLCOLL_TOX_IDX1: // 1. Ebene
+ lcl_SetRegister( this, aSet, 0, sal_False, sal_False );
+ break;
+ case RES_POOLCOLL_TOX_IDX2: // 2. Ebene
+ lcl_SetRegister( this, aSet, 1, sal_False, sal_False );
+ break;
+ case RES_POOLCOLL_TOX_IDX3: // 3. Ebene
+ lcl_SetRegister( this, aSet, 2, sal_False, sal_False );
+ break;
+ case RES_POOLCOLL_TOX_IDXBREAK: // Trenner
+ lcl_SetRegister( this, aSet, 0, sal_False, sal_False );
+ break;
+
+ // Inhalts-Verzeichnisse
+ case RES_POOLCOLL_TOX_CNTNTH: // Header
+ lcl_SetRegister( this, aSet, 0, sal_True, sal_False );
+ {
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+ case RES_POOLCOLL_TOX_CNTNT1: // 1. Ebene
+ lcl_SetRegister( this, aSet, 0, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_CNTNT2: // 2. Ebene
+ lcl_SetRegister( this, aSet, 1, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_CNTNT3: // 3. Ebene
+ lcl_SetRegister( this, aSet, 2, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_CNTNT4: // 4. Ebene
+ lcl_SetRegister( this, aSet, 3, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_CNTNT5: // 5. Ebene
+ lcl_SetRegister( this, aSet, 4, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_CNTNT6: // 6. Ebene
+ lcl_SetRegister( this, aSet, 5, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_CNTNT7: // 7. Ebene
+ lcl_SetRegister( this, aSet, 6, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_CNTNT8: // 8. Ebene
+ lcl_SetRegister( this, aSet, 7, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_CNTNT9: // 9. Ebene
+ lcl_SetRegister( this, aSet, 8, sal_False, sal_True );
+ break;
+ case RES_POOLCOLL_TOX_CNTNT10: // 10. Ebene
+ lcl_SetRegister( this, aSet, 9, sal_False, sal_True );
+ break;
+
+ case RES_POOLCOLL_TOX_ILLUSH:
+ case RES_POOLCOLL_TOX_OBJECTH:
+ case RES_POOLCOLL_TOX_TABLESH:
+ case RES_POOLCOLL_TOX_AUTHORITIESH:
+ lcl_SetRegister( this, aSet, 0, sal_True, sal_False );
+ {
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+ case RES_POOLCOLL_TOX_ILLUS1:
+ case RES_POOLCOLL_TOX_OBJECT1:
+ case RES_POOLCOLL_TOX_TABLES1:
+ case RES_POOLCOLL_TOX_AUTHORITIES1:
+ lcl_SetRegister( this, aSet, 0, sal_False, sal_True );
+ break;
+
+
+
+ case RES_POOLCOLL_NUM_LEVEL1S:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
+ PT_12, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL1:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
+ 0, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL1E:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
+ 0, PT_12 );
+ break;
+ case RES_POOLCOLL_NUM_NONUM1:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM1,
+ 0, SwNumRule::GetNumIndent( 0 ), 0, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL2S:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
+ PT_12, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL2:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
+ 0, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL2E:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
+ 0, PT_12 );
+ break;
+ case RES_POOLCOLL_NUM_NONUM2:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM2,
+ 0, SwNumRule::GetNumIndent( 1 ), 0, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL3S:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
+ PT_12, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL3:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
+ 0, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL3E:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
+ 0, PT_12 );
+ break;
+ case RES_POOLCOLL_NUM_NONUM3:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM3,
+ 0, SwNumRule::GetNumIndent( 2 ), 0, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL4S:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
+ PT_12, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL4:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
+ 0, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL4E:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
+ 0, PT_12 );
+ break;
+ case RES_POOLCOLL_NUM_NONUM4:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM4,
+ 0, SwNumRule::GetNumIndent( 3 ), 0, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL5S:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
+ PT_12, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL5:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
+ 0, PT_6 );
+ break;
+ case RES_POOLCOLL_NUM_LEVEL5E:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
+ lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
+ 0, PT_12 );
+ break;
+ case RES_POOLCOLL_NUM_NONUM5:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM5,
+ 0, SwNumRule::GetNumIndent( 4 ), 0, PT_6 );
+ break;
+
+ case RES_POOLCOLL_BUL_LEVEL1S:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
+ PT_12, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL1:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
+ 0, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL1E:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
+ 0, PT_12 );
+ break;
+ case RES_POOLCOLL_BUL_NONUM1:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM1,
+ 0, SwNumRule::GetBullIndent( 0 ), 0, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL2S:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
+ PT_12, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL2:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
+ 0, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL2E:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
+ 0, PT_12 );
+ break;
+ case RES_POOLCOLL_BUL_NONUM2:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM2,
+ 0, SwNumRule::GetBullIndent( 1 ), 0, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL3S:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
+ PT_12, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL3:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
+ 0, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL3E:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
+ 0, PT_12 );
+ break;
+ case RES_POOLCOLL_BUL_NONUM3:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM3,
+ 0, SwNumRule::GetBullIndent( 2 ), 0, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL4S:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
+ PT_12, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL4:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
+ 0, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL4E:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
+ 0, PT_12 );
+ break;
+ case RES_POOLCOLL_BUL_NONUM4:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM4,
+ 0, SwNumRule::GetBullIndent( 3 ), 0, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL5S:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
+ PT_12, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL5:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
+ 0, PT_6 );
+ break;
+ case RES_POOLCOLL_BUL_LEVEL5E:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
+ lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
+ 0, PT_12 );
+ break;
+ case RES_POOLCOLL_BUL_NONUM5:
+ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM5,
+ 0, SwNumRule::GetBullIndent( 4 ), 0, PT_6 );
+ break;
+
+ case RES_POOLCOLL_DOC_TITEL: // Doc. Titel
+ {
+ SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
+ SetAllScriptItem( aSet, SvxFontHeightItem( PT_18, 100, RES_CHRATR_FONTSIZE ) );
+
+ aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) );
+
+ pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
+ RES_POOLCOLL_DOC_SUBTITEL ));
+ }
+ break;
+
+ case RES_POOLCOLL_DOC_SUBTITEL: // Doc. UnterTitel
+ {
+ SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ));
+ SetAllScriptItem( aSet, SvxFontHeightItem( PT_14, 100, RES_CHRATR_FONTSIZE ));
+
+ aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ));
+
+ pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
+ RES_POOLCOLL_TEXT ));
+ }
+ break;
+
+ case RES_POOLCOLL_HTML_BLOCKQUOTE:
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetLeft( GetMetricVal( CM_1 ));
+ aLR.SetRight( GetMetricVal( CM_1 ));
+ aSet.Put( aLR );
+// aSet.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, RES_PARATR_ADJUST ) );
+ SvxULSpaceItem aUL( RES_UL_SPACE );
+ aUL = pNewColl->GetULSpace();
+ aUL.SetLower( HTML_PARSPACE );
+ aSet.Put( aUL);
+ }
+ break;
+
+ case RES_POOLCOLL_HTML_PRE:
+ {
+ ::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
+
+// WORKAROUND: PRE auf 10pt setzten
+ SetAllScriptItem( aSet, SvxFontHeightItem(PT_10, 100, RES_CHRATR_FONTSIZE) );
+// WORKAROUND: PRE auf 10pt setzten
+
+ // der untere Absatz-Abstand wird explizit gesetzt (macht
+ // die harte Attributierung einfacher)
+ SvxULSpaceItem aULSpaceItem( RES_UL_SPACE );
+ aULSpaceItem = pNewColl->GetULSpace();
+ aULSpaceItem.SetLower( 0 );
+ aSet.Put( aULSpaceItem );
+ }
+ break;
+
+ case RES_POOLCOLL_HTML_HR:
+ {
+ SvxBoxItem aBox( RES_BOX );
+ Color aColor( COL_GRAY );
+ SvxBorderLine aNew( &aColor, DEF_DOUBLE_LINE0_OUT,
+ DEF_DOUBLE_LINE0_IN,
+ DEF_DOUBLE_LINE0_DIST );
+ aBox.SetLine( &aNew, BOX_LINE_BOTTOM );
+
+ aSet.Put( aBox );
+ aSet.Put( SwParaConnectBorderItem( sal_False ) );
+ SetAllScriptItem( aSet, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE) );
+
+ SvxULSpaceItem aUL( RES_UL_SPACE );
+ {
+ pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
+ RES_POOLCOLL_TEXT ));
+ aUL = pNewColl->GetULSpace();
+ }
+ aUL.SetLower( HTML_PARSPACE );
+ aSet.Put( aUL);
+ SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
+ aSet.Put( aLN );
+ }
+ break;
+
+ case RES_POOLCOLL_HTML_DD:
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR = pNewColl->GetLRSpace();
+ // es wird um 1cm eingerueckt. Die IDs liegen immer 2 auseinander!
+ aLR.SetLeft( GetMetricVal( CM_1 ));
+ aSet.Put( aLR );
+ }
+ break;
+ case RES_POOLCOLL_HTML_DT:
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ {
+ pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
+ RES_POOLCOLL_HTML_DD ));
+ aLR = pNewColl->GetLRSpace();
+ }
+ // es wird um 0cm eingerueckt. Die IDs liegen immer 2 auseinander!
+ aLR.SetLeft( 0 );
+ aSet.Put( aLR );
+ }
+ break;
+ }
+
+ if( aSet.Count() )
+ {
+ {
+ pNewColl->SetFmtAttr( aSet );
+ // JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
+ // (Bug: 18545)
+ // SetModified();
+ }
+ }
+ return pNewColl;
+}
+
+
+
+ // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
+ // benutzt wird
+bool SwDoc::IsPoolTxtCollUsed( sal_uInt16 nId ) const
+{
+ ASSERT(
+ (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) ||
+ (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) ||
+ (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) ||
+ (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) ||
+ (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
+ (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END),
+ "Falsche AutoFormat-Id" );
+
+ SwTxtFmtColl* pNewColl = 0;
+ sal_Bool bFnd = sal_False;
+ for( sal_uInt16 n = 0; !bFnd && n < pTxtFmtCollTbl->Count(); ++n )
+ {
+ pNewColl = (*pTxtFmtCollTbl)[ n ];
+ if( nId == pNewColl->GetPoolFmtId() )
+ bFnd = sal_True;
+ }
+
+ if( !bFnd || !pNewColl->GetDepends() )
+ return sal_False;
+
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
+ return !pNewColl->GetInfo( aGetHt );
+}
+
+ // Gebe das "Auto[matische]-Format" mit der Id zurueck. Existiert
+ // es noch nicht, dann erzeuge es
+
+SwFmt* SwDoc::GetFmtFromPool( sal_uInt16 nId )
+{
+ SwFmt *pNewFmt = 0;
+ SwFmt *pDeriveFmt = 0;
+
+ SvPtrarr* pArray[ 2 ];
+ sal_uInt16 nArrCnt = 1, nRCId = 0;
+ sal_uInt16* pWhichRange = 0;
+
+ switch( nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
+ {
+ case POOLGRP_CHARFMT:
+ {
+ pArray[0] = pCharFmtTbl;
+ pDeriveFmt = pDfltCharFmt;
+
+ if( nId > RES_POOLCHR_NORMAL_END )
+ nRCId = RC_POOLCHRFMT_HTML_BEGIN - RES_POOLCHR_HTML_BEGIN;
+ else
+ nRCId = RC_POOLCHRFMT_BEGIN - RES_POOLCHR_BEGIN;
+ pWhichRange = aCharFmtSetRange;
+
+ // Fehlerfall: unbekanntes Format, aber CharFormat
+ // -> returne das erste
+ if( RES_POOLCHR_BEGIN > nId || nId >= RES_POOLCHR_END )
+ {
+ ASSERT( !this, "ungueltige Id" );
+ nId = RES_POOLCHR_BEGIN;
+ }
+ }
+ break;
+ case POOLGRP_FRAMEFMT:
+ {
+ pArray[0] = pFrmFmtTbl;
+ pArray[1] = pSpzFrmFmtTbl;
+ pDeriveFmt = pDfltFrmFmt;
+ nArrCnt = 2;
+ nRCId = RC_POOLFRMFMT_BEGIN - RES_POOLFRM_BEGIN;
+ pWhichRange = aFrmFmtSetRange;
+
+ // Fehlerfall: unbekanntes Format, aber FrameFormat
+ // -> returne das erste
+ if( RES_POOLFRM_BEGIN > nId || nId >= RES_POOLFRM_END )
+ {
+ ASSERT( !this, "ungueltige Id" );
+ nId = RES_POOLFRM_BEGIN;
+ }
+ }
+ break;
+
+ default:
+ // Fehlerfall, unbekanntes Format
+ ASSERT( nId, "ungueltige Id" );
+ return 0;
+ }
+ ASSERT( nRCId, "ungueltige Id" );
+
+ while( nArrCnt-- )
+ for( sal_uInt16 n = 0; n < (*pArray[nArrCnt]).Count(); ++n )
+ if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )->
+ GetPoolFmtId() )
+ {
+ return pNewFmt;
+ }
+
+ ResId aResId( nRCId + nId, *pSwResMgr );
+ String aNm( aResId );
+ SwAttrSet aSet( GetAttrPool(), pWhichRange );
+
+ {
+ sal_Bool bIsModified = IsModified();
+
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+ switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
+ {
+ case POOLGRP_CHARFMT:
+ pNewFmt = _MakeCharFmt(aNm, pDeriveFmt, sal_False, sal_True);
+ break;
+ case POOLGRP_FRAMEFMT:
+ pNewFmt = _MakeFrmFmt(aNm, pDeriveFmt, sal_False, sal_True);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if( !bIsModified )
+ ResetModified();
+ pNewFmt->SetPoolFmtId( nId );
+ pNewFmt->SetAuto( sal_False ); // kein Auto-Format
+ }
+
+ switch( nId )
+ {
+ case RES_POOLCHR_FOOTNOTE: // Fussnote
+ case RES_POOLCHR_PAGENO: // Seiten/Feld
+ case RES_POOLCHR_LABEL: // Beschriftung
+ case RES_POOLCHR_DROPCAPS: // Initialien
+ case RES_POOLCHR_NUM_LEVEL: // Aufzaehlungszeichen
+ case RES_POOLCHR_TOXJUMP: // Verzeichnissprung
+ case RES_POOLCHR_ENDNOTE: // Endnote
+ case RES_POOLCHR_LINENUM: // Zeilennummerierung
+ break;
+
+ case RES_POOLCHR_ENDNOTE_ANCHOR: // Endnotenanker
+ case RES_POOLCHR_FOOTNOTE_ANCHOR: // Fussnotenanker
+ {
+ aSet.Put( SvxEscapementItem( DFLT_ESC_AUTO_SUPER, 58, RES_CHRATR_ESCAPEMENT ) );
+ }
+ break;
+
+
+ case RES_POOLCHR_BUL_LEVEL: // Aufzaehlungszeichen
+ {
+ const Font& rBulletFont = numfunc::GetDefBulletFont();
+ SetAllScriptItem( aSet, SvxFontItem( rBulletFont.GetFamily(),
+ rBulletFont.GetName(), rBulletFont.GetStyleName(),
+ rBulletFont.GetPitch(), rBulletFont.GetCharSet(), RES_CHRATR_FONT ));
+ // --> OD 2008-06-02 #i63395#
+ // no font and no font size any more
+// SetAllScriptItem( aSet, SvxFontHeightItem( PT_9, 100, RES_CHRATR_FONTSIZE ));
+ // <--
+ }
+ break;
+
+ case RES_POOLCHR_INET_NORMAL:
+ {
+ Color aCol( COL_BLUE );
+ aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
+ aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE ) );
+ // i40133: patch submitted by rail: set language to 'none' to prevent spell checking:
+ aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
+ aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE ) );
+ aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE ) );
+ }
+ break;
+ case RES_POOLCHR_INET_VISIT:
+ {
+ Color aCol( COL_RED );
+ aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
+ aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE ) );
+ aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
+ aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE ) );
+ aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE ) );
+ }
+ break;
+ case RES_POOLCHR_JUMPEDIT:
+ {
+ Color aCol( COL_CYAN );
+ aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
+ aSet.Put( SvxUnderlineItem( UNDERLINE_DOTTED, RES_CHRATR_UNDERLINE ) );
+ aSet.Put( SvxCaseMapItem( SVX_CASEMAP_KAPITAELCHEN, RES_CHRATR_CASEMAP ) );
+ }
+ break;
+
+ case RES_POOLCHR_RUBYTEXT:
+ {
+ long nH = ((SvxFontHeightItem*)GetDfltAttr(
+ RES_CHRATR_CJK_FONTSIZE ))->GetHeight() / 2;
+ SetAllScriptItem( aSet, SvxFontHeightItem( nH, 100, RES_CHRATR_FONTSIZE));
+ aSet.Put(SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ));
+ aSet.Put(SvxEmphasisMarkItem( EMPHASISMARK_NONE, RES_CHRATR_EMPHASIS_MARK) );
+ }
+ break;
+
+ case RES_POOLCHR_HTML_EMPHASIS:
+ case RES_POOLCHR_HTML_CITIATION:
+ case RES_POOLCHR_HTML_VARIABLE:
+ {
+ SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE) );
+ }
+ break;
+
+ case RES_POOLCHR_IDX_MAIN_ENTRY:
+ case RES_POOLCHR_HTML_STRONG:
+ {
+ SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ));
+ }
+ break;
+
+ case RES_POOLCHR_HTML_CODE:
+ case RES_POOLCHR_HTML_SAMPLE:
+ case RES_POOLCHR_HTML_KEYBOARD:
+ case RES_POOLCHR_HTML_TELETYPE:
+ {
+ ::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
+ }
+ break;
+ case RES_POOLCHR_VERT_NUM:
+ aSet.Put( SvxCharRotateItem( 900, sal_False, RES_CHRATR_ROTATE ) );
+ break;
+//nichts besonderes
+// case RES_POOLCHR_HTML_DEFINSTANCE:
+// break;
+
+
+ case RES_POOLFRM_FRAME:
+ {
+ if ( get(IDocumentSettingAccess::HTML_MODE) )
+ {
+ aSet.Put( SwFmtAnchor( FLY_AS_CHAR ));
+ aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::LINE_CENTER, text::RelOrientation::PRINT_AREA ) );
+ aSet.Put( SwFmtSurround( SURROUND_NONE ) );
+ }
+ else
+ {
+ aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
+ aSet.Put( SwFmtSurround( SURROUND_PARALLEL ) );
+ aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::PRINT_AREA ) );
+ aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::PRINT_AREA ) );
+ Color aCol( COL_BLACK );
+ SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 );
+ SvxBoxItem aBox( RES_BOX );
+ aBox.SetLine( &aLine, BOX_LINE_TOP );
+ aBox.SetLine( &aLine, BOX_LINE_BOTTOM );
+ aBox.SetLine( &aLine, BOX_LINE_LEFT );
+ aBox.SetLine( &aLine, BOX_LINE_RIGHT );
+ aBox.SetDistance( 85 );
+ aSet.Put( aBox );
+ aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
+ aSet.Put( SvxULSpaceItem( 114, 114, RES_UL_SPACE ) );
+ }
+ }
+ break;
+ case RES_POOLFRM_GRAPHIC:
+ case RES_POOLFRM_OLE:
+ {
+ aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
+ aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
+ aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
+ aSet.Put( SwFmtSurround( SURROUND_NONE ));
+ }
+ break;
+ case RES_POOLFRM_FORMEL:
+ {
+ aSet.Put( SwFmtAnchor( FLY_AS_CHAR ) );
+ aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::FRAME ) );
+ aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
+ }
+ break;
+ case RES_POOLFRM_MARGINAL:
+ {
+ aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
+ aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::FRAME ));
+ aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
+ aSet.Put( SwFmtSurround( SURROUND_PARALLEL ));
+ // Breite 3.5 centimeter vorgegeben, als Hoehe nur den
+ // min. Wert benutzen
+ aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE,
+ GetMetricVal( CM_1 ) * 3 + GetMetricVal( CM_05 ),
+ MM50 ));
+ }
+ break;
+ case RES_POOLFRM_WATERSIGN:
+ {
+ aSet.Put( SwFmtAnchor( FLY_AT_PAGE ));
+ aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
+ aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME ));
+ aSet.Put( SvxOpaqueItem( sal_False ));
+ aSet.Put( SwFmtSurround( SURROUND_THROUGHT ));
+ }
+ break;
+
+ case RES_POOLFRM_LABEL:
+ {
+ aSet.Put( SwFmtAnchor( FLY_AS_CHAR ) );
+ aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ) );
+ aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
+
+ SvxProtectItem aProtect( RES_PROTECT );
+ aProtect.SetSizeProtect( sal_True );
+ aProtect.SetPosProtect( sal_True );
+ aSet.Put( aProtect );
+
+ pNewFmt->SetAutoUpdateFmt( sal_True );
+ }
+ break;
+ }
+ if( aSet.Count() )
+ {
+ {
+ pNewFmt->SetFmtAttr( aSet );
+ // JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
+ // (Bug: 18545)
+ // SetModified();
+ }
+ }
+ return pNewFmt;
+}
+
+SwFrmFmt* SwDoc::GetFrmFmtFromPool( sal_uInt16 nId )
+{
+ return (SwFrmFmt*)GetFmtFromPool( nId );
+}
+
+SwCharFmt* SwDoc::GetCharFmtFromPool( sal_uInt16 nId )
+{
+ return (SwCharFmt*)GetFmtFromPool( nId );
+}
+
+ // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
+ // benutzt wird
+bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const
+{
+ SwFmt *pNewFmt = 0;
+ const SvPtrarr* pArray[ 2 ];
+ sal_uInt16 nArrCnt = 1;
+ sal_Bool bFnd = sal_True;
+
+ if( RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END )
+ {
+ pArray[0] = pCharFmtTbl;
+ }
+ if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
+ {
+ pArray[0] = pFrmFmtTbl;
+ pArray[1] = pSpzFrmFmtTbl;
+ nArrCnt = 2;
+ }
+ else
+ {
+ ASSERT( sal_False, "ungueltige Id" );
+ bFnd = sal_False;
+ }
+
+ if( bFnd )
+ {
+ bFnd = sal_False;
+ while( nArrCnt-- && !bFnd )
+ for( sal_uInt16 n = 0; !bFnd && n < (*pArray[nArrCnt]).Count(); ++n )
+ if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )->
+ GetPoolFmtId() )
+ bFnd = sal_True;
+ }
+
+ // nicht gefunden oder keine Abhaengigen ?
+ if( bFnd && pNewFmt->GetDepends() )
+ {
+ // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
+ // (auch indirekte fuer Format-Ableitung! )
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
+ bFnd = !pNewFmt->GetInfo( aGetHt );
+ }
+ else
+ bFnd = sal_False;
+
+ return bFnd;
+}
+
+
+
+void lcl_GetStdPgSize( SwDoc* pDoc, SfxItemSet& rSet )
+{
+ SwPageDesc* pStdPgDsc = pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
+ SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
+ if( pStdPgDsc->GetLandscape() )
+ {
+ SwTwips nTmp = aFrmSz.GetHeight();
+ aFrmSz.SetHeight( aFrmSz.GetWidth() );
+ aFrmSz.SetWidth( nTmp );
+ }
+ rSet.Put( aFrmSz );
+}
+
+SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
+{
+ ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
+ "Falsche AutoFormat-Id" );
+
+ SwPageDesc *pNewPgDsc;
+ sal_uInt16 n;
+
+ for( n = 0; n < aPageDescs.Count(); ++n )
+ if( nId == ( pNewPgDsc = aPageDescs[ n ] )->GetPoolFmtId() )
+ {
+ return pNewPgDsc;
+ }
+
+ // Fehlerfall: unbekannte Poolvorlage
+ if( RES_POOLPAGE_BEGIN > nId || nId >= RES_POOLPAGE_END )
+ {
+ ASSERT( !this, "ungueltige Id" );
+ nId = RES_POOLPAGE_BEGIN;
+ }
+
+ ResId aResId( sal_uInt32(RC_POOLPAGEDESC_BEGIN + nId - RES_POOLPAGE_BEGIN), *pSwResMgr );
+ String aNm( aResId );
+ {
+ sal_Bool bIsModified = IsModified();
+
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+ n = MakePageDesc( aNm, 0, bRegardLanguage );
+ }
+
+ pNewPgDsc = aPageDescs[ n ];
+ pNewPgDsc->SetPoolFmtId( nId );
+ if( !bIsModified )
+ ResetModified();
+ }
+
+
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetLeft( GetMetricVal( CM_1 ) * 2 );
+ aLR.SetRight( aLR.GetLeft() );
+ SvxULSpaceItem aUL( RES_UL_SPACE );
+ aUL.SetUpper( (sal_uInt16)aLR.GetLeft() );
+ aUL.SetLower( (sal_uInt16)aLR.GetLeft() );
+
+ SwAttrSet aSet( GetAttrPool(), aPgFrmFmtSetRange );
+ sal_Bool bSetLeft = sal_True;
+
+ switch( nId )
+ {
+ case RES_POOLPAGE_STANDARD: // Standard-Seite
+ {
+ aSet.Put( aLR );
+ aSet.Put( aUL );
+ if( pNewPgDsc )
+ pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
+ }
+ break;
+
+ case RES_POOLPAGE_FIRST: // Erste Seite
+ case RES_POOLPAGE_REGISTER: // Verzeichnis
+ {
+ lcl_GetStdPgSize( this, aSet );
+ aSet.Put( aLR );
+ aSet.Put( aUL );
+ if( pNewPgDsc )
+ {
+ pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
+ if( RES_POOLPAGE_FIRST == nId )
+ pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_STANDARD ));
+ }
+ }
+ break;
+
+ case RES_POOLPAGE_LEFT: // Linke Seite
+ {
+ lcl_GetStdPgSize( this, aSet );
+ aSet.Put( aLR );
+ aSet.Put( aUL );
+ bSetLeft = sal_False;
+ if( pNewPgDsc )
+ pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT );
+ }
+ break;
+ case RES_POOLPAGE_RIGHT: // Rechte Seite
+ {
+ lcl_GetStdPgSize( this, aSet );
+ aSet.Put( aLR );
+ aSet.Put( aUL );
+ bSetLeft = sal_False;
+ if( pNewPgDsc )
+ pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT );
+ }
+ break;
+
+ case RES_POOLPAGE_JAKET: // Umschlag
+ {
+ aLR.SetLeft( 0 ); aLR.SetRight( 0 );
+ aUL.SetUpper( 0 ); aUL.SetLower( 0 );
+ Size aPSize( SvxPaperInfo::GetPaperSize( PAPER_ENV_C65 ) );
+ LandscapeSwap( aPSize );
+ aSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aPSize.Width(), aPSize.Height() ));
+ aSet.Put( aLR );
+ aSet.Put( aUL );
+
+ if( pNewPgDsc )
+ {
+ pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
+ pNewPgDsc->SetLandscape( sal_True );
+ }
+ }
+ break;
+
+ case RES_POOLPAGE_HTML: // HTML
+ {
+ lcl_GetStdPgSize( this, aSet );
+ aLR.SetRight( GetMetricVal( CM_1 ));
+ aUL.SetUpper( (sal_uInt16)aLR.GetRight() );
+ aUL.SetLower( (sal_uInt16)aLR.GetRight() );
+ aSet.Put( aLR );
+ aSet.Put( aUL );
+
+ if( pNewPgDsc )
+ pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
+ }
+ break;
+ case RES_POOLPAGE_FOOTNOTE:
+ case RES_POOLPAGE_ENDNOTE:
+ {
+ lcl_GetStdPgSize( this, aSet );
+ aSet.Put( aLR );
+ aSet.Put( aUL );
+ if( pNewPgDsc )
+ pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
+ SwPageFtnInfo aInf( pNewPgDsc->GetFtnInfo() );
+ aInf.SetLineWidth( 0 );
+ aInf.SetTopDist( 0 );
+ aInf.SetBottomDist( 0 );
+ pNewPgDsc->SetFtnInfo( aInf );
+ }
+ break;
+ case RES_POOLPAGE_LANDSCAPE:
+ {
+ SwPageDesc* pStdPgDsc = this->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
+ SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
+ SwTwips nTmp = aFrmSz.GetHeight();
+ aFrmSz.SetHeight( aFrmSz.GetWidth() );
+ aFrmSz.SetWidth( nTmp );
+ aSet.Put( aFrmSz );
+ aSet.Put( aLR );
+ aSet.Put( aUL );
+ if( pNewPgDsc )
+ {
+ pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
+ pNewPgDsc->SetLandscape( sal_True );
+ }
+ }
+ break;
+
+ }
+
+ if( aSet.Count() )
+ {
+ {
+ if( bSetLeft )
+ pNewPgDsc->GetLeft().SetFmtAttr( aSet );
+ pNewPgDsc->GetMaster().SetFmtAttr( aSet );
+ // JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
+ // (Bug: 18545)
+ // SetModified();
+ }
+ }
+ return pNewPgDsc;
+}
+
+SwNumRule* SwDoc::GetNumRuleFromPool( sal_uInt16 nId )
+{
+ ASSERT( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END,
+ "Falsche AutoFormat-Id" );
+
+ SwNumRule* pNewRule;
+ sal_uInt16 n;
+
+ for( n = 0; n < GetNumRuleTbl().Count(); ++n )
+ if( nId == ( pNewRule = GetNumRuleTbl()[ n ] )->GetPoolFmtId() )
+ {
+ return pNewRule;
+ }
+
+ // Fehlerfall: unbekannte Poolvorlage
+ if( RES_POOLNUMRULE_BEGIN > nId || nId >= RES_POOLNUMRULE_END )
+ {
+ ASSERT( !this, "ungueltige Id" );
+ nId = RES_POOLNUMRULE_BEGIN;
+ }
+
+ ResId aResId( sal_uInt32(RC_POOLNUMRULE_BEGIN + nId - RES_POOLNUMRULE_BEGIN), *pSwResMgr );
+ String aNm( aResId );
+
+ SwCharFmt *pNumCFmt = 0, *pBullCFmt = 0;
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode eNumberFormatPositionAndSpaceMode
+ // --> OD 2008-06-06 #i89178#
+ = numfunc::GetDefaultPositionAndSpaceMode();
+ // <--
+ // <--
+ {
+ sal_Bool bIsModified = IsModified();
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ n = MakeNumRule( aNm, 0, sal_False, eNumberFormatPositionAndSpaceMode );
+ // <--
+ pNewRule = GetNumRuleTbl()[ n ];
+ pNewRule->SetPoolFmtId( nId );
+ pNewRule->SetAutoRule( sal_False );
+
+ if( RES_POOLNUMRULE_NUM1 <= nId && nId <= RES_POOLNUMRULE_NUM5 )
+ pNumCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
+
+ if( ( RES_POOLNUMRULE_BUL1 <= nId && nId <= RES_POOLNUMRULE_BUL5 ) ||
+ RES_POOLNUMRULE_NUM5 == nId )
+ pBullCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
+
+ if( !bIsModified )
+ ResetModified();
+ }
+
+ switch( nId )
+ {
+ case RES_POOLNUMRULE_NUM1:
+ {
+ SwNumFmt aFmt;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
+ // <--
+ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+ aFmt.SetCharFmt( pNumCFmt );
+ aFmt.SetStart( 1 );
+ aFmt.SetIncludeUpperLevels( 1 );
+ aFmt.SetSuffix( aDotStr );
+
+ static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
+ {
+// cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
+ 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
+ };
+#ifdef USE_MEASUREMENT
+ static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
+ {
+ 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
+ };
+ const sal_uInt16* pArr = MEASURE_METRIC ==
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
+ ? aAbsSpace
+ : aAbsSpaceInch;
+#else
+ const sal_uInt16* pArr = aAbsSpace;
+#endif
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( - (*pArr) );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ aFmt.SetFirstLineIndent( - (*pArr) );
+ }
+ // <--
+ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+ {
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetAbsLSpace( *pArr );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetListtabPos( *pArr );
+ aFmt.SetIndentAt( *pArr );
+ }
+ // <--
+ pNewRule->Set( n, aFmt );
+ }
+ }
+ break;
+
+ case RES_POOLNUMRULE_NUM2:
+ {
+ static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
+ {
+ 283, 283, 567, 709, // 0.50, 0.50, 1.00, 1.25
+ 850, 1021, 1304, 1474, // 1.50, 1.80, 2.30, 2.60
+ 1588, 1758 // 2.80, 3.10
+ };
+
+#ifdef USE_MEASUREMENT
+ static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
+ {
+ 385, 385, 770, 963,
+ 1155, 1386, 1771, 2002,
+ 2156, 2387
+ };
+
+ const sal_uInt16* pArr = MEASURE_METRIC ==
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
+ ? aAbsSpace
+ : aAbsSpaceInch;
+#else
+ const sal_uInt16* pArr = aAbsSpace;
+#endif
+ SwNumFmt aFmt;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
+ // <--
+ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+ aFmt.SetCharFmt( pNumCFmt );
+ aFmt.SetIncludeUpperLevels( 1 );
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ }
+ // <--
+ sal_uInt16 nSpace = 0;
+ for( n = 0; n < MAXLEVEL; ++n )
+ {
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetAbsLSpace( nSpace = nSpace + pArr[ n ] );
+ aFmt.SetFirstLineOffset( - pArr[ n ] );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetListtabPos( nSpace = nSpace + pArr[ n ] );
+ aFmt.SetIndentAt( nSpace );
+ aFmt.SetFirstLineIndent( - pArr[ n ] );
+ }
+ // <--
+ aFmt.SetStart( n+1 );
+ pNewRule->Set( n, aFmt );
+ }
+ }
+ break;
+ case RES_POOLNUMRULE_NUM3:
+ {
+ SwNumFmt aFmt;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
+ // <--
+ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+ aFmt.SetCharFmt( pNumCFmt );
+ aFmt.SetIncludeUpperLevels( 1 );
+
+ sal_uInt16 nOffs = GetMetricVal( CM_1 ) * 3;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( - nOffs );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ aFmt.SetFirstLineIndent( - nOffs );
+ }
+ // <--
+
+ for( n = 0; n < MAXLEVEL; ++n )
+ {
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetAbsLSpace( (n+1) * nOffs );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetListtabPos( (n+1) * nOffs );
+ aFmt.SetIndentAt( (n+1) * nOffs );
+ }
+ // <--
+ aFmt.SetStart( n+1 );
+ pNewRule->Set( n, aFmt );
+ }
+ }
+ break;
+ case RES_POOLNUMRULE_NUM4:
+ {
+ SwNumFmt aFmt;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
+ // <--
+ aFmt.SetNumberingType(SVX_NUM_ROMAN_UPPER);
+ aFmt.SetCharFmt( pNumCFmt );
+ aFmt.SetIncludeUpperLevels( 1 );
+ aFmt.SetSuffix( aDotStr );
+
+ static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
+ {
+// cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
+ 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
+ };
+#ifdef USE_MEASUREMENT
+ static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
+ {
+ 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
+ };
+ const sal_uInt16* pArr = MEASURE_METRIC ==
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
+ ? aAbsSpace
+ : aAbsSpaceInch;
+#else
+ const sal_uInt16* pArr = aAbsSpace;
+#endif
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( - (*pArr) );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
+ aFmt.SetFirstLineIndent( - (*pArr) );
+ }
+ // <--
+ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+ {
+ aFmt.SetStart( n + 1 );
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetAbsLSpace( *pArr );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetListtabPos( *pArr );
+ aFmt.SetIndentAt( *pArr );
+ }
+ // <--
+ pNewRule->Set( n, aFmt );
+ }
+ }
+ break;
+ case RES_POOLNUMRULE_NUM5:
+ {
+ // [ First, LSpace ]
+ static const sal_uInt16 aAbsSpace0to2[] =
+ {
+ 227, 227, // 0.40, 0.40,
+ 369, 624, // 0.65, 1.10,
+ 255, 879 // 0.45, 1.55
+ };
+
+#ifdef USE_MEASUREMENT
+ static const sal_uInt16 aAbsSpaceInch0to2[] =
+ {
+ 308, 308,
+ 501, 847,
+ 347, 1194
+ };
+ const sal_uInt16* pArr0to2 = MEASURE_METRIC ==
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
+ ? aAbsSpace0to2
+ : aAbsSpaceInch0to2;
+#else
+ const sal_uInt16* pArr0to2 = aAbsSpace0to2;
+#endif
+ SwNumFmt aFmt;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
+ // <--
+ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+ aFmt.SetStart( 1 );
+ aFmt.SetIncludeUpperLevels( 1 );
+ aFmt.SetSuffix( aDotStr );
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ }
+ // <--
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( -pArr0to2[0] ); // == 0.40 cm
+ aFmt.SetAbsLSpace( pArr0to2[1] ); // == 0.40 cm
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetFirstLineIndent( -pArr0to2[0] );
+ aFmt.SetListtabPos( pArr0to2[1] );
+ aFmt.SetIndentAt( pArr0to2[1] );
+ }
+ // <--
+
+ aFmt.SetCharFmt( pNumCFmt );
+ pNewRule->Set( 0, aFmt );
+
+ aFmt.SetIncludeUpperLevels( 2 );
+ aFmt.SetStart( 2 );
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( -pArr0to2[2] ); // == 0.65 cm
+ aFmt.SetAbsLSpace( pArr0to2[3] ); // == 1.10 cm
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetFirstLineIndent( -pArr0to2[2] );
+ aFmt.SetListtabPos( pArr0to2[3] );
+ aFmt.SetIndentAt( pArr0to2[3] );
+ }
+ // <--
+ pNewRule->Set( 1, aFmt );
+
+ aFmt.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER);
+ aFmt.SetSuffix( ')');
+ aFmt.SetIncludeUpperLevels( 1 );
+ aFmt.SetStart( 3 );
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( - pArr0to2[4] ); // == 0.45cm
+ aFmt.SetAbsLSpace( pArr0to2[5] ); // == 1.55 cm
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetFirstLineIndent( -pArr0to2[4] );
+ aFmt.SetListtabPos( pArr0to2[5] );
+ aFmt.SetIndentAt( pArr0to2[5] );
+ }
+ // <--
+ pNewRule->Set( 2, aFmt );
+
+
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ aFmt.SetCharFmt( pBullCFmt );
+ // --> OD 2006-06-29 #6440955#
+ aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
+ // <--
+ aFmt.SetBulletChar( cBulletChar );
+ sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4,
+ nOffs2 = GetMetricVal( CM_1 ) * 2;
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( - nOffs );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetFirstLineIndent( - nOffs );
+ }
+ // <--
+ aFmt.SetSuffix( aEmptyStr );
+ for( n = 3; n < MAXLEVEL; ++n )
+ {
+ aFmt.SetStart( n+1 );
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetAbsLSpace( nOffs2 + ((n-3) * nOffs) );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetListtabPos( nOffs2 + ((n-3) * nOffs) );
+ aFmt.SetIndentAt( nOffs2 + ((n-3) * nOffs) );
+ }
+ // <--
+ pNewRule->Set( n, aFmt );
+ }
+ }
+ break;
+
+ case RES_POOLNUMRULE_BUL1:
+ {
+ SwNumFmt aFmt;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
+ // <--
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ aFmt.SetCharFmt( pBullCFmt );
+ aFmt.SetStart( 1 );
+ aFmt.SetIncludeUpperLevels( 1 );
+ // --> OD 2006-06-29 #6440955#
+ aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
+ // <--
+ aFmt.SetBulletChar( cBulletChar );
+
+ static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
+ {
+// cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
+ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+ };
+#ifdef USE_MEASUREMENT
+ static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
+ {
+ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+ };
+ const sal_uInt16* pArr = MEASURE_METRIC ==
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
+ ? aAbsSpace
+ : aAbsSpaceInch;
+#else
+ const sal_uInt16* pArr = aAbsSpace;
+#endif
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( - (*pArr) );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ aFmt.SetFirstLineIndent( - (*pArr) );
+ }
+ // <--
+ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+ {
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetAbsLSpace( *pArr );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetListtabPos( *pArr );
+ aFmt.SetIndentAt( *pArr );
+ }
+ // <--
+ pNewRule->Set( n, aFmt );
+ }
+ }
+ break;
+ case RES_POOLNUMRULE_BUL2:
+ {
+ SwNumFmt aFmt;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
+ // <--
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ aFmt.SetCharFmt( pBullCFmt );
+ aFmt.SetStart( 1 );
+ aFmt.SetIncludeUpperLevels( 1 );
+ // --> OD 2006-06-29 #6440955#
+ aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
+ // <--
+ aFmt.SetBulletChar( 0x2013 );
+
+ static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
+ {
+// cm: 0,3 0,6 0,9 1,2 1,5 1,8 2,1 2,4 2,7 3,0
+ 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
+ };
+#ifdef USE_MEASUREMENT
+ static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
+ {
+ 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
+ };
+ const sal_uInt16* pArr = MEASURE_METRIC ==
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
+ ? aAbsSpace
+ : aAbsSpaceInch;
+#else
+ const sal_uInt16* pArr = aAbsSpace;
+#endif
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( - (*pArr) );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ aFmt.SetFirstLineIndent( - (*pArr) );
+ }
+ // <--
+ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+ {
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetAbsLSpace( *pArr );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetListtabPos( *pArr );
+ aFmt.SetIndentAt( *pArr );
+ }
+ // <--
+ pNewRule->Set( n, aFmt );
+ }
+ }
+ break;
+ case RES_POOLNUMRULE_BUL3:
+ {
+ SwNumFmt aFmt;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
+ // <--
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ aFmt.SetCharFmt( pBullCFmt );
+ aFmt.SetStart( 1 );
+ aFmt.SetIncludeUpperLevels( 1 );
+ // --> OD 2006-06-29 #6440955#
+ aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
+ // <--
+
+ sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( - nOffs );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ aFmt.SetFirstLineIndent( - nOffs );
+ }
+ // <--
+
+ for( n = 0; n < MAXLEVEL; ++n )
+ {
+ aFmt.SetBulletChar( ( n & 1 ? 0x25a1 : 0x2611 ) );
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetAbsLSpace( ((n & 1) +1) * nOffs );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetListtabPos( ((n & 1) +1) * nOffs );
+ aFmt.SetIndentAt( ((n & 1) +1) * nOffs );
+ }
+ // <--
+ pNewRule->Set( n, aFmt );
+ }
+ }
+ break;
+ case RES_POOLNUMRULE_BUL4:
+ {
+ SwNumFmt aFmt;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
+ // <--
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ aFmt.SetCharFmt( pBullCFmt );
+ aFmt.SetStart( 1 );
+ aFmt.SetIncludeUpperLevels( 1 );
+ // --> OD 2006-06-29 #6440955#
+ aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
+ // <--
+
+ static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
+ {
+// cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
+ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+ };
+#ifdef USE_MEASUREMENT
+ static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
+ {
+ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+ };
+ const sal_uInt16* pArr = MEASURE_METRIC ==
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
+ ? aAbsSpace
+ : aAbsSpaceInch;
+#else
+ const sal_uInt16* pArr = aAbsSpace;
+#endif
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( - (*pArr) );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
+ aFmt.SetFirstLineIndent( - (*pArr) );
+ }
+ // <--
+ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+ {
+ switch( n )
+ {
+ case 0: aFmt.SetBulletChar( 0x27a2 ); break;
+ case 1: aFmt.SetBulletChar( 0xE006 ); break;
+ default: aFmt.SetBulletChar( 0xE004 ); break;
+ }
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetAbsLSpace( *pArr );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetListtabPos( *pArr );
+ aFmt.SetIndentAt( *pArr );
+ }
+ // <--
+ pNewRule->Set( n, aFmt );
+ }
+ }
+ break;
+ case RES_POOLNUMRULE_BUL5:
+ {
+ SwNumFmt aFmt;
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
+ // <--
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ aFmt.SetCharFmt( pBullCFmt );
+ aFmt.SetStart( 1 );
+ aFmt.SetIncludeUpperLevels( 1 );
+ aFmt.SetBulletChar( 0x2717 );
+ // --> OD 2006-06-29 #6440955#
+ aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
+ // <--
+
+ static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
+ {
+// cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
+ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+ };
+#ifdef USE_MEASUREMENT
+ static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
+ {
+ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+ };
+ const sal_uInt16* pArr = MEASURE_METRIC ==
+ SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
+ ? aAbsSpace
+ : aAbsSpaceInch;
+#else
+ const sal_uInt16* pArr = aAbsSpace;
+#endif
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetFirstLineOffset( - (*pArr) );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ aFmt.SetFirstLineIndent( - (*pArr) );
+ }
+ // <--
+ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+ {
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aFmt.SetAbsLSpace( *pArr );
+ }
+ else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aFmt.SetListtabPos( *pArr );
+ aFmt.SetIndentAt( *pArr );
+ }
+ // <--
+ pNewRule->Set( n, aFmt );
+ }
+ }
+ break;
+ }
+
+ return pNewRule;
+}
+
+
+
+ // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
+ // benutzt wird
+bool SwDoc::IsPoolPageDescUsed( sal_uInt16 nId ) const
+{
+ ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
+ "Falsche AutoFormat-Id" );
+ SwPageDesc *pNewPgDsc = 0;
+ sal_Bool bFnd = sal_False;
+ for( sal_uInt16 n = 0; !bFnd && n < aPageDescs.Count(); ++n )
+ {
+ pNewPgDsc = aPageDescs[ n ];
+ if( nId == pNewPgDsc->GetPoolFmtId() )
+ bFnd = sal_True;
+ }
+
+ // nicht gefunden oder keine Abhaengigen ?
+ if( !bFnd || !pNewPgDsc->GetDepends() ) // ??????
+ return sal_False;
+
+ // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
+ // (auch indirekte fuer Format-Ableitung! )
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
+ return !pNewPgDsc->GetInfo( aGetHt );
+}
+
+// erfrage ob die Absatz-/Zeichen-/Rahmen-/Seiten - Vorlage benutzt wird
+sal_Bool SwDoc::IsUsed( const SwModify& rModify ) const
+{
+ // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
+ // (auch indirekte fuer Format-Ableitung! )
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
+ return !rModify.GetInfo( aGetHt );
+}
+
+// erfrage ob die NumRule benutzt wird
+sal_Bool SwDoc::IsUsed( const SwNumRule& rRule ) const
+{
+ // --> OD 2008-03-04 #refactorlists#
+// // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
+// // (auch indirekte fuer Format-Ableitung! )
+// sal_Bool bUsed = sal_False;
+// SwAutoFmtGetDocNode aGetHt( &aNodes );
+// SwModify* pMod;
+// const SfxPoolItem* pItem;
+// sal_uInt16 i, nMaxItems = GetAttrPool().GetItemCount( RES_PARATR_NUMRULE);
+// for( i = 0; i < nMaxItems; ++i )
+// {
+// if( 0 != (pItem = GetAttrPool().GetItem( RES_PARATR_NUMRULE, i ) ) &&
+// 0 != ( pMod = (SwModify*)((SwNumRuleItem*)pItem)->GetDefinedIn()) &&
+// ((SwNumRuleItem*)pItem)->GetValue().Len() &&
+// ((SwNumRuleItem*)pItem)->GetValue() == rRule.GetName() )
+// {
+// if( pMod->IsA( TYPE( SwFmt )) )
+// {
+// bUsed = !pMod->GetInfo( aGetHt );
+// if( bUsed )
+// break;
+// }
+// else if( ((SwTxtNode*)pMod)->GetNodes().IsDocNodes() )
+// {
+// bUsed = sal_True;
+// break;
+// }
+// }
+// }
+
+// return bUsed;
+ sal_Bool bUsed = rRule.GetTxtNodeListSize() > 0 ||
+ rRule.GetParagraphStyleListSize() > 0;
+
+ return bUsed;
+ // <--
+}
+
+ // Suche die Position vom Vorlagen-Namen. Ist nicht vorhanden
+ // dann fuege neu ein
+sal_uInt16 SwDoc::SetDocPattern( const String& rPatternName )
+{
+ ASSERT( rPatternName.Len(), "kein Dokument-Vorlagenname" );
+
+ sal_uInt16 nNewPos = aPatternNms.Count();
+ for( sal_uInt16 n = 0; n < aPatternNms.Count(); ++n )
+ if( !aPatternNms[n] )
+ {
+ if( nNewPos == aPatternNms.Count() )
+ nNewPos = n;
+ }
+ else if( rPatternName == *aPatternNms[n] )
+ return n;
+
+ if( nNewPos < aPatternNms.Count() )
+ aPatternNms.Remove( nNewPos ); // Platz wieder frei machen
+
+ String* pNewNm = new String( rPatternName );
+ aPatternNms.Insert( pNewNm, nNewPos );
+ SetModified();
+ return nNewPos;
+}
+
+sal_uInt16 GetPoolParent( sal_uInt16 nId )
+{
+ sal_uInt16 nRet = USHRT_MAX;
+ if( POOLGRP_NOCOLLID & nId ) // 1 == Formate / 0 == Collections
+ {
+ switch( ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID ) & nId )
+ {
+ case POOLGRP_CHARFMT:
+ case POOLGRP_FRAMEFMT:
+ nRet = 0; // vom default abgeleitet
+ break;
+ case POOLGRP_PAGEDESC:
+ case POOLGRP_NUMRULE:
+ break; // es gibt keine Ableitung
+ }
+ }
+ else
+ {
+ switch( COLL_GET_RANGE_BITS & nId )
+ {
+ case COLL_TEXT_BITS:
+ switch( nId )
+ {
+ case RES_POOLCOLL_STANDARD:
+ nRet = 0; break;
+ case RES_POOLCOLL_TEXT_IDENT:
+ case RES_POOLCOLL_TEXT_NEGIDENT:
+ case RES_POOLCOLL_TEXT_MOVE:
+ case RES_POOLCOLL_CONFRONTATION:
+ case RES_POOLCOLL_MARGINAL:
+ nRet = RES_POOLCOLL_TEXT; break;
+
+ case RES_POOLCOLL_TEXT:
+ case RES_POOLCOLL_GREETING:
+ case RES_POOLCOLL_SIGNATURE:
+ case RES_POOLCOLL_HEADLINE_BASE:
+ nRet = RES_POOLCOLL_STANDARD; 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:
+ case RES_POOLCOLL_HEADLINE10:
+ nRet = RES_POOLCOLL_HEADLINE_BASE; break;
+ }
+ break;
+
+ case COLL_LISTS_BITS:
+ switch( nId )
+ {
+ case RES_POOLCOLL_NUMBUL_BASE:
+ nRet = RES_POOLCOLL_TEXT; break;
+
+ default:
+ nRet = RES_POOLCOLL_NUMBUL_BASE; break;
+ }
+ break;
+
+ case COLL_EXTRA_BITS:
+ switch( nId )
+ {
+ case RES_POOLCOLL_FRAME:
+ nRet = RES_POOLCOLL_TEXT; break;
+
+ case RES_POOLCOLL_TABLE_HDLN:
+ nRet = RES_POOLCOLL_TABLE; break;
+
+ case RES_POOLCOLL_TABLE:
+ case RES_POOLCOLL_FOOTNOTE:
+ case RES_POOLCOLL_ENDNOTE:
+ case RES_POOLCOLL_JAKETADRESS:
+ case RES_POOLCOLL_SENDADRESS:
+ case RES_POOLCOLL_HEADER:
+ case RES_POOLCOLL_HEADERL:
+ case RES_POOLCOLL_HEADERR:
+ case RES_POOLCOLL_FOOTER:
+ case RES_POOLCOLL_FOOTERL:
+ case RES_POOLCOLL_FOOTERR:
+ case RES_POOLCOLL_LABEL:
+ nRet = RES_POOLCOLL_STANDARD; break;
+
+ case RES_POOLCOLL_LABEL_ABB:
+ case RES_POOLCOLL_LABEL_TABLE:
+ case RES_POOLCOLL_LABEL_FRAME:
+ case RES_POOLCOLL_LABEL_DRAWING:
+ nRet = RES_POOLCOLL_LABEL; break;
+ }
+ break;
+
+ case COLL_REGISTER_BITS:
+ switch( nId )
+ {
+ case RES_POOLCOLL_REGISTER_BASE:
+ nRet = RES_POOLCOLL_STANDARD; break;
+
+ case RES_POOLCOLL_TOX_USERH:
+ case RES_POOLCOLL_TOX_CNTNTH:
+ case RES_POOLCOLL_TOX_IDXH:
+ case RES_POOLCOLL_TOX_ILLUSH:
+ case RES_POOLCOLL_TOX_OBJECTH:
+ case RES_POOLCOLL_TOX_TABLESH:
+ case RES_POOLCOLL_TOX_AUTHORITIESH:
+ nRet = RES_POOLCOLL_HEADLINE_BASE; break;
+
+ default:
+ nRet = RES_POOLCOLL_REGISTER_BASE; break;
+ }
+ break;
+
+ case COLL_DOC_BITS:
+ nRet = RES_POOLCOLL_HEADLINE_BASE;
+ break;
+
+ case COLL_HTML_BITS:
+ nRet = RES_POOLCOLL_STANDARD;
+ break;
+ }
+ }
+
+ return nRet;
+}
+
+void SwDoc::RemoveAllFmtLanguageDependencies()
+{
+ /* #106748# Restore the language independ pool defaults and styles. */
+ GetAttrPool().ResetPoolDefaultItem( RES_PARATR_ADJUST );
+
+ SwTxtFmtColl * pTxtFmtColl = GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
+
+ pTxtFmtColl->ResetFmtAttr( RES_PARATR_ADJUST );
+ /* #111214# koreans do not like SvxScriptItem(sal_True) */
+ pTxtFmtColl->ResetFmtAttr( RES_PARATR_SCRIPTSPACE );
+
+ SvxFrameDirectionItem aFrameDir( FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR );
+
+ sal_uInt16 nCount = GetPageDescCnt();
+ for( sal_uInt16 i=0; i<nCount; ++i )
+ {
+ SwPageDesc& rDesc = _GetPageDesc( i );
+ rDesc.GetMaster().SetFmtAttr( aFrameDir );
+ rDesc.GetLeft().SetFmtAttr( aFrameDir );
+ }
+
+ // OD 09.10.2003 #i18732# - restore static pool default for item
+ // RES_FOLLOW_TEXT_FLOW.
+ GetAttrPool().ResetPoolDefaultItem( RES_FOLLOW_TEXT_FLOW );
+
+ //#i16874# AutoKerning as default for new documents
+ GetAttrPool().ResetPoolDefaultItem( RES_CHRATR_AUTOKERN );
+}
diff --git a/sw/source/core/doc/sortopt.cxx b/sw/source/core/doc/sortopt.cxx
new file mode 100644
index 000000000000..e845ec6f6897
--- /dev/null
+++ b/sw/source/core/doc/sortopt.cxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <tools/debug.hxx>
+#include <i18npool/lang.h>
+#include <sortopt.hxx>
+
+
+SV_IMPL_PTRARR(SwSortKeys, SwSortKey*)
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sortier-Schluessel
+ --------------------------------------------------------------------*/
+
+SwSortKey::SwSortKey() :
+ eSortOrder( SRT_ASCENDING ),
+ nColumnId( 0 ),
+ bIsNumeric( sal_True )
+{
+}
+
+SwSortKey::SwSortKey(sal_uInt16 nId, const String& rSrtType, SwSortOrder eOrder) :
+ sSortType( rSrtType ),
+ eSortOrder( eOrder ),
+ nColumnId( nId ),
+ bIsNumeric( 0 == rSrtType.Len() )
+{
+}
+
+
+SwSortKey::SwSortKey(const SwSortKey& rOld) :
+ sSortType( rOld.sSortType ),
+ eSortOrder( rOld.eSortOrder ),
+ nColumnId( rOld.nColumnId ),
+ bIsNumeric( rOld.bIsNumeric )
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sortieroptionen fuers Sortieren
+ --------------------------------------------------------------------*/
+
+
+SwSortOptions::SwSortOptions()
+ : eDirection( SRT_ROWS ),
+ cDeli( 9 ),
+ nLanguage( LANGUAGE_SYSTEM ),
+ bTable( sal_False ),
+ bIgnoreCase( sal_False )
+{
+}
+
+
+SwSortOptions::SwSortOptions(const SwSortOptions& rOpt) :
+ eDirection( rOpt.eDirection ),
+ cDeli( rOpt.cDeli ),
+ nLanguage( rOpt.nLanguage ),
+ bTable( rOpt.bTable ),
+ bIgnoreCase( rOpt.bIgnoreCase )
+{
+ for( sal_uInt16 i=0; i < rOpt.aKeys.Count(); ++i )
+ {
+ SwSortKey* pNew = new SwSortKey(*rOpt.aKeys[i]);
+ aKeys.C40_INSERT( SwSortKey, pNew, aKeys.Count());
+ }
+}
+
+
+SwSortOptions::~SwSortOptions()
+{
+ aKeys.DeleteAndDestroy(0, aKeys.Count());
+}
+
+
+
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
new file mode 100644
index 000000000000..d53ac908f0c1
--- /dev/null
+++ b/sw/source/core/doc/swserv.cxx
@@ -0,0 +1,371 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sot/storage.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <doc.hxx>
+#include <swtypes.hxx>
+#include <swserv.hxx>
+#include <swbaslnk.hxx>
+#include <mvsave.hxx>
+#include <IMark.hxx>
+#include <bookmrk.hxx>
+#include <pam.hxx>
+#include <shellio.hxx>
+#ifndef _SWERROR_H
+#include <swerror.h>
+#endif
+
+using namespace ::com::sun::star;
+
+SV_IMPL_REF( SwServerObject )
+
+SwServerObject::~SwServerObject()
+{
+}
+
+
+sal_Bool SwServerObject::GetData( uno::Any & rData,
+ const String & rMimeType, sal_Bool )
+{
+ sal_Bool bRet = sal_False;
+ WriterRef xWrt;
+ switch( SotExchange::GetFormatIdFromMimeType( rMimeType ) )
+ {
+ case FORMAT_STRING:
+ ::GetASCWriter( aEmptyStr, String(), xWrt );
+ break;
+
+ case FORMAT_RTF:
+ // mba: no BaseURL for data exchange
+ ::GetRTFWriter( aEmptyStr, String(), xWrt );
+ break;
+ }
+
+ if( xWrt.Is() )
+ {
+ SwPaM* pPam = 0;
+ switch( eType )
+ {
+ case BOOKMARK_SERVER:
+ if( CNTNT_TYPE.pBkmk->IsExpanded() )
+ {
+ // Bereich aufspannen
+ pPam = new SwPaM( CNTNT_TYPE.pBkmk->GetMarkPos(),
+ CNTNT_TYPE.pBkmk->GetOtherMarkPos() );
+ }
+ break;
+
+ case TABLE_SERVER:
+ pPam = new SwPaM( *CNTNT_TYPE.pTblNd,
+ *CNTNT_TYPE.pTblNd->EndOfSectionNode() );
+ break;
+
+ case SECTION_SERVER:
+ pPam = new SwPaM( SwPosition( *CNTNT_TYPE.pSectNd ) );
+ pPam->Move( fnMoveForward );
+ pPam->SetMark();
+ pPam->GetPoint()->nNode = *CNTNT_TYPE.pSectNd->EndOfSectionNode();
+ pPam->Move( fnMoveBackward );
+ break;
+ case NONE_SERVER: break;
+ }
+
+ if( pPam )
+ {
+ // Stream anlegen
+ SvMemoryStream aMemStm( 65535, 65535 );
+ SwWriter aWrt( aMemStm, *pPam, sal_False );
+ if( !IsError( aWrt.Write( xWrt )) )
+ {
+ aMemStm << '\0'; // append a zero char
+ rData <<= uno::Sequence< sal_Int8 >(
+ (sal_Int8*)aMemStm.GetData(),
+ aMemStm.Seek( STREAM_SEEK_TO_END ) );
+ bRet = sal_True;
+ }
+
+ delete pPam;
+ }
+ }
+ return bRet;
+}
+
+
+sal_Bool SwServerObject::SetData( const String & ,
+ const uno::Any& )
+{
+ // set new data into the "server" -> at first nothing to do
+ return sal_False;
+}
+
+
+void SwServerObject::SendDataChanged( const SwPosition& rPos )
+{
+ // ist an unseren Aenderungen jemand interessiert ?
+ if( HasDataLinks() )
+ {
+ int bCall = sal_False;
+ const SwStartNode* pNd = 0;
+ switch( eType )
+ {
+ case BOOKMARK_SERVER:
+ if( CNTNT_TYPE.pBkmk->IsExpanded() )
+ {
+ bCall = CNTNT_TYPE.pBkmk->GetMarkStart() <= rPos
+ && rPos < CNTNT_TYPE.pBkmk->GetMarkEnd();
+ }
+ break;
+
+ case TABLE_SERVER: pNd = CNTNT_TYPE.pTblNd; break;
+ case SECTION_SERVER: pNd = CNTNT_TYPE.pSectNd; break;
+ case NONE_SERVER: break;
+ }
+ if( pNd )
+ {
+ sal_uLong nNd = rPos.nNode.GetIndex();
+ bCall = pNd->GetIndex() < nNd && nNd < pNd->EndOfSectionIndex();
+ }
+
+ if( bCall )
+ {
+ // Recursionen erkennen und flaggen
+ IsLinkInServer( 0 );
+ SvLinkSource::NotifyDataChanged();
+ }
+ }
+ // sonst melden wir uns ab !!
+// ????? JP 27.06.95: geht das so ????
+// else
+// Closed();
+}
+
+
+void SwServerObject::SendDataChanged( const SwPaM& rRange )
+{
+ // ist an unseren Aenderungen jemand interessiert ?
+ if( HasDataLinks() )
+ {
+ int bCall = sal_False;
+ const SwStartNode* pNd = 0;
+ const SwPosition* pStt = rRange.Start(), *pEnd = rRange.End();
+ switch( eType )
+ {
+ case BOOKMARK_SERVER:
+ if(CNTNT_TYPE.pBkmk->IsExpanded())
+ {
+ bCall = *pStt <= CNTNT_TYPE.pBkmk->GetMarkEnd()
+ && *pEnd > CNTNT_TYPE.pBkmk->GetMarkStart();
+ }
+ break;
+
+ case TABLE_SERVER: pNd = CNTNT_TYPE.pTblNd; break;
+ case SECTION_SERVER: pNd = CNTNT_TYPE.pSectNd; break;
+ case NONE_SERVER: break;
+ }
+ if( pNd )
+ {
+ // liegt der Start-Bereich im Node Bereich ?
+ bCall = pStt->nNode.GetIndex() < pNd->EndOfSectionIndex() &&
+ pEnd->nNode.GetIndex() >= pNd->GetIndex();
+ }
+
+ if( bCall )
+ {
+ // Recursionen erkennen und flaggen
+ IsLinkInServer( 0 );
+ SvLinkSource::NotifyDataChanged();
+ }
+ }
+ // sonst melden wir uns ab !!
+// ????? JP 27.06.95: geht das so ????
+// else
+// Closed();
+}
+
+
+sal_Bool SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const
+{
+ sal_uLong nSttNd = 0, nEndNd = 0;
+ xub_StrLen nStt = 0;
+ xub_StrLen nEnd = 0;
+ const SwNode* pNd = 0;
+ const SwNodes* pNds = 0;
+
+ switch( eType )
+ {
+ case BOOKMARK_SERVER:
+ if( CNTNT_TYPE.pBkmk->IsExpanded() )
+ {
+ const SwPosition* pStt = &CNTNT_TYPE.pBkmk->GetMarkStart(),
+ * pEnd = &CNTNT_TYPE.pBkmk->GetMarkEnd();
+
+ nSttNd = pStt->nNode.GetIndex();
+ nStt = pStt->nContent.GetIndex();
+ nEndNd = pEnd->nNode.GetIndex();
+ nEnd = pEnd->nContent.GetIndex();
+ pNds = &pStt->nNode.GetNodes();
+ }
+ break;
+
+ case TABLE_SERVER: pNd = CNTNT_TYPE.pTblNd; break;
+ case SECTION_SERVER: pNd = CNTNT_TYPE.pSectNd; break;
+
+ case SECTION_SERVER+1:
+ return sal_True;
+ }
+
+ if( pNd )
+ {
+ nSttNd = pNd->GetIndex();
+ nEndNd = pNd->EndOfSectionIndex();
+ nStt = 0, nEnd = USHRT_MAX;
+ pNds = &pNd->GetNodes();
+ }
+
+ if( nSttNd && nEndNd )
+ {
+ // LinkManager besorgen:
+ const ::sfx2::SvBaseLinks& rLnks = pNds->GetDoc()->GetLinkManager().GetLinks();
+
+// um Rekursionen zu Verhindern: ServerType umsetzen!
+SwServerObject::ServerModes eSave = eType;
+if( !pChkLnk )
+// sowas sollte man nicht tun, wer weiss schon, wie gross ein enum ist
+// ICC nimmt keinen int
+// #41723#
+// *((int*)&eType) = SECTION_SERVER+1;
+ ((SwServerObject*)this)->eType = NONE_SERVER;
+ for( sal_uInt16 n = rLnks.Count(); n; )
+ {
+ const ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
+ if( pLnk && OBJECT_CLIENT_GRF != pLnk->GetObjType() &&
+ pLnk->ISA( SwBaseLink ) &&
+ !((SwBaseLink*)pLnk)->IsNoDataFlag() &&
+ ((SwBaseLink*)pLnk)->IsInRange( nSttNd, nEndNd, nStt, nEnd ))
+ {
+ if( pChkLnk )
+ {
+ if( pLnk == pChkLnk ||
+ ((SwBaseLink*)pLnk)->IsRecursion( pChkLnk ) )
+ return sal_True;
+ }
+ else if( ((SwBaseLink*)pLnk)->IsRecursion( (SwBaseLink*)pLnk ) )
+ ((SwBaseLink*)pLnk)->SetNoDataFlag();
+ }
+ }
+if( !pChkLnk )
+ // *((int*)&eType) = eSave;
+ ((SwServerObject*)this)->eType = eSave;
+ }
+
+ return sal_False;
+}
+
+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)
+ {
+ CNTNT_TYPE.pBkmk = 0, eType = NONE_SERVER;
+ pDdeBookmark->SetRefObject(NULL);
+ }
+ }
+}
+
+void SwServerObject::SetDdeBookmark( ::sw::mark::IMark& rBookmark)
+{
+ ::sw::mark::DdeBookmark* const pDdeBookmark = dynamic_cast< ::sw::mark::DdeBookmark* >(&rBookmark);
+ if(pDdeBookmark)
+ {
+ eType = BOOKMARK_SERVER;
+ CNTNT_TYPE.pBkmk = &rBookmark;
+ pDdeBookmark->SetRefObject(this);
+ }
+ else
+ OSL_ENSURE(false,
+ "SwServerObject::SetNoServer(..)"
+ " - setting an bookmark that is not DDE-capable");
+}
+
+/* */
+
+
+SwDataChanged::SwDataChanged( const SwPaM& rPam, sal_uInt16 nTyp )
+ : pPam( &rPam ), pPos( 0 ), pDoc( rPam.GetDoc() ), nType( nTyp )
+{
+ nNode = rPam.GetPoint()->nNode.GetIndex();
+ nCntnt = rPam.GetPoint()->nContent.GetIndex();
+}
+
+
+SwDataChanged::SwDataChanged( SwDoc* pDc, const SwPosition& rPos, sal_uInt16 nTyp )
+ : pPam( 0 ), pPos( &rPos ), pDoc( pDc ), nType( nTyp )
+{
+ nNode = rPos.nNode.GetIndex();
+ nCntnt = rPos.nContent.GetIndex();
+}
+
+SwDataChanged::~SwDataChanged()
+{
+ // JP 09.04.96: nur wenn das Layout vorhanden ist ( also waehrend der
+ // Eingabe)
+ if( pDoc->GetCurrentViewShell() ) //swmod 071108//swmod 071225
+ {
+ const ::sfx2::SvLinkSources& rServers = pDoc->GetLinkManager().GetServers();
+
+ for( sal_uInt16 nCnt = rServers.Count(); nCnt; )
+ {
+ ::sfx2::SvLinkSourceRef refObj( rServers[ --nCnt ] );
+ // noch jemand am Object interessiert ?
+ if( refObj->HasDataLinks() && refObj->ISA( SwServerObject ))
+ {
+ SwServerObject& rObj = *(SwServerObject*)&refObj;
+ if( pPos )
+ rObj.SendDataChanged( *pPos );
+ else
+ rObj.SendDataChanged( *pPam );
+ }
+
+ // sollte jetzt gar keine Verbindung mehr bestehen
+ if( !refObj->HasDataLinks() )
+ {
+ // dann raus aus der Liste (Object bleibt aber bestehen!)
+ // falls es noch da ist !!
+ if( nCnt < rServers.Count() && &refObj == rServers[ nCnt ] )
+ pDoc->GetLinkManager().RemoveServer( nCnt, 1 );
+ }
+ }
+ }
+}
diff --git a/sw/source/core/doc/swstylemanager.cxx b/sw/source/core/doc/swstylemanager.cxx
new file mode 100644
index 000000000000..ea8ba9366c75
--- /dev/null
+++ b/sw/source/core/doc/swstylemanager.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "swstylemanager.hxx"
+#include <hash_map>
+#include <svl/stylepool.hxx>
+#include <doc.hxx>
+#include <charfmt.hxx>
+#include <docary.hxx>
+#include <swtypes.hxx>
+#include <istyleaccess.hxx>
+
+typedef ::std::hash_map< const ::rtl::OUString,
+ StylePool::SfxItemSet_Pointer_t,
+ ::rtl::OUStringHash,
+ ::std::equal_to< ::rtl::OUString > > SwStyleNameCache;
+
+class SwStyleCache
+{
+ SwStyleNameCache mMap;
+public:
+ SwStyleCache() {}
+ void addStyleName( StylePool::SfxItemSet_Pointer_t pStyle )
+ { mMap[ StylePool::nameOf(pStyle) ] = pStyle; }
+ void addCompletePool( StylePool& rPool );
+ StylePool::SfxItemSet_Pointer_t getByName( const rtl::OUString& rName ) { return mMap[rName]; }
+};
+
+void SwStyleCache::addCompletePool( StylePool& rPool )
+{
+ IStylePoolIteratorAccess *pIter = rPool.createIterator();
+ StylePool::SfxItemSet_Pointer_t pStyle = pIter->getNext();
+ while( pStyle.get() )
+ {
+ rtl::OUString aName( StylePool::nameOf(pStyle) );
+ mMap[ aName ] = pStyle;
+ pStyle = pIter->getNext();
+ }
+ delete pIter;
+}
+
+class SwStyleManager : public IStyleAccess
+{
+ StylePool aAutoCharPool;
+ StylePool aAutoParaPool;
+ SwStyleCache *mpCharCache;
+ SwStyleCache *mpParaCache;
+
+public:
+ // --> OD 2008-03-07 #refactorlists#
+ // accept empty item set for ignorable paragraph items.
+ SwStyleManager( SfxItemSet* pIgnorableParagraphItems )
+ : aAutoCharPool(),
+ aAutoParaPool( pIgnorableParagraphItems ),
+ mpCharCache(0),
+ mpParaCache(0)
+ {}
+ // <--
+ virtual ~SwStyleManager();
+ virtual StylePool::SfxItemSet_Pointer_t getAutomaticStyle( const SfxItemSet& rSet,
+ IStyleAccess::SwAutoStyleFamily eFamily );
+ virtual StylePool::SfxItemSet_Pointer_t getByName( const rtl::OUString& rName,
+ IStyleAccess::SwAutoStyleFamily eFamily );
+ virtual void getAllStyles( std::vector<StylePool::SfxItemSet_Pointer_t> &rStyles,
+ IStyleAccess::SwAutoStyleFamily eFamily );
+ virtual StylePool::SfxItemSet_Pointer_t cacheAutomaticStyle( const SfxItemSet& rSet,
+ SwAutoStyleFamily eFamily );
+ virtual void clearCaches();
+};
+
+IStyleAccess *createStyleManager( SfxItemSet* pIgnorableParagraphItems )
+{
+ return new SwStyleManager( pIgnorableParagraphItems );
+}
+
+SwStyleManager::~SwStyleManager()
+{
+ delete mpCharCache;
+ delete mpParaCache;
+}
+
+void SwStyleManager::clearCaches()
+{
+ delete mpCharCache;
+ mpCharCache = 0;
+ delete mpParaCache;
+ mpParaCache = 0;
+}
+
+StylePool::SfxItemSet_Pointer_t SwStyleManager::getAutomaticStyle( const SfxItemSet& rSet,
+ IStyleAccess::SwAutoStyleFamily eFamily )
+{
+ StylePool& rAutoPool = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? aAutoCharPool : aAutoParaPool;
+ return rAutoPool.insertItemSet( rSet );
+}
+
+StylePool::SfxItemSet_Pointer_t SwStyleManager::cacheAutomaticStyle( const SfxItemSet& rSet,
+ IStyleAccess::SwAutoStyleFamily eFamily )
+{
+ StylePool& rAutoPool = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? aAutoCharPool : aAutoParaPool;
+ StylePool::SfxItemSet_Pointer_t pStyle = rAutoPool.insertItemSet( rSet );
+ SwStyleCache* &rpCache = eFamily == IStyleAccess::AUTO_STYLE_CHAR ?
+ mpCharCache : mpParaCache;
+ if( !rpCache )
+ rpCache = new SwStyleCache();
+ rpCache->addStyleName( pStyle );
+ return pStyle;
+}
+
+StylePool::SfxItemSet_Pointer_t SwStyleManager::getByName( const rtl::OUString& rName,
+ IStyleAccess::SwAutoStyleFamily eFamily )
+{
+ StylePool& rAutoPool = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? aAutoCharPool : aAutoParaPool;
+ SwStyleCache* &rpCache = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? mpCharCache : mpParaCache;
+ if( !rpCache )
+ rpCache = new SwStyleCache();
+ StylePool::SfxItemSet_Pointer_t pStyle = rpCache->getByName( rName );
+ if( !pStyle.get() )
+ {
+ // Ok, ok, it's allowed to ask for uncached styles (from UNO) but it should not be done
+ // during loading a document
+ ASSERT( false, "Don't ask for uncached styles" );
+ rpCache->addCompletePool( rAutoPool );
+ pStyle = rpCache->getByName( rName );
+ }
+ return pStyle;
+}
+
+void SwStyleManager::getAllStyles( std::vector<StylePool::SfxItemSet_Pointer_t> &rStyles,
+ IStyleAccess::SwAutoStyleFamily eFamily )
+{
+ StylePool& rAutoPool = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? aAutoCharPool : aAutoParaPool;
+ // --> OD 2008-03-07 #refactorlists#
+ // setup <StylePool> iterator, which skips unused styles and ignorable items
+ IStylePoolIteratorAccess *pIter = rAutoPool.createIterator( true, true );
+ // <--
+ StylePool::SfxItemSet_Pointer_t pStyle = pIter->getNext();
+ while( pStyle.get() )
+ {
+ rStyles.push_back( pStyle );
+
+ pStyle = pIter->getNext();
+ }
+ delete pIter;
+}
diff --git a/sw/source/core/doc/swstylemanager.hxx b/sw/source/core/doc/swstylemanager.hxx
new file mode 100644
index 000000000000..4997ce5c0770
--- /dev/null
+++ b/sw/source/core/doc/swstylemanager.hxx
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SWSTYLEMANAGER_HXX
+#define _SWSTYLEMANAGER_HXX
+
+class IStyleAccess;
+// --> OD 2008-03-07 #refactorlists#
+class SfxItemSet;
+// <--
+
+// --> OD 2008-03-07 #refactorlists#
+IStyleAccess *createStyleManager( SfxItemSet* pIgnorableParagraphItems = 0 );
+// <--
+#endif //_SWSTYLEMANAGER_HXX
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
new file mode 100755
index 000000000000..3d4a21584f9a
--- /dev/null
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -0,0 +1,1106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <tools/resid.hxx>
+#include <tools/stream.hxx>
+#include <tools/shl.hxx>
+#include <vcl/svapp.hxx>
+#include <sfx2/docfile.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/app.hxx>
+#include <svx/dialmgr.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+
+#define READ_OLDVERS // erstmal noch alte Versionen lesen
+#include <swtypes.hxx>
+#include <doc.hxx>
+#include <poolfmt.hxx>
+#include <tblafmt.hxx>
+#include <cellatr.hxx>
+#include <SwStyleNameMapper.hxx>
+
+// bis SO5PF
+const sal_uInt16 AUTOFORMAT_ID_X = 9501;
+const sal_uInt16 AUTOFORMAT_ID_358 = 9601;
+const sal_uInt16 AUTOFORMAT_DATA_ID_X = 9502;
+
+// ab SO5
+//! in nachfolgenden Versionen muss der Betrag dieser IDs groesser sein
+const sal_uInt16 AUTOFORMAT_ID_504 = 9801;
+const sal_uInt16 AUTOFORMAT_DATA_ID_504 = 9802;
+
+const sal_uInt16 AUTOFORMAT_ID_552 = 9901;
+const sal_uInt16 AUTOFORMAT_DATA_ID_552 = 9902;
+
+// --- from 641 on: CJK and CTL font settings
+const sal_uInt16 AUTOFORMAT_ID_641 = 10001;
+const sal_uInt16 AUTOFORMAT_DATA_ID_641 = 10002;
+
+// --- from 680/dr14 on: diagonal frame lines
+const sal_uInt16 AUTOFORMAT_ID_680DR14 = 10011;
+const sal_uInt16 AUTOFORMAT_DATA_ID_680DR14 = 10012;
+
+// --- from 680/dr25 on: #21549# store strings as UTF-8
+const sal_uInt16 AUTOFORMAT_ID_680DR25 = 10021;
+const sal_uInt16 AUTOFORMAT_DATA_ID_680DR25 = 10022;
+
+// --- from DEV300/overline2 on: #5991# overline
+const sal_uInt16 AUTOFORMAT_ID_300OVRLN = 10031;
+const sal_uInt16 AUTOFORMAT_DATA_ID_300OVRLN = 10032;
+
+// current version
+const sal_uInt16 AUTOFORMAT_ID = AUTOFORMAT_ID_300OVRLN;
+const sal_uInt16 AUTOFORMAT_DATA_ID = AUTOFORMAT_DATA_ID_300OVRLN;
+
+
+#ifdef READ_OLDVERS
+const sal_uInt16 AUTOFORMAT_OLD_ID = 8201;
+const sal_uInt16 AUTOFORMAT_OLD_ID1 = 8301;
+const sal_uInt16 AUTOFORMAT_OLD_DATA_ID = 8202;
+#endif
+
+
+SwBoxAutoFmt* SwTableAutoFmt::pDfltBoxAutoFmt = 0;
+
+#define sAutoTblFmtName "autotbl.fmt"
+
+// SwTable Auto-Format-Tabelle
+SV_IMPL_PTRARR( _SwTableAutoFmtTbl, SwTableAutoFmt* )
+
+
+// Struct mit Versionsnummern der Items
+
+struct SwAfVersions
+{
+public:
+ sal_uInt16 nFontVersion;
+ sal_uInt16 nFontHeightVersion;
+ sal_uInt16 nWeightVersion;
+ sal_uInt16 nPostureVersion;
+ sal_uInt16 nUnderlineVersion;
+ sal_uInt16 nOverlineVersion;
+ sal_uInt16 nCrossedOutVersion;
+ sal_uInt16 nContourVersion;
+ sal_uInt16 nShadowedVersion;
+ sal_uInt16 nColorVersion;
+ sal_uInt16 nBoxVersion;
+ sal_uInt16 nLineVersion;
+ sal_uInt16 nBrushVersion;
+
+ sal_uInt16 nAdjustVersion;
+
+ sal_uInt16 nHorJustifyVersion;
+ sal_uInt16 nVerJustifyVersion;
+ sal_uInt16 nOrientationVersion;
+ sal_uInt16 nMarginVersion;
+ sal_uInt16 nBoolVersion;
+ sal_uInt16 nInt32Version;
+ sal_uInt16 nRotateModeVersion;
+
+ sal_uInt16 nNumFmtVersion;
+
+ SwAfVersions();
+ void Load( SvStream& rStream, sal_uInt16 nVer );
+};
+
+SwAfVersions::SwAfVersions() :
+ nFontVersion(0),
+ nFontHeightVersion(0),
+ nWeightVersion(0),
+ nPostureVersion(0),
+ nUnderlineVersion(0),
+ nOverlineVersion(0),
+ nCrossedOutVersion(0),
+ nContourVersion(0),
+ nShadowedVersion(0),
+ nColorVersion(0),
+ nBoxVersion(0),
+ nLineVersion(0),
+ nBrushVersion(0),
+ nAdjustVersion(0),
+ nHorJustifyVersion(0),
+ nVerJustifyVersion(0),
+ nOrientationVersion(0),
+ nMarginVersion(0),
+ nBoolVersion(0),
+ nInt32Version(0),
+ nRotateModeVersion(0),
+ nNumFmtVersion(0)
+{
+}
+
+void SwAfVersions::Load( SvStream& rStream, sal_uInt16 nVer )
+{
+ rStream >> nFontVersion;
+ rStream >> nFontHeightVersion;
+ rStream >> nWeightVersion;
+ rStream >> nPostureVersion;
+ rStream >> nUnderlineVersion;
+ if ( nVer >= AUTOFORMAT_ID_300OVRLN )
+ rStream >> nOverlineVersion;
+ rStream >> nCrossedOutVersion;
+ rStream >> nContourVersion;
+ rStream >> nShadowedVersion;
+ rStream >> nColorVersion;
+ rStream >> nBoxVersion;
+ if ( nVer >= AUTOFORMAT_ID_680DR14 )
+ rStream >> nLineVersion;
+ rStream >> nBrushVersion;
+ rStream >> nAdjustVersion;
+ rStream >> nHorJustifyVersion;
+ rStream >> nVerJustifyVersion;
+ rStream >> nOrientationVersion;
+ rStream >> nMarginVersion;
+ rStream >> nBoolVersion;
+ if ( nVer >= AUTOFORMAT_ID_504 )
+ {
+ rStream >> nInt32Version;
+ rStream >> nRotateModeVersion;
+ }
+ rStream >> nNumFmtVersion;
+}
+
+// ---------------------------------------------------------------------------
+
+SwBoxAutoFmt::SwBoxAutoFmt()
+ : aFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_FONT ) ),
+ aHeight( 240, 100, RES_CHRATR_FONTSIZE ),
+ aWeight( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ),
+ aPosture( ITALIC_NONE, RES_CHRATR_POSTURE ),
+
+ aCJKFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CJK_FONT ) ),
+ aCJKHeight( 240, 100, RES_CHRATR_CJK_FONTSIZE ),
+ aCJKWeight( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ),
+ aCJKPosture( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ),
+
+ aCTLFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CTL_FONT ) ),
+ aCTLHeight( 240, 100, RES_CHRATR_CTL_FONTSIZE ),
+ aCTLWeight( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ),
+ aCTLPosture( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ),
+
+ aUnderline( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ),
+ aOverline( UNDERLINE_NONE, RES_CHRATR_OVERLINE ),
+ aCrossedOut( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ),
+ aContour( sal_False, RES_CHRATR_CONTOUR ),
+ aShadowed( sal_False, RES_CHRATR_SHADOWED ),
+ aColor( RES_CHRATR_COLOR ),
+ aBox( RES_BOX ),
+ aTLBR( 0 ),
+ aBLTR( 0 ),
+ aBackground( RES_BACKGROUND ),
+ aAdjust( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ),
+ aHorJustify( SVX_HOR_JUSTIFY_STANDARD, 0),
+ aVerJustify( SVX_VER_JUSTIFY_STANDARD, 0),
+ aStacked( 0 ),
+ aMargin( 0 ),
+ aLinebreak( 0 ),
+ aRotateAngle( 0 ),
+
+// FIXME - add attribute IDs for the diagonal line items
+// aTLBR( RES_... ),
+// aBLTR( RES_... ),
+ aRotateMode( SVX_ROTATE_MODE_STANDARD, 0 )
+{
+ eSysLanguage = eNumFmtLanguage = static_cast<LanguageType>(::GetAppLanguage());
+ aBox.SetDistance( 55 );
+}
+
+
+SwBoxAutoFmt::SwBoxAutoFmt( const SwBoxAutoFmt& rNew )
+ : aFont( rNew.aFont ),
+ aHeight( rNew.aHeight ),
+ aWeight( rNew.aWeight ),
+ aPosture( rNew.aPosture ),
+ aCJKFont( rNew.aCJKFont ),
+ aCJKHeight( rNew.aCJKHeight ),
+ aCJKWeight( rNew.aCJKWeight ),
+ aCJKPosture( rNew.aCJKPosture ),
+ aCTLFont( rNew.aCTLFont ),
+ aCTLHeight( rNew.aCTLHeight ),
+ aCTLWeight( rNew.aCTLWeight ),
+ aCTLPosture( rNew.aCTLPosture ),
+ aUnderline( rNew.aUnderline ),
+ aOverline( rNew.aOverline ),
+ aCrossedOut( rNew.aCrossedOut ),
+ aContour( rNew.aContour ),
+ aShadowed( rNew.aShadowed ),
+ aColor( rNew.aColor ),
+ aBox( rNew.aBox ),
+ aTLBR( rNew.aTLBR ),
+ aBLTR( rNew.aBLTR ),
+ aBackground( rNew.aBackground ),
+ aAdjust( rNew.aAdjust ),
+ aHorJustify( rNew.aHorJustify ),
+ aVerJustify( rNew.aVerJustify ),
+ aStacked( rNew.aStacked ),
+ aMargin( rNew.aMargin ),
+ aLinebreak( rNew.aLinebreak ),
+ aRotateAngle( rNew.aRotateAngle ),
+ aRotateMode( rNew.aRotateMode ),
+ sNumFmtString( rNew.sNumFmtString ),
+ eSysLanguage( rNew.eSysLanguage ),
+ eNumFmtLanguage( rNew.eNumFmtLanguage )
+{
+}
+
+
+SwBoxAutoFmt::~SwBoxAutoFmt()
+{
+}
+
+SwBoxAutoFmt& SwBoxAutoFmt::operator=( const SwBoxAutoFmt& rNew )
+{
+ aFont = rNew.aFont;
+ aHeight = rNew.aHeight;
+ aWeight = rNew.aWeight;
+ aPosture = rNew.aPosture;
+ aCJKFont = rNew.aCJKFont;
+ aCJKHeight = rNew.aCJKHeight;
+ aCJKWeight = rNew.aCJKWeight;
+ aCJKPosture = rNew.aCJKPosture;
+ aCTLFont = rNew.aCTLFont;
+ aCTLHeight = rNew.aCTLHeight;
+ aCTLWeight = rNew.aCTLWeight;
+ aCTLPosture = rNew.aCTLPosture;
+ aUnderline = rNew.aUnderline;
+ aOverline = rNew.aOverline;
+ aCrossedOut = rNew.aCrossedOut;
+ aContour = rNew.aContour;
+ aShadowed = rNew.aShadowed;
+ aColor = rNew.aColor;
+ SetAdjust( rNew.aAdjust );
+ aBox = rNew.aBox;
+ aTLBR = rNew.aTLBR;
+ aBLTR = rNew.aBLTR;
+ aBackground = rNew.aBackground;
+
+ aHorJustify = rNew.aHorJustify;
+ aVerJustify = rNew.aVerJustify;
+ aStacked.SetValue( rNew.aStacked.GetValue() );
+ aMargin = rNew.aMargin;
+ aLinebreak.SetValue( rNew.aLinebreak.GetValue() );
+ aRotateAngle.SetValue( rNew.aRotateAngle.GetValue() );
+ aRotateMode.SetValue( rNew.aRotateMode.GetValue() );
+
+ sNumFmtString = rNew.sNumFmtString;
+ eSysLanguage = rNew.eSysLanguage;
+ eNumFmtLanguage = rNew.eNumFmtLanguage;
+
+ return *this;
+}
+
+
+#define READ( aItem, aItemType, nVers )\
+ pNew = aItem.Create(rStream, nVers ); \
+ aItem = *(aItemType*)pNew; \
+ delete pNew;
+
+sal_Bool SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer )
+{
+ SfxPoolItem* pNew;
+ SvxOrientationItem aOrientation( SVX_ORIENTATION_STANDARD, 0);
+
+ READ( aFont, SvxFontItem , rVersions.nFontVersion)
+
+ if( rStream.GetStreamCharSet() == aFont.GetCharSet() )
+ aFont.SetCharSet(::gsl_getSystemTextEncoding());
+
+ READ( aHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
+ READ( aWeight, SvxWeightItem , rVersions.nWeightVersion)
+ READ( aPosture, SvxPostureItem , rVersions.nPostureVersion)
+ // --- from 641 on: CJK and CTL font settings
+ if( AUTOFORMAT_DATA_ID_641 <= nVer )
+ {
+ READ( aCJKFont, SvxFontItem , rVersions.nFontVersion)
+ READ( aCJKHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
+ READ( aCJKWeight, SvxWeightItem , rVersions.nWeightVersion)
+ READ( aCJKPosture, SvxPostureItem , rVersions.nPostureVersion)
+ READ( aCTLFont, SvxFontItem , rVersions.nFontVersion)
+ READ( aCTLHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
+ READ( aCTLWeight, SvxWeightItem , rVersions.nWeightVersion)
+ READ( aCTLPosture, SvxPostureItem , rVersions.nPostureVersion)
+ }
+ READ( aUnderline, SvxUnderlineItem , rVersions.nUnderlineVersion)
+ if( nVer >= AUTOFORMAT_DATA_ID_300OVRLN )
+ {
+ READ( aOverline, SvxOverlineItem , rVersions.nOverlineVersion)
+ }
+ READ( aCrossedOut, SvxCrossedOutItem , rVersions.nCrossedOutVersion)
+ READ( aContour, SvxContourItem , rVersions.nContourVersion)
+ READ( aShadowed, SvxShadowedItem , rVersions.nShadowedVersion)
+ READ( aColor, SvxColorItem , rVersions.nColorVersion)
+
+ READ( aBox, SvxBoxItem , rVersions.nBoxVersion)
+
+ // --- from 680/dr14 on: diagonal frame lines
+ if( nVer >= AUTOFORMAT_DATA_ID_680DR14 )
+ {
+ READ( aTLBR, SvxLineItem, rVersions.nLineVersion)
+ READ( aBLTR, SvxLineItem, rVersions.nLineVersion)
+ }
+
+ READ( aBackground, SvxBrushItem , rVersions.nBrushVersion)
+
+ pNew = aAdjust.Create(rStream, rVersions.nAdjustVersion );
+ SetAdjust( *(SvxAdjustItem*)pNew );
+ delete pNew;
+
+ READ( aHorJustify, SvxHorJustifyItem , rVersions.nHorJustifyVersion)
+ READ( aVerJustify, SvxVerJustifyItem , rVersions.nVerJustifyVersion)
+ READ( aOrientation, SvxOrientationItem , rVersions.nOrientationVersion)
+ READ( aMargin, SvxMarginItem , rVersions.nMarginVersion)
+
+ pNew = aLinebreak.Create(rStream, rVersions.nBoolVersion );
+ aLinebreak.SetValue( ((SfxBoolItem*)pNew)->GetValue() );
+ delete pNew;
+
+ if ( nVer >= AUTOFORMAT_DATA_ID_504 )
+ {
+ pNew = aRotateAngle.Create( rStream, rVersions.nInt32Version );
+ aRotateAngle.SetValue( ((SfxInt32Item*)pNew)->GetValue() );
+ delete pNew;
+ pNew = aRotateMode.Create( rStream, rVersions.nRotateModeVersion );
+ aRotateMode.SetValue( ((SvxRotateModeItem*)pNew)->GetValue() );
+ delete pNew;
+ }
+
+ if( 0 == rVersions.nNumFmtVersion )
+ {
+ sal_uInt16 eSys, eLge;
+ // --- from 680/dr25 on: #21549# store strings as UTF-8
+ CharSet eCharSet = (nVer >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
+ rStream.ReadByteString( sNumFmtString, eCharSet )
+ >> eSys >> eLge;
+ eSysLanguage = (LanguageType) eSys;
+ eNumFmtLanguage = (LanguageType) eLge;
+ if ( eSysLanguage == LANGUAGE_SYSTEM ) // von alten Versionen (Calc)
+ eSysLanguage = static_cast<LanguageType>(::GetAppLanguage());
+ }
+
+ aStacked.SetValue( aOrientation.IsStacked() );
+ aRotateAngle.SetValue( aOrientation.GetRotation( aRotateAngle.GetValue() ) );
+
+ return 0 == rStream.GetError();
+}
+
+#ifdef READ_OLDVERS
+
+sal_Bool SwBoxAutoFmt::LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] )
+{
+ SfxPoolItem* pNew;
+ READ( aFont, SvxFontItem , 0)
+
+ if( rStream.GetStreamCharSet() == aFont.GetCharSet() )
+ aFont.SetCharSet(::gsl_getSystemTextEncoding());
+
+ READ( aHeight, SvxFontHeightItem , 1)
+ READ( aWeight, SvxWeightItem , 2)
+ READ( aPosture, SvxPostureItem , 3)
+ READ( aUnderline, SvxUnderlineItem , 4)
+ READ( aCrossedOut, SvxCrossedOutItem , 5)
+ READ( aContour, SvxContourItem , 6)
+ READ( aShadowed, SvxShadowedItem , 7)
+ READ( aColor, SvxColorItem , 8)
+
+ pNew = aAdjust.Create(rStream, aLoadVer[ 9 ] );
+ SetAdjust( *(SvxAdjustItem*)pNew );
+ delete pNew;
+
+ READ( aBox, SvxBoxItem , 10)
+ READ( aBackground, SvxBrushItem , 11)
+
+ return 0 == rStream.GetError();
+}
+
+#endif
+
+
+sal_Bool SwBoxAutoFmt::Save( SvStream& rStream ) const
+{
+ SvxOrientationItem aOrientation( aRotateAngle.GetValue(), aStacked.GetValue(), 0 );
+
+ aFont.Store( rStream, aFont.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aHeight.Store( rStream, aHeight.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aWeight.Store( rStream, aWeight.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aPosture.Store( rStream, aPosture.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aCJKFont.Store( rStream, aCJKFont.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aCJKHeight.Store( rStream, aCJKHeight.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aCJKWeight.Store( rStream, aCJKWeight.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aCJKPosture.Store( rStream, aCJKPosture.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aCTLFont.Store( rStream, aCTLFont.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aCTLHeight.Store( rStream, aCTLHeight.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aCTLWeight.Store( rStream, aCTLWeight.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aCTLPosture.Store( rStream, aCTLPosture.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aUnderline.Store( rStream, aUnderline.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aOverline.Store( rStream, aOverline.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aCrossedOut.Store( rStream, aCrossedOut.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aContour.Store( rStream, aContour.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aShadowed.Store( rStream, aShadowed.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aColor.Store( rStream, aColor.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aBox.Store( rStream, aBox.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aTLBR.Store( rStream, aTLBR.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aBLTR.Store( rStream, aBLTR.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aBackground.Store( rStream, aBackground.GetVersion(SOFFICE_FILEFORMAT_40) );
+
+ aAdjust.Store( rStream, aAdjust.GetVersion(SOFFICE_FILEFORMAT_40) );
+
+ aHorJustify.Store( rStream, aHorJustify.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aVerJustify.Store( rStream, aVerJustify.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aOrientation.Store( rStream, aOrientation.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aMargin.Store( rStream, aMargin.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aLinebreak.Store( rStream, aLinebreak.GetVersion(SOFFICE_FILEFORMAT_40) );
+ // Calc Rotation ab SO5
+ aRotateAngle.Store( rStream, aRotateAngle.GetVersion(SOFFICE_FILEFORMAT_40) );
+ aRotateMode.Store( rStream, aRotateMode.GetVersion(SOFFICE_FILEFORMAT_40) );
+
+ // --- from 680/dr25 on: #21549# store strings as UTF-8
+ rStream.WriteByteString( sNumFmtString, RTL_TEXTENCODING_UTF8 )
+ << (sal_uInt16)eSysLanguage << (sal_uInt16)eNumFmtLanguage;
+
+ return 0 == rStream.GetError();
+}
+
+
+sal_Bool SwBoxAutoFmt::SaveVerionNo( SvStream& rStream ) const
+{
+ rStream << aFont.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aHeight.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aWeight.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aPosture.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aUnderline.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aOverline.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aCrossedOut.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aContour.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aShadowed.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aColor.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aBox.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aTLBR.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aBackground.GetVersion( SOFFICE_FILEFORMAT_40 );
+
+ rStream << aAdjust.GetVersion( SOFFICE_FILEFORMAT_40 );
+
+ rStream << aHorJustify.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aVerJustify.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << SvxOrientationItem(SVX_ORIENTATION_STANDARD, 0).GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aMargin.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aLinebreak.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aRotateAngle.GetVersion( SOFFICE_FILEFORMAT_40 );
+ rStream << aRotateMode.GetVersion( SOFFICE_FILEFORMAT_40 );
+
+ rStream << (sal_uInt16)0; // NumberFormat
+
+ return 0 == rStream.GetError();
+}
+
+/* */
+
+
+SwTableAutoFmt::SwTableAutoFmt( const String& rName )
+ : aName( rName ), nStrResId( USHRT_MAX )
+{
+ bInclFont = sal_True;
+ bInclJustify = sal_True;
+ bInclFrame = sal_True;
+ bInclBackground = sal_True;
+ bInclValueFormat = sal_True;
+ bInclWidthHeight = sal_True;
+
+ memset( aBoxAutoFmt, 0, sizeof( aBoxAutoFmt ) );
+}
+
+
+SwTableAutoFmt::SwTableAutoFmt( const SwTableAutoFmt& rNew )
+{
+ for( sal_uInt8 n = 0; n < 16; ++n )
+ aBoxAutoFmt[ n ] = 0;
+ *this = rNew;
+}
+
+SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew )
+{
+ for( sal_uInt8 n = 0; n < 16; ++n )
+ {
+ if( aBoxAutoFmt[ n ] )
+ delete aBoxAutoFmt[ n ];
+
+ SwBoxAutoFmt* pFmt = rNew.aBoxAutoFmt[ n ];
+ if( pFmt ) // ist gesetzt -> kopieren
+ aBoxAutoFmt[ n ] = new SwBoxAutoFmt( *pFmt );
+ else // sonst default
+ aBoxAutoFmt[ n ] = 0;
+ }
+
+ aName = rNew.aName;
+ nStrResId = rNew.nStrResId;
+ bInclFont = rNew.bInclFont;
+ bInclJustify = rNew.bInclJustify;
+ bInclFrame = rNew.bInclFrame;
+ bInclBackground = rNew.bInclBackground;
+ bInclValueFormat = rNew.bInclValueFormat;
+ bInclWidthHeight = rNew.bInclWidthHeight;
+
+ return *this;
+}
+
+
+SwTableAutoFmt::~SwTableAutoFmt()
+{
+ SwBoxAutoFmt** ppFmt = aBoxAutoFmt;
+ for( sal_uInt8 n = 0; n < 16; ++n, ++ppFmt )
+ if( *ppFmt )
+ delete *ppFmt;
+}
+
+
+void SwTableAutoFmt::SetBoxFmt( const SwBoxAutoFmt& rNew, sal_uInt8 nPos )
+{
+ ASSERT( nPos < 16, "falscher Bereich" );
+
+ SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ];
+ if( pFmt ) // ist gesetzt -> kopieren
+ *aBoxAutoFmt[ nPos ] = rNew;
+ else // sonst neu setzen
+ aBoxAutoFmt[ nPos ] = new SwBoxAutoFmt( rNew );
+}
+
+
+const SwBoxAutoFmt& SwTableAutoFmt::GetBoxFmt( sal_uInt8 nPos ) const
+{
+ ASSERT( nPos < 16, "falscher Bereich" );
+
+ SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ];
+ if( pFmt ) // ist gesetzt -> kopieren
+ return *pFmt;
+ else // sonst den default returnen
+ {
+ // falls noch nicht vorhanden:
+ if( !pDfltBoxAutoFmt )
+ pDfltBoxAutoFmt = new SwBoxAutoFmt;
+ return *pDfltBoxAutoFmt;
+ }
+}
+
+
+
+SwBoxAutoFmt& SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos,
+ const SfxItemSet& rSet,
+ UpdateFlags eFlags,
+ SvNumberFormatter* pNFmtr )
+{
+ ASSERT( nPos < 16, "falscher Bereich" );
+
+ SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ];
+ if( !pFmt ) // ist gesetzt -> kopieren
+ {
+ pFmt = new SwBoxAutoFmt;
+ aBoxAutoFmt[ nPos ] = pFmt;
+ }
+
+ if( UPDATE_CHAR & eFlags )
+ {
+ pFmt->SetFont( (SvxFontItem&)rSet.Get( RES_CHRATR_FONT ) );
+ pFmt->SetHeight( (SvxFontHeightItem&)rSet.Get( RES_CHRATR_FONTSIZE ) );
+ pFmt->SetWeight( (SvxWeightItem&)rSet.Get( RES_CHRATR_WEIGHT ) );
+ pFmt->SetPosture( (SvxPostureItem&)rSet.Get( RES_CHRATR_POSTURE ) );
+ pFmt->SetCJKFont( (SvxFontItem&)rSet.Get( RES_CHRATR_CJK_FONT ) );
+ pFmt->SetCJKHeight( (SvxFontHeightItem&)rSet.Get( RES_CHRATR_CJK_FONTSIZE ) );
+ pFmt->SetCJKWeight( (SvxWeightItem&)rSet.Get( RES_CHRATR_CJK_WEIGHT ) );
+ pFmt->SetCJKPosture( (SvxPostureItem&)rSet.Get( RES_CHRATR_CJK_POSTURE ) );
+ pFmt->SetCTLFont( (SvxFontItem&)rSet.Get( RES_CHRATR_CTL_FONT ) );
+ pFmt->SetCTLHeight( (SvxFontHeightItem&)rSet.Get( RES_CHRATR_CTL_FONTSIZE ) );
+ pFmt->SetCTLWeight( (SvxWeightItem&)rSet.Get( RES_CHRATR_CTL_WEIGHT ) );
+ pFmt->SetCTLPosture( (SvxPostureItem&)rSet.Get( RES_CHRATR_CTL_POSTURE ) );
+ pFmt->SetUnderline( (SvxUnderlineItem&)rSet.Get( RES_CHRATR_UNDERLINE ) );
+ pFmt->SetOverline( (SvxOverlineItem&)rSet.Get( RES_CHRATR_OVERLINE ) );
+ pFmt->SetCrossedOut( (SvxCrossedOutItem&)rSet.Get( RES_CHRATR_CROSSEDOUT ) );
+ pFmt->SetContour( (SvxContourItem&)rSet.Get( RES_CHRATR_CONTOUR ) );
+ pFmt->SetShadowed( (SvxShadowedItem&)rSet.Get( RES_CHRATR_SHADOWED ) );
+ pFmt->SetColor( (SvxColorItem&)rSet.Get( RES_CHRATR_COLOR ) );
+ pFmt->SetAdjust( (SvxAdjustItem&)rSet.Get( RES_PARATR_ADJUST ) );
+ }
+ if( UPDATE_BOX & eFlags )
+ {
+ pFmt->SetBox( (SvxBoxItem&)rSet.Get( RES_BOX ) );
+// FIXME - add attribute IDs for the diagonal line items
+// pFmt->SetTLBR( (SvxLineItem&)rSet.Get( RES_... ) );
+// pFmt->SetBLTR( (SvxLineItem&)rSet.Get( RES_... ) );
+ pFmt->SetBackground( (SvxBrushItem&)rSet.Get( RES_BACKGROUND ) );
+
+ const SwTblBoxNumFormat* pNumFmtItem;
+ const SvNumberformat* pNumFormat = 0;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT, sal_True,
+ (const SfxPoolItem**)&pNumFmtItem ) && pNFmtr &&
+ 0 != (pNumFormat = pNFmtr->GetEntry( pNumFmtItem->GetValue() )) )
+ pFmt->SetValueFormat( ((SvNumberformat*)pNumFormat)->GetFormatstring(),
+ pNumFormat->GetLanguage(),
+ static_cast<LanguageType>(::GetAppLanguage()));
+ else
+ {
+ // defaulten
+ pFmt->SetValueFormat( aEmptyStr, LANGUAGE_SYSTEM,
+ static_cast<LanguageType>(::GetAppLanguage() ));
+ }
+ }
+ // den Rest koennen wir nicht, StarCalc spezifisch
+
+ return *pFmt;
+}
+
+
+void SwTableAutoFmt::UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet,
+ UpdateFlags eFlags, SvNumberFormatter* pNFmtr ) const
+{
+ const SwBoxAutoFmt& rChg = GetBoxFmt( nPos );
+
+ if( UPDATE_CHAR & eFlags )
+ {
+ if( IsFont() )
+ {
+ rSet.Put( rChg.GetFont() );
+ rSet.Put( rChg.GetHeight() );
+ rSet.Put( rChg.GetWeight() );
+ rSet.Put( rChg.GetPosture() );
+ // #103065# do not insert empty CJK font
+ const SvxFontItem& rCJKFont = rChg.GetCJKFont();
+ if( rCJKFont.GetStyleName().Len() )
+ {
+ rSet.Put( rChg.GetCJKFont() );
+ rSet.Put( rChg.GetCJKHeight() );
+ rSet.Put( rChg.GetCJKWeight() );
+ rSet.Put( rChg.GetCJKPosture() );
+ }
+ else
+ {
+ rSet.Put( rChg.GetHeight(), RES_CHRATR_CJK_FONTSIZE );
+ rSet.Put( rChg.GetWeight(), RES_CHRATR_CJK_WEIGHT );
+ rSet.Put( rChg.GetPosture(), RES_CHRATR_CJK_POSTURE );
+ }
+ // #103065# do not insert empty CTL font
+ const SvxFontItem& rCTLFont = rChg.GetCTLFont();
+ if( rCTLFont.GetStyleName().Len() )
+ {
+ rSet.Put( rChg.GetCTLFont() );
+ rSet.Put( rChg.GetCTLHeight() );
+ rSet.Put( rChg.GetCTLWeight() );
+ rSet.Put( rChg.GetCTLPosture() );
+ }
+ else
+ {
+ rSet.Put( rChg.GetHeight(), RES_CHRATR_CTL_FONTSIZE );
+ rSet.Put( rChg.GetWeight(), RES_CHRATR_CTL_WEIGHT );
+ rSet.Put( rChg.GetPosture(), RES_CHRATR_CTL_POSTURE );
+ }
+ rSet.Put( rChg.GetUnderline() );
+ rSet.Put( rChg.GetOverline() );
+ rSet.Put( rChg.GetCrossedOut() );
+ rSet.Put( rChg.GetContour() );
+ rSet.Put( rChg.GetShadowed() );
+ rSet.Put( rChg.GetColor() );
+ }
+ if( IsJustify() )
+ rSet.Put( rChg.GetAdjust() );
+ }
+
+ if( UPDATE_BOX & eFlags )
+ {
+ if( IsFrame() )
+ {
+ rSet.Put( rChg.GetBox() );
+// FIXME - uncomment the lines to put the diagonal line items
+// rSet.Put( rChg.GetTLBR() );
+// rSet.Put( rChg.GetBLTR() );
+ }
+ if( IsBackground() )
+ rSet.Put( rChg.GetBackground() );
+
+ if( IsValueFormat() && pNFmtr )
+ {
+ String sFmt; LanguageType eLng, eSys;
+ rChg.GetValueFormat( sFmt, eLng, eSys );
+ if( sFmt.Len() )
+ {
+ short nType;
+ sal_Bool bNew;
+ xub_StrLen nCheckPos;
+ sal_uInt32 nKey = pNFmtr->GetIndexPuttingAndConverting( sFmt, eLng,
+ eSys, nType, bNew, nCheckPos);
+ rSet.Put( SwTblBoxNumFormat( nKey ));
+ }
+ else
+ rSet.ClearItem( RES_BOXATR_FORMAT );
+ }
+ }
+
+ // den Rest koennen wir nicht, StarCalc spezifisch
+}
+
+
+sal_Bool SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions )
+{
+ sal_Bool bRet = sal_True;
+ sal_uInt16 nVal = 0;
+ rStream >> nVal;
+ bRet = 0 == rStream.GetError();
+
+ if( bRet && (nVal == AUTOFORMAT_DATA_ID_X ||
+ (AUTOFORMAT_DATA_ID_504 <= nVal && nVal <= AUTOFORMAT_DATA_ID)) )
+ {
+ sal_Bool b;
+ // --- from 680/dr25 on: #21549# store strings as UTF-8
+ CharSet eCharSet = (nVal >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
+ rStream.ReadByteString( aName, eCharSet );
+ if( AUTOFORMAT_DATA_ID_552 <= nVal )
+ {
+ rStream >> nStrResId;
+ sal_uInt16 nId = RID_SVXSTR_TBLAFMT_BEGIN + nStrResId;
+ if( RID_SVXSTR_TBLAFMT_BEGIN <= nId &&
+ nId < RID_SVXSTR_TBLAFMT_END )
+ {
+ aName = SVX_RESSTR( nId );
+ }
+ else
+ nStrResId = USHRT_MAX;
+ }
+ rStream >> b; bInclFont = b;
+ rStream >> b; bInclJustify = b;
+ rStream >> b; bInclFrame = b;
+ rStream >> b; bInclBackground = b;
+ rStream >> b; bInclValueFormat = b;
+ rStream >> b; bInclWidthHeight = b;
+
+ bRet = 0 == rStream.GetError();
+
+ for( sal_uInt8 i = 0; i < 16; ++i )
+ {
+ SwBoxAutoFmt* pFmt = new SwBoxAutoFmt;
+ bRet = pFmt->Load( rStream, rVersions, nVal );
+ if( bRet )
+ aBoxAutoFmt[ i ] = pFmt;
+ else
+ {
+ delete pFmt;
+ break;
+ }
+ }
+ }
+ return bRet;
+}
+
+#ifdef READ_OLDVERS
+
+sal_Bool SwTableAutoFmt::LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] )
+{
+ sal_Bool bRet = sal_True;
+ sal_uInt16 nVal = 0;
+ rStream >> nVal;
+ bRet = 0 == rStream.GetError();
+
+ if( bRet && ( AUTOFORMAT_OLD_DATA_ID == nVal ))
+ {
+ sal_Bool b;
+ rStream.ReadByteString( aName, rStream.GetStreamCharSet() );
+ rStream >> b; bInclFont = b;
+ rStream >> b; bInclJustify = b;
+ rStream >> b; bInclFrame = b;
+ rStream >> b; bInclBackground = b;
+ bRet = (rStream.GetError() == 0);
+
+ for( int i = 0; i < 16; i++)
+ {
+ SwBoxAutoFmt* pFmt = new SwBoxAutoFmt;
+ bRet = pFmt->LoadOld( rStream, aLoadVer );
+ if( bRet )
+ aBoxAutoFmt[ i ] = pFmt;
+ else
+ {
+ delete pFmt;
+ break;
+ }
+ }
+ }
+ return bRet;
+}
+#endif
+
+
+sal_Bool SwTableAutoFmt::Save( SvStream& rStream ) const
+{
+ sal_uInt16 nVal = AUTOFORMAT_DATA_ID;
+ sal_Bool b;
+ rStream << nVal;
+ // --- from 680/dr25 on: #21549# store strings as UTF-8
+ rStream.WriteByteString( aName, RTL_TEXTENCODING_UTF8 );
+ rStream << nStrResId;
+ rStream << ( b = bInclFont );
+ rStream << ( b = bInclJustify );
+ rStream << ( b = bInclFrame );
+ rStream << ( b = bInclBackground );
+ rStream << ( b = bInclValueFormat );
+ rStream << ( b = bInclWidthHeight );
+
+ sal_Bool bRet = 0 == rStream.GetError();
+
+ for( int i = 0; bRet && i < 16; ++i )
+ {
+ SwBoxAutoFmt* pFmt = aBoxAutoFmt[ i ];
+ if( !pFmt ) // nicht gesetzt -> default schreiben
+ {
+ // falls noch nicht vorhanden:
+ if( !pDfltBoxAutoFmt )
+ pDfltBoxAutoFmt = new SwBoxAutoFmt;
+ pFmt = pDfltBoxAutoFmt;
+ }
+ bRet = pFmt->Save( rStream );
+ }
+ return bRet;
+}
+
+
+SwTableAutoFmtTbl::SwTableAutoFmtTbl()
+{
+ String sNm;
+ SwTableAutoFmt* pNew = new SwTableAutoFmt(
+ SwStyleNameMapper::GetUIName( RES_POOLCOLL_STANDARD, sNm ) );
+
+ SwBoxAutoFmt aNew;
+
+ sal_uInt8 i;
+
+ Color aColor( COL_BLUE );
+ SvxBrushItem aBrushItem( aColor, RES_BACKGROUND );
+ aNew.SetBackground( aBrushItem );
+ aNew.SetColor( SvxColorItem(Color( COL_WHITE ), RES_CHRATR_COLOR) );
+
+ for( i = 0; i < 4; ++i )
+ pNew->SetBoxFmt( aNew, i );
+
+ // 70% Grau
+ aBrushItem.SetColor( RGB_COLORDATA( 0x4d, 0x4d, 0x4d ) );
+ aNew.SetBackground( aBrushItem );
+ for( i = 4; i <= 12; i += 4 )
+ pNew->SetBoxFmt( aNew, i );
+
+ // 20% Grau
+ aBrushItem.SetColor( RGB_COLORDATA( 0xcc, 0xcc, 0xcc ) );
+ aNew.SetBackground( aBrushItem );
+ aColor.SetColor( COL_BLACK );
+ aNew.SetColor( SvxColorItem( aColor, RES_CHRATR_COLOR) );
+ for( i = 7; i <= 15; i += 4 )
+ pNew->SetBoxFmt( aNew, i );
+ for( i = 13; i <= 14; ++i )
+ pNew->SetBoxFmt( aNew, i );
+
+ aBrushItem.SetColor( Color( COL_WHITE ) );
+ aNew.SetBackground( aBrushItem );
+ for( i = 5; i <= 6; ++i )
+ pNew->SetBoxFmt( aNew, i );
+ for( i = 9; i <= 10; ++i )
+ pNew->SetBoxFmt( aNew, i );
+
+
+ SvxBoxItem aBox( RES_BOX );
+ aBox.SetDistance( 55 );
+ SvxBorderLine aLn( &aColor, DEF_LINE_WIDTH_0 );
+ aBox.SetLine( &aLn, BOX_LINE_LEFT );
+ aBox.SetLine( &aLn, BOX_LINE_BOTTOM );
+
+ for( i = 0; i <= 15; ++i )
+ {
+ aBox.SetLine( i <= 3 ? &aLn : 0, BOX_LINE_TOP );
+ aBox.SetLine( (3 == ( i & 3 )) ? &aLn : 0, BOX_LINE_RIGHT );
+ ((SwBoxAutoFmt&)pNew->GetBoxFmt( i )).SetBox( aBox );
+ }
+
+ Insert( pNew, Count() );
+}
+
+sal_Bool SwTableAutoFmtTbl::Load()
+{
+ sal_Bool bRet = sal_False;
+ String sNm( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( sAutoTblFmtName )));
+ SvtPathOptions aOpt;
+ if( aOpt.SearchFile( sNm, SvtPathOptions::PATH_USERCONFIG ))
+ {
+ SfxMedium aStream( sNm, STREAM_STD_READ, sal_True );
+ bRet = Load( *aStream.GetInStream() );
+ }
+ else
+ bRet = sal_False;
+ return bRet;
+}
+
+sal_Bool SwTableAutoFmtTbl::Save() const
+{
+ SvtPathOptions aPathOpt;
+ String sNm( aPathOpt.GetUserConfigPath() );
+ sNm += INET_PATH_TOKEN;
+ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sAutoTblFmtName ));
+ SfxMedium aStream(sNm, STREAM_STD_WRITE, sal_True );
+ return Save( *aStream.GetOutStream() ) && aStream.Commit();
+}
+
+sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream )
+{
+ sal_Bool bRet = 0 == rStream.GetError();
+ if (bRet)
+ {
+ // Achtung hier muss ein allgemeiner Header gelesen werden
+ sal_uInt16 nVal = 0;
+ rStream >> nVal;
+ bRet = 0 == rStream.GetError();
+
+ if( bRet )
+ {
+ SwAfVersions aVersions;
+
+ if( nVal == AUTOFORMAT_ID_358 ||
+ (AUTOFORMAT_ID_504 <= nVal && nVal <= AUTOFORMAT_ID) )
+ {
+ sal_uInt16 nFileVers = SOFFICE_FILEFORMAT_40;
+ sal_uInt8 nChrSet, nCnt;
+ long nPos = rStream.Tell();
+ rStream >> nCnt >> nChrSet;
+// if( 4 <= nCnt )
+// rStream >> nFileVers;
+ if( rStream.Tell() != sal_uLong(nPos + nCnt) )
+ {
+ ASSERT( !this, "Der Header enthaelt mehr/neuere Daten" );
+ rStream.Seek( nPos + nCnt );
+ }
+ rStream.SetStreamCharSet( (CharSet)nChrSet );
+ rStream.SetVersion( nFileVers );
+ }
+
+ if( nVal == AUTOFORMAT_ID_358 || nVal == AUTOFORMAT_ID_X ||
+ (AUTOFORMAT_ID_504 <= nVal && nVal <= AUTOFORMAT_ID) )
+ {
+ aVersions.Load( rStream, nVal ); // Item-Versionen
+
+ SwTableAutoFmt* pNew;
+ sal_uInt16 nAnz = 0;
+ rStream >> nAnz;
+
+ bRet = 0 == rStream.GetError();
+
+ for( sal_uInt16 i = 0; i < nAnz; ++i )
+ {
+ pNew = new SwTableAutoFmt( aEmptyStr );
+ bRet = pNew->Load( rStream, aVersions );
+ if( bRet )
+ {
+ Insert( pNew, Count() );
+ }
+ else
+ {
+ delete pNew;
+ break;
+ }
+ }
+ }
+#ifdef READ_OLDVERS
+ else if( AUTOFORMAT_OLD_ID == nVal || AUTOFORMAT_OLD_ID1 == nVal )
+ {
+ SwTableAutoFmt* pNew;
+ sal_uInt16 nAnz = 0;
+ rStream >> nAnz;
+
+ sal_uInt16 aArr[ 12 ];
+ memset( aArr, 0, 12 * sizeof( sal_uInt16 ) );
+ if( AUTOFORMAT_OLD_ID1 == nVal )
+ for( sal_uInt16 n = 0; n < 12; ++n )
+ rStream >> aArr[ n ];
+
+ bRet = 0 == rStream.GetError();
+
+ for( sal_uInt16 i = 0; i < nAnz; ++i )
+ {
+ pNew = new SwTableAutoFmt( aEmptyStr );
+ bRet = pNew->LoadOld( rStream, aArr );
+ if( bRet )
+ {
+ Insert( pNew, Count() );
+ }
+ else
+ {
+ delete pNew;
+ break;
+ }
+ }
+ }
+#endif
+ }
+ }
+ return bRet;
+}
+
+
+sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const
+{
+ sal_Bool bRet = 0 == rStream.GetError();
+ if (bRet)
+ {
+ rStream.SetVersion( SOFFICE_FILEFORMAT_40 );
+
+ // Achtung hier muss ein allgemeiner Header gespeichert werden
+ sal_uInt16 nVal = AUTOFORMAT_ID;
+ rStream << nVal
+ << (sal_uInt8)2 // Anzahl von Zeichen des Headers incl. diesem
+ << (sal_uInt8)GetStoreCharSet( ::gsl_getSystemTextEncoding() );
+// << (sal_uInt8)4 // Anzahl von Zeichen des Headers incl. diesem
+// << (sal_uInt8)::GetSystemCharSet()
+// << (UNIT16)SOFFICE_FILEFORMAT_NOW;
+ bRet = 0 == rStream.GetError();
+
+ //-----------------------------------------------------------
+ // die VersionsNummer fuer alle Attribute schreiben
+ (*this)[ 0 ]->GetBoxFmt( 0 ).SaveVerionNo( rStream );
+
+ rStream << (sal_uInt16)(Count() - 1);
+ bRet = 0 == rStream.GetError();
+
+ for( sal_uInt16 i = 1; bRet && i < Count(); ++i )
+ {
+ SwTableAutoFmt* pFmt = (*this)[ i ];
+ bRet = pFmt->Save( rStream );
+ }
+ }
+ rStream.Flush();
+ return bRet;
+}
+
+
+
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
new file mode 100644
index 000000000000..51e1d455beb5
--- /dev/null
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -0,0 +1,1099 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#define _ZFORLIST_DECLARE_TABLE
+#include <svl/zforlist.hxx>
+#include <frmfmt.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <cntfrm.hxx>
+#include <pam.hxx>
+#include <swtable.hxx>
+#include <ndtxt.hxx>
+#include <fldbas.hxx>
+#include <tblsel.hxx>
+#include <tabfrm.hxx>
+#include <poolfmt.hxx>
+#include <cellatr.hxx>
+#include <mvsave.hxx>
+#include <docary.hxx>
+#include <fmtanchr.hxx>
+#include <hints.hxx>
+#include <UndoTable.hxx>
+#include <redline.hxx>
+#include <fmtfsize.hxx>
+#include <list>
+
+sal_Bool _FndCntntLine( const SwTableLine*& rpLine, void* pPara );
+sal_Bool _FndCntntBox( const SwTableBox*& rpBox, void* pPara );
+void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox,
+ SwTable& rDstTbl, SwTableBox* pDstBox,
+ sal_Bool bDelCntnt, SwUndoTblCpyTbl* pUndo );
+
+// The following type will be used by table copy functions to describe
+// the structure of tables (or parts of tables).
+// It's for new table model only.
+
+namespace
+{
+ struct BoxSpanInfo
+ {
+ SwTableBox* mpBox;
+ SwTableBox* mpCopy;
+ sal_uInt16 mnColSpan;
+ bool mbSelected;
+ };
+
+ typedef std::vector< BoxSpanInfo > BoxStructure;
+ typedef std::vector< BoxStructure > LineStructure;
+ typedef std::list< sal_uLong > ColumnStructure;
+
+ struct SubBox
+ {
+ SwTableBox *mpBox;
+ bool mbCovered;
+ };
+
+ typedef std::list< SubBox > SubLine;
+ typedef std::list< SubLine > SubTable;
+
+ class TableStructure
+ {
+ public:
+ LineStructure maLines;
+ ColumnStructure maCols;
+ sal_uInt16 mnStartCol;
+ sal_uInt16 mnAddLine;
+ void addLine( sal_uInt16 &rLine, const SwTableBoxes&, const SwSelBoxes*,
+ bool bNewModel );
+ void addBox( sal_uInt16 nLine, const SwSelBoxes*, SwTableBox *pBox,
+ sal_uLong &rnB, sal_uInt16 &rnC, ColumnStructure::iterator& rpCl,
+ BoxStructure::iterator& rpSel, bool &rbSel, bool bCover );
+ void incColSpan( sal_uInt16 nLine, sal_uInt16 nCol );
+ TableStructure( const SwTable& rTable );
+ TableStructure( const SwTable& rTable, _FndBox &rFndBox,
+ const SwSelBoxes& rSelBoxes,
+ LineStructure::size_type nMinSize );
+ LineStructure::size_type getLineCount() const
+ { return maLines.size(); }
+ void moreLines( const SwTable& rTable );
+ void assignBoxes( const TableStructure &rSource );
+ void copyBoxes( const SwTable& rSource, SwTable& rDstTbl,
+ SwUndoTblCpyTbl* pUndo ) const;
+ };
+
+ SubTable::iterator insertSubLine( SubTable& rSubTable, SwTableLine& rLine,
+ SubTable::iterator pStartLn );
+
+ SubTable::iterator insertSubBox( SubTable& rSubTable, SwTableBox& rBox,
+ SubTable::iterator pStartLn, SubTable::iterator pEndLn )
+ {
+ if( rBox.GetTabLines().Count() )
+ {
+ SubTable::difference_type nSize = std::distance( pStartLn, pEndLn );
+ if( nSize < rBox.GetTabLines().Count() )
+ {
+ SubLine aSubLine;
+ SubLine::iterator pBox = pStartLn->begin();
+ SubLine::iterator pEnd = pStartLn->end();
+ while( pBox != pEnd )
+ {
+ SubBox aSub;
+ aSub.mpBox = pBox->mpBox;
+ aSub.mbCovered = true;
+ aSubLine.push_back( aSub );
+ ++pBox;
+ }
+ do
+ {
+ rSubTable.insert( pEndLn, aSubLine );
+ } while( ++nSize < rBox.GetTabLines().Count() );
+ }
+ for( sal_uInt16 nLine = 0; nLine < rBox.GetTabLines().Count(); ++nLine )
+ pStartLn = insertSubLine( rSubTable, *rBox.GetTabLines()[nLine],
+ pStartLn );
+ ASSERT( pStartLn == pEndLn, "Sub line confusion" );
+ }
+ else
+ {
+ SubBox aSub;
+ aSub.mpBox = &rBox;
+ aSub.mbCovered = false;
+ while( pStartLn != pEndLn )
+ {
+ pStartLn->push_back( aSub );
+ aSub.mbCovered = true;
+ ++pStartLn;
+ }
+ }
+ return pStartLn;
+ }
+
+ SubTable::iterator insertSubLine( SubTable& rSubTable, SwTableLine& rLine,
+ SubTable::iterator pStartLn )
+ {
+ SubTable::iterator pMax = pStartLn;
+ ++pMax;
+ SubTable::difference_type nMax = 1;
+ for( sal_uInt16 nBox = 0; nBox < rLine.GetTabBoxes().Count(); ++nBox )
+ {
+ SubTable::iterator pTmp = insertSubBox( rSubTable,
+ *rLine.GetTabBoxes()[nBox], pStartLn, pMax );
+ SubTable::difference_type nTmp = std::distance( pStartLn, pTmp );
+ if( nTmp > nMax )
+ {
+ pMax = pTmp;
+ nMax = nTmp;
+ }
+ }
+ return pMax;
+ }
+
+ TableStructure::TableStructure( const SwTable& rTable ) :
+ maLines( rTable.GetTabLines().Count() ), mnStartCol(USHRT_MAX),
+ mnAddLine(0)
+ {
+ maCols.push_front(0);
+ const SwTableLines &rLines = rTable.GetTabLines();
+ sal_uInt16 nCnt = 0;
+ for( sal_uInt16 nLine = 0; nLine < rLines.Count(); ++nLine )
+ addLine( nCnt, rLines[nLine]->GetTabBoxes(), 0, rTable.IsNewModel() );
+ }
+
+ TableStructure::TableStructure( const SwTable& rTable,
+ _FndBox &rFndBox, const SwSelBoxes& rSelBoxes,
+ LineStructure::size_type nMinSize )
+ : mnStartCol(USHRT_MAX), mnAddLine(0)
+ {
+ if( rFndBox.GetLines().Count() )
+ {
+ bool bNoSelection = rSelBoxes.Count() < 2;
+ _FndLines &rFndLines = rFndBox.GetLines();
+ maCols.push_front(0);
+ const SwTableLine* pLine = rFndLines[0]->GetLine();
+ sal_uInt16 nStartLn = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ sal_uInt16 nEndLn = nStartLn;
+ if( rFndLines.Count() > 1 )
+ {
+ pLine = rFndLines[ rFndLines.Count()-1 ]->GetLine();
+ nEndLn = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ }
+ if( nStartLn < USHRT_MAX && nEndLn < USHRT_MAX )
+ {
+ const SwTableLines &rLines = rTable.GetTabLines();
+ if( bNoSelection &&
+ (sal_uInt16)nMinSize > nEndLn - nStartLn + 1 )
+ {
+ sal_uInt16 nNewEndLn = nStartLn + (sal_uInt16)nMinSize - 1;
+ if( nNewEndLn >= rLines.Count() )
+ {
+ mnAddLine = nNewEndLn - rLines.Count() + 1;
+ nNewEndLn = rLines.Count() - 1;
+ }
+ while( nEndLn < nNewEndLn )
+ {
+ SwTableLine *pLine2 = rLines[ ++nEndLn ];
+ SwTableBox *pTmpBox = pLine2->GetTabBoxes()[0];
+ _FndLine *pInsLine = new _FndLine( pLine2, &rFndBox );
+ _FndBox *pFndBox = new _FndBox( pTmpBox, pInsLine );
+ pInsLine->GetBoxes().C40_INSERT( _FndBox, pFndBox, 0 );
+ rFndLines.C40_INSERT( _FndLine, pInsLine, rFndLines.Count() );
+ }
+ }
+ maLines.resize( nEndLn - nStartLn + 1 );
+ const SwSelBoxes* pSelBoxes = &rSelBoxes;
+ sal_uInt16 nCnt = 0;
+ for( sal_uInt16 nLine = nStartLn; nLine <= nEndLn; ++nLine )
+ {
+ addLine( nCnt, rLines[nLine]->GetTabBoxes(),
+ pSelBoxes, rTable.IsNewModel() );
+ if( bNoSelection )
+ pSelBoxes = 0;
+ }
+ }
+ if( bNoSelection && mnStartCol < USHRT_MAX )
+ {
+ BoxStructure::iterator pC = maLines[0].begin();
+ BoxStructure::iterator pEnd = maLines[0].end();
+ sal_uInt16 nIdx = mnStartCol;
+ mnStartCol = 0;
+ while( nIdx && pC != pEnd )
+ {
+ mnStartCol = mnStartCol + pC->mnColSpan;
+ --nIdx;
+ ++pC;
+ }
+ }
+ else
+ mnStartCol = USHRT_MAX;
+ }
+ }
+
+ void TableStructure::addLine( sal_uInt16 &rLine, const SwTableBoxes& rBoxes,
+ const SwSelBoxes* pSelBoxes, bool bNewModel )
+ {
+ bool bComplex = false;
+ if( !bNewModel )
+ for( sal_uInt16 nBox = 0; !bComplex && nBox < rBoxes.Count(); ++nBox )
+ bComplex = rBoxes[nBox]->GetTabLines().Count() > 0;
+ if( bComplex )
+ {
+ SubTable aSubTable;
+ SubLine aSubLine;
+ aSubTable.push_back( aSubLine );
+ SubTable::iterator pStartLn = aSubTable.begin();
+ SubTable::iterator pEndLn = aSubTable.end();
+ for( sal_uInt16 nBox = 0; nBox < rBoxes.Count(); ++nBox )
+ insertSubBox( aSubTable, *rBoxes[nBox], pStartLn, pEndLn );
+ SubTable::size_type nSize = aSubTable.size();
+ if( nSize )
+ {
+ maLines.resize( maLines.size() + nSize - 1 );
+ while( pStartLn != pEndLn )
+ {
+ bool bSelected = false;
+ sal_uLong nBorder = 0;
+ sal_uInt16 nCol = 0;
+ maLines[rLine].reserve( pStartLn->size() );
+ BoxStructure::iterator pSel = maLines[rLine].end();
+ ColumnStructure::iterator pCol = maCols.begin();
+ SubLine::iterator pBox = pStartLn->begin();
+ SubLine::iterator pEnd = pStartLn->end();
+ while( pBox != pEnd )
+ {
+ addBox( rLine, pSelBoxes, pBox->mpBox, nBorder, nCol,
+ pCol, pSel, bSelected, pBox->mbCovered );
+ ++pBox;
+ }
+ ++rLine;
+ ++pStartLn;
+ }
+ }
+ }
+ else
+ {
+ bool bSelected = false;
+ sal_uLong nBorder = 0;
+ sal_uInt16 nCol = 0;
+ maLines[rLine].reserve( rBoxes.Count() );
+ ColumnStructure::iterator pCol = maCols.begin();
+ BoxStructure::iterator pSel = maLines[rLine].end();
+ for( sal_uInt16 nBox = 0; nBox < rBoxes.Count(); ++nBox )
+ addBox( rLine, pSelBoxes, rBoxes[nBox], nBorder, nCol,
+ pCol, pSel, bSelected, false );
+ ++rLine;
+ }
+ }
+
+ void TableStructure::addBox( sal_uInt16 nLine, const SwSelBoxes* pSelBoxes,
+ SwTableBox *pBox, sal_uLong &rnBorder, sal_uInt16 &rnCol,
+ ColumnStructure::iterator& rpCol, BoxStructure::iterator& rpSel,
+ bool &rbSelected, bool bCovered )
+ {
+ BoxSpanInfo aInfo;
+ if( pSelBoxes &&
+ USHRT_MAX != pSelBoxes->GetPos( pBox ) )
+ {
+ aInfo.mbSelected = true;
+ if( mnStartCol == USHRT_MAX )
+ {
+ mnStartCol = (sal_uInt16)maLines[nLine].size();
+ if( pSelBoxes->Count() < 2 )
+ {
+ pSelBoxes = 0;
+ aInfo.mbSelected = false;
+ }
+ }
+ }
+ else
+ aInfo.mbSelected = false;
+ rnBorder += pBox->GetFrmFmt()->GetFrmSize().GetWidth();
+ sal_uInt16 nLeftCol = rnCol;
+ while( rpCol != maCols.end() && *rpCol < rnBorder )
+ {
+ ++rnCol;
+ ++rpCol;
+ }
+ if( rpCol == maCols.end() || *rpCol > rnBorder )
+ {
+ maCols.insert( rpCol, rnBorder );
+ --rpCol;
+ incColSpan( nLine, rnCol );
+ }
+ aInfo.mnColSpan = rnCol - nLeftCol;
+ aInfo.mpCopy = 0;
+ aInfo.mpBox = bCovered ? 0 : pBox;
+ maLines[nLine].push_back( aInfo );
+ if( aInfo.mbSelected )
+ {
+ if( rbSelected )
+ {
+ while( rpSel != maLines[nLine].end() )
+ {
+ rpSel->mbSelected = true;
+ ++rpSel;
+ }
+ }
+ else
+ {
+ rpSel = maLines[nLine].end();
+ rbSelected = true;
+ }
+ --rpSel;
+ }
+ }
+
+ void TableStructure::moreLines( const SwTable& rTable )
+ {
+ if( mnAddLine )
+ {
+ const SwTableLines &rLines = rTable.GetTabLines();
+ sal_uInt16 nLineCount = rLines.Count();
+ if( nLineCount < mnAddLine )
+ mnAddLine = nLineCount;
+ sal_uInt16 nLine = (sal_uInt16)maLines.size();
+ maLines.resize( nLine + mnAddLine );
+ while( mnAddLine )
+ {
+ SwTableLine *pLine = rLines[ nLineCount - mnAddLine ];
+ addLine( nLine, pLine->GetTabBoxes(), 0, rTable.IsNewModel() );
+ --mnAddLine;
+ }
+ }
+ }
+
+ void TableStructure::incColSpan( sal_uInt16 nLineMax, sal_uInt16 nNewCol )
+ {
+ for( sal_uInt16 nLine = 0; nLine < nLineMax; ++nLine )
+ {
+ BoxStructure::iterator pInfo = maLines[nLine].begin();
+ BoxStructure::iterator pEnd = maLines[nLine].end();
+ long nCol = pInfo->mnColSpan;
+ while( nNewCol > nCol && ++pInfo != pEnd )
+ nCol += pInfo->mnColSpan;
+ if( pInfo != pEnd )
+ ++(pInfo->mnColSpan);
+ }
+ }
+
+ void TableStructure::assignBoxes( const TableStructure &rSource )
+ {
+ LineStructure::const_iterator pFirstLine = rSource.maLines.begin();
+ LineStructure::const_iterator pLastLine = rSource.maLines.end();
+ if( pFirstLine == pLastLine )
+ return;
+ LineStructure::const_iterator pCurrLine = pFirstLine;
+ LineStructure::size_type nLineCount = maLines.size();
+ sal_uInt16 nFirstStartCol = 0;
+ {
+ BoxStructure::const_iterator pFirstBox = pFirstLine->begin();
+ if( pFirstBox != pFirstLine->end() && pFirstBox->mpBox &&
+ pFirstBox->mpBox->getDummyFlag() )
+ nFirstStartCol = pFirstBox->mnColSpan;
+ }
+ for( LineStructure::size_type nLine = 0; nLine < nLineCount; ++nLine )
+ {
+ BoxStructure::const_iterator pFirstBox = pCurrLine->begin();
+ BoxStructure::const_iterator pLastBox = pCurrLine->end();
+ sal_uInt16 nCurrStartCol = mnStartCol;
+ if( pFirstBox != pLastBox )
+ {
+ BoxStructure::const_iterator pTmpBox = pLastBox;
+ --pTmpBox;
+ if( pTmpBox->mpBox && pTmpBox->mpBox->getDummyFlag() )
+ --pLastBox;
+ if( pFirstBox != pLastBox && pFirstBox->mpBox &&
+ pFirstBox->mpBox->getDummyFlag() )
+ {
+ if( nCurrStartCol < USHRT_MAX )
+ {
+ if( pFirstBox->mnColSpan > nFirstStartCol )
+ nCurrStartCol = pFirstBox->mnColSpan - nFirstStartCol
+ + nCurrStartCol;
+ }
+ ++pFirstBox;
+ }
+ }
+ if( pFirstBox != pLastBox )
+ {
+ BoxStructure::const_iterator pCurrBox = pFirstBox;
+ BoxStructure &rBox = maLines[nLine];
+ BoxStructure::size_type nBoxCount = rBox.size();
+ sal_uInt16 nCol = 0;
+ for( BoxStructure::size_type nBox = 0; nBox < nBoxCount; ++nBox )
+ {
+ BoxSpanInfo& rInfo = rBox[nBox];
+ nCol = nCol + rInfo.mnColSpan;
+ if( rInfo.mbSelected || nCol > nCurrStartCol )
+ {
+ rInfo.mpCopy = pCurrBox->mpBox;
+ if( rInfo.mbSelected && rInfo.mpCopy->getDummyFlag() )
+ {
+ ++pCurrBox;
+ if( pCurrBox == pLastBox )
+ {
+ pCurrBox = pFirstBox;
+ if( pCurrBox->mpBox->getDummyFlag() )
+ ++pCurrBox;
+ }
+ rInfo.mpCopy = pCurrBox->mpBox;
+ }
+ ++pCurrBox;
+ if( pCurrBox == pLastBox )
+ {
+ if( rInfo.mbSelected )
+ pCurrBox = pFirstBox;
+ else
+ {
+ rInfo.mbSelected = rInfo.mpCopy == 0;
+ break;
+ }
+ }
+ rInfo.mbSelected = rInfo.mpCopy == 0;
+ }
+ }
+ }
+ ++pCurrLine;
+ if( pCurrLine == pLastLine )
+ pCurrLine = pFirstLine;
+ }
+ }
+
+ void TableStructure::copyBoxes( const SwTable& rSource, SwTable& rDstTbl,
+ SwUndoTblCpyTbl* pUndo ) const
+ {
+ LineStructure::size_type nLineCount = maLines.size();
+ for( LineStructure::size_type nLine = 0; nLine < nLineCount; ++nLine )
+ {
+ const BoxStructure &rBox = maLines[nLine];
+ BoxStructure::size_type nBoxCount = rBox.size();
+ for( BoxStructure::size_type nBox = 0; nBox < nBoxCount; ++nBox )
+ {
+ const BoxSpanInfo& rInfo = rBox[nBox];
+ if( ( rInfo.mpCopy && !rInfo.mpCopy->getDummyFlag() )
+ || rInfo.mbSelected )
+ {
+ SwTableBox *pBox = rInfo.mpBox;
+ if( pBox && pBox->getRowSpan() > 0 )
+ lcl_CpyBox( rSource, rInfo.mpCopy, rDstTbl, pBox,
+ sal_True, pUndo );
+ /* Idea: If target cell is a covered cell, append content
+ to master cell.
+ sal_Bool bReplace = sal_True;
+ if( pBox->getRowSpan() < 0 )
+ {
+ if( rInfo.mpCopy->getRowSpan() < 0 )
+ continue;
+ pBox = &pBox->FindStartOfRowSpan( rDstTbl );
+ bReplace = sal_False;
+ }
+ lcl_CpyBox( rSource, rInfo.mpCopy, rDstTbl, pBox,
+ bReplace, pUndo );
+ */
+ }
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------------
+
+// kopiere die Tabelle in diese.
+// Kopiere alle Boxen einer Line in entsprechenden Boxen. Der alte Inhalt
+// wird dabei geloescht.
+// Ist keine mehr vorhanden, kommt der restliche Inhalt in die letzte
+// Box einer "GrundLine".
+// Ist auch keine Line mehr vorhanden, -> auch in die letzte Box
+// einer "GrundLine"
+
+
+void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox,
+ SwTable& rDstTbl, SwTableBox* pDstBox,
+ sal_Bool bDelCntnt, SwUndoTblCpyTbl* pUndo )
+{
+ ASSERT( ( !pCpyBox || pCpyBox->GetSttNd() ) && pDstBox->GetSttNd(),
+ "Keine inhaltstragende Box" );
+
+ SwDoc* pCpyDoc = rCpyTbl.GetFrmFmt()->GetDoc();
+ SwDoc* pDoc = rDstTbl.GetFrmFmt()->GetDoc();
+
+ // kopiere erst den neuen und loeschen dann den alten Inhalt
+ // (keine leeren Section erzeugen; werden sonst geloescht!)
+ std::auto_ptr< SwNodeRange > pRg( pCpyBox ?
+ new SwNodeRange ( *pCpyBox->GetSttNd(), 1,
+ *pCpyBox->GetSttNd()->EndOfSectionNode() ) : 0 );
+
+ SwNodeIndex aInsIdx( *pDstBox->GetSttNd(), bDelCntnt ? 1 :
+ pDstBox->GetSttNd()->EndOfSectionIndex() -
+ pDstBox->GetSttIdx() );
+
+ if( pUndo )
+ pUndo->AddBoxBefore( *pDstBox, bDelCntnt );
+
+ bool bUndoRedline = pUndo && pDoc->IsRedlineOn();
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+
+ SwNodeIndex aSavePos( aInsIdx, -1 );
+ if( pRg.get() )
+ pCpyDoc->CopyWithFlyInFly( *pRg, 0, aInsIdx, sal_False );
+ else
+ pDoc->GetNodes().MakeTxtNode( aInsIdx, (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
+ aSavePos++;
+
+ SwTableLine* pLine = pDstBox->GetUpper();
+ while( pLine->GetUpper() )
+ pLine = pLine->GetUpper()->GetUpper();
+
+ sal_Bool bReplaceColl = sal_True;
+ if( bDelCntnt && !bUndoRedline )
+ {
+ // zuerst die Fly loeschen, dann die entsprechenden Nodes
+ SwNodeIndex aEndNdIdx( *aInsIdx.GetNode().EndOfSectionNode() );
+
+ // Bookmarks usw. verschieben
+ {
+ SwPosition aMvPos( aInsIdx );
+ SwCntntNode* pCNd = pDoc->GetNodes().GoPrevious( &aMvPos.nNode );
+ aMvPos.nContent.Assign( pCNd, pCNd->Len() );
+ pDoc->CorrAbs( aInsIdx, aEndNdIdx, aMvPos, /*sal_True*/sal_False );
+ }
+
+ // stehen noch FlyFrames rum, loesche auch diese
+ for( sal_uInt16 n = 0; n < pDoc->GetSpzFrmFmts()->Count(); ++n )
+ {
+ SwFrmFmt *const pFly = (*pDoc->GetSpzFrmFmts())[n];
+ SwFmtAnchor const*const pAnchor = &pFly->GetAnchor();
+ SwPosition const*const pAPos = pAnchor->GetCntntAnchor();
+ if (pAPos &&
+ ((FLY_AT_PARA == pAnchor->GetAnchorId()) ||
+ (FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
+ aInsIdx <= pAPos->nNode && pAPos->nNode <= aEndNdIdx )
+ {
+ pDoc->DelLayoutFmt( pFly );
+ }
+ }
+
+ // ist DestBox eine Headline-Box und hat Tabellen-Vorlage gesetzt,
+ // dann NICHT die TabellenHeadline-Vorlage automatisch setzen
+ if( 1 < rDstTbl.GetTabLines().Count() &&
+ pLine == rDstTbl.GetTabLines()[0] )
+ {
+ SwCntntNode* pCNd = aInsIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ {
+ SwNodeIndex aTmp( aInsIdx );
+ pCNd = pDoc->GetNodes().GoNext( &aTmp );
+ }
+
+ if( pCNd &&
+ /*RES_POOLCOLL_TABLE == */
+ RES_POOLCOLL_TABLE_HDLN !=
+ pCNd->GetFmtColl()->GetPoolFmtId() )
+ bReplaceColl = sal_False;
+ }
+
+ pDoc->GetNodes().Delete( aInsIdx, aEndNdIdx.GetIndex() - aInsIdx.GetIndex() );
+ }
+
+ //b6341295: Table copy redlining will be managed by AddBoxAfter()
+ if( pUndo )
+ pUndo->AddBoxAfter( *pDstBox, aInsIdx, bDelCntnt );
+
+ // heading
+ SwTxtNode *const pTxtNd = aSavePos.GetNode().GetTxtNode();
+ if( pTxtNd )
+ {
+ sal_uInt16 nPoolId = pTxtNd->GetTxtColl()->GetPoolFmtId();
+ if( bReplaceColl &&
+ (( 1 < rDstTbl.GetTabLines().Count() &&
+ pLine == rDstTbl.GetTabLines()[0] )
+ // gilt noch die Tabellen-Inhalt ??
+ ? RES_POOLCOLL_TABLE == nPoolId
+ : RES_POOLCOLL_TABLE_HDLN == nPoolId ) )
+ {
+ SwTxtFmtColl* pColl = pDoc->GetTxtCollFromPool(
+ static_cast<sal_uInt16>(
+ RES_POOLCOLL_TABLE == nPoolId
+ ? RES_POOLCOLL_TABLE_HDLN
+ : RES_POOLCOLL_TABLE ) );
+ if( pColl ) // Vorlage umsetzen
+ {
+ SwPaM aPam( aSavePos );
+ aPam.SetMark();
+ aPam.Move( fnMoveForward, fnGoSection );
+ pDoc->SetTxtFmtColl( aPam, pColl );
+ }
+ }
+
+ // loesche die akt. Formel/Format/Value Werte
+ if( SFX_ITEM_SET == pDstBox->GetFrmFmt()->GetItemState( RES_BOXATR_FORMAT ) ||
+ SFX_ITEM_SET == pDstBox->GetFrmFmt()->GetItemState( RES_BOXATR_FORMULA ) ||
+ SFX_ITEM_SET == pDstBox->GetFrmFmt()->GetItemState( RES_BOXATR_VALUE ) )
+ {
+ pDstBox->ClaimFrmFmt()->ResetFmtAttr( RES_BOXATR_FORMAT,
+ RES_BOXATR_VALUE );
+ }
+
+ // kopiere die TabellenBoxAttribute - Formel/Format/Value
+ if( pCpyBox )
+ {
+ SfxItemSet aBoxAttrSet( pCpyDoc->GetAttrPool(), RES_BOXATR_FORMAT,
+ RES_BOXATR_VALUE );
+ aBoxAttrSet.Put( pCpyBox->GetFrmFmt()->GetAttrSet() );
+ if( aBoxAttrSet.Count() )
+ {
+ const SfxPoolItem* pItem;
+ SvNumberFormatter* pN = pDoc->GetNumberFormatter( sal_False );
+ if( pN && pN->HasMergeFmtTbl() && SFX_ITEM_SET == aBoxAttrSet.
+ GetItemState( RES_BOXATR_FORMAT, sal_False, &pItem ) )
+ {
+ sal_uLong nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue();
+ sal_uLong nNewIdx = pN->GetMergeFmtIndex( nOldIdx );
+ if( nNewIdx != nOldIdx )
+ aBoxAttrSet.Put( SwTblBoxNumFormat( nNewIdx ));
+ }
+ pDstBox->ClaimFrmFmt()->SetFmtAttr( aBoxAttrSet );
+ }
+ }
+ }
+}
+
+sal_Bool SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes,
+ SwUndoTblCpyTbl* pUndo )
+{
+ SwDoc* pDoc = GetFrmFmt()->GetDoc();
+ SwDoc* pCpyDoc = rCpyTbl.GetFrmFmt()->GetDoc();
+
+ SwTblNumFmtMerge aTNFM( *pCpyDoc, *pDoc );
+
+ // analyse source structure
+ TableStructure aCopyStruct( rCpyTbl );
+
+ // analyse target structure (from start box) and selected substructure
+ _FndBox aFndBox( 0, 0 );
+ { // get all boxes/lines
+ _FndPara aPara( rSelBoxes, &aFndBox );
+ GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ }
+ TableStructure aTarget( *this, aFndBox, rSelBoxes, aCopyStruct.getLineCount() );
+
+ bool bClear = false;
+ if( aTarget.mnAddLine && IsNewModel() )
+ {
+ SwSelBoxes aBoxes;
+ aBoxes.Insert( GetTabLines()[ GetTabLines().Count()-1 ]->GetTabBoxes()[0] );
+ if( pUndo )
+ pUndo->InsertRow( *this, aBoxes, aTarget.mnAddLine );
+ else
+ InsertRow( pDoc, aBoxes, aTarget.mnAddLine, sal_True );
+
+ aTarget.moreLines( *this );
+ bClear = true;
+ }
+
+ // find mapping, if needed extend target table and/or selection
+ aTarget.assignBoxes( aCopyStruct );
+
+ {
+ // Change table formulas into relative representation
+ SwTableFmlUpdate aMsgHnt( &rCpyTbl );
+ aMsgHnt.eFlags = TBL_RELBOXNAME;
+ pCpyDoc->UpdateTblFlds( &aMsgHnt );
+ }
+
+ // delete frames
+ aFndBox.SetTableLines( *this );
+ if( bClear )
+ aFndBox.ClearLineBehind();
+ aFndBox.DelFrms( *this );
+
+ // copy boxes
+ aTarget.copyBoxes( rCpyTbl, *this, pUndo );
+
+ // adjust row span attributes accordingly
+
+ // make frames
+ aFndBox.MakeFrms( *this );
+
+ return sal_True;
+}
+
+// ---------------------------------------------------------------
+
+// kopiere die Tabelle in diese.
+// Kopiere alle Boxen einer Line in entsprechenden Boxen. Der alte Inhalt
+// wird dabei geloescht.
+// Ist keine mehr vorhanden, kommt der restliche Inhalt in die letzte
+// Box einer "GrundLine".
+// Ist auch keine Line mehr vorhanden, -> auch in die letzte Box
+// einer "GrundLine"
+
+
+sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox,
+ SwUndoTblCpyTbl* pUndo )
+{
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ SwDoc* pDoc = GetFrmFmt()->GetDoc();
+
+ SwTableNode* pTblNd = pDoc->IsIdxInTbl( rSttBox );
+
+ // suche erstmal die Box, in die kopiert werden soll:
+ SwTableBox* pMyBox = (SwTableBox*)GetTblBox(
+ rSttBox.GetNode().FindTableBoxStartNode()->GetIndex() );
+
+ ASSERT( pMyBox, "Index steht nicht in dieser Tabelle in einer Box" );
+
+ // loesche erstmal die Frames der Tabelle
+ _FndBox aFndBox( 0, 0 );
+ aFndBox.DelFrms( pTblNd->GetTable() );
+
+ SwDoc* pCpyDoc = rCpyTbl.GetFrmFmt()->GetDoc();
+
+ {
+ // Tabellen-Formeln in die relative Darstellung umwandeln
+ SwTableFmlUpdate aMsgHnt( &rCpyTbl );
+ aMsgHnt.eFlags = TBL_RELBOXNAME;
+ pCpyDoc->UpdateTblFlds( &aMsgHnt );
+ }
+
+ SwTblNumFmtMerge aTNFM( *pCpyDoc, *pDoc );
+
+ sal_Bool bDelCntnt = sal_True;
+ const SwTableBox* pTmp;
+
+ for( sal_uInt16 nLines = 0; nLines < rCpyTbl.GetTabLines().Count(); ++nLines )
+ {
+ // hole die erste Box von der Copy-Line
+ const SwTableBox* pCpyBox = rCpyTbl.GetTabLines()[nLines]
+ ->GetTabBoxes()[0];
+ while( pCpyBox->GetTabLines().Count() )
+ pCpyBox = pCpyBox->GetTabLines()[0]->GetTabBoxes()[0];
+
+ do {
+ // kopiere erst den neuen und loeschen dann den alten Inhalt
+ // (keine leeren Section erzeugen, werden sonst geloescht!)
+ lcl_CpyBox( rCpyTbl, pCpyBox, *this, pMyBox, bDelCntnt, pUndo );
+
+ if( 0 == (pTmp = pCpyBox->FindNextBox( rCpyTbl, pCpyBox, sal_False )))
+ break; // es folgt keine weitere Box mehr
+ pCpyBox = pTmp;
+
+ if( 0 == ( pTmp = pMyBox->FindNextBox( *this, pMyBox, sal_False )))
+ bDelCntnt = sal_False; // kein Platz mehr ??
+ else
+ pMyBox = (SwTableBox*)pTmp;
+
+ } while( sal_True );
+
+ // suche die oberste Line
+ SwTableLine* pNxtLine = pMyBox->GetUpper();
+ while( pNxtLine->GetUpper() )
+ pNxtLine = pNxtLine->GetUpper()->GetUpper();
+ sal_uInt16 nPos = GetTabLines().C40_GETPOS( SwTableLine, pNxtLine );
+ // gibt es eine naechste ??
+ if( nPos + 1 >= GetTabLines().Count() )
+ bDelCntnt = sal_False; // es gibt keine, alles in die letzte Box
+ else
+ {
+ // suche die naechste "Inhaltstragende Box"
+ pNxtLine = GetTabLines()[ nPos+1 ];
+ pMyBox = pNxtLine->GetTabBoxes()[0];
+ while( pMyBox->GetTabLines().Count() )
+ pMyBox = pMyBox->GetTabLines()[0]->GetTabBoxes()[0];
+ bDelCntnt = sal_True;
+ }
+ }
+
+ aFndBox.MakeFrms( pTblNd->GetTable() ); // erzeuge die Frames neu
+ return sal_True;
+}
+
+
+sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes,
+ SwUndoTblCpyTbl* pUndo )
+{
+ ASSERT( rSelBoxes.Count(), "Missing selection" )
+
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ if( IsNewModel() || rCpyTbl.IsNewModel() )
+ return InsNewTable( rCpyTbl, rSelBoxes, pUndo );
+
+ ASSERT( !rCpyTbl.IsTblComplex(), "Table too complex" )
+
+ SwDoc* pDoc = GetFrmFmt()->GetDoc();
+ SwDoc* pCpyDoc = rCpyTbl.GetFrmFmt()->GetDoc();
+
+ SwTblNumFmtMerge aTNFM( *pCpyDoc, *pDoc );
+
+ SwTableBox *pTmpBox, *pSttBox = (SwTableBox*)rSelBoxes[0];
+
+ sal_uInt16 nLn, nBx;
+ _FndLine *pFLine, *pInsFLine = 0;
+ _FndBox aFndBox( 0, 0 );
+ // suche alle Boxen / Lines
+ {
+ _FndPara aPara( rSelBoxes, &aFndBox );
+ ((SwTableLines&)GetTabLines()).ForEach( &_FndLineCopyCol, &aPara );
+ }
+
+ // JP 06.09.96: Sonderfall - eine Box in der Tabelle -> in alle
+ // selektierten Boxen kopieren!
+ if( 1 != rCpyTbl.GetTabSortBoxes().Count() )
+ {
+ SwTableLine* pSttLine = pSttBox->GetUpper();
+ sal_uInt16 nSttBox = pSttLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSttBox );
+ sal_uInt16 nSttLine = GetTabLines().C40_GETPOS( SwTableLine, pSttLine );
+ _FndBox* pFndBox;
+
+ sal_uInt16 nFndCnt = aFndBox.GetLines().Count();
+ if( !nFndCnt )
+ return sal_False;
+
+ // teste ob genug Platz fuer die einzelnen Lines und Boxen ist:
+ sal_uInt16 nTstLns = 0;
+ pFLine = aFndBox.GetLines()[ 0 ];
+ pSttLine = pFLine->GetLine();
+ nSttLine = GetTabLines().C40_GETPOS( SwTableLine, pSttLine );
+ // sind ueberhaupt soviele Zeilen vorhanden
+ if( 1 == nFndCnt )
+ {
+ // in der Tabelle noch genug Platz ??
+ if( (GetTabLines().Count() - nSttLine ) <
+ rCpyTbl.GetTabLines().Count() )
+ {
+ // sollte nicht mehr soviele Lines vorhanden sein, dann
+ // teste, ob man durch einfuegen neuer zum Ziel kommt. Aber
+ // nur wenn die SSelection eine Box umfasst !!
+ if( 1 < rSelBoxes.Count() )
+ return sal_False;
+
+ sal_uInt16 nNewLns = rCpyTbl.GetTabLines().Count() -
+ (GetTabLines().Count() - nSttLine );
+
+ // Dann teste mal ob die Anzahl der Boxen fuer die Lines reicht
+ SwTableLine* pLastLn = GetTabLines()[ GetTabLines().Count()-1 ];
+
+ pSttBox = pFLine->GetBoxes()[0]->GetBox();
+ nSttBox = pFLine->GetLine()->GetTabBoxes().C40_GETPOS( SwTableBox, pSttBox );
+ for( sal_uInt16 n = rCpyTbl.GetTabLines().Count() - nNewLns;
+ n < rCpyTbl.GetTabLines().Count(); ++n )
+ {
+ SwTableLine* pCpyLn = rCpyTbl.GetTabLines()[ n ];
+
+ if( pLastLn->GetTabBoxes().Count() < nSttBox ||
+ ( pLastLn->GetTabBoxes().Count() - nSttBox ) <
+ pCpyLn->GetTabBoxes().Count() )
+ return sal_False;
+
+ // Test auf Verschachtelungen
+ for( nBx = 0; nBx < pCpyLn->GetTabBoxes().Count(); ++nBx )
+ if( !( pTmpBox = pLastLn->GetTabBoxes()[ nSttBox + nBx ])
+ ->GetSttNd() )
+ return sal_False;
+ }
+ // es ist also Platz fuer das zu kopierende vorhanden, also
+ // fuege entsprechend neue Zeilen ein.
+ SwTableBox* pInsBox = pLastLn->GetTabBoxes()[ nSttBox ];
+ ASSERT( pInsBox && pInsBox->GetSttNd(),
+ "kein CntntBox oder steht nicht in dieser Tabelle" );
+ SwSelBoxes aBoxes;
+
+ if( pUndo
+ ? !pUndo->InsertRow( *this, SelLineFromBox( pInsBox,
+ aBoxes, sal_True ), nNewLns )
+ : !InsertRow( pDoc, SelLineFromBox( pInsBox,
+ aBoxes, sal_True ), nNewLns, sal_True ) )
+ return sal_False;
+ }
+
+ nTstLns = rCpyTbl.GetTabLines().Count(); // soviele Kopieren
+ }
+ else if( 0 == (nFndCnt % rCpyTbl.GetTabLines().Count()) )
+ nTstLns = nFndCnt;
+ else
+ return sal_False; // kein Platz fuer die Zeilen
+
+ for( nLn = 0; nLn < nTstLns; ++nLn )
+ {
+ // Zeilen sind genug vorhanden, dann ueberpruefe die Boxen
+ // je Zeile
+ pFLine = aFndBox.GetLines()[ nLn % nFndCnt ];
+ SwTableLine* pLine = pFLine->GetLine();
+ pSttBox = pFLine->GetBoxes()[0]->GetBox();
+ nSttBox = pLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSttBox );
+ if( nLn >= nFndCnt )
+ {
+ // es sind im ClipBoard mehr Zeilen als selectiert wurden
+ pInsFLine = new _FndLine( GetTabLines()[ nSttLine + nLn ],
+ &aFndBox );
+ pLine = pInsFLine->GetLine();
+ }
+ SwTableLine* pCpyLn = rCpyTbl.GetTabLines()[ nLn %
+ rCpyTbl.GetTabLines().Count() ];
+
+ // zu wenig Zeilen selektiert ?
+ if( pInsFLine )
+ {
+ // eine neue Zeile wird in die FndBox eingefuegt,
+ if( pLine->GetTabBoxes().Count() < nSttBox ||
+ ( pLine->GetTabBoxes().Count() - nSttBox ) <
+ pFLine->GetBoxes().Count() )
+ return sal_False;
+
+ // Test auf Verschachtelungen
+ for( nBx = 0; nBx < pFLine->GetBoxes().Count(); ++nBx )
+ {
+ if( !( pTmpBox = pLine->GetTabBoxes()[ nSttBox + nBx ])
+ ->GetSttNd() )
+ return sal_False;
+ // wenn Ok, fuege die Box in die FndLine zu
+ pFndBox = new _FndBox( pTmpBox, pInsFLine );
+ pInsFLine->GetBoxes().C40_INSERT( _FndBox, pFndBox, nBx );
+ }
+ aFndBox.GetLines().C40_INSERT( _FndLine, pInsFLine, nLn );
+ }
+ else if( pFLine->GetBoxes().Count() == 1 )
+ {
+ if( pLine->GetTabBoxes().Count() < nSttBox ||
+ ( pLine->GetTabBoxes().Count() - nSttBox ) <
+ pCpyLn->GetTabBoxes().Count() )
+ return sal_False;
+
+ // Test auf Verschachtelungen
+ for( nBx = 0; nBx < pCpyLn->GetTabBoxes().Count(); ++nBx )
+ {
+ if( !( pTmpBox = pLine->GetTabBoxes()[ nSttBox + nBx ])
+ ->GetSttNd() )
+ return sal_False;
+ // wenn Ok, fuege die Box in die FndLine zu
+ if( nBx == pFLine->GetBoxes().Count() )
+ {
+ pFndBox = new _FndBox( pTmpBox, pFLine );
+ pFLine->GetBoxes().C40_INSERT( _FndBox, pFndBox, nBx );
+ }
+ }
+ }
+ else
+ {
+ // ueberpruefe die selektierten Boxen mit denen im Clipboard
+ // (n-Fach)
+ if( 0 != ( pFLine->GetBoxes().Count() %
+ pCpyLn->GetTabBoxes().Count() ))
+ return sal_False;
+
+ // Test auf Verschachtelungen
+ for( nBx = 0; nBx < pFLine->GetBoxes().Count(); ++nBx )
+ if( !pFLine->GetBoxes()[ nBx ]->GetBox()->GetSttNd() )
+ return sal_False;
+ }
+ }
+
+ if( !aFndBox.GetLines().Count() )
+ return sal_False;
+ }
+
+ {
+ // Tabellen-Formeln in die relative Darstellung umwandeln
+ SwTableFmlUpdate aMsgHnt( &rCpyTbl );
+ aMsgHnt.eFlags = TBL_RELBOXNAME;
+ pCpyDoc->UpdateTblFlds( &aMsgHnt );
+ }
+
+ // loesche die Frames
+ aFndBox.SetTableLines( *this );
+ aFndBox.DelFrms( *this );
+
+ if( 1 == rCpyTbl.GetTabSortBoxes().Count() )
+ {
+ SwTableBox *pTmpBx = rCpyTbl.GetTabSortBoxes()[0];
+ for( sal_uInt16 n = 0; n < rSelBoxes.Count(); ++n )
+ lcl_CpyBox( rCpyTbl, pTmpBx, *this,
+ (SwTableBox*)rSelBoxes[n], sal_True, pUndo );
+ }
+ else
+ for( nLn = 0; nLn < aFndBox.GetLines().Count(); ++nLn )
+ {
+ pFLine = aFndBox.GetLines()[ nLn ];
+ SwTableLine* pCpyLn = rCpyTbl.GetTabLines()[
+ nLn % rCpyTbl.GetTabLines().Count() ];
+ for( nBx = 0; nBx < pFLine->GetBoxes().Count(); ++nBx )
+ {
+ // Kopiere in pMyBox die pCpyBox
+ lcl_CpyBox( rCpyTbl, pCpyLn->GetTabBoxes()[
+ nBx % pCpyLn->GetTabBoxes().Count() ],
+ *this, pFLine->GetBoxes()[ nBx ]->GetBox(), sal_True, pUndo );
+ }
+ }
+
+ aFndBox.MakeFrms( *this );
+ return sal_True;
+}
+
+
+
+sal_Bool _FndCntntBox( const SwTableBox*& rpBox, void* pPara )
+{
+ SwTableBox* pBox = (SwTableBox*)rpBox;
+ if( rpBox->GetTabLines().Count() )
+ pBox->GetTabLines().ForEach( &_FndCntntLine, pPara );
+ else
+ ((SwSelBoxes*)pPara)->Insert( pBox );
+ return sal_True;
+}
+
+
+sal_Bool _FndCntntLine( const SwTableLine*& rpLine, void* pPara )
+{
+ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &_FndCntntBox, pPara );
+ return sal_True;
+}
+
+
+// suche alle Inhaltstragenden-Boxen dieser Box
+SwSelBoxes& SwTable::SelLineFromBox( const SwTableBox* pBox,
+ SwSelBoxes& rBoxes, sal_Bool bToTop ) const
+{
+ SwTableLine* pLine = (SwTableLine*)pBox->GetUpper();
+ if( bToTop )
+ while( pLine->GetUpper() )
+ pLine = pLine->GetUpper()->GetUpper();
+
+ // alle alten loeschen
+ rBoxes.Remove( sal_uInt16(0), rBoxes.Count() );
+ pLine->GetTabBoxes().ForEach( &_FndCntntBox, &rBoxes );
+ return rBoxes;
+}
+
+
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
new file mode 100644
index 000000000000..a71c0e170834
--- /dev/null
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -0,0 +1,4763 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <hintids.hxx>
+
+#define _ZFORLIST_DECLARE_TABLE
+#include <editeng/brshitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <tools/fract.hxx>
+#include <fmtfsize.hxx>
+#include <fmtornt.hxx>
+#include <doc.hxx>
+#include <cntfrm.hxx>
+#include <tabfrm.hxx>
+#include <frmtool.hxx>
+#include <pam.hxx>
+#include <swtable.hxx>
+#include <ndtxt.hxx>
+#include <tblsel.hxx>
+#include <fldbas.hxx>
+#include <swundo.hxx>
+#include <rowfrm.hxx>
+#include <ddefld.hxx>
+#include <hints.hxx>
+#include <UndoTable.hxx>
+#include <cellatr.hxx>
+#include <mvsave.hxx>
+#include <swtblfmt.hxx>
+#include <swddetbl.hxx>
+#include <poolfmt.hxx>
+#include <tblrwcl.hxx>
+#include <unochart.hxx>
+#include <boost/shared_ptr.hpp>
+#include <switerator.hxx>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+
+#define COLFUZZY 20
+#define ROWFUZZY 10
+
+using namespace ::com::sun::star;
+
+#ifndef DBG_UTIL
+#define CHECK_TABLE(t)
+#else
+#ifdef DEBUG
+#define CHECK_TABLE(t) (t).CheckConsistency();
+#else
+#define CHECK_TABLE(t)
+#endif
+#endif
+
+typedef SwTableLine* SwTableLinePtr;
+SV_DECL_PTRARR_SORT( SwSortTableLines, SwTableLinePtr, 16, 16 )
+SV_IMPL_PTRARR_SORT( SwSortTableLines, SwTableLinePtr );
+
+SV_IMPL_PTRARR( _SwShareBoxFmts, SwShareBoxFmt* )
+
+// fuers setzen der Frame-Formate an den Boxen reicht es, das aktuelle
+// im Array zu suchen. Ist es vorhanden, so gebe das neue zurueck
+struct _CpyTabFrm
+{
+ union {
+ SwTableBoxFmt *pFrmFmt; // fuer CopyCol
+ SwTwips nSize; // fuer DelCol
+ } Value;
+ SwTableBoxFmt *pNewFrmFmt;
+
+ _CpyTabFrm( SwTableBoxFmt* pAktFrmFmt ) : pNewFrmFmt( 0 )
+ { Value.pFrmFmt = pAktFrmFmt; }
+
+ _CpyTabFrm& operator=( const _CpyTabFrm& );
+
+ sal_Bool operator==( const _CpyTabFrm& rCpyTabFrm )
+ { return (sal_uLong)Value.nSize == (sal_uLong)rCpyTabFrm.Value.nSize; }
+ sal_Bool operator<( const _CpyTabFrm& rCpyTabFrm )
+ { return (sal_uLong)Value.nSize < (sal_uLong)rCpyTabFrm.Value.nSize; }
+};
+
+struct CR_SetBoxWidth
+{
+ SwSelBoxes aBoxes;
+ SwSortTableLines aLines;
+ SvUShorts aLinesWidth;
+ SwShareBoxFmts aShareFmts;
+ SwTableNode* pTblNd;
+ SwUndoTblNdsChg* pUndo;
+ SwTwips nDiff, nSide, nMaxSize, nLowerDiff;
+ TblChgMode nMode;
+ sal_uInt16 nTblWidth, nRemainWidth, nBoxWidth;
+ sal_Bool bBigger, bLeft, bSplittBox, bAnyBoxFnd;
+
+ CR_SetBoxWidth( sal_uInt16 eType, SwTwips nDif, SwTwips nSid, SwTwips nTblW,
+ SwTwips nMax, SwTableNode* pTNd )
+ : pTblNd( pTNd ),
+ nDiff( nDif ), nSide( nSid ), nMaxSize( nMax ), nLowerDiff( 0 ),
+ nTblWidth( (sal_uInt16)nTblW ), nRemainWidth( 0 ), nBoxWidth( 0 ),
+ bSplittBox( sal_False ), bAnyBoxFnd( sal_False )
+ {
+ bLeft = nsTblChgWidthHeightType::WH_COL_LEFT == ( eType & 0xff ) ||
+ nsTblChgWidthHeightType::WH_CELL_LEFT == ( eType & 0xff );
+ bBigger = 0 != (eType & nsTblChgWidthHeightType::WH_FLAG_BIGGER );
+ nMode = pTblNd->GetTable().GetTblChgMode();
+ }
+ CR_SetBoxWidth( const CR_SetBoxWidth& rCpy )
+ : pTblNd( rCpy.pTblNd ),
+ pUndo( rCpy.pUndo ),
+ nDiff( rCpy.nDiff ), nSide( rCpy.nSide ),
+ nMaxSize( rCpy.nMaxSize ), nLowerDiff( 0 ),
+ nMode( rCpy.nMode ), nTblWidth( rCpy.nTblWidth ),
+ nRemainWidth( rCpy.nRemainWidth ), nBoxWidth( nBoxWidth ),
+ bBigger( rCpy.bBigger ), bLeft( rCpy.bLeft ),
+ bSplittBox( rCpy.bSplittBox ), bAnyBoxFnd( rCpy.bAnyBoxFnd )
+ {
+ aLines.Insert( &rCpy.aLines );
+ aLinesWidth.Insert( &rCpy.aLinesWidth, 0 );
+ }
+
+ SwUndoTblNdsChg* CreateUndo( SwUndoId eUndoType )
+ {
+ return pUndo = new SwUndoTblNdsChg( eUndoType, aBoxes, *pTblNd );
+ }
+
+ void LoopClear()
+ {
+ nLowerDiff = 0; nRemainWidth = 0;
+ }
+
+ void AddBoxWidth( const SwTableBox& rBox, sal_uInt16 nWidth )
+ {
+ SwTableLinePtr p = (SwTableLine*)rBox.GetUpper();
+ sal_uInt16 nFndPos;
+ if( aLines.Insert( p, nFndPos ))
+ aLinesWidth.Insert( nWidth, nFndPos );
+ else
+ aLinesWidth[ nFndPos ] = aLinesWidth[ nFndPos ] + nWidth;
+ }
+
+ sal_uInt16 GetBoxWidth( const SwTableLine& rLn ) const
+ {
+ SwTableLinePtr p = (SwTableLine*)&rLn;
+ sal_uInt16 nFndPos;
+ if( aLines.Seek_Entry( p, &nFndPos ) )
+ nFndPos = aLinesWidth[ nFndPos ];
+ else
+ nFndPos = 0;
+ return nFndPos;
+ }
+};
+
+sal_Bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck );
+sal_Bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck );
+sal_Bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck );
+sal_Bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck );
+sal_Bool lcl_DelSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck );
+sal_Bool lcl_DelOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck );
+
+typedef sal_Bool (*FN_lcl_SetBoxWidth)(SwTableLine*, CR_SetBoxWidth&, SwTwips, sal_Bool );
+
+#if defined(DBG_UTIL) || defined( JP_DEBUG )
+
+void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize );
+
+#define CHECKBOXWIDTH \
+ { \
+ SwTwips nSize = GetFrmFmt()->GetFrmSize().GetWidth(); \
+ for( sal_uInt16 nTmp = 0; nTmp < aLines.Count(); ++nTmp ) \
+ ::_CheckBoxWidth( *aLines[ nTmp ], nSize ); \
+ }
+
+#define CHECKTABLELAYOUT \
+ { \
+ for ( sal_uInt16 i = 0; i < GetTabLines().Count(); ++i ) \
+ { \
+ SwFrmFmt* pFmt = GetTabLines()[i]->GetFrmFmt(); \
+ SwIterator<SwRowFrm,SwFmt> aIter( *pFmt ); \
+ for (SwRowFrm* pFrm=aIter.First(); pFrm; pFrm=aIter.Next())\
+ { \
+ if ( pFrm->GetTabLine() == GetTabLines()[i] ) \
+ { \
+ ASSERT( pFrm->GetUpper()->IsTabFrm(), \
+ "Table layout does not match table structure" ) \
+ } \
+ } \
+ } \
+ }
+
+#else
+
+#define CHECKBOXWIDTH
+#define CHECKTABLELAYOUT
+
+#endif
+
+
+struct CR_SetLineHeight
+{
+ SwSelBoxes aBoxes;
+ SwShareBoxFmts aShareFmts;
+ SwTableNode* pTblNd;
+ SwUndoTblNdsChg* pUndo;
+ SwTwips nMaxSpace, nMaxHeight;
+ TblChgMode nMode;
+ sal_uInt16 nLines;
+ sal_Bool bBigger, bTop, bSplittBox, bAnyBoxFnd;
+
+ CR_SetLineHeight( sal_uInt16 eType, SwTableNode* pTNd )
+ : pTblNd( pTNd ), pUndo( 0 ),
+ nMaxSpace( 0 ), nMaxHeight( 0 ), nLines( 0 ),
+ bSplittBox( sal_False ), bAnyBoxFnd( sal_False )
+ {
+ bTop = nsTblChgWidthHeightType::WH_ROW_TOP == ( eType & 0xff ) || nsTblChgWidthHeightType::WH_CELL_TOP == ( eType & 0xff );
+ bBigger = 0 != (eType & nsTblChgWidthHeightType::WH_FLAG_BIGGER );
+ if( eType & nsTblChgWidthHeightType::WH_FLAG_INSDEL )
+ bBigger = !bBigger;
+ nMode = pTblNd->GetTable().GetTblChgMode();
+ }
+ CR_SetLineHeight( const CR_SetLineHeight& rCpy )
+ : pTblNd( rCpy.pTblNd ), pUndo( rCpy.pUndo ),
+ nMaxSpace( rCpy.nMaxSpace ), nMaxHeight( rCpy.nMaxHeight ),
+ nMode( rCpy.nMode ), nLines( rCpy.nLines ),
+ bBigger( rCpy.bBigger ), bTop( rCpy.bTop ),
+ bSplittBox( rCpy.bSplittBox ), bAnyBoxFnd( rCpy.bAnyBoxFnd )
+ {}
+
+ SwUndoTblNdsChg* CreateUndo( SwUndoId nUndoType )
+ {
+ return pUndo = new SwUndoTblNdsChg( nUndoType, aBoxes, *pTblNd );
+ }
+};
+
+sal_Bool lcl_SetSelLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam,
+ SwTwips nDist, sal_Bool bCheck );
+sal_Bool lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam,
+ SwTwips nDist, sal_Bool bCheck );
+sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam,
+ SwTwips nDist, sal_Bool bCheck );
+
+typedef sal_Bool (*FN_lcl_SetLineHeight)(SwTableLine*, CR_SetLineHeight&, SwTwips, sal_Bool );
+
+_CpyTabFrm& _CpyTabFrm::operator=( const _CpyTabFrm& rCpyTabFrm )
+{
+ pNewFrmFmt = rCpyTabFrm.pNewFrmFmt;
+ Value = rCpyTabFrm.Value;
+ return *this;
+}
+
+SV_DECL_VARARR_SORT( _CpyTabFrms, _CpyTabFrm, 0, 50 )
+SV_IMPL_VARARR_SORT( _CpyTabFrms, _CpyTabFrm )
+
+void lcl_DelCpyTabFrmFmts( _CpyTabFrm& rArr );
+
+// ---------------------------------------------------------------
+
+struct _CpyPara
+{
+ boost::shared_ptr< std::vector< std::vector< sal_uLong > > > pWidths;
+ SwDoc* pDoc;
+ SwTableNode* pTblNd;
+ _CpyTabFrms& rTabFrmArr;
+ SwTableLine* pInsLine;
+ SwTableBox* pInsBox;
+ sal_uLong nOldSize, nNewSize; // zum Korrigieren der Size-Attribute
+ sal_uLong nMinLeft, nMaxRight;
+ sal_uInt16 nCpyCnt, nInsPos;
+ sal_uInt16 nLnIdx, nBoxIdx;
+ sal_uInt8 nDelBorderFlag;
+ sal_Bool bCpyCntnt;
+
+ _CpyPara( SwTableNode* pNd, sal_uInt16 nCopies, _CpyTabFrms& rFrmArr,
+ sal_Bool bCopyContent = sal_True )
+ : pDoc( pNd->GetDoc() ), pTblNd( pNd ), rTabFrmArr(rFrmArr),
+ pInsLine(0), pInsBox(0), nOldSize(0), nNewSize(0),
+ nMinLeft(ULONG_MAX), nMaxRight(0),
+ nCpyCnt(nCopies), nInsPos(0),
+ nLnIdx(0), nBoxIdx(0),
+ nDelBorderFlag(0), bCpyCntnt( bCopyContent )
+ {}
+ _CpyPara( const _CpyPara& rPara, SwTableLine* pLine )
+ : pWidths( rPara.pWidths ), pDoc(rPara.pDoc), pTblNd(rPara.pTblNd),
+ rTabFrmArr(rPara.rTabFrmArr), pInsLine(pLine), pInsBox(rPara.pInsBox),
+ nOldSize(0), nNewSize(rPara.nNewSize), nMinLeft( rPara.nMinLeft ),
+ nMaxRight( rPara.nMaxRight ), nCpyCnt(rPara.nCpyCnt), nInsPos(0),
+ nLnIdx( rPara.nLnIdx), nBoxIdx( rPara.nBoxIdx ),
+ nDelBorderFlag( rPara.nDelBorderFlag ), bCpyCntnt( rPara.bCpyCntnt )
+ {}
+ _CpyPara( const _CpyPara& rPara, SwTableBox* pBox )
+ : pWidths( rPara.pWidths ), pDoc(rPara.pDoc), pTblNd(rPara.pTblNd),
+ rTabFrmArr(rPara.rTabFrmArr), pInsLine(rPara.pInsLine), pInsBox(pBox),
+ nOldSize(rPara.nOldSize), nNewSize(rPara.nNewSize),
+ nMinLeft( rPara.nMinLeft ), nMaxRight( rPara.nMaxRight ),
+ nCpyCnt(rPara.nCpyCnt), nInsPos(0), nLnIdx(rPara.nLnIdx), nBoxIdx(rPara.nBoxIdx),
+ nDelBorderFlag( rPara.nDelBorderFlag ), bCpyCntnt( rPara.bCpyCntnt )
+ {}
+ void SetBoxWidth( SwTableBox* pBox );
+};
+
+
+sal_Bool lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara )
+{
+ _CpyPara* pCpyPara = (_CpyPara*)pPara;
+
+ // suche das FrmFmt im Array aller Frame-Formate
+ SwTableBox* pBox = (SwTableBox*)rpFndBox->GetBox();
+ _CpyTabFrm aFindFrm( (SwTableBoxFmt*)pBox->GetFrmFmt() );
+
+ sal_uInt16 nFndPos;
+ if( pCpyPara->nCpyCnt )
+ {
+ if( !pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos ))
+ {
+ // fuer das verschachtelte Kopieren sicher auch das neue Format
+ // als alt.
+ SwTableBoxFmt* pNewFmt = (SwTableBoxFmt*)pBox->ClaimFrmFmt();
+
+ // suche die selektierten Boxen in der Line:
+ _FndLine* pCmpLine = NULL;
+ SwFmtFrmSize aFrmSz( pNewFmt->GetFrmSize() );
+
+ 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();
+ long nSz = 0;
+ for( sal_uInt16 n = rFndBoxes.Count(); n; )
+ nSz += rFndBoxes[ --n ]->GetBox()->GetFrmFmt()->GetFrmSize().GetWidth();
+ aFrmSz.SetWidth( aFrmSz.GetWidth() -
+ nSz / ( pCpyPara->nCpyCnt + 1 ) );
+ pNewFmt->SetFmtAttr( aFrmSz );
+ aFrmSz.SetWidth( nSz / ( pCpyPara->nCpyCnt + 1 ) );
+
+ // fuer die neue Box ein neues Format mit der Groesse anlegen!
+ aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pNewFmt->GetDoc()->
+ MakeTableLineFmt();
+ *aFindFrm.pNewFrmFmt = *pNewFmt;
+ aFindFrm.pNewFrmFmt->SetFmtAttr( aFrmSz );
+ }
+ else
+ {
+ aFrmSz.SetWidth( aFrmSz.GetWidth() / ( pCpyPara->nCpyCnt + 1 ) );
+ pNewFmt->SetFmtAttr( aFrmSz );
+
+ aFindFrm.pNewFrmFmt = pNewFmt;
+ pCpyPara->rTabFrmArr.Insert( aFindFrm );
+ aFindFrm.Value.pFrmFmt = pNewFmt;
+ pCpyPara->rTabFrmArr.Insert( aFindFrm );
+ }
+ }
+ else
+ {
+ aFindFrm = pCpyPara->rTabFrmArr[ nFndPos ];
+// aFindFrm.pNewFrmFmt->Add( pBox );
+ pBox->ChgFrmFmt( (SwTableBoxFmt*)aFindFrm.pNewFrmFmt );
+ }
+ }
+ else
+ {
+ if( pCpyPara->nDelBorderFlag &&
+ pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos ))
+ aFindFrm = pCpyPara->rTabFrmArr[ nFndPos ];
+ else
+ aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pBox->GetFrmFmt();
+ }
+
+ if( rpFndBox->GetLines().Count() )
+ {
+ pBox = new SwTableBox( aFindFrm.pNewFrmFmt,
+ rpFndBox->GetLines().Count(), pCpyPara->pInsLine );
+ pCpyPara->pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, pCpyPara->nInsPos++);
+ _CpyPara aPara( *pCpyPara, pBox );
+ aPara.nDelBorderFlag &= 7;
+
+ ((_FndBox*)rpFndBox)->GetLines().ForEach( &lcl_CopyRow, &aPara );
+ }
+ else
+ {
+ ::_InsTblBox( pCpyPara->pDoc, pCpyPara->pTblNd, pCpyPara->pInsLine,
+ aFindFrm.pNewFrmFmt, pBox, pCpyPara->nInsPos++ );
+
+ const _FndBoxes& rFndBxs = rpFndBox->GetUpper()->GetBoxes();
+ if( 8 > pCpyPara->nDelBorderFlag
+ ? pCpyPara->nDelBorderFlag
+ : rpFndBox == rFndBxs[ rFndBxs.Count() - 1 ] )
+ {
+ const SvxBoxItem& rBoxItem = pBox->GetFrmFmt()->GetBox();
+ if( 8 > pCpyPara->nDelBorderFlag
+ ? rBoxItem.GetTop()
+ : rBoxItem.GetRight() )
+ {
+ aFindFrm.Value.pFrmFmt = (SwTableBoxFmt*)pBox->GetFrmFmt();
+
+ SvxBoxItem aNew( rBoxItem );
+ if( 8 > pCpyPara->nDelBorderFlag )
+ aNew.SetLine( 0, BOX_LINE_TOP );
+ else
+ aNew.SetLine( 0, BOX_LINE_RIGHT );
+
+ if( 1 == pCpyPara->nDelBorderFlag ||
+ 8 == pCpyPara->nDelBorderFlag )
+ {
+ // es wird dahinter kopiert, bei allen Boxen die
+ // TopBorderLine loeschen
+ pBox = pCpyPara->pInsLine->GetTabBoxes()[
+ pCpyPara->nInsPos - 1 ];
+ }
+
+ aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pBox->GetFrmFmt();
+
+ // ansonsten wird davor kopiert und die erste Line behaelt
+ // die TopLine und an der originalen wird sie entfernt
+ pBox->ClaimFrmFmt()->SetFmtAttr( aNew );
+
+ if( !pCpyPara->nCpyCnt )
+ pCpyPara->rTabFrmArr.Insert( aFindFrm );
+ }
+ }
+ }
+ return sal_True;
+}
+
+sal_Bool lcl_CopyRow( const _FndLine*& rpFndLine, void* pPara )
+{
+ _CpyPara* pCpyPara = (_CpyPara*)pPara;
+ SwTableLine* pNewLine = new SwTableLine(
+ (SwTableLineFmt*)rpFndLine->GetLine()->GetFrmFmt(),
+ rpFndLine->GetBoxes().Count(), pCpyPara->pInsBox );
+ if( pCpyPara->pInsBox )
+ {
+ pCpyPara->pInsBox->GetTabLines().C40_INSERT( SwTableLine, pNewLine, pCpyPara->nInsPos++ );
+ }
+ else
+ {
+ pCpyPara->pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pNewLine,
+ pCpyPara->nInsPos++ );
+ }
+
+ _CpyPara aPara( *pCpyPara, pNewLine );
+ ((_FndLine*)rpFndLine)->GetBoxes().ForEach( &lcl_CopyCol, &aPara );
+
+ pCpyPara->nDelBorderFlag &= 0xf8;
+ return sal_True;
+}
+
+//-----------------------------------------------------------
+
+void lcl_InsCol( _FndLine* pFndLn, _CpyPara& rCpyPara, sal_uInt16 nCpyCnt,
+ sal_Bool bBehind )
+{
+ // Bug 29124: nicht nur in den Grundlines kopieren. Wenns geht, so weit
+ // runter wie moeglich.
+ _FndBox* pFBox;
+ if( 1 == pFndLn->GetBoxes().Count() &&
+ !( pFBox = pFndLn->GetBoxes()[ 0 ] )->GetBox()->GetSttNd() )
+ {
+ // eine Box mit mehreren Lines, also in diese Lines einfuegen
+ for( sal_uInt16 n = 0; n < pFBox->GetLines().Count(); ++n )
+ lcl_InsCol( pFBox->GetLines()[ n ], rCpyPara, nCpyCnt, bBehind );
+ }
+ else
+ {
+ rCpyPara.pInsLine = pFndLn->GetLine();
+ SwTableBox* pBox = pFndLn->GetBoxes()[ bBehind ?
+ pFndLn->GetBoxes().Count()-1 : 0 ]->GetBox();
+ rCpyPara.nInsPos = pFndLn->GetLine()->GetTabBoxes().C40_GETPOS( SwTableBox, pBox );
+ if( bBehind )
+ ++rCpyPara.nInsPos;
+
+ for( sal_uInt16 n = 0; n < nCpyCnt; ++n )
+ {
+ if( n + 1 == nCpyCnt && bBehind )
+ rCpyPara.nDelBorderFlag = 9;
+ else
+ rCpyPara.nDelBorderFlag = 8;
+ pFndLn->GetBoxes().ForEach( &lcl_CopyCol, &rCpyPara );
+ }
+ }
+}
+
+SwRowFrm* GetRowFrm( SwTableLine& rLine )
+{
+ SwIterator<SwRowFrm,SwFmt> aIter( *rLine.GetFrmFmt() );
+ for( SwRowFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() )
+ if( pFrm->GetTabLine() == &rLine )
+ return pFrm;
+ return 0;
+}
+
+
+sal_Bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind )
+{
+ ASSERT( rBoxes.Count() && nCnt, "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ sal_Bool bRes = sal_True;
+ if( IsNewModel() )
+ bRes = NewInsertCol( pDoc, rBoxes, nCnt, bBehind );
+ else
+ {
+ // suche alle Boxen / Lines
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aPara( rBoxes, &aFndBox );
+ GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ }
+ if( !aFndBox.GetLines().Count() )
+ return sal_False;
+
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ //Lines fuer das Layout-Update herausuchen.
+ aFndBox.SetTableLines( *this );
+ aFndBox.DelFrms( *this );
+
+ // TL_CHART2: nothing to be done since chart2 currently does not want to
+ // get notified about new rows/cols.
+
+ _CpyTabFrms aTabFrmArr;
+ _CpyPara aCpyPara( pTblNd, nCnt, aTabFrmArr );
+
+ for( sal_uInt16 n = 0; n < aFndBox.GetLines().Count(); ++n )
+ lcl_InsCol( aFndBox.GetLines()[ n ], aCpyPara, nCnt, bBehind );
+
+ // dann raeume die Struktur dieser Line noch mal auf, generell alle
+ GCLines();
+
+ //Layout updaten
+ aFndBox.MakeFrms( *this );
+
+ CHECKBOXWIDTH
+ CHECKTABLELAYOUT
+ bRes = sal_True;
+ }
+
+ SwChartDataProvider *pPCD = pDoc->GetChartDataProvider();
+ if (pPCD && nCnt)
+ pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind );
+ pDoc->UpdateCharts( GetFrmFmt()->GetName() );
+
+ return bRes;
+}
+
+sal_Bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes,
+ sal_uInt16 nCnt, sal_Bool bBehind )
+{
+ ASSERT( pDoc && rBoxes.Count() && nCnt, "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ // suche alle Boxen / Lines
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aPara( rBoxes, &aFndBox );
+ GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ }
+ if( !aFndBox.GetLines().Count() )
+ return sal_False;
+
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ _FndBox* pFndBox = &aFndBox;
+ {
+ _FndLine* pFndLine;
+ while( 1 == pFndBox->GetLines().Count() &&
+ 1 == ( pFndLine = pFndBox->GetLines()[ 0 ])->GetBoxes().Count() )
+ {
+ // nicht zu weit runter, eine Line mit Boxen muss nachbleiben!!
+ _FndBox* pTmpBox = pFndLine->GetBoxes()[ 0 ];
+ if( pTmpBox->GetLines().Count() )
+ pFndBox = pTmpBox;
+ else
+ break;
+ }
+ }
+
+ //Lines fuer das Layout-Update herausuchen.
+ const sal_Bool bLayout = !IsNewModel() &&
+ 0 != SwIterator<SwTabFrm,SwFmt>::FirstElement( *GetFrmFmt() );
+
+ if ( bLayout )
+ {
+ aFndBox.SetTableLines( *this );
+ if( pFndBox != &aFndBox )
+ aFndBox.DelFrms( *this );
+ // TL_CHART2: nothing to be done since chart2 currently does not want to
+ // get notified about new rows/cols.
+ }
+
+ _CpyTabFrms aTabFrmArr;
+ _CpyPara aCpyPara( pTblNd, 0, aTabFrmArr );
+
+ SwTableLine* pLine = pFndBox->GetLines()[ bBehind ?
+ pFndBox->GetLines().Count()-1 : 0 ]->GetLine();
+ if( &aFndBox == pFndBox )
+ aCpyPara.nInsPos = GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ else
+ {
+ aCpyPara.pInsBox = pFndBox->GetBox();
+ aCpyPara.nInsPos = pFndBox->GetBox()->GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ }
+
+ if( bBehind )
+ {
+ ++aCpyPara.nInsPos;
+ aCpyPara.nDelBorderFlag = 1;
+ }
+ else
+ aCpyPara.nDelBorderFlag = 2;
+
+ for( sal_uInt16 nCpyCnt = 0; nCpyCnt < nCnt; ++nCpyCnt )
+ {
+ if( bBehind )
+ aCpyPara.nDelBorderFlag = 1;
+ pFndBox->GetLines().ForEach( &lcl_CopyRow, &aCpyPara );
+ }
+
+ // dann raeume die Struktur dieser Line noch mal auf, generell alle
+ if( !pDoc->IsInReading() )
+ GCLines();
+
+ //Layout updaten
+ if ( bLayout )
+ {
+ if( pFndBox != &aFndBox )
+ aFndBox.MakeFrms( *this );
+ else
+ aFndBox.MakeNewFrms( *this, nCnt, bBehind );
+ }
+
+ CHECKBOXWIDTH
+ CHECKTABLELAYOUT
+
+ SwChartDataProvider *pPCD = pDoc->GetChartDataProvider();
+ if (pPCD && nCnt)
+ pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind );
+ pDoc->UpdateCharts( GetFrmFmt()->GetName() );
+
+ return sal_True;
+}
+
+sal_Bool _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara );
+
+sal_Bool _FndBoxAppendRowBox( const SwTableBox*& rpBox, void* pPara )
+{
+ _FndPara* pFndPara = (_FndPara*)pPara;
+ _FndBox* pFndBox = new _FndBox( (SwTableBox*)rpBox, pFndPara->pFndLine );
+ if( rpBox->GetTabLines().Count() )
+ {
+ _FndPara aPara( *pFndPara, pFndBox );
+ pFndBox->GetBox()->GetTabLines().ForEach( &_FndBoxAppendRowLine, &aPara );
+ if( !pFndBox->GetLines().Count() )
+ delete pFndBox;
+ }
+ else
+ pFndPara->pFndLine->GetBoxes().C40_INSERT( _FndBox, pFndBox,
+ pFndPara->pFndLine->GetBoxes().Count() );
+ return sal_True;
+}
+
+sal_Bool _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara )
+{
+ _FndPara* pFndPara = (_FndPara*)pPara;
+ _FndLine* pFndLine = new _FndLine( (SwTableLine*)rpLine, pFndPara->pFndBox );
+ _FndPara aPara( *pFndPara, pFndLine );
+ pFndLine->GetLine()->GetTabBoxes().ForEach( &_FndBoxAppendRowBox, &aPara );
+ if( pFndLine->GetBoxes().Count() )
+ {
+ pFndPara->pFndBox->GetLines().C40_INSERT( _FndLine, pFndLine,
+ pFndPara->pFndBox->GetLines().Count() );
+ }
+ else
+ delete pFndLine;
+ return sal_True;
+}
+
+
+sal_Bool SwTable::AppendRow( SwDoc* pDoc, sal_uInt16 nCnt )
+{
+ SwTableNode* pTblNd = (SwTableNode*)aSortCntBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ // suche alle Boxen / Lines
+ _FndBox aFndBox( 0, 0 );
+ {
+ const SwTableLine* pLLine = GetTabLines()[ GetTabLines().Count()-1 ];
+
+ const SwSelBoxes* pBxs = 0; // Dummy !!!
+ _FndPara aPara( *pBxs, &aFndBox );
+
+ _FndBoxAppendRowLine( pLLine, &aPara );
+ }
+ if( !aFndBox.GetLines().Count() )
+ return sal_False;
+
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ //Lines fuer das Layout-Update herausuchen.
+ bool bLayout = 0 != SwIterator<SwTabFrm,SwFmt>::FirstElement( *GetFrmFmt() );
+ if( bLayout )
+ {
+ aFndBox.SetTableLines( *this );
+ // TL_CHART2: nothing to be done since chart2 currently does not want to
+ // get notified about new rows/cols.
+ }
+
+ _CpyTabFrms aTabFrmArr;
+ _CpyPara aCpyPara( pTblNd, 0, aTabFrmArr );
+ aCpyPara.nInsPos = GetTabLines().Count();
+ aCpyPara.nDelBorderFlag = 1;
+
+ for( sal_uInt16 nCpyCnt = 0; nCpyCnt < nCnt; ++nCpyCnt )
+ {
+ aCpyPara.nDelBorderFlag = 1;
+ aFndBox.GetLines().ForEach( &lcl_CopyRow, &aCpyPara );
+ }
+
+ // dann raeume die Struktur dieser Line noch mal auf, generell alle
+ if( !pDoc->IsInReading() )
+ GCLines();
+
+ //Layout updaten
+ if ( bLayout )
+ {
+ aFndBox.MakeNewFrms( *this, nCnt, sal_True );
+ }
+ // TL_CHART2: need to inform chart of probably changed cell names
+ pDoc->UpdateCharts( GetFrmFmt()->GetName() );
+
+ CHECKBOXWIDTH
+ CHECKTABLELAYOUT
+
+ return sal_True;
+}
+
+
+void lcl_LastBoxSetWidth( SwTableBoxes &rBoxes, const long nOffset,
+ sal_Bool bFirst, SwShareBoxFmts& rShareFmts );
+
+void lcl_LastBoxSetWidthLine( SwTableLines &rLines, const long nOffset,
+ sal_Bool bFirst, SwShareBoxFmts& rShareFmts )
+{
+ for ( sal_uInt16 i = 0; i < rLines.Count(); ++i )
+ ::lcl_LastBoxSetWidth( rLines[i]->GetTabBoxes(), nOffset, bFirst,
+ rShareFmts );
+}
+
+void lcl_LastBoxSetWidth( SwTableBoxes &rBoxes, const long nOffset,
+ sal_Bool bFirst, SwShareBoxFmts& rShareFmts )
+{
+ SwTableBox& rBox = *rBoxes[ bFirst ? 0 : rBoxes.Count() - 1 ];
+ if( !rBox.GetSttNd() )
+ ::lcl_LastBoxSetWidthLine( rBox.GetTabLines(), nOffset,
+ bFirst, rShareFmts );
+
+ //Die Box anpassen
+ SwFrmFmt *pBoxFmt = rBox.GetFrmFmt();
+ SwFmtFrmSize aNew( pBoxFmt->GetFrmSize() );
+ aNew.SetWidth( aNew.GetWidth() + nOffset );
+ SwFrmFmt *pFmt = rShareFmts.GetFormat( *pBoxFmt, aNew );
+ if( pFmt )
+ rBox.ChgFrmFmt( (SwTableBoxFmt*)pFmt );
+ else
+ {
+ pFmt = rBox.ClaimFrmFmt();
+
+ pFmt->LockModify();
+ pFmt->SetFmtAttr( aNew );
+ pFmt->UnlockModify();
+
+ rShareFmts.AddFormat( *pBoxFmt, *pFmt );
+ }
+}
+
+void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo,
+ sal_Bool bCalcNewSize, const sal_Bool bCorrBorder,
+ SwShareBoxFmts* pShareFmts )
+{
+ do {
+ SwTwips nBoxSz = bCalcNewSize ?
+ pBox->GetFrmFmt()->GetFrmSize().GetWidth() : 0;
+ SwTableLine* pLine = pBox->GetUpper();
+ SwTableBoxes& rTblBoxes = pLine->GetTabBoxes();
+ sal_uInt16 nDelPos = rTblBoxes.C40_GETPOS( SwTableBox, pBox );
+ SwTableBox* pUpperBox = pBox->GetUpper()->GetUpper();
+
+ // Sonderbehandlung fuer Umrandung:
+ if( bCorrBorder && 1 < rTblBoxes.Count() )
+ {
+ sal_Bool bChgd = sal_False;
+ const SvxBoxItem& rBoxItem = pBox->GetFrmFmt()->GetBox();
+
+ if( rBoxItem.GetLeft() || rBoxItem.GetRight() )
+ {
+ //JP 02.04.97: 1.Teil fuer Bug 36271
+ // zuerst die linken/rechten Kanten
+ if( nDelPos + 1 < rTblBoxes.Count() )
+ {
+ SwTableBox* pNxtBox = rTblBoxes[ nDelPos + 1 ];
+ const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrmFmt()->GetBox();
+
+ SwTableBox* pPrvBox = nDelPos ? rTblBoxes[ nDelPos - 1 ] : 0;
+
+ if( pNxtBox->GetSttNd() && !rNxtBoxItem.GetLeft() &&
+ ( !pPrvBox || !pPrvBox->GetFrmFmt()->GetBox().GetRight()) )
+ {
+ SvxBoxItem aTmp( rNxtBoxItem );
+ aTmp.SetLine( rBoxItem.GetLeft() ? rBoxItem.GetLeft()
+ : rBoxItem.GetRight(),
+ BOX_LINE_LEFT );
+ if( pShareFmts )
+ pShareFmts->SetAttr( *pNxtBox, aTmp );
+ else
+ pNxtBox->ClaimFrmFmt()->SetFmtAttr( aTmp );
+ bChgd = sal_True;
+ }
+ }
+ if( !bChgd && nDelPos )
+ {
+ SwTableBox* pPrvBox = rTblBoxes[ nDelPos - 1 ];
+ const SvxBoxItem& rPrvBoxItem = pPrvBox->GetFrmFmt()->GetBox();
+
+ SwTableBox* pNxtBox = nDelPos + 1 < rTblBoxes.Count()
+ ? rTblBoxes[ nDelPos + 1 ] : 0;
+
+ if( pPrvBox->GetSttNd() && !rPrvBoxItem.GetRight() &&
+ ( !pNxtBox || !pNxtBox->GetFrmFmt()->GetBox().GetLeft()) )
+ {
+ SvxBoxItem aTmp( rPrvBoxItem );
+ aTmp.SetLine( rBoxItem.GetLeft() ? rBoxItem.GetLeft()
+ : rBoxItem.GetRight(),
+ BOX_LINE_RIGHT );
+ if( pShareFmts )
+ pShareFmts->SetAttr( *pPrvBox, aTmp );
+ else
+ pPrvBox->ClaimFrmFmt()->SetFmtAttr( aTmp );
+ }
+ }
+ }
+
+ }
+
+ // erst die Box, dann die Nodes loeschen!!
+ SwStartNode* pSttNd = (SwStartNode*)pBox->GetSttNd();
+ if( pShareFmts )
+ pShareFmts->RemoveFormat( *rTblBoxes[ nDelPos ]->GetFrmFmt() );
+ rTblBoxes.DeleteAndDestroy( nDelPos );
+
+ if( pSttNd )
+ {
+ // ist das UndoObject zum speichern der Section vorbereitet?
+ if( pUndo && pUndo->IsDelBox() )
+ ((SwUndoTblNdsChg*)pUndo)->SaveSection( pSttNd );
+ else
+ pSttNd->GetDoc()->DeleteSection( pSttNd );
+ }
+
+ // auch die Zeile noch loeschen ??
+ if( rTblBoxes.Count() )
+ {
+ // dann passe noch die Frame-SSize an
+ sal_Bool bLastBox = nDelPos == rTblBoxes.Count();
+ if( bLastBox )
+ --nDelPos;
+ pBox = rTblBoxes[nDelPos];
+ if( bCalcNewSize )
+ {
+ SwFmtFrmSize aNew( pBox->GetFrmFmt()->GetFrmSize() );
+ aNew.SetWidth( aNew.GetWidth() + nBoxSz );
+ if( pShareFmts )
+ pShareFmts->SetSize( *pBox, aNew );
+ else
+ pBox->ClaimFrmFmt()->SetFmtAttr( aNew );
+
+ if( !pBox->GetSttNd() )
+ {
+ // dann muss es auch rekursiv in allen Zeilen, in allen
+ // Zellen erfolgen!
+ SwShareBoxFmts aShareFmts;
+ ::lcl_LastBoxSetWidthLine( pBox->GetTabLines(), nBoxSz,
+ !bLastBox,
+ pShareFmts ? *pShareFmts
+ : aShareFmts );
+ }
+ }
+ break; // nichts mehr loeschen
+ }
+ // loesche die Line aus Tabelle/Box
+ if( !pUpperBox )
+ {
+ // dann loesche auch noch die Line aus der Tabelle
+ nDelPos = rTbl.GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ if( pShareFmts )
+ pShareFmts->RemoveFormat( *rTbl.GetTabLines()[ nDelPos ]->GetFrmFmt() );
+ rTbl.GetTabLines().DeleteAndDestroy( nDelPos );
+ break; // mehr kann nicht geloescht werden
+ }
+
+ // dann loesche auch noch die Line
+ pBox = pUpperBox;
+ nDelPos = pBox->GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ if( pShareFmts )
+ pShareFmts->RemoveFormat( *pBox->GetTabLines()[ nDelPos ]->GetFrmFmt() );
+ pBox->GetTabLines().DeleteAndDestroy( nDelPos );
+ } while( !pBox->GetTabLines().Count() );
+}
+
+SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns,
+ SwTwips nBoxStt, SwTwips nBoxWidth,
+ sal_uInt16 nLinePos, sal_Bool bNxt,
+ SwSelBoxes* pAllDelBoxes, sal_uInt16* pCurPos )
+{
+ SwTableBox* pFndBox = 0;
+ do {
+ if( bNxt )
+ ++nLinePos;
+ else
+ --nLinePos;
+ SwTableLine* pLine = rTblLns[ nLinePos ];
+ SwTwips nFndBoxWidth = 0;
+ SwTwips nFndWidth = nBoxStt + nBoxWidth;
+ sal_uInt16 nBoxCnt = pLine->GetTabBoxes().Count();
+
+ pFndBox = pLine->GetTabBoxes()[ 0 ];
+ for( sal_uInt16 n = 0; 0 < nFndWidth && n < nBoxCnt; ++n )
+ {
+ pFndBox = pLine->GetTabBoxes()[ n ];
+ nFndWidth -= (nFndBoxWidth = pFndBox->GetFrmFmt()->
+ GetFrmSize().GetWidth());
+ }
+
+ // suche die erste ContentBox
+ while( !pFndBox->GetSttNd() )
+ {
+ const SwTableLines& rLowLns = pFndBox->GetTabLines();
+ if( bNxt )
+ pFndBox = rLowLns[ 0 ]->GetTabBoxes()[ 0 ];
+ else
+ pFndBox = rLowLns[ rLowLns.Count() - 1 ]->GetTabBoxes()[ 0 ];
+ }
+
+ if( Abs( nFndWidth ) > COLFUZZY ||
+ Abs( nBoxWidth - nFndBoxWidth ) > COLFUZZY )
+ pFndBox = 0;
+ else if( pAllDelBoxes )
+ {
+ // falls der Vorganger auch geloscht wird, ist nicht zu tun
+ sal_uInt16 nFndPos;
+ if( !pAllDelBoxes->Seek_Entry( pFndBox, &nFndPos ) )
+ break;
+
+ // sonst noch mal weitersuchen
+ // Die Box muessen wir aber nicht nochmal abpruefen
+ pFndBox = 0;
+ if( nFndPos <= *pCurPos )
+ --*pCurPos;
+ pAllDelBoxes->Remove( nFndPos );
+ }
+ } while( bNxt ? ( nLinePos + 1 < rTblLns.Count() ) : nLinePos );
+ return pFndBox;
+}
+
+void lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox,
+ SwShareBoxFmts& rShareFmts,
+ SwSelBoxes* pAllDelBoxes = 0,
+ sal_uInt16* pCurPos = 0 )
+{
+//JP 16.04.97: 2.Teil fuer Bug 36271
+ sal_Bool bChgd = sal_False;
+ const SwTableLine* pLine = rBox.GetUpper();
+ const SwTableBoxes& rTblBoxes = pLine->GetTabBoxes();
+ const SwTableBox* pUpperBox = &rBox;
+ sal_uInt16 nDelPos = rTblBoxes.C40_GETPOS( SwTableBox, pUpperBox );
+ pUpperBox = rBox.GetUpper()->GetUpper();
+ const SvxBoxItem& rBoxItem = rBox.GetFrmFmt()->GetBox();
+
+ // dann die unteren/oberen Kanten
+ if( rBoxItem.GetTop() || rBoxItem.GetBottom() )
+ {
+ bChgd = sal_False;
+ const SwTableLines* pTblLns;
+ if( pUpperBox )
+ pTblLns = &pUpperBox->GetTabLines();
+ else
+ pTblLns = &rTbl.GetTabLines();
+
+ sal_uInt16 nLnPos = pTblLns->GetPos( pLine );
+
+ // bestimme die Attr.Position der akt. zu loeschenden Box
+ // und suche dann in der unteren / oberen Line die entspr.
+ // Gegenstuecke
+ SwTwips nBoxStt = 0;
+ for( sal_uInt16 n = 0; n < nDelPos; ++n )
+ nBoxStt += rTblBoxes[ n ]->GetFrmFmt()->GetFrmSize().GetWidth();
+ SwTwips nBoxWidth = rBox.GetFrmFmt()->GetFrmSize().GetWidth();
+
+ SwTableBox *pPrvBox = 0, *pNxtBox = 0;
+ if( nLnPos ) // Vorgaenger?
+ pPrvBox = ::lcl_FndNxtPrvDelBox( *pTblLns, nBoxStt, nBoxWidth,
+ nLnPos, sal_False, pAllDelBoxes, pCurPos );
+
+ if( nLnPos + 1 < pTblLns->Count() ) // Nachfolger?
+ pNxtBox = ::lcl_FndNxtPrvDelBox( *pTblLns, nBoxStt, nBoxWidth,
+ nLnPos, sal_True, pAllDelBoxes, pCurPos );
+
+ if( pNxtBox && pNxtBox->GetSttNd() )
+ {
+ const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrmFmt()->GetBox();
+ if( !rNxtBoxItem.GetTop() && ( !pPrvBox ||
+ !pPrvBox->GetFrmFmt()->GetBox().GetBottom()) )
+ {
+ SvxBoxItem aTmp( rNxtBoxItem );
+ aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop()
+ : rBoxItem.GetBottom(),
+ BOX_LINE_TOP );
+ rShareFmts.SetAttr( *pNxtBox, aTmp );
+ bChgd = sal_True;
+ }
+ }
+ if( !bChgd && pPrvBox && pPrvBox->GetSttNd() )
+ {
+ const SvxBoxItem& rPrvBoxItem = pPrvBox->GetFrmFmt()->GetBox();
+ if( !rPrvBoxItem.GetTop() && ( !pNxtBox ||
+ !pNxtBox->GetFrmFmt()->GetBox().GetTop()) )
+ {
+ SvxBoxItem aTmp( rPrvBoxItem );
+ aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop()
+ : rBoxItem.GetBottom(),
+ BOX_LINE_BOTTOM );
+ rShareFmts.SetAttr( *pPrvBox, aTmp );
+ }
+ }
+
+ }
+}
+
+
+sal_Bool SwTable::DeleteSel(
+ SwDoc* pDoc
+ ,
+ const SwSelBoxes& rBoxes,
+ const SwSelBoxes* pMerged, SwUndo* pUndo,
+ const sal_Bool bDelMakeFrms, const sal_Bool bCorrBorder )
+{
+ ASSERT( pDoc, "No doc?" );
+ SwTableNode* pTblNd = 0;
+ if( rBoxes.Count() )
+ {
+ pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+ }
+
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ //Lines fuer das Layout-Update herausuchen.
+ _FndBox aFndBox( 0, 0 );
+ if ( bDelMakeFrms )
+ {
+ if( pMerged && pMerged->Count() )
+ aFndBox.SetTableLines( *pMerged, *this );
+ else if( rBoxes.Count() )
+ aFndBox.SetTableLines( rBoxes, *this );
+ aFndBox.DelFrms( *this );
+ }
+
+ SwShareBoxFmts aShareFmts;
+
+ // erst die Umrandung umsetzen, dann loeschen
+ if( bCorrBorder )
+ {
+ SwSelBoxes aBoxes;
+ aBoxes.Insert( &rBoxes );
+ for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n )
+ ::lcl_SaveUpperLowerBorder( *this, *rBoxes[ n ], aShareFmts,
+ &aBoxes, &n );
+ }
+
+ PrepareDelBoxes( rBoxes );
+
+ SwChartDataProvider *pPCD = pDoc->GetChartDataProvider();
+ //
+ // delete boxes from last to first
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ {
+ sal_uInt16 nIdx = rBoxes.Count() - 1 - n;
+
+ // first adapt the data-sequence for chart if necessary
+ // (needed to move the implementation cursor properly to it's new
+ // position which can't be done properly if the cell is already gone)
+ if (pPCD && pTblNd)
+ pPCD->DeleteBox( &pTblNd->GetTable(), *rBoxes[nIdx] );
+
+ // ... then delete the boxes
+ _DeleteBox( *this, rBoxes[nIdx], pUndo, sal_True, bCorrBorder, &aShareFmts );
+ }
+
+ // dann raeume die Struktur aller Lines auf
+ GCLines();
+
+ if( bDelMakeFrms && aFndBox.AreLinesToRestore( *this ) )
+ aFndBox.MakeFrms( *this );
+
+ // TL_CHART2: now inform chart that sth has changed
+ pDoc->UpdateCharts( GetFrmFmt()->GetName() );
+
+ CHECKTABLELAYOUT
+ CHECK_TABLE( *this )
+
+ return sal_True;
+}
+
+
+// ---------------------------------------------------------------
+
+sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
+ sal_Bool bSameHeight )
+{
+ ASSERT( pDoc && rBoxes.Count() && nCnt, "keine gueltigen Werte" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ // TL_CHART2: splitting/merging of a number of cells or rows will usually make
+ // the table to complex to be handled with chart.
+ // Thus we tell the charts to use their own data provider and forget about this table
+ pDoc->CreateChartInternalDataProviders( this );
+
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ // If the rows should get the same (min) height, we first have
+ // to store the old row heights before deleting the frames
+ long* pRowHeights = 0;
+ if ( bSameHeight )
+ {
+ pRowHeights = new long[ rBoxes.Count() ];
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ {
+ SwTableBox* pSelBox = *( rBoxes.GetData() + n );
+ const SwRowFrm* pRow = GetRowFrm( *pSelBox->GetUpper() );
+ ASSERT( pRow, "wo ist der Frm von der SwTableLine?" )
+ SWRECTFN( pRow )
+ pRowHeights[ n ] = (pRow->Frm().*fnRect->fnGetHeight)();
+ }
+ }
+
+ //Lines fuer das Layout-Update herausuchen.
+ _FndBox aFndBox( 0, 0 );
+ aFndBox.SetTableLines( rBoxes, *this );
+ aFndBox.DelFrms( *this );
+
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ {
+ SwTableBox* pSelBox = *( rBoxes.GetData() + n );
+ ASSERT( pSelBox, "Box steht nicht in der Tabelle" );
+
+ // dann fuege in die Box nCnt neue Zeilen ein
+ SwTableLine* pInsLine = pSelBox->GetUpper();
+ SwTableBoxFmt* pFrmFmt = (SwTableBoxFmt*)pSelBox->GetFrmFmt();
+
+ // Hoehe der Line beachten, gegebenenfalls neu setzen
+ SwFmtFrmSize aFSz( pInsLine->GetFrmFmt()->GetFrmSize() );
+ if ( bSameHeight && ATT_VAR_SIZE == aFSz.GetHeightSizeType() )
+ aFSz.SetHeightSizeType( ATT_MIN_SIZE );
+
+ sal_Bool bChgLineSz = 0 != aFSz.GetHeight() || bSameHeight;
+ if ( bChgLineSz )
+ aFSz.SetHeight( ( bSameHeight ? pRowHeights[ n ] : aFSz.GetHeight() ) /
+ (nCnt + 1) );
+
+ SwTableBox* pNewBox = new SwTableBox( pFrmFmt, nCnt, pInsLine );
+ sal_uInt16 nBoxPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSelBox );
+ pInsLine->GetTabBoxes().Remove( nBoxPos ); // alte loeschen
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pNewBox, nBoxPos );
+
+ // Hintergrund- / Rand Attribut loeschen
+ SwTableBox* pLastBox = pSelBox; // zum verteilen der TextNodes !!
+ // sollte Bereiche in der Box stehen, dann bleibt sie so bestehen
+ // !! FALLS DAS GEAENDERT WIRD MUSS DAS UNDO ANGEPASST WERDEN !!!
+ sal_Bool bMoveNodes = sal_True;
+ {
+ sal_uLong nSttNd = pLastBox->GetSttIdx() + 1,
+ nEndNd = pLastBox->GetSttNd()->EndOfSectionIndex();
+ while( nSttNd < nEndNd )
+ if( !pDoc->GetNodes()[ nSttNd++ ]->IsTxtNode() )
+ {
+ bMoveNodes = sal_False;
+ break;
+ }
+ }
+
+ SwTableBoxFmt* pCpyBoxFrmFmt = (SwTableBoxFmt*)pSelBox->GetFrmFmt();
+ sal_Bool bChkBorder = 0 != pCpyBoxFrmFmt->GetBox().GetTop();
+ if( bChkBorder )
+ pCpyBoxFrmFmt = (SwTableBoxFmt*)pSelBox->ClaimFrmFmt();
+
+ for( sal_uInt16 i = 0; i <= nCnt; ++i )
+ {
+ // also erstmal eine neue Linie in der neuen Box
+ SwTableLine* pNewLine = new SwTableLine(
+ (SwTableLineFmt*)pInsLine->GetFrmFmt(), 1, pNewBox );
+ if( bChgLineSz )
+ {
+ pNewLine->ClaimFrmFmt()->SetFmtAttr( aFSz );
+ }
+
+ pNewBox->GetTabLines().C40_INSERT( SwTableLine, pNewLine, i );
+ // dann eine neue Box in der Line
+ if( !i ) // haenge die originale Box ein
+ {
+ pSelBox->SetUpper( pNewLine );
+ pNewLine->GetTabBoxes().C40_INSERT( SwTableBox, pSelBox, 0 );
+ }
+ else
+ {
+ ::_InsTblBox( pDoc, pTblNd, pNewLine, pCpyBoxFrmFmt,
+ pLastBox, 0 );
+
+ if( bChkBorder )
+ {
+ pCpyBoxFrmFmt = (SwTableBoxFmt*)pNewLine->GetTabBoxes()[ 0 ]->ClaimFrmFmt();
+ SvxBoxItem aTmp( pCpyBoxFrmFmt->GetBox() );
+ aTmp.SetLine( 0, BOX_LINE_TOP );
+ pCpyBoxFrmFmt->SetFmtAttr( aTmp );
+ bChkBorder = sal_False;
+ }
+
+ if( bMoveNodes )
+ {
+ const SwNode* pEndNd = pLastBox->GetSttNd()->EndOfSectionNode();
+ if( pLastBox->GetSttIdx()+2 != pEndNd->GetIndex() )
+ {
+ // TextNodes verschieben
+ SwNodeRange aRg( *pLastBox->GetSttNd(), +2, *pEndNd );
+ pLastBox = pNewLine->GetTabBoxes()[0]; // neu setzen
+ SwNodeIndex aInsPos( *pLastBox->GetSttNd(), 1 );
+ pDoc->GetNodes()._MoveNodes(aRg, pDoc->GetNodes(), aInsPos, sal_False);
+ pDoc->GetNodes().Delete( aInsPos, 1 ); // den leeren noch loeschen
+ }
+ }
+ }
+ }
+ // in Boxen mit Lines darf es nur noch Size/Fillorder geben
+ pFrmFmt = (SwTableBoxFmt*)pNewBox->ClaimFrmFmt();
+ pFrmFmt->ResetFmtAttr( RES_LR_SPACE, RES_FRMATR_END - 1 );
+ pFrmFmt->ResetFmtAttr( RES_BOXATR_BEGIN, RES_BOXATR_END - 1 );
+ }
+
+ delete[] pRowHeights;
+
+ GCLines();
+
+ aFndBox.MakeFrms( *this );
+
+ CHECKBOXWIDTH
+ CHECKTABLELAYOUT
+ return sal_True;
+}
+
+sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt )
+{
+ ASSERT( pDoc && rBoxes.Count() && nCnt, "keine gueltigen Werte" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ // TL_CHART2: splitting/merging of a number of cells or rows will usually make
+ // the table to complex to be handled with chart.
+ // Thus we tell the charts to use their own data provider and forget about this table
+ pDoc->CreateChartInternalDataProviders( this );
+
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+ SwSelBoxes aSelBoxes;
+ aSelBoxes.Insert(rBoxes.GetData(), rBoxes.Count());
+ ExpandSelection( aSelBoxes );
+
+ //Lines fuer das Layout-Update herausuchen.
+ _FndBox aFndBox( 0, 0 );
+ aFndBox.SetTableLines( aSelBoxes, *this );
+ aFndBox.DelFrms( *this );
+
+ _CpyTabFrms aFrmArr;
+ SvPtrarr aLastBoxArr;
+ sal_uInt16 nFndPos;
+ for( sal_uInt16 n = 0; n < aSelBoxes.Count(); ++n )
+ {
+ SwTableBox* pSelBox = *( aSelBoxes.GetData() + n );
+ ASSERT( pSelBox, "Box steht nicht in der Tabelle" );
+
+ // We don't want to split small table cells into very very small cells
+ if( pSelBox->GetFrmFmt()->GetFrmSize().GetWidth()/( nCnt + 1 ) < 10 )
+ continue;
+
+ // dann teile die Box nCnt in nCnt Boxen
+ SwTableLine* pInsLine = pSelBox->GetUpper();
+ sal_uInt16 nBoxPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSelBox );
+
+ // suche das FrmFmt im Array aller Frame-Formate
+ SwTableBoxFmt* pLastBoxFmt;
+ _CpyTabFrm aFindFrm( (SwTableBoxFmt*)pSelBox->GetFrmFmt() );
+ if( !aFrmArr.Seek_Entry( aFindFrm, &nFndPos ))
+ {
+ // aender das FrmFmt
+ aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pSelBox->ClaimFrmFmt();
+ SwTwips nBoxSz = aFindFrm.pNewFrmFmt->GetFrmSize().GetWidth();
+ SwTwips nNewBoxSz = nBoxSz / ( nCnt + 1 );
+ aFindFrm.pNewFrmFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE,
+ nNewBoxSz, 0 ) );
+ aFrmArr.Insert( aFindFrm );
+
+ pLastBoxFmt = aFindFrm.pNewFrmFmt;
+ if( nBoxSz != ( nNewBoxSz * (nCnt + 1)))
+ {
+ // es bleibt ein Rest, also muss fuer die letzte Box ein
+ // eigenes Format definiert werden
+ pLastBoxFmt = new SwTableBoxFmt( *aFindFrm.pNewFrmFmt );
+ pLastBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE,
+ nBoxSz - ( nNewBoxSz * nCnt ), 0 ) );
+ }
+ void* p = pLastBoxFmt;
+ aLastBoxArr.Insert( p, nFndPos );
+ }
+ else
+ {
+ aFindFrm = aFrmArr[ nFndPos ];
+ pSelBox->ChgFrmFmt( (SwTableBoxFmt*)aFindFrm.pNewFrmFmt );
+ pLastBoxFmt = (SwTableBoxFmt*)aLastBoxArr[ nFndPos ];
+ }
+
+ // dann fuege mal an der Position die neuen Boxen ein
+ for( sal_uInt16 i = 1; i < nCnt; ++i )
+ ::_InsTblBox( pDoc, pTblNd, pInsLine, aFindFrm.pNewFrmFmt,
+ pSelBox, nBoxPos + i ); // dahinter einfuegen
+
+ ::_InsTblBox( pDoc, pTblNd, pInsLine, pLastBoxFmt,
+ pSelBox, nBoxPos + nCnt ); // dahinter einfuegen
+
+ // Sonderbehandlung fuer die Umrandung:
+ const SvxBoxItem& aSelBoxItem = aFindFrm.pNewFrmFmt->GetBox();
+ if( aSelBoxItem.GetRight() )
+ {
+ pInsLine->GetTabBoxes()[ nBoxPos + nCnt ]->ClaimFrmFmt();
+
+ SvxBoxItem aTmp( aSelBoxItem );
+ aTmp.SetLine( 0, BOX_LINE_RIGHT );
+ aFindFrm.pNewFrmFmt->SetFmtAttr( aTmp );
+
+ // und dann das Format aus dem "cache" entfernen
+ for( sal_uInt16 i = aFrmArr.Count(); i; )
+ {
+ const _CpyTabFrm& rCTF = aFrmArr[ --i ];
+ if( rCTF.pNewFrmFmt == aFindFrm.pNewFrmFmt ||
+ rCTF.Value.pFrmFmt == aFindFrm.pNewFrmFmt )
+ {
+ aFrmArr.Remove( i );
+ aLastBoxArr.Remove( i );
+ }
+ }
+ }
+ }
+
+ //Layout updaten
+ aFndBox.MakeFrms( *this );
+
+ CHECKBOXWIDTH
+ CHECKTABLELAYOUT
+ return sal_True;
+}
+
+// ---------------------------------------------------------------
+
+/*
+ ----------------------- >> MERGE << ------------------------
+ Algorithmus:
+ ist in der _FndBox nur eine Line angegeben, nehme die Line
+ und teste die Anzahl der Boxen
+ - ist mehr als 1 Box angegeben, so wird auf Boxenebene zusammen-
+ gefasst, d.H. die neue Box wird so Breit wie die alten.
+ - Alle Lines die ueber/unter dem Bereich liegen werden in die
+ Box als Line + Box mit Lines eingefuegt
+ - Alle Lines die vor/hinter dem Bereich liegen werden in
+ die Boxen Left/Right eingetragen
+
+ ----------------------- >> MERGE << ------------------------
+*/
+
+void lcl_CpyLines( sal_uInt16 nStt, sal_uInt16 nEnd,
+ SwTableLines& rLines,
+ SwTableBox* pInsBox,
+ sal_uInt16 nPos = USHRT_MAX )
+{
+ for( sal_uInt16 n = nStt; n < nEnd; ++n )
+ rLines[n]->SetUpper( pInsBox );
+ if( USHRT_MAX == nPos )
+ nPos = pInsBox->GetTabLines().Count();
+ pInsBox->GetTabLines().Insert( &rLines, nPos, nStt, nEnd );
+ rLines.Remove( nStt, nEnd - nStt );
+}
+
+void lcl_CpyBoxes( sal_uInt16 nStt, sal_uInt16 nEnd,
+ SwTableBoxes& rBoxes,
+ SwTableLine* pInsLine,
+ sal_uInt16 nPos = USHRT_MAX )
+{
+ for( sal_uInt16 n = nStt; n < nEnd; ++n )
+ rBoxes[n]->SetUpper( pInsLine );
+ if( USHRT_MAX == nPos )
+ nPos = pInsLine->GetTabBoxes().Count();
+ pInsLine->GetTabBoxes().Insert( &rBoxes, nPos, nStt, nEnd );
+ rBoxes.Remove( nStt, nEnd - nStt );
+}
+
+void lcl_CalcWidth( SwTableBox* pBox )
+{
+ // Annahme: jede Line in der Box ist gleich gross
+ SwFrmFmt* pFmt = pBox->ClaimFrmFmt();
+ ASSERT( pBox->GetTabLines().Count(), "Box hat keine Lines" );
+
+ SwTableLine* pLine = pBox->GetTabLines()[0];
+ ASSERT( pLine, "Box steht in keiner Line" );
+
+ long nWidth = 0;
+ for( sal_uInt16 n = 0; n < pLine->GetTabBoxes().Count(); ++n )
+ nWidth += pLine->GetTabBoxes()[n]->GetFrmFmt()->GetFrmSize().GetWidth();
+
+ pFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth, 0 ));
+
+ // in Boxen mit Lines darf es nur noch Size/Fillorder geben
+ pFmt->ResetFmtAttr( RES_LR_SPACE, RES_FRMATR_END - 1 );
+ pFmt->ResetFmtAttr( RES_BOXATR_BEGIN, RES_BOXATR_END - 1 );
+}
+
+
+
+struct _InsULPara
+{
+ SwTableNode* pTblNd;
+ SwTableLine* pInsLine;
+ SwTableBox* pInsBox;
+ sal_Bool bUL_LR : 1; // Upper-Lower(sal_True) oder Left-Right(sal_False) ?
+ sal_Bool bUL : 1; // Upper-Left(sal_True) oder Lower-Right(sal_False) ?
+
+ SwTableBox* pLeftBox;
+ SwTableBox* pRightBox;
+ SwTableBox* pMergeBox;
+
+ _InsULPara( SwTableNode* pTNd, sal_Bool bUpperLower, sal_Bool bUpper,
+ SwTableBox* pLeft, SwTableBox* pMerge, SwTableBox* pRight,
+ SwTableLine* pLine=0, SwTableBox* pBox=0 )
+ : pTblNd( pTNd ), pInsLine( pLine ), pInsBox( pBox ),
+ pLeftBox( pLeft ), pRightBox( pRight ), pMergeBox( pMerge )
+ { bUL_LR = bUpperLower; bUL = bUpper; }
+
+ void SetLeft( SwTableBox* pBox=0 )
+ { bUL_LR = sal_False; bUL = sal_True; if( pBox ) pInsBox = pBox; }
+ void SetRight( SwTableBox* pBox=0 )
+ { bUL_LR = sal_False; bUL = sal_False; if( pBox ) pInsBox = pBox; }
+ void SetUpper( SwTableLine* pLine=0 )
+ { bUL_LR = sal_True; bUL = sal_True; if( pLine ) pInsLine = pLine; }
+ void SetLower( SwTableLine* pLine=0 )
+ { bUL_LR = sal_True; bUL = sal_False; if( pLine ) pInsLine = pLine; }
+};
+
+
+sal_Bool lcl_Merge_MoveBox( const _FndBox*& rpFndBox, void* pPara )
+{
+ _InsULPara* pULPara = (_InsULPara*)pPara;
+ SwTableBoxes* pBoxes;
+
+ sal_uInt16 nStt = 0, nEnd = rpFndBox->GetLines().Count();
+ sal_uInt16 nInsPos = USHRT_MAX;
+ if( !pULPara->bUL_LR ) // Left/Right
+ {
+ sal_uInt16 nPos;
+ SwTableBox* pFndBox = (SwTableBox*)rpFndBox->GetBox();
+ pBoxes = &pFndBox->GetUpper()->GetTabBoxes();
+ if( pULPara->bUL ) // Left ?
+ {
+ // gibt es noch davor Boxen, dann move sie
+ if( 0 != ( nPos = pBoxes->C40_GETPOS( SwTableBox, pFndBox )) )
+ lcl_CpyBoxes( 0, nPos, *pBoxes, pULPara->pInsLine );
+ }
+ else // Right
+ // gibt es noch dahinter Boxen, dann move sie
+ if( (nPos = pBoxes->C40_GETPOS( SwTableBox, pFndBox )) +1 < pBoxes->Count() )
+ {
+ nInsPos = pULPara->pInsLine->GetTabBoxes().Count();
+ lcl_CpyBoxes( nPos+1, pBoxes->Count(),
+ *pBoxes, pULPara->pInsLine );
+ }
+ }
+ // Upper/Lower und gehts noch tiefer ??
+ else if( rpFndBox->GetLines().Count() )
+ {
+ // suche nur die Line, ab der Verschoben werden muss
+ nStt = pULPara->bUL ? 0 : rpFndBox->GetLines().Count()-1;
+ nEnd = nStt+1;
+ }
+
+ pBoxes = &pULPara->pInsLine->GetTabBoxes();
+
+ // geht es noch eine weitere Stufe runter?
+ if( rpFndBox->GetBox()->GetTabLines().Count() )
+ {
+ SwTableBox* pBox = new SwTableBox(
+ (SwTableBoxFmt*)rpFndBox->GetBox()->GetFrmFmt(), 0, pULPara->pInsLine );
+ _InsULPara aPara( *pULPara );
+ aPara.pInsBox = pBox;
+ ((_FndBox*)rpFndBox)->GetLines().ForEach( nStt, nEnd,
+ &lcl_Merge_MoveLine, &aPara );
+ if( pBox->GetTabLines().Count() )
+ {
+ if( USHRT_MAX == nInsPos )
+ nInsPos = pBoxes->Count();
+ pBoxes->C40_INSERT( SwTableBox, pBox, nInsPos );
+ lcl_CalcWidth( pBox ); // bereche die Breite der Box
+ }
+ else
+ delete pBox;
+ }
+ return sal_True;
+}
+
+sal_Bool lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara )
+{
+ _InsULPara* pULPara = (_InsULPara*)pPara;
+ SwTableLines* pLines;
+
+ sal_uInt16 nStt = 0, nEnd = rpFndLine->GetBoxes().Count();
+ sal_uInt16 nInsPos = USHRT_MAX;
+ if( pULPara->bUL_LR ) // UpperLower ?
+ {
+ sal_uInt16 nPos;
+ SwTableLine* pFndLn = (SwTableLine*)rpFndLine->GetLine();
+ pLines = pFndLn->GetUpper() ?
+ &pFndLn->GetUpper()->GetTabLines() :
+ &pULPara->pTblNd->GetTable().GetTabLines();
+
+ SwTableBox* pLBx = rpFndLine->GetBoxes()[0]->GetBox();
+ SwTableBox* pRBx = rpFndLine->GetBoxes()[
+ rpFndLine->GetBoxes().Count()-1]->GetBox();
+ sal_uInt16 nLeft = pFndLn->GetTabBoxes().C40_GETPOS( SwTableBox, pLBx );
+ sal_uInt16 nRight = pFndLn->GetTabBoxes().C40_GETPOS( SwTableBox, pRBx );
+
+// if( ( nLeft && nRight+1 < pFndLn->GetTabBoxes().Count() ) ||
+// ( !nLeft && nRight+1 >= pFndLn->GetTabBoxes().Count() ) )
+ if( !nLeft || nRight == pFndLn->GetTabBoxes().Count() )
+ {
+ if( pULPara->bUL ) // Upper ?
+ {
+ // gibt es noch davor Zeilen, dann move sie
+ if( 0 != ( nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) )
+ lcl_CpyLines( 0, nPos, *pLines, pULPara->pInsBox );
+ }
+ else
+ // gibt es noch dahinter Zeilen, dann move sie
+ if( (nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) +1 < pLines->Count() )
+ {
+ nInsPos = pULPara->pInsBox->GetTabLines().Count();
+ lcl_CpyLines( nPos+1, pLines->Count(), *pLines,
+ pULPara->pInsBox );
+ }
+ }
+ else if( nLeft )
+ {
+ // es gibt links noch weitere Boxen, also setze Left-
+ // und Merge-Box in eine Box und Line, fuege davor/dahinter
+ // eine Line mit Box ein, in die die oberen/unteren Lines
+ // eingefuegt werden
+ SwTableLine* pInsLine = pULPara->pLeftBox->GetUpper();
+ SwTableBox* pLMBox = new SwTableBox(
+ (SwTableBoxFmt*)pULPara->pLeftBox->GetFrmFmt(), 0, pInsLine );
+ SwTableLine* pLMLn = new SwTableLine(
+ (SwTableLineFmt*)pInsLine->GetFrmFmt(), 2, pLMBox );
+ pLMLn->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE );
+
+ pLMBox->GetTabLines().C40_INSERT( SwTableLine, pLMLn, 0 );
+
+ lcl_CpyBoxes( 0, 2, pInsLine->GetTabBoxes(), pLMLn );
+
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pLMBox, 0 );
+
+ if( pULPara->bUL ) // Upper ?
+ {
+ // gibt es noch davor Zeilen, dann move sie
+ if( 0 != ( nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) )
+ lcl_CpyLines( 0, nPos, *pLines, pLMBox, 0 );
+ }
+ else
+ // gibt es noch dahinter Zeilen, dann move sie
+ if( (nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) +1 < pLines->Count() )
+ lcl_CpyLines( nPos+1, pLines->Count(), *pLines,
+ pLMBox );
+ lcl_CalcWidth( pLMBox ); // bereche die Breite der Box
+ }
+ else if( nRight+1 < pFndLn->GetTabBoxes().Count() )
+ {
+ // es gibt rechts noch weitere Boxen, also setze Right-
+ // und Merge-Box in eine Box und Line, fuege davor/dahinter
+ // eine Line mit Box ein, in die die oberen/unteren Lines
+ // eingefuegt werden
+ SwTableLine* pInsLine = pULPara->pRightBox->GetUpper();
+ SwTableBox* pRMBox;
+ if( pULPara->pLeftBox->GetUpper() == pInsLine )
+ {
+ pRMBox = new SwTableBox(
+ (SwTableBoxFmt*)pULPara->pRightBox->GetFrmFmt(), 0, pInsLine );
+ SwTableLine* pRMLn = new SwTableLine(
+ (SwTableLineFmt*)pInsLine->GetFrmFmt(), 2, pRMBox );
+ pRMLn->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE );
+ pRMBox->GetTabLines().C40_INSERT( SwTableLine, pRMLn, 0 );
+
+ lcl_CpyBoxes( 1, 3, pInsLine->GetTabBoxes(), pRMLn );
+
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pRMBox, 0 );
+ }
+ else
+ {
+ // Left und Merge wurden schon zusammengefuegt, also move
+ // Right auch mit in die Line
+
+ pInsLine = pULPara->pLeftBox->GetUpper();
+ sal_uInt16 nMvPos = pULPara->pRightBox->GetUpper()->GetTabBoxes().
+ C40_GETPOS( SwTableBox, pULPara->pRightBox );
+ lcl_CpyBoxes( nMvPos, nMvPos+1,
+ pULPara->pRightBox->GetUpper()->GetTabBoxes(),
+ pInsLine );
+ pRMBox = pInsLine->GetUpper();
+
+ // sind schon Lines vorhanden, dann muessen diese in eine
+ // neue Line und Box
+ nMvPos = pRMBox->GetTabLines().C40_GETPOS( SwTableLine, pInsLine );
+ if( pULPara->bUL ? nMvPos
+ : nMvPos+1 < pRMBox->GetTabLines().Count() )
+ {
+ // alle Lines zu einer neuen Line und Box zusammenfassen
+ SwTableLine* pNewLn = new SwTableLine(
+ (SwTableLineFmt*)pInsLine->GetFrmFmt(), 1, pRMBox );
+ pNewLn->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE );
+ pRMBox->GetTabLines().C40_INSERT( SwTableLine, pNewLn,
+ pULPara->bUL ? nMvPos : nMvPos+1 );
+ pRMBox = new SwTableBox( (SwTableBoxFmt*)pRMBox->GetFrmFmt(), 0, pNewLn );
+ pNewLn->GetTabBoxes().C40_INSERT( SwTableBox, pRMBox, 0 );
+
+ sal_uInt16 nPos1, nPos2;
+ if( pULPara->bUL )
+ nPos1 = 0,
+ nPos2 = nMvPos;
+ else
+ nPos1 = nMvPos+2,
+ nPos2 = pNewLn->GetUpper()->GetTabLines().Count();
+
+ lcl_CpyLines( nPos1, nPos2,
+ pNewLn->GetUpper()->GetTabLines(), pRMBox );
+ lcl_CalcWidth( pRMBox ); // bereche die Breite der Box
+
+ pRMBox = new SwTableBox( (SwTableBoxFmt*)pRMBox->GetFrmFmt(), 0, pNewLn );
+ pNewLn->GetTabBoxes().C40_INSERT( SwTableBox, pRMBox,
+ pNewLn->GetTabBoxes().Count() );
+ }
+ }
+ if( pULPara->bUL ) // Upper ?
+ {
+ // gibt es noch davor Zeilen, dann move sie
+ if( 0 != ( nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) )
+ lcl_CpyLines( 0, nPos, *pLines, pRMBox, 0 );
+ }
+ else
+ // gibt es noch dahinter Zeilen, dann move sie
+ if( (nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) +1 < pLines->Count() )
+ lcl_CpyLines( nPos+1, pLines->Count(), *pLines,
+ pRMBox );
+ lcl_CalcWidth( pRMBox ); // bereche die Breite der Box
+ }
+ else {
+ ASSERT( sal_False , "Was denn nun" );
+ }
+ }
+ // Left/Right
+ else
+ {
+ // suche nur die Line, ab der Verschoben werden muss
+ nStt = pULPara->bUL ? 0 : rpFndLine->GetBoxes().Count()-1;
+ nEnd = nStt+1;
+ }
+ pLines = &pULPara->pInsBox->GetTabLines();
+
+ SwTableLine* pNewLine = new SwTableLine(
+ (SwTableLineFmt*)rpFndLine->GetLine()->GetFrmFmt(), 0, pULPara->pInsBox );
+ _InsULPara aPara( *pULPara ); // kopieren
+ aPara.pInsLine = pNewLine;
+ ((_FndLine*)rpFndLine)->GetBoxes().ForEach( nStt, nEnd,
+ &lcl_Merge_MoveBox, &aPara );
+ if( pNewLine->GetTabBoxes().Count() )
+ {
+ if( USHRT_MAX == nInsPos )
+ nInsPos = pLines->Count();
+ pLines->C40_INSERT( SwTableLine, pNewLine, nInsPos );
+ }
+ else
+ delete pNewLine;
+
+ return sal_True;
+}
+
+
+sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes,
+ SwTableBox* pMergeBox, SwUndoTblMerge* pUndo )
+{
+ ASSERT( rBoxes.Count() && pMergeBox, "keine gueltigen Werte" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ // suche alle Boxen / Lines
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aPara( rBoxes, &aFndBox );
+ GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ }
+ if( !aFndBox.GetLines().Count() )
+ return sal_False;
+
+ // TL_CHART2: splitting/merging of a number of cells or rows will usually make
+ // the table to complex to be handled with chart.
+ // Thus we tell the charts to use their own data provider and forget about this table
+ pDoc->CreateChartInternalDataProviders( this );
+
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ if( pUndo )
+ pUndo->SetSelBoxes( rBoxes );
+
+ //Lines fuer das Layout-Update herausuchen.
+ aFndBox.SetTableLines( *this );
+ aFndBox.DelFrms( *this );
+
+ _FndBox* pFndBox = &aFndBox;
+ while( 1 == pFndBox->GetLines().Count() &&
+ 1 == pFndBox->GetLines()[0]->GetBoxes().Count() )
+ pFndBox = pFndBox->GetLines()[0]->GetBoxes()[0];
+
+ SwTableLine* pInsLine = new SwTableLine(
+ (SwTableLineFmt*)pFndBox->GetLines()[0]->GetLine()->GetFrmFmt(), 0,
+ !pFndBox->GetUpper() ? 0 : pFndBox->GetBox() );
+ pInsLine->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE );
+
+ // trage die neue Line ein
+ SwTableLines* pLines = pFndBox->GetUpper() ?
+ &pFndBox->GetBox()->GetTabLines() : &GetTabLines();
+
+ SwTableLine* pNewLine = pFndBox->GetLines()[0]->GetLine();
+ sal_uInt16 nInsPos = pLines->C40_GETPOS( SwTableLine, pNewLine );
+ pLines->C40_INSERT( SwTableLine, pInsLine, nInsPos );
+
+ SwTableBox* pLeftBox = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine );
+ SwTableBox* pRightBox = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine );
+ pMergeBox->SetUpper( pInsLine );
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pLeftBox, 0 );
+ pLeftBox->ClaimFrmFmt();
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pMergeBox, 1 );
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pRightBox, 2 );
+ pRightBox->ClaimFrmFmt();
+
+ // in diese kommen alle Lines, die ueber dem selektierten Bereich stehen
+ // Sie bilden also eine Upper/Lower Line
+ _InsULPara aPara( pTblNd, sal_True, sal_True, pLeftBox, pMergeBox, pRightBox, pInsLine );
+
+ // move die oben/unten ueberhaengenden Lines vom selektierten Bereich
+ pFndBox->GetLines()[0]->GetBoxes().ForEach( &lcl_Merge_MoveBox,
+ &aPara );
+ aPara.SetLower( pInsLine );
+ sal_uInt16 nEnd = pFndBox->GetLines().Count()-1;
+ pFndBox->GetLines()[nEnd]->GetBoxes().ForEach( &lcl_Merge_MoveBox,
+ &aPara );
+
+ // move die links/rechts hereinreichenden Boxen vom selektierten Bereich
+ aPara.SetLeft( pLeftBox );
+ pFndBox->GetLines().ForEach( &lcl_Merge_MoveLine, &aPara );
+
+ aPara.SetRight( pRightBox );
+ pFndBox->GetLines().ForEach( &lcl_Merge_MoveLine, &aPara );
+
+ if( !pLeftBox->GetTabLines().Count() )
+ _DeleteBox( *this, pLeftBox, 0, sal_False, sal_False );
+ else
+ {
+ lcl_CalcWidth( pLeftBox ); // bereche die Breite der Box
+ if( pUndo && pLeftBox->GetSttNd() )
+ pUndo->AddNewBox( pLeftBox->GetSttIdx() );
+ }
+ if( !pRightBox->GetTabLines().Count() )
+ _DeleteBox( *this, pRightBox, 0, sal_False, sal_False );
+ else
+ {
+ lcl_CalcWidth( pRightBox ); // bereche die Breite der Box
+ if( pUndo && pRightBox->GetSttNd() )
+ pUndo->AddNewBox( pRightBox->GetSttIdx() );
+ }
+
+ DeleteSel( pDoc, rBoxes, 0, 0, sal_False, sal_False );
+
+ // dann raeume die Struktur dieser Line noch mal auf:
+ // generell alle Aufraeumen
+ GCLines();
+
+ GetTabLines()[0]->GetTabBoxes().ForEach( &lcl_BoxSetHeadCondColl, 0 );
+
+ aFndBox.MakeFrms( *this );
+
+ CHECKBOXWIDTH
+ CHECKTABLELAYOUT
+
+ return sal_True;
+}
+
+// ---------------------------------------------------------------
+
+void lcl_CheckRowSpan( SwTable &rTbl )
+{
+ sal_uInt16 nLineCount = rTbl.GetTabLines().Count();
+ sal_uInt16 nMaxSpan = nLineCount;
+ long nMinSpan = 1;
+ while( nMaxSpan )
+ {
+ SwTableLine* pLine = rTbl.GetTabLines()[ nLineCount - nMaxSpan ];
+ for( sal_uInt16 nBox = 0; nBox < pLine->GetTabBoxes().Count(); ++nBox )
+ {
+ SwTableBox* pBox = pLine->GetTabBoxes()[nBox];
+ long nRowSpan = pBox->getRowSpan();
+ if( nRowSpan > nMaxSpan )
+ pBox->setRowSpan( nMaxSpan );
+ else if( nRowSpan < nMinSpan )
+ pBox->setRowSpan( nMinSpan > 0 ? nMaxSpan : nMinSpan );
+ }
+ --nMaxSpan;
+ nMinSpan = -nMaxSpan;
+ }
+}
+
+sal_uInt16 lcl_GetBoxOffset( const _FndBox& rBox )
+{
+ // suche die erste Box
+ const _FndBox* pFirstBox = &rBox;
+ while( pFirstBox->GetLines().Count() )
+ pFirstBox = pFirstBox->GetLines()[ 0 ]->GetBoxes()[ 0 ];
+
+ sal_uInt16 nRet = 0;
+ // dann ueber die Lines nach oben die Position bestimmen
+ const SwTableBox* pBox = pFirstBox->GetBox();
+ do {
+ const SwTableBoxes& rBoxes = pBox->GetUpper()->GetTabBoxes();
+ const SwTableBox* pCmp;
+ for( sal_uInt16 n = 0; pBox != ( pCmp = rBoxes[ n ] ); ++n )
+ nRet = nRet + (sal_uInt16) pCmp->GetFrmFmt()->GetFrmSize().GetWidth();
+ pBox = pBox->GetUpper()->GetUpper();
+ } while( pBox );
+ return nRet;
+}
+
+sal_uInt16 lcl_GetLineWidth( const _FndLine& rLine )
+{
+ sal_uInt16 nRet = 0;
+ for( sal_uInt16 n = rLine.GetBoxes().Count(); n; )
+ nRet = nRet + (sal_uInt16)rLine.GetBoxes()[ --n ]->GetBox()->GetFrmFmt()
+ ->GetFrmSize().GetWidth();
+ return nRet;
+}
+
+void lcl_CalcNewWidths( const _FndLines& rFndLines, _CpyPara& rPara )
+{
+ rPara.pWidths.reset();
+ sal_uInt16 nLineCount = rFndLines.Count();
+ if( nLineCount )
+ {
+ rPara.pWidths = boost::shared_ptr< std::vector< std::vector< sal_uLong > > >
+ ( new std::vector< std::vector< sal_uLong > >( nLineCount ));
+ // First we collect information about the left/right borders of all
+ // selected cells
+ for( sal_uInt16 nLine = 0; nLine < nLineCount; ++nLine )
+ {
+ std::vector< sal_uLong > &rWidth = (*rPara.pWidths.get())[ nLine ];
+ const _FndLine *pFndLine = rFndLines[ nLine ];
+ if( pFndLine && pFndLine->GetBoxes().Count() )
+ {
+ const SwTableLine *pLine = pFndLine->GetLine();
+ if( pLine && pLine->GetTabBoxes().Count() )
+ {
+ sal_uInt16 nBoxCount = pLine->GetTabBoxes().Count();
+ sal_uLong nPos = 0;
+ // The first selected box...
+ const SwTableBox *pSel = pFndLine->GetBoxes()[0]->GetBox();
+ sal_uInt16 nBox = 0;
+ // Sum up the width of all boxes before the first selected box
+ while( nBox < nBoxCount )
+ {
+ SwTableBox* pBox = pLine->GetTabBoxes()[nBox++];
+ if( pBox != pSel )
+ nPos += pBox->GetFrmFmt()->GetFrmSize().GetWidth();
+ else
+ break;
+ }
+ // nPos is now the left border of the first selceted box
+ if( rPara.nMinLeft > nPos )
+ rPara.nMinLeft = nPos;
+ nBoxCount = pFndLine->GetBoxes().Count();
+ rWidth = std::vector< sal_uLong >( nBoxCount+2 );
+ rWidth[ 0 ] = nPos;
+ // Add now the widths of all selected boxes and store
+ // the positions in the vector
+ for( nBox = 0; nBox < nBoxCount; )
+ {
+ nPos += pFndLine->GetBoxes()[nBox]
+ ->GetBox()->GetFrmFmt()->GetFrmSize().GetWidth();
+ rWidth[ ++nBox ] = nPos;
+ }
+ // nPos: The right border of the last selected box
+ if( rPara.nMaxRight < nPos )
+ rPara.nMaxRight = nPos;
+ if( nPos <= rWidth[ 0 ] )
+ rWidth.clear();
+ }
+ }
+ }
+ }
+ // Second step: calculate the new widths for the copied cells
+ sal_uLong nSelSize = rPara.nMaxRight - rPara.nMinLeft;
+ if( nSelSize )
+ {
+ for( sal_uInt16 nLine = 0; nLine < nLineCount; ++nLine )
+ {
+ std::vector< sal_uLong > &rWidth = (*rPara.pWidths.get())[ nLine ];
+ sal_uInt16 nCount = (sal_uInt16)rWidth.size();
+ if( nCount > 2 )
+ {
+ rWidth[ nCount - 1 ] = rPara.nMaxRight;
+ sal_uLong nLastPos = 0;
+ for( sal_uInt16 nBox = 0; nBox < nCount; ++nBox )
+ {
+ sal_uInt64 nNextPos = rWidth[ nBox ];
+ nNextPos -= rPara.nMinLeft;
+ nNextPos *= rPara.nNewSize;
+ nNextPos /= nSelSize;
+ rWidth[ nBox ] = (sal_uLong)(nNextPos - nLastPos);
+ nLastPos = (sal_uLong)nNextPos;
+ }
+ }
+ }
+ }
+}
+
+sal_Bool lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara )
+{
+ _CpyPara* pCpyPara = (_CpyPara*)pPara;
+
+ // Calculation of new size
+ sal_uLong nRealSize;
+ sal_uLong nDummy1 = 0;
+ sal_uLong nDummy2 = 0;
+ if( pCpyPara->pTblNd->GetTable().IsNewModel() )
+ {
+ if( pCpyPara->nBoxIdx == 1 )
+ nDummy1 = (*pCpyPara->pWidths.get())[pCpyPara->nLnIdx][0];
+ nRealSize = (*pCpyPara->pWidths.get())[pCpyPara->nLnIdx][pCpyPara->nBoxIdx++];
+ if( pCpyPara->nBoxIdx == (*pCpyPara->pWidths.get())[pCpyPara->nLnIdx].size()-1 )
+ nDummy2 = (*pCpyPara->pWidths.get())[pCpyPara->nLnIdx][pCpyPara->nBoxIdx];
+ }
+ else
+ {
+ nRealSize = pCpyPara->nNewSize;
+ nRealSize *= rpFndBox->GetBox()->GetFrmFmt()->GetFrmSize().GetWidth();
+ nRealSize /= pCpyPara->nOldSize;
+ }
+
+ sal_uLong nSize;
+ bool bDummy = nDummy1 > 0;
+ if( bDummy )
+ nSize = nDummy1;
+ else
+ {
+ nSize = nRealSize;
+ nRealSize = 0;
+ }
+ do
+ {
+ // suche das Frame-Format in der Liste aller Frame-Formate
+ _CpyTabFrm aFindFrm( (SwTableBoxFmt*)rpFndBox->GetBox()->GetFrmFmt() );
+
+ SwFmtFrmSize aFrmSz;
+ sal_uInt16 nFndPos;
+ if( !pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos ) ||
+ ( aFrmSz = ( aFindFrm = pCpyPara->rTabFrmArr[ nFndPos ]).pNewFrmFmt->
+ GetFrmSize()).GetWidth() != (SwTwips)nSize )
+ {
+ // es ist noch nicht vorhanden, also kopiere es
+ aFindFrm.pNewFrmFmt = pCpyPara->pDoc->MakeTableBoxFmt();
+ aFindFrm.pNewFrmFmt->CopyAttrs( *rpFndBox->GetBox()->GetFrmFmt() );
+ if( !pCpyPara->bCpyCntnt )
+ aFindFrm.pNewFrmFmt->ResetFmtAttr( RES_BOXATR_FORMULA, RES_BOXATR_VALUE );
+ aFrmSz.SetWidth( nSize );
+ aFindFrm.pNewFrmFmt->SetFmtAttr( aFrmSz );
+ pCpyPara->rTabFrmArr.Insert( aFindFrm );
+ }
+
+ SwTableBox* pBox;
+ if( rpFndBox->GetLines().Count() )
+ {
+ pBox = new SwTableBox( aFindFrm.pNewFrmFmt,
+ rpFndBox->GetLines().Count(), pCpyPara->pInsLine );
+ pCpyPara->pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, pCpyPara->nInsPos++ );
+ _CpyPara aPara( *pCpyPara, pBox );
+ aPara.nNewSize = nSize; // hole die Groesse
+ ((_FndBox*)rpFndBox)->GetLines().ForEach( &lcl_CopyLineToDoc, &aPara );
+ }
+ else
+ {
+ // erzeuge eine leere Box
+ pCpyPara->pDoc->GetNodes().InsBoxen( pCpyPara->pTblNd, pCpyPara->pInsLine,
+ aFindFrm.pNewFrmFmt,
+ (SwTxtFmtColl*)pCpyPara->pDoc->GetDfltTxtFmtColl(),
+ 0, pCpyPara->nInsPos );
+ pBox = pCpyPara->pInsLine->GetTabBoxes()[ pCpyPara->nInsPos ];
+ if( bDummy )
+ pBox->setDummyFlag( true );
+ else if( pCpyPara->bCpyCntnt )
+ {
+ // dann kopiere mal den Inhalt in diese leere Box
+ pBox->setRowSpan( rpFndBox->GetBox()->getRowSpan() );
+
+ // der Inhalt kopiert wird, dann koennen auch Formeln&Values
+ // kopiert werden.
+ {
+ SfxItemSet aBoxAttrSet( pCpyPara->pDoc->GetAttrPool(),
+ RES_BOXATR_FORMAT, RES_BOXATR_VALUE );
+ aBoxAttrSet.Put( rpFndBox->GetBox()->GetFrmFmt()->GetAttrSet() );
+ if( aBoxAttrSet.Count() )
+ {
+ const SfxPoolItem* pItem;
+ SvNumberFormatter* pN = pCpyPara->pDoc->GetNumberFormatter( sal_False );
+ if( pN && pN->HasMergeFmtTbl() && SFX_ITEM_SET == aBoxAttrSet.
+ GetItemState( RES_BOXATR_FORMAT, sal_False, &pItem ) )
+ {
+ sal_uLong nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue();
+ sal_uLong nNewIdx = pN->GetMergeFmtIndex( nOldIdx );
+ if( nNewIdx != nOldIdx )
+ aBoxAttrSet.Put( SwTblBoxNumFormat( nNewIdx ));
+ }
+ pBox->ClaimFrmFmt()->SetFmtAttr( aBoxAttrSet );
+ }
+ }
+ SwDoc* pFromDoc = rpFndBox->GetBox()->GetFrmFmt()->GetDoc();
+ SwNodeRange aCpyRg( *rpFndBox->GetBox()->GetSttNd(), 1,
+ *rpFndBox->GetBox()->GetSttNd()->EndOfSectionNode() );
+ SwNodeIndex aInsIdx( *pBox->GetSttNd(), 1 );
+
+ pFromDoc->CopyWithFlyInFly( aCpyRg, 0, aInsIdx, sal_False );
+ // den initialen TextNode loeschen
+ pCpyPara->pDoc->GetNodes().Delete( aInsIdx, 1 );
+ }
+ ++pCpyPara->nInsPos;
+ }
+ if( nRealSize )
+ {
+ bDummy = false;
+ nSize = nRealSize;
+ nRealSize = 0;
+ }
+ else
+ {
+ bDummy = true;
+ nSize = nDummy2;
+ nDummy2 = 0;
+ }
+ }
+ while( nSize );
+ return sal_True;
+}
+
+sal_Bool lcl_CopyLineToDoc( const _FndLine*& rpFndLine, void* pPara )
+{
+ _CpyPara* pCpyPara = (_CpyPara*)pPara;
+
+ // suche das Format in der Liste aller Formate
+ _CpyTabFrm aFindFrm( (SwTableBoxFmt*)rpFndLine->GetLine()->GetFrmFmt() );
+ sal_uInt16 nFndPos;
+ if( !pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos ))
+ {
+ // es ist noch nicht vorhanden, also kopiere es
+ aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pCpyPara->pDoc->MakeTableLineFmt();
+ aFindFrm.pNewFrmFmt->CopyAttrs( *rpFndLine->GetLine()->GetFrmFmt() );
+ pCpyPara->rTabFrmArr.Insert( aFindFrm );
+ }
+ else
+ aFindFrm = pCpyPara->rTabFrmArr[ nFndPos ];
+
+ SwTableLine* pNewLine = new SwTableLine( (SwTableLineFmt*)aFindFrm.pNewFrmFmt,
+ rpFndLine->GetBoxes().Count(), pCpyPara->pInsBox );
+ if( pCpyPara->pInsBox )
+ {
+ pCpyPara->pInsBox->GetTabLines().C40_INSERT( SwTableLine, pNewLine, pCpyPara->nInsPos++ );
+ }
+ else
+ {
+ pCpyPara->pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pNewLine,
+ pCpyPara->nInsPos++ );
+ }
+
+ _CpyPara aPara( *pCpyPara, pNewLine );
+
+ if( pCpyPara->pTblNd->GetTable().IsNewModel() )
+ {
+ aPara.nOldSize = 0; // will not be used
+ aPara.nBoxIdx = 1;
+ }
+ else if( rpFndLine->GetBoxes().Count() ==
+ rpFndLine->GetLine()->GetTabBoxes().Count() )
+ {
+ // hole die Size vom Parent
+ const SwFrmFmt* pFmt;
+
+ if( rpFndLine->GetLine()->GetUpper() )
+ pFmt = rpFndLine->GetLine()->GetUpper()->GetFrmFmt();
+ else
+ pFmt = pCpyPara->pTblNd->GetTable().GetFrmFmt();
+ aPara.nOldSize = pFmt->GetFrmSize().GetWidth();
+ }
+ else
+ // errechne sie
+ for( sal_uInt16 n = 0; n < rpFndLine->GetBoxes().Count(); ++n )
+ aPara.nOldSize += rpFndLine->GetBoxes()[n]
+ ->GetBox()->GetFrmFmt()->GetFrmSize().GetWidth();
+
+ ((_FndLine*)rpFndLine)->GetBoxes().ForEach( &lcl_CopyBoxToDoc, &aPara );
+ if( pCpyPara->pTblNd->GetTable().IsNewModel() )
+ ++pCpyPara->nLnIdx;
+ return sal_True;
+}
+
+sal_Bool SwTable::CopyHeadlineIntoTable( SwTableNode& rTblNd )
+{
+ // suche alle Boxen / Lines
+ SwSelBoxes aSelBoxes;
+ SwTableBox* pBox = GetTabSortBoxes()[ 0 ];
+ pBox = GetTblBox( pBox->GetSttNd()->StartOfSectionNode()->GetIndex() + 1 );
+ SelLineFromBox( pBox, aSelBoxes, sal_True );
+
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aPara( aSelBoxes, &aFndBox );
+ ((SwTableLines&)GetTabLines()).ForEach( &_FndLineCopyCol, &aPara );
+ }
+ if( !aFndBox.GetLines().Count() )
+ return sal_False;
+
+ {
+ // Tabellen-Formeln in die relative Darstellung umwandeln
+ SwTableFmlUpdate aMsgHnt( this );
+ aMsgHnt.eFlags = TBL_RELBOXNAME;
+ GetFrmFmt()->GetDoc()->UpdateTblFlds( &aMsgHnt );
+ }
+
+ _CpyTabFrms aCpyFmt;
+ _CpyPara aPara( &rTblNd, 1, aCpyFmt, sal_True );
+ aPara.nNewSize = aPara.nOldSize = rTblNd.GetTable().GetFrmFmt()->GetFrmSize().GetWidth();
+ // dann kopiere mal
+ if( IsNewModel() )
+ lcl_CalcNewWidths( aFndBox.GetLines(), aPara );
+ aFndBox.GetLines().ForEach( &lcl_CopyLineToDoc, &aPara );
+ if( rTblNd.GetTable().IsNewModel() )
+ { // The copied line must not contain any row span attributes > 1
+ SwTableLine* pLine = rTblNd.GetTable().GetTabLines()[0];
+ sal_uInt16 nColCount = pLine->GetTabBoxes().Count();
+ ASSERT( nColCount, "Empty Table Line" )
+ for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
+ {
+ SwTableBox* pTableBox = pLine->GetTabBoxes()[nCurrCol];
+ ASSERT( pTableBox, "Missing Table Box" );
+ pTableBox->setRowSpan( 1 );
+ }
+ }
+
+ return sal_True;
+}
+
+sal_Bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos,
+ const SwSelBoxes& rSelBoxes, sal_Bool bCpyNds,
+ sal_Bool bCpyName ) const
+{
+ // suche alle Boxen / Lines
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aPara( rSelBoxes, &aFndBox );
+ ((SwTableLines&)GetTabLines()).ForEach( &_FndLineCopyCol, &aPara );
+ }
+ if( !aFndBox.GetLines().Count() )
+ return sal_False;
+
+ // erst die Poolvorlagen fuer die Tabelle kopieren, damit die dann
+ // wirklich kopiert und damit die gueltigen Werte haben.
+ SwDoc* pSrcDoc = GetFrmFmt()->GetDoc();
+ if( pSrcDoc != pInsDoc )
+ {
+ pInsDoc->CopyTxtColl( *pSrcDoc->GetTxtCollFromPool( RES_POOLCOLL_TABLE ) );
+ pInsDoc->CopyTxtColl( *pSrcDoc->GetTxtCollFromPool( RES_POOLCOLL_TABLE_HDLN ) );
+ }
+
+ SwTable* pNewTbl = (SwTable*)pInsDoc->InsertTable(
+ SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ),
+ rPos, 1, 1, GetFrmFmt()->GetHoriOrient().GetHoriOrient(),
+ 0, 0, sal_False, IsNewModel() );
+ if( !pNewTbl )
+ return sal_False;
+
+ SwNodeIndex aIdx( rPos.nNode, -1 );
+ SwTableNode* pTblNd = aIdx.GetNode().FindTableNode();
+ aIdx++;
+ ASSERT( pTblNd, "wo ist denn nun der TableNode?" );
+
+ pTblNd->GetTable().SetRowsToRepeat( GetRowsToRepeat() );
+
+ if( IS_TYPE( SwDDETable, this ))
+ {
+ // es wird eine DDE-Tabelle kopiert
+ // ist im neuen Dokument ueberhaupt der FeldTyp vorhanden ?
+ SwFieldType* pFldType = pInsDoc->InsertFldType(
+ *((SwDDETable*)this)->GetDDEFldType() );
+ ASSERT( pFldType, "unbekannter FieldType" );
+
+ // tauschen am Node den Tabellen-Pointer aus
+ pNewTbl = new SwDDETable( *pNewTbl,
+ (SwDDEFieldType*)pFldType );
+ pTblNd->SetNewTable( pNewTbl, sal_False );
+ }
+
+ pNewTbl->GetFrmFmt()->CopyAttrs( *GetFrmFmt() );
+ pNewTbl->SetTblChgMode( GetTblChgMode() );
+
+ //Vernichten der Frms die bereits angelegt wurden.
+ pTblNd->DelFrms();
+
+ {
+ // Tabellen-Formeln in die relative Darstellung umwandeln
+ SwTableFmlUpdate aMsgHnt( this );
+ aMsgHnt.eFlags = TBL_RELBOXNAME;
+ pSrcDoc->UpdateTblFlds( &aMsgHnt );
+ }
+
+ SwTblNumFmtMerge aTNFM( *pSrcDoc, *pInsDoc );
+
+ // Namen auch kopieren oder neuen eindeutigen erzeugen
+ if( bCpyName )
+ pNewTbl->GetFrmFmt()->SetName( GetFrmFmt()->GetName() );
+
+ _CpyTabFrms aCpyFmt;
+ _CpyPara aPara( pTblNd, 1, aCpyFmt, bCpyNds );
+ aPara.nNewSize = aPara.nOldSize = GetFrmFmt()->GetFrmSize().GetWidth();
+
+ if( IsNewModel() )
+ lcl_CalcNewWidths( aFndBox.GetLines(), aPara );
+ // dann kopiere mal
+ aFndBox.GetLines().ForEach( &lcl_CopyLineToDoc, &aPara );
+
+ // dann setze oben und unten noch die "richtigen" Raender:
+ {
+ _FndLine* pFndLn = aFndBox.GetLines()[ 0 ];
+ SwTableLine* pLn = pFndLn->GetLine();
+ const SwTableLine* pTmp = pLn;
+ sal_uInt16 nLnPos = GetTabLines().GetPos( pTmp );
+ if( USHRT_MAX != nLnPos && nLnPos )
+ {
+ // es gibt eine Line davor
+ SwCollectTblLineBoxes aLnPara( sal_False, HEADLINE_BORDERCOPY );
+
+ pLn = GetTabLines()[ nLnPos - 1 ];
+ pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aLnPara );
+
+ if( aLnPara.Resize( lcl_GetBoxOffset( aFndBox ),
+ lcl_GetLineWidth( *pFndLn )) )
+ {
+ aLnPara.SetValues( sal_True );
+ pLn = pNewTbl->GetTabLines()[ 0 ];
+ pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aLnPara );
+ }
+ }
+
+ pFndLn = aFndBox.GetLines()[ aFndBox.GetLines().Count() -1 ];
+ pLn = pFndLn->GetLine();
+ pTmp = pLn;
+ nLnPos = GetTabLines().GetPos( pTmp );
+ if( nLnPos < GetTabLines().Count() - 1 )
+ {
+ // es gibt eine Line dahinter
+ SwCollectTblLineBoxes aLnPara( sal_True, HEADLINE_BORDERCOPY );
+
+ pLn = GetTabLines()[ nLnPos + 1 ];
+ pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aLnPara );
+
+ if( aLnPara.Resize( lcl_GetBoxOffset( aFndBox ),
+ lcl_GetLineWidth( *pFndLn )) )
+ {
+ aLnPara.SetValues( sal_False );
+ pLn = pNewTbl->GetTabLines()[ pNewTbl->GetTabLines().Count()-1 ];
+ pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aLnPara );
+ }
+ }
+ }
+
+ // die initiale Box muss noch geloescht werden
+ _DeleteBox( *pNewTbl, pNewTbl->GetTabLines()[
+ pNewTbl->GetTabLines().Count() - 1 ]->GetTabBoxes()[0],
+ 0, sal_False, sal_False );
+
+ if( pNewTbl->IsNewModel() )
+ lcl_CheckRowSpan( *pNewTbl );
+ // Mal kurz aufraeumen:
+ pNewTbl->GCLines();
+
+ pTblNd->MakeFrms( &aIdx ); // erzeuge die Frames neu
+
+ CHECKTABLELAYOUT
+
+ return sal_True;
+}
+
+
+
+// ---------------------------------------------------------------
+
+// suche ab dieser Line nach der naechsten Box mit Inhalt
+SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl,
+ const SwTableBox* pSrchBox, sal_Bool bOvrTblLns ) const
+{
+ const SwTableLine* pLine = this; // fuer M800
+ SwTableBox* pBox;
+ sal_uInt16 nFndPos;
+ if( GetTabBoxes().Count() && pSrchBox &&
+ USHRT_MAX != ( nFndPos = GetTabBoxes().GetPos( pSrchBox )) &&
+ nFndPos + 1 != GetTabBoxes().Count() )
+ {
+ pBox = GetTabBoxes()[ nFndPos + 1 ];
+ while( pBox->GetTabLines().Count() )
+ pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0];
+ return pBox;
+ }
+
+ if( GetUpper() )
+ {
+ nFndPos = GetUpper()->GetTabLines().GetPos( pLine );
+ ASSERT( USHRT_MAX != nFndPos, "Line nicht in der Tabelle" );
+ // gibts eine weitere Line
+ if( nFndPos+1 >= GetUpper()->GetTabLines().Count() )
+ return GetUpper()->GetUpper()->FindNextBox( rTbl, GetUpper(), bOvrTblLns );
+ pLine = GetUpper()->GetTabLines()[nFndPos+1];
+ }
+ else if( bOvrTblLns ) // ueber die "GrundLines" einer Tabelle ?
+ {
+ // suche in der Tabelle nach der naechsten Line
+ nFndPos = rTbl.GetTabLines().GetPos( pLine );
+ if( nFndPos + 1 >= rTbl.GetTabLines().Count() )
+ return 0; // es gibt keine weitere Box mehr
+
+ pLine = rTbl.GetTabLines()[ nFndPos+1 ];
+ }
+ else
+ return 0;
+
+ if( pLine->GetTabBoxes().Count() )
+ {
+ pBox = pLine->GetTabBoxes()[0];
+ while( pBox->GetTabLines().Count() )
+ pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0];
+ return pBox;
+ }
+ return pLine->FindNextBox( rTbl, 0, bOvrTblLns );
+}
+
+// suche ab dieser Line nach der vorherigen Box
+SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl,
+ const SwTableBox* pSrchBox, sal_Bool bOvrTblLns ) const
+{
+ const SwTableLine* pLine = this; // fuer M800
+ SwTableBox* pBox;
+ sal_uInt16 nFndPos;
+ if( GetTabBoxes().Count() && pSrchBox &&
+ USHRT_MAX != ( nFndPos = GetTabBoxes().GetPos( pSrchBox )) &&
+ nFndPos )
+ {
+ pBox = GetTabBoxes()[ nFndPos - 1 ];
+ while( pBox->GetTabLines().Count() )
+ {
+ pLine = pBox->GetTabLines()[pBox->GetTabLines().Count()-1];
+ pBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1];
+ }
+ return pBox;
+ }
+
+ if( GetUpper() )
+ {
+ nFndPos = GetUpper()->GetTabLines().GetPos( pLine );
+ ASSERT( USHRT_MAX != nFndPos, "Line nicht in der Tabelle" );
+ // gibts eine weitere Line
+ if( !nFndPos )
+ return GetUpper()->GetUpper()->FindPreviousBox( rTbl, GetUpper(), bOvrTblLns );
+ pLine = GetUpper()->GetTabLines()[nFndPos-1];
+ }
+ else if( bOvrTblLns ) // ueber die "GrundLines" einer Tabelle ?
+ {
+ // suche in der Tabelle nach der naechsten Line
+ nFndPos = rTbl.GetTabLines().GetPos( pLine );
+ if( !nFndPos )
+ return 0; // es gibt keine weitere Box mehr
+
+ pLine = rTbl.GetTabLines()[ nFndPos-1 ];
+ }
+ else
+ return 0;
+
+ if( pLine->GetTabBoxes().Count() )
+ {
+ pBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1];
+ while( pBox->GetTabLines().Count() )
+ {
+ pLine = pBox->GetTabLines()[pBox->GetTabLines().Count()-1];
+ pBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1];
+ }
+ return pBox;
+ }
+ return pLine->FindPreviousBox( rTbl, 0, bOvrTblLns );
+}
+
+// suche ab dieser Line nach der naechsten Box mit Inhalt
+SwTableBox* SwTableBox::FindNextBox( const SwTable& rTbl,
+ const SwTableBox* pSrchBox, sal_Bool bOvrTblLns ) const
+{
+ if( !pSrchBox && !GetTabLines().Count() )
+ return (SwTableBox*)this;
+ return GetUpper()->FindNextBox( rTbl, pSrchBox ? pSrchBox : this,
+ bOvrTblLns );
+
+}
+
+// suche ab dieser Line nach der naechsten Box mit Inhalt
+SwTableBox* SwTableBox::FindPreviousBox( const SwTable& rTbl,
+ const SwTableBox* pSrchBox, sal_Bool bOvrTblLns ) const
+{
+ if( !pSrchBox && !GetTabLines().Count() )
+ return (SwTableBox*)this;
+ return GetUpper()->FindPreviousBox( rTbl, pSrchBox ? pSrchBox : this,
+ bOvrTblLns );
+}
+
+
+sal_Bool lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* )
+{
+ // in der HeadLine sind die Absaetze mit BedingtenVorlage anzupassen
+ const SwStartNode* pSttNd = rpBox->GetSttNd();
+ if( pSttNd )
+ pSttNd->CheckSectionCondColl();
+ else
+ ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_LineSetHeadCondColl, 0 );
+ return sal_True;
+}
+
+sal_Bool lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* )
+{
+ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_BoxSetHeadCondColl, 0 );
+ return sal_True;
+}
+
+/* */
+
+SwTwips lcl_GetDistance( SwTableBox* pBox, sal_Bool bLeft )
+{
+ sal_Bool bFirst = sal_True;
+ SwTwips nRet = 0;
+ SwTableLine* pLine;
+ while( pBox && 0 != ( pLine = pBox->GetUpper() ) )
+ {
+ sal_uInt16 nStt = 0, nPos = pLine->GetTabBoxes().C40_GETPOS( SwTableBox, pBox );
+
+ if( bFirst && !bLeft )
+ ++nPos;
+ bFirst = sal_False;
+
+ while( nStt < nPos )
+ nRet += pLine->GetTabBoxes()[ nStt++ ]->GetFrmFmt()
+ ->GetFrmSize().GetWidth();
+ pBox = pLine->GetUpper();
+ }
+ return nRet;
+}
+
+sal_Bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck )
+{
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ {
+ SwTableBox* pBox = rBoxes[ n ];
+ SwFrmFmt* pFmt = pBox->GetFrmFmt();
+ const SwFmtFrmSize& rSz = pFmt->GetFrmSize();
+ SwTwips nWidth = rSz.GetWidth();
+ sal_Bool bGreaterBox = sal_False;
+
+ if( bCheck )
+ {
+ for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i )
+ if( !::lcl_SetSelBoxWidth( pBox->GetTabLines()[ i ], rParam,
+ nDist, sal_True ))
+ return sal_False;
+
+ // dann noch mal alle "ContentBoxen" sammeln
+ if( ( 0 != ( bGreaterBox = TBLFIX_CHGABS != rParam.nMode && ( nDist + ( rParam.bLeft ? 0 : nWidth ) ) >= rParam.nSide)) ||
+ ( !rParam.bBigger && ( Abs( nDist + (( rParam.nMode && rParam.bLeft ) ? 0 : nWidth ) - rParam.nSide ) < COLFUZZY ) ) )
+ {
+ rParam.bAnyBoxFnd = sal_True;
+ SwTwips nLowerDiff;
+ if( bGreaterBox && TBLFIX_CHGPROP == rParam.nMode )
+ {
+ // die "anderen Boxen" wurden angepasst,
+ // also sich um diesen Betrag aendern
+ nLowerDiff = (nDist + ( rParam.bLeft ? 0 : nWidth ) ) - rParam.nSide;
+ nLowerDiff *= rParam.nDiff;
+ nLowerDiff /= rParam.nMaxSize;
+ nLowerDiff = rParam.nDiff - nLowerDiff;
+ }
+ else
+ nLowerDiff = rParam.nDiff;
+
+ if( nWidth < nLowerDiff || nWidth - nLowerDiff < MINLAY )
+ return sal_False;
+ }
+ }
+ else
+ {
+ SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff;
+ for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i )
+ {
+ rParam.nLowerDiff = 0;
+ lcl_SetSelBoxWidth( pBox->GetTabLines()[ i ], rParam, nDist, sal_False );
+
+ if( nLowerDiff < rParam.nLowerDiff )
+ nLowerDiff = rParam.nLowerDiff;
+ }
+ rParam.nLowerDiff = nOldLower;
+
+
+ if( nLowerDiff ||
+ ( 0 != ( bGreaterBox = !nOldLower && TBLFIX_CHGABS != rParam.nMode &&
+ ( nDist + ( rParam.bLeft ? 0 : nWidth ) ) >= rParam.nSide)) ||
+ ( Abs( nDist + ( (rParam.nMode && rParam.bLeft) ? 0 : nWidth )
+ - rParam.nSide ) < COLFUZZY ))
+ {
+ // in dieser Spalte ist der Cursor - also verkleinern / vergroessern
+ SwFmtFrmSize aNew( rSz );
+
+ if( !nLowerDiff )
+ {
+ if( bGreaterBox && TBLFIX_CHGPROP == rParam.nMode )
+ {
+ // die "anderen Boxen" wurden angepasst,
+ // also sich um diesen Betrag aendern
+ nLowerDiff = (nDist + ( rParam.bLeft ? 0 : nWidth ) ) - rParam.nSide;
+ nLowerDiff *= rParam.nDiff;
+ nLowerDiff /= rParam.nMaxSize;
+ nLowerDiff = rParam.nDiff - nLowerDiff;
+ }
+ else
+ nLowerDiff = rParam.nDiff;
+ }
+
+ rParam.nLowerDiff += nLowerDiff;
+
+ if( rParam.bBigger )
+ aNew.SetWidth( nWidth + nLowerDiff );
+ else
+ aNew.SetWidth( nWidth - nLowerDiff );
+ rParam.aShareFmts.SetSize( *pBox, aNew );
+ break;
+ }
+ }
+
+ if( rParam.bLeft && rParam.nMode && nDist >= rParam.nSide )
+ break;
+
+ nDist += nWidth;
+
+ // wenns groesser wird, dann wars das
+ if( ( TBLFIX_CHGABS == rParam.nMode || !rParam.bLeft ) &&
+ nDist >= rParam.nSide )
+ break;
+ }
+ return sal_True;
+}
+
+sal_Bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck )
+{
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ {
+ SwTableBox* pBox = rBoxes[ n ];
+ SwFrmFmt* pFmt = pBox->GetFrmFmt();
+ const SwFmtFrmSize& rSz = pFmt->GetFrmSize();
+ SwTwips nWidth = rSz.GetWidth();
+
+ if( bCheck )
+ {
+ for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i )
+ if( !::lcl_SetOtherBoxWidth( pBox->GetTabLines()[ i ],
+ rParam, nDist, sal_True ))
+ return sal_False;
+
+ if( rParam.bBigger && ( TBLFIX_CHGABS == rParam.nMode
+ ? Abs( nDist - rParam.nSide ) < COLFUZZY
+ : ( rParam.bLeft ? nDist < rParam.nSide - COLFUZZY
+ : nDist >= rParam.nSide - COLFUZZY )) )
+ {
+ rParam.bAnyBoxFnd = sal_True;
+ SwTwips nDiff;
+ if( TBLFIX_CHGPROP == rParam.nMode ) // Tabelle fix, proport.
+ {
+ // relativ berechnen
+ nDiff = nWidth;
+ nDiff *= rParam.nDiff;
+ nDiff /= rParam.nMaxSize;
+ }
+ else
+ nDiff = rParam.nDiff;
+
+ if( nWidth < nDiff || nWidth - nDiff < MINLAY )
+ return sal_False;
+ }
+ }
+ else
+ {
+ SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff;
+ for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i )
+ {
+ rParam.nLowerDiff = 0;
+ lcl_SetOtherBoxWidth( pBox->GetTabLines()[ i ], rParam,
+ nDist, sal_False );
+
+ if( nLowerDiff < rParam.nLowerDiff )
+ nLowerDiff = rParam.nLowerDiff;
+ }
+ rParam.nLowerDiff = nOldLower;
+
+ if( nLowerDiff ||
+ ( TBLFIX_CHGABS == rParam.nMode
+ ? Abs( nDist - rParam.nSide ) < COLFUZZY
+ : ( rParam.bLeft ? nDist < rParam.nSide - COLFUZZY
+ : nDist >= rParam.nSide - COLFUZZY)
+ ) )
+ {
+ SwFmtFrmSize aNew( rSz );
+
+ if( !nLowerDiff )
+ {
+ if( TBLFIX_CHGPROP == rParam.nMode ) // Tabelle fix, proport.
+ {
+ // relativ berechnen
+ nLowerDiff = nWidth;
+ nLowerDiff *= rParam.nDiff;
+ nLowerDiff /= rParam.nMaxSize;
+ }
+ else
+ nLowerDiff = rParam.nDiff;
+ }
+
+ rParam.nLowerDiff += nLowerDiff;
+
+ if( rParam.bBigger )
+ aNew.SetWidth( nWidth - nLowerDiff );
+ else
+ aNew.SetWidth( nWidth + nLowerDiff );
+
+ rParam.aShareFmts.SetSize( *pBox, aNew );
+ }
+ }
+
+ nDist += nWidth;
+ if( ( TBLFIX_CHGABS == rParam.nMode || rParam.bLeft ) &&
+ nDist > rParam.nSide )
+ break;
+ }
+ return sal_True;
+}
+
+/* */
+
+sal_Bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck )
+{
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ sal_uInt16 n, nCmp;
+ for( n = 0; n < rBoxes.Count(); ++n )
+ {
+ SwTableBox* pBox = rBoxes[ n ];
+ SwTableBoxFmt* pFmt = (SwTableBoxFmt*)pBox->GetFrmFmt();
+ const SwFmtFrmSize& rSz = pFmt->GetFrmSize();
+ SwTwips nWidth = rSz.GetWidth();
+
+ if( bCheck )
+ {
+ for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i )
+ if( !::lcl_InsSelBox( pBox->GetTabLines()[ i ], rParam,
+ nDist, sal_True ))
+ return sal_False;
+
+ // dann noch mal alle "ContentBoxen" sammeln
+ if( Abs( nDist + ( rParam.bLeft ? 0 : nWidth )
+ - rParam.nSide ) < COLFUZZY )
+ nCmp = 1;
+ else if( nDist + ( rParam.bLeft ? 0 : nWidth/2 ) > rParam.nSide )
+ nCmp = 2;
+ else
+ nCmp = 0;
+
+ if( nCmp )
+ {
+ rParam.bAnyBoxFnd = sal_True;
+ if( pFmt->GetProtect().IsCntntProtected() )
+ return sal_False;
+
+ if( rParam.bSplittBox &&
+ nWidth - rParam.nDiff <= COLFUZZY +
+ ( 567 / 2 /* min. 0,5 cm Platz lassen*/) )
+ return sal_False;
+
+ if( pBox->GetSttNd() )
+ rParam.aBoxes.Insert( pBox );
+
+ break;
+ }
+ }
+ else
+ {
+ SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff;
+ for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i )
+ {
+ rParam.nLowerDiff = 0;
+ lcl_InsSelBox( pBox->GetTabLines()[ i ], rParam, nDist, sal_False );
+
+ if( nLowerDiff < rParam.nLowerDiff )
+ nLowerDiff = rParam.nLowerDiff;
+ }
+ rParam.nLowerDiff = nOldLower;
+
+ if( nLowerDiff )
+ nCmp = 1;
+ else if( Abs( nDist + ( rParam.bLeft ? 0 : nWidth )
+ - rParam.nSide ) < COLFUZZY )
+ nCmp = 2;
+ else if( nDist + nWidth / 2 > rParam.nSide )
+ nCmp = 3;
+ else
+ nCmp = 0;
+
+ if( nCmp )
+ {
+ // in dieser Spalte ist der Cursor - also verkleinern / vergroessern
+ if( 1 == nCmp )
+ {
+ if( !rParam.bSplittBox )
+ {
+ // die akt. Box auf
+ SwFmtFrmSize aNew( rSz );
+ aNew.SetWidth( nWidth + rParam.nDiff );
+ rParam.aShareFmts.SetSize( *pBox, aNew );
+ }
+ }
+ else
+ {
+ ASSERT( pBox->GetSttNd(), "Das muss eine EndBox sein!");
+
+ if( !rParam.bLeft && 3 != nCmp )
+ ++n;
+
+ ::_InsTblBox( pFmt->GetDoc(), rParam.pTblNd,
+ pLine, pFmt, pBox, n );
+
+ SwTableBox* pNewBox = rBoxes[ n ];
+ SwFmtFrmSize aNew( rSz );
+ aNew.SetWidth( rParam.nDiff );
+ rParam.aShareFmts.SetSize( *pNewBox, aNew );
+
+ // Sonderfall: kein Platz in den anderen Boxen
+ // aber in der Zelle
+ if( rParam.bSplittBox )
+ {
+ // die akt. Box auf
+ SwFmtFrmSize aNewSize( rSz );
+ aNewSize.SetWidth( nWidth - rParam.nDiff );
+ rParam.aShareFmts.SetSize( *pBox, aNewSize );
+ }
+
+ // Sonderbehandlung fuer Umrandung die Rechte muss
+ // entfernt werden
+ {
+ const SvxBoxItem& rBoxItem = pBox->GetFrmFmt()->GetBox();
+ if( rBoxItem.GetRight() )
+ {
+ SvxBoxItem aTmp( rBoxItem );
+ aTmp.SetLine( 0, BOX_LINE_RIGHT );
+ rParam.aShareFmts.SetAttr( rParam.bLeft
+ ? *pNewBox
+ : *pBox, aTmp );
+ }
+ }
+ }
+
+ rParam.nLowerDiff = rParam.nDiff;
+ break;
+ }
+ }
+
+ if( rParam.bLeft && rParam.nMode && nDist >= rParam.nSide )
+ break;
+
+ nDist += nWidth;
+ }
+ return sal_True;
+}
+
+sal_Bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck )
+{
+ // Sonderfall: kein Platz in den anderen Boxen aber in der Zelle
+ if( rParam.bSplittBox )
+ return sal_True;
+
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ sal_uInt16 n;
+
+ // Tabelle fix, proport.
+ if( !rParam.nRemainWidth && TBLFIX_CHGPROP == rParam.nMode )
+ {
+ // dann die richtige Breite suchen, auf die sich die relative
+ // Breitenanpassung bezieht.
+ SwTwips nTmpDist = nDist;
+ for( n = 0; n < rBoxes.Count(); ++n )
+ {
+ SwTwips nWidth = rBoxes[ n ]->GetFrmFmt()->GetFrmSize().GetWidth();
+ if( (nTmpDist + nWidth / 2 ) > rParam.nSide )
+ {
+ rParam.nRemainWidth = rParam.bLeft
+ ? sal_uInt16(nTmpDist)
+ : sal_uInt16(rParam.nTblWidth - nTmpDist);
+ break;
+ }
+ nTmpDist += nWidth;
+ }
+ }
+
+ for( n = 0; n < rBoxes.Count(); ++n )
+ {
+ SwTableBox* pBox = rBoxes[ n ];
+ SwFrmFmt* pFmt = pBox->GetFrmFmt();
+ const SwFmtFrmSize& rSz = pFmt->GetFrmSize();
+ SwTwips nWidth = rSz.GetWidth();
+
+ if( bCheck )
+ {
+ for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i )
+ if( !::lcl_InsOtherBox( pBox->GetTabLines()[ i ],
+ rParam, nDist, sal_True ))
+ return sal_False;
+
+ if(
+ rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide &&
+ (TBLFIX_CHGABS != rParam.nMode ||
+ (n < rBoxes.Count() &&
+ (nDist + nWidth + rBoxes[ n+1 ]->
+ GetFrmFmt()->GetFrmSize().GetWidth() / 2)
+ > rParam.nSide) ))
+ : (nDist + nWidth / 2 ) > rParam.nSide
+ )
+ {
+ rParam.bAnyBoxFnd = sal_True;
+ SwTwips nDiff;
+ if( TBLFIX_CHGPROP == rParam.nMode ) // Tabelle fix, proport.
+ {
+ // relativ berechnen
+ nDiff = nWidth;
+ nDiff *= rParam.nDiff;
+ nDiff /= rParam.nRemainWidth;
+
+ if( nWidth < nDiff || nWidth - nDiff < MINLAY )
+ return sal_False;
+ }
+ else
+ {
+ nDiff = rParam.nDiff;
+
+ // teste ob die linke oder rechte Box gross genug
+ // ist, um den Platz abzugeben!
+ // es wird davor oder dahinter eine Box eingefuegt!
+ SwTwips nTmpWidth = nWidth;
+ if( rParam.bLeft && pBox->GetUpper()->GetUpper() )
+ {
+ const SwTableBox* pTmpBox = pBox;
+ sal_uInt16 nBoxPos = n;
+ while( !nBoxPos && pTmpBox->GetUpper()->GetUpper() )
+ {
+ pTmpBox = pTmpBox->GetUpper()->GetUpper();
+ nBoxPos = pTmpBox->GetUpper()->GetTabBoxes().GetPos( pTmpBox );
+ }
+// if( nBoxPos )
+ nTmpWidth = pTmpBox->GetFrmFmt()->GetFrmSize().GetWidth();
+// else
+// nTmpWidth = 0;
+ }
+
+ if( nTmpWidth < nDiff || nTmpWidth - nDiff < MINLAY )
+ return sal_False;
+ break;
+ }
+ }
+ }
+ else
+ {
+ SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff;
+ for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i )
+ {
+ rParam.nLowerDiff = 0;
+ lcl_InsOtherBox( pBox->GetTabLines()[ i ], rParam,
+ nDist, sal_False );
+
+ if( nLowerDiff < rParam.nLowerDiff )
+ nLowerDiff = rParam.nLowerDiff;
+ }
+ rParam.nLowerDiff = nOldLower;
+
+ if( nLowerDiff ||
+ (rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide &&
+ (TBLFIX_CHGABS != rParam.nMode ||
+ (n < rBoxes.Count() &&
+ (nDist + nWidth + rBoxes[ n+1 ]->
+ GetFrmFmt()->GetFrmSize().GetWidth() / 2)
+ > rParam.nSide) ))
+ : (nDist + nWidth / 2 ) > rParam.nSide ))
+ {
+ if( !nLowerDiff )
+ {
+ if( TBLFIX_CHGPROP == rParam.nMode ) // Tabelle fix, proport.
+ {
+ // relativ berechnen
+ nLowerDiff = nWidth;
+ nLowerDiff *= rParam.nDiff;
+ nLowerDiff /= rParam.nRemainWidth;
+ }
+ else
+ nLowerDiff = rParam.nDiff;
+ }
+
+ SwFmtFrmSize aNew( rSz );
+ rParam.nLowerDiff += nLowerDiff;
+
+ if( rParam.bBigger )
+ aNew.SetWidth( nWidth - nLowerDiff );
+ else
+ aNew.SetWidth( nWidth + nLowerDiff );
+ rParam.aShareFmts.SetSize( *pBox, aNew );
+
+ if( TBLFIX_CHGABS == rParam.nMode )
+ break;
+ }
+ }
+
+ nDist += nWidth;
+ }
+ return sal_True;
+}
+
+
+// das Ergebnis des Positions Vergleiches
+// POS_BEFORE, // Box liegt davor
+// POS_BEHIND, // Box liegt dahinter
+// POS_INSIDE, // Box liegt vollstaendig in Start/End
+// POS_OUTSIDE, // Box ueberlappt Start/End vollstaendig
+// POS_EQUAL, // Box und Start/End sind gleich
+// POS_OVERLAP_BEFORE, // Box ueberlappt den Start
+// POS_OVERLAP_BEHIND // Box ueberlappt das Ende
+
+SwComparePosition _CheckBoxInRange( sal_uInt16 nStt, sal_uInt16 nEnd,
+ sal_uInt16 nBoxStt, sal_uInt16 nBoxEnd )
+{
+// COLFUZZY noch beachten!!
+ SwComparePosition nRet;
+ if( nBoxStt + COLFUZZY < nStt )
+ {
+ if( nBoxEnd > nStt + COLFUZZY )
+ {
+ if( nBoxEnd >= nEnd + COLFUZZY )
+ nRet = POS_OUTSIDE;
+ else
+ nRet = POS_OVERLAP_BEFORE;
+ }
+ else
+ nRet = POS_BEFORE;
+ }
+ else if( nEnd > nBoxStt + COLFUZZY )
+ {
+ if( nEnd + COLFUZZY >= nBoxEnd )
+ {
+ if( COLFUZZY > Abs( long(nEnd) - long(nBoxEnd) ) &&
+ COLFUZZY > Abs( long(nStt) - long(nBoxStt) ) )
+ nRet = POS_EQUAL;
+ else
+ nRet = POS_INSIDE;
+ }
+ else
+ nRet = POS_OVERLAP_BEHIND;
+ }
+ else
+ nRet = POS_BEHIND;
+
+ return nRet;
+}
+
+void lcl_DelSelBox_CorrLowers( SwTableLine& rLine, CR_SetBoxWidth& rParam,
+ SwTwips nWidth )
+{
+ // 1. Schritt die eigene Breite feststellen
+ SwTableBoxes& rBoxes = rLine.GetTabBoxes();
+ SwTwips nBoxWidth = 0;
+ sal_uInt16 n;
+
+ for( n = rBoxes.Count(); n; )
+ nBoxWidth += rBoxes[ --n ]->GetFrmFmt()->GetFrmSize().GetWidth();
+
+ if( COLFUZZY < Abs( nWidth - nBoxWidth ))
+ {
+ // sie muessen also angepasst werden
+ for( n = rBoxes.Count(); n; )
+ {
+ SwTableBox* pBox = rBoxes[ --n ];
+ SwFmtFrmSize aNew( pBox->GetFrmFmt()->GetFrmSize() );
+ long nDiff = aNew.GetWidth();
+ nDiff *= nWidth;
+ nDiff /= nBoxWidth;
+ aNew.SetWidth( nDiff );
+
+ rParam.aShareFmts.SetSize( *pBox, aNew );
+
+ if( !pBox->GetSttNd() )
+ {
+ // hat selbst auch Lower, also auch die anpassen
+ for( sal_uInt16 i = pBox->GetTabLines().Count(); i; )
+ ::lcl_DelSelBox_CorrLowers( *pBox->GetTabLines()[ --i ],
+ rParam, nDiff );
+ }
+ }
+ }
+}
+
+void lcl_ChgBoxSize( SwTableBox& rBox, CR_SetBoxWidth& rParam,
+ const SwFmtFrmSize& rOldSz,
+ sal_uInt16& rDelWidth, SwTwips nDist )
+{
+ long nDiff = 0;
+ sal_Bool bSetSize = sal_False;
+
+ switch( rParam.nMode )
+ {
+ case TBLFIX_CHGABS: // Tabelle feste Breite, den Nachbar andern
+ nDiff = rDelWidth + rParam.nLowerDiff;
+ bSetSize = sal_True;
+ break;
+
+ case TBLFIX_CHGPROP: // Tabelle feste Breite, alle Nachbarn aendern
+ if( !rParam.nRemainWidth )
+ {
+ // dann kurz berechnen:
+ if( rParam.bLeft )
+ rParam.nRemainWidth = sal_uInt16(nDist);
+ else
+ rParam.nRemainWidth = sal_uInt16(rParam.nTblWidth - nDist);
+ }
+
+ // relativ berechnen
+ nDiff = rOldSz.GetWidth();
+ nDiff *= rDelWidth + rParam.nLowerDiff;
+ nDiff /= rParam.nRemainWidth;
+
+ bSetSize = sal_True;
+ break;
+
+ case TBLVAR_CHGABS: // Tabelle variable, alle Nachbarn aendern
+ if( COLFUZZY < Abs( rParam.nBoxWidth -
+ ( rDelWidth + rParam.nLowerDiff )))
+ {
+ nDiff = rDelWidth + rParam.nLowerDiff - rParam.nBoxWidth;
+ if( 0 < nDiff )
+ rDelWidth = rDelWidth - sal_uInt16(nDiff);
+ else
+ rDelWidth = rDelWidth + sal_uInt16(-nDiff);
+ bSetSize = sal_True;
+ }
+ break;
+ }
+
+ if( bSetSize )
+ {
+ SwFmtFrmSize aNew( rOldSz );
+ aNew.SetWidth( aNew.GetWidth() + nDiff );
+ rParam.aShareFmts.SetSize( rBox, aNew );
+
+ // dann leider nochmals die Lower anpassen
+ for( sal_uInt16 i = rBox.GetTabLines().Count(); i; )
+ ::lcl_DelSelBox_CorrLowers( *rBox.GetTabLines()[ --i ], rParam,
+ aNew.GetWidth() );
+ }
+}
+
+sal_Bool lcl_DeleteBox_Rekursiv( CR_SetBoxWidth& rParam, SwTableBox& rBox,
+ sal_Bool bCheck )
+{
+ sal_Bool bRet = sal_True;
+ if( rBox.GetSttNd() )
+ {
+ if( bCheck )
+ {
+ rParam.bAnyBoxFnd = sal_True;
+ if( rBox.GetFrmFmt()->GetProtect().IsCntntProtected() )
+ bRet = sal_False;
+ else
+ {
+ SwTableBox* pBox = &rBox;
+ rParam.aBoxes.Insert( pBox );
+ }
+ }
+ else
+ ::_DeleteBox( rParam.pTblNd->GetTable(), &rBox,
+ rParam.pUndo, sal_False, sal_True, &rParam.aShareFmts );
+ }
+ else
+ {
+ // die muessen leider alle sequentiel ueber die
+ // Contentboxen geloescht werden
+ for( sal_uInt16 i = rBox.GetTabLines().Count(); i; )
+ {
+ SwTableLine& rLine = *rBox.GetTabLines()[ --i ];
+ for( sal_uInt16 n = rLine.GetTabBoxes().Count(); n; )
+ if( !::lcl_DeleteBox_Rekursiv( rParam,
+ *rLine.GetTabBoxes()[ --n ], bCheck ))
+ return sal_False;
+ }
+ }
+ return bRet;
+}
+
+sal_Bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam,
+ SwTwips nDist, sal_Bool bCheck )
+{
+ SwTableBoxes& rBoxes = pTabLine->GetTabBoxes();
+ sal_uInt16 n, nCntEnd, nBoxChkStt, nBoxChkEnd, nDelWidth = 0;
+ if( rParam.bLeft )
+ {
+ n = rBoxes.Count();
+ nCntEnd = 0;
+ nBoxChkStt = (sal_uInt16)rParam.nSide;
+ nBoxChkEnd = static_cast<sal_uInt16>(rParam.nSide + rParam.nBoxWidth);
+ }
+ else
+ {
+ n = 0;
+ nCntEnd = rBoxes.Count();
+ nBoxChkStt = static_cast<sal_uInt16>(rParam.nSide - rParam.nBoxWidth);
+ nBoxChkEnd = (sal_uInt16)rParam.nSide;
+ }
+
+
+ while( n != nCntEnd )
+ {
+ SwTableBox* pBox;
+ if( rParam.bLeft )
+ pBox = rBoxes[ --n ];
+ else
+ pBox = rBoxes[ n++ ];
+
+ SwFrmFmt* pFmt = pBox->GetFrmFmt();
+ const SwFmtFrmSize& rSz = pFmt->GetFrmSize();
+ long nWidth = rSz.GetWidth();
+ sal_Bool bDelBox = sal_False, bChgLowers = sal_False;
+
+ // die Boxenbreite testen und entpsrechend reagieren
+ SwComparePosition ePosType = ::_CheckBoxInRange(
+ nBoxChkStt, nBoxChkEnd,
+ sal_uInt16(rParam.bLeft ? nDist - nWidth : nDist),
+ sal_uInt16(rParam.bLeft ? nDist : nDist + nWidth));
+
+ switch( ePosType )
+ {
+ case POS_BEFORE:
+ if( bCheck )
+ {
+ if( rParam.bLeft )
+ return sal_True;
+ }
+ else if( rParam.bLeft )
+ {
+ ::lcl_ChgBoxSize( *pBox, rParam, rSz, nDelWidth, nDist );
+ if( TBLFIX_CHGABS == rParam.nMode )
+ n = nCntEnd;
+ }
+ break;
+
+ case POS_BEHIND:
+ if( bCheck )
+ {
+ if( !rParam.bLeft )
+ return sal_True;
+ }
+ else if( !rParam.bLeft )
+ {
+ ::lcl_ChgBoxSize( *pBox, rParam, rSz, nDelWidth, nDist );
+ if( TBLFIX_CHGABS == rParam.nMode )
+ n = nCntEnd;
+ }
+ break;
+
+ case POS_OUTSIDE: // Box ueberlappt Start/End vollstaendig
+ case POS_INSIDE: // Box liegt vollstaendig in Start/End
+ case POS_EQUAL: // Box und Start/End sind gleich
+ bDelBox = sal_True;
+ break;
+
+ case POS_OVERLAP_BEFORE: // Box ueberlappt den Start
+ if( nBoxChkStt <= ( nDist + (rParam.bLeft ? - nWidth / 2
+ : nWidth / 2 )))
+ {
+ if( !pBox->GetSttNd() )
+ bChgLowers = sal_True;
+ else
+ bDelBox = sal_True;
+ }
+ else if( !bCheck && rParam.bLeft )
+ {
+ if( !pBox->GetSttNd() )
+ bChgLowers = sal_True;
+ else
+ {
+ ::lcl_ChgBoxSize( *pBox, rParam, rSz, nDelWidth, nDist );
+ if( TBLFIX_CHGABS == rParam.nMode )
+ n = nCntEnd;
+ }
+ }
+ break;
+
+ case POS_OVERLAP_BEHIND: // Box ueberlappt das Ende
+ // JP 10.02.99:
+ // generell loeschen oder wie beim OVERLAP_Before nur die, die
+ // bis zur Haelfte in die "Loesch-"Box reicht ???
+ if( !pBox->GetSttNd() )
+ bChgLowers = sal_True;
+ else
+ bDelBox = sal_True;
+ break;
+ default: break;
+ }
+
+ if( bDelBox )
+ {
+ nDelWidth = nDelWidth + sal_uInt16(nWidth);
+ if( bCheck )
+ {
+ // die letzte/erste Box kann nur bei Tbl-Var geloescht werden,
+ // wenn diese so gross ist, wie die Aenderung an der Tabelle
+ if( (( TBLVAR_CHGABS != rParam.nMode ||
+ nDelWidth != rParam.nBoxWidth ) &&
+ COLFUZZY > Abs( rParam.bLeft
+ ? nWidth - nDist
+ : (nDist + nWidth - rParam.nTblWidth )))
+ || !::lcl_DeleteBox_Rekursiv( rParam, *pBox, bCheck ) )
+ return sal_False;
+
+ if( pFmt->GetProtect().IsCntntProtected() )
+ return sal_False;
+ }
+ else
+ {
+ ::lcl_DeleteBox_Rekursiv( rParam, *pBox, bCheck );
+
+ if( !rParam.bLeft )
+ --n, --nCntEnd;
+ }
+ }
+ else if( bChgLowers )
+ {
+ sal_Bool bFirst = sal_True, bCorrLowers = sal_False;
+ long nLowerDiff = 0;
+ long nOldLower = rParam.nLowerDiff;
+ sal_uInt16 nOldRemain = rParam.nRemainWidth;
+ sal_uInt16 i;
+
+ for( i = pBox->GetTabLines().Count(); i; )
+ {
+ rParam.nLowerDiff = nDelWidth + nOldLower;
+ rParam.nRemainWidth = nOldRemain;
+ SwTableLine* pLine = pBox->GetTabLines()[ --i ];
+ if( !::lcl_DelSelBox( pLine, rParam, nDist, bCheck ))
+ return sal_False;
+
+ // gibt es die Box und die darin enthaltenen Lines noch??
+ if( n < rBoxes.Count() &&
+ pBox == rBoxes[ rParam.bLeft ? n : n-1 ] &&
+ i < pBox->GetTabLines().Count() &&
+ pLine == pBox->GetTabLines()[ i ] )
+ {
+ if( !bFirst && !bCorrLowers &&
+ COLFUZZY < Abs( nLowerDiff - rParam.nLowerDiff ) )
+ bCorrLowers = sal_True;
+
+ // die groesste "loesch" Breite entscheidet, aber nur wenn
+ // nicht die gesamte Line geloescht wurde
+ if( nLowerDiff < rParam.nLowerDiff )
+ nLowerDiff = rParam.nLowerDiff;
+
+ bFirst = sal_False;
+ }
+ }
+ rParam.nLowerDiff = nOldLower;
+ rParam.nRemainWidth = nOldRemain;
+
+ // wurden alle Boxen geloescht? Dann ist die DelBreite natuerlich
+ // die Boxenbreite
+ if( !nLowerDiff )
+ nLowerDiff = nWidth;
+
+ // DelBreite anpassen!!
+ nDelWidth = nDelWidth + sal_uInt16(nLowerDiff);
+
+ if( !bCheck )
+ {
+ // wurde die Box schon entfernt?
+ if( n > rBoxes.Count() ||
+ pBox != rBoxes[ ( rParam.bLeft ? n : n-1 ) ] )
+ {
+ // dann beim Loeschen nach rechts die Laufvar. anpassen
+ if( !rParam.bLeft )
+ --n, --nCntEnd;
+ }
+ else
+ {
+ // sonst muss die Groesse der Box angepasst werden
+ SwFmtFrmSize aNew( rSz );
+ sal_Bool bCorrRel = sal_False;
+
+ if( TBLVAR_CHGABS != rParam.nMode )
+ {
+ switch( ePosType )
+ {
+ case POS_OVERLAP_BEFORE: // Box ueberlappt den Start
+ if( TBLFIX_CHGPROP == rParam.nMode )
+ bCorrRel = rParam.bLeft;
+ else if( rParam.bLeft ) // TBLFIX_CHGABS
+ {
+ nLowerDiff = nLowerDiff - nDelWidth;
+ bCorrLowers = sal_True;
+ n = nCntEnd;
+ }
+ break;
+
+ case POS_OVERLAP_BEHIND: // Box ueberlappt das Ende
+ if( TBLFIX_CHGPROP == rParam.nMode )
+ bCorrRel = !rParam.bLeft;
+ else if( !rParam.bLeft ) // TBLFIX_CHGABS
+ {
+ nLowerDiff = nLowerDiff - nDelWidth;
+ bCorrLowers = sal_True;
+ n = nCntEnd;
+ }
+ break;
+
+ default:
+ ASSERT( !pBox, "hier sollte man nie hinkommen" );
+ break;
+ }
+ }
+
+ if( bCorrRel )
+ {
+ if( !rParam.nRemainWidth )
+ {
+ // dann kurz berechnen:
+ if( rParam.bLeft )
+ rParam.nRemainWidth = sal_uInt16(nDist - nLowerDiff);
+ else
+ rParam.nRemainWidth = sal_uInt16(rParam.nTblWidth - nDist
+ - nLowerDiff );
+ }
+
+ long nDiff = aNew.GetWidth() - nLowerDiff;
+ nDiff *= nDelWidth + rParam.nLowerDiff;
+ nDiff /= rParam.nRemainWidth;
+
+ aNew.SetWidth( aNew.GetWidth() - nLowerDiff + nDiff );
+ }
+ else
+ aNew.SetWidth( aNew.GetWidth() - nLowerDiff );
+ rParam.aShareFmts.SetSize( *pBox, aNew );
+
+ if( bCorrLowers )
+ {
+ // dann leider nochmals die Lower anpassen
+ for( i = pBox->GetTabLines().Count(); i; )
+ ::lcl_DelSelBox_CorrLowers( *pBox->
+ GetTabLines()[ --i ], rParam, aNew.GetWidth() );
+ }
+ }
+ }
+ }
+
+ if( rParam.bLeft )
+ nDist -= nWidth;
+ else
+ nDist += nWidth;
+ }
+ rParam.nLowerDiff = nDelWidth;
+ return sal_True;
+}
+
+// Dummy Funktion fuer die Methode SetColWidth
+sal_Bool lcl_DelOtherBox( SwTableLine* , CR_SetBoxWidth& , SwTwips , sal_Bool )
+{
+ return sal_True;
+}
+
+/* */
+
+void lcl_AjustLines( SwTableLine* pLine, CR_SetBoxWidth& rParam )
+{
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ {
+ SwTableBox* pBox = rBoxes[ n ];
+
+ SwFmtFrmSize aSz( pBox->GetFrmFmt()->GetFrmSize() );
+ SwTwips nWidth = aSz.GetWidth();
+ nWidth *= rParam.nDiff;
+ nWidth /= rParam.nMaxSize;
+ aSz.SetWidth( nWidth );
+ rParam.aShareFmts.SetSize( *pBox, aSz );
+
+ for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i )
+ ::lcl_AjustLines( pBox->GetTabLines()[ i ], rParam );
+ }
+}
+
+#if defined(DBG_UTIL) || defined( JP_DEBUG )
+
+void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize )
+{
+ const SwTableBoxes& rBoxes = rLine.GetTabBoxes();
+
+ SwTwips nAktSize = 0;
+ // checke doch mal ob die Tabellen korrekte Breiten haben
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ {
+ const SwTableBox* pBox = rBoxes[ n ];
+ const SwTwips nBoxW = pBox->GetFrmFmt()->GetFrmSize().GetWidth();
+ nAktSize += nBoxW;
+
+ for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i )
+ _CheckBoxWidth( *pBox->GetTabLines()[ i ], nBoxW );
+ }
+
+ if( Abs( nAktSize - nSize ) > ( COLFUZZY * rBoxes.Count() ) )
+ {
+ DBG_ERROR( "Boxen der Line zu klein/gross" );
+#if defined( WNT ) && defined( JP_DEBUG )
+ __asm int 3;
+#endif
+ }
+}
+
+#endif
+
+_FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo,
+ SwTableSortBoxes& rTmpLst, SwTwips nDistStt )
+{
+ // suche alle Boxen / Lines
+ SwTable& rTbl = rParam.pTblNd->GetTable();
+
+ if( !rParam.aBoxes.Count() )
+ {
+ // erstmal die Boxen besorgen !
+ if( rParam.bBigger )
+ for( sal_uInt16 n = 0; n < rTbl.GetTabLines().Count(); ++n )
+ ::lcl_DelSelBox( rTbl.GetTabLines()[ n ], rParam, nDistStt, sal_True );
+ else
+ for( sal_uInt16 n = 0; n < rTbl.GetTabLines().Count(); ++n )
+ ::lcl_InsSelBox( rTbl.GetTabLines()[ n ], rParam, nDistStt, sal_True );
+ }
+
+ // loeschen der gesamten Tabelle verhindern
+ if( rParam.bBigger && rParam.aBoxes.Count() ==
+ rTbl.GetTabSortBoxes().Count() )
+ return 0;
+
+ _FndBox* pFndBox = new _FndBox( 0, 0 );
+ if( rParam.bBigger )
+ pFndBox->SetTableLines( rParam.aBoxes, rTbl );
+ else
+ {
+ _FndPara aPara( rParam.aBoxes, pFndBox );
+ rTbl.GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ ASSERT( pFndBox->GetLines().Count(), "Wo sind die Boxen" );
+ pFndBox->SetTableLines( rTbl );
+
+ if( ppUndo )
+ rTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() );
+ }
+
+ //Lines fuer das Layout-Update herausuchen.
+ pFndBox->DelFrms( rTbl );
+
+ // TL_CHART2: this function gest called from SetColWidth exclusively,
+ // thus it is currently speculated that nothing needs to be done here.
+ // Note: that SetColWidth is currently not completely understood though :-(
+
+ return pFndBox;
+}
+
+sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
+ SwTwips nAbsDiff, SwTwips nRelDiff, SwUndo** ppUndo )
+{
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ const SwFmtFrmSize& rSz = GetFrmFmt()->GetFrmSize();
+ const SvxLRSpaceItem& rLR = GetFrmFmt()->GetLRSpace();
+
+ _FndBox* pFndBox = 0; // fuers Einfuegen/Loeschen
+ SwTableSortBoxes aTmpLst( 0, 5 ); // fuers Undo
+ sal_Bool bBigger,
+ bRet = sal_False,
+ bLeft = nsTblChgWidthHeightType::WH_COL_LEFT == ( eType & 0xff ) ||
+ nsTblChgWidthHeightType::WH_CELL_LEFT == ( eType & 0xff ),
+ bInsDel = 0 != (eType & nsTblChgWidthHeightType::WH_FLAG_INSDEL );
+ sal_uInt16 n;
+ sal_uLong nBoxIdx = rAktBox.GetSttIdx();
+
+ // bestimme die akt. Kante der Box
+ // wird nur fuer die Breitenmanipulation benoetigt!
+ const SwTwips nDist = ::lcl_GetDistance( &rAktBox, bLeft );
+ SwTwips nDistStt = 0;
+ CR_SetBoxWidth aParam( eType, nRelDiff, nDist, rSz.GetWidth(),
+ bLeft ? nDist : rSz.GetWidth() - nDist,
+ (SwTableNode*)rAktBox.GetSttNd()->FindTableNode() );
+ bBigger = aParam.bBigger;
+
+ FN_lcl_SetBoxWidth fnSelBox, fnOtherBox;
+ if( bInsDel )
+ {
+ if( bBigger )
+ {
+ fnSelBox = lcl_DelSelBox;
+ fnOtherBox = lcl_DelOtherBox;
+ aParam.nBoxWidth = (sal_uInt16)rAktBox.GetFrmFmt()->GetFrmSize().GetWidth();
+ if( bLeft )
+ nDistStt = rSz.GetWidth();
+ }
+ else
+ {
+ fnSelBox = lcl_InsSelBox;
+ fnOtherBox = lcl_InsOtherBox;
+ }
+ }
+ else
+ {
+ fnSelBox = lcl_SetSelBoxWidth;
+ fnOtherBox = lcl_SetOtherBoxWidth;
+ }
+
+
+ switch( eType & 0xff )
+ {
+ case nsTblChgWidthHeightType::WH_COL_RIGHT:
+ case nsTblChgWidthHeightType::WH_COL_LEFT:
+ if( TBLVAR_CHGABS == eTblChgMode )
+ {
+ if( bInsDel )
+ bBigger = !bBigger;
+
+ // erstmal testen, ob ueberhaupt Platz ist
+ sal_Bool bChgLRSpace = sal_True;
+ if( bBigger )
+ {
+ if( GetFrmFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) &&
+ !rSz.GetWidthPercent() )
+ {
+ bRet = rSz.GetWidth() < USHRT_MAX - nRelDiff;
+ bChgLRSpace = bLeft ? rLR.GetLeft() >= nAbsDiff
+ : rLR.GetRight() >= nAbsDiff;
+ }
+ else
+ bRet = bLeft ? rLR.GetLeft() >= nAbsDiff
+ : rLR.GetRight() >= nAbsDiff;
+
+ if( !bRet && bInsDel &&
+ // auf der anderen Seite Platz?
+ ( bLeft ? rLR.GetRight() >= nAbsDiff
+ : rLR.GetLeft() >= nAbsDiff ))
+ {
+ bRet = sal_True; bLeft = !bLeft;
+ }
+
+ if( !bRet )
+ {
+ // dann sich selbst rekursiv aufrufen; nur mit
+ // einem anderen Mode -> proprotional
+ TblChgMode eOld = eTblChgMode;
+ eTblChgMode = TBLFIX_CHGPROP;
+
+ bRet = SetColWidth( rAktBox, eType, nAbsDiff, nRelDiff,
+ ppUndo );
+ eTblChgMode = eOld;
+ return bRet;
+ }
+ }
+ else
+ {
+ bRet = sal_True;
+ for( n = 0; n < aLines.Count(); ++n )
+ {
+ aParam.LoopClear();
+ if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True ))
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ }
+
+ if( bRet )
+ {
+ if( bInsDel )
+ {
+ pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo,
+ aTmpLst, nDistStt );
+ if( aParam.bBigger && aParam.aBoxes.Count() ==
+ aSortCntBoxes.Count() )
+ {
+ // dies gesamte Tabelle soll geloescht werden!!
+ GetFrmFmt()->GetDoc()->DeleteRowCol( aParam.aBoxes );
+ return sal_False;
+ }
+
+ if( ppUndo )
+ *ppUndo = aParam.CreateUndo(
+ aParam.bBigger ? UNDO_COL_DELETE
+ : UNDO_TABLE_INSCOL );
+ }
+ else if( ppUndo )
+ *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, sal_True );
+
+ long nFrmWidth = LONG_MAX;
+ LockModify();
+ SwFmtFrmSize aSz( rSz );
+ SvxLRSpaceItem aLR( rLR );
+ if( bBigger )
+ {
+ // falls die Tabelle keinen Platz zum Wachsen hat, dann
+ // muessen wir welchen schaffen!
+ if( aSz.GetWidth() + nRelDiff > USHRT_MAX )
+ {
+ // dann mal herunterbrechen auf USHRT_MAX / 2
+ CR_SetBoxWidth aTmpPara( 0, aSz.GetWidth() / 2,
+ 0, aSz.GetWidth(), aSz.GetWidth(), aParam.pTblNd );
+ for( sal_uInt16 nLn = 0; nLn < aLines.Count(); ++nLn )
+ ::lcl_AjustLines( aLines[ nLn ], aTmpPara );
+ aSz.SetWidth( aSz.GetWidth() / 2 );
+ aParam.nDiff = nRelDiff /= 2;
+ aParam.nSide /= 2;
+ aParam.nMaxSize /= 2;
+ }
+
+ if( bLeft )
+ aLR.SetLeft( sal_uInt16( aLR.GetLeft() - nAbsDiff ) );
+ else
+ aLR.SetRight( sal_uInt16( aLR.GetRight() - nAbsDiff ) );
+ }
+ else if( bLeft )
+ aLR.SetLeft( sal_uInt16( aLR.GetLeft() + nAbsDiff ) );
+ else
+ aLR.SetRight( sal_uInt16( aLR.GetRight() + nAbsDiff ) );
+
+ if( bChgLRSpace )
+ GetFrmFmt()->SetFmtAttr( aLR );
+ const SwFmtHoriOrient& rHOri = GetFrmFmt()->GetHoriOrient();
+ if( text::HoriOrientation::FULL == rHOri.GetHoriOrient() ||
+ (text::HoriOrientation::LEFT == rHOri.GetHoriOrient() && aLR.GetLeft()) ||
+ (text::HoriOrientation::RIGHT == rHOri.GetHoriOrient() && aLR.GetRight()))
+ {
+ SwFmtHoriOrient aHOri( rHOri );
+ aHOri.SetHoriOrient( text::HoriOrientation::NONE );
+ GetFrmFmt()->SetFmtAttr( aHOri );
+
+ // sollte die Tabelle noch auf relativen Werten
+ // (USHRT_MAX) stehen dann muss es jetzt auf absolute
+ // umgerechnet werden. Bug 61494
+ if( GetFrmFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) &&
+ !rSz.GetWidthPercent() )
+ {
+ SwTabFrm* pTabFrm = SwIterator<SwTabFrm,SwFmt>::FirstElement( *GetFrmFmt() );
+ if( pTabFrm &&
+ pTabFrm->Prt().Width() != rSz.GetWidth() )
+ {
+ nFrmWidth = pTabFrm->Prt().Width();
+ if( bBigger )
+ nFrmWidth += nAbsDiff;
+ else
+ nFrmWidth -= nAbsDiff;
+ }
+ }
+ }
+
+ if( bBigger )
+ aSz.SetWidth( aSz.GetWidth() + nRelDiff );
+ else
+ aSz.SetWidth( aSz.GetWidth() - nRelDiff );
+
+ if( rSz.GetWidthPercent() )
+ aSz.SetWidthPercent( static_cast<sal_uInt8>(( aSz.GetWidth() * 100 ) /
+ ( aSz.GetWidth() + aLR.GetRight() + aLR.GetLeft())));
+
+ GetFrmFmt()->SetFmtAttr( aSz );
+ aParam.nTblWidth = sal_uInt16( aSz.GetWidth() );
+
+ UnlockModify();
+
+ for( n = aLines.Count(); n; )
+ {
+ --n;
+ aParam.LoopClear();
+ (*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_False );
+ }
+
+ // sollte die Tabelle noch auf relativen Werten
+ // (USHRT_MAX) stehen dann muss es jetzt auf absolute
+ // umgerechnet werden. Bug 61494
+ if( LONG_MAX != nFrmWidth )
+ {
+ SwFmtFrmSize aAbsSz( aSz );
+ aAbsSz.SetWidth( nFrmWidth );
+ GetFrmFmt()->SetFmtAttr( aAbsSz );
+ }
+ }
+ }
+ else if( bInsDel ||
+ ( bLeft ? nDist : Abs( rSz.GetWidth() - nDist ) > COLFUZZY ) )
+ {
+ bRet = sal_True;
+ if( bLeft && TBLFIX_CHGABS == eTblChgMode && !bInsDel )
+ aParam.bBigger = !bBigger;
+
+ // erstmal testen, ob ueberhaupt Platz ist
+ if( bInsDel )
+ {
+ if( aParam.bBigger )
+ {
+ for( n = 0; n < aLines.Count(); ++n )
+ {
+ aParam.LoopClear();
+ if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True ))
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ }
+ else
+ {
+ if( 0 != ( bRet = bLeft ? nDist != 0
+ : ( rSz.GetWidth() - nDist ) > COLFUZZY ) )
+ {
+ for( n = 0; n < aLines.Count(); ++n )
+ {
+ aParam.LoopClear();
+ if( !(*fnOtherBox)( aLines[ n ], aParam, 0, sal_True ))
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ if( bRet && !aParam.bAnyBoxFnd )
+ bRet = sal_False;
+ }
+
+ if( !bRet && rAktBox.GetFrmFmt()->GetFrmSize().GetWidth()
+ - nRelDiff > COLFUZZY +
+ ( 567 / 2 /* min. 0,5 cm Platz lassen*/) )
+ {
+ // dann den Platz von der akt. Zelle nehmen
+ aParam.bSplittBox = sal_True;
+ // aber das muss auch mal getestet werden!
+ bRet = sal_True;
+
+ for( n = 0; n < aLines.Count(); ++n )
+ {
+ aParam.LoopClear();
+ if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True ))
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ }
+ }
+ }
+ else if( aParam.bBigger )
+ {
+ for( n = 0; n < aLines.Count(); ++n )
+ {
+ aParam.LoopClear();
+ if( !(*fnOtherBox)( aLines[ n ], aParam, 0, sal_True ))
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ }
+ else
+ {
+ for( n = 0; n < aLines.Count(); ++n )
+ {
+ aParam.LoopClear();
+ if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True ))
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ }
+
+ // wenn ja, dann setzen
+ if( bRet )
+ {
+ CR_SetBoxWidth aParam1( aParam );
+ if( bInsDel )
+ {
+ aParam1.bBigger = !aParam.bBigger;
+ pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo,
+ aTmpLst, nDistStt );
+ if( ppUndo )
+ *ppUndo = aParam.CreateUndo(
+ aParam.bBigger ? UNDO_TABLE_DELBOX
+ : UNDO_TABLE_INSCOL );
+ }
+ else if( ppUndo )
+ *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, sal_True );
+
+ if( bInsDel
+ ? ( TBLFIX_CHGABS == eTblChgMode ? bLeft : bLeft )
+ : ( TBLFIX_CHGABS != eTblChgMode && bLeft ) )
+ {
+ for( n = aLines.Count(); n; )
+ {
+ --n;
+ aParam.LoopClear();
+ aParam1.LoopClear();
+ (*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_False );
+ (*fnOtherBox)( aLines[ n ], aParam1, nDistStt, sal_False );
+ }
+ }
+ else
+ for( n = aLines.Count(); n; )
+ {
+ --n;
+ aParam.LoopClear();
+ aParam1.LoopClear();
+ (*fnOtherBox)( aLines[ n ], aParam1, nDistStt, sal_False );
+ (*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_False );
+ }
+ }
+ }
+ break;
+
+ case nsTblChgWidthHeightType::WH_CELL_RIGHT:
+ case nsTblChgWidthHeightType::WH_CELL_LEFT:
+ if( TBLVAR_CHGABS == eTblChgMode )
+ {
+ // dann sich selbst rekursiv aufrufen; nur mit
+ // einem anderen Mode -> Nachbarn
+ TblChgMode eOld = eTblChgMode;
+ eTblChgMode = TBLFIX_CHGABS;
+
+ bRet = SetColWidth( rAktBox, eType, nAbsDiff, nRelDiff,
+ ppUndo );
+ eTblChgMode = eOld;
+ return bRet;
+ }
+ else if( bInsDel || ( bLeft ? nDist
+ : (rSz.GetWidth() - nDist) > COLFUZZY ))
+ {
+ if( bLeft && TBLFIX_CHGABS == eTblChgMode && !bInsDel )
+ aParam.bBigger = !bBigger;
+
+ // erstmal testen, ob ueberhaupt Platz ist
+ SwTableBox* pBox = &rAktBox;
+ SwTableLine* pLine = rAktBox.GetUpper();
+ while( pLine->GetUpper() )
+ {
+ sal_uInt16 nPos = pLine->GetTabBoxes().C40_GETPOS( SwTableBox, pBox );
+ if( bLeft ? nPos : nPos + 1 != pLine->GetTabBoxes().Count() )
+ break;
+
+ pBox = pLine->GetUpper();
+ pLine = pBox->GetUpper();
+ }
+
+ if( pLine->GetUpper() )
+ {
+ // dann muss die Distanz wieder korriegiert werden!
+ aParam.nSide -= ::lcl_GetDistance( pLine->GetUpper(), sal_True );
+
+ if( bLeft )
+ aParam.nMaxSize = aParam.nSide;
+ else
+ aParam.nMaxSize = pLine->GetUpper()->GetFrmFmt()->
+ GetFrmSize().GetWidth() - aParam.nSide;
+ }
+
+ // erstmal testen, ob ueberhaupt Platz ist
+ if( bInsDel )
+ {
+ if( 0 != ( bRet = bLeft ? nDist != 0
+ : ( rSz.GetWidth() - nDist ) > COLFUZZY ) &&
+ !aParam.bBigger )
+ {
+ bRet = (*fnOtherBox)( pLine, aParam, 0, sal_True );
+ if( bRet && !aParam.bAnyBoxFnd )
+ bRet = sal_False;
+ }
+
+ if( !bRet && !aParam.bBigger && rAktBox.GetFrmFmt()->
+ GetFrmSize().GetWidth() - nRelDiff > COLFUZZY +
+ ( 567 / 2 /* min. 0,5 cm Platz lassen*/) )
+ {
+ // dann den Platz von der akt. Zelle nehmen
+ aParam.bSplittBox = sal_True;
+ bRet = sal_True;
+ }
+ }
+ else
+ {
+ FN_lcl_SetBoxWidth fnTmp = aParam.bBigger ? fnOtherBox : fnSelBox;
+ bRet = (*fnTmp)( pLine, aParam, nDistStt, sal_True );
+ }
+
+ // wenn ja, dann setzen
+ if( bRet )
+ {
+ CR_SetBoxWidth aParam1( aParam );
+ if( bInsDel )
+ {
+ aParam1.bBigger = !aParam.bBigger;
+ pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst, nDistStt );
+ if( ppUndo )
+ *ppUndo = aParam.CreateUndo(
+ aParam.bBigger ? UNDO_TABLE_DELBOX
+ : UNDO_TABLE_INSCOL );
+ }
+ else if( ppUndo )
+ *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, sal_True );
+
+ if( bInsDel
+ ? ( TBLFIX_CHGABS == eTblChgMode ? (bBigger && bLeft) : bLeft )
+ : ( TBLFIX_CHGABS != eTblChgMode && bLeft ) )
+ {
+ (*fnSelBox)( pLine, aParam, nDistStt, sal_False );
+ (*fnOtherBox)( pLine, aParam1, nDistStt, sal_False );
+ }
+ else
+ {
+ (*fnOtherBox)( pLine, aParam1, nDistStt, sal_False );
+ (*fnSelBox)( pLine, aParam, nDistStt, sal_False );
+ }
+ }
+ }
+ break;
+
+ }
+
+ if( pFndBox )
+ {
+ // dann raeume die Struktur aller Lines auf
+ GCLines();
+
+ //Layout updaten
+ if( !bBigger || pFndBox->AreLinesToRestore( *this ) )
+ pFndBox->MakeFrms( *this );
+
+ // TL_CHART2: it is currently unclear if sth has to be done here.
+ // The function name hints that nothing needs to be done, on the other
+ // hand there is a case where sth gets deleted. :-(
+
+ delete pFndBox;
+
+ if( ppUndo && *ppUndo )
+ {
+ aParam.pUndo->SetColWidthParam( nBoxIdx, static_cast<sal_uInt16>(eTblChgMode), eType,
+ nAbsDiff, nRelDiff );
+ if( !aParam.bBigger )
+ aParam.pUndo->SaveNewBoxes( *aParam.pTblNd, aTmpLst );
+ }
+ }
+
+ if( bRet )
+ {
+ CHECKBOXWIDTH
+ CHECKTABLELAYOUT
+ }
+
+ return bRet;
+}
+/* */
+
+_FndBox* lcl_SaveInsDelData( CR_SetLineHeight& rParam, SwUndo** ppUndo,
+ SwTableSortBoxes& rTmpLst )
+{
+ // suche alle Boxen / Lines
+ SwTable& rTbl = rParam.pTblNd->GetTable();
+
+ ASSERT( rParam.aBoxes.Count(), "ohne Boxen ist nichts zu machen!" );
+
+ // loeschen der gesamten Tabelle verhindern
+ if( !rParam.bBigger && rParam.aBoxes.Count() ==
+ rTbl.GetTabSortBoxes().Count() )
+ return 0;
+
+ _FndBox* pFndBox = new _FndBox( 0, 0 );
+ if( !rParam.bBigger )
+ pFndBox->SetTableLines( rParam.aBoxes, rTbl );
+ else
+ {
+ _FndPara aPara( rParam.aBoxes, pFndBox );
+ rTbl.GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ ASSERT( pFndBox->GetLines().Count(), "Wo sind die Boxen" );
+ pFndBox->SetTableLines( rTbl );
+
+ if( ppUndo )
+ rTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() );
+ }
+
+ //Lines fuer das Layout-Update heraussuchen.
+ pFndBox->DelFrms( rTbl );
+
+ // TL_CHART2: it is currently unclear if sth has to be done here.
+
+ return pFndBox;
+}
+
+void SetLineHeight( SwTableLine& rLine, SwTwips nOldHeight, SwTwips nNewHeight,
+ sal_Bool bMinSize )
+{
+ SwLayoutFrm* pLineFrm = GetRowFrm( rLine );
+ ASSERT( pLineFrm, "wo ist der Frm von der SwTableLine?" );
+
+ SwFrmFmt* pFmt = rLine.ClaimFrmFmt();
+
+ SwTwips nMyNewH, nMyOldH = pLineFrm->Frm().Height();
+ if( !nOldHeight ) // die BaseLine und absolut
+ nMyNewH = nMyOldH + nNewHeight;
+ else
+ {
+ // moeglichst genau rechnen
+ Fraction aTmp( nMyOldH );
+ aTmp *= Fraction( nNewHeight, nOldHeight );
+ aTmp += Fraction( 1, 2 ); // ggfs. aufrunden
+ nMyNewH = aTmp;
+ }
+
+ SwFrmSize eSize = ATT_MIN_SIZE;
+ if( !bMinSize &&
+ ( nMyOldH - nMyNewH ) > ( CalcRowRstHeight( pLineFrm ) + ROWFUZZY ))
+ eSize = ATT_FIX_SIZE;
+
+ pFmt->SetFmtAttr( SwFmtFrmSize( eSize, 0, nMyNewH ) );
+
+ // erst alle inneren anpassen
+ SwTableBoxes& rBoxes = rLine.GetTabBoxes();
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ {
+ SwTableBox& rBox = *rBoxes[ n ];
+ for( sal_uInt16 i = 0; i < rBox.GetTabLines().Count(); ++i )
+ SetLineHeight( *rBox.GetTabLines()[ i ], nMyOldH, nMyNewH, bMinSize );
+ }
+}
+
+sal_Bool lcl_SetSelLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam,
+ SwTwips nDist, sal_Bool bCheck )
+{
+ sal_Bool bRet = sal_True;
+ if( !bCheck )
+ {
+ // Zeilenhoehe einstellen
+ SetLineHeight( *pLine, 0, rParam.bBigger ? nDist : -nDist,
+ rParam.bBigger );
+ }
+ else if( !rParam.bBigger )
+ {
+ // anhand der alten Size die neue relative errechnen
+ SwLayoutFrm* pLineFrm = GetRowFrm( *pLine );
+ ASSERT( pLineFrm, "wo ist der Frm von der SwTableLine?" );
+ SwTwips nRstHeight = CalcRowRstHeight( pLineFrm );
+ if( (nRstHeight + ROWFUZZY) < nDist )
+ bRet = sal_False;
+ }
+ return bRet;
+}
+
+sal_Bool lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam,
+ SwTwips nDist, sal_Bool bCheck )
+{
+ sal_Bool bRet = sal_True;
+ if( bCheck )
+ {
+ if( rParam.bBigger )
+ {
+ // anhand der alten Size die neue relative errechnen
+ SwLayoutFrm* pLineFrm = GetRowFrm( *pLine );
+ ASSERT( pLineFrm, "wo ist der Frm von der SwTableLine?" );
+
+ if( TBLFIX_CHGPROP == rParam.nMode )
+ {
+ nDist *= pLineFrm->Frm().Height();
+ nDist /= rParam.nMaxHeight;
+ }
+ bRet = nDist <= CalcRowRstHeight( pLineFrm );
+ }
+ }
+ else
+ {
+ // Zeilenhoehe einstellen
+ // pLine ist die nachfolgende / vorhergehende -> also anpassen
+ if( TBLFIX_CHGPROP == rParam.nMode )
+ {
+ SwLayoutFrm* pLineFrm = GetRowFrm( *pLine );
+ ASSERT( pLineFrm, "wo ist der Frm von der SwTableLine?" );
+
+ // aus der alten Size die neue relative errechnen
+ // Wird die selektierte Box groesser ueber den MaxSpace anpassen,
+ // sonst ueber die MaxHeight
+ if( 1 /*!rParam.bBigger*/ )
+ {
+ nDist *= pLineFrm->Frm().Height();
+ nDist /= rParam.nMaxHeight;
+ }
+ else
+ {
+ // aus der alten Size die neue relative errechnen
+ nDist *= CalcRowRstHeight( pLineFrm );
+ nDist /= rParam.nMaxSpace;
+ }
+ }
+ SetLineHeight( *pLine, 0, rParam.bBigger ? -nDist : nDist,
+ !rParam.bBigger );
+ }
+ return bRet;
+}
+
+sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam,
+ SwTwips nDist, sal_Bool bCheck )
+{
+ sal_Bool bRet = sal_True;
+ if( !bCheck )
+ {
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ SwDoc* pDoc = pLine->GetFrmFmt()->GetDoc();
+ if( !rParam.bBigger )
+ {
+ sal_uInt16 n;
+
+ for( n = rBoxes.Count(); n; )
+ ::lcl_SaveUpperLowerBorder( rParam.pTblNd->GetTable(),
+ *rBoxes[ --n ],
+ rParam.aShareFmts );
+ for( n = rBoxes.Count(); n; )
+ ::_DeleteBox( rParam.pTblNd->GetTable(),
+ rBoxes[ --n ], rParam.pUndo, sal_False,
+ sal_False, &rParam.aShareFmts );
+ }
+ else
+ {
+ // Zeile einfuegen
+ SwTableLine* pNewLine = new SwTableLine( (SwTableLineFmt*)pLine->GetFrmFmt(),
+ rBoxes.Count(), pLine->GetUpper() );
+ SwTableLines* pLines;
+ if( pLine->GetUpper() )
+ pLines = &pLine->GetUpper()->GetTabLines();
+ else
+ pLines = &rParam.pTblNd->GetTable().GetTabLines();
+ sal_uInt16 nPos = pLines->C40_GETPOS( SwTableLine, pLine );
+ if( !rParam.bTop )
+ ++nPos;
+ pLines->C40_INSERT( SwTableLine, pNewLine, nPos );
+
+ SwFrmFmt* pNewFmt = pNewLine->ClaimFrmFmt();
+ pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_MIN_SIZE, 0, nDist ) );
+
+ // und noch mal die Anzahl Boxen erzeugen
+ SwTableBoxes& rNewBoxes = pNewLine->GetTabBoxes();
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ {
+ SwTwips nWidth = 0;
+ SwTableBox* pOld = rBoxes[ n ];
+ if( !pOld->GetSttNd() )
+ {
+ // keine normale "Content"-Box also auf die 1. naechste
+ // Box zurueckfallen
+ nWidth = pOld->GetFrmFmt()->GetFrmSize().GetWidth();
+ while( !pOld->GetSttNd() )
+ pOld = pOld->GetTabLines()[ 0 ]->GetTabBoxes()[ 0 ];
+ }
+ ::_InsTblBox( pDoc, rParam.pTblNd, pNewLine,
+ (SwTableBoxFmt*)pOld->GetFrmFmt(), pOld, n );
+
+ // Sonderbehandlung fuer Umrandung die Obere muss
+ // entfernt werden
+ const SvxBoxItem& rBoxItem = pOld->GetFrmFmt()->GetBox();
+ if( rBoxItem.GetTop() )
+ {
+ SvxBoxItem aTmp( rBoxItem );
+ aTmp.SetLine( 0, BOX_LINE_TOP );
+ rParam.aShareFmts.SetAttr( rParam.bTop
+ ? *pOld
+ : *rNewBoxes[ n ], aTmp );
+ }
+
+ if( nWidth )
+ rParam.aShareFmts.SetAttr( *rNewBoxes[ n ],
+ SwFmtFrmSize( ATT_FIX_SIZE, nWidth, 0 ) );
+ }
+ }
+ }
+ else
+ {
+ // Boxen einsammeln!
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ for( sal_uInt16 n = rBoxes.Count(); n; )
+ {
+ SwTableBox* pBox = rBoxes[ --n ];
+ if( pBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
+ return sal_False;
+
+ if( pBox->GetSttNd() )
+ rParam.aBoxes.Insert( pBox );
+ else
+ {
+ for( sal_uInt16 i = pBox->GetTabLines().Count(); i; )
+ lcl_InsDelSelLine( pBox->GetTabLines()[ --i ],
+ rParam, 0, sal_True );
+ }
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
+ SwTwips nAbsDiff, SwTwips nRelDiff,SwUndo** ppUndo )
+{
+ SwTableLine* pLine = rAktBox.GetUpper();
+
+ SwTableLine* pBaseLine = pLine;
+ while( pBaseLine->GetUpper() )
+ pBaseLine = pBaseLine->GetUpper()->GetUpper();
+
+ _FndBox* pFndBox = 0; // fuers Einfuegen/Loeschen
+ SwTableSortBoxes aTmpLst( 0, 5 ); // fuers Undo
+ sal_Bool bBigger,
+ bRet = sal_False,
+ bTop = nsTblChgWidthHeightType::WH_ROW_TOP == ( eType & 0xff ) ||
+ nsTblChgWidthHeightType::WH_CELL_TOP == ( eType & 0xff ),
+ bInsDel = 0 != (eType & nsTblChgWidthHeightType::WH_FLAG_INSDEL );
+ sal_uInt16 n, nBaseLinePos = GetTabLines().C40_GETPOS( SwTableLine, pBaseLine );
+ sal_uLong nBoxIdx = rAktBox.GetSttIdx();
+
+ CR_SetLineHeight aParam( eType,
+ (SwTableNode*)rAktBox.GetSttNd()->FindTableNode() );
+ bBigger = aParam.bBigger;
+
+ FN_lcl_SetLineHeight fnSelLine, fnOtherLine = lcl_SetOtherLineHeight;
+ if( bInsDel )
+ fnSelLine = lcl_InsDelSelLine;
+ else
+ fnSelLine = lcl_SetSelLineHeight;
+
+ SwTableLines* pLines = &aLines;
+
+ // wie kommt man an die Hoehen heran?
+ switch( eType & 0xff )
+ {
+ case nsTblChgWidthHeightType::WH_CELL_TOP:
+ case nsTblChgWidthHeightType::WH_CELL_BOTTOM:
+ if( pLine == pBaseLine )
+ break; // dann geht es nicht!
+
+ // ist eine verschachtelte Line (Box!)
+ pLines = &pLine->GetUpper()->GetTabLines();
+ nBaseLinePos = pLines->C40_GETPOS( SwTableLine, pLine );
+ pBaseLine = pLine;
+ // kein break!
+
+ case nsTblChgWidthHeightType::WH_ROW_TOP:
+ case nsTblChgWidthHeightType::WH_ROW_BOTTOM:
+ {
+ if( bInsDel && !bBigger ) // um wieviel wird es Hoeher?
+ {
+ nAbsDiff = GetRowFrm( *pBaseLine )->Frm().Height();
+ }
+
+ if( TBLVAR_CHGABS == eTblChgMode )
+ {
+ // erstmal testen, ob ueberhaupt Platz ist
+ if( bBigger )
+ {
+ bRet = sal_True;
+// was ist mit Top, was ist mit Tabelle im Rahmen oder in Kopf-/Fusszeile
+// mit fester Hoehe ??
+ if( !bRet )
+ {
+ // dann sich selbst rekursiv aufrufen; nur mit
+ // einem anderen Mode -> proprotional
+ TblChgMode eOld = eTblChgMode;
+ eTblChgMode = TBLFIX_CHGPROP;
+
+ bRet = SetRowHeight( rAktBox, eType, nAbsDiff,
+ nRelDiff, ppUndo );
+
+ eTblChgMode = eOld;
+ return bRet;
+ }
+ }
+ else
+ bRet = (*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam,
+ nAbsDiff, sal_True );
+
+ if( bRet )
+ {
+ if( bInsDel )
+ {
+ if( !aParam.aBoxes.Count() )
+ ::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ],
+ aParam, 0, sal_True );
+
+ pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst );
+
+ // #110525# delete complete table when last row is
+ // deleted
+ if( !bBigger &&
+ aParam.aBoxes.Count() == aSortCntBoxes.Count() )
+ {
+ GetFrmFmt()->GetDoc()->DeleteRowCol( aParam.aBoxes );
+ return sal_False;
+ }
+
+
+ if( ppUndo )
+ *ppUndo = aParam.CreateUndo(
+ bBigger ? UNDO_TABLE_INSROW
+ : UNDO_ROW_DELETE );
+ }
+ else if( ppUndo )
+ *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, sal_True );
+
+ (*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam,
+ nAbsDiff, sal_False );
+ }
+ }
+ else
+ {
+ bRet = sal_True;
+ sal_uInt16 nStt, nEnd;
+ if( bTop )
+ nStt = 0, nEnd = nBaseLinePos;
+ else
+ nStt = nBaseLinePos + 1, nEnd = pLines->Count();
+
+ // die akt. Hoehe der Lines besorgen
+ if( TBLFIX_CHGPROP == eTblChgMode )
+ {
+ for( n = nStt; n < nEnd; ++n )
+ {
+ SwLayoutFrm* pLineFrm = GetRowFrm( *(*pLines)[ n ] );
+ ASSERT( pLineFrm, "wo ist der Frm von der SwTableLine?" );
+ aParam.nMaxSpace += CalcRowRstHeight( pLineFrm );
+ aParam.nMaxHeight += pLineFrm->Frm().Height();
+ }
+ if( bBigger && aParam.nMaxSpace < nAbsDiff )
+ bRet = sal_False;
+ }
+ else
+ {
+ if( bTop ? nEnd : nStt < nEnd )
+ {
+ if( bTop )
+ nStt = nEnd - 1;
+ else
+ nEnd = nStt + 1;
+ }
+ else
+ bRet = sal_False;
+ }
+
+ if( bRet )
+ {
+ if( bBigger )
+ {
+ for( n = nStt; n < nEnd; ++n )
+ {
+ if( !(*fnOtherLine)( (*pLines)[ n ], aParam,
+ nAbsDiff, sal_True ))
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ }
+ else
+ bRet = (*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam,
+ nAbsDiff, sal_True );
+ }
+
+ if( bRet )
+ {
+ // dann mal anpassen
+ if( bInsDel )
+ {
+ if( !aParam.aBoxes.Count() )
+ ::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ],
+ aParam, 0, sal_True );
+ pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst );
+ if( ppUndo )
+ *ppUndo = aParam.CreateUndo(
+ bBigger ? UNDO_TABLE_INSROW
+ : UNDO_ROW_DELETE );
+ }
+ else if( ppUndo )
+ *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, sal_True );
+
+ CR_SetLineHeight aParam1( aParam );
+ if( TBLFIX_CHGPROP == eTblChgMode && !bBigger &&
+ !aParam.nMaxSpace )
+ {
+ // dann muss der gesamte Platz auf alle Lines
+ // gleichmaessig verteilt werden. Dafuer wird die
+ // Anzahl benoetigt
+ aParam1.nLines = nEnd - nStt;
+ }
+
+ if( bTop )
+ {
+ (*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam,
+ nAbsDiff, sal_False );
+ for( n = nStt; n < nEnd; ++n )
+ (*fnOtherLine)( (*pLines)[ n ], aParam1,
+ nAbsDiff, sal_False );
+ }
+ else
+ {
+ for( n = nStt; n < nEnd; ++n )
+ (*fnOtherLine)( (*pLines)[ n ], aParam1,
+ nAbsDiff, sal_False );
+ (*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam,
+ nAbsDiff, sal_False );
+ }
+ }
+ else
+ {
+ // dann sich selbst rekursiv aufrufen; nur mit
+ // einem anderen Mode -> proprotional
+ TblChgMode eOld = eTblChgMode;
+ eTblChgMode = TBLVAR_CHGABS;
+
+ bRet = SetRowHeight( rAktBox, eType, nAbsDiff,
+ nRelDiff, ppUndo );
+
+ eTblChgMode = eOld;
+ pFndBox = 0;
+ }
+ }
+ }
+ break;
+ }
+
+ if( pFndBox )
+ {
+ // dann raeume die Struktur aller Lines auf
+ GCLines();
+
+ //Layout updaten
+ if( bBigger || pFndBox->AreLinesToRestore( *this ) )
+ pFndBox->MakeFrms( *this );
+
+ // TL_CHART2: it is currently unclear if sth has to be done here.
+
+ delete pFndBox;
+
+ if( ppUndo && *ppUndo )
+ {
+ aParam.pUndo->SetColWidthParam( nBoxIdx, static_cast<sal_uInt16>(eTblChgMode), eType,
+ nAbsDiff, nRelDiff );
+ if( bBigger )
+ aParam.pUndo->SaveNewBoxes( *aParam.pTblNd, aTmpLst );
+ }
+ }
+
+ CHECKTABLELAYOUT
+
+ return bRet;
+}
+
+/* */
+
+SwFrmFmt* SwShareBoxFmt::GetFormat( long nWidth ) const
+{
+ SwFrmFmt *pRet = 0, *pTmp;
+ for( sal_uInt16 n = aNewFmts.Count(); n; )
+ if( ( pTmp = (SwFrmFmt*)aNewFmts[ --n ])->GetFrmSize().GetWidth()
+ == nWidth )
+ {
+ pRet = pTmp;
+ break;
+ }
+ return pRet;
+}
+
+SwFrmFmt* SwShareBoxFmt::GetFormat( const SfxPoolItem& rItem ) const
+{
+ const SfxPoolItem* pItem;
+ sal_uInt16 nWhich = rItem.Which();
+ SwFrmFmt *pRet = 0, *pTmp;
+ const SfxPoolItem& rFrmSz = pOldFmt->GetFmtAttr( RES_FRM_SIZE, sal_False );
+ for( sal_uInt16 n = aNewFmts.Count(); n; )
+ if( SFX_ITEM_SET == ( pTmp = (SwFrmFmt*)aNewFmts[ --n ])->
+ GetItemState( nWhich, sal_False, &pItem ) && *pItem == rItem &&
+ pTmp->GetFmtAttr( RES_FRM_SIZE, sal_False ) == rFrmSz )
+ {
+ pRet = pTmp;
+ break;
+ }
+ return pRet;
+}
+
+void SwShareBoxFmt::AddFormat( const SwFrmFmt& rNew )
+{
+ void* pFmt = (void*)&rNew;
+ aNewFmts.Insert( pFmt, aNewFmts.Count() );
+}
+
+sal_Bool SwShareBoxFmt::RemoveFormat( const SwFrmFmt& rFmt )
+{
+ // returnt sal_True, wenn geloescht werden kann
+ if( pOldFmt == &rFmt )
+ return sal_True;
+
+ void* p = (void*)&rFmt;
+ sal_uInt16 nFnd = aNewFmts.GetPos( p );
+ if( USHRT_MAX != nFnd )
+ aNewFmts.Remove( nFnd );
+ return 0 == aNewFmts.Count();
+}
+
+SwShareBoxFmts::~SwShareBoxFmts()
+{
+}
+
+SwFrmFmt* SwShareBoxFmts::GetFormat( const SwFrmFmt& rFmt, long nWidth ) const
+{
+ sal_uInt16 nPos;
+ return Seek_Entry( rFmt, &nPos )
+ ? aShareArr[ nPos ]->GetFormat( nWidth )
+ : 0;
+}
+SwFrmFmt* SwShareBoxFmts::GetFormat( const SwFrmFmt& rFmt,
+ const SfxPoolItem& rItem ) const
+{
+ sal_uInt16 nPos;
+ return Seek_Entry( rFmt, &nPos )
+ ? aShareArr[ nPos ]->GetFormat( rItem )
+ : 0;
+}
+
+void SwShareBoxFmts::AddFormat( const SwFrmFmt& rOld, const SwFrmFmt& rNew )
+{
+ // wenn das Format nicht geshared ist, braucht es auch nicht in die
+ // Liste aufgenommen werden. Denn es gibt keinen 2. der es sucht.
+//leider werden auch die CellFrms gefunden
+// if( !rOld.IsLastDepend() )
+ {
+ sal_uInt16 nPos;
+ SwShareBoxFmt* pEntry;
+ if( !Seek_Entry( rOld, &nPos ))
+ {
+ pEntry = new SwShareBoxFmt( rOld );
+ aShareArr.C40_INSERT( SwShareBoxFmt, pEntry, nPos );
+ }
+ else
+ pEntry = aShareArr[ nPos ];
+
+ pEntry->AddFormat( rNew );
+ }
+}
+void SwShareBoxFmts::ChangeFrmFmt( SwTableBox* pBox, SwTableLine* pLn,
+ SwFrmFmt& rFmt )
+{
+ SwClient aCl;
+ SwFrmFmt* pOld = 0;
+ if( pBox )
+ {
+ pOld = pBox->GetFrmFmt();
+ pOld->Add( &aCl );
+ pBox->ChgFrmFmt( (SwTableBoxFmt*)&rFmt );
+ }
+ else if( pLn )
+ {
+ pOld = pLn->GetFrmFmt();
+ pOld->Add( &aCl );
+ pLn->ChgFrmFmt( (SwTableLineFmt*)&rFmt );
+ }
+ if( pOld && pOld->IsLastDepend() )
+ {
+ RemoveFormat( *pOld );
+ delete pOld;
+ }
+}
+
+void SwShareBoxFmts::SetSize( SwTableBox& rBox, const SwFmtFrmSize& rSz )
+{
+ SwFrmFmt *pBoxFmt = rBox.GetFrmFmt(),
+ *pRet = GetFormat( *pBoxFmt, rSz.GetWidth() );
+ if( pRet )
+ ChangeFrmFmt( &rBox, 0, *pRet );
+ else
+ {
+ pRet = rBox.ClaimFrmFmt();
+ pRet->SetFmtAttr( rSz );
+ AddFormat( *pBoxFmt, *pRet );
+ }
+}
+
+void SwShareBoxFmts::SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem )
+{
+ SwFrmFmt *pBoxFmt = rBox.GetFrmFmt(),
+ *pRet = GetFormat( *pBoxFmt, rItem );
+ if( pRet )
+ ChangeFrmFmt( &rBox, 0, *pRet );
+ else
+ {
+ pRet = rBox.ClaimFrmFmt();
+ pRet->SetFmtAttr( rItem );
+ AddFormat( *pBoxFmt, *pRet );
+ }
+}
+
+void SwShareBoxFmts::SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem )
+{
+ SwFrmFmt *pLineFmt = rLine.GetFrmFmt(),
+ *pRet = GetFormat( *pLineFmt, rItem );
+ if( pRet )
+ ChangeFrmFmt( 0, &rLine, *pRet );
+ else
+ {
+ pRet = rLine.ClaimFrmFmt();
+ pRet->SetFmtAttr( rItem );
+ AddFormat( *pLineFmt, *pRet );
+ }
+}
+
+void SwShareBoxFmts::RemoveFormat( const SwFrmFmt& rFmt )
+{
+ for( sal_uInt16 i = aShareArr.Count(); i; )
+ if( aShareArr[ --i ]->RemoveFormat( rFmt ))
+ aShareArr.DeleteAndDestroy( i );
+}
+
+sal_Bool SwShareBoxFmts::Seek_Entry( const SwFrmFmt& rFmt, sal_uInt16* pPos ) const
+{
+ sal_uLong nIdx = (sal_uLong)&rFmt;
+ sal_uInt16 nO = aShareArr.Count(), nM, nU = 0;
+ if( nO > 0 )
+ {
+ nO--;
+ while( nU <= nO )
+ {
+ nM = nU + ( nO - nU ) / 2;
+ sal_uLong nFmt = (sal_uLong)&aShareArr[ nM ]->GetOldFormat();
+ if( nFmt == nIdx )
+ {
+ if( pPos )
+ *pPos = nM;
+ return sal_True;
+ }
+ else if( nFmt < nIdx )
+ nU = nM + 1;
+ else if( nM == 0 )
+ {
+ if( pPos )
+ *pPos = nU;
+ return sal_False;
+ }
+ else
+ nO = nM - 1;
+ }
+ }
+ if( pPos )
+ *pPos = nU;
+ return sal_False;
+}
+
+
diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx
new file mode 100644
index 000000000000..01b4623fba96
--- /dev/null
+++ b/sw/source/core/doc/visiturl.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sfx2/docfile.hxx>
+#include <svl/inethist.hxx>
+#include <fmtinfmt.hxx>
+#include <txtinet.hxx>
+#include <doc.hxx>
+#include <visiturl.hxx>
+#include <hints.hxx>
+#include <ndtxt.hxx>
+#include <editsh.hxx>
+#include <docsh.hxx>
+
+
+SwURLStateChanged::SwURLStateChanged( const SwDoc* pD )
+ : pDoc( pD )
+{
+ StartListening( *INetURLHistory::GetOrCreate() );
+}
+
+SwURLStateChanged::~SwURLStateChanged()
+{
+ EndListening( *INetURLHistory::GetOrCreate() );
+}
+
+void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint )
+{
+ if( rHint.ISA( INetURLHistoryHint ) && pDoc->GetCurrentViewShell() ) //swmod 071108//swmod 071225
+ {
+ // diese URL wurde veraendert:
+ const INetURLObject* pIURL = ((INetURLHistoryHint&)rHint).GetObject();
+ String sURL( pIURL->GetMainURL( INetURLObject::NO_DECODE ) ), sBkmk;
+
+ SwEditShell* pESh = pDoc->GetEditShell();
+
+ if( pDoc->GetDocShell() && pDoc->GetDocShell()->GetMedium() &&
+ // falls das unser Doc ist, kann es auch lokale Spruenge geben!
+ sURL == pDoc->GetDocShell()->GetMedium()->GetName() )
+ (sBkmk = pIURL->GetMark()).Insert( INET_MARK_TOKEN, 0 );
+
+ sal_Bool bAction = sal_False, bUnLockView = sal_False;
+ const SwFmtINetFmt* pItem;
+ const SwTxtINetFmt* pTxtAttr;
+ const SwTxtNode* pTxtNd;
+ sal_uInt32 n, nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT );
+ for( n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = (SwFmtINetFmt*)pDoc->GetAttrPool().GetItem2(
+ RES_TXTATR_INETFMT, n ) ) &&
+ ( pItem->GetValue() == sURL ||
+ ( sBkmk.Len() && pItem->GetValue() == sBkmk )) &&
+ 0 != ( pTxtAttr = pItem->GetTxtINetFmt()) &&
+ 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) )
+ {
+ if( !bAction && pESh )
+ {
+ pESh->StartAllAction();
+ bAction = sal_True;
+ bUnLockView = !pESh->IsViewLocked();
+ pESh->LockView( sal_True );
+ }
+ const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( false );
+ const SwTxtAttr* pAttr = pTxtAttr;
+ SwUpdateAttr aUpdateAttr( *pAttr->GetStart(),
+ *pAttr->GetEnd(),
+ RES_FMT_CHG );
+ ((SwTxtNode*)pTxtNd)->ModifyNotification( &aUpdateAttr, &aUpdateAttr );
+ }
+
+ if( bAction )
+ pESh->EndAllAction();
+ if( bUnLockView )
+ pESh->LockView( sal_False );
+ }
+}
+
+ // erfrage ob die URL besucht war. Uebers Doc, falls nur ein Bookmark
+ // angegeben ist. Dann muss der Doc. Name davor gesetzt werden!
+sal_Bool SwDoc::IsVisitedURL( const String& rURL ) const
+{
+#if OSL_DEBUG_LEVEL > 1
+ static long nTmp = 0;
+ ++nTmp;
+#endif
+
+ sal_Bool bRet = sal_False;
+ if( rURL.Len() )
+ {
+ INetURLHistory *pHist = INetURLHistory::GetOrCreate();
+ if( '#' == rURL.GetChar( 0 ) && pDocShell && pDocShell->GetMedium() )
+ {
+ INetURLObject aIObj( pDocShell->GetMedium()->GetURLObject() );
+ aIObj.SetMark( rURL.Copy( 1 ) );
+ bRet = pHist->QueryUrl( aIObj );
+ }
+ else
+ bRet = pHist->QueryUrl( rURL );
+
+ // dann wollen wird auch ueber Statusaenderungen in der History
+ // informiert werden!
+ if( !pURLStateChgd )
+ {
+ SwDoc* pD = (SwDoc*)this;
+ pD->pURLStateChgd = new SwURLStateChanged( this );
+ }
+ }
+ return bRet;
+}
+
+
+
diff --git a/sw/source/core/docnode/cancellablejob.cxx b/sw/source/core/docnode/cancellablejob.cxx
new file mode 100644
index 000000000000..e769949ab87c
--- /dev/null
+++ b/sw/source/core/docnode/cancellablejob.cxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+#include <cancellablejob.hxx>
+#include <observablethread.hxx>
+
+CancellableJob::CancellableJob( const rtl::Reference< ObservableThread >& rThread ) :
+ mrThread( rThread )
+{
+}
+
+// ::com::sun::star::util::XCancellable:
+void SAL_CALL CancellableJob::cancel() throw (com::sun::star::uno::RuntimeException)
+{
+ mrThread->join();
+}
diff --git a/sw/source/core/docnode/cancellablejob.hxx b/sw/source/core/docnode/cancellablejob.hxx
new file mode 100644
index 000000000000..f2c26630bd81
--- /dev/null
+++ b/sw/source/core/docnode/cancellablejob.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _CANCELLABLEJOB_HXX
+#define _CANCELLABLEJOB_HXX
+
+#include "sal/config.h"
+#include "cppuhelper/implbase1.hxx"
+#include "com/sun/star/util/XCancellable.hpp"
+
+#include <rtl/ref.hxx>
+
+class ObservableThread;
+
+class CancellableJob : public ::cppu::WeakImplHelper1<com::sun::star::util::XCancellable>
+{
+public:
+ explicit CancellableJob( const ::rtl::Reference< ObservableThread >& rThread );
+ ~CancellableJob() {}
+
+ // ::com::sun::star::util::XCancellable:
+ virtual void SAL_CALL cancel() throw (com::sun::star::uno::RuntimeException);
+
+private:
+ CancellableJob( CancellableJob& ); // not defined
+ void operator =( CancellableJob& ); // not defined
+
+ ::rtl::Reference< ObservableThread > mrThread;
+};
+#endif
diff --git a/sw/source/core/docnode/finalthreadmanager.cxx b/sw/source/core/docnode/finalthreadmanager.cxx
new file mode 100644
index 000000000000..f4cedbbf8cdb
--- /dev/null
+++ b/sw/source/core/docnode/finalthreadmanager.cxx
@@ -0,0 +1,549 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+#include <finalthreadmanager.hxx>
+
+#ifndef _OSL_THREAD_HXX_
+#include <osl/thread.hxx>
+#endif
+#include <errhdl.hxx>
+#include <pausethreadstarting.hxx>
+#include <swthreadjoiner.hxx>
+
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+
+namespace css = ::com::sun::star;
+
+/** thread to cancel a give list of cancellable jobs
+
+ helper class for FinalThreadManager
+
+ @author OD
+*/
+class CancelJobsThread : public osl::Thread
+{
+ public:
+ CancelJobsThread( std::list< css::uno::Reference< css::util::XCancellable > > aJobs )
+ : osl::Thread(),
+ maMutex(),
+ maJobs( aJobs ),
+ mbAllJobsCancelled( false ),
+ mbStopped( false )
+ {
+ }
+
+ virtual ~CancelJobsThread() {}
+
+ void addJobs( std::list< css::uno::Reference< css::util::XCancellable > >& rJobs );
+
+ bool allJobsCancelled() const;
+
+ void stopWhenAllJobsCancelled();
+
+ private:
+
+ bool existJobs() const;
+
+ css::uno::Reference< css::util::XCancellable > getNextJob();
+
+ bool stopped() const;
+
+ virtual void SAL_CALL run();
+
+ mutable osl::Mutex maMutex;
+
+ std::list< css::uno::Reference< css::util::XCancellable > > maJobs;
+
+ bool mbAllJobsCancelled;
+ bool mbStopped;
+};
+
+void CancelJobsThread::addJobs( std::list< css::uno::Reference< css::util::XCancellable > >& rJobs )
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ maJobs.insert( maJobs.end(), rJobs.begin(), rJobs.end() );
+ mbAllJobsCancelled = !maJobs.empty();
+}
+
+bool CancelJobsThread::existJobs() const
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ return !maJobs.empty();
+}
+
+bool CancelJobsThread::allJobsCancelled() const
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ return maJobs.empty() && mbAllJobsCancelled;
+}
+void CancelJobsThread::stopWhenAllJobsCancelled()
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ mbStopped = true;
+}
+
+css::uno::Reference< css::util::XCancellable > CancelJobsThread::getNextJob()
+{
+ css::uno::Reference< css::util::XCancellable > xRet;
+
+ {
+ osl::MutexGuard aGuard(maMutex);
+
+ if ( !maJobs.empty() )
+ {
+ xRet = maJobs.front();
+ maJobs.pop_front();
+ }
+ }
+
+ return xRet;
+}
+
+bool CancelJobsThread::stopped() const
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ return mbStopped;
+}
+
+void SAL_CALL CancelJobsThread::run()
+{
+ while ( !stopped() )
+ {
+ while ( existJobs() )
+ {
+ css::uno::Reference< css::util::XCancellable > aJob( getNextJob() );
+ if ( aJob.is() )
+ {
+ aJob->cancel();
+ }
+ }
+
+ mbAllJobsCancelled = true;
+
+ {
+ TimeValue aSleepTime;
+ aSleepTime.Seconds = 1;
+ aSleepTime.Nanosec = 0;
+ osl_waitThread( &aSleepTime );
+ }
+ }
+}
+
+/** thread to terminate office, when all jobs are cancelled.
+
+ helper class for FinalThreadManager
+
+ @author OD
+*/
+class TerminateOfficeThread : public osl::Thread
+{
+ public:
+ TerminateOfficeThread( CancelJobsThread& rCancelJobsThread,
+ css::uno::Reference< css::uno::XComponentContext > const & xContext )
+ : osl::Thread(),
+ maMutex(),
+ mrCancelJobsThread( rCancelJobsThread ),
+ mbStopOfficeTermination( false ),
+ mxContext( xContext )
+ {
+ }
+
+ virtual ~TerminateOfficeThread() {}
+
+ void StopOfficeTermination();
+
+ private:
+
+ virtual void SAL_CALL run();
+ virtual void SAL_CALL onTerminated();
+
+ bool OfficeTerminationStopped();
+
+ void PerformOfficeTermination();
+
+ osl::Mutex maMutex;
+
+ const CancelJobsThread& mrCancelJobsThread;
+
+ bool mbStopOfficeTermination;
+
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+};
+
+void TerminateOfficeThread::StopOfficeTermination()
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ mbStopOfficeTermination = true;
+}
+
+bool TerminateOfficeThread::OfficeTerminationStopped()
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ return mbStopOfficeTermination;
+}
+
+void SAL_CALL TerminateOfficeThread::run()
+{
+ while ( !OfficeTerminationStopped() )
+ {
+ osl::MutexGuard aGuard(maMutex);
+
+ if ( mrCancelJobsThread.allJobsCancelled() )
+ {
+ break;
+ }
+ }
+
+ if ( !OfficeTerminationStopped() )
+ {
+ PerformOfficeTermination();
+ }
+}
+
+void TerminateOfficeThread::PerformOfficeTermination()
+{
+ css::uno::Reference< css::frame::XFramesSupplier > xTasksSupplier(
+ mxContext->getServiceManager()->createInstanceWithContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ),
+ mxContext ),
+ css::uno::UNO_QUERY );
+ if ( !xTasksSupplier.is() )
+ {
+ ASSERT( false, "<TerminateOfficeThread::PerformOfficeTermination()> - no XFramesSupplier!" );
+ return;
+ }
+
+ css::uno::Reference< css::container::XElementAccess > xList( xTasksSupplier->getFrames(), css::uno::UNO_QUERY );
+ if ( !xList.is() )
+ {
+ ASSERT( false, "<TerminateOfficeThread::PerformOfficeTermination()> - no XElementAccess!" );
+ return;
+ }
+
+ if ( !xList->hasElements() )
+ {
+ css::uno::Reference< css::frame::XDesktop > xDesktop( xTasksSupplier, css::uno::UNO_QUERY );
+ if ( xDesktop.is() && !OfficeTerminationStopped() )
+ {
+ xDesktop->terminate();
+ }
+ }
+}
+
+void SAL_CALL TerminateOfficeThread::onTerminated()
+{
+ if ( OfficeTerminationStopped() )
+ {
+ delete this;
+ }
+}
+
+
+/** class FinalThreadManager
+
+ @author OD
+*/
+FinalThreadManager::FinalThreadManager(css::uno::Reference< css::uno::XComponentContext > const & context)
+ : m_xContext(context),
+ maMutex(),
+ maThreads(),
+ mpCancelJobsThread( 0 ),
+ mpTerminateOfficeThread( 0 ),
+ mpPauseThreadStarting( 0 ),
+ mbRegisteredAtDesktop( false )
+{
+
+}
+
+void FinalThreadManager::registerAsListenerAtDesktop()
+{
+ css::uno::Reference< css::frame::XDesktop > xDesktop(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ),
+ m_xContext ),
+ css::uno::UNO_QUERY );
+
+ if ( xDesktop.is() )
+ {
+ xDesktop->addTerminateListener( css::uno::Reference< css::frame::XTerminateListener >( static_cast< cppu::OWeakObject* >( this ), css::uno::UNO_QUERY ) );
+ }
+}
+
+FinalThreadManager::~FinalThreadManager()
+{
+ if ( mpPauseThreadStarting != 0 )
+ {
+ delete mpPauseThreadStarting;
+ mpPauseThreadStarting = 0;
+ }
+
+ if ( mpTerminateOfficeThread != 0 )
+ {
+ mpTerminateOfficeThread->StopOfficeTermination(); // thread kills itself.
+ mpTerminateOfficeThread = 0;
+ }
+
+ if ( !maThreads.empty() )
+ {
+ ASSERT( false, "<FinalThreadManager::~FinalThreadManager()> - still registered jobs are existing -> perform cancellation" );
+ cancelAllJobs();
+ }
+
+ if ( mpCancelJobsThread != 0 )
+ {
+ if ( !mpCancelJobsThread->allJobsCancelled() )
+ {
+ ASSERT( false, "<FinalThreadManager::~FinalThreadManager()> - cancellation of registered jobs not yet finished -> wait for its finish" );
+ }
+
+ mpCancelJobsThread->stopWhenAllJobsCancelled();
+ mpCancelJobsThread->join();
+ delete mpCancelJobsThread;
+ mpCancelJobsThread = 0;
+ }
+}
+
+// com.sun.star.uno.XServiceInfo:
+::rtl::OUString SAL_CALL FinalThreadManager::getImplementationName() throw (css::uno::RuntimeException)
+{
+ return comp_FinalThreadManager::_getImplementationName();
+}
+
+::sal_Bool SAL_CALL FinalThreadManager::supportsService(::rtl::OUString const & serviceName) throw (css::uno::RuntimeException)
+{
+ css::uno::Sequence< ::rtl::OUString > serviceNames = comp_FinalThreadManager::_getSupportedServiceNames();
+ for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {
+ if (serviceNames[i] == serviceName)
+ return sal_True;
+ }
+ return sal_False;
+}
+
+css::uno::Sequence< ::rtl::OUString > SAL_CALL FinalThreadManager::getSupportedServiceNames() throw (css::uno::RuntimeException)
+{
+ return comp_FinalThreadManager::_getSupportedServiceNames();
+}
+
+// ::com::sun::star::util::XJobManager:
+void SAL_CALL FinalThreadManager::registerJob(const css::uno::Reference< css::util::XCancellable > & Job) throw (css::uno::RuntimeException)
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ maThreads.push_back( Job );
+
+ if ( !mbRegisteredAtDesktop )
+ {
+ registerAsListenerAtDesktop();
+ mbRegisteredAtDesktop = true;
+ }
+}
+
+void SAL_CALL FinalThreadManager::releaseJob(const css::uno::Reference< css::util::XCancellable > & Job) throw (css::uno::RuntimeException)
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ maThreads.remove( Job );
+}
+
+void SAL_CALL FinalThreadManager::cancelAllJobs() throw (css::uno::RuntimeException)
+{
+ std::list< css::uno::Reference< css::util::XCancellable > > aThreads;
+ {
+ osl::MutexGuard aGuard(maMutex);
+
+ aThreads.insert( aThreads.end(), maThreads.begin(), maThreads.end() );
+ maThreads.clear();
+ }
+
+ if ( !aThreads.empty() )
+ {
+ osl::MutexGuard aGuard(maMutex);
+
+ if ( mpCancelJobsThread == 0 )
+ {
+ mpCancelJobsThread = new CancelJobsThread( aThreads );;
+ if ( !mpCancelJobsThread->create() )
+ {
+ // error handling
+ // ASSERT( false, "<FinalThreadManager::cancelAllJobs()> - thread to cancel jobs can't be setup --> synchron cancellation of jobs" );
+ delete mpCancelJobsThread;
+ mpCancelJobsThread = 0;
+ while ( !aThreads.empty() )
+ {
+ aThreads.front()->cancel();
+ aThreads.pop_front();
+ }
+ }
+ }
+ else
+ {
+ mpCancelJobsThread->addJobs( aThreads );
+ }
+ }
+}
+
+// ::com::sun::star::frame::XTerminateListener
+void SAL_CALL FinalThreadManager::queryTermination( const css::lang::EventObject& ) throw (css::frame::TerminationVetoException, css::uno::RuntimeException)
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ cancelAllJobs();
+ // Sleep 1 second to give the thread for job cancellation some time.
+ // Probably, all started threads have already finished its work.
+ if ( mpCancelJobsThread != 0 &&
+ !mpCancelJobsThread->allJobsCancelled() )
+ {
+ TimeValue aSleepTime;
+ aSleepTime.Seconds = 1;
+ aSleepTime.Nanosec = 0;
+ osl_waitThread( &aSleepTime );
+ }
+
+ if ( mpCancelJobsThread != 0 &&
+ !mpCancelJobsThread->allJobsCancelled() )
+ {
+ if ( mpTerminateOfficeThread != 0 )
+ {
+ if ( mpTerminateOfficeThread->isRunning() )
+ {
+ mpTerminateOfficeThread->StopOfficeTermination(); // thread kills itself.
+ }
+ else
+ {
+ delete mpTerminateOfficeThread;
+ }
+ mpTerminateOfficeThread = 0;
+ }
+ mpTerminateOfficeThread = new TerminateOfficeThread( *mpCancelJobsThread,
+ m_xContext );
+ if ( !mpTerminateOfficeThread->create() )
+ {
+ // ASSERT( false, "FinalThreadManager::queryTermination(..) - thread to terminate office can't be started!" );
+ delete mpTerminateOfficeThread;
+ mpTerminateOfficeThread = 0;
+ }
+
+ throw css::frame::TerminationVetoException();
+ }
+
+ mpPauseThreadStarting = new SwPauseThreadStarting();
+
+ return;
+}
+
+void SAL_CALL FinalThreadManager::cancelTermination( const css::lang::EventObject& ) throw (css::uno::RuntimeException)
+{
+ if ( mpPauseThreadStarting != 0 )
+ {
+ delete mpPauseThreadStarting;
+ mpPauseThreadStarting = 0;
+ }
+
+ return;
+}
+
+void SAL_CALL FinalThreadManager::notifyTermination( const css::lang::EventObject& ) throw (css::uno::RuntimeException)
+{
+ if ( mpTerminateOfficeThread != 0 )
+ {
+ if ( mpTerminateOfficeThread->isRunning() )
+ {
+ // ASSERT( false, "<FinalThreadManager::notifyTermination()> - office termination thread still running!" );
+ mpTerminateOfficeThread->StopOfficeTermination(); // thread kills itself.
+ }
+ else
+ {
+ delete mpTerminateOfficeThread;
+ }
+ mpTerminateOfficeThread = 0;
+ }
+
+ if ( !maThreads.empty() )
+ {
+ // ASSERT( false, "<FinalThreadManager::notifyTermination()> - still registered jobs are existing" );
+ cancelAllJobs();
+ }
+
+ if ( mpCancelJobsThread != 0 )
+ {
+ if ( !mpCancelJobsThread->allJobsCancelled() )
+ {
+ // ASSERT( false, "<FinalThreadManager::notifyTermination()> - cancellation of registered jobs not yet finished -> wait for its finish" );
+ }
+
+ mpCancelJobsThread->stopWhenAllJobsCancelled();
+ mpCancelJobsThread->join();
+ delete mpCancelJobsThread;
+ mpCancelJobsThread = 0;
+ }
+
+ // get reference of this
+ css::uno::Reference< css::uno::XInterface > aOwnRef( static_cast< cppu::OWeakObject* >( this ));
+ // notify <SwThreadJoiner> to release its reference
+ SwThreadJoiner::ReleaseThreadJoiner();
+}
+
+// ::com::sun:star::lang::XEventListener (inherited via com::sun::star::frame::XTerminateListener)
+void SAL_CALL FinalThreadManager::disposing( const css::lang::EventObject& ) throw (css::uno::RuntimeException)
+{
+ // nothing to do, because instance doesn't hold any references of observed objects
+}
+
+// component helper namespace
+namespace comp_FinalThreadManager {
+
+ ::rtl::OUString SAL_CALL _getImplementationName()
+ {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.comp.FinalThreadManager"));
+ }
+
+ css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames()
+ {
+ css::uno::Sequence< ::rtl::OUString > s(1);
+ s[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.JobManager"));
+ return s;
+ }
+
+ css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
+ const css::uno::Reference< css::uno::XComponentContext > & context)
+ SAL_THROW((css::uno::Exception))
+ {
+ return static_cast< ::cppu::OWeakObject * >(new FinalThreadManager(context));
+ }
+
+} // closing component helper namespace
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
new file mode 100644
index 000000000000..e73c9cf3fd7c
--- /dev/null
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -0,0 +1,1620 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <editeng/brkitem.hxx>
+
+#define _ZFORLIST_DECLARE_TABLE
+#include <hintids.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtanchr.hxx>
+#include <fmtcntnt.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <fldbas.hxx>
+#include <swtable.hxx>
+#include <ddefld.hxx>
+#include <undobj.hxx>
+#include <IMark.hxx>
+#include <mvsave.hxx>
+#include <cellatr.hxx>
+#include <swtblfmt.hxx>
+#include <swddetbl.hxx>
+#include <docary.hxx>
+#include <fmtcnct.hxx>
+#include <redline.hxx>
+#include <paratr.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+#include <SwNodeNum.hxx>
+#ifndef DBG_UTIL
+#define CHECK_TABLE(t)
+#else
+#ifdef DEBUG
+#define CHECK_TABLE(t) (t).CheckConsistency();
+#else
+#define CHECK_TABLE(t)
+#endif
+#endif
+
+namespace
+{
+ /*
+ The lcl_CopyBookmarks function has to copy bookmarks from the source to the destination nodes
+ array. It is called after a call of the _CopyNodes(..) function. But this function does not copy
+ every node (at least at the moment: 2/08/2006 ), section start and end nodes will not be copied if the corresponding end/start node is outside the copied pam.
+ The lcl_NonCopyCount function counts the number of these nodes, given the copied pam and a node
+ index inside the pam.
+ rPam is the original source pam, rLastIdx is the last calculated position, rDelCount the number
+ of "non-copy" nodes between rPam.Start() and rLastIdx.
+ nNewIdx is the new position of interest.
+ */
+
+ static void lcl_NonCopyCount( const SwPaM& rPam, SwNodeIndex& rLastIdx, const sal_uLong nNewIdx, sal_uLong& rDelCount )
+ {
+ sal_uLong nStart = rPam.Start()->nNode.GetIndex();
+ sal_uLong nEnd = rPam.End()->nNode.GetIndex();
+ if( rLastIdx.GetIndex() < nNewIdx ) // Moving forward?
+ {
+ do // count "non-copy" nodes
+ {
+ SwNode& rNode = rLastIdx.GetNode();
+ if( ( rNode.IsSectionNode() && rNode.EndOfSectionIndex() >= nEnd )
+ || ( rNode.IsEndNode() && rNode.StartOfSectionNode()->GetIndex() < nStart ) )
+ ++rDelCount;
+ rLastIdx++;
+ }
+ while( rLastIdx.GetIndex() < nNewIdx );
+ }
+ else if( rDelCount ) // optimization: if there are no "non-copy" nodes until now,
+ // no move backward needed
+ {
+ while( rLastIdx.GetIndex() > nNewIdx )
+ {
+ SwNode& rNode = rLastIdx.GetNode();
+ if( ( rNode.IsSectionNode() && rNode.EndOfSectionIndex() >= nEnd )
+ || ( rNode.IsEndNode() && rNode.StartOfSectionNode()->GetIndex() < nStart ) )
+ --rDelCount;
+ rLastIdx--;
+ }
+ }
+ }
+
+ static void lcl_SetCpyPos( const SwPosition& rOrigPos,
+ const SwPosition& rOrigStt,
+ const SwPosition& rCpyStt,
+ SwPosition& rChgPos,
+ sal_uLong nDelCount )
+ {
+ sal_uLong nNdOff = rOrigPos.nNode.GetIndex();
+ nNdOff -= rOrigStt.nNode.GetIndex();
+ nNdOff -= nDelCount;
+ xub_StrLen nCntntPos = rOrigPos.nContent.GetIndex();
+
+ // --> OD, AMA 2008-07-07 #b6713815#
+ // Always adjust <nNode> at to be changed <SwPosition> instance <rChgPos>
+ rChgPos.nNode = nNdOff + rCpyStt.nNode.GetIndex();
+ if( !nNdOff )
+ // <--
+ {
+ // dann nur den Content anpassen
+ if( nCntntPos > rOrigStt.nContent.GetIndex() )
+ nCntntPos = nCntntPos - rOrigStt.nContent.GetIndex();
+ else
+ nCntntPos = 0;
+ nCntntPos = nCntntPos + rCpyStt.nContent.GetIndex();
+ }
+ rChgPos.nContent.Assign( rChgPos.nNode.GetNode().GetCntntNode(), nCntntPos );
+ }
+
+ // TODO: use SaveBookmark (from _DelBookmarks)
+ static void lcl_CopyBookmarks(const SwPaM& rPam, SwPaM& rCpyPam)
+ {
+ const SwDoc* pSrcDoc = rPam.GetDoc();
+ SwDoc* pDestDoc = rCpyPam.GetDoc();
+ const IDocumentMarkAccess* const pSrcMarkAccess = pSrcDoc->getIDocumentMarkAccess();
+ ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo());
+
+ const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
+ SwPosition* pCpyStt = rCpyPam.Start();
+
+ typedef ::std::vector< const ::sw::mark::IMark* > mark_vector_t;
+ mark_vector_t vMarksToCopy;
+ for(IDocumentMarkAccess::const_iterator_t ppMark = pSrcMarkAccess->getMarksBegin();
+ ppMark != pSrcMarkAccess->getMarksEnd();
+ ppMark++)
+ {
+ const ::sw::mark::IMark* const pMark = ppMark->get();
+ const SwPosition& rMarkStart = pMark->GetMarkStart();
+ const SwPosition& rMarkEnd = pMark->GetMarkEnd();
+ // only include marks that are in the range and not touching
+ // both start and end
+ bool bIsNotOnBoundary = pMark->IsExpanded()
+ ? (rMarkStart != rStt || rMarkEnd != rEnd) // rMarkStart != rMarkEnd
+ : (rMarkStart != rStt && rMarkEnd != rEnd); // rMarkStart == rMarkEnd
+ if(rMarkStart >= rStt && rMarkEnd <= rEnd && bIsNotOnBoundary)
+ {
+ vMarksToCopy.push_back(pMark);
+ }
+ }
+ // We have to count the "non-copied" nodes..
+ SwNodeIndex aCorrIdx(rStt.nNode);
+ sal_uLong nDelCount = 0;
+ for(mark_vector_t::const_iterator ppMark = vMarksToCopy.begin();
+ ppMark != vMarksToCopy.end();
+ ++ppMark)
+ {
+ const ::sw::mark::IMark* const pMark = *ppMark;
+ SwPaM aTmpPam(*pCpyStt);
+ lcl_NonCopyCount(rPam, aCorrIdx, pMark->GetMarkPos().nNode.GetIndex(), nDelCount);
+ lcl_SetCpyPos( pMark->GetMarkPos(), rStt, *pCpyStt, *aTmpPam.GetPoint(), nDelCount);
+ if(pMark->IsExpanded())
+ {
+ aTmpPam.SetMark();
+ lcl_NonCopyCount(rPam, aCorrIdx, pMark->GetOtherMarkPos().nNode.GetIndex(), nDelCount);
+ lcl_SetCpyPos(pMark->GetOtherMarkPos(), rStt, *pCpyStt, *aTmpPam.GetMark(), nDelCount);
+ }
+
+ ::sw::mark::IMark* const pNewMark = pDestDoc->getIDocumentMarkAccess()->makeMark(
+ aTmpPam,
+ pMark->GetName(),
+ IDocumentMarkAccess::GetType(*pMark));
+ // Explicitly try to get exactly the same name as in the source
+ // because NavigatorReminders, DdeBookmarks etc. ignore the proposed name
+ pDestDoc->getIDocumentMarkAccess()->renameMark(pNewMark, pMark->GetName());
+ ::sw::mark::IBookmark* const pNewBookmark =
+ dynamic_cast< ::sw::mark::IBookmark* const >(pNewMark);
+ if(pNewBookmark) /* copying additional attributes for bookmarks */
+ {
+ const ::sw::mark::IBookmark* const pOldBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(pMark);
+ pNewBookmark->SetKeyCode(pOldBookmark->GetKeyCode());
+ pNewBookmark->SetShortName(pOldBookmark->GetShortName());
+ }
+ ::sfx2::Metadatable const*const pMetadatable(
+ dynamic_cast< ::sfx2::Metadatable const* >(pMark));
+ ::sfx2::Metadatable *const pNewMetadatable(
+ dynamic_cast< ::sfx2::Metadatable * >(pNewMark));
+ if (pMetadatable && pNewMetadatable)
+ {
+ pNewMetadatable->RegisterAsCopyOf(*pMetadatable);
+ }
+ }
+ }
+}
+
+// Struktur fuer das Mappen von alten und neuen Frame-Formaten an den
+// Boxen und Lines einer Tabelle
+
+struct _MapTblFrmFmt
+{
+ const SwFrmFmt *pOld, *pNew;
+ _MapTblFrmFmt( const SwFrmFmt *pOldFmt, const SwFrmFmt*pNewFmt )
+ : pOld( pOldFmt ), pNew( pNewFmt )
+ {}
+};
+
+SV_DECL_VARARR( _MapTblFrmFmts, _MapTblFrmFmt, 0, 10 )
+SV_IMPL_VARARR( _MapTblFrmFmts, _MapTblFrmFmt );
+
+SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+{
+ // the Copy-Textnode is the Node with the Text, the Copy-Attrnode is the
+ // node with the collection and hard attributes. Normally ist the same
+ // node, but if insert a glossary without formatting, then the Attrnode
+ // is the prev node of the destionation position in dest. document.
+ SwTxtNode* pCpyTxtNd = (SwTxtNode*)this;
+ SwTxtNode* pCpyAttrNd = pCpyTxtNd;
+
+ // kopiere die Formate in das andere Dokument:
+ SwTxtFmtColl* pColl = 0;
+ if( pDoc->IsInsOnlyTextGlossary() )
+ {
+ SwNodeIndex aIdx( rIdx, -1 );
+ if( aIdx.GetNode().IsTxtNode() )
+ {
+ pCpyAttrNd = aIdx.GetNode().GetTxtNode();
+ pColl = &pCpyAttrNd->GetTxtColl()->GetNextTxtFmtColl();
+ }
+ }
+ if( !pColl )
+ pColl = pDoc->CopyTxtColl( *GetTxtColl() );
+
+ 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!
+ pTxtNd->ResetAllAttr();
+
+ // if Copy-Textnode unequal to Copy-Attrnode, then copy first
+ // the attributes into the new Node.
+ if( pCpyAttrNd != pCpyTxtNd )
+ {
+ pCpyAttrNd->CopyAttr( pTxtNd, 0, 0 );
+ if( pCpyAttrNd->HasSwAttrSet() )
+ {
+ SwAttrSet aSet( *pCpyAttrNd->GetpSwAttrSet() );
+ aSet.ClearItem( RES_PAGEDESC );
+ aSet.ClearItem( RES_BREAK );
+ aSet.CopyToModify( *pTxtNd );
+ }
+ }
+
+ // ??? reicht das ??? was ist mit PostIts/Feldern/FeldTypen ???
+ // --> OD 2008-11-18 #i96213# - force copy of all attributes
+ pCpyTxtNd->CopyText( pTxtNd, SwIndex( pCpyTxtNd ),
+ pCpyTxtNd->GetTxt().Len(), true );
+ // <--
+
+//FEATURE::CONDCOLL
+ if( RES_CONDTXTFMTCOLL == pColl->Which() )
+ pTxtNd->ChkCondColl();
+//FEATURE::CONDCOLL
+
+ return pTxtNd;
+}
+
+
+sal_Bool lcl_SrchNew( const _MapTblFrmFmt& rMap, void * pPara )
+{
+ if( rMap.pOld != *(const SwFrmFmt**)pPara )
+ return sal_True;
+ *((const SwFrmFmt**)pPara) = rMap.pNew;
+ return sal_False; // abbrechen, Pointer gefunden
+}
+
+
+struct _CopyTable
+{
+ SwDoc* pDoc;
+ sal_uLong nOldTblSttIdx;
+ _MapTblFrmFmts& rMapArr;
+ SwTableLine* pInsLine;
+ SwTableBox* pInsBox;
+ SwTableNode *pTblNd;
+ const SwTable *pOldTable;
+
+ _CopyTable( SwDoc* pDc, _MapTblFrmFmts& rArr, sal_uLong nOldStt,
+ SwTableNode& rTblNd, const SwTable* pOldTbl )
+ : pDoc(pDc), nOldTblSttIdx(nOldStt), rMapArr(rArr),
+ pInsLine(0), pInsBox(0), pTblNd(&rTblNd), pOldTable( pOldTbl )
+ {}
+};
+
+sal_Bool lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara );
+
+sal_Bool lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara );
+
+sal_Bool lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara )
+{
+ _CopyTable* pCT = (_CopyTable*)pPara;
+
+ SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rpBox->GetFrmFmt();
+ pCT->rMapArr.ForEach( lcl_SrchNew, &pBoxFmt );
+ if( pBoxFmt == rpBox->GetFrmFmt() ) // ein neues anlegen ??
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_FORMULA, sal_False,
+ &pItem ) && ((SwTblBoxFormula*)pItem)->IsIntrnlName() )
+ {
+ ((SwTblBoxFormula*)pItem)->PtrToBoxNm( pCT->pOldTable );
+ }
+
+ pBoxFmt = pCT->pDoc->MakeTableBoxFmt();
+ pBoxFmt->CopyAttrs( *rpBox->GetFrmFmt() );
+
+ if( rpBox->GetSttIdx() )
+ {
+ SvNumberFormatter* pN = pCT->pDoc->GetNumberFormatter( sal_False );
+ if( pN && pN->HasMergeFmtTbl() && SFX_ITEM_SET == pBoxFmt->
+ GetItemState( RES_BOXATR_FORMAT, sal_False, &pItem ) )
+ {
+ sal_uLong nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue();
+ sal_uLong nNewIdx = pN->GetMergeFmtIndex( nOldIdx );
+ if( nNewIdx != nOldIdx )
+ pBoxFmt->SetFmtAttr( SwTblBoxNumFormat( nNewIdx ));
+
+ }
+ }
+
+ pCT->rMapArr.Insert( _MapTblFrmFmt( rpBox->GetFrmFmt(), pBoxFmt ),
+ pCT->rMapArr.Count() );
+ }
+
+ sal_uInt16 nLines = rpBox->GetTabLines().Count();
+ SwTableBox* pNewBox;
+ if( nLines )
+ pNewBox = new SwTableBox( pBoxFmt, nLines, pCT->pInsLine );
+ else
+ {
+ SwNodeIndex aNewIdx( *pCT->pTblNd,
+ rpBox->GetSttIdx() - pCT->nOldTblSttIdx );
+ ASSERT( aNewIdx.GetNode().IsStartNode(), "Index nicht auf einem StartNode" );
+ pNewBox = new SwTableBox( pBoxFmt, aNewIdx, pCT->pInsLine );
+ pNewBox->setRowSpan( rpBox->getRowSpan() );
+ }
+
+ pCT->pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pNewBox,
+ pCT->pInsLine->GetTabBoxes().Count() );
+
+ if( nLines )
+ {
+ _CopyTable aPara( *pCT );
+ aPara.pInsBox = pNewBox;
+ ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_CopyTblLine, &aPara );
+ }
+ else if( pNewBox->IsInHeadline( &pCT->pTblNd->GetTable() ))
+ // in der HeadLine sind die Absaetze mit BedingtenVorlage anzupassen
+ pNewBox->GetSttNd()->CheckSectionCondColl();
+ return sal_True;
+}
+
+sal_Bool lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara )
+{
+ _CopyTable* pCT = (_CopyTable*)pPara;
+ SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rpLine->GetFrmFmt();
+ pCT->rMapArr.ForEach( lcl_SrchNew, &pLineFmt );
+ if( pLineFmt == rpLine->GetFrmFmt() ) // ein neues anlegen ??
+ {
+ pLineFmt = pCT->pDoc->MakeTableLineFmt();
+ pLineFmt->CopyAttrs( *rpLine->GetFrmFmt() );
+ pCT->rMapArr.Insert( _MapTblFrmFmt( rpLine->GetFrmFmt(), pLineFmt ),
+ pCT->rMapArr.Count());
+ }
+ SwTableLine* pNewLine = new SwTableLine( pLineFmt,
+ rpLine->GetTabBoxes().Count(), pCT->pInsBox );
+ // die neue Zeile in die Tabelle eintragen
+ if( pCT->pInsBox )
+ {
+ pCT->pInsBox->GetTabLines().C40_INSERT( SwTableLine, pNewLine,
+ pCT->pInsBox->GetTabLines().Count() );
+ }
+ else
+ {
+ pCT->pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pNewLine,
+ pCT->pTblNd->GetTable().GetTabLines().Count() );
+ }
+ pCT->pInsLine = pNewLine;
+ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_CopyTblBox, pCT );
+ return sal_True;
+}
+
+SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+{
+ // in welchen Array steht ich denn Nodes, UndoNodes ??
+ SwNodes& rNds = (SwNodes&)GetNodes();
+
+ {
+ // nicht in Fussnoten kopieren !!
+/*
+!! Mal ohne Frames
+ SwCntntNode* pCNd = pDoc->GetNodes()[ rIdx ]->GetCntntNode();
+ SwFrm* pFrm;
+ if( (pCNd && 0 != ( pFrm = pCNd->GetFrm()))
+ ? pFrm->FindFtnFrm()
+ : rIdx < pDoc->GetNodes().EndOfInserts &&
+ pDoc->GetNodes()[pDoc->GetNodes().EndOfInserts]->StartOfSection()
+ < rIdx )
+*/
+ if( rIdx < pDoc->GetNodes().GetEndOfInserts().GetIndex() &&
+ rIdx >= pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex() )
+ return 0;
+ }
+
+ // das TableFrmFmt kopieren
+ String sTblName( GetTable().GetFrmFmt()->GetName() );
+ if( !pDoc->IsCopyIsMove() )
+ {
+ const SwFrmFmts& rTblFmts = *pDoc->GetTblFrmFmts();
+ for( sal_uInt16 n = rTblFmts.Count(); n; )
+ if( rTblFmts[ --n ]->GetName() == sTblName )
+ {
+ sTblName = pDoc->GetUniqueTblName();
+ break;
+ }
+ }
+
+ SwFrmFmt* pTblFmt = pDoc->MakeTblFrmFmt( sTblName, pDoc->GetDfltFrmFmt() );
+ pTblFmt->CopyAttrs( *GetTable().GetFrmFmt() );
+ SwTableNode* pTblNd = new SwTableNode( rIdx );
+ SwEndNode* pEndNd = new SwEndNode( rIdx, *pTblNd );
+ SwNodeIndex aInsPos( *pEndNd );
+
+ SwTable& rTbl = (SwTable&)pTblNd->GetTable();
+ rTbl.RegisterToFormat( *pTblFmt );
+
+ rTbl.SetRowsToRepeat( GetTable().GetRowsToRepeat() );
+ rTbl.SetTblChgMode( GetTable().GetTblChgMode() );
+ rTbl.SetTableModel( GetTable().IsNewModel() );
+
+ SwDDEFieldType* pDDEType = 0;
+ if( IS_TYPE( SwDDETable, &GetTable() ))
+ {
+ // es wird eine DDE-Tabelle kopiert
+ // ist im neuen Dokument ueberhaupt der FeldTyp vorhanden ?
+ pDDEType = ((SwDDETable&)GetTable()).GetDDEFldType();
+ if( pDDEType->IsDeleted() )
+ pDoc->InsDeletedFldType( *pDDEType );
+ else
+ pDDEType = (SwDDEFieldType*)pDoc->InsertFldType( *pDDEType );
+ ASSERT( pDDEType, "unbekannter FieldType" );
+
+ // tauschen am Node den Tabellen-Pointer aus
+ SwDDETable* pNewTable = new SwDDETable( pTblNd->GetTable(), pDDEType );
+ pTblNd->SetNewTable( pNewTable, sal_False );
+ }
+ // dann kopiere erstmal den Inhalt der Tabelle, die Zuordnung der
+ // Boxen/Lines und das anlegen der Frames erfolgt spaeter
+ SwNodeRange aRg( *this, +1, *EndOfSectionNode() ); // (wo stehe in denn nun ??)
+
+ // If there is a table in this table, the table format for the outer table
+ // does not seem to be used, because the table does not have any contents yet
+ // (see IsUsed). Therefore the inner table gets the same name as the outer table.
+ // We have to make sure that the table node of the SwTable is accessible, even
+ // without any content in aSortCntBoxes. #i26629#
+ pTblNd->GetTable().SetTableNode( pTblNd );
+ rNds._Copy( aRg, aInsPos, sal_False );
+ pTblNd->GetTable().SetTableNode( 0 );
+
+ // Sonderbehandlung fuer eine einzelne Box
+ if( 1 == GetTable().GetTabSortBoxes().Count() )
+ {
+ aRg.aStart.Assign( *pTblNd, 1 );
+ aRg.aEnd.Assign( *pTblNd->EndOfSectionNode() );
+ pDoc->GetNodes().SectionDown( &aRg, SwTableBoxStartNode );
+ }
+
+ // loesche alle Frames vom kopierten Bereich, diese werden beim
+ // erzeugen des TableFrames angelegt !
+ pTblNd->DelFrms();
+
+ _MapTblFrmFmts aMapArr;
+ _CopyTable aPara( pDoc, aMapArr, GetIndex(), *pTblNd, &GetTable() );
+
+ ((SwTable&)GetTable()).GetTabLines().ForEach( &lcl_CopyTblLine, &aPara );
+
+ if( pDDEType )
+ pDDEType->IncRefCnt();
+
+ CHECK_TABLE( GetTable() );
+ return pTblNd;
+}
+
+void SwTxtNode::CopyCollFmt( SwTxtNode& rDestNd )
+{
+ // kopiere die Formate in das andere Dokument:
+
+ // Sonderbehandlung fuer PageBreak/PageDesc/ColBrk
+ SwDoc* pDestDoc = rDestNd.GetDoc();
+ SwAttrSet aPgBrkSet( pDestDoc->GetAttrPool(), aBreakSetRange );
+ const SwAttrSet* pSet;
+
+ if( 0 != ( pSet = rDestNd.GetpSwAttrSet() ) )
+ {
+ // Sonderbehandlung fuer unsere Break-Attribute
+ const SfxPoolItem* pAttr;
+ if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False, &pAttr ) )
+ aPgBrkSet.Put( *pAttr );
+
+ if( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, sal_False, &pAttr ) )
+ aPgBrkSet.Put( *pAttr );
+ }
+
+ rDestNd.ChgFmtColl( pDestDoc->CopyTxtColl( *GetTxtColl() ));
+ if( 0 != ( pSet = GetpSwAttrSet() ) )
+ pSet->CopyToModify( rDestNd );
+
+ if( aPgBrkSet.Count() )
+ rDestNd.SetAttr( aPgBrkSet );
+}
+
+
+// ----- Copy-Methode vom SwDoc ------
+
+ // verhinder das Kopieren in Fly's, die im Bereich verankert sind.
+sal_Bool lcl_ChkFlyFly( SwDoc* pDoc, sal_uLong nSttNd, sal_uLong nEndNd,
+ sal_uLong nInsNd )
+{
+ const SwSpzFrmFmts& rFrmFmtTbl = *pDoc->GetSpzFrmFmts();
+
+ for( sal_uInt16 n = 0; n < rFrmFmtTbl.Count(); ++n )
+ {
+ SwFrmFmt const*const pFmt = rFrmFmtTbl[n];
+ SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor();
+ SwPosition const*const pAPos = pAnchor->GetCntntAnchor();
+ if (pAPos &&
+ ((FLY_AS_CHAR == pAnchor->GetAnchorId()) ||
+ (FLY_AT_CHAR == pAnchor->GetAnchorId()) ||
+ (FLY_AT_FLY == pAnchor->GetAnchorId()) ||
+ (FLY_AT_PARA == pAnchor->GetAnchorId())) &&
+ nSttNd <= pAPos->nNode.GetIndex() &&
+ pAPos->nNode.GetIndex() < nEndNd )
+ {
+ const SwFmtCntnt& rCntnt = pFmt->GetCntnt();
+ SwStartNode* pSNd;
+ if( !rCntnt.GetCntntIdx() ||
+ 0 == ( pSNd = rCntnt.GetCntntIdx()->GetNode().GetStartNode() ))
+ continue;
+
+ if( pSNd->GetIndex() < nInsNd &&
+ nInsNd < pSNd->EndOfSectionIndex() )
+ return sal_True; // nicht kopieren !!
+
+ if( lcl_ChkFlyFly( pDoc, pSNd->GetIndex(),
+ pSNd->EndOfSectionIndex(), nInsNd ) )
+ return sal_True; // nicht kopieren !!
+ }
+ }
+
+ return sal_False;
+}
+
+void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam )
+{
+ const SwDoc* pSrcDoc = rPam.GetDoc();
+ const SwRedlineTbl& rTbl = pSrcDoc->GetRedlineTbl();
+ if( rTbl.Count() )
+ {
+ SwDoc* pDestDoc = rCpyPam.GetDoc();
+ SwPosition* pCpyStt = rCpyPam.Start(), *pCpyEnd = rCpyPam.End();
+ SwPaM* pDelPam = 0;
+ const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
+ // We have to count the "non-copied" nodes
+ sal_uLong nDelCount = 0;
+ SwNodeIndex aCorrIdx( pStt->nNode );
+
+ sal_uInt16 n = 0;
+ pSrcDoc->GetRedline( *pStt, &n );
+ for( ; n < rTbl.Count(); ++n )
+ {
+ const SwRedline* pRedl = rTbl[ n ];
+ if( nsRedlineType_t::REDLINE_DELETE == pRedl->GetType() && pRedl->IsVisible() )
+ {
+ const SwPosition *pRStt = pRedl->Start(), *pREnd = pRedl->End();
+
+ SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRStt, *pREnd );
+ switch( eCmpPos )
+ {
+ case POS_COLLIDE_END:
+ case POS_BEFORE: // Pos1 liegt vor Pos2
+ break;
+
+ case POS_COLLIDE_START:
+ case POS_BEHIND: // Pos1 liegt hinter Pos2
+ n = rTbl.Count();
+ break;
+
+ default:
+ {
+ pDelPam = new SwPaM( *pCpyStt, pDelPam );
+ if( *pStt < *pRStt )
+ {
+ lcl_NonCopyCount( rPam, aCorrIdx, pRStt->nNode.GetIndex(), nDelCount );
+ lcl_SetCpyPos( *pRStt, *pStt, *pCpyStt,
+ *pDelPam->GetPoint(), nDelCount );
+ }
+ pDelPam->SetMark();
+
+ if( *pEnd < *pREnd )
+ *pDelPam->GetPoint() = *pCpyEnd;
+ else
+ {
+ lcl_NonCopyCount( rPam, aCorrIdx, pREnd->nNode.GetIndex(), nDelCount );
+ lcl_SetCpyPos( *pREnd, *pStt, *pCpyStt,
+ *pDelPam->GetPoint(), nDelCount );
+ }
+ }
+ }
+ }
+ }
+
+ if( pDelPam )
+ {
+ RedlineMode_t eOld = pDestDoc->GetRedlineMode();
+ pDestDoc->SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+
+ ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo());
+
+ do {
+ pDestDoc->DeleteAndJoin( *(SwPaM*)pDelPam->GetNext() );
+ if( pDelPam->GetNext() == pDelPam )
+ break;
+ delete pDelPam->GetNext();
+ } while( sal_True );
+ delete pDelPam;
+
+ pDestDoc->SetRedlineMode_intern( eOld );
+ }
+ }
+}
+
+void lcl_DeleteRedlines( const SwNodeRange& rRg, SwNodeRange& rCpyRg )
+{
+ SwDoc* pSrcDoc = rRg.aStart.GetNode().GetDoc();
+ if( pSrcDoc->GetRedlineTbl().Count() )
+ {
+ SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
+ SwPaM aCpyTmp( rCpyRg.aStart, rCpyRg.aEnd );
+ lcl_DeleteRedlines( aRgTmp, aCpyTmp );
+ }
+}
+
+// Kopieren eines Bereiches im oder in ein anderes Dokument !
+
+bool
+SwDoc::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const
+{
+ const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
+
+ SwDoc* pDoc = rPos.nNode.GetNode().GetDoc();
+ bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
+
+ // kein Copy abfangen.
+ if( !rPam.HasMark() || ( *pStt >= *pEnd && !bColumnSel ) )
+ return false;
+
+ // verhinder das Kopieren in Fly's, die im Bereich verankert sind.
+ if( pDoc == this )
+ {
+ // Start-/EndNode noch korrigieren
+ sal_uLong nStt = pStt->nNode.GetIndex(),
+ nEnd = pEnd->nNode.GetIndex(),
+ nDiff = nEnd - nStt +1;
+ SwNode* pNd = GetNodes()[ nStt ];
+ if( pNd->IsCntntNode() && pStt->nContent.GetIndex() )
+ ++nStt, --nDiff;
+ if( (pNd = GetNodes()[ nEnd ])->IsCntntNode() &&
+ ((SwCntntNode*)pNd)->Len() != pEnd->nContent.GetIndex() )
+ --nEnd, --nDiff;
+ if( nDiff &&
+ lcl_ChkFlyFly( pDoc, nStt, nEnd, rPos.nNode.GetIndex() ) )
+ {
+ return false;
+ }
+ }
+
+ SwPaM* pRedlineRange = 0;
+ if( pDoc->IsRedlineOn() ||
+ (!pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() ) )
+ pRedlineRange = new SwPaM( rPos );
+
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+
+ bool bRet = false;
+
+ if( pDoc != this )
+ { // ordinary copy
+ bRet = CopyImpl( rPam, rPos, true, bCopyAll, pRedlineRange );
+ }
+ // Copy in sich selbst (ueber mehrere Nodes wird hier gesondert
+ // behandelt; in einem TextNode wird normal behandelt)
+ else if( ! ( *pStt <= rPos && rPos < *pEnd &&
+ ( pStt->nNode != pEnd->nNode ||
+ !pStt->nNode.GetNode().IsTxtNode() )) )
+ { // ordinary copy
+ bRet = CopyImpl( rPam, rPos, true, bCopyAll, pRedlineRange );
+ }
+ else
+ {
+ ASSERT( this == pDoc, " falscher Copy-Zweig!" );
+ ASSERT(false, "mst: i thought this could be dead code;"
+ "please tell me what you did to get here!");
+ pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+
+ // dann kopiere den Bereich im unteren DokumentBereich,
+ // (mit Start/End-Nodes geklammert) und verschiebe diese
+ // dann an die gewuenschte Stelle.
+
+ SwUndoCpyDoc* pUndo = 0;
+ SwPaM aPam( rPos ); // UndoBereich sichern
+ if (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ {
+ pDoc->GetIDocumentUndoRedo().ClearRedo();
+ pUndo = new SwUndoCpyDoc( aPam );
+ }
+
+ {
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+ SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection(
+ SwNodeIndex( GetNodes().GetEndOfAutotext() ));
+ aPam.GetPoint()->nNode = *pSttNd->EndOfSectionNode();
+ // copy without Frames
+ pDoc->CopyImpl( rPam, *aPam.GetPoint(), false, bCopyAll, 0 );
+
+ aPam.GetPoint()->nNode = pDoc->GetNodes().GetEndOfAutotext();
+ aPam.SetMark();
+ SwCntntNode* pNode =
+ pDoc->GetNodes().GoPrevious( &aPam.GetMark()->nNode );
+ pNode->MakeEndIndex( &aPam.GetMark()->nContent );
+
+ aPam.GetPoint()->nNode = *aPam.GetNode()->StartOfSectionNode();
+ pNode = pDoc->GetNodes().GoNext( &aPam.GetPoint()->nNode );
+ pNode->MakeStartIndex( &aPam.GetPoint()->nContent );
+ // move to desired position
+ pDoc->MoveRange( aPam, rPos, DOC_MOVEDEFAULT );
+
+ pNode = aPam.GetCntntNode();
+ *aPam.GetPoint() = rPos; // Cursor umsetzen fuers Undo !
+ aPam.SetMark(); // auch den Mark umsetzen !!
+ aPam.DeleteMark(); // aber keinen Bereich makieren !!
+ pDoc->DeleteSection( pNode ); // Bereich wieder loeschen
+ }
+
+ // if Undo is enabled, store the insertion range
+ if (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo->SetInsertRange( aPam );
+ pDoc->GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ if( pRedlineRange )
+ {
+ pRedlineRange->SetMark();
+ *pRedlineRange->GetPoint() = *aPam.GetPoint();
+ *pRedlineRange->GetMark() = *aPam.GetMark();
+ }
+
+ pDoc->SetModified();
+ bRet = true;
+ }
+
+ pDoc->SetRedlineMode_intern( eOld );
+ if( pRedlineRange )
+ {
+ if( pDoc->IsRedlineOn() )
+ pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlineRange ), true);
+ else
+ pDoc->SplitRedline( *pRedlineRange );
+ delete pRedlineRange;
+ }
+
+ return bRet;
+}
+
+// Kopieren eines Bereiches im oder in ein anderes Dokument !
+// Die Position darf nicht im Bereich liegen !!
+
+bool lcl_MarksWholeNode(const SwPaM & rPam)
+{
+ bool bResult = false;
+ const SwPosition* pStt = rPam.Start();
+ const SwPosition* pEnd = rPam.End();
+
+ if (NULL != pStt && NULL != pEnd)
+ {
+ const SwTxtNode* pSttNd = pStt->nNode.GetNode().GetTxtNode();
+ const SwTxtNode* pEndNd = pEnd->nNode.GetNode().GetTxtNode();
+
+ if (NULL != pSttNd && NULL != pEndNd &&
+ pStt->nContent.GetIndex() == 0 &&
+ pEnd->nContent.GetIndex() == pEndNd->Len())
+ {
+ bResult = true;
+ }
+ }
+
+ return bResult;
+}
+
+// --> OD 2009-08-25 #i86492#
+bool lcl_ContainsOnlyParagraphsInList( const SwPaM& rPam )
+{
+ bool bRet = false;
+
+ const SwTxtNode* pTxtNd = rPam.Start()->nNode.GetNode().GetTxtNode();
+ const SwTxtNode* pEndTxtNd = rPam.End()->nNode.GetNode().GetTxtNode();
+ if ( pTxtNd && pTxtNd->IsInList() &&
+ pEndTxtNd && pEndTxtNd->IsInList() )
+ {
+ bRet = true;
+ SwNodeIndex aIdx(rPam.Start()->nNode);
+
+ do
+ {
+ aIdx++;
+ pTxtNd = aIdx.GetNode().GetTxtNode();
+
+ if ( !pTxtNd || !pTxtNd->IsInList() )
+ {
+ bRet = false;
+ break;
+ }
+ } while ( pTxtNd && pTxtNd != pEndTxtNd );
+ }
+
+
+ return bRet;
+}
+// <--
+
+bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
+ const bool bMakeNewFrms, const bool bCopyAll,
+ SwPaM *const pCpyRange ) const
+{
+ SwDoc* pDoc = rPos.nNode.GetNode().GetDoc();
+ const bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
+
+ SwPosition* pStt = rPam.Start();
+ SwPosition* pEnd = rPam.End();
+
+ // kein Copy abfangen.
+ if( !rPam.HasMark() || ( *pStt >= *pEnd && !bColumnSel ) ||
+ //JP 29.6.2001: 88963 - dont copy if inspos is in region of start to end
+ //JP 15.11.2001: don't test inclusive the end, ever exclusive
+ ( pDoc == this && *pStt <= rPos && rPos < *pEnd ))
+ {
+ return false;
+ }
+
+ const bool bEndEqualIns = pDoc == this && rPos == *pEnd;
+
+ // falls Undo eingeschaltet, erzeuge das UndoCopy-Objekt
+ SwUndoCpyDoc* pUndo = 0;
+ SwPaM aCpyPam( rPos );
+
+ SwTblNumFmtMerge aTNFM( *this, *pDoc );
+
+ if (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoCpyDoc( aCpyPam );
+ pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+
+ RedlineMode_t eOld = pDoc->GetRedlineMode();
+ pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+
+
+ // bewege den Pam von der Insert-Position ein zurueck, dadurch wird
+ // die Position nicht "verschoben"
+ aCpyPam.SetMark();
+ sal_Bool bCanMoveBack = aCpyPam.Move( fnMoveBackward, fnGoCntnt );
+ if( !bCanMoveBack )
+ aCpyPam.GetPoint()->nNode--;
+
+ SwNodeRange aRg( pStt->nNode, pEnd->nNode );
+ SwNodeIndex aInsPos( rPos.nNode );
+ const bool bOneNode = pStt->nNode == pEnd->nNode;
+ SwTxtNode* pSttTxtNd = pStt->nNode.GetNode().GetTxtNode();
+ SwTxtNode* pEndTxtNd = pEnd->nNode.GetNode().GetTxtNode();
+ SwTxtNode* pDestTxtNd = aInsPos.GetNode().GetTxtNode();
+ bool bCopyCollFmt = !pDoc->IsInsOnlyTextGlossary() &&
+ ( ( pDestTxtNd && !pDestTxtNd->GetTxt().Len() ) ||
+ ( !bOneNode && !rPos.nContent.GetIndex() ) );
+ bool bCopyBookmarks = true;
+ sal_Bool bStartIsTxtNode = 0 != pSttTxtNd;
+
+ // #i104585# copy outline num rule to clipboard (for ASCII filter)
+ if (pDoc->IsClipBoard() && GetOutlineNumRule())
+ {
+ pDoc->SetOutlineNumRule(*GetOutlineNumRule());
+ }
+
+ // --> OD 2009-08-25 #i86492#
+ // Correct the search for a previous list:
+ // First search for non-outline numbering list. Then search for non-outline
+ // bullet list.
+ // Keep also the <ListId> value for possible propagation.
+ String aListIdToPropagate;
+ const SwNumRule* pNumRuleToPropagate =
+ pDoc->SearchNumRule( rPos, false, true, false, 0, aListIdToPropagate, true );
+ if ( !pNumRuleToPropagate )
+ {
+ pNumRuleToPropagate =
+ pDoc->SearchNumRule( rPos, false, false, false, 0, aListIdToPropagate, true );
+ }
+ // <--
+ // --> OD 2009-08-25 #i86492#
+ // Do not propagate previous found list, if
+ // - destination is an empty paragraph which is not in a list and
+ // - source contains at least one paragraph which is not in a list
+ if ( pNumRuleToPropagate &&
+ pDestTxtNd && !pDestTxtNd->GetTxt().Len() && !pDestTxtNd->IsInList() &&
+ !lcl_ContainsOnlyParagraphsInList( rPam ) )
+ {
+ pNumRuleToPropagate = 0;
+ }
+ // <--
+
+ // Block, damit aus diesem gesprungen werden kann !!
+ do {
+ if( pSttTxtNd )
+ {
+ // den Anfang nicht komplett kopieren ?
+ if( !bCopyCollFmt || bColumnSel || pStt->nContent.GetIndex() )
+ {
+ SwIndex aDestIdx( rPos.nContent );
+ sal_Bool bCopyOk = sal_False;
+ if( !pDestTxtNd )
+ {
+ if( pStt->nContent.GetIndex() || bOneNode )
+ pDestTxtNd = pDoc->GetNodes().MakeTxtNode( aInsPos,
+ pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD));
+ else
+ {
+ pDestTxtNd = static_cast<SwTxtNode*>(pSttTxtNd->MakeCopy( pDoc, aInsPos ));
+ bCopyOk = sal_True;
+ }
+ aDestIdx.Assign( pDestTxtNd, 0 );
+ bCopyCollFmt = true;
+ }
+ else if( !bOneNode || bColumnSel )
+ {
+ xub_StrLen nCntntEnd = pEnd->nContent.GetIndex();
+ {
+ ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
+ pDoc->SplitNode( rPos, false );
+ }
+
+ if( bCanMoveBack && rPos == *aCpyPam.GetPoint() )
+ {
+ // nach dem SplitNode, den CpyPam wieder richtig aufspannen
+ aCpyPam.Move( fnMoveBackward, fnGoCntnt );
+ aCpyPam.Move( fnMoveBackward, fnGoCntnt );
+ }
+
+ pDestTxtNd = pDoc->GetNodes()[ aInsPos.GetIndex()-1 ]->GetTxtNode();
+ aDestIdx.Assign( pDestTxtNd, pDestTxtNd->GetTxt().Len() );
+
+ // korrigiere den Bereich wieder !!
+ if( bEndEqualIns )
+ {
+ sal_Bool bChg = pEnd != rPam.GetPoint();
+ if( bChg )
+ rPam.Exchange();
+ rPam.Move( fnMoveBackward, fnGoCntnt );
+ if( bChg )
+ rPam.Exchange();
+
+ aRg.aEnd = pEnd->nNode;
+ pEndTxtNd = pEnd->nNode.GetNode().GetTxtNode();
+ }
+ else if( rPos == *pEnd ) // Wurde das Ende auch verschoben
+ {
+ pEnd->nNode--;
+ pEnd->nContent.Assign( pDestTxtNd, nCntntEnd );
+ aRg.aEnd = pEnd->nNode;
+ pEndTxtNd = pEnd->nNode.GetNode().GetTxtNode();
+ }
+ }
+
+ /* #107213#: Safe numrule item at destination. */
+ // --> OD 2009-08-25 #i86492#
+ // Safe also <ListId> item of destination.
+ int aNumRuleState = SFX_ITEM_UNKNOWN;
+ SwNumRuleItem aNumRuleItem;
+ int aListIdState = SFX_ITEM_UNKNOWN;
+ SfxStringItem aListIdItem( RES_PARATR_LIST_ID, String() );
+ {
+ const SfxItemSet * pAttrSet = pDestTxtNd->GetpSwAttrSet();
+ if (pAttrSet != NULL)
+ {
+ const SfxPoolItem * pItem = NULL;
+ aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, sal_False, &pItem);
+ if (SFX_ITEM_SET == aNumRuleState)
+ aNumRuleItem = *((SwNumRuleItem *) pItem);
+
+ aListIdState =
+ pAttrSet->GetItemState(RES_PARATR_LIST_ID, sal_False, &pItem);
+ if (SFX_ITEM_SET == aListIdState)
+ {
+ aListIdItem.SetValue( static_cast<const SfxStringItem*>(pItem)->GetValue() );
+ }
+ }
+ }
+ // <--
+ /* #107213# */
+
+ if( !bCopyOk )
+ {
+ const xub_StrLen nCpyLen = ( (bOneNode)
+ ? pEnd->nContent.GetIndex()
+ : pSttTxtNd->GetTxt().Len() )
+ - pStt->nContent.GetIndex();
+ pSttTxtNd->CopyText( pDestTxtNd, aDestIdx,
+ pStt->nContent, nCpyLen );
+ if( bEndEqualIns )
+ pEnd->nContent -= nCpyLen;
+ }
+
+ if( bOneNode )
+ {
+ if( bCopyCollFmt )
+ {
+ pSttTxtNd->CopyCollFmt( *pDestTxtNd );
+
+ /* #107213# If only a part of one paragraph is copied
+ restore the numrule at the destination. */
+ // --> OD 2009-08-25 #i86492#
+ // restore also <ListId> item
+ if ( !lcl_MarksWholeNode(rPam) )
+ {
+ if (SFX_ITEM_SET == aNumRuleState)
+ {
+ pDestTxtNd->SetAttr(aNumRuleItem);
+ }
+ else
+ {
+ pDestTxtNd->ResetAttr(RES_PARATR_NUMRULE);
+ }
+ if (SFX_ITEM_SET == aListIdState)
+ {
+ pDestTxtNd->SetAttr(aListIdItem);
+ }
+ else
+ {
+ pDestTxtNd->ResetAttr(RES_PARATR_LIST_ID);
+ }
+ }
+ }
+
+ break;
+ }
+
+ aRg.aStart++;
+ }
+ }
+ else if( pDestTxtNd )
+ {
+ // Problems with insertion of table selections into "normal" text solved.
+ // We have to set the correct PaM for Undo, if this PaM starts in a textnode,
+ // the undo operation will try to merge this node after removing the table.
+ // If we didn't split a textnode, the PaM should start at the inserted table node
+ if( rPos.nContent.GetIndex() == pDestTxtNd->Len() )
+ { // Insertion at the last position of a textnode (empty or not)
+ aInsPos++; // The table will be inserted behind the text node
+ }
+ else if( rPos.nContent.GetIndex() )
+ { // Insertion in the middle of a text node, it has to be split
+ // (and joined from undo)
+ bStartIsTxtNode = sal_True;
+ // splitte den TextNode, bei dem Eingefuegt wird.
+
+ xub_StrLen nCntntEnd = pEnd->nContent.GetIndex();
+ {
+ ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
+ pDoc->SplitNode( rPos, false );
+ }
+
+ if( bCanMoveBack && rPos == *aCpyPam.GetPoint() )
+ {
+ // nach dem SplitNode, den CpyPam wieder richtig aufspannen
+ aCpyPam.Move( fnMoveBackward, fnGoCntnt );
+ aCpyPam.Move( fnMoveBackward, fnGoCntnt );
+ }
+
+ // korrigiere den Bereich wieder !!
+ if( bEndEqualIns )
+ aRg.aEnd--;
+ else if( rPos == *pEnd ) // Wurde das Ende auch verschoben
+ {
+ rPos.nNode-=2;
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(),
+ nCntntEnd );
+ rPos.nNode++;
+ aRg.aEnd--;
+ }
+ }
+ else if( bCanMoveBack )
+ { //Insertion at the first position of a text node. It will not be splitted, the table
+ // will be inserted before the text node.
+ // See below, before the SetInsertRange funciton of the undo object will be called,
+ // the CpyPam would be moved to the next content position. This has to be avoided
+ // We want to be moved to the table node itself thus we have to set bCanMoveBack
+ // and to manipulate aCpyPam.
+ bCanMoveBack = false;
+ aCpyPam.GetPoint()->nNode--;
+ }
+ }
+
+ pDestTxtNd = aInsPos.GetNode().GetTxtNode();
+ if( pEndTxtNd )
+ {
+ SwIndex aDestIdx( rPos.nContent );
+ if( !pDestTxtNd )
+ {
+ pDestTxtNd = pDoc->GetNodes().MakeTxtNode( aInsPos,
+ pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD));
+ aDestIdx.Assign( pDestTxtNd, 0 );
+ aInsPos--;
+
+ // #112756# #98130# if we have to insert an extra text node
+ // at the destination, this node will be our new destination
+ // (text) node, and thus we set bStartisTxtNode to true. This
+ // will ensure that this node will be deleted during Undo
+ // using JoinNext.
+ DBG_ASSERT( !bStartIsTxtNode, "Oops, undo may be instable now." );
+ bStartIsTxtNode = sal_True;
+ }
+
+ /* #107213# Save numrule at destination */
+ // --> OD 2009-08-25 #i86492#
+ // Safe also <ListId> item of destination.
+ int aNumRuleState = SFX_ITEM_UNKNOWN;
+ SwNumRuleItem aNumRuleItem;
+ int aListIdState = SFX_ITEM_UNKNOWN;
+ SfxStringItem aListIdItem( RES_PARATR_LIST_ID, String() );
+ {
+ const SfxItemSet* pAttrSet = pDestTxtNd->GetpSwAttrSet();
+ if (pAttrSet != NULL)
+ {
+ const SfxPoolItem * pItem = NULL;
+
+ aNumRuleState =
+ pAttrSet->GetItemState(RES_PARATR_NUMRULE, sal_False, &pItem);
+ if (SFX_ITEM_SET == aNumRuleState)
+ aNumRuleItem = *((SwNumRuleItem *) pItem);
+
+ aListIdState =
+ pAttrSet->GetItemState(RES_PARATR_LIST_ID, sal_False, &pItem);
+ if (SFX_ITEM_SET == aListIdState)
+ aListIdItem.SetValue( static_cast<const SfxStringItem*>(pItem)->GetValue() );
+ }
+ }
+ // <--
+ /* #107213# */
+
+ const bool bEmptyDestNd = 0 == pDestTxtNd->GetTxt().Len();
+ pEndTxtNd->CopyText( pDestTxtNd, aDestIdx, SwIndex( pEndTxtNd ),
+ pEnd->nContent.GetIndex() );
+
+ // auch alle FormatVorlagen kopieren
+ if( bCopyCollFmt && ( bOneNode || bEmptyDestNd ))
+ {
+ pEndTxtNd->CopyCollFmt( *pDestTxtNd );
+
+ if ( bOneNode )
+ {
+ /* #107213# If only a part of one paragraph is copied
+ restore the numrule at the destination. */
+ // --> OD 2009-08-25 #i86492#
+ // restore also <ListId> item
+ if ( !lcl_MarksWholeNode(rPam) )
+ {
+ if (SFX_ITEM_SET == aNumRuleState)
+ {
+ pDestTxtNd->SetAttr(aNumRuleItem);
+ }
+ else
+ {
+ pDestTxtNd->ResetAttr(RES_PARATR_NUMRULE);
+ }
+ if (SFX_ITEM_SET == aListIdState)
+ {
+ pDestTxtNd->SetAttr(aListIdItem);
+ }
+ else
+ {
+ pDestTxtNd->ResetAttr(RES_PARATR_LIST_ID);
+ }
+ }
+ }
+ }
+ }
+
+ if( bCopyAll || aRg.aStart != aRg.aEnd )
+ {
+ SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange );
+ if( pSttTxtNd && bCopyCollFmt && pDestTxtNd->HasSwAttrSet() )
+ {
+ aBrkSet.Put( *pDestTxtNd->GetpSwAttrSet() );
+ if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_BREAK, sal_False ) )
+ pDestTxtNd->ResetAttr( RES_BREAK );
+ if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_PAGEDESC, sal_False ) )
+ pDestTxtNd->ResetAttr( RES_PAGEDESC );
+ }
+
+ if( aInsPos == pEnd->nNode )
+ {
+ SwNodeIndex aSaveIdx( aInsPos, -1 );
+ CopyWithFlyInFly( aRg, 0,aInsPos, bMakeNewFrms, sal_False );
+ aSaveIdx++;
+ pEnd->nNode = aSaveIdx;
+ pEnd->nContent.Assign( aSaveIdx.GetNode().GetTxtNode(), 0 );
+ }
+ else
+ CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, bMakeNewFrms, sal_False );
+
+ bCopyBookmarks = false;
+
+ // harte Umbrueche wieder in den ersten Node setzen
+ if( aBrkSet.Count() && 0 != ( pDestTxtNd = pDoc->GetNodes()[
+ aCpyPam.GetPoint()->nNode.GetIndex()+1 ]->GetTxtNode() ) )
+ {
+ pDestTxtNd->SetAttr( aBrkSet );
+ }
+ }
+ } while( sal_False );
+
+ // Position ummelden ( falls verschoben / im anderen Node )
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(),
+ rPos.nContent.GetIndex() );
+
+ if( rPos.nNode != aInsPos )
+ {
+ aCpyPam.GetMark()->nNode = aInsPos;
+ aCpyPam.GetMark()->nContent.Assign( aCpyPam.GetCntntNode(sal_False), 0 );
+ rPos = *aCpyPam.GetMark();
+ }
+ else
+ *aCpyPam.GetMark() = rPos;
+
+ aCpyPam.Move( fnMoveForward, bCanMoveBack ? fnGoCntnt : fnGoNode );
+ aCpyPam.Exchange();
+
+ // dann kopiere noch alle Bookmarks
+ if( bCopyBookmarks && getIDocumentMarkAccess()->getMarksCount() )
+ lcl_CopyBookmarks( rPam, aCpyPam );
+
+ if( nsRedlineMode_t::REDLINE_DELETE_REDLINES & eOld )
+ lcl_DeleteRedlines( rPam, aCpyPam );
+
+ // falls Undo eingeschaltet ist, so speicher den eingefuegten Bereich
+ if (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo->SetInsertRange( aCpyPam, sal_True, bStartIsTxtNode );
+ }
+
+ if( pCpyRange )
+ {
+ pCpyRange->SetMark();
+ *pCpyRange->GetPoint() = *aCpyPam.GetPoint();
+ *pCpyRange->GetMark() = *aCpyPam.GetMark();
+ }
+
+ if ( pNumRuleToPropagate )
+ {
+ // --> OD 2009-08-25 #i86492#
+ // use <SwDoc::SetNumRule(..)>, because it also handles the <ListId>
+// pDoc->ReplaceNumRule(aCpyPam, *pNumRuleToPropagate);
+ pDoc->SetNumRule( aCpyPam, *pNumRuleToPropagate, false,
+ aListIdToPropagate, sal_True, true );
+ }
+
+ pDoc->SetRedlineMode_intern( eOld );
+ pDoc->SetModified();
+
+ return true;
+}
+
+
+// ----- Copy-Methode vom SwDoc - "kopiere Fly's in Fly's" ------
+
+void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex,
+ const SwNodeIndex& rInsPos, sal_Bool bMakeNewFrms,
+ sal_Bool bDelRedlines, sal_Bool bCopyFlyAtFly ) const
+{
+ SwDoc* pDest = rInsPos.GetNode().GetDoc();
+
+ _SaveRedlEndPosForRestore aRedlRest( rInsPos, 0 );
+
+ SwNodeIndex aSavePos( rInsPos, -1 );
+ sal_Bool bEndIsEqualEndPos = rInsPos == rRg.aEnd;
+ GetNodes()._CopyNodes( rRg, rInsPos, bMakeNewFrms, sal_True );
+ aSavePos++;
+ if( bEndIsEqualEndPos )
+ ((SwNodeIndex&)rRg.aEnd) = aSavePos;
+
+ aRedlRest.Restore();
+
+#ifdef DBG_UTIL
+ {
+ //JP 17.06.99: Bug 66973 - check count only if the selection is in
+ // the same (or no) section. Becaus not full selected
+ // section are not copied.
+ const SwSectionNode* pSSectNd = rRg.aStart.GetNode().FindSectionNode();
+ SwNodeIndex aTmpI( rRg.aEnd, -1 );
+ const SwSectionNode* pESectNd = aTmpI.GetNode().FindSectionNode();
+ if( pSSectNd == pESectNd &&
+ !rRg.aStart.GetNode().IsSectionNode() &&
+ !aTmpI.GetNode().IsEndNode() )
+ {
+ ASSERT( rInsPos.GetIndex() - aSavePos.GetIndex() ==
+ rRg.aEnd.GetIndex() - rRg.aStart.GetIndex(),
+ "Es wurden zu wenig Nodes kopiert!" )
+ }
+ }
+#endif
+
+ {
+ ::sw::UndoGuard const undoGuard(pDest->GetIDocumentUndoRedo());
+ CopyFlyInFlyImpl( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly );
+ }
+
+ SwNodeRange aCpyRange( aSavePos, rInsPos );
+
+ // dann kopiere noch alle Bookmarks
+ if( getIDocumentMarkAccess()->getMarksCount() )
+ {
+ SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
+ SwPaM aCpyTmp( aCpyRange.aStart, aCpyRange.aEnd );
+
+ lcl_CopyBookmarks( aRgTmp, aCpyTmp );
+ }
+
+ if( bDelRedlines && ( nsRedlineMode_t::REDLINE_DELETE_REDLINES & pDest->GetRedlineMode() ))
+ lcl_DeleteRedlines( rRg, aCpyRange );
+
+ pDest->GetNodes()._DelDummyNodes( aCpyRange );
+}
+
+void lcl_ChainFmts( SwFlyFrmFmt *pSrc, SwFlyFrmFmt *pDest )
+{
+ SwFmtChain aSrc( pSrc->GetChain() );
+ if ( !aSrc.GetNext() )
+ {
+ aSrc.SetNext( pDest );
+ pSrc->SetFmtAttr( aSrc );
+ }
+ SwFmtChain aDest( pDest->GetChain() );
+ if ( !aDest.GetPrev() )
+ {
+ aDest.SetPrev( pSrc );
+ pDest->SetFmtAttr( aDest );
+ }
+}
+
+void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg,
+ const xub_StrLen nEndContentIndex, const SwNodeIndex& rStartIdx,
+ const bool bCopyFlyAtFly ) const
+{
+ // Bug 22727: suche erst mal alle Flys zusammen, sortiere sie entsprechend
+ // ihrer Ordnungsnummer und kopiere sie erst dann. Damit wird
+ // die Ordnungsnummer (wird nur im DrawModel verwaltet)
+ // beibehalten.
+ SwDoc *const pDest = rStartIdx.GetNode().GetDoc();
+ _ZSortFlys aArr;
+ sal_uInt16 nArrLen = GetSpzFrmFmts()->Count();
+
+ for ( sal_uInt16 n = 0; n < nArrLen; ++n )
+ {
+ SwFrmFmt const*const pFmt = (*GetSpzFrmFmts())[n];
+ SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor();
+ SwPosition const*const pAPos = pAnchor->GetCntntAnchor();
+ bool bAtCntnt = (pAnchor->GetAnchorId() == FLY_AT_PARA);
+ if ( pAPos &&
+ ( bAtCntnt ||
+ (pAnchor->GetAnchorId() == FLY_AT_FLY) ||
+ (pAnchor->GetAnchorId() == FLY_AT_CHAR)) &&
+ (( bCopyFlyAtFly && FLY_AT_FLY == pAnchor->GetAnchorId() )
+ ? rRg.aStart <= pAPos->nNode.GetIndex() + 1
+ : ( IsRedlineMove()
+ ? rRg.aStart < pAPos->nNode
+ : rRg.aStart <= pAPos->nNode )) &&
+ pAPos->nNode <= rRg.aEnd )
+ {
+ //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 (aTmp.GetNode().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() ));
+ }
+ }
+
+ //Alle kopierten (also die neu erzeugten) Rahmen in ein weiteres Array
+ //stopfen. Dort sizten sie passend zu den Originalen, damit hinterher
+ //die Chains entsprechend aufgebaut werden koennen.
+ SvPtrarr aNewArr( 10, 10 );
+
+ for ( sal_uInt16 n = 0; n < aArr.Count(); ++n )
+ {
+ const _ZSortFly& rZSortFly = aArr[ n ];
+
+ // --> OD 2006-01-04 #i59964#
+ // correct determination of new anchor position
+ SwFmtAnchor aAnchor( *rZSortFly.GetAnchor() );
+ SwPosition* pNewPos = (SwPosition*)aAnchor.GetCntntAnchor();
+ // for at-paragraph and at-character anchored objects the new anchor
+ // position can *not* be determined by the difference of the current
+ // anchor position to the start of the copied range, because not
+ // complete selected sections in the copied range aren't copied - see
+ // method <SwNodes::_CopyNodes(..)>.
+ // Thus, the new anchor position in the destination document is found
+ // by counting the text nodes.
+ if ((aAnchor.GetAnchorId() == FLY_AT_PARA) ||
+ (aAnchor.GetAnchorId() == FLY_AT_CHAR) )
+ {
+ // First, determine number of anchor text node in the copied range.
+ // Note: The anchor text node *have* to be inside the copied range.
+ sal_uLong nAnchorTxtNdNumInRange( 0L );
+ bool bAnchorTxtNdFound( false );
+ SwNodeIndex aIdx( rRg.aStart );
+ while ( !bAnchorTxtNdFound && aIdx <= rRg.aEnd )
+ {
+ if ( aIdx.GetNode().IsTxtNode() )
+ {
+ ++nAnchorTxtNdNumInRange;
+ bAnchorTxtNdFound = aAnchor.GetCntntAnchor()->nNode == aIdx;
+ }
+
+ ++aIdx;
+ }
+ if ( !bAnchorTxtNdFound )
+ {
+ // This case can *not* happen, but to be robust take the first
+ // text node in the destination document.
+ ASSERT( false,
+ "<SwDoc::_CopyFlyInFly(..)> - anchor text node in copied range not found" );
+ nAnchorTxtNdNumInRange = 1;
+ }
+ // Second, search corresponding text node in destination document
+ // by counting forward from start insert position <rStartIdx> the
+ // determined number of text nodes.
+ aIdx = rStartIdx;
+ SwNodeIndex aAnchorNdIdx( rStartIdx );
+ const SwNode& aEndOfContentNd =
+ aIdx.GetNode().GetNodes().GetEndOfContent();
+ while ( nAnchorTxtNdNumInRange > 0 &&
+ &(aIdx.GetNode()) != &aEndOfContentNd )
+ {
+ if ( aIdx.GetNode().IsTxtNode() )
+ {
+ --nAnchorTxtNdNumInRange;
+ aAnchorNdIdx = aIdx;
+ }
+
+ ++aIdx;
+ }
+ if ( !aAnchorNdIdx.GetNode().IsTxtNode() )
+ {
+ // This case can *not* happen, but to be robust take the first
+ // text node in the destination document.
+ ASSERT( false,
+ "<SwDoc::_CopyFlyInFly(..)> - found anchor node index isn't a text node" );
+ aAnchorNdIdx = rStartIdx;
+ while ( !aAnchorNdIdx.GetNode().IsTxtNode() )
+ {
+ ++aAnchorNdIdx;
+ }
+ }
+ // apply found anchor text node as new anchor position
+ pNewPos->nNode = aAnchorNdIdx;
+ }
+ else
+ {
+ long nOffset = pNewPos->nNode.GetIndex() - rRg.aStart.GetIndex();
+ SwNodeIndex aIdx( rStartIdx, nOffset );
+ pNewPos->nNode = aIdx;
+ }
+ // <--
+ // die am Zeichen Flys wieder ans das vorgegebene Zeichen setzen
+ if ((FLY_AT_CHAR == aAnchor.GetAnchorId()) &&
+ pNewPos->nNode.GetNode().IsTxtNode() )
+ {
+ pNewPos->nContent.Assign( (SwTxtNode*)&pNewPos->nNode.GetNode(),
+ pNewPos->nContent.GetIndex() );
+ }
+ else
+ {
+ pNewPos->nContent.Assign( 0, 0 );
+ }
+
+ // ueberpruefe Rekursion: Inhalt in "seinen eigenen" Frame
+ // kopieren. Dann nicht kopieren
+ sal_Bool bMakeCpy = sal_True;
+ if( pDest == this )
+ {
+ const SwFmtCntnt& rCntnt = rZSortFly.GetFmt()->GetCntnt();
+ const SwStartNode* pSNd;
+ if( rCntnt.GetCntntIdx() &&
+ 0 != ( pSNd = rCntnt.GetCntntIdx()->GetNode().GetStartNode() ) &&
+ pSNd->GetIndex() < rStartIdx.GetIndex() &&
+ rStartIdx.GetIndex() < pSNd->EndOfSectionIndex() )
+ {
+ bMakeCpy = sal_False;
+ aArr.Remove( n, 1 );
+ --n;
+ }
+ }
+
+ // Format kopieren und den neuen Anker setzen
+ if( bMakeCpy )
+ aNewArr.Insert( pDest->CopyLayoutFmt( *rZSortFly.GetFmt(),
+ aAnchor, false, true ), aNewArr.Count() );
+ }
+
+ //Alle chains, die im Original vorhanden sind, soweit wie moeglich wieder
+ //aufbauen.
+ ASSERT( aArr.Count() == aNewArr.Count(), "Missing new Flys" );
+ if ( aArr.Count() == aNewArr.Count() )
+ {
+ for ( sal_uInt16 n = 0; n < aArr.Count(); ++n )
+ {
+ const SwFrmFmt *pFmt = aArr[n].GetFmt();
+ const SwFmtChain &rChain = pFmt->GetChain();
+ int nCnt = 0 != rChain.GetPrev();
+ nCnt += rChain.GetNext() ? 1: 0;
+ for ( sal_uInt16 k = 0; nCnt && k < aArr.Count(); ++k )
+ {
+ const _ZSortFly &rTmp = aArr[k];
+ const SwFrmFmt *pTmp = rTmp.GetFmt();
+ if ( rChain.GetPrev() == pTmp )
+ {
+ ::lcl_ChainFmts( (SwFlyFrmFmt*)aNewArr[k],
+ (SwFlyFrmFmt*)aNewArr[n] );
+ --nCnt;
+ }
+ else if ( rChain.GetNext() == pTmp )
+ {
+ ::lcl_ChainFmts( (SwFlyFrmFmt*)aNewArr[n],
+ (SwFlyFrmFmt*)aNewArr[k] );
+ --nCnt;
+ }
+ }
+ }
+ }
+}
+
+
+
+
diff --git a/sw/source/core/docnode/ndindex.cxx b/sw/source/core/docnode/ndindex.cxx
new file mode 100644
index 000000000000..a6b718df2d09
--- /dev/null
+++ b/sw/source/core/docnode/ndindex.cxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "errhdl.hxx" // fuers ASSERT
+#include "error.h" // fuers ASSERT
+#include "ndindex.hxx"
+
+#ifdef DBG_UTIL
+int SwNodeIndex::nSerial = 0;
+#endif
+
+
+SwNodeRange::SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE )
+ : aStart( rS ), aEnd( rE )
+{}
+
+SwNodeRange::SwNodeRange( const SwNodeRange &rRange )
+ : aStart( rRange.aStart ), aEnd( rRange.aEnd )
+{}
+
+SwNodeRange::SwNodeRange( SwNodes& rNds, sal_uLong nSttIdx, sal_uLong nEndIdx )
+ : aStart( rNds, nSttIdx ), aEnd( rNds, nEndIdx )
+{}
+
+
+SwNodeRange::SwNodeRange( const SwNodeIndex& rS, long nSttDiff,
+ const SwNodeIndex& rE, long nEndDiff )
+ : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
+{}
+
+SwNodeRange::SwNodeRange( const SwNode& rS, long nSttDiff,
+ const SwNode& rE, long nEndDiff )
+ : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
+{}
+
+
+SwNodeIndex::SwNodeIndex( SwNodes& rNds, sal_uLong nIdx )
+ : pNd( rNds[ nIdx ] ), pNext( 0 ), pPrev( 0 )
+{
+ rNds.RegisterIndex( *this );
+
+#ifdef DBG_UTIL
+ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+#endif
+}
+
+
+SwNodeIndex::SwNodeIndex( const SwNodeIndex& rIdx, long nDiff )
+ : pNext( 0 ), pPrev( 0 )
+{
+ if( nDiff )
+ pNd = rIdx.GetNodes()[ rIdx.GetIndex() + nDiff ];
+ else
+ pNd = rIdx.pNd;
+
+ pNd->GetNodes().RegisterIndex( *this );
+#ifdef DBG_UTIL
+ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+#endif
+}
+
+
+SwNodeIndex::SwNodeIndex( const SwNode& rNd, long nDiff )
+ : pNext( 0 ), pPrev( 0 )
+{
+ if( nDiff )
+ pNd = rNd.GetNodes()[ rNd.GetIndex() + nDiff ];
+ else
+ pNd = (SwNode*)&rNd;
+
+ pNd->GetNodes().RegisterIndex( *this );
+#ifdef DBG_UTIL
+ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+#endif
+}
+
+
+void SwNodeIndex::Remove()
+{
+ pNd->GetNodes().DeRegisterIndex( *this );
+}
+
+SwNodeIndex& SwNodeIndex::operator=( const SwNodeIndex& rIdx )
+{
+ if( &pNd->GetNodes() != &rIdx.pNd->GetNodes() )
+ {
+ pNd->GetNodes().DeRegisterIndex( *this );
+ pNd = rIdx.pNd;
+ pNd->GetNodes().RegisterIndex( *this );
+ }
+ else
+ pNd = rIdx.pNd;
+ return *this;
+}
+
+SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd )
+{
+ if( &pNd->GetNodes() != &rNd.GetNodes() )
+ {
+ pNd->GetNodes().DeRegisterIndex( *this );
+ pNd = (SwNode*)&rNd;
+ pNd->GetNodes().RegisterIndex( *this );
+ }
+ else
+ pNd = (SwNode*)&rNd;
+ return *this;
+}
+
+SwNodeIndex& SwNodeIndex::Assign( SwNodes& rNds, sal_uLong nIdx )
+{
+ if( &pNd->GetNodes() != &rNds )
+ {
+ pNd->GetNodes().DeRegisterIndex( *this );
+ pNd = rNds[ nIdx ];
+ pNd->GetNodes().RegisterIndex( *this );
+ }
+ else
+ pNd = rNds[ nIdx ];
+ return *this;
+}
+
+SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
+{
+ if( &pNd->GetNodes() != &rNd.GetNodes() )
+ {
+ pNd->GetNodes().DeRegisterIndex( *this );
+ pNd = (SwNode*)&rNd;
+ pNd->GetNodes().RegisterIndex( *this );
+ }
+ else
+ pNd = (SwNode*)&rNd;
+
+ if( nOffset )
+ pNd = pNd->GetNodes()[ pNd->GetIndex() + nOffset ];
+
+ return *this;
+}
+
+
diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx
new file mode 100644
index 000000000000..6ad9605a18f2
--- /dev/null
+++ b/sw/source/core/docnode/ndnotxt.cxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <tools/poly.hxx>
+#include <svl/stritem.hxx>
+#include <svx/contdlg.hxx>
+#include <vcl/svapp.hxx>
+#include <docary.hxx>
+#include <doc.hxx>
+#include <fmtcol.hxx>
+#include <ndnotxt.hxx>
+#include <ndgrf.hxx>
+#include <ndole.hxx>
+#include <ndindex.hxx>
+#include <hints.hxx> // fuer SwFmtChg
+#include <istyleaccess.hxx>
+#include <SwStyleNameMapper.hxx>
+
+// --> OD 2009-07-13 #i73249#
+#include <frmfmt.hxx>
+// <--
+
+SwNoTxtNode::SwNoTxtNode( const SwNodeIndex & rWhere,
+ const sal_uInt8 nNdType,
+ SwGrfFmtColl *pGrfColl,
+ SwAttrSet* pAutoAttr ) :
+ SwCntntNode( rWhere, nNdType, pGrfColl ),
+ pContour( 0 ),
+ bAutomaticContour( sal_False ),
+ bContourMapModeValid( sal_True ),
+ bPixelContour( sal_False )
+{
+ // soll eine Harte-Attributierung gesetzt werden?
+ if( pAutoAttr )
+ SetAttr( *pAutoAttr );
+}
+
+
+SwNoTxtNode::~SwNoTxtNode()
+{
+ delete pContour;
+}
+
+
+// erzeugt fuer alle Ableitungen einen AttrSet mit Bereichen
+// fuer Frame- und Grafik-Attributen
+void SwNoTxtNode::NewAttrSet( SwAttrPool& rPool )
+{
+ ASSERT( !mpAttrSet.get(), "AttrSet ist doch gesetzt" );
+ SwAttrSet aNewAttrSet( rPool, aNoTxtNodeSetRange );
+
+ // put names of parent style and conditional style:
+ const SwFmtColl* pFmtColl = GetFmtColl();
+ String sVal;
+ SwStyleNameMapper::FillProgName( pFmtColl->GetName(), sVal, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
+ SfxStringItem aFmtColl( RES_FRMATR_STYLE_NAME, sVal );
+ aNewAttrSet.Put( aFmtColl );
+
+ aNewAttrSet.SetParent( &GetFmtColl()->GetAttrSet() );
+ mpAttrSet = GetDoc()->GetIStyleAccess().getAutomaticStyle( aNewAttrSet, IStyleAccess::AUTO_STYLE_NOTXT );
+}
+
+// Dummies fuer das Laden/Speichern von persistenten Daten
+// bei Grafiken und OLE-Objekten
+
+
+sal_Bool SwNoTxtNode::RestorePersistentData()
+{
+ return sal_True;
+}
+
+
+sal_Bool SwNoTxtNode::SavePersistentData()
+{
+ return sal_True;
+}
+
+
+void SwNoTxtNode::SetContour( const PolyPolygon *pPoly, sal_Bool bAutomatic )
+{
+ delete pContour;
+ if ( pPoly )
+ pContour = new PolyPolygon( *pPoly );
+ else
+ pContour = 0;
+ bAutomaticContour = bAutomatic;
+ bContourMapModeValid = sal_True;
+ bPixelContour = sal_False;
+}
+
+
+void SwNoTxtNode::CreateContour()
+{
+ ASSERT( !pContour, "Contour available." );
+ pContour = new PolyPolygon(SvxContourDlg::CreateAutoContour(GetGraphic()));
+ bAutomaticContour = sal_True;
+ bContourMapModeValid = sal_True;
+ bPixelContour = sal_False;
+}
+
+const PolyPolygon *SwNoTxtNode::HasContour() const
+{
+ if( !bContourMapModeValid )
+ {
+ const MapMode aGrfMap( GetGraphic().GetPrefMapMode() );
+ sal_Bool bPixelGrf = aGrfMap.GetMapUnit() == MAP_PIXEL;
+ const MapMode aContourMap( bPixelGrf ? MAP_PIXEL : MAP_100TH_MM );
+ if( bPixelGrf ? !bPixelContour : aGrfMap != aContourMap )
+ {
+ ASSERT( !bPixelGrf || aGrfMap == aContourMap,
+ "scale factor for pixel unsupported" );
+ OutputDevice* pOutDev =
+ (bPixelGrf || bPixelContour) ? Application::GetDefaultDevice()
+ : 0;
+ sal_uInt16 nPolyCount = pContour->Count();
+ for( sal_uInt16 j=0; j<nPolyCount; j++ )
+ {
+ Polygon& rPoly = (*pContour)[j];
+
+ sal_uInt16 nCount = rPoly.GetSize();
+ for( sal_uInt16 i=0 ; i<nCount; i++ )
+ {
+ if( bPixelGrf )
+ rPoly[i] = pOutDev->LogicToPixel( rPoly[i],
+ aContourMap );
+ else if( bPixelContour )
+ rPoly[i] = pOutDev->PixelToLogic( rPoly[i], aGrfMap );
+ else
+ rPoly[i] = OutputDevice::LogicToLogic( rPoly[i],
+ aContourMap,
+ aGrfMap );
+ }
+ }
+ }
+ ((SwNoTxtNode *)this)->bContourMapModeValid = sal_True;
+ ((SwNoTxtNode *)this)->bPixelContour = sal_False;
+ }
+
+ return pContour;
+}
+
+void SwNoTxtNode::GetContour( PolyPolygon &rPoly ) const
+{
+ ASSERT( pContour, "Contour not available." );
+ rPoly = *HasContour();
+}
+
+void SwNoTxtNode::SetContourAPI( const PolyPolygon *pPoly )
+{
+ delete pContour;
+ if ( pPoly )
+ pContour = new PolyPolygon( *pPoly );
+ else
+ pContour = 0;
+ bContourMapModeValid = sal_False;
+}
+
+sal_Bool SwNoTxtNode::GetContourAPI( PolyPolygon &rContour ) const
+{
+ if( !pContour )
+ return sal_False;
+
+ rContour = *pContour;
+ if( bContourMapModeValid )
+ {
+ const MapMode aGrfMap( GetGraphic().GetPrefMapMode() );
+ const MapMode aContourMap( MAP_100TH_MM );
+ ASSERT( aGrfMap.GetMapUnit() != MAP_PIXEL ||
+ aGrfMap == MapMode( MAP_PIXEL ),
+ "scale factor for pixel unsupported" );
+ if( aGrfMap.GetMapUnit() != MAP_PIXEL &&
+ aGrfMap != aContourMap )
+ {
+ sal_uInt16 nPolyCount = rContour.Count();
+ for( sal_uInt16 j=0; j<nPolyCount; j++ )
+ {
+ Polygon& rPoly = (*pContour)[j];
+
+ sal_uInt16 nCount = rPoly.GetSize();
+ for( sal_uInt16 i=0 ; i<nCount; i++ )
+ {
+ rPoly[i] = OutputDevice::LogicToLogic( rPoly[i], aGrfMap,
+ aContourMap );
+ }
+ }
+ }
+ }
+
+ return sal_True;
+}
+
+sal_Bool SwNoTxtNode::IsPixelContour() const
+{
+ sal_Bool bRet;
+ if( bContourMapModeValid )
+ {
+ const MapMode aGrfMap( GetGraphic().GetPrefMapMode() );
+ bRet = aGrfMap.GetMapUnit() == MAP_PIXEL;
+ }
+ else
+ {
+ bRet = bPixelContour;
+ }
+
+ return bRet;
+}
+
+
+Graphic SwNoTxtNode::GetGraphic() const
+{
+ Graphic aRet;
+ if ( GetGrfNode() )
+ {
+ ((SwGrfNode*)this)->SwapIn( sal_True );
+ aRet = ((SwGrfNode*)this)->GetGrf();
+ }
+ else
+ {
+ ASSERT( GetOLENode(), "new type of Node?" );
+ aRet = *((SwOLENode*)this)->SwOLENode::GetGraphic();
+ }
+ 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;
+ }
+
+ pFlyFmt->SetObjTitle( rTitle, bBroadcast );
+}
+
+const String SwNoTxtNode::GetTitle() const
+{
+ const SwFlyFrmFmt* pFlyFmt = dynamic_cast<const SwFlyFrmFmt*>(GetFlyFmt());
+ ASSERT( pFlyFmt,
+ "<SwNoTxtNode::GetTitle(..)> - missing <SwFlyFrmFmt> instance" );
+ if ( !pFlyFmt )
+ {
+ return aEmptyStr;
+ }
+
+ 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 )
+ {
+ 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/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx
new file mode 100644
index 000000000000..6e00748b618e
--- /dev/null
+++ b/sw/source/core/docnode/ndnum.cxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <node.hxx>
+#include <doc.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <fldbas.hxx> // UpdateFlds der KapitelNummerierung
+#include <docary.hxx>
+
+_SV_IMPL_SORTAR_ALG( SwOutlineNodes, SwNodePtr )
+sal_Bool SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, sal_uInt16* pFndPos ) const
+{
+ sal_uLong nIdx = rSrch->GetIndex();
+
+ sal_uInt16 nO = Count(), nM, nU = 0;
+ if( nO > 0 )
+ {
+//JP 17.03.98: aufgrund des Bug 48592 - wo unter anderem nach Undo/Redo
+// Nodes aus dem falschen NodesArray im OutlineArray standen,
+// jetzt mal einen Check eingebaut.
+#ifdef DBG_UTIL
+ {
+ for( sal_uInt16 n = 1; n < nO; ++n )
+ if( &(*this)[ n-1 ]->GetNodes() !=
+ &(*this)[ n ]->GetNodes() )
+ {
+ ASSERT( !this, "Node im falschen Outline-Array" );
+ }
+ }
+#endif
+
+ nO--;
+ while( nU <= nO )
+ {
+ nM = nU + ( nO - nU ) / 2;
+ if( (*this)[ nM ] == rSrch )
+ {
+ if( pFndPos )
+ *pFndPos = nM;
+ return sal_True;
+ }
+ else if( (*this)[ nM ]->GetIndex() < nIdx )
+ nU = nM + 1;
+ else if( nM == 0 )
+ {
+ if( pFndPos )
+ *pFndPos = nU;
+ return sal_False;
+ }
+ else
+ nO = nM - 1;
+ }
+ }
+ if( pFndPos )
+ *pFndPos = nU;
+ return sal_False;
+}
+
+void SwNodes::UpdateOutlineNode(SwNode & rNd)
+{
+ SwTxtNode * pTxtNd = rNd.GetTxtNode();
+
+ if (pTxtNd && pTxtNd->IsOutlineStateChanged())
+ {
+ sal_Bool bFound = pOutlineNds->Seek_Entry(pTxtNd);
+
+ if (pTxtNd->IsOutline())
+ {
+ if (! bFound)
+ {
+ // --> OD 2005-11-02 #125329#
+ // assure that text is in the correct nodes array
+ if ( &(pTxtNd->GetNodes()) == this )
+ {
+ pOutlineNds->Insert(pTxtNd);
+ }
+ else
+ {
+ ASSERT( false,
+ "<SwNodes::UpdateOutlineNode(..)> - given text node isn't in the correct nodes array. This is a serious defect -> inform OD" );
+ }
+ // <--
+ }
+ }
+ else
+ {
+ if (bFound)
+ pOutlineNds->Remove(pTxtNd);
+ }
+
+ pTxtNd->UpdateOutlineState();
+
+ // die Gliederungs-Felder Updaten
+ GetDoc()->GetSysFldType( RES_CHAPTERFLD )->UpdateFlds();
+ }
+}
+
+//void SwNodes::UpdateOutlineNode( const SwNode& rNd, sal_uInt8 nOldLevel, //#outline level,removed by zhaojianwei
+// sal_uInt8 nNewLevel )
+//{
+// const SwNodePtr pSrch = (SwNodePtr)&rNd;
+// sal_uInt16 nSttPos;
+// sal_Bool bSeekIdx = pOutlineNds->Seek_Entry( pSrch, &nSttPos );
+//
+// //if( NO_NUMBERING == nOldLevel ) //#outline level,zhaojianwei
+// if( 0 == nOldLevel ) //<-end, zhaojianwei
+// {
+// // nicht vorhanden, also einfuegen
+// //ASSERT( !bSeekIdx, "Der Node ist schon als OutlineNode vorhanden" );
+//
+// //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen
+// sal_uLong nNd = rNd.GetIndex();
+// if( nNd < GetEndOfRedlines().GetIndex() &&
+// nNd > GetEndOfRedlines().StartOfSectionNode()->GetIndex() )
+// return ;
+//
+// // jetzt noch alle nachfolgende Outline-Nodes updaten
+// if (! bSeekIdx)
+// {
+// // --> OD 2005-11-03 #125329#
+// // assure that node <pSrch> is in the correct nodes array
+// if ( &(pSrch->GetNodes()) == this )
+// {
+// pOutlineNds->Insert( pSrch );
+// }
+// else
+// {
+// ASSERT( false,
+// "<SwNodes::UpdateOutlineNode(..)> - node <pSrch> isn't in correct nodes array. This is a serious defect -> inform OD" );
+// }
+// // <--
+// }
+//
+// }
+// //else if( NO_NUMBERING == nNewLevel ) //#outline level,removed by zhaojianwei
+// else if( 0 == nNewLevel ) //<-end,added by zhaojianwei // Level entfernen
+// {
+// if( !bSeekIdx )
+// return;
+//
+// // jetzt noch alle nachfolgende Outline-Nodes updaten
+// pOutlineNds->Remove( nSttPos );
+// }
+// else if( !bSeekIdx ) // Update und Index nicht gefunden ??
+// return ;
+//
+// {
+// SwTxtNode & rTxtNd = (SwTxtNode &) rNd;
+// SwPaM aPam(rTxtNd); // #115901#
+//
+// //if (nNewLevel != NO_NUMBERING) //#outline level,zhaojianwei // #115901#
+// if (nNewLevel != 0) //<-end,zhaojianwei // #115901#
+// {
+// //rTxtNd.SetLevel(rTxtNd.GetTxtColl()->GetOutlineLevel()); //#outline level,zhaojianwei
+// //rTxtNd.NumRuleChgd();
+// if(rTxtNd.GetTxtColl()->IsAssignedToListLevelOfOutlineStyle())
+// {
+// rTxtNd.SetLevel(rTxtNd.GetTxtColl()->GetAssignedOutlineStyleLevel());
+// rTxtNd.NumRuleChgd();
+// }//<-end,zhaojianwei
+//
+// //GetDoc()->SetNumRule(aPam, *GetDoc()->GetOutlineNumRule());
+// }
+// else
+// {
+// GetDoc()->DelNumRules(aPam);
+// }
+// }
+//
+// // die Gliederungs-Felder Updaten
+// GetDoc()->GetSysFldType( RES_CHAPTERFLD )->UpdateFlds();
+// GetDoc()->ChkCondColls();
+//}//<-end,zhaojianwei
+
+void SwNodes::UpdtOutlineIdx( const SwNode& rNd )
+{
+ if( !pOutlineNds->Count() ) // keine OutlineNodes vorhanden ?
+ return;
+
+ const SwNodePtr pSrch = (SwNodePtr)&rNd;
+ sal_uInt16 nPos;
+ pOutlineNds->Seek_Entry( pSrch, &nPos );
+ if( nPos == pOutlineNds->Count() ) // keine zum Updaten vorhanden ?
+ return;
+
+ if( nPos )
+ --nPos;
+
+ if( !GetDoc()->IsInDtor() && IsDocNodes() )
+ UpdateOutlineNode( *(*pOutlineNds)[ nPos ]);
+}
+
+const SwOutlineNodes & SwNodes::GetOutLineNds() const
+{
+ return *pOutlineNds;
+}
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
new file mode 100644
index 000000000000..278f0d15c8d1
--- /dev/null
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -0,0 +1,1483 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svl/smplhint.hxx>
+#include <hintids.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <svl/itemiter.hxx>
+#include <tools/resid.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtanchr.hxx>
+#include <txtftn.hxx>
+#include <fmtclds.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <rootfrm.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <section.hxx>
+#include <UndoSection.hxx>
+#include <UndoDelete.hxx>
+#include <swundo.hxx>
+#include <calc.hxx>
+#include <swtable.hxx>
+#include <swserv.hxx>
+#include <frmfmt.hxx>
+#include <frmtool.hxx>
+#include <ftnidx.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+#include <sectfrm.hxx>
+#include <pagefrm.hxx>
+#include <cntfrm.hxx>
+#include <node2lay.hxx>
+#include <doctxm.hxx>
+#include <fmtftntx.hxx>
+#include <comcore.hrc>
+// --> OD 2005-12-01 #i27138#
+#include <viewsh.hxx>
+#include <txtfrm.hxx>
+// <--
+
+
+// OD 04.11.2003 #i21457# - new implementation of local method <lcl_IsInSameTblBox(..)>.
+// Method now determines the previous/next on its own. Thus, it can be controlled,
+// for which previous/next is checked, if it's visible.
+bool lcl_IsInSameTblBox( SwNodes& _rNds,
+ const SwNode& _rNd,
+ const bool _bPrev )
+{
+ const SwTableNode* pTblNd = _rNd.FindTableNode();
+ if ( !pTblNd )
+ {
+ return true;
+ }
+
+ // determine index to be checked. Its assumed that a previous/next exist.
+ SwNodeIndex aChkIdx( _rNd );
+ {
+ // determine index of previous/next - skip hidden ones, which are
+ // inside the table.
+ // If found one is before/after table, this one isn't in the same
+ // table box as <_rNd>.
+ bool bFound = false;
+ do
+ {
+ if ( _bPrev
+ ? !_rNds.GoPrevSection( &aChkIdx, sal_False, sal_False )
+ : !_rNds.GoNextSection( &aChkIdx, sal_False, sal_False ) )
+ {
+ ASSERT( false, "<lcl_IsInSameTblBox(..)> - no previous/next!" );
+ return false;
+ }
+ else
+ {
+ if ( aChkIdx < pTblNd->GetIndex() ||
+ aChkIdx > pTblNd->EndOfSectionNode()->GetIndex() )
+ {
+ return false;
+ }
+ else
+ {
+ // check, if found one isn't inside a hidden section, which
+ // is also inside the table.
+ SwSectionNode* pSectNd = aChkIdx.GetNode().FindSectionNode();
+ if ( !pSectNd ||
+ pSectNd->GetIndex() < pTblNd->GetIndex() ||
+ !pSectNd->GetSection().IsHiddenFlag() )
+ {
+ bFound = true;
+ }
+ }
+ }
+ } while ( !bFound );
+ }
+
+ // dann suche den StartNode der Box
+ const SwTableSortBoxes& rSortBoxes = pTblNd->GetTable().GetTabSortBoxes();
+ sal_uLong nIdx = _rNd.GetIndex();
+ for( sal_uInt16 n = 0; n < rSortBoxes.Count(); ++n )
+ {
+ const SwStartNode* pNd = rSortBoxes[ n ]->GetSttNd();
+ if ( pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex() )
+ {
+ // dann muss der andere Index in derselben Section liegen
+ nIdx = aChkIdx.GetIndex();
+ return pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex();
+ }
+ }
+
+ return true;
+}
+
+void lcl_CheckEmptyLayFrm( SwNodes& rNds, SwSectionData& rSectionData,
+ const SwNode& rStt, const SwNode& rEnd )
+{
+ SwNodeIndex aIdx( rStt );
+ if( !rNds.GoPrevSection( &aIdx, sal_True, sal_False ) ||
+ !CheckNodesRange( rStt, aIdx, sal_True ) ||
+ // OD 04.11.2003 #i21457#
+ !lcl_IsInSameTblBox( rNds, rStt, true ))
+ {
+ aIdx = rEnd;
+ if( !rNds.GoNextSection( &aIdx, sal_True, sal_False ) ||
+ !CheckNodesRange( rEnd, aIdx, sal_True ) ||
+ // OD 04.11.2003 #i21457#
+ !lcl_IsInSameTblBox( rNds, rEnd, false ))
+ {
+ rSectionData.SetHidden( false );
+ }
+ }
+}
+
+SwSection *
+SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
+ SwTOXBase const*const pTOXBase,
+ SfxItemSet const*const pAttr, bool const bUpdate)
+{
+ const SwNode* pPrvNd = 0;
+ sal_uInt16 nRegionRet = 0;
+ if( rRange.HasMark() &&
+ 0 == ( nRegionRet = IsInsRegionAvailable( rRange, &pPrvNd ) ))
+ {
+ ASSERT( !this, "Selection ueber verschiedene Sections" );
+ return 0;
+ }
+
+ // Teste ob das gesamte Dokument versteckt werden soll,
+ // koennen wir zur Zeit nicht !!!!
+ if (rNewData.IsHidden() && rRange.HasMark())
+ {
+ const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
+ if( !pStt->nContent.GetIndex() &&
+ pEnd->nNode.GetNode().GetCntntNode()->Len() ==
+ pEnd->nContent.GetIndex() )
+ {
+ ::lcl_CheckEmptyLayFrm( GetNodes(),
+ rNewData,
+ pStt->nNode.GetNode(),
+ pEnd->nNode.GetNode() );
+ }
+ }
+
+ SwUndoInsSection* pUndoInsSect = 0;
+ bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
+ if (bUndo)
+ {
+ pUndoInsSect = new SwUndoInsSection(rRange, rNewData, pAttr, pTOXBase);
+ GetIDocumentUndoRedo().AppendUndo( pUndoInsSect );
+ GetIDocumentUndoRedo().DoUndo(false);
+ }
+
+ SwSectionFmt* const pFmt = MakeSectionFmt( 0 );
+ if ( pAttr )
+ {
+ pFmt->SetFmtAttr( *pAttr );
+ }
+
+ SwSectionNode* pNewSectNode = 0;
+
+ RedlineMode_t eOld = GetRedlineMode();
+ SetRedlineMode_intern( (RedlineMode_t)((eOld & ~nsRedlineMode_t::REDLINE_SHOW_MASK) | nsRedlineMode_t::REDLINE_IGNORE));
+
+ if( rRange.HasMark() )
+ {
+ SwPosition *pSttPos = (SwPosition*)rRange.Start(),
+ *pEndPos = (SwPosition*)rRange.End();
+ if( pPrvNd && 3 == nRegionRet )
+ {
+ ASSERT( pPrvNd, "der SectionNode fehlt" );
+ SwNodeIndex aStt( pSttPos->nNode ), aEnd( pEndPos->nNode, +1 );
+ while( pPrvNd != aStt.GetNode().StartOfSectionNode() )
+ aStt--;
+ while( pPrvNd != aEnd.GetNode().StartOfSectionNode() )
+ aEnd++;
+
+ --aEnd; // im InsertSection ist Ende inclusive
+ pNewSectNode = GetNodes().InsertTextSection(
+ aStt, *pFmt, rNewData, pTOXBase, & aEnd);
+ }
+ else
+ {
+ if( pUndoInsSect )
+ {
+ if( !( pPrvNd && 1 == nRegionRet ) &&
+ pSttPos->nContent.GetIndex() )
+ {
+ SwTxtNode* const pTNd =
+ pSttPos->nNode.GetNode().GetTxtNode();
+ if (pTNd)
+ {
+ pUndoInsSect->SaveSplitNode( pTNd, sal_True );
+ }
+ }
+
+ if ( !( pPrvNd && 2 == nRegionRet ) )
+ {
+ SwTxtNode *const pTNd =
+ pEndPos->nNode.GetNode().GetTxtNode();
+ if (pTNd &&
+ (pTNd->GetTxt().Len() != pEndPos->nContent.GetIndex()))
+ {
+ pUndoInsSect->SaveSplitNode( pTNd, sal_False );
+ }
+ }
+ }
+
+ const SwCntntNode* pCNd;
+ if( pPrvNd && 1 == nRegionRet )
+ {
+ pSttPos->nNode.Assign( *pPrvNd );
+ pSttPos->nContent.Assign( pSttPos->nNode.GetNode().GetCntntNode(), 0 );
+ }
+ else if( pSttPos->nContent.GetIndex() )
+ {
+ SplitNode( *pSttPos, false );
+ }
+
+ if( pPrvNd && 2 == nRegionRet )
+ {
+ pEndPos->nNode.Assign( *pPrvNd );
+ pEndPos->nContent.Assign( pEndPos->nNode.GetNode().GetCntntNode(), 0 );
+ }
+ else
+ {
+ pCNd = pEndPos->nNode.GetNode().GetCntntNode();
+ if( pCNd && pCNd->Len() != pEndPos->nContent.GetIndex() )
+ {
+ xub_StrLen nCntnt = pSttPos->nContent.GetIndex();
+ SplitNode( *pEndPos, false );
+
+ SwTxtNode* pTNd;
+ if( pEndPos->nNode.GetIndex() == pSttPos->nNode.GetIndex() )
+ {
+ pSttPos->nNode--;
+ pEndPos->nNode--;
+ pTNd = pSttPos->nNode.GetNode().GetTxtNode();
+ pSttPos->nContent.Assign( pTNd, nCntnt );
+ }
+ else
+ {
+ // wieder ans Ende vom vorherigen setzen
+ pEndPos->nNode--;
+ pTNd = pEndPos->nNode.GetNode().GetTxtNode();
+ }
+ if( pTNd ) nCntnt = pTNd->GetTxt().Len(); else nCntnt = 0;
+ pEndPos->nContent.Assign( pTNd, nCntnt );
+ }
+ }
+ pNewSectNode = GetNodes().InsertTextSection(
+ pSttPos->nNode, *pFmt, rNewData, pTOXBase, &pEndPos->nNode);
+ }
+ }
+ else
+ {
+ const SwPosition* pPos = rRange.GetPoint();
+ const SwCntntNode* pCNd = pPos->nNode.GetNode().GetCntntNode();
+ if( !pPos->nContent.GetIndex() )
+ {
+ pNewSectNode = GetNodes().InsertTextSection(
+ pPos->nNode, *pFmt, rNewData, pTOXBase, 0, true);
+ }
+ else if( pPos->nContent.GetIndex() == pCNd->Len() )
+ {
+ pNewSectNode = GetNodes().InsertTextSection(
+ pPos->nNode, *pFmt, rNewData, pTOXBase, 0, false);
+ }
+ else
+ {
+ if( pUndoInsSect && pCNd->IsTxtNode() )
+ {
+ pUndoInsSect->SaveSplitNode( (SwTxtNode*)pCNd, sal_True );
+ }
+ SplitNode( *pPos, false );
+ pNewSectNode = GetNodes().InsertTextSection(
+ pPos->nNode, *pFmt, rNewData, pTOXBase, 0, true);
+ }
+ }
+
+//FEATURE::CONDCOLL
+ pNewSectNode->CheckSectionCondColl();
+//FEATURE::CONDCOLL
+
+ SetRedlineMode_intern( eOld );
+
+ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ {
+ SwPaM aPam( *pNewSectNode->EndOfSectionNode(), *pNewSectNode, 1 );
+ if( IsRedlineOn() )
+ {
+ AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ }
+ else
+ {
+ SplitRedline( aPam );
+ }
+ }
+
+ // ist eine Condition gesetzt
+ if (rNewData.IsHidden() && rNewData.GetCondition().Len())
+ {
+ // dann berechne bis zu dieser Position
+ SwCalc aCalc( *this );
+ if( ! IsInReading() )
+ {
+ FldsToCalc( aCalc, pNewSectNode->GetIndex(), USHRT_MAX );
+ }
+ SwSection& rNewSect = pNewSectNode->GetSection();
+ rNewSect.SetCondHidden( aCalc.Calculate( rNewSect.GetCondition() ).GetBool() );
+ }
+
+ sal_Bool bUpdateFtn = sal_False;
+ if( GetFtnIdxs().Count() && pAttr )
+ {
+ sal_uInt16 nVal = ((SwFmtFtnAtTxtEnd&)pAttr->Get(
+ RES_FTN_AT_TXTEND )).GetValue();
+ if( ( FTNEND_ATTXTEND_OWNNUMSEQ == nVal ||
+ FTNEND_ATTXTEND_OWNNUMANDFMT == nVal ) ||
+ ( FTNEND_ATTXTEND_OWNNUMSEQ == ( nVal = ((SwFmtEndAtTxtEnd&)
+ pAttr->Get( RES_END_AT_TXTEND )).GetValue() ) ||
+ FTNEND_ATTXTEND_OWNNUMANDFMT == nVal ))
+ {
+ bUpdateFtn = sal_True;
+ }
+ }
+
+ if( pUndoInsSect )
+ {
+ pUndoInsSect->SetSectNdPos( pNewSectNode->GetIndex() );
+ pUndoInsSect->SetUpdtFtnFlag( bUpdateFtn );
+ GetIDocumentUndoRedo().DoUndo(bUndo);
+ }
+
+ if (rNewData.IsLinkType())
+ {
+ pNewSectNode->GetSection().CreateLink( bUpdate ? CREATE_UPDATE : CREATE_CONNECT );
+ }
+
+ if( bUpdateFtn )
+ {
+ GetFtnIdxs().UpdateFtn( SwNodeIndex( *pNewSectNode ));
+ }
+
+ SetModified();
+ return &pNewSectNode->GetSection();
+}
+
+sal_uInt16 SwDoc::IsInsRegionAvailable( const SwPaM& rRange,
+ const SwNode** ppSttNd ) const
+{
+ sal_uInt16 nRet = 1;
+ if( rRange.HasMark() )
+ {
+ // teste ob es sich um eine gueltige Selektion handelt
+ const SwPosition* pStt = rRange.Start(),
+ * pEnd = rRange.End();
+
+ const SwCntntNode* pCNd = pEnd->nNode.GetNode().GetCntntNode();
+ const SwNode* pNd = &pStt->nNode.GetNode();
+ const SwSectionNode* pSectNd = pNd->FindSectionNode();
+ const SwSectionNode* pEndSectNd = pCNd ? pCNd->FindSectionNode() : 0;
+ if( pSectNd && pEndSectNd && pSectNd != pEndSectNd )
+ {
+ // versuche eine umschliessende Section zu erzeugen
+ // Aber, nur wenn der Start am Sectionanfang und das Ende am
+ // Section Ende liegt!
+ nRet = 0;
+ if( !pStt->nContent.GetIndex() && pSectNd->GetIndex()
+ == pStt->nNode.GetIndex() - 1 && pEnd->nContent.GetIndex() ==
+ pCNd->Len() )
+ {
+ SwNodeIndex aIdx( pStt->nNode, -1 );
+ sal_uLong nCmp = pEnd->nNode.GetIndex();
+ const SwStartNode* pPrvNd;
+ const SwEndNode* pNxtNd;
+ while( 0 != ( pPrvNd = (pNd = &aIdx.GetNode())->GetSectionNode() ) &&
+ !( aIdx.GetIndex() < nCmp &&
+ nCmp < pPrvNd->EndOfSectionIndex() ) )
+ {
+ aIdx--;
+ }
+ if( !pPrvNd )
+ pPrvNd = pNd->IsStartNode() ? (SwStartNode*)pNd
+ : pNd->StartOfSectionNode();
+
+ aIdx = pEnd->nNode.GetIndex() + 1;
+ nCmp = pStt->nNode.GetIndex();
+ while( 0 != ( pNxtNd = (pNd = &aIdx.GetNode())->GetEndNode() ) &&
+ pNxtNd->StartOfSectionNode()->IsSectionNode() &&
+ !( pNxtNd->StartOfSectionIndex() < nCmp &&
+ nCmp < aIdx.GetIndex() ) )
+ {
+ aIdx++;
+ }
+ if( !pNxtNd )
+ pNxtNd = pNd->EndOfSectionNode();
+
+ if( pPrvNd && pNxtNd && pPrvNd == pNxtNd->StartOfSectionNode() )
+ {
+ nRet = 3;
+
+ if( ppSttNd )
+ *ppSttNd = pPrvNd;
+ }
+ }
+ }
+ else if( !pSectNd && pEndSectNd )
+ {
+ // versuche eine umschliessende Section zu erzeugen
+ // Aber, nur wenn das Ende am Section Ende liegt!
+ nRet = 0;
+ if( pEnd->nContent.GetIndex() == pCNd->Len() )
+ {
+ SwNodeIndex aIdx( pEnd->nNode, 1 );
+ if( aIdx.GetNode().IsEndNode() &&
+ 0 != aIdx.GetNode().FindSectionNode() )
+ {
+ do {
+ aIdx++;
+ } while( aIdx.GetNode().IsEndNode() &&
+ 0 != aIdx.GetNode().FindSectionNode() );
+// if( !aIdx.GetNode().IsEndNode() )
+ {
+ nRet = 2;
+ if( ppSttNd )
+ {
+ aIdx--;
+ *ppSttNd = &aIdx.GetNode();
+ }
+ }
+ }
+ }
+ }
+ else if( pSectNd && !pEndSectNd )
+ {
+ // versuche eine umschliessende Section zu erzeugen
+ // Aber, nur wenn der Start am Section Anfang liegt!
+ nRet = 0;
+ if( !pStt->nContent.GetIndex() )
+ {
+ SwNodeIndex aIdx( pStt->nNode, -1 );
+ if( aIdx.GetNode().IsSectionNode() )
+ {
+ do {
+ aIdx--;
+ } while( aIdx.GetNode().IsSectionNode() );
+ if( !aIdx.GetNode().IsSectionNode() )
+ {
+ nRet = 1;
+ if( ppSttNd )
+ {
+ aIdx++;
+ *ppSttNd = &aIdx.GetNode();
+ }
+ }
+ }
+ }
+ }
+ }
+ return nRet;
+}
+
+SwSection* SwDoc::GetCurrSection( const SwPosition& rPos ) const
+{
+ const SwSectionNode* pSectNd = rPos.nNode.GetNode().FindSectionNode();
+ if( pSectNd )
+ return (SwSection*)&pSectNd->GetSection();
+ return 0;
+}
+
+SwSectionFmt* SwDoc::MakeSectionFmt( SwSectionFmt *pDerivedFrom )
+{
+ if( !pDerivedFrom )
+ pDerivedFrom = (SwSectionFmt*)pDfltFrmFmt;
+ SwSectionFmt* pNew = new SwSectionFmt( pDerivedFrom, this );
+ pSectionFmtTbl->Insert( pNew, pSectionFmtTbl->Count() );
+ return pNew;
+}
+
+void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes )
+{
+ sal_uInt16 nPos = pSectionFmtTbl->GetPos( pFmt );
+
+ GetIDocumentUndoRedo().StartUndo(UNDO_DELSECTION, NULL);
+
+ if( USHRT_MAX != nPos )
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt( sal_False ).GetCntntIdx();
+ const SfxPoolItem* pFtnEndAtTxtEnd;
+ if( SFX_ITEM_SET != pFmt->GetItemState(
+ RES_FTN_AT_TXTEND, sal_True, &pFtnEndAtTxtEnd ) ||
+ SFX_ITEM_SET != pFmt->GetItemState(
+ RES_END_AT_TXTEND, sal_True, &pFtnEndAtTxtEnd ))
+ pFtnEndAtTxtEnd = 0;
+
+ const SwSectionNode* pSectNd;
+
+ if( GetIDocumentUndoRedo().DoesUndo() )
+ {
+ if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
+ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+ {
+ SwNodeIndex aUpdIdx( *pIdx );
+ SwPaM aPaM( *pSectNd->EndOfSectionNode(), *pSectNd );
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( aPaM ));
+ if( pFtnEndAtTxtEnd )
+ GetFtnIdxs().UpdateFtn( aUpdIdx );
+ SetModified();
+ //#126178# start/end undo have to be pairs!
+ GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL);
+ return ;
+ }
+ GetIDocumentUndoRedo().AppendUndo( MakeUndoDelSection( *pFmt ) );
+ }
+ else if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
+ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+ {
+ SwNodeIndex aUpdIdx( *pIdx );
+ DeleteSection( (SwNode*)pSectNd );
+ if( pFtnEndAtTxtEnd )
+ GetFtnIdxs().UpdateFtn( aUpdIdx );
+ SetModified();
+ //#126178# start/end undo have to be pairs!
+ GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL);
+ return ;
+ }
+
+ {
+ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFmt );
+ pFmt->ModifyNotification( &aMsgHint, &aMsgHint );
+ }
+
+ // A ClearRedo could result in a rekursive call of this function and delete some section
+ // formats => the position iside the SectionFmtTbl could have changed
+ nPos = pSectionFmtTbl->GetPos( pFmt );
+
+ // ACHTUNG: erst aus dem Array entfernen und dann loeschen.
+ // Der Section-DTOR versucht selbst noch sein Format
+ // zu loeschen!
+ pSectionFmtTbl->Remove( nPos );
+//FEATURE::CONDCOLL
+ sal_uLong nCnt = 0, nSttNd = 0;
+ if( pIdx && &GetNodes() == &pIdx->GetNodes() &&
+ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+ {
+ nSttNd = pSectNd->GetIndex();
+ nCnt = pSectNd->EndOfSectionIndex() - nSttNd - 1;
+ }
+//FEATURE::CONDCOLL
+
+ delete pFmt;
+
+ if( nSttNd && pFtnEndAtTxtEnd )
+ {
+ SwNodeIndex aUpdIdx( GetNodes(), nSttNd );
+ GetFtnIdxs().UpdateFtn( aUpdIdx );
+ }
+
+//FEATURE::CONDCOLL
+ SwCntntNode* pCNd;
+ for( ; nCnt--; ++nSttNd )
+ if( 0 != (pCNd = GetNodes()[ nSttNd ]->GetCntntNode() ) &&
+ RES_CONDTXTFMTCOLL == pCNd->GetFmtColl()->Which() )
+ pCNd->ChkCondColl();
+//FEATURE::CONDCOLL
+ }
+
+ GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL);
+
+ SetModified();
+}
+
+void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData,
+ SfxItemSet const*const pAttr, bool const bPreventLinkUpdate)
+{
+ SwSectionFmt* pFmt = (*pSectionFmtTbl)[ nPos ];
+ SwSection* pSection = pFmt->GetSection();
+ /// OD 04.10.2002 #102894#
+ /// remember hidden condition flag of SwSection before changes
+ bool bOldCondHidden = pSection->IsCondHidden() ? true : false;
+
+ if (pSection->DataEquals(rNewData))
+ {
+ // die Attribute ueberpruefen
+ sal_Bool bOnlyAttrChg = sal_False;
+ if( pAttr && pAttr->Count() )
+ {
+ SfxItemIter aIter( *pAttr );
+ sal_uInt16 nWhich = aIter.GetCurItem()->Which();
+ while( sal_True )
+ {
+ if( pFmt->GetFmtAttr( nWhich ) != *aIter.GetCurItem() )
+ {
+ bOnlyAttrChg = sal_True;
+ break;
+ }
+
+ if( aIter.IsAtEnd() )
+ break;
+ nWhich = aIter.NextItem()->Which();
+ }
+ }
+
+ if( bOnlyAttrChg )
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(
+ MakeUndoUpdateSection( *pFmt, true ) );
+ }
+ // #i32968# Inserting columns in the section causes MakeFrmFmt
+ // to put two objects of type SwUndoFrmFmt on the undo stack.
+ // We don't want them.
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+ pFmt->SetFmtAttr( *pAttr );
+ SetModified();
+ }
+ return;
+ }
+
+ // Teste ob eine gesamte Content-Section (Dokument/TabellenBox/Fly)
+ // versteckt werden soll, koennen wir zur Zeit nicht !!!!
+ const SwNodeIndex* pIdx = 0;
+ {
+ if (rNewData.IsHidden())
+ {
+ pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if (pIdx)
+ {
+ const SwSectionNode* pSectNd =
+ pIdx->GetNode().GetSectionNode();
+ if (pSectNd)
+ {
+ ::lcl_CheckEmptyLayFrm( GetNodes(), rNewData,
+ *pSectNd, *pSectNd->EndOfSectionNode() );
+ }
+ }
+ }
+ }
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(MakeUndoUpdateSection(*pFmt, false));
+ }
+ // #i32968# Inserting columns in the section causes MakeFrmFmt to put two
+ // objects of type SwUndoFrmFmt on the undo stack. We don't want them.
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ // #56167# Der LinkFileName koennte auch nur aus Separatoren bestehen
+ String sCompareString = sfx2::cTokenSeperator;
+ sCompareString += sfx2::cTokenSeperator;
+ const bool bUpdate =
+ (!pSection->IsLinkType() && rNewData.IsLinkType())
+ || ( rNewData.GetLinkFileName().Len()
+ && (rNewData.GetLinkFileName() != sCompareString)
+ && (rNewData.GetLinkFileName() != pSection->GetLinkFileName()));
+
+ String sSectName( rNewData.GetSectionName() );
+ if (sSectName != pSection->GetSectionName())
+ GetUniqueSectionName( &sSectName );
+ else
+ sSectName.Erase();
+
+ /// OD 04.10.2002 #102894# - NOTE
+ /// In SwSection::operator=(..) class member bCondHiddenFlag is always set to sal_True.
+ /// IMHO this have to be changed, but I can't estimate the consequences:
+ /// Either it is set to sal_True using corresponding method <SwSection.SetCondHidden(..)>,
+ /// or it is set to the value of SwSection which is assigned to it.
+ /// Discussion with AMA results that the adjustment to the assignment operator
+ /// could be very risky -> see notes in bug #102894#.
+ pSection->SetSectionData(rNewData);
+
+ if( pAttr )
+ pSection->GetFmt()->SetFmtAttr( *pAttr );
+
+ if( sSectName.Len() )
+ {
+ pSection->SetSectionName( sSectName );
+ }
+
+ // ist eine Condition gesetzt
+ if( pSection->IsHidden() && pSection->GetCondition().Len() )
+ {
+ // dann berechne bis zu dieser Position
+ SwCalc aCalc( *this );
+ if( !pIdx )
+ pIdx = pFmt->GetCntnt().GetCntntIdx();
+ FldsToCalc( aCalc, pIdx->GetIndex(), USHRT_MAX );
+ /// OD 04.10.2002 #102894#
+ /// Because on using SwSection::operator=() to set up <pSection>
+ /// with <rNewData> and the above given note, the hidden condition flag
+ /// has to be set to sal_False, if hidden condition flag of <pFmt->GetSection()>
+ /// (SwSection before the changes) is sal_False (already saved in <bOldCondHidden>)
+ /// and new calculated condition is sal_True.
+ /// This is necessary, because otherwise the <SetCondHidden> would have
+ /// no effect.
+ bool bCalculatedCondHidden =
+ aCalc.Calculate( pSection->GetCondition() ).GetBool() ? true : false;
+ if ( bCalculatedCondHidden && !bOldCondHidden )
+ {
+ pSection->SetCondHidden( false );
+ }
+ pSection->SetCondHidden( bCalculatedCondHidden );
+ }
+
+ if( bUpdate )
+ pSection->CreateLink( bPreventLinkUpdate ? CREATE_CONNECT : CREATE_UPDATE );
+ else if( !pSection->IsLinkType() && pSection->IsConnected() )
+ {
+ pSection->Disconnect();
+ GetLinkManager().Remove( &pSection->GetBaseLink() );
+ }
+
+ SetModified();
+}
+
+/* -----------------19.02.99 09:31-------------------
+ * LockFrms wurde im InsertSection genutzt, um zu verhindern, dass
+ * SectionFrms durch das DelFrms zerstoert werden. Dies ist durch
+ * den Destroy-Listen-Mechanismus ueberfluessig geworden.
+ * Falls diese Methode doch noch einmal reanimiert wird, bietet es
+ * sich vielleicht an, beim Entlocken die SectionFrms auf Inhalt zu
+ * pruefen und dann ggf. zur Zerstoerung anzumelden.
+ * --------------------------------------------------*/
+
+// und dann waren da noch die Fussnoten:
+void lcl_DeleteFtn( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd )
+{
+ SwFtnIdxs& rFtnArr = pNd->GetDoc()->GetFtnIdxs();
+ if( rFtnArr.Count() )
+ {
+ sal_uInt16 nPos;
+ rFtnArr.SeekEntry( SwNodeIndex( *pNd ), &nPos );
+ SwTxtFtn* pSrch;
+
+ // loesche erstmal alle, die dahinter stehen
+ while( nPos < rFtnArr.Count() &&
+ _SwTxtFtn_GetIndex( (pSrch = rFtnArr[ nPos ]) ) <= nEnd )
+ {
+ // Werden die Nodes nicht geloescht mussen sie bei den Seiten
+ // abmeldet (Frms loeschen) werden, denn sonst bleiben sie
+ // stehen (Undo loescht sie nicht!)
+ pSrch->DelFrms(0);
+ ++nPos;
+ }
+
+ while( nPos-- &&
+ _SwTxtFtn_GetIndex( (pSrch = rFtnArr[ nPos ]) ) >= nStt )
+ {
+ // Werden die Nodes nicht geloescht mussen sie bei den Seiten
+ // abmeldet (Frms loeschen) werden, denn sonst bleiben sie
+ // stehen (Undo loescht sie nicht!)
+ pSrch->DelFrms(0);
+ }
+ }
+}
+
+static inline bool lcl_IsTOXSection(SwSectionData const& rSectionData)
+{
+ return (TOX_CONTENT_SECTION == rSectionData.GetType())
+ || (TOX_HEADER_SECTION == rSectionData.GetType());
+}
+
+SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx,
+ SwSectionFmt& rSectionFmt,
+ SwSectionData const& rSectionData,
+ SwTOXBase const*const pTOXBase,
+ SwNodeIndex const*const pEnde,
+ bool const bInsAtStart, bool const bCreateFrms)
+{
+ SwNodeIndex aInsPos( rNdIdx );
+ if( !pEnde ) // kein Bereich also neue Section davor/hinter anlegen
+ {
+ // #i26762#
+ ASSERT(!pEnde || rNdIdx <= *pEnde,
+ "Section start and end in wrong order!");
+
+ if( bInsAtStart )
+ {
+ if (!lcl_IsTOXSection(rSectionData))
+ {
+ do {
+ aInsPos--;
+ } while( aInsPos.GetNode().IsSectionNode() );
+ aInsPos++;
+ }
+ }
+ else
+ {
+ SwNode* pNd;
+ aInsPos++;
+ if (!lcl_IsTOXSection(rSectionData))
+ {
+ while( aInsPos.GetIndex() < Count() - 1 &&
+ ( pNd = &aInsPos.GetNode())->IsEndNode() &&
+ pNd->StartOfSectionNode()->IsSectionNode())
+ {
+ aInsPos++;
+ }
+ }
+ }
+ }
+
+ SwSectionNode *const pSectNd =
+ new SwSectionNode(aInsPos, rSectionFmt, pTOXBase);
+ if( pEnde )
+ {
+ // Sonderfall fuer die Reader/Writer
+ if( &pEnde->GetNode() != &GetEndOfContent() )
+ aInsPos = pEnde->GetIndex()+1;
+ // #i58710: We created a RTF document with a section break inside a table cell
+ // We are not able to handle a section start inside a table and the section end outside.
+ const SwNode* pLastNode = pSectNd->StartOfSectionNode()->EndOfSectionNode();
+ if( aInsPos > pLastNode->GetIndex() )
+ aInsPos = pLastNode->GetIndex();
+ // Another way round: if the section starts outside a table but the end is inside...
+ // aInsPos is at the moment the Position where my EndNode will be inserted
+ const SwStartNode* pStartNode = aInsPos.GetNode().StartOfSectionNode();
+ // This StartNode should be in front of me, but if not, I wanna survive
+ sal_uLong nMyIndex = pSectNd->GetIndex();
+ if( pStartNode->GetIndex() > nMyIndex ) // Suspicious!
+ {
+ const SwNode* pTemp;
+ do
+ {
+ pTemp = pStartNode; // pTemp is a suspicious one
+ pStartNode = pStartNode->StartOfSectionNode();
+ }
+ while( pStartNode->GetIndex() > nMyIndex );
+ pTemp = pTemp->EndOfSectionNode();
+ // If it starts behind me but ends behind my end...
+ if( pTemp->GetIndex() >= aInsPos.GetIndex() )
+ aInsPos = pTemp->GetIndex()+1; // ...I have to correct my end position
+ }
+
+ }
+ else
+ {
+ SwTxtNode* pCpyTNd = rNdIdx.GetNode().GetTxtNode();
+ if( pCpyTNd )
+ {
+ SwTxtNode* pTNd = new SwTxtNode( aInsPos, pCpyTNd->GetTxtColl() );
+ if( pCpyTNd->HasSwAttrSet() )
+ {
+ // Task 70955 - move PageDesc/Break to the first Node of the
+ // section
+ const SfxItemSet& rSet = *pCpyTNd->GetpSwAttrSet();
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_BREAK ) ||
+ SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC ))
+ {
+ SfxItemSet aSet( rSet );
+ if( bInsAtStart )
+ pCpyTNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
+ else
+ {
+ aSet.ClearItem( RES_PAGEDESC );
+ aSet.ClearItem( RES_BREAK );
+ }
+ pTNd->SetAttr( aSet );
+ }
+ else
+ pTNd->SetAttr( rSet );
+ }
+ // den Frame anlegen nicht vergessen !!
+ pCpyTNd->MakeFrms( *pTNd );
+ }
+ else
+ new SwTxtNode( aInsPos, (SwTxtFmtColl*)GetDoc()->GetDfltTxtFmtColl() );
+ }
+ new SwEndNode( aInsPos, *pSectNd );
+
+ pSectNd->GetSection().SetSectionData(rSectionData);
+ SwSectionFmt* pSectFmt = pSectNd->GetSection().GetFmt();
+
+ // Hier bietet sich als Optimierung an, vorhandene Frames nicht zu
+ // zerstoeren und wieder neu anzulegen, sondern nur umzuhaengen.
+ sal_Bool bInsFrm = bCreateFrms && !pSectNd->GetSection().IsHidden() &&
+ GetDoc()->GetCurrentViewShell(); //swmod 071108//swmod 071225
+ SwNode2Layout *pNode2Layout = NULL;
+ if( bInsFrm )
+ {
+ SwNodeIndex aTmp( *pSectNd );
+ if( !pSectNd->GetNodes().FindPrvNxtFrmNode( aTmp, pSectNd->EndOfSectionNode() ) )
+ // dann sammel mal alle Uppers ein
+ pNode2Layout = new SwNode2Layout( *pSectNd );
+ }
+
+ // jetzt noch bei allen im Bereich den richtigen StartNode setzen
+ sal_uLong nEnde = pSectNd->EndOfSectionIndex();
+ sal_uLong nStart = pSectNd->GetIndex()+1;
+ sal_uLong nSkipIdx = ULONG_MAX;
+ for( sal_uLong n = nStart; n < nEnde; ++n )
+ {
+ SwNode* pNd = (*this)[n];
+
+ //JP 30.04.99: Bug 65644 - alle in der NodeSection liegenden
+ // Sections unter die neue haengen
+ if( ULONG_MAX == nSkipIdx )
+ pNd->pStartOfSection = pSectNd;
+ else if( n >= nSkipIdx )
+ nSkipIdx = ULONG_MAX;
+
+ if( pNd->IsStartNode() )
+ {
+ // die Verschachtelung der Formate herstellen!
+ if( pNd->IsSectionNode() )
+ {
+ ((SwSectionNode*)pNd)->GetSection().GetFmt()->
+ SetDerivedFrom( pSectFmt );
+ ((SwSectionNode*)pNd)->DelFrms();
+ n = pNd->EndOfSectionIndex();
+ }
+ else
+ {
+ if( pNd->IsTableNode() )
+ ((SwTableNode*)pNd)->DelFrms();
+
+ if( ULONG_MAX == nSkipIdx )
+ nSkipIdx = pNd->EndOfSectionIndex();
+ }
+ }
+ else if( pNd->IsCntntNode() )
+ ((SwCntntNode*)pNd)->DelFrms();
+ }
+
+ lcl_DeleteFtn( pSectNd, nStart, nEnde );
+
+ if( bInsFrm )
+ {
+ if( pNode2Layout )
+ {
+ sal_uLong nIdx = pSectNd->GetIndex();
+ pNode2Layout->RestoreUpperFrms( pSectNd->GetNodes(), nIdx, nIdx + 1 );
+ delete pNode2Layout;
+ }
+ else
+ pSectNd->MakeFrms( &aInsPos );
+ }
+
+ return pSectNd;
+}
+
+SwSectionNode* SwNode::FindSectionNode()
+{
+ if( IsSectionNode() )
+ return GetSectionNode();
+ SwStartNode* pTmp = pStartOfSection;
+ while( !pTmp->IsSectionNode() && pTmp->GetIndex() )
+#if defined( ALPHA ) && defined( UNX )
+ pTmp = ((SwNode*)pTmp)->pStartOfSection;
+#else
+ pTmp = pTmp->pStartOfSection;
+#endif
+ return pTmp->GetSectionNode();
+}
+
+
+//---------
+// SwSectionNode
+//---------
+
+// ugly hack to make m_pSection const
+static SwSectionFmt &
+lcl_initParent(SwSectionNode & rThis, SwSectionFmt & rFmt)
+{
+ SwSectionNode *const pParent =
+ rThis.StartOfSectionNode()->FindSectionNode();
+ if( pParent )
+ {
+ // das Format beim richtigen Parent anmelden.
+ rFmt.SetDerivedFrom( pParent->GetSection().GetFmt() );
+ }
+ return rFmt;
+}
+
+SwSectionNode::SwSectionNode(SwNodeIndex const& rIdx,
+ SwSectionFmt & rFmt, SwTOXBase const*const pTOXBase)
+ : SwStartNode( rIdx, ND_SECTIONNODE )
+ , m_pSection( (pTOXBase)
+ ? new SwTOXBaseSection(*pTOXBase, lcl_initParent(*this, rFmt))
+ : new SwSection( CONTENT_SECTION, rFmt.GetName(),
+ lcl_initParent(*this, rFmt) ) )
+{
+ // jetzt noch die Verbindung von Format zum Node setzen
+ // Modify unterdruecken, interresiert keinen
+ rFmt.LockModify();
+ rFmt.SetFmtAttr( SwFmtCntnt( this ) );
+ rFmt.UnlockModify();
+}
+
+#if OSL_DEBUG_LEVEL > 1
+//Hier werden ueberfluessige SectionFrms entfernt
+SwFrm* SwClearDummies( SwFrm* pFrm )
+{
+ SwFrm* pTmp = pFrm;
+ while( pTmp )
+ {
+ ASSERT( !pTmp->GetUpper(), "SwClearDummies: No Upper allowed!" );
+ if( pTmp->IsSctFrm() )
+ {
+ SwSectionFrm* pSectFrm = (SwSectionFrm*)pFrm;
+ pTmp = pTmp->GetNext();
+ if( !pSectFrm->GetLower() )
+ {
+ if( pSectFrm->GetPrev() )
+ pSectFrm->GetPrev()->pNext = pTmp;
+ else
+ pFrm = pTmp;
+ if( pTmp )
+ pTmp->pPrev = pSectFrm->GetPrev();
+ delete pSectFrm;
+ }
+ }
+ else
+ pTmp = pTmp->GetNext();
+ }
+ return pFrm;
+}
+#endif
+
+SwSectionNode::~SwSectionNode()
+{
+ // mba: test if iteration works as clients will be removed in callback
+ m_pSection->GetFmt()->CallSwClientNotify( SfxSimpleHint( SFX_HINT_DYING ) );
+ SwSectionFmt* pFmt = m_pSection->GetFmt();
+ if( pFmt )
+ {
+ // das Attribut entfernen, weil die Section ihr Format loescht
+ // und falls das Cntnt-Attribut vorhanden ist, die Section aufhebt.
+ pFmt->LockModify();
+ pFmt->ResetFmtAttr( RES_CNTNT );
+ pFmt->UnlockModify();
+ }
+}
+
+
+SwFrm *SwSectionNode::MakeFrm( SwFrm *pSib )
+{
+ m_pSection->m_Data.SetHiddenFlag(false);
+ return new SwSectionFrm( *m_pSection, pSib );
+}
+
+//Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
+//Dokument. Die erzeugten Contentframes werden in das entsprechende
+//Layout gehaengt.
+void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx )
+{
+ // also nehme meinen nachfolgenden oder vorhergehenden ContentFrame:
+ SwNodes& rNds = GetNodes();
+ if( rNds.IsDocNodes() && rNds.GetDoc()->GetCurrentViewShell() ) //swmod 071108//swmod 071225
+ {
+ if( GetSection().IsHidden() || IsCntntHidden() )
+ {
+ SwNodeIndex aIdx( *EndOfSectionNode() );
+ SwCntntNode* pCNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
+ if( !pCNd )
+ {
+ aIdx = *this;
+ if( 0 == ( pCNd = rNds.GoPrevSection( &aIdx, sal_True, sal_False )) )
+ return ;
+ }
+ pCNd = aIdx.GetNode().GetCntntNode();
+ pCNd->MakeFrms( (SwCntntNode&)rIdx.GetNode() );
+ }
+ else
+ {
+ SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() );
+ SwFrm *pFrm, *pNew;
+ while( 0 != (pFrm = aNode2Layout.NextFrm()) )
+ {
+ ASSERT( pFrm->IsSctFrm(), "Depend von Section keine Section." );
+ pNew = rIdx.GetNode().GetCntntNode()->MakeFrm( pFrm );
+
+ SwSectionNode* pS = rIdx.GetNode().FindSectionNode();
+ // --> OD 2008-06-23 #156927#
+ // Assure that node is not inside a table, which is inside the
+ // found section.
+ if ( pS )
+ {
+ SwTableNode* pTableNode = rIdx.GetNode().FindTableNode();
+ if ( pTableNode &&
+ pTableNode->GetIndex() > pS->GetIndex() )
+ {
+ pS = 0;
+ }
+ }
+ // <--
+ // if the node is in a section, the sectionframe now
+ // has to be created..
+ // OD 14.11.2002 #104684# - boolean to control <Init()> of a new
+ // section frame.
+ bool bInitNewSect = false;
+ if( pS )
+ {
+ SwSectionFrm *pSct = new SwSectionFrm( pS->GetSection(), pFrm );
+ // OD 14.11.2002 #104684# - prepare <Init()> of new section frame.
+ bInitNewSect = true;
+ SwLayoutFrm* pUp = pSct;
+ while( pUp->Lower() ) // for columned sections
+ {
+ ASSERT( pUp->Lower()->IsLayoutFrm(),"Who's in there?" );
+ pUp = (SwLayoutFrm*)pUp->Lower();
+ }
+ pNew->Paste( pUp, NULL );
+ // --> OD 2005-12-01 #i27138#
+ // notify accessibility paragraphs objects about changed
+ // CONTENT_FLOWS_FROM/_TO relation.
+ // Relation CONTENT_FLOWS_FROM for next paragraph will change
+ // and relation CONTENT_FLOWS_TO for previous paragraph will change.
+ if ( pNew->IsTxtFrm() )
+ {
+ ViewShell* pViewShell( pNew->getRootFrm()->GetCurrShell() );
+ if ( pViewShell && pViewShell->GetLayout() &&
+ pViewShell->GetLayout()->IsAnyShellAccessible() )
+ {
+ pViewShell->InvalidateAccessibleParaFlowRelation(
+ dynamic_cast<SwTxtFrm*>(pNew->FindNextCnt( true )),
+ dynamic_cast<SwTxtFrm*>(pNew->FindPrevCnt( true )) );
+ }
+ }
+ // <--
+ pNew = pSct;
+ }
+
+ // wird ein Node vorher oder nachher mit Frames versehen
+ if ( rIdx < GetIndex() )
+ // der neue liegt vor mir
+ pNew->Paste( pFrm->GetUpper(), pFrm );
+ else
+ // der neue liegt hinter mir
+ pNew->Paste( pFrm->GetUpper(), pFrm->GetNext() );
+ // --> OD 2005-12-01 #i27138#
+ // notify accessibility paragraphs objects about changed
+ // CONTENT_FLOWS_FROM/_TO relation.
+ // Relation CONTENT_FLOWS_FROM for next paragraph will change
+ // and relation CONTENT_FLOWS_TO for previous paragraph will change.
+ if ( pNew->IsTxtFrm() )
+ {
+ ViewShell* pViewShell( pNew->getRootFrm()->GetCurrShell() );
+ if ( pViewShell && pViewShell->GetLayout() &&
+ pViewShell->GetLayout()->IsAnyShellAccessible() )
+ {
+ pViewShell->InvalidateAccessibleParaFlowRelation(
+ dynamic_cast<SwTxtFrm*>(pNew->FindNextCnt( true )),
+ dynamic_cast<SwTxtFrm*>(pNew->FindPrevCnt( true )) );
+ }
+ }
+ // <--
+ if ( bInitNewSect )
+ static_cast<SwSectionFrm*>(pNew)->Init();
+ }
+ }
+ }
+}
+
+//Fuer jedes vorkommen im Layout einen SectionFrm anlegen und vor den
+//entsprechenden CntntFrm pasten.
+
+void SwSectionNode::MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEndIdx )
+{
+ ASSERT( pIdxBehind, "kein Index" );
+ SwNodes& rNds = GetNodes();
+ SwDoc* pDoc = rNds.GetDoc();
+
+ *pIdxBehind = *this;
+
+ m_pSection->m_Data.SetHiddenFlag(true);
+
+ if( rNds.IsDocNodes() )
+ {
+ SwNodeIndex *pEnd = pEndIdx ? pEndIdx :
+ new SwNodeIndex( *EndOfSectionNode(), 1 );
+ ::MakeFrms( pDoc, *pIdxBehind, *pEnd );
+ if( !pEndIdx )
+ delete pEnd;
+ }
+
+}
+
+void SwSectionNode::DelFrms()
+{
+ sal_uLong nStt = GetIndex()+1, nEnd = EndOfSectionIndex();
+ if( nStt >= nEnd )
+ {
+ // unser Flag muessen wir noch aktualisieren
+ // pSection->bHiddenFlag = sal_True;
+ return ;
+ }
+
+ SwNodes& rNds = GetNodes();
+ m_pSection->GetFmt()->DelFrms();
+
+ // unser Flag muessen wir noch aktualisieren
+ m_pSection->m_Data.SetHiddenFlag(true);
+
+ // Bug 30582: falls der Bereich in Fly oder TabellenBox ist, dann
+ // kann er nur "gehiddet" werden, wenn weiterer Content
+ // vorhanden ist, der "Frames" haelt. Sonst hat der
+ // Fly/TblBox-Frame keinen Lower !!!
+ {
+ SwNodeIndex aIdx( *this );
+ if( !rNds.GoPrevSection( &aIdx, sal_True, sal_False ) ||
+ !CheckNodesRange( *this, aIdx, sal_True ) ||
+ // OD 04.11.2003 #i21457#
+ !lcl_IsInSameTblBox( rNds, *this, true ))
+ {
+ aIdx = *EndOfSectionNode();
+ if( !rNds.GoNextSection( &aIdx, sal_True, sal_False ) ||
+ !CheckNodesRange( *EndOfSectionNode(), aIdx, sal_True ) ||
+ // OD 04.11.2003 #i21457#
+ !lcl_IsInSameTblBox( rNds, *EndOfSectionNode(), false ))
+ {
+ m_pSection->m_Data.SetHiddenFlag(false);
+ }
+ }
+ }
+}
+
+SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+{
+ // in welchen Array steht ich denn: Nodes, UndoNodes ??
+ const SwNodes& rNds = GetNodes();
+
+ // das SectionFrmFmt kopieren
+ SwSectionFmt* pSectFmt = pDoc->MakeSectionFmt( 0 );
+ pSectFmt->CopyAttrs( *GetSection().GetFmt() );
+
+ ::std::auto_ptr<SwTOXBase> pTOXBase;
+ if (TOX_CONTENT_SECTION == GetSection().GetType())
+ {
+ ASSERT( GetSection().ISA( SwTOXBaseSection ), "no TOXBaseSection!" );
+ SwTOXBaseSection const& rTBS(
+ dynamic_cast<SwTOXBaseSection const&>(GetSection()));
+ pTOXBase.reset( new SwTOXBase(rTBS, pDoc) );
+ }
+
+ SwSectionNode *const pSectNd =
+ new SwSectionNode(rIdx, *pSectFmt, pTOXBase.get());
+ SwEndNode* pEndNd = new SwEndNode( rIdx, *pSectNd );
+ SwNodeIndex aInsPos( *pEndNd );
+
+ // Werte uebertragen
+ SwSection *const pNewSect = pSectNd->m_pSection.get();
+
+ if (TOX_CONTENT_SECTION != GetSection().GetType())
+ {
+ // beim Move den Namen beibehalten
+ if( rNds.GetDoc() == pDoc && pDoc->IsCopyIsMove() )
+ {
+ pNewSect->SetSectionName( GetSection().GetSectionName() );
+ }
+ else
+ {
+ pNewSect->SetSectionName(
+ pDoc->GetUniqueSectionName( &GetSection().GetSectionName() ));
+ }
+ }
+
+
+ pNewSect->SetType( GetSection().GetType() );
+ pNewSect->SetCondition( GetSection().GetCondition() );
+ pNewSect->SetLinkFileName( GetSection().GetLinkFileName() );
+ if( !pNewSect->IsHiddenFlag() && GetSection().IsHidden() )
+ pNewSect->SetHidden( sal_True );
+ if( !pNewSect->IsProtectFlag() && GetSection().IsProtect() )
+ pNewSect->SetProtect( sal_True );
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ if( !pNewSect->IsEditInReadonlyFlag() && GetSection().IsEditInReadonly() )
+ pNewSect->SetEditInReadonly( sal_True );
+ // <--
+
+ SwNodeRange aRg( *this, +1, *EndOfSectionNode() ); // (wo stehe in denn nun ??)
+ rNds._Copy( aRg, aInsPos, sal_False );
+
+ // loesche alle Frames vom kopierten Bereich, diese werden beim
+ // erzeugen des SectionFrames angelegt !
+ pSectNd->DelFrms();
+
+ // dann kopiere auch noch die Links/Server
+ if( pNewSect->IsLinkType() ) // den Link eintragen
+ pNewSect->CreateLink( pDoc->GetCurrentViewShell() ? CREATE_CONNECT //swmod 071108//swmod 071225
+ : CREATE_NONE );
+
+ // falls als Server aus dem Undo kopiert wird, wieder eintragen
+ if (m_pSection->IsServer()
+ && pDoc->GetIDocumentUndoRedo().IsUndoNodes(rNds))
+ {
+ pNewSect->SetRefObject( m_pSection->GetObject() );
+ pDoc->GetLinkManager().InsertServer( pNewSect->GetObject() );
+ }
+
+ // METADATA: copy xml:id; must be done after insertion of node
+ pSectFmt->RegisterAsCopyOf(*GetSection().GetFmt());
+
+ return pSectNd;
+}
+
+sal_Bool SwSectionNode::IsCntntHidden() const
+{
+ ASSERT( !m_pSection->IsHidden(),
+ "That's simple: Hidden Section => Hidden Content" );
+ SwNodeIndex aTmp( *this, 1 );
+ sal_uLong nEnd = EndOfSectionIndex();
+ while( aTmp < nEnd )
+ {
+ if( aTmp.GetNode().IsSectionNode() )
+ {
+ const SwSection& rSect = ((SwSectionNode&)aTmp.GetNode()).GetSection();
+ if( rSect.IsHiddenFlag() )
+ // dann diese Section ueberspringen
+ aTmp = *aTmp.GetNode().EndOfSectionNode();
+ }
+ else
+ {
+ if( aTmp.GetNode().IsCntntNode() || aTmp.GetNode().IsTableNode() )
+ return sal_False; // Nicht versteckter Inhalt wurde gefunden
+ ASSERT( aTmp.GetNode().IsEndNode(), "EndNode expected" );
+ }
+ aTmp++;
+ }
+ return sal_True; // Alles versteckt
+}
+
+
+void SwSectionNode::NodesArrChgd()
+{
+ SwSectionFmt *const pFmt = m_pSection->GetFmt();
+ if( pFmt )
+ {
+ SwNodes& rNds = GetNodes();
+ SwDoc* pDoc = pFmt->GetDoc();
+
+ if( !rNds.IsDocNodes() )
+ {
+ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFmt );
+ pFmt->ModifyNotification( &aMsgHint, &aMsgHint );
+ }
+
+ pFmt->LockModify();
+ pFmt->SetFmtAttr( SwFmtCntnt( this ));
+ pFmt->UnlockModify();
+
+ SwSectionNode* pSectNd = StartOfSectionNode()->FindSectionNode();
+ // set the correct parent from the new section
+ pFmt->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFmt()
+ : pDoc->GetDfltFrmFmt() );
+
+ // jetzt noch bei allen im Bereich den richtigen StartNode setzen
+ sal_uLong nStart = GetIndex()+1, nEnde = EndOfSectionIndex();
+ for( sal_uLong n = nStart; n < nEnde; ++n )
+ // die Verschachtelung der Formate herstellen!
+ if( 0 != ( pSectNd = rNds[ n ]->GetSectionNode() ) )
+ {
+ pSectNd->GetSection().GetFmt()->SetDerivedFrom( pFmt );
+ n = pSectNd->EndOfSectionIndex();
+ }
+
+ // verschieben vom Nodes- ins UndoNodes-Array?
+ if( rNds.IsDocNodes() )
+ {
+ ASSERT( pDoc == GetDoc(),
+ "verschieben in unterschiedliche Documente?" );
+ if( m_pSection->IsLinkType() ) // den Link austragen
+ m_pSection->CreateLink( pDoc->GetCurrentViewShell() ? CREATE_CONNECT //swmod 071108
+ : CREATE_NONE );//swmod 071225
+ if (m_pSection->IsServer())
+ {
+ pDoc->GetLinkManager().InsertServer( m_pSection->GetObject() );
+ }
+ }
+ else
+ {
+ if (CONTENT_SECTION != m_pSection->GetType())
+ {
+ pDoc->GetLinkManager().Remove( &m_pSection->GetBaseLink() );
+ }
+
+ if (m_pSection->IsServer())
+ {
+ pDoc->GetLinkManager().RemoveServer( m_pSection->GetObject() );
+ }
+ }
+ }
+}
+
+
+String SwDoc::GetUniqueSectionName( const String* pChkStr ) const
+{
+ ResId aId( STR_REGION_DEFNAME, *pSwResMgr );
+ String aName( aId );
+ xub_StrLen nNmLen = aName.Len();
+
+ sal_uInt16 nNum = 0;
+ sal_uInt16 nTmp, nFlagSize = ( pSectionFmtTbl->Count() / 8 ) +2;
+ sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
+ memset( pSetFlags, 0, nFlagSize );
+
+ const SwSectionNode* pSectNd;
+ sal_uInt16 n;
+
+ for( n = 0; n < pSectionFmtTbl->Count(); ++n )
+ if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( sal_False ) ))
+ {
+ const String& rNm = pSectNd->GetSection().GetSectionName();
+ if( rNm.Match( aName ) == nNmLen )
+ {
+ // Nummer bestimmen und das Flag setzen
+ nNum = static_cast<sal_uInt16>(rNm.Copy( nNmLen ).ToInt32());
+ if( nNum-- && nNum < pSectionFmtTbl->Count() )
+ pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
+ }
+ if( pChkStr && pChkStr->Equals( rNm ) )
+ pChkStr = 0;
+ }
+
+ if( !pChkStr )
+ {
+ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+ nNum = pSectionFmtTbl->Count();
+ for( n = 0; n < nFlagSize; ++n )
+ if( 0xff != ( nTmp = pSetFlags[ n ] ))
+ {
+ // also die Nummer bestimmen
+ nNum = n * 8;
+ while( nTmp & 1 )
+ ++nNum, nTmp >>= 1;
+ break;
+ }
+
+ }
+ delete [] pSetFlags;
+ if( pChkStr )
+ return *pChkStr;
+ return aName += String::CreateFromInt32( ++nNum );
+}
+
+
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
new file mode 100644
index 000000000000..5896792ee7c3
--- /dev/null
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -0,0 +1,4683 @@
+
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/chart2/XChartDocument.hpp>
+#include <hintids.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <fmtfsize.hxx>
+#include <fmtornt.hxx>
+#include <fmtfordr.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtanchr.hxx>
+#include <fmtlsplt.hxx>
+#include <frmatr.hxx>
+#include <charatr.hxx>
+#include <cellfrm.hxx>
+#include <pagefrm.hxx>
+#include <tabcol.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <UndoManager.hxx>
+#include <cntfrm.hxx>
+#include <pam.hxx>
+#include <swcrsr.hxx>
+#include <viscrs.hxx>
+#include <swtable.hxx>
+#include <ndtxt.hxx>
+#include <swundo.hxx>
+#include <tblsel.hxx>
+#include <fldbas.hxx>
+#include <poolfmt.hxx>
+#include <tabfrm.hxx>
+#include <UndoCore.hxx>
+#include <UndoRedline.hxx>
+#include <UndoDelete.hxx>
+#include <UndoTable.hxx>
+#include <hints.hxx>
+#include <tblafmt.hxx>
+#include <swcache.hxx>
+#include <ddefld.hxx>
+#include <frminf.hxx>
+#include <cellatr.hxx>
+#include <swtblfmt.hxx>
+#include <swddetbl.hxx>
+#include <mvsave.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+#include <rolbck.hxx>
+#include <tblrwcl.hxx>
+#include <editsh.hxx>
+#include <txtfrm.hxx>
+#include <ftnfrm.hxx>
+#include <section.hxx>
+#include <frmtool.hxx>
+#include <node2lay.hxx>
+#include <comcore.hrc>
+#include "docsh.hxx"
+#include <tabcol.hxx>
+#include <unochart.hxx>
+#include <node.hxx>
+#include <ndtxt.hxx>
+#include <map>
+#include <algorithm>
+#include <rootfrm.hxx>
+#include <fldupde.hxx>
+#include <switerator.hxx>
+
+#ifndef DBG_UTIL
+#define CHECK_TABLE(t)
+#else
+#ifdef DEBUG
+#define CHECK_TABLE(t) (t).CheckConsistency();
+#else
+#define CHECK_TABLE(t)
+#endif
+#endif
+
+
+using namespace ::com::sun::star;
+
+// #i17764# delete table redlines when modifying the table structure?
+// #define DEL_TABLE_REDLINES 1
+
+const sal_Unicode T2T_PARA = 0x0a;
+
+extern void ClearFEShellTabCols();
+
+// steht im gctable.cxx
+extern sal_Bool lcl_GC_Line_Border( const SwTableLine*& , void* pPara );
+
+#ifdef DEL_TABLE_REDLINES
+class lcl_DelRedlines
+{
+ SwDoc* pDoc;
+public:
+ lcl_DelRedlines( const SwTableNode& rNd, sal_Bool bCheckForOwnRedline );
+ lcl_DelRedlines( SwPaM& rPam );
+
+ ~lcl_DelRedlines() { pDoc->EndUndo(UNDO_EMPTY, NULL); }
+};
+
+lcl_DelRedlines::lcl_DelRedlines( SwPaM & rPam) : pDoc( rPam.GetDoc() )
+{
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+ if( !pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() )
+ pDoc->AcceptRedline( rPam, true );
+}
+#endif
+
+void lcl_SetDfltBoxAttr( SwFrmFmt& rFmt, sal_uInt8 nId )
+{
+ sal_Bool bTop = sal_False, bBottom = sal_False, bLeft = sal_False, bRight = sal_False;
+ switch ( nId )
+ {
+ case 0: bTop = bBottom = bLeft = sal_True; break;
+ case 1: bTop = bBottom = bLeft = bRight = sal_True; break;
+ case 2: bBottom = bLeft = sal_True; break;
+ case 3: bBottom = bLeft = bRight = sal_True; break;
+ }
+
+ const sal_Bool bHTML = rFmt.getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE);
+ Color aCol( bHTML ? COL_GRAY : COL_BLACK );
+ SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 );
+ if ( bHTML )
+ {
+ aLine.SetOutWidth( DEF_DOUBLE_LINE7_OUT );
+ aLine.SetInWidth ( DEF_DOUBLE_LINE7_IN );
+ aLine.SetDistance( DEF_DOUBLE_LINE7_DIST);
+ }
+ SvxBoxItem aBox(RES_BOX); aBox.SetDistance( 55 );
+ if ( bTop )
+ aBox.SetLine( &aLine, BOX_LINE_TOP );
+ if ( bBottom )
+ aBox.SetLine( &aLine, BOX_LINE_BOTTOM );
+ if ( bLeft )
+ aBox.SetLine( &aLine, BOX_LINE_LEFT );
+ if ( bRight )
+ aBox.SetLine( &aLine, BOX_LINE_RIGHT );
+ rFmt.SetFmtAttr( aBox );
+}
+
+void lcl_SetDfltBoxAttr( SwTableBox& rBox, SvPtrarr &rBoxFmtArr, sal_uInt8 nId,
+ const SwTableAutoFmt* pAutoFmt = 0 )
+{
+ SvPtrarr* pArr = (SvPtrarr*)rBoxFmtArr[ nId ];
+ if( !pArr )
+ {
+ pArr = new SvPtrarr;
+ rBoxFmtArr.Replace( pArr, nId );
+ }
+
+ SwTableBoxFmt* pNewBoxFmt = 0;
+ SwFrmFmt* pBoxFmt = rBox.GetFrmFmt();
+ for( sal_uInt16 n = 0; n < pArr->Count(); n += 2 )
+ if( pArr->GetObject( n ) == pBoxFmt )
+ {
+ pNewBoxFmt = (SwTableBoxFmt*)pArr->GetObject( n + 1 );
+ break;
+ }
+
+ if( !pNewBoxFmt )
+ {
+ SwDoc* pDoc = pBoxFmt->GetDoc();
+ // das Format ist also nicht vorhanden, also neu erzeugen
+ pNewBoxFmt = pDoc->MakeTableBoxFmt();
+ pNewBoxFmt->SetFmtAttr( pBoxFmt->GetAttrSet().Get( RES_FRM_SIZE ) );
+
+ if( pAutoFmt )
+ pAutoFmt->UpdateToSet( nId, (SfxItemSet&)pNewBoxFmt->GetAttrSet(),
+ SwTableAutoFmt::UPDATE_BOX,
+ pDoc->GetNumberFormatter( sal_True ) );
+ else
+ ::lcl_SetDfltBoxAttr( *pNewBoxFmt, nId );
+
+ void* p = pBoxFmt;
+ pArr->Insert( p, pArr->Count() );
+ p = pNewBoxFmt;
+ pArr->Insert( p, pArr->Count() );
+ }
+ rBox.ChgFrmFmt( pNewBoxFmt );
+}
+
+SwTableBoxFmt *lcl_CreateDfltBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr,
+ sal_uInt16 nCols, sal_uInt8 nId )
+{
+ if ( !rBoxFmtArr[nId] )
+ {
+ SwTableBoxFmt* pBoxFmt = rDoc.MakeTableBoxFmt();
+ if( USHRT_MAX != nCols )
+ pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE,
+ USHRT_MAX / nCols, 0 ));
+ ::lcl_SetDfltBoxAttr( *pBoxFmt, nId );
+ rBoxFmtArr.Replace( pBoxFmt, nId );
+ }
+ return (SwTableBoxFmt*)rBoxFmtArr[nId];
+}
+
+SwTableBoxFmt *lcl_CreateAFmtBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr,
+ const SwTableAutoFmt& rAutoFmt,
+ sal_uInt16 nCols, sal_uInt8 nId )
+{
+ if( !rBoxFmtArr[nId] )
+ {
+ SwTableBoxFmt* pBoxFmt = rDoc.MakeTableBoxFmt();
+ rAutoFmt.UpdateToSet( nId, (SfxItemSet&)pBoxFmt->GetAttrSet(),
+ SwTableAutoFmt::UPDATE_BOX,
+ rDoc.GetNumberFormatter( sal_True ) );
+ if( USHRT_MAX != nCols )
+ pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE,
+ USHRT_MAX / nCols, 0 ));
+ rBoxFmtArr.Replace( pBoxFmt, nId );
+ }
+ return (SwTableBoxFmt*)rBoxFmtArr[nId];
+}
+
+SwTableNode* SwDoc::IsIdxInTbl(const SwNodeIndex& rIdx)
+{
+ SwTableNode* pTableNd = 0;
+ sal_uLong nIndex = rIdx.GetIndex();
+ do {
+ SwNode* pNd = (SwNode*)GetNodes()[ nIndex ]->StartOfSectionNode();
+ if( 0 != ( pTableNd = pNd->GetTableNode() ) )
+ break;
+
+ nIndex = pNd->GetIndex();
+ } while ( nIndex );
+ return pTableNd;
+}
+
+
+// --------------- einfuegen einer neuen Box --------------
+
+ // fuege in der Line, vor der InsPos eine neue Box ein.
+
+sal_Bool SwNodes::InsBoxen( SwTableNode* pTblNd,
+ SwTableLine* pLine,
+ SwTableBoxFmt* pBoxFmt,
+ SwTxtFmtColl* pTxtColl,
+ const SfxItemSet* pAutoAttr,
+ sal_uInt16 nInsPos,
+ sal_uInt16 nCnt )
+{
+ if( !nCnt )
+ return sal_False;
+ ASSERT( pLine, "keine gueltige Zeile" );
+
+ // Index hinter die letzte Box der Line
+ sal_uLong nIdxPos = 0;
+ SwTableBox *pPrvBox = 0, *pNxtBox = 0;
+ if( pLine->GetTabBoxes().Count() )
+ {
+ if( nInsPos < pLine->GetTabBoxes().Count() )
+ {
+ if( 0 == (pPrvBox = pLine->FindPreviousBox( pTblNd->GetTable(),
+ pLine->GetTabBoxes()[ nInsPos ] )))
+ pPrvBox = pLine->FindPreviousBox( pTblNd->GetTable() );
+ }
+ else if( 0 == ( pNxtBox = pLine->FindNextBox( pTblNd->GetTable(),
+ pLine->GetTabBoxes()[ nInsPos-1 ] )))
+ pNxtBox = pLine->FindNextBox( pTblNd->GetTable() );
+ }
+ else if( 0 == ( pNxtBox = pLine->FindNextBox( pTblNd->GetTable() )))
+ pPrvBox = pLine->FindPreviousBox( pTblNd->GetTable() );
+
+ if( !pPrvBox && !pNxtBox )
+ {
+ sal_Bool bSetIdxPos = sal_True;
+ if( pTblNd->GetTable().GetTabLines().Count() && !nInsPos )
+ {
+ const SwTableLine* pTblLn = pLine;
+ while( pTblLn->GetUpper() )
+ pTblLn = pTblLn->GetUpper()->GetUpper();
+
+ if( pTblNd->GetTable().GetTabLines()[ 0 ] == pTblLn )
+ {
+ // also vor die erste Box der Tabelle
+ while( ( pNxtBox = pLine->GetTabBoxes()[0])->GetTabLines().Count() )
+ pLine = pNxtBox->GetTabLines()[0];
+ nIdxPos = pNxtBox->GetSttIdx();
+ bSetIdxPos = sal_False;
+ }
+ }
+ if( bSetIdxPos )
+ // Tabelle ohne irgendeinen Inhalt oder am Ende, also vors Ende
+ nIdxPos = pTblNd->EndOfSectionIndex();
+ }
+ else if( pNxtBox ) // es gibt einen Nachfolger
+ nIdxPos = pNxtBox->GetSttIdx();
+ else // es gibt einen Vorgaenger
+ nIdxPos = pPrvBox->GetSttNd()->EndOfSectionIndex() + 1;
+
+ SwNodeIndex aEndIdx( *this, nIdxPos );
+ for( sal_uInt16 n = 0; n < nCnt; ++n )
+ {
+ SwStartNode* pSttNd = new SwStartNode( aEndIdx, ND_STARTNODE,
+ SwTableBoxStartNode );
+ pSttNd->pStartOfSection = pTblNd;
+ new SwEndNode( aEndIdx, *pSttNd );
+
+ pPrvBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
+
+ SwTableBoxes & rTabBoxes = pLine->GetTabBoxes();
+ sal_uInt16 nRealInsPos = nInsPos + n;
+ if (nRealInsPos > rTabBoxes.Count())
+ nRealInsPos = rTabBoxes.Count();
+
+ rTabBoxes.C40_INSERT( SwTableBox, pPrvBox, nRealInsPos );
+
+ //if( NO_NUMBERING == pTxtColl->GetOutlineLevel()//#outline level,zhaojianwei
+ if( ! pTxtColl->IsAssignedToListLevelOfOutlineStyle()//<-end,zhaojianwei
+//FEATURE::CONDCOLL
+ && RES_CONDTXTFMTCOLL != pTxtColl->Which()
+//FEATURE::CONDCOLL
+ )
+ new SwTxtNode( SwNodeIndex( *pSttNd->EndOfSectionNode() ),
+ pTxtColl, pAutoAttr );
+ else
+ {
+ // Outline-Numerierung richtig behandeln !!!
+ SwTxtNode* pTNd = new SwTxtNode(
+ SwNodeIndex( *pSttNd->EndOfSectionNode() ),
+ (SwTxtFmtColl*)GetDoc()->GetDfltTxtFmtColl(),
+ pAutoAttr );
+ pTNd->ChgFmtColl( pTxtColl );
+ }
+ }
+ return sal_True;
+}
+
+// --------------- einfuegen einer neuen Tabelle --------------
+
+const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
+ const SwPosition& rPos, sal_uInt16 nRows,
+ sal_uInt16 nCols, sal_Int16 eAdjust,
+ const SwTableAutoFmt* pTAFmt,
+ const SvUShorts* pColArr,
+ sal_Bool bCalledFromShell,
+ sal_Bool bNewModel )
+{
+ ASSERT( nRows, "Tabelle ohne Zeile?" );
+ ASSERT( nCols, "Tabelle ohne Spalten?" );
+
+ {
+ // nicht in Fussnoten kopieren !!
+ if( rPos.nNode < GetNodes().GetEndOfInserts().GetIndex() &&
+ rPos.nNode >= GetNodes().GetEndOfInserts().StartOfSectionIndex() )
+ return 0;
+
+ // sollte das ColumnArray die falsche Anzahl haben wird es ignoriert!
+ if( pColArr &&
+ (nCols + ( text::HoriOrientation::NONE == eAdjust ? 2 : 1 )) != pColArr->Count() )
+ pColArr = 0;
+ }
+
+ String aTblName = GetUniqueTblName();
+
+ if( GetIDocumentUndoRedo().DoesUndo() )
+ {
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoInsTbl( rPos, nCols, nRows, static_cast<sal_uInt16>(eAdjust),
+ rInsTblOpts, pTAFmt, pColArr,
+ aTblName));
+ }
+
+ // fuege erstmal die Nodes ein
+ // hole das Auto-Format fuer die Tabelle
+ SwTxtFmtColl *pBodyColl = GetTxtCollFromPool( RES_POOLCOLL_TABLE ),
+ *pHeadColl = pBodyColl;
+
+ sal_Bool bDfltBorders = 0 != ( rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER );
+
+ if( (rInsTblOpts.mnInsMode & tabopts::HEADLINE) && (1 != nRows || !bDfltBorders) )
+ pHeadColl = GetTxtCollFromPool( RES_POOLCOLL_TABLE_HDLN );
+
+ const sal_uInt16 nRowsToRepeat =
+ tabopts::HEADLINE == (rInsTblOpts.mnInsMode & tabopts::HEADLINE) ?
+ rInsTblOpts.mnRowsToRepeat :
+ 0;
+
+ /* #106283# Save content node to extract FRAMEDIR from. */
+ const SwCntntNode * pCntntNd = rPos.nNode.GetNode().GetCntntNode();
+
+ /* #109161# If we are called from a shell pass the attrset from
+ pCntntNd (aka the node the table is inserted at) thus causing
+ SwNodes::InsertTable to propagate an adjust item if
+ necessary. */
+ SwTableNode *pTblNd = GetNodes().InsertTable(
+ rPos.nNode,
+ nCols,
+ pBodyColl,
+ nRows,
+ nRowsToRepeat,
+ pHeadColl,
+ bCalledFromShell ? &pCntntNd->GetSwAttrSet() : 0 );
+
+ // dann erstelle die Box/Line/Table-Struktur
+ SwTableLineFmt* pLineFmt = MakeTableLineFmt();
+ SwTableFmt* pTableFmt = MakeTblFrmFmt( aTblName, GetDfltFrmFmt() );
+
+ /* #106283# If the node to insert the table at is a context node and has a
+ non-default FRAMEDIR propagate it to the table. */
+ if (pCntntNd)
+ {
+ const SwAttrSet & aNdSet = pCntntNd->GetSwAttrSet();
+ const SfxPoolItem *pItem = NULL;
+
+ if (SFX_ITEM_SET == aNdSet.GetItemState( RES_FRAMEDIR, sal_True, &pItem )
+ && pItem != NULL)
+ {
+ pTableFmt->SetFmtAttr( *pItem );
+ }
+ }
+
+ //Orientation am Fmt der Table setzen
+ pTableFmt->SetFmtAttr( SwFmtHoriOrient( 0, eAdjust ) );
+ // alle Zeilen haben die Fill-Order von links nach rechts !
+ pLineFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ));
+
+ // die Tabelle bekommt USHRT_MAX als default SSize
+ SwTwips nWidth = USHRT_MAX;
+ if( pColArr )
+ {
+ sal_uInt16 nSttPos = (*pColArr)[ 0 ];
+ sal_uInt16 nLastPos = (*pColArr)[ sal_uInt16(pColArr->Count()-1)];
+ if( text::HoriOrientation::NONE == eAdjust )
+ {
+ sal_uInt16 nFrmWidth = nLastPos;
+ nLastPos = (*pColArr)[ sal_uInt16(pColArr->Count()-2)];
+ pTableFmt->SetFmtAttr( SvxLRSpaceItem( nSttPos, nFrmWidth - nLastPos, 0, 0, RES_LR_SPACE ) );
+ }
+ nWidth = nLastPos - nSttPos;
+ }
+ else if( nCols )
+ {
+ nWidth /= nCols;
+ nWidth *= nCols; // to avoid rounding problems
+ }
+ pTableFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth ));
+ if( !(rInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT) )
+ pTableFmt->SetFmtAttr( SwFmtLayoutSplit( sal_False ));
+
+ // verschiebe ggfs. die harten PageDesc/PageBreak Attribute:
+ SwCntntNode* pNextNd = GetNodes()[ pTblNd->EndOfSectionIndex()+1 ]
+ ->GetCntntNode();
+ if( pNextNd && pNextNd->HasSwAttrSet() )
+ {
+ const SfxItemSet* pNdSet = pNextNd->GetpSwAttrSet();
+ const SfxPoolItem *pItem;
+ if( SFX_ITEM_SET == pNdSet->GetItemState( RES_PAGEDESC, sal_False,
+ &pItem ) )
+ {
+ pTableFmt->SetFmtAttr( *pItem );
+ pNextNd->ResetAttr( RES_PAGEDESC );
+ pNdSet = pNextNd->GetpSwAttrSet();
+ }
+ if( pNdSet && SFX_ITEM_SET == pNdSet->GetItemState( RES_BREAK, sal_False,
+ &pItem ) )
+ {
+ pTableFmt->SetFmtAttr( *pItem );
+ pNextNd->ResetAttr( RES_BREAK );
+ }
+ }
+
+ SwTable * pNdTbl = &pTblNd->GetTable();
+ pNdTbl->RegisterToFormat( *pTableFmt );
+
+ pNdTbl->SetRowsToRepeat( nRowsToRepeat );
+ pNdTbl->SetTableModel( bNewModel );
+
+ SvPtrarr aBoxFmtArr( 0, 16 );
+ SwTableBoxFmt* pBoxFmt = 0;
+ if( !bDfltBorders && !pTAFmt )
+ {
+ pBoxFmt = MakeTableBoxFmt();
+ pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX / nCols, 0 ));
+ }
+ else
+ {
+ const sal_uInt16 nBoxArrLen = pTAFmt ? 16 : 4;
+ for( sal_uInt16 i = 0; i < nBoxArrLen; ++i )
+ aBoxFmtArr.Insert( (void*)0, i );
+ }
+ // --> OD 2008-02-25 #refactorlists#
+// SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_END-1 );
+ SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1 );
+ // <--
+
+ SwNodeIndex aNdIdx( *pTblNd, 1 ); // auf den ersten Box-StartNode
+ SwTableLines& rLines = pNdTbl->GetTabLines();
+ for( sal_uInt16 n = 0; n < nRows; ++n )
+ {
+ SwTableLine* pLine = new SwTableLine( pLineFmt, nCols, 0 );
+ rLines.C40_INSERT( SwTableLine, pLine, n );
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ for( sal_uInt16 i = 0; i < nCols; ++i )
+ {
+ SwTableBoxFmt *pBoxF;
+ if( pTAFmt )
+ {
+ sal_uInt8 nId = static_cast<sal_uInt8>(!n ? 0 : (( n+1 == nRows )
+ ? 12 : (4 * (1 + ((n-1) & 1 )))));
+ nId = nId + static_cast<sal_uInt8>( !i ? 0 :
+ ( i+1 == nCols ? 3 : (1 + ((i-1) & 1))));
+ pBoxF = ::lcl_CreateAFmtBoxFmt( *this, aBoxFmtArr, *pTAFmt,
+ nCols, nId );
+
+ // ggfs. noch die Absatz/ZeichenAttribute setzen
+ if( pTAFmt->IsFont() || pTAFmt->IsJustify() )
+ {
+ aCharSet.ClearItem();
+ pTAFmt->UpdateToSet( nId, aCharSet,
+ SwTableAutoFmt::UPDATE_CHAR, 0 );
+ if( aCharSet.Count() )
+ GetNodes()[ aNdIdx.GetIndex()+1 ]->GetCntntNode()->
+ SetAttr( aCharSet );
+ }
+ }
+ else if( bDfltBorders )
+ {
+ sal_uInt8 nBoxId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 );
+ pBoxF = ::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr, nCols, nBoxId);
+ }
+ else
+ pBoxF = pBoxFmt;
+
+ // fuer AutoFormat bei der Eingabe: beim Einfuegen der Tabelle
+ // werden gleich die Spalten gesetzt. Im Array stehen die
+ // Positionen der Spalten!! (nicht deren Breite!)
+ if( pColArr )
+ {
+ nWidth = (*pColArr)[ sal_uInt16(i + 1) ] - (*pColArr)[ i ];
+ if( pBoxF->GetFrmSize().GetWidth() != nWidth )
+ {
+ if( pBoxF->GetDepends() ) // neues Format erzeugen!
+ {
+ SwTableBoxFmt *pNewFmt = MakeTableBoxFmt();
+ *pNewFmt = *pBoxF;
+ pBoxF = pNewFmt;
+ }
+ pBoxF->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth ));
+ }
+ }
+
+ SwTableBox *pBox = new SwTableBox( pBoxF, aNdIdx, pLine);
+ rBoxes.C40_INSERT( SwTableBox, pBox, i );
+ aNdIdx += 3; // StartNode, TextNode, EndNode == 3 Nodes
+ }
+ }
+ // und Frms einfuegen.
+ GetNodes().GoNext( &aNdIdx ); // zum naechsten ContentNode
+ pTblNd->MakeFrms( &aNdIdx );
+
+ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ {
+ SwPaM aPam( *pTblNd->EndOfSectionNode(), *pTblNd, 1 );
+ if( IsRedlineOn() )
+ AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ else
+ SplitRedline( aPam );
+ }
+
+ SetModified();
+ CHECK_TABLE( *pNdTbl );
+ return pNdTbl;
+}
+
+SwTableNode* SwNodes::InsertTable( const SwNodeIndex& rNdIdx,
+ sal_uInt16 nBoxes,
+ SwTxtFmtColl* pCntntTxtColl,
+ sal_uInt16 nLines,
+ sal_uInt16 nRepeat,
+ SwTxtFmtColl* pHeadlineTxtColl,
+ const SwAttrSet * pAttrSet)
+{
+ if( !nBoxes )
+ return 0;
+
+ // wenn Lines angegeben, erzeuge die Matrix aus Lines & Boxen
+ if( !pHeadlineTxtColl || !nLines )
+ pHeadlineTxtColl = pCntntTxtColl;
+
+ SwTableNode * pTblNd = new SwTableNode( rNdIdx );
+ SwEndNode* pEndNd = new SwEndNode( rNdIdx, *pTblNd );
+
+ if( !nLines ) // fuer die FOR-Schleife
+ ++nLines;
+
+ SwNodeIndex aIdx( *pEndNd );
+ SwTxtFmtColl* pTxtColl = pHeadlineTxtColl;
+ for( sal_uInt16 nL = 0; nL < nLines; ++nL )
+ {
+ for( sal_uInt16 nB = 0; nB < nBoxes; ++nB )
+ {
+ SwStartNode* pSttNd = new SwStartNode( aIdx, ND_STARTNODE,
+ SwTableBoxStartNode );
+ pSttNd->pStartOfSection = pTblNd;
+
+ SwTxtNode * pTmpNd = new SwTxtNode( aIdx, pTxtColl );
+
+ // --> FME 2006-04-13 #i60422# Propagate some more attributes.
+ // Adjustment was done for #109161#
+ const SfxPoolItem* pItem = NULL;
+ if ( NULL != pAttrSet )
+ {
+ static const sal_uInt16 aPropagateItems[] = {
+ RES_PARATR_ADJUST,
+ RES_CHRATR_FONT, RES_CHRATR_FONTSIZE,
+ RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONTSIZE,
+ RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONTSIZE, 0 };
+
+ const sal_uInt16* pIdx = aPropagateItems;
+ while ( *pIdx != 0 )
+ {
+ if ( SFX_ITEM_SET != pTmpNd->GetSwAttrSet().GetItemState( *pIdx ) &&
+ SFX_ITEM_SET == pAttrSet->GetItemState( *pIdx, sal_True, &pItem ) )
+ static_cast<SwCntntNode *>(pTmpNd)->SetAttr(*pItem);
+ ++pIdx;
+ }
+ }
+ // <--
+
+ new SwEndNode( aIdx, *pSttNd );
+ }
+ if ( nL + 1 >= nRepeat )
+ pTxtColl = pCntntTxtColl;
+ }
+ return pTblNd;
+}
+
+
+//---------------- Text -> Tabelle -----------------------
+
+const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
+ const SwPaM& rRange, sal_Unicode cCh,
+ sal_Int16 eAdjust,
+ const SwTableAutoFmt* pTAFmt )
+{
+ // pruefe ob in der Selection eine Tabelle liegt
+ const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
+ {
+ sal_uLong nCnt = pStt->nNode.GetIndex();
+ for( ; nCnt <= pEnd->nNode.GetIndex(); ++nCnt )
+ if( !GetNodes()[ nCnt ]->IsTxtNode() )
+ return 0;
+ }
+
+ /* #106283# Save first node in the selection if it is a context node. */
+ SwCntntNode * pSttCntntNd = pStt->nNode.GetNode().GetCntntNode();
+
+ SwPaM aOriginal( *pStt, *pEnd );
+ pStt = aOriginal.GetMark();
+ pEnd = aOriginal.GetPoint();
+
+#ifdef DEL_TABLE_REDLINES
+ lcl_DelRedlines aDelRedl( aOriginal );
+#endif
+
+ SwUndoTxtToTbl* pUndo = 0;
+ if( GetIDocumentUndoRedo().DoesUndo() )
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE, NULL );
+ pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh,
+ static_cast<sal_uInt16>(eAdjust), pTAFmt );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+
+ // das Splitten vom TextNode nicht in die Undohistory aufnehmen
+ GetIDocumentUndoRedo().DoUndo( false );
+ }
+
+ ::PaMCorrAbs( aOriginal, *pEnd );
+
+ // sorge dafuer, das der Bereich auf Node-Grenzen liegt
+ SwNodeRange aRg( pStt->nNode, pEnd->nNode );
+ if( pStt->nContent.GetIndex() )
+ SplitNode( *pStt, false );
+
+ sal_Bool bEndCntnt = 0 != pEnd->nContent.GetIndex();
+ // nicht splitten am Ende der Zeile (aber am Ende vom Doc!!)
+ if( bEndCntnt )
+ {
+ if( pEnd->nNode.GetNode().GetCntntNode()->Len() != pEnd->nContent.GetIndex()
+ || pEnd->nNode.GetIndex() >= GetNodes().GetEndOfContent().GetIndex()-1 )
+ {
+ SplitNode( *pEnd, false );
+ ((SwNodeIndex&)pEnd->nNode)--;
+ ((SwIndex&)pEnd->nContent).Assign(
+ pEnd->nNode.GetNode().GetCntntNode(), 0 );
+ // ein Node und am Ende ??
+ if( pStt->nNode.GetIndex() >= pEnd->nNode.GetIndex() )
+ aRg.aStart--;
+ }
+ else
+ aRg.aEnd++;
+ }
+
+
+ if( aRg.aEnd.GetIndex() == aRg.aStart.GetIndex() )
+ {
+ ASSERT( sal_False, "Kein Bereich" );
+ aRg.aEnd++;
+ }
+
+ // Wir gehen jetzt immer ueber die Upper, um die Tabelle einzufuegen:
+ SwNode2Layout aNode2Layout( aRg.aStart.GetNode() );
+
+ GetIDocumentUndoRedo().DoUndo( 0 != pUndo );
+
+ // dann erstelle die Box/Line/Table-Struktur
+ SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt();
+ SwTableLineFmt* pLineFmt = MakeTableLineFmt();
+ SwTableFmt* pTableFmt = MakeTblFrmFmt( GetUniqueTblName(), GetDfltFrmFmt() );
+
+ // alle Zeilen haben die Fill-Order von links nach rechts !
+ pLineFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ));
+ // die Tabelle bekommt USHRT_MAX als default SSize
+ pTableFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX ));
+ if( !(rInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT) )
+ pTableFmt->SetFmtAttr( SwFmtLayoutSplit( sal_False ));
+
+ /* #106283# If the first node in the selection is a context node and if it
+ has an item FRAMEDIR set (no default) propagate the item to the
+ replacing table. */
+ if (pSttCntntNd)
+ {
+ const SwAttrSet & aNdSet = pSttCntntNd->GetSwAttrSet();
+ const SfxPoolItem *pItem = NULL;
+
+ if (SFX_ITEM_SET == aNdSet.GetItemState( RES_FRAMEDIR, sal_True, &pItem )
+ && pItem != NULL)
+ {
+ pTableFmt->SetFmtAttr( *pItem );
+ }
+ }
+
+ SwTableNode* pTblNd = GetNodes().TextToTable(
+ aRg, cCh, pTableFmt, pLineFmt, pBoxFmt,
+ GetTxtCollFromPool( RES_POOLCOLL_STANDARD ), pUndo );
+
+ SwTable * pNdTbl = &pTblNd->GetTable();
+ ASSERT( pNdTbl, "kein Tabellen-Node angelegt." )
+
+ const sal_uInt16 nRowsToRepeat =
+ tabopts::HEADLINE == (rInsTblOpts.mnInsMode & tabopts::HEADLINE) ?
+ rInsTblOpts.mnRowsToRepeat :
+ 0;
+ pNdTbl->SetRowsToRepeat( nRowsToRepeat );
+
+ sal_Bool bUseBoxFmt = sal_False;
+ if( !pBoxFmt->GetDepends() )
+ {
+ // die Formate an den Boxen haben schon die richtige Size, es darf
+ // also nur noch die richtige Umrandung/AutoFmt gesetzt werden.
+ bUseBoxFmt = sal_True;
+ pTableFmt->SetFmtAttr( pBoxFmt->GetFrmSize() );
+ delete pBoxFmt;
+ eAdjust = text::HoriOrientation::NONE;
+ }
+
+ //Orientation am Fmt der Table setzen
+ pTableFmt->SetFmtAttr( SwFmtHoriOrient( 0, eAdjust ) );
+ pNdTbl->RegisterToFormat( *pTableFmt );
+
+ if( pTAFmt || ( rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) )
+ {
+ sal_uInt8 nBoxArrLen = pTAFmt ? 16 : 4;
+ SvPtrarr aBoxFmtArr( nBoxArrLen, 0 );
+ {
+ for( sal_uInt8 i = 0; i < nBoxArrLen; ++i )
+ aBoxFmtArr.Insert( (void*)0, i );
+ }
+
+ // --> OD 2008-02-25 #refactorlists#
+// SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_END-1 );
+ SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1 );
+ // <--
+ SwHistory* pHistory = pUndo ? &pUndo->GetHistory() : 0;
+
+ SwTableBoxFmt *pBoxF = 0;
+ SwTableLines& rLines = pNdTbl->GetTabLines();
+ sal_uInt16 nRows = rLines.Count();
+ for( sal_uInt16 n = 0; n < nRows; ++n )
+ {
+ SwTableBoxes& rBoxes = rLines[ n ]->GetTabBoxes();
+ sal_uInt16 nCols = rBoxes.Count();
+ for( sal_uInt16 i = 0; i < nCols; ++i )
+ {
+ SwTableBox* pBox = rBoxes[ i ];
+ sal_Bool bChgSz = sal_False;
+
+ if( pTAFmt )
+ {
+ sal_uInt8 nId = static_cast<sal_uInt8>(!n ? 0 : (( n+1 == nRows )
+ ? 12 : (4 * (1 + ((n-1) & 1 )))));
+ nId = nId + static_cast<sal_uInt8>(!i ? 0 :
+ ( i+1 == nCols ? 3 : (1 + ((i-1) & 1))));
+ if( bUseBoxFmt )
+ ::lcl_SetDfltBoxAttr( *pBox, aBoxFmtArr, nId, pTAFmt );
+ else
+ {
+ bChgSz = 0 == aBoxFmtArr[ nId ];
+ pBoxF = ::lcl_CreateAFmtBoxFmt( *this, aBoxFmtArr,
+ *pTAFmt, USHRT_MAX, nId );
+ }
+
+ // ggfs. noch die Absatz/ZeichenAttribute setzen
+ if( pTAFmt->IsFont() || pTAFmt->IsJustify() )
+ {
+ aCharSet.ClearItem();
+ pTAFmt->UpdateToSet( nId, aCharSet,
+ SwTableAutoFmt::UPDATE_CHAR, 0 );
+ if( aCharSet.Count() )
+ {
+ sal_uLong nSttNd = pBox->GetSttIdx()+1;
+ sal_uLong nEndNd = pBox->GetSttNd()->EndOfSectionIndex();
+ for( ; nSttNd < nEndNd; ++nSttNd )
+ {
+ SwCntntNode* pNd = GetNodes()[ nSttNd ]->GetCntntNode();
+ if( pNd )
+ {
+ if( pHistory )
+ {
+ SwRegHistory aReg( pNd, *pNd, pHistory );
+ pNd->SetAttr( aCharSet );
+ }
+ else
+ pNd->SetAttr( aCharSet );
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ sal_uInt8 nId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 );
+ if( bUseBoxFmt )
+ ::lcl_SetDfltBoxAttr( *pBox, aBoxFmtArr, nId );
+ else
+ {
+ bChgSz = 0 == aBoxFmtArr[ nId ];
+ pBoxF = ::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr,
+ USHRT_MAX, nId );
+ }
+ }
+
+ if( !bUseBoxFmt )
+ {
+ if( bChgSz )
+ pBoxF->SetFmtAttr( pBox->GetFrmFmt()->GetFrmSize() );
+ pBox->ChgFrmFmt( pBoxF );
+ }
+ }
+ }
+
+ if( bUseBoxFmt )
+ {
+ for( sal_uInt8 i = 0; i < nBoxArrLen; ++i )
+ {
+ SvPtrarr* pArr = (SvPtrarr*)aBoxFmtArr[ i ];
+ delete pArr;
+ }
+ }
+ }
+
+ // JP 03.04.97: Inhalt der Boxen auf Zahlen abpruefen
+ if( IsInsTblFormatNum() )
+ {
+ for( sal_uInt16 nBoxes = pNdTbl->GetTabSortBoxes().Count(); nBoxes; )
+ ChkBoxNumFmt( *pNdTbl->GetTabSortBoxes()[ --nBoxes ], sal_False );
+ }
+
+ sal_uLong nIdx = pTblNd->GetIndex();
+ aNode2Layout.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 );
+
+ {
+ SwPaM& rTmp = (SwPaM&)rRange; // Point immer an den Anfang
+ rTmp.DeleteMark();
+ rTmp.GetPoint()->nNode = *pTblNd;
+ SwCntntNode* pCNd = GetNodes().GoNext( &rTmp.GetPoint()->nNode );
+ rTmp.GetPoint()->nContent.Assign( pCNd, 0 );
+ }
+
+ if( pUndo )
+ {
+ GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE, NULL );
+ }
+
+ SetModified();
+ SetFieldsDirty(true, NULL, 0);
+ return pNdTbl;
+}
+
+SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
+ SwTableFmt* pTblFmt,
+ SwTableLineFmt* pLineFmt,
+ SwTableBoxFmt* pBoxFmt,
+ SwTxtFmtColl* pTxtColl,
+ SwUndoTxtToTbl* pUndo )
+{
+ if( rRange.aStart >= rRange.aEnd )
+ return 0;
+
+ SwTableNode * pTblNd = new SwTableNode( rRange.aStart );
+ new SwEndNode( rRange.aEnd, *pTblNd );
+
+ SwDoc* pDoc = GetDoc();
+ SvUShorts aPosArr( 0, 16 );
+ SwTable * pTable = &pTblNd->GetTable();
+ SwTableLine* pLine;
+ SwTableBox* pBox;
+ sal_uInt16 nBoxes, nLines, nMaxBoxes = 0;
+
+ SwNodeIndex aSttIdx( *pTblNd, 1 );
+ SwNodeIndex aEndIdx( rRange.aEnd, -1 );
+ for( nLines = 0, nBoxes = 0;
+ aSttIdx.GetIndex() < aEndIdx.GetIndex();
+ aSttIdx += 2, nLines++, nBoxes = 0 )
+ {
+ SwTxtNode* pTxtNd = aSttIdx.GetNode().GetTxtNode();
+ ASSERT( pTxtNd, "nur TextNodes in der Tabelle aufnehmen" );
+
+ if( !nLines && 0x0b == cCh )
+ {
+ cCh = 0x09;
+
+ // JP 28.10.96: vom 1. Node die Positionen des Trenners besorgen,
+ // damit die Boxen entsprechend eingestellt werden
+ SwTxtFrmInfo aFInfo( (SwTxtFrm*)pTxtNd->getLayoutFrm( pTxtNd->GetDoc()->GetCurrentLayout() ) );
+ if( aFInfo.IsOneLine() ) // nur dann sinnvoll!
+ {
+ const sal_Unicode* pTxt = pTxtNd->GetTxt().GetBuffer();
+ for( xub_StrLen nChPos = 0; *pTxt; ++nChPos, ++pTxt )
+ {
+ if( *pTxt == cCh )
+ {
+ aPosArr.Insert( static_cast<sal_uInt16>(
+ aFInfo.GetCharPos( nChPos+1, sal_False )),
+ aPosArr.Count() );
+ }
+ }
+
+ aPosArr.Insert( /*aFInfo.GetFrm()->Frm().Left() +*/
+ static_cast<sal_uInt16>(aFInfo.GetFrm()->IsVertical() ?
+ aFInfo.GetFrm()->Prt().Bottom() :
+ aFInfo.GetFrm()->Prt().Right()),
+ aPosArr.Count() );
+ }
+ }
+
+ // die alten Frames loeschen, es werden neue erzeugt
+ pTxtNd->DelFrms();
+
+ // PageBreaks/PageDesc/ColBreak rausschmeissen.
+ const SfxItemSet* pSet = pTxtNd->GetpSwAttrSet();
+ if( pSet )
+ {
+// das entfernen der PageBreaks erst nach dem erzeugen der Tabelle
+// erfolgen, denn sonst stehen sie falsch in der History !!!
+// SwRegHistory aRegH( pTxtNd, *pTxtNd, pHistory );
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False, &pItem ) )
+ {
+ if( !nLines )
+ pTblFmt->SetFmtAttr( *pItem );
+ pTxtNd->ResetAttr( RES_BREAK );
+ pSet = pTxtNd->GetpSwAttrSet();
+ }
+
+ if( pSet && SFX_ITEM_SET == pSet->GetItemState(
+ RES_PAGEDESC, sal_False, &pItem ) &&
+ ((SwFmtPageDesc*)pItem)->GetPageDesc() )
+ {
+ if( !nLines )
+ pTblFmt->SetFmtAttr( *pItem );
+ pTxtNd->ResetAttr( RES_PAGEDESC );
+ }
+ }
+
+ // setze den bei allen TextNode in der Tabelle den TableNode
+ // als StartNode
+ pTxtNd->pStartOfSection = pTblNd;
+
+ pLine = new SwTableLine( pLineFmt, 1, 0 );
+ pTable->GetTabLines().C40_INSERT( SwTableLine, pLine, nLines );
+
+ SwStartNode* pSttNd;
+ SwPosition aCntPos( aSttIdx, SwIndex( pTxtNd ));
+
+ SvULongs aBkmkArr( 15, 15 );
+ _SaveCntntIdx( pDoc, aSttIdx.GetIndex(), pTxtNd->GetTxt().Len(), aBkmkArr );
+
+ const sal_Unicode* pTxt = pTxtNd->GetTxt().GetBuffer();
+
+ if( T2T_PARA != cCh )
+ for( xub_StrLen nChPos = 0; *pTxt; ++nChPos, ++pTxt )
+ if( *pTxt == cCh )
+ {
+ aCntPos.nContent = nChPos;
+ SwCntntNode* pNewNd = pTxtNd->SplitCntntNode( aCntPos );
+
+ if( aBkmkArr.Count() )
+ _RestoreCntntIdx( aBkmkArr, *pNewNd, nChPos,
+ nChPos + 1 );
+
+ // Trennzeichen loeschen und SuchString korrigieren
+ pTxtNd->EraseText( aCntPos.nContent, 1 );
+ pTxt = pTxtNd->GetTxt().GetBuffer();
+ nChPos = 0;
+ --nChPos, --pTxt; // for the ++ in the for loop !!!
+
+ // setze bei allen TextNodes in der Tabelle den TableNode
+ // als StartNode
+ const SwNodeIndex aTmpIdx( aCntPos.nNode, -1 );
+ pSttNd = new SwStartNode( aTmpIdx, ND_STARTNODE,
+ SwTableBoxStartNode );
+ new SwEndNode( aCntPos.nNode, *pSttNd );
+ pNewNd->pStartOfSection = pSttNd;
+
+ // Section der Box zuweisen
+ pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
+ pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ );
+ }
+
+ // und jetzt den letzten Teil-String
+ if( aBkmkArr.Count() )
+ _RestoreCntntIdx( aBkmkArr, *pTxtNd, pTxtNd->GetTxt().Len(),
+ pTxtNd->GetTxt().Len()+1 );
+
+ pSttNd = new SwStartNode( aCntPos.nNode, ND_STARTNODE, SwTableBoxStartNode );
+ const SwNodeIndex aTmpIdx( aCntPos.nNode, 1 );
+ new SwEndNode( aTmpIdx, *pSttNd );
+ pTxtNd->pStartOfSection = pSttNd;
+
+ pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
+ pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ );
+ if( nMaxBoxes < nBoxes )
+ nMaxBoxes = nBoxes;
+ }
+
+ // die Tabelle ausgleichen, leere Sections einfuegen
+ sal_uInt16 n;
+
+ for( n = 0; n < pTable->GetTabLines().Count(); ++n )
+ {
+ SwTableLine* pCurrLine = pTable->GetTabLines()[ n ];
+ if( nMaxBoxes != ( nBoxes = pCurrLine->GetTabBoxes().Count() ))
+ {
+ InsBoxen( pTblNd, pCurrLine, pBoxFmt, pTxtColl, 0,
+ nBoxes, nMaxBoxes - nBoxes );
+
+ if( pUndo )
+ for( sal_uInt16 i = nBoxes; i < nMaxBoxes; ++i )
+ pUndo->AddFillBox( *pCurrLine->GetTabBoxes()[ i ] );
+
+ // fehlen der 1. Line Boxen, dann kann man das Breiten Array
+ // vergessen!
+ if( !n )
+ aPosArr.Remove( 0, aPosArr.Count() );
+ }
+ }
+
+ if( aPosArr.Count() )
+ {
+ SwTableLines& rLns = pTable->GetTabLines();
+ sal_uInt16 nLastPos = 0;
+ for( n = 0; n < aPosArr.Count(); ++n )
+ {
+ SwTableBoxFmt *pNewFmt = pDoc->MakeTableBoxFmt();
+ pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE,
+ aPosArr[ n ] - nLastPos ));
+ for( sal_uInt16 nTmpLine = 0; nTmpLine < rLns.Count(); ++nTmpLine )
+ //JP 24.06.98: hier muss ein Add erfolgen, da das BoxFormat
+ // von der rufenden Methode noch gebraucht wird!
+ pNewFmt->Add( rLns[ nTmpLine ]->GetTabBoxes()[ n ] );
+
+ nLastPos = aPosArr[ n ];
+ }
+
+ // damit die Tabelle die richtige Groesse bekommt, im BoxFormat die
+ // Groesse nach "oben" transportieren.
+ ASSERT( !pBoxFmt->GetDepends(), "wer ist in dem Format noch angemeldet" );
+ pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nLastPos ));
+ }
+ else
+ pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX / nMaxBoxes ));
+
+ // das wars doch wohl ??
+ return pTblNd;
+}
+/*-- 18.05.2006 10:30:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes )
+{
+ /* #106283# Save first node in the selection if it is a content node. */
+ SwCntntNode * pSttCntntNd = rTableNodes.begin()->begin()->aStart.GetNode().GetCntntNode();
+
+ /**debug**/
+#if OSL_DEBUG_LEVEL > 1
+ const SwNodeRange& rStartRange = *rTableNodes.begin()->begin();
+ const SwNodeRange& rEndRange = *rTableNodes.rbegin()->rbegin();
+ (void) rStartRange;
+ (void) rEndRange;
+#endif
+ /**debug**/
+
+ //!!! not necessarily TextNodes !!!
+ SwPaM aOriginal( rTableNodes.begin()->begin()->aStart, rTableNodes.rbegin()->rbegin()->aEnd );
+ const SwPosition *pStt = aOriginal.GetMark();
+ const SwPosition *pEnd = aOriginal.GetPoint();
+
+#ifdef DEL_TABLE_REDLINES
+ lcl_DelRedlines aDelRedl( aOriginal );
+#endif
+
+// SwUndoTxtToTbl* pUndo = 0;
+ bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
+ if (bUndo)
+ {
+ // das Splitten vom TextNode nicht in die Undohistory aufnehmen
+ GetIDocumentUndoRedo().DoUndo(false);
+ }
+
+ ::PaMCorrAbs( aOriginal, *pEnd );
+
+ // sorge dafuer, das der Bereich auf Node-Grenzen liegt
+ SwNodeRange aRg( pStt->nNode, pEnd->nNode );
+ if( pStt->nContent.GetIndex() )
+ SplitNode( *pStt, false );
+
+ sal_Bool bEndCntnt = 0 != pEnd->nContent.GetIndex();
+ // nicht splitten am Ende der Zeile (aber am Ende vom Doc!!)
+ if( bEndCntnt )
+ {
+ if( pEnd->nNode.GetNode().GetCntntNode()->Len() != pEnd->nContent.GetIndex()
+ || pEnd->nNode.GetIndex() >= GetNodes().GetEndOfContent().GetIndex()-1 )
+ {
+ SplitNode( *pEnd, false );
+ ((SwNodeIndex&)pEnd->nNode)--;
+ ((SwIndex&)pEnd->nContent).Assign(
+ pEnd->nNode.GetNode().GetCntntNode(), 0 );
+ // ein Node und am Ende ??
+ if( pStt->nNode.GetIndex() >= pEnd->nNode.GetIndex() )
+ aRg.aStart--;
+ }
+ else
+ aRg.aEnd++;
+ }
+
+
+ if( aRg.aEnd.GetIndex() == aRg.aStart.GetIndex() )
+ {
+ ASSERT( sal_False, "Kein Bereich" );
+ aRg.aEnd++;
+ }
+
+ // Wir gehen jetzt immer ueber die Upper, um die Tabelle einzufuegen:
+ SwNode2Layout aNode2Layout( aRg.aStart.GetNode() );
+
+ GetIDocumentUndoRedo().DoUndo(bUndo);
+
+ // dann erstelle die Box/Line/Table-Struktur
+ SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt();
+ SwTableLineFmt* pLineFmt = MakeTableLineFmt();
+ SwTableFmt* pTableFmt = MakeTblFrmFmt( GetUniqueTblName(), GetDfltFrmFmt() );
+
+ // alle Zeilen haben die Fill-Order von links nach rechts !
+ pLineFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ));
+ // die Tabelle bekommt USHRT_MAX als default SSize
+ pTableFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX ));
+
+ /* #106283# If the first node in the selection is a context node and if it
+ has an item FRAMEDIR set (no default) propagate the item to the
+ replacing table. */
+ if (pSttCntntNd)
+ {
+ const SwAttrSet & aNdSet = pSttCntntNd->GetSwAttrSet();
+ const SfxPoolItem *pItem = NULL;
+
+ if (SFX_ITEM_SET == aNdSet.GetItemState( RES_FRAMEDIR, sal_True, &pItem )
+ && pItem != NULL)
+ {
+ pTableFmt->SetFmtAttr( *pItem );
+ }
+ }
+
+ SwTableNode* pTblNd = GetNodes().TextToTable(
+ rTableNodes, pTableFmt, pLineFmt, pBoxFmt,
+ GetTxtCollFromPool( RES_POOLCOLL_STANDARD )/*, pUndo*/ );
+
+ SwTable * pNdTbl = &pTblNd->GetTable();
+ ASSERT( pNdTbl, "kein Tabellen-Node angelegt." )
+ pNdTbl->RegisterToFormat( *pTableFmt );
+
+ sal_Bool bUseBoxFmt = sal_False;
+ if( !pBoxFmt->GetDepends() )
+ {
+ // die Formate an den Boxen haben schon die richtige Size, es darf
+ // also nur noch die richtige Umrandung/AutoFmt gesetzt werden.
+ bUseBoxFmt = sal_True;
+ pTableFmt->SetFmtAttr( pBoxFmt->GetFrmSize() );
+ delete pBoxFmt;
+ }
+
+ sal_uLong nIdx = pTblNd->GetIndex();
+ aNode2Layout.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 );
+
+ SetModified();
+ SetFieldsDirty( true, NULL, 0 );
+ return pNdTbl;
+}
+
+SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange)
+{
+ SwNodeRange * pResult = NULL;
+ bool bChanged = false;
+
+ SwNodeIndex aNewStart = rRange.aStart;
+ SwNodeIndex aNewEnd = rRange.aEnd;
+
+ SwNodeIndex aEndIndex = rRange.aEnd;
+ SwNodeIndex aIndex = rRange.aStart;
+
+ while (aIndex < aEndIndex)
+ {
+ SwNode& rNode = aIndex.GetNode();
+
+ if (rNode.IsStartNode())
+ {
+ // advance aIndex to the end node of this start node
+ SwNode * pEndNode = rNode.EndOfSectionNode();
+ aIndex = *pEndNode;
+
+ if (aIndex > aNewEnd)
+ {
+ aNewEnd = aIndex;
+ bChanged = true;
+ }
+ }
+ else if (rNode.IsEndNode())
+ {
+ SwNode * pStartNode = rNode.StartOfSectionNode();
+ SwNodeIndex aStartIndex = *pStartNode;
+
+ if (aStartIndex < aNewStart)
+ {
+ aNewStart = aStartIndex;
+ bChanged = true;
+ }
+ }
+
+ if (aIndex < aEndIndex)
+ ++aIndex;
+ }
+
+ SwNode * pNode = &aIndex.GetNode();
+ while (pNode->IsEndNode())
+ {
+ SwNode * pStartNode = pNode->StartOfSectionNode();
+ SwNodeIndex aStartIndex(*pStartNode);
+ aNewStart = aStartIndex;
+ aNewEnd = aIndex;
+ bChanged = true;
+
+ ++aIndex;
+ pNode = &aIndex.GetNode();
+ }
+
+ if (bChanged)
+ pResult = new SwNodeRange(aNewStart, aNewEnd);
+
+ return pResult;
+}
+
+/*-- 18.05.2006 08:23:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
+ SwTableFmt* pTblFmt,
+ SwTableLineFmt* pLineFmt,
+ SwTableBoxFmt* pBoxFmt,
+ SwTxtFmtColl* /*pTxtColl*/ /*, SwUndo... pUndo*/ )
+{
+ if( !rTableNodes.size() )
+ return 0;
+
+ SwTableNode * pTblNd = new SwTableNode( rTableNodes.begin()->begin()->aStart );
+ //insert the end node after the last text node
+ SwNodeIndex aInsertIndex( rTableNodes.rbegin()->rbegin()->aEnd );
+ ++aInsertIndex;
+
+ //!! owner ship will be transferred in c-tor to SwNodes array.
+ //!! Thus no real problem here...
+ new SwEndNode( aInsertIndex, *pTblNd );
+
+#if OSL_DEBUG_LEVEL > 1
+ /**debug**/
+ const SwNodeRange& rStartRange = *rTableNodes.begin()->begin();
+ const SwNodeRange& rEndRange = *rTableNodes.rbegin()->rbegin();
+ (void) rStartRange;
+ (void) rEndRange;
+ /**debug**/
+#endif
+
+ SwDoc* pDoc = GetDoc();
+ SvUShorts aPosArr( 0, 16 );
+ SwTable * pTable = &pTblNd->GetTable();
+ SwTableLine* pLine;
+ SwTableBox* pBox;
+ sal_uInt16 nBoxes, nLines, nMaxBoxes = 0;
+
+// SwHistory* pHistory = pUndo ? &pUndo->GetHistory() : 0;
+
+
+ SwNodeIndex aNodeIndex = rTableNodes.begin()->begin()->aStart;
+ // delete frames of all contained content nodes
+ for( nLines = 0; aNodeIndex <= rTableNodes.rbegin()->rbegin()->aEnd; ++aNodeIndex,++nLines )
+ {
+ SwNode& rNode = aNodeIndex.GetNode();
+ if( rNode.IsCntntNode() )
+ {
+ static_cast<SwCntntNode&>(rNode).DelFrms();
+ if(rNode.IsTxtNode())
+ {
+ SwTxtNode& rTxtNode = static_cast<SwTxtNode&>(rNode);
+ // setze den bei allen TextNode in der Tabelle den TableNode
+ // als StartNode
+// FIXME: this is setting wrong node StartOfSections in nested tables.
+// rTxtNode.pStartOfSection = pTblNd;
+ // remove PageBreaks/PageDesc/ColBreak
+ const SwAttrSet* pSet = rTxtNode.GetpSwAttrSet();
+ if( pSet )
+ {
+ // das entfernen der PageBreaks erst nach dem erzeugen der Tabelle
+ // erfolgen, denn sonst stehen sie falsch in der History !!!
+ // SwRegHistory aRegH( pTxtNd, *pTxtNd, pHistory );
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False, &pItem ) )
+ {
+ if( !nLines )
+ pTblFmt->SetFmtAttr( *pItem );
+ rTxtNode.ResetAttr( RES_BREAK );
+ pSet = rTxtNode.GetpSwAttrSet();
+ }
+
+ if( pSet && SFX_ITEM_SET == pSet->GetItemState(
+ RES_PAGEDESC, sal_False, &pItem ) &&
+ ((SwFmtPageDesc*)pItem)->GetPageDesc() )
+ {
+ if( !nLines )
+ pTblFmt->SetFmtAttr( *pItem );
+ rTxtNode.ResetAttr( RES_PAGEDESC );
+ }
+ }
+ }
+ }
+ }
+
+// SwNodeIndex aSttIdx( *pTblNd, 1 );
+// SwNodeIndex aEndIdx( rlNodes.rbegin()->aEnd, -1 );
+ std::vector<std::vector < SwNodeRange > >::const_iterator aRowIter = rTableNodes.begin();
+ for( nLines = 0, nBoxes = 0;
+ aRowIter != rTableNodes.end();
+ ++aRowIter, /*aSttIdx += 2, */nLines++, nBoxes = 0 )
+ {
+// SwTxtNode* pTxtNd = aSttIdx.GetNode().GetTxtNode();
+// ASSERT( pTxtNd, "nur TextNodes in der Tabelle aufnehmen" );
+
+ pLine = new SwTableLine( pLineFmt, 1, 0 );
+ pTable->GetTabLines().C40_INSERT( SwTableLine, pLine, nLines );
+
+// SwStartNode* pSttNd;
+// SwPosition aCntPos( aSttIdx, SwIndex( pTxtNd ));
+
+ std::vector< SwNodeRange >::const_iterator aCellIter = aRowIter->begin();
+// SvULongs aBkmkArr( 15, 15 );
+// _SaveCntntIdx( pDoc, aCellIter->aStart.GetIndex(), pTxtNd->GetTxt().Len(), aBkmkArr );
+// const sal_Unicode* pTxt = pTxtNd->GetTxt().GetBuffer();
+
+ for( ; aCellIter != aRowIter->end(); ++aCellIter )
+ {
+// aCellIter->aStart aCellIter->aEnd
+// aCntPos.nContent = nChPos;
+// SwCntntNode* pNewNd = pTxtNd->SplitNode( aCntPos );
+
+// auch f?rs undo?
+// if( aBkmkArr.Count() )
+// _RestoreCntntIdx( aBkmkArr, *pNewNd, nChPos,
+// nChPos + 1 );
+
+ const SwNodeIndex aTmpIdx( aCellIter->aStart, 0 );
+
+ SwNodeIndex aCellEndIdx(aCellIter->aEnd);
+ ++aCellEndIdx;
+ SwStartNode* pSttNd = new SwStartNode( aTmpIdx, ND_STARTNODE,
+ SwTableBoxStartNode );
+ new SwEndNode( aCellEndIdx, *pSttNd );
+ //set the start node on all node of the current cell
+ SwNodeIndex aCellNodeIdx = aCellIter->aStart;
+ for(;aCellNodeIdx <= aCellIter->aEnd; ++aCellNodeIdx )
+ {
+ aCellNodeIdx.GetNode().pStartOfSection = pSttNd;
+ //skip start/end node pairs
+ if( aCellNodeIdx.GetNode().IsStartNode() )
+ aCellNodeIdx = SwNodeIndex( *aCellNodeIdx.GetNode().EndOfSectionNode() );
+ }
+
+ // Section der Box zuweisen
+ pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
+ pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ );
+ }
+ if( nMaxBoxes < nBoxes )
+ nMaxBoxes = nBoxes;
+ }
+
+ // die Tabelle ausgleichen, leere Sections einfuegen
+ sal_uInt16 n;
+
+ if( aPosArr.Count() )
+ {
+ SwTableLines& rLns = pTable->GetTabLines();
+ sal_uInt16 nLastPos = 0;
+ for( n = 0; n < aPosArr.Count(); ++n )
+ {
+ SwTableBoxFmt *pNewFmt = pDoc->MakeTableBoxFmt();
+ pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE,
+ aPosArr[ n ] - nLastPos ));
+ for( sal_uInt16 nLines2 = 0; nLines2 < rLns.Count(); ++nLines2 )
+ //JP 24.06.98: hier muss ein Add erfolgen, da das BoxFormat
+ // von der rufenden Methode noch gebraucht wird!
+ pNewFmt->Add( rLns[ nLines2 ]->GetTabBoxes()[ n ] );
+
+ nLastPos = aPosArr[ n ];
+ }
+
+ // damit die Tabelle die richtige Groesse bekommt, im BoxFormat die
+ // Groesse nach "oben" transportieren.
+ ASSERT( !pBoxFmt->GetDepends(), "wer ist in dem Format noch angemeldet" );
+ pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nLastPos ));
+ }
+ else
+ pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX / nMaxBoxes ));
+
+ // das wars doch wohl ??
+ return pTblNd;
+}
+
+
+//---------------- Tabelle -> Text -----------------------
+
+
+sal_Bool SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh )
+{
+ if( !pTblNd )
+ return sal_False;
+
+ // --> FME 2004-09-28 #i34471#
+ // If this is trigged by SwUndoTblToTxt::Repeat() nobody ever deleted
+ // the table cursor.
+ SwEditShell* pESh = GetEditShell();
+ if( pESh && pESh->IsTableMode() )
+ pESh->ClearMark();
+ // <--
+
+#ifdef DEL_TABLE_REDLINES
+ lcl_DelRedlines aDelRedl( *pTblNd, sal_False );
+#endif
+
+ SwNodeRange aRg( *pTblNd, 0, *pTblNd->EndOfSectionNode() );
+ SwUndoTblToTxt* pUndo = 0;
+ SwNodeRange* pUndoRg = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ pUndoRg = new SwNodeRange( aRg.aStart, -1, aRg.aEnd, +1 );
+ pUndo = new SwUndoTblToTxt( pTblNd->GetTable(), cCh );
+ }
+
+ SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() );
+ aMsgHnt.eFlags = TBL_BOXNAME;
+ UpdateTblFlds( &aMsgHnt );
+
+ sal_Bool bRet = GetNodes().TableToText( aRg, cCh, pUndo );
+ if( pUndoRg )
+ {
+ pUndoRg->aStart++;
+ pUndoRg->aEnd--;
+ pUndo->SetRange( *pUndoRg );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ delete pUndoRg;
+ }
+
+ if( bRet )
+ SetModified();
+
+ return bRet;
+}
+
+// -- benutze die ForEach Methode vom PtrArray um aus einer Tabelle wieder
+// Text zuerzeugen. (Die Boxen koennen auch noch Lines enthalten !!)
+struct _DelTabPara
+{
+ SwTxtNode* pLastNd;
+ SwNodes& rNds;
+ SwUndoTblToTxt* pUndo;
+ sal_Unicode cCh;
+
+ _DelTabPara( SwNodes& rNodes, sal_Unicode cChar, SwUndoTblToTxt* pU ) :
+ pLastNd(0), rNds( rNodes ), pUndo( pU ), cCh( cChar ) {}
+ _DelTabPara( const _DelTabPara& rPara ) :
+ pLastNd(rPara.pLastNd), rNds( rPara.rNds ),
+ pUndo( rPara.pUndo ), cCh( rPara.cCh ) {}
+};
+
+// forward deklarieren damit sich die Lines und Boxen rekursiv aufrufen
+// koennen.
+sal_Bool lcl_DelBox( const SwTableBox*&, void *pPara );
+
+sal_Bool lcl_DelLine( const SwTableLine*& rpLine, void* pPara )
+{
+ ASSERT( pPara, "die Parameter fehlen" );
+ _DelTabPara aPara( *(_DelTabPara*)pPara );
+ ((SwTableLine*&)rpLine)->GetTabBoxes().ForEach( &lcl_DelBox, &aPara );
+ if( rpLine->GetUpper() ) // gibt es noch eine uebergeordnete Box ??
+ // dann gebe den letzten TextNode zurueck
+ ((_DelTabPara*)pPara)->pLastNd = aPara.pLastNd;
+ return sal_True;
+}
+
+
+sal_Bool lcl_DelBox( const SwTableBox*& rpBox, void* pPara )
+{
+ ASSERT( pPara, "die Parameter fehlen" );
+
+ // loesche erstmal die Lines der Box
+ _DelTabPara* pDelPara = (_DelTabPara*)pPara;
+ if( rpBox->GetTabLines().Count() )
+ ((SwTableBox*&)rpBox)->GetTabLines().ForEach( &lcl_DelLine, pDelPara );
+ else
+ {
+ SwDoc* pDoc = pDelPara->rNds.GetDoc();
+ SwNodeRange aDelRg( *rpBox->GetSttNd(), 0,
+ *rpBox->GetSttNd()->EndOfSectionNode() );
+ // loesche die Section
+ pDelPara->rNds.SectionUp( &aDelRg );
+ const SwTxtNode* pCurTxtNd;
+ if( T2T_PARA != pDelPara->cCh && pDelPara->pLastNd &&
+ 0 != ( pCurTxtNd = aDelRg.aStart.GetNode().GetTxtNode() ))
+ {
+ // Join the current text node with the last from the previous box if possible
+ sal_uLong nNdIdx = aDelRg.aStart.GetIndex();
+ aDelRg.aStart--;
+ if( pDelPara->pLastNd == &aDelRg.aStart.GetNode() )
+ {
+ // Inserting the seperator
+ SwIndex aCntIdx( pDelPara->pLastNd, pDelPara->pLastNd->GetTxt().Len());
+ pDelPara->pLastNd->InsertText( pDelPara->cCh, aCntIdx,
+ IDocumentContentOperations::INS_EMPTYEXPAND );
+ if( pDelPara->pUndo )
+ pDelPara->pUndo->AddBoxPos( *pDoc, nNdIdx, aDelRg.aEnd.GetIndex(),
+ aCntIdx.GetIndex() );
+
+ SvULongs aBkmkArr( 4, 4 );
+ xub_StrLen nOldTxtLen = aCntIdx.GetIndex();
+ _SaveCntntIdx( pDoc, nNdIdx, pCurTxtNd->GetTxt().Len(),
+ aBkmkArr );
+
+ pDelPara->pLastNd->JoinNext();
+
+ if( aBkmkArr.Count() )
+ _RestoreCntntIdx( pDoc, aBkmkArr,
+ pDelPara->pLastNd->GetIndex(),
+ nOldTxtLen );
+ }
+ else if( pDelPara->pUndo )
+ {
+ aDelRg.aStart++;
+ pDelPara->pUndo->AddBoxPos( *pDoc, nNdIdx, aDelRg.aEnd.GetIndex() );
+ }
+ }
+ else if( pDelPara->pUndo )
+ pDelPara->pUndo->AddBoxPos( *pDoc, aDelRg.aStart.GetIndex(), aDelRg.aEnd.GetIndex() );
+ aDelRg.aEnd--;
+ pDelPara->pLastNd = aDelRg.aEnd.GetNode().GetTxtNode();
+
+ //JP 03.04.97: die Ausrichtung der ZahlenFormatierung auf
+ // keinen Fall uebernehmen
+ if( pDelPara->pLastNd && pDelPara->pLastNd->HasSwAttrSet() )
+ pDelPara->pLastNd->ResetAttr( RES_PARATR_ADJUST );
+ }
+ return sal_True;
+}
+
+
+sal_Bool SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh,
+ SwUndoTblToTxt* pUndo )
+{
+ // ist eine Tabelle selektiert ?
+ SwTableNode* pTblNd;
+ if( rRange.aStart.GetIndex() >= rRange.aEnd.GetIndex() ||
+ 0 == ( pTblNd = rRange.aStart.GetNode().GetTableNode()) ||
+ &rRange.aEnd.GetNode() != pTblNd->EndOfSectionNode() )
+ return sal_False;
+
+ // stand die Tabelle ganz alleine in einer Section ?
+ // dann ueber den Upper der Tabelle die Frames anlegen
+ SwNode2Layout* pNode2Layout = 0;
+ SwNodeIndex aFrmIdx( rRange.aStart );
+ SwNode* pFrmNd = FindPrvNxtFrmNode( aFrmIdx, &rRange.aEnd.GetNode() );
+ if( !pFrmNd )
+ // dann sammel mal alle Uppers ein
+ pNode2Layout = new SwNode2Layout( *pTblNd );
+
+ // loesche schon mal die Frames
+ pTblNd->DelFrms();
+
+ // dann "loeschen" die Tabellen und fasse alle Lines/Boxen zusammen
+ _DelTabPara aDelPara( *this, cCh, pUndo );
+ pTblNd->pTable->GetTabLines().ForEach( &lcl_DelLine, &aDelPara );
+
+ // jetzt ist aus jeder TableLine ein TextNode mit dem entsprechenden
+ // Trenner erzeugt worden. Es braucht nur noch die Table-Section
+ // geloescht und fuer die neuen TextNode die Frames erzeugt werden.
+ SwNodeRange aDelRg( rRange.aStart, rRange.aEnd );
+
+ // JP 14.01.97: hat die Tabelle PageDesc-/Break-Attribute? Dann in den
+ // ersten TextNode uebernehmen
+ {
+// was ist mit UNDO???
+ const SfxItemSet& rTblSet = pTblNd->pTable->GetFrmFmt()->GetAttrSet();
+ const SfxPoolItem *pBreak, *pDesc;
+ if( SFX_ITEM_SET != rTblSet.GetItemState( RES_PAGEDESC, sal_False, &pDesc ))
+ pDesc = 0;
+ if( SFX_ITEM_SET != rTblSet.GetItemState( RES_BREAK, sal_False, &pBreak ))
+ pBreak = 0;
+
+ if( pBreak || pDesc )
+ {
+ SwNodeIndex aIdx( *pTblNd );
+ SwCntntNode* pCNd = GoNext( &aIdx );
+ if( pBreak )
+ pCNd->SetAttr( *pBreak );
+ if( pDesc )
+ pCNd->SetAttr( *pDesc );
+ }
+ }
+
+ SectionUp( &aDelRg ); // loesche die Section und damit die Tabelle
+ // #i28006#
+ sal_uLong nStt = aDelRg.aStart.GetIndex(), nEnd = aDelRg.aEnd.GetIndex();
+ if( !pFrmNd )
+ {
+ pNode2Layout->RestoreUpperFrms( *this,
+ aDelRg.aStart.GetIndex(), aDelRg.aEnd.GetIndex() );
+ delete pNode2Layout;
+ }
+ else
+ {
+ SwCntntNode *pCNd;
+ SwSectionNode *pSNd;
+ while( aDelRg.aStart.GetIndex() < nEnd )
+ {
+ if( 0 != ( pCNd = aDelRg.aStart.GetNode().GetCntntNode()))
+ {
+ if( pFrmNd->IsCntntNode() )
+ ((SwCntntNode*)pFrmNd)->MakeFrms( *pCNd );
+ else if( pFrmNd->IsTableNode() )
+ ((SwTableNode*)pFrmNd)->MakeFrms( aDelRg.aStart );
+ else if( pFrmNd->IsSectionNode() )
+ ((SwSectionNode*)pFrmNd)->MakeFrms( aDelRg.aStart );
+ pFrmNd = pCNd;
+ }
+ else if( 0 != ( pSNd = aDelRg.aStart.GetNode().GetSectionNode()))
+ {
+ if( !pSNd->GetSection().IsHidden() && !pSNd->IsCntntHidden() )
+ {
+ pSNd->MakeFrms( &aFrmIdx, &aDelRg.aEnd );
+ pFrmNd = pSNd;
+ break;
+ }
+ aDelRg.aStart = *pSNd->EndOfSectionNode();
+ }
+ aDelRg.aStart++;
+ }
+ }
+
+ // #i28006# Fly frames have to be restored even if the table was
+ // #alone in the section
+ const SwSpzFrmFmts& rFlyArr = *GetDoc()->GetSpzFrmFmts();
+ for( sal_uInt16 n = 0; n < rFlyArr.Count(); ++n )
+ {
+ SwFrmFmt *const pFmt = (SwFrmFmt*)rFlyArr[n];
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+ SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
+ if (pAPos &&
+ ((FLY_AT_PARA == rAnchor.GetAnchorId()) ||
+ (FLY_AT_CHAR == rAnchor.GetAnchorId())) &&
+ nStt <= pAPos->nNode.GetIndex() &&
+ pAPos->nNode.GetIndex() < nEnd )
+ {
+ pFmt->MakeFrms();
+ }
+ }
+
+ return sal_True;
+}
+
+
+// ----- einfuegen von Spalten/Zeilen ------------------------
+
+sal_Bool SwDoc::InsertCol( const SwCursor& rCursor, sal_uInt16 nCnt, sal_Bool bBehind )
+{
+ if( !::CheckSplitCells( rCursor, nCnt + 1, nsSwTblSearchType::TBLSEARCH_COL ) )
+ return sal_False;
+
+ // lasse ueber das Layout die Boxen suchen
+ SwSelBoxes aBoxes;
+ ::GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
+
+ sal_Bool bRet = sal_False;
+ if( aBoxes.Count() )
+ bRet = InsertCol( aBoxes, nCnt, bBehind );
+ return bRet;
+}
+
+sal_Bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind )
+{
+ // uebers SwDoc fuer Undo !!
+ ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ SwTable& rTbl = pTblNd->GetTable();
+ if( rTbl.ISA( SwDDETable ))
+ return sal_False;
+
+#ifdef DEL_TABLE_REDLINES
+ lcl_DelRedlines aDelRedl( *pTblNd, sal_True );
+#endif
+
+ SwTableSortBoxes aTmpLst( 0, 5 );
+ SwUndoTblNdsChg* pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSCOL, rBoxes, *pTblNd,
+ 0, 0, nCnt, bBehind, sal_False );
+ aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() );
+ }
+
+ bool bRet(false);
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ SwTableFmlUpdate aMsgHnt( &rTbl );
+ aMsgHnt.eFlags = TBL_BOXPTR;
+ UpdateTblFlds( &aMsgHnt );
+
+ bRet = rTbl.InsertCol( this, rBoxes, nCnt, bBehind );
+ if (bRet)
+ {
+ SetModified();
+ ::ClearFEShellTabCols();
+ SetFieldsDirty( true, NULL, 0 );
+ }
+ }
+
+ if( pUndo )
+ {
+ if( bRet )
+ {
+ pUndo->SaveNewBoxes( *pTblNd, aTmpLst );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ else
+ delete pUndo;
+ }
+ return bRet;
+}
+
+sal_Bool SwDoc::InsertRow( const SwCursor& rCursor, sal_uInt16 nCnt, sal_Bool bBehind )
+{
+ // lasse ueber das Layout die Boxen suchen
+ SwSelBoxes aBoxes;
+ GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW );
+
+ sal_Bool bRet = sal_False;
+ if( aBoxes.Count() )
+ bRet = InsertRow( aBoxes, nCnt, bBehind );
+ return bRet;
+}
+
+sal_Bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind )
+{
+ // uebers SwDoc fuer Undo !!
+ ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ SwTable& rTbl = pTblNd->GetTable();
+ if( rTbl.ISA( SwDDETable ))
+ return sal_False;
+
+#ifdef DEL_TABLE_REDLINES
+ lcl_DelRedlines aDelRedl( *pTblNd, sal_True );
+#endif
+
+ SwTableSortBoxes aTmpLst( 0, 5 );
+ SwUndoTblNdsChg* pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSROW,rBoxes, *pTblNd,
+ 0, 0, nCnt, bBehind, sal_False );
+ aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() );
+ }
+
+ bool bRet(false);
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ SwTableFmlUpdate aMsgHnt( &rTbl );
+ aMsgHnt.eFlags = TBL_BOXPTR;
+ UpdateTblFlds( &aMsgHnt );
+
+ bRet = rTbl.InsertRow( this, rBoxes, nCnt, bBehind );
+ if (bRet)
+ {
+ SetModified();
+ ::ClearFEShellTabCols();
+ SetFieldsDirty( true, NULL, 0 );
+ }
+ }
+
+ if( pUndo )
+ {
+ if( bRet )
+ {
+ pUndo->SaveNewBoxes( *pTblNd, aTmpLst );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ else
+ delete pUndo;
+ }
+ return bRet;
+
+}
+
+// ----- loeschen von Spalten/Zeilen ------------------------
+
+sal_Bool SwDoc::DeleteRow( const SwCursor& rCursor )
+{
+ // lasse ueber das Layout die Boxen suchen
+ SwSelBoxes aBoxes;
+ GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW );
+ if( ::HasProtectedCells( aBoxes ))
+ return sal_False;
+
+ // die Crsr aus dem Loeschbereich entfernen.
+ // Der Cursor steht danach:
+ // - es folgt noch eine Zeile, in dieser
+ // - vorher steht noch eine Zeile, in dieser
+ // - sonst immer dahinter
+ {
+ SwTableNode* pTblNd = rCursor.GetNode()->FindTableNode();
+
+ if( pTblNd->GetTable().ISA( SwDDETable ))
+ return sal_False;
+
+ // suche alle Boxen / Lines
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aPara( aBoxes, &aFndBox );
+ pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ }
+
+ if( !aFndBox.GetLines().Count() )
+ return sal_False;
+
+ SwEditShell* pESh = GetEditShell();
+ if( pESh )
+ {
+ pESh->KillPams();
+ // JP: eigentlich sollte man ueber alle Shells iterieren!!
+ }
+
+ _FndBox* pFndBox = &aFndBox;
+ while( 1 == pFndBox->GetLines().Count() &&
+ 1 == pFndBox->GetLines()[0]->GetBoxes().Count() )
+ {
+ _FndBox* pTmp = pFndBox->GetLines()[0]->GetBoxes()[0];
+ if( pTmp->GetBox()->GetSttNd() )
+ break; // das ist sonst zu weit
+ pFndBox = pTmp;
+ }
+
+ SwTableLine* pDelLine = pFndBox->GetLines()[
+ pFndBox->GetLines().Count()-1 ]->GetLine();
+ SwTableBox* pDelBox = pDelLine->GetTabBoxes()[
+ pDelLine->GetTabBoxes().Count() - 1 ];
+ while( !pDelBox->GetSttNd() )
+ {
+ SwTableLine* pLn = pDelBox->GetTabLines()[
+ pDelBox->GetTabLines().Count()-1 ];
+ pDelBox = pLn->GetTabBoxes()[ pLn->GetTabBoxes().Count() - 1 ];
+ }
+ SwTableBox* pNextBox = pDelLine->FindNextBox( pTblNd->GetTable(),
+ pDelBox, sal_True );
+ while( pNextBox &&
+ pNextBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
+ pNextBox = pNextBox->FindNextBox( pTblNd->GetTable(), pNextBox );
+
+ if( !pNextBox ) // keine nachfolgende? dann die vorhergehende
+ {
+ pDelLine = pFndBox->GetLines()[ 0 ]->GetLine();
+ pDelBox = pDelLine->GetTabBoxes()[ 0 ];
+ while( !pDelBox->GetSttNd() )
+ pDelBox = pDelBox->GetTabLines()[0]->GetTabBoxes()[0];
+ pNextBox = pDelLine->FindPreviousBox( pTblNd->GetTable(),
+ pDelBox, sal_True );
+ while( pNextBox &&
+ pNextBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
+ pNextBox = pNextBox->FindPreviousBox( pTblNd->GetTable(), pNextBox );
+ }
+
+ sal_uLong nIdx;
+ if( pNextBox ) // dann den Cursor hier hinein
+ nIdx = pNextBox->GetSttIdx() + 1;
+ else // ansonsten hinter die Tabelle
+ nIdx = pTblNd->EndOfSectionIndex() + 1;
+
+ SwNodeIndex aIdx( GetNodes(), nIdx );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetNodes().GoNext( &aIdx );
+
+ if( pCNd )
+ {
+ // die Cursor von der Shell oder den uebergebenen Cursor aendern?
+ SwPaM* pPam = (SwPaM*)&rCursor;
+ pPam->GetPoint()->nNode = aIdx;
+ pPam->GetPoint()->nContent.Assign( pCNd, 0 );
+ pPam->SetMark(); // beide wollen etwas davon haben
+ pPam->DeleteMark();
+ }
+ }
+
+ // dann loesche doch die Zeilen
+
+ GetIDocumentUndoRedo().StartUndo(UNDO_ROW_DELETE, NULL);
+ sal_Bool bResult = DeleteRowCol( aBoxes );
+ GetIDocumentUndoRedo().EndUndo(UNDO_ROW_DELETE, NULL);
+
+ return bResult;
+}
+
+sal_Bool SwDoc::DeleteCol( const SwCursor& rCursor )
+{
+ // lasse ueber das Layout die Boxen suchen
+ SwSelBoxes aBoxes;
+ GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
+ if( ::HasProtectedCells( aBoxes ))
+ return sal_False;
+
+ // die Crsr muessen noch aus dem Loesch Bereich entfernt
+ // werden. Setze sie immer hinter/auf die Tabelle; ueber die
+ // Dokument-Position werden sie dann immer an die alte Position gesetzt.
+ SwEditShell* pESh = GetEditShell();
+ if( pESh )
+ {
+ const SwNode* pNd = rCursor.GetNode()->FindTableBoxStartNode();
+ pESh->ParkCrsr( SwNodeIndex( *pNd ) );
+ }
+
+ // dann loesche doch die Spalten
+ GetIDocumentUndoRedo().StartUndo(UNDO_COL_DELETE, NULL);
+ sal_Bool bResult = DeleteRowCol( aBoxes, true );
+ GetIDocumentUndoRedo().EndUndo(UNDO_COL_DELETE, NULL);
+
+ return bResult;
+}
+
+sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
+{
+ if( ::HasProtectedCells( rBoxes ))
+ return sal_False;
+
+ // uebers SwDoc fuer Undo !!
+ ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ if( pTblNd->GetTable().ISA( SwDDETable ))
+ return sal_False;
+
+ ::ClearFEShellTabCols();
+ SwSelBoxes aSelBoxes;
+ aSelBoxes.Insert(rBoxes.GetData(), rBoxes.Count());
+ SwTable &rTable = pTblNd->GetTable();
+ long nMin = 0;
+ long nMax = 0;
+ if( rTable.IsNewModel() )
+ {
+ if( bColumn )
+ rTable.ExpandColumnSelection( aSelBoxes, nMin, nMax );
+ else
+ rTable.FindSuperfluousRows( aSelBoxes );
+ }
+
+#ifdef DEL_TABLE_REDLINES
+ lcl_DelRedlines aDelRedl( *pTblNd, sal_True );
+#endif
+
+ // soll die gesamte Tabelle geloescht werden ??
+ const sal_uLong nTmpIdx1 = pTblNd->GetIndex();
+ const sal_uLong nTmpIdx2 = aSelBoxes[ aSelBoxes.Count()-1 ]->GetSttNd()->
+ EndOfSectionIndex()+1;
+ if( pTblNd->GetTable().GetTabSortBoxes().Count() == aSelBoxes.Count() &&
+ aSelBoxes[0]->GetSttIdx()-1 == nTmpIdx1 &&
+ nTmpIdx2 == pTblNd->EndOfSectionIndex() )
+ {
+ sal_Bool bNewTxtNd = sal_False;
+ // steht diese auch noch alleine in einem FlyFrame ?
+ SwNodeIndex aIdx( *pTblNd, -1 );
+ const SwStartNode* pSttNd = aIdx.GetNode().GetStartNode();
+ if( pSttNd )
+ {
+ const sal_uLong nTblEnd = pTblNd->EndOfSectionIndex() + 1;
+ const sal_uLong nSectEnd = pSttNd->EndOfSectionIndex();
+ if( nTblEnd == nSectEnd )
+ {
+ if( SwFlyStartNode == pSttNd->GetStartNodeType() )
+ {
+ SwFrmFmt* pFmt = pSttNd->GetFlyFmt();
+ if( pFmt )
+ {
+ // Ok, das ist das gesuchte FlyFormat
+ DelLayoutFmt( pFmt );
+ return sal_True;
+ }
+ }
+ // kein Fly ?? also Kopf- oder Fusszeile: dann immer einen
+ // TextNode ueberig lassen.
+ // Undo koennen wir dann vergessen !!
+ bNewTxtNd = sal_True;
+ }
+ }
+
+ // kein Fly ?? also Kopf- oder Fusszeile: dann immer einen
+ // TextNode ueberig lassen.
+ aIdx++;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ SwPaM aPaM( *pTblNd->EndOfSectionNode(), aIdx.GetNode() );
+
+ if( bNewTxtNd )
+ {
+ const SwNodeIndex aTmpIdx( *pTblNd->EndOfSectionNode(), 1 );
+ GetNodes().MakeTxtNode( aTmpIdx,
+ GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
+ }
+
+ // save the cursors (UNO and otherwise)
+ SwPaM aSavePaM( SwNodeIndex( *pTblNd->EndOfSectionNode() ) );
+ if( ! aSavePaM.Move( fnMoveForward, fnGoNode ) )
+ {
+ *aSavePaM.GetMark() = SwPosition( *pTblNd );
+ aSavePaM.Move( fnMoveBackward, fnGoNode );
+ }
+ {
+ SwPaM const tmpPaM(*pTblNd, *pTblNd->EndOfSectionNode());
+ ::PaMCorrAbs(tmpPaM, *aSavePaM.GetMark());
+ }
+
+ // harte SeitenUmbrueche am nachfolgenden Node verschieben
+ sal_Bool bSavePageBreak = sal_False, bSavePageDesc = sal_False;
+ sal_uLong nNextNd = pTblNd->EndOfSectionIndex()+1;
+ SwCntntNode* pNextNd = GetNodes()[ nNextNd ]->GetCntntNode();
+ if( pNextNd )
+ {
+//JP 24.08.98: will man wirklich den PageDesc/Break vom
+// nachfolgen Absatz ueberbuegeln?
+// const SwAttrSet& rAttrSet = pNextNd->GetSwAttrSet();
+// if( SFX_ITEM_SET != rAttrSet.GetItemState( RES_PAGEDESC ) &&
+// SFX_ITEM_SET != rAttrSet.GetItemState( RES_BREAK ))
+ {
+ SwFrmFmt* pTableFmt = pTblNd->GetTable().GetFrmFmt();
+ const SfxPoolItem *pItem;
+ if( SFX_ITEM_SET == pTableFmt->GetItemState( RES_PAGEDESC,
+ sal_False, &pItem ) )
+ {
+ pNextNd->SetAttr( *pItem );
+ bSavePageDesc = sal_True;
+ }
+
+ if( SFX_ITEM_SET == pTableFmt->GetItemState( RES_BREAK,
+ sal_False, &pItem ) )
+ {
+ pNextNd->SetAttr( *pItem );
+ bSavePageBreak = sal_True;
+ }
+ }
+ }
+ SwUndoDelete* pUndo = new SwUndoDelete( aPaM );
+ if( bNewTxtNd )
+ pUndo->SetTblDelLastNd();
+ pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc );
+ pUndo->SetTableName(pTblNd->GetTable().GetFrmFmt()->GetName());
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ else
+ {
+ if( bNewTxtNd )
+ {
+ const SwNodeIndex aTmpIdx( *pTblNd->EndOfSectionNode(), 1 );
+ GetNodes().MakeTxtNode( aTmpIdx,
+ GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
+ }
+
+ // save the cursors (UNO and otherwise)
+ SwPaM aSavePaM( SwNodeIndex( *pTblNd->EndOfSectionNode() ) );
+ if( ! aSavePaM.Move( fnMoveForward, fnGoNode ) )
+ {
+ *aSavePaM.GetMark() = SwPosition( *pTblNd );
+ aSavePaM.Move( fnMoveBackward, fnGoNode );
+ }
+ {
+ SwPaM const tmpPaM(*pTblNd, *pTblNd->EndOfSectionNode());
+ ::PaMCorrAbs(tmpPaM, *aSavePaM.GetMark());
+ }
+
+ // harte SeitenUmbrueche am nachfolgenden Node verschieben
+ SwCntntNode* pNextNd = GetNodes()[ pTblNd->EndOfSectionIndex()+1 ]->GetCntntNode();
+ if( pNextNd )
+ {
+ SwFrmFmt* pTableFmt = pTblNd->GetTable().GetFrmFmt();
+ const SfxPoolItem *pItem;
+ if( SFX_ITEM_SET == pTableFmt->GetItemState( RES_PAGEDESC,
+ sal_False, &pItem ) )
+ pNextNd->SetAttr( *pItem );
+
+ if( SFX_ITEM_SET == pTableFmt->GetItemState( RES_BREAK,
+ sal_False, &pItem ) )
+ pNextNd->SetAttr( *pItem );
+ }
+
+ pTblNd->DelFrms();
+ DeleteSection( pTblNd );
+ }
+ SetModified();
+ SetFieldsDirty( true, NULL, 0 );
+ return sal_True;
+ }
+
+ SwUndoTblNdsChg* pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoTblNdsChg( UNDO_TABLE_DELBOX, aSelBoxes, *pTblNd,
+ nMin, nMax, 0, sal_False, sal_False );
+ }
+
+ bool bRet(false);
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() );
+ aMsgHnt.eFlags = TBL_BOXPTR;
+ UpdateTblFlds( &aMsgHnt );
+
+ if (rTable.IsNewModel())
+ {
+ if (bColumn)
+ rTable.PrepareDeleteCol( nMin, nMax );
+ rTable.FindSuperfluousRows( aSelBoxes );
+ if (pUndo)
+ pUndo->ReNewBoxes( aSelBoxes );
+ }
+ bRet = rTable.DeleteSel( this, aSelBoxes, 0, pUndo, sal_True, sal_True );
+ if (bRet)
+ {
+ SetModified();
+ SetFieldsDirty( true, NULL, 0 );
+ }
+ }
+
+ if( pUndo )
+ {
+ if( bRet )
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ else
+ delete pUndo;
+ }
+
+ return bRet;
+}
+
+
+// ---------- teilen / zusammenfassen von Boxen in der Tabelle --------
+
+sal_Bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, sal_uInt16 nCnt,
+ sal_Bool bSameHeight )
+{
+ // uebers SwDoc fuer Undo !!
+ ASSERT( rBoxes.Count() && nCnt, "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ SwTable& rTbl = pTblNd->GetTable();
+ if( rTbl.ISA( SwDDETable ))
+ return sal_False;
+
+#ifdef DEL_TABLE_REDLINES
+ lcl_DelRedlines aDelRedl( *pTblNd, sal_True );
+#endif
+
+ SvULongs aNdsCnts;
+ SwTableSortBoxes aTmpLst( 0, 5 );
+ SwUndoTblNdsChg* pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoTblNdsChg( UNDO_TABLE_SPLIT, rBoxes, *pTblNd, 0, 0,
+ nCnt, bVert, bSameHeight );
+
+ aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() );
+ if( !bVert )
+ {
+ for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n )
+ {
+ const SwStartNode* pSttNd = rBoxes[ n ]->GetSttNd();
+ aNdsCnts.Insert( pSttNd->EndOfSectionIndex() -
+ pSttNd->GetIndex(), n );
+ }
+ }
+ }
+
+ bool bRet(false);
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ SwTableFmlUpdate aMsgHnt( &rTbl );
+ aMsgHnt.eFlags = TBL_BOXPTR;
+ UpdateTblFlds( &aMsgHnt );
+
+ if (bVert)
+ bRet = rTbl.SplitCol( this, rBoxes, nCnt );
+ else
+ bRet = rTbl.SplitRow( this, rBoxes, nCnt, bSameHeight );
+
+ if (bRet)
+ {
+ SetModified();
+ SetFieldsDirty( true, NULL, 0 );
+ }
+ }
+
+ if( pUndo )
+ {
+ if( bRet )
+ {
+ if( bVert )
+ pUndo->SaveNewBoxes( *pTblNd, aTmpLst );
+ else
+ pUndo->SaveNewBoxes( *pTblNd, aTmpLst, rBoxes, aNdsCnts );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ else
+ delete pUndo;
+ }
+
+ return bRet;
+}
+
+
+sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam )
+{
+ // pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen
+ SwTableNode* pTblNd = rPam.GetNode()->FindTableNode();
+ if( !pTblNd )
+ return TBLMERGE_NOSELECTION;
+ SwTable& rTable = pTblNd->GetTable();
+ if( rTable.ISA(SwDDETable) )
+ return TBLMERGE_NOSELECTION;
+ sal_uInt16 nRet = TBLMERGE_NOSELECTION;
+ if( !rTable.IsNewModel() )
+ {
+ nRet =::CheckMergeSel( rPam );
+ if( TBLMERGE_OK != nRet )
+ return nRet;
+ nRet = TBLMERGE_NOSELECTION;
+ }
+
+ // --> FME 2004-10-08 #i33394#
+ GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_MERGE, NULL );
+ // <--
+
+#ifdef DEL_TABLE_REDLINES
+ if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ DeleteRedline( *pTblNd, true, USHRT_MAX );
+#endif
+ RedlineMode_t eOld = GetRedlineMode();
+ SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+
+ SwUndoTblMerge *const pUndo( (GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoTblMerge( rPam )
+ : 0 );
+
+ // lasse ueber das Layout die Boxen suchen
+ SwSelBoxes aBoxes;
+ SwSelBoxes aMerged;
+ SwTableBox* pMergeBox;
+
+ if( !rTable.PrepareMerge( rPam, aBoxes, aMerged, &pMergeBox, pUndo ) )
+ { // no cells found to merge
+ SetRedlineMode_intern( eOld );
+ if( pUndo )
+ {
+ delete pUndo;
+ SwUndoId nLastUndoId(UNDO_EMPTY);
+ if (GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId)
+ && (UNDO_REDLINE == nLastUndoId))
+ {
+ // FIXME: why is this horrible cleanup necessary?
+ SwUndoRedline *const pU = dynamic_cast<SwUndoRedline*>(
+ GetUndoManager().RemoveLastUndo());
+ if( pU->GetRedlSaveCount() )
+ {
+ SwEditShell *const pEditShell(GetEditShell(0));
+ OSL_ASSERT(pEditShell);
+ ::sw::UndoRedoContext context(*this, *pEditShell);
+ static_cast<SfxUndoAction *>(pU)->UndoWithContext(context);
+ }
+ delete pU;
+ }
+ }
+ }
+ else
+ {
+ // die PaMs muessen noch aus dem Loesch Bereich entfernt
+ // werden. Setze sie immer hinter/auf die Tabelle; ueber die
+ // Dokument-Position werden sie dann immer an die alte Position gesetzt.
+ // Erstmal einen Index auf die Parkposition merken, denn nach GetMergeSel
+ // komme ich nicht mehr dran.
+ {
+ rPam.DeleteMark();
+ rPam.GetPoint()->nNode = *pMergeBox->GetSttNd();
+ rPam.GetPoint()->nContent.Assign( 0, 0 );
+ rPam.SetMark();
+ rPam.DeleteMark();
+
+ SwPaM* pTmp = &rPam;
+ while( &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() ))
+ for( int i = 0; i < 2; ++i )
+ pTmp->GetBound( (sal_Bool)i ) = *rPam.GetPoint();
+ }
+
+ // dann fuege sie zusammen
+ SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() );
+ aMsgHnt.eFlags = TBL_BOXPTR;
+ UpdateTblFlds( &aMsgHnt );
+
+ if( pTblNd->GetTable().Merge( this, aBoxes, aMerged, pMergeBox, pUndo ))
+ {
+ nRet = TBLMERGE_OK;
+ SetModified();
+ SetFieldsDirty( true, NULL, 0 );
+ if( pUndo )
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ }
+ else if( pUndo )
+ delete pUndo;
+
+ rPam.GetPoint()->nNode = *pMergeBox->GetSttNd();
+ rPam.Move();
+
+ ::ClearFEShellTabCols();
+ SetRedlineMode_intern( eOld );
+ }
+ GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_MERGE, NULL );
+ return nRet;
+}
+
+
+
+// -------------------------------------------------------
+
+//---------
+// SwTableNode
+//---------
+
+SwTableNode::SwTableNode( const SwNodeIndex& rIdx )
+ : SwStartNode( rIdx, ND_TABLENODE )
+{
+ pTable = new SwTable( 0 );
+}
+
+SwTableNode::~SwTableNode()
+{
+ //don't forget to notify uno wrappers
+ SwFrmFmt* pTblFmt = GetTable().GetFrmFmt();
+ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT,
+ pTblFmt );
+ pTblFmt->ModifyNotification( &aMsgHint, &aMsgHint );
+ DelFrms();
+ delete pTable;
+}
+
+SwTabFrm *SwTableNode::MakeFrm( SwFrm* pSib )
+{
+ return new SwTabFrm( *pTable, pSib );
+}
+
+//Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
+//Dokument. Die erzeugten Contentframes werden in das entsprechende
+//Layout gehaengt.
+void SwTableNode::MakeFrms(const SwNodeIndex & rIdx )
+{
+ if( !GetTable().GetFrmFmt()->GetDepends())//gibt es ueberhaupt Frames ??
+ return;
+
+ SwFrm *pFrm, *pNew;
+ SwCntntNode * pNode = rIdx.GetNode().GetCntntNode();
+
+ ASSERT( pNode, "Kein Contentnode oder Copy-Node und neuer Node identisch.");
+
+ sal_Bool bBefore = rIdx < GetIndex();
+
+ SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() );
+
+ while( 0 != (pFrm = aNode2Layout.NextFrm()) )
+ {
+ pNew = pNode->MakeFrm( pFrm );
+ // wird ein Node vorher oder nachher mit Frames versehen
+ if ( bBefore )
+ // der neue liegt vor mir
+ pNew->Paste( pFrm->GetUpper(), pFrm );
+ else
+ // der neue liegt hinter mir
+ pNew->Paste( pFrm->GetUpper(), pFrm->GetNext() );
+ }
+}
+
+//Fuer jede Shell einen TblFrm anlegen und vor den entsprechenden
+//CntntFrm pasten.
+
+void SwTableNode::MakeFrms( SwNodeIndex* pIdxBehind )
+{
+ ASSERT( pIdxBehind, "kein Index" );
+ *pIdxBehind = *this;
+ SwNode *pNd = GetNodes().FindPrvNxtFrmNode( *pIdxBehind, EndOfSectionNode() );
+ if( !pNd )
+ return ;
+
+ SwFrm *pFrm( 0L );
+ SwLayoutFrm *pUpper( 0L );
+ SwNode2Layout aNode2Layout( *pNd, GetIndex() );
+ while( 0 != (pUpper = aNode2Layout.UpperFrm( pFrm, *this )) )
+ {
+ SwTabFrm* pNew = MakeFrm( pUpper );
+ pNew->Paste( pUpper, pFrm );
+ // --> OD 2005-12-01 #i27138#
+ // notify accessibility paragraphs objects about changed
+ // CONTENT_FLOWS_FROM/_TO relation.
+ // Relation CONTENT_FLOWS_FROM for next paragraph will change
+ // and relation CONTENT_FLOWS_TO for previous paragraph will change.
+ {
+ ViewShell* pViewShell( pNew->getRootFrm()->GetCurrShell() );
+ if ( pViewShell && pViewShell->GetLayout() &&
+ pViewShell->GetLayout()->IsAnyShellAccessible() )
+ {
+ pViewShell->InvalidateAccessibleParaFlowRelation(
+ dynamic_cast<SwTxtFrm*>(pNew->FindNextCnt( true )),
+ dynamic_cast<SwTxtFrm*>(pNew->FindPrevCnt( true )) );
+ }
+ }
+ // <--
+ ((SwTabFrm*)pNew)->RegistFlys();
+ }
+}
+
+void SwTableNode::DelFrms()
+{
+ //Erstmal die TabFrms ausschneiden und deleten, die Columns und Rows
+ //nehmen sie mit in's Grab.
+ //Die TabFrms haengen am FrmFmt des SwTable.
+ //Sie muessen etwas umstaendlich zerstort werden, damit die Master
+ //die Follows mit in's Grab nehmen.
+
+ SwIterator<SwTabFrm,SwFmt> aIter( *(pTable->GetFrmFmt()) );
+ SwTabFrm *pFrm = aIter.First();
+ while ( pFrm )
+ {
+ sal_Bool bAgain = sal_False;
+ {
+ if ( !pFrm->IsFollow() )
+ {
+ while ( pFrm->HasFollow() )
+ pFrm->JoinAndDelFollows();
+ // --> OD 2005-12-01 #i27138#
+ // notify accessibility paragraphs objects about changed
+ // CONTENT_FLOWS_FROM/_TO relation.
+ // Relation CONTENT_FLOWS_FROM for current next paragraph will change
+ // and relation CONTENT_FLOWS_TO for current previous paragraph will change.
+ {
+ ViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() );
+ if ( pViewShell && pViewShell->GetLayout() &&
+ pViewShell->GetLayout()->IsAnyShellAccessible() )
+ {
+ pViewShell->InvalidateAccessibleParaFlowRelation(
+ dynamic_cast<SwTxtFrm*>(pFrm->FindNextCnt( true )),
+ dynamic_cast<SwTxtFrm*>(pFrm->FindPrevCnt( true )) );
+ }
+ }
+ // <--
+ pFrm->Cut();
+ delete pFrm;
+ bAgain = sal_True;
+ }
+ }
+ pFrm = bAgain ? aIter.First() : aIter.Next();
+ }
+}
+
+
+void SwTableNode::SetNewTable( SwTable* pNewTable, sal_Bool bNewFrames )
+{
+ DelFrms();
+ delete pTable;
+ pTable = pNewTable;
+ if( bNewFrames )
+ {
+ SwNodeIndex aIdx( *EndOfSectionNode());
+ GetNodes().GoNext( &aIdx );
+ MakeFrms( &aIdx );
+ }
+}
+
+void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr,
+ const SwCellFrm* pBoxFrm ) const
+{
+ const SwTableBox* pBox = 0;
+ SwTabFrm *pTab = 0;
+
+ if( pBoxFrm )
+ {
+ pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm();
+ pBox = pBoxFrm->GetTabBox();
+ }
+ else if( pCrsr )
+ {
+ const SwCntntNode* pCNd = pCrsr->GetCntntNode();
+ if( !pCNd )
+ return ;
+
+ Point aPt;
+ const SwShellCrsr *pShCrsr = dynamic_cast<const SwShellCrsr*>(pCrsr);
+ if( pShCrsr )
+ aPt = pShCrsr->GetPtPos();
+
+ const SwFrm* pTmpFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
+ do {
+ pTmpFrm = pTmpFrm->GetUpper();
+ } while ( !pTmpFrm->IsCellFrm() );
+
+ pBoxFrm = (SwCellFrm*)pTmpFrm;
+ pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm();
+ pBox = pBoxFrm->GetTabBox();
+ }
+ else if( !pCrsr && !pBoxFrm )
+ {
+ ASSERT( !this, "einer von beiden muss angegeben werden!" );
+ return ;
+ }
+
+ //Fix-Punkte setzen, LeftMin in Dokumentkoordinaten die anderen relativ.
+ SWRECTFN( pTab )
+ const SwPageFrm* pPage = pTab->FindPageFrm();
+ const sal_uLong nLeftMin = (pTab->Frm().*fnRect->fnGetLeft)() -
+ (pPage->Frm().*fnRect->fnGetLeft)();
+ const sal_uLong nRightMax = (pTab->Frm().*fnRect->fnGetRight)() -
+ (pPage->Frm().*fnRect->fnGetLeft)();
+
+ rFill.SetLeftMin ( nLeftMin );
+ rFill.SetLeft ( (pTab->Prt().*fnRect->fnGetLeft)() );
+ rFill.SetRight ( (pTab->Prt().*fnRect->fnGetRight)());
+ rFill.SetRightMax( nRightMax - nLeftMin );
+
+ pTab->GetTable()->GetTabCols( rFill, pBox );
+}
+
+//
+// Here are some little helpers used in SwDoc::GetTabRows
+//
+
+#define ROWFUZZY 25
+
+struct FuzzyCompare
+{
+ bool operator() ( long s1, long s2 ) const;
+};
+
+bool FuzzyCompare::operator() ( long s1, long s2 ) const
+{
+ return ( s1 < s2 && abs( s1 - s2 ) > ROWFUZZY );
+}
+
+bool lcl_IsFrmInColumn( const SwCellFrm& rFrm, SwSelBoxes& rBoxes )
+{
+ for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
+ {
+ if ( rFrm.GetTabBox() == rBoxes[ i ] )
+ return true;
+ }
+
+ return false;
+}
+
+//
+// SwDoc::GetTabRows()
+//
+
+void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* ,
+ const SwCellFrm* pBoxFrm ) const
+{
+ ASSERT( pBoxFrm, "GetTabRows called without pBoxFrm" )
+
+ // --> FME 2005-09-12 #121591# Make code robust:
+ if ( !pBoxFrm )
+ return;
+ // <--
+
+ // --> FME 2005-01-06 #i39552# Collection of the boxes of the current
+ // column has to be done at the beginning of this function, because
+ // the table may be formatted in ::GetTblSel.
+ SwDeletionChecker aDelCheck( pBoxFrm );
+
+ SwSelBoxes aBoxes;
+ const SwCntntFrm* pCntnt = ::GetCellCntnt( *pBoxFrm );
+ if ( pCntnt && pCntnt->IsTxtFrm() )
+ {
+ const SwPosition aPos( *((SwTxtFrm*)pCntnt)->GetTxtNode() );
+ const SwCursor aTmpCrsr( aPos, 0, false );
+ ::GetTblSel( aTmpCrsr, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
+ }
+ // <--
+
+ // --> FME 2005-09-12 #121591# Make code robust:
+ if ( aDelCheck.HasBeenDeleted() )
+ {
+ ASSERT( false, "Current box has been deleted during GetTabRows()" )
+ return;
+ }
+ // <--
+
+ // --> FME 2005-09-12 #121591# Make code robust:
+ const SwTabFrm* pTab = pBoxFrm->FindTabFrm();
+ ASSERT( pTab, "GetTabRows called without a table" )
+ if ( !pTab )
+ return;
+ // <--
+
+ const SwFrm* pFrm = pTab->GetNextLayoutLeaf();
+
+ //Fix-Punkte setzen, LeftMin in Dokumentkoordinaten die anderen relativ.
+ SWRECTFN( pTab )
+ const SwPageFrm* pPage = pTab->FindPageFrm();
+ const long nLeftMin = ( bVert ?
+ pTab->GetPrtLeft() - pPage->Frm().Left() :
+ pTab->GetPrtTop() - pPage->Frm().Top() );
+ const long nLeft = bVert ? LONG_MAX : 0;
+ const long nRight = (pTab->Prt().*fnRect->fnGetHeight)();
+ const long nRightMax = bVert ? nRight : LONG_MAX;
+
+ rFill.SetLeftMin( nLeftMin );
+ rFill.SetLeft( nLeft );
+ rFill.SetRight( nRight );
+ rFill.SetRightMax( nRightMax );
+
+ typedef std::map< long, std::pair< long, long >, FuzzyCompare > BoundaryMap;
+ BoundaryMap aBoundaries;
+ BoundaryMap::iterator aIter;
+ std::pair< long, long > aPair;
+
+ typedef std::map< long, bool > HiddenMap;
+ HiddenMap aHidden;
+ HiddenMap::iterator aHiddenIter;
+
+ while ( pFrm && pTab->IsAnLower( pFrm ) )
+ {
+ if ( pFrm->IsCellFrm() && pFrm->FindTabFrm() == pTab )
+ {
+ // upper and lower borders of current cell frame:
+ long nUpperBorder = (pFrm->Frm().*fnRect->fnGetTop)();
+ long nLowerBorder = (pFrm->Frm().*fnRect->fnGetBottom)();
+
+ // get boundaries for nUpperBorder:
+ aIter = aBoundaries.find( nUpperBorder );
+ if ( aIter == aBoundaries.end() )
+ {
+ aPair.first = nUpperBorder; aPair.second = LONG_MAX;
+ aBoundaries[ nUpperBorder ] = aPair;
+ }
+
+ // get boundaries for nLowerBorder:
+ aIter = aBoundaries.find( nLowerBorder );
+ if ( aIter == aBoundaries.end() )
+ {
+ aPair.first = nUpperBorder; aPair.second = LONG_MAX;
+ }
+ else
+ {
+ nLowerBorder = (*aIter).first;
+ long nNewLowerBorderUpperBoundary = Max( (*aIter).second.first, nUpperBorder );
+ aPair.first = nNewLowerBorderUpperBoundary; aPair.second = LONG_MAX;
+ }
+ aBoundaries[ nLowerBorder ] = aPair;
+
+ // calculate hidden flags for entry nUpperBorder/nLowerBorder:
+ long nTmpVal = nUpperBorder;
+ for ( sal_uInt8 i = 0; i < 2; ++i )
+ {
+ aHiddenIter = aHidden.find( nTmpVal );
+ if ( aHiddenIter == aHidden.end() )
+ aHidden[ nTmpVal ] = !lcl_IsFrmInColumn( *((SwCellFrm*)pFrm), aBoxes );
+ else
+ {
+ if ( aHidden[ nTmpVal ] &&
+ lcl_IsFrmInColumn( *((SwCellFrm*)pFrm), aBoxes ) )
+ aHidden[ nTmpVal ] = false;
+ }
+ nTmpVal = nLowerBorder;
+ }
+ }
+
+ pFrm = pFrm->GetNextLayoutLeaf();
+ }
+
+ // transfer calculated values from BoundaryMap and HiddenMap into rFill:
+ sal_uInt16 nIdx = 0;
+ for ( aIter = aBoundaries.begin(); aIter != aBoundaries.end(); ++aIter )
+ {
+ const long nTabTop = (pTab->*fnRect->fnGetPrtTop)();
+ const long nKey = (*fnRect->fnYDiff)( (*aIter).first, nTabTop );
+ const std::pair< long, long > aTmpPair = (*aIter).second;
+ const long nFirst = (*fnRect->fnYDiff)( aTmpPair.first, nTabTop );
+ const long nSecond = aTmpPair.second;
+
+ aHiddenIter = aHidden.find( (*aIter).first );
+ const bool bHidden = aHiddenIter != aHidden.end() && (*aHiddenIter).second;
+ rFill.Insert( nKey, nFirst, nSecond, bHidden, nIdx++ );
+ }
+
+ // delete first and last entry
+ ASSERT( rFill.Count(), "Deleting from empty vector. Fasten your seatbelts!" )
+ // --> FME 2006-01-19 #i60818# There may be only one entry in rFill. Make
+ // code robust by checking count of rFill.
+ if ( rFill.Count() ) rFill.Remove( 0, 1 );
+ if ( rFill.Count() ) rFill.Remove( rFill.Count() - 1 , 1 );
+ // <--
+ rFill.SetLastRowAllowedToChange( !pTab->HasFollowFlowLine() );
+}
+
+void SwDoc::SetTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly,
+ const SwCursor* pCrsr, const SwCellFrm* pBoxFrm )
+{
+ const SwTableBox* pBox = 0;
+ SwTabFrm *pTab = 0;
+
+ if( pBoxFrm )
+ {
+ pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm();
+ pBox = pBoxFrm->GetTabBox();
+ }
+ else if( pCrsr )
+ {
+ const SwCntntNode* pCNd = pCrsr->GetCntntNode();
+ if( !pCNd )
+ return ;
+
+ Point aPt;
+ const SwShellCrsr *pShCrsr = dynamic_cast<const SwShellCrsr*>(pCrsr);
+ if( pShCrsr )
+ aPt = pShCrsr->GetPtPos();
+
+ const SwFrm* pTmpFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
+ do {
+ pTmpFrm = pTmpFrm->GetUpper();
+ } while ( !pTmpFrm->IsCellFrm() );
+
+ pBoxFrm = (SwCellFrm*)pTmpFrm;
+ pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm();
+ pBox = pBoxFrm->GetTabBox();
+ }
+ else if( !pCrsr && !pBoxFrm )
+ {
+ ASSERT( !this, "einer von beiden muss angegeben werden!" );
+ return ;
+ }
+
+ // sollte die Tabelle noch auf relativen Werten (USHRT_MAX) stehen
+ // dann muss es jetzt auf absolute umgerechnet werden.
+ SwTable& rTab = *pTab->GetTable();
+ const SwFmtFrmSize& rTblFrmSz = rTab.GetFrmFmt()->GetFrmSize();
+ SWRECTFN( pTab )
+ // OD 06.08.2003 #i17174# - With fix for #i9040# the shadow size is taken
+ // from the table width. Thus, add its left and right size to current table
+ // printing area width in order to get the correct table size attribute.
+ SwTwips nPrtWidth = (pTab->Prt().*fnRect->fnGetWidth)();
+ {
+ SvxShadowItem aShadow( rTab.GetFrmFmt()->GetShadow() );
+ nPrtWidth += aShadow.CalcShadowSpace( SHADOW_LEFT ) +
+ aShadow.CalcShadowSpace( SHADOW_RIGHT );
+ }
+ if( nPrtWidth != rTblFrmSz.GetWidth() )
+ {
+ SwFmtFrmSize aSz( rTblFrmSz );
+ aSz.SetWidth( nPrtWidth );
+ rTab.GetFrmFmt()->SetFmtAttr( aSz );
+ }
+
+ SwTabCols aOld( rNew.Count() );
+
+ const SwPageFrm* pPage = pTab->FindPageFrm();
+ const sal_uLong nLeftMin = (pTab->Frm().*fnRect->fnGetLeft)() -
+ (pPage->Frm().*fnRect->fnGetLeft)();
+ const sal_uLong nRightMax = (pTab->Frm().*fnRect->fnGetRight)() -
+ (pPage->Frm().*fnRect->fnGetLeft)();
+
+ //Fix-Punkte setzen, LeftMin in Dokumentkoordinaten die anderen relativ.
+ aOld.SetLeftMin ( nLeftMin );
+ aOld.SetLeft ( (pTab->Prt().*fnRect->fnGetLeft)() );
+ aOld.SetRight ( (pTab->Prt().*fnRect->fnGetRight)());
+ aOld.SetRightMax( nRightMax - nLeftMin );
+
+ rTab.GetTabCols( aOld, pBox );
+ SetTabCols(rTab, rNew, aOld, pBox, bCurRowOnly );
+}
+
+void SwDoc::SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCursor*,
+ const SwCellFrm* pBoxFrm )
+{
+ const SwTableBox* pBox;
+ SwTabFrm *pTab;
+
+ ASSERT( pBoxFrm, "SetTabRows called without pBoxFrm" )
+
+ pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm();
+ pBox = pBoxFrm->GetTabBox();
+
+ // sollte die Tabelle noch auf relativen Werten (USHRT_MAX) stehen
+ // dann muss es jetzt auf absolute umgerechnet werden.
+ SWRECTFN( pTab )
+ SwTabCols aOld( rNew.Count() );
+
+ //Fix-Punkte setzen, LeftMin in Dokumentkoordinaten die anderen relativ.
+ const SwPageFrm* pPage = pTab->FindPageFrm();
+
+ aOld.SetRight( (pTab->Prt().*fnRect->fnGetHeight)() );
+ long nLeftMin;
+ if ( bVert )
+ {
+ nLeftMin = pTab->GetPrtLeft() - pPage->Frm().Left();
+ aOld.SetLeft ( LONG_MAX );
+ aOld.SetRightMax( aOld.GetRight() );
+
+ }
+ else
+ {
+ nLeftMin = pTab->GetPrtTop() - pPage->Frm().Top();
+ aOld.SetLeft ( 0 );
+ aOld.SetRightMax( LONG_MAX );
+ }
+ aOld.SetLeftMin ( nLeftMin );
+
+ GetTabRows( aOld, 0, pBoxFrm );
+
+ GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_ATTR, NULL );
+
+ // check for differences between aOld and rNew:
+ const sal_uInt16 nCount = rNew.Count();
+ const SwTable* pTable = pTab->GetTable();
+ ASSERT( pTable, "My colleague told me, this couldn't happen" );
+
+ for ( sal_uInt16 i = 0; i <= nCount; ++i )
+ {
+ const sal_uInt16 nIdxStt = bVert ? nCount - i : i - 1;
+ const sal_uInt16 nIdxEnd = bVert ? nCount - i - 1 : i;
+
+ const long nOldRowStart = i == 0 ? 0 : aOld[ nIdxStt ];
+ const long nOldRowEnd = i == nCount ? aOld.GetRight() : aOld[ nIdxEnd ];
+ const long nOldRowHeight = nOldRowEnd - nOldRowStart;
+
+ const long nNewRowStart = i == 0 ? 0 : rNew[ nIdxStt ];
+ const long nNewRowEnd = i == nCount ? rNew.GetRight() : rNew[ nIdxEnd ];
+ const long nNewRowHeight = nNewRowEnd - nNewRowStart;
+
+ const long nDiff = nNewRowHeight - nOldRowHeight;
+ if ( abs( nDiff ) >= ROWFUZZY )
+ {
+ // For the old table model pTxtFrm and pLine will be set for every box.
+ // For the new table model pTxtFrm will be set if the box is not covered,
+ // but the pLine will be set if the box is not an overlapping box
+ // In the new table model the row height can be adjusted,
+ // when both variables are set.
+ SwTxtFrm* pTxtFrm = 0;
+ const SwTableLine* pLine = 0;
+
+ // Iterate over all SwCellFrms with Bottom = nOldPos
+ const SwFrm* pFrm = pTab->GetNextLayoutLeaf();
+ while ( pFrm && pTab->IsAnLower( pFrm ) )
+ {
+ if ( pFrm->IsCellFrm() && pFrm->FindTabFrm() == pTab )
+ {
+ const long nLowerBorder = (pFrm->Frm().*fnRect->fnGetBottom)();
+ const sal_uLong nTabTop = (pTab->*fnRect->fnGetPrtTop)();
+ if ( abs( (*fnRect->fnYInc)( nTabTop, nOldRowEnd ) - nLowerBorder ) <= ROWFUZZY )
+ {
+ if ( !bCurColOnly || pFrm == pBoxFrm )
+ {
+ const SwFrm* pCntnt = ::GetCellCntnt( static_cast<const SwCellFrm&>(*pFrm) );
+
+ if ( pCntnt && pCntnt->IsTxtFrm() )
+ {
+ pBox = ((SwCellFrm*)pFrm)->GetTabBox();
+ const long nRowSpan = pBox->getRowSpan();
+ if( nRowSpan > 0 ) // Not overlapped
+ pTxtFrm = (SwTxtFrm*)pCntnt;
+ if( nRowSpan < 2 ) // Not overlapping for row height
+ pLine = pBox->GetUpper();
+ if( pLine && pTxtFrm ) // always for old table model
+ {
+ // The new row height must not to be calculated from a overlapping box
+ SwFmtFrmSize aNew( pLine->GetFrmFmt()->GetFrmSize() );
+ const long nNewSize = (pFrm->Frm().*fnRect->fnGetHeight)() + nDiff;
+ if( nNewSize != aNew.GetHeight() )
+ {
+ aNew.SetHeight( nNewSize );
+ if ( ATT_VAR_SIZE == aNew.GetHeightSizeType() )
+ aNew.SetHeightSizeType( ATT_MIN_SIZE );
+ // This position must not be in an overlapped box
+ const SwPosition aPos( *((SwTxtFrm*)pCntnt)->GetTxtNode() );
+ const SwCursor aTmpCrsr( aPos, 0, false );
+ SetRowHeight( aTmpCrsr, aNew );
+ // For the new table model we're done, for the old one
+ // there might be another (sub)row to adjust...
+ if( pTable->IsNewModel() )
+ break;
+ }
+ pLine = 0;
+ }
+ }
+ }
+ }
+ }
+ pFrm = pFrm->GetNextLayoutLeaf();
+ }
+ }
+ }
+
+ GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_ATTR, NULL );
+
+ ::ClearFEShellTabCols();
+}
+
+/* -----------------18.07.98 11:45-------------------
+ * Direktzugriff fuer UNO
+ * --------------------------------------------------*/
+void SwDoc::SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
+ const SwTableBox *pStart, sal_Bool bCurRowOnly )
+{
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoAttrTbl( *rTab.GetTableNode(), sal_True ));
+ }
+ rTab.SetTabCols( rNew, rOld, pStart, bCurRowOnly );
+ ::ClearFEShellTabCols();
+ SetModified();
+}
+
+void SwDoc::SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet )
+{
+ if( nSet == rTable.GetRowsToRepeat() )
+ return;
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoTblHeadline(rTable, rTable.GetRowsToRepeat(), nSet) );
+ }
+
+ SwMsgPoolItem aChg( RES_TBLHEADLINECHG );
+ rTable.SetRowsToRepeat( nSet );
+ rTable.GetFrmFmt()->ModifyNotification( &aChg, &aChg );
+ SetModified();
+}
+
+
+
+
+// Splittet eine Tabelle in der Grund-Zeile, in der der Index steht.
+// Alle GrundZeilen dahinter wandern in eine neue Tabelle/-Node.
+// Ist das Flag bCalcNewSize auf sal_True, wird fuer beide neuen Tabellen
+// die neue Size aus dem Max der Boxen errechnet; vorrausgesetzt,
+// die Size ist "absolut" gesetzt (USHRT_MAX)
+
+void SwCollectTblLineBoxes::AddToUndoHistory( const SwCntntNode& rNd )
+{
+ if( pHst )
+ pHst->Add( rNd.GetFmtColl(), rNd.GetIndex(), ND_TEXTNODE );
+}
+
+void SwCollectTblLineBoxes::AddBox( const SwTableBox& rBox )
+{
+ aPosArr.Insert( nWidth, aPosArr.Count() );
+ SwTableBox* p = (SwTableBox*)&rBox;
+ aBoxes.Insert( p, aBoxes.Count() );
+ nWidth = nWidth + (sal_uInt16)rBox.GetFrmFmt()->GetFrmSize().GetWidth();
+}
+
+const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox )
+{
+ const SwTableBox* pRet = 0;
+ sal_uInt16 n;
+
+ if( aPosArr.Count() )
+ {
+ for( n = 0; n < aPosArr.Count(); ++n )
+ if( aPosArr[ n ] == nWidth )
+ break;
+ else if( aPosArr[ n ] > nWidth )
+ {
+ if( n )
+ --n;
+ break;
+ }
+
+ if( n >= aPosArr.Count() )
+ --n;
+
+ nWidth = nWidth + (sal_uInt16)rBox.GetFrmFmt()->GetFrmSize().GetWidth();
+ pRet = aBoxes[ n ];
+ }
+ return pRet;
+}
+
+sal_Bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth )
+{
+ sal_uInt16 n;
+
+ if( aPosArr.Count() )
+ {
+ for( n = 0; n < aPosArr.Count(); ++n )
+ if( aPosArr[ n ] == nOffset )
+ break;
+ else if( aPosArr[ n ] > nOffset )
+ {
+ if( n )
+ --n;
+ break;
+ }
+
+ aPosArr.Remove( 0, n );
+ aBoxes.Remove( 0, n );
+
+ // dann die Positionen der neuen Size anpassen
+ for( n = 0; n < aPosArr.Count(); ++n )
+ {
+ sal_uLong nSize = nWidth;
+ nSize *= ( aPosArr[ n ] - nOffset );
+ nSize /= nOldWidth;
+ aPosArr[ n ] = sal_uInt16( nSize );
+ }
+ }
+ return 0 != aPosArr.Count();
+}
+
+sal_Bool lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara )
+{
+ SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara;
+ if( pSplPara->IsGetValues() )
+ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_Box_CollectBox, pPara );
+ else
+ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, pPara );
+ return sal_True;
+}
+
+sal_Bool lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara )
+{
+ SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara;
+ sal_uInt16 nLen = rpBox->GetTabLines().Count();
+ if( nLen )
+ {
+ // dann mit der richtigen Line weitermachen
+ if( pSplPara->IsGetFromTop() )
+ nLen = 0;
+ else
+ --nLen;
+
+ const SwTableLine* pLn = rpBox->GetTabLines()[ nLen ];
+ lcl_Line_CollectBox( pLn, pPara );
+ }
+ else
+ pSplPara->AddBox( *rpBox );
+ return sal_True;
+}
+
+sal_Bool lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara )
+{
+ SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara;
+ sal_uInt16 nLen = rpBox->GetTabLines().Count();
+ if( nLen )
+ {
+ // dann mit der richtigen Line weitermachen
+ if( pSplPara->IsGetFromTop() )
+ nLen = 0;
+ else
+ --nLen;
+
+ const SwTableLine* pLn = rpBox->GetTabLines()[ nLen ];
+ lcl_Line_CollectBox( pLn, pPara );
+ }
+ else
+ {
+ const SwTableBox* pSrcBox = pSplPara->GetBoxOfPos( *rpBox );
+ SwFrmFmt* pFmt = pSrcBox->GetFrmFmt();
+ SwTableBox* pBox = (SwTableBox*)rpBox;
+
+ if( HEADLINE_BORDERCOPY == pSplPara->GetMode() )
+ {
+ const SvxBoxItem& rBoxItem = pBox->GetFrmFmt()->GetBox();
+ if( !rBoxItem.GetTop() )
+ {
+ SvxBoxItem aNew( rBoxItem );
+ aNew.SetLine( pFmt->GetBox().GetBottom(), BOX_LINE_TOP );
+ if( aNew != rBoxItem )
+ pBox->ClaimFrmFmt()->SetFmtAttr( aNew );
+ }
+ }
+ else
+ {
+sal_uInt16 __FAR_DATA aTableSplitBoxSetRange[] = {
+ RES_LR_SPACE, RES_UL_SPACE,
+ RES_BACKGROUND, RES_SHADOW,
+ RES_PROTECT, RES_PROTECT,
+ RES_VERT_ORIENT, RES_VERT_ORIENT,
+ 0 };
+ SfxItemSet aTmpSet( pFmt->GetDoc()->GetAttrPool(),
+ aTableSplitBoxSetRange );
+ aTmpSet.Put( pFmt->GetAttrSet() );
+ if( aTmpSet.Count() )
+ pBox->ClaimFrmFmt()->SetFmtAttr( aTmpSet );
+
+ if( HEADLINE_BOXATRCOLLCOPY == pSplPara->GetMode() )
+ {
+ SwNodeIndex aIdx( *pSrcBox->GetSttNd(), 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = aIdx.GetNodes().GoNext( &aIdx );
+ aIdx = *pBox->GetSttNd();
+ SwCntntNode* pDNd = aIdx.GetNodes().GoNext( &aIdx );
+
+ // nur wenn der Node alleine in der Section steht
+ if( 2 == pDNd->EndOfSectionIndex() -
+ pDNd->StartOfSectionIndex() )
+ {
+ pSplPara->AddToUndoHistory( *pDNd );
+ pDNd->ChgFmtColl( pCNd->GetFmtColl() );
+ }
+ }
+
+ // bedingte Vorlage beachten
+ pBox->GetSttNd()->CheckSectionCondColl();
+ }
+ }
+ return sal_True;
+}
+
+
+sal_Bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode,
+ sal_Bool bCalcNewSize )
+{
+ SwNode* pNd = &rPos.nNode.GetNode();
+ SwTableNode* pTNd = pNd->FindTableNode();
+ if( !pTNd || pNd->IsTableNode() )
+ return 0;
+
+ if( pTNd->GetTable().ISA( SwDDETable ))
+ return sal_False;
+
+ SwTable& rTbl = pTNd->GetTable();
+ rTbl.SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ SwTableFmlUpdate aMsgHnt( &rTbl );
+
+ SwHistory aHistory;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ aMsgHnt.pHistory = &aHistory;
+ }
+
+ {
+ sal_uLong nSttIdx = pNd->FindTableBoxStartNode()->GetIndex();
+
+ // Suche die Grund-Line dieser Box:
+ SwTableBox* pBox = rTbl.GetTblBox( nSttIdx );
+ if( pBox )
+ {
+ SwTableLine* pLine = pBox->GetUpper();
+ while( pLine->GetUpper() )
+ pLine = pLine->GetUpper()->GetUpper();
+
+ // in pLine steht jetzt die GrundLine.
+ aMsgHnt.nSplitLine = rTbl.GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ }
+
+ String sNewTblNm( GetUniqueTblName() );
+ aMsgHnt.DATA.pNewTblNm = &sNewTblNm;
+ aMsgHnt.eFlags = TBL_SPLITTBL;
+ UpdateTblFlds( &aMsgHnt );
+ }
+
+ //Lines fuer das Layout-Update heraussuchen.
+ _FndBox aFndBox( 0, 0 );
+ aFndBox.SetTableLines( rTbl );
+ aFndBox.DelFrms( rTbl );
+
+ // TL_CHART2: need to inform chart of probably changed cell names
+ //pDoc->UpdateCharts( rTbl.GetFrmFmt()->GetName() );
+
+ SwTableNode* pNew = GetNodes().SplitTable( rPos.nNode, sal_False, bCalcNewSize );
+
+ if( pNew )
+ {
+ SwSaveRowSpan* pSaveRowSp = pNew->GetTable().CleanUpTopRowSpan( rTbl.GetTabLines().Count() );
+ SwUndoSplitTbl* pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoSplitTbl(
+ *pNew, pSaveRowSp, eHdlnMode, bCalcNewSize);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ if( aHistory.Count() )
+ pUndo->SaveFormula( aHistory );
+ }
+
+ switch( eHdlnMode )
+ {
+ // setze die untere Border der vorherige Line,
+ // an der aktuellen als obere
+ case HEADLINE_BORDERCOPY:
+ {
+ SwCollectTblLineBoxes aPara( sal_False, eHdlnMode );
+ SwTableLine* pLn = rTbl.GetTabLines()[
+ rTbl.GetTabLines().Count() - 1 ];
+ pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aPara );
+
+ aPara.SetValues( sal_True );
+ pLn = pNew->GetTable().GetTabLines()[ 0 ];
+ pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aPara );
+
+ // Kopfzeile wiederholen abschalten
+ pNew->GetTable().SetRowsToRepeat( 0 );
+ }
+ break;
+
+ // setze die Attributierung der ersten Line an der neuen ersten
+ case HEADLINE_BOXATTRCOPY:
+ case HEADLINE_BOXATRCOLLCOPY:
+ {
+ SwHistory* pHst = 0;
+ if( HEADLINE_BOXATRCOLLCOPY == eHdlnMode && pUndo )
+ pHst = pUndo->GetHistory();
+
+ SwCollectTblLineBoxes aPara( sal_True, eHdlnMode, pHst );
+ SwTableLine* pLn = rTbl.GetTabLines()[ 0 ];
+ pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aPara );
+
+ aPara.SetValues( sal_True );
+ pLn = pNew->GetTable().GetTabLines()[ 0 ];
+ pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aPara );
+ }
+ break;
+
+ case HEADLINE_CNTNTCOPY:
+ rTbl.CopyHeadlineIntoTable( *pNew );
+ if( pUndo )
+ pUndo->SetTblNodeOffset( pNew->GetIndex() );
+ break;
+
+ case HEADLINE_NONE:
+ // Kopfzeile wiederholen abschalten
+ pNew->GetTable().SetRowsToRepeat( 0 );
+ break;
+ }
+
+ // und Frms einfuegen.
+ SwNodeIndex aNdIdx( *pNew->EndOfSectionNode() );
+ GetNodes().GoNext( &aNdIdx ); // zum naechsten ContentNode
+ pNew->MakeFrms( &aNdIdx );
+
+ //Zwischen die Tabellen wird ein Absatz geschoben
+ GetNodes().MakeTxtNode( SwNodeIndex( *pNew ),
+ GetTxtCollFromPool( RES_POOLCOLL_TEXT ) );
+ }
+
+ //Layout updaten
+ aFndBox.MakeFrms( rTbl );
+
+ // TL_CHART2: need to inform chart of probably changed cell names
+ UpdateCharts( rTbl.GetFrmFmt()->GetName() );
+
+ SetFieldsDirty( true, NULL, 0 );
+
+ return 0 != pNew;
+}
+
+sal_Bool lcl_ChgTblSize( SwTable& rTbl )
+{
+ // das Attribut darf nicht ueber das Modify an der
+ // Tabelle gesetzt werden, denn sonst werden alle
+ // Boxen wieder auf 0 zurueck gesetzt. Also locke das Format
+ SwFrmFmt* pFmt = rTbl.GetFrmFmt();
+ SwFmtFrmSize aTblMaxSz( pFmt->GetFrmSize() );
+
+ if( USHRT_MAX == aTblMaxSz.GetWidth() )
+ return sal_False;
+
+ sal_Bool bLocked = pFmt->IsModifyLocked();
+ pFmt->LockModify();
+
+ aTblMaxSz.SetWidth( 0 );
+
+ SwTableLines& rLns = rTbl.GetTabLines();
+ for( sal_uInt16 nLns = 0; nLns < rLns.Count(); ++nLns )
+ {
+ SwTwips nMaxLnWidth = 0;
+ SwTableBoxes& rBoxes = rLns[ nLns ]->GetTabBoxes();
+ for( sal_uInt16 nBox = 0; nBox < rBoxes.Count(); ++nBox )
+ nMaxLnWidth += rBoxes[nBox]->GetFrmFmt()->GetFrmSize().GetWidth();
+
+ if( nMaxLnWidth > aTblMaxSz.GetWidth() )
+ aTblMaxSz.SetWidth( nMaxLnWidth );
+ }
+ pFmt->SetFmtAttr( aTblMaxSz );
+ if( !bLocked ) // und gegebenenfalls Lock wieder freigeben
+ pFmt->UnlockModify();
+
+ return sal_True;
+}
+
+class _SplitTable_Para
+{
+ SvPtrarr aSrc, aDest;
+ SwTableNode* pNewTblNd;
+ SwTable& rOldTbl;
+
+public:
+ _SplitTable_Para( SwTableNode* pNew, SwTable& rOld )
+ : aSrc( 16, 16 ), aDest( 16, 16 ), pNewTblNd( pNew ), rOldTbl( rOld )
+ {}
+ sal_uInt16 SrcFmt_GetPos( void* pFmt ) const
+ { return aSrc.GetPos( pFmt ); }
+
+ void DestFmt_Insert( void* pFmt )
+ { aDest.Insert( pFmt, aDest.Count() ); }
+
+ void SrcFmt_Insert( void* pFmt )
+ { aSrc.Insert( pFmt, aSrc.Count() ); }
+
+ SwFrmFmt* DestFmt_Get( sal_uInt16 nPos ) const
+ { return (SwFrmFmt*)aDest[ nPos ]; }
+
+ void ChgBox( SwTableBox* pBox )
+ {
+ rOldTbl.GetTabSortBoxes().Remove( pBox );
+ pNewTblNd->GetTable().GetTabSortBoxes().Insert( pBox );
+ }
+};
+
+
+sal_Bool lcl_SplitTable_CpyBox( const SwTableBox*& rpBox, void* pPara );
+
+sal_Bool lcl_SplitTable_CpyLine( const SwTableLine*& rpLine, void* pPara )
+{
+ SwTableLine* pLn = (SwTableLine*)rpLine;
+ _SplitTable_Para& rPara = *(_SplitTable_Para*)pPara;
+
+ SwFrmFmt *pSrcFmt = pLn->GetFrmFmt();
+ sal_uInt16 nPos = rPara.SrcFmt_GetPos( pSrcFmt );
+ if( USHRT_MAX == nPos )
+ {
+ rPara.DestFmt_Insert( pLn->ClaimFrmFmt() );
+ rPara.SrcFmt_Insert( pSrcFmt );
+ }
+ else
+ pLn->ChgFrmFmt( (SwTableLineFmt*)rPara.DestFmt_Get( nPos ) );
+
+ pLn->GetTabBoxes().ForEach( &lcl_SplitTable_CpyBox, pPara );
+ return sal_True;
+}
+
+sal_Bool lcl_SplitTable_CpyBox( const SwTableBox*& rpBox, void* pPara )
+{
+ SwTableBox* pBox = (SwTableBox*)rpBox;
+ _SplitTable_Para& rPara = *(_SplitTable_Para*)pPara;
+
+ SwFrmFmt *pSrcFmt = pBox->GetFrmFmt();
+ sal_uInt16 nPos = rPara.SrcFmt_GetPos( pSrcFmt );
+ if( USHRT_MAX == nPos )
+ {
+ rPara.DestFmt_Insert( pBox->ClaimFrmFmt() );
+ rPara.SrcFmt_Insert( pSrcFmt );
+ }
+ else
+ pBox->ChgFrmFmt( (SwTableBoxFmt*)rPara.DestFmt_Get( nPos ) );
+
+ if( pBox->GetSttNd() )
+ rPara.ChgBox( pBox );
+ else
+ pBox->GetTabLines().ForEach( &lcl_SplitTable_CpyLine, pPara );
+ return sal_True;
+}
+
+SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter,
+ sal_Bool bCalcNewSize )
+{
+ SwNode* pNd = &rPos.GetNode();
+ SwTableNode* pTNd = pNd->FindTableNode();
+ if( !pTNd || pNd->IsTableNode() )
+ return 0;
+
+ sal_uLong nSttIdx = pNd->FindTableBoxStartNode()->GetIndex();
+
+ // Suche die Grund-Line dieser Box:
+ SwTable& rTbl = pTNd->GetTable();
+ SwTableBox* pBox = rTbl.GetTblBox( nSttIdx );
+ if( !pBox )
+ return 0;
+
+ SwTableLine* pLine = pBox->GetUpper();
+ while( pLine->GetUpper() )
+ pLine = pLine->GetUpper()->GetUpper();
+
+ // in pLine steht jetzt die GrundLine.
+ sal_uInt16 nLinePos = rTbl.GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ if( USHRT_MAX == nLinePos ||
+ ( bAfter ? ++nLinePos >= rTbl.GetTabLines().Count() : !nLinePos ))
+ return 0; // nicht gefunden oder letze Line !!
+
+ // Suche jetzt die 1. Box der nachfolgenden Line
+ SwTableLine* pNextLine = rTbl.GetTabLines()[ nLinePos ];
+ pBox = pNextLine->GetTabBoxes()[0];
+ while( !pBox->GetSttNd() )
+ pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0];
+
+ // dann fuege mal einen End- und TabelleNode ins Nodes-Array ein.
+ SwTableNode * pNewTblNd;
+ {
+ SwEndNode* pOldTblEndNd = (SwEndNode*)pTNd->EndOfSectionNode()->GetEndNode();
+ ASSERT( pOldTblEndNd, "wo ist der EndNode?" )
+
+ SwNodeIndex aIdx( *pBox->GetSttNd() );
+ new SwEndNode( aIdx, *pTNd );
+ pNewTblNd = new SwTableNode( aIdx );
+ pNewTblNd->GetTable().SetTableModel( rTbl.IsNewModel() );
+
+ pOldTblEndNd->pStartOfSection = pNewTblNd;
+ pNewTblNd->pEndOfSection = pOldTblEndNd;
+
+ SwNode* pBoxNd = aIdx.GetNode().GetStartNode();
+ do {
+ ASSERT( pBoxNd->IsStartNode(), "das muss ein StartNode sein!" );
+ pBoxNd->pStartOfSection = pNewTblNd;
+ pBoxNd = (*this)[ pBoxNd->EndOfSectionIndex() + 1 ];
+ } while( pBoxNd != pOldTblEndNd );
+ }
+
+ {
+ // die Lines ruebermoven...
+ SwTable& rNewTbl = pNewTblNd->GetTable();
+ rNewTbl.GetTabLines().Insert( &rTbl.GetTabLines(), 0, nLinePos );
+ //
+ // von hinten (unten-rechts) nach vorn (oben-links) alle Boxen
+ // beim chart data provider austragen (das modified event wird dann
+ // in der aufrufenden Funktion getriggert.
+ // TL_CHART2:
+ SwChartDataProvider *pPCD = rTbl.GetFrmFmt()->getIDocumentChartDataProviderAccess()->GetChartDataProvider();
+ if( pPCD )
+ {
+ for (sal_uInt16 k = nLinePos; k < rTbl.GetTabLines().Count(); ++k)
+ {
+ sal_uInt16 nLineIdx = (rTbl.GetTabLines().Count() - 1) - k + nLinePos;
+ sal_uInt16 nBoxCnt = rTbl.GetTabLines()[ nLineIdx ]->GetTabBoxes().Count();
+ for (sal_uInt16 j = 0; j < nBoxCnt; ++j)
+ {
+ sal_uInt16 nIdx = nBoxCnt - 1 - j;
+ pPCD->DeleteBox( &rTbl, *rTbl.GetTabLines()[ nLineIdx ]->GetTabBoxes()[nIdx] );
+ }
+ }
+ }
+ //
+ // ...und loeschen
+ sal_uInt16 nDeleted = rTbl.GetTabLines().Count() - nLinePos;
+ rTbl.GetTabLines().Remove( nLinePos, nDeleted );
+
+ // und die betr. Boxen verschieben. Dabei die Formate eindeutig
+ // machen und die StartNodes korrigieren
+ _SplitTable_Para aPara( pNewTblNd, rTbl );
+ rNewTbl.GetTabLines().ForEach( &lcl_SplitTable_CpyLine, &aPara );
+ rTbl.CleanUpBottomRowSpan( nDeleted );
+ }
+
+ {
+ // Das Tabellen-FrmFormat kopieren
+ SwFrmFmt* pOldTblFmt = rTbl.GetFrmFmt();
+ SwFrmFmt* pNewTblFmt = pOldTblFmt->GetDoc()->MakeTblFrmFmt(
+ pOldTblFmt->GetDoc()->GetUniqueTblName(),
+ pOldTblFmt->GetDoc()->GetDfltFrmFmt() );
+
+ *pNewTblFmt = *pOldTblFmt;
+ pNewTblNd->GetTable().RegisterToFormat( *pNewTblFmt );
+
+ // neue Size errechnen ? (lcl_ChgTblSize nur das 2. aufrufen, wenn es
+ // beim 1. schon geklappt hat; also absolute Groesse hat)
+ if( bCalcNewSize && lcl_ChgTblSize( rTbl ) )
+ lcl_ChgTblSize( pNewTblNd->GetTable() );
+ }
+
+ // TL_CHART2: need to inform chart of probably changed cell names
+ rTbl.UpdateCharts();
+
+ return pNewTblNd; // das wars
+}
+
+// und die Umkehrung davon. rPos muss in der Tabelle stehen, die bestehen
+// bleibt. Das Flag besagt ob die aktuelle mit der davor oder dahinter
+// stehenden vereint wird.
+sal_Bool SwDoc::MergeTable( const SwPosition& rPos, sal_Bool bWithPrev, sal_uInt16 nMode )
+{
+ SwTableNode* pTblNd = rPos.nNode.GetNode().FindTableNode(), *pDelTblNd;
+ if( !pTblNd )
+ return sal_False;
+
+ SwNodes& rNds = GetNodes();
+ if( bWithPrev )
+ pDelTblNd = rNds[ pTblNd->GetIndex() - 1 ]->FindTableNode();
+ else
+ pDelTblNd = rNds[ pTblNd->EndOfSectionIndex() + 1 ]->GetTableNode();
+ if( !pDelTblNd )
+ return sal_False;
+
+ if( pTblNd->GetTable().ISA( SwDDETable ) ||
+ pDelTblNd->GetTable().ISA( SwDDETable ))
+ return sal_False;
+
+ // MIB 9.7.97: HTML-Layout loeschen
+ pTblNd->GetTable().SetHTMLTableLayout( 0 );
+ pDelTblNd->GetTable().SetHTMLTableLayout( 0 );
+
+ // beide Tabellen vorhanden, also kanns losgehen
+ SwUndoMergeTbl* pUndo = 0;
+ SwHistory* pHistory = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoMergeTbl( *pTblNd, *pDelTblNd, bWithPrev, nMode );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ pHistory = new SwHistory;
+ }
+
+ // alle "Tabellenformeln" anpassen
+ SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() );
+ aMsgHnt.DATA.pDelTbl = &pDelTblNd->GetTable();
+ aMsgHnt.eFlags = TBL_MERGETBL;
+ aMsgHnt.pHistory = pHistory;
+ UpdateTblFlds( &aMsgHnt );
+
+ // das eigentliche Mergen
+ SwNodeIndex aIdx( bWithPrev ? *pTblNd : *pDelTblNd );
+ sal_Bool bRet = rNds.MergeTable( aIdx, !bWithPrev, nMode, pHistory );
+
+ if( pHistory )
+ {
+ if( pHistory->Count() )
+ pUndo->SaveFormula( *pHistory );
+ delete pHistory;
+ }
+ if( bRet )
+ {
+ SetModified();
+ SetFieldsDirty( true, NULL, 0 );
+ }
+ return bRet;
+}
+
+sal_Bool SwNodes::MergeTable( const SwNodeIndex& rPos, sal_Bool bWithPrev,
+ sal_uInt16 nMode, SwHistory* )
+{
+ SwTableNode* pDelTblNd = rPos.GetNode().GetTableNode();
+ ASSERT( pDelTblNd, "wo ist der TableNode geblieben?" );
+
+ SwTableNode* pTblNd = (*this)[ rPos.GetIndex() - 1]->FindTableNode();
+ ASSERT( pTblNd, "wo ist der TableNode geblieben?" );
+
+ if( !pDelTblNd || !pTblNd )
+ return sal_False;
+
+ pDelTblNd->DelFrms();
+
+ SwTable& rDelTbl = pDelTblNd->GetTable();
+ SwTable& rTbl = pTblNd->GetTable();
+
+ //Lines fuer das Layout-Update herausuchen.
+ _FndBox aFndBox( 0, 0 );
+ aFndBox.SetTableLines( rTbl );
+ aFndBox.DelFrms( rTbl );
+
+ // TL_CHART2: since chart currently does not want to get informed about
+ // additional rows/cols there is no need for a modified event in the
+ // remaining first table. Also, if it is required it should be done
+ // after the merging and not here...
+ // pDoc->UpdateCharts( rTbl.GetFrmFmt()->GetName() );
+
+
+ // TL_CHART2:
+ // tell the charts about the table to be deleted and have them use their own data
+ GetDoc()->CreateChartInternalDataProviders( &rDelTbl );
+
+ // die Breite der TabellenFormate abgleichen:
+ {
+ const SwFmtFrmSize& rTblSz = rTbl.GetFrmFmt()->GetFrmSize();
+ const SwFmtFrmSize& rDelTblSz = rDelTbl.GetFrmFmt()->GetFrmSize();
+ if( rTblSz != rDelTblSz )
+ {
+ // dann sollten die mal schleunigst korrigiert werden
+ if( bWithPrev )
+ rDelTbl.GetFrmFmt()->SetFmtAttr( rTblSz );
+ else
+ rTbl.GetFrmFmt()->SetFmtAttr( rDelTblSz );
+ }
+ }
+
+ if( !bWithPrev )
+ {
+ // dann mussen alle Attruibute der hinteren Tabelle auf die
+ // vordere uebertragen werden, weil die hintere ueber das loeschen
+ // des Node geloescht wird.
+ rTbl.SetRowsToRepeat( rDelTbl.GetRowsToRepeat() );
+ rTbl.SetTblChgMode( rDelTbl.GetTblChgMode() );
+
+ rTbl.GetFrmFmt()->LockModify();
+ *rTbl.GetFrmFmt() = *rDelTbl.GetFrmFmt();
+ // auch den Namen umsetzen!
+ rTbl.GetFrmFmt()->SetName( rDelTbl.GetFrmFmt()->GetName() );
+ rTbl.GetFrmFmt()->UnlockModify();
+ }
+
+ // die Lines und Boxen ruebermoven
+ sal_uInt16 nOldSize = rTbl.GetTabLines().Count();
+ rTbl.GetTabLines().Insert( &rDelTbl.GetTabLines(), nOldSize );
+ rDelTbl.GetTabLines().Remove( 0, rDelTbl.GetTabLines().Count() );
+
+ rTbl.GetTabSortBoxes().Insert( &rDelTbl.GetTabSortBoxes() );
+ rDelTbl.GetTabSortBoxes().Remove( (sal_uInt16)0, rDelTbl.GetTabSortBoxes().Count() );
+
+ // die vordere Tabelle bleibt immer stehen, die hintere wird geloescht
+ SwEndNode* pTblEndNd = pDelTblNd->EndOfSectionNode();
+ pTblNd->pEndOfSection = pTblEndNd;
+
+ SwNodeIndex aIdx( *pDelTblNd, 1 );
+
+ SwNode* pBoxNd = aIdx.GetNode().GetStartNode();
+ do {
+ ASSERT( pBoxNd->IsStartNode(), "das muss ein StartNode sein!" );
+ pBoxNd->pStartOfSection = pTblNd;
+ pBoxNd = (*this)[ pBoxNd->EndOfSectionIndex() + 1 ];
+ } while( pBoxNd != pTblEndNd );
+ pBoxNd->pStartOfSection = pTblNd;
+
+ aIdx -= 2;
+ DelNodes( aIdx, 2 );
+
+ // jetzt an der 1. eingefuegten Line die bedingten Vorlagen umschubsen
+ const SwTableLine* pFirstLn = rTbl.GetTabLines()[ nOldSize ];
+ if( 1 == nMode ) //
+ {
+ // Header-Vorlagen in der Zeile setzen
+ // und ggfs. in der History speichern fuers Undo!!!
+ }
+ lcl_LineSetHeadCondColl( pFirstLn, 0 );
+
+ // und die Borders "aufrauemen"
+ if( nOldSize )
+ {
+ _SwGCLineBorder aPara( rTbl );
+ aPara.nLinePos = --nOldSize;
+ pFirstLn = rTbl.GetTabLines()[ nOldSize ];
+ lcl_GC_Line_Border( pFirstLn, &aPara );
+ }
+
+ //Layout updaten
+ aFndBox.MakeFrms( rTbl );
+
+ return sal_True;
+}
+
+// -------------------------------------------------------------------
+
+
+// -- benutze die ForEach Methode vom PtrArray
+struct _SetAFmtTabPara
+{
+ SwTableAutoFmt& rTblFmt;
+ SwUndoTblAutoFmt* pUndo;
+ sal_uInt16 nEndBox, nCurBox;
+ sal_uInt8 nAFmtLine, nAFmtBox;
+
+ _SetAFmtTabPara( const SwTableAutoFmt& rNew )
+ : rTblFmt( (SwTableAutoFmt&)rNew ), pUndo( 0 ),
+ nEndBox( 0 ), nCurBox( 0 ), nAFmtLine( 0 ), nAFmtBox( 0 )
+ {}
+};
+
+// forward deklarieren damit sich die Lines und Boxen rekursiv aufrufen
+// koennen.
+sal_Bool lcl_SetAFmtBox( const _FndBox*&, void *pPara );
+sal_Bool lcl_SetAFmtLine( const _FndLine*&, void *pPara );
+
+sal_Bool lcl_SetAFmtLine( const _FndLine*& rpLine, void *pPara )
+{
+ ((_FndLine*&)rpLine)->GetBoxes().ForEach( &lcl_SetAFmtBox, pPara );
+ return sal_True;
+}
+
+sal_Bool lcl_SetAFmtBox( const _FndBox*& rpBox, void *pPara )
+{
+ _SetAFmtTabPara* pSetPara = (_SetAFmtTabPara*)pPara;
+
+ if( !rpBox->GetUpper()->GetUpper() ) // Box auf 1. Ebene ?
+ {
+ if( !pSetPara->nCurBox )
+ pSetPara->nAFmtBox = 0;
+ else if( pSetPara->nCurBox == pSetPara->nEndBox )
+ pSetPara->nAFmtBox = 3;
+ else
+ pSetPara->nAFmtBox = (sal_uInt8)(1 + ((pSetPara->nCurBox-1) & 1));
+ }
+
+ if( rpBox->GetBox()->GetSttNd() )
+ {
+ SwTableBox* pSetBox = (SwTableBox*)rpBox->GetBox();
+ SwDoc* pDoc = pSetBox->GetFrmFmt()->GetDoc();
+ // --> OD 2008-02-25 #refactorlists#
+// SfxItemSet aCharSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_END-1 );
+ SfxItemSet aCharSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1 );
+ // <--
+ SfxItemSet aBoxSet( pDoc->GetAttrPool(), aTableBoxSetRange );
+ sal_uInt8 nPos = pSetPara->nAFmtLine * 4 + pSetPara->nAFmtBox;
+ pSetPara->rTblFmt.UpdateToSet( nPos, aCharSet,
+ SwTableAutoFmt::UPDATE_CHAR, 0 );
+ pSetPara->rTblFmt.UpdateToSet( nPos, aBoxSet,
+ SwTableAutoFmt::UPDATE_BOX,
+ pDoc->GetNumberFormatter( sal_True ) );
+ if( aCharSet.Count() )
+ {
+ sal_uLong nSttNd = pSetBox->GetSttIdx()+1;
+ sal_uLong nEndNd = pSetBox->GetSttNd()->EndOfSectionIndex();
+ for( ; nSttNd < nEndNd; ++nSttNd )
+ {
+ SwCntntNode* pNd = pDoc->GetNodes()[ nSttNd ]->GetCntntNode();
+ if( pNd )
+ pNd->SetAttr( aCharSet );
+ }
+ }
+
+ if( aBoxSet.Count() )
+ {
+ if( pSetPara->pUndo &&
+ SFX_ITEM_SET == aBoxSet.GetItemState( RES_BOXATR_FORMAT ))
+ pSetPara->pUndo->SaveBoxCntnt( *pSetBox );
+
+ pSetBox->ClaimFrmFmt()->SetFmtAttr( aBoxSet );
+ }
+ }
+ else
+ ((_FndBox*&)rpBox)->GetLines().ForEach( &lcl_SetAFmtLine, pPara );
+
+ if( !rpBox->GetUpper()->GetUpper() ) // eine BaseLine
+ ++pSetPara->nCurBox;
+ return sal_True;
+}
+
+
+ // AutoFormat fuer die Tabelle/TabellenSelection
+sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew )
+{
+ ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ // suche alle Boxen / Lines
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aPara( rBoxes, &aFndBox );
+ pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ }
+ if( !aFndBox.GetLines().Count() )
+ return sal_False;
+
+ pTblNd->GetTable().SetHTMLTableLayout( 0 );
+
+ _FndBox* pFndBox = &aFndBox;
+ while( 1 == pFndBox->GetLines().Count() &&
+ 1 == pFndBox->GetLines()[0]->GetBoxes().Count() )
+ pFndBox = pFndBox->GetLines()[0]->GetBoxes()[0];
+
+ if( !pFndBox->GetLines().Count() ) // eine zu weit? (nur 1 sel.Box)
+ pFndBox = pFndBox->GetUpper()->GetUpper();
+
+
+ // Undo abschalten, Attribute werden sich vorher gemerkt
+ SwUndoTblAutoFmt* pUndo = 0;
+ bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
+ if (bUndo)
+ {
+ pUndo = new SwUndoTblAutoFmt( *pTblNd, rNew );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ GetIDocumentUndoRedo().DoUndo(false);
+ }
+
+ _SetAFmtTabPara aPara( rNew );
+ _FndLines& rFLns = pFndBox->GetLines();
+ _FndLine* pLine;
+
+ for( sal_uInt16 n = 0; n < rFLns.Count(); ++n )
+ {
+ pLine = rFLns[n];
+
+ // Upper auf 0 setzen (Base-Line simulieren!)
+ _FndBox* pSaveBox = pLine->GetUpper();
+ pLine->SetUpper( 0 );
+
+ if( !n )
+ aPara.nAFmtLine = 0;
+ else if( n+1 == rFLns.Count() )
+ aPara.nAFmtLine = 3;
+ else
+ aPara.nAFmtLine = (sal_uInt8)(1 + ((n-1) & 1 ));
+
+ aPara.nAFmtBox = 0;
+ aPara.nCurBox = 0;
+ aPara.nEndBox = pLine->GetBoxes().Count()-1;
+ aPara.pUndo = pUndo;
+ pLine->GetBoxes().ForEach( &lcl_SetAFmtBox, &aPara );
+
+ pLine->SetUpper( pSaveBox );
+ }
+
+ if( pUndo )
+ {
+ GetIDocumentUndoRedo().DoUndo(bUndo);
+ }
+
+ SetModified();
+ SetFieldsDirty( true, NULL, 0 );
+
+ return sal_True;
+}
+
+
+ // Erfrage wie attributiert ist
+sal_Bool SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet )
+{
+ ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return sal_False;
+
+ // suche alle Boxen / Lines
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aPara( rBoxes, &aFndBox );
+ pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ }
+ if( !aFndBox.GetLines().Count() )
+ return sal_False;
+
+ _FndBox* pFndBox = &aFndBox;
+ while( 1 == pFndBox->GetLines().Count() &&
+ 1 == pFndBox->GetLines()[0]->GetBoxes().Count() )
+ pFndBox = pFndBox->GetLines()[0]->GetBoxes()[0];
+
+ if( !pFndBox->GetLines().Count() ) // eine zu weit? (nur 1 sel.Box)
+ pFndBox = pFndBox->GetUpper()->GetUpper();
+
+ _FndLines& rFLns = pFndBox->GetLines();
+
+ sal_uInt16 aLnArr[4];
+ aLnArr[0] = 0;
+ aLnArr[1] = 1 < rFLns.Count() ? 1 : 0;
+ aLnArr[2] = 2 < rFLns.Count() ? 2 : aLnArr[1];
+ aLnArr[3] = rFLns.Count() - 1;
+
+ for( sal_uInt8 nLine = 0; nLine < 4; ++nLine )
+ {
+ _FndLine& rLine = *rFLns[ aLnArr[ nLine ] ];
+
+ sal_uInt16 aBoxArr[4];
+ aBoxArr[0] = 0;
+ aBoxArr[1] = 1 < rLine.GetBoxes().Count() ? 1 : 0;
+ aBoxArr[2] = 2 < rLine.GetBoxes().Count() ? 2 : aBoxArr[1];
+ aBoxArr[3] = rLine.GetBoxes().Count() - 1;
+
+ for( sal_uInt8 nBox = 0; nBox < 4; ++nBox )
+ {
+ SwTableBox* pFBox = rLine.GetBoxes()[ aBoxArr[ nBox ] ]->GetBox();
+ // immer auf die 1. runterfallen
+ while( !pFBox->GetSttNd() )
+ pFBox = pFBox->GetTabLines()[0]->GetTabBoxes()[0];
+
+ sal_uInt8 nPos = nLine * 4 + nBox;
+ SwNodeIndex aIdx( *pFBox->GetSttNd(), 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetNodes().GoNext( &aIdx );
+
+ if( pCNd )
+ rGet.UpdateFromSet( nPos, pCNd->GetSwAttrSet(),
+ SwTableAutoFmt::UPDATE_CHAR, 0 );
+ rGet.UpdateFromSet( nPos, pFBox->GetFrmFmt()->GetAttrSet(),
+ SwTableAutoFmt::UPDATE_BOX,
+ GetNumberFormatter( sal_True ) );
+ }
+ }
+
+ return sal_True;
+}
+
+String SwDoc::GetUniqueTblName() const
+{
+ ResId aId( STR_TABLE_DEFNAME, *pSwResMgr );
+ String aName( aId );
+ xub_StrLen nNmLen = aName.Len();
+
+ sal_uInt16 nNum, nTmp, nFlagSize = ( pTblFrmFmtTbl->Count() / 8 ) +2;
+ sal_uInt16 n;
+
+ sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
+ memset( pSetFlags, 0, nFlagSize );
+
+ for( n = 0; n < pTblFrmFmtTbl->Count(); ++n )
+ {
+ const SwFrmFmt* pFmt = (*pTblFrmFmtTbl)[ n ];
+ if( !pFmt->IsDefault() && IsUsed( *pFmt ) &&
+ pFmt->GetName().Match( aName ) == nNmLen )
+ {
+ // Nummer bestimmen und das Flag setzen
+ nNum = static_cast<sal_uInt16>(pFmt->GetName().Copy( nNmLen ).ToInt32());
+ if( nNum-- && nNum < pTblFrmFmtTbl->Count() )
+ pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
+ }
+ }
+
+ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+ nNum = pTblFrmFmtTbl->Count();
+ for( n = 0; n < nFlagSize; ++n )
+ if( 0xff != ( nTmp = pSetFlags[ n ] ))
+ {
+ // also die Nummer bestimmen
+ nNum = n * 8;
+ while( nTmp & 1 )
+ ++nNum, nTmp >>= 1;
+ break;
+ }
+
+ delete [] pSetFlags;
+ return aName += String::CreateFromInt32( ++nNum );
+}
+
+SwTableFmt* SwDoc::FindTblFmtByName( const String& rName, sal_Bool bAll ) const
+{
+ const SwFmt* pRet = 0;
+ if( bAll )
+ pRet = FindFmtByName( (SvPtrarr&)*pTblFrmFmtTbl, rName );
+ else
+ {
+ // dann nur die, die im Doc gesetzt sind
+ for( sal_uInt16 n = 0; n < pTblFrmFmtTbl->Count(); ++n )
+ {
+ const SwFrmFmt* pFmt = (*pTblFrmFmtTbl)[ n ];
+ if( !pFmt->IsDefault() && IsUsed( *pFmt ) &&
+ pFmt->GetName() == rName )
+ {
+ pRet = pFmt;
+ break;
+ }
+ }
+ }
+ return (SwTableFmt*)pRet;
+}
+
+sal_Bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType,
+ SwTwips nAbsDiff, SwTwips nRelDiff )
+{
+ SwTableNode* pTblNd = (SwTableNode*)rAktBox.GetSttNd()->FindTableNode();
+ SwUndo* pUndo = 0;
+
+ if( nsTblChgWidthHeightType::WH_FLAG_INSDEL & eType && pTblNd->GetTable().ISA( SwDDETable ))
+ return sal_False;
+
+ SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() );
+ aMsgHnt.eFlags = TBL_BOXPTR;
+ UpdateTblFlds( &aMsgHnt );
+
+ bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
+ sal_Bool bRet = sal_False;
+ switch( eType & 0xff )
+ {
+ case nsTblChgWidthHeightType::WH_COL_LEFT:
+ case nsTblChgWidthHeightType::WH_COL_RIGHT:
+ case nsTblChgWidthHeightType::WH_CELL_LEFT:
+ case nsTblChgWidthHeightType::WH_CELL_RIGHT:
+ {
+ bRet = pTblNd->GetTable().SetColWidth( rAktBox,
+ eType, nAbsDiff, nRelDiff,
+ (bUndo) ? &pUndo : 0 );
+ }
+ break;
+ case nsTblChgWidthHeightType::WH_ROW_TOP:
+ case nsTblChgWidthHeightType::WH_ROW_BOTTOM:
+ case nsTblChgWidthHeightType::WH_CELL_TOP:
+ case nsTblChgWidthHeightType::WH_CELL_BOTTOM:
+ bRet = pTblNd->GetTable().SetRowHeight( rAktBox,
+ eType, nAbsDiff, nRelDiff,
+ (bUndo) ? &pUndo : 0 );
+ break;
+ }
+
+ GetIDocumentUndoRedo().DoUndo(bUndo); // SetColWidth can turn it off
+ if( pUndo )
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+
+ if( bRet )
+ {
+ SetModified();
+ if( nsTblChgWidthHeightType::WH_FLAG_INSDEL & eType )
+ SetFieldsDirty( true, NULL, 0 );
+ }
+ return bRet;
+}
+
+
+void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, sal_Bool bCallUpdate )
+{
+ //JP 09.07.97: Optimierung: wenn die Box schon sagt, das es Text
+ // sein soll, dann bleibt das auch Text!
+ const SfxPoolItem* pNumFmtItem = 0;
+ if( SFX_ITEM_SET == rBox.GetFrmFmt()->GetItemState( RES_BOXATR_FORMAT,
+ sal_False, &pNumFmtItem ) && GetNumberFormatter()->IsTextFormat(
+ ((SwTblBoxNumFormat*)pNumFmtItem)->GetValue() ))
+ return ;
+
+ SwUndoTblNumFmt* pUndo = 0;
+
+ sal_Bool bIsEmptyTxtNd, bChgd = sal_True;
+ sal_uInt32 nFmtIdx;
+ double fNumber;
+ if( rBox.HasNumCntnt( fNumber, nFmtIdx, bIsEmptyTxtNd ) )
+ {
+ if( !rBox.IsNumberChanged() )
+ bChgd = sal_False;
+ else
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_AUTOFMT, NULL );
+ pUndo = new SwUndoTblNumFmt( rBox );
+ pUndo->SetNumFmt( nFmtIdx, fNumber );
+ }
+
+ SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rBox.GetFrmFmt();
+ SfxItemSet aBoxSet( GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_VALUE );
+
+ sal_Bool bSetNumFmt = IsInsTblFormatNum(), bLockModify = sal_True;
+ if( bSetNumFmt )
+ {
+ if( !IsInsTblChangeNumFormat() )
+ {
+ if( !pNumFmtItem )
+ bSetNumFmt = sal_False;
+ else
+ {
+ sal_uLong nOldNumFmt = ((SwTblBoxNumFormat*)pNumFmtItem)->
+ GetValue();
+ SvNumberFormatter* pNumFmtr = GetNumberFormatter();
+
+ short nFmtType = pNumFmtr->GetType( nFmtIdx );
+ if( nFmtType == pNumFmtr->GetType( nOldNumFmt ) ||
+ NUMBERFORMAT_NUMBER == nFmtType )
+ // eingstelltes und vorgegebenes NumFormat
+ // stimmen ueberein -> altes Format beibehalten
+ nFmtIdx = nOldNumFmt;
+ else
+ // eingstelltes und vorgegebenes NumFormat
+ // stimmen nicht ueberein -> als Text einfuegen
+ bLockModify = bSetNumFmt = sal_False;
+ }
+ }
+
+ if( bSetNumFmt )
+ {
+ pBoxFmt = (SwTableBoxFmt*)rBox.ClaimFrmFmt();
+
+ aBoxSet.Put( SwTblBoxValue( fNumber ));
+ aBoxSet.Put( SwTblBoxNumFormat( nFmtIdx ));
+ }
+ }
+
+ // JP 28.04.98: Nur Formel zuruecksetzen reicht nicht.
+ // Sorge dafuer, das der Text auch entsprechend
+ // formatiert wird!
+
+ if( !bSetNumFmt && !bIsEmptyTxtNd && pNumFmtItem )
+ {
+ // JP 15.01.99: Nur Attribute zuruecksetzen reicht nicht.
+ // Sorge dafuer, das der Text auch entsprechend
+ // formatiert wird!
+ pBoxFmt->SetFmtAttr( *GetDfltAttr( RES_BOXATR_FORMAT ));
+ }
+
+ if( bLockModify ) pBoxFmt->LockModify();
+ pBoxFmt->ResetFmtAttr( RES_BOXATR_FORMAT, RES_BOXATR_VALUE );
+ if( bLockModify ) pBoxFmt->UnlockModify();
+
+ if( bSetNumFmt )
+ pBoxFmt->SetFmtAttr( aBoxSet );
+ }
+ }
+ else
+ {
+ // es ist keine Zahl
+ const SfxPoolItem* pValueItem = 0, *pFmtItem = 0;
+ SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rBox.GetFrmFmt();
+ if( SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_FORMAT,
+ sal_False, &pFmtItem ) ||
+ SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_VALUE,
+ sal_False, &pValueItem ))
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_AUTOFMT, NULL );
+ pUndo = new SwUndoTblNumFmt( rBox );
+ }
+
+ pBoxFmt = (SwTableBoxFmt*)rBox.ClaimFrmFmt();
+
+ // alle Zahlenformate entfernen
+ sal_uInt16 nWhich1 = RES_BOXATR_FORMULA;
+ if( !bIsEmptyTxtNd )
+ //JP 15.01.99: dieser Teil wurde doch schon oben abgeprueft!
+ /* && pFmtItem && !GetNumberFormatter()->
+ IsTextFormat( ((SwTblBoxNumFormat*)pFmtItem)->GetValue() ) )*/
+ {
+ nWhich1 = RES_BOXATR_FORMAT;
+
+ // JP 15.01.99: Nur Attribute zuruecksetzen reicht nicht.
+ // Sorge dafuer, das der Text auch entsprechend
+ // formatiert wird!
+ pBoxFmt->SetFmtAttr( *GetDfltAttr( nWhich1 ));
+ }
+ pBoxFmt->ResetFmtAttr( nWhich1, RES_BOXATR_VALUE );
+ }
+ else
+ bChgd = sal_False;
+ }
+
+ if( bChgd )
+ {
+ if( pUndo )
+ {
+ pUndo->SetBox( rBox );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
+
+ const SwTableNode* pTblNd = rBox.GetSttNd()->FindTableNode();
+ if( bCallUpdate )
+ {
+ SwTableFmlUpdate aTblUpdate( &pTblNd->GetTable() );
+ UpdateTblFlds( &aTblUpdate );
+
+ // TL_CHART2: update charts (when cursor leaves cell and
+ // automatic update is enabled)
+ if (AUTOUPD_FIELD_AND_CHARTS == getFieldUpdateFlags(true))
+ pTblNd->GetTable().UpdateCharts();
+ }
+ SetModified();
+ }
+}
+
+void SwDoc::SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet )
+{
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoTblNumFmt(rBox, &rSet) );
+ }
+
+ SwFrmFmt* pBoxFmt = rBox.ClaimFrmFmt();
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMULA ))
+ {
+ pBoxFmt->LockModify();
+ pBoxFmt->ResetFmtAttr( RES_BOXATR_VALUE );
+ pBoxFmt->UnlockModify();
+ }
+ else if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_VALUE ))
+ {
+ pBoxFmt->LockModify();
+ pBoxFmt->ResetFmtAttr( RES_BOXATR_FORMULA );
+ pBoxFmt->UnlockModify();
+ }
+ pBoxFmt->SetFmtAttr( rSet );
+ SetModified();
+}
+
+void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode )
+{
+ SwStartNode* pSttNd;
+ if( 0 != ( pSttNd = rNode.GetNode().
+ FindSttNodeByType( SwTableBoxStartNode )) &&
+ 2 == pSttNd->EndOfSectionIndex() - pSttNd->GetIndex() )
+ {
+ SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().
+ GetTblBox( pSttNd->GetIndex() );
+
+ const SfxPoolItem* pFmtItem = 0;
+ const SfxItemSet& rSet = pBox->GetFrmFmt()->GetAttrSet();
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT, sal_False, &pFmtItem ) ||
+ SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMULA, sal_False ) ||
+ SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_VALUE, sal_False ))
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoTblNumFmt(*pBox));
+ }
+
+ SwFrmFmt* pBoxFmt = pBox->ClaimFrmFmt();
+
+ //JP 01.09.97: TextFormate bleiben erhalten!
+ sal_uInt16 nWhich1 = RES_BOXATR_FORMAT;
+ if( pFmtItem && GetNumberFormatter()->IsTextFormat(
+ ((SwTblBoxNumFormat*)pFmtItem)->GetValue() ))
+ nWhich1 = RES_BOXATR_FORMULA;
+ else
+ // JP 15.01.99: Nur Attribute zuruecksetzen reicht nicht.
+ // Sorge dafuer, das der Text auch entsprechend
+ // formatiert wird!
+ pBoxFmt->SetFmtAttr( *GetDfltAttr( RES_BOXATR_FORMAT ));
+
+ pBoxFmt->ResetFmtAttr( nWhich1, RES_BOXATR_VALUE );
+ SetModified();
+ }
+ }
+}
+
+// kopiert eine Tabelle aus dem selben oder einem anderen Doc in sich
+// selbst. Dabei wird eine neue Tabelle angelegt oder eine bestehende
+// mit dem Inhalt gefuellt; wobei entweder der Inhalt ab einer Box oder
+// in eine bestehende TblSelektion gefuellt wird.
+// Gerufen wird es von: edglss.cxx/fecopy.cxx
+
+sal_Bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
+ const SwTable* pCpyTbl, sal_Bool bCpyName, sal_Bool bCorrPos )
+{
+ sal_Bool bRet;
+
+ const SwTableNode* pSrcTblNd = pCpyTbl
+ ? pCpyTbl->GetTableNode()
+ : rBoxes[ 0 ]->GetSttNd()->FindTableNode();
+
+ SwTableNode * pInsTblNd = rInsPos.nNode.GetNode().FindTableNode();
+
+ bool const bUndo( GetIDocumentUndoRedo().DoesUndo() );
+ if( !pCpyTbl && !pInsTblNd )
+ {
+ SwUndoCpyTbl* pUndo = 0;
+ if (bUndo)
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ pUndo = new SwUndoCpyTbl;
+ }
+
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+ bRet = pSrcTblNd->GetTable().MakeCopy( this, rInsPos, rBoxes,
+ sal_True, bCpyName );
+ }
+
+ if( pUndo )
+ {
+ if( !bRet )
+ {
+ delete pUndo;
+ pUndo = 0;
+ }
+ else
+ {
+ pInsTblNd = GetNodes()[ rInsPos.nNode.GetIndex() - 1 ]->FindTableNode();
+
+ pUndo->SetTableSttIdx( pInsTblNd->GetIndex() );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ }
+ }
+ else
+ {
+ RedlineMode_t eOld = GetRedlineMode();
+ if( IsRedlineOn() )
+ SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON |
+ nsRedlineMode_t::REDLINE_SHOW_INSERT |
+ nsRedlineMode_t::REDLINE_SHOW_DELETE));
+
+ SwUndoTblCpyTbl* pUndo = 0;
+ if (bUndo)
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ pUndo = new SwUndoTblCpyTbl;
+ GetIDocumentUndoRedo().DoUndo(false);
+ }
+
+ SwDoc* pCpyDoc = (SwDoc*)pSrcTblNd->GetDoc();
+ sal_Bool bDelCpyDoc = pCpyDoc == this;
+
+ if( bDelCpyDoc )
+ {
+ // kopiere die Tabelle erstmal in ein temp. Doc
+ pCpyDoc = new SwDoc;
+ pCpyDoc->acquire();
+
+ SwPosition aPos( SwNodeIndex( pCpyDoc->GetNodes().GetEndOfContent() ));
+ if( !pSrcTblNd->GetTable().MakeCopy( pCpyDoc, aPos, rBoxes, sal_True, sal_True ))
+ {
+ if( pCpyDoc->release() == 0 )
+ delete pCpyDoc;
+
+ if( pUndo )
+ {
+ GetIDocumentUndoRedo().DoUndo(bUndo);
+ delete pUndo;
+ pUndo = 0;
+ }
+ return sal_False;
+ }
+ aPos.nNode -= 1; // auf den EndNode der Tabelle
+ pSrcTblNd = aPos.nNode.GetNode().FindTableNode();
+ }
+
+ const SwStartNode* pSttNd = rInsPos.nNode.GetNode().FindTableBoxStartNode();
+
+ rInsPos.nContent.Assign( 0, 0 );
+
+ // no complex into complex, but copy into or from new model is welcome
+ if( ( !pSrcTblNd->GetTable().IsTblComplex() || pInsTblNd->GetTable().IsNewModel() )
+ && ( bDelCpyDoc || rBoxes.Count() ) )
+ {
+ // dann die Tabelle "relativ" kopieren
+ const SwSelBoxes* pBoxes;
+ SwSelBoxes aBoxes;
+
+ if( bDelCpyDoc )
+ {
+ SwTableBox* pBox = pInsTblNd->GetTable().GetTblBox(
+ pSttNd->GetIndex() );
+ ASSERT( pBox, "Box steht nicht in dieser Tabelle" );
+ aBoxes.Insert( pBox );
+ pBoxes = &aBoxes;
+ }
+ else
+ pBoxes = &rBoxes;
+
+ // kopiere die Tabelle in die selktierten Zellen.
+ bRet = pInsTblNd->GetTable().InsTable( pSrcTblNd->GetTable(),
+ *pBoxes, pUndo );
+ }
+ else
+ {
+ SwNodeIndex aNdIdx( *pSttNd, 1 );
+ bRet = pInsTblNd->GetTable().InsTable( pSrcTblNd->GetTable(),
+ aNdIdx, pUndo );
+ }
+
+ if( bDelCpyDoc )
+ {
+ if( pCpyDoc->release() == 0 )
+ delete pCpyDoc;
+ }
+
+ if( pUndo )
+ {
+ // falls die Tabelle nicht kopiert werden konnte, das Undo-Object
+ // wieder loeschen
+ GetIDocumentUndoRedo().DoUndo(bUndo);
+ if( !bRet && pUndo->IsEmpty() )
+ delete pUndo;
+ else
+ {
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ }
+
+ if( bCorrPos )
+ {
+ rInsPos.nNode = *pSttNd;
+ rInsPos.nContent.Assign( GetNodes().GoNext( &rInsPos.nNode ), 0 );
+ }
+ SetRedlineMode( eOld );
+ }
+
+ if( bRet )
+ {
+ SetModified();
+ SetFieldsDirty( true, NULL, 0 );
+ }
+ return bRet;
+}
+
+
+
+sal_Bool SwDoc::_UnProtectTblCells( SwTable& rTbl )
+{
+ sal_Bool bChgd = sal_False;
+ SwUndoAttrTbl *const pUndo = (GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoAttrTbl( *rTbl.GetTableNode() )
+ : 0;
+
+ SwTableSortBoxes& rSrtBox = rTbl.GetTabSortBoxes();
+ for( sal_uInt16 i = rSrtBox.Count(); i; )
+ {
+ SwFrmFmt *pBoxFmt = rSrtBox[ --i ]->GetFrmFmt();
+ if( pBoxFmt->GetProtect().IsCntntProtected() )
+ {
+ pBoxFmt->ResetFmtAttr( RES_PROTECT );
+ bChgd = sal_True;
+ }
+ }
+
+ if( pUndo )
+ {
+ if( bChgd )
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ else
+ delete pUndo;
+ }
+ return bChgd;
+}
+
+
+sal_Bool SwDoc::UnProtectCells( const String& rName )
+{
+ sal_Bool bChgd = sal_False;
+ SwTableFmt* pFmt = FindTblFmtByName( rName );
+ if( pFmt )
+ {
+ bChgd = _UnProtectTblCells( *SwTable::FindTable( pFmt ) );
+ if( bChgd )
+ SetModified();
+ }
+
+ return bChgd;
+}
+
+sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
+{
+ sal_Bool bChgd = sal_False;
+ if( rBoxes.Count() )
+ {
+ SwUndoAttrTbl *const pUndo = (GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoAttrTbl( *rBoxes[0]->GetSttNd()->FindTableNode() )
+ : 0;
+
+ SvPtrarr aFmts( 16 ), aNewFmts( 16 );
+ for( sal_uInt16 i = rBoxes.Count(); i; )
+ {
+ SwTableBox* pBox = rBoxes[ --i ];
+ SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
+ if( pBoxFmt->GetProtect().IsCntntProtected() )
+ {
+ sal_uInt16 nFnd = aFmts.GetPos( pBoxFmt );
+ if( USHRT_MAX != nFnd )
+ pBox->ChgFrmFmt( (SwTableBoxFmt*)aNewFmts[ nFnd ] );
+ else
+ {
+ aFmts.Insert( pBoxFmt, aFmts.Count() );
+ pBoxFmt = pBox->ClaimFrmFmt();
+ pBoxFmt->ResetFmtAttr( RES_PROTECT );
+ aNewFmts.Insert( pBoxFmt, aNewFmts.Count() );
+ }
+ bChgd = sal_True;
+ }
+ }
+
+ if( pUndo )
+ {
+ if( bChgd )
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
+ else
+ delete pUndo;
+ }
+ }
+ return bChgd;
+}
+
+sal_Bool SwDoc::UnProtectTbls( const SwPaM& rPam )
+{
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+
+ sal_Bool bChgd = sal_False, bHasSel = rPam.HasMark() ||
+ rPam.GetNext() != (SwPaM*)&rPam;
+ SwFrmFmts& rFmts = *GetTblFrmFmts();
+ SwTable* pTbl;
+ const SwTableNode* pTblNd;
+ for( sal_uInt16 n = rFmts.Count(); n ; )
+ if( 0 != (pTbl = SwTable::FindTable( rFmts[ --n ] )) &&
+ 0 != (pTblNd = pTbl->GetTableNode() ) &&
+ pTblNd->GetNodes().IsDocNodes() )
+ {
+ sal_uLong nTblIdx = pTblNd->GetIndex();
+
+ // dann ueberpruefe ob Tabelle in der Selection liegt
+ if( bHasSel )
+ {
+ int bFound = sal_False;
+ SwPaM* pTmp = (SwPaM*)&rPam;
+ do {
+ const SwPosition *pStt = pTmp->Start(),
+ *pEnd = pTmp->End();
+ bFound = pStt->nNode.GetIndex() < nTblIdx &&
+ nTblIdx < pEnd->nNode.GetIndex();
+
+ } while( !bFound && &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() ) );
+ if( !bFound )
+ continue; // weitersuchen
+ }
+
+ // dann mal den Schutz aufheben
+ bChgd |= _UnProtectTblCells( *pTbl );
+ }
+
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+ if( bChgd )
+ SetModified();
+
+ return bChgd;
+}
+
+sal_Bool SwDoc::HasTblAnyProtection( const SwPosition* pPos,
+ const String* pTblName,
+ sal_Bool* pFullTblProtection )
+{
+ sal_Bool bHasProtection = sal_False;
+ SwTable* pTbl = 0;
+ if( pTblName )
+ pTbl = SwTable::FindTable( FindTblFmtByName( *pTblName ) );
+ else if( pPos )
+ {
+ SwTableNode* pTblNd = pPos->nNode.GetNode().FindTableNode();
+ if( pTblNd )
+ pTbl = &pTblNd->GetTable();
+ }
+
+ if( pTbl )
+ {
+ SwTableSortBoxes& rSrtBox = pTbl->GetTabSortBoxes();
+ for( sal_uInt16 i = rSrtBox.Count(); i; )
+ {
+ SwFrmFmt *pBoxFmt = rSrtBox[ --i ]->GetFrmFmt();
+ if( pBoxFmt->GetProtect().IsCntntProtected() )
+ {
+ if( !bHasProtection )
+ {
+ bHasProtection = sal_True;
+ if( !pFullTblProtection )
+ break;
+ *pFullTblProtection = sal_True;
+ }
+ }
+ else if( bHasProtection && pFullTblProtection )
+ {
+ *pFullTblProtection = sal_False;
+ break;
+ }
+ }
+ }
+ return bHasProtection;
+}
+
+#ifdef DEL_TABLE_REDLINES
+lcl_DelRedlines::lcl_DelRedlines( const SwTableNode& rNd,
+ sal_Bool bCheckForOwnRedline )
+ : pDoc( (SwDoc*)rNd.GetNodes().GetDoc() )
+{
+ pDoc->StartUndo(UNDO_EMPTY, NULL);
+ const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ if( !pDoc->IsIgnoreRedline() && rTbl.Count() )
+ {
+ sal_Bool bDelete = sal_True;
+ if( bCheckForOwnRedline )
+ {
+ sal_uInt16 nRedlPos = pDoc->GetRedlinePos( rNd, USHRT_MAX );
+ sal_uInt32 nSttNd = rNd.GetIndex(),
+ nEndNd = rNd.EndOfSectionIndex();
+
+ for ( ; nRedlPos < rTbl.Count(); ++nRedlPos )
+ {
+ const SwRedline* pRedline = rTbl[ nRedlPos ];
+ const SwPosition* pStt = pRedline->Start(),
+ * pEnd = pStt == pRedline->GetPoint()
+ ? pRedline->GetMark()
+ : pRedline->GetPoint();
+ if( pStt->nNode <= nSttNd )
+ {
+ if( pEnd->nNode >= nEndNd &&
+ pRedline->GetAuthor() == pDoc->GetRedlineAuthor() )
+ {
+ bDelete = sal_False;
+ break;
+ }
+ }
+ else
+ break;
+ }
+ }
+ if( bDelete )
+ {
+ SwPaM aPam(*rNd.EndOfSectionNode(), rNd);
+ pDoc->AcceptRedline( aPam, true );
+ }
+ }
+}
+#endif
+
+
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
new file mode 100644
index 000000000000..c7a911188c88
--- /dev/null
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -0,0 +1,1597 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "hintids.hxx"
+#include <editeng/lrspitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <fmtornt.hxx>
+#include <fmtfsize.hxx>
+#include <fmtlsplt.hxx>
+#include <fmtrowsplt.hxx>
+#include <tabcol.hxx>
+#include <frmatr.hxx>
+#include <cellfrm.hxx>
+#include <tabfrm.hxx>
+#include <cntfrm.hxx>
+#include <txtfrm.hxx>
+#include <svx/svxids.hrc>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include "pam.hxx"
+#include "swcrsr.hxx"
+#include "viscrs.hxx"
+#include "swtable.hxx"
+#include "htmltbl.hxx"
+#include "tblsel.hxx"
+#include "swtblfmt.hxx"
+#include "docary.hxx"
+#include "ndindex.hxx"
+#include "undobj.hxx"
+#include "switerator.hxx"
+#include <UndoTable.hxx>
+
+using namespace ::com::sun::star;
+
+
+extern void ClearFEShellTabCols();
+
+//siehe auch swtable.cxx
+#define COLFUZZY 20L
+
+inline sal_Bool IsSame( long nA, long nB ) { return Abs(nA-nB) <= COLFUZZY; }
+
+class SwTblFmtCmp
+{
+public:
+ SwFrmFmt *pOld,
+ *pNew;
+ sal_Int16 nType;
+
+ SwTblFmtCmp( SwFrmFmt *pOld, SwFrmFmt *pNew, sal_Int16 nType );
+
+ static SwFrmFmt *FindNewFmt( SvPtrarr &rArr, SwFrmFmt*pOld, sal_Int16 nType );
+ static void Delete( SvPtrarr &rArr );
+};
+
+
+SwTblFmtCmp::SwTblFmtCmp( SwFrmFmt *pO, SwFrmFmt *pN, sal_Int16 nT )
+ : pOld ( pO ), pNew ( pN ), nType( nT )
+{
+}
+
+SwFrmFmt *SwTblFmtCmp::FindNewFmt( SvPtrarr &rArr, SwFrmFmt *pOld, sal_Int16 nType )
+{
+ for ( sal_uInt16 i = 0; i < rArr.Count(); ++i )
+ {
+ SwTblFmtCmp *pCmp = (SwTblFmtCmp*)rArr[i];
+ if ( pCmp->pOld == pOld && pCmp->nType == nType )
+ return pCmp->pNew;
+ }
+ return 0;
+}
+
+void SwTblFmtCmp::Delete( SvPtrarr &rArr )
+{
+ for ( sal_uInt16 i = 0; i < rArr.Count(); ++i )
+ delete (SwTblFmtCmp*)rArr[i];
+}
+
+void lcl_GetStartEndCell( const SwCursor& rCrsr,
+ SwLayoutFrm *&prStart, SwLayoutFrm *&prEnd )
+{
+ ASSERT( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( sal_False ),
+ "Tabselection nicht auf Cnt." );
+
+ Point aPtPos, aMkPos;
+ const SwShellCrsr* pShCrsr = dynamic_cast<const SwShellCrsr*>(&rCrsr);
+ if( pShCrsr )
+ {
+ aPtPos = pShCrsr->GetPtPos();
+ aMkPos = pShCrsr->GetMkPos();
+ }
+
+ // robust:
+ SwCntntNode* pPointNd = rCrsr.GetCntntNode();
+ SwCntntNode* pMarkNd = rCrsr.GetCntntNode(sal_False);
+
+ SwFrm* pPointFrm = pPointNd ? pPointNd->getLayoutFrm( pPointNd->GetDoc()->GetCurrentLayout(), &aPtPos ) : 0;
+ SwFrm* pMarkFrm = pMarkNd ? pMarkNd->getLayoutFrm( pMarkNd->GetDoc()->GetCurrentLayout(), &aMkPos ) : 0;
+
+ prStart = pPointFrm ? pPointFrm->GetUpper() : 0;
+ prEnd = pMarkFrm ? pMarkFrm->GetUpper() : 0;
+}
+
+sal_Bool lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes,
+ sal_Bool bAllCrsr = sal_False )
+{
+ const SwTableCursor* pTblCrsr =
+ dynamic_cast<const SwTableCursor*>(&rCursor);
+ if( pTblCrsr )
+ ::GetTblSelCrs( *pTblCrsr, rBoxes );
+ else
+ {
+ const SwPaM *pCurPam = &rCursor, *pSttPam = pCurPam;
+ do {
+ const SwNode* pNd = pCurPam->GetNode()->FindTableBoxStartNode();
+ if( pNd )
+ {
+ SwTableBox* pBox = (SwTableBox*)pNd->FindTableNode()->GetTable().
+ GetTblBox( pNd->GetIndex() );
+ rBoxes.Insert( pBox );
+ }
+ } while( bAllCrsr &&
+ pSttPam != ( pCurPam = (SwPaM*)pCurPam->GetNext()) );
+ }
+ return 0 != rBoxes.Count();
+}
+
+/***********************************************************************
+#* Class : SwDoc
+#* Methoden : SetRowHeight(), GetRowHeight()
+#* Datum : MA 17. May. 93
+#* Update : JP 28.04.98
+#***********************************************************************/
+//Die Zeilenhoehe wird ausgehend von der Selektion ermittelt/gesetzt.
+//Ausgehend von jeder Zelle innerhalb der Selektion werden nach oben alle
+//Zeilen abgeklappert, die oberste Zeile erhaelt den gewuenschten Wert alle
+//tieferliegenden Zeilen einen entsprechenden Wert der sich aus der
+//Relation der alten und neuen Groesse der obersten Zeile und ihrer
+//eigenen Groesse ergiebt.
+//Alle veraenderten Zeilen erhalten ggf. ein eigenes FrmFmt.
+//Natuerlich darf jede Zeile nur einmal angefasst werden.
+
+inline void InsertLine( SvPtrarr& rLineArr, SwTableLine* pLine )
+{
+ if( USHRT_MAX == rLineArr.GetPos( pLine ) )
+ rLineArr.Insert( pLine, rLineArr.Count() );
+}
+
+//-----------------------------------------------------------------------------
+
+sal_Bool lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed )
+{
+ const SwTableLine *pTmp = pAssumed->GetUpper() ?
+ pAssumed->GetUpper()->GetUpper() : 0;
+ while ( pTmp )
+ {
+ if ( pTmp == pLine )
+ return sal_True;
+ pTmp = pTmp->GetUpper() ? pTmp->GetUpper()->GetUpper() : 0;
+ }
+ return sal_False;
+}
+//-----------------------------------------------------------------------------
+
+struct LinesAndTable
+{
+ SvPtrarr &rLines;
+ const SwTable &rTable;
+ sal_Bool bInsertLines;
+
+ LinesAndTable( SvPtrarr &rL, const SwTable &rTbl ) :
+ rLines( rL ), rTable( rTbl ), bInsertLines( sal_True ) {}
+};
+
+
+sal_Bool _FindLine( const _FndLine*& rpLine, void* pPara );
+
+sal_Bool _FindBox( const _FndBox*& rpBox, void* pPara )
+{
+ if ( rpBox->GetLines().Count() )
+ {
+ ((LinesAndTable*)pPara)->bInsertLines = sal_True;
+ ((_FndBox*)rpBox)->GetLines().ForEach( _FindLine, pPara );
+ if ( ((LinesAndTable*)pPara)->bInsertLines )
+ {
+ const SwTableLines &rLines = rpBox->GetBox()
+ ? rpBox->GetBox()->GetTabLines()
+ : ((LinesAndTable*)pPara)->rTable.GetTabLines();
+ if ( rpBox->GetLines().Count() == rLines.Count() )
+ {
+ for ( sal_uInt16 i = 0; i < rLines.Count(); ++i )
+ ::InsertLine( ((LinesAndTable*)pPara)->rLines,
+ (SwTableLine*)rLines[i] );
+ }
+ else
+ ((LinesAndTable*)pPara)->bInsertLines = sal_False;
+ }
+ }
+ else if ( rpBox->GetBox() )
+ ::InsertLine( ((LinesAndTable*)pPara)->rLines,
+ (SwTableLine*)rpBox->GetBox()->GetUpper() );
+ return sal_True;
+}
+
+sal_Bool _FindLine( const _FndLine*& rpLine, void* pPara )
+{
+ ((_FndLine*)rpLine)->GetBoxes().ForEach( _FindBox, pPara );
+ return sal_True;
+}
+
+void lcl_CollectLines( SvPtrarr &rArr, const SwCursor& rCursor, bool bRemoveLines )
+{
+ //Zuerst die selektierten Boxen einsammeln.
+ SwSelBoxes aBoxes;
+ if( !::lcl_GetBoxSel( rCursor, aBoxes ))
+ return ;
+
+ //Die selektierte Struktur kopieren.
+ const SwTable &rTable = aBoxes[0]->GetSttNd()->FindTableNode()->GetTable();
+ LinesAndTable aPara( rArr, rTable );
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aTmpPara( aBoxes, &aFndBox );
+ ((SwTableLines&)rTable.GetTabLines()).ForEach( &_FndLineCopyCol, &aTmpPara );
+ }
+
+ //Diejenigen Lines einsammeln, die nur selektierte Boxen enthalten.
+ const _FndBox *pTmp = &aFndBox;
+ ::_FindBox( pTmp, &aPara );
+
+ // Remove lines, that have a common superordinate row.
+ // (Not for row split)
+ if ( bRemoveLines )
+ {
+ for ( sal_uInt16 i = 0; i < rArr.Count(); ++i )
+ {
+ SwTableLine *pUpLine = (SwTableLine*)rArr[i];
+ for ( sal_uInt16 k = 0; k < rArr.Count(); ++k )
+ {
+ if ( k != i && ::lcl_IsAnLower( pUpLine, (SwTableLine*)rArr[k] ) )
+ {
+ rArr.Remove( k );
+ if ( k <= i )
+ --i;
+ --k;
+ }
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void lcl_ProcessRowAttr( SvPtrarr& rFmtCmp, SwTableLine* pLine, const SfxPoolItem& rNew )
+{
+ SwFrmFmt *pNewFmt;
+ if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( rFmtCmp, pLine->GetFrmFmt(), 0 )))
+ pLine->ChgFrmFmt( (SwTableLineFmt*)pNewFmt );
+ else
+ {
+ SwFrmFmt *pOld = pLine->GetFrmFmt();
+ SwFrmFmt *pNew = pLine->ClaimFrmFmt();
+ pNew->SetFmtAttr( rNew );
+ rFmtCmp.Insert( new SwTblFmtCmp( pOld, pNew, 0 ), rFmtCmp.Count());
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void lcl_ProcessBoxSize( SvPtrarr &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew );
+
+void lcl_ProcessRowSize( SvPtrarr &rFmtCmp, SwTableLine *pLine, const SwFmtFrmSize &rNew )
+{
+ lcl_ProcessRowAttr( rFmtCmp, pLine, rNew );
+ SwTableBoxes &rBoxes = pLine->GetTabBoxes();
+ for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i )
+ ::lcl_ProcessBoxSize( rFmtCmp, rBoxes[i], rNew );
+}
+
+//-----------------------------------------------------------------------------
+
+void lcl_ProcessBoxSize( SvPtrarr &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew )
+{
+ SwTableLines &rLines = pBox->GetTabLines();
+ if ( rLines.Count() )
+ {
+ SwFmtFrmSize aSz( rNew );
+ aSz.SetHeight( rNew.GetHeight() ? rNew.GetHeight() / rLines.Count() : 0 );
+ for ( sal_uInt16 i = 0; i < rLines.Count(); ++i )
+ ::lcl_ProcessRowSize( rFmtCmp, rLines[i], aSz );
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+/******************************************************************************
+ * void SwDoc::SetRowSplit()
+ ******************************************************************************/
+void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew )
+{
+ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ if( pTblNd )
+ {
+ SvPtrarr aRowArr( 25, 50 ); //Zum sammeln Lines.
+ ::lcl_CollectLines( aRowArr, rCursor, false );
+
+ if( aRowArr.Count() )
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
+ }
+
+ SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 );
+
+ for( sal_uInt16 i = 0; i < aRowArr.Count(); ++i )
+ ::lcl_ProcessRowAttr( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
+
+ SwTblFmtCmp::Delete( aFmtCmp );
+ SetModified();
+ }
+ }
+}
+
+
+/******************************************************************************
+ * SwTwips SwDoc::GetRowSplit() const
+ ******************************************************************************/
+void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const
+{
+ rpSz = 0;
+
+ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ if( pTblNd )
+ {
+ SvPtrarr aRowArr( 25, 50 ); //Zum sammeln der Lines.
+ ::lcl_CollectLines( aRowArr, rCursor, false );
+
+ if( aRowArr.Count() )
+ {
+ rpSz = &(SwFmtRowSplit&)((SwTableLine*)aRowArr[0])->
+ GetFrmFmt()->GetRowSplit();
+
+ for ( sal_uInt16 i = 1; i < aRowArr.Count() && rpSz; ++i )
+ {
+ if ( (*rpSz).GetValue() != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetRowSplit().GetValue() )
+ rpSz = 0;
+ }
+ if ( rpSz )
+ rpSz = new SwFmtRowSplit( *rpSz );
+ }
+ }
+}
+
+
+/******************************************************************************
+ * void SwDoc::SetRowHeight( SwTwips nNew )
+ ******************************************************************************/
+void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew )
+{
+ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ if( pTblNd )
+ {
+ SvPtrarr aRowArr( 25, 50 ); //Zum sammeln Lines.
+ ::lcl_CollectLines( aRowArr, rCursor, true );
+
+ if( aRowArr.Count() )
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
+ }
+
+ SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 );
+ for ( sal_uInt16 i = 0; i < aRowArr.Count(); ++i )
+ ::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
+ SwTblFmtCmp::Delete( aFmtCmp );
+
+ SetModified();
+ }
+ }
+}
+
+
+/******************************************************************************
+ * SwTwips SwDoc::GetRowHeight() const
+ ******************************************************************************/
+void SwDoc::GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const
+{
+ rpSz = 0;
+
+ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ if( pTblNd )
+ {
+ SvPtrarr aRowArr( 25, 50 ); //Zum sammeln der Lines.
+ ::lcl_CollectLines( aRowArr, rCursor, true );
+
+ if( aRowArr.Count() )
+ {
+ rpSz = &(SwFmtFrmSize&)((SwTableLine*)aRowArr[0])->
+ GetFrmFmt()->GetFrmSize();
+
+ for ( sal_uInt16 i = 1; i < aRowArr.Count() && rpSz; ++i )
+ {
+ if ( *rpSz != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetFrmSize() )
+ rpSz = 0;
+ }
+ if ( rpSz )
+ rpSz = new SwFmtFrmSize( *rpSz );
+ }
+ }
+}
+
+sal_Bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly )
+{
+ sal_Bool bRet = sal_False;
+ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ if( pTblNd )
+ {
+ SvPtrarr aRowArr( 25, 50 ); //Zum sammeln der Lines.
+ ::lcl_CollectLines( aRowArr, rCursor, true );
+
+ if( 1 < aRowArr.Count() )
+ {
+ if( !bTstOnly )
+ {
+ long nHeight = 0;
+ sal_uInt16 i;
+
+ for ( i = 0; i < aRowArr.Count(); ++i )
+ {
+ SwIterator<SwFrm,SwFmt> aIter( *((SwTableLine*)aRowArr[i])->GetFrmFmt() );
+ SwFrm* pFrm = aIter.First();
+ while ( pFrm )
+ {
+ nHeight = Max( nHeight, pFrm->Frm().Height() );
+ pFrm = aIter.Next();
+ }
+ }
+ SwFmtFrmSize aNew( ATT_MIN_SIZE, 0, nHeight );
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoAttrTbl(*pTblNd));
+ }
+
+ SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 );
+ for( i = 0; i < aRowArr.Count(); ++i )
+ ::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], aNew );
+ SwTblFmtCmp::Delete( aFmtCmp );
+
+ SetModified();
+ }
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+/******************************************************************************
+ * void SwDoc::SetRowBackground()
+ ******************************************************************************/
+void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew )
+{
+ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ if( pTblNd )
+ {
+ SvPtrarr aRowArr( 25, 50 ); //Zum sammeln Lines.
+ ::lcl_CollectLines( aRowArr, rCursor, true );
+
+ if( aRowArr.Count() )
+ {
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
+ }
+
+ SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 );
+
+ for( sal_uInt16 i = 0; i < aRowArr.Count(); ++i )
+ ::lcl_ProcessRowAttr( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
+
+ SwTblFmtCmp::Delete( aFmtCmp );
+ SetModified();
+ }
+ }
+}
+
+/******************************************************************************
+ * SwTwips SwDoc::GetRowBackground() const
+ ******************************************************************************/
+sal_Bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) const
+{
+ sal_Bool bRet = sal_False;
+ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ if( pTblNd )
+ {
+ SvPtrarr aRowArr( 25, 50 ); //Zum sammeln Lines.
+ ::lcl_CollectLines( aRowArr, rCursor, true );
+
+ if( aRowArr.Count() )
+ {
+ rToFill = ((SwTableLine*)aRowArr[0])->GetFrmFmt()->GetBackground();
+
+ bRet = sal_True;
+ for ( sal_uInt16 i = 1; i < aRowArr.Count(); ++i )
+ if ( rToFill != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetBackground() )
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ }
+ return bRet;
+}
+
+/***********************************************************************
+#* Class : SwDoc
+#* Methoden : SetTabBorders(), GetTabBorders()
+#* Datum : MA 18. May. 93
+#* Update : JP 29.04.98
+#***********************************************************************/
+inline void InsertCell( SvPtrarr& rCellArr, SwCellFrm* pCellFrm )
+{
+ if( USHRT_MAX == rCellArr.GetPos( pCellFrm ) )
+ rCellArr.Insert( pCellFrm, rCellArr.Count() );
+}
+
+//-----------------------------------------------------------------------------
+void lcl_CollectCells( SvPtrarr &rArr, const SwRect &rUnion,
+ SwTabFrm *pTab )
+{
+ SwLayoutFrm *pCell = pTab->FirstCell();
+ do
+ {
+ // Wenn in der Zelle ein spaltiger Bereich sitzt, muessen wir
+ // uns erst wieder zur Zelle hochhangeln
+ while ( !pCell->IsCellFrm() )
+ pCell = pCell->GetUpper();
+ ASSERT( pCell, "Frame ist keine Zelle." );
+ if ( rUnion.IsOver( pCell->Frm() ) )
+ ::InsertCell( rArr, (SwCellFrm*)pCell );
+ //Dafuer sorgen, dass die Zelle auch verlassen wird (Bereiche)
+ SwLayoutFrm *pTmp = pCell;
+ do
+ { pTmp = pTmp->GetNextLayoutLeaf();
+ } while ( pCell->IsAnLower( pTmp ) );
+ pCell = pTmp;
+ } while( pCell && pTab->IsAnLower( pCell ) );
+}
+
+void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
+{
+ SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode();
+ SwTableNode* pTblNd = pCntNd ? pCntNd->FindTableNode() : 0;
+ if( !pTblNd )
+ return ;
+
+ SwLayoutFrm *pStart, *pEnd;
+ ::lcl_GetStartEndCell( rCursor, pStart, pEnd );
+
+ SwSelUnions aUnions;
+ ::MakeSelUnions( aUnions, pStart, pEnd );
+
+ if( aUnions.Count() )
+ {
+ SwTable& rTable = pTblNd->GetTable();
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) );
+ }
+
+ SvPtrarr aFmtCmp( 255, 255 );
+ const SvxBoxItem* pSetBox;
+ const SvxBoxInfoItem *pSetBoxInfo;
+
+ const SvxBorderLine* pLeft = 0;
+ const SvxBorderLine* pRight = 0;
+ const SvxBorderLine* pTop = 0;
+ const SvxBorderLine* pBottom = 0;
+ const SvxBorderLine* pHori = 0;
+ const SvxBorderLine* pVert = 0;
+ sal_Bool bHoriValid = sal_True, bVertValid = sal_True,
+ bTopValid = sal_True, bBottomValid = sal_True,
+ bLeftValid = sal_True, bRightValid = sal_True;
+
+ // JP 21.07.95: die Flags im BoxInfo-Item entscheiden, wann eine
+ // BorderLine gueltig ist!!
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, sal_False,
+ (const SfxPoolItem**)&pSetBoxInfo) )
+ {
+ pHori = pSetBoxInfo->GetHori();
+ pVert = pSetBoxInfo->GetVert();
+
+ bHoriValid = pSetBoxInfo->IsValid(VALID_HORI);
+ bVertValid = pSetBoxInfo->IsValid(VALID_VERT);
+
+ // wollen wir die auswerten ??
+ bTopValid = pSetBoxInfo->IsValid(VALID_TOP);
+ bBottomValid = pSetBoxInfo->IsValid(VALID_BOTTOM);
+ bLeftValid = pSetBoxInfo->IsValid(VALID_LEFT);
+ bRightValid = pSetBoxInfo->IsValid(VALID_RIGHT);
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_BOX, sal_False,
+ (const SfxPoolItem**)&pSetBox) )
+ {
+ pLeft = pSetBox->GetLeft();
+ pRight = pSetBox->GetRight();
+ pTop = pSetBox->GetTop();
+ pBottom = pSetBox->GetBottom();
+ }
+ else
+ {
+ // nicht gesetzt, also keine gueltigen Werte
+ bTopValid = bBottomValid = bLeftValid = bRightValid = sal_False;
+ pSetBox = 0;
+ }
+
+ sal_Bool bFirst = sal_True;
+ for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i )
+ {
+ SwSelUnion *pUnion = aUnions[i];
+ SwTabFrm *pTab = pUnion->GetTable();
+ const SwRect &rUnion = pUnion->GetUnion();
+ const sal_Bool bLast = i == aUnions.Count() - 1 ? sal_True : sal_False;
+
+ SvPtrarr aCellArr( 255, 255 );
+ ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
+
+ //Alle Zellenkanten, die mit dem UnionRect uebereinstimmen oder
+ //darueber hinausragen sind Aussenkanten. Alle anderen sind
+ //Innenkanten.
+ //neu: Die Aussenkanten koennen abhaengig davon, ob es sich um eine
+ //Start/Mittlere/Folge -Tabelle (bei Selektionen ueber FollowTabs)
+ //handelt doch keine Aussenkanten sein.
+ //Aussenkanten werden links, rechts, oben und unten gesetzt.
+ //Innenkanten werden nur oben und links gesetzt.
+ for ( sal_uInt16 j = 0; j < aCellArr.Count(); ++j )
+ {
+ SwCellFrm *pCell = (SwCellFrm*)aCellArr[j];
+ const sal_Bool bVert = pTab->IsVertical();
+ const sal_Bool bRTL = pTab->IsRightToLeft();
+ sal_Bool bTopOver, bLeftOver, bRightOver, bBottomOver;
+ if ( bVert )
+ {
+ bTopOver = pCell->Frm().Right() >= rUnion.Right();
+ bLeftOver = pCell->Frm().Top() <= rUnion.Top();
+ bRightOver = pCell->Frm().Bottom() >= rUnion.Bottom();
+ bBottomOver = pCell->Frm().Left() <= rUnion.Left();
+ }
+ else
+ {
+ bTopOver = pCell->Frm().Top() <= rUnion.Top();
+ bLeftOver = pCell->Frm().Left() <= rUnion.Left();
+ bRightOver = pCell->Frm().Right() >= rUnion.Right();
+ bBottomOver = pCell->Frm().Bottom() >= rUnion.Bottom();
+ }
+
+ if ( bRTL )
+ {
+ sal_Bool bTmp = bRightOver;
+ bRightOver = bLeftOver;
+ bLeftOver = bTmp;
+ }
+
+ //Grundsaetzlich nichts setzen in HeadlineRepeats.
+ if ( pTab->IsFollow() &&
+ ( pTab->IsInHeadline( *pCell ) ||
+ // --> FME 2006-02-07 #126092# Same holds for follow flow rows.
+ pCell->IsInFollowFlowRow() ) )
+ // <--
+ continue;
+
+ SvxBoxItem aBox( pCell->GetFmt()->GetBox() );
+
+ sal_Int16 nType = 0;
+
+ //Obere Kante
+ if( bTopValid )
+ {
+ if ( bFirst && bTopOver )
+ {
+ aBox.SetLine( pTop, BOX_LINE_TOP );
+ nType |= 0x0001;
+ }
+ else if ( bHoriValid )
+ {
+ aBox.SetLine( 0, BOX_LINE_TOP );
+ nType |= 0x0002;
+ }
+ }
+
+ //Linke Kante
+ if ( bLeftOver )
+ {
+ if( bLeftValid )
+ {
+ aBox.SetLine( pLeft, BOX_LINE_LEFT );
+ nType |= 0x0004;
+ }
+ }
+ else if( bVertValid )
+ {
+ aBox.SetLine( pVert, BOX_LINE_LEFT );
+ nType |= 0x0008;
+ }
+
+ //Rechte Kante
+ if( bRightValid )
+ {
+ if ( bRightOver )
+ {
+ aBox.SetLine( pRight, BOX_LINE_RIGHT );
+ nType |= 0x0010;
+ }
+ else if ( bVertValid )
+ {
+ aBox.SetLine( 0, BOX_LINE_RIGHT );
+ nType |= 0x0020;
+ }
+ }
+
+ //Untere Kante
+ if ( bLast && bBottomOver )
+ {
+ if( bBottomValid )
+ {
+ aBox.SetLine( pBottom, BOX_LINE_BOTTOM );
+ nType |= 0x0040;
+ }
+ }
+ else if( bHoriValid )
+ {
+ aBox.SetLine( pHori, BOX_LINE_BOTTOM );
+ nType |= 0x0080;
+ }
+
+ if( pSetBox )
+ {
+ static sal_uInt16 __READONLY_DATA aBorders[] = {
+ BOX_LINE_BOTTOM, BOX_LINE_TOP,
+ BOX_LINE_RIGHT, BOX_LINE_LEFT };
+ const sal_uInt16* pBrd = aBorders;
+ for( int k = 0; k < 4; ++k, ++pBrd )
+ aBox.SetDistance( pSetBox->GetDistance( *pBrd ), *pBrd );
+ }
+
+ SwTableBox *pBox = (SwTableBox*)pCell->GetTabBox();
+ SwFrmFmt *pNewFmt;
+ if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( aFmtCmp, pBox->GetFrmFmt(), nType )))
+ pBox->ChgFrmFmt( (SwTableBoxFmt*)pNewFmt );
+ else
+ {
+ SwFrmFmt *pOld = pBox->GetFrmFmt();
+ SwFrmFmt *pNew = pBox->ClaimFrmFmt();
+ pNew->SetFmtAttr( aBox );
+ aFmtCmp.Insert( new SwTblFmtCmp( pOld, pNew, nType ), aFmtCmp.Count());
+ }
+ }
+
+ bFirst = sal_False;
+ }
+
+ SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
+ if( pTableLayout )
+ {
+ SwCntntFrm* pFrm = rCursor.GetCntntNode()->getLayoutFrm( rCursor.GetCntntNode()->GetDoc()->GetCurrentLayout() );
+ SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm();
+
+ pTableLayout->BordersChanged(
+ pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), sal_True );
+ }
+ SwTblFmtCmp::Delete( aFmtCmp );
+ ::ClearFEShellTabCols();
+ SetModified();
+ }
+}
+
+void lcl_SetLineStyle( SvxBorderLine *pToSet,
+ const Color *pColor, const SvxBorderLine *pBorderLine)
+{
+ if ( pBorderLine )
+ {
+ if ( !pColor )
+ {
+ Color aTmp( pToSet->GetColor() );
+ *pToSet = *pBorderLine;
+ pToSet->SetColor( aTmp );
+ }
+ else
+ *pToSet = *pBorderLine;
+ }
+ if ( pColor )
+ pToSet->SetColor( *pColor );
+}
+
+void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
+ const Color* pColor, sal_Bool bSetLine,
+ const SvxBorderLine* pBorderLine )
+{
+ SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode();
+ SwTableNode* pTblNd = pCntNd ? pCntNd->FindTableNode() : 0;
+ if( !pTblNd )
+ return ;
+
+ SwLayoutFrm *pStart, *pEnd;
+ ::lcl_GetStartEndCell( rCursor, pStart, pEnd );
+
+ SwSelUnions aUnions;
+ ::MakeSelUnions( aUnions, pStart, pEnd );
+
+ if( aUnions.Count() )
+ {
+ SwTable& rTable = pTblNd->GetTable();
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
+ }
+
+ for( sal_uInt16 i = 0; i < aUnions.Count(); ++i )
+ {
+ SwSelUnion *pUnion = aUnions[i];
+ SwTabFrm *pTab = pUnion->GetTable();
+ SvPtrarr aCellArr( 255, 255 );
+ ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
+
+ for ( sal_uInt16 j = 0; j < aCellArr.Count(); ++j )
+ {
+ SwCellFrm *pCell = ( SwCellFrm* )aCellArr[j];
+
+ //Grundsaetzlich nichts setzen in HeadlineRepeats.
+ if ( pTab->IsFollow() && pTab->IsInHeadline( *pCell ) )
+ continue;
+
+ ((SwTableBox*)pCell->GetTabBox())->ClaimFrmFmt();
+ SwFrmFmt *pFmt = pCell->GetFmt();
+ SvxBoxItem aBox( pFmt->GetBox() );
+
+ if ( !pBorderLine && bSetLine )
+ aBox = *(SvxBoxItem*)::GetDfltAttr( RES_BOX );
+ else
+ {
+ if ( aBox.GetTop() )
+ ::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetTop(),
+ pColor, pBorderLine );
+ if ( aBox.GetBottom() )
+ ::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetBottom(),
+ pColor, pBorderLine );
+ if ( aBox.GetLeft() )
+ ::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetLeft(),
+ pColor, pBorderLine );
+ if ( aBox.GetRight() )
+ ::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetRight(),
+ pColor, pBorderLine );
+ }
+ pFmt->SetFmtAttr( aBox );
+ }
+ }
+
+ SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
+ if( pTableLayout )
+ {
+ SwCntntFrm* pFrm = rCursor.GetCntntNode()->getLayoutFrm( rCursor.GetCntntNode()->GetDoc()->GetCurrentLayout() );
+ SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm();
+
+ pTableLayout->BordersChanged(
+ pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), sal_True );
+ }
+ ::ClearFEShellTabCols();
+ SetModified();
+ }
+}
+
+void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
+{
+ SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode();
+ SwTableNode* pTblNd = pCntNd ? pCntNd->FindTableNode() : 0;
+ if( !pTblNd )
+ return ;
+
+ SwLayoutFrm *pStart, *pEnd;
+ ::lcl_GetStartEndCell( rCursor, pStart, pEnd );
+
+ SwSelUnions aUnions;
+ ::MakeSelUnions( aUnions, pStart, pEnd );
+
+ if( aUnions.Count() )
+ {
+ SvxBoxItem aSetBox ((const SvxBoxItem &) rSet.Get(RES_BOX ));
+ SvxBoxInfoItem aSetBoxInfo((const SvxBoxInfoItem&) rSet.Get(SID_ATTR_BORDER_INNER));
+
+ sal_Bool bTopSet = sal_False,
+ bBottomSet = sal_False,
+ bLeftSet = sal_False,
+ bRightSet = sal_False,
+ bHoriSet = sal_False,
+ bVertSet = sal_False,
+ bDistanceSet = sal_False;
+
+ aSetBoxInfo.ResetFlags();
+
+ for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i )
+ {
+ SwSelUnion *pUnion = aUnions[i];
+ const SwTabFrm *pTab = pUnion->GetTable();
+ const SwRect &rUnion = pUnion->GetUnion();
+ const sal_Bool bFirst = i == 0 ? sal_True : sal_False;
+ const sal_Bool bLast = i == aUnions.Count() - 1 ? sal_True : sal_False;
+
+ SvPtrarr aCellArr( 255, 255 );
+ ::lcl_CollectCells( aCellArr, rUnion, (SwTabFrm*)pTab );
+
+ for ( sal_uInt16 j = 0; j < aCellArr.Count(); ++j )
+ {
+ const SwCellFrm *pCell = (const SwCellFrm*)aCellArr[j];
+ const sal_Bool bVert = pTab->IsVertical();
+ const sal_Bool bRTL = pTab->IsRightToLeft();
+ sal_Bool bTopOver, bLeftOver, bRightOver, bBottomOver;
+ if ( bVert )
+ {
+ bTopOver = pCell->Frm().Right() >= rUnion.Right();
+ bLeftOver = pCell->Frm().Top() <= rUnion.Top();
+ bRightOver = pCell->Frm().Bottom() >= rUnion.Bottom();
+ bBottomOver = pCell->Frm().Left() <= rUnion.Left();
+ }
+ else
+ {
+ bTopOver = pCell->Frm().Top() <= rUnion.Top();
+ bLeftOver = pCell->Frm().Left() <= rUnion.Left();
+ bRightOver = pCell->Frm().Right() >= rUnion.Right();
+ bBottomOver = pCell->Frm().Bottom() >= rUnion.Bottom();
+ }
+
+ if ( bRTL )
+ {
+ sal_Bool bTmp = bRightOver;
+ bRightOver = bLeftOver;
+ bLeftOver = bTmp;
+ }
+
+ const SwFrmFmt *pFmt = pCell->GetFmt();
+ const SvxBoxItem &rBox = pFmt->GetBox();
+
+ //Obere Kante
+ if ( bFirst && bTopOver )
+ {
+ if (aSetBoxInfo.IsValid(VALID_TOP))
+ {
+ if ( !bTopSet )
+ { bTopSet = sal_True;
+ aSetBox.SetLine( rBox.GetTop(), BOX_LINE_TOP );
+ }
+ else if ((aSetBox.GetTop() && rBox.GetTop() &&
+ !(*aSetBox.GetTop() == *rBox.GetTop())) ||
+ ((!aSetBox.GetTop()) ^ (!rBox.GetTop()))) // XOR-Ausdruck ist sal_True, wenn genau einer der beiden Pointer 0 ist
+ {
+ aSetBoxInfo.SetValid(VALID_TOP, sal_False );
+ aSetBox.SetLine( 0, BOX_LINE_TOP );
+ }
+ }
+ }
+
+ //Linke Kante
+ if ( bLeftOver )
+ {
+ if (aSetBoxInfo.IsValid(VALID_LEFT))
+ {
+ if ( !bLeftSet )
+ { bLeftSet = sal_True;
+ aSetBox.SetLine( rBox.GetLeft(), BOX_LINE_LEFT );
+ }
+ else if ((aSetBox.GetLeft() && rBox.GetLeft() &&
+ !(*aSetBox.GetLeft() == *rBox.GetLeft())) ||
+ ((!aSetBox.GetLeft()) ^ (!rBox.GetLeft())))
+ {
+ aSetBoxInfo.SetValid(VALID_LEFT, sal_False );
+ aSetBox.SetLine( 0, BOX_LINE_LEFT );
+ }
+ }
+ }
+ else
+ {
+ if (aSetBoxInfo.IsValid(VALID_VERT))
+ {
+ if ( !bVertSet )
+ { bVertSet = sal_True;
+ aSetBoxInfo.SetLine( rBox.GetLeft(), BOXINFO_LINE_VERT );
+ }
+ else if ((aSetBoxInfo.GetVert() && rBox.GetLeft() &&
+ !(*aSetBoxInfo.GetVert() == *rBox.GetLeft())) ||
+ ((!aSetBoxInfo.GetVert()) ^ (!rBox.GetLeft())))
+ { aSetBoxInfo.SetValid( VALID_VERT, sal_False );
+ aSetBoxInfo.SetLine( 0, BOXINFO_LINE_VERT );
+ }
+ }
+ }
+
+ //Rechte Kante
+ if ( aSetBoxInfo.IsValid(VALID_RIGHT) && bRightOver )
+ {
+ if ( !bRightSet )
+ { bRightSet = sal_True;
+ aSetBox.SetLine( rBox.GetRight(), BOX_LINE_RIGHT );
+ }
+ else if ((aSetBox.GetRight() && rBox.GetRight() &&
+ !(*aSetBox.GetRight() == *rBox.GetRight())) ||
+ (!aSetBox.GetRight() ^ !rBox.GetRight()))
+ { aSetBoxInfo.SetValid( VALID_RIGHT, sal_False );
+ aSetBox.SetLine( 0, BOX_LINE_RIGHT );
+ }
+ }
+
+ //Untere Kante
+ if ( bLast && bBottomOver )
+ {
+ if ( aSetBoxInfo.IsValid(VALID_BOTTOM) )
+ {
+ if ( !bBottomSet )
+ { bBottomSet = sal_True;
+ aSetBox.SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM );
+ }
+ else if ((aSetBox.GetBottom() && rBox.GetBottom() &&
+ !(*aSetBox.GetBottom() == *rBox.GetBottom())) ||
+ (!aSetBox.GetBottom() ^ !rBox.GetBottom()))
+ { aSetBoxInfo.SetValid( VALID_BOTTOM, sal_False );
+ aSetBox.SetLine( 0, BOX_LINE_BOTTOM );
+ }
+ }
+ }
+ //in allen Zeilen ausser der letzten werden die
+ // horiz. Linien aus der Bottom-Linie entnommen
+ else
+ {
+ if (aSetBoxInfo.IsValid(VALID_HORI))
+ {
+ if ( !bHoriSet )
+ { bHoriSet = sal_True;
+ aSetBoxInfo.SetLine( rBox.GetBottom(), BOXINFO_LINE_HORI );
+ }
+ else if ((aSetBoxInfo.GetHori() && rBox.GetBottom() &&
+ !(*aSetBoxInfo.GetHori() == *rBox.GetBottom())) ||
+ ((!aSetBoxInfo.GetHori()) ^ (!rBox.GetBottom())))
+ {
+ aSetBoxInfo.SetValid( VALID_HORI, sal_False );
+ aSetBoxInfo.SetLine( 0, BOXINFO_LINE_HORI );
+ }
+ }
+ }
+
+ // Abstand zum Text
+ if (aSetBoxInfo.IsValid(VALID_DISTANCE))
+ {
+ static sal_uInt16 __READONLY_DATA aBorders[] = {
+ BOX_LINE_BOTTOM, BOX_LINE_TOP,
+ BOX_LINE_RIGHT, BOX_LINE_LEFT };
+ const sal_uInt16* pBrd = aBorders;
+
+ if( !bDistanceSet ) // bei 1. Durchlauf erstmal setzen
+ {
+ bDistanceSet = sal_True;
+ for( int k = 0; k < 4; ++k, ++pBrd )
+ aSetBox.SetDistance( rBox.GetDistance( *pBrd ),
+ *pBrd );
+ }
+ else
+ {
+ for( int k = 0; k < 4; ++k, ++pBrd )
+ if( aSetBox.GetDistance( *pBrd ) !=
+ rBox.GetDistance( *pBrd ) )
+ {
+ aSetBoxInfo.SetValid( VALID_DISTANCE, sal_False );
+ aSetBox.SetDistance( (sal_uInt16) 0 );
+ break;
+ }
+ }
+ }
+ }
+ }
+ rSet.Put( aSetBox );
+ rSet.Put( aSetBoxInfo );
+ }
+}
+
+/***********************************************************************
+#* Class : SwDoc
+#* Methoden : SetBoxAttr
+#* Datum : MA 18. Dec. 96
+#* Update : JP 29.04.98
+#***********************************************************************/
+void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
+{
+ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ SwSelBoxes aBoxes;
+ if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes, sal_True ) )
+ {
+ SwTable& rTable = pTblNd->GetTable();
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) );
+ }
+
+ SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aBoxes.Count()) ), 255 );
+ for ( sal_uInt16 i = 0; i < aBoxes.Count(); ++i )
+ {
+ SwTableBox *pBox = aBoxes[i];
+
+ SwFrmFmt *pNewFmt;
+ if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( aFmtCmp, pBox->GetFrmFmt(), 0 )))
+ pBox->ChgFrmFmt( (SwTableBoxFmt*)pNewFmt );
+ else
+ {
+ SwFrmFmt *pOld = pBox->GetFrmFmt();
+ SwFrmFmt *pNew = pBox->ClaimFrmFmt();
+ pNew->SetFmtAttr( rNew );
+ aFmtCmp.Insert( new SwTblFmtCmp( pOld, pNew, 0 ), aFmtCmp.Count());
+ }
+ }
+
+ SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
+ if( pTableLayout )
+ {
+ SwCntntFrm* pFrm = rCursor.GetCntntNode()->getLayoutFrm( rCursor.GetCntntNode()->GetDoc()->GetCurrentLayout() );
+ SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm();
+
+ pTableLayout->Resize(
+ pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), sal_True );
+ }
+ SwTblFmtCmp::Delete( aFmtCmp );
+ SetModified();
+ }
+}
+
+/***********************************************************************
+#* Class : SwDoc
+#* Methoden : GetBoxAttr()
+#* Datum : MA 01. Jun. 93
+#* Update : JP 29.04.98
+#***********************************************************************/
+
+sal_Bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const
+{
+ sal_Bool bRet = sal_False;
+ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ SwSelBoxes aBoxes;
+ if( pTblNd && lcl_GetBoxSel( rCursor, aBoxes ))
+ {
+ bRet = sal_True;
+ sal_Bool bOneFound = sal_False;
+ const sal_uInt16 nWhich = rToFill.Which();
+ for( sal_uInt16 i = 0; i < aBoxes.Count(); ++i )
+ {
+ switch ( nWhich )
+ {
+ case RES_BACKGROUND:
+ {
+ const SvxBrushItem &rBack =
+ aBoxes[i]->GetFrmFmt()->GetBackground();
+ if( !bOneFound )
+ {
+ (SvxBrushItem&)rToFill = rBack;
+ bOneFound = sal_True;
+ }
+ else if( rToFill != rBack )
+ bRet = sal_False;
+ }
+ break;
+
+ case RES_FRAMEDIR:
+ {
+ const SvxFrameDirectionItem& rDir =
+ aBoxes[i]->GetFrmFmt()->GetFrmDir();
+ if( !bOneFound )
+ {
+ (SvxFrameDirectionItem&)rToFill = rDir;
+ bOneFound = sal_True;
+ }
+ else if( rToFill != rDir )
+ bRet = sal_False;
+ }
+ }
+
+ if ( sal_False == bRet )
+ break;
+ }
+ }
+ return bRet;
+}
+
+/***********************************************************************
+#* Class : SwDoc
+#* Methoden : SetBoxAlign, SetBoxAlign
+#* Datum : MA 18. Dec. 96
+#* Update : JP 29.04.98
+#***********************************************************************/
+void SwDoc::SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign )
+{
+ ASSERT( nAlign == text::VertOrientation::NONE ||
+ nAlign == text::VertOrientation::CENTER ||
+ nAlign == text::VertOrientation::BOTTOM, "wrong alignment" );
+ SwFmtVertOrient aVertOri( 0, nAlign );
+ SetBoxAttr( rCursor, aVertOri );
+}
+
+sal_uInt16 SwDoc::GetBoxAlign( const SwCursor& rCursor ) const
+{
+ sal_uInt16 nAlign = USHRT_MAX;
+ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+ SwSelBoxes aBoxes;
+ if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes ))
+ for( sal_uInt16 i = 0; i < aBoxes.Count(); ++i )
+ {
+ const SwFmtVertOrient &rOri =
+ aBoxes[i]->GetFrmFmt()->GetVertOrient();
+ if( USHRT_MAX == nAlign )
+ nAlign = static_cast<sal_uInt16>(rOri.GetVertOrient());
+ else if( rOri.GetVertOrient() != nAlign )
+ {
+ nAlign = USHRT_MAX;
+ break;
+ }
+ }
+ return nAlign;
+}
+
+
+/***********************************************************************
+#* Class : SwDoc
+#* Methoden : AdjustCellWidth()
+#* Datum : MA 20. Feb. 95
+#* Update : JP 29.04.98
+#***********************************************************************/
+sal_uInt16 lcl_CalcCellFit( const SwLayoutFrm *pCell )
+{
+ SwTwips nRet = 0;
+ const SwFrm *pFrm = pCell->Lower(); //Die ganze Zelle.
+ SWRECTFN( pCell )
+ while ( pFrm )
+ {
+ const SwTwips nAdd = (pFrm->Frm().*fnRect->fnGetWidth)() -
+ (pFrm->Prt().*fnRect->fnGetWidth)();
+
+ // --> FME 2005-12-02 #127801# pFrm does not necessarily have to be a SwTxtFrm!
+ const SwTwips nCalcFitToContent = pFrm->IsTxtFrm() ?
+ ((SwTxtFrm*)pFrm)->CalcFitToContent() :
+ (pFrm->Prt().*fnRect->fnGetWidth)();
+ // <--
+
+ nRet = Max( nRet, nCalcFitToContent + nAdd );
+ pFrm = pFrm->GetNext();
+ }
+ //Umrandung und linker/rechter Rand wollen mit kalkuliert werden.
+ nRet += (pCell->Frm().*fnRect->fnGetWidth)() -
+ (pCell->Prt().*fnRect->fnGetWidth)();
+
+ //Um Rechenungenauikeiten, die spaeter bei SwTable::SetTabCols enstehen,
+ //auszugleichen, addieren wir noch ein bischen.
+ nRet += COLFUZZY;
+ return (sal_uInt16)Max( long(MINLAY), nRet );
+}
+
+/*Die Zelle ist in der Selektion, wird aber nicht von den TabCols beschrieben.
+ *Das bedeutet, dass die Zelle aufgrund der zweidimensionalen Darstellung von
+ *anderen Zellen "geteilt" wurde. Wir muessen also den Wunsch- bzw. Minimalwert
+ *der Zelle auf die Spalten, durch die sie geteilt wurde verteilen.
+ *
+ *Dazu sammeln wir zuerst die Spalten - nicht die Spaltentrenner! - ein, die
+ *sich mit der Zelle ueberschneiden. Den Wunschwert der Zelle verteilen wir
+ *dann anhand des Betrages der Ueberschneidung auf die Zellen.
+ *Wenn eine Zelle bereits einen groesseren Wunschwert angemeldet hat, so bleibt
+ *dieser erhalten, kleinere Wuensche werden ueberschrieben.
+ */
+
+void lcl_CalcSubColValues( SvUShorts &rToFill, const SwTabCols &rCols,
+ const SwLayoutFrm *pCell, const SwLayoutFrm *pTab,
+ sal_Bool bWishValues )
+{
+ const sal_uInt16 nWish = bWishValues ?
+ ::lcl_CalcCellFit( pCell ) :
+ MINLAY + sal_uInt16(pCell->Frm().Width() - pCell->Prt().Width());
+
+ SWRECTFN( pTab )
+
+ for ( sal_uInt16 i = 0 ; i <= rCols.Count(); ++i )
+ {
+ long nColLeft = i == 0 ? rCols.GetLeft() : rCols[i-1];
+ long nColRight = i == rCols.Count() ? rCols.GetRight() : rCols[i];
+ nColLeft += rCols.GetLeftMin();
+ nColRight += rCols.GetLeftMin();
+
+ //Werte auf die Verhaeltnisse der Tabelle (Follows) anpassen.
+ if ( rCols.GetLeftMin() != sal_uInt16((pTab->Frm().*fnRect->fnGetLeft)()) )
+ {
+ const long nDiff = (pTab->Frm().*fnRect->fnGetLeft)() - rCols.GetLeftMin();
+ nColLeft += nDiff;
+ nColRight += nDiff;
+ }
+ const long nCellLeft = (pCell->Frm().*fnRect->fnGetLeft)();
+ const long nCellRight = (pCell->Frm().*fnRect->fnGetRight)();
+
+ //Ueberschneidungsbetrag ermitteln.
+ long nWidth = 0;
+ if ( nColLeft <= nCellLeft && nColRight >= (nCellLeft+COLFUZZY) )
+ nWidth = nColRight - nCellLeft;
+ else if ( nColLeft <= (nCellRight-COLFUZZY) && nColRight >= nCellRight )
+ nWidth = nCellRight - nColLeft;
+ else if ( nColLeft >= nCellLeft && nColRight <= nCellRight )
+ nWidth = nColRight - nColLeft;
+ if ( nWidth && pCell->Frm().Width() )
+ {
+ long nTmp = nWidth * nWish / pCell->Frm().Width();
+ if ( sal_uInt16(nTmp) > rToFill[i] )
+ rToFill[i] = sal_uInt16(nTmp);
+ }
+ }
+}
+
+/*Besorgt neue Werte zu Einstellung der TabCols.
+ *Es wird nicht ueber die Eintrage in den TabCols itereriert, sondern
+ *quasi ueber die Zwischenraeume, die ja die Zellen beschreiben.
+ *
+ *bWishValues == sal_True: Es werden zur aktuellen Selektion bzw. zur aktuellen
+ * Zelle die Wunschwerte aller betroffen Zellen ermittelt.
+ * Sind mehrere Zellen in einer Spalte, so wird der
+ * groesste Wunschwert als Ergebnis geliefert.
+ * Fuer die TabCol-Eintraege, zu denen keine Zellen
+ * ermittelt wurden, werden 0-en eingetragen.
+ *
+ *bWishValues == sal_False: Die Selektion wird senkrecht ausgedehnt. Zu jeder
+ * Spalte in den TabCols, die sich mit der Selektion
+ * schneidet wird der Minimalwert ermittelt.
+ */
+
+void lcl_CalcColValues( SvUShorts &rToFill, const SwTabCols &rCols,
+ const SwLayoutFrm *pStart, const SwLayoutFrm *pEnd,
+ sal_Bool bWishValues )
+{
+ SwSelUnions aUnions;
+ ::MakeSelUnions( aUnions, pStart, pEnd,
+ bWishValues ? nsSwTblSearchType::TBLSEARCH_NONE : nsSwTblSearchType::TBLSEARCH_COL );
+
+ for ( sal_uInt16 i2 = 0; i2 < aUnions.Count(); ++i2 )
+ {
+ SwSelUnion *pSelUnion = aUnions[i2];
+ const SwTabFrm *pTab = pSelUnion->GetTable();
+ const SwRect &rUnion = pSelUnion->GetUnion();
+
+ SWRECTFN( pTab )
+ sal_Bool bRTL = pTab->IsRightToLeft();
+
+ const SwLayoutFrm *pCell = pTab->FirstCell();
+ do
+ {
+ if ( pCell->IsCellFrm() && pCell->FindTabFrm() == pTab && ::IsFrmInTblSel( rUnion, pCell ) )
+ {
+ const long nCLeft = (pCell->Frm().*fnRect->fnGetLeft)();
+ const long nCRight = (pCell->Frm().*fnRect->fnGetRight)();
+
+ sal_Bool bNotInCols = sal_True;
+
+ for ( sal_uInt16 i = 0; i <= rCols.Count(); ++i )
+ {
+ sal_uInt16 nFit = rToFill[i];
+ long nColLeft = i == 0 ? rCols.GetLeft() : rCols[i-1];
+ long nColRight = i == rCols.Count() ? rCols.GetRight() : rCols[i];
+
+ if ( bRTL )
+ {
+ long nTmpRight = nColRight;
+ nColRight = rCols.GetRight() - nColLeft;
+ nColLeft = rCols.GetRight() - nTmpRight;
+ }
+
+ nColLeft += rCols.GetLeftMin();
+ nColRight += rCols.GetLeftMin();
+
+ //Werte auf die Verhaeltnisse der Tabelle (Follows) anpassen.
+ long nLeftA = nColLeft;
+ long nRightA = nColRight;
+ if ( rCols.GetLeftMin() != sal_uInt16((pTab->Frm().*fnRect->fnGetLeft)()) )
+ {
+ const long nDiff = (pTab->Frm().*fnRect->fnGetLeft)() - rCols.GetLeftMin();
+ nLeftA += nDiff;
+ nRightA += nDiff;
+ }
+
+ //Wir wollen nicht allzu genau hinsehen.
+ if ( ::IsSame(nCLeft, nLeftA) && ::IsSame(nCRight, nRightA))
+ {
+ bNotInCols = sal_False;
+ if ( bWishValues )
+ {
+ const sal_uInt16 nWish = ::lcl_CalcCellFit( pCell );
+ if ( nWish > nFit )
+ nFit = nWish;
+ }
+ else
+ { const sal_uInt16 nMin = MINLAY + sal_uInt16(pCell->Frm().Width() -
+ pCell->Prt().Width());
+ if ( !nFit || nMin < nFit )
+ nFit = nMin;
+ }
+ if ( rToFill[i] < nFit )
+ rToFill[i] = nFit;
+ }
+ }
+ if ( bNotInCols )
+ ::lcl_CalcSubColValues( rToFill, rCols, pCell, pTab, bWishValues );
+ }
+ do {
+ pCell = pCell->GetNextLayoutLeaf();
+ }while( pCell && pCell->Frm().Width() == 0 );
+ } while ( pCell && pTab->IsAnLower( pCell ) );
+ }
+}
+
+
+void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance )
+{
+ // pruefe ob vom aktuellen Crsr der Point/Mark in einer Tabelle stehen
+ SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode();
+ SwTableNode* pTblNd = pCntNd ? pCntNd->FindTableNode() : 0;
+ if( !pTblNd )
+ return ;
+
+ SwLayoutFrm *pStart, *pEnd;
+ ::lcl_GetStartEndCell( rCursor, pStart, pEnd );
+
+ //TabCols besorgen, den ueber diese stellen wir die Tabelle neu ein.
+ SwFrm* pBoxFrm = pStart;
+ while( pBoxFrm && !pBoxFrm->IsCellFrm() )
+ pBoxFrm = pBoxFrm->GetUpper();
+
+ if ( !pBoxFrm )
+ return; // robust
+
+ SwTabCols aTabCols;
+ GetTabCols( aTabCols, 0, (SwCellFrm*)pBoxFrm );
+
+ if ( ! aTabCols.Count() )
+ return;
+
+ const sal_uInt8 nTmp = (sal_uInt8)Max( sal_uInt16(255), sal_uInt16(aTabCols.Count() + 1) );
+ SvUShorts aWish( nTmp, nTmp ),
+ aMins( nTmp, nTmp );
+ sal_uInt16 i;
+
+ for ( i = 0; i <= aTabCols.Count(); ++i )
+ {
+ aWish.Insert( sal_uInt16(0), aWish.Count() );
+ aMins.Insert( sal_uInt16(0), aMins.Count() );
+ }
+ ::lcl_CalcColValues( aWish, aTabCols, pStart, pEnd, sal_True );
+
+ //Es ist Robuster wenn wir die Min-Werte fuer die ganze Tabelle berechnen.
+ const SwTabFrm *pTab = pStart->ImplFindTabFrm();
+ pStart = (SwLayoutFrm*)pTab->FirstCell();
+ pEnd = (SwLayoutFrm*)pTab->FindLastCntnt()->GetUpper();
+ while( !pEnd->IsCellFrm() )
+ pEnd = pEnd->GetUpper();
+ ::lcl_CalcColValues( aMins, aTabCols, pStart, pEnd, sal_False );
+
+ if( bBalance )
+ {
+ //Alle Spalten, die makiert sind haben jetzt einen Wunschwert
+ //eingtragen. Wir addieren die aktuellen Werte, teilen das Ergebnis
+ //durch die Anzahl und haben eine Wunschwert fuer den ausgleich.
+ sal_uInt16 nWish = 0, nCnt = 0;
+ for ( i = 0; i <= aTabCols.Count(); ++i )
+ {
+ int nDiff = aWish[i];
+ if ( nDiff )
+ {
+ if ( i == 0 )
+ nWish = static_cast<sal_uInt16>( nWish + aTabCols[i] - aTabCols.GetLeft() );
+ else if ( i == aTabCols.Count() )
+ nWish = static_cast<sal_uInt16>(nWish + aTabCols.GetRight() - aTabCols[i-1] );
+ else
+ nWish = static_cast<sal_uInt16>(nWish + aTabCols[i] - aTabCols[i-1] );
+ ++nCnt;
+ }
+ }
+ nWish = nWish / nCnt;
+ for ( i = 0; i < aWish.Count(); ++i )
+ if ( aWish[i] )
+ aWish[i] = nWish;
+ }
+
+ const sal_uInt16 nOldRight = static_cast<sal_uInt16>(aTabCols.GetRight());
+
+ //Um die Impl. einfach zu gestalten, aber trotzdem in den meissten Faellen
+ //den Platz richtig auszunutzen laufen wir zweimal.
+ //Problem: Erste Spalte wird breiter, die anderen aber erst danach
+ //schmaler. Die Wunschbreite der ersten Spalte wuerde abgelehnt, weil
+ //mit ihr die max. Breite der Tabelle ueberschritten wuerde.
+ for ( sal_uInt16 k= 0; k < 2; ++k )
+ {
+ for ( i = 0; i <= aTabCols.Count(); ++i )
+ {
+ int nDiff = aWish[i];
+ if ( nDiff )
+ {
+ int nMin = aMins[i];
+ if ( nMin > nDiff )
+ nDiff = nMin;
+
+ if ( i == 0 )
+ {
+ if( aTabCols.Count() )
+ nDiff -= aTabCols[0] - aTabCols.GetLeft();
+ else
+ nDiff -= aTabCols.GetRight() - aTabCols.GetLeft();
+ }
+ else if ( i == aTabCols.Count() )
+ nDiff -= aTabCols.GetRight() - aTabCols[i-1];
+ else
+ nDiff -= aTabCols[i] - aTabCols[i-1];
+
+ long nTabRight = aTabCols.GetRight() + nDiff;
+
+ //Wenn die Tabelle zu breit wuerde begrenzen wir die Anpassung
+ //auf das erlaubte Maximum.
+ if ( !bBalance && nTabRight > aTabCols.GetRightMax() )
+ {
+ const long nTmpD = nTabRight - aTabCols.GetRightMax();
+ nDiff -= nTmpD;
+ nTabRight -= nTmpD;
+ }
+ for ( sal_uInt16 i2 = i; i2 < aTabCols.Count(); ++i2 )
+ aTabCols[i2] += nDiff;
+ aTabCols.SetRight( nTabRight );
+ }
+ }
+ }
+
+ const sal_uInt16 nNewRight = static_cast<sal_uInt16>(aTabCols.GetRight());
+
+ SwFrmFmt *pFmt = pTblNd->GetTable().GetFrmFmt();
+ const sal_Int16 nOriHori = pFmt->GetHoriOrient().GetHoriOrient();
+
+ //So, die richtige Arbeit koennen wir jetzt der SwTable ueberlassen.
+ SetTabCols( aTabCols, sal_False, 0, (SwCellFrm*)pBoxFrm );
+
+ // i54248: lijian/fme
+ // alignment might have been changed in SetTabCols, restore old value:
+ const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient();
+ SwFmtHoriOrient aHori( rHori );
+ if ( aHori.GetHoriOrient() != nOriHori )
+ {
+ aHori.SetHoriOrient( nOriHori );
+ pFmt->SetFmtAttr( aHori );
+ }
+
+ //Bei Automatischer Breite wird auf Linksbuendig umgeschaltet.
+ //Bei Randattributen wird der Rechte Rand angepasst.
+ if( !bBalance && nNewRight < nOldRight )
+ {
+ if( aHori.GetHoriOrient() == text::HoriOrientation::FULL )
+ {
+ aHori.SetHoriOrient( text::HoriOrientation::LEFT );
+ pFmt->SetFmtAttr( aHori );
+ }
+ }
+
+ SetModified();
+}
+
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
new file mode 100644
index 000000000000..94fdcb5d54a6
--- /dev/null
+++ b/sw/source/core/docnode/node.cxx
@@ -0,0 +1,2081 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <editeng/protitem.hxx>
+#include <com/sun/star/i18n/CharacterIteratorMode.hdl>
+#include <fmtcntnt.hxx>
+#include <fmtanchr.hxx>
+#include <frmfmt.hxx>
+#include <txtftn.hxx>
+#include <ftnfrm.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <node.hxx>
+#include <ndindex.hxx>
+#include <numrule.hxx>
+#include <swtable.hxx>
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <swcache.hxx>
+#include <section.hxx>
+#include <cntfrm.hxx>
+#include <flyfrm.hxx>
+#include <txtfrm.hxx>
+#include <tabfrm.hxx> // SwTabFrm
+#include <viewsh.hxx>
+#include <paratr.hxx>
+#include <ftnidx.hxx>
+#include <fmtftn.hxx>
+#include <fmthdft.hxx>
+#include <frmatr.hxx>
+#include <fmtautofmt.hxx>
+#include <frmtool.hxx>
+#include <pagefrm.hxx>
+#include <node2lay.hxx>
+#include <pagedesc.hxx>
+#include <fmtpdsc.hxx>
+#include <breakit.hxx>
+#include <crsskip.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <scriptinfo.hxx>
+#include <rootfrm.hxx>
+#include <istyleaccess.hxx>
+#include <IDocumentListItems.hxx>
+#include <switerator.hxx>
+#include "ndole.hxx"
+
+using namespace ::com::sun::star::i18n;
+
+TYPEINIT2( SwCntntNode, SwModify, SwIndexReg )
+
+/*
+ * Some local helper functions for the attribute set handle of a content node.
+ * Since the attribute set of a content node may not be modified directly,
+ * we always have to create a new SwAttrSet, do the modifications, and get
+ * a new handle from the style access
+ */
+
+namespace AttrSetHandleHelper
+{
+
+void GetNewAutoStyle( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
+ const SwCntntNode& rNode,
+ SwAttrSet& rNewAttrSet )
+{
+ const SwAttrSet* pAttrSet = static_cast<const SwAttrSet*>(mrpAttrSet.get());
+ if( rNode.GetModifyAtAttr() )
+ const_cast<SwAttrSet*>(pAttrSet)->SetModifyAtAttr( 0 );
+ IStyleAccess& rSA = pAttrSet->GetPool()->GetDoc()->GetIStyleAccess();
+ mrpAttrSet = rSA.getAutomaticStyle( rNewAttrSet, rNode.IsTxtNode() ?
+ IStyleAccess::AUTO_STYLE_PARA :
+ IStyleAccess::AUTO_STYLE_NOTXT );
+ const bool bSetModifyAtAttr = ((SwAttrSet*)mrpAttrSet.get())->SetModifyAtAttr( &rNode );
+ rNode.SetModifyAtAttr( bSetModifyAtAttr );
+}
+
+
+void SetParent( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
+ const SwCntntNode& rNode,
+ const SwFmt* pParentFmt,
+ const SwFmt* pConditionalFmt )
+{
+ const SwAttrSet* pAttrSet = static_cast<const SwAttrSet*>(mrpAttrSet.get());
+ ASSERT( pAttrSet, "no SwAttrSet" )
+ ASSERT( pParentFmt || !pConditionalFmt, "ConditionalFmt without ParentFmt?" )
+
+ const SwAttrSet* pParentSet = pParentFmt ? &pParentFmt->GetAttrSet() : 0;
+
+ if ( pParentSet != pAttrSet->GetParent() )
+ {
+ SwAttrSet aNewSet( *pAttrSet );
+ aNewSet.SetParent( pParentSet );
+ aNewSet.ClearItem( RES_FRMATR_STYLE_NAME );
+ aNewSet.ClearItem( RES_FRMATR_CONDITIONAL_STYLE_NAME );
+ String sVal;
+
+ if ( pParentFmt )
+ {
+ SwStyleNameMapper::FillProgName( pParentFmt->GetName(), sVal, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
+ const SfxStringItem aAnyFmtColl( RES_FRMATR_STYLE_NAME, sVal );
+ aNewSet.Put( aAnyFmtColl );
+
+ if ( pConditionalFmt != pParentFmt )
+ SwStyleNameMapper::FillProgName( pConditionalFmt->GetName(), sVal, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
+
+ const SfxStringItem aFmtColl( RES_FRMATR_CONDITIONAL_STYLE_NAME, sVal );
+ aNewSet.Put( aFmtColl );
+ }
+
+ GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
+ }
+}
+
+const SfxPoolItem* Put( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
+ const SwCntntNode& rNode,
+ const SfxPoolItem& rAttr )
+{
+ SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
+ const SfxPoolItem* pRet = aNewSet.Put( rAttr );
+ if ( pRet )
+ GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
+ return pRet;
+}
+
+int Put( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, const SwCntntNode& rNode,
+ const SfxItemSet& rSet )
+{
+ SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
+
+ // --> FME 2007-4-12 #i76273# Robust: Save the style name items:
+ SfxItemSet* pStyleNames = 0;
+ if ( SFX_ITEM_SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, sal_False ) )
+ {
+ pStyleNames = new SfxItemSet( *aNewSet.GetPool(), RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME );
+ pStyleNames->Put( aNewSet );
+ }
+ // <--
+
+ const int nRet = aNewSet.Put( rSet );
+
+ // --> FME 2007-4-12 #i76273# Robust: Save the style name items:
+ if ( pStyleNames )
+ {
+ aNewSet.Put( *pStyleNames );
+ delete pStyleNames;
+ }
+ // <--
+
+ if ( nRet )
+ GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
+
+ return nRet;
+}
+
+int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
+ const SwCntntNode& rNode, const SfxPoolItem& rAttr,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
+
+ // for a correct broadcast, we need to do a SetModifyAtAttr with the items
+ // from aNewSet. The 'regular' SetModifyAtAttr is done in GetNewAutoStyle
+ if( rNode.GetModifyAtAttr() )
+ aNewSet.SetModifyAtAttr( &rNode );
+
+ const int nRet = aNewSet.Put_BC( rAttr, pOld, pNew );
+
+ if ( nRet )
+ GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
+
+ return nRet;
+}
+
+int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
+ const SwCntntNode& rNode, const SfxItemSet& rSet,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
+
+ // --> FME 2007-4-12 #i76273# Robust: Save the style name items:
+ SfxItemSet* pStyleNames = 0;
+ if ( SFX_ITEM_SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, sal_False ) )
+ {
+ pStyleNames = new SfxItemSet( *aNewSet.GetPool(), RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME );
+ pStyleNames->Put( aNewSet );
+ }
+ // <--
+
+ // for a correct broadcast, we need to do a SetModifyAtAttr with the items
+ // from aNewSet. The 'regular' SetModifyAtAttr is done in GetNewAutoStyle
+ if( rNode.GetModifyAtAttr() )
+ aNewSet.SetModifyAtAttr( &rNode );
+
+ const int nRet = aNewSet.Put_BC( rSet, pOld, pNew );
+
+ // --> FME 2007-4-12 #i76273# Robust: Save the style name items:
+ if ( pStyleNames )
+ {
+ aNewSet.Put( *pStyleNames );
+ delete pStyleNames;
+ }
+ // <--
+
+ if ( nRet )
+ GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
+
+ return nRet;
+}
+
+sal_uInt16 ClearItem_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
+ const SwCntntNode& rNode, sal_uInt16 nWhich,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
+ if( rNode.GetModifyAtAttr() )
+ aNewSet.SetModifyAtAttr( &rNode );
+ const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich, pOld, pNew );
+ if ( nRet )
+ GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
+ return nRet;
+}
+
+sal_uInt16 ClearItem_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
+ const SwCntntNode& rNode,
+ sal_uInt16 nWhich1, sal_uInt16 nWhich2,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
+ if( rNode.GetModifyAtAttr() )
+ aNewSet.SetModifyAtAttr( &rNode );
+ const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich1, nWhich2, pOld, pNew );
+ if ( nRet )
+ GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
+ return nRet;
+}
+
+}
+
+/*******************************************************************
+|*
+|* SwNode::GetSectionLevel
+|*
+|* Beschreibung
+|* Die Funktion liefert den Sectionlevel an der durch
+|* aIndex bezeichneten Position.
+|*
+|* Die Logik ist wie folgt: ( S -> Start, E -> End, C -> CntntNode)
+|* Level 0 E
+|* 1 S E
+|* 2 SC
+|*
+|* alle EndNodes der GrundSection haben den Level 0
+|* alle StartNodes der GrundSection haben den Level 1
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Aenderung: JP 11.08.93
+|* keine Rekursion mehr !!
+|*
+*******************************************************************/
+
+
+sal_uInt16 SwNode::GetSectionLevel() const
+{
+ // EndNode einer Grund-Section ?? diese sind immer 0 !!
+ if( IsEndNode() && 0 == pStartOfSection->StartOfSectionIndex() )
+ return 0;
+
+ sal_uInt16 nLevel;
+ const SwNode* pNode = IsStartNode() ? this : pStartOfSection;
+ for( nLevel = 1; 0 != pNode->StartOfSectionIndex(); ++nLevel )
+ pNode = pNode->pStartOfSection;
+ return IsEndNode() ? nLevel-1 : nLevel;
+}
+
+/*******************************************************************
+|*
+|* SwNode::SwNode
+|*
+|* Beschreibung
+|* Konstruktor; dieser fuegt einen Node in das Array rNodes
+|* an der Position rWhere ein. Dieser bekommt als
+|* theEndOfSection den EndOfSection-Index des Nodes
+|* unmittelbar vor ihm. Falls er sich an der Position 0
+|* innerhalb des variablen Arrays befindet, wird
+|* theEndOfSection 0 (der neue selbst).
+|*
+|* Parameter
+|* IN
+|* rNodes bezeichnet das variable Array, in das der Node
+|* eingefuegt werden soll
+|* IN
+|* rWhere bezeichnet die Position innerhalb dieses Arrays,
+|* an der der Node eingefuegt werden soll
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+
+#ifdef DBG_UTIL
+long SwNode::nSerial = 0;
+#endif
+
+SwNode::SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType )
+ : nNodeType( nNdType ), pStartOfSection( 0 )
+{
+ bSetNumLSpace = bIgnoreDontExpand = sal_False;
+ nAFmtNumLvl = 0;
+
+ SwNodes& rNodes = (SwNodes&)rWhere.GetNodes();
+ SwNode* pInsNd = this; // der MAC kann this nicht einfuegen !!
+ if( rWhere.GetIndex() )
+ {
+ SwNode* pNd = rNodes[ rWhere.GetIndex() -1 ];
+ rNodes.InsertNode( pInsNd, rWhere );
+ if( 0 == ( pStartOfSection = pNd->GetStartNode()) )
+ {
+ pStartOfSection = pNd->pStartOfSection;
+ if( pNd->GetEndNode() ) // EndNode ? Section ueberspringen!
+ {
+ pNd = pStartOfSection;
+ pStartOfSection = pNd->pStartOfSection;
+ }
+ }
+ }
+ else
+ {
+ rNodes.InsertNode( pInsNd, rWhere );
+ pStartOfSection = (SwStartNode*)this;
+ }
+
+#ifdef DBG_UTIL
+ nMySerial = nSerial;
+ nSerial++;
+#endif
+}
+
+SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNdType )
+ : nNodeType( nNdType ), pStartOfSection( 0 )
+{
+ bSetNumLSpace = bIgnoreDontExpand = sal_False;
+ nAFmtNumLvl = 0;
+
+ SwNode* pInsNd = this; // der MAC kann this nicht einfuegen !!
+ if( nPos )
+ {
+ SwNode* pNd = rNodes[ nPos - 1 ];
+ rNodes.InsertNode( pInsNd, nPos );
+ if( 0 == ( pStartOfSection = pNd->GetStartNode()) )
+ {
+ pStartOfSection = pNd->pStartOfSection;
+ if( pNd->GetEndNode() ) // EndNode ? Section ueberspringen!
+ {
+ pNd = pStartOfSection;
+ pStartOfSection = pNd->pStartOfSection;
+ }
+ }
+ }
+ else
+ {
+ rNodes.InsertNode( pInsNd, nPos );
+ pStartOfSection = (SwStartNode*)this;
+ }
+
+#ifdef DBG_UTIL
+ nMySerial = nSerial;
+ nSerial++;
+#endif
+}
+
+SwNode::~SwNode()
+{
+}
+
+// suche den TabellenNode, in dem dieser steht. Wenn in keiner
+// Tabelle wird 0 returnt.
+
+
+SwTableNode* SwNode::FindTableNode()
+{
+ if( IsTableNode() )
+ return GetTableNode();
+ SwStartNode* pTmp = pStartOfSection;
+ while( !pTmp->IsTableNode() && pTmp->GetIndex() )
+#if defined( ALPHA ) && defined( UNX )
+ pTmp = ((SwNode*)pTmp)->pStartOfSection;
+#else
+ pTmp = pTmp->pStartOfSection;
+#endif
+ return pTmp->GetTableNode();
+}
+
+
+// liegt der Node im Sichtbarenbereich der Shell ?
+sal_Bool SwNode::IsInVisibleArea( ViewShell* pSh ) const
+{
+ sal_Bool bRet = sal_False;
+ const SwCntntNode* pNd;
+
+ if( ND_STARTNODE & nNodeType )
+ {
+ SwNodeIndex aIdx( *this );
+ pNd = GetNodes().GoNext( &aIdx );
+ }
+ else if( ND_ENDNODE & nNodeType )
+ {
+ SwNodeIndex aIdx( *EndOfSectionNode() );
+ pNd = GetNodes().GoPrevious( &aIdx );
+ }
+ else
+ pNd = GetCntntNode();
+
+ if( !pSh )
+ // dann die Shell vom Doc besorgen:
+ GetDoc()->GetEditShell( &pSh );
+
+ if( pSh )
+ {
+ const SwFrm* pFrm;
+ if( pNd && 0 != ( pFrm = pNd->getLayoutFrm( pSh->GetLayout(), 0, 0, sal_False ) ) )
+ {
+
+ if ( pFrm->IsInTab() )
+ pFrm = pFrm->FindTabFrm();
+
+ if( !pFrm->IsValid() )
+ do
+ { pFrm = pFrm->FindPrev();
+ } while ( pFrm && !pFrm->IsValid() );
+
+ if( !pFrm || pSh->VisArea().IsOver( pFrm->Frm() ) )
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool SwNode::IsInProtectSect() const
+{
+ const SwNode* pNd = ND_SECTIONNODE == nNodeType ? pStartOfSection : this;
+ const SwSectionNode* pSectNd = pNd->FindSectionNode();
+ return pSectNd && pSectNd->GetSection().IsProtectFlag();
+}
+
+ // befindet sich der Node in irgendetwas geschuetzten ?
+ // (Bereich/Rahmen/Tabellenzellen/... incl. des Ankers bei
+ // Rahmen/Fussnoten/..)
+sal_Bool SwNode::IsProtect() const
+{
+ const SwNode* pNd = ND_SECTIONNODE == nNodeType ? pStartOfSection : this;
+ const SwStartNode* pSttNd = pNd->FindSectionNode();
+ if( pSttNd && ((SwSectionNode*)pSttNd)->GetSection().IsProtectFlag() )
+ return sal_True;
+
+ if( 0 != ( pSttNd = FindTableBoxStartNode() ) )
+ {
+ SwCntntFrm* pCFrm;
+ if( IsCntntNode() && 0 != (pCFrm = ((SwCntntNode*)this)->getLayoutFrm( GetDoc()->GetCurrentLayout() ) ))
+ return pCFrm->IsProtected();
+
+ const SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().
+ GetTblBox( pSttNd->GetIndex() );
+ //Robust #149568
+ if( pBox && pBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
+ return sal_True;
+ }
+
+ SwFrmFmt* pFlyFmt = GetFlyFmt();
+ if( pFlyFmt )
+ {
+ if( pFlyFmt->GetProtect().IsCntntProtected() )
+ return sal_True;
+ const SwFmtAnchor& rAnchor = pFlyFmt->GetAnchor();
+ return rAnchor.GetCntntAnchor()
+ ? rAnchor.GetCntntAnchor()->nNode.GetNode().IsProtect()
+ : sal_False;
+ }
+
+ if( 0 != ( pSttNd = FindFootnoteStartNode() ) )
+ {
+ const SwTxtFtn* pTFtn = GetDoc()->GetFtnIdxs().SeekEntry(
+ SwNodeIndex( *pSttNd ) );
+ if( pTFtn )
+ return pTFtn->GetTxtNode().IsProtect();
+ }
+
+ return sal_False;
+}
+
+ // suche den PageDesc, mit dem dieser Node formatiert ist. Wenn das
+ // Layout vorhanden ist wird ueber das gesucht, ansonsten gibt es nur
+ // die harte Tour ueber die Nodes nach vorne suchen!!
+const SwPageDesc* SwNode::FindPageDesc( sal_Bool bCalcLay,
+ sal_uInt32* pPgDescNdIdx ) const
+{
+ // OD 18.03.2003 #106329#
+ if ( !GetNodes().IsDocNodes() )
+ {
+ return 0;
+ }
+
+ const SwPageDesc* pPgDesc = 0;
+
+ const SwCntntNode* pNode;
+ if( ND_STARTNODE & nNodeType )
+ {
+ SwNodeIndex aIdx( *this );
+ pNode = GetNodes().GoNext( &aIdx );
+ }
+ else if( ND_ENDNODE & nNodeType )
+ {
+ SwNodeIndex aIdx( *EndOfSectionNode() );
+ pNode = GetNodes().GoPrevious( &aIdx );
+ }
+ else
+ {
+ pNode = GetCntntNode();
+ if( pNode )
+ pPgDesc = ((SwFmtPageDesc&)pNode->GetAttr( RES_PAGEDESC )).GetPageDesc();
+ }
+
+ // geht es uebers Layout?
+ if( !pPgDesc )
+ {
+ const SwFrm* pFrm;
+ const SwPageFrm* pPage;
+ if( pNode && 0 != ( pFrm = pNode->getLayoutFrm( pNode->GetDoc()->GetCurrentLayout(), 0, 0, bCalcLay ) ) &&
+ 0 != ( pPage = pFrm->FindPageFrm() ) )
+ {
+ pPgDesc = pPage->GetPageDesc();
+ // OD 18.03.2003 #106329#
+ if ( pPgDescNdIdx )
+ {
+ *pPgDescNdIdx = pNode->GetIndex();
+ }
+ }
+ }
+
+ if( !pPgDesc )
+ {
+ // dann also uebers Nodes-Array
+ const SwDoc* pDoc = GetDoc();
+ const SwNode* pNd = this;
+ const SwStartNode* pSttNd;
+ if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() &&
+ 0 != ( pSttNd = pNd->FindFlyStartNode() ) )
+ {
+ // dann erstmal den richtigen Anker finden
+ const SwFrmFmt* pFmt = 0;
+ const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
+ sal_uInt16 n;
+
+ for( n = 0; n < rFmts.Count(); ++n )
+ {
+ SwFrmFmt* pFrmFmt = rFmts[ n ];
+ const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt();
+ if( rCntnt.GetCntntIdx() &&
+ &rCntnt.GetCntntIdx()->GetNode() == (SwNode*)pSttNd )
+ {
+ pFmt = pFrmFmt;
+ break;
+ }
+ }
+
+ if( pFmt )
+ {
+ const SwFmtAnchor* pAnchor = &pFmt->GetAnchor();
+ if ((FLY_AT_PAGE != pAnchor->GetAnchorId()) &&
+ pAnchor->GetCntntAnchor() )
+ {
+ pNd = &pAnchor->GetCntntAnchor()->nNode.GetNode();
+ const SwNode* pFlyNd = pNd->FindFlyStartNode();
+ while( pFlyNd )
+ {
+ // dann ueber den Anker nach oben "hangeln"
+ for( n = 0; n < rFmts.Count(); ++n )
+ {
+ const SwFrmFmt* pFrmFmt = rFmts[ n ];
+ const SwNodeIndex* pIdx = pFrmFmt->GetCntnt().
+ GetCntntIdx();
+ if( pIdx && pFlyNd == &pIdx->GetNode() )
+ {
+ if( pFmt == pFrmFmt )
+ {
+ pNd = pFlyNd;
+ pFlyNd = 0;
+ break;
+ }
+ pAnchor = &pFrmFmt->GetAnchor();
+ if ((FLY_AT_PAGE == pAnchor->GetAnchorId()) ||
+ !pAnchor->GetCntntAnchor() )
+ {
+ pFlyNd = 0;
+ break;
+ }
+
+ pFlyNd = pAnchor->GetCntntAnchor()->nNode.
+ GetNode().FindFlyStartNode();
+ break;
+ }
+ }
+ if( n >= rFmts.Count() )
+ {
+ ASSERT( !this, "Fly-Section aber kein Format gefunden" );
+ return sal_False;
+ }
+ }
+ }
+ }
+ // in pNd sollte jetzt der richtige Anker Node stehen oder
+ // immer noch der this
+ }
+
+ if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
+ {
+ if( pNd->GetIndex() > GetNodes().GetEndOfAutotext().GetIndex() )
+ {
+ pPgDesc = &pDoc->GetPageDesc( 0 );
+ pNd = 0;
+ }
+ else
+ {
+ // suche den Body Textnode
+ if( 0 != ( pSttNd = pNd->FindHeaderStartNode() ) ||
+ 0 != ( pSttNd = pNd->FindFooterStartNode() ))
+ {
+ // dann in den PageDescs diesen StartNode suchen
+ sal_uInt16 nId;
+ UseOnPage eAskUse;
+ if( SwHeaderStartNode == pSttNd->GetStartNodeType())
+ {
+ nId = RES_HEADER;
+ eAskUse = nsUseOnPage::PD_HEADERSHARE;
+ }
+ else
+ {
+ nId = RES_FOOTER;
+ eAskUse = nsUseOnPage::PD_FOOTERSHARE;
+ }
+
+ for( sal_uInt16 n = pDoc->GetPageDescCnt(); n && !pPgDesc; )
+ {
+ const SwPageDesc& rPgDsc = pDoc->GetPageDesc( --n );
+ const SwFrmFmt* pFmt = &rPgDsc.GetMaster();
+ int nStt = 0, nLast = 1;
+ if( !( eAskUse & rPgDsc.ReadUseOn() )) ++nLast;
+
+ for( ; nStt < nLast; ++nStt, pFmt = &rPgDsc.GetLeft() )
+ {
+ const SwFmtHeader& rHdFt = (SwFmtHeader&)
+ pFmt->GetFmtAttr( nId );
+ if( rHdFt.GetHeaderFmt() )
+ {
+ const SwFmtCntnt& rCntnt =
+ rHdFt.GetHeaderFmt()->GetCntnt();
+ if( rCntnt.GetCntntIdx() &&
+ &rCntnt.GetCntntIdx()->GetNode() ==
+ (SwNode*)pSttNd )
+ {
+ pPgDesc = &rPgDsc;
+ break;
+ }
+ }
+ }
+ }
+
+ if( !pPgDesc )
+ pPgDesc = &pDoc->GetPageDesc( 0 );
+ pNd = 0;
+ }
+ else if( 0 != ( pSttNd = pNd->FindFootnoteStartNode() ))
+ {
+ // der Anker kann nur im Bodytext sein
+ const SwTxtFtn* pTxtFtn;
+ const SwFtnIdxs& rFtnArr = pDoc->GetFtnIdxs();
+ for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n )
+ if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() &&
+ (SwNode*)pSttNd ==
+ &pTxtFtn->GetStartNode()->GetNode() )
+ {
+ pNd = &pTxtFtn->GetTxtNode();
+ break;
+ }
+ }
+ else
+ {
+ // kann jetzt nur noch ein Seitengebundener Fly sein
+ // oder irgendetwas neueres.
+ // Hier koennen wir nur noch den Standard returnen
+ ASSERT( pNd->FindFlyStartNode(),
+ "wo befindet sich dieser Node?" );
+
+ pPgDesc = &pDoc->GetPageDesc( 0 );
+ pNd = 0;
+ }
+ }
+ }
+
+ if( pNd )
+ {
+ SwFindNearestNode aInfo( *pNd );
+ // dann ueber alle Nodes aller PageDesc
+ const SfxPoolItem* pItem;
+ sal_uInt32 i, nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_PAGEDESC );
+ for( i = 0; i < nMaxItems; ++i )
+ if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_PAGEDESC, i ) ) &&
+ ((SwFmtPageDesc*)pItem)->GetDefinedIn() )
+ {
+ const SwModify* pMod = ((SwFmtPageDesc*)pItem)->GetDefinedIn();
+ if( pMod->ISA( SwCntntNode ) )
+ aInfo.CheckNode( *(SwCntntNode*)pMod );
+ else if( pMod->ISA( SwFmt ))
+ ((SwFmt*)pMod)->GetInfo( aInfo );
+ }
+
+ if( 0 != ( pNd = aInfo.GetFoundNode() ))
+ {
+ if( pNd->IsCntntNode() )
+ pPgDesc = ((SwFmtPageDesc&)pNd->GetCntntNode()->
+ GetAttr( RES_PAGEDESC )).GetPageDesc();
+ else if( pNd->IsTableNode() )
+ pPgDesc = pNd->GetTableNode()->GetTable().
+ GetFrmFmt()->GetPageDesc().GetPageDesc();
+ else if( pNd->IsSectionNode() )
+ pPgDesc = pNd->GetSectionNode()->GetSection().
+ GetFmt()->GetPageDesc().GetPageDesc();
+ // OD 18.03.2003 #106329#
+ if ( pPgDescNdIdx )
+ {
+ *pPgDescNdIdx = pNd->GetIndex();
+ }
+ }
+ if( !pPgDesc )
+ pPgDesc = &pDoc->GetPageDesc( 0 );
+ }
+ }
+ return pPgDesc;
+}
+
+
+ // falls der Node in einem Fly steht, dann wird das entsprechende Format
+ // returnt
+SwFrmFmt* SwNode::GetFlyFmt() const
+{
+ SwFrmFmt* pRet = 0;
+ const SwNode* pSttNd = FindFlyStartNode();
+ if( pSttNd )
+ {
+ if( IsCntntNode() )
+ {
+ SwCntntFrm* pFrm = SwIterator<SwCntntFrm,SwCntntNode>::FirstElement( *(SwCntntNode*)this );
+ if( pFrm )
+ pRet = pFrm->FindFlyFrm()->GetFmt();
+ }
+ if( !pRet )
+ {
+ // dann gibts noch harten steinigen Weg uebers Dokument:
+ const SwSpzFrmFmts& rFrmFmtTbl = *GetDoc()->GetSpzFrmFmts();
+ for( sal_uInt16 n = 0; n < rFrmFmtTbl.Count(); ++n )
+ {
+ SwFrmFmt* pFmt = rFrmFmtTbl[n];
+ const SwFmtCntnt& rCntnt = pFmt->GetCntnt();
+ if( rCntnt.GetCntntIdx() &&
+ &rCntnt.GetCntntIdx()->GetNode() == pSttNd )
+ {
+ pRet = pFmt;
+ break;
+ }
+ }
+ }
+ }
+ return pRet;
+}
+
+SwTableBox* SwNode::GetTblBox() const
+{
+ SwTableBox* pBox = 0;
+ const SwNode* pSttNd = FindTableBoxStartNode();
+ if( pSttNd )
+ pBox = (SwTableBox*)pSttNd->FindTableNode()->GetTable().GetTblBox(
+ pSttNd->GetIndex() );
+ return pBox;
+}
+
+SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp )
+{
+ SwStartNode* pTmp = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
+
+ while( eTyp != pTmp->GetStartNodeType() && pTmp->GetIndex() )
+#if defined( ALPHA ) && defined( UNX )
+ pTmp = ((SwNode*)pTmp)->pStartOfSection;
+#else
+ pTmp = pTmp->pStartOfSection;
+#endif
+ return eTyp == pTmp->GetStartNodeType() ? pTmp : 0;
+}
+
+const SwTxtNode* SwNode::FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const
+{
+ const SwTxtNode* pRet = 0;
+ const SwOutlineNodes& rONds = GetNodes().GetOutLineNds();
+ if( MAXLEVEL > nLvl && rONds.Count() )
+ {
+ sal_uInt16 nPos;
+ SwNode* pNd = (SwNode*)this;
+ sal_Bool bCheckFirst = sal_False;
+ if( !rONds.Seek_Entry( pNd, &nPos ))
+ {
+ if( nPos )
+ nPos = nPos-1;
+ else
+ bCheckFirst = sal_True;
+ }
+
+ if( bCheckFirst )
+ {
+ // der 1.GliederungsNode liegt hinter dem Fragenden. Dann
+ // teste mal, ob dieser auf der gleichen Seite steht. Wenn
+ // nicht, ist das ein ungueltiger. Bug 61865
+ pRet = rONds[0]->GetTxtNode();
+
+ const SwCntntNode* pCNd = GetCntntNode();
+
+ Point aPt( 0, 0 );
+ const SwFrm* pFrm = pRet->getLayoutFrm( pRet->GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False ),
+ * pMyFrm = pCNd ? pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False ) : 0;
+ const SwPageFrm* pPgFrm = pFrm ? pFrm->FindPageFrm() : 0;
+ if( pPgFrm && pMyFrm &&
+ pPgFrm->Frm().Top() > pMyFrm->Frm().Top() )
+ {
+ // der Fragende liegt vor der Seite, also ist er ungueltig
+ pRet = 0;
+ }
+ }
+ else
+ {
+ // oder ans Feld und von dort holen !!
+ while( nPos &&
+ nLvl < ( pRet = rONds[nPos]->GetTxtNode() )
+ //->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei
+ ->GetAttrOutlineLevel() - 1 ) //<-end,zhaojianwei
+ --nPos;
+
+ if( !nPos ) // bei 0 gesondert holen !!
+ pRet = rONds[0]->GetTxtNode();
+ }
+ }
+ return pRet;
+}
+
+inline sal_Bool IsValidNextPrevNd( const SwNode& rNd )
+{
+ return ND_TABLENODE == rNd.GetNodeType() ||
+ ( ND_CONTENTNODE & rNd.GetNodeType() ) ||
+ ( ND_ENDNODE == rNd.GetNodeType() && rNd.StartOfSectionNode() &&
+ ND_TABLENODE == rNd.StartOfSectionNode()->GetNodeType() );
+}
+
+sal_uInt8 SwNode::HasPrevNextLayNode() const
+{
+ // assumption: <this> node is a node inside the document nodes array section.
+
+ sal_uInt8 nRet = 0;
+ if( IsValidNextPrevNd( *this ))
+ {
+ SwNodeIndex aIdx( *this, -1 );
+ // --> OD 2007-06-04 #i77805#
+ // skip section start and end nodes
+ while ( aIdx.GetNode().IsSectionNode() ||
+ ( aIdx.GetNode().IsEndNode() &&
+ aIdx.GetNode().StartOfSectionNode()->IsSectionNode() ) )
+ {
+ --aIdx;
+ }
+ // <--
+ if( IsValidNextPrevNd( aIdx.GetNode() ))
+ nRet |= ND_HAS_PREV_LAYNODE;
+ // --> OD 2007-06-04 #i77805#
+ // skip section start and end nodes
+// aIdx += 2;
+ aIdx = SwNodeIndex( *this, +1 );
+ while ( aIdx.GetNode().IsSectionNode() ||
+ ( aIdx.GetNode().IsEndNode() &&
+ aIdx.GetNode().StartOfSectionNode()->IsSectionNode() ) )
+ {
+ ++aIdx;
+ }
+ // <--
+ if( IsValidNextPrevNd( aIdx.GetNode() ))
+ nRet |= ND_HAS_NEXT_LAYNODE;
+ }
+ return nRet;
+}
+
+/*******************************************************************
+|*
+|* SwNode::StartOfSection
+|*
+|* Beschreibung
+|* Die Funktion liefert die StartOfSection des Nodes.
+|*
+|* Parameter
+|* IN
+|* rNodes bezeichnet das variable Array, in dem sich der Node
+|* befindet
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+
+
+SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType,
+ SwStartNodeType eSttNd )
+ : SwNode( rWhere, nNdType ), eSttNdTyp( eSttNd )
+{
+ // erstmal temporaer, bis der EndNode eingefuegt wird.
+ pEndOfSection = (SwEndNode*)this;
+}
+
+SwStartNode::SwStartNode( SwNodes& rNodes, sal_uLong nPos )
+ : SwNode( rNodes, nPos, ND_STARTNODE ), eSttNdTyp( SwNormalStartNode )
+{
+ // erstmal temporaer, bis der EndNode eingefuegt wird.
+ pEndOfSection = (SwEndNode*)this;
+}
+
+
+void SwStartNode::CheckSectionCondColl() const
+{
+//FEATURE::CONDCOLL
+ SwNodeIndex aIdx( *this );
+ sal_uLong nEndIdx = EndOfSectionIndex();
+ const SwNodes& rNds = GetNodes();
+ SwCntntNode* pCNd;
+ while( 0 != ( pCNd = rNds.GoNext( &aIdx )) && pCNd->GetIndex() < nEndIdx )
+ pCNd->ChkCondColl();
+//FEATURE::CONDCOLL
+}
+
+/*******************************************************************
+|*
+|* SwEndNode::SwEndNode
+|*
+|* Beschreibung
+|* Konstruktor; dieser fuegt einen Node in das Array rNodes
+|* an der Position aWhere ein. Der
+|* theStartOfSection-Pointer wird entsprechend gesetzt,
+|* und der EndOfSection-Pointer des zugehoerigen
+|* Startnodes -- durch rStartOfSection bezeichnet --
+|* wird auf diesen Node gesetzt.
+|*
+|* Parameter
+|* IN
+|* rNodes bezeichnet das variable Array, in das der Node
+|* eingefuegt werden soll
+|* IN
+|* aWhere bezeichnet die Position innerhalb dieses Arrays,
+|* an der der Node eingefuegt werden soll
+|* !!!!!!!!!!!!
+|* Es wird eine Kopie uebergeben!
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+
+
+SwEndNode::SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd )
+ : SwNode( rWhere, ND_ENDNODE )
+{
+ pStartOfSection = &rSttNd;
+ pStartOfSection->pEndOfSection = this;
+}
+
+SwEndNode::SwEndNode( SwNodes& rNds, sal_uLong nPos, SwStartNode& rSttNd )
+ : SwNode( rNds, nPos, ND_ENDNODE )
+{
+ pStartOfSection = &rSttNd;
+ pStartOfSection->pEndOfSection = this;
+}
+
+
+
+// --------------------
+// SwCntntNode
+// --------------------
+
+
+SwCntntNode::SwCntntNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType,
+ SwFmtColl *pColl )
+ : SwModify( pColl ), // CrsrsShell, FrameFmt,
+ SwNode( rWhere, nNdType ),
+ pCondColl( 0 ),
+ mbSetModifyAtAttr( false )
+#ifdef OLD_INDEX
+ ,SwIndexReg(2)
+#endif
+{
+}
+
+
+SwCntntNode::~SwCntntNode()
+{
+ // Die Basisklasse SwClient vom SwFrm nimmt sich aus
+ // der Abhaengikeitsliste raus!
+ // Daher muessen alle Frames in der Abhaengigkeitsliste geloescht werden.
+ if( GetDepends() )
+ DelFrms();
+
+ if( pCondColl )
+ delete pCondColl;
+
+ if ( mpAttrSet.get() && mbSetModifyAtAttr )
+ ((SwAttrSet*)mpAttrSet.get())->SetModifyAtAttr( 0 );
+}
+
+void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
+{
+ sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
+ pNewValue ? pNewValue->Which() : 0 ;
+
+ switch( nWhich )
+ {
+ case RES_OBJECTDYING :
+ {
+ SwFmt * pFmt = (SwFmt *) ((SwPtrMsgPoolItem *)pNewValue)->pObject;
+
+ // nicht umhaengen wenn dieses das oberste Format ist !!
+ if( GetRegisteredIn() == pFmt )
+ {
+ if( pFmt->GetRegisteredIn() )
+ {
+ // wenn Parent, dann im neuen Parent wieder anmelden
+ ((SwModify*)pFmt->GetRegisteredIn())->Add( this );
+ if ( GetpSwAttrSet() )
+ AttrSetHandleHelper::SetParent( mpAttrSet, *this, GetFmtColl(), GetFmtColl() );
+ }
+ else
+ {
+ // sonst auf jeden Fall beim sterbenden abmelden
+ ((SwModify*)GetRegisteredIn())->Remove( this );
+ if ( GetpSwAttrSet() )
+ AttrSetHandleHelper::SetParent( mpAttrSet, *this, 0, 0 );
+ }
+ }
+ }
+ break;
+
+
+ case RES_FMT_CHG:
+ // falls mein Format Parent umgesetzt wird, dann melde ich
+ // meinen Attrset beim Neuen an.
+
+ // sein eigenes Modify ueberspringen !!
+ if( GetpSwAttrSet() &&
+ ((SwFmtChg*)pNewValue)->pChangedFmt == GetRegisteredIn() )
+ {
+ // den Set an den neuen Parent haengen
+ AttrSetHandleHelper::SetParent( mpAttrSet, *this, GetFmtColl(), GetFmtColl() );
+ }
+ break;
+//FEATURE::CONDCOLL
+ case RES_CONDCOLL_CONDCHG:
+ if( ((SwCondCollCondChg*)pNewValue)->pChangedFmt == GetRegisteredIn() &&
+ &GetNodes() == &GetDoc()->GetNodes() )
+ {
+ ChkCondColl();
+ }
+ return ; // nicht an die Basisklasse / Frames weitergeben
+//FEATURE::CONDCOLL
+
+ case RES_ATTRSET_CHG:
+ if( GetNodes().IsDocNodes() && IsTxtNode() )
+ {
+ if( SFX_ITEM_SET == ((SwAttrSetChg*)pOldValue)->GetChgSet()->GetItemState(
+ RES_CHRATR_HIDDEN, sal_False ) )
+ {
+ ((SwTxtNode*)this)->SetCalcHiddenCharFlags();
+ }
+ }
+ break;
+
+ case RES_UPDATE_ATTR:
+ if( GetNodes().IsDocNodes() && IsTxtNode() )
+ {
+ const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->nWhichAttr;
+ if ( RES_ATTRSET_CHG == nTmp )
+ {
+ // anybody wants to do some optimization here?
+ ((SwTxtNode*)this)->SetCalcHiddenCharFlags();
+ }
+ }
+ break;
+ }
+
+ NotifyClients( pOldValue, pNewValue );
+}
+
+sal_Bool SwCntntNode::InvalidateNumRule()
+{
+ SwNumRule* pRule = 0;
+ const SfxPoolItem* pItem;
+ if( GetNodes().IsDocNodes() &&
+ 0 != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, sal_True )) &&
+ ((SwNumRuleItem*)pItem)->GetValue().Len() &&
+ 0 != (pRule = GetDoc()->FindNumRulePtr(
+ ((SwNumRuleItem*)pItem)->GetValue() ) ) )
+ {
+ pRule->SetInvalidRule( sal_True );
+ }
+ return 0 != pRule;
+}
+
+SwCntntFrm *SwCntntNode::getLayoutFrm( const SwRootFrm* _pRoot,
+ const Point* pPoint, const SwPosition *pPos, const sal_Bool bCalcFrm ) const
+{
+ return (SwCntntFrm*) ::GetFrmOfModify( _pRoot, *(SwModify*)this, FRM_CNTNT,
+ pPoint, pPos, bCalcFrm );
+}
+
+SwRect SwCntntNode::FindLayoutRect( const sal_Bool bPrtArea, const Point* pPoint,
+ const sal_Bool bCalcFrm ) const
+{
+ SwRect aRet;
+ SwCntntFrm* pFrm = (SwCntntFrm*)::GetFrmOfModify( 0, *(SwModify*)this,
+ FRM_CNTNT, pPoint, 0, bCalcFrm );
+ if( pFrm )
+ aRet = bPrtArea ? pFrm->Prt() : pFrm->Frm();
+ return aRet;
+}
+
+SwRect SwCntntNode::FindPageFrmRect( const sal_Bool bPrtArea, const Point* pPoint,
+ const sal_Bool bCalcFrm ) const
+{
+ SwRect aRet;
+ SwFrm* pFrm = ::GetFrmOfModify( 0, *(SwModify*)this,
+ FRM_CNTNT, pPoint, 0, bCalcFrm );
+ if( pFrm && 0 != ( pFrm = pFrm->FindPageFrm() ))
+ aRet = bPrtArea ? pFrm->Prt() : pFrm->Frm();
+ return aRet;
+}
+
+xub_StrLen SwCntntNode::Len() const { return 0; }
+
+
+
+SwFmtColl *SwCntntNode::ChgFmtColl( SwFmtColl *pNewColl )
+{
+ ASSERT( pNewColl, "Collectionpointer ist 0." );
+ SwFmtColl *pOldColl = GetFmtColl();
+
+ if( pNewColl != pOldColl )
+ {
+ pNewColl->Add( this );
+
+ // setze den Parent von unseren Auto-Attributen auf die neue
+ // Collection:
+ if( GetpSwAttrSet() )
+ AttrSetHandleHelper::SetParent( mpAttrSet, *this, pNewColl, pNewColl );
+
+//FEATURE::CONDCOLL
+ // HACK: hier muss die entsprechend der neuen Vorlage die Bedingungen
+ // neu ueberprueft werden!
+ if( sal_True /*pNewColl */ )
+ {
+ SetCondFmtColl( 0 );
+ }
+//FEATURE::CONDCOLL
+
+ if( !IsModifyLocked() )
+ {
+ SwFmtChg aTmp1( pOldColl );
+ SwFmtChg aTmp2( pNewColl );
+ SwCntntNode::Modify( &aTmp1, &aTmp2 );
+ }
+ }
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+ return pOldColl;
+}
+
+
+sal_Bool SwCntntNode::GoNext(SwIndex * pIdx, sal_uInt16 nMode ) const
+{
+ sal_Bool bRet = sal_True;
+ if( pIdx->GetIndex() < Len() )
+ {
+ if( !IsTxtNode() )
+ (*pIdx)++;
+ else
+ {
+ const SwTxtNode& rTNd = *GetTxtNode();
+ xub_StrLen nPos = pIdx->GetIndex();
+ if( pBreakIt->GetBreakIter().is() )
+ {
+ sal_Int32 nDone = 0;
+ sal_uInt16 nItrMode = ( CRSR_SKIP_CELLS & nMode ) ?
+ CharacterIteratorMode::SKIPCELL :
+ CharacterIteratorMode::SKIPCONTROLCHARACTER;
+ nPos = (xub_StrLen)pBreakIt->GetBreakIter()->nextCharacters( rTNd.GetTxt(), nPos,
+ pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
+ nItrMode, 1, nDone );
+
+ // Check if nPos is inside hidden text range:
+ if ( CRSR_SKIP_HIDDEN & nMode )
+ {
+ xub_StrLen nHiddenStart;
+ xub_StrLen nHiddenEnd;
+ SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
+ if ( nHiddenStart != STRING_LEN && nHiddenStart != nPos )
+ nPos = nHiddenEnd;
+ }
+
+ if( 1 == nDone )
+ *pIdx = nPos;
+ else
+ bRet = sal_False;
+ }
+ else if( nPos < rTNd.GetTxt().Len() )
+ (*pIdx)++;
+ else
+ bRet = sal_False;
+ }
+ }
+ else
+ bRet = sal_False;
+ return bRet;
+}
+
+
+sal_Bool SwCntntNode::GoPrevious(SwIndex * pIdx, sal_uInt16 nMode ) const
+{
+ sal_Bool bRet = sal_True;
+ if( pIdx->GetIndex() > 0 )
+ {
+ if( !IsTxtNode() )
+ (*pIdx)--;
+ else
+ {
+ const SwTxtNode& rTNd = *GetTxtNode();
+ xub_StrLen nPos = pIdx->GetIndex();
+ if( pBreakIt->GetBreakIter().is() )
+ {
+ sal_Int32 nDone = 0;
+ sal_uInt16 nItrMode = ( CRSR_SKIP_CELLS & nMode ) ?
+ CharacterIteratorMode::SKIPCELL :
+ CharacterIteratorMode::SKIPCONTROLCHARACTER;
+ nPos = (xub_StrLen)pBreakIt->GetBreakIter()->previousCharacters( rTNd.GetTxt(), nPos,
+ pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
+ nItrMode, 1, nDone );
+
+ // Check if nPos is inside hidden text range:
+ if ( CRSR_SKIP_HIDDEN & nMode )
+ {
+ xub_StrLen nHiddenStart;
+ xub_StrLen nHiddenEnd;
+ SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
+ if ( nHiddenStart != STRING_LEN )
+ nPos = nHiddenStart;
+ }
+
+ if( 1 == nDone )
+ *pIdx = nPos;
+ else
+ bRet = sal_False;
+ }
+ else if( nPos )
+ (*pIdx)--;
+ else
+ bRet = sal_False;
+ }
+ }
+ else
+ bRet = sal_False;
+ return bRet;
+}
+
+
+/*
+ * Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
+ * Dokument. Die erzeugten Contentframes werden in das entsprechende
+ * Layout gehaengt.
+ */
+
+
+void SwCntntNode::MakeFrms( SwCntntNode& rNode )
+{
+ ASSERT( &rNode != this,
+ "Kein Contentnode oder Copy-Node und neuer Node identisch." );
+
+ if( !GetDepends() || &rNode == this ) // gibt es ueberhaupt Frames ??
+ return;
+
+ SwFrm *pFrm, *pNew;
+ SwLayoutFrm *pUpper;
+ // Frames anlegen fuer Nodes, die vor oder hinter der Tabelle stehen ??
+ ASSERT( FindTableNode() == rNode.FindTableNode(), "Table confusion" )
+
+ SwNode2Layout aNode2Layout( *this, rNode.GetIndex() );
+
+ while( 0 != (pUpper = aNode2Layout.UpperFrm( pFrm, rNode )) )
+ {
+ pNew = rNode.MakeFrm( pUpper );
+ pNew->Paste( pUpper, pFrm );
+ // --> OD 2005-12-01 #i27138#
+ // notify accessibility paragraphs objects about changed
+ // CONTENT_FLOWS_FROM/_TO relation.
+ // Relation CONTENT_FLOWS_FROM for next paragraph will change
+ // and relation CONTENT_FLOWS_TO for previous paragraph will change.
+ if ( pNew->IsTxtFrm() )
+ {
+ ViewShell* pViewShell( pNew->getRootFrm()->GetCurrShell() );
+ if ( pViewShell && pViewShell->GetLayout() &&
+ pViewShell->GetLayout()->IsAnyShellAccessible() )
+ {
+ pViewShell->InvalidateAccessibleParaFlowRelation(
+ dynamic_cast<SwTxtFrm*>(pNew->FindNextCnt( true )),
+ dynamic_cast<SwTxtFrm*>(pNew->FindPrevCnt( true )) );
+ }
+ }
+ // <--
+ }
+}
+
+/*
+ * Methode loescht fuer den Node alle Ansichten vom
+ * Dokument. Die Contentframes werden aus dem entsprechenden
+ * Layout ausgehaengt.
+ */
+
+
+void SwCntntNode::DelFrms()
+{
+ if( !GetDepends() )
+ return;
+
+ SwCntntFrm::DelFrms(*this);
+ if( IsTxtNode() )
+ {
+ ((SwTxtNode*)this)->SetWrong( NULL );
+ ((SwTxtNode*)this)->SetWrongDirty( true );
+
+ ((SwTxtNode*)this)->SetGrammarCheck( NULL );
+ ((SwTxtNode*)this)->SetGrammarCheckDirty( true );
+ // SMARTTAGS
+ ((SwTxtNode*)this)->SetSmartTags( NULL );
+ ((SwTxtNode*)this)->SetSmartTagDirty( true );
+
+ ((SwTxtNode*)this)->SetWordCountDirty( true );
+ ((SwTxtNode*)this)->SetAutoCompleteWordDirty( true );
+ }
+}
+
+
+SwCntntNode *SwCntntNode::JoinNext()
+{
+ return this;
+}
+
+
+SwCntntNode *SwCntntNode::JoinPrev()
+{
+ return this;
+}
+
+
+
+ // erfrage vom Modify Informationen
+sal_Bool SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const
+{
+ switch( rInfo.Which() )
+ {
+ case RES_AUTOFMT_DOCNODE:
+ if( &GetNodes() == ((SwAutoFmtGetDocNode&)rInfo).pNodes )
+ {
+ ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = this;
+ return sal_False;
+ }
+ break;
+ // --> OD 2008-02-19 #refactorlists#
+// case RES_GETNUMNODES:
+// // #111955# only numbered nodes in rInfo
+// if( IsTxtNode())
+// {
+// SwTxtNode * pTxtNode = (SwTxtNode*)this;
+// pItem = (SwNumRuleItem*)GetNoCondAttr(RES_PARATR_NUMRULE, sal_True );
+
+// if (0 != pItem &&
+// pItem->GetValue().Len() &&
+// pItem->GetValue() == ((SwNumRuleInfo&)rInfo).GetName() &&
+// GetNodes().IsDocNodes())
+// {
+// ((SwNumRuleInfo&)rInfo).AddNode( *pTxtNode );
+// }
+// }
+
+// return sal_True;
+ // <--
+
+ case RES_FINDNEARESTNODE:
+ if( ((SwFmtPageDesc&)GetAttr( RES_PAGEDESC )).GetPageDesc() )
+ ((SwFindNearestNode&)rInfo).CheckNode( *this );
+ return sal_True;
+
+ case RES_CONTENT_VISIBLE:
+ {
+ ((SwPtrMsgPoolItem&)rInfo).pObject =
+ SwIterator<SwFrm,SwCntntNode>::FirstElement(*this);
+ }
+ return sal_False;
+ }
+
+ return SwModify::GetInfo( rInfo );
+}
+
+
+ // setze ein Attribut
+sal_Bool SwCntntNode::SetAttr(const SfxPoolItem& rAttr )
+{
+ if( !GetpSwAttrSet() ) // lasse von den entsprechenden Nodes die
+ NewAttrSet( GetDoc()->GetAttrPool() ); // AttrSets anlegen
+
+ ASSERT( GetpSwAttrSet(), "warum wurde kein AttrSet angelegt?" );
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+
+ sal_Bool bRet = sal_False;
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() ||
+ ( !GetDepends() && RES_PARATR_NUMRULE != rAttr.Which() ))
+ {
+ bRet = 0 != AttrSetHandleHelper::Put( mpAttrSet, *this, rAttr );
+ }
+ else
+ {
+ SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
+ aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
+ if( 0 != ( bRet = 0 != AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew ) ))
+ {
+ SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
+ SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+ return bRet;
+}
+#include <svl/itemiter.hxx>
+
+sal_Bool SwCntntNode::SetAttr( const SfxItemSet& rSet )
+{
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+
+ const SfxPoolItem* pFnd = 0;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_AUTO_STYLE, sal_False, &pFnd ) )
+ {
+ ASSERT( rSet.Count() == 1, "SetAutoStyle mixed with other attributes?!" );
+ const SwFmtAutoFmt* pTmp = static_cast<const SwFmtAutoFmt*>(pFnd);
+
+ // If there already is an attribute set (usually containing a numbering
+ // item), we have to merge the attribute of the new set into the old set:
+ bool bSetParent = true;
+ if ( GetpSwAttrSet() )
+ {
+ bSetParent = false;
+ AttrSetHandleHelper::Put( mpAttrSet, *this, *pTmp->GetStyleHandle() );
+ }
+ else
+ {
+ mpAttrSet = pTmp->GetStyleHandle();
+ }
+
+ if ( bSetParent )
+ {
+ // If the content node has a conditional style, we have to set the
+ // string item containing the correct conditional style name (the
+ // style name property has already been set during the import!)
+ // In case we do not have a conditional style, we make use of the
+ // fact that nobody else uses the attribute set behind the handle.
+ // FME 2007-07-10 #i78124# If autostyle does not have a parent,
+ // the string is empty.
+ const SfxPoolItem* pNameItem = 0;
+ if ( 0 != GetCondFmtColl() ||
+ SFX_ITEM_SET != mpAttrSet->GetItemState( RES_FRMATR_STYLE_NAME, sal_False, &pNameItem ) ||
+ 0 == static_cast<const SfxStringItem*>(pNameItem)->GetValue().Len() )
+ AttrSetHandleHelper::SetParent( mpAttrSet, *this, &GetAnyFmtColl(), GetFmtColl() );
+ else
+ const_cast<SfxItemSet*>(mpAttrSet.get())->SetParent( &GetFmtColl()->GetAttrSet() );
+ }
+
+ return sal_True;
+ }
+
+ if( !GetpSwAttrSet() ) // lasse von den entsprechenden Nodes die
+ NewAttrSet( GetDoc()->GetAttrPool() ); // AttrSets anlegen
+
+ sal_Bool bRet = sal_False;
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if ( IsModifyLocked() ||
+ ( !GetDepends() &&
+ SFX_ITEM_SET != rSet.GetItemState( RES_PARATR_NUMRULE, sal_False ) ) )
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ bRet = 0 != AttrSetHandleHelper::Put( mpAttrSet, *this, rSet );
+ }
+ else
+ {
+ SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
+ aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
+ if( 0 != (bRet = 0 != AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew )) )
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
+ SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+ return bRet;
+}
+
+// Nimmt den Hint mit nWhich aus dem Delta-Array
+
+
+sal_Bool SwCntntNode::ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
+{
+ if( !GetpSwAttrSet() )
+ return sal_False;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ {
+ sal_uInt16 nDel = 0;
+ if ( !nWhich2 || nWhich2 < nWhich1 )
+ {
+ std::vector<sal_uInt16> aClearWhichIds;
+ aClearWhichIds.push_back( nWhich1 );
+ nDel = ClearItemsFromAttrSet( aClearWhichIds );
+ }
+ else
+ nDel = AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, 0, 0 );
+
+ if( !GetpSwAttrSet()->Count() ) // leer, dann loeschen
+ mpAttrSet.reset();//DELETEZ( mpAttrSet );
+ return 0 != nDel;
+ }
+
+ // sollte kein gueltiger Bereich definiert sein ?
+ if( !nWhich2 || nWhich2 < nWhich1 )
+ nWhich2 = nWhich1; // dann setze auf 1. Id, nur dieses Item
+
+ SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
+ aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
+ sal_Bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
+ SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+
+ if( !GetpSwAttrSet()->Count() ) // leer, dann loeschen
+ mpAttrSet.reset();//DELETEZ( mpAttrSet );
+ }
+ return bRet;
+}
+sal_Bool SwCntntNode::ResetAttr( const SvUShorts& rWhichArr )
+{
+ if( !GetpSwAttrSet() )
+ return sal_False;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ sal_uInt16 nDel = 0;
+ if( IsModifyLocked() )
+ {
+ std::vector<sal_uInt16> aClearWhichIds;
+ for( sal_uInt16 n = 0, nEnd = rWhichArr.Count(); n < nEnd; ++n )
+ aClearWhichIds.push_back( rWhichArr[ n ] );
+
+ nDel = ClearItemsFromAttrSet( aClearWhichIds );
+ }
+ else
+ {
+ SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
+ aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
+
+ for( sal_uInt16 n = 0, nEnd = rWhichArr.Count(); n < nEnd; ++n )
+ if( AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, rWhichArr[ n ], &aOld, &aNew ))
+ ++nDel;
+
+ if( nDel )
+ {
+ SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
+ SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+ if( !GetpSwAttrSet()->Count() ) // leer, dann loeschen
+ mpAttrSet.reset();//DELETEZ( mpAttrSet );
+ return 0 != nDel ;
+}
+
+
+sal_uInt16 SwCntntNode::ResetAllAttr()
+{
+ if( !GetpSwAttrSet() )
+ return 0;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ {
+ std::vector<sal_uInt16> aClearWhichIds;
+ aClearWhichIds.push_back(0);
+ sal_uInt16 nDel = ClearItemsFromAttrSet( aClearWhichIds );
+ if( !GetpSwAttrSet()->Count() ) // leer, dann loeschen
+ mpAttrSet.reset(); // DELETEZ( mpAttrSet );
+ return nDel;
+ }
+
+ SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
+ aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
+ sal_Bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, 0, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
+ SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
+ ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+
+ if( !GetpSwAttrSet()->Count() ) // leer, dann loeschen
+ mpAttrSet.reset();//DELETEZ( mpAttrSet );
+ }
+ return aNew.Count();
+}
+
+
+sal_Bool SwCntntNode::GetAttr( SfxItemSet& rSet, sal_Bool bInParent ) const
+{
+ if( rSet.Count() )
+ rSet.ClearItem();
+
+ const SwAttrSet& rAttrSet = GetSwAttrSet();
+ if( bInParent )
+ return rSet.Set( rAttrSet, sal_True ) ? sal_True : sal_False;
+
+ rSet.Put( rAttrSet );
+ return rSet.Count() ? sal_True : sal_False;
+}
+
+sal_uInt16 SwCntntNode::ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds )
+{
+ sal_uInt16 nRet = 0;
+ if ( 0 == rWhichIds.size() )
+ return nRet;
+
+ ASSERT( GetpSwAttrSet(), "no item set" )
+ SwAttrSet aNewAttrSet( *GetpSwAttrSet() );
+ for ( std::vector<sal_uInt16>::const_iterator aIter = rWhichIds.begin();
+ aIter != rWhichIds.end();
+ ++aIter )
+ {
+ nRet = nRet + aNewAttrSet.ClearItem( *aIter );
+ }
+ if ( nRet )
+ AttrSetHandleHelper::GetNewAutoStyle( mpAttrSet, *this, aNewAttrSet );
+
+ return nRet;
+}
+
+const SfxPoolItem* SwCntntNode::GetNoCondAttr( sal_uInt16 nWhich,
+ sal_Bool bInParents ) const
+{
+ const SfxPoolItem* pFnd = 0;
+ if( pCondColl && pCondColl->GetRegisteredIn() )
+ {
+ if( !GetpSwAttrSet() || ( SFX_ITEM_SET != GetpSwAttrSet()->GetItemState(
+ nWhich, sal_False, &pFnd ) && bInParents ))
+ ((SwFmt*)GetRegisteredIn())->GetItemState( nWhich, bInParents, &pFnd );
+ }
+ // --> OD 2005-10-25 #126347# - undo change of issue #i51029#
+ // Note: <GetSwAttrSet()> returns <mpAttrSet>, if set, otherwise it returns
+ // the attribute set of the paragraph style, which is valid for the
+ // content node - see file <node.hxx>
+ else
+ // <--
+ {
+ GetSwAttrSet().GetItemState( nWhich, bInParents, &pFnd );
+ }
+ return pFnd;
+}
+
+ // koennen 2 Nodes zusammengefasst werden ?
+ // in pIdx kann die 2. Position returnt werden.
+int SwCntntNode::CanJoinNext( SwNodeIndex* pIdx ) const
+{
+ const SwNodes& rNds = GetNodes();
+ sal_uInt8 nNdType = GetNodeType();
+ SwNodeIndex aIdx( *this, 1 );
+
+ const SwNode* pNd = this;
+ while( aIdx < rNds.Count()-1 &&
+ (( pNd = &aIdx.GetNode())->IsSectionNode() ||
+ ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
+ aIdx++;
+
+ if( pNd->GetNodeType() != nNdType || rNds.Count()-1 == aIdx.GetIndex() )
+ return sal_False;
+ if( IsTxtNode() )
+ { // Do not merge strings if the result exceeds the allowed string length
+ const SwTxtNode* pTxtNd = static_cast<const SwTxtNode*>(this);
+ sal_uInt64 nSum = pTxtNd->GetTxt().Len();
+ pTxtNd = static_cast<const SwTxtNode*>(pNd);
+ nSum += pTxtNd->GetTxt().Len();
+ if( nSum > STRING_LEN )
+ return sal_False;
+ }
+ if( pIdx )
+ *pIdx = aIdx;
+ return sal_True;
+}
+
+
+ // koennen 2 Nodes zusammengefasst werden ?
+ // in pIdx kann die 2. Position returnt werden.
+int SwCntntNode::CanJoinPrev( SwNodeIndex* pIdx ) const
+{
+ sal_uInt8 nNdType = GetNodeType();
+ SwNodeIndex aIdx( *this, -1 );
+
+ const SwNode* pNd = this;
+ while( aIdx.GetIndex() &&
+ (( pNd = &aIdx.GetNode())->IsSectionNode() ||
+ ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
+ aIdx--;
+
+ if( pNd->GetNodeType() != nNdType || 0 == aIdx.GetIndex() )
+ return sal_False;
+ if( pIdx )
+ *pIdx = aIdx;
+ return sal_True;
+}
+
+
+//FEATURE::CONDCOLL
+
+
+void SwCntntNode::SetCondFmtColl( SwFmtColl* pColl )
+{
+ if( (!pColl && pCondColl) || ( pColl && !pCondColl ) ||
+ ( pColl && pColl != pCondColl->GetRegisteredIn() ) )
+ {
+ SwFmtColl* pOldColl = GetCondFmtColl();
+ delete pCondColl;
+ if( pColl )
+ pCondColl = new SwDepend( this, pColl );
+ else
+ pCondColl = 0;
+
+ if( GetpSwAttrSet() )
+ {
+ AttrSetHandleHelper::SetParent( mpAttrSet, *this, &GetAnyFmtColl(), GetFmtColl() );
+ }
+
+ if( !IsModifyLocked() )
+ {
+ SwFmtChg aTmp1( pOldColl ? pOldColl : GetFmtColl() );
+ SwFmtChg aTmp2( pColl ? pColl : GetFmtColl() );
+ NotifyClients( &aTmp1, &aTmp2 );
+ }
+ if( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( sal_False );
+ }
+ }
+}
+
+
+sal_Bool SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const
+{
+ const SwNodes& rNds = GetNodes();
+ {
+ int nCond = 0;
+ const SwStartNode* pSttNd = StartOfSectionNode();
+ while( pSttNd )
+ {
+ switch( pSttNd->GetNodeType() )
+ {
+ case ND_TABLENODE: nCond = PARA_IN_TABLEBODY; break;
+ case ND_SECTIONNODE: nCond = PARA_IN_SECTION; break;
+
+ default:
+ switch( pSttNd->GetStartNodeType() )
+ {
+ case SwTableBoxStartNode:
+ {
+ nCond = PARA_IN_TABLEBODY;
+ const SwTableNode* pTblNd = pSttNd->FindTableNode();
+ const SwTableBox* pBox;
+ if( pTblNd && 0 != ( pBox = pTblNd->GetTable().
+ GetTblBox( pSttNd->GetIndex() ) ) && pBox &&
+ pBox->IsInHeadline( &pTblNd->GetTable() ) )
+ nCond = PARA_IN_TABLEHEAD;
+ }
+ break;
+ case SwFlyStartNode: nCond = PARA_IN_FRAME; break;
+ case SwFootnoteStartNode:
+ {
+ nCond = PARA_IN_FOOTENOTE;
+ const SwFtnIdxs& rFtnArr = rNds.GetDoc()->GetFtnIdxs();
+ const SwTxtFtn* pTxtFtn;
+ const SwNode* pSrchNd = pSttNd;
+
+ for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n )
+ if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() &&
+ pSrchNd == &pTxtFtn->GetStartNode()->GetNode() )
+ {
+ if( pTxtFtn->GetFtn().IsEndNote() )
+ nCond = PARA_IN_ENDNOTE;
+ break;
+ }
+ }
+ break;
+ case SwHeaderStartNode: nCond = PARA_IN_HEADER; break;
+ case SwFooterStartNode: nCond = PARA_IN_FOOTER; break;
+ case SwNormalStartNode: break;
+ }
+ }
+
+ if( nCond )
+ {
+ rTmp.SetCondition( (Master_CollConditions)nCond, 0 );
+ return sal_True;
+ }
+ pSttNd = pSttNd->GetIndex()
+ ? pSttNd->StartOfSectionNode()
+ : 0;
+ }
+ }
+
+ {
+ sal_uInt16 nPos;
+ const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
+ if( rOutlNds.Count() )
+ {
+ if( !rOutlNds.Seek_Entry( (SwCntntNode*)this, &nPos ) && nPos )
+ --nPos;
+ if( nPos < rOutlNds.Count() &&
+ rOutlNds[ nPos ]->GetIndex() < GetIndex() )
+ {
+ SwTxtNode* pOutlNd = rOutlNds[ nPos ]->GetTxtNode();
+
+ if( pOutlNd->IsOutline())
+ {
+ rTmp.SetCondition( PARA_IN_OUTLINE, pOutlNd->GetAttrOutlineLevel() - 1 );
+ return sal_True;
+ }
+ }
+ }
+ }
+
+ return sal_False;
+}
+
+
+void SwCntntNode::ChkCondColl()
+{
+ // zur Sicherheit abfragen
+ if( RES_CONDTXTFMTCOLL == GetFmtColl()->Which() )
+ {
+ SwCollCondition aTmp( 0, 0, 0 );
+ const SwCollCondition* pCColl;
+
+ bool bDone = false;
+
+ if( IsAnyCondition( aTmp ))
+ {
+ pCColl = static_cast<SwConditionTxtFmtColl*>(GetFmtColl())
+ ->HasCondition( aTmp );
+
+ if (pCColl)
+ {
+ SetCondFmtColl( pCColl->GetTxtFmtColl() );
+ bDone = true;
+ }
+ }
+
+ if (!bDone)
+ {
+ if( IsTxtNode() && ((SwTxtNode*)this)->GetNumRule())
+ {
+ // steht in einer Numerierung
+ // welcher Level?
+ aTmp.SetCondition( PARA_IN_LIST,
+ ((SwTxtNode*)this)->GetActualListLevel() );
+ pCColl = ((SwConditionTxtFmtColl*)GetFmtColl())->
+ HasCondition( aTmp );
+ }
+ else
+ pCColl = 0;
+
+ if( pCColl )
+ SetCondFmtColl( pCColl->GetTxtFmtColl() );
+ else if( pCondColl )
+ SetCondFmtColl( 0 );
+ }
+ }
+}
+
+// --> OD 2005-02-21 #i42921#
+short SwCntntNode::GetTextDirection( const SwPosition& rPos,
+ const Point* pPt ) const
+{
+ short nRet = -1;
+
+ Point aPt;
+ if( pPt )
+ aPt = *pPt;
+
+ // --> OD 2007-01-10 #i72024#
+ // No format of the frame, because this can cause recursive layout actions
+ SwFrm* pFrm = getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, &rPos, sal_False );
+ // <--
+
+ if ( pFrm )
+ {
+ if ( pFrm->IsVertical() )
+ {
+ if ( pFrm->IsRightToLeft() )
+ nRet = FRMDIR_VERT_TOP_LEFT;
+ else
+ nRet = FRMDIR_VERT_TOP_RIGHT;
+ }
+ else
+ {
+ if ( pFrm->IsRightToLeft() )
+ nRet = FRMDIR_HORI_RIGHT_TOP;
+ else
+ nRet = FRMDIR_HORI_LEFT_TOP;
+ }
+ }
+
+
+ return nRet;
+}
+// <--
+
+SwOLENodes* SwCntntNode::CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize )
+{
+ SwOLENodes *pNodes = 0;
+ SwIterator<SwCntntNode,SwFmtColl> aIter( rColl );
+ for( SwCntntNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
+ {
+ SwOLENode *pONd = pNd->GetOLENode();
+ if ( pONd && (!bOnlyWithInvalidSize || pONd->IsOLESizeInvalid()) )
+ {
+ if ( !pNodes )
+ pNodes = new SwOLENodes;
+ pNodes->Insert( pONd, pNodes->Count() );
+ }
+ }
+
+ return pNodes;
+}
+
+//FEATURE::CONDCOLL
+// Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
+// os: nur fuer ICC, da der zum optimieren zu dumm ist
+#ifdef ICC
+SwTxtNode *SwNode::GetTxtNode()
+{
+ return ND_TEXTNODE == nNodeType ? (SwTxtNode*)this : 0;
+}
+const SwTxtNode *SwNode::GetTxtNode() const
+{
+ return ND_TEXTNODE == nNodeType ? (const SwTxtNode*)this : 0;
+}
+#endif
+
+/*
+ * Document Interface Access
+ */
+const IDocumentSettingAccess* SwNode::getIDocumentSettingAccess() const { return GetDoc(); }
+const IDocumentDeviceAccess* SwNode::getIDocumentDeviceAccess() const { return GetDoc(); }
+const IDocumentMarkAccess* SwNode::getIDocumentMarkAccess() const { return GetDoc()->getIDocumentMarkAccess(); }
+const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return GetDoc(); }
+const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return GetDoc(); }
+const IDocumentLineNumberAccess* SwNode::getIDocumentLineNumberAccess() const { return GetDoc(); }
+const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return GetDoc(); }
+const IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() const { return GetDoc(); }
+IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() { return GetDoc(); }
+const IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() const { return GetDoc(); }
+IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() { return GetDoc(); }
+const IDocumentFieldsAccess* SwNode::getIDocumentFieldsAccess() const { return GetDoc(); }
+IDocumentFieldsAccess* SwNode::getIDocumentFieldsAccess() { return GetDoc(); }
+IDocumentContentOperations* SwNode::getIDocumentContentOperations() { return GetDoc(); }
+IStyleAccess& SwNode::getIDocumentStyleAccess() { return GetDoc()->GetIStyleAccess(); }
+// --> OD 2007-10-31 #i83479#
+IDocumentListItems& SwNode::getIDocumentListItems()
+{
+ return *GetDoc();
+}
+// <--
+
+sal_Bool SwNode::IsInRedlines() const
+{
+ const SwDoc * pDoc = GetDoc();
+ sal_Bool bResult = sal_False;
+
+ if (pDoc != NULL)
+ bResult = pDoc->IsInRedlines(*this);
+
+ return bResult;
+}
diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx
new file mode 100644
index 000000000000..7c4e648f6c19
--- /dev/null
+++ b/sw/source/core/docnode/node2lay.cxx
@@ -0,0 +1,472 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <switerator.hxx>
+#include <calbck.hxx>
+#include <node.hxx>
+#include <ndindex.hxx>
+#include <swtable.hxx>
+#include <ftnfrm.hxx>
+#include <sectfrm.hxx>
+#include "frmfmt.hxx"
+#include "cntfrm.hxx"
+#include "tabfrm.hxx"
+#include "frmtool.hxx"
+#include "section.hxx"
+#include "node2lay.hxx"
+
+/* -----------------25.02.99 10:31-------------------
+ * Die SwNode2LayImpl-Klasse erledigt die eigentliche Arbeit,
+ * die SwNode2Layout-Klasse ist nur die der Oefffentlichkeit bekannte Schnittstelle
+ * --------------------------------------------------*/
+class SwNode2LayImpl
+{
+ SwIterator<SwFrm,SwModify>* pIter;
+ SwModify* pMod;
+ SvPtrarr *pUpperFrms;// Zum Einsammeln der Upper
+ sal_uLong nIndex; // Der Index des einzufuegenden Nodes
+ sal_Bool bMaster : 1; // sal_True => nur Master , sal_False => nur Frames ohne Follow
+ sal_Bool bInit : 1; // Ist am SwClient bereits ein First()-Aufruf erfolgt?
+public:
+ SwNode2LayImpl( const SwNode& rNode, sal_uLong nIdx, sal_Bool bSearch );
+ ~SwNode2LayImpl() { delete pIter; delete pUpperFrms; }
+ SwFrm* NextFrm(); // liefert den naechsten "sinnvollen" Frame
+ SwLayoutFrm* UpperFrm( SwFrm* &rpFrm, const SwNode &rNode );
+ void SaveUpperFrms(); // Speichert (und lockt ggf.) die pUpper
+ // Fuegt unter jeden pUpper des Arrays einen Frame ein.
+ void RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd );
+
+ SwFrm* GetFrm( const Point* pDocPos = 0,
+ const SwPosition *pPos = 0,
+ const sal_Bool bCalcFrm = sal_True ) const;
+};
+
+/* -----------------25.02.99 10:38-------------------
+ * Hauptaufgabe des Ctor: Das richtige SwModify zu ermitteln,
+ * ueber das iteriert wird.
+ * Uebergibt man bSearch == sal_True, so wird der naechste Cntnt- oder TableNode
+ * gesucht, der Frames besitzt ( zum Einsammeln der pUpper ), ansonsten wird
+ * erwartet, das rNode bereits auf einem solchen Cntnt- oder TableNode sitzt,
+ * vor oder hinter den eingefuegt werden soll.
+ * --------------------------------------------------*/
+
+SwNode* GoNextWithFrm(const SwNodes& rNodes, SwNodeIndex *pIdx)
+{
+ if( pIdx->GetIndex() >= rNodes.Count() - 1 )
+ return 0;
+
+ SwNodeIndex aTmp(*pIdx, +1);
+ SwNode* pNd = 0;
+ while( aTmp < rNodes.Count()-1 )
+ {
+ pNd = &aTmp.GetNode();
+ bool bFound = false;
+ if ( pNd->IsCntntNode() )
+ bFound = ( SwIterator<SwFrm,SwCntntNode>::FirstElement(*(SwCntntNode*)pNd) != 0);
+ else if ( pNd->IsTableNode() )
+ bFound = ( SwIterator<SwFrm,SwFmt>::FirstElement(*((SwTableNode*)pNd)->GetTable().GetFrmFmt()) != 0 );
+ else if( pNd->IsEndNode() && !pNd->StartOfSectionNode()->IsSectionNode() )
+ {
+ pNd = 0;
+ break;
+ }
+ if ( bFound )
+ break;
+ aTmp++;
+ }
+
+ if( aTmp == rNodes.Count()-1 )
+ pNd = 0;
+ else if( pNd )
+ (*pIdx) = aTmp;
+ return pNd;
+}
+
+SwNode* GoPreviousWithFrm(SwNodeIndex *pIdx)
+{
+ if( !pIdx->GetIndex() )
+ return 0;
+
+ SwNodeIndex aTmp( *pIdx, -1 );
+ SwNode* pNd(0);
+ while( aTmp.GetIndex() )
+ {
+ pNd = &aTmp.GetNode();
+ bool bFound = false;
+ if ( pNd->IsCntntNode() )
+ bFound = ( SwIterator<SwFrm,SwCntntNode>::FirstElement(*(SwCntntNode*)pNd) != 0);
+ else if ( pNd->IsTableNode() )
+ bFound = ( SwIterator<SwFrm,SwFmt>::FirstElement(*((SwTableNode*)pNd)->GetTable().GetFrmFmt()) != 0 );
+ else if( pNd->IsStartNode() && !pNd->IsSectionNode() )
+ {
+ pNd = 0;
+ break;
+ }
+ if ( bFound )
+ break;
+ aTmp--;
+ }
+
+ if( !aTmp.GetIndex() )
+ pNd = 0;
+ else if( pNd )
+ (*pIdx) = aTmp;
+ return pNd;
+}
+
+
+SwNode2LayImpl::SwNode2LayImpl( const SwNode& rNode, sal_uLong nIdx, sal_Bool bSearch )
+ : pUpperFrms( NULL ), nIndex( nIdx ), bInit( sal_False )
+{
+ const SwNode* pNd;
+ if( bSearch || rNode.IsSectionNode() )
+ {
+ // Suche den naechsten Cntnt/TblNode, der einen Frame besitzt,
+ // damit wir uns vor/hinter ihn haengen koennen
+ if( !bSearch && rNode.GetIndex() < nIndex )
+ {
+ SwNodeIndex aTmp( *rNode.EndOfSectionNode(), +1 );
+ pNd = GoPreviousWithFrm( &aTmp );
+ if( !bSearch && pNd && rNode.GetIndex() > pNd->GetIndex() )
+ pNd = NULL; // Nicht ueber den Bereich hinausschiessen
+ bMaster = sal_False;
+ }
+ else
+ {
+ SwNodeIndex aTmp( rNode, -1 );
+ pNd = GoNextWithFrm( rNode.GetNodes(), &aTmp );
+ bMaster = sal_True;
+ if( !bSearch && pNd && rNode.EndOfSectionIndex() < pNd->GetIndex() )
+ pNd = NULL; // Nicht ueber den Bereich hinausschiessen
+ }
+ }
+ else
+ {
+ pNd = &rNode;
+ bMaster = nIndex < rNode.GetIndex();
+ }
+ if( pNd )
+ {
+ if( pNd->IsCntntNode() )
+ pMod = (SwModify*)pNd->GetCntntNode();
+ else
+ {
+ ASSERT( pNd->IsTableNode(), "For Tablenodes only" );
+ pMod = pNd->GetTableNode()->GetTable().GetFrmFmt();
+ }
+ pIter = new SwIterator<SwFrm,SwModify>( *pMod );
+ }
+ else
+ {
+ pIter = NULL;
+ pMod = 0;
+ }
+}
+
+/* -----------------25.02.99 10:41-------------------
+ * SwNode2LayImpl::NextFrm() liefert den naechsten "sinnvollen" Frame,
+ * beim ersten Aufruf wird am eigentlichen Iterator ein First gerufen,
+ * danach die Next-Methode. Das Ergebnis wird auf Brauchbarkeit untersucht,
+ * so werden keine Follows akzeptiert, ein Master wird beim Einsammeln der
+ * pUpper und beim Einfuegen vor ihm akzeptiert. Beim Einfuegen dahinter
+ * wird vom Master ausgehend der letzte Follow gesucht und zurueckgegeben.
+ * Wenn der Frame innerhalb eines SectionFrms liegt, wird noch festgestellt,
+ * ob statt des Frames der SectionFrm der geeignete Rueckgabewert ist, dies
+ * ist der Fall, wenn der neu einzufuegende Node ausserhalb des Bereichs liegt.
+ * --------------------------------------------------*/
+SwFrm* SwNode2LayImpl::NextFrm()
+{
+ SwFrm* pRet;
+ if( !pIter )
+ return sal_False;
+ if( !bInit )
+ {
+ pRet = pIter->First();
+ bInit = sal_True;
+ }
+ else
+ pRet = pIter->Next();
+ while( pRet )
+ {
+ SwFlowFrm* pFlow = SwFlowFrm::CastFlowFrm( pRet );
+ ASSERT( pFlow, "Cntnt or Table expected?!" );
+ // Follows sind fluechtige Gestalten, deshalb werden sie ignoriert.
+ // Auch wenn wir hinter dem Frame eingefuegt werden sollen, nehmen wir
+ // zunaechst den Master, hangeln uns dann aber zum letzten Follow durch.
+ if( !pFlow->IsFollow() )
+ {
+ if( !bMaster )
+ {
+ while( pFlow->HasFollow() )
+ pFlow = pFlow->GetFollow();
+ pRet = pFlow->GetFrm();
+ }
+ if( pRet->IsInSct() )
+ {
+ SwSectionFrm* pSct = pRet->FindSctFrm();
+ // Vorsicht: Wenn wir in einer Fussnote sind, so kann diese
+ // Layoutmaessig in einem spaltigen Bereich liegen, obwohl
+ // sie nodemaessig ausserhalb liegt. Deshalb muss bei Fussnoten
+ // ueberprueft werden, ob auch der SectionFrm in der Fussnote
+ // und nicht ausserhalb liegt.
+ if( !pRet->IsInFtn() || pSct->IsInFtn() )
+ {
+ ASSERT( pSct && pSct->GetSection(), "Where's my section?" );
+ SwSectionNode* pNd = pSct->GetSection()->GetFmt()->GetSectionNode();
+ ASSERT( pNd, "Lost SectionNode" );
+ // Wenn der erhaltene Frame in einem Bereichsframe steht,
+ // dessen Bereich den Ausgangsnode nicht umfasst, so kehren
+ // wir mit dem SectionFrm zurueck, sonst mit dem Cntnt/TabFrm
+ if( bMaster )
+ {
+ if( pNd->GetIndex() >= nIndex )
+ pRet = pSct;
+ }
+ else if( pNd->EndOfSectionIndex() < nIndex )
+ pRet = pSct;
+ }
+ }
+ return pRet;
+ }
+ pRet = pIter->Next();
+ }
+ return NULL;
+}
+
+void SwNode2LayImpl::SaveUpperFrms()
+{
+ pUpperFrms = new SvPtrarr( 0, 20 );
+ SwFrm* pFrm;
+ while( 0 != (pFrm = NextFrm()) )
+ {
+ SwFrm* pPrv = pFrm->GetPrev();
+ pFrm = pFrm->GetUpper();
+ if( pFrm )
+ {
+ if( pFrm->IsFtnFrm() )
+ ((SwFtnFrm*)pFrm)->ColLock();
+ else if( pFrm->IsInSct() )
+ pFrm->FindSctFrm()->ColLock();
+ if( pPrv && pPrv->IsSctFrm() )
+ ((SwSectionFrm*)pPrv)->LockJoin();
+ pUpperFrms->Insert( (void*)pPrv, pUpperFrms->Count() );
+ pUpperFrms->Insert( (void*)pFrm, pUpperFrms->Count() );
+ }
+ }
+ delete pIter;
+ pIter = NULL;
+ pMod = 0;
+}
+
+SwLayoutFrm* SwNode2LayImpl::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode )
+{
+ rpFrm = NextFrm();
+ if( !rpFrm )
+ return NULL;
+ SwLayoutFrm* pUpper = rpFrm->GetUpper();
+ if( rpFrm->IsSctFrm() )
+ {
+ const SwNode* pNode = rNode.StartOfSectionNode();
+ if( pNode->IsSectionNode() )
+ {
+ SwFrm* pFrm = bMaster ? rpFrm->FindPrev() : rpFrm->FindNext();
+ if( pFrm && pFrm->IsSctFrm() )
+ {
+ // #137684#: pFrm could be a "dummy"-section
+ if( ((SwSectionFrm*)pFrm)->GetSection() &&
+ (&((SwSectionNode*)pNode)->GetSection() ==
+ ((SwSectionFrm*)pFrm)->GetSection()) )
+ {
+ // OD 2004-06-02 #i22922# - consider columned sections
+ // 'Go down' the section frame as long as the layout frame
+ // is found, which would contain content.
+ while ( pFrm->IsLayoutFrm() &&
+ static_cast<SwLayoutFrm*>(pFrm)->Lower() &&
+ !static_cast<SwLayoutFrm*>(pFrm)->Lower()->IsFlowFrm() &&
+ static_cast<SwLayoutFrm*>(pFrm)->Lower()->IsLayoutFrm() )
+ {
+ pFrm = static_cast<SwLayoutFrm*>(pFrm)->Lower();
+ }
+ ASSERT( pFrm->IsLayoutFrm(),
+ "<SwNode2LayImpl::UpperFrm(..)> - expected upper frame isn't a layout frame." );
+ rpFrm = bMaster ? NULL
+ : static_cast<SwLayoutFrm*>(pFrm)->Lower();
+ ASSERT( !rpFrm || rpFrm->IsFlowFrm(),
+ "<SwNode2LayImpl::UpperFrm(..)> - expected sibling isn't a flow frame." );
+ return static_cast<SwLayoutFrm*>(pFrm);
+ }
+
+ pUpper = new SwSectionFrm(((SwSectionNode*)pNode)->GetSection(), rpFrm);
+ pUpper->Paste( rpFrm->GetUpper(),
+ bMaster ? rpFrm : rpFrm->GetNext() );
+ static_cast<SwSectionFrm*>(pUpper)->Init();
+ rpFrm = NULL;
+ // 'Go down' the section frame as long as the layout frame
+ // is found, which would contain content.
+ while ( pUpper->Lower() &&
+ !pUpper->Lower()->IsFlowFrm() &&
+ pUpper->Lower()->IsLayoutFrm() )
+ {
+ pUpper = static_cast<SwLayoutFrm*>(pUpper->Lower());
+ }
+ return pUpper;
+ }
+ }
+ };
+ if( !bMaster )
+ rpFrm = rpFrm->GetNext();
+ return pUpper;
+}
+
+void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd )
+{
+ ASSERT( pUpperFrms, "RestoreUpper without SaveUpper?" )
+ SwNode* pNd;
+ SwDoc *pDoc = rNds.GetDoc();
+ sal_Bool bFirst = sal_True;
+ for( ; nStt < nEnd; ++nStt )
+ {
+ SwFrm* pNew = 0;
+ SwFrm* pNxt;
+ SwLayoutFrm* pUp;
+ if( (pNd = rNds[nStt])->IsCntntNode() )
+ for( sal_uInt16 n = 0; n < pUpperFrms->Count(); )
+ {
+ pNxt = (SwFrm*)(*pUpperFrms)[n++];
+ if( bFirst && pNxt && pNxt->IsSctFrm() )
+ ((SwSectionFrm*)pNxt)->UnlockJoin();
+ pUp = (SwLayoutFrm*)(*pUpperFrms)[n++];
+ if( pNxt )
+ pNxt = pNxt->GetNext();
+ else
+ pNxt = pUp->Lower();
+ pNew = ((SwCntntNode*)pNd)->MakeFrm( pUp );
+ pNew->Paste( pUp, pNxt );
+ (*pUpperFrms)[n-2] = pNew;
+ }
+ else if( pNd->IsTableNode() )
+ for( sal_uInt16 x = 0; x < pUpperFrms->Count(); )
+ {
+ pNxt = (SwFrm*)(*pUpperFrms)[x++];
+ if( bFirst && pNxt && pNxt->IsSctFrm() )
+ ((SwSectionFrm*)pNxt)->UnlockJoin();
+ pUp = (SwLayoutFrm*)(*pUpperFrms)[x++];
+ if( pNxt )
+ pNxt = pNxt->GetNext();
+ else
+ pNxt = pUp->Lower();
+ pNew = ((SwTableNode*)pNd)->MakeFrm( pUp );
+ ASSERT( pNew->IsTabFrm(), "Table exspected" );
+ pNew->Paste( pUp, pNxt );
+ ((SwTabFrm*)pNew)->RegistFlys();
+ (*pUpperFrms)[x-2] = pNew;
+ }
+ else if( pNd->IsSectionNode() )
+ {
+ nStt = pNd->EndOfSectionIndex();
+ for( sal_uInt16 x = 0; x < pUpperFrms->Count(); )
+ {
+ pNxt = (SwFrm*)(*pUpperFrms)[x++];
+ if( bFirst && pNxt && pNxt->IsSctFrm() )
+ ((SwSectionFrm*)pNxt)->UnlockJoin();
+ pUp = (SwLayoutFrm*)(*pUpperFrms)[x++];
+ ASSERT( pUp->GetUpper() || pUp->IsFlyFrm(), "Lost Upper" );
+ ::_InsertCnt( pUp, pDoc, pNd->GetIndex(), sal_False, nStt+1, pNxt );
+ pNxt = pUp->GetLastLower();
+ (*pUpperFrms)[x-2] = pNxt;
+ }
+ }
+ bFirst = sal_False;
+ }
+ for( sal_uInt16 x = 0; x < pUpperFrms->Count(); ++x )
+ {
+ SwFrm* pTmp = (SwFrm*)(*pUpperFrms)[++x];
+ if( pTmp->IsFtnFrm() )
+ ((SwFtnFrm*)pTmp)->ColUnlock();
+ else if ( pTmp->IsInSct() )
+ {
+ SwSectionFrm* pSctFrm = pTmp->FindSctFrm();
+ pSctFrm->ColUnlock();
+ // OD 26.08.2003 #i18103# - invalidate size of section in order to
+ // assure, that the section is formatted, unless it was 'Collocked'
+ // from its 'collection' until its 'restoration'.
+ pSctFrm->_InvalidateSize();
+ }
+ }
+}
+
+SwFrm* SwNode2LayImpl::GetFrm( const Point* pDocPos,
+ const SwPosition *pPos,
+ const sal_Bool bCalcFrm ) const
+{
+ // mba: test if change of member pIter -> pMod broke anything
+ return pMod ? ::GetFrmOfModify( 0, *pMod, USHRT_MAX, pDocPos, pPos, bCalcFrm ) : 0;
+}
+
+SwNode2Layout::SwNode2Layout( const SwNode& rNd, sal_uLong nIdx )
+{
+ pImpl = new SwNode2LayImpl( rNd, nIdx, sal_False );
+}
+
+SwNode2Layout::SwNode2Layout( const SwNode& rNd )
+{
+ pImpl = new SwNode2LayImpl( rNd, rNd.GetIndex(), sal_True );
+ pImpl->SaveUpperFrms();
+}
+
+void SwNode2Layout::RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd )
+{
+ ASSERT( pImpl, "RestoreUpperFrms without SaveUpperFrms" );
+ pImpl->RestoreUpperFrms( rNds, nStt, nEnd );
+}
+
+SwFrm* SwNode2Layout::NextFrm()
+{
+ return pImpl->NextFrm();
+}
+
+SwLayoutFrm* SwNode2Layout::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode )
+{
+ return pImpl->UpperFrm( rpFrm, rNode );
+}
+
+SwNode2Layout::~SwNode2Layout()
+{
+ delete pImpl;
+}
+
+SwFrm* SwNode2Layout::GetFrm( const Point* pDocPos,
+ const SwPosition *pPos,
+ const sal_Bool bCalcFrm ) const
+{
+ return pImpl->GetFrm( pDocPos, pPos, bCalcFrm );
+}
+
+
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
new file mode 100644
index 000000000000..cce5bcb586f1
--- /dev/null
+++ b/sw/source/core/docnode/nodes.cxx
@@ -0,0 +1,2627 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <stdlib.h>
+
+#include <node.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pam.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <hints.hxx>
+#include <numrule.hxx>
+#include <ndtxt.hxx>
+#include <ndnotxt.hxx>
+#include <swtable.hxx> // fuer erzuegen / loeschen der Table-Frames
+#include <tblsel.hxx>
+#include <section.hxx>
+#include <ddefld.hxx>
+#include <swddetbl.hxx>
+#include <frame.hxx>
+#include <txtatr.hxx>
+#include <tox.hxx> // InvalidateTOXMark
+
+#include <docsh.hxx>
+#include <svl/smplhint.hxx>
+
+extern sal_Bool CheckNodesRange( const SwNodeIndex& rStt,
+ const SwNodeIndex& rEnd, sal_Bool bChkSection );
+
+SV_DECL_PTRARR(SwSttNdPtrs,SwStartNode*,2,2)
+
+
+//#define JP_DEBUG
+#ifdef JP_DEBUG
+#include "shellio.hxx"
+#endif
+
+
+// Funktion zum bestimmen des hoechsten Levels innerhalb des Bereiches
+
+sal_uInt16 HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange );
+
+//-----------------------------------------------------------------------
+
+/*******************************************************************
+|* SwNodes::SwNodes
+|*
+|* Beschreibung
+|* Konstruktor; legt die vier Grundsektions (PostIts,
+|* Inserts, Icons, Inhalt) an
+*******************************************************************/
+SwNodes::SwNodes( SwDoc* pDocument )
+ : pRoot( 0 ), pMyDoc( pDocument )
+{
+ bInNodesDel = bInDelUpdOutl = bInDelUpdNum = sal_False;
+
+ ASSERT( pMyDoc, "in welchem Doc stehe ich denn?" );
+
+ sal_uLong nPos = 0;
+ SwStartNode* pSttNd = new SwStartNode( *this, nPos++ );
+ pEndOfPostIts = new SwEndNode( *this, nPos++, *pSttNd );
+
+ SwStartNode* pTmp = new SwStartNode( *this, nPos++ );
+ pEndOfInserts = new SwEndNode( *this, nPos++, *pTmp );
+
+ pTmp = new SwStartNode( *this, nPos++ );
+ pTmp->pStartOfSection = pSttNd;
+ pEndOfAutotext = new SwEndNode( *this, nPos++, *pTmp );
+
+ pTmp = new SwStartNode( *this, nPos++ );
+ pTmp->pStartOfSection = pSttNd;
+ pEndOfRedlines = new SwEndNode( *this, nPos++, *pTmp );
+
+ pTmp = new SwStartNode( *this, nPos++ );
+ pTmp->pStartOfSection = pSttNd;
+ pEndOfContent = new SwEndNode( *this, nPos++, *pTmp );
+
+ pOutlineNds = new SwOutlineNodes;
+}
+
+/*******************************************************************
+|*
+|* SwNodes::~SwNodes
+|*
+|* Beschreibung
+|* dtor, loescht alle Nodes, deren Pointer in diesem dynamischen
+|* Array sind. Ist kein Problem, da Nodes ausserhalb dieses
+|* Arrays nicht erzeugt werden koennen und somit auch nicht
+|* in mehreren drin sein koennen
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+
+SwNodes::~SwNodes()
+{
+ delete pOutlineNds;
+
+ {
+ SwNode *pNode;
+ SwNodeIndex aNdIdx( *this );
+ while( sal_True )
+ {
+ pNode = &aNdIdx.GetNode();
+ if( pNode == pEndOfContent )
+ break;
+
+ aNdIdx++;
+ delete pNode;
+ }
+ }
+
+ // jetzt muessen alle SwNodeIndizies abgemeldet sein!!!
+ delete pEndOfContent;
+}
+
+void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
+ SwNodeIndex& rInsPos, sal_Bool bNewFrms )
+{
+ // im UndoBereich brauchen wir keine Frames
+ SwNodes& rNds = rInsPos.GetNodes();
+ const SwNode* pPrevInsNd = rNds[ rInsPos.GetIndex() -1 ];
+
+ //JP 03.02.99: alle Felder als invalide erklaeren, aktu. erfolgt im
+ // Idle-Handler des Docs
+ if( GetDoc()->SetFieldsDirty( sal_True, &rDelPos.GetNode(), nSz ) &&
+ rNds.GetDoc() != GetDoc() )
+ rNds.GetDoc()->SetFieldsDirty( true, NULL, 0 );
+
+ //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen
+ sal_uLong nNd = rInsPos.GetIndex();
+ sal_Bool bInsOutlineIdx = !(
+ rNds.GetEndOfRedlines().StartOfSectionNode()->GetIndex() < nNd &&
+ nNd < rNds.GetEndOfRedlines().GetIndex() );
+
+ if( &rNds == this ) // im gleichen Nodes-Array -> moven !!
+ {
+ // wird von vorne nach hinten gemovt, so wird nach vorne immer
+ // nachgeschoben, d.H. die Loeschposition ist immer gleich
+ sal_uInt16 nDiff = rDelPos.GetIndex() < rInsPos.GetIndex() ? 0 : 1;
+
+ for( sal_uLong n = rDelPos.GetIndex(); nSz; n += nDiff, --nSz )
+ {
+ SwNodeIndex aDelIdx( *this, n );
+ SwNode& rNd = aDelIdx.GetNode();
+
+ // --> OD 2005-11-16 #i57920#
+ // correction of refactoring done by cws swnumtree:
+ // - <SwTxtNode::SetLevel( NO_NUMBERING ) is deprecated and
+ // set <IsCounted> state of the text node to <false>, which
+ // isn't correct here.
+ if ( rNd.IsTxtNode() )
+ {
+ SwTxtNode* pTxtNode = rNd.GetTxtNode();
+ // --> OD 2008-03-13 #refactorlists#
+// pTxtNode->UnregisterNumber();
+ pTxtNode->RemoveFromList();
+ // <--
+
+ //if ( pTxtNode->GetTxtColl()->GetOutlineLevel() != NO_NUMBERING )//#outline level,zhaojianwei
+ if ( pTxtNode->GetAttrOutlineLevel() != 0 )//<-end,zhaojianwei
+ {
+ const SwNodePtr pSrch = (SwNodePtr)&rNd;
+ pOutlineNds->Remove( pSrch );
+ }
+ }
+ // <--
+
+ BigPtrArray::Move( aDelIdx.GetIndex(), rInsPos.GetIndex() );
+
+ if( rNd.IsTxtNode() )
+ {
+ SwTxtNode& rTxtNd = (SwTxtNode&)rNd;
+ // --> OD 2008-03-13 #refactorlists#
+// rTxtNd.SyncNumberAndNumRule();
+ rTxtNd.AddToList();
+ // <--
+
+ if( bInsOutlineIdx &&
+ //NO_NUMBERING != rTxtNd.GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei
+ 0 != rTxtNd.GetAttrOutlineLevel() )//<-end,zhaojianwei
+ {
+ const SwNodePtr pSrch = (SwNodePtr)&rNd;
+ pOutlineNds->Insert( pSrch );
+ }
+ rTxtNd.InvalidateNumRule();
+
+//FEATURE::CONDCOLL
+ if( RES_CONDTXTFMTCOLL == rTxtNd.GetTxtColl()->Which() )
+ rTxtNd.ChkCondColl();
+//FEATURE::CONDCOLL
+ }
+ else if( rNd.IsCntntNode() )
+ ((SwCntntNode&)rNd).InvalidateNumRule();
+ }
+ }
+ else
+ {
+ bool bSavePersData(GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds));
+ bool bRestPersData(GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this));
+ SwDoc* pDestDoc = rNds.GetDoc() != GetDoc() ? rNds.GetDoc() : 0;
+ OSL_ENSURE(!pDestDoc, "SwNodes::ChgNode(): "
+ "the code to handle text fields here looks broken\n"
+ "if the target is in a different document.");
+ if( !bRestPersData && !bSavePersData && pDestDoc )
+ bSavePersData = bRestPersData = sal_True;
+
+ String sNumRule;
+ SwNodeIndex aInsPos( rInsPos );
+ for( sal_uLong n = 0; n < nSz; n++ )
+ {
+ SwNode* pNd = &rDelPos.GetNode();
+
+ // NoTextNode muessen ihre Persitenten Daten mitnehmen
+ if( pNd->IsNoTxtNode() )
+ {
+ if( bSavePersData )
+ ((SwNoTxtNode*)pNd)->SavePersistentData();
+ }
+ else if( pNd->IsTxtNode() )
+ {
+ SwTxtNode* pTxtNd = (SwTxtNode*)pNd;
+
+ // loesche die Gliederungs-Indizies aus dem alten Nodes-Array
+ //if( NO_NUMBERING != pTxtNd->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei
+ if( 0 != pTxtNd->GetAttrOutlineLevel() )//<-end,zhaojianwei
+ pOutlineNds->Remove( pNd );
+
+ // muss die Rule kopiere werden?
+ if( pDestDoc )
+ {
+ const SwNumRule* pNumRule = pTxtNd->GetNumRule();
+ if( pNumRule && sNumRule != pNumRule->GetName() )
+ {
+ sNumRule = pNumRule->GetName();
+ SwNumRule* pDestRule = pDestDoc->FindNumRulePtr( sNumRule );
+ if( pDestRule )
+ pDestRule->SetInvalidRule( sal_True );
+ else
+ pDestDoc->MakeNumRule( sNumRule, pNumRule );
+ }
+ }
+ else
+ // wenns ins UndoNodes-Array gemoved wird, sollten die
+ // Numerierungen auch aktualisiert werden.
+ pTxtNd->InvalidateNumRule();
+
+ // --> OD 2008-03-13 #refactorlists#
+// pTxtNd->UnregisterNumber();
+ pTxtNd->RemoveFromList();
+ // <--
+ }
+
+ RemoveNode( rDelPos.GetIndex(), 1, sal_False ); // Indizies verschieben !!
+ SwCntntNode * pCNd = pNd->GetCntntNode();
+ rNds.InsertNode( pNd, aInsPos );
+
+ if( pCNd )
+ {
+ SwTxtNode* pTxtNd = pCNd->GetTxtNode();
+ if( pTxtNd )
+ {
+ SwpHints * const pHts = pTxtNd->GetpSwpHints();
+ // setze die OultineNodes im neuen Nodes-Array
+ //if( bInsOutlineIdx && NO_NUMBERING != //#outline level,removed by zhaojianwei
+ // pTxtNd->GetTxtColl()->GetOutlineLevel() )
+ if( bInsOutlineIdx &&
+ 0 != pTxtNd->GetAttrOutlineLevel() ) //#outline level,added by zhaojianwei
+ {
+ rNds.pOutlineNds->Insert( pTxtNd );
+ }
+
+ // --> OD 2008-03-13 #refactorlists#
+// pTxtNd->SyncNumberAndNumRule();
+ pTxtNd->AddToList();
+ // <--
+
+ // Sonderbehandlung fuer die Felder!
+ if( pHts && pHts->Count() )
+ {
+ // this looks fishy if pDestDoc != 0
+ bool const bToUndo = !pDestDoc &&
+ GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds);
+ for( sal_uInt16 i = pHts->Count(); i; )
+ {
+ sal_uInt16 nDelMsg = 0;
+ SwTxtAttr * const pAttr = pHts->GetTextHint( --i );
+ switch ( pAttr->Which() )
+ {
+ case RES_TXTATR_FIELD:
+ {
+ SwTxtFld* pTxtFld =
+ static_cast<SwTxtFld*>(pAttr);
+ rNds.GetDoc()->InsDelFldInFldLst( !bToUndo, *pTxtFld );
+
+ const SwFieldType* pTyp = pTxtFld->GetFld().GetFld()->GetTyp();
+ if ( RES_POSTITFLD == pTyp->Which() )
+ {
+ rNds.GetDoc()->GetDocShell()->Broadcast( SwFmtFldHint( &pTxtFld->GetFld(), pTxtFld->GetFld().IsFldInDoc() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) );
+ }
+ else
+ if( RES_DDEFLD == pTyp->Which() )
+ {
+ if( bToUndo )
+ ((SwDDEFieldType*)pTyp)->DecRefCnt();
+ else
+ ((SwDDEFieldType*)pTyp)->IncRefCnt();
+ }
+ nDelMsg = RES_FIELD_DELETED;
+ }
+ break;
+ case RES_TXTATR_FTN:
+ nDelMsg = RES_FOOTNOTE_DELETED;
+ break;
+
+ case RES_TXTATR_TOXMARK:
+ static_cast<SwTOXMark&>(pAttr->GetAttr())
+ .InvalidateTOXMark();
+ break;
+
+ case RES_TXTATR_REFMARK:
+ nDelMsg = RES_REFMARK_DELETED;
+ break;
+
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ {
+ SwTxtMeta *const pTxtMeta(
+ static_cast<SwTxtMeta*>(pAttr));
+ // force removal of UNO object
+ pTxtMeta->ChgTxtNode(0);
+ pTxtMeta->ChgTxtNode(pTxtNd);
+ }
+ break;
+
+ default:
+ break;
+ }
+ if( nDelMsg && bToUndo )
+ {
+ SwPtrMsgPoolItem aMsgHint( nDelMsg,
+ (void*)&pAttr->GetAttr() );
+ rNds.GetDoc()->GetUnoCallBack()->
+ ModifyNotification( &aMsgHint, &aMsgHint );
+ }
+ }
+ }
+//FEATURE::CONDCOLL
+ if( RES_CONDTXTFMTCOLL == pTxtNd->GetTxtColl()->Which() )
+ pTxtNd->ChkCondColl();
+//FEATURE::CONDCOLL
+ }
+ else
+ {
+ // in unterschiedliche Docs gemoved ?
+ // dann die Daten wieder persistent machen
+ if( pCNd->IsNoTxtNode() && bRestPersData )
+ ((SwNoTxtNode*)pCNd)->RestorePersistentData();
+ }
+ }
+ }
+ }
+
+ //JP 03.02.99: alle Felder als invalide erklaeren, aktu. erfolgt im
+ // Idle-Handler des Docs
+ GetDoc()->SetFieldsDirty( true, NULL, 0 );
+ if( rNds.GetDoc() != GetDoc() )
+ rNds.GetDoc()->SetFieldsDirty( true, NULL, 0 );
+
+
+ if( bNewFrms )
+ bNewFrms = &GetDoc()->GetNodes() == (const SwNodes*)&rNds &&
+ GetDoc()->GetCurrentViewShell(); //swmod 071108//swmod 071225
+ if( bNewFrms )
+ {
+ // Frames besorgen:
+ SwNodeIndex aIdx( *pPrevInsNd, 1 );
+ SwNodeIndex aFrmNdIdx( aIdx );
+ SwNode* pFrmNd = rNds.FindPrvNxtFrmNode( aFrmNdIdx,
+ rNds[ rInsPos.GetIndex() - 1 ] );
+
+ if( !pFrmNd && aFrmNdIdx > rNds.GetEndOfExtras().GetIndex() )
+ {
+ ASSERT( !this, "ob das so richtig ist ??" );
+ aFrmNdIdx = rNds.GetEndOfContent();
+ pFrmNd = rNds.GoPrevSection( &aFrmNdIdx, sal_True, sal_False );
+ if( pFrmNd && !((SwCntntNode*)pFrmNd)->GetDepends() )
+ pFrmNd = 0;
+
+#ifdef DBG_UTIL
+ if( !pFrmNd )
+ ASSERT( !this, "ChgNode() - kein FrameNode gefunden" );
+#endif
+ }
+ if( pFrmNd )
+ while( aIdx != rInsPos )
+ {
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( pCNd )
+ {
+ if( pFrmNd->IsTableNode() )
+ ((SwTableNode*)pFrmNd)->MakeFrms( aIdx );
+ else if( pFrmNd->IsSectionNode() )
+ ((SwSectionNode*)pFrmNd)->MakeFrms( aIdx );
+ else
+ ((SwCntntNode*)pFrmNd)->MakeFrms( *pCNd );
+ pFrmNd = pCNd;
+ }
+ aIdx++;
+ }
+ }
+}
+
+
+/***********************************************************************
+|*
+|* SwNodes::Move
+|*
+|* Beschreibung
+|* Move loescht die Node-Pointer ab und einschliesslich der Startposition
+|* bis zu und ausschliesslich der Endposition und fuegt sie an
+|* der vor der Zielposition ein.
+|* Wenn das Ziel vor dem ersten oder dem letzten zu bewegenden Element oder
+|* dazwischen liegt, geschieht nichts.
+|* Wenn der zu bewegende Bereich leer ist oder das Ende vor
+|* dem Anfang liegt, geschieht nichts.
+|*
+|* Allg.: aRange beschreibt den Bereich -exklusive- aEnd !!
+|* ( 1.Node: aStart, letzer Node: aEnd-1 !! )
+|*
+|*
+|*
+***********************************************************************/
+
+sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
+ const SwNodeIndex& aIndex, sal_Bool bNewFrms )
+{
+ SwNode * pAktNode;
+ if( aIndex == 0 ||
+ ( (pAktNode = &aIndex.GetNode())->GetStartNode() &&
+ !pAktNode->StartOfSectionIndex() ))
+ return sal_False;
+
+ SwNodeRange aRg( aRange );
+
+ // "einfache" StartNodes oder EndNodes ueberspringen
+ while( ND_STARTNODE == (pAktNode = &aRg.aStart.GetNode())->GetNodeType()
+ || ( pAktNode->IsEndNode() &&
+ !pAktNode->pStartOfSection->IsSectionNode() ) )
+ aRg.aStart++;
+ aRg.aStart--;
+
+ // falls aEnd-1 auf keinem ContentNode steht, dann suche den vorherigen
+ aRg.aEnd--;
+ while( ( (( pAktNode = &aRg.aEnd.GetNode())->GetStartNode() &&
+ !pAktNode->IsSectionNode() ) ||
+ ( pAktNode->IsEndNode() &&
+ ND_STARTNODE == pAktNode->pStartOfSection->GetNodeType()) ) &&
+ aRg.aEnd > aRg.aStart )
+ aRg.aEnd--;
+
+
+ // wird im selben Array's verschoben, dann ueberpruefe die Einfuegepos.
+ if( aRg.aStart >= aRg.aEnd )
+ return sal_False;
+
+ if( this == &rNodes )
+ {
+ if( ( aIndex.GetIndex()-1 >= aRg.aStart.GetIndex() &&
+ aIndex.GetIndex()-1 < aRg.aEnd.GetIndex()) ||
+ ( aIndex.GetIndex()-1 == aRg.aEnd.GetIndex() ) )
+ return sal_False;
+ }
+
+ sal_uInt16 nLevel = 0; // Level-Counter
+ sal_uLong nInsPos = 0; // Cnt fuer das TmpArray
+
+ // das Array bildet einen Stack, es werden alle StartOfSelction's gesichert
+ SwSttNdPtrs aSttNdStack( 1, 5 );
+
+ // setze den Start-Index
+ SwNodeIndex aIdx( aIndex );
+/*
+ --- JP 17.11.94: sollte ueberholt sein, wird im ChgNode schon erledigt!
+ sal_Bool bCorrNum = pSect && pSect->aStart.GetIndex() == aIdx.GetIndex();
+*/
+
+ SwStartNode* pStartNode = aIdx.GetNode().pStartOfSection;
+ aSttNdStack.C40_INSERT( SwStartNode, pStartNode, 0 );
+// aSttNdStack.Insert( rNodes[ aIdx ]->pStartOfSection, 0 );
+ SwNodeRange aOrigInsPos( aIdx, -1, aIdx ); // Originale Insert Pos
+
+ //JP 16.01.98: SectionNodes: DelFrms/MakeFrms beim obersten SectionNode!
+ sal_uInt16 nSectNdCnt = 0;
+ sal_Bool bSaveNewFrms = bNewFrms;
+
+ // bis alles verschoben ist
+ while( aRg.aStart < aRg.aEnd )
+ switch( (pAktNode = &aRg.aEnd.GetNode())->GetNodeType() )
+ {
+ case ND_ENDNODE:
+ {
+ if( nInsPos ) // verschieb schon mal alle bis hier her
+ {
+ // loeschen und kopieren. ACHTUNG: die Indizies ab
+ // "aRg.aEnd+1" werden mit verschoben !!
+ SwNodeIndex aSwIndex( aRg.aEnd, 1 );
+ ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
+ aIdx -= nInsPos;
+ nInsPos = 0;
+ }
+
+ SwStartNode* pSttNd = pAktNode->pStartOfSection;
+ if( pSttNd->IsTableNode() )
+ {
+ SwTableNode* pTblNd = (SwTableNode*)pSttNd;
+
+ // dann bewege die gesamte Tabelle/den Bereich !!
+ nInsPos = (aRg.aEnd.GetIndex() -
+ pSttNd->GetIndex() )+1;
+ aRg.aEnd -= nInsPos;
+
+ //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen
+ sal_uLong nNd = aIdx.GetIndex();
+ sal_Bool bInsOutlineIdx = !( rNodes.GetEndOfRedlines().
+ StartOfSectionNode()->GetIndex() < nNd &&
+ nNd < rNodes.GetEndOfRedlines().GetIndex() );
+
+ if( bNewFrms )
+ // loesche erstmal die Frames
+ pTblNd->DelFrms();
+ if( &rNodes == this ) // in sich selbst moven ??
+ {
+ // dann bewege alle Start/End/ContentNodes. Loesche
+ // bei den ContentNodes auch die Frames !!
+ pTblNd->pStartOfSection = aIdx.GetNode().pStartOfSection;
+ for( sal_uLong n = 0; n < nInsPos; ++n )
+ {
+ SwNodeIndex aMvIdx( aRg.aEnd, 1 );
+ SwCntntNode* pCNd = 0;
+ SwNode* pTmpNd = &aMvIdx.GetNode();
+ if( pTmpNd->IsCntntNode() )
+ {
+ pCNd = (SwCntntNode*)pTmpNd;
+ if( pTmpNd->IsTxtNode() )
+ ((SwTxtNode*)pTmpNd)->RemoveFromList();
+
+// if( bNewFrms )
+// pCNd->DelFrms();
+
+ // setze bei Start/EndNodes die richtigen Indizies
+ // loesche die Gliederungs-Indizies aus
+ // dem alten Nodes-Array
+ //if( pCNd->IsTxtNode() && NO_NUMBERING != //#outline level,zhaojianwei
+ // ((SwTxtNode*)pCNd)->GetTxtColl()->GetOutlineLevel() )
+ if( pCNd->IsTxtNode() && 0 !=
+ ((SwTxtNode*)pCNd)->GetAttrOutlineLevel() )//<-end,by zhaojianwei
+ pOutlineNds->Remove( pCNd );
+ else
+ pCNd = 0;
+ }
+// else if( bNewFrms && pTmpNd->IsSectionNode() )
+// ((SwSectionNode*)pTmpNd)->DelFrms();
+ BigPtrArray::Move( aMvIdx.GetIndex(), aIdx.GetIndex() );
+
+ if( bInsOutlineIdx && pCNd )
+ pOutlineNds->Insert( pCNd );
+ if( pTmpNd->IsTxtNode() )
+ ((SwTxtNode*)pTmpNd)->AddToList();
+ }
+ }
+ else
+ {
+ // StartNode holen
+ // Even aIdx points to a startnode, we need the startnode
+ // of the environment of aIdx (#i80941)
+ SwStartNode* pSttNode = aIdx.GetNode().pStartOfSection;
+
+ // Hole alle Boxen mit Inhalt. Deren Indizies auf die
+ // StartNodes muessen umgemeldet werden !!
+ // (Array kopieren und alle gefunden wieder loeschen;
+ // erleichtert das suchen!!)
+ SwNodeIndex aMvIdx( aRg.aEnd, 1 );
+ for( sal_uLong n = 0; n < nInsPos; ++n )
+ {
+ SwNode* pNd = &aMvIdx.GetNode();
+/* if( bNewFrms )
+ {
+ if( pNd->IsCntntNode() )
+ ((SwCntntNode*)pNd)->DelFrms();
+ else if( pNd->IsSectionNode() )
+ ((SwSectionNode*)pNd)->DelFrms();
+ }
+*/
+ //sal_Bool bOutlNd = pNd->IsTxtNode() && NO_NUMBERING !=//#outline level,zhaojianwei
+ // ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel();
+ const bool bOutlNd = pNd->IsTxtNode() &&
+ 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel();//<-end,zhaojianwei
+ // loesche die Gliederungs-Indizies aus
+ // dem alten Nodes-Array
+ if( bOutlNd )
+ pOutlineNds->Remove( pNd );
+
+ RemoveNode( aMvIdx.GetIndex(), 1, sal_False );
+ pNd->pStartOfSection = pSttNode;
+ rNodes.InsertNode( pNd, aIdx );
+
+ // setze bei Start/EndNodes die richtigen Indizies
+ if( bInsOutlineIdx && bOutlNd )
+ // und setze sie im neuen Nodes-Array
+ rNodes.pOutlineNds->Insert( pNd );
+ else if( pNd->IsStartNode() )
+ pSttNode = (SwStartNode*)pNd;
+ else if( pNd->IsEndNode() )
+ {
+ pSttNode->pEndOfSection = (SwEndNode*)pNd;
+ if( pSttNode->IsSectionNode() )
+ ((SwSectionNode*)pSttNode)->NodesArrChgd();
+ pSttNode = pSttNode->pStartOfSection;
+ }
+ }
+
+ if( pTblNd->GetTable().IsA( TYPE( SwDDETable ) ))
+ {
+ SwDDEFieldType* pTyp = ((SwDDETable&)pTblNd->
+ GetTable()).GetDDEFldType();
+ if( pTyp )
+ {
+ if( rNodes.IsDocNodes() )
+ pTyp->IncRefCnt();
+ else
+ pTyp->DecRefCnt();
+ }
+ }
+
+ if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(
+ rNodes))
+ {
+ SwFrmFmt* pTblFmt = pTblNd->GetTable().GetFrmFmt();
+ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT,
+ pTblFmt );
+ pTblFmt->ModifyNotification( &aMsgHint, &aMsgHint );
+ }
+ }
+ if( bNewFrms )
+ {
+ SwNodeIndex aTmp( aIdx );
+ pTblNd->MakeFrms( &aTmp );
+ }
+ aIdx -= nInsPos;
+ nInsPos = 0;
+ }
+ else if( pSttNd->GetIndex() < aRg.aStart.GetIndex() )
+ {
+ // SectionNode: es wird nicht die gesamte Section
+ // verschoben, also bewege nur die
+ // ContentNodes
+ // StartNode: erzeuge an der Postion eine neue Section
+ do { // middle check loop
+ if( !pSttNd->IsSectionNode() )
+ {
+ // Start und EndNode an der InsertPos erzeugen
+ SwStartNode* pTmp = new SwStartNode( aIdx,
+ ND_STARTNODE,
+/*?? welcher NodeTyp ??*/
+ SwNormalStartNode );
+
+ nLevel++; // den Index auf StartNode auf den Stack
+ aSttNdStack.C40_INSERT( SwStartNode, pTmp, nLevel );
+
+ // noch den EndNode erzeugen
+ new SwEndNode( aIdx, *pTmp );
+ }
+ else if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(
+ rNodes))
+ {
+ // im UndoNodes-Array spendieren wir einen
+ // Platzhalter
+ new SwNode( aIdx, ND_SECTIONDUMMY );
+ }
+ else
+ {
+ // JP 18.5.2001: neue Section anlegen?? Bug 70454
+ aRg.aEnd--;
+ break;
+
+ }
+
+ aRg.aEnd--;
+ aIdx--;
+ } while( sal_False );
+ }
+ else
+ {
+ // Start und EndNode komplett verschieben
+// s. u. SwIndex aOldStt( pSttNd->theIndex );
+//JP 21.05.97: sollte der Start genau der Start des Bereiches sein, so muss
+// der Node auf jedenfall noch besucht werden!
+ if( &aRg.aStart.GetNode() == pSttNd )
+ --aRg.aStart;
+
+ SwSectionNode* pSctNd = pSttNd->GetSectionNode();
+ if( bNewFrms && pSctNd )
+ pSctNd->DelFrms();
+
+ RemoveNode( aRg.aEnd.GetIndex(), 1, sal_False ); // EndNode loeschen
+ sal_uLong nSttPos = pSttNd->GetIndex();
+
+ // dieser StartNode wird spaeter wieder entfernt!
+ SwStartNode* pTmpSttNd = new SwStartNode( *this, nSttPos+1 );
+ pTmpSttNd->pStartOfSection = pSttNd->pStartOfSection;
+
+ RemoveNode( nSttPos, 1, sal_False ); // SttNode loeschen
+
+ pSttNd->pStartOfSection = aIdx.GetNode().pStartOfSection;
+ rNodes.InsertNode( pSttNd, aIdx );
+ rNodes.InsertNode( pAktNode, aIdx );
+ aIdx--;
+ pSttNd->pEndOfSection = (SwEndNode*)pAktNode;
+
+ aRg.aEnd--;
+
+ nLevel++; // den Index auf StartNode auf den Stack
+ aSttNdStack.C40_INSERT( SwStartNode, pSttNd, nLevel );
+
+ // SectionNode muss noch ein paar Indizies ummelden
+ if( pSctNd )
+ {
+ pSctNd->NodesArrChgd();
+ ++nSectNdCnt;
+ bNewFrms = sal_False;
+ }
+ }
+ }
+ break;
+
+
+
+ case ND_SECTIONNODE:
+ if( !nLevel &&
+ GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNodes))
+ {
+ // dann muss an der akt. InsPos ein SectionDummyNode
+ // eingefuegt werden
+ if( nInsPos ) // verschieb schon mal alle bis hier her
+ {
+ // loeschen und kopieren. ACHTUNG: die Indizies ab
+ // "aRg.aEnd+1" werden mit verschoben !!
+ SwNodeIndex aSwIndex( aRg.aEnd, 1 );
+ ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
+ aIdx -= nInsPos;
+ nInsPos = 0;
+ }
+ new SwNode( aIdx, ND_SECTIONDUMMY );
+ aRg.aEnd--;
+ aIdx--;
+ break;
+ }
+ // kein break !!
+ case ND_TABLENODE:
+ case ND_STARTNODE:
+ {
+ // Bug #78589# - empty section -> nothing to do
+ // and only if it's a top level section
+ if( !nInsPos && !nLevel )
+ {
+ aRg.aEnd--;
+ break;
+ }
+
+ if( !nLevel ) // es wird eine Stufe runter gestuft
+ {
+ // erzeuge die Runterstufung
+ SwNodeIndex aTmpSIdx( aOrigInsPos.aStart, 1 );
+ SwStartNode* pTmpStt = new SwStartNode( aTmpSIdx,
+ ND_STARTNODE,
+ ((SwStartNode*)pAktNode)->GetStartNodeType() );
+
+ aTmpSIdx--;
+
+ SwNodeIndex aTmpEIdx( aOrigInsPos.aEnd );
+ new SwEndNode( aTmpEIdx, *pTmpStt );
+ aTmpEIdx--;
+ aTmpSIdx++;
+
+ // setze die StartOfSection richtig
+ aRg.aEnd++;
+ {
+ SwNodeIndex aCntIdx( aRg.aEnd );
+ for( sal_uLong n = 0; n < nInsPos; n++, aCntIdx++)
+ aCntIdx.GetNode().pStartOfSection = pTmpStt;
+ }
+
+ // Setze auch bei allen runtergestuften den richtigen StartNode
+ while( aTmpSIdx < aTmpEIdx )
+ if( 0 != (( pAktNode = &aTmpEIdx.GetNode())->GetEndNode()) )
+ aTmpEIdx = pAktNode->StartOfSectionIndex();
+ else
+ {
+ pAktNode->pStartOfSection = pTmpStt;
+ aTmpEIdx--;
+ }
+
+ aIdx--; // hinter den eingefuegten StartNode
+ aRg.aEnd--; // vor den StartNode
+ // kopiere jetzt das Array. ACHTUNG: die Indizies ab
+ // "aRg.aEnd+1" werden mit verschoben !!
+ SwNodeIndex aSwIndex( aRg.aEnd, 1 );
+ ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
+ aIdx -= nInsPos+1;
+ nInsPos = 0;
+ }
+ else // es wurden alle Nodes innerhalb eines
+ { // Start- und End-Nodes verschoben
+ ASSERT( pAktNode == aSttNdStack[nLevel] ||
+ ( pAktNode->IsStartNode() &&
+ aSttNdStack[nLevel]->IsSectionNode()),
+ "falscher StartNode" );
+
+ SwNodeIndex aSwIndex( aRg.aEnd, 1 );
+ ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
+ aIdx -= nInsPos+1; // vor den eingefuegten StartNode
+ nInsPos = 0;
+
+ // loesche nur noch den Pointer aus dem Nodes-Array.
+// RemoveNode( aRg.aEnd.GetIndex(), 1, sal_False );
+ RemoveNode( aRg.aEnd.GetIndex(), 1, sal_True );
+ aRg.aEnd--;
+
+ SwSectionNode* pSectNd = aSttNdStack[ nLevel ]->GetSectionNode();
+ if( pSectNd && !--nSectNdCnt )
+ {
+ SwNodeIndex aTmp( *pSectNd );
+ pSectNd->MakeFrms( &aTmp );
+ bNewFrms = bSaveNewFrms;
+ }
+ aSttNdStack.Remove( nLevel ); // vom Stack loeschen
+ nLevel--;
+ }
+
+ // loesche alle entstehenden leeren Start-/End-Node-Paare
+ SwNode* pTmpNode = (*this)[ aRg.aEnd.GetIndex()+1 ]->GetEndNode();
+ if( pTmpNode && ND_STARTNODE == (pAktNode = &aRg.aEnd.GetNode())
+ ->GetNodeType() && pAktNode->StartOfSectionIndex() &&
+ pTmpNode->StartOfSectionNode() == pAktNode )
+ {
+ DelNodes( aRg.aEnd, 2 );
+ aRg.aEnd--;
+ }
+// aRg.aEnd--;
+ }
+ break;
+
+ case ND_TEXTNODE:
+ case ND_GRFNODE:
+ case ND_OLENODE:
+ {
+ if( bNewFrms && pAktNode->GetCntntNode() )
+ ((SwCntntNode*)pAktNode)->DelFrms();
+
+ pAktNode->pStartOfSection = aSttNdStack[ nLevel ];
+ nInsPos++;
+ aRg.aEnd--;
+ }
+ break;
+
+ case ND_SECTIONDUMMY:
+ if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this))
+ {
+ if( &rNodes == this ) // innerhalb vom UndoNodesArray
+ {
+ // mit verschieben
+ pAktNode->pStartOfSection = aSttNdStack[ nLevel ];
+ nInsPos++;
+ }
+ else // in ein "normales" Nodes-Array verschieben
+ {
+ // dann muss an der akt. InsPos auch ein SectionNode
+ // (Start/Ende) stehen; dann diesen ueberspringen.
+ // Andernfalls nicht weiter beachten.
+ if( nInsPos ) // verschieb schon mal alle bis hier her
+ {
+ // loeschen und kopieren. ACHTUNG: die Indizies ab
+ // "aRg.aEnd+1" werden mit verschoben !!
+ SwNodeIndex aSwIndex( aRg.aEnd, 1 );
+ ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
+ aIdx -= nInsPos;
+ nInsPos = 0;
+ }
+ SwNode* pTmpNd = &aIdx.GetNode();
+ if( pTmpNd->IsSectionNode() ||
+ pTmpNd->StartOfSectionNode()->IsSectionNode() )
+ aIdx--; // ueberspringen
+ }
+ }
+ else {
+ ASSERT( sal_False, "wie kommt diser Node ins Nodes-Array??" );
+ }
+ aRg.aEnd--;
+ break;
+
+ default:
+ ASSERT( sal_False, "was ist das fuer ein Node??" );
+ break;
+ }
+
+ if( nInsPos ) // kopiere den Rest
+ {
+ // der Rest muesste so stimmen
+ SwNodeIndex aSwIndex( aRg.aEnd, 1 );
+ ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
+ }
+ aRg.aEnd++; // wieder exklusive Ende
+
+ // loesche alle leeren Start-/End-Node-Paare
+ if( ( pAktNode = &aRg.aStart.GetNode())->GetStartNode() &&
+ pAktNode->StartOfSectionIndex() &&
+ aRg.aEnd.GetNode().GetEndNode() )
+ DelNodes( aRg.aStart, 2 );
+
+ // rufe jetzt noch das Update fuer die Gliederung/Nummerierung auf
+ aOrigInsPos.aStart++;
+ // im gleichen Nodes-Array verschoben ??,
+ // dann von oben nach unten das Update aufrufen !!
+ if( this == &rNodes &&
+ aRg.aEnd.GetIndex() >= aOrigInsPos.aStart.GetIndex() )
+ {
+ UpdtOutlineIdx( aOrigInsPos.aStart.GetNode() );
+ UpdtOutlineIdx( aRg.aEnd.GetNode() );
+ }
+ else
+ {
+ UpdtOutlineIdx( aRg.aEnd.GetNode() );
+ rNodes.UpdtOutlineIdx( aOrigInsPos.aStart.GetNode() );
+ }
+
+#ifdef JP_DEBUG
+ {
+extern Writer* GetDebugWriter(const String&);
+
+ Writer* pWriter = GetDebugWriter(aEmptyStr);
+ if( pWriter )
+ {
+ int nError;
+ SvFileStream aStrm( "c:\\$$move.db", STREAM_WRITE );
+ SwWriter aWriter( aStrm, *pMyDoc );
+ aWriter.Write( &nError, pWriter );
+ }
+ }
+#endif
+
+ return sal_True;
+}
+
+
+/*******************************************************************
+|*
+|* SwNodes::SectionDown
+|*
+|* Beschreibung
+|* SectionDown() legt ein Paar von Start- und EndSection-Node
+|* (andere Nodes koennen dazwischen liegen) an.
+|*
+|* Zustand des SRange beim Verlassen der Funktion: nStart ist der
+|* Index des ersten Node hinter dem Start Section Node, nEnd ist
+|* der Index des End Section Nodes. Beispiel: Wird Insert Section
+|* mehrmals hintereinander aufgerufen, so werden mehrere
+|* unmittelbar geschachtelte Sections (keine Content Nodes
+|* zwischen Start- bzw. End Nodes) angelegt.
+|*
+|* Allg.: aRange beschreibt den Bereich -exklusive- aEnd !!
+|* ( 1.Node: aStart, letzer Node: aEnd-1 !! )
+|*
+|* Parameter
+|* SwRange &rRange
+|* IO:
+|* IN
+|* rRange.aStart: Einfuegeposition des StartNodes
+|* rRange.aEnd: Einfuegeposition des EndNodes
+|* OUT
+|* rRange.aStart: steht hinter dem eingefuegten Startnode
+|* rRange.aEnd: steht auf dem eingefuegen Endnode
+|*
+|* Ausnahmen
+|* 1. SRange-Anfang und SRange-Ende muessen auf dem gleichen Level sein
+|* 2. duerfen nicht auf dem obersten Level sein
+|* Ist dies nicht der Fall, wird die
+|* Funktion durch Aufruf von ERR_RAISE verlassen.
+|*
+|* Debug-Funktionen
+|* die Debugging Tools geben rRange beim Eintritt und beim
+|* Verlassen der Funktion aus
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+void SwNodes::SectionDown(SwNodeRange *pRange, SwStartNodeType eSttNdTyp )
+{
+ if( pRange->aStart >= pRange->aEnd ||
+ pRange->aEnd >= Count() ||
+ !CheckNodesRange( pRange->aStart, pRange->aEnd ))
+ return;
+
+ // Ist der Anfang vom Bereich vor oder auf einem EndNode, so loesche
+ // diesen, denn sonst wuerden leere S/E-Nodes oder E/S-Nodes enstehen.
+ // Bei anderen Nodes wird eine neuer StartNode eingefuegt
+ SwNode * pAktNode = &pRange->aStart.GetNode();
+ SwNodeIndex aTmpIdx( *pAktNode->StartOfSectionNode() );
+
+ if( pAktNode->GetEndNode() )
+ DelNodes( pRange->aStart, 1 ); // verhinder leere Section
+ else
+ {
+ // fuege einen neuen StartNode ein
+ SwNode* pSttNd = new SwStartNode( pRange->aStart, ND_STARTNODE, eSttNdTyp );
+ pRange->aStart = *pSttNd;
+ aTmpIdx = pRange->aStart;
+ }
+
+ // Ist das Ende vom Bereich vor oder auf einem StartNode, so loesche
+ // diesen, denn sonst wuerden leere S/E-Nodes oder E/S-Nodes enstehen
+ // Bei anderen Nodes wird eine neuer EndNode eingefuegt
+ pRange->aEnd--;
+ if( pRange->aEnd.GetNode().GetStartNode() )
+ DelNodes( pRange->aEnd, 1 );
+ else
+ {
+ pRange->aEnd++;
+ // fuege einen neuen EndNode ein
+ new SwEndNode( pRange->aEnd, *pRange->aStart.GetNode().GetStartNode() );
+ }
+ pRange->aEnd--;
+
+ SectionUpDown( aTmpIdx, pRange->aEnd );
+}
+
+/*******************************************************************
+|*
+|* SwNodes::SectionUp
+|*
+|* Beschreibung
+|* Der von rRange umspannte Bereich wird auf die naechst hoehere
+|* Ebene gehoben. Das geschieht dadurch, dass bei
+|* rRange.aStart ein Endnode und bei rRange.aEnd ein
+|* Startnode eingefuegt wird. Die Indices fuer den Bereich
+|* innerhalb von rRange werden geupdated.
+|*
+|* Allg.: aRange beschreibt den Bereich -exklusive- aEnd !!
+|* ( 1.Node: aStart, letzer Node: aEnd-1 !! )
+|*
+|* Parameter
+|* SwRange &rRange
+|* IO:
+|* IN
+|* rRange.aStart: Anfang des hoeher zubewegenden Bereiches
+|* rRange.aEnd: der 1.Node hinter dem Bereich
+|* OUT
+|* rRange.aStart: an der ersten Position innerhalb des
+|* hochbewegten Bereiches
+|* rRange.aEnd: an der letzten Position innerhalb des
+|* hochbewegten Bereiches
+|*
+|* Debug-Funktionen
+|* die Debugging Tools geben rRange beim Eintritt und beim
+|* Verlassen der Funktion aus
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+void SwNodes::SectionUp(SwNodeRange *pRange)
+{
+ if( pRange->aStart >= pRange->aEnd ||
+ pRange->aEnd >= Count() ||
+ !CheckNodesRange( pRange->aStart, pRange->aEnd ) ||
+ !( HighestLevel( *this, *pRange ) > 1 ))
+ return;
+
+ // Ist der Anfang vom Bereich vor oder auf einem StartNode, so loesche
+ // diesen, denn sonst wuerden leere S/E-Nodes oder E/S-Nodes enstehen.
+ // Bei anderen Nodes wird eine neuer EndNode eingefuegt
+ SwNode * pAktNode = &pRange->aStart.GetNode();
+ SwNodeIndex aIdx( *pAktNode->StartOfSectionNode() );
+ if( pAktNode->IsStartNode() ) // selbst StartNode
+ {
+ SwEndNode* pEndNd = pRange->aEnd.GetNode().GetEndNode();
+ if( pAktNode == pEndNd->pStartOfSection )
+ {
+ // dann wurde paarig aufgehoben, also nur die im Berich neu anpassen
+ SwStartNode* pTmpSttNd = pAktNode->pStartOfSection;
+ RemoveNode( pRange->aStart.GetIndex(), 1, sal_True );
+ RemoveNode( pRange->aEnd.GetIndex(), 1, sal_True );
+
+ SwNodeIndex aTmpIdx( pRange->aStart );
+ while( aTmpIdx < pRange->aEnd )
+ {
+ pAktNode = &aTmpIdx.GetNode();
+ pAktNode->pStartOfSection = pTmpSttNd;
+ if( pAktNode->IsStartNode() )
+ aTmpIdx = pAktNode->EndOfSectionIndex() + 1;
+ else
+ aTmpIdx++;
+ }
+ return ;
+ }
+ DelNodes( pRange->aStart, 1 );
+ }
+ else if( aIdx == pRange->aStart.GetIndex()-1 ) // vor StartNode
+ DelNodes( aIdx, 1 );
+ else
+ new SwEndNode( pRange->aStart, *aIdx.GetNode().GetStartNode() );
+
+ // Ist das Ende vom Bereich vor oder auf einem StartNode, so loesche
+ // diesen, denn sonst wuerden leere S/E-Nodes oder E/S-Nodes entstehen
+ // Bei anderen Nodes wird eine neuer EndNode eingefuegt
+ SwNodeIndex aTmpIdx( pRange->aEnd );
+ if( pRange->aEnd.GetNode().IsEndNode() )
+ DelNodes( pRange->aEnd, 1 );
+ else
+ {
+ pAktNode = new SwStartNode( pRange->aEnd );
+/*?? welcher NodeTyp ??*/
+ aTmpIdx = *pRange->aEnd.GetNode().EndOfSectionNode();
+ pRange->aEnd--;
+ }
+
+ SectionUpDown( aIdx, aTmpIdx );
+}
+
+
+/*************************************************************************
+|*
+|* SwNodes::SectionUpDown()
+|*
+|* Beschreibung
+|* Methode setzt die Indizies die bei SectionUp oder SectionDwon
+|* veraendert wurden wieder richtig, sodass die Ebenen wieder
+|* Konsistent sind.
+|*
+|* Parameter
+|* SwIndex & aStart StartNode !!!
+|* SwIndex & aEnd EndPunkt
+|*
+|* Ersterstellung JP 23.04.91
+|* Letzte Aenderung JP 23.04.91
+|*
+*************************************************************************/
+void SwNodes::SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEnd )
+{
+ SwNode * pAktNode;
+ SwNodeIndex aTmpIdx( aStart, +1 );
+ // das Array bildet einen Stack, es werden alle StartOfSelction's gesichert
+ SwSttNdPtrs aSttNdStack( 1, 5 );
+ SwStartNode* pTmp = aStart.GetNode().GetStartNode();
+ aSttNdStack.C40_INSERT( SwStartNode, pTmp, 0 );
+
+ // durchlaufe bis der erste zu aendernde Start-Node gefunden wurde
+ // ( Es wird vom eingefuegten EndNode bis nach vorne die Indexe gesetzt )
+ for( ;; aTmpIdx++ )
+ {
+ pAktNode = &aTmpIdx.GetNode();
+ pAktNode->pStartOfSection = aSttNdStack[ aSttNdStack.Count()-1 ];
+
+ if( pAktNode->GetStartNode() )
+ {
+ pTmp = (SwStartNode*)pAktNode;
+ aSttNdStack.C40_INSERT( SwStartNode, pTmp, aSttNdStack.Count() );
+ }
+ else if( pAktNode->GetEndNode() )
+ {
+ SwStartNode* pSttNd = aSttNdStack[ aSttNdStack.Count() - 1 ];
+ pSttNd->pEndOfSection = (SwEndNode*)pAktNode;
+ aSttNdStack.Remove( aSttNdStack.Count() - 1 );
+ if( aSttNdStack.Count() )
+ continue; // noch genuegend EndNodes auf dem Stack
+
+ else if( aTmpIdx < aEnd ) // Uebergewicht an StartNodes
+ // ist das Ende noch nicht erreicht, so hole den Start von
+ // der uebergeordneten Section
+ {
+ aSttNdStack.C40_INSERT( SwStartNode, pSttNd->pStartOfSection, 0 );
+ }
+ else // wenn ueber den Bereich hinaus, dann Ende
+ break;
+ }
+ }
+}
+
+
+
+
+/*******************************************************************
+|*
+|* SwNodes::Delete
+|*
+|* Beschreibung
+|* Spezielle Implementierung der Delete-Funktion des
+|* variablen Array. Diese spezielle Implementierung ist
+|* notwendig, da durch das Loeschen von Start- bzw.
+|* Endnodes Inkonsistenzen entstehen koennen. Diese werden
+|* durch diese Funktion beseitigt.
+|*
+|* Parameter
+|* IN
+|* SwIndex &rIndex bezeichnet die Position, an der
+|* geloescht wird
+|* rIndex ist nach Aufruf der Funktion unveraendert (Kopie?!)
+|* sal_uInt16 nNodes bezeichnet die Anzahl der zu loeschenden
+|* Nodes; ist auf 1 defaulted
+|*
+|* Debug-Funktionen
+|* geben beim Eintritt in die Funktion Position und Anzahl
+|* der zu loeschenden Nodes aus.
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
+{
+ sal_uInt16 nLevel = 0; // Level-Counter
+ SwNode * pAktNode;
+
+ sal_uLong nCnt = Count() - rIndex.GetIndex() - 1;
+ if( nCnt > nNodes ) nCnt = nNodes;
+
+ if( nCnt == 0 ) // keine Anzahl -> return
+ return;
+
+ SwNodeRange aRg( rIndex, 0, rIndex, nCnt-1 );
+ // ueberprufe ob rIndex..rIndex + nCnt ueber einen Bereich hinausragt !!
+ if( ( !aRg.aStart.GetNode().StartOfSectionIndex() &&
+ !aRg.aStart.GetIndex() ) ||
+ ! CheckNodesRange( aRg.aStart, aRg.aEnd ) )
+ return;
+
+
+ // falls aEnd auf keinem ContentNode steht, dann suche den vorherigen
+ while( ( pAktNode = &aRg.aEnd.GetNode())->GetStartNode() ||
+ ( pAktNode->GetEndNode() &&
+ !pAktNode->pStartOfSection->IsTableNode() ))
+ aRg.aEnd--;
+
+ nCnt = 0;
+ // Start erhoehen, damit auf < abgefragt wird. ( bei <= kann es zu
+ // Problemen fuehren; ist aEnd == aStart und wird aEnd geloscht,
+ // so ist aEnd <= aStart
+ aRg.aStart--;
+
+ sal_Bool bSaveInNodesDel = bInNodesDel;
+ bInNodesDel = sal_True;
+ sal_Bool bUpdateOutline = sal_False;
+
+ // bis alles geloescht ist
+ while( aRg.aStart < aRg.aEnd )
+ {
+ pAktNode = &aRg.aEnd.GetNode();
+
+ if( pAktNode->GetEndNode() )
+ {
+ // die gesamte Section loeschen ?
+ if( pAktNode->StartOfSectionIndex() > aRg.aStart.GetIndex() )
+ {
+ SwTableNode* pTblNd = pAktNode->pStartOfSection->GetTableNode();
+ if( pTblNd )
+ pTblNd->DelFrms();
+
+ SwNode *pNd, *pChkNd = pAktNode->pStartOfSection;
+ sal_uInt16 nIdxPos;
+ do {
+ pNd = &aRg.aEnd.GetNode();
+
+ if( pNd->IsTxtNode() )
+ {
+ //if( NO_NUMBERING != //#outline level,zhaojianwei
+ // ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() &&
+ if( 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel() &&//<-end,zhaojianwei
+ pOutlineNds->Seek_Entry( pNd, &nIdxPos ))
+ {
+ // loesche die Gliederungs-Indizies.
+ pOutlineNds->Remove( nIdxPos );
+ bUpdateOutline = sal_True;
+ }
+ ((SwTxtNode*)pNd)->InvalidateNumRule();
+ }
+ else if( pNd->IsEndNode() &&
+ pNd->pStartOfSection->IsTableNode() )
+ ((SwTableNode*)pNd->pStartOfSection)->DelFrms();
+
+ aRg.aEnd--;
+ nCnt++;
+
+ } while( pNd != pChkNd );
+ }
+ else
+ {
+ RemoveNode( aRg.aEnd.GetIndex()+1, nCnt, sal_True ); // loesche
+ nCnt = 0;
+ aRg.aEnd--; // vor den EndNode
+ nLevel++;
+ }
+ }
+ else if( pAktNode->GetStartNode() ) // StartNode gefunden
+ {
+ if( nLevel == 0 ) // es wird eine Stufe runter gestuft
+ {
+ if( nCnt )
+ {
+ // loesche jetzt das Array
+ aRg.aEnd++;
+ RemoveNode( aRg.aEnd.GetIndex(), nCnt, sal_True );
+ nCnt = 0;
+ }
+ }
+ else // es werden alle Nodes Innerhalb eines Start- und
+ { // End-Nodes geloescht, loesche mit Start/EndNode
+ RemoveNode( aRg.aEnd.GetIndex(), nCnt + 2, sal_True ); // loesche Array
+ nCnt = 0;
+ nLevel--;
+ }
+
+ // nach dem loeschen kann aEnd auf einem EndNode stehen
+ // loesche alle leeren Start-/End-Node-Paare
+ SwNode* pTmpNode = aRg.aEnd.GetNode().GetEndNode();
+ aRg.aEnd--;
+ while( pTmpNode &&
+ ( pAktNode = &aRg.aEnd.GetNode())->GetStartNode() &&
+ pAktNode->StartOfSectionIndex() )
+ {
+ // loesche den EndNode und StartNode
+ DelNodes( aRg.aEnd, 2 );
+ pTmpNode = aRg.aEnd.GetNode().GetEndNode();
+ aRg.aEnd--;
+ }
+ }
+ else // normaler Node, also ins TmpArray einfuegen
+ {
+ SwTxtNode* pTxtNd = pAktNode->GetTxtNode();
+ if( pTxtNd )
+ {
+ if( pTxtNd->IsOutline())
+ { // loesche die Gliederungs-Indizies.
+ pOutlineNds->Remove( pTxtNd );
+ bUpdateOutline = sal_True;
+ }
+ pTxtNd->InvalidateNumRule();
+ }
+ else if( pAktNode->IsCntntNode() )
+ ((SwCntntNode*)pAktNode)->InvalidateNumRule();
+
+ aRg.aEnd--;
+ nCnt++;
+ }
+ }
+
+ aRg.aEnd++;
+ if( nCnt != 0 )
+ RemoveNode( aRg.aEnd.GetIndex(), nCnt, sal_True ); // loesche den Rest
+
+ // loesche alle leeren Start-/End-Node-Paare
+ while( aRg.aEnd.GetNode().GetEndNode() &&
+ ( pAktNode = &aRg.aStart.GetNode())->GetStartNode() &&
+ pAktNode->StartOfSectionIndex() )
+ // aber ja keinen der heiligen 5.
+ {
+ DelNodes( aRg.aStart, 2 ); // loesche den Start- und EndNode
+ aRg.aStart--;
+ }
+
+ bInNodesDel = bSaveInNodesDel;
+
+ if( !bInNodesDel )
+ {
+ // rufe jetzt noch das Update fuer die Gliederung/Nummerierung auf
+ if( bUpdateOutline || bInDelUpdOutl )
+ {
+ UpdtOutlineIdx( aRg.aEnd.GetNode() );
+ bInDelUpdOutl = sal_False;
+ }
+
+ }
+ else
+ {
+ if( bUpdateOutline )
+ bInDelUpdOutl = sal_True;
+ }
+}
+
+/*******************************************************************
+|*
+|* SwNodes::GetSectionLevel
+|*
+|* Beschreibung
+|* Die Funktion liefert den Sectionlevel an der durch
+|* aIndex bezeichneten Position. Die Funktion ruft die
+|* GetSectionlevel-Funktion des durch aIndex bezeichneten
+|* Nodes. Diese ist eine virtuelle Funktion, die fuer
+|* Endnodes speziell implementiert werden musste.
+|* Die Sectionlevels werden ermittelt, indem rekursiv durch
+|* die Nodesstruktur (jeweils zum naechsten theEndOfSection)
+|* gegangen wird, bis die oberste Ebene erreicht ist
+|* (theEndOfSection == 0)
+|*
+|* Parameter
+|* aIndex bezeichnet die Position des Nodes, dessen
+|* Sectionlevel ermittelt werden soll. Hier wird eine Kopie
+|* uebergeben, da eine Veraenderung der Variablen in der
+|* rufenden Funktion nicht wuenschenswert ist.
+|*
+|* Ausnahmen
+|* Der erste Node im Array sollte immer ein Startnode sein.
+|* Dieser erfaehrt in der Funktion SwNodes::GetSectionLevel()
+|* eine Sonderbehandlung; es wird davon ausgegangen, dass der
+|* erste Node auch ein Startnode ist.
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+sal_uInt16 SwNodes::GetSectionLevel(const SwNodeIndex &rIdx) const {
+ // Sonderbehandlung 1. Node
+ if(rIdx == 0) return 1;
+ /*
+ * Keine Rekursion! - hier wird das SwNode::GetSectionLevel
+ * aufgerufen
+ */
+ return rIdx.GetNode().GetSectionLevel();
+}
+
+void SwNodes::GoStartOfSection(SwNodeIndex *pIdx) const
+{
+ // hinter den naechsten Startnode
+ SwNodeIndex aTmp( *pIdx->GetNode().StartOfSectionNode(), +1 );
+
+ // steht der Index auf keinem ContentNode, dann gehe dahin. Ist aber
+ // kein weiterer vorhanden, dann lasse den Index an alter Pos stehen !!!
+ while( !aTmp.GetNode().IsCntntNode() )
+ { // gehe vom StartNode ( es kann nur ein StartNode sein ! ) an sein
+ // Ende
+ if( *pIdx <= aTmp )
+ return; // FEHLER: Steht schon hinter der Sektion
+ aTmp = aTmp.GetNode().EndOfSectionIndex()+1;
+ if( *pIdx <= aTmp )
+ return; // FEHLER: Steht schon hinter der Sektion
+ }
+ (*pIdx) = aTmp; // steht auf einem ContentNode
+}
+
+void SwNodes::GoEndOfSection(SwNodeIndex *pIdx) const
+{
+ // falls er vor einem Endnode steht --> nichts tun
+ if( !pIdx->GetNode().IsEndNode() )
+ (*pIdx) = *pIdx->GetNode().EndOfSectionNode();
+}
+
+SwCntntNode* SwNodes::GoNext(SwNodeIndex *pIdx) const
+{
+ if( pIdx->GetIndex() >= Count() - 1 )
+ return 0;
+
+ SwNodeIndex aTmp(*pIdx, +1);
+ SwNode* pNd = 0;
+ while( aTmp < Count()-1 && 0 == ( pNd = &aTmp.GetNode())->IsCntntNode() )
+ aTmp++;
+
+ if( aTmp == Count()-1 )
+ pNd = 0;
+ else
+ (*pIdx) = aTmp;
+ return (SwCntntNode*)pNd;
+}
+
+SwCntntNode* SwNodes::GoPrevious(SwNodeIndex *pIdx) const
+{
+ if( !pIdx->GetIndex() )
+ return 0;
+
+ SwNodeIndex aTmp( *pIdx, -1 );
+ SwNode* pNd = 0;
+ while( aTmp.GetIndex() && 0 == ( pNd = &aTmp.GetNode())->IsCntntNode() )
+ aTmp--;
+
+ if( !aTmp.GetIndex() )
+ pNd = 0;
+ else
+ (*pIdx) = aTmp;
+ return (SwCntntNode*)pNd;
+}
+
+/*************************************************************************
+|*
+|* sal_Bool SwNodes::CheckNodesRange()
+|*
+|* Beschreibung
+|* Teste ob der uebergene SRange nicht ueber die Grenzen der
+|* einzelnen Bereiche (PosIts, Autotext, Content, Icons und Inserts )
+|* hinaus reicht.
+|* Nach Wahrscheinlichkeit des Ranges sortiert.
+|*
+|* Alg.: Da festgelegt ist, das aRange.aEnd den 1.Node hinter dem Bereich
+|* bezeichnet, wird hier auf aEnd <= End.. getestet !!
+|*
+|* Parameter SwIndex & Start-Index vom Bereich
+|* SwIndex & End-Index vom Bereich
+|* sal_Bool sal_True: Start+End in gleicher Section!
+|* sal_False: Start+End in verschiedenen Sect.
+|* Return-Wert sal_Bool sal_True: gueltiger SRange
+|* sal_False: ungueltiger SRange
+|*
+|* Ersterstellung JP 23.04.91
+|* Letzte Aenderung JP 18.06.92
+|*
+*************************************************************************/
+
+inline int TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, sal_uLong nStt, sal_uLong nEnd )
+{
+ return nStt < nSttIdx && nEnd >= nSttIdx &&
+ nStt < nEndIdx && nEnd >= nEndIdx;
+}
+
+sal_Bool SwNodes::CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd ) const
+{
+ sal_uLong nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex();
+ if( TstIdx( nStt, nEnd, pEndOfContent->StartOfSectionIndex(),
+ pEndOfContent->GetIndex() )) return sal_True;
+ if( TstIdx( nStt, nEnd, pEndOfAutotext->StartOfSectionIndex(),
+ pEndOfAutotext->GetIndex() )) return sal_True;
+ if( TstIdx( nStt, nEnd, pEndOfPostIts->StartOfSectionIndex(),
+ pEndOfPostIts->GetIndex() )) return sal_True;
+ if( TstIdx( nStt, nEnd, pEndOfInserts->StartOfSectionIndex(),
+ pEndOfInserts->GetIndex() )) return sal_True;
+ if( TstIdx( nStt, nEnd, pEndOfRedlines->StartOfSectionIndex(),
+ pEndOfRedlines->GetIndex() )) return sal_True;
+
+ return sal_False; // liegt irgendwo dazwischen, FEHLER
+}
+
+
+/*************************************************************************
+|*
+|* void SwNodes::DelNodes()
+|*
+|* Beschreibung
+|* Loesche aus den NodesArray ab einer Position entsprechend Node's.
+|*
+|* Parameter SwIndex & Der Startpunkt im Nodes-Array
+|* sal_uInt16 die Anzahl
+|*
+|* Ersterstellung JP 23.04.91
+|* Letzte Aenderung JP 23.04.91
+|*
+*************************************************************************/
+void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt )
+{
+ int bUpdateNum = 0;
+ sal_uLong nSttIdx = rStart.GetIndex();
+
+ if( !nSttIdx && nCnt == GetEndOfContent().GetIndex()+1 )
+ {
+ // es wird das gesamte Nodes-Array zerstoert, man ist im Doc DTOR!
+ // Die initialen Start-/End-Nodes duerfen nur im SwNodes-DTOR
+ // zerstoert werden!
+ SwNode* aEndNdArr[] = { pEndOfContent,
+ pEndOfPostIts, pEndOfInserts,
+ pEndOfAutotext, pEndOfRedlines,
+ 0
+ };
+
+ SwNode** ppEndNdArr = aEndNdArr;
+ while( *ppEndNdArr )
+ {
+ nSttIdx = (*ppEndNdArr)->StartOfSectionIndex() + 1;
+ sal_uLong nEndIdx = (*ppEndNdArr)->GetIndex();
+
+ if( nSttIdx != nEndIdx )
+ RemoveNode( nSttIdx, nEndIdx - nSttIdx, sal_True );
+
+ ++ppEndNdArr;
+ }
+ }
+ else
+ {
+ for( sal_uLong n = nSttIdx, nEnd = nSttIdx + nCnt; n < nEnd; ++n )
+ {
+ SwNode* pNd = (*this)[ n ];
+
+ if( pNd->IsTxtNode() &&
+ //NO_NUMBERING != ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei
+ 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel() ) //<-end,zhaojianwei
+ { // loesche die Gliederungs-Indizies.
+ sal_uInt16 nIdxPos;
+ if( pOutlineNds->Seek_Entry( pNd, &nIdxPos ))
+ {
+ pOutlineNds->Remove( nIdxPos );
+ bUpdateNum = 1;
+ }
+ }
+ if( pNd->IsCntntNode() )
+ {
+ ((SwCntntNode*)pNd)->InvalidateNumRule();
+ ((SwCntntNode*)pNd)->DelFrms();
+ }
+ }
+ RemoveNode( nSttIdx, nCnt, sal_True );
+
+ // rufe noch das Update fuer die Gliederungsnumerierung auf
+ if( bUpdateNum )
+ UpdtOutlineIdx( rStart.GetNode() );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* sal_uInt16 HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange )
+|*
+|* Beschreibung
+|* Berechne den hoehsten Level innerhalb des Bereiches
+|*
+|* Parameter SwNodes & das Node-Array
+|* SwNodeRange & der zu ueberpruefende Bereich
+|* Return sal_uInt16 der hoechste Level
+|*
+|* Ersterstellung JP 24.04.91
+|* Letzte Aenderung JP 24.04.91
+|*
+*************************************************************************/
+
+struct HighLevel
+{
+ sal_uInt16 nLevel, nTop;
+ HighLevel( sal_uInt16 nLv ) : nLevel( nLv ), nTop( nLv ) {}
+
+};
+
+sal_Bool _HighestLevel( const SwNodePtr& rpNode, void * pPara )
+{
+ HighLevel * pHL = (HighLevel*)pPara;
+ if( rpNode->GetStartNode() )
+ pHL->nLevel++;
+ else if( rpNode->GetEndNode() )
+ pHL->nLevel--;
+ if( pHL->nTop > pHL->nLevel )
+ pHL->nTop = pHL->nLevel;
+ return sal_True;
+
+}
+
+sal_uInt16 HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange )
+{
+ HighLevel aPara( rNodes.GetSectionLevel( rRange.aStart ));
+ rNodes.ForEach( rRange.aStart, rRange.aEnd, _HighestLevel, &aPara );
+ return aPara.nTop;
+
+}
+
+/*************************************************************************
+|*
+|* SwNodes::Move()
+|*
+|* Beschreibung
+|* Parameter SwPaM& zu kopierender Bereich
+|* SwNodes& in dieses Nodes-Array
+|* SwPosition& auf diese Position im Nodes-Array
+|* Ersterstellung JP 09.07.92
+|* Letzte Aenderung JP 09.07.92
+|*
+*************************************************************************/
+void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
+{
+ SwPosition * const pStt = rPam.Start();
+ SwPosition * const pEnd = rPam.End();
+
+ if( !rPam.HasMark() || *pStt >= *pEnd )
+ return;
+
+ if( this == &rNodes && *pStt <= rPos && rPos < *pEnd )
+ return;
+
+ SwNodeIndex aEndIdx( pEnd->nNode );
+ SwNodeIndex aSttIdx( pStt->nNode );
+ SwTxtNode *const pSrcNd = aSttIdx.GetNode().GetTxtNode();
+ SwTxtNode * pDestNd = rPos.nNode.GetNode().GetTxtNode();
+ sal_Bool bSplitDestNd = sal_True;
+ sal_Bool bCopyCollFmt = pDestNd && !pDestNd->GetTxt().Len();
+
+ if( pSrcNd )
+ {
+ // ist der 1.Node ein TextNode, dann muss im NodesArray auch
+ // ein TextNode vorhanden sein, in den der Inhalt geschoben wird
+ if( !pDestNd )
+ {
+ pDestNd = rNodes.MakeTxtNode( rPos.nNode, pSrcNd->GetTxtColl() );
+ rPos.nNode--;
+ rPos.nContent.Assign( pDestNd, 0 );
+ bCopyCollFmt = sal_True;
+ }
+ bSplitDestNd = pDestNd->Len() > rPos.nContent.GetIndex() ||
+ pEnd->nNode.GetNode().IsTxtNode();
+
+ // verschiebe jetzt noch den Inhalt in den neuen Node
+ sal_Bool bOneNd = pStt->nNode == pEnd->nNode;
+ const xub_StrLen nLen =
+ ( (bOneNd) ? pEnd->nContent.GetIndex() : pSrcNd->Len() )
+ - pStt->nContent.GetIndex();
+
+ if( !pEnd->nNode.GetNode().IsCntntNode() )
+ {
+ bOneNd = sal_True;
+ sal_uLong nSttNdIdx = pStt->nNode.GetIndex() + 1;
+ const sal_uLong nEndNdIdx = pEnd->nNode.GetIndex();
+ for( ; nSttNdIdx < nEndNdIdx; ++nSttNdIdx )
+ {
+ if( (*this)[ nSttNdIdx ]->IsCntntNode() )
+ {
+ bOneNd = sal_False;
+ break;
+ }
+ }
+ }
+
+ // das kopieren / setzen der Vorlagen darf erst nach
+ // dem Splitten erfolgen
+ if( !bOneNd && bSplitDestNd )
+ {
+ if( !rPos.nContent.GetIndex() )
+ {
+ bCopyCollFmt = sal_True;
+ }
+ if( rNodes.IsDocNodes() )
+ {
+ SwDoc* const pInsDoc = pDestNd->GetDoc();
+ ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
+ pInsDoc->SplitNode( rPos, false );
+ }
+ else
+ {
+ pDestNd->SplitCntntNode( rPos );
+ }
+
+ if( rPos.nNode == aEndIdx )
+ {
+ aEndIdx--;
+ }
+ bSplitDestNd = sal_True;
+
+ pDestNd = rNodes[ rPos.nNode.GetIndex() - 1 ]->GetTxtNode();
+ if( nLen )
+ {
+ pSrcNd->CutText( pDestNd, SwIndex( pDestNd, pDestNd->Len()),
+ pStt->nContent, nLen );
+ }
+ }
+ else if ( nLen )
+ {
+ pSrcNd->CutText( pDestNd, rPos.nContent, pStt->nContent, nLen );
+ }
+
+ if( bCopyCollFmt )
+ {
+ SwDoc* const pInsDoc = pDestNd->GetDoc();
+ ::sw::UndoGuard const undoGuard(pInsDoc->GetIDocumentUndoRedo());
+ pSrcNd->CopyCollFmt( *pDestNd );
+ bCopyCollFmt = sal_False;
+ }
+
+ if( bOneNd ) // das wars schon
+ {
+ // der PaM wird korrigiert, denn falls ueber Nodegrenzen verschoben
+ // wurde, so stehen sie in unterschieden Nodes. Auch die Selektion
+ // wird aufgehoben !
+ pEnd->nContent = pStt->nContent;
+ rPam.DeleteMark();
+ GetDoc()->GetDocShell()->Broadcast( SwFmtFldHint( 0,
+ rNodes.IsDocNodes() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) );
+ return;
+ }
+
+ aSttIdx++;
+ }
+ else if( pDestNd )
+ {
+ if( rPos.nContent.GetIndex() )
+ {
+ if( rPos.nContent.GetIndex() == pDestNd->Len() )
+ {
+ rPos.nNode++;
+ }
+ else if( rPos.nContent.GetIndex() )
+ {
+ // falls im EndNode gesplittet wird, dann muss der EndIdx
+ // korrigiert werden !!
+ const bool bCorrEnd = aEndIdx == rPos.nNode;
+ // es wird kein Text an den TextNode angehaengt, also splitte ihn
+
+ if( rNodes.IsDocNodes() )
+ {
+ SwDoc* const pInsDoc = pDestNd->GetDoc();
+ ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
+ pInsDoc->SplitNode( rPos, false );
+ }
+ else
+ {
+ pDestNd->SplitCntntNode( rPos );
+ }
+
+ pDestNd = rPos.nNode.GetNode().GetTxtNode();
+
+ if ( bCorrEnd )
+ {
+ aEndIdx--;
+ }
+ }
+ }
+ // am Ende steht noch ein leerer Text Node herum.
+ bSplitDestNd = sal_True;
+ }
+
+ SwTxtNode* const pEndSrcNd = aEndIdx.GetNode().GetTxtNode();
+ if ( pEndSrcNd )
+ {
+ {
+ // am Bereichsende entsteht ein neuer TextNode
+ if( !bSplitDestNd )
+ {
+ if( rPos.nNode < rNodes.GetEndOfContent().GetIndex() )
+ {
+ rPos.nNode++;
+ }
+
+ pDestNd =
+ rNodes.MakeTxtNode( rPos.nNode, pEndSrcNd->GetTxtColl() );
+ rPos.nNode--;
+ rPos.nContent.Assign( pDestNd, 0 );
+ }
+ else
+ {
+ pDestNd = rPos.nNode.GetNode().GetTxtNode();
+ }
+
+ if( pDestNd && pEnd->nContent.GetIndex() )
+ {
+ // verschiebe jetzt noch den Inhalt in den neuen Node
+ SwIndex aIdx( pEndSrcNd, 0 );
+ pEndSrcNd->CutText( pDestNd, rPos.nContent, aIdx,
+ pEnd->nContent.GetIndex());
+ }
+
+ if( bCopyCollFmt )
+ {
+ SwDoc* const pInsDoc = pDestNd->GetDoc();
+ ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
+ pEndSrcNd->CopyCollFmt( *pDestNd );
+ }
+ }
+ }
+ else
+ {
+ if ( pSrcNd && aEndIdx.GetNode().IsCntntNode() )
+ {
+ aEndIdx++;
+ }
+ if( !bSplitDestNd )
+ {
+ rPos.nNode++;
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), 0 );
+ }
+ }
+
+ if( aEndIdx != aSttIdx )
+ {
+ // verschiebe jetzt die Nodes in das NodesArary
+ const sal_uLong nSttDiff = aSttIdx.GetIndex() - pStt->nNode.GetIndex();
+ SwNodeRange aRg( aSttIdx, aEndIdx );
+ _MoveNodes( aRg, rNodes, rPos.nNode );
+ // falls ins gleiche Nodes-Array verschoben wurde, stehen die
+ // Indizies jetzt auch an der neuen Position !!!!
+ // (also alles wieder umsetzen)
+ if( &rNodes == this )
+ {
+ pStt->nNode = aRg.aEnd.GetIndex() - nSttDiff;
+ }
+ }
+
+ // falls der Start-Node verschoben wurde, in dem der Cursor stand, so
+ // muss der Content im akt. Content angemeldet werden !!!
+ if ( &pStt->nNode.GetNode() == &GetEndOfContent() )
+ {
+ const bool bSuccess = GoPrevious( &pStt->nNode );
+ ASSERT( bSuccess, "Move() - no ContentNode here" );
+ (void) bSuccess;
+ }
+ pStt->nContent.Assign( pStt->nNode.GetNode().GetCntntNode(),
+ pStt->nContent.GetIndex() );
+ // der PaM wird korrigiert, denn falls ueber Nodegrenzen verschoben
+ // wurde, so stehen sie in unterschielichen Nodes. Auch die Selektion
+ // wird aufgehoben !
+ *pEnd = *pStt;
+ rPam.DeleteMark();
+ GetDoc()->GetDocShell()->Broadcast( SwFmtFldHint( 0,
+ rNodes.IsDocNodes() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) );
+}
+
+
+
+/*************************************************************************
+|*
+|* SwNodes::_Copy()
+|*
+|* Beschreibung
+|* Parameter SwNodeRange& zu kopierender Bereich
+|* SwDoc& in dieses Dokument
+|* SwIndex& auf diese Position im Nodes-Array
+|* Ersterstellung JP 11.11.92
+|* Letzte Aenderung JP 11.11.92
+|*
+*************************************************************************/
+
+inline sal_uInt8 MaxLvl( sal_uInt8 nMin, sal_uInt8 nMax, short nNew )
+{
+ return (sal_uInt8)(nNew < nMin ? nMin : nNew > nMax ? nMax : nNew);
+}
+
+void SwNodes::_CopyNodes( const SwNodeRange& rRange,
+ const SwNodeIndex& rIndex, sal_Bool bNewFrms, sal_Bool bTblInsDummyNode ) const
+{
+ SwDoc* pDoc = rIndex.GetNode().GetDoc();
+
+ SwNode * pAktNode;
+ if( rIndex == 0 ||
+ ( (pAktNode = &rIndex.GetNode())->GetStartNode() &&
+ !pAktNode->StartOfSectionIndex() ))
+ return;
+
+ SwNodeRange aRg( rRange );
+
+ // "einfache" StartNodes oder EndNodes ueberspringen
+ while( ND_STARTNODE == (pAktNode = & aRg.aStart.GetNode())->GetNodeType()
+ || ( pAktNode->IsEndNode() &&
+ !pAktNode->pStartOfSection->IsSectionNode() ) )
+ aRg.aStart++;
+
+ // falls aEnd-1 auf keinem ContentNode steht, dann suche den vorherigen
+ aRg.aEnd--;
+ // #i107142#: if aEnd is start node of a special section, do nothing.
+ // Otherwise this could lead to crash: going through all previous
+ // special section nodes and then one before the first.
+ if (aRg.aEnd.GetNode().StartOfSectionIndex() != 0)
+ {
+ while( ((pAktNode = & aRg.aEnd.GetNode())->GetStartNode() &&
+ !pAktNode->IsSectionNode() ) ||
+ ( pAktNode->IsEndNode() &&
+ ND_STARTNODE == pAktNode->pStartOfSection->GetNodeType()) )
+ {
+ aRg.aEnd--;
+ }
+ }
+ aRg.aEnd++;
+
+ // wird im selben Array's verschoben, dann ueberpruefe die Einfuegepos.
+ if( aRg.aStart >= aRg.aEnd )
+ return;
+
+ // when inserting into the source range, nothing need to be done
+ DBG_ASSERT( &aRg.aStart.GetNodes() == this,
+ "aRg should use thisnodes array" );
+ DBG_ASSERT( &aRg.aStart.GetNodes() == &aRg.aEnd.GetNodes(),
+ "Range across different nodes arrays? You deserve punishment!");
+ if( &rIndex.GetNodes() == &aRg.aStart.GetNodes() &&
+ rIndex.GetIndex() >= aRg.aStart.GetIndex() &&
+ rIndex.GetIndex() < aRg.aEnd.GetIndex() )
+ return;
+
+ SwNodeIndex aInsPos( rIndex );
+ SwNodeIndex aOrigInsPos( rIndex, -1 ); // Originale Insert Pos
+ sal_uInt16 nLevel = 0; // Level-Counter
+
+ for( sal_uLong nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex();
+ nNodeCnt > 0; --nNodeCnt )
+ {
+ pAktNode = &aRg.aStart.GetNode();
+ switch( pAktNode->GetNodeType() )
+ {
+ case ND_TABLENODE:
+ // dann kopiere mal den TableNode
+ // Tabell in Fussnote kopieren ?
+ if( aInsPos < pDoc->GetNodes().GetEndOfInserts().GetIndex() &&
+ pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex()
+ < aInsPos.GetIndex() )
+ {
+ nNodeCnt -=
+ ( pAktNode->EndOfSectionIndex() -
+ aRg.aStart.GetIndex() );
+
+ // dann alle Nodes der Tabelle in die akt. Zelle kopieren
+ // fuer den TabellenNode einen DummyNode einfuegen?
+ if( bTblInsDummyNode )
+ new SwNode( aInsPos, ND_SECTIONDUMMY );
+
+ for( aRg.aStart++; aRg.aStart.GetIndex() <
+ pAktNode->EndOfSectionIndex();
+ aRg.aStart++ )
+ {
+ // fuer den Box-StartNode einen DummyNode einfuegen?
+ if( bTblInsDummyNode )
+ new SwNode( aInsPos, ND_SECTIONDUMMY );
+
+ SwStartNode* pSttNd = aRg.aStart.GetNode().GetStartNode();
+ _CopyNodes( SwNodeRange( *pSttNd, + 1,
+ *pSttNd->EndOfSectionNode() ),
+ aInsPos, bNewFrms, sal_False );
+
+ // fuer den Box-EndNode einen DummyNode einfuegen?
+ if( bTblInsDummyNode )
+ new SwNode( aInsPos, ND_SECTIONDUMMY );
+ aRg.aStart = *pSttNd->EndOfSectionNode();
+ }
+ // fuer den TabellenEndNode einen DummyNode einfuegen?
+ if( bTblInsDummyNode )
+ new SwNode( aInsPos, ND_SECTIONDUMMY );
+ aRg.aStart = *pAktNode->EndOfSectionNode();
+ }
+ else
+ {
+ SwNodeIndex nStt( aInsPos, -1 );
+ SwTableNode* pTblNd = ((SwTableNode*)pAktNode)->
+ MakeCopy( pDoc, aInsPos );
+ nNodeCnt -= aInsPos.GetIndex() - nStt.GetIndex() -2;
+
+ aRg.aStart = pAktNode->EndOfSectionIndex();
+
+ if( bNewFrms && pTblNd )
+ {
+ nStt = aInsPos;
+ pTblNd->MakeFrms( &nStt );
+ }
+ }
+ break;
+
+ case ND_SECTIONNODE: // SectionNode
+ // If the end of the section is outside the copy range,
+ // the section node will skipped, not copied!
+ // If someone want to change this behaviour, he has to adjust the function
+ // lcl_NonCopyCount(..) in ndcopy.cxx which relies on it.
+ if( pAktNode->EndOfSectionIndex() < aRg.aEnd.GetIndex() )
+ {
+ // also der gesamte, lege einen neuen SectionNode an
+ SwNodeIndex nStt( aInsPos, -1 );
+ SwSectionNode* pSectNd = ((SwSectionNode*)pAktNode)->
+ MakeCopy( pDoc, aInsPos );
+
+ nNodeCnt -= aInsPos.GetIndex() - nStt.GetIndex() -2;
+ aRg.aStart = pAktNode->EndOfSectionIndex();
+
+ if( bNewFrms && pSectNd &&
+ !pSectNd->GetSection().IsHidden() )
+ pSectNd->MakeFrms( &nStt );
+ }
+ break;
+
+ case ND_STARTNODE: // StartNode gefunden
+ {
+ SwStartNode* pTmp = new SwStartNode( aInsPos, ND_STARTNODE,
+ ((SwStartNode*)pAktNode)->GetStartNodeType() );
+ new SwEndNode( aInsPos, *pTmp );
+ aInsPos--;
+ nLevel++;
+ }
+ break;
+
+ case ND_ENDNODE:
+ if( nLevel ) // vollstaendige Section
+ {
+ --nLevel;
+ aInsPos++; // EndNode schon vorhanden
+ }
+ else if( !pAktNode->pStartOfSection->IsSectionNode() )
+ {
+ // erzeuge eine Section an der originalen InsertPosition
+ SwNodeRange aTmpRg( aOrigInsPos, 1, aInsPos );
+ pDoc->GetNodes().SectionDown( &aTmpRg,
+ pAktNode->pStartOfSection->GetStartNodeType() );
+ }
+ break;
+
+ case ND_TEXTNODE:
+ case ND_GRFNODE:
+ case ND_OLENODE:
+ {
+ SwCntntNode* pNew = ((SwCntntNode*)pAktNode)->MakeCopy(
+ pDoc, aInsPos );
+ if( !bNewFrms ) // dflt. werden die Frames immer angelegt
+ pNew->DelFrms();
+ }
+ break;
+
+ case ND_SECTIONDUMMY:
+ if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this))
+ {
+ // dann muss an der akt. InsPos auch ein SectionNode
+ // (Start/Ende) stehen; dann diesen ueberspringen.
+ // Andernfalls nicht weiter beachten.
+ SwNode *const pTmpNd = & aInsPos.GetNode();
+ if( pTmpNd->IsSectionNode() ||
+ pTmpNd->StartOfSectionNode()->IsSectionNode() )
+ aInsPos++; // ueberspringen
+ }
+ else {
+ ASSERT( sal_False, "wie kommt diser Node ins Nodes-Array??" );
+ }
+ break;
+
+ default:
+ ASSERT( sal_False, "weder Start-/End-/Content-Node, unbekannter Typ" );
+ }
+ aRg.aStart++;
+ }
+
+
+#ifdef JP_DEBUG
+ {
+extern Writer* GetDebugWriter(const String&);
+
+ Writer* pWriter = GetDebugWriter(aEmptyStr);
+ if( pWriter )
+ {
+ int nError;
+ SvFileStream aStrm( "c:\\$$copy.db", STREAM_WRITE );
+ SwWriter aWriter( aStrm, *pMyDoc );
+ aWriter.Write( &nError, pWriter );
+ }
+ }
+#endif
+}
+
+void SwNodes::_DelDummyNodes( const SwNodeRange& rRg )
+{
+ SwNodeIndex aIdx( rRg.aStart );
+ while( aIdx.GetIndex() < rRg.aEnd.GetIndex() )
+ {
+ if( ND_SECTIONDUMMY == aIdx.GetNode().GetNodeType() )
+ RemoveNode( aIdx.GetIndex(), 1, sal_True );
+ else
+ aIdx++;
+ }
+}
+
+SwStartNode* SwNodes::MakeEmptySection( const SwNodeIndex& rIdx,
+ SwStartNodeType eSttNdTyp )
+{
+ SwStartNode* pSttNd = new SwStartNode( rIdx, ND_STARTNODE, eSttNdTyp );
+ new SwEndNode( rIdx, *pSttNd );
+ return pSttNd;
+}
+
+
+SwStartNode* SwNodes::MakeTextSection( const SwNodeIndex & rWhere,
+ SwStartNodeType eSttNdTyp,
+ SwTxtFmtColl *pColl,
+ SwAttrSet* pAutoAttr )
+{
+ SwStartNode* pSttNd = new SwStartNode( rWhere, ND_STARTNODE, eSttNdTyp );
+ new SwEndNode( rWhere, *pSttNd );
+ MakeTxtNode( SwNodeIndex( rWhere, - 1 ), pColl, pAutoAttr );
+ return pSttNd;
+}
+
+ // zum naechsten Content-Node, der nicht geschuetzt oder versteckt ist
+ // (beides auf sal_False ==> GoNext/GoPrevious!!!)
+SwCntntNode* SwNodes::GoNextSection( SwNodeIndex * pIdx,
+ int bSkipHidden, int bSkipProtect ) const
+{
+ int bFirst = sal_True;
+ SwNodeIndex aTmp( *pIdx );
+ const SwNode* pNd;
+ while( aTmp < Count() - 1 )
+ {
+ pNd = & aTmp.GetNode();
+ if (ND_SECTIONNODE == pNd->GetNodeType())
+ {
+ const SwSection& rSect = ((SwSectionNode*)pNd)->GetSection();
+ if( (bSkipHidden && rSect.IsHiddenFlag()) ||
+ (bSkipProtect && rSect.IsProtectFlag()) )
+ // dann diese Section ueberspringen
+ aTmp = *pNd->EndOfSectionNode();
+ bFirst = sal_False;
+ }
+ else if( bFirst )
+ {
+ bFirst = sal_False;
+ if( pNd->pStartOfSection->IsSectionNode() )
+ {
+ const SwSection& rSect = ((SwSectionNode*)pNd->
+ pStartOfSection)->GetSection();
+ if( (bSkipHidden && rSect.IsHiddenFlag()) ||
+ (bSkipProtect && rSect.IsProtectFlag()) )
+ // dann diese Section ueberspringen
+ aTmp = *pNd->EndOfSectionNode();
+ }
+ }
+ else if( ND_CONTENTNODE & pNd->GetNodeType() )
+ {
+ const SwSectionNode* pSectNd;
+ if( ( bSkipHidden || bSkipProtect ) &&
+ 0 != (pSectNd = pNd->FindSectionNode() ) &&
+ ( ( bSkipHidden && pSectNd->GetSection().IsHiddenFlag() ) ||
+ ( bSkipProtect && pSectNd->GetSection().IsProtectFlag() )) )
+ {
+ aTmp = *pSectNd->EndOfSectionNode();
+ }
+ else
+ {
+ (*pIdx) = aTmp;
+ return (SwCntntNode*)pNd;
+ }
+ }
+ aTmp++;
+ bFirst = sal_False;
+ }
+ return 0;
+}
+
+SwCntntNode* SwNodes::GoPrevSection( SwNodeIndex * pIdx,
+ int bSkipHidden, int bSkipProtect ) const
+{
+ int bFirst = sal_True;
+ SwNodeIndex aTmp( *pIdx );
+ const SwNode* pNd;
+ while( aTmp > 0 )
+ {
+ pNd = & aTmp.GetNode();
+ if (ND_ENDNODE == pNd->GetNodeType())
+ {
+ if( pNd->pStartOfSection->IsSectionNode() )
+ {
+ const SwSection& rSect = ((SwSectionNode*)pNd->
+ pStartOfSection)->GetSection();
+ if( (bSkipHidden && rSect.IsHiddenFlag()) ||
+ (bSkipProtect && rSect.IsProtectFlag()) )
+ // dann diese Section ueberspringen
+ aTmp = *pNd->StartOfSectionNode();
+ }
+ bFirst = sal_False;
+ }
+ else if( bFirst )
+ {
+ bFirst = sal_False;
+ if( pNd->pStartOfSection->IsSectionNode() )
+ {
+ const SwSection& rSect = ((SwSectionNode*)pNd->
+ pStartOfSection)->GetSection();
+ if( (bSkipHidden && rSect.IsHiddenFlag()) ||
+ (bSkipProtect && rSect.IsProtectFlag()) )
+ // dann diese Section ueberspringen
+ aTmp = *pNd->StartOfSectionNode();
+ }
+ }
+ else if( ND_CONTENTNODE & pNd->GetNodeType() )
+ {
+ const SwSectionNode* pSectNd;
+ if( ( bSkipHidden || bSkipProtect ) &&
+ 0 != (pSectNd = pNd->FindSectionNode() ) &&
+ ( ( bSkipHidden && pSectNd->GetSection().IsHiddenFlag() ) ||
+ ( bSkipProtect && pSectNd->GetSection().IsProtectFlag() )) )
+ {
+ aTmp = *pSectNd;
+ }
+ else
+ {
+ (*pIdx) = aTmp;
+ return (SwCntntNode*)pNd;
+ }
+ }
+ aTmp--;
+ }
+ return 0;
+}
+
+
+ // suche den vorhergehenden [/nachfolgenden ] ContentNode oder
+ // TabellenNode mit Frames. Wird kein Ende angeben, dann wird mit
+ // dem FrameIndex begonnen; ansonsten, wird mit dem vor rFrmIdx und
+ // dem hintern pEnd die Suche gestartet. Sollte kein gueltiger Node
+ // gefunden werden, wird 0 returnt. rFrmIdx zeigt auf dem Node mit
+ // Frames
+SwNode* SwNodes::FindPrvNxtFrmNode( SwNodeIndex& rFrmIdx,
+ const SwNode* pEnd ) const
+{
+ SwNode* pFrmNd = 0;
+
+ // habe wir gar kein Layout, vergiss es
+ if( GetDoc()->GetCurrentViewShell() ) //swmod 071108//swmod 071225
+ {
+ SwNode* pSttNd = &rFrmIdx.GetNode();
+
+ // wird in eine versteckte Section verschoben ??
+ SwSectionNode* pSectNd = pSttNd->IsSectionNode()
+ ? pSttNd->StartOfSectionNode()->FindSectionNode()
+ : pSttNd->FindSectionNode();
+ if( !( pSectNd && pSectNd->GetSection().CalcHiddenFlag()/*IsHiddenFlag()*/ ) )
+ {
+ // #130650# in a table in table situation we have to assure that we don't leave the
+ // outer table cell when the inner table is looking for a PrvNxt...
+ SwTableNode* pTableNd = pSttNd->IsTableNode()
+ ? pSttNd->StartOfSectionNode()->FindTableNode()
+ : pSttNd->FindTableNode();
+ SwNodeIndex aIdx( rFrmIdx );
+ SwNode* pNd;
+ if( pEnd )
+ {
+ aIdx--;
+ pNd = &aIdx.GetNode();
+ }
+ else
+ pNd = pSttNd;
+
+ if( ( pFrmNd = pNd )->IsCntntNode() )
+ rFrmIdx = aIdx;
+
+ // suche nach vorne/hinten nach einem Content Node
+ else if( 0 != ( pFrmNd = GoPrevSection( &aIdx, sal_True, sal_False )) &&
+ ::CheckNodesRange( aIdx, rFrmIdx, sal_True ) &&
+ // nach vorne nie aus der Tabelle hinaus!
+ pFrmNd->FindTableNode() == pTableNd &&
+ // Bug 37652: nach hinten nie aus der Tabellenzelle hinaus!
+ (!pFrmNd->FindTableNode() || pFrmNd->FindTableBoxStartNode()
+ == pSttNd->FindTableBoxStartNode() ) &&
+ (!pSectNd || pSttNd->IsSectionNode() ||
+ pSectNd->GetIndex() < pFrmNd->GetIndex())
+ )
+ {
+ rFrmIdx = aIdx;
+ }
+ else
+ {
+ if( pEnd )
+ aIdx = pEnd->GetIndex() + 1;
+ else
+ aIdx = rFrmIdx;
+
+ // JP 19.09.93: aber nie die Section dafuer verlassen !!
+ if( ( pEnd && ( pFrmNd = &aIdx.GetNode())->IsCntntNode() ) ||
+ ( 0 != ( pFrmNd = GoNextSection( &aIdx, sal_True, sal_False )) &&
+ ::CheckNodesRange( aIdx, rFrmIdx, sal_True ) &&
+ ( pFrmNd->FindTableNode() == pTableNd &&
+ // Bug 37652: nach hinten nie aus der Tabellenzelle hinaus!
+ (!pFrmNd->FindTableNode() || pFrmNd->FindTableBoxStartNode()
+ == pSttNd->FindTableBoxStartNode() ) ) &&
+ (!pSectNd || pSttNd->IsSectionNode() ||
+ pSectNd->EndOfSectionIndex() > pFrmNd->GetIndex())
+ ))
+ {
+ //JP 18.02.99: Undo von Merge einer Tabelle mit der
+ // der vorherigen, wenn dahinter auch noch eine steht
+ // falls aber der Node in einer Tabelle steht, muss
+ // natuerlich dieser returnt werden, wenn der SttNode eine
+ // Section oder Tabelle ist!
+ SwTableNode* pTblNd;
+ if( pSttNd->IsTableNode() &&
+ 0 != ( pTblNd = pFrmNd->FindTableNode() ) &&
+ // TABLE IN TABLE:
+ pTblNd != pSttNd->StartOfSectionNode()->FindTableNode() )
+ {
+ pFrmNd = pTblNd;
+ rFrmIdx = *pFrmNd;
+ }
+ else
+ rFrmIdx = aIdx;
+ }
+ else if( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsTableNode() )
+ {
+ pFrmNd = pNd->StartOfSectionNode();
+ rFrmIdx = *pFrmNd;
+ }
+ else
+ {
+ if( pEnd )
+ aIdx = pEnd->GetIndex() + 1;
+ else
+ aIdx = rFrmIdx.GetIndex() + 1;
+
+ if( (pFrmNd = &aIdx.GetNode())->IsTableNode() )
+ rFrmIdx = aIdx;
+ else
+ {
+ pFrmNd = 0;
+
+ // is there some sectionnodes before a tablenode?
+ while( aIdx.GetNode().IsSectionNode() )
+ {
+ const SwSection& rSect = aIdx.GetNode().
+ GetSectionNode()->GetSection();
+ if( rSect.IsHiddenFlag() )
+ aIdx = aIdx.GetNode().EndOfSectionIndex()+1;
+ else
+ aIdx++;
+ }
+ if( aIdx.GetNode().IsTableNode() )
+ {
+ rFrmIdx = aIdx;
+ pFrmNd = &aIdx.GetNode();
+ }
+ }
+ }
+ }
+ }
+ }
+ return pFrmNd;
+}
+
+void SwNodes::ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd,
+ FnForEach_SwNodes fnForEach, void* pArgs )
+{
+ BigPtrArray::ForEach( rStart.GetIndex(), rEnd.GetIndex(),
+ (FnForEach) fnForEach, pArgs );
+}
+
+struct _TempBigPtrEntry : public BigPtrEntry
+{
+ _TempBigPtrEntry() {}
+};
+
+
+void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, sal_Bool bDel )
+{
+ sal_uLong nEnd = nDelPos + nSz;
+ SwNode* pNew = (*this)[ nEnd ];
+
+ if( pRoot )
+ {
+ SwNodeIndex *p = pRoot;
+ while( p )
+ {
+ sal_uLong nIdx = p->GetIndex();
+ SwNodeIndex* pNext = p->pNext;
+ if( nDelPos <= nIdx && nIdx < nEnd )
+ (*p) = *pNew;
+
+ p = pNext;
+ }
+
+ p = pRoot->pPrev;
+ while( p )
+ {
+ sal_uLong nIdx = p->GetIndex();
+ SwNodeIndex* pPrev = p->pPrev;
+ if( nDelPos <= nIdx && nIdx < nEnd )
+ (*p) = *pNew;
+
+ p = pPrev;
+ }
+ }
+
+ {
+ for (sal_uLong nCnt = 0; nCnt < nSz; nCnt++)
+ {
+ SwTxtNode * pTxtNd = ((*this)[ nDelPos + nCnt ])->GetTxtNode();
+
+ if (pTxtNd)
+ {
+ // --> OD 2008-03-13 #refactorlists#
+// pTxtNd->UnregisterNumber();
+ pTxtNd->RemoveFromList();
+ // <--
+ }
+ }
+ }
+
+ if( bDel )
+ {
+ sal_uLong nCnt = nSz;
+ SwNode *pDel = (*this)[ nDelPos+nCnt-1 ], *pPrev = (*this)[ nDelPos+nCnt-2 ];
+
+// temp. Object setzen
+ //JP 24.08.98: muessten eigentlich einzeln removed werden, weil
+ // das Remove auch rekursiv gerufen werden kann, z.B. bei
+ // zeichengebundenen Rahmen. Da aber dabei viel zu viel
+ // ablaueft, wird hier ein temp. Objekt eingefuegt, das
+ // dann mit dem Remove wieder entfernt wird.
+ // siehe Bug 55406
+ _TempBigPtrEntry aTempEntry;
+ BigPtrEntry* pTempEntry = &aTempEntry;
+
+ while( nCnt-- )
+ {
+ delete pDel;
+ pDel = pPrev;
+ sal_uLong nPrevNdIdx = pPrev->GetIndex();
+ BigPtrArray::Replace( nPrevNdIdx+1, pTempEntry );
+ if( nCnt )
+ pPrev = (*this)[ nPrevNdIdx - 1 ];
+ }
+ nDelPos = pDel->GetIndex() + 1;
+ }
+
+ BigPtrArray::Remove( nDelPos, nSz );
+}
+
+void SwNodes::RegisterIndex( SwNodeIndex& rIdx )
+{
+ if( !pRoot ) // noch keine Root gesetzt?
+ {
+ pRoot = &rIdx;
+ pRoot->pPrev = 0;
+ pRoot->pNext = 0;
+ }
+ else
+ {
+ // immer hinter die Root haengen
+ rIdx.pNext = pRoot->pNext;
+ pRoot->pNext = &rIdx;
+ rIdx.pPrev = pRoot;
+ if( rIdx.pNext )
+ rIdx.pNext->pPrev = &rIdx;
+ }
+}
+
+void SwNodes::DeRegisterIndex( SwNodeIndex& rIdx )
+{
+ SwNodeIndex* pN = rIdx.pNext;
+ SwNodeIndex* pP = rIdx.pPrev;
+
+ if( pRoot == &rIdx )
+ pRoot = pP ? pP : pN;
+
+ if( pP )
+ pP->pNext = pN;
+ if( pN )
+ pN->pPrev = pP;
+
+ rIdx.pNext = 0;
+ rIdx.pPrev = 0;
+}
+
+void SwNodes::InsertNode( const SwNodePtr pNode,
+ const SwNodeIndex& rPos )
+{
+ const ElementPtr pIns = pNode;
+ BigPtrArray::Insert( pIns, rPos.GetIndex() );
+}
+
+void SwNodes::InsertNode( const SwNodePtr pNode,
+ sal_uLong nPos )
+{
+ const ElementPtr pIns = pNode;
+ BigPtrArray::Insert( pIns, nPos );
+}
+
+// ->#112139#
+SwNode * SwNodes::DocumentSectionStartNode(SwNode * pNode) const
+{
+ if (NULL != pNode)
+ {
+ SwNodeIndex aIdx(*pNode);
+
+ if (aIdx <= (*this)[0]->EndOfSectionIndex())
+ pNode = (*this)[0];
+ else
+ {
+ while ((*this)[0] != pNode->StartOfSectionNode())
+ pNode = pNode->StartOfSectionNode();
+ }
+ }
+
+ return pNode;
+}
+
+SwNode * SwNodes::DocumentSectionEndNode(SwNode * pNode) const
+{
+ return DocumentSectionStartNode(pNode)->EndOfSectionNode();
+}
+
+//SwNode * SwNodes::operator[](int n) const
+//{
+// return operator[]((sal_uLong) n);
+//}
+// <-#112139#
+
+sal_Bool SwNodes::IsDocNodes() const
+{
+ return this == &pMyDoc->GetNodes();
+}
diff --git a/sw/source/core/docnode/observablethread.cxx b/sw/source/core/docnode/observablethread.cxx
new file mode 100644
index 000000000000..347575165cc4
--- /dev/null
+++ b/sw/source/core/docnode/observablethread.cxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+#include <observablethread.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+/** class for an observable thread
+
+ OD 2007-01-29 #i73788#
+
+ @author OD
+*/
+ObservableThread::ObservableThread()
+ : mnRefCount( 0 ),
+ mnThreadID( 0 ),
+ mpThreadListener()
+{
+}
+
+ObservableThread::~ObservableThread()
+{
+}
+
+oslInterlockedCount ObservableThread::acquire()
+{
+ return osl_incrementInterlockedCount( &mnRefCount );
+}
+
+oslInterlockedCount ObservableThread::release()
+{
+ oslInterlockedCount nCount( osl_decrementInterlockedCount( &mnRefCount ) );
+ if ( nCount == 0 )
+ {
+ delete this;
+ return nCount;
+ }
+
+ return nCount;
+}
+
+void ObservableThread::SetListener( boost::weak_ptr< IFinishedThreadListener > pThreadListener,
+ const oslInterlockedCount nThreadID )
+{
+ mpThreadListener = pThreadListener;
+ mnThreadID = nThreadID;
+}
+
+void SAL_CALL ObservableThread::run()
+{
+ acquire();
+
+ threadFunction();
+}
+
+void SAL_CALL ObservableThread::onTerminated()
+{
+ threadFinished();
+
+ // notify observer
+ boost::shared_ptr< IFinishedThreadListener > pThreadListener = mpThreadListener.lock();
+ if ( pThreadListener )
+ {
+ pThreadListener->NotifyAboutFinishedThread( mnThreadID );
+ }
+
+ release();
+}
+
+void ObservableThread::threadFinished()
+{
+ // empty default implementation
+}
diff --git a/sw/source/core/docnode/pausethreadstarting.cxx b/sw/source/core/docnode/pausethreadstarting.cxx
new file mode 100644
index 000000000000..d9c9293dce51
--- /dev/null
+++ b/sw/source/core/docnode/pausethreadstarting.cxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+#include <pausethreadstarting.hxx>
+#include <swthreadmanager.hxx>
+
+/** Helper class to pause starting of threads during existence of an instance
+ of this class
+
+ OD 2007-03-16 #i73788#
+
+ @author OD
+*/
+SwPauseThreadStarting::SwPauseThreadStarting()
+ : mbPausedThreadStarting( false )
+{
+ if ( SwThreadManager::ExistsThreadManager() &&
+ !SwThreadManager::GetThreadManager().StartingOfThreadsSuspended() )
+ {
+ SwThreadManager::GetThreadManager().SuspendStartingOfThreads();
+ mbPausedThreadStarting = true;
+ }
+}
+
+SwPauseThreadStarting::~SwPauseThreadStarting()
+{
+ if ( mbPausedThreadStarting )
+ {
+ SwThreadManager::GetThreadManager().ResumeStartingOfThreads();
+ }
+}
diff --git a/sw/source/core/docnode/retrievedinputstreamdata.cxx b/sw/source/core/docnode/retrievedinputstreamdata.cxx
new file mode 100644
index 000000000000..21fa5284ac26
--- /dev/null
+++ b/sw/source/core/docnode/retrievedinputstreamdata.cxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+#include <retrievedinputstreamdata.hxx>
+#include <retrieveinputstreamconsumer.hxx>
+#include <vcl/svapp.hxx>
+
+/** implementation of class <SwRetrievedInputStreamDataManager>
+
+ OD 2007-01-30 #i73788#
+*/
+SwRetrievedInputStreamDataManager* SwRetrievedInputStreamDataManager::mpManager = 0;
+SwRetrievedInputStreamDataManager::tDataKey SwRetrievedInputStreamDataManager::mnNextKeyValue = 1;
+osl::Mutex SwRetrievedInputStreamDataManager::maGetManagerMutex;
+
+SwRetrievedInputStreamDataManager& SwRetrievedInputStreamDataManager::GetManager()
+{
+ osl::MutexGuard aGuard(maGetManagerMutex);
+
+ if ( mpManager == 0 )
+ {
+ mpManager = new SwRetrievedInputStreamDataManager();
+ }
+
+ return *mpManager;
+}
+
+SwRetrievedInputStreamDataManager::tDataKey SwRetrievedInputStreamDataManager::ReserveData(
+ boost::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > pThreadConsumer )
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ // create empty data container for given thread Consumer
+ tDataKey nDataKey( mnNextKeyValue );
+ tData aNewEntry( pThreadConsumer );
+ maInputStreamData[ nDataKey ] = aNewEntry;
+
+ // prepare next data key value
+ if ( mnNextKeyValue < SAL_MAX_UINT64 )
+ {
+ ++mnNextKeyValue;
+ }
+ else
+ {
+ mnNextKeyValue = 1;
+ }
+
+ return nDataKey;
+}
+
+void SwRetrievedInputStreamDataManager::PushData(
+ const tDataKey nDataKey,
+ com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream,
+ const sal_Bool bIsStreamReadOnly )
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ std::map< tDataKey, tData >::iterator aIter = maInputStreamData.find( nDataKey );
+
+ if ( aIter != maInputStreamData.end() )
+ {
+ // Fill data container.
+ (*aIter).second.mxInputStream = xInputStream;
+ (*aIter).second.mbIsStreamReadOnly = bIsStreamReadOnly;
+
+ // post user event to process the retrieved input stream data
+ if ( GetpApp() )
+ {
+
+ tDataKey* pDataKey = new tDataKey;
+ *pDataKey = nDataKey;
+ GetpApp()->PostUserEvent( LINK( this, SwRetrievedInputStreamDataManager, LinkedInputStreamReady ), pDataKey );
+ }
+ else
+ {
+ // no application available -> discard data
+ maInputStreamData.erase( aIter );
+ }
+ }
+}
+
+bool SwRetrievedInputStreamDataManager::PopData( const tDataKey nDataKey,
+ tData& rData )
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ bool bDataProvided( false );
+
+ std::map< tDataKey, tData >::iterator aIter = maInputStreamData.find( nDataKey );
+
+ if ( aIter != maInputStreamData.end() )
+ {
+ rData.mpThreadConsumer = (*aIter).second.mpThreadConsumer;
+ rData.mxInputStream = (*aIter).second.mxInputStream;
+ rData.mbIsStreamReadOnly = (*aIter).second.mbIsStreamReadOnly;
+
+ maInputStreamData.erase( aIter );
+
+ bDataProvided = true;
+ }
+
+ return bDataProvided;
+}
+
+/** callback function, which is triggered by input stream data manager on
+ filling of the data container to provide retrieved input stream to the
+ thread Consumer using <Application::PostUserEvent(..)>
+
+ OD 2007-01-29 #i73788#
+ Note: This method has to be run in the main thread.
+
+ @author OD
+*/
+IMPL_LINK( SwRetrievedInputStreamDataManager,
+ LinkedInputStreamReady,
+ SwRetrievedInputStreamDataManager::tDataKey*,
+ pDataKey )
+{
+ if ( !pDataKey )
+ {
+ return 0;
+ }
+
+ osl::MutexGuard aGuard(maMutex);
+
+ SwRetrievedInputStreamDataManager& rDataManager =
+ SwRetrievedInputStreamDataManager::GetManager();
+ SwRetrievedInputStreamDataManager::tData aInputStreamData;
+ if ( rDataManager.PopData( *pDataKey, aInputStreamData ) )
+ {
+ boost::shared_ptr< SwAsyncRetrieveInputStreamThreadConsumer > pThreadConsumer =
+ aInputStreamData.mpThreadConsumer.lock();
+ if ( pThreadConsumer )
+ {
+ pThreadConsumer->ApplyInputStream( aInputStreamData.mxInputStream,
+ aInputStreamData.mbIsStreamReadOnly );
+ }
+ }
+ delete pDataKey;
+
+ return 0;
+}
+
diff --git a/sw/source/core/docnode/retrieveinputstream.cxx b/sw/source/core/docnode/retrieveinputstream.cxx
new file mode 100644
index 000000000000..7da81735e58f
--- /dev/null
+++ b/sw/source/core/docnode/retrieveinputstream.cxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+#include <retrieveinputstream.hxx>
+#include <comphelper/mediadescriptor.hxx>
+#ifndef _COM_SUN_STAR_IO_XSTREAM_HXX_
+#include <com/sun/star/io/XStream.hpp>
+#endif
+
+/** class for a thread to retrieve an input stream given by an URL
+
+ OD 2007-01-29 #i73788#
+
+ @author OD
+*/
+::rtl::Reference< ObservableThread > SwAsyncRetrieveInputStreamThread::createThread(
+ const SwRetrievedInputStreamDataManager::tDataKey nDataKey,
+ const String& rLinkedURL )
+{
+ SwAsyncRetrieveInputStreamThread* pNewThread =
+ new SwAsyncRetrieveInputStreamThread( nDataKey, rLinkedURL );
+ return pNewThread;
+}
+
+SwAsyncRetrieveInputStreamThread::SwAsyncRetrieveInputStreamThread(
+ const SwRetrievedInputStreamDataManager::tDataKey nDataKey,
+ const String& rLinkedURL )
+ : ObservableThread(),
+ mnDataKey( nDataKey ),
+ mrLinkedURL( rLinkedURL )
+{
+}
+
+SwAsyncRetrieveInputStreamThread::~SwAsyncRetrieveInputStreamThread()
+{
+}
+
+void SwAsyncRetrieveInputStreamThread::threadFunction()
+{
+ com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > xProps( 1 );
+ xProps[0].Name = ::rtl::OUString::createFromAscii( "URL" );
+ xProps[0].Value <<= ::rtl::OUString( mrLinkedURL );
+ comphelper::MediaDescriptor aMedium( xProps );
+
+ aMedium.addInputStream();
+
+ com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream;
+ aMedium[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
+ if ( !xInputStream.is() )
+ {
+ com::sun::star::uno::Reference<com::sun::star::io::XStream> xStream;
+ aMedium[comphelper::MediaDescriptor::PROP_STREAM()] >>= xStream;
+ if ( xStream.is() )
+ {
+ xInputStream = xStream->getInputStream();
+ }
+ }
+
+ SwRetrievedInputStreamDataManager::GetManager().PushData( mnDataKey,
+ xInputStream,
+ aMedium.isStreamReadOnly() );
+}
diff --git a/sw/source/core/docnode/retrieveinputstreamconsumer.cxx b/sw/source/core/docnode/retrieveinputstreamconsumer.cxx
new file mode 100644
index 000000000000..409a96084ced
--- /dev/null
+++ b/sw/source/core/docnode/retrieveinputstreamconsumer.cxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_sw.hxx"
+#include <retrieveinputstreamconsumer.hxx>
+#include <ndgrf.hxx>
+#include <retrieveinputstream.hxx>
+#include <swthreadmanager.hxx>
+
+/** class to provide creation of a thread to retrieve an input stream given by
+ an URL and to consume the retrieved input stream.
+
+ OD 2007-01-29 #i73788#
+
+ @author OD
+*/
+SwAsyncRetrieveInputStreamThreadConsumer::SwAsyncRetrieveInputStreamThreadConsumer(
+ SwGrfNode& rGrfNode )
+ : mrGrfNode( rGrfNode ),
+ mnThreadID( 0 )
+{
+}
+
+SwAsyncRetrieveInputStreamThreadConsumer::~SwAsyncRetrieveInputStreamThreadConsumer()
+{
+ SwThreadManager::GetThreadManager().RemoveThread( mnThreadID );
+}
+
+void SwAsyncRetrieveInputStreamThreadConsumer::CreateThread( const String& rURL )
+{
+ // Get new data container for input stream data
+ SwRetrievedInputStreamDataManager::tDataKey nDataKey =
+ SwRetrievedInputStreamDataManager::GetManager().ReserveData(
+ mrGrfNode.GetThreadConsumer() );
+
+ rtl::Reference< ObservableThread > pNewThread =
+ SwAsyncRetrieveInputStreamThread::createThread( nDataKey, rURL );
+
+ // Add thread to thread manager and pass ownership of thread to thread manager.
+ mnThreadID = SwThreadManager::GetThreadManager().AddThread( pNewThread );
+}
+
+void SwAsyncRetrieveInputStreamThreadConsumer::ApplyInputStream(
+ com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream,
+ const sal_Bool bIsStreamReadOnly )
+{
+ mrGrfNode.ApplyInputStream( xInputStream, bIsStreamReadOnly );
+}
+
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
new file mode 100644
index 000000000000..e722400e8dca
--- /dev/null
+++ b/sw/source/core/docnode/section.cxx
@@ -0,0 +1,1809 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <stdlib.h>
+#include <hintids.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <editeng/protitem.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/fcontnr.hxx>
+#include <docary.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtpdsc.hxx>
+#include <errhdl.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <node.hxx>
+#include <pam.hxx>
+#include <frmtool.hxx>
+#include <editsh.hxx>
+#include <hints.hxx>
+#include <docsh.hxx>
+#include <ndtxt.hxx>
+#include <section.hxx>
+#include <swserv.hxx>
+#include <shellio.hxx>
+#include <poolfmt.hxx>
+#include <expfld.hxx>
+#include <swbaslnk.hxx>
+#include <mvsave.hxx>
+#include <sectfrm.hxx>
+#include <fmtftntx.hxx>
+#include <ftnidx.hxx>
+#include <doctxm.hxx>
+#include <fmteiro.hxx>
+#include <swerror.h>
+#include <unosection.hxx>
+#include <switerator.hxx>
+#include <svl/smplhint.hxx>
+
+using namespace ::com::sun::star;
+
+
+SV_IMPL_REF( SwServerObject )
+
+//static const char __FAR_DATA sSectionFmtNm[] = "Section";
+#define sSectionFmtNm aEmptyStr
+
+class SwIntrnlSectRefLink : public SwBaseLink
+{
+ SwSectionFmt& rSectFmt;
+public:
+ SwIntrnlSectRefLink( SwSectionFmt& rFmt, sal_uInt16 nUpdateType, sal_uInt16 nFmt )
+ : SwBaseLink( nUpdateType, nFmt ),
+ rSectFmt( rFmt )
+ {}
+
+ virtual void Closed();
+ virtual void DataChanged( const String& rMimeType,
+ const uno::Any & rValue );
+
+ virtual const SwNode* GetAnchor() const;
+ virtual sal_Bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, xub_StrLen nStt = 0,
+ xub_StrLen nEnd = STRING_NOTFOUND ) const;
+
+ // --> OD 2007-02-14 #b6521322#
+ inline SwSectionNode* GetSectNode()
+ {
+ const SwNode* pSectNd( const_cast<SwIntrnlSectRefLink*>(this)->GetAnchor() );
+ return const_cast<SwSectionNode*>( dynamic_cast<const SwSectionNode*>( pSectNd ) );
+ }
+ // <--
+};
+
+
+TYPEINIT1(SwSectionFmt,SwFrmFmt );
+TYPEINIT1(SwSection,SwClient );
+
+typedef SwSection* SwSectionPtr;
+
+SV_IMPL_PTRARR( SwSections, SwSection*)
+SV_IMPL_PTRARR(SwSectionFmts,SwSectionFmt*)
+
+
+SwSectionData::SwSectionData(SectionType const eType, String const& rName)
+ : m_eType(eType)
+ , m_sSectionName(rName)
+ , m_bHiddenFlag(false)
+ , m_bProtectFlag(false)
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ , m_bEditInReadonlyFlag(false)
+ // <--
+ , m_bHidden(false)
+ , m_bCondHiddenFlag(true)
+ , m_bConnectFlag(true)
+{
+}
+
+// this must have the same semantics as operator=()
+SwSectionData::SwSectionData(SwSection const& rSection)
+ : m_eType(rSection.GetType())
+ , m_sSectionName(rSection.GetSectionName())
+ , m_sCondition(rSection.GetCondition())
+ , m_sLinkFileName(rSection.GetLinkFileName())
+ , m_sLinkFilePassword(rSection.GetLinkFilePassword())
+ , m_Password(rSection.GetPassword())
+ , m_bHiddenFlag(rSection.IsHiddenFlag())
+ , m_bProtectFlag(rSection.IsProtect())
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ , m_bEditInReadonlyFlag(rSection.IsEditInReadonly())
+ // <--
+ , m_bHidden(rSection.IsHidden())
+ , m_bCondHiddenFlag(true)
+ , m_bConnectFlag(rSection.IsConnectFlag())
+{
+}
+
+// this must have the same semantics as operator=()
+SwSectionData::SwSectionData(SwSectionData const& rOther)
+ : m_eType(rOther.m_eType)
+ , m_sSectionName(rOther.m_sSectionName)
+ , m_sCondition(rOther.m_sCondition)
+ , m_sLinkFileName(rOther.m_sLinkFileName)
+ , m_sLinkFilePassword(rOther.m_sLinkFilePassword)
+ , m_Password(rOther.m_Password)
+ , m_bHiddenFlag(rOther.m_bHiddenFlag)
+ , m_bProtectFlag(rOther.m_bProtectFlag)
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ , m_bEditInReadonlyFlag(rOther.m_bEditInReadonlyFlag)
+ // <--
+ , m_bHidden(rOther.m_bHidden)
+ , m_bCondHiddenFlag(true)
+ , m_bConnectFlag(rOther.m_bConnectFlag)
+{
+}
+
+// the semantics here are weird for reasons of backward compatibility
+SwSectionData & SwSectionData::operator= (SwSectionData const& rOther)
+{
+ m_eType = rOther.m_eType;
+ m_sSectionName = rOther.m_sSectionName;
+ m_sCondition = rOther.m_sCondition;
+ m_sLinkFileName = rOther.m_sLinkFileName;
+ m_sLinkFilePassword = rOther.m_sLinkFilePassword;
+ m_bConnectFlag = rOther.m_bConnectFlag;
+ m_Password = rOther.m_Password;
+
+ m_bEditInReadonlyFlag = rOther.m_bEditInReadonlyFlag;
+ m_bProtectFlag = rOther.m_bProtectFlag;
+
+ m_bHidden = rOther.m_bHidden;
+ // FIXME: old code did not assign m_bHiddenFlag ?
+ // FIXME: why should m_bCondHiddenFlag always default to true?
+ m_bCondHiddenFlag = true;
+
+ return *this;
+}
+
+// the semantics here are weird for reasons of backward compatibility
+bool SwSectionData::operator==(SwSectionData const& rOther) const
+{
+ return (m_eType == rOther.m_eType)
+ && (m_sSectionName == rOther.m_sSectionName)
+ && (m_sCondition == rOther.m_sCondition)
+ && (m_bHidden == rOther.m_bHidden)
+ && (m_bProtectFlag == rOther.m_bProtectFlag)
+ && (m_bEditInReadonlyFlag == rOther.m_bEditInReadonlyFlag)
+ && (m_sLinkFileName == rOther.m_sLinkFileName)
+ && (m_sLinkFilePassword == rOther.m_sLinkFilePassword)
+ && (m_Password == rOther.m_Password);
+ // FIXME: old code ignored m_bCondHiddenFlag m_bHiddenFlag m_bConnectFlag
+}
+
+// SwSection ===========================================================
+
+SwSection::SwSection(
+ SectionType const eType, String const& rName, SwSectionFmt & rFormat)
+ : SwClient(& rFormat)
+ , m_Data(eType, rName)
+{
+ SwSection *const pParentSect = GetParent();
+ if( pParentSect )
+ {
+ if( pParentSect->IsHiddenFlag() )
+ {
+ SetHidden( true );
+ }
+
+ m_Data.SetProtectFlag( pParentSect->IsProtectFlag() );
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ m_Data.SetEditInReadonlyFlag( pParentSect->IsEditInReadonlyFlag() );
+ // <--
+ }
+
+ if (!m_Data.IsProtectFlag())
+ {
+ m_Data.SetProtectFlag( rFormat.GetProtect().IsCntntProtected() );
+ }
+
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ if (!m_Data.IsEditInReadonlyFlag())
+ {
+ m_Data.SetEditInReadonlyFlag( rFormat.GetEditInReadonly().GetValue() );
+ }
+ // <--
+}
+
+
+SwSection::~SwSection()
+{
+ SwSectionFmt* pFmt = GetFmt();
+ if( !pFmt )
+ return;
+
+ SwDoc* pDoc = pFmt->GetDoc();
+ if( pDoc->IsInDtor() )
+ {
+ // dann melden wir noch schnell unser Format um ans dflt FrameFmt,
+ // damit es keine Abhaengigkeiten gibt
+ if( pFmt->DerivedFrom() != pDoc->GetDfltFrmFmt() )
+ pFmt->RegisterToFormat( *pDoc->GetDfltFrmFmt() );
+ }
+ else
+ {
+ pFmt->Remove( this ); // austragen,
+
+ if (CONTENT_SECTION != m_Data.GetType())
+ {
+ pDoc->GetLinkManager().Remove( m_RefLink );
+ }
+
+ if (m_RefObj.Is())
+ {
+ pDoc->GetLinkManager().RemoveServer( &m_RefObj );
+ }
+
+ // ist die Section der letzte Client im Format, kann dieses
+ // geloescht werden
+ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFmt );
+ pFmt->ModifyNotification( &aMsgHint, &aMsgHint );
+ if( !pFmt->GetDepends() )
+ {
+ // Bug: 28191 - nicht ins Undo aufnehmen, sollte schon vorher
+ // geschehen sein!!
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+ pDoc->DelSectionFmt( pFmt ); // und loeschen
+ }
+ }
+ if (m_RefObj.Is())
+ {
+ m_RefObj->Closed();
+ }
+}
+
+void SwSection::SetSectionData(SwSectionData const& rData)
+{
+ bool const bOldHidden( m_Data.IsHidden() );
+ m_Data = rData;
+ // now update format and reflink with new data
+// SetLinkFileName(m_Data.GetLinkFileName()); // old code did not do this?
+ // next 2 may actually overwrite m_Data.m_b{Protect,EditInReadonly}Flag
+ // in Modify, which should result in same flag value as the old code!
+ SetProtect(m_Data.IsProtectFlag());
+ SetEditInReadonly(m_Data.IsEditInReadonlyFlag());
+ if (bOldHidden != m_Data.IsHidden()) // check if changed...
+ {
+ ImplSetHiddenFlag(m_Data.IsHidden(), m_Data.IsCondHidden());
+ }
+}
+
+bool SwSection::DataEquals(SwSectionData const& rCmp) const
+{
+ // note that the old code compared the flags of the parameter with the
+ // format attributes of this; the following mess should do the same...
+ (void) GetLinkFileName(); // updates m_sLinkFileName
+ bool const bProtect(m_Data.IsProtectFlag());
+ bool const bEditInReadonly(m_Data.IsEditInReadonlyFlag());
+ const_cast<SwSection*>(this)->m_Data.SetProtectFlag(IsProtect());
+ const_cast<SwSection*>(this)->m_Data
+ .SetEditInReadonlyFlag(IsEditInReadonly());
+ bool const bResult( m_Data == rCmp );
+ const_cast<SwSection*>(this)->m_Data.SetProtectFlag(bProtect);
+ const_cast<SwSection*>(this)->m_Data.SetEditInReadonlyFlag(bEditInReadonly);
+ return bResult;
+}
+
+
+void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, bool const bCondition)
+{
+ SwSectionFmt* pFmt = GetFmt();
+ ASSERT(pFmt, "ImplSetHiddenFlag: no format?");
+ if( pFmt )
+ {
+ const bool bHide = bTmpHidden && bCondition;
+
+ if (bHide) // should be hidden
+ {
+ if (!m_Data.IsHiddenFlag()) // is not hidden
+ {
+ // wie sieht es mit dem Parent aus, ist der versteckt ?
+ // (eigentlich muesste das vom bHiddenFlag angezeigt werden!)
+
+ // erstmal allen Childs sagen, das sie versteckt sind
+ SwMsgPoolItem aMsgItem( RES_SECTION_HIDDEN );
+ pFmt->ModifyNotification( &aMsgItem, &aMsgItem );
+
+ // alle Frames loeschen
+ pFmt->DelFrms();
+ }
+ }
+ else if (m_Data.IsHiddenFlag()) // show Nodes again
+ {
+ // alle Frames sichtbar machen ( Childs Sections werden vom
+ // MakeFrms beruecksichtigt). Aber nur wenn die ParentSection
+ // nichts dagegen hat !
+ SwSection* pParentSect = pFmt->GetParentSection();
+ if( !pParentSect || !pParentSect->IsHiddenFlag() )
+ {
+ // erstmal allen Childs sagen, das der Parent nicht mehr
+ // versteckt ist
+ SwMsgPoolItem aMsgItem( RES_SECTION_NOT_HIDDEN );
+ pFmt->ModifyNotification( &aMsgItem, &aMsgItem );
+
+ pFmt->MakeFrms();
+ }
+ }
+ }
+}
+
+sal_Bool SwSection::CalcHiddenFlag() const
+{
+ const SwSection* pSect = this;
+ do {
+ if( pSect->IsHidden() && pSect->IsCondHidden() )
+ return sal_True;
+ } while( 0 != ( pSect = pSect->GetParent()) );
+
+ return sal_False;
+}
+
+bool SwSection::IsProtect() const
+{
+ SwSectionFmt *const pFmt( GetFmt() );
+ ASSERT(pFmt, "SwSection::IsProtect: no format?");
+ return (pFmt)
+ ? pFmt->GetProtect().IsCntntProtected()
+ : IsProtectFlag();
+}
+
+// --> FME 2004-06-22 #114856# edit in readonly sections
+bool SwSection::IsEditInReadonly() const
+{
+ SwSectionFmt *const pFmt( GetFmt() );
+ ASSERT(pFmt, "SwSection::IsEditInReadonly: no format?");
+ return (pFmt)
+ ? pFmt->GetEditInReadonly().GetValue()
+ : IsEditInReadonlyFlag();
+}
+// <--
+
+void SwSection::SetHidden(bool const bFlag)
+{
+ if (!m_Data.IsHidden() == !bFlag)
+ return;
+
+ m_Data.SetHidden(bFlag);
+ ImplSetHiddenFlag(bFlag, m_Data.IsCondHidden());
+}
+
+
+void SwSection::SetProtect(bool const bFlag)
+{
+ SwSectionFmt *const pFormat( GetFmt() );
+ ASSERT(pFormat, "SwSection::SetProtect: no format?");
+ if (pFormat)
+ {
+ SvxProtectItem aItem( RES_PROTECT );
+ aItem.SetCntntProtect( (sal_Bool)bFlag );
+ pFormat->SetFmtAttr( aItem );
+ // note: this will call m_Data.SetProtectFlag via Modify!
+ }
+ else
+ {
+ m_Data.SetProtectFlag(bFlag);
+ }
+}
+
+// --> FME 2004-06-22 #114856# edit in readonly sections
+void SwSection::SetEditInReadonly(bool const bFlag)
+{
+ SwSectionFmt *const pFormat( GetFmt() );
+ ASSERT(pFormat, "SwSection::SetEditInReadonly: no format?");
+ if (pFormat)
+ {
+ SwFmtEditInReadonly aItem;
+ aItem.SetValue( (sal_Bool)bFlag );
+ pFormat->SetFmtAttr( aItem );
+ // note: this will call m_Data.SetEditInReadonlyFlag via Modify!
+ }
+ else
+ {
+ m_Data.SetEditInReadonlyFlag(bFlag);
+ }
+}
+// <--
+
+void SwSection::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+{
+ bool bRemake = false;
+ bool bUpdateFtn = false;
+ switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 )
+ {
+ case RES_ATTRSET_CHG:
+ {
+ SfxItemSet* pNewSet = ((SwAttrSetChg*)pNew)->GetChgSet();
+ SfxItemSet* pOldSet = ((SwAttrSetChg*)pOld)->GetChgSet();
+ const SfxPoolItem* pItem;
+
+ if( SFX_ITEM_SET == pNewSet->GetItemState(
+ RES_PROTECT, sal_False, &pItem ) )
+ {
+ m_Data.SetProtectFlag( static_cast<SvxProtectItem const*>(pItem)
+ ->IsCntntProtected() );
+ pNewSet->ClearItem( RES_PROTECT );
+ pOldSet->ClearItem( RES_PROTECT );
+ }
+
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ if( SFX_ITEM_SET == pNewSet->GetItemState(
+ RES_EDIT_IN_READONLY, sal_False, &pItem ) )
+ {
+ m_Data.SetEditInReadonlyFlag(
+ static_cast<SwFmtEditInReadonly const*>(pItem)->GetValue());
+ pNewSet->ClearItem( RES_EDIT_IN_READONLY );
+ pOldSet->ClearItem( RES_EDIT_IN_READONLY );
+ }
+ // <--
+
+ if( SFX_ITEM_SET == pNewSet->GetItemState(
+ RES_FTN_AT_TXTEND, sal_False, &pItem ) ||
+ SFX_ITEM_SET == pNewSet->GetItemState(
+ RES_END_AT_TXTEND, sal_False, &pItem ))
+ {
+ bUpdateFtn = true;
+ }
+
+ if( !pNewSet->Count() )
+ return;
+ }
+ break;
+
+ case RES_PROTECT:
+ if( pNew )
+ {
+ bool bNewFlag =
+ static_cast<const SvxProtectItem*>(pNew)->IsCntntProtected();
+ if( !bNewFlag )
+ {
+ // Abschalten: teste ob nicht vielleich ueber die Parents
+ // doch ein Schutzt besteht!
+ const SwSection* pSect = this;
+ do {
+ if( pSect->IsProtect() )
+ {
+ bNewFlag = true;
+ break;
+ }
+ pSect = pSect->GetParent();
+ } while (pSect);
+ }
+
+ m_Data.SetProtectFlag( bNewFlag );
+ }
+ return;
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ case RES_EDIT_IN_READONLY:
+ if( pNew )
+ {
+ const bool bNewFlag =
+ static_cast<const SwFmtEditInReadonly*>(pNew)->GetValue();
+ m_Data.SetEditInReadonlyFlag( bNewFlag );
+ }
+ return;
+ // <--
+
+ case RES_SECTION_HIDDEN:
+ m_Data.SetHiddenFlag(true);
+ return;
+
+ case RES_SECTION_NOT_HIDDEN:
+ case RES_SECTION_RESETHIDDENFLAG:
+ m_Data.SetHiddenFlag( m_Data.IsHidden() && m_Data.IsCondHidden() );
+ return;
+
+ case RES_COL:
+ /* wird ggf. vom Layout erledigt */
+ break;
+
+ case RES_FTN_AT_TXTEND:
+ if( pNew && pOld )
+ {
+ bUpdateFtn = true;
+ }
+ break;
+
+ case RES_END_AT_TXTEND:
+ if( pNew && pOld )
+ {
+ bUpdateFtn = true;
+ }
+ break;
+
+ default:
+ CheckRegistration( pOld, pNew );
+ break;
+ }
+
+ if( bRemake )
+ {
+ GetFmt()->DelFrms();
+ GetFmt()->MakeFrms();
+ }
+
+ if( bUpdateFtn )
+ {
+ SwSectionNode* pSectNd = GetFmt()->GetSectionNode( sal_False );
+ if( pSectNd )
+ pSectNd->GetDoc()->GetFtnIdxs().UpdateFtn(SwNodeIndex( *pSectNd ));
+ }
+}
+
+void SwSection::SetRefObject( SwServerObject* pObj )
+{
+ m_RefObj = pObj;
+}
+
+
+void SwSection::SetCondHidden(bool const bFlag)
+{
+ if (!m_Data.IsCondHidden() == !bFlag)
+ return;
+
+ m_Data.SetCondHidden(bFlag);
+ ImplSetHiddenFlag(m_Data.IsHidden(), bFlag);
+}
+
+
+// setze/erfrage den gelinkten FileNamen
+const String& SwSection::GetLinkFileName() const
+{
+ if (m_RefLink.Is())
+ {
+ String sTmp;
+ switch (m_Data.GetType())
+ {
+ case DDE_LINK_SECTION:
+ sTmp = m_RefLink->GetLinkSourceName();
+ break;
+
+ case FILE_LINK_SECTION:
+ {
+ String sRange, sFilter;
+ if (m_RefLink->GetLinkManager() &&
+ m_RefLink->GetLinkManager()->GetDisplayNames(
+ m_RefLink, 0, &sTmp, &sRange, &sFilter ))
+ {
+ ( sTmp += sfx2::cTokenSeperator ) += sFilter;
+ ( sTmp += sfx2::cTokenSeperator ) += sRange;
+ }
+ else if( GetFmt() && !GetFmt()->GetSectionNode() )
+ {
+ // ist die Section im UndoNodesArray, dann steht
+ // der Link nicht im LinkManager, kann also auch nicht
+ // erfragt werden. Dann returne den akt. Namen
+ return m_Data.GetLinkFileName();
+ }
+ }
+ break;
+ default: break;
+ }
+ const_cast<SwSection*>(this)->m_Data.SetLinkFileName(sTmp);
+ }
+ return m_Data.GetLinkFileName();
+}
+
+
+void SwSection::SetLinkFileName(const String& rNew, String const*const pPassWd)
+{
+ if (m_RefLink.Is())
+ {
+ m_RefLink->SetLinkSourceName( rNew );
+ }
+ m_Data.SetLinkFileName(rNew);
+ if( pPassWd )
+ {
+ SetLinkFilePassword( *pPassWd );
+ }
+}
+
+// falls es ein gelinkter Bereich war, dann muessen alle
+// Child-Verknuepfungen sichtbar bemacht werden.
+void SwSection::MakeChildLinksVisible( const SwSectionNode& rSectNd )
+{
+ const SwNode* pNd;
+ const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->GetLinkManager().GetLinks();
+ for( sal_uInt16 n = rLnks.Count(); n; )
+ {
+ ::sfx2::SvBaseLink* pBLnk = &(*rLnks[ --n ]);
+ if( pBLnk && !pBLnk->IsVisible() &&
+ pBLnk->ISA( SwBaseLink ) &&
+ 0 != ( pNd = ((SwBaseLink*)pBLnk)->GetAnchor() ) )
+ {
+ pNd = pNd->StartOfSectionNode(); // falls SectionNode ist!
+ const SwSectionNode* pParent;
+ while( 0 != ( pParent = pNd->FindSectionNode() ) &&
+ ( CONTENT_SECTION == pParent->GetSection().GetType()
+ || pNd == &rSectNd ))
+ pNd = pParent->StartOfSectionNode();
+
+ // steht nur noch in einer normalen Section, also
+ // wieder anzeigen
+ if( !pParent )
+ pBLnk->SetVisible( sal_True );
+ }
+ }
+}
+
+const SwTOXBase* SwSection::GetTOXBase() const
+{
+ const SwTOXBase* pRet = 0;
+ if( TOX_CONTENT_SECTION == GetType() )
+ pRet = PTR_CAST( SwTOXBaseSection, this );
+ return pRet;
+}
+
+// SwSectionFmt ========================================================
+
+SwSectionFmt::SwSectionFmt( SwSectionFmt* pDrvdFrm, SwDoc *pDoc )
+ : SwFrmFmt( pDoc->GetAttrPool(), sSectionFmtNm, pDrvdFrm )
+{
+ LockModify();
+ SetFmtAttr( *GetDfltAttr( RES_COL ) );
+ UnlockModify();
+}
+
+SwSectionFmt::~SwSectionFmt()
+{
+ if( !GetDoc()->IsInDtor() )
+ {
+ SwSectionNode* pSectNd;
+ const SwNodeIndex* pIdx = GetCntnt( sal_False ).GetCntntIdx();
+ if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
+ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+ {
+ SwSection& rSect = pSectNd->GetSection();
+ // falls es ein gelinkter Bereich war, dann muessen alle
+ // Child-Verknuepfungen sichtbar bemacht werden.
+ if( rSect.IsConnected() )
+ rSect.MakeChildLinksVisible( *pSectNd );
+
+ // vorm loeschen der Nodes pruefe, ob wir uns nicht
+ // noch anzeigen muessen!
+ if( rSect.IsHiddenFlag() )
+ {
+ SwSectionPtr pParentSect = rSect.GetParent();
+ if( !pParentSect || !pParentSect->IsHiddenFlag() )
+ {
+ // Nodes wieder anzeigen
+ rSect.SetHidden(false);
+ }
+ }
+ // mba: test iteration; objects are removed while iterating
+ CallSwClientNotify( SfxSimpleHint(SFX_HINT_DYING) );
+
+ // hebe die Section doch mal auf
+ SwNodeRange aRg( *pSectNd, 0, *pSectNd->EndOfSectionNode() );
+ GetDoc()->GetNodes().SectionUp( &aRg );
+ }
+ LockModify();
+ ResetFmtAttr( RES_CNTNT );
+ UnlockModify();
+ }
+}
+
+
+SwSection * SwSectionFmt::GetSection() const
+{
+ return SwIterator<SwSection,SwSectionFmt>::FirstElement( *this );
+}
+
+extern void lcl_DeleteFtn( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd );
+
+//Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt).
+void SwSectionFmt::DelFrms()
+{
+ SwSectionNode* pSectNd;
+ const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx();
+ if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
+ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+ {
+ // #147431# : First delete the <SwSectionFrm> of the <SwSectionFmt> instance
+ // mba: test iteration as objects are removed in iteration
+ CallSwClientNotify( SfxSimpleHint(SFX_HINT_DYING) );
+
+ // Then delete frames of the nested <SwSectionFmt> instances
+ SwIterator<SwSectionFmt,SwSectionFmt> aIter( *this );
+ SwSectionFmt *pLast = aIter.First();
+ while ( pLast )
+ {
+ pLast->DelFrms();
+ pLast = aIter.Next();
+ }
+
+ sal_uLong nEnde = pSectNd->EndOfSectionIndex();
+ sal_uLong nStart = pSectNd->GetIndex()+1;
+ lcl_DeleteFtn( pSectNd, nStart, nEnde );
+ }
+ if( pIdx )
+ {
+ //JP 22.09.98:
+ //Hint fuer Pagedesc versenden. Das mueste eigntlich das Layout im
+ //Paste der Frames selbst erledigen, aber das fuehrt dann wiederum
+ //zu weiteren Folgefehlern, die mit Laufzeitkosten geloest werden
+ //muesten. #56977# #55001# #56135#
+ SwNodeIndex aNextNd( *pIdx );
+ SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection( &aNextNd, sal_True, sal_False );
+ if( pCNd )
+ {
+ const SfxPoolItem& rItem = pCNd->GetSwAttrSet().Get( RES_PAGEDESC );
+ pCNd->ModifyNotification( (SfxPoolItem*)&rItem, (SfxPoolItem*)&rItem );
+ }
+ }
+}
+
+
+//Erzeugt die Ansichten
+void SwSectionFmt::MakeFrms()
+{
+ SwSectionNode* pSectNd;
+ const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx();
+
+ if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
+ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+ {
+ SwNodeIndex aIdx( *pIdx );
+ pSectNd->MakeFrms( &aIdx );
+ }
+}
+
+void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+{
+ sal_Bool bClients = sal_False;
+ sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+ switch( nWhich )
+ {
+ case RES_ATTRSET_CHG:
+ if( GetDepends() )
+ {
+ SfxItemSet* pNewSet = ((SwAttrSetChg*)pNew)->GetChgSet();
+ SfxItemSet* pOldSet = ((SwAttrSetChg*)pOld)->GetChgSet();
+ const SfxPoolItem *pItem;
+ if( SFX_ITEM_SET == pNewSet->GetItemState(
+ RES_PROTECT, sal_False, &pItem ))
+ {
+ ModifyBroadcast( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
+ pNewSet->ClearItem( RES_PROTECT );
+ pOldSet->ClearItem( RES_PROTECT );
+ }
+
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ if( SFX_ITEM_SET == pNewSet->GetItemState(
+ RES_EDIT_IN_READONLY, sal_False, &pItem ) )
+ {
+ ModifyBroadcast( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
+ pNewSet->ClearItem( RES_EDIT_IN_READONLY );
+ pOldSet->ClearItem( RES_EDIT_IN_READONLY );
+ }
+ // <--
+
+ if( SFX_ITEM_SET == pNewSet->GetItemState(
+ RES_FTN_AT_TXTEND, sal_False, &pItem ))
+ {
+ ModifyBroadcast( (SfxPoolItem*)&pOldSet->Get( RES_FTN_AT_TXTEND ), (SfxPoolItem*)pItem );
+ pNewSet->ClearItem( RES_FTN_AT_TXTEND );
+ pOldSet->ClearItem( RES_FTN_AT_TXTEND );
+ }
+ if( SFX_ITEM_SET == pNewSet->GetItemState(
+ RES_END_AT_TXTEND, sal_False, &pItem ))
+ {
+ ModifyBroadcast( (SfxPoolItem*)&pOldSet->Get( RES_END_AT_TXTEND ), (SfxPoolItem*)pItem );
+ pNewSet->ClearItem( RES_END_AT_TXTEND );
+ pOldSet->ClearItem( RES_END_AT_TXTEND );
+ }
+ if( !((SwAttrSetChg*)pOld)->GetChgSet()->Count() )
+ return;
+ }
+ break;
+
+ case RES_SECTION_RESETHIDDENFLAG:
+ case RES_FTN_AT_TXTEND:
+ case RES_END_AT_TXTEND : bClients = sal_True;
+ // no break !!
+ case RES_SECTION_HIDDEN:
+ case RES_SECTION_NOT_HIDDEN:
+ {
+ SwSection* pSect = GetSection();
+ if( pSect && ( bClients || ( RES_SECTION_HIDDEN == nWhich ?
+ !pSect->IsHiddenFlag() : pSect->IsHiddenFlag() ) ) )
+ {
+ ModifyBroadcast( pOld, pNew );
+ }
+ }
+ return ;
+
+
+ case RES_PROTECT:
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ case RES_EDIT_IN_READONLY:
+ // <--
+ // diese Messages bis zum Ende des Baums durchreichen !
+ if( GetDepends() )
+ {
+ ModifyBroadcast( pOld, pNew );
+ }
+ return; // das wars
+
+ case RES_OBJECTDYING:
+ if( !GetDoc()->IsInDtor() &&
+ ((SwPtrMsgPoolItem *)pOld)->pObject == (void*)GetRegisteredIn() )
+ {
+ // mein Parent wird vernichtet, dann an den Parent vom Parent
+ // umhaengen und wieder aktualisieren
+ SwFrmFmt::Modify( pOld, pNew ); // erst umhaengen !!!
+ UpdateParent();
+ return;
+ }
+ break;
+
+ case RES_FMT_CHG:
+ if( !GetDoc()->IsInDtor() &&
+ ((SwFmtChg*)pNew)->pChangedFmt == (void*)GetRegisteredIn() &&
+ ((SwFmtChg*)pNew)->pChangedFmt->IsA( TYPE( SwSectionFmt )) )
+ {
+ // mein Parent wird veraendert, muss mich aktualisieren
+ SwFrmFmt::Modify( pOld, pNew ); // erst umhaengen !!!
+ UpdateParent();
+ return;
+ }
+ break;
+ }
+ SwFrmFmt::Modify( pOld, pNew );
+
+ if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
+ { // invalidate cached uno object
+ SetXTextSection(uno::Reference<text::XTextSection>(0));
+ }
+}
+
+ // erfrage vom Format Informationen
+sal_Bool SwSectionFmt::GetInfo( SfxPoolItem& rInfo ) const
+{
+ switch( rInfo.Which() )
+ {
+ case RES_FINDNEARESTNODE:
+ if( ((SwFmtPageDesc&)GetFmtAttr( RES_PAGEDESC )).GetPageDesc() )
+ {
+ const SwSectionNode* pNd = GetSectionNode();
+ if( pNd )
+ ((SwFindNearestNode&)rInfo).CheckNode( *pNd );
+ }
+ return sal_True;
+
+ case RES_CONTENT_VISIBLE:
+ {
+ SwFrm* pFrm = SwIterator<SwFrm,SwFmt>::FirstElement(*this);
+ // if the current section has no own frame search for the children
+ if(!pFrm)
+ {
+ SwIterator<SwSectionFmt,SwSectionFmt> aFormatIter(*this);
+ SwSectionFmt* pChild = aFormatIter.First();
+ while(pChild && !pFrm)
+ {
+ pFrm = SwIterator<SwFrm,SwFmt>::FirstElement(*pChild);
+ pChild = aFormatIter.Next();
+ }
+ }
+ ((SwPtrMsgPoolItem&)rInfo).pObject = pFrm;
+ }
+ return sal_False;
+ }
+ return SwModify::GetInfo( rInfo );
+}
+
+extern "C" {
+
+ int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC )
+ _Optlink
+#endif
+ lcl_SectionCmpPos( const void *pFirst, const void *pSecond)
+ {
+ const SwSectionFmt* pFSectFmt = (*(SwSectionPtr*)pFirst)->GetFmt();
+ const SwSectionFmt* pSSectFmt = (*(SwSectionPtr*)pSecond)->GetFmt();
+ ASSERT( pFSectFmt && pSSectFmt &&
+ pFSectFmt->GetCntnt(sal_False).GetCntntIdx() &&
+ pSSectFmt->GetCntnt(sal_False).GetCntntIdx(),
+ "ungueltige Sections" );
+ return (int)((long)pFSectFmt->GetCntnt(sal_False).GetCntntIdx()->GetIndex()) -
+ pSSectFmt->GetCntnt(sal_False).GetCntntIdx()->GetIndex();
+ }
+
+ int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC )
+ _Optlink
+#endif
+ lcl_SectionCmpNm( const void *pFirst, const void *pSecond)
+ {
+ const SwSectionPtr pFSect = *(SwSectionPtr*)pFirst;
+ const SwSectionPtr pSSect = *(SwSectionPtr*)pSecond;
+ ASSERT( pFSect && pSSect, "ungueltige Sections" );
+ StringCompare const eCmp =
+ pFSect->GetSectionName().CompareTo( pSSect->GetSectionName() );
+ return eCmp == COMPARE_EQUAL ? 0
+ : eCmp == COMPARE_LESS ? 1 : -1;
+ }
+}
+
+ // alle Sections, die von dieser abgeleitet sind
+sal_uInt16 SwSectionFmt::GetChildSections( SwSections& rArr,
+ SectionSort eSort,
+ sal_Bool bAllSections ) const
+{
+ rArr.Remove( 0, rArr.Count() );
+
+ if( GetDepends() )
+ {
+ SwIterator<SwSectionFmt,SwSectionFmt> aIter(*this);
+ const SwNodeIndex* pIdx;
+ for( SwSectionFmt* pLast = aIter.First(); pLast; pLast = aIter.Next() )
+ if( bAllSections ||
+ ( 0 != ( pIdx = pLast->GetCntnt(sal_False).
+ GetCntntIdx()) && &pIdx->GetNodes() == &GetDoc()->GetNodes() ))
+ {
+ const SwSection* Dummy = pLast->GetSection();
+ rArr.C40_INSERT( SwSection,
+ Dummy,
+ rArr.Count() );
+ }
+
+ // noch eine Sortierung erwuenscht ?
+ if( 1 < rArr.Count() )
+ switch( eSort )
+ {
+ case SORTSECT_NAME:
+ qsort( (void*)rArr.GetData(),
+ rArr.Count(),
+ sizeof( SwSectionPtr ),
+ lcl_SectionCmpNm );
+ break;
+
+ case SORTSECT_POS:
+ qsort( (void*)rArr.GetData(),
+ rArr.Count(),
+ sizeof( SwSectionPtr ),
+ lcl_SectionCmpPos );
+ break;
+ case SORTSECT_NOT: break;
+ }
+ }
+ return rArr.Count();
+}
+
+ // erfrage, ob sich die Section im Nodes-Array oder UndoNodes-Array
+ // befindet.
+sal_Bool SwSectionFmt::IsInNodesArr() const
+{
+ const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx();
+ return pIdx && &pIdx->GetNodes() == &GetDoc()->GetNodes();
+}
+
+
+void SwSectionFmt::UpdateParent() // Parent wurde veraendert
+{
+ if( !GetDepends() )
+ return;
+
+ SwSectionPtr pSection = 0;
+ const SvxProtectItem* pProtect(0);
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ const SwFmtEditInReadonly* pEditInReadonly = 0;
+ // <--
+ bool bIsHidden = false;
+
+ SwClientIter aIter( *this ); // TODO
+ ::SwClient * pLast = aIter.GoStart();
+ if( pLast ) // konnte zum Anfang gesprungen werden ??
+ do {
+ if( pLast->IsA( TYPE(SwSectionFmt) ) )
+ {
+ if( !pSection )
+ {
+ pSection = GetSection();
+ if( GetRegisteredIn() )
+ {
+ const SwSectionPtr pPS = GetParentSection();
+ pProtect = &pPS->GetFmt()->GetProtect();
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly();
+ // <--
+ bIsHidden = pPS->IsHiddenFlag();
+ }
+ else
+ {
+ pProtect = &GetProtect();
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ pEditInReadonly = &GetEditInReadonly();
+ // <--
+ bIsHidden = pSection->IsHidden();
+ }
+ }
+ if (!pProtect->IsCntntProtected() !=
+ !pSection->IsProtectFlag())
+ {
+ pLast->ModifyNotification( (SfxPoolItem*)pProtect,
+ (SfxPoolItem*)pProtect );
+ }
+
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ if (!pEditInReadonly->GetValue() !=
+ !pSection->IsEditInReadonlyFlag())
+ {
+ pLast->ModifyNotification( (SfxPoolItem*)pEditInReadonly,
+ (SfxPoolItem*)pEditInReadonly );
+ }
+ // <--
+
+ if( bIsHidden == pSection->IsHiddenFlag() )
+ {
+ SwMsgPoolItem aMsgItem( static_cast<sal_uInt16>(bIsHidden
+ ? RES_SECTION_HIDDEN
+ : RES_SECTION_NOT_HIDDEN ) );
+ pLast->ModifyNotification( &aMsgItem, &aMsgItem );
+ }
+ }
+ else if( !pSection &&
+ pLast->IsA( TYPE(SwSection) ) )
+ {
+ pSection = (SwSectionPtr)pLast;
+ if( GetRegisteredIn() )
+ {
+ const SwSectionPtr pPS = GetParentSection();
+ pProtect = &pPS->GetFmt()->GetProtect();
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly();
+ // <--
+ bIsHidden = pPS->IsHiddenFlag();
+ }
+ else
+ {
+ pProtect = &GetProtect();
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ pEditInReadonly = &GetEditInReadonly();
+ // <--
+ bIsHidden = pSection->IsHidden();
+ }
+ }
+ } while( 0 != ( pLast = aIter++ ));
+}
+
+
+SwSectionNode* SwSectionFmt::GetSectionNode(bool const bAlways)
+{
+ const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx();
+ if( pIdx && ( bAlways || &pIdx->GetNodes() == &GetDoc()->GetNodes() ))
+ return pIdx->GetNode().GetSectionNode();
+ return 0;
+}
+
+ // ist die Section eine gueltige fuers GlobalDocument?
+const SwSection* SwSectionFmt::GetGlobalDocSection() const
+{
+ const SwSectionNode* pNd = GetSectionNode();
+ if( pNd &&
+ ( FILE_LINK_SECTION == pNd->GetSection().GetType() ||
+ TOX_CONTENT_SECTION == pNd->GetSection().GetType() ) &&
+ pNd->GetIndex() > pNd->GetNodes().GetEndOfExtras().GetIndex() &&
+ !pNd->StartOfSectionNode()->IsSectionNode() &&
+ !pNd->StartOfSectionNode()->FindSectionNode() )
+ return &pNd->GetSection();
+ return 0;
+}
+
+// sw::Metadatable
+::sfx2::IXmlIdRegistry& SwSectionFmt::GetRegistry()
+{
+ return GetDoc()->GetXmlIdRegistry();
+}
+
+bool SwSectionFmt::IsInClipboard() const
+{
+ return GetDoc()->IsClipBoard();
+}
+
+bool SwSectionFmt::IsInUndo() const
+{
+ return !IsInNodesArr();
+}
+
+bool SwSectionFmt::IsInContent() const
+{
+ SwNodeIndex const*const pIdx = GetCntnt(sal_False).GetCntntIdx();
+ OSL_ENSURE(pIdx, "SwSectionFmt::IsInContent: no index?");
+ return (pIdx) ? !GetDoc()->IsInHeaderFooter(*pIdx) : true;
+}
+
+// n.b.: if the section format represents an index, then there is both a
+// SwXDocumentIndex and a SwXTextSection instance for this single core object.
+// these two can both implement XMetadatable and forward to the same core
+// section format. but here only one UNO object can be returned,
+// so always return the text section.
+uno::Reference< rdf::XMetadatable >
+SwSectionFmt::MakeUnoObject()
+{
+ uno::Reference<rdf::XMetadatable> xMeta;
+ SwSection *const pSection( GetSection() );
+ if (pSection)
+ {
+ xMeta.set( SwXTextSection::CreateXTextSection(this,
+ TOX_HEADER_SECTION == pSection->GetType()),
+ uno::UNO_QUERY );
+ }
+ return xMeta;
+}
+
+
+// --> OD 2007-02-14 #b6521322#
+// Method to break section links inside a linked section
+void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd )
+{
+ if ( !rSectNd.GetDoc() )
+ {
+ ASSERT( false,
+ "method <lcl_RemoveSectionLinksInSect(..)> - no Doc at SectionNode" );
+ return;
+ }
+
+ if ( !rSectNd.GetSection().IsConnected() )
+ {
+ ASSERT( false,
+ "method <lcl_RemoveSectionLinksInSect(..)> - no Link at Section of SectionNode" );
+ return;
+ }
+ const ::sfx2::SvBaseLink* pOwnLink( &(rSectNd.GetSection().GetBaseLink() ) );
+ const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->GetLinkManager().GetLinks();
+ for ( sal_uInt16 n = rLnks.Count(); n > 0; )
+ {
+ SwIntrnlSectRefLink* pSectLnk = dynamic_cast<SwIntrnlSectRefLink*>(&(*rLnks[ --n ]));
+ if ( pSectLnk && pSectLnk != pOwnLink &&
+ pSectLnk->IsInRange( rSectNd.GetIndex(), rSectNd.EndOfSectionIndex() ) )
+ {
+ // break the link of the corresponding section.
+ // the link is also removed from the link manager
+ pSectLnk->GetSectNode()->GetSection().BreakLink();
+
+ // for robustness, because link is removed from the link manager
+ if ( n > rLnks.Count() )
+ {
+ n = rLnks.Count();
+ }
+ }
+ }
+}
+// <--
+
+void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
+{
+ SwDoc* pDoc = rSectNd.GetDoc();
+ SwDocShell* pDShell = pDoc->GetDocShell();
+ if( !pDShell || !pDShell->GetMedium() )
+ return ;
+
+ String sName( pDShell->GetMedium()->GetName() );
+ SwBaseLink* pBLink;
+ String sMimeType( SotExchange::GetFormatMimeType( FORMAT_FILE ));
+ uno::Any aValue;
+ aValue <<= ::rtl::OUString( sName ); // beliebiger Name
+
+ const ::sfx2::SvBaseLinks& rLnks = pDoc->GetLinkManager().GetLinks();
+ for( sal_uInt16 n = rLnks.Count(); n; )
+ {
+ ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
+ if( pLnk && pLnk != &rUpdLnk &&
+ OBJECT_CLIENT_FILE == pLnk->GetObjType() &&
+ pLnk->ISA( SwBaseLink ) &&
+ ( pBLink = (SwBaseLink*)pLnk )->IsInRange( rSectNd.GetIndex(),
+ rSectNd.EndOfSectionIndex() ) )
+ {
+ // liegt in dem Bereich: also updaten. Aber nur wenns nicht
+ // im gleichen File liegt
+ String sFName;
+ pDoc->GetLinkManager().GetDisplayNames( pBLink, 0, &sFName, 0, 0 );
+ if( sFName != sName )
+ {
+ pBLink->DataChanged( sMimeType, aValue );
+
+ // ggfs. neu den Link-Pointer wieder suchen, damit nicht einer
+ // ausgelassen oder doppelt gerufen wird.
+ if( n >= rLnks.Count() && 0 != ( n = rLnks.Count() ))
+ --n;
+
+ if( n && pLnk != &(*rLnks[ n ]) )
+ {
+ // suchen - kann nur davor liegen!!
+ while( n )
+ if( pLnk == &(*rLnks[ --n ] ) )
+ break;
+ }
+ }
+ }
+ }
+}
+
+
+// sucht sich die richtige DocShell raus oder erzeugt eine neue:
+// Der Return-Wert gibt an, was mit der Shell zu geschehen hat:
+// 0 - Fehler, konnte DocShell nicht finden
+// 1 - DocShell ist ein existieren Document
+// 2 - DocShell wurde neu angelegt, muss also wieder geschlossen werden ( will be assigned to xLockRef additionaly )
+
+int lcl_FindDocShell( SfxObjectShellRef& xDocSh,
+ SfxObjectShellLock& xLockRef,
+ const String& rFileName,
+ const String& rPasswd,
+ String& rFilter,
+ sal_Int16 nVersion,
+ SwDocShell* pDestSh )
+{
+ if( !rFileName.Len() )
+ return 0;
+
+ // 1. existiert die Datei schon in der Liste aller Dokumente?
+ INetURLObject aTmpObj( rFileName );
+ aTmpObj.SetMark( aEmptyStr );
+
+ // erstmal nur ueber die DocumentShells laufen und die mit dem
+ // Namen heraussuchen:
+ TypeId aType( TYPE(SwDocShell) );
+
+ SfxObjectShell* pShell = pDestSh;
+ sal_Bool bFirst = 0 != pShell;
+
+ if( !bFirst )
+ // keine DocShell uebergeben, also beginne mit der ersten aus der
+ // DocShell Liste
+ pShell = SfxObjectShell::GetFirst( &aType );
+
+ while( pShell )
+ {
+ // die wollen wir haben
+ SfxMedium* pMed = pShell->GetMedium();
+ if( pMed && pMed->GetURLObject() == aTmpObj )
+ {
+ const SfxPoolItem* pItem;
+ if( ( SFX_ITEM_SET == pMed->GetItemSet()->GetItemState(
+ SID_VERSION, sal_False, &pItem ) )
+ ? (nVersion == ((SfxInt16Item*)pItem)->GetValue())
+ : !nVersion )
+ {
+ // gefunden also returnen
+ xDocSh = pShell;
+ return 1;
+ }
+ }
+
+ if( bFirst )
+ {
+ bFirst = sal_False;
+ pShell = SfxObjectShell::GetFirst( &aType );
+ }
+ else
+ pShell = SfxObjectShell::GetNext( *pShell, &aType );
+ }
+
+ // 2. selbst die Date oeffnen
+ SfxMedium* pMed = new SfxMedium( aTmpObj.GetMainURL(
+ INetURLObject::NO_DECODE ), STREAM_READ, sal_True );
+ if( INET_PROT_FILE == aTmpObj.GetProtocol() )
+ pMed->DownLoad(); // nur mal das Medium anfassen (DownLoaden)
+
+ const SfxFilter* pSfxFlt = 0;
+ if( !pMed->GetError() )
+ {
+ String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName()));
+ SfxFilterMatcher aMatcher( sFactory );
+
+ // kein Filter, dann suche ihn. Ansonsten teste, ob der angegebene
+ // ein gueltiger ist
+ if( rFilter.Len() )
+ {
+ pSfxFlt = aMatcher.GetFilter4FilterName( rFilter );
+ }
+
+ if( nVersion )
+ pMed->GetItemSet()->Put( SfxInt16Item( SID_VERSION, nVersion ));
+
+ if( rPasswd.Len() )
+ pMed->GetItemSet()->Put( SfxStringItem( SID_PASSWORD, rPasswd ));
+
+ if( !pSfxFlt )
+ aMatcher.DetectFilter( *pMed, &pSfxFlt, sal_False, sal_False );
+
+ if( pSfxFlt )
+ {
+ // ohne Filter geht gar nichts
+ pMed->SetFilter( pSfxFlt );
+
+ // if the new shell is created, SfxObjectShellLock should be used to let it be closed later for sure
+ xLockRef = new SwDocShell( SFX_CREATE_MODE_INTERNAL );
+ xDocSh = (SfxObjectShell*)xLockRef;
+ if( xDocSh->DoLoad( pMed ) )
+ return 2;
+ }
+ }
+
+ if( !xDocSh.Is() ) // Medium muss noch geloescht werden
+ delete pMed;
+
+ return 0; // das war wohl nichts
+}
+
+
+void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
+ const uno::Any & rValue )
+{
+ SwSectionNode* pSectNd = rSectFmt.GetSectionNode( sal_False );
+ SwDoc* pDoc = rSectFmt.GetDoc();
+
+ sal_uLong nDataFormat = SotExchange::GetFormatIdFromMimeType( rMimeType );
+
+ if( !pSectNd || !pDoc || pDoc->IsInDtor() || ChkNoDataFlag() ||
+ sfx2::LinkManager::RegisterStatusInfoId() == nDataFormat )
+ {
+ // sollten wir schon wieder im Undo stehen?
+ return ;
+ }
+
+ // --> OD 2005-02-11 #i38810# - Due to possible existing signatures, the
+ // document has to be modified after updating a link.
+ pDoc->SetModified();
+ // set additional flag that links have been updated, in order to check this
+ // during load.
+ pDoc->SetLinksUpdated( sal_True );
+ // <--
+
+ // Undo immer abschalten
+ bool const bWasUndo = pDoc->GetIDocumentUndoRedo().DoesUndo();
+ pDoc->GetIDocumentUndoRedo().DoUndo(false);
+ sal_Bool bWasVisibleLinks = pDoc->IsVisibleLinks();
+ pDoc->SetVisibleLinks( sal_False );
+
+ SwPaM* pPam;
+ ViewShell* pVSh = 0;
+ SwEditShell* pESh = pDoc->GetEditShell( &pVSh );
+ pDoc->LockExpFlds();
+ {
+ // am Anfang des Bereichs einen leeren TextNode einfuegen
+ SwNodeIndex aIdx( *pSectNd, +1 );
+ SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() );
+ SwTxtNode* pNewNd = pDoc->GetNodes().MakeTxtNode( aIdx,
+ pDoc->GetTxtCollFromPool( RES_POOLCOLL_TEXT ) );
+
+ if( pESh )
+ pESh->StartAllAction();
+ else if( pVSh )
+ pVSh->StartAction();
+
+ SwPosition aPos( aIdx, SwIndex( pNewNd, 0 ));
+ aPos.nNode--;
+ pDoc->CorrAbs( aIdx, aEndIdx, aPos, sal_True );
+
+ pPam = new SwPaM( aPos );
+
+ //und alles dahinter liegende loeschen
+ aIdx--;
+ DelFlyInRange( aIdx, aEndIdx );
+ _DelBookmarks(aIdx, aEndIdx);
+ aIdx++;
+
+ pDoc->GetNodes().Delete( aIdx, aEndIdx.GetIndex() - aIdx.GetIndex() );
+ }
+
+ SwSection& rSection = pSectNd->GetSection();
+ rSection.SetConnectFlag(false);
+
+ ::rtl::OUString sNewFileName;
+ Reader* pRead = 0;
+ switch( nDataFormat )
+ {
+ case FORMAT_STRING:
+ pRead = ReadAscii;
+ break;
+
+ case FORMAT_RTF:
+ pRead = SwReaderWriter::GetReader( READER_WRITER_RTF );
+ break;
+
+ case FORMAT_FILE:
+ if( rValue.hasValue() && ( rValue >>= sNewFileName ) )
+ {
+ String sFilter, sRange, sFileName( sNewFileName );
+ pDoc->GetLinkManager().GetDisplayNames( this, 0, &sFileName,
+ &sRange, &sFilter );
+
+ RedlineMode_t eOldRedlineMode = nsRedlineMode_t::REDLINE_NONE;
+ SfxObjectShellRef xDocSh;
+ SfxObjectShellLock xLockRef;
+ int nRet;
+ if( !sFileName.Len() )
+ {
+ xDocSh = pDoc->GetDocShell();
+ nRet = 1;
+ }
+ else
+ {
+ nRet = lcl_FindDocShell( xDocSh, xLockRef, sFileName,
+ rSection.GetLinkFilePassword(),
+ sFilter, 0, pDoc->GetDocShell() );
+ if( nRet )
+ {
+ SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
+ eOldRedlineMode = pSrcDoc->GetRedlineMode();
+ pSrcDoc->SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT );
+ }
+ }
+
+ if( nRet )
+ {
+ rSection.SetConnectFlag(true);
+
+ SwNodeIndex aSave( pPam->GetPoint()->nNode, -1 );
+ SwNodeRange* pCpyRg = 0;
+
+ if( xDocSh->GetMedium() &&
+ !rSection.GetLinkFilePassword().Len() )
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == xDocSh->GetMedium()->GetItemSet()->
+ GetItemState( SID_PASSWORD, sal_False, &pItem ) )
+ rSection.SetLinkFilePassword(
+ ((SfxStringItem*)pItem)->GetValue() );
+ }
+
+ SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
+
+ if( sRange.Len() )
+ {
+ // Rekursionen abfangen
+ sal_Bool bRecursion = sal_False;
+ if( pSrcDoc == pDoc )
+ {
+ SwServerObjectRef refObj( (SwServerObject*)
+ pDoc->CreateLinkSource( sRange ));
+ if( refObj.Is() )
+ {
+ bRecursion = refObj->IsLinkInServer( this ) ||
+ ChkNoDataFlag();
+ }
+ }
+
+ SwNodeIndex& rInsPos = pPam->GetPoint()->nNode;
+
+ SwPaM* pCpyPam = 0;
+ if( !bRecursion &&
+ pSrcDoc->SelectServerObj( sRange, pCpyPam, pCpyRg )
+ && pCpyPam )
+ {
+ if( pSrcDoc != pDoc ||
+ pCpyPam->Start()->nNode > rInsPos ||
+ rInsPos >= pCpyPam->End()->nNode )
+ {
+ pSrcDoc->CopyRange( *pCpyPam, *pPam->GetPoint(),
+ false );
+ }
+ delete pCpyPam;
+ }
+ if( pCpyRg && pSrcDoc == pDoc &&
+ pCpyRg->aStart < rInsPos && rInsPos < pCpyRg->aEnd )
+ delete pCpyRg, pCpyRg = 0;
+ }
+ else if( pSrcDoc != pDoc )
+ pCpyRg = new SwNodeRange( pSrcDoc->GetNodes().GetEndOfExtras(), 2,
+ pSrcDoc->GetNodes().GetEndOfContent() );
+
+ // --> OD 2007-11-30 #i81653#
+ // Update links of extern linked document or extern linked
+ // document section, if section is protected.
+ if ( pSrcDoc != pDoc &&
+ rSection.IsProtectFlag() )
+ {
+ pSrcDoc->GetLinkManager().UpdateAllLinks( sal_False, sal_True, sal_False, 0 );
+ }
+ // <--
+ if( pCpyRg )
+ {
+ SwNodeIndex& rInsPos = pPam->GetPoint()->nNode;
+ sal_Bool bCreateFrm = rInsPos.GetIndex() <=
+ pDoc->GetNodes().GetEndOfExtras().GetIndex() ||
+ rInsPos.GetNode().FindTableNode();
+
+ SwTblNumFmtMerge aTNFM( *pSrcDoc, *pDoc );
+
+ pSrcDoc->CopyWithFlyInFly( *pCpyRg, 0, rInsPos, bCreateFrm );
+ aSave++;
+
+ if( !bCreateFrm )
+ ::MakeFrms( pDoc, aSave, rInsPos );
+
+ // den letzten Node noch loeschen, aber nur wenn
+ // erfolgreich kopiert werden konnte, also der Bereich
+ // mehr als 1 Node enthaelt
+ if( 2 < pSectNd->EndOfSectionIndex() - pSectNd->GetIndex() )
+ {
+ aSave = rInsPos;
+ pPam->Move( fnMoveBackward, fnGoNode );
+ pPam->SetMark(); // beide SwPositions ummelden!
+
+ pDoc->CorrAbs( aSave, *pPam->GetPoint(), 0, sal_True );
+ pDoc->GetNodes().Delete( aSave, 1 );
+ }
+ delete pCpyRg;
+ }
+
+ // --> OD 2007-02-14 #b6521322#
+ lcl_BreakSectionLinksInSect( *pSectNd );
+ // <--
+
+ // update alle Links in diesem Bereich
+ lcl_UpdateLinksInSect( *this, *pSectNd );
+ }
+ if( xDocSh.Is() )
+ {
+ if( 2 == nRet )
+ xDocSh->DoClose();
+ else if( ((SwDocShell*)&xDocSh)->GetDoc() )
+ ((SwDocShell*)&xDocSh)->GetDoc()->SetRedlineMode(
+ eOldRedlineMode );
+ }
+ }
+ break;
+ }
+
+ // !!!! DDE nur updaten wenn Shell vorhanden ist??
+ uno::Sequence< sal_Int8 > aSeq;
+ if( pRead && rValue.hasValue() && ( rValue >>= aSeq ) )
+ {
+ if( pESh )
+ {
+ pESh->Push();
+ SwPaM* pCrsr = pESh->GetCrsr();
+ *pCrsr->GetPoint() = *pPam->GetPoint();
+ delete pPam;
+ pPam = pCrsr;
+ }
+
+ SvMemoryStream aStrm( (void*)aSeq.getConstArray(), aSeq.getLength(),
+ STREAM_READ );
+ aStrm.Seek( 0 );
+
+#if OSL_DEBUG_LEVEL > 1
+ {
+ SvFileStream aDeb( String::CreateFromAscii(
+ "file:///d|/temp/update.txt" ), STREAM_WRITE );
+ aDeb << aStrm;
+ }
+ aStrm.Seek( 0 );
+#endif
+
+ // TODO/MBA: it's impossible to set a BaseURL here!
+ SwReader aTmpReader( aStrm, aEmptyStr, pDoc->GetDocShell()->GetMedium()->GetBaseURL(), *pPam );
+
+ if( !IsError( aTmpReader.Read( *pRead ) ))
+ {
+ rSection.SetConnectFlag(true);
+ }
+
+ if( pESh )
+ {
+ pESh->Pop( sal_False );
+ pPam = 0; // pam is deleted before
+ }
+ }
+
+
+ // remove all undo actions and turn undo on again
+ pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
+ pDoc->GetIDocumentUndoRedo().DoUndo(bWasUndo);
+ pDoc->SetVisibleLinks( bWasVisibleLinks );
+
+ pDoc->UnlockExpFlds();
+ if( !pDoc->IsExpFldsLocked() )
+ pDoc->UpdateExpFlds(NULL, true);
+
+ if( pESh )
+ pESh->EndAllAction();
+ else if( pVSh )
+ pVSh->EndAction();
+ delete pPam; // wurde am Anfang angelegt
+}
+
+
+void SwIntrnlSectRefLink::Closed()
+{
+ SwDoc* pDoc = rSectFmt.GetDoc();
+ if( pDoc && !pDoc->IsInDtor() )
+ {
+ // Advise verabschiedet sich, den Bereich als nicht geschuetzt
+ // kennzeichnen und das Flag umsetzen
+
+ const SwSectionFmts& rFmts = pDoc->GetSections();
+ for( sal_uInt16 n = rFmts.Count(); n; )
+ if( rFmts[ --n ] == &rSectFmt )
+ {
+ ViewShell* pSh;
+ SwEditShell* pESh = pDoc->GetEditShell( &pSh );
+
+ if( pESh )
+ pESh->StartAllAction();
+ else
+ pSh->StartAction();
+
+ SwSectionData aSectionData(*rSectFmt.GetSection());
+ aSectionData.SetType( CONTENT_SECTION );
+ aSectionData.SetLinkFileName( aEmptyStr );
+ aSectionData.SetHidden( false );
+ aSectionData.SetProtectFlag( false );
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aSectionData.SetEditInReadonlyFlag( false );
+ // <--
+
+ aSectionData.SetConnectFlag( false );
+
+ pDoc->UpdateSection( n, aSectionData );
+
+ // alle in der Section liegenden Links werden sichtbar
+ SwSectionNode* pSectNd = rSectFmt.GetSectionNode( sal_False );
+ if( pSectNd )
+ pSectNd->GetSection().MakeChildLinksVisible( *pSectNd );
+
+ if( pESh )
+ pESh->EndAllAction();
+ else
+ pSh->EndAction();
+ break;
+ }
+ }
+ SvBaseLink::Closed();
+}
+
+
+void SwSection::CreateLink( LinkCreateType eCreateType )
+{
+ SwSectionFmt* pFmt = GetFmt();
+ ASSERT(pFmt, "SwSection::CreateLink: no format?");
+ if (!pFmt || (CONTENT_SECTION == m_Data.GetType()))
+ return ;
+
+ sal_uInt16 nUpdateType = sfx2::LINKUPDATE_ALWAYS;
+
+ if (!m_RefLink.Is())
+ {
+ // create BaseLink
+ m_RefLink = new SwIntrnlSectRefLink( *pFmt, nUpdateType, FORMAT_RTF );
+ }
+ else
+ {
+ pFmt->GetDoc()->GetLinkManager().Remove( m_RefLink );
+ }
+
+ SwIntrnlSectRefLink *const pLnk =
+ static_cast<SwIntrnlSectRefLink*>(& m_RefLink);
+
+ String sCmd( m_Data.GetLinkFileName() );
+ xub_StrLen nPos;
+ while( STRING_NOTFOUND != (nPos = sCmd.SearchAscii( " " )) )
+ sCmd.Erase( nPos, 1 );
+
+ pLnk->SetUpdateMode( nUpdateType );
+ pLnk->SetVisible( pFmt->GetDoc()->IsVisibleLinks() );
+
+ switch (m_Data.GetType())
+ {
+ case DDE_LINK_SECTION:
+ pLnk->SetLinkSourceName( sCmd );
+ pFmt->GetDoc()->GetLinkManager().InsertDDELink( pLnk );
+ break;
+ case FILE_LINK_SECTION:
+ {
+ pLnk->SetContentType( FORMAT_FILE );
+ String sFltr( sCmd.GetToken( 1, sfx2::cTokenSeperator ) );
+ String sRange( sCmd.GetToken( 2, sfx2::cTokenSeperator ) );
+ pFmt->GetDoc()->GetLinkManager().InsertFileLink( *pLnk,
+ static_cast<sal_uInt16>(m_Data.GetType()),
+ sCmd.GetToken( 0, sfx2::cTokenSeperator ),
+ ( sFltr.Len() ? &sFltr : 0 ),
+ ( sRange.Len() ? &sRange : 0 ) );
+ }
+ break;
+ default:
+ ASSERT( !this, "Was ist das fuer ein Link?" )
+ }
+
+ switch( eCreateType )
+ {
+ case CREATE_CONNECT: // Link gleich connecten
+ pLnk->Connect();
+ break;
+
+ case CREATE_UPDATE: // Link connecten und updaten
+ pLnk->Update();
+ break;
+ case CREATE_NONE: break;
+ }
+}
+
+// --> OD 2007-02-14 #b6521322#
+void SwSection::BreakLink()
+{
+ const SectionType eCurrentType( GetType() );
+ if ( eCurrentType == CONTENT_SECTION ||
+ eCurrentType == TOX_HEADER_SECTION ||
+ eCurrentType == TOX_CONTENT_SECTION )
+ {
+ // nothing to do
+ return;
+ }
+
+ // release link, if it exists
+ if (m_RefLink.Is())
+ {
+ SwSectionFmt *const pFormat( GetFmt() );
+ ASSERT(pFormat, "SwSection::BreakLink: no format?");
+ if (pFormat)
+ {
+ pFormat->GetDoc()->GetLinkManager().Remove( m_RefLink );
+ }
+ m_RefLink.Clear();
+ }
+ // change type
+ SetType( CONTENT_SECTION );
+ // reset linked file data
+ SetLinkFileName( aEmptyStr );
+ SetLinkFilePassword( aEmptyStr );
+}
+// <--
+
+const SwNode* SwIntrnlSectRefLink::GetAnchor() const
+{
+ return rSectFmt.GetSectionNode( sal_False );
+}
+
+
+sal_Bool SwIntrnlSectRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd,
+ xub_StrLen , xub_StrLen ) const
+{
+ SwStartNode* pSttNd = rSectFmt.GetSectionNode( sal_False );
+ return pSttNd &&
+ nSttNd < pSttNd->GetIndex() &&
+ pSttNd->EndOfSectionIndex() < nEndNd;
+}
+
+
+
diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx
new file mode 100644
index 000000000000..d34f60952e2f
--- /dev/null
+++ b/sw/source/core/docnode/swbaslnk.cxx
@@ -0,0 +1,503 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+
+#include <osl/thread.hxx>
+#include <salhelper/condition.hxx>
+#include <comphelper/mediadescriptor.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/objsh.hxx>
+#include <editeng/boxitem.hxx>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc> // fuer die EventIds
+#endif
+#include <sfx2/linkmgr.hxx>
+#include <svtools/soerr.hxx>
+#include <fmtfsize.hxx>
+#include <fmtanchr.hxx>
+#include <frmatr.hxx>
+#include <frmfmt.hxx>
+#include <doc.hxx>
+#include <pam.hxx>
+#include <editsh.hxx>
+#include <swtable.hxx>
+#include <docary.hxx>
+#include <swevent.hxx>
+#include <swbaslnk.hxx>
+#include <swserv.hxx>
+#include <ndgrf.hxx>
+#include <ndole.hxx>
+#include <hints.hxx>
+#include <tabfrm.hxx>
+#include <cntfrm.hxx>
+#include <htmltbl.hxx>
+
+using namespace com::sun::star;
+
+sal_Bool SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd );
+
+TYPEINIT1( SwBaseLink, ::sfx2::SvBaseLink );
+
+SV_IMPL_REF( SwServerObject )
+
+void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
+{
+ //JP 4.7.2001: call fist all not SwNoTxtFrames, then the SwNoTxtFrames.
+ // The reason is, that in the SwNoTxtFrames the Graphic
+ // after a Paint will be swapped out! So all other "behind"
+ // them havent't a loaded Graphic. - #86501#
+ rGrfNd.LockModify();
+
+ SwClientIter aIter( rGrfNd ); // TODO
+ for( int n = 0; n < 2; ++n )
+ {
+ SwClient * pLast = aIter.GoStart();
+ if( pLast ) // konnte zum Anfang gesprungen werden ??
+ {
+ do {
+ if( (0 == n) ^ ( 0 != pLast->ISA( SwCntntFrm )) )
+ pLast->ModifyNotification( &rItem, &rItem );
+ } while( 0 != ( pLast = aIter++ ));
+ }
+ }
+ rGrfNd.UnlockModify();
+}
+
+
+void SwBaseLink::DataChanged( const String& rMimeType,
+ const uno::Any & rValue )
+{
+ if( !pCntntNode )
+ {
+ ASSERT(!this, "DataChanged ohne ContentNode" );
+ return ;
+ }
+
+ SwDoc* pDoc = pCntntNode->GetDoc();
+ if( pDoc->IsInDtor() || ChkNoDataFlag() || bIgnoreDataChanged )
+ {
+ bIgnoreDataChanged = sal_False;
+ return ;
+ }
+
+ sal_uLong nFmt = SotExchange::GetFormatIdFromMimeType( rMimeType );
+
+ if( pCntntNode->IsNoTxtNode() &&
+ nFmt == sfx2::LinkManager::RegisterStatusInfoId() )
+ {
+ // nur eine Statusaenderung - Events bedienen ?
+ ::rtl::OUString sState;
+ if( rValue.hasValue() && ( rValue >>= sState ))
+ {
+ sal_uInt16 nEvent = 0;
+ switch( sState.toInt32() )
+ {
+ case sfx2::LinkManager::STATE_LOAD_OK: nEvent = SVX_EVENT_IMAGE_LOAD; break;
+ case sfx2::LinkManager::STATE_LOAD_ERROR: nEvent = SVX_EVENT_IMAGE_ERROR; break;
+ case sfx2::LinkManager::STATE_LOAD_ABORT: nEvent = SVX_EVENT_IMAGE_ABORT; break;
+ }
+
+ SwFrmFmt* pFmt;
+ if( nEvent && 0 != ( pFmt = pCntntNode->GetFlyFmt() ))
+ {
+ SwCallMouseEvent aCallEvent;
+ aCallEvent.Set( EVENT_OBJECT_IMAGE, pFmt );
+ pDoc->CallEvent( nEvent, aCallEvent );
+ }
+ }
+ return; // das wars!
+ }
+
+ sal_Bool bUpdate = sal_False;
+ sal_Bool bGraphicArrived = sal_False;
+ sal_Bool bGraphicPieceArrived = sal_False;
+ sal_Bool bDontNotify = sal_False;
+ Size aGrfSz, aFrmFmtSz;
+
+ if( pCntntNode->IsGrfNode() )
+ {
+ GraphicObject& rGrfObj = ((SwGrfNode*)pCntntNode)->GetGrfObj();
+
+ bDontNotify = ((SwGrfNode*)pCntntNode)->IsFrameInPaint();
+
+ bGraphicArrived = GetObj()->IsDataComplete();
+ bGraphicPieceArrived = GetObj()->IsPending();
+ ((SwGrfNode*)pCntntNode)->SetGrafikArrived( bGraphicArrived );
+
+ Graphic aGrf;
+ if( sfx2::LinkManager::GetGraphicFromAny( rMimeType, rValue, aGrf ) &&
+ ( GRAPHIC_DEFAULT != aGrf.GetType() ||
+ GRAPHIC_DEFAULT != rGrfObj.GetType() ) )
+ {
+ aGrfSz = ::GetGraphicSizeTwip( aGrf, 0 );
+ if( static_cast< const SwGrfNode * >( pCntntNode )->IsChgTwipSizeFromPixel() )
+ {
+ const MapMode aMapTwip( MAP_TWIP );
+ aFrmFmtSz =
+ Application::GetDefaultDevice()->PixelToLogic(
+ aGrf.GetSizePixel(), aMapTwip );
+
+ }
+ else
+ {
+ aFrmFmtSz = aGrfSz;
+ }
+ Size aSz( ((SwGrfNode*)pCntntNode)->GetTwipSize() );
+
+ if( bGraphicPieceArrived && GRAPHIC_DEFAULT != aGrf.GetType() &&
+ ( !aSz.Width() || !aSz.Height() ) )
+ {
+ // wenn nur ein Teil ankommt, aber die Groesse nicht
+ // gesetzt ist, dann muss "unten" der Teil von
+ // bGraphicArrived durchlaufen werden!
+ // (ansonten wird die Grafik in deft. Size gepaintet)
+ bGraphicArrived = sal_True;
+ bGraphicPieceArrived = sal_False;
+ }
+
+ rGrfObj.SetGraphic( aGrf, rGrfObj.GetLink() );
+ bUpdate = sal_True;
+
+ // Bug 33999: damit der Node den Transparent-Status
+ // richtig gesetzt hat, ohne auf die Grafik
+ // zugreifen zu muessen (sonst erfolgt ein SwapIn!).
+ if( bGraphicArrived )
+ {
+ // Bug #34735#: immer mit der korrekten Grafik-Size
+ // arbeiten
+ if( aGrfSz.Height() && aGrfSz.Width() &&
+ aSz.Height() && aSz.Width() &&
+ aGrfSz != aSz )
+ ((SwGrfNode*)pCntntNode)->SetTwipSize( aGrfSz );
+ }
+ }
+ if ( bUpdate && !bGraphicArrived && !bGraphicPieceArrived )
+ ((SwGrfNode*)pCntntNode)->SetTwipSize( Size(0,0) );
+ }
+ else if( pCntntNode->IsOLENode() )
+ bUpdate = sal_True;
+
+ ViewShell *pSh = 0;
+ SwEditShell* pESh = pDoc->GetEditShell( &pSh );
+
+ if ( bUpdate && bGraphicPieceArrived && !(bSwapIn || bDontNotify) )
+ {
+ //Hint ohne Actions verschicken, loest direktes Paint aus.
+ if ( (!pSh || !pSh->ActionPend()) && (!pESh || !pESh->ActionPend()) )
+ {
+ SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
+ pCntntNode->ModifyNotification( &aMsgHint, &aMsgHint );
+ bUpdate = sal_False;
+ }
+ }
+
+ static sal_Bool bInNotifyLinks = sal_False;
+ if( bUpdate && !bDontNotify && (!bSwapIn || bGraphicArrived) &&
+ !bInNotifyLinks)
+ {
+ sal_Bool bLockView = sal_False;
+ if( pSh )
+ {
+ bLockView = pSh->IsViewLocked();
+ pSh->LockView( sal_True );
+ }
+
+ if( pESh )
+ pESh->StartAllAction();
+ else if( pSh )
+ pSh->StartAction();
+
+ SwMsgPoolItem aMsgHint( static_cast<sal_uInt16>(
+ bGraphicArrived ? RES_GRAPHIC_ARRIVED : RES_UPDATE_ATTR ) );
+
+ if ( bGraphicArrived )
+ {
+ //Alle benachrichtigen, die am gleichen Link horchen.
+ bInNotifyLinks = sal_True;
+
+ const ::sfx2::SvBaseLinks& rLnks = pDoc->GetLinkManager().GetLinks();
+ for( sal_uInt16 n = rLnks.Count(); n; )
+ {
+ ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
+ if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() &&
+ pLnk->ISA( SwBaseLink ) && pLnk->GetObj() == GetObj() )
+ {
+ SwBaseLink* pBLink = (SwBaseLink*)pLnk;
+ SwGrfNode* pGrfNd = (SwGrfNode*)pBLink->pCntntNode;
+
+ if( pBLink != this &&
+ ( !bSwapIn ||
+ GRAPHIC_DEFAULT == pGrfNd->GetGrfObj().GetType()))
+ {
+ pBLink->bIgnoreDataChanged = sal_False;
+ pBLink->DataChanged( rMimeType, rValue );
+ pBLink->bIgnoreDataChanged = sal_True;
+
+ pGrfNd->SetGrafikArrived( ((SwGrfNode*)pCntntNode)->
+ IsGrafikArrived() );
+
+ // Fly der Grafik anpassen !
+ if( !::SetGrfFlySize( aGrfSz, aFrmFmtSz, pGrfNd ) )
+ ::lcl_CallModify( *pGrfNd, aMsgHint );
+ }
+ else if( pBLink == this &&
+ !::SetGrfFlySize( aGrfSz, aFrmFmtSz, pGrfNd ) )
+ // Fly der Grafik anpassen !
+ ::lcl_CallModify( *pGrfNd, aMsgHint );
+ }
+ }
+
+ bInNotifyLinks = sal_False;
+ }
+ else
+ {
+ pCntntNode->ModifyNotification( &aMsgHint, &aMsgHint );
+ }
+
+
+ if( pESh )
+ {
+ const sal_Bool bEndActionByVirDev = pESh->IsEndActionByVirDev();
+ pESh->SetEndActionByVirDev( sal_True );
+ pESh->EndAllAction();
+ pESh->SetEndActionByVirDev( bEndActionByVirDev );
+ }
+ else if( pSh )
+ pSh->EndAction();
+
+ if( pSh && !bLockView )
+ pSh->LockView( sal_False );
+ }
+}
+
+sal_Bool SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd )
+{
+ sal_Bool bRet = sal_False;
+ ViewShell *pSh;
+ CurrShell *pCurr = 0;
+ if ( pGrfNd->GetDoc()->GetEditShell( &pSh ) )
+ pCurr = new CurrShell( pSh );
+
+ Size aSz = pGrfNd->GetTwipSize();
+ if ( !(aSz.Width() && aSz.Height()) &&
+ rGrfSz.Width() && rGrfSz.Height() )
+ {
+ SwFrmFmt* pFmt;
+ if( pGrfNd->IsChgTwipSize() &&
+ 0 != (pFmt = pGrfNd->GetFlyFmt()) )
+ {
+ Size aCalcSz( aSz );
+ if ( !aSz.Height() && aSz.Width() )
+ //passende Hoehe ausrechnen.
+ aCalcSz.Height() = rFrmSz.Height() *
+ aSz.Width() / rFrmSz.Width();
+ else if ( !aSz.Width() && aSz.Height() )
+ //passende Breite ausrechnen
+ aCalcSz.Width() = rFrmSz.Width() *
+ aSz.Height() / rFrmSz.Height();
+ else
+ //Hoehe und Breite uebernehmen
+ aCalcSz = rFrmSz;
+
+ const SvxBoxItem &rBox = pFmt->GetBox();
+ aCalcSz.Width() += rBox.CalcLineSpace(BOX_LINE_LEFT) +
+ rBox.CalcLineSpace(BOX_LINE_RIGHT);
+ aCalcSz.Height()+= rBox.CalcLineSpace(BOX_LINE_TOP) +
+ rBox.CalcLineSpace(BOX_LINE_BOTTOM);
+ const SwFmtFrmSize& rOldAttr = pFmt->GetFrmSize();
+ if( rOldAttr.GetSize() != aCalcSz )
+ {
+ SwFmtFrmSize aAttr( rOldAttr );
+ aAttr.SetSize( aCalcSz );
+ pFmt->SetFmtAttr( aAttr );
+ bRet = sal_True;
+ }
+
+ if( !aSz.Width() )
+ {
+ // Wenn die Grafik in einer Tabelle verankert ist, muess
+ // die Tabellen-Spalten neu berechnet werden
+ const SwDoc *pDoc = pGrfNd->GetDoc();
+ const SwPosition* pAPos = pFmt->GetAnchor().GetCntntAnchor();
+ SwNode *pANd;
+ SwTableNode *pTblNd;
+ if( pAPos &&
+ 0 != (pANd = & pAPos->nNode.GetNode()) &&
+ 0 != (pTblNd = pANd->FindTableNode()) )
+ {
+ const sal_Bool bLastGrf = !pTblNd->GetTable().DecGrfsThatResize();
+ SwHTMLTableLayout *pLayout =
+ pTblNd->GetTable().GetHTMLTableLayout();
+ if( pLayout )
+ {
+ const sal_uInt16 nBrowseWidth =
+ pLayout->GetBrowseWidthByTable( *pDoc );
+ if ( nBrowseWidth )
+ {
+ pLayout->Resize( nBrowseWidth, sal_True, sal_True,
+ bLastGrf ? HTMLTABLE_RESIZE_NOW
+ : 500 );
+ }
+ }
+ }
+ }
+ }
+
+ // SetTwipSize skaliert ggf. eine ImageMap neu und
+ // braucht dazu das Frame-Format
+ pGrfNd->SetTwipSize( rGrfSz );
+ }
+
+ delete pCurr;
+
+ return bRet;
+}
+
+
+sal_Bool SwBaseLink::SwapIn( sal_Bool bWaitForData, sal_Bool bNativFormat )
+{
+ bSwapIn = sal_True;
+
+ sal_Bool bRes;
+
+ if( !GetObj() && ( bNativFormat || ( !IsSynchron() && bWaitForData ) ))
+ {
+ AddNextRef();
+ _GetRealObject();
+ ReleaseRef();
+ }
+
+#if OSL_DEBUG_LEVEL > 1
+ {
+ String sGrfNm;
+ if(GetLinkManager())
+ GetLinkManager()->GetDisplayNames( this, 0, &sGrfNm, 0, 0 );
+ int x = 0;
+ ++x;
+ }
+#endif
+
+ if( GetObj() )
+ {
+ String aMimeType( SotExchange::GetFormatMimeType( GetContentType() ));
+ uno::Any aValue;
+ GetObj()->GetData( aValue, aMimeType, !IsSynchron() && bWaitForData );
+
+ if( bWaitForData && !GetObj() )
+ {
+ ASSERT( !this, "das SvxFileObject wurde in einem GetData geloescht!" );
+ bRes = sal_False;
+ }
+ else if( 0 != ( bRes = aValue.hasValue() ) )
+ {
+ //JP 14.04.99: Bug 64820 - das Flag muss beim SwapIn natuerlich
+ // zurueckgesetzt werden. Die Daten sollen ja neu
+ // uebernommen werden
+ bIgnoreDataChanged = sal_False;
+ DataChanged( aMimeType, aValue );
+ }
+ }
+ else if( !IsSynchron() && bWaitForData )
+ {
+ SetSynchron( sal_True );
+ bRes = Update();
+ SetSynchron( sal_False );
+ }
+ else
+ bRes = Update();
+
+ bSwapIn = sal_False;
+ return bRes;
+}
+
+void SwBaseLink::Closed()
+{
+ if( pCntntNode && !pCntntNode->GetDoc()->IsInDtor() )
+ {
+ // wir heben die Verbindung auf
+ if( pCntntNode->IsGrfNode() )
+ ((SwGrfNode*)pCntntNode)->ReleaseLink();
+ }
+ SvBaseLink::Closed();
+}
+
+const SwNode* SwBaseLink::GetAnchor() const
+{
+ if (pCntntNode)
+ {
+ SwFrmFmt *const pFmt = pCntntNode->GetFlyFmt();
+ if (pFmt)
+ {
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+ SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
+ if (pAPos &&
+ ((FLY_AS_CHAR == rAnchor.GetAnchorId()) ||
+ (FLY_AT_CHAR == rAnchor.GetAnchorId()) ||
+ (FLY_AT_FLY == rAnchor.GetAnchorId()) ||
+ (FLY_AT_PARA == rAnchor.GetAnchorId())))
+ {
+ return &pAPos->nNode.GetNode();
+ }
+ return 0;
+ }
+ }
+
+ ASSERT( !this, "GetAnchor nicht ueberlagert" );
+ return 0;
+}
+
+sal_Bool SwBaseLink::IsRecursion( const SwBaseLink* pChkLnk ) const
+{
+ SwServerObjectRef aRef( (SwServerObject*)GetObj() );
+ if( aRef.Is() )
+ {
+ // es ist ein ServerObject, also frage nach allen darin
+ // befindlichen Links, ob wir darin enthalten sind. Ansonsten
+ // handelt es sich um eine Rekursion.
+ return aRef->IsLinkInServer( pChkLnk );
+ }
+ return sal_False;
+}
+
+sal_Bool SwBaseLink::IsInRange( sal_uLong, sal_uLong, xub_StrLen, xub_StrLen ) const
+{
+ // Grafik oder OLE-Links nicht,
+ // Felder oder Sections haben eigene Ableitung!
+ return sal_False;
+}
+
+SwBaseLink::~SwBaseLink()
+{
+}
diff --git a/sw/source/core/docnode/swthreadjoiner.cxx b/sw/source/core/docnode/swthreadjoiner.cxx
new file mode 100644
index 000000000000..8ee2924d4cdb
--- /dev/null
+++ b/sw/source/core/docnode/swthreadjoiner.cxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_sw.hxx"
+#include <swthreadjoiner.hxx>
+#include <finalthreadmanager.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+
+/** Testing
+
+ @author OD
+*/
+using namespace ::com::sun::star;
+
+uno::Reference< util::XJobManager > SwThreadJoiner::mpThreadJoiner;
+osl::Mutex* SwThreadJoiner::mpGetJoinerMutex = new osl::Mutex();
+
+uno::Reference< util::XJobManager >& SwThreadJoiner::GetThreadJoiner()
+{
+ osl::MutexGuard aGuard(*mpGetJoinerMutex);
+
+ if ( !mpThreadJoiner.is() )
+ {
+ mpThreadJoiner =
+ uno::Reference< util::XJobManager >(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ ::rtl::OUString::createFromAscii("com.sun.star.util.JobManager" ) ),
+ uno::UNO_QUERY );
+ }
+
+ return mpThreadJoiner;
+}
+
+void SwThreadJoiner::ReleaseThreadJoiner()
+{
+ mpThreadJoiner.clear();
+}
diff --git a/sw/source/core/docnode/swthreadmanager.cxx b/sw/source/core/docnode/swthreadmanager.cxx
new file mode 100644
index 000000000000..7723bb684664
--- /dev/null
+++ b/sw/source/core/docnode/swthreadmanager.cxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+#include <swthreadmanager.hxx>
+#include <swthreadjoiner.hxx>
+#include <observablethread.hxx>
+#include <threadmanager.hxx>
+
+/** class to manage threads in Writer - it conforms the singleton pattern
+
+ OD 2007-04-13 #i73788#
+
+ @author OD
+*/
+bool SwThreadManager::mbThreadManagerInstantiated = false;
+
+SwThreadManager::SwThreadManager()
+ : mpThreadManagerImpl( new ThreadManager( SwThreadJoiner::GetThreadJoiner() ) )
+{
+ mpThreadManagerImpl->Init();
+ mbThreadManagerInstantiated = true;
+}
+
+SwThreadManager::~SwThreadManager()
+{
+}
+
+struct InitInstance : public rtl::Static<SwThreadManager, InitInstance> {};
+
+SwThreadManager& SwThreadManager::GetThreadManager()
+{
+ return InitInstance::get();
+}
+
+bool SwThreadManager::ExistsThreadManager()
+{
+ return mbThreadManagerInstantiated;
+}
+
+oslInterlockedCount SwThreadManager::AddThread( const rtl::Reference< ObservableThread >& rThread )
+{
+ return mpThreadManagerImpl->AddThread( rThread );
+}
+
+void SwThreadManager::RemoveThread( const oslInterlockedCount nThreadID )
+{
+ mpThreadManagerImpl->RemoveThread( nThreadID );
+}
+
+void SwThreadManager::SuspendStartingOfThreads()
+{
+ mpThreadManagerImpl->SuspendStartingOfThreads();
+}
+
+void SwThreadManager::ResumeStartingOfThreads()
+{
+ mpThreadManagerImpl->ResumeStartingOfThreads();
+}
+
+bool SwThreadManager::StartingOfThreadsSuspended()
+{
+ return mpThreadManagerImpl->StartingOfThreadsSuspended();
+}
diff --git a/sw/source/core/docnode/threadlistener.cxx b/sw/source/core/docnode/threadlistener.cxx
new file mode 100644
index 000000000000..171d9fad380d
--- /dev/null
+++ b/sw/source/core/docnode/threadlistener.cxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_sw.hxx"
+#include <threadlistener.hxx>
+
+/** helper class to observe threads
+
+ OD 2007-03-30 #i73788#
+
+ @author OD
+*/
+ThreadListener::ThreadListener( IThreadListenerOwner& rThreadListenerOwner )
+ : IFinishedThreadListener(),
+ mrThreadListenerOwner( rThreadListenerOwner )
+{
+}
+
+ThreadListener::~ThreadListener()
+{
+}
+
+void ThreadListener::ListenToThread( const oslInterlockedCount nThreadID,
+ ObservableThread& rThread )
+{
+ rThread.SetListener( mrThreadListenerOwner.GetThreadListenerWeakRef(),
+ nThreadID );
+}
+
+void ThreadListener::NotifyAboutFinishedThread( const oslInterlockedCount nThreadID )
+{
+ mrThreadListenerOwner.NotifyAboutFinishedThread( nThreadID );
+}
+
diff --git a/sw/source/core/docnode/threadmanager.cxx b/sw/source/core/docnode/threadmanager.cxx
new file mode 100644
index 000000000000..bb7bb4a4332b
--- /dev/null
+++ b/sw/source/core/docnode/threadmanager.cxx
@@ -0,0 +1,258 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "precompiled_sw.hxx"
+#include <threadmanager.hxx>
+#include <errhdl.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+/** class to manage threads
+
+ OD 2007-01-29 #i73788#
+
+ @author OD
+*/
+const std::deque< ThreadManager::tThreadData >::size_type ThreadManager::mnStartedSize = 10;
+
+ThreadManager::ThreadManager( uno::Reference< util::XJobManager >& rThreadJoiner )
+ : maMutex(),
+ mrThreadJoiner( rThreadJoiner ),
+ mpThreadListener(),
+ mnThreadIDCounter( 0 ),
+ maWaitingForStartThreads(),
+ maStartedThreads(),
+ maStartNewThreadTimer(),
+ mbStartingOfThreadsSuspended( false )
+{
+}
+
+void ThreadManager::Init()
+{
+ mpThreadListener.reset( new ThreadListener( *this ) );
+
+ maStartNewThreadTimer.SetTimeout( 2000 );
+ maStartNewThreadTimer.SetTimeoutHdl( LINK( this, ThreadManager, TryToStartNewThread ) );
+}
+
+ThreadManager::~ThreadManager()
+{
+ maWaitingForStartThreads.clear();
+ maStartedThreads.clear();
+}
+
+boost::weak_ptr< IFinishedThreadListener > ThreadManager::GetThreadListenerWeakRef()
+{
+ return mpThreadListener;
+}
+
+void ThreadManager::NotifyAboutFinishedThread( const oslInterlockedCount nThreadID )
+{
+ RemoveThread( nThreadID, true );
+}
+
+oslInterlockedCount ThreadManager::AddThread(
+ const rtl::Reference< ObservableThread >& rThread )
+
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ // create new thread
+ tThreadData aThreadData;
+ oslInterlockedCount nNewThreadID( RetrieveNewThreadID() );
+ {
+ aThreadData.nThreadID = nNewThreadID;
+
+ aThreadData.pThread = rThread;
+ aThreadData.aJob = new CancellableJob( aThreadData.pThread );
+
+ aThreadData.pThread->setPriority( osl_Thread_PriorityBelowNormal );
+ mpThreadListener->ListenToThread( aThreadData.nThreadID,
+ *(aThreadData.pThread) );
+ }
+
+ // add thread to manager
+ if ( maStartedThreads.size() < mnStartedSize &&
+ !StartingOfThreadsSuspended() )
+ {
+ // Try to start thread
+ if ( !StartThread( aThreadData ) )
+ {
+ // No success on starting thread
+ // If no more started threads exist, but still threads are waiting,
+ // setup Timer to start thread from waiting ones
+ if ( maStartedThreads.empty() && !maWaitingForStartThreads.empty() )
+ {
+ maStartNewThreadTimer.Start();
+ }
+ }
+ }
+ else
+ {
+ // Thread will be started later
+ maWaitingForStartThreads.push_back( aThreadData );
+ }
+
+ return nNewThreadID;
+}
+
+void ThreadManager::RemoveThread( const oslInterlockedCount nThreadID,
+ const bool bThreadFinished )
+{
+ // --> SAFE ----
+ osl::MutexGuard aGuard(maMutex);
+
+ std::deque< tThreadData >::iterator aIter =
+ std::find_if( maStartedThreads.begin(), maStartedThreads.end(),
+ ThreadPred( nThreadID ) );
+
+ if ( aIter != maStartedThreads.end() )
+ {
+ tThreadData aTmpThreadData( (*aIter) );
+
+ maStartedThreads.erase( aIter );
+
+ if ( bThreadFinished )
+ {
+ // release thread as job from thread joiner instance
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XJobManager > rThreadJoiner( mrThreadJoiner );
+ if ( rThreadJoiner.is() )
+ {
+ rThreadJoiner->releaseJob( aTmpThreadData.aJob );
+ }
+ else
+ {
+ ASSERT( false, "<ThreadManager::RemoveThread(..)> - ThreadJoiner already gone!" );
+ }
+ }
+
+ // Try to start thread from waiting ones
+ TryToStartNewThread( 0 );
+ }
+ else
+ {
+ aIter = std::find_if( maWaitingForStartThreads.begin(),
+ maWaitingForStartThreads.end(), ThreadPred( nThreadID ) );
+
+ if ( aIter != maWaitingForStartThreads.end() )
+ {
+ maWaitingForStartThreads.erase( aIter );
+ }
+ }
+ // <-- SAFE ----
+}
+
+bool ThreadManager::StartWaitingThread()
+{
+ if ( !maWaitingForStartThreads.empty() )
+ {
+ tThreadData aThreadData( maWaitingForStartThreads.front() );
+ maWaitingForStartThreads.pop_front();
+ return StartThread( aThreadData );
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool ThreadManager::StartThread( const tThreadData& rThreadData )
+{
+ bool bThreadStarted( false );
+
+ if ( rThreadData.pThread->create() )
+ {
+ // start of thread successful.
+ bThreadStarted = true;
+
+ maStartedThreads.push_back( rThreadData );
+
+ // register thread as job at thread joiner instance
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XJobManager > rThreadJoiner( mrThreadJoiner );
+ if ( rThreadJoiner.is() )
+ {
+ rThreadJoiner->registerJob( rThreadData.aJob );
+ }
+ else
+ {
+ ASSERT( false, "<ThreadManager::StartThread(..)> - ThreadJoiner already gone!" );
+ }
+ }
+ else
+ {
+ // thread couldn't be started.
+ maWaitingForStartThreads.push_front( rThreadData );
+ }
+
+ return bThreadStarted;
+}
+
+IMPL_LINK( ThreadManager, TryToStartNewThread, Timer *, EMPTYARG )
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ if ( !StartingOfThreadsSuspended() )
+ {
+ // Try to start thread from waiting ones
+ if ( !StartWaitingThread() )
+ {
+ // No success on starting thread
+ // If no more started threads exist, but still threads are waiting,
+ // setup Timer to start thread from waiting ones
+ if ( maStartedThreads.empty() && !maWaitingForStartThreads.empty() )
+ {
+ maStartNewThreadTimer.Start();
+ }
+ }
+ }
+
+ return sal_True;
+}
+
+void ThreadManager::ResumeStartingOfThreads()
+{
+ osl::MutexGuard aGuard(maMutex);
+
+ mbStartingOfThreadsSuspended = false;
+
+ while ( maStartedThreads.size() < mnStartedSize &&
+ !maWaitingForStartThreads.empty() )
+ {
+ if ( !StartWaitingThread() )
+ {
+ // No success on starting thread
+ // If no more started threads exist, but still threads are waiting,
+ // setup Timer to start thread from waiting ones
+ if ( maStartedThreads.empty() && !maWaitingForStartThreads.empty() )
+ {
+ maStartNewThreadTimer.Start();
+ break;
+ }
+ }
+ }
+}
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
new file mode 100644
index 000000000000..e501eb970121
--- /dev/null
+++ b/sw/source/core/draw/dcontact.cxx
@@ -0,0 +1,2793 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include "hintids.hxx"
+#include <editeng/protitem.hxx>
+#include <editeng/opaqitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svditer.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdviter.hxx>
+#include <svx/svdview.hxx>
+#include <svx/shapepropertynotifier.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <fmtornt.hxx>
+#include <viewimp.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtanchr.hxx>
+#include <node.hxx>
+#include <fmtcntnt.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <frmtool.hxx> // Notify_Background
+#include <flyfrm.hxx>
+#include <frmfmt.hxx>
+#include <dflyobj.hxx>
+#include <dcontact.hxx>
+#include <unodraw.hxx>
+#include <IDocumentDrawModelAccess.hxx>
+#include <doc.hxx>
+#include <hints.hxx>
+#include <txtfrm.hxx>
+#include <editsh.hxx>
+#include <docary.hxx>
+#include <flyfrms.hxx>
+#include <sortedobjs.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <svx/sdr/contact/viewcontactofvirtobj.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <switerator.hxx>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+
+TYPEINIT1( SwContact, SwClient )
+TYPEINIT1( SwFlyDrawContact, SwContact )
+TYPEINIT1( SwDrawContact, SwContact )
+
+void setContextWritingMode( SdrObject* pObj, SwFrm* pAnchor )
+{
+ if( pObj && pAnchor )
+ {
+ short nWritingDirection = text::WritingMode2::LR_TB;
+ if( pAnchor->IsVertical() )
+ {
+ nWritingDirection = text::WritingMode2::TB_RL;
+ } else if( pAnchor->IsRightToLeft() )
+ {
+ nWritingDirection = text::WritingMode2::RL_TB;
+ }
+ pObj->SetContextWritingMode( nWritingDirection );
+ }
+}
+
+
+//Der Umgekehrte Weg: Sucht das Format zum angegebenen Objekt.
+//Wenn das Object ein SwVirtFlyDrawObj ist so wird das Format von
+//selbigem besorgt.
+//Anderfalls ist es eben ein einfaches Zeichenobjekt. Diese hat einen
+//UserCall und der ist Client vom gesuchten Format.
+
+SwFrmFmt *FindFrmFmt( SdrObject *pObj )
+{
+ SwFrmFmt* pRetval = 0L;
+
+ if ( pObj->ISA(SwVirtFlyDrawObj) )
+ {
+ pRetval = ((SwVirtFlyDrawObj*)pObj)->GetFmt();
+ }
+ else
+ {
+ SwDrawContact* pContact = static_cast<SwDrawContact*>(GetUserCall( pObj ));
+ if ( pContact )
+ {
+ pRetval = pContact->GetFmt();
+ }
+ }
+/* SJ: after prior consultation with OD we decided to remove this Assertion
+#if OSL_DEBUG_LEVEL > 1
+ ASSERT( pRetval,
+ "<::FindFrmFmt(..)> - no frame format found for given object. Please inform OD." );
+#endif
+*/
+ return pRetval;
+}
+
+sal_Bool HasWrap( const SdrObject* pObj )
+{
+ if ( pObj )
+ {
+ const SwFrmFmt* pFmt = ::FindFrmFmt( pObj );
+ if ( pFmt )
+ {
+ return SURROUND_THROUGHT != pFmt->GetSurround().GetSurround();
+ }
+ }
+
+ return sal_False;
+}
+
+/*****************************************************************************
+ *
+ * GetBoundRect liefert das BoundRect _inklusive_ Abstand des Objekts.
+ *
+ *****************************************************************************/
+
+// --> OD 2006-08-15 #i68520# - change naming
+SwRect GetBoundRectOfAnchoredObj( const SdrObject* pObj )
+// <--
+{
+ SwRect aRet( pObj->GetCurrentBoundRect() );
+ // --> OD 2006-08-10 #i68520# - call cache of <SwAnchoredObject>
+ SwContact* pContact( GetUserCall( pObj ) );
+ if ( pContact )
+ {
+ const SwAnchoredObject* pAnchoredObj( pContact->GetAnchoredObj( pObj ) );
+ if ( pAnchoredObj )
+ {
+ aRet = pAnchoredObj->GetObjRectWithSpaces();
+ }
+ }
+ // <--
+ return aRet;
+}
+
+//Liefert den UserCall ggf. vom Gruppenobjekt
+// OD 2004-03-31 #i26791# - change return type
+SwContact* GetUserCall( const SdrObject* pObj )
+{
+ SdrObject *pTmp;
+ while ( !pObj->GetUserCall() && 0 != (pTmp = pObj->GetUpGroup()) )
+ pObj = pTmp;
+ ASSERT( !pObj->GetUserCall() || pObj->GetUserCall()->ISA(SwContact),
+ "<::GetUserCall(..)> - wrong type of found object user call." );
+ return static_cast<SwContact*>(pObj->GetUserCall());
+}
+
+// liefert sal_True falls das SrdObject ein Marquee-Object (Lauftext) ist
+sal_Bool IsMarqueeTextObj( const SdrObject& rObj )
+{
+ SdrTextAniKind eTKind;
+ return SdrInventor == rObj.GetObjInventor() &&
+ OBJ_TEXT == rObj.GetObjIdentifier() &&
+ ( SDRTEXTANI_SCROLL == ( eTKind = ((SdrTextObj&)rObj).GetTextAniKind())
+ || SDRTEXTANI_ALTERNATE == eTKind || SDRTEXTANI_SLIDE == eTKind );
+}
+
+/*************************************************************************
+|*
+|* SwContact, Ctor und Dtor
+|*
+|* Ersterstellung AMA 27.Sep.96 18:13
+|* Letzte Aenderung AMA 27.Sep.96
+|*
+|*************************************************************************/
+
+SwContact::SwContact( SwFrmFmt *pToRegisterIn ) :
+ SwClient( pToRegisterIn ),
+ // OD 05.09.2003 #112039# - init member <mbInDTOR>
+ mbInDTOR( false )
+{}
+
+SwContact::~SwContact()
+{
+ // OD 05.09.2003 #112039# - set <mbInDTOR>
+ SetInDTOR();
+}
+
+// OD 05.09.2003 #112039# - accessor for member <mbInDTOR>
+bool SwContact::IsInDTOR() const
+{
+ return mbInDTOR;
+}
+
+// OD 05.09.2003 #112039# - accessor to set member <mbInDTOR>
+void SwContact::SetInDTOR()
+{
+ mbInDTOR = true;
+}
+
+/** method to move drawing object to corresponding visible layer
+
+ OD 21.08.2003 #i18447#
+
+ @author OD
+*/
+void SwContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj )
+{
+ // --> OD 2005-06-08 #i46297# - notify background about the arriving of
+ // the object and invalidate its position.
+ const bool bNotify( !GetFmt()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) );
+ // <--
+
+ _MoveObjToLayer( true, _pDrawObj );
+
+ // --> OD 2005-05-23 #i46297#
+ if ( bNotify )
+ {
+ SwAnchoredObject* pAnchoredObj = GetAnchoredObj( _pDrawObj );
+ ASSERT( pAnchoredObj,
+ "<SwContact::MoveObjToInvisibleLayer(..)> - missing anchored object" );
+ if ( pAnchoredObj )
+ {
+ ::setContextWritingMode( _pDrawObj, pAnchoredObj->GetAnchorFrmContainingAnchPos() );
+ // Note: as-character anchored objects aren't registered at a page frame and
+ // a notification of its background isn't needed.
+ if ( pAnchoredObj->GetPageFrm() )
+ {
+ ::Notify_Background( _pDrawObj, pAnchoredObj->GetPageFrm(),
+ pAnchoredObj->GetObjRect(), PREP_FLY_ARRIVE, sal_True );
+ }
+
+ pAnchoredObj->InvalidateObjPos();
+ }
+ }
+ // <--
+}
+
+/** method to move drawing object to corresponding invisible layer
+
+ OD 21.08.2003 #i18447#
+
+ @author OD
+*/
+void SwContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj )
+{
+ // --> OD 2005-06-08 #i46297# - notify background about the leaving of the object.
+ const bool bNotify( GetFmt()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) );
+ // <--
+
+ _MoveObjToLayer( false, _pDrawObj );
+
+ // --> OD 2005-05-19 #i46297#
+ if ( bNotify )
+ {
+ SwAnchoredObject* pAnchoredObj = GetAnchoredObj( _pDrawObj );
+ ASSERT( pAnchoredObj,
+ "<SwContact::MoveObjToInvisibleLayer(..)> - missing anchored object" );
+ // Note: as-character anchored objects aren't registered at a page frame and
+ // a notification of its background isn't needed.
+ if ( pAnchoredObj && pAnchoredObj->GetPageFrm() )
+ {
+ ::Notify_Background( _pDrawObj, pAnchoredObj->GetPageFrm(),
+ pAnchoredObj->GetObjRect(), PREP_FLY_LEAVE, sal_True );
+ }
+ }
+ // <--
+}
+
+/** method to move object to visible/invisible layer
+
+ OD 21.08.2003 #i18447#
+ implementation for the public method <MoveObjToVisibleLayer(..)>
+ and <MoveObjToInvisibleLayer(..)>
+
+ @author OD
+*/
+void SwContact::_MoveObjToLayer( const bool _bToVisible,
+ SdrObject* _pDrawObj )
+{
+ if ( !_pDrawObj )
+ {
+ ASSERT( false, "SwDrawContact::_MoveObjToLayer(..) - no drawing object!" );
+ return;
+ }
+
+ if ( !GetRegisteredIn() )
+ {
+ ASSERT( false, "SwDrawContact::_MoveObjToLayer(..) - no drawing frame format!" );
+ return;
+ }
+
+ const IDocumentDrawModelAccess* pIDDMA = static_cast<SwFrmFmt*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess();
+ if ( !pIDDMA )
+ {
+ ASSERT( false, "SwDrawContact::_MoveObjToLayer(..) - no writer document!" );
+ return;
+ }
+
+ SdrLayerID nToHellLayerId =
+ _bToVisible ? pIDDMA->GetHellId() : pIDDMA->GetInvisibleHellId();
+ SdrLayerID nToHeavenLayerId =
+ _bToVisible ? pIDDMA->GetHeavenId() : pIDDMA->GetInvisibleHeavenId();
+ SdrLayerID nToControlLayerId =
+ _bToVisible ? pIDDMA->GetControlsId() : pIDDMA->GetInvisibleControlsId();
+ SdrLayerID nFromHellLayerId =
+ _bToVisible ? pIDDMA->GetInvisibleHellId() : pIDDMA->GetHellId();
+ SdrLayerID nFromHeavenLayerId =
+ _bToVisible ? pIDDMA->GetInvisibleHeavenId() : pIDDMA->GetHeavenId();
+ SdrLayerID nFromControlLayerId =
+ _bToVisible ? pIDDMA->GetInvisibleControlsId() : pIDDMA->GetControlsId();
+
+ if ( _pDrawObj->ISA( SdrObjGroup ) )
+ {
+ // determine layer for group object
+ {
+ // proposed layer of a group object is the hell layer
+ SdrLayerID nNewLayerId = nToHellLayerId;
+ if ( ::CheckControlLayer( _pDrawObj ) )
+ {
+ // it has to be the control layer, if one of the member
+ // is a control
+ nNewLayerId = nToControlLayerId;
+ }
+ else if ( _pDrawObj->GetLayer() == pIDDMA->GetHeavenId() ||
+ _pDrawObj->GetLayer() == pIDDMA->GetInvisibleHeavenId() )
+ {
+ // it has to be the heaven layer, if method <GetLayer()> reveals
+ // a heaven layer
+ nNewLayerId = nToHeavenLayerId;
+ }
+ // set layer at group object, but do *not* broadcast and
+ // no propagation to the members.
+ // Thus, call <NbcSetLayer(..)> at super class
+ _pDrawObj->SdrObject::NbcSetLayer( nNewLayerId );
+ }
+
+ // call method recursively for group object members
+ const SdrObjList* pLst =
+ static_cast<SdrObjGroup*>(_pDrawObj)->GetSubList();
+ if ( pLst )
+ {
+ for ( sal_uInt16 i = 0; i < pLst->GetObjCount(); ++i )
+ {
+ _MoveObjToLayer( _bToVisible, pLst->GetObj( i ) );
+ }
+ }
+ }
+ else
+ {
+ const SdrLayerID nLayerIdOfObj = _pDrawObj->GetLayer();
+ if ( nLayerIdOfObj == nFromHellLayerId )
+ {
+ _pDrawObj->SetLayer( nToHellLayerId );
+ }
+ else if ( nLayerIdOfObj == nFromHeavenLayerId )
+ {
+ _pDrawObj->SetLayer( nToHeavenLayerId );
+ }
+ else if ( nLayerIdOfObj == nFromControlLayerId )
+ {
+ _pDrawObj->SetLayer( nToControlLayerId );
+ }
+ }
+}
+
+// -------------------------------------------------------------------------
+// OD 2004-01-16 #110582# - some virtual helper methods for information
+// about the object (Writer fly frame resp. drawing object)
+
+const SwIndex& SwContact::GetCntntAnchorIndex() const
+{
+ return GetCntntAnchor().nContent;
+}
+
+/** get minimum order number of anchored objects handled by with contact
+
+ OD 2004-08-24 #110810#
+
+ @author
+*/
+sal_uInt32 SwContact::GetMinOrdNum() const
+{
+ sal_uInt32 nMinOrdNum( SAL_MAX_UINT32 );
+
+ std::list< SwAnchoredObject* > aObjs;
+ GetAnchoredObjs( aObjs );
+
+ while ( !aObjs.empty() )
+ {
+ sal_uInt32 nTmpOrdNum = aObjs.back()->GetDrawObj()->GetOrdNum();
+
+ if ( nTmpOrdNum < nMinOrdNum )
+ {
+ nMinOrdNum = nTmpOrdNum;
+ }
+
+ aObjs.pop_back();
+ }
+
+ ASSERT( nMinOrdNum != SAL_MAX_UINT32,
+ "<SwContact::GetMinOrdNum()> - no order number found." );
+ return nMinOrdNum;
+}
+
+/** get maximum order number of anchored objects handled by with contact
+
+ OD 2004-08-24 #110810#
+
+ @author
+*/
+sal_uInt32 SwContact::GetMaxOrdNum() const
+{
+ sal_uInt32 nMaxOrdNum( 0L );
+
+ std::list< SwAnchoredObject* > aObjs;
+ GetAnchoredObjs( aObjs );
+
+ while ( !aObjs.empty() )
+ {
+ sal_uInt32 nTmpOrdNum = aObjs.back()->GetDrawObj()->GetOrdNum();
+
+ if ( nTmpOrdNum > nMaxOrdNum )
+ {
+ nMaxOrdNum = nTmpOrdNum;
+ }
+
+ aObjs.pop_back();
+ }
+
+ return nMaxOrdNum;
+}
+// -------------------------------------------------------------------------
+
+/*************************************************************************
+|*
+|* SwFlyDrawContact, Ctor und Dtor
+|*
+|* Ersterstellung OK 23.11.94 18:13
+|* Letzte Aenderung MA 06. Apr. 95
+|*
+|*************************************************************************/
+
+SwFlyDrawContact::SwFlyDrawContact( SwFlyFrmFmt *pToRegisterIn, SdrModel * ) :
+ SwContact( pToRegisterIn )
+{
+ // OD 2004-04-01 #i26791# - class <SwFlyDrawContact> contains the 'master'
+ // drawing object of type <SwFlyDrawObj> on its own.
+ mpMasterObj = new SwFlyDrawObj;
+ mpMasterObj->SetOrdNum( 0xFFFFFFFE );
+ mpMasterObj->SetUserCall( this );
+}
+
+SwFlyDrawContact::~SwFlyDrawContact()
+{
+ if ( mpMasterObj )
+ {
+ mpMasterObj->SetUserCall( 0 );
+ if ( mpMasterObj->GetPage() )
+ mpMasterObj->GetPage()->RemoveObject( mpMasterObj->GetOrdNum() );
+ delete mpMasterObj;
+ }
+}
+
+// OD 2004-03-29 #i26791#
+const SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( const SdrObject* _pSdrObj ) const
+{
+ ASSERT( _pSdrObj,
+ "<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" );
+ ASSERT( _pSdrObj->ISA(SwVirtFlyDrawObj),
+ "<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type object provided" );
+ ASSERT( GetUserCall( _pSdrObj ) == const_cast<SwFlyDrawContact*>(this),
+ "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
+
+ const SwAnchoredObject* pRetAnchoredObj = 0L;
+
+ if ( _pSdrObj && _pSdrObj->ISA(SwVirtFlyDrawObj) )
+ {
+ pRetAnchoredObj = static_cast<const SwVirtFlyDrawObj*>(_pSdrObj)->GetFlyFrm();
+ }
+
+ return pRetAnchoredObj;
+}
+
+SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( SdrObject* _pSdrObj )
+{
+ ASSERT( _pSdrObj,
+ "<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" );
+ ASSERT( _pSdrObj->ISA(SwVirtFlyDrawObj),
+ "<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type provided" );
+ ASSERT( GetUserCall( _pSdrObj ) == this,
+ "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
+
+ SwAnchoredObject* pRetAnchoredObj = 0L;
+
+ if ( _pSdrObj && _pSdrObj->ISA(SwVirtFlyDrawObj) )
+ {
+ pRetAnchoredObj = static_cast<SwVirtFlyDrawObj*>(_pSdrObj)->GetFlyFrm();
+ }
+
+ return pRetAnchoredObj;
+}
+
+const SdrObject* SwFlyDrawContact::GetMaster() const
+{
+ return mpMasterObj;
+}
+
+SdrObject* SwFlyDrawContact::GetMaster()
+{
+ return mpMasterObj;
+}
+
+void SwFlyDrawContact::SetMaster( SdrObject* _pNewMaster )
+{
+ ASSERT( _pNewMaster->ISA(SwFlyDrawObj),
+ "<SwFlyDrawContact::SetMaster(..)> - wrong type of new master object" );
+ mpMasterObj = static_cast<SwFlyDrawObj *>(_pNewMaster);
+}
+
+/*************************************************************************
+|*
+|* SwFlyDrawContact::Modify()
+|*
+|* Ersterstellung OK 08.11.94 10:21
+|* Letzte Aenderung MA 06. Dec. 94
+|*
+|*************************************************************************/
+
+void SwFlyDrawContact::Modify( const SfxPoolItem*, const SfxPoolItem * )
+{
+}
+
+// OD 2004-01-16 #110582# - override method to control Writer fly frames,
+// which are linked, and to assure that all objects anchored at/inside the
+// Writer fly frame are also made visible.
+void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj )
+{
+ ASSERT( _pDrawObj->ISA(SwVirtFlyDrawObj),
+ "<SwFlyDrawContact::MoveObjToVisibleLayer(..)> - wrong SdrObject type -> crash" );
+
+ if ( GetFmt()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) )
+ {
+ // nothing to do
+ return;
+ }
+
+ SwFlyFrm* pFlyFrm = static_cast<SwVirtFlyDrawObj*>(_pDrawObj)->GetFlyFrm();
+
+ // --> OD 2005-03-09 #i44464# - consider, that Writer fly frame content
+ // already exists - (e.g. WW8 document is inserted into a existing document).
+ if ( !pFlyFrm->Lower() )
+ {
+ pFlyFrm->InsertColumns();
+ pFlyFrm->Chain( pFlyFrm->AnchorFrm() );
+ pFlyFrm->InsertCnt();
+ }
+ if ( pFlyFrm->GetDrawObjs() )
+ {
+ for ( sal_uInt8 i = 0; i < pFlyFrm->GetDrawObjs()->Count(); ++i)
+ {
+ // --> OD 2004-07-01 #i28701# - consider type of objects in sorted object list.
+ SdrObject* pObj = (*pFlyFrm->GetDrawObjs())[i]->DrawObj();
+ SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
+ pContact->MoveObjToVisibleLayer( pObj );
+ }
+ }
+
+ // make fly frame visible
+ SwContact::MoveObjToVisibleLayer( _pDrawObj );
+}
+
+// OD 2004-01-16 #110582# - override method to control Writer fly frames,
+// which are linked, and to assure that all objects anchored at/inside the
+// Writer fly frame are also made invisible.
+void SwFlyDrawContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj )
+{
+ ASSERT( _pDrawObj->ISA(SwVirtFlyDrawObj),
+ "<SwFlyDrawContact::MoveObjToInvisibleLayer(..)> - wrong SdrObject type -> crash" );
+
+ if ( !GetFmt()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) )
+ {
+ // nothing to do
+ return;
+ }
+
+ SwFlyFrm* pFlyFrm = static_cast<SwVirtFlyDrawObj*>(_pDrawObj)->GetFlyFrm();
+
+ pFlyFrm->Unchain();
+ pFlyFrm->DeleteCnt();
+ if ( pFlyFrm->GetDrawObjs() )
+ {
+ for ( sal_uInt8 i = 0; i < pFlyFrm->GetDrawObjs()->Count(); ++i)
+ {
+ // --> OD 2004-07-01 #i28701# - consider type of objects in sorted object list.
+ SdrObject* pObj = (*pFlyFrm->GetDrawObjs())[i]->DrawObj();
+ SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
+ pContact->MoveObjToInvisibleLayer( pObj );
+ }
+ }
+
+ // make fly frame invisible
+ SwContact::MoveObjToInvisibleLayer( _pDrawObj );
+}
+
+/** get data collection of anchored objects, handled by with contact
+
+ OD 2004-08-23 #110810#
+
+ @author
+*/
+void SwFlyDrawContact::GetAnchoredObjs( std::list<SwAnchoredObject*>& _roAnchoredObjs ) const
+{
+ const SwFrmFmt* pFmt = GetFmt();
+ SwFlyFrm::GetAnchoredObjects( _roAnchoredObjs, *pFmt );
+}
+
+/*************************************************************************
+|*
+|* SwDrawContact, Ctor+Dtor
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 22. Jul. 98
+|*
+|*************************************************************************/
+bool CheckControlLayer( const SdrObject *pObj )
+{
+ if ( FmFormInventor == pObj->GetObjInventor() )
+ return true;
+ if ( pObj->ISA( SdrObjGroup ) )
+ {
+ const SdrObjList *pLst = ((SdrObjGroup*)pObj)->GetSubList();
+ for ( sal_uInt16 i = 0; i < pLst->GetObjCount(); ++i )
+ {
+ if ( ::CheckControlLayer( pLst->GetObj( i ) ) )
+ {
+ // OD 21.08.2003 #i18447# - return correct value ;-)
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+SwDrawContact::SwDrawContact( SwFrmFmt* pToRegisterIn, SdrObject* pObj ) :
+ SwContact( pToRegisterIn ),
+ maAnchoredDrawObj(),
+ mbMasterObjCleared( false ),
+ // OD 10.10.2003 #112299#
+ mbDisconnectInProgress( false ),
+ // --> OD 2006-01-18 #129959#
+ mbUserCallActive( false ),
+ // Note: value of <meEventTypeOfCurrentUserCall> isn't of relevance, because
+ // <mbUserCallActive> is sal_False.
+ meEventTypeOfCurrentUserCall( SDRUSERCALL_MOVEONLY )
+ // <--
+{
+ // clear list containing 'virtual' drawing objects.
+ maDrawVirtObjs.clear();
+
+ // --> OD 2004-09-22 #i33909# - assure, that drawing object is inserted
+ // in the drawing page.
+ if ( !pObj->IsInserted() )
+ {
+ pToRegisterIn->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)->
+ InsertObject( pObj, pObj->GetOrdNumDirect() );
+ }
+ // <--
+
+ //Controls muessen immer im Control-Layer liegen. Das gilt auch fuer
+ //Gruppenobjekte, wenn diese Controls enthalten.
+ if ( ::CheckControlLayer( pObj ) )
+ {
+ // OD 25.06.2003 #108784# - set layer of object to corresponding invisible layer.
+ pObj->SetLayer( pToRegisterIn->getIDocumentDrawModelAccess()->GetInvisibleControlsId() );
+ }
+
+ // OD 2004-03-29 #i26791#
+ pObj->SetUserCall( this );
+ maAnchoredDrawObj.SetDrawObj( *pObj );
+
+ // if there already exists an SwXShape for the object, ensure it knows about us, and the SdrObject
+ // FS 2009-04-07 #i99056#
+ SwXShape::AddExistingShapeToFmt( *pObj );
+}
+
+SwDrawContact::~SwDrawContact()
+{
+ // OD 05.09.2003 #112039# - set <mbInDTOR>
+ SetInDTOR();
+
+ DisconnectFromLayout();
+
+ // OD 25.06.2003 #108784# - remove 'master' from drawing page
+ RemoveMasterFromDrawPage();
+
+ // remove and destroy 'virtual' drawing objects.
+ RemoveAllVirtObjs();
+
+ if ( !mbMasterObjCleared )
+ {
+ SdrObject* pObject = const_cast< SdrObject* >( maAnchoredDrawObj.GetDrawObj() );
+ SdrObject::Free( pObject );
+ }
+}
+
+void SwDrawContact::GetTextObjectsFromFmt( std::list<SdrTextObj*>& rTextObjects, SwDoc* pDoc )
+{
+ for( sal_Int32 n=0; n<pDoc->GetSpzFrmFmts()->Count(); n++ )
+ {
+ SwFrmFmt* pFly = (*pDoc->GetSpzFrmFmts())[n];
+ if( pFly->IsA( TYPE(SwDrawFrmFmt) ) )
+ {
+ std::list<SdrTextObj*> aTextObjs;
+ SwDrawContact* pContact = SwIterator<SwDrawContact,SwFrmFmt>::FirstElement(*pFly);
+ if( pContact )
+ {
+ SdrObject* pSdrO = pContact->GetMaster();
+ if ( pSdrO )
+ {
+ if ( pSdrO->IsA( TYPE(SdrObjGroup) ) )
+ {
+ SdrObjListIter aListIter( *pSdrO, IM_DEEPNOGROUPS );
+ //iterate inside of a grouped object
+ while( aListIter.IsMore() )
+ {
+ SdrObject* pSdrOElement = aListIter.Next();
+ if( pSdrOElement && pSdrOElement->IsA( TYPE(SdrTextObj) ) &&
+ static_cast<SdrTextObj*>( pSdrOElement)->HasText() )
+ {
+ rTextObjects.push_back((SdrTextObj*) pSdrOElement);
+ }
+ }
+ }
+ else if( pSdrO->IsA( TYPE(SdrTextObj) ) &&
+ static_cast<SdrTextObj*>( pSdrO )->HasText() )
+ {
+ rTextObjects.push_back((SdrTextObj*) pSdrO);
+ }
+ }
+ }
+ }
+ }
+}
+
+// OD 2004-03-29 #i26791#
+const SwAnchoredObject* SwDrawContact::GetAnchoredObj( const SdrObject* _pSdrObj ) const
+{
+ // handle default parameter value
+ if ( !_pSdrObj )
+ {
+ _pSdrObj = GetMaster();
+ }
+
+ ASSERT( _pSdrObj,
+ "<SwDrawContact::GetAnchoredObj(..)> - no object provided" );
+ ASSERT( _pSdrObj->ISA(SwDrawVirtObj) ||
+ ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ),
+ "<SwDrawContact::GetAnchoredObj(..)> - wrong object type object provided" );
+ ASSERT( GetUserCall( _pSdrObj ) == const_cast<SwDrawContact*>(this) ||
+ _pSdrObj == GetMaster(),
+ "<SwDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
+
+ const SwAnchoredObject* pRetAnchoredObj = 0L;
+
+ if ( _pSdrObj )
+ {
+ if ( _pSdrObj->ISA(SwDrawVirtObj) )
+ {
+ pRetAnchoredObj = static_cast<const SwDrawVirtObj*>(_pSdrObj)->GetAnchoredObj();
+ }
+ else if ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) )
+ {
+ pRetAnchoredObj = &maAnchoredDrawObj;
+ }
+ }
+
+ return pRetAnchoredObj;
+}
+
+SwAnchoredObject* SwDrawContact::GetAnchoredObj( SdrObject* _pSdrObj )
+{
+ // handle default parameter value
+ if ( !_pSdrObj )
+ {
+ _pSdrObj = GetMaster();
+ }
+
+ ASSERT( _pSdrObj,
+ "<SwDrawContact::GetAnchoredObj(..)> - no object provided" );
+ ASSERT( _pSdrObj->ISA(SwDrawVirtObj) ||
+ ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ),
+ "<SwDrawContact::GetAnchoredObj(..)> - wrong object type object provided" );
+ ASSERT( GetUserCall( _pSdrObj ) == this || _pSdrObj == GetMaster(),
+ "<SwDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
+
+ SwAnchoredObject* pRetAnchoredObj = 0L;
+
+ if ( _pSdrObj )
+ {
+ if ( _pSdrObj->ISA(SwDrawVirtObj) )
+ {
+ pRetAnchoredObj = static_cast<SwDrawVirtObj*>(_pSdrObj)->AnchoredObj();
+ }
+ else if ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) )
+ {
+ pRetAnchoredObj = &maAnchoredDrawObj;
+ }
+ }
+
+ return pRetAnchoredObj;
+}
+
+const SdrObject* SwDrawContact::GetMaster() const
+{
+ return !mbMasterObjCleared
+ ? maAnchoredDrawObj.GetDrawObj()
+ : 0L;
+}
+
+SdrObject* SwDrawContact::GetMaster()
+{
+ return !mbMasterObjCleared
+ ? maAnchoredDrawObj.DrawObj()
+ : 0L;
+}
+
+// OD 16.05.2003 #108784# - overload <SwContact::SetMaster(..)> in order to
+// assert, if the 'master' drawing object is replaced.
+// OD 10.07.2003 #110742# - replace of master object correctly handled, if
+// handled by method <SwDrawContact::ChangeMasterObject(..)>. Thus, assert
+// only, if a debug level is given.
+void SwDrawContact::SetMaster( SdrObject* _pNewMaster )
+{
+ if ( _pNewMaster )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ ASSERT( false, "debug notification - master replaced!" );
+#endif
+ maAnchoredDrawObj.SetDrawObj( *_pNewMaster );
+ }
+ else
+ {
+ mbMasterObjCleared = true;
+ }
+}
+
+const SwFrm* SwDrawContact::GetAnchorFrm( const SdrObject* _pDrawObj ) const
+{
+ const SwFrm* pAnchorFrm = 0L;
+ if ( !_pDrawObj ||
+ _pDrawObj == GetMaster() ||
+ ( !_pDrawObj->GetUserCall() &&
+ GetUserCall( _pDrawObj ) == static_cast<const SwContact* const>(this) ) )
+ {
+ pAnchorFrm = maAnchoredDrawObj.GetAnchorFrm();
+ }
+ else if ( _pDrawObj->ISA(SwDrawVirtObj) )
+ {
+ pAnchorFrm = static_cast<const SwDrawVirtObj*>(_pDrawObj)->GetAnchorFrm();
+ }
+ else
+ {
+ ASSERT( false,
+ "<SwDrawContact::GetAnchorFrm(..)> - unknown drawing object." )
+ }
+
+ return pAnchorFrm;
+}
+SwFrm* SwDrawContact::GetAnchorFrm( SdrObject* _pDrawObj )
+{
+ SwFrm* pAnchorFrm = 0L;
+ if ( !_pDrawObj ||
+ _pDrawObj == GetMaster() ||
+ ( !_pDrawObj->GetUserCall() &&
+ GetUserCall( _pDrawObj ) == this ) )
+ {
+ pAnchorFrm = maAnchoredDrawObj.AnchorFrm();
+ }
+ else
+ {
+ ASSERT( _pDrawObj->ISA(SwDrawVirtObj),
+ "<SwDrawContact::GetAnchorFrm(..)> - unknown drawing object." )
+ pAnchorFrm = static_cast<SwDrawVirtObj*>(_pDrawObj)->AnchorFrm();
+ }
+
+ return pAnchorFrm;
+}
+
+// OD 23.06.2003 #108784# - method to create a new 'virtual' drawing object.
+SwDrawVirtObj* SwDrawContact::CreateVirtObj()
+{
+ // determine 'master'
+ SdrObject* pOrgMasterSdrObj = GetMaster();
+
+ // create 'virtual' drawing object
+ SwDrawVirtObj* pNewDrawVirtObj = new SwDrawVirtObj ( *(pOrgMasterSdrObj), *(this) );
+
+ // add new 'virtual' drawing object managing data structure
+ maDrawVirtObjs.push_back( pNewDrawVirtObj );
+
+ return pNewDrawVirtObj;
+}
+
+// OD 23.06.2003 #108784# - destroys a given 'virtual' drawing object.
+// side effect: 'virtual' drawing object is removed from data structure
+// <maDrawVirtObjs>.
+void SwDrawContact::DestroyVirtObj( SwDrawVirtObj* _pVirtObj )
+{
+ if ( _pVirtObj )
+ {
+ delete _pVirtObj;
+ _pVirtObj = 0;
+ }
+}
+
+// OD 16.05.2003 #108784# - add a 'virtual' drawing object to drawing page.
+// Use an already created one, which isn't used, or create a new one.
+SwDrawVirtObj* SwDrawContact::AddVirtObj()
+{
+ SwDrawVirtObj* pAddedDrawVirtObj = 0L;
+
+ // check, if a disconnected 'virtual' drawing object exist and use it
+ std::list<SwDrawVirtObj*>::const_iterator aFoundVirtObjIter =
+ std::find_if( maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
+ UsedOrUnusedVirtObjPred( false ) );
+
+ if ( aFoundVirtObjIter != maDrawVirtObjs.end() )
+ {
+ // use already created, disconnected 'virtual' drawing object
+ pAddedDrawVirtObj = (*aFoundVirtObjIter);
+ }
+ else
+ {
+ // create new 'virtual' drawing object.
+ pAddedDrawVirtObj = CreateVirtObj();
+ }
+ pAddedDrawVirtObj->AddToDrawingPage();
+
+ return pAddedDrawVirtObj;
+}
+
+// OD 16.05.2003 #108784# - remove 'virtual' drawing objects and destroy them.
+void SwDrawContact::RemoveAllVirtObjs()
+{
+ for ( std::list<SwDrawVirtObj*>::iterator aDrawVirtObjsIter = maDrawVirtObjs.begin();
+ aDrawVirtObjsIter != maDrawVirtObjs.end();
+ ++aDrawVirtObjsIter )
+ {
+ // remove and destroy 'virtual object'
+ SwDrawVirtObj* pDrawVirtObj = (*aDrawVirtObjsIter);
+ pDrawVirtObj->RemoveFromWriterLayout();
+ pDrawVirtObj->RemoveFromDrawingPage();
+ DestroyVirtObj( pDrawVirtObj );
+ }
+ maDrawVirtObjs.clear();
+}
+
+SwDrawContact::VirtObjAnchoredAtFrmPred::VirtObjAnchoredAtFrmPred(
+ const SwFrm& _rAnchorFrm )
+ : mpAnchorFrm( &_rAnchorFrm )
+{
+ if ( mpAnchorFrm->IsCntntFrm() )
+ {
+ const SwCntntFrm* pTmpFrm =
+ static_cast<const SwCntntFrm*>( mpAnchorFrm );
+ while ( pTmpFrm->IsFollow() )
+ {
+ pTmpFrm = pTmpFrm->FindMaster();
+ }
+ mpAnchorFrm = pTmpFrm;
+ }
+}
+
+// OD 2004-04-14 #i26791# - compare with master frame
+bool SwDrawContact::VirtObjAnchoredAtFrmPred::operator() ( const SwDrawVirtObj* _pDrawVirtObj )
+{
+ const SwFrm* pObjAnchorFrm = _pDrawVirtObj->GetAnchorFrm();
+ if ( pObjAnchorFrm && pObjAnchorFrm->IsCntntFrm() )
+ {
+ const SwCntntFrm* pTmpFrm =
+ static_cast<const SwCntntFrm*>( pObjAnchorFrm );
+ while ( pTmpFrm->IsFollow() )
+ {
+ pTmpFrm = pTmpFrm->FindMaster();
+ }
+ pObjAnchorFrm = pTmpFrm;
+ }
+
+ return ( pObjAnchorFrm == mpAnchorFrm );
+}
+
+// OD 19.06.2003 #108784# - get drawing object ('master' or 'virtual') by frame.
+SdrObject* SwDrawContact::GetDrawObjectByAnchorFrm( const SwFrm& _rAnchorFrm )
+{
+ SdrObject* pRetDrawObj = 0L;
+
+ // OD 2004-04-14 #i26791# - compare master frames instead of direct frames
+ const SwFrm* pProposedAnchorFrm = &_rAnchorFrm;
+ if ( pProposedAnchorFrm->IsCntntFrm() )
+ {
+ const SwCntntFrm* pTmpFrm =
+ static_cast<const SwCntntFrm*>( pProposedAnchorFrm );
+ while ( pTmpFrm->IsFollow() )
+ {
+ pTmpFrm = pTmpFrm->FindMaster();
+ }
+ pProposedAnchorFrm = pTmpFrm;
+ }
+
+ const SwFrm* pMasterObjAnchorFrm = GetAnchorFrm();
+ if ( pMasterObjAnchorFrm && pMasterObjAnchorFrm->IsCntntFrm() )
+ {
+ const SwCntntFrm* pTmpFrm =
+ static_cast<const SwCntntFrm*>( pMasterObjAnchorFrm );
+ while ( pTmpFrm->IsFollow() )
+ {
+ pTmpFrm = pTmpFrm->FindMaster();
+ }
+ pMasterObjAnchorFrm = pTmpFrm;
+ }
+
+ if ( pMasterObjAnchorFrm && pMasterObjAnchorFrm == pProposedAnchorFrm )
+ {
+ pRetDrawObj = GetMaster();
+ }
+ else
+ {
+ std::list<SwDrawVirtObj*>::const_iterator aFoundVirtObjIter =
+ std::find_if( maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
+ VirtObjAnchoredAtFrmPred( *pProposedAnchorFrm ) );
+
+ if ( aFoundVirtObjIter != maDrawVirtObjs.end() )
+ {
+ pRetDrawObj = (*aFoundVirtObjIter);
+ }
+ }
+
+ return pRetDrawObj;
+}
+
+/*************************************************************************
+|*
+|* SwDrawContact::Changed
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 29. May. 96
+|*
+|*************************************************************************/
+
+// OD 03.07.2003 #108784#
+void SwDrawContact::NotifyBackgrdOfAllVirtObjs( const Rectangle* pOldBoundRect )
+{
+ for ( std::list<SwDrawVirtObj*>::iterator aDrawVirtObjIter = maDrawVirtObjs.begin();
+ aDrawVirtObjIter != maDrawVirtObjs.end();
+ ++aDrawVirtObjIter )
+ {
+ SwDrawVirtObj* pDrawVirtObj = (*aDrawVirtObjIter);
+ if ( pDrawVirtObj->GetAnchorFrm() )
+ {
+ // --> OD 2004-10-21 #i34640# - determine correct page frame
+ SwPageFrm* pPage = pDrawVirtObj->AnchoredObj()->FindPageFrmOfAnchor();
+ // <--
+ if( pOldBoundRect && pPage )
+ {
+ SwRect aOldRect( *pOldBoundRect );
+ aOldRect.Pos() += pDrawVirtObj->GetOffset();
+ if( aOldRect.HasArea() )
+ ::Notify_Background( pDrawVirtObj, pPage,
+ aOldRect, PREP_FLY_LEAVE,sal_True);
+ }
+ // --> OD 2004-10-21 #i34640# - include spacing for wrapping
+ SwRect aRect( pDrawVirtObj->GetAnchoredObj()->GetObjRectWithSpaces() );
+ // <--
+ if( aRect.HasArea() )
+ {
+ // --> OD 2004-10-21 #i34640# - simplify
+ SwPageFrm* pPg = (SwPageFrm*)::FindPage( aRect, pPage );
+ // <--
+ if ( pPg )
+ ::Notify_Background( pDrawVirtObj, pPg, aRect,
+ PREP_FLY_ARRIVE, sal_True );
+ }
+ ::ClrContourCache( pDrawVirtObj );
+ }
+ }
+}
+
+// OD 2004-04-08 #i26791# - local method to notify the background for a drawing object
+void lcl_NotifyBackgroundOfObj( SwDrawContact& _rDrawContact,
+ const SdrObject& _rObj,
+ const Rectangle* _pOldObjRect )
+{
+ // --> OD 2004-10-21 #i34640#
+ SwAnchoredObject* pAnchoredObj =
+ const_cast<SwAnchoredObject*>(_rDrawContact.GetAnchoredObj( &_rObj ));
+ if ( pAnchoredObj && pAnchoredObj->GetAnchorFrm() )
+ // <--
+ {
+ // --> OD 2004-10-21 #i34640# - determine correct page frame
+ SwPageFrm* pPageFrm = pAnchoredObj->FindPageFrmOfAnchor();
+ // <--
+ if( _pOldObjRect && pPageFrm )
+ {
+ SwRect aOldRect( *_pOldObjRect );
+ if( aOldRect.HasArea() )
+ {
+ // --> OD 2004-10-21 #i34640# - determine correct page frame
+ SwPageFrm* pOldPageFrm = (SwPageFrm*)::FindPage( aOldRect, pPageFrm );
+ // <--
+ ::Notify_Background( &_rObj, pOldPageFrm, aOldRect,
+ PREP_FLY_LEAVE, sal_True);
+ }
+ }
+ // --> OD 2004-10-21 #i34640# - include spacing for wrapping
+ SwRect aNewRect( pAnchoredObj->GetObjRectWithSpaces() );
+ // <--
+ if( aNewRect.HasArea() && pPageFrm )
+ {
+ pPageFrm = (SwPageFrm*)::FindPage( aNewRect, pPageFrm );
+ ::Notify_Background( &_rObj, pPageFrm, aNewRect,
+ PREP_FLY_ARRIVE, sal_True );
+ }
+ ClrContourCache( &_rObj );
+ }
+}
+
+void SwDrawContact::Changed( const SdrObject& rObj,
+ SdrUserCallType eType,
+ const Rectangle& rOldBoundRect )
+{
+ // OD 2004-06-01 #i26791# - no event handling, if existing <ViewShell>
+ // is in contruction
+ SwDoc* pDoc = GetFmt()->GetDoc();
+ if ( pDoc->GetCurrentViewShell() &&
+ pDoc->GetCurrentViewShell()->IsInConstructor() )
+ {
+ return;
+ }
+
+ // --> OD 2005-03-08 #i44339#
+ // no event handling, if document is in destruction.
+ // Exception: It's the SDRUSERCALL_DELETE event
+ if ( pDoc->IsInDtor() && eType != SDRUSERCALL_DELETE )
+ {
+ return;
+ }
+ // <--
+
+ //Action aufsetzen, aber nicht wenn gerade irgendwo eine Action laeuft.
+ ViewShell *pSh = 0, *pOrg;
+ SwRootFrm *pTmpRoot = pDoc->GetCurrentLayout();//swmod 080317
+ if ( pTmpRoot && pTmpRoot->IsCallbackActionEnabled() )
+ {
+ pDoc->GetEditShell( &pOrg );
+ pSh = pOrg;
+ if ( pSh )
+ do
+ { if ( pSh->Imp()->IsAction() || pSh->Imp()->IsIdleAction() )
+ pSh = 0;
+ else
+ pSh = (ViewShell*)pSh->GetNext();
+
+ } while ( pSh && pSh != pOrg );
+
+ if ( pSh )
+ pTmpRoot->StartAllAction();
+ }
+ SdrObjUserCall::Changed( rObj, eType, rOldBoundRect );
+ _Changed( rObj, eType, &rOldBoundRect ); //Achtung, ggf. Suizid!
+
+ if ( pSh )
+ pTmpRoot->EndAllAction();
+}
+
+// --> OD 2006-01-18 #129959#
+// helper class for method <SwDrawContact::_Changed(..)> for handling nested
+// <SdrObjUserCall> events
+class NestedUserCallHdl
+{
+ private:
+ SwDrawContact* mpDrawContact;
+ bool mbParentUserCallActive;
+ SdrUserCallType meParentUserCallEventType;
+
+ public:
+ NestedUserCallHdl( SwDrawContact* _pDrawContact,
+ SdrUserCallType _eEventType )
+ : mpDrawContact( _pDrawContact ),
+ mbParentUserCallActive( _pDrawContact->mbUserCallActive ),
+ meParentUserCallEventType( _pDrawContact->meEventTypeOfCurrentUserCall )
+ {
+ mpDrawContact->mbUserCallActive = true;
+ mpDrawContact->meEventTypeOfCurrentUserCall = _eEventType;
+ }
+
+ ~NestedUserCallHdl()
+ {
+ if ( mpDrawContact )
+ {
+ mpDrawContact->mbUserCallActive = mbParentUserCallActive;
+ mpDrawContact->meEventTypeOfCurrentUserCall = meParentUserCallEventType;
+ }
+ }
+
+ void DrawContactDeleted()
+ {
+ mpDrawContact = 0;
+ }
+
+ bool IsNestedUserCall()
+ {
+ return mbParentUserCallActive;
+ }
+
+ void AssertNestedUserCall()
+ {
+ if ( IsNestedUserCall() )
+ {
+ bool bTmpAssert( true );
+ // Currently its known, that a nested event SDRUSERCALL_RESIZE
+ // could occur during parent user call SDRUSERCALL_INSERTED,
+ // SDRUSERCALL_DELETE and SDRUSERCALL_RESIZE for edge objects.
+ // Also possible are nested SDRUSERCALL_CHILD_RESIZE events for
+ // edge objects
+ // Thus, assert all other combinations
+ if ( ( meParentUserCallEventType == SDRUSERCALL_INSERTED ||
+ meParentUserCallEventType == SDRUSERCALL_DELETE ||
+ meParentUserCallEventType == SDRUSERCALL_RESIZE ) &&
+ mpDrawContact->meEventTypeOfCurrentUserCall == SDRUSERCALL_RESIZE )
+ {
+ bTmpAssert = false;
+ }
+ else if ( meParentUserCallEventType == SDRUSERCALL_CHILD_RESIZE &&
+ mpDrawContact->meEventTypeOfCurrentUserCall == SDRUSERCALL_CHILD_RESIZE )
+ {
+ bTmpAssert = false;
+ }
+
+ if ( bTmpAssert )
+ {
+ ASSERT( false,
+ "<SwDrawContact::_Changed(..)> - unknown nested <UserCall> event. This is serious, please inform OD." );
+ }
+ }
+ }
+};
+
+// <--
+//
+// !!!ACHTUNG!!! The object may commit suicide!!!
+//
+void SwDrawContact::_Changed( const SdrObject& rObj,
+ SdrUserCallType eType,
+ const Rectangle* pOldBoundRect )
+{
+ // --> OD 2006-01-18 #129959#
+ // suppress handling of nested <SdrObjUserCall> events
+ NestedUserCallHdl aNestedUserCallHdl( this, eType );
+ if ( aNestedUserCallHdl.IsNestedUserCall() )
+ {
+ aNestedUserCallHdl.AssertNestedUserCall();
+ return;
+ }
+ // <--
+ // OD 05.08.2002 #100843# - do *not* notify, if document is destructing
+ // --> OD 2004-10-21 #i35912# - do *not* notify for as-character anchored
+ // drawing objects.
+ // --> OD 2004-11-11 #i35007#
+ // improvement: determine as-character anchored object flag only once.
+ const bool bAnchoredAsChar = ObjAnchoredAsChar();
+ // <--
+ const bool bNotify = !(GetFmt()->GetDoc()->IsInDtor()) &&
+ ( SURROUND_THROUGHT != GetFmt()->GetSurround().GetSurround() ) &&
+ !bAnchoredAsChar;
+ // <--
+ switch( eType )
+ {
+ case SDRUSERCALL_DELETE:
+ {
+ if ( bNotify )
+ {
+ lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
+ // --> OD 2004-10-27 #i36181# - background of 'virtual'
+ // drawing objects have also been notified.
+ NotifyBackgrdOfAllVirtObjs( pOldBoundRect );
+ // <--
+ }
+ DisconnectFromLayout( false );
+ SetMaster( NULL );
+ delete this;
+ // --> FME 2006-07-12 #i65784# Prevent memory corruption
+ aNestedUserCallHdl.DrawContactDeleted();
+ // <--
+ break;
+ }
+ case SDRUSERCALL_INSERTED:
+ {
+ // OD 10.10.2003 #112299#
+ if ( mbDisconnectInProgress )
+ {
+ ASSERT( false,
+ "<SwDrawContact::_Changed(..)> - Insert event during disconnection from layout is invalid." );
+ }
+ else
+ {
+ ConnectToLayout();
+ if ( bNotify )
+ {
+ lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
+ }
+ }
+ break;
+ }
+ case SDRUSERCALL_REMOVED:
+ {
+ if ( bNotify )
+ {
+ lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
+ }
+ DisconnectFromLayout( false );
+ break;
+ }
+ case SDRUSERCALL_CHILD_INSERTED :
+ case SDRUSERCALL_CHILD_REMOVED :
+ {
+ // --> AW, OD 2010-09-13 #i113730#
+ // force layer of controls for group objects containing control objects
+ if(dynamic_cast< SdrObjGroup* >(maAnchoredDrawObj.DrawObj()))
+ {
+ if(::CheckControlLayer(maAnchoredDrawObj.DrawObj()))
+ {
+ const IDocumentDrawModelAccess* pIDDMA = static_cast<SwFrmFmt*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess();
+ const SdrLayerID aCurrentLayer(maAnchoredDrawObj.DrawObj()->GetLayer());
+ const SdrLayerID aControlLayerID(pIDDMA->GetControlsId());
+ const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId());
+
+ if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID)
+ {
+ if ( aCurrentLayer == pIDDMA->GetInvisibleHellId() ||
+ aCurrentLayer == pIDDMA->GetInvisibleHeavenId() )
+ {
+ maAnchoredDrawObj.DrawObj()->SetLayer(aInvisibleControlLayerID);
+ }
+ else
+ {
+ maAnchoredDrawObj.DrawObj()->SetLayer(aControlLayerID);
+ }
+ }
+ }
+ }
+ // fallthrough intended here
+ // <--
+ }
+ case SDRUSERCALL_MOVEONLY:
+ case SDRUSERCALL_RESIZE:
+ case SDRUSERCALL_CHILD_MOVEONLY :
+ case SDRUSERCALL_CHILD_RESIZE :
+ case SDRUSERCALL_CHILD_CHGATTR :
+ case SDRUSERCALL_CHILD_DELETE :
+ case SDRUSERCALL_CHILD_COPY :
+ {
+ // --> OD 2004-08-04 #i31698# - improvement:
+ // get instance <SwAnchoredDrawObject> only once
+ const SwAnchoredDrawObject* pAnchoredDrawObj =
+ static_cast<const SwAnchoredDrawObject*>( GetAnchoredObj( &rObj ) );
+ // <--
+ // OD 2004-04-06 #i26791# - adjust positioning and alignment attributes,
+ // if positioning of drawing object isn't in progress.
+ // --> OD 2005-08-15 #i53320# - no adjust of positioning attributes,
+ // if drawing object isn't positioned.
+ if ( !pAnchoredDrawObj->IsPositioningInProgress() &&
+ !pAnchoredDrawObj->NotYetPositioned() )
+ // <--
+ {
+ // --> OD 2004-09-29 #i34748# - If no last object rectangle is
+ // provided by the anchored object, use parameter <pOldBoundRect>.
+ const Rectangle& aOldObjRect = pAnchoredDrawObj->GetLastObjRect()
+ ? *(pAnchoredDrawObj->GetLastObjRect())
+ : *(pOldBoundRect);
+ // <--
+ // --> OD 2008-02-18 #i79400#
+ // always invalidate object rectangle inclusive spaces
+ pAnchoredDrawObj->InvalidateObjRectWithSpaces();
+ // <--
+ // --> OD 2005-01-28 #i41324# - notify background before
+ // adjusting position
+ if ( bNotify )
+ {
+ // --> OD 2004-07-20 #i31573# - correction: Only invalidate
+ // background of given drawing object.
+ lcl_NotifyBackgroundOfObj( *this, rObj, &aOldObjRect );
+ }
+ // <--
+ // --> OD 2004-08-04 #i31698# - determine layout direction
+ // via draw frame format.
+ SwFrmFmt::tLayoutDir eLayoutDir =
+ pAnchoredDrawObj->GetFrmFmt().GetLayoutDir();
+ // <--
+ // use geometry of drawing object
+ SwRect aObjRect( rObj.GetSnapRect() );
+ // If drawing object is a member of a group, the adjustment
+ // of the positioning and the alignment attributes has to
+ // be done for the top group object.
+ if ( rObj.GetUpGroup() )
+ {
+ const SdrObject* pGroupObj = rObj.GetUpGroup();
+ while ( pGroupObj->GetUpGroup() )
+ {
+ pGroupObj = pGroupObj->GetUpGroup();
+ }
+ // use geometry of drawing object
+ aObjRect = pGroupObj->GetSnapRect();
+ }
+ SwTwips nXPosDiff(0L);
+ SwTwips nYPosDiff(0L);
+ switch ( eLayoutDir )
+ {
+ case SwFrmFmt::HORI_L2R:
+ {
+ nXPosDiff = aObjRect.Left() - aOldObjRect.Left();
+ nYPosDiff = aObjRect.Top() - aOldObjRect.Top();
+ }
+ break;
+ case SwFrmFmt::HORI_R2L:
+ {
+ nXPosDiff = aOldObjRect.Right() - aObjRect.Right();
+ nYPosDiff = aObjRect.Top() - aOldObjRect.Top();
+ }
+ break;
+ case SwFrmFmt::VERT_R2L:
+ {
+ nXPosDiff = aObjRect.Top() - aOldObjRect.Top();
+ nYPosDiff = aOldObjRect.Right() - aObjRect.Right();
+ }
+ break;
+ default:
+ {
+ ASSERT( false,
+ "<SwDrawContact::_Changed(..)> - unsupported layout direction" );
+ }
+ }
+ SfxItemSet aSet( GetFmt()->GetDoc()->GetAttrPool(),
+ RES_VERT_ORIENT, RES_HORI_ORIENT, 0 );
+ const SwFmtVertOrient& rVert = GetFmt()->GetVertOrient();
+ if ( nYPosDiff != 0 )
+ {
+
+ if ( rVert.GetRelationOrient() == text::RelOrientation::CHAR ||
+ rVert.GetRelationOrient() == text::RelOrientation::TEXT_LINE )
+ {
+ nYPosDiff = -nYPosDiff;
+ }
+ aSet.Put( SwFmtVertOrient( rVert.GetPos()+nYPosDiff,
+ text::VertOrientation::NONE,
+ rVert.GetRelationOrient() ) );
+ }
+
+ const SwFmtHoriOrient& rHori = GetFmt()->GetHoriOrient();
+ if ( !bAnchoredAsChar && nXPosDiff != 0 )
+ {
+ aSet.Put( SwFmtHoriOrient( rHori.GetPos()+nXPosDiff,
+ text::HoriOrientation::NONE,
+ rHori.GetRelationOrient() ) );
+ }
+
+ if ( nYPosDiff ||
+ ( !bAnchoredAsChar && nXPosDiff != 0 ) )
+ {
+ GetFmt()->GetDoc()->SetFlyFrmAttr( *(GetFmt()), aSet );
+ // keep new object rectangle, to avoid multiple
+ // changes of the attributes by multiple event from
+ // the drawing layer - e.g. group objects and its members
+ // --> OD 2004-09-29 #i34748# - use new method
+ // <SwAnchoredDrawObject::SetLastObjRect(..)>.
+ const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
+ ->SetLastObjRect( aObjRect.SVRect() );
+ }
+ else if ( aObjRect.SSize() != aOldObjRect.GetSize() )
+ {
+ _InvalidateObjs();
+ // --> OD 2004-11-11 #i35007# - notify anchor frame
+ // of as-character anchored object
+ if ( bAnchoredAsChar )
+ {
+ const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
+ ->AnchorFrm()->Prepare( PREP_FLY_ATTR_CHG, GetFmt() );
+ }
+ // <--
+ }
+ }
+ // --> OD 2006-01-18 #129959#
+ // It reveals that the following code causes several defects -
+ // on copying or on ungrouping a group shape containing edge objects.
+ // Testing fix for #i53320# also reveal that the following code
+ // isn't necessary.
+// // --> OD 2005-08-15 #i53320# - reset positioning attributes,
+// // if anchored drawing object isn't yet positioned.
+// else if ( pAnchoredDrawObj->NotYetPositioned() &&
+// static_cast<const SwDrawFrmFmt&>(pAnchoredDrawObj->GetFrmFmt()).IsPosAttrSet() )
+// {
+// const_cast<SwDrawFrmFmt&>(
+// static_cast<const SwDrawFrmFmt&>(pAnchoredDrawObj->GetFrmFmt()))
+// .ResetPosAttr();
+// }
+// // <--
+ // <--
+ }
+ break;
+ case SDRUSERCALL_CHGATTR:
+ if ( bNotify )
+ {
+ lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+namespace
+{
+ static const SwFmtAnchor* lcl_getAnchorFmt( const SfxPoolItem& _rItem )
+ {
+ sal_uInt16 nWhich = _rItem.Which();
+ const SwFmtAnchor* pAnchorFmt = NULL;
+ if ( RES_ATTRSET_CHG == nWhich )
+ {
+ static_cast<const SwAttrSetChg&>(_rItem).GetChgSet()->
+ GetItemState( RES_ANCHOR, sal_False, (const SfxPoolItem**)&pAnchorFmt );
+ }
+ else if ( RES_ANCHOR == nWhich )
+ {
+ pAnchorFmt = &static_cast<const SwFmtAnchor&>(_rItem);
+ }
+ return pAnchorFmt;
+ }
+}
+
+/*************************************************************************
+|*
+|* SwDrawContact::Modify()
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 03. Dec. 95
+|*
+|*************************************************************************/
+
+void SwDrawContact::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
+{
+ // OD 10.10.2003 #112299#
+ ASSERT( !mbDisconnectInProgress,
+ "<SwDrawContact::Modify(..)> called during disconnection.");
+
+ sal_uInt16 nWhich = pNew ? pNew->Which() : 0;
+ const SwFmtAnchor* pNewAnchorFmt = pNew ? lcl_getAnchorFmt( *pNew ) : NULL;
+
+ if ( pNewAnchorFmt )
+ {
+ // JP 10.04.95: nicht auf ein Reset Anchor reagieren !!!!!
+ if ( SFX_ITEM_SET ==
+ GetFmt()->GetAttrSet().GetItemState( RES_ANCHOR, sal_False ) )
+ {
+ // OD 10.10.2003 #112299# - no connect to layout during disconnection
+ if ( !mbDisconnectInProgress )
+ {
+ // determine old object retangle of 'master' drawing object
+ // for notification
+ const Rectangle* pOldRect = 0L;
+ Rectangle aOldRect;
+ if ( GetAnchorFrm() )
+ {
+ // --> OD 2004-10-27 #i36181# - include spacing in object
+ // rectangle for notification.
+ aOldRect = maAnchoredDrawObj.GetObjRectWithSpaces().SVRect();
+ pOldRect = &aOldRect;
+ // <--
+ }
+ // re-connect to layout due to anchor format change
+ ConnectToLayout( pNewAnchorFmt );
+ // notify background of drawing objects
+ lcl_NotifyBackgroundOfObj( *this, *GetMaster(), pOldRect );
+ NotifyBackgrdOfAllVirtObjs( pOldRect );
+
+ const SwFmtAnchor* pOldAnchorFmt = pOld ? lcl_getAnchorFmt( *pOld ) : NULL;
+ if ( !pOldAnchorFmt || ( pOldAnchorFmt->GetAnchorId() != pNewAnchorFmt->GetAnchorId() ) )
+ {
+ ASSERT( maAnchoredDrawObj.DrawObj(), "SwDrawContact::Modify: no draw object here?" );
+ if ( maAnchoredDrawObj.DrawObj() )
+ {
+ // --> OD 2009-07-10 #i102752#
+ // assure that a ShapePropertyChangeNotifier exists
+ maAnchoredDrawObj.DrawObj()->notifyShapePropertyChange( ::svx::eTextShapeAnchorType );
+ // <--
+ }
+ }
+ }
+ }
+ else
+ DisconnectFromLayout();
+ }
+ // --> OD 2006-03-17 #i62875# - revised fix for issue #124157#
+ // no further notification, if not connected to Writer layout
+ else if ( maAnchoredDrawObj.GetAnchorFrm() &&
+ maAnchoredDrawObj.GetDrawObj()->GetUserCall() )
+ {
+ // --> OD 2004-07-01 #i28701# - on change of wrapping style, hell|heaven layer,
+ // or wrapping style influence an update of the <SwSortedObjs> list,
+ // the drawing object is registered in, has to be performed. This is triggered
+ // by the 1st parameter of method call <_InvalidateObjs(..)>.
+ if ( RES_SURROUND == nWhich ||
+ RES_OPAQUE == nWhich ||
+ RES_WRAP_INFLUENCE_ON_OBJPOS == nWhich ||
+ ( RES_ATTRSET_CHG == nWhich &&
+ ( SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+ RES_SURROUND, sal_False ) ||
+ SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+ RES_OPAQUE, sal_False ) ||
+ SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+ RES_WRAP_INFLUENCE_ON_OBJPOS, sal_False ) ) ) )
+ {
+ lcl_NotifyBackgroundOfObj( *this, *GetMaster(), 0L );
+ NotifyBackgrdOfAllVirtObjs( 0L );
+ _InvalidateObjs( true );
+ }
+ else if ( RES_UL_SPACE == nWhich || RES_LR_SPACE == nWhich ||
+ RES_HORI_ORIENT == nWhich || RES_VERT_ORIENT == nWhich ||
+ // --> OD 2004-07-01 #i28701# - add attribute 'Follow text flow'
+ RES_FOLLOW_TEXT_FLOW == nWhich ||
+ ( RES_ATTRSET_CHG == nWhich &&
+ ( SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+ RES_LR_SPACE, sal_False ) ||
+ SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+ RES_UL_SPACE, sal_False ) ||
+ SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+ RES_HORI_ORIENT, sal_False ) ||
+ SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+ RES_VERT_ORIENT, sal_False ) ||
+ SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+ RES_FOLLOW_TEXT_FLOW, sal_False ) ) ) )
+ {
+ lcl_NotifyBackgroundOfObj( *this, *GetMaster(), 0L );
+ NotifyBackgrdOfAllVirtObjs( 0L );
+ _InvalidateObjs();
+ }
+ // --> OD 2004-10-26 #i35443#
+ else if ( RES_ATTRSET_CHG == nWhich )
+ {
+ lcl_NotifyBackgroundOfObj( *this, *GetMaster(), 0L );
+ NotifyBackgrdOfAllVirtObjs( 0L );
+ _InvalidateObjs();
+ }
+ // <--
+ else if ( RES_REMOVE_UNO_OBJECT == nWhich )
+ {
+ // nothing to do
+ }
+#if OSL_DEBUG_LEVEL > 1
+ else
+ {
+ ASSERT( false,
+ "<SwDrawContact::Modify(..)> - unhandled attribute? - please inform od@openoffice.org" );
+ }
+#endif
+ }
+
+ // --> OD 2005-07-18 #i51474#
+ GetAnchoredObj( 0L )->ResetLayoutProcessBools();
+ // <--
+}
+
+// OD 2004-03-31 #i26791#
+// --> OD 2004-07-01 #i28701# - added parameter <_bUpdateSortedObjsList>
+void SwDrawContact::_InvalidateObjs( const bool _bUpdateSortedObjsList )
+{
+ // invalidate position of existing 'virtual' drawing objects
+ for ( std::list<SwDrawVirtObj*>::iterator aDisconnectIter = maDrawVirtObjs.begin();
+ aDisconnectIter != maDrawVirtObjs.end();
+ ++aDisconnectIter )
+ {
+ SwDrawVirtObj* pDrawVirtObj = (*aDisconnectIter);
+ // --> OD 2004-08-23 #i33313# - invalidation only for connected
+ // 'virtual' drawing objects
+ if ( pDrawVirtObj->IsConnected() )
+ {
+ pDrawVirtObj->AnchoredObj()->InvalidateObjPos();
+ // --> OD 2004-07-01 #i28701#
+ if ( _bUpdateSortedObjsList )
+ {
+ pDrawVirtObj->AnchoredObj()->UpdateObjInSortedList();
+ }
+ // <--
+ }
+ // <--
+ }
+
+ // invalidate position of 'master' drawing object
+ SwAnchoredObject* pAnchoredObj = GetAnchoredObj( 0L );
+ pAnchoredObj->InvalidateObjPos();
+ // --> OD 2004-07-01 #i28701#
+ if ( _bUpdateSortedObjsList )
+ {
+ pAnchoredObj->UpdateObjInSortedList();
+ }
+ // <--
+}
+
+/*************************************************************************
+|*
+|* SwDrawContact::DisconnectFromLayout()
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 25. Mar. 99
+|*
+|*************************************************************************/
+
+void SwDrawContact::DisconnectFromLayout( bool _bMoveMasterToInvisibleLayer )
+{
+ // OD 10.10.2003 #112299#
+ mbDisconnectInProgress = true;
+
+ // --> OD 2004-10-27 #i36181# - notify background of drawing object
+ if ( _bMoveMasterToInvisibleLayer &&
+ !(GetFmt()->GetDoc()->IsInDtor()) &&
+ GetAnchorFrm() )
+ {
+ const Rectangle aOldRect( maAnchoredDrawObj.GetObjRectWithSpaces().SVRect() );
+ lcl_NotifyBackgroundOfObj( *this, *GetMaster(), &aOldRect );
+ NotifyBackgrdOfAllVirtObjs( &aOldRect );
+ }
+ // <--
+
+ // OD 16.05.2003 #108784# - remove 'virtual' drawing objects from writer
+ // layout and from drawing page
+ for ( std::list<SwDrawVirtObj*>::iterator aDisconnectIter = maDrawVirtObjs.begin();
+ aDisconnectIter != maDrawVirtObjs.end();
+ ++aDisconnectIter )
+ {
+ SwDrawVirtObj* pDrawVirtObj = (*aDisconnectIter);
+ pDrawVirtObj->RemoveFromWriterLayout();
+ pDrawVirtObj->RemoveFromDrawingPage();
+ }
+
+ if ( maAnchoredDrawObj.GetAnchorFrm() )
+ {
+ maAnchoredDrawObj.AnchorFrm()->RemoveDrawObj( maAnchoredDrawObj );
+ }
+
+ if ( _bMoveMasterToInvisibleLayer && GetMaster() && GetMaster()->IsInserted() )
+ {
+ SdrViewIter aIter( GetMaster() );
+ for( SdrView* pView = aIter.FirstView(); pView;
+ pView = aIter.NextView() )
+ {
+ pView->MarkObj( GetMaster(), pView->GetSdrPageView(), sal_True );
+ }
+
+ // OD 25.06.2003 #108784# - Instead of removing 'master' object from
+ // drawing page, move the 'master' drawing object into the corresponding
+ // invisible layer.
+ {
+ //((SwFrmFmt*)GetRegisteredIn())->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)->
+ // RemoveObject( GetMaster()->GetOrdNum() );
+ // OD 21.08.2003 #i18447# - in order to consider group object correct
+ // use new method <SwDrawContact::MoveObjToInvisibleLayer(..)>
+ MoveObjToInvisibleLayer( GetMaster() );
+ }
+ }
+
+ // OD 10.10.2003 #112299#
+ mbDisconnectInProgress = false;
+}
+
+// OD 26.06.2003 #108784# - method to remove 'master' drawing object
+// from drawing page.
+void SwDrawContact::RemoveMasterFromDrawPage()
+{
+ if ( GetMaster() )
+ {
+ GetMaster()->SetUserCall( 0 );
+ if ( GetMaster()->IsInserted() )
+ {
+ ((SwFrmFmt*)GetRegisteredIn())->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)->
+ RemoveObject( GetMaster()->GetOrdNum() );
+ }
+ }
+}
+
+// OD 19.06.2003 #108784# - disconnect for a dedicated drawing object -
+// could be 'master' or 'virtual'.
+// a 'master' drawing object will disconnect a 'virtual' drawing object
+// in order to take its place.
+// OD 13.10.2003 #i19919# - no special case, if drawing object isn't in
+// page header/footer, in order to get drawing objects in repeating table headers
+// also working.
+void SwDrawContact::DisconnectObjFromLayout( SdrObject* _pDrawObj )
+{
+ if ( _pDrawObj->ISA(SwDrawVirtObj) )
+ {
+ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(_pDrawObj);
+ pDrawVirtObj->RemoveFromWriterLayout();
+ pDrawVirtObj->RemoveFromDrawingPage();
+ }
+ else
+ {
+ std::list<SwDrawVirtObj*>::const_iterator aFoundVirtObjIter =
+ std::find_if( maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
+ UsedOrUnusedVirtObjPred( true ) );
+ if ( aFoundVirtObjIter != maDrawVirtObjs.end() )
+ {
+ // replace found 'virtual' drawing object by 'master' drawing
+ // object and disconnect the 'virtual' one
+ SwDrawVirtObj* pDrawVirtObj = (*aFoundVirtObjIter);
+ SwFrm* pNewAnchorFrmOfMaster = pDrawVirtObj->AnchorFrm();
+ // disconnect 'virtual' drawing object
+ pDrawVirtObj->RemoveFromWriterLayout();
+ pDrawVirtObj->RemoveFromDrawingPage();
+ // disconnect 'master' drawing object from current frame
+ GetAnchorFrm()->RemoveDrawObj( maAnchoredDrawObj );
+ // re-connect 'master' drawing object to frame of found 'virtual'
+ // drawing object.
+ pNewAnchorFrmOfMaster->AppendDrawObj( maAnchoredDrawObj );
+ }
+ else
+ {
+ // no connected 'virtual' drawing object found. Thus, disconnect
+ // completely from layout.
+ DisconnectFromLayout();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SwDrawContact::ConnectToLayout()
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 25. Mar. 99
+|*
+|*************************************************************************/
+SwTxtFrm* lcl_GetFlyInCntntAnchor( SwTxtFrm* _pProposedAnchorFrm,
+ const xub_StrLen _nTxtOfs )
+{
+ SwTxtFrm* pAct = _pProposedAnchorFrm;
+ SwTxtFrm* pTmp;
+ do
+ {
+ pTmp = pAct;
+ pAct = pTmp->GetFollow();
+ }
+ while( pAct && _nTxtOfs >= pAct->GetOfst() );
+ return pTmp;
+}
+
+void SwDrawContact::ConnectToLayout( const SwFmtAnchor* pAnch )
+{
+ // OD 10.10.2003 #112299# - *no* connect to layout during disconnection from
+ // layout.
+ if ( mbDisconnectInProgress )
+ {
+ ASSERT( false,
+ "<SwDrawContact::ConnectToLayout(..)> called during disconnection.");
+ return;
+ }
+
+ // --> OD 2004-09-22 #i33909# - *no* connect to layout, if 'master' drawing
+ // object isn't inserted in the drawing page
+ if ( !GetMaster()->IsInserted() )
+ {
+ ASSERT( false, "<SwDrawContact::ConnectToLayout(..)> - master drawing object not inserted -> no connect to layout. Please inform od@openoffice.org" );
+ return;
+ }
+ // <--
+
+ SwFrmFmt* pDrawFrmFmt = (SwFrmFmt*)GetRegisteredIn();
+
+ if( !pDrawFrmFmt->getIDocumentLayoutAccess()->GetCurrentViewShell() )
+ return;
+
+ // OD 16.05.2003 #108784# - remove 'virtual' drawing objects from writer
+ // layout and from drawing page, and remove 'master' drawing object from
+ // writer layout - 'master' object will remain in drawing page.
+ DisconnectFromLayout( false );
+
+ if ( !pAnch )
+ {
+ pAnch = &(pDrawFrmFmt->GetAnchor());
+ }
+
+ switch ( pAnch->GetAnchorId() )
+ {
+ case FLY_AT_PAGE:
+ {
+ sal_uInt16 nPgNum = pAnch->GetPageNum();
+ ViewShell *pShell = pDrawFrmFmt->getIDocumentLayoutAccess()->GetCurrentViewShell();
+ if( !pShell )
+ break;
+ SwRootFrm* pRoot = pShell->GetLayout();
+ SwPageFrm *pPage = static_cast<SwPageFrm*>(pRoot->Lower());
+
+ for ( sal_uInt16 i = 1; i < nPgNum && pPage; ++i )
+ {
+ pPage = static_cast<SwPageFrm*>(pPage->GetNext());
+ }
+
+ if ( pPage )
+ {
+ pPage->AppendDrawObj( maAnchoredDrawObj );
+ }
+ else
+ //Sieht doof aus, ist aber erlaubt (vlg. SwFEShell::SetPageObjsNewPage)
+ pRoot->SetAssertFlyPages();
+ }
+ break;
+
+ case FLY_AT_CHAR:
+ case FLY_AT_PARA:
+ case FLY_AT_FLY:
+ case FLY_AS_CHAR:
+ {
+ if ( pAnch->GetAnchorId() == FLY_AS_CHAR )
+ {
+ ClrContourCache( GetMaster() );
+ }
+ // OD 16.05.2003 #108784# - support drawing objects in header/footer,
+ // but not control objects:
+ // anchor at first found frame the 'master' object and
+ // at the following frames 'virtual' drawing objects.
+ // Note: method is similar to <SwFlyFrmFmt::MakeFrms(..)>
+ SwModify *pModify = 0;
+ if( pAnch->GetCntntAnchor() )
+ {
+ if ( pAnch->GetAnchorId() == FLY_AT_FLY )
+ {
+ SwNodeIndex aIdx( pAnch->GetCntntAnchor()->nNode );
+ SwCntntNode* pCNd = pDrawFrmFmt->GetDoc()->GetNodes().GoNext( &aIdx );
+ if ( SwIterator<SwFrm,SwCntntNode>::FirstElement( *pCNd ) )
+ pModify = pCNd;
+ else
+ {
+ const SwNodeIndex& rIdx = pAnch->GetCntntAnchor()->nNode;
+ SwSpzFrmFmts& rFmts = *(pDrawFrmFmt->GetDoc()->GetSpzFrmFmts());
+ for( sal_uInt16 i = 0; i < rFmts.Count(); ++i )
+ {
+ SwFrmFmt* pFlyFmt = rFmts[i];
+ if( pFlyFmt->GetCntnt().GetCntntIdx() &&
+ rIdx == *(pFlyFmt->GetCntnt().GetCntntIdx()) )
+ {
+ pModify = pFlyFmt;
+ break;
+ }
+ }
+ }
+ // --> OD 2004-06-15 #i29199# - It is possible, that
+ // the anchor doesn't exist - E.g., reordering the
+ // sub-documents in a master document.
+ // Note: The anchor will be inserted later.
+ if ( !pModify )
+ {
+ // break to end of the current switch case.
+ break;
+ }
+ }
+ else
+ {
+ pModify = pAnch->GetCntntAnchor()->nNode.GetNode().GetCntntNode();
+ }
+ }
+ SwIterator<SwFrm,SwModify> aIter( *pModify );
+ SwFrm* pAnchorFrmOfMaster = 0;
+ for( SwFrm *pFrm = aIter.First(); pFrm; pFrm = aIter.Next() )
+ {
+ // append drawing object, if
+ // (1) proposed anchor frame isn't a follow and
+ // (2) drawing object isn't a control object to be anchored
+ // in header/footer.
+ const bool bAdd = ( !pFrm->IsCntntFrm() ||
+ !((SwCntntFrm*)pFrm)->IsFollow() ) &&
+ ( !::CheckControlLayer( GetMaster() ) ||
+ !pFrm->FindFooterOrHeader() );
+
+ if( bAdd )
+ {
+ if ( FLY_AT_FLY == pAnch->GetAnchorId() && !pFrm->IsFlyFrm() )
+ {
+ pFrm = pFrm->FindFlyFrm();
+ ASSERT( pFrm,
+ "<SwDrawContact::ConnectToLayout(..)> - missing fly frame -> crash." );
+ }
+
+ // OD 2004-01-20 #110582# - find correct follow for
+ // as character anchored objects.
+ if ((pAnch->GetAnchorId() == FLY_AS_CHAR) &&
+ pFrm->IsTxtFrm() )
+ {
+ pFrm = lcl_GetFlyInCntntAnchor(
+ static_cast<SwTxtFrm*>(pFrm),
+ pAnch->GetCntntAnchor()->nContent.GetIndex() );
+ }
+
+ if ( !pAnchorFrmOfMaster )
+ {
+ // append 'master' drawing object
+ pAnchorFrmOfMaster = pFrm;
+ pFrm->AppendDrawObj( maAnchoredDrawObj );
+ }
+ else
+ {
+ // append 'virtual' drawing object
+ SwDrawVirtObj* pDrawVirtObj = AddVirtObj();
+ if ( pAnch->GetAnchorId() == FLY_AS_CHAR )
+ {
+ ClrContourCache( pDrawVirtObj );
+ }
+ pFrm->AppendDrawObj( *(pDrawVirtObj->AnchoredObj()) );
+
+ // for repaint, use new ActionChanged()
+ // pDrawVirtObj->SendRepaintBroadcast();
+ pDrawVirtObj->ActionChanged();
+ }
+
+ if ( pAnch->GetAnchorId() == FLY_AS_CHAR )
+ {
+ pFrm->InvalidatePrt();
+ }
+ }
+ }
+ }
+ break;
+ default:
+ ASSERT( sal_False, "Unknown Anchor." )
+ break;
+ }
+ if ( GetAnchorFrm() )
+ {
+ ::setContextWritingMode( maAnchoredDrawObj.DrawObj(), GetAnchorFrm() );
+ // OD 2004-04-01 #i26791# - invalidate objects instead of direct positioning
+ _InvalidateObjs();
+ }
+}
+
+// OD 27.06.2003 #108784# - insert 'master' drawing object into drawing page
+void SwDrawContact::InsertMasterIntoDrawPage()
+{
+ if ( !GetMaster()->IsInserted() )
+ {
+ GetFmt()->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)
+ ->InsertObject( GetMaster(), GetMaster()->GetOrdNumDirect() );
+ }
+ GetMaster()->SetUserCall( this );
+}
+
+/*************************************************************************
+|*
+|* SwDrawContact::FindPage(), ChkPage()
+|*
+|* Ersterstellung MA 21. Mar. 95
+|* Letzte Aenderung MA 19. Jul. 96
+|*
+|*************************************************************************/
+
+SwPageFrm* SwDrawContact::FindPage( const SwRect &rRect )
+{
+ // --> OD 2004-07-01 #i28701# - use method <GetPageFrm()>
+ SwPageFrm* pPg = GetPageFrm();
+ if ( !pPg && GetAnchorFrm() )
+ pPg = GetAnchorFrm()->FindPageFrm();
+ if ( pPg )
+ pPg = (SwPageFrm*)::FindPage( rRect, pPg );
+ return pPg;
+}
+
+void SwDrawContact::ChkPage()
+{
+ // OD 10.10.2003 #112299#
+ if ( mbDisconnectInProgress )
+ {
+ ASSERT( false,
+ "<SwDrawContact::ChkPage()> called during disconnection." );
+ return;
+ }
+
+ // --> OD 2004-07-01 #i28701#
+ SwPageFrm* pPg = ( maAnchoredDrawObj.GetAnchorFrm() &&
+ maAnchoredDrawObj.GetAnchorFrm()->IsPageFrm() )
+ ? GetPageFrm()
+ : FindPage( GetMaster()->GetCurrentBoundRect() );
+ if ( GetPageFrm() != pPg )
+ {
+ // OD 27.06.2003 #108784# - if drawing object is anchor in header/footer
+ // a change of the page is a dramatic change. Thus, completely re-connect
+ // to the layout
+ if ( maAnchoredDrawObj.GetAnchorFrm() &&
+ maAnchoredDrawObj.GetAnchorFrm()->FindFooterOrHeader() )
+ {
+ ConnectToLayout();
+ }
+ else
+ {
+ // --> OD 2004-07-01 #i28701# - use methods <GetPageFrm()> and <SetPageFrm>
+ if ( GetPageFrm() )
+ GetPageFrm()->RemoveDrawObjFromPage( maAnchoredDrawObj );
+ pPg->AppendDrawObjToPage( maAnchoredDrawObj );
+ SetPageFrm( pPg );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SwDrawContact::ChangeMasterObject()
+|*
+|* Ersterstellung MA 07. Aug. 95
+|* Letzte Aenderung MA 20. Apr. 99
+|*
+|*************************************************************************/
+// OD 10.07.2003 #110742# - Important note:
+// method is called by method <SwDPage::ReplaceObject(..)>, which called its
+// corresponding superclass method <FmFormPage::ReplaceObject(..)>.
+// Note: 'master' drawing object *has* to be connected to layout triggered
+// by the caller of this, if method is called.
+void SwDrawContact::ChangeMasterObject( SdrObject *pNewMaster )
+{
+ DisconnectFromLayout( false );
+ // OD 10.07.2003 #110742# - consider 'virtual' drawing objects
+ RemoveAllVirtObjs();
+
+ GetMaster()->SetUserCall( 0 );
+ SetMaster( pNewMaster );
+ GetMaster()->SetUserCall( this );
+
+ _InvalidateObjs();
+}
+
+/** get data collection of anchored objects, handled by with contact
+
+ OD 2004-08-23 #110810#
+
+ @author
+*/
+void SwDrawContact::GetAnchoredObjs( std::list<SwAnchoredObject*>& _roAnchoredObjs ) const
+{
+ _roAnchoredObjs.push_back( const_cast<SwAnchoredDrawObject*>(&maAnchoredDrawObj) );
+
+ for ( std::list<SwDrawVirtObj*>::const_iterator aDrawVirtObjsIter = maDrawVirtObjs.begin();
+ aDrawVirtObjsIter != maDrawVirtObjs.end();
+ ++aDrawVirtObjsIter )
+ {
+ _roAnchoredObjs.push_back( (*aDrawVirtObjsIter)->AnchoredObj() );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////
+// AW: own sdr::contact::ViewContact (VC) sdr::contact::ViewObjectContact (VOC) needed
+// since offset is defined different from SdrVirtObj's sdr::contact::ViewContactOfVirtObj.
+// For paint, that offset is used by setting at the OutputDevice; for primitives this is
+// not possible since we have no OutputDevice, but define the geometry itself.
+
+namespace sdr
+{
+ namespace contact
+ {
+ class VOCOfDrawVirtObj : public ViewObjectContactOfSdrObj
+ {
+ protected:
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored/cached in the local primitive. Default gets view-independent Primitive
+ // from the ViewContact using ViewContact::getViewIndependentPrimitive2DSequence(), takes care of
+ // visibility, handles glue and ghosted.
+ // This method will not handle included hierarchies and not check geometric visibility.
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ public:
+ VOCOfDrawVirtObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
+ {
+ }
+
+ virtual ~VOCOfDrawVirtObj();
+ };
+
+ class VCOfDrawVirtObj : public ViewContactOfVirtObj
+ {
+ protected:
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something. Default is to create
+ // a standard ViewObjectContact containing the given ObjectContact and *this
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ public:
+ // basic constructor, used from SdrObject.
+ VCOfDrawVirtObj(SwDrawVirtObj& rObj)
+ : ViewContactOfVirtObj(rObj)
+ {
+ }
+ virtual ~VCOfDrawVirtObj();
+
+ // access to SwDrawVirtObj
+ SwDrawVirtObj& GetSwDrawVirtObj() const
+ {
+ return (SwDrawVirtObj&)mrObject;
+ }
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+namespace sdr
+{
+ namespace contact
+ {
+ // recursively collect primitive data from given VOC with given offset
+ void impAddPrimitivesFromGroup(const ViewObjectContact& rVOC, const basegfx::B2DHomMatrix& rOffsetMatrix, const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DSequence& rxTarget)
+ {
+ const sal_uInt32 nSubHierarchyCount(rVOC.GetViewContact().GetObjectCount());
+
+ for(sal_uInt32 a(0L); a < nSubHierarchyCount; a++)
+ {
+ const ViewObjectContact& rCandidate(rVOC.GetViewContact().GetViewContact(a).GetViewObjectContact(rVOC.GetObjectContact()));
+
+ if(rCandidate.GetViewContact().GetObjectCount())
+ {
+ // is a group object itself, call resursively
+ impAddPrimitivesFromGroup(rCandidate, rOffsetMatrix, rDisplayInfo, rxTarget);
+ }
+ else
+ {
+ // single object, add primitives; check model-view visibility
+ if(rCandidate.isPrimitiveVisible(rDisplayInfo))
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aNewSequence(rCandidate.getPrimitive2DSequence(rDisplayInfo));
+
+ if(aNewSequence.hasElements())
+ {
+ // get ranges
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(rCandidate.GetObjectContact().getViewInformation2D());
+ const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
+ basegfx::B2DRange aObjectRange(rCandidate.getObjectRange());
+
+ // correct with virtual object's offset
+ aObjectRange.transform(rOffsetMatrix);
+
+ // check geometrical visibility (with offset)
+ if(!aViewRange.overlaps(aObjectRange))
+ {
+ // not visible, release
+ aNewSequence.realloc(0);
+ }
+ }
+
+ if(aNewSequence.hasElements())
+ {
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rxTarget, aNewSequence);
+ }
+ }
+ }
+ }
+ }
+
+ 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;
+
+ // create offset transformation
+ basegfx::B2DHomMatrix aOffsetMatrix;
+ const Point aLocalOffset(rVC.GetSwDrawVirtObj().GetOffset());
+
+ 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))
+ {
+ // group object. Since the VOC/OC/VC hierarchy does not represent the
+ // hierarchy virtual objects when they have group objects
+ // (ViewContactOfVirtObj::GetObjectCount() returns null for that purpose)
+ // to avoid multiple usages of VOCs (which would not work), the primitives
+ // for the sub-hierarchy need to be collected here
+
+ // Get the VOC of the referenced object (the Group) and fetch primitives from it
+ const ViewObjectContact& rVOCOfRefObj = rReferencedObject.GetViewContact().GetViewObjectContact(GetObjectContact());
+ impAddPrimitivesFromGroup(rVOCOfRefObj, aOffsetMatrix, rDisplayInfo, xRetval);
+ }
+ else
+ {
+ // single object, use method from referenced object to get the Primitive2DSequence
+ xRetval = rReferencedObject.GetViewContact().getViewIndependentPrimitive2DSequence();
+ }
+
+ if(xRetval.hasElements())
+ {
+ // create transform primitive
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::TransformPrimitive2D(aOffsetMatrix, xRetval));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ return xRetval;
+ }
+
+ VOCOfDrawVirtObj::~VOCOfDrawVirtObj()
+ {
+ }
+
+ ViewObjectContact& VCOfDrawVirtObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ return *(new VOCOfDrawVirtObj(rObjectContact, *this));
+ }
+
+ VCOfDrawVirtObj::~VCOfDrawVirtObj()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////////////
+
+// =============================================================================
+/** implementation of class <SwDrawVirtObj>
+
+ OD 14.05.2003 #108784#
+
+ @author OD
+*/
+
+TYPEINIT1(SwDrawVirtObj,SdrVirtObj);
+
+sdr::contact::ViewContact* SwDrawVirtObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::VCOfDrawVirtObj(*this);
+}
+
+// #108784#
+// implemetation of SwDrawVirtObj
+SwDrawVirtObj::SwDrawVirtObj( SdrObject& _rNewObj,
+ SwDrawContact& _rDrawContact )
+ : SdrVirtObj( _rNewObj ),
+ // OD 2004-03-29 #i26791# - init new member <maAnchoredDrawObj>
+ maAnchoredDrawObj(),
+ mrDrawContact( _rDrawContact )
+{
+ // OD 2004-03-29 #i26791#
+ maAnchoredDrawObj.SetDrawObj( *this );
+ // --> OD 2004-11-17 #i35635# - set initial position out of sight
+ NbcMove( Size( -RECT_EMPTY, -RECT_EMPTY ) );
+ // <--
+}
+
+SwDrawVirtObj::~SwDrawVirtObj()
+{}
+
+void SwDrawVirtObj::operator=( const SdrObject& rObj )
+{
+ SdrVirtObj::operator=(rObj);
+ // Note: Members <maAnchoredDrawObj> and <mrDrawContact>
+ // haven't to be considered.
+}
+
+SdrObject* SwDrawVirtObj::Clone() const
+{
+ SwDrawVirtObj* pObj = new SwDrawVirtObj( rRefObj, mrDrawContact );
+
+ if ( pObj )
+ {
+ pObj->operator=(static_cast<const SdrObject&>(*this));
+ // Note: Member <maAnchoredDrawObj> hasn't to be considered.
+ }
+
+ return pObj;
+}
+
+// --------------------------------------------------------------------
+// connection to writer layout: <GetAnchoredObj()>, <SetAnchorFrm(..)>,
+// <GetAnchorFrm()>, <SetPageFrm(..)>, <GetPageFrm()> and <RemoveFromWriterLayout()>
+// --------------------------------------------------------------------
+const SwAnchoredObject* SwDrawVirtObj::GetAnchoredObj() const
+{
+ return &maAnchoredDrawObj;
+}
+
+SwAnchoredObject* SwDrawVirtObj::AnchoredObj()
+{
+ return &maAnchoredDrawObj;
+}
+
+const SwFrm* SwDrawVirtObj::GetAnchorFrm() const
+{
+ // OD 2004-03-29 #i26791# - use new member <maAnchoredDrawObj>
+ return maAnchoredDrawObj.GetAnchorFrm();
+}
+
+SwFrm* SwDrawVirtObj::AnchorFrm()
+{
+ // OD 2004-03-29 #i26791# - use new member <maAnchoredDrawObj>
+ return maAnchoredDrawObj.AnchorFrm();
+}
+
+void SwDrawVirtObj::RemoveFromWriterLayout()
+{
+ // remove contact object from frame for 'virtual' drawing object
+ // OD 2004-03-29 #i26791# - use new member <maAnchoredDrawObj>
+ if ( maAnchoredDrawObj.GetAnchorFrm() )
+ {
+ maAnchoredDrawObj.AnchorFrm()->RemoveDrawObj( maAnchoredDrawObj );
+ }
+}
+
+// --------------------------------------------------------------------
+// connection to writer layout: <AddToDrawingPage()>, <RemoveFromDrawingPage()>
+// --------------------------------------------------------------------
+void SwDrawVirtObj::AddToDrawingPage()
+{
+ // determine 'master'
+ SdrObject* pOrgMasterSdrObj = mrDrawContact.GetMaster();
+
+ // insert 'virtual' drawing object into page, set layer and user call.
+ SdrPage* pDrawPg;
+ // --> OD 2004-08-16 #i27030# - apply order number of referenced object
+ if ( 0 != ( pDrawPg = pOrgMasterSdrObj->GetPage() ) )
+ {
+ // --> OD 2004-08-16 #i27030# - apply order number of referenced object
+ pDrawPg->InsertObject( this, GetReferencedObj().GetOrdNum() );
+ }
+ else
+ {
+ pDrawPg = GetPage();
+ if ( pDrawPg )
+ {
+ pDrawPg->SetObjectOrdNum( GetOrdNumDirect(),
+ GetReferencedObj().GetOrdNum() );
+ }
+ else
+ {
+ SetOrdNum( GetReferencedObj().GetOrdNum() );
+ }
+ }
+ // <--
+ SetUserCall( &mrDrawContact );
+}
+
+void SwDrawVirtObj::RemoveFromDrawingPage()
+{
+ SetUserCall( 0 );
+ if ( GetPage() )
+ {
+ GetPage()->RemoveObject( GetOrdNum() );
+ }
+}
+
+// is 'virtual' drawing object connected to writer layout and to drawing layer.
+bool SwDrawVirtObj::IsConnected() const
+{
+ bool bRetVal = GetAnchorFrm() &&
+ ( GetPage() && GetUserCall() );
+
+ return bRetVal;
+}
+
+void SwDrawVirtObj::NbcSetAnchorPos(const Point& rPnt)
+{
+ SdrObject::NbcSetAnchorPos( rPnt );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #i97197#
+// the methods relevant for positioning
+
+const Rectangle& SwDrawVirtObj::GetCurrentBoundRect() const
+{
+ if(aOutRect.IsEmpty())
+ {
+ const_cast<SwDrawVirtObj*>(this)->RecalcBoundRect();
+ }
+
+ return aOutRect;
+}
+
+const Rectangle& SwDrawVirtObj::GetLastBoundRect() const
+{
+ return aOutRect;
+}
+
+const Point SwDrawVirtObj::GetOffset() const
+{
+ // do NOT use IsEmpty() here, there is already a useful offset
+ // in the position
+ if(aOutRect == Rectangle())
+ {
+ return Point();
+ }
+ else
+ {
+ return aOutRect.TopLeft() - GetReferencedObj().GetCurrentBoundRect().TopLeft();
+ }
+}
+
+void SwDrawVirtObj::SetBoundRectDirty()
+{
+ // do nothing to not lose model information in aOutRect
+}
+
+void SwDrawVirtObj::RecalcBoundRect()
+{
+ // OD 2004-04-05 #i26791# - switch order of calling <GetOffset()> and
+ // <ReferencedObj().GetCurrentBoundRect()>, because <GetOffset()> calculates
+ // its value by the 'BoundRect' of the referenced object.
+ //aOutRect = rRefObj.GetCurrentBoundRect();
+ //aOutRect += GetOffset();
+
+ const Point aOffset(GetOffset());
+ aOutRect = ReferencedObj().GetCurrentBoundRect() + aOffset;
+}
+
+basegfx::B2DPolyPolygon SwDrawVirtObj::TakeXorPoly() const
+{
+ basegfx::B2DPolyPolygon aRetval(rRefObj.TakeXorPoly());
+ aRetval.transform(basegfx::tools::createTranslateB2DHomMatrix(GetOffset().X(), GetOffset().Y()));
+
+ return aRetval;
+}
+
+basegfx::B2DPolyPolygon SwDrawVirtObj::TakeContour() const
+{
+ basegfx::B2DPolyPolygon aRetval(rRefObj.TakeContour());
+ aRetval.transform(basegfx::tools::createTranslateB2DHomMatrix(GetOffset().X(), GetOffset().Y()));
+
+ return aRetval;
+}
+
+SdrHdl* SwDrawVirtObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ SdrHdl* pHdl = rRefObj.GetHdl(nHdlNum);
+ Point aP(pHdl->GetPos() + GetOffset());
+ pHdl->SetPos(aP);
+
+ return pHdl;
+}
+
+SdrHdl* SwDrawVirtObj::GetPlusHdl(const SdrHdl& rHdl, sal_uInt16 nPlNum) const
+{
+ SdrHdl* pHdl = rRefObj.GetPlusHdl(rHdl, nPlNum);
+ pHdl->SetPos(pHdl->GetPos() + GetOffset());
+
+ return pHdl;
+}
+
+void SwDrawVirtObj::NbcMove(const Size& rSiz)
+{
+ SdrObject::NbcMove( rSiz );
+}
+
+void SwDrawVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ rRefObj.NbcResize(rRef - GetOffset(), xFact, yFact);
+ SetRectsDirty();
+}
+
+void SwDrawVirtObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ rRefObj.NbcRotate(rRef - GetOffset(), nWink, sn, cs);
+ SetRectsDirty();
+}
+
+void SwDrawVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2)
+{
+ rRefObj.NbcMirror(rRef1 - GetOffset(), rRef2 - GetOffset());
+ SetRectsDirty();
+}
+
+void SwDrawVirtObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ rRefObj.NbcShear(rRef - GetOffset(), nWink, tn, bVShear);
+ SetRectsDirty();
+}
+
+void SwDrawVirtObj::Move(const Size& rSiz)
+{
+ SdrObject::Move( rSiz );
+// Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
+// rRefObj.Move( rSiz );
+// SetRectsDirty();
+// SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+}
+
+void SwDrawVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ if(xFact.GetNumerator() != xFact.GetDenominator() || yFact.GetNumerator() != yFact.GetDenominator())
+ {
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
+ rRefObj.Resize(rRef - GetOffset(), xFact, yFact);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+ }
+}
+
+void SwDrawVirtObj::Rotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ if(nWink)
+ {
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
+ rRefObj.Rotate(rRef - GetOffset(), nWink, sn, cs);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+ }
+}
+
+void SwDrawVirtObj::Mirror(const Point& rRef1, const Point& rRef2)
+{
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
+ rRefObj.Mirror(rRef1 - GetOffset(), rRef2 - GetOffset());
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+}
+
+void SwDrawVirtObj::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ if(nWink)
+ {
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
+ rRefObj.Shear(rRef - GetOffset(), nWink, tn, bVShear);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+ }
+}
+
+void SwDrawVirtObj::RecalcSnapRect()
+{
+ aSnapRect = rRefObj.GetSnapRect();
+ aSnapRect += GetOffset();
+}
+
+const Rectangle& SwDrawVirtObj::GetSnapRect() const
+{
+ ((SwDrawVirtObj*)this)->aSnapRect = rRefObj.GetSnapRect();
+ ((SwDrawVirtObj*)this)->aSnapRect += GetOffset();
+
+ return aSnapRect;
+}
+
+void SwDrawVirtObj::SetSnapRect(const Rectangle& rRect)
+{
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
+ Rectangle aR(rRect);
+ aR -= GetOffset();
+ rRefObj.SetSnapRect(aR);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+}
+
+void SwDrawVirtObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ Rectangle aR(rRect);
+ aR -= GetOffset();
+ SetRectsDirty();
+ rRefObj.NbcSetSnapRect(aR);
+}
+
+const Rectangle& SwDrawVirtObj::GetLogicRect() const
+{
+ ((SwDrawVirtObj*)this)->aSnapRect = rRefObj.GetLogicRect();
+ ((SwDrawVirtObj*)this)->aSnapRect += GetOffset();
+
+ return aSnapRect;
+}
+
+void SwDrawVirtObj::SetLogicRect(const Rectangle& rRect)
+{
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
+ Rectangle aR(rRect);
+ aR -= GetOffset();
+ rRefObj.SetLogicRect(aR);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+}
+
+void SwDrawVirtObj::NbcSetLogicRect(const Rectangle& rRect)
+{
+ Rectangle aR(rRect);
+ aR -= GetOffset();
+ rRefObj.NbcSetLogicRect(aR);
+ SetRectsDirty();
+}
+
+Point SwDrawVirtObj::GetSnapPoint(sal_uInt32 i) const
+{
+ Point aP(rRefObj.GetSnapPoint(i));
+ aP += GetOffset();
+
+ return aP;
+}
+
+Point SwDrawVirtObj::GetPoint(sal_uInt32 i) const
+{
+ return Point(rRefObj.GetPoint(i) + GetOffset());
+}
+
+void SwDrawVirtObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
+{
+ Point aP(rPnt);
+ aP -= GetOffset();
+ rRefObj.SetPoint(aP, i);
+ SetRectsDirty();
+}
+
+// #108784#
+FASTBOOL SwDrawVirtObj::HasTextEdit() const
+{
+ return rRefObj.HasTextEdit();
+}
+
+// OD 18.06.2003 #108784# - overloaded 'layer' methods for 'virtual' drawing
+// object to assure, that layer of 'virtual' object is the layer of the referenced
+// object.
+SdrLayerID SwDrawVirtObj::GetLayer() const
+{
+ return GetReferencedObj().GetLayer();
+}
+
+void SwDrawVirtObj::NbcSetLayer(SdrLayerID nLayer)
+{
+ ReferencedObj().NbcSetLayer( nLayer );
+ SdrVirtObj::NbcSetLayer( ReferencedObj().GetLayer() );
+}
+
+void SwDrawVirtObj::SetLayer(SdrLayerID nLayer)
+{
+ ReferencedObj().SetLayer( nLayer );
+ SdrVirtObj::NbcSetLayer( ReferencedObj().GetLayer() );
+}
+
+bool SwDrawVirtObj::supportsFullDrag() const
+{
+ // call parent
+ return SdrVirtObj::supportsFullDrag();
+}
+
+SdrObject* SwDrawVirtObj::getFullDragClone() const
+{
+ // call parent
+ return SdrVirtObj::getFullDragClone();
+}
+
+// eof
+
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
new file mode 100644
index 000000000000..73616b18fc36
--- /dev/null
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -0,0 +1,981 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include "hintids.hxx"
+#include <svx/svdtrans.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/opaqitem.hxx>
+#include <svx/svdpage.hxx>
+
+
+#include <fmtclds.hxx>
+#include <fmtornt.hxx>
+#include <fmtfsize.hxx>
+#include <fmturl.hxx>
+#include "viewsh.hxx"
+#include "viewimp.hxx"
+#include "cntfrm.hxx"
+#include "frmatr.hxx"
+#include "doc.hxx"
+#include <IDocumentUndoRedo.hxx>
+#include "dview.hxx"
+#include "dflyobj.hxx"
+#include "flyfrm.hxx"
+#include "frmfmt.hxx"
+#include "viewopt.hxx"
+#include "frmtool.hxx"
+#include "flyfrms.hxx"
+#include "ndnotxt.hxx"
+#include "grfatr.hxx"
+#include "pagefrm.hxx"
+#include "rootfrm.hxx"
+
+
+using namespace ::com::sun::star;
+
+
+// --> OD 2004-11-22 #117958#
+#include <svx/sdr/properties/defaultproperties.hxx>
+// <--
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+// AW: For VCOfDrawVirtObj and stuff
+#include <svx/sdr/contact/viewcontactofvirtobj.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+using namespace ::com::sun::star;
+
+static sal_Bool bInResize = sal_False;
+
+TYPEINIT1( SwFlyDrawObj, SdrObject )
+TYPEINIT1( SwVirtFlyDrawObj, SdrVirtObj )
+
+/*************************************************************************
+|*
+|* SwFlyDrawObj::Ctor
+|*
+|* Ersterstellung MA 18. Apr. 95
+|* Letzte Aenderung MA 28. May. 96
+|*
+*************************************************************************/
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // #i95264# currently needed since createViewIndependentPrimitive2DSequence()
+ // is called when RecalcBoundRect() is used. There should currently no VOCs being
+ // constructed since it gets not visualized (instead the corresponding SwVirtFlyDrawObj's
+ // referencing this one are visualized).
+ class VCOfSwFlyDrawObj : public ViewContactOfSdrObj
+ {
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ // basic constructor, used from SdrObject.
+ VCOfSwFlyDrawObj(SwFlyDrawObj& rObj)
+ : ViewContactOfSdrObj(rObj)
+ {
+ }
+ virtual ~VCOfSwFlyDrawObj();
+ };
+
+ drawinglayer::primitive2d::Primitive2DSequence VCOfSwFlyDrawObj::createViewIndependentPrimitive2DSequence() const
+ {
+ // currently gets not visualized, return empty sequence
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ }
+
+ VCOfSwFlyDrawObj::~VCOfSwFlyDrawObj()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sdr::properties::BaseProperties* SwFlyDrawObj::CreateObjectSpecificProperties()
+{
+ // --> OD 2004-11-22 #117958# - create default properties
+ return new sdr::properties::DefaultProperties(*this);
+ // <--
+}
+
+sdr::contact::ViewContact* SwFlyDrawObj::CreateObjectSpecificViewContact()
+{
+ // #i95264# needs an own VC since createViewIndependentPrimitive2DSequence()
+ // is called when RecalcBoundRect() is used
+ return new sdr::contact::VCOfSwFlyDrawObj(*this);
+}
+
+SwFlyDrawObj::SwFlyDrawObj()
+{
+}
+
+SwFlyDrawObj::~SwFlyDrawObj()
+{
+}
+
+/*************************************************************************
+|*
+|* SwFlyDrawObj::Factory-Methoden
+|*
+|* Ersterstellung MA 23. Feb. 95
+|* Letzte Aenderung MA 23. Feb. 95
+|*
+*************************************************************************/
+
+sal_uInt32 __EXPORT SwFlyDrawObj::GetObjInventor() const
+{
+ return SWGInventor;
+}
+
+
+sal_uInt16 __EXPORT SwFlyDrawObj::GetObjIdentifier() const
+{
+ return SwFlyDrawObjIdentifier;
+}
+
+
+sal_uInt16 __EXPORT SwFlyDrawObj::GetObjVersion() const
+{
+ return SwDrawFirst;
+}
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::CToren, Dtor
+|*
+|* Ersterstellung MA 08. Dec. 94
+|* Letzte Aenderung MA 28. May. 96
+|*
+*************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////////////////
+// AW: Need own primitive to get the FlyFrame paint working
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SwVirtFlyDrawObjPrimitive : public BufferedDecompositionPrimitive2D
+ {
+ 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 create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ SwVirtFlyDrawObjPrimitive(
+ const SwVirtFlyDrawObj& rSwVirtFlyDrawObj,
+ const basegfx::B2DRange &rOuterRange)
+ : BufferedDecompositionPrimitive2D(),
+ mrSwVirtFlyDrawObj(rSwVirtFlyDrawObj),
+ maOuterRange(rOuterRange)
+ {
+ }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // 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()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SwVirtFlyDrawObjPrimitive::create2DDecomposition(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 invisible geometry to allow corfect HitTest and BoundRect calculations for the
+ // object. Use a filled primitive to get '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 null-tolerance
+ // as it was done in the old implementation
+ const Primitive2DReference aHitTestReference(
+ createHiddenGeometryPrimitives2D(
+ true,
+ getOuterRange()));
+
+ aRetval = Primitive2DSequence(&aHitTestReference, 1);
+ }
+
+ return aRetval;
+ }
+
+ bool SwVirtFlyDrawObjPrimitive::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SwVirtFlyDrawObjPrimitive& rCompare = (SwVirtFlyDrawObjPrimitive&)rPrimitive;
+
+ return (&getSwVirtFlyDrawObj() == &rCompare.getSwVirtFlyDrawObj()
+ && getOuterRange() == rCompare.getOuterRange());
+ }
+
+ return false;
+ }
+
+ basegfx::B2DRange SwVirtFlyDrawObjPrimitive::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ return getOuterRange();
+ }
+
+ 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.
+ getSwVirtFlyDrawObj().wrap_DoPaintObject();
+
+ // call parent
+ return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation);
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SwVirtFlyDrawObjPrimitive, PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////////////
+// AW: own sdr::contact::ViewContact (VC) sdr::contact::ViewObjectContact (VOC) needed
+// since offset is defined different from SdrVirtObj's sdr::contact::ViewContactOfVirtObj.
+// For paint, that offset is used by setting at the OutputDevice; for primitives this is
+// not possible since we have no OutputDevice, but define the geometry itself.
+
+namespace sdr
+{
+ namespace contact
+ {
+ class VCOfSwVirtFlyDrawObj : public ViewContactOfVirtObj
+ {
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ // basic constructor, used from SdrObject.
+ VCOfSwVirtFlyDrawObj(SwVirtFlyDrawObj& rObj)
+ : ViewContactOfVirtObj(rObj)
+ {
+ }
+ virtual ~VCOfSwVirtFlyDrawObj();
+
+ // access to SwVirtFlyDrawObj
+ SwVirtFlyDrawObj& GetSwVirtFlyDrawObj() const
+ {
+ return (SwVirtFlyDrawObj&)mrObject;
+ }
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+namespace sdr
+{
+ namespace contact
+ {
+ drawinglayer::primitive2d::Primitive2DSequence VCOfSwVirtFlyDrawObj::createViewIndependentPrimitive2DSequence() const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SdrObject& rReferencedObject = GetSwVirtFlyDrawObj().GetReferencedObj();
+
+ if(rReferencedObject.ISA(SwFlyDrawObj))
+ {
+ // 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;
+ }
+
+ VCOfSwVirtFlyDrawObj::~VCOfSwVirtFlyDrawObj()
+ {
+ }
+ } // end of namespace contact
+} // end of 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
+ // for being able to visualize the FlyFrames in primitive renderers
+ return new sdr::contact::VCOfSwVirtFlyDrawObj(*this);
+}
+
+SwVirtFlyDrawObj::SwVirtFlyDrawObj(SdrObject& rNew, SwFlyFrm* pFly) :
+ SdrVirtObj( rNew ),
+ pFlyFrm( pFly )
+{
+ //#110094#-1
+ // bNotPersistent = bNeedColorRestore = bWriterFlyFrame = sal_True;
+ const SvxProtectItem &rP = pFlyFrm->GetFmt()->GetProtect();
+ bMovProt = rP.IsPosProtected();
+ bSizProt = rP.IsSizeProtected();
+}
+
+
+__EXPORT SwVirtFlyDrawObj::~SwVirtFlyDrawObj()
+{
+ if ( GetPage() ) //Der SdrPage die Verantwortung entziehen.
+ GetPage()->RemoveObject( GetOrdNum() );
+}
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::GetFmt()
+|*
+|* Ersterstellung MA 08. Dec. 94
+|* Letzte Aenderung MA 08. Dec. 94
+|*
+*************************************************************************/
+
+const SwFrmFmt *SwVirtFlyDrawObj::GetFmt() const
+{
+ return GetFlyFrm()->GetFmt();
+}
+
+
+SwFrmFmt *SwVirtFlyDrawObj::GetFmt()
+{
+ return GetFlyFrm()->GetFmt();
+}
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::Paint()
+|*
+|* Ersterstellung MA 20. Dec. 94
+|* Letzte Aenderung MA 18. Dec. 95
+|*
+*************************************************************************/
+
+void SwVirtFlyDrawObj::wrap_DoPaintObject() const
+{
+ ViewShell* pShell = pFlyFrm->getRootFrm()->GetCurrShell();
+
+ // Only paint when we have a current shell and a DrawingLayer paint is in progress.
+ // This avcoids evtl. problems with renderers which do processing stuff,
+ // but no paints. IsPaintInProgress() depends on SW repaint, so, as long
+ // as SW paints self and calls DrawLayer() for Heaven and Hell, this will
+ // be correct
+ if(pShell && pShell->IsDrawingLayerPaintInProgress())
+ {
+ sal_Bool bDrawObject(sal_True);
+
+ if(!SwFlyFrm::IsPaint((SdrObject*)this, pShell))
+ {
+ bDrawObject = sal_False;
+ }
+
+ if(bDrawObject)
+ {
+ if(!pFlyFrm->IsFlyInCntFrm())
+ {
+ // it is also necessary to restore the VCL MapMode from ViewInformation since e.g.
+ // the VCL PixelRenderer resets it at the used OutputDevice. Unfortunately, this
+ // excludes shears and rotates which are not expressable in MapMode.
+ OutputDevice* pOut = pShell->GetOut();
+
+ pOut->Push(PUSH_MAPMODE);
+ pOut->SetMapMode(pShell->getPrePostMapMode());
+
+ // paint the FlyFrame (use standard VCL-Paint)
+ pFlyFrm->Paint(GetFlyFrm()->Frm());
+
+ pOut->Pop();
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::TakeObjInfo()
+|*
+|* Ersterstellung MA 03. May. 95
+|* Letzte Aenderung MA 03. May. 95
+|*
+*************************************************************************/
+
+void __EXPORT SwVirtFlyDrawObj::TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const
+{
+ rInfo.bSelectAllowed = rInfo.bMoveAllowed =
+ rInfo.bResizeFreeAllowed = rInfo.bResizePropAllowed = sal_True;
+
+ rInfo.bRotateFreeAllowed = rInfo.bRotate90Allowed =
+ rInfo.bMirrorFreeAllowed = rInfo.bMirror45Allowed =
+ rInfo.bMirror90Allowed = rInfo.bShearAllowed =
+ rInfo.bCanConvToPath = rInfo.bCanConvToPoly =
+ rInfo.bCanConvToPathLineToArea = rInfo.bCanConvToPolyLineToArea = sal_False;
+}
+
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::Groessenermittlung
+|*
+|* Ersterstellung MA 12. Jan. 95
+|* Letzte Aenderung MA 10. Nov. 95
+|*
+*************************************************************************/
+
+void SwVirtFlyDrawObj::SetRect() const
+{
+ if ( GetFlyFrm()->Frm().HasArea() )
+ ((SwVirtFlyDrawObj*)this)->aOutRect = GetFlyFrm()->Frm().SVRect();
+ else
+ ((SwVirtFlyDrawObj*)this)->aOutRect = Rectangle();
+}
+
+
+const Rectangle& __EXPORT SwVirtFlyDrawObj::GetCurrentBoundRect() const
+{
+ SetRect();
+ return aOutRect;
+}
+
+const Rectangle& __EXPORT SwVirtFlyDrawObj::GetLastBoundRect() const
+{
+ return GetCurrentBoundRect();
+}
+
+
+void __EXPORT SwVirtFlyDrawObj::RecalcBoundRect()
+{
+ SetRect();
+}
+
+
+void __EXPORT SwVirtFlyDrawObj::RecalcSnapRect()
+{
+ SetRect();
+}
+
+
+const Rectangle& __EXPORT SwVirtFlyDrawObj::GetSnapRect() const
+{
+ SetRect();
+ return aOutRect;
+}
+
+
+void __EXPORT SwVirtFlyDrawObj::SetSnapRect(const Rectangle& )
+{
+ Rectangle aTmp( GetLastBoundRect() );
+ SetRect();
+ SetChanged();
+ BroadcastObjectChange();
+ if (pUserCall!=NULL)
+ pUserCall->Changed(*this, SDRUSERCALL_RESIZE, aTmp);
+}
+
+
+void __EXPORT SwVirtFlyDrawObj::NbcSetSnapRect(const Rectangle& )
+{
+ SetRect();
+}
+
+
+const Rectangle& __EXPORT SwVirtFlyDrawObj::GetLogicRect() const
+{
+ SetRect();
+ return aOutRect;
+}
+
+
+void __EXPORT SwVirtFlyDrawObj::SetLogicRect(const Rectangle& )
+{
+ Rectangle aTmp( GetLastBoundRect() );
+ SetRect();
+ SetChanged();
+ BroadcastObjectChange();
+ if (pUserCall!=NULL)
+ pUserCall->Changed(*this, SDRUSERCALL_RESIZE, aTmp);
+}
+
+
+void __EXPORT SwVirtFlyDrawObj::NbcSetLogicRect(const Rectangle& )
+{
+ SetRect();
+}
+
+
+::basegfx::B2DPolyPolygon SwVirtFlyDrawObj::TakeXorPoly() const
+{
+ const Rectangle aSourceRectangle(GetFlyFrm()->Frm().SVRect());
+ const ::basegfx::B2DRange aSourceRange(aSourceRectangle.Left(), aSourceRectangle.Top(), aSourceRectangle.Right(), aSourceRectangle.Bottom());
+ ::basegfx::B2DPolyPolygon aRetval;
+
+ aRetval.append(::basegfx::tools::createPolygonFromRect(aSourceRange));
+
+ return aRetval;
+}
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::Move() und Resize()
+|*
+|* Ersterstellung MA 12. Jan. 95
+|* Letzte Aenderung MA 26. Jul. 96
+|*
+*************************************************************************/
+
+void __EXPORT SwVirtFlyDrawObj::NbcMove(const Size& rSiz)
+{
+ MoveRect( aOutRect, rSiz );
+ const Point aOldPos( GetFlyFrm()->Frm().Pos() );
+ const Point aNewPos( aOutRect.TopLeft() );
+ const SwRect aFlyRect( aOutRect );
+
+ //Wenn der Fly eine automatische Ausrichtung hat (rechts oder oben),
+ //so soll die Automatik erhalten bleiben
+ SwFrmFmt *pFmt = GetFlyFrm()->GetFmt();
+ const sal_Int16 eHori = pFmt->GetHoriOrient().GetHoriOrient();
+ const sal_Int16 eVert = pFmt->GetVertOrient().GetVertOrient();
+ const sal_Int16 eRelHori = pFmt->GetHoriOrient().GetRelationOrient();
+ const sal_Int16 eRelVert = pFmt->GetVertOrient().GetRelationOrient();
+ //Bei Absatzgebundenen Flys muss ausgehend von der neuen Position ein
+ //neuer Anker gesetzt werden. Anker und neue RelPos werden vom Fly selbst
+ //berechnet und gesetzt.
+ if( GetFlyFrm()->IsFlyAtCntFrm() )
+ ((SwFlyAtCntFrm*)GetFlyFrm())->SetAbsPos( aNewPos );
+ else
+ {
+ const SwFrmFmt *pTmpFmt = GetFmt();
+ const SwFmtVertOrient &rVert = pTmpFmt->GetVertOrient();
+ const SwFmtHoriOrient &rHori = pTmpFmt->GetHoriOrient();
+ long lXDiff = aNewPos.X() - aOldPos.X();
+ if( rHori.IsPosToggle() && text::HoriOrientation::NONE == eHori &&
+ !GetFlyFrm()->FindPageFrm()->OnRightPage() )
+ lXDiff = -lXDiff;
+
+ if( GetFlyFrm()->GetAnchorFrm()->IsRightToLeft() &&
+ text::HoriOrientation::NONE == eHori )
+ lXDiff = -lXDiff;
+
+ long lYDiff = aNewPos.Y() - aOldPos.Y();
+ if( GetFlyFrm()->GetAnchorFrm()->IsVertical() )
+ {
+ //lXDiff -= rVert.GetPos();
+ //lYDiff += rHori.GetPos();
+ //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
+ if ( GetFlyFrm()->GetAnchorFrm()->IsVertLR() )
+ {
+ lXDiff += rVert.GetPos();
+ lXDiff = -lXDiff;
+ }
+ else
+ {
+ lXDiff -= rVert.GetPos();
+ lYDiff += rHori.GetPos();
+ }
+ }
+ else
+ {
+ lXDiff += rHori.GetPos();
+ lYDiff += rVert.GetPos();
+ }
+
+ if( GetFlyFrm()->GetAnchorFrm()->IsRightToLeft() &&
+ text::HoriOrientation::NONE != eHori )
+ lXDiff = GetFlyFrm()->GetAnchorFrm()->Frm().Width() -
+ aFlyRect.Width() - lXDiff;
+
+ const Point aTmp( lXDiff, lYDiff );
+ GetFlyFrm()->ChgRelPos( aTmp );
+ }
+
+ SwAttrSet aSet( pFmt->GetDoc()->GetAttrPool(),
+ RES_VERT_ORIENT, RES_HORI_ORIENT );
+ SwFmtHoriOrient aHori( pFmt->GetHoriOrient() );
+ SwFmtVertOrient aVert( pFmt->GetVertOrient() );
+ sal_Bool bPut = sal_False;
+
+ if( !GetFlyFrm()->IsFlyLayFrm() &&
+ ::GetHtmlMode(pFmt->GetDoc()->GetDocShell()) )
+ {
+ //Im HTML-Modus sind nur automatische Ausrichtungen erlaubt.
+ //Einzig einen Snap auf Links/Rechts bzw. Linker-/Rechter-Rand koennen
+ //wir versuchen.
+ const SwFrm* pAnch = GetFlyFrm()->GetAnchorFrm();
+ sal_Bool bNextLine = sal_False;
+
+ if( !GetFlyFrm()->IsAutoPos() || text::RelOrientation::PAGE_FRAME != aHori.GetRelationOrient() )
+ {
+ if( text::RelOrientation::CHAR == eRelHori )
+ {
+ aHori.SetHoriOrient( text::HoriOrientation::LEFT );
+ aHori.SetRelationOrient( text::RelOrientation::CHAR );
+ }
+ else
+ {
+ bNextLine = sal_True;
+ //Horizontale Ausrichtung:
+ const sal_Bool bLeftFrm =
+ aFlyRect.Left() < pAnch->Frm().Left() + pAnch->Prt().Left(),
+ bLeftPrt = aFlyRect.Left() + aFlyRect.Width() <
+ pAnch->Frm().Left() + pAnch->Prt().Width()/2;
+ if ( bLeftFrm || bLeftPrt )
+ {
+ aHori.SetHoriOrient( text::HoriOrientation::LEFT );
+ aHori.SetRelationOrient( bLeftFrm ? text::RelOrientation::FRAME : text::RelOrientation::PRINT_AREA );
+ }
+ else
+ {
+ const sal_Bool bRightFrm = aFlyRect.Left() >
+ pAnch->Frm().Left() + pAnch->Prt().Width();
+ aHori.SetHoriOrient( text::HoriOrientation::RIGHT );
+ aHori.SetRelationOrient( bRightFrm ? text::RelOrientation::FRAME : text::RelOrientation::PRINT_AREA );
+ }
+ }
+ aSet.Put( aHori );
+ }
+ //Vertikale Ausrichtung bleibt grundsaetzlich schlicht erhalten,
+ //nur bei nicht automatischer Ausrichtung wird umgeschaltet.
+ sal_Bool bRelChar = text::RelOrientation::CHAR == eRelVert;
+ aVert.SetVertOrient( eVert != text::VertOrientation::NONE ? eVert :
+ GetFlyFrm()->IsFlyInCntFrm() ? text::VertOrientation::CHAR_CENTER :
+ bRelChar && bNextLine ? text::VertOrientation::CHAR_TOP : text::VertOrientation::TOP );
+ if( bRelChar )
+ aVert.SetRelationOrient( text::RelOrientation::CHAR );
+ else
+ aVert.SetRelationOrient( text::RelOrientation::PRINT_AREA );
+ aSet.Put( aVert );
+ bPut = sal_True;
+ }
+
+ //Automatische Ausrichtungen wollen wir moeglichst nicht verlieren.
+ if ( !bPut && bInResize )
+ {
+ if ( text::HoriOrientation::NONE != eHori )
+ {
+ aHori.SetHoriOrient( eHori );
+ aHori.SetRelationOrient( eRelHori );
+ aSet.Put( aHori );
+ bPut = sal_True;
+ }
+ if ( text::VertOrientation::NONE != eVert )
+ {
+ aVert.SetVertOrient( eVert );
+ aVert.SetRelationOrient( eRelVert );
+ aSet.Put( aVert );
+ bPut = sal_True;
+ }
+ }
+ if ( bPut )
+ pFmt->SetFmtAttr( aSet );
+}
+
+
+void __EXPORT SwVirtFlyDrawObj::NbcResize(const Point& rRef,
+ const Fraction& xFact, const Fraction& yFact)
+{
+ ResizeRect( aOutRect, rRef, xFact, yFact );
+
+ const SwFrm* pTmpFrm = GetFlyFrm()->GetAnchorFrm();
+ if( !pTmpFrm )
+ pTmpFrm = GetFlyFrm();
+ const bool bVertX = pTmpFrm->IsVertical();
+
+ const sal_Bool bRTL = pTmpFrm->IsRightToLeft();
+
+ //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
+ const bool bVertL2RX = pTmpFrm->IsVertLR();
+ const Point aNewPos( ( bVertX && !bVertL2RX ) || bRTL ?
+ aOutRect.Right() + 1 :
+ aOutRect.Left(),
+ aOutRect.Top() );
+
+ Size aSz( aOutRect.Right() - aOutRect.Left() + 1,
+ aOutRect.Bottom()- aOutRect.Top() + 1 );
+ if( aSz != GetFlyFrm()->Frm().SSize() )
+ {
+ //Die Breite darf bei Spalten nicht zu schmal werden
+ if ( GetFlyFrm()->Lower() && GetFlyFrm()->Lower()->IsColumnFrm() )
+ {
+ SwBorderAttrAccess aAccess( SwFrm::GetCache(), GetFlyFrm() );
+ const SwBorderAttrs &rAttrs = *aAccess.Get();
+ long nMin = rAttrs.CalcLeftLine()+rAttrs.CalcRightLine();
+ const SwFmtCol& rCol = rAttrs.GetAttrSet().GetCol();
+ if ( rCol.GetColumns().Count() > 1 )
+ {
+ for ( sal_uInt16 i = 0; i < rCol.GetColumns().Count(); ++i )
+ {
+ nMin += rCol.GetColumns()[i]->GetLeft() +
+ rCol.GetColumns()[i]->GetRight() +
+ MINFLY;
+ }
+ nMin -= MINFLY;
+ }
+ aSz.Width() = Max( aSz.Width(), nMin );
+ }
+
+ SwFrmFmt *pFmt = GetFmt();
+ const SwFmtFrmSize aOldFrmSz( pFmt->GetFrmSize() );
+ GetFlyFrm()->ChgSize( aSz );
+ SwFmtFrmSize aFrmSz( pFmt->GetFrmSize() );
+ if ( aFrmSz.GetWidthPercent() || aFrmSz.GetHeightPercent() )
+ {
+ long nRelWidth, nRelHeight;
+ const SwFrm *pRel = GetFlyFrm()->IsFlyLayFrm() ?
+ GetFlyFrm()->GetAnchorFrm() :
+ GetFlyFrm()->GetAnchorFrm()->GetUpper();
+ const ViewShell *pSh = GetFlyFrm()->getRootFrm()->GetCurrShell();
+ if ( pSh && pRel->IsBodyFrm() &&
+ pSh->GetViewOptions()->getBrowseMode() &&
+ pSh->VisArea().HasArea() )
+ {
+ nRelWidth = pSh->GetBrowseWidth();
+ nRelHeight = pSh->VisArea().Height();
+ const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
+ nRelHeight -= 2*aBorder.Height();
+ }
+ else
+ {
+ nRelWidth = pRel->Prt().Width();
+ nRelHeight = pRel->Prt().Height();
+ }
+ if ( aFrmSz.GetWidthPercent() && aFrmSz.GetWidthPercent() != 0xFF &&
+ aOldFrmSz.GetWidth() != aFrmSz.GetWidth() )
+ aFrmSz.SetWidthPercent( sal_uInt8(aSz.Width() * 100L / nRelWidth + 0.5) );
+ if ( aFrmSz.GetHeightPercent() && aFrmSz.GetHeightPercent() != 0xFF &&
+ aOldFrmSz.GetHeight() != aFrmSz.GetHeight() )
+ aFrmSz.SetHeightPercent( sal_uInt8(aSz.Height() * 100L / nRelHeight + 0.5) );
+ pFmt->GetDoc()->SetAttr( aFrmSz, *pFmt );
+ }
+ }
+
+ //Position kann auch veraendert sein!
+ const Point aOldPos( ( bVertX && !bVertL2RX ) || bRTL ?
+ GetFlyFrm()->Frm().TopRight() :
+ GetFlyFrm()->Frm().Pos() );
+ if ( aNewPos != aOldPos )
+ {
+ //Kann sich durch das ChgSize veraendert haben!
+ if( bVertX || bRTL )
+ {
+ if( aOutRect.TopRight() != aNewPos )
+ {
+ //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
+ SwTwips nDeltaX;
+ if ( bVertL2RX )
+ nDeltaX = aNewPos.X() - aOutRect.Left();
+ else
+ nDeltaX = aNewPos.X() - aOutRect.Right();
+ SwTwips nDeltaY = aNewPos.Y() - aOutRect.Top();
+ MoveRect( aOutRect, Size( nDeltaX, nDeltaY ) );
+ }
+ }
+ else if ( aOutRect.TopLeft() != aNewPos )
+ aOutRect.SetPos( aNewPos );
+ bInResize = sal_True;
+ NbcMove( Size( 0, 0 ) );
+ bInResize = sal_False;
+ }
+}
+
+
+void __EXPORT SwVirtFlyDrawObj::Move(const Size& rSiz)
+{
+ NbcMove( rSiz );
+ SetChanged();
+ GetFmt()->GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false);
+}
+
+
+void __EXPORT SwVirtFlyDrawObj::Resize(const Point& rRef,
+ const Fraction& xFact, const Fraction& yFact)
+{
+ NbcResize( rRef, xFact, yFact );
+ SetChanged();
+ GetFmt()->GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false);
+}
+
+
+Pointer __EXPORT SwVirtFlyDrawObj::GetMacroPointer(
+ const SdrObjMacroHitRec& ) const
+{
+ return Pointer( POINTER_REFHAND );
+}
+
+
+FASTBOOL __EXPORT SwVirtFlyDrawObj::HasMacro() const
+{
+ const SwFmtURL &rURL = pFlyFrm->GetFmt()->GetURL();
+ return rURL.GetMap() || rURL.GetURL().Len();
+}
+
+
+SdrObject* SwVirtFlyDrawObj::CheckMacroHit( const SdrObjMacroHitRec& rRec ) const
+{
+ const SwFmtURL &rURL = pFlyFrm->GetFmt()->GetURL();
+ if( rURL.GetMap() || rURL.GetURL().Len() )
+ {
+ SwRect aRect;
+ if ( pFlyFrm->Lower() && pFlyFrm->Lower()->IsNoTxtFrm() )
+ {
+ aRect = pFlyFrm->Prt();
+ aRect += pFlyFrm->Frm().Pos();
+ }
+ else
+ aRect = pFlyFrm->Frm();
+
+ if( aRect.IsInside( rRec.aPos ) )
+ {
+ SwRect aActRect( aRect );
+ Size aActSz( aRect.SSize() );
+ aRect.Pos().X() += rRec.nTol;
+ aRect.Pos().Y() += rRec.nTol;
+ aRect.SSize().Height()-= 2 * rRec.nTol;
+ aRect.SSize().Width() -= 2 * rRec.nTol;
+
+ if( aRect.IsInside( rRec.aPos ) )
+ {
+ if( !rURL.GetMap() ||
+ pFlyFrm->GetFmt()->GetIMapObject( rRec.aPos, pFlyFrm ))
+ return (SdrObject*)this;
+
+ return 0;
+ }
+ }
+ }
+ return SdrObject::CheckMacroHit( rRec );
+}
+
+bool SwVirtFlyDrawObj::supportsFullDrag() const
+{
+ // call parent
+ return SdrVirtObj::supportsFullDrag();
+}
+
+SdrObject* SwVirtFlyDrawObj::getFullDragClone() const
+{
+ // call parent
+ return SdrVirtObj::getFullDragClone();
+}
+
+// eof
diff --git a/sw/source/core/draw/dobjfac.cxx b/sw/source/core/draw/dobjfac.cxx
new file mode 100644
index 000000000000..f50e3c156a49
--- /dev/null
+++ b/sw/source/core/draw/dobjfac.cxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <errhdl.hxx>
+#include <dpage.hxx>
+#include <dobjfac.hxx>
+#include <dflyobj.hxx>
+
+SwObjectFactory aSwObjectFactory;
+
+/*************************************************************************
+|*
+|* void SwObjectFactory::MakeObject()
+|*
+\************************************************************************/
+
+IMPL_LINK( SwObjectFactory, MakeObject, SdrObjFactory*, pObjFactory )
+{
+ if ( pObjFactory->nInventor == SWGInventor )
+ {
+ //Kein switch, derzeit gibt es nur einen.
+ ASSERT( pObjFactory->nIdentifier == SwFlyDrawObjIdentifier,
+ "Falscher Inventor oder identifier." );
+ pObjFactory->pNewObj = new SwFlyDrawObj();
+ }
+ return 0;
+}
+
+
diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx
new file mode 100644
index 000000000000..bdca839d9a89
--- /dev/null
+++ b/sw/source/core/draw/dpage.cxx
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <basic/basmgr.hxx>
+#include <svtools/imapobj.hxx>
+#include <svl/urihelper.hxx>
+#include <unotools/securityoptions.hxx>
+#include <vcl/help.hxx>
+#include <svx/svdview.hxx>
+#include <fmturl.hxx>
+#include <frmfmt.hxx>
+#include <doc.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <shellres.hxx>
+#include <viewimp.hxx>
+#include <pagefrm.hxx>
+#include <cntfrm.hxx>
+#include <rootfrm.hxx>
+#include <frmatr.hxx>
+#include <viewsh.hxx>
+#include <drawdoc.hxx>
+#include <dpage.hxx>
+#include <dcontact.hxx>
+#include <dflyobj.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <usrfld.hxx>
+#include <flyfrm.hxx>
+#include <ndnotxt.hxx>
+#include <grfatr.hxx>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::frame;
+
+SwDPage::SwDPage(SwDrawDocument& rNewModel, sal_Bool bMasterPage) :
+ FmFormPage(rNewModel, 0, bMasterPage),
+ pGridLst( 0 ),
+ rDoc(rNewModel.GetDoc())
+{
+}
+
+
+SwDPage::~SwDPage()
+{
+ delete pGridLst;
+}
+
+/*************************************************************************
+|*
+|* SwDPage::ReplaceObject()
+|*
+|* Ersterstellung MA 07. Aug. 95
+|* Letzte Aenderung MA 07. Aug. 95
+|*
+*************************************************************************/
+
+SdrObject* SwDPage::ReplaceObject( SdrObject* pNewObj, sal_uLong nObjNum )
+{
+ SdrObject *pOld = GetObj( nObjNum );
+ ASSERT( pOld, "Oups, Object not replaced" );
+ SdrObjUserCall* pContact;
+ if ( 0 != ( pContact = GetUserCall(pOld) ) &&
+ RES_DRAWFRMFMT == ((SwContact*)pContact)->GetFmt()->Which())
+ ((SwDrawContact*)pContact)->ChangeMasterObject( pNewObj );
+ return FmFormPage::ReplaceObject( pNewObj, nObjNum );
+}
+
+/*************************************************************************
+|*
+|* SwDPage::GetGridFrameList()
+|*
+|* Ersterstellung MA 04. Sep. 95
+|* Letzte Aenderung MA 15. Feb. 96
+|*
+*************************************************************************/
+
+void InsertGridFrame( SdrPageGridFrameList *pLst, const SwFrm *pPg )
+{
+ SwRect aPrt( pPg->Prt() );
+ aPrt += pPg->Frm().Pos();
+ const Rectangle aUser( aPrt.SVRect() );
+ const Rectangle aPaper( pPg->Frm().SVRect() );
+ pLst->Insert( SdrPageGridFrame( aPaper, aUser ) );
+}
+
+
+const SdrPageGridFrameList* SwDPage::GetGridFrameList(
+ const SdrPageView* pPV, const Rectangle *pRect ) const
+{
+ ViewShell *pSh = ((SwDrawDocument*)GetModel())->GetDoc().GetCurrentViewShell(); //swmod 071108//swmod 071225
+ if ( pSh )
+ {
+ while ( pSh->Imp()->GetPageView() != pPV )
+ pSh = (ViewShell*)pSh->GetNext();
+ if ( pSh )
+ {
+ if ( pGridLst )
+ ((SwDPage*)this)->pGridLst->Clear();
+ else
+ ((SwDPage*)this)->pGridLst = new SdrPageGridFrameList;
+
+ if ( pRect )
+ {
+ //Das Drawing verlang alle Seiten, die mit dem Rect ueberlappen.
+ const SwRect aRect( *pRect );
+ const SwFrm *pPg = pSh->GetLayout()->Lower();
+ do
+ { if ( pPg->Frm().IsOver( aRect ) )
+ ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg );
+ pPg = pPg->GetNext();
+ } while ( pPg );
+ }
+ else
+ {
+ //Das Drawing verlangt alle sichbaren Seiten
+ const SwFrm *pPg = pSh->Imp()->GetFirstVisPage();
+ if ( pPg )
+ do
+ { ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg );
+ pPg = pPg->GetNext();
+ } while ( pPg && pPg->Frm().IsOver( pSh->VisArea() ) );
+ }
+ }
+ }
+ return pGridLst;
+}
+
+sal_Bool SwDPage::RequestHelp( Window* pWindow, SdrView* pView,
+ const HelpEvent& rEvt )
+{
+ sal_Bool bWeiter = sal_True;
+
+ if( rEvt.GetMode() & ( HELPMODE_QUICK | HELPMODE_BALLOON ))
+ {
+ Point aPos( rEvt.GetMousePosPixel() );
+ aPos = pWindow->ScreenToOutputPixel( aPos );
+ aPos = pWindow->PixelToLogic( aPos );
+
+ SdrPageView* pPV;
+ SdrObject* pObj;
+ if( pView->PickObj( aPos, 0, pObj, pPV, SDRSEARCH_PICKMACRO ) &&
+ pObj->ISA(SwVirtFlyDrawObj) )
+ {
+ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+ const SwFmtURL &rURL = pFly->GetFmt()->GetURL();
+ String sTxt;
+ if( rURL.GetMap() )
+ {
+ IMapObject *pTmpObj = pFly->GetFmt()->GetIMapObject( aPos, pFly );
+ if( pTmpObj )
+ {
+ sTxt = pTmpObj->GetAltText();
+ if ( !sTxt.Len() )
+ sTxt = URIHelper::removePassword( pTmpObj->GetURL(),
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS);
+ }
+ }
+ else if ( rURL.GetURL().Len() )
+ {
+ sTxt = URIHelper::removePassword( rURL.GetURL(),
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS);
+
+ if( rURL.IsServerMap() )
+ {
+ // dann die rel. Pixel Position anhaengen !!
+ Point aPt( aPos );
+ aPt -= pFly->Frm().Pos();
+ // ohne MapMode-Offset !!!!!
+ // ohne MapMode-Offset, ohne Offset, o ... !!!!!
+ aPt = pWindow->LogicToPixel(
+ aPt, MapMode( MAP_TWIP ) );
+ ((( sTxt += '?' ) += String::CreateFromInt32( aPt.X() ))
+ += ',' ) += String::CreateFromInt32( aPt.Y() );
+ }
+ }
+
+ if ( sTxt.Len() )
+ {
+ // --> OD 2007-07-26 #i80029#
+ sal_Bool bExecHyperlinks = rDoc.GetDocShell()->IsReadOnly();
+ if ( !bExecHyperlinks )
+ {
+ SvtSecurityOptions aSecOpts;
+ bExecHyperlinks = !aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
+
+ if ( !bExecHyperlinks )
+ {
+ sTxt.InsertAscii( ": ", 0 );
+ sTxt.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
+ }
+ }
+
+ // <--
+
+ if( rEvt.GetMode() & HELPMODE_BALLOON )
+ {
+ Help::ShowBalloon( pWindow, rEvt.GetMousePosPixel(), sTxt );
+ }
+ else
+ {
+ // dann zeige die Hilfe mal an:
+ Rectangle aRect( rEvt.GetMousePosPixel(), Size(1,1) );
+ Help::ShowQuickHelp( pWindow, aRect, sTxt );
+ }
+ bWeiter = sal_False;
+ }
+ }
+ }
+
+ if( bWeiter )
+ bWeiter = !FmFormPage::RequestHelp( pWindow, pView, rEvt );
+
+ return bWeiter;
+}
+/* -----------------------------27.11.00 07:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XInterface > SwDPage::createUnoPage()
+{
+ Reference < XInterface > xRet;
+ SwDocShell* pDocShell = rDoc.GetDocShell();
+ if ( pDocShell )
+ {
+ Reference<XModel> xModel = pDocShell->GetBaseModel();
+ Reference<XDrawPageSupplier> xPageSupp(xModel, UNO_QUERY);
+ xRet = xPageSupp->getDrawPage();
+ }
+ return xRet;
+}
+
+
+
diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx
new file mode 100644
index 000000000000..be94db96d47f
--- /dev/null
+++ b/sw/source/core/draw/drawdoc.cxx
@@ -0,0 +1,240 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <tools/stream.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sot/storage.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+
+#include <unotools/ucbstreamhelper.hxx>
+#include <svx/xtable.hxx>
+#include <svx/drawitem.hxx>
+#include <viewsh.hxx>
+#include <doc.hxx>
+#include <rootfrm.hxx>
+#include <drawdoc.hxx>
+#include <dpage.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <shellio.hxx>
+#include <hintids.hxx>
+#include <com/sun/star/embed/ElementModes.hpp>
+
+using namespace com::sun::star;
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+const String GetPalettePath()
+{
+ SvtPathOptions aPathOpt;
+ return aPathOpt.GetPalettePath();
+}
+
+SwDrawDocument::SwDrawDocument( SwDoc* pD ) :
+ FmFormModel( ::GetPalettePath(), &pD->GetAttrPool(),
+ pD->GetDocShell(), sal_True ),
+ pDoc( pD )
+{
+ SetScaleUnit( MAP_TWIP );
+ SetSwapGraphics( sal_True );
+
+ SwDocShell* pDocSh = pDoc->GetDocShell();
+ if ( pDocSh )
+ {
+ SetObjectShell( pDocSh );
+ SvxColorTableItem* pColItem = ( SvxColorTableItem* )
+ ( pDocSh->GetItem( SID_COLOR_TABLE ) );
+ XColorTable *pXCol = pColItem ? pColItem->GetColorTable() :
+ XColorTable::GetStdColorTable();
+ SetColorTable( pXCol );
+
+ if ( !pColItem )
+ pDocSh->PutItem( SvxColorTableItem( pXCol, SID_COLOR_TABLE ) );
+
+ pDocSh->PutItem( SvxGradientListItem( GetGradientList(), SID_GRADIENT_LIST ));
+ pDocSh->PutItem( SvxHatchListItem( GetHatchList(), SID_HATCH_LIST ) );
+ pDocSh->PutItem( SvxBitmapListItem( GetBitmapList(), SID_BITMAP_LIST ) );
+ pDocSh->PutItem( SvxDashListItem( GetDashList(), SID_DASH_LIST ) );
+ pDocSh->PutItem( SvxLineEndListItem( GetLineEndList(), SID_LINEEND_LIST ) );
+ pDocSh->PutItem( SfxUInt16Item(SID_ATTR_LINEEND_WIDTH_DEFAULT, 111) );
+ SetObjectShell( pDocSh );
+ }
+ else
+ SetColorTable( XColorTable::GetStdColorTable() );
+
+ // copy all the default values to the SdrModel
+ SfxItemPool* pSdrPool = pD->GetAttrPool().GetSecondaryPool();
+ if( pSdrPool )
+ {
+ const sal_uInt16 aWhichRanges[] =
+ {
+ RES_CHRATR_BEGIN, RES_CHRATR_END,
+ RES_PARATR_BEGIN, RES_PARATR_END,
+ 0
+ };
+
+ SfxItemPool& rDocPool = pD->GetAttrPool();
+ sal_uInt16 nEdtWhich, nSlotId;
+ const SfxPoolItem* pItem;
+ for( const sal_uInt16* pRangeArr = aWhichRanges;
+ *pRangeArr; pRangeArr += 2 )
+ for( sal_uInt16 nW = *pRangeArr, nEnd = *(pRangeArr+1);
+ nW < nEnd; ++nW )
+ if( 0 != (pItem = rDocPool.GetPoolDefaultItem( nW )) &&
+ 0 != (nSlotId = rDocPool.GetSlotId( nW ) ) &&
+ nSlotId != nW &&
+ 0 != (nEdtWhich = pSdrPool->GetWhich( nSlotId )) &&
+ nSlotId != nEdtWhich )
+ {
+ SfxPoolItem* pCpy = pItem->Clone();
+ pCpy->SetWhich( nEdtWhich );
+ pSdrPool->SetPoolDefaultItem( *pCpy );
+ delete pCpy;
+ }
+ }
+
+ SetForbiddenCharsTable( pD->getForbiddenCharacterTable() );
+ // #87795# Implementation for asian compression
+ SetCharCompressType( static_cast<sal_uInt16>(pD->getCharacterCompressionType() ));
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+
+SwDrawDocument::~SwDrawDocument()
+{
+ Broadcast(SdrHint(HINT_MODELCLEARED));
+
+ // #116168#
+ ClearModel(sal_True);
+ //Clear();
+}
+
+/*************************************************************************
+|*
+|* Diese Methode erzeugt eine neue Seite (SdPage) und gibt einen Zeiger
+|* darauf zurueck. Die Drawing Engine benutzt diese Methode beim Laden
+|* zur Erzeugung von Seiten (deren Typ sie ja nicht kennt, da es ABLEITUNGEN
+|* der SdrPage sind).
+|*
+\************************************************************************/
+
+
+SdrPage* SwDrawDocument::AllocPage(FASTBOOL bMasterPage)
+{
+ SwDPage* pPage = new SwDPage(*this, 0 != bMasterPage);
+ pPage->SetName( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "Controls" )) );
+ return pPage;
+}
+
+
+SvStream* SwDrawDocument::GetDocumentStream( SdrDocumentStreamInfo& rInfo ) const
+{
+ SvStream* pRet = NULL;
+ uno::Reference < embed::XStorage > xRoot( pDoc->GetDocStorage() );
+ if( xRoot.is() )
+ {
+ if( rInfo.maUserData.Len() &&
+ ( rInfo.maUserData.GetToken( 0, ':' ) ==
+ String( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package" ) ) ) )
+ {
+ const String aPicturePath( rInfo.maUserData.GetToken( 1, ':' ) );
+
+ // graphic from picture stream in picture storage in XML package
+ if( aPicturePath.GetTokenCount( '/' ) == 2 )
+ {
+ const String aPictureStorageName( aPicturePath.GetToken( 0, '/' ) );
+ const String aPictureStreamName( aPicturePath.GetToken( 1, '/' ) );
+
+ try
+ {
+ uno::Reference < embed::XStorage > xPictureStorage = xRoot->openStorageElement(
+ aPictureStorageName, embed::ElementModes::READ );
+ uno::Reference < io::XStream > xStream = xPictureStorage->openStreamElement(
+ aPictureStreamName, embed::ElementModes::READ );
+ pRet = utl::UcbStreamHelper::CreateStream( xStream );
+ if( pRet )
+ {
+ rInfo.mbDeleteAfterUse = sal_True;
+ rInfo.mxStorageRef = xPictureStorage;
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+ return pRet;
+}
+
+SdrLayerID SwDrawDocument::GetControlExportLayerId( const SdrObject & ) const
+{
+ //fuer Versionen < 5.0, es gab nur Hell und Heaven
+ return (SdrLayerID)pDoc->GetHeavenId();
+}
+
+// --> OD 2006-03-01 #b6382898#
+uno::Reference< uno::XInterface > SwDrawDocument::createUnoModel()
+{
+
+ uno::Reference< uno::XInterface > xModel;
+
+ try
+ {
+ if ( GetDoc().GetDocShell() )
+ {
+ xModel = GetDoc().GetDocShell()->GetModel();
+ }
+ }
+ catch( uno::RuntimeException& )
+ {
+ ASSERT( false,
+ "<SwDrawDocument::createUnoModel()> - could *not* retrieve model at <SwDocShell>" );
+ }
+
+ return xModel;
+}
+
+// <--
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
new file mode 100644
index 000000000000..9707831a7ac9
--- /dev/null
+++ b/sw/source/core/draw/dview.cxx
@@ -0,0 +1,1115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "hintids.hxx"
+#include <editeng/protitem.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/fmmodel.hxx>
+#include <sot/exchange.hxx>
+
+#include "swtypes.hxx"
+#include "pagefrm.hxx"
+#include "rootfrm.hxx"
+#include "cntfrm.hxx"
+#include "flyfrm.hxx"
+#include "frmfmt.hxx"
+#include "dflyobj.hxx"
+#include "dcontact.hxx"
+#include "frmatr.hxx"
+#include "viewsh.hxx"
+#include "viewimp.hxx"
+#include "dview.hxx"
+#include "dpage.hxx"
+#include "doc.hxx"
+#include "mdiexp.hxx"
+#include <ndole.hxx>
+#include <fmtanchr.hxx>
+#include "shellres.hxx"
+#include <IDocumentUndoRedo.hxx>
+
+// #i7672#
+#include <editeng/outliner.hxx>
+
+#include <com/sun/star/embed/EmbedMisc.hpp>
+
+// OD 18.06.2003 #108784#
+//#ifndef _SVDVMARK_HXX //autogen
+//#include <svx/svdvmark.hxx>
+//#endif
+#include <vector>
+// --> OD 2004-06-24 #i28701#
+#include <sortedobjs.hxx>
+#include <flyfrms.hxx>
+// <--
+
+
+using namespace com::sun::star;
+
+
+class SwSdrHdl : public SdrHdl
+{
+public:
+ SwSdrHdl(const Point& rPnt, bool bTopRight ) :
+ SdrHdl( rPnt, bTopRight ? HDL_ANCHOR_TR : HDL_ANCHOR ) {}
+ virtual sal_Bool IsFocusHdl() const;
+};
+
+sal_Bool SwSdrHdl::IsFocusHdl() const
+{
+ if( HDL_ANCHOR == eKind || HDL_ANCHOR_TR == eKind )
+ return sal_True;
+ return SdrHdl::IsFocusHdl();
+}
+
+const SwFrm *lcl_FindAnchor( const SdrObject *pObj, sal_Bool bAll )
+{
+ const SwVirtFlyDrawObj *pVirt = pObj->ISA(SwVirtFlyDrawObj) ?
+ (SwVirtFlyDrawObj*)pObj : 0;
+ if ( pVirt )
+ {
+ if ( bAll || !pVirt->GetFlyFrm()->IsFlyInCntFrm() )
+ return pVirt->GetFlyFrm()->GetAnchorFrm();
+ }
+ else
+ {
+ const SwDrawContact *pCont = (const SwDrawContact*)GetUserCall(pObj);
+ if ( pCont )
+ return pCont->GetAnchorFrm( pObj );
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SwDrawView::Ctor
+|*
+|* Ersterstellung OK 18.11.94
+|* Letzte Aenderung MA 22. Jul. 96
+|*
+*************************************************************************/
+
+
+
+SwDrawView::SwDrawView( SwViewImp &rI, SdrModel *pMd, OutputDevice *pOutDev) :
+ FmFormView( (FmFormModel*)pMd, pOutDev ),
+ rImp( rI )
+{
+ SetPageVisible( sal_False );
+ SetBordVisible( sal_False );
+ SetGridVisible( sal_False );
+ SetHlplVisible( sal_False );
+ SetGlueVisible( sal_False );
+ SetFrameDragSingles( sal_True );
+ SetVirtualObjectBundling( sal_True );
+ SetSwapAsynchron( sal_True );
+
+ EnableExtendedKeyInputDispatcher( sal_False );
+ EnableExtendedMouseEventDispatcher( sal_False );
+ EnableExtendedCommandEventDispatcher( sal_False );
+
+ SetHitTolerancePixel( GetMarkHdlSizePixel()/2 );
+
+ SetPrintPreview( rI.GetShell()->IsPreView() );
+
+ // #i73602# Use default from the configuration
+ SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_Writer());
+
+ // #i74769#, #i75172# Use default from the configuration
+ SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_Writer());
+}
+
+// --> OD 2009-03-05 #i99665#
+sal_Bool SwDrawView::IsAntiAliasing() const
+{
+ return getOptionsDrawinglayer().IsAntiAliasing();
+}
+// <--
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdrObject* impLocalHitCorrection(SdrObject* pRetval, const Point& rPnt, sal_uInt16 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, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_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()
+|*
+|* Gets called every time the handles need to be build
+|*
+|* Ersterstellung AW 06. Sep. 99
+|* Letzte Aenderung AW 06. Sep. 99
+|*
+*************************************************************************/
+
+void SwDrawView::AddCustomHdl()
+{
+ const SdrMarkList &rMrkList = GetMarkedObjectList();
+
+ if(rMrkList.GetMarkCount() != 1 || !GetUserCall(rMrkList.GetMark( 0 )->GetMarkedSdrObj()))
+ return;
+
+ SdrObject *pObj = rMrkList.GetMark(0)->GetMarkedSdrObj();
+ // --> OD 2006-11-06 #130889# - make code robust
+// const SwFmtAnchor &rAnchor = ::FindFrmFmt(pObj)->GetAnchor();
+ SwFrmFmt* pFrmFmt( ::FindFrmFmt( pObj ) );
+ if ( !pFrmFmt )
+ {
+ ASSERT( false, "<SwDrawView::AddCustomHdl()> - missing frame format!" );
+ return;
+ }
+ const SwFmtAnchor &rAnchor = pFrmFmt->GetAnchor();
+ // <--
+
+ if (FLY_AS_CHAR == rAnchor.GetAnchorId())
+ return;
+
+ const SwFrm* pAnch;
+ if(0 == (pAnch = CalcAnchor()))
+ return;
+
+ Point aPos(aAnchorPoint);
+
+ if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
+ {
+ // --> OD 2004-06-24 #i28701# - use last character rectangle saved at object
+ // in order to avoid a format of the anchor frame
+ SwAnchoredObject* pAnchoredObj = ::GetUserCall( pObj )->GetAnchoredObj( pObj );
+ SwRect aAutoPos = pAnchoredObj->GetLastCharRect();
+ if ( aAutoPos.Height() )
+ {
+ aPos = aAutoPos.Pos();
+ }
+ }
+
+ // add anchor handle:
+ //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
+ aHdl.AddHdl( new SwSdrHdl( aPos, ( pAnch->IsVertical() && !pAnch->IsVertLR() ) ||
+ pAnch->IsRightToLeft() ) );
+}
+
+/*************************************************************************
+|*
+|* SwDrawView::GetMaxToTopObj(), _GetMaxToTopObj()
+|*
+|* Ersterstellung MA 13. Jan. 95
+|* Letzte Aenderung MA 18. Mar. 97
+|*
+*************************************************************************/
+
+
+SdrObject* SwDrawView::GetMaxToTopObj( SdrObject* pObj ) const
+{
+ if ( GetUserCall(pObj) )
+ {
+ const SwFrm *pAnch = ::lcl_FindAnchor( pObj, sal_False );
+ if ( pAnch )
+ {
+ //Das oberste Obj innerhalb des Ankers darf nicht ueberholt
+ //werden.
+ const SwFlyFrm *pFly = pAnch->FindFlyFrm();
+ if ( pFly )
+ {
+ const SwPageFrm *pPage = pFly->FindPageFrm();
+ if ( pPage->GetSortedObjs() )
+ {
+ sal_uInt32 nOrdNum = 0;
+ for ( sal_uInt16 i = 0; i < pPage->GetSortedObjs()->Count(); ++i )
+ {
+ const SdrObject *pO =
+ (*pPage->GetSortedObjs())[i]->GetDrawObj();
+
+ if ( pO->GetOrdNumDirect() > nOrdNum )
+ {
+ const SwFrm *pTmpAnch = ::lcl_FindAnchor( pO, sal_False );
+ if ( pFly->IsAnLower( pTmpAnch ) )
+ {
+ nOrdNum = pO->GetOrdNumDirect();
+ }
+ }
+ }
+ if ( nOrdNum )
+ {
+ SdrPage *pTmpPage = GetModel()->GetPage( 0 );
+ ++nOrdNum;
+ if ( nOrdNum < pTmpPage->GetObjCount() )
+ {
+ return pTmpPage->GetObj( nOrdNum );
+ }
+ }
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SwDrawView::GetMaxToBtmObj()
+|*
+|* Ersterstellung MA 13. Jan. 95
+|* Letzte Aenderung MA 05. Sep. 96
+|*
+*************************************************************************/
+
+
+SdrObject* SwDrawView::GetMaxToBtmObj(SdrObject* pObj) const
+{
+ if ( GetUserCall(pObj) )
+ {
+ const SwFrm *pAnch = ::lcl_FindAnchor( pObj, sal_False );
+ if ( pAnch )
+ {
+ //Der Fly des Ankers darf nicht "unterflogen" werden.
+ const SwFlyFrm *pFly = pAnch->FindFlyFrm();
+ if ( pFly )
+ {
+ SdrObject *pRet = (SdrObject*)pFly->GetVirtDrawObj();
+ return pRet != pObj ? pRet : 0;
+ }
+ }
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SwDrawView::ObjOrderChanged()
+|*
+|* Ersterstellung MA 31. Jul. 95
+|* Letzte Aenderung MA 18. Mar. 97
+|*
+*************************************************************************/
+
+inline sal_Bool lcl_IsChild( SdrObject *pParent, SdrObject *pChild )
+{
+ if ( pParent->ISA(SwVirtFlyDrawObj) )
+ {
+ const SwFrm *pAnch = lcl_FindAnchor( pChild, sal_False );
+ if ( pAnch && ((SwVirtFlyDrawObj*)pParent)->GetFlyFrm()->IsAnLower( pAnch ))
+ {
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+inline SdrObject *lcl_FindParent( SdrObject *pObj )
+{
+ const SwFrm *pAnch = lcl_FindAnchor( pObj, sal_False );
+ if ( pAnch && pAnch->IsInFly() )
+ return (SdrObject*)pAnch->FindFlyFrm()->GetVirtDrawObj();
+ return 0;
+}
+
+/** determine maximal order number for a 'child' object of given 'parent' object
+
+ OD 2004-08-20 #110810#
+
+ @author OD
+*/
+sal_uInt32 SwDrawView::_GetMaxChildOrdNum( const SwFlyFrm& _rParentObj,
+ const SdrObject* _pExclChildObj ) const
+{
+ sal_uInt32 nMaxChildOrdNum = _rParentObj.GetDrawObj()->GetOrdNum();
+
+ const SdrPage* pDrawPage = _rParentObj.GetDrawObj()->GetPage();
+ ASSERT( pDrawPage,
+ "<SwDrawView::_GetMaxChildOrdNum(..) - missing drawing page at parent object - crash!" );
+
+ sal_uInt32 nObjCount = pDrawPage->GetObjCount();
+ for ( sal_uInt32 i = nObjCount-1; i > _rParentObj.GetDrawObj()->GetOrdNum() ; --i )
+ {
+ const SdrObject* pObj = pDrawPage->GetObj( i );
+
+ // Don't consider 'child' object <_pExclChildObj>
+ if ( pObj == _pExclChildObj )
+ {
+ continue;
+ }
+
+ if ( pObj->GetOrdNum() > nMaxChildOrdNum &&
+ _rParentObj.IsAnLower( lcl_FindAnchor( pObj, sal_True ) ) )
+ {
+ nMaxChildOrdNum = pObj->GetOrdNum();
+ break;
+ }
+ }
+
+ return nMaxChildOrdNum;
+}
+
+/** method to move 'repeated' objects of the given moved object to the
+ according level
+
+ OD 2004-08-23 #110810#
+
+ @author OD
+*/
+void SwDrawView::_MoveRepeatedObjs( const SwAnchoredObject& _rMovedAnchoredObj,
+ const std::vector<SdrObject*>& _rMovedChildObjs ) const
+{
+ // determine 'repeated' objects of already moved object <_rMovedAnchoredObj>
+ std::list<SwAnchoredObject*> aAnchoredObjs;
+ {
+ const SwContact* pContact = ::GetUserCall( _rMovedAnchoredObj.GetDrawObj() );
+ ASSERT( pContact,
+ "SwDrawView::_MoveRepeatedObjs(..) - missing contact object -> crash." );
+ pContact->GetAnchoredObjs( aAnchoredObjs );
+ }
+
+ // check, if 'repeated' objects exists.
+ if ( aAnchoredObjs.size() > 1 )
+ {
+ SdrPage* pDrawPage = GetModel()->GetPage( 0 );
+
+ // move 'repeated' ones to the same order number as the already moved one.
+ sal_uInt32 nNewPos = _rMovedAnchoredObj.GetDrawObj()->GetOrdNum();
+ while ( !aAnchoredObjs.empty() )
+ {
+ SwAnchoredObject* pAnchoredObj = aAnchoredObjs.back();
+ if ( pAnchoredObj != &_rMovedAnchoredObj )
+ {
+ pDrawPage->SetObjectOrdNum( pAnchoredObj->GetDrawObj()->GetOrdNum(),
+ nNewPos );
+ pDrawPage->RecalcObjOrdNums();
+ // adjustments for accessibility API
+ if ( pAnchoredObj->ISA(SwFlyFrm) )
+ {
+ const SwFlyFrm *pTmpFlyFrm = static_cast<SwFlyFrm*>(pAnchoredObj);
+ rImp.DisposeAccessibleFrm( pTmpFlyFrm );
+ rImp.AddAccessibleFrm( pTmpFlyFrm );
+ }
+ else
+ {
+ rImp.DisposeAccessibleObj( pAnchoredObj->GetDrawObj() );
+ rImp.AddAccessibleObj( pAnchoredObj->GetDrawObj() );
+ }
+ }
+ aAnchoredObjs.pop_back();
+ }
+
+ // move 'repeated' ones of 'child' objects
+ for ( std::vector<SdrObject*>::const_iterator aObjIter = _rMovedChildObjs.begin();
+ aObjIter != _rMovedChildObjs.end(); ++aObjIter )
+ {
+ SdrObject* pChildObj = (*aObjIter);
+ {
+ const SwContact* pContact = ::GetUserCall( pChildObj );
+ ASSERT( pContact,
+ "SwDrawView::_MoveRepeatedObjs(..) - missing contact object -> crash." );
+ pContact->GetAnchoredObjs( aAnchoredObjs );
+ }
+ // move 'repeated' ones to the same order number as the already moved one.
+ const sal_uInt32 nTmpNewPos = pChildObj->GetOrdNum();
+ while ( !aAnchoredObjs.empty() )
+ {
+ SwAnchoredObject* pAnchoredObj = aAnchoredObjs.back();
+ if ( pAnchoredObj->GetDrawObj() != pChildObj )
+ {
+ pDrawPage->SetObjectOrdNum( pAnchoredObj->GetDrawObj()->GetOrdNum(),
+ nTmpNewPos );
+ pDrawPage->RecalcObjOrdNums();
+ // adjustments for accessibility API
+ if ( pAnchoredObj->ISA(SwFlyFrm) )
+ {
+ const SwFlyFrm *pTmpFlyFrm = static_cast<SwFlyFrm*>(pAnchoredObj);
+ rImp.DisposeAccessibleFrm( pTmpFlyFrm );
+ rImp.AddAccessibleFrm( pTmpFlyFrm );
+ }
+ else
+ {
+ rImp.DisposeAccessibleObj( pAnchoredObj->GetDrawObj() );
+ rImp.AddAccessibleObj( pAnchoredObj->GetDrawObj() );
+ }
+ }
+ aAnchoredObjs.pop_back();
+ }
+ }
+ }
+}
+
+// --> OD 2004-08-20 #110810# - adjustment and re-factoring of method
+void SwDrawView::ObjOrderChanged( SdrObject* pObj, sal_uLong nOldPos,
+ sal_uLong nNewPos )
+{
+ // --> OD 2004-08-17 #110810# - nothing to do for group members
+ if ( pObj->GetUpGroup() )
+ {
+ return;
+ }
+ // <--
+
+ // determine drawing page and assure that the order numbers are correct.
+ SdrPage* pDrawPage = GetModel()->GetPage( 0 );
+ if ( pDrawPage->IsObjOrdNumsDirty() )
+ pDrawPage->RecalcObjOrdNums();
+ const sal_uInt32 nObjCount = pDrawPage->GetObjCount();
+
+ SwAnchoredObject* pMovedAnchoredObj =
+ ::GetUserCall( pObj )->GetAnchoredObj( pObj );
+ const SwFlyFrm* pParentAnchoredObj =
+ pMovedAnchoredObj->GetAnchorFrm()->FindFlyFrm();
+
+ const bool bMovedForward = nOldPos < nNewPos;
+
+ // assure for a 'child' object, that it doesn't exceed the limits of its 'parent'
+ if ( pParentAnchoredObj )
+ {
+ if ( bMovedForward )
+ {
+ sal_uInt32 nMaxChildOrdNumWithoutMoved =
+ _GetMaxChildOrdNum( *pParentAnchoredObj, pMovedAnchoredObj->GetDrawObj() );
+ if ( nNewPos > nMaxChildOrdNumWithoutMoved+1 )
+ {
+ // set position to the top of the 'child' object group
+ pDrawPage->SetObjectOrdNum( nNewPos, nMaxChildOrdNumWithoutMoved+1 );
+ nNewPos = nMaxChildOrdNumWithoutMoved+1;
+ }
+ }
+ else
+ {
+ const sal_uInt32 nParentOrdNum = pParentAnchoredObj->GetDrawObj()->GetOrdNum();
+ if ( nNewPos < nParentOrdNum )
+ {
+ // set position to the bottom of the 'child' object group
+ pDrawPage->SetObjectOrdNum( nNewPos, nParentOrdNum );
+ nNewPos = nParentOrdNum;
+ }
+ }
+ if ( pDrawPage->IsObjOrdNumsDirty() )
+ pDrawPage->RecalcObjOrdNums();
+ }
+
+ // Assure, that object isn't positioned between 'repeated' ones
+ if ( ( bMovedForward && nNewPos < nObjCount - 1 ) ||
+ ( !bMovedForward && nNewPos > 0 ) )
+ {
+ const SdrObject* pTmpObj =
+ pDrawPage->GetObj( bMovedForward ? nNewPos - 1 : nNewPos + 1 );
+ if ( pTmpObj )
+ {
+ sal_uInt32 nTmpNewPos( nNewPos );
+ if ( bMovedForward )
+ {
+ // move before the top 'repeated' object
+ const sal_uInt32 nTmpMaxOrdNum =
+ ::GetUserCall( pTmpObj )->GetMaxOrdNum();
+ if ( nTmpMaxOrdNum > nNewPos )
+ nTmpNewPos = nTmpMaxOrdNum;
+ }
+ else
+ {
+ // move behind the bottom 'repeated' object
+ const sal_uInt32 nTmpMinOrdNum =
+ ::GetUserCall( pTmpObj )->GetMinOrdNum();
+ if ( nTmpMinOrdNum < nNewPos )
+ nTmpNewPos = nTmpMinOrdNum;
+ }
+ if ( nTmpNewPos != nNewPos )
+ {
+ pDrawPage->SetObjectOrdNum( nNewPos, nTmpNewPos );
+ nNewPos = nTmpNewPos;
+ pDrawPage->RecalcObjOrdNums();
+ }
+ }
+ }
+
+ // On move forward, assure that object is moved before its own childs.
+ // Only Writer fly frames can have childs.
+ if ( pMovedAnchoredObj->ISA(SwFlyFrm) &&
+ bMovedForward && nNewPos < nObjCount - 1 )
+ {
+ sal_uInt32 nMaxChildOrdNum =
+ _GetMaxChildOrdNum( *(static_cast<const SwFlyFrm*>(pMovedAnchoredObj)) );
+ if ( nNewPos < nMaxChildOrdNum )
+ {
+ // determine position before the object before its top 'child' object
+ const SdrObject* pTmpObj = pDrawPage->GetObj( nMaxChildOrdNum );
+ sal_uInt32 nTmpNewPos = ::GetUserCall( pTmpObj )->GetMaxOrdNum() + 1;
+ if ( nTmpNewPos >= nObjCount )
+ {
+ --nTmpNewPos;
+ }
+ // assure, that determined position isn't between 'repeated' objects
+ pTmpObj = pDrawPage->GetObj( nTmpNewPos );
+ nTmpNewPos = ::GetUserCall( pTmpObj )->GetMaxOrdNum();
+ // apply new position
+ pDrawPage->SetObjectOrdNum( nNewPos, nTmpNewPos );
+ nNewPos = nTmpNewPos;
+ pDrawPage->RecalcObjOrdNums();
+ }
+ }
+
+ // Assure, that object isn't positioned between nested objects
+ if ( ( bMovedForward && nNewPos < nObjCount - 1 ) ||
+ ( !bMovedForward && nNewPos > 0 ) )
+ {
+ sal_uInt32 nTmpNewPos( nNewPos );
+ const SwFrmFmt* pParentFrmFmt =
+ pParentAnchoredObj ? &(pParentAnchoredObj->GetFrmFmt()) : 0L;
+ const SdrObject* pTmpObj = pDrawPage->GetObj( nNewPos + 1 );
+ while ( pTmpObj )
+ {
+ // --> OD 2004-12-07 #i38563# - assure, that anchor frame exists.
+ // If object is anchored inside a invisible part of the document
+ // (e.g. page header, whose page style isn't applied, or hidden
+ // section), no anchor frame exists.
+ const SwFrm* pTmpAnchorFrm = lcl_FindAnchor( pTmpObj, sal_True );
+ const SwFlyFrm* pTmpParentObj = pTmpAnchorFrm
+ ? pTmpAnchorFrm->FindFlyFrm() : 0L;
+ // <--
+ if ( pTmpParentObj &&
+ &(pTmpParentObj->GetFrmFmt()) != pParentFrmFmt )
+ {
+ if ( bMovedForward )
+ {
+ nTmpNewPos = ::GetUserCall( pTmpObj )->GetMaxOrdNum();
+ pTmpObj = pDrawPage->GetObj( nTmpNewPos + 1 );
+ }
+ else
+ {
+ nTmpNewPos = ::GetUserCall( pTmpParentObj->GetDrawObj() )
+ ->GetMinOrdNum();
+ pTmpObj = pTmpParentObj->GetDrawObj();
+ }
+ }
+ else
+ break;
+ }
+ if ( nTmpNewPos != nNewPos )
+ {
+ pDrawPage->SetObjectOrdNum( nNewPos, nTmpNewPos );
+ nNewPos = nTmpNewPos;
+ pDrawPage->RecalcObjOrdNums();
+ }
+ }
+
+ // setup collection of moved 'child' objects to move its 'repeated' objects.
+ std::vector< SdrObject* > aMovedChildObjs;
+
+ // move 'childs' accordingly
+ if ( pMovedAnchoredObj->ISA(SwFlyFrm) )
+ {
+ const SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pMovedAnchoredObj);
+
+ // adjustments for accessibility API
+ rImp.DisposeAccessibleFrm( pFlyFrm );
+ rImp.AddAccessibleFrm( pFlyFrm );
+
+ const sal_uInt32 nChildNewPos = bMovedForward ? nNewPos : nNewPos+1;
+ sal_uInt32 i = bMovedForward ? nOldPos : nObjCount-1;
+ do
+ {
+ SdrObject* pTmpObj = pDrawPage->GetObj( i );
+ if ( pTmpObj == pObj )
+ break;
+
+ // --> OD 2004-12-07 #i38563# - assure, that anchor frame exists.
+ // If object is anchored inside a invisible part of the document
+ // (e.g. page header, whose page style isn't applied, or hidden
+ // section), no anchor frame exists.
+ const SwFrm* pTmpAnchorFrm = lcl_FindAnchor( pTmpObj, sal_True );
+ const SwFlyFrm* pTmpParentObj = pTmpAnchorFrm
+ ? pTmpAnchorFrm->FindFlyFrm() : 0L;
+ // <--
+ if ( pTmpParentObj &&
+ ( ( pTmpParentObj == pFlyFrm ) ||
+ ( pFlyFrm->IsUpperOf( *pTmpParentObj ) ) ) )
+ {
+ // move child object.,
+ pDrawPage->SetObjectOrdNum( i, nChildNewPos );
+ pDrawPage->RecalcObjOrdNums();
+ // collect 'child' object
+ aMovedChildObjs.push_back( pTmpObj );
+ // adjustments for accessibility API
+ if ( pTmpObj->ISA(SwVirtFlyDrawObj) )
+ {
+ const SwFlyFrm *pTmpFlyFrm =
+ static_cast<SwVirtFlyDrawObj*>(pTmpObj)->GetFlyFrm();
+ rImp.DisposeAccessibleFrm( pTmpFlyFrm );
+ rImp.AddAccessibleFrm( pTmpFlyFrm );
+ }
+ else
+ {
+ rImp.DisposeAccessibleObj( pTmpObj );
+ rImp.AddAccessibleObj( pTmpObj );
+ }
+ }
+ else
+ {
+ // adjust loop counter
+ if ( bMovedForward )
+ ++i;
+ else if ( !bMovedForward && i > 0 )
+ --i;
+ }
+
+ } while ( ( bMovedForward && i < ( nObjCount - aMovedChildObjs.size() ) ) ||
+ ( !bMovedForward && i > ( nNewPos + aMovedChildObjs.size() ) ) );
+ }
+ else
+ {
+ // adjustments for accessibility API
+ rImp.DisposeAccessibleObj( pObj );
+ rImp.AddAccessibleObj( pObj );
+ }
+
+ _MoveRepeatedObjs( *pMovedAnchoredObj, aMovedChildObjs );
+}
+// <--
+
+/*************************************************************************
+|*
+|* SwDrawView::TakeDragLimit()
+|*
+|* Ersterstellung AMA 26. Apr. 96
+|* Letzte Aenderung MA 03. May. 96
+|*
+*************************************************************************/
+
+
+sal_Bool SwDrawView::TakeDragLimit( SdrDragMode eMode,
+ Rectangle& rRect ) const
+{
+ const SdrMarkList &rMrkList = GetMarkedObjectList();
+ sal_Bool bRet = sal_False;
+ if( 1 == rMrkList.GetMarkCount() )
+ {
+ const SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
+ SwRect aRect;
+ if( ::CalcClipRect( pObj, aRect, eMode == SDRDRAG_MOVE ) )
+ {
+ rRect = aRect.SVRect();
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* SwDrawView::CalcAnchor()
+|*
+|* Ersterstellung MA 13. Jan. 95
+|* Letzte Aenderung MA 08. Nov. 96
+|*
+*************************************************************************/
+
+
+const SwFrm* SwDrawView::CalcAnchor()
+{
+ const SdrMarkList &rMrkList = GetMarkedObjectList();
+ if ( rMrkList.GetMarkCount() != 1 )
+ return NULL;
+
+ SdrObject* pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ //Fuer Absatzgebundene Objekte suchen, andernfalls einfach nur
+ //der aktuelle Anker. Nur suchen wenn wir gerade draggen.
+ const SwFrm* pAnch;
+ Rectangle aMyRect;
+ const sal_Bool bFly = pObj->ISA(SwVirtFlyDrawObj);
+ if ( bFly )
+ {
+ pAnch = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetAnchorFrm();
+ aMyRect = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->Frm().SVRect();
+ }
+ else
+ {
+ SwDrawContact *pC = (SwDrawContact*)GetUserCall(pObj);
+ // OD 17.06.2003 #108784# - determine correct anchor position for
+ // 'virtual' drawing objects.
+ // OD 2004-03-25 #i26791#
+ pAnch = pC->GetAnchorFrm( pObj );
+ if( !pAnch )
+ {
+ pC->ConnectToLayout();
+ // OD 17.06.2003 #108784# - determine correct anchor position for
+ // 'virtual' drawing objects.
+ // OD 2004-03-25 #i26791#
+ pAnch = pC->GetAnchorFrm( pObj );
+ }
+ aMyRect = pObj->GetSnapRect();
+ }
+
+ //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
+ const sal_Bool bTopRight = pAnch && ( ( pAnch->IsVertical() &&
+ !pAnch->IsVertLR() ) ||
+ pAnch->IsRightToLeft() );
+ const Point aMyPt = bTopRight ? aMyRect.TopRight() : aMyRect.TopLeft();
+
+ Point aPt;
+ if ( IsAction() )
+ {
+ if ( !TakeDragObjAnchorPos( aPt, bTopRight ) )
+ return NULL;
+ }
+ else
+ {
+ Rectangle aRect = pObj->GetSnapRect();
+ aPt = bTopRight ? aRect.TopRight() : aRect.TopLeft();
+ }
+
+ if ( aPt != aMyPt )
+ {
+ if ( pAnch->IsCntntFrm() )
+ {
+ // OD 26.06.2003 #108784# - allow drawing objects in header/footer,
+ // but exclude control objects.
+ bool bBodyOnly = CheckControlLayer( pObj );
+ pAnch = ::FindAnchor( (SwCntntFrm*)pAnch, aPt, bBodyOnly );
+ }
+ else if ( !bFly )
+ {
+ const SwRect aRect( aPt.X(), aPt.Y(), 1, 1 );
+
+ SwDrawContact* pContact = (SwDrawContact*)GetUserCall(pObj);
+ if ( pContact->GetAnchorFrm( pObj ) &&
+ pContact->GetAnchorFrm( pObj )->IsPageFrm() )
+ pAnch = pContact->GetPageFrm();
+ else
+ pAnch = pContact->FindPage( aRect );
+ }
+ }
+ if( pAnch && !pAnch->IsProtected() )
+ aAnchorPoint = pAnch->GetFrmAnchorPos( ::HasWrap( pObj ) );
+ else
+ pAnch = 0;
+ return pAnch;
+}
+
+/*************************************************************************
+|*
+|* SwDrawView::ShowDragXor(), HideDragXor()
+|*
+|* Ersterstellung MA 17. Jan. 95
+|* Letzte Aenderung MA 27. Jan. 95
+|*
+*************************************************************************/
+
+
+void SwDrawView::ShowDragAnchor()
+{
+ SdrHdl* pHdl = aHdl.GetHdl(HDL_ANCHOR);
+ if ( ! pHdl )
+ pHdl = aHdl.GetHdl(HDL_ANCHOR_TR);
+
+ if(pHdl)
+ {
+ CalcAnchor();
+ pHdl->SetPos(aAnchorPoint);
+ //OLMRefreshAllIAOManagers();
+ }
+}
+
+/*************************************************************************
+|*
+|* SwDrawView::MarkListHasChanged()
+|*
+|* Ersterstellung OM 02. Feb. 95
+|* Letzte Aenderung OM 07. Jul. 95
+|*
+*************************************************************************/
+
+
+void SwDrawView::MarkListHasChanged()
+{
+ Imp().GetShell()->DrawSelChanged();
+ FmFormView::MarkListHasChanged();
+}
+
+// #i7672#
+void SwDrawView::ModelHasChanged()
+{
+ // The ModelHasChanged() call in DrawingLayer also updates
+ // a eventually active text edit view (OutlinerView). This also leads
+ // to newly setting the background color for that edit view. Thus,
+ // this method rescues the current background color if a OutlinerView
+ // exists and re-establishes it then. To be more safe, the OutlinerView
+ // will be fetched again (maybe textedit has ended).
+ OutlinerView* pView = GetTextEditOutlinerView();
+ Color aBackColor;
+ sal_Bool bColorWasSaved(sal_False);
+
+ if(pView)
+ {
+ aBackColor = pView->GetBackgroundColor();
+ bColorWasSaved = sal_True;
+ }
+
+ // call parent
+ FmFormView::ModelHasChanged();
+
+ if(bColorWasSaved)
+ {
+ pView = GetTextEditOutlinerView();
+
+ if(pView)
+ {
+ pView->SetBackgroundColor(aBackColor);
+ }
+ }
+}
+
+void SwDrawView::MakeVisible( const Rectangle &rRect, Window & )
+{
+ ASSERT( rImp.GetShell()->GetWin(), "MakeVisible, unknown Window");
+ rImp.GetShell()->MakeVisible( SwRect( rRect ) );
+}
+
+void SwDrawView::CheckPossibilities()
+{
+ FmFormView::CheckPossibilities();
+
+ //Zusaetzlich zu den bestehenden Flags der Objekte selbst, die von der
+ //DrawingEngine ausgewertet werden, koennen weitere Umstaende zu einem
+ //Schutz fuehren.
+ //Objekte, die in Rahmen verankert sind, muessen genau dann geschuetzt
+ //sein, wenn der Inhalt des Rahmens geschuetzt ist.
+ //OLE-Objekte konnen selbst einen Resize-Schutz wuenschen (StarMath)
+
+ const SdrMarkList &rMrkList = GetMarkedObjectList();
+ sal_Bool bProtect = sal_False,
+ bSzProtect = sal_False;
+ for ( sal_uInt16 i = 0; !bProtect && i < rMrkList.GetMarkCount(); ++i )
+ {
+ const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
+ const SwFrm *pFrm = NULL;
+ if ( pObj->ISA(SwVirtFlyDrawObj) )
+ {
+ const SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+ if ( pFly )
+ {
+ pFrm = pFly->GetAnchorFrm();
+ if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() )
+ {
+ SwOLENode *pNd = ((SwCntntFrm*)pFly->Lower())->GetNode()->GetOLENode();
+ if ( pNd )
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj = pNd->GetOLEObj().GetOleRef();
+ if ( xObj.is() )
+ {
+ // --> OD 2004-08-16 #110810# - improvement for
+ // the future, when more than one Writer fly frame
+ // can be selected.
+
+ // TODO/LATER: retrieve Aspect - from where?!
+ bSzProtect |= ( embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT ) ) ? sal_True : sal_False;
+
+ // <--
+
+ // #i972: protect position if it is a Math object anchored 'as char' and baseline alignment is activated
+ SwDoc* pDoc = Imp().GetShell()->GetDoc();
+ const bool bProtectMathPos = SotExchange::IsMath( xObj->getClassID() )
+ && FLY_AS_CHAR == pFly->GetFmt()->GetAnchor().GetAnchorId()
+ && pDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
+ if (bProtectMathPos)
+ bMoveProtect = true;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ SwDrawContact *pC = (SwDrawContact*)GetUserCall(pObj);
+ if ( pC )
+ pFrm = pC->GetAnchorFrm( pObj );
+ }
+ if ( pFrm )
+ bProtect = pFrm->IsProtected(); //Rahmen, Bereiche usw.
+ {
+ SwFrmFmt* pFrmFmt( ::FindFrmFmt( const_cast<SdrObject*>(pObj) ) );
+ if ( !pFrmFmt )
+ {
+ ASSERT( false,
+ "<SwDrawView::CheckPossibilities()> - missing frame format" );
+ bProtect = sal_True;
+ }
+ else if ((FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId()) &&
+ rMrkList.GetMarkCount() > 1 )
+ {
+ bProtect = sal_True;
+ }
+ }
+ }
+ bMoveProtect |= bProtect;
+ bResizeProtect |= bProtect | bSzProtect;
+}
+
+/** replace marked <SwDrawVirtObj>-objects by its reference object for delete
+ marked objects.
+
+ OD 18.06.2003 #108784#
+
+ @author OD
+*/
+void SwDrawView::ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView )
+{
+ SdrPageView* pDrawPageView = _rMarkView.GetSdrPageView();
+ const SdrMarkList& rMarkList = _rMarkView.GetMarkedObjectList();
+
+ if( rMarkList.GetMarkCount() )
+ {
+ // collect marked objects in a local data structure
+ std::vector<SdrObject*> aMarkedObjs;
+ for( sal_uInt32 i = 0; i < rMarkList.GetMarkCount(); ++i )
+ {
+ SdrObject* pMarkedObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
+ aMarkedObjs.push_back( pMarkedObj );
+ }
+ // unmark all objects
+ _rMarkView.UnmarkAllObj();
+ // re-mark objects, but for marked <SwDrawVirtObj>-objects marked its
+ // reference object.
+ while ( !aMarkedObjs.empty() )
+ {
+ SdrObject* pMarkObj = aMarkedObjs.back();
+ if ( pMarkObj->ISA(SwDrawVirtObj) )
+ {
+ SdrObject* pRefObj = &(static_cast<SwDrawVirtObj*>(pMarkObj)->ReferencedObj());
+ if ( !_rMarkView.IsObjMarked( pRefObj ) )
+ {
+ _rMarkView.MarkObj( pRefObj, pDrawPageView );
+ }
+ }
+ else
+ {
+ _rMarkView.MarkObj( pMarkObj, pDrawPageView );
+ }
+
+ aMarkedObjs.pop_back();
+ }
+ // sort marked list in order to assure consistent state in drawing layer
+ _rMarkView.SortMarkedObjects();
+ }
+}
+
+void SwDrawView::DeleteMarked()
+{
+ SwDoc* pDoc = Imp().GetShell()->GetDoc();
+ SwRootFrm *pTmpRoot = pDoc->GetCurrentLayout();//swmod 080317
+ if ( pTmpRoot )
+ pTmpRoot->StartAllAction();
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+ // OD 18.06.2003 #108784# - replace marked <SwDrawVirtObj>-objects by its
+ // reference objects.
+ {
+ SdrPageView* pDrawPageView = rImp.GetPageView();
+ if ( pDrawPageView )
+ {
+ SdrMarkView* pMarkView = PTR_CAST( SdrMarkView, &(pDrawPageView->GetView()) );
+ if ( pMarkView )
+ {
+ ReplaceMarkedDrawVirtObjs( *pMarkView );
+ }
+ }
+ }
+ if ( pDoc->DeleteSelection( *this ) )
+ {
+ FmFormView::DeleteMarked();
+ ::FrameNotify( Imp().GetShell(), FLY_DRAG_END );
+ }
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+ if( pTmpRoot )
+ pTmpRoot->EndAllAction(); //swmod 080218
+}
+
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
new file mode 100755
index 000000000000..d018b0731e43
--- /dev/null
+++ b/sw/source/core/edit/acorrect.cxx
@@ -0,0 +1,548 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+
+
+#define _STD_VAR_ARRAYS
+#include <hintids.hxx>
+
+#include <svx/svxids.hrc>
+#include <editeng/langitem.hxx>
+#include <fmtinfmt.hxx>
+#include <txtatr.hxx>
+#include <txtinet.hxx>
+#include <editsh.hxx>
+#include <doc.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <acorrect.hxx>
+#include <shellio.hxx>
+#include <swundo.hxx>
+#include <viscrs.hxx>
+
+#include <editeng/acorrcfg.hxx>
+
+using namespace ::com::sun::star;
+
+
+class _PaMIntoCrsrShellRing
+{
+ SwCrsrShell& rSh;
+ SwPaM &rDelPam, &rCrsr;
+ Ring *pPrevDelPam, *pPrevCrsr;
+
+ void RemoveFromRing( SwPaM& rPam, Ring* pPrev );
+public:
+ _PaMIntoCrsrShellRing( SwCrsrShell& rSh, SwPaM& rCrsr, SwPaM& rPam );
+ ~_PaMIntoCrsrShellRing();
+};
+
+_PaMIntoCrsrShellRing::_PaMIntoCrsrShellRing( SwCrsrShell& rCSh,
+ SwPaM& rShCrsr, SwPaM& rPam )
+ : rSh( rCSh ), rDelPam( rPam ), rCrsr( rShCrsr )
+{
+ SwPaM* pShCrsr = rSh._GetCrsr();
+
+ pPrevDelPam = rDelPam.GetPrev();
+ pPrevCrsr = rCrsr.GetPrev();
+
+ rDelPam.MoveRingTo( pShCrsr );
+ rCrsr.MoveRingTo( pShCrsr );
+}
+_PaMIntoCrsrShellRing::~_PaMIntoCrsrShellRing()
+{
+ // und den Pam wieder herausnehmen:
+ RemoveFromRing( rDelPam, pPrevDelPam );
+ RemoveFromRing( rCrsr, pPrevCrsr );
+}
+void _PaMIntoCrsrShellRing::RemoveFromRing( SwPaM& rPam, Ring* pPrev )
+{
+ Ring *p, *pNext = (Ring*)&rPam;
+ do {
+ p = pNext;
+ pNext = p->GetNext();
+ p->MoveTo( &rPam );
+ } while( p != pPrev );
+}
+
+
+SwAutoCorrDoc::SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam,
+ sal_Unicode cIns )
+ : rEditSh( rEditShell ), rCrsr( rPam ), pIdx( 0 )
+ , m_nEndUndoCounter(0)
+ , bUndoIdInitialized( cIns ? false : true )
+{
+}
+
+
+SwAutoCorrDoc::~SwAutoCorrDoc()
+{
+ for (int i = 0; i < m_nEndUndoCounter; ++i)
+ {
+ rEditSh.EndUndo();
+ }
+ delete pIdx;
+}
+
+void SwAutoCorrDoc::DeleteSel( SwPaM& rDelPam )
+{
+ SwDoc* pDoc = rEditSh.GetDoc();
+ if( pDoc->IsAutoFmtRedline() )
+ {
+ // damit der DelPam auch verschoben wird, in den Shell-Cursr-Ring
+ // mit aufnehmen !!
+ _PaMIntoCrsrShellRing aTmp( rEditSh, rCrsr, rDelPam );
+ pDoc->DeleteAndJoin( rDelPam );
+ }
+ else
+ {
+ pDoc->DeleteRange( rDelPam );
+ }
+}
+
+sal_Bool SwAutoCorrDoc::Delete( xub_StrLen nStt, xub_StrLen nEnd )
+{
+ const SwNodeIndex& rNd = rCrsr.GetPoint()->nNode;
+ SwPaM aSel( rNd, nStt, rNd, nEnd );
+ DeleteSel( aSel );
+
+ if( bUndoIdInitialized )
+ bUndoIdInitialized = true;
+ return sal_True;
+}
+
+
+sal_Bool SwAutoCorrDoc::Insert( xub_StrLen nPos, const String& rTxt )
+{
+ SwPaM aPam( rCrsr.GetPoint()->nNode.GetNode(), nPos );
+ rEditSh.GetDoc()->InsertString( aPam, rTxt );
+ if( !bUndoIdInitialized )
+ {
+ bUndoIdInitialized = true;
+ if( 1 == rTxt.Len() )
+ {
+ rEditSh.StartUndo( UNDO_AUTOCORRECT );
+ ++m_nEndUndoCounter;
+ }
+ }
+ return sal_True;
+}
+
+
+sal_Bool SwAutoCorrDoc::Replace( xub_StrLen nPos, const String& rTxt )
+{
+ return ReplaceRange( nPos, rTxt.Len(), rTxt );
+}
+sal_Bool SwAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength, const String& rTxt )
+{
+ SwPaM* pPam = &rCrsr;
+ if( pPam->GetPoint()->nContent.GetIndex() != nPos )
+ {
+ pPam = new SwPaM( *rCrsr.GetPoint() );
+ pPam->GetPoint()->nContent = nPos;
+ }
+
+ SwTxtNode * const pNd = pPam->GetNode()->GetTxtNode();
+ if ( !pNd )
+ {
+ return sal_False;
+ }
+
+ // text attributes with dummy characters must not be replaced!
+ bool bDoReplace = true;
+ xub_StrLen const nLen = rTxt.Len();
+ for ( xub_StrLen n = 0; n < nLen; ++n )
+ {
+ sal_Unicode const Char = pNd->GetTxt().GetChar( n + nPos );
+ if ( ( CH_TXTATR_BREAKWORD == Char || CH_TXTATR_INWORD == Char )
+ && pNd->GetTxtAttrForCharAt( n + nPos ) )
+ {
+ bDoReplace = false;
+ break;
+ }
+ }
+
+ if ( bDoReplace )
+ {
+ SwDoc* pDoc = rEditSh.GetDoc();
+
+// if( !pDoc->IsAutoFmtRedline() &&
+// pPam != &rCrsr ) // nur an akt. Position das Redline sichern
+// pDoc->SetRedlineMode_intern( eOld | REDLINE_IGNORE );
+
+ if( pDoc->IsAutoFmtRedline() )
+ {
+ if( nPos == pNd->GetTxt().Len() ) // am Ende erfolgt ein Insert
+ {
+ pDoc->InsertString( *pPam, rTxt );
+ }
+ else
+ {
+ _PaMIntoCrsrShellRing aTmp( rEditSh, rCrsr, *pPam );
+
+ pPam->SetMark();
+ pPam->GetPoint()->nContent = Min( pNd->GetTxt().Len(),
+ xub_StrLen( nPos + nSourceLength ));
+ pDoc->ReplaceRange( *pPam, rTxt, false );
+ pPam->Exchange();
+ pPam->DeleteMark();
+ }
+ }
+ else
+ {
+ if( nSourceLength != rTxt.Len() )
+ {
+ pPam->SetMark();
+ pPam->GetPoint()->nContent = Min( pNd->GetTxt().Len(),
+ xub_StrLen( nPos + nSourceLength ));
+ pDoc->ReplaceRange( *pPam, rTxt, false );
+ pPam->Exchange();
+ pPam->DeleteMark();
+ }
+ else
+ pDoc->Overwrite( *pPam, rTxt );
+ }
+
+// pDoc->SetRedlineMode_intern( eOld );
+ if( bUndoIdInitialized )
+ {
+ bUndoIdInitialized = true;
+ if( 1 == rTxt.Len() )
+ {
+ rEditSh.StartUndo( UNDO_AUTOCORRECT );
+ ++m_nEndUndoCounter;
+ }
+ }
+ }
+
+ if( pPam != &rCrsr )
+ delete pPam;
+
+ return sal_True;
+}
+
+
+
+sal_Bool SwAutoCorrDoc::SetAttr( xub_StrLen nStt, xub_StrLen nEnd, sal_uInt16 nSlotId,
+ SfxPoolItem& rItem )
+{
+ const SwNodeIndex& rNd = rCrsr.GetPoint()->nNode;
+ SwPaM aPam( rNd, nStt, rNd, nEnd );
+
+ SfxItemPool& rPool = rEditSh.GetDoc()->GetAttrPool();
+ sal_uInt16 nWhich = rPool.GetWhich( nSlotId, sal_False );
+ if( nWhich )
+ {
+ rItem.SetWhich( nWhich );
+
+ SfxItemSet aSet( rPool, aCharFmtSetRange );
+ SetAllScriptItem( aSet, rItem );
+
+ rEditSh.GetDoc()->SetFmtItemByAutoFmt( aPam, aSet );
+
+ if( bUndoIdInitialized )
+ bUndoIdInitialized = true;
+ }
+ return 0 != nWhich;
+}
+
+
+
+sal_Bool SwAutoCorrDoc::SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL )
+{
+ const SwNodeIndex& rNd = rCrsr.GetPoint()->nNode;
+ SwPaM aPam( rNd, nStt, rNd, nEnd );
+
+ SfxItemSet aSet( rEditSh.GetDoc()->GetAttrPool(),
+ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT );
+ aSet.Put( SwFmtINetFmt( rURL, aEmptyStr ));
+ rEditSh.GetDoc()->SetFmtItemByAutoFmt( aPam, aSet );
+ if( bUndoIdInitialized )
+ bUndoIdInitialized = true;
+ return sal_True;
+}
+
+ // returne den Text eines vorherigen Absatzes.
+ // Dieser darf nicht leer sein!
+ // Gibt es diesen nicht oder gibt es davor nur Leere, dann returne 0
+ // Das Flag gibt an:
+ // sal_True: den, vor der normalen Einfuegeposition (sal_True)
+ // sal_False: den, in den das korrigierte Wort eingfuegt wurde.
+ // (Muss nicht der gleiche Absatz sein!!!!)
+const String* SwAutoCorrDoc::GetPrevPara( sal_Bool bAtNormalPos )
+{
+ const String* pStr = 0;
+
+ if( bAtNormalPos || !pIdx )
+ pIdx = new SwNodeIndex( rCrsr.GetPoint()->nNode, -1 );
+ else
+ (*pIdx)--;
+
+ SwTxtNode* pTNd = pIdx->GetNode().GetTxtNode();
+ while( pTNd && !pTNd->GetTxt().Len() )
+ {
+ (*pIdx)--;
+ pTNd = pIdx->GetNode().GetTxtNode();
+ }
+ //if( pTNd && NO_NUMBERING == pTNd->GetTxtColl()->GetOutlineLevel() )
+ if( pTNd && 0 == pTNd->GetAttrOutlineLevel() )//#outline level,zhaojianwei
+ pStr = &pTNd->GetTxt();
+
+ if( bUndoIdInitialized )
+ bUndoIdInitialized = true;
+ return pStr;
+}
+
+
+sal_Bool SwAutoCorrDoc::ChgAutoCorrWord( xub_StrLen & rSttPos, xub_StrLen nEndPos,
+ SvxAutoCorrect& rACorrect,
+ const String** ppPara )
+{
+ if( bUndoIdInitialized )
+ bUndoIdInitialized = true;
+
+ // Absatz-Anfang oder ein Blank gefunden, suche nach dem Wort
+ // Kuerzel im Auto
+ SwTxtNode* pTxtNd = rCrsr.GetNode()->GetTxtNode();
+ ASSERT( pTxtNd, "wo ist denn der TextNode?" );
+
+ sal_Bool bRet = sal_False;
+ if( nEndPos == rSttPos )
+ return bRet;
+
+ LanguageType eLang = GetLanguage(nEndPos, sal_False);
+ if(LANGUAGE_SYSTEM == eLang)
+ eLang = (LanguageType)GetAppLanguage();
+
+ //JP 22.04.99: Bug 63883 - Sonderbehandlung fuer Punkte.
+ sal_Bool bLastCharIsPoint = nEndPos < pTxtNd->GetTxt().Len() &&
+ '.' == pTxtNd->GetTxt().GetChar( nEndPos );
+
+ const SvxAutocorrWord* pFnd = rACorrect.SearchWordsInList(
+ pTxtNd->GetTxt(), rSttPos, nEndPos, *this, eLang );
+ SwDoc* pDoc = rEditSh.GetDoc();
+ if( pFnd )
+ {
+ const SwNodeIndex& rNd = rCrsr.GetPoint()->nNode;
+ SwPaM aPam( rNd, rSttPos, rNd, nEndPos );
+
+ if( pFnd->IsTextOnly() )
+ {
+ //JP 22.04.99: Bug 63883 - Sonderbehandlung fuer Punkte.
+ if( !bLastCharIsPoint || !pFnd->GetLong().Len() ||
+ '.' != pFnd->GetLong().GetChar( pFnd->GetLong().Len() - 1 ) )
+ {
+ // replace the selection
+ pDoc->ReplaceRange( aPam, pFnd->GetLong(), false);
+ bRet = sal_True;
+ }
+ }
+ else
+ {
+ SwTextBlocks aTBlks( rACorrect.GetAutoCorrFileName( eLang, sal_False, sal_True ));
+ sal_uInt16 nPos = aTBlks.GetIndex( pFnd->GetShort() );
+ if( USHRT_MAX != nPos && aTBlks.BeginGetDoc( nPos ) )
+ {
+ DeleteSel( aPam );
+ pDoc->DontExpandFmt( *aPam.GetPoint() );
+
+ if( ppPara )
+ {
+ ASSERT( !pIdx, "wer hat seinen Index nicht geloescht?" );
+ pIdx = new SwNodeIndex( rCrsr.GetPoint()->nNode, -1 );
+ }
+
+ //
+ SwDoc* pAutoDoc = aTBlks.GetDoc();
+ SwNodeIndex aSttIdx( pAutoDoc->GetNodes().GetEndOfExtras(), 1 );
+ SwCntntNode* pCntntNd = pAutoDoc->GetNodes().GoNext( &aSttIdx );
+ SwPaM aCpyPam( aSttIdx );
+
+ const SwTableNode* pTblNd = pCntntNd->FindTableNode();
+ if( pTblNd )
+ {
+ aCpyPam.GetPoint()->nContent.Assign( 0, 0 );
+ aCpyPam.GetPoint()->nNode = *pTblNd;
+ }
+ aCpyPam.SetMark();
+
+ // dann bis zum Ende vom Nodes Array
+ aCpyPam.GetPoint()->nNode.Assign( pAutoDoc->GetNodes().GetEndOfContent(), -1 );
+ pCntntNd = aCpyPam.GetCntntNode();
+ aCpyPam.GetPoint()->nContent.Assign( pCntntNd, pCntntNd->Len() );
+
+ SwDontExpandItem aExpItem;
+ aExpItem.SaveDontExpandItems( *aPam.GetPoint() );
+
+ pAutoDoc->CopyRange( aCpyPam, *aPam.GetPoint(), false );
+
+ aExpItem.RestoreDontExpandItems( *aPam.GetPoint() );
+
+ if( ppPara )
+ {
+ (*pIdx)++;
+ pTxtNd = pIdx->GetNode().GetTxtNode();
+ }
+ bRet = sal_True;
+ }
+ aTBlks.EndGetDoc();
+ }
+ }
+
+ if( bRet && ppPara && pTxtNd )
+ *ppPara = &pTxtNd->GetTxt();
+
+ return bRet;
+}
+
+
+ // wird nach dem austauschen der Zeichen von den Funktionen
+ // - FnCptlSttWrd
+ // - FnCptlSttSntnc
+ // gerufen. Dann koennen die Worte ggfs. in die Ausnahmelisten
+ // aufgenommen werden.
+void SwAutoCorrDoc::SaveCpltSttWord( sal_uLong nFlag, xub_StrLen nPos,
+ const String& rExceptWord,
+ sal_Unicode cChar )
+{
+ sal_uLong nNode = pIdx ? pIdx->GetIndex() : rCrsr.GetPoint()->nNode.GetIndex();
+ LanguageType eLang = GetLanguage(nPos, sal_False);
+ rEditSh.GetDoc()->SetAutoCorrExceptWord( new SwAutoCorrExceptWord( nFlag,
+ nNode, nPos, rExceptWord, cChar, eLang ));
+}
+
+LanguageType SwAutoCorrDoc::GetLanguage( xub_StrLen nPos, sal_Bool bPrevPara ) const
+{
+ LanguageType eRet = LANGUAGE_SYSTEM;
+
+ SwTxtNode* pNd = (( bPrevPara && pIdx )
+ ? *pIdx
+ : rCrsr.GetPoint()->nNode ).GetNode().GetTxtNode();
+
+ if( pNd )
+ eRet = pNd->GetLang( nPos, 0 );
+ if(LANGUAGE_SYSTEM == eRet)
+ eRet = (LanguageType)GetAppLanguage();
+ return eRet;
+}
+
+void SwAutoCorrExceptWord::CheckChar( const SwPosition& rPos, sal_Unicode cChr )
+{
+ // nur testen ob es eine Verbesserung ist. Wenn ja, dann das Wort
+ // in die Ausnahmeliste aufnehmen.
+ if( cChar == cChr && rPos.nNode.GetIndex() == nNode &&
+ rPos.nContent.GetIndex() == nCntnt )
+ {
+ // die akt. Autokorrektur besorgen:
+ SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+
+ // dann in die Liste aufnehmen:
+ if( CptlSttWrd & nFlags )
+ pACorr->AddWrtSttException( sWord, eLanguage );
+ else if( CptlSttSntnc & nFlags )
+ pACorr->AddCplSttException( sWord, eLanguage );
+ }
+}
+
+
+sal_Bool SwAutoCorrExceptWord::CheckDelChar( const SwPosition& rPos )
+{
+ sal_Bool bRet = sal_False;
+ if( !bDeleted && rPos.nNode.GetIndex() == nNode &&
+ rPos.nContent.GetIndex() == nCntnt )
+ bDeleted = bRet = sal_True;
+ return bRet;
+}
+
+SwDontExpandItem::~SwDontExpandItem()
+{
+ delete pDontExpItems;
+}
+
+void SwDontExpandItem::SaveDontExpandItems( const SwPosition& rPos )
+{
+ const SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+ if( pTxtNd )
+ {
+ pDontExpItems = new SfxItemSet( ((SwDoc*)pTxtNd->GetDoc())->GetAttrPool(),
+ aCharFmtSetRange );
+ xub_StrLen n = rPos.nContent.GetIndex();
+ if( !pTxtNd->GetAttr( *pDontExpItems, n, n,
+ n != pTxtNd->GetTxt().Len() ))
+ delete pDontExpItems, pDontExpItems = 0;
+ }
+}
+
+void SwDontExpandItem::RestoreDontExpandItems( const SwPosition& rPos )
+{
+ SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+ if( pTxtNd )
+ {
+ xub_StrLen nStart = rPos.nContent.GetIndex();
+ if( nStart == pTxtNd->GetTxt().Len() )
+ pTxtNd->FmtToTxtAttr( pTxtNd );
+
+ if( pTxtNd->GetpSwpHints() && pTxtNd->GetpSwpHints()->Count() )
+ {
+ const sal_uInt16 nSize = pTxtNd->GetpSwpHints()->Count();
+ sal_uInt16 n;
+ xub_StrLen nAttrStart;
+ const xub_StrLen* pAttrEnd;
+
+ for( n = 0; n < nSize; ++n )
+ {
+ SwTxtAttr* pHt = pTxtNd->GetpSwpHints()->GetTextHint( n );
+ nAttrStart = *pHt->GetStart();
+ if( nAttrStart > nStart ) // ueber den Bereich hinaus
+ break;
+
+ if( 0 != ( pAttrEnd = pHt->GetEnd() ) &&
+ ( ( nAttrStart < nStart &&
+ ( pHt->DontExpand() ? nStart < *pAttrEnd
+ : nStart <= *pAttrEnd )) ||
+ ( nStart == nAttrStart &&
+ ( nAttrStart == *pAttrEnd || !nStart ))) )
+ {
+ const SfxPoolItem* pItem;
+ if( !pDontExpItems || SFX_ITEM_SET != pDontExpItems->
+ GetItemState( pHt->Which(), sal_False, &pItem ) ||
+ *pItem != pHt->GetAttr() )
+ {
+ // das Attribut war vorher nicht in dieser Form im Absatz
+ // gesetzt, also kann es nur durchs einfuegen/kopieren erzeugt
+ // worden sein. Damit ist es ein Kandiadat fuers DontExpand
+ pHt->SetDontExpand( sal_True );
+ }
+ }
+ }
+ }
+ }
+}
+
+
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
new file mode 100644
index 000000000000..3ae88ec4b45d
--- /dev/null
+++ b/sw/source/core/edit/autofmt.cxx
@@ -0,0 +1,2798 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+
+
+#define _SVSTDARR_LONGS
+#define _SVSTDARR_USHORTS
+
+#include <ctype.h>
+#include <hintids.hxx>
+
+#include <svl/svstdarr.hxx>
+
+#include <unotools/charclass.hxx>
+
+#include <vcl/msgbox.hxx>
+
+#include <editeng/boxitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/cscoitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/acorrcfg.hxx>
+
+#include <swwait.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtanchr.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <docary.hxx>
+#include <editsh.hxx>
+#include <index.hxx>
+#include <pam.hxx>
+#include <edimp.hxx>
+#include <fesh.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <poolfmt.hxx>
+#include <ndtxt.hxx>
+#include <txtfrm.hxx>
+#include <frminf.hxx>
+#include <pagedesc.hxx>
+#include <paratr.hxx>
+#include <swtable.hxx>
+#include <acorrect.hxx>
+#include <shellres.hxx>
+#include <section.hxx>
+#include <frmatr.hxx>
+#include <charatr.hxx>
+#include <mdiexp.hxx>
+#include <statstr.hrc>
+#include <comcore.hrc>
+#include <numrule.hxx>
+
+using namespace ::com::sun::star;
+
+//-------------------------------------------------------------------
+
+//JP 16.12.99: definition:
+// from pos cPosEnDash to cPosEmDash all chars changed to endashes,
+// from pos cPosEmDash to cPosEnd all chars changed to emdashes
+// all other chars are changed to the user configuration
+
+const sal_Unicode pBulletChar[6] = { '+', '*', '-', 0x2013, 0x2014, 0 };
+const int cnPosEnDash = 2, cnPosEmDash = 4, cnPosEnd = 5;
+
+const sal_Unicode cStarSymbolEnDash = 0x2013;
+const sal_Unicode cStarSymbolEmDash = 0x2014;
+
+
+SvxSwAutoFmtFlags* SwEditShell::pAutoFmtFlags = 0;
+
+// Anzahl von Num-/Bullet-Absatzvorlagen. MAXLEVEL wird demnaechst auf
+// x erhoeht, die Anzahl Vorlagen aber nicht (Ueberbleibsel aus <= 4.0)
+const sal_uInt16 cnNumBullColls = 4;
+
+class SwAutoFormat
+{
+ SvxSwAutoFmtFlags aFlags;
+ SwPaM aDelPam; // ein Pam der benutzt werden kann
+ SwNodeIndex aNdIdx; // der Index auf den akt. TextNode
+ SwNodeIndex aEndNdIdx; // Index auf das Ende vom Bereich
+
+ SwEditShell* pEditShell;
+ SwDoc* pDoc;
+ SwTxtNode* pAktTxtNd; // der akt. TextNode
+ SwTxtFrm* pAktTxtFrm; // Frame vom akt. TextNode
+ CharClass* pCharClass; // Character classification
+ sal_uLong nEndNdIdx; // fuer die Prozent-Anzeige
+ LanguageType eCharClassLang;
+
+ sal_uInt16 nLastHeadLvl, nLastCalcHeadLvl;
+ sal_uInt16 nLastEnumLvl, nLastCalcEnumLvl;
+ sal_uInt16 nRedlAutoFmtSeqId;
+
+ enum
+ {
+ NONE = 0,
+ DELIM = 1,
+ DIGIT = 2,
+ CHG = 4,
+ LOWER_ALPHA = 8,
+ UPPER_ALPHA = 16,
+ LOWER_ROMAN = 32,
+ UPPER_ROMAN = 64,
+ NO_DELIM = (DIGIT|LOWER_ALPHA|UPPER_ALPHA|LOWER_ROMAN|UPPER_ROMAN)
+ };
+
+ enum Format_Status
+ {
+ READ_NEXT_PARA,
+ TST_EMPTY_LINE,
+ TST_ALPHA_LINE,
+ GET_ALL_INFO,
+ IS_ONE_LINE,
+ TST_ENUMERIC,
+ TST_IDENT,
+ TST_NEG_IDENT,
+ TST_TXT_BODY,
+ HAS_FMTCOLL,
+ IS_ENDE
+ } eStat;
+
+ sal_Bool bEnde : 1;
+ sal_Bool bEmptyLine : 1;
+ sal_Bool bMoreLines : 1;
+
+ static sal_Bool m_bAskForCancelUndoWhileBufferOverflow;
+ static short m_nActionWhileAutoformatUndoBufferOverflow;
+
+
+ // ------------- private methods -----------------------------
+ void _GetCharClass( LanguageType eLang );
+ CharClass& GetCharClass( LanguageType eLang ) const
+ {
+ if( !pCharClass || eLang != eCharClassLang )
+ {
+ SwAutoFormat* pThis = (SwAutoFormat*)this;
+ pThis->_GetCharClass( eLang );
+ }
+ return *pCharClass;
+ }
+
+
+ sal_Bool IsSpace( const sal_Unicode c ) const
+ { return (' ' == c || '\t' == c || 0x0a == c|| 0x3000 == c /* Jap. space */) ? sal_True : sal_False; }
+
+ void SetColl( sal_uInt16 nId, sal_Bool bHdLineOrText = sal_False );
+ String GoNextPara();
+ sal_Bool HasObjects( const SwNode& rNd );
+
+ // TxtNode Methoden
+ const SwTxtNode* GetNextNode() const;
+ sal_Bool IsEmptyLine( const SwTxtNode& rNd ) const
+ { return 0 == rNd.GetTxt().Len() ||
+ rNd.GetTxt().Len() == GetLeadingBlanks( rNd.GetTxt() ); }
+
+ sal_Bool IsOneLine( const SwTxtNode& ) const;
+ sal_Bool IsFastFullLine( const SwTxtNode& ) const;
+ sal_Bool IsNoAlphaLine( const SwTxtNode&) const;
+ sal_Bool IsEnumericChar( const SwTxtNode&) const;
+ sal_Bool IsBlanksInString( const SwTxtNode&) const;
+ sal_uInt16 CalcLevel( const SwTxtNode&, sal_uInt16 *pDigitLvl = 0 ) const;
+ xub_StrLen GetBigIndent( xub_StrLen& rAktSpacePos ) const;
+
+ String& DelLeadingBlanks( String& rStr ) const;
+ String& DelTrailingBlanks( String& rStr ) const;
+ xub_StrLen GetLeadingBlanks( const String& rStr ) const;
+ xub_StrLen GetTrailingBlanks( const String& rStr ) const;
+
+ sal_Bool IsFirstCharCapital( const SwTxtNode& rNd ) const;
+ sal_uInt16 GetDigitLevel( const SwTxtNode& rTxtNd, xub_StrLen& rPos,
+ String* pPreFix = 0, String* pPostFix = 0,
+ String* pNumTypes = 0 ) const;
+ // hole den FORMATIERTEN TextFrame
+ SwTxtFrm* GetFrm( const SwTxtNode& rTxtNd ) const;
+
+ void BuildIndent();
+ void BuildText();
+ void BuildTextIndent();
+ void BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel );
+ void BuildNegIndent( SwTwips nSpaces );
+ void BuildHeadLine( sal_uInt16 nLvl );
+
+ sal_Bool HasSelBlanks( SwPaM& rPam ) const;
+ sal_Bool HasBreakAttr( const SwTxtNode& ) const;
+ void DeleteSel( SwPaM& rPam );
+ sal_Bool DeleteAktNxtPara( const String& rNxtPara );
+ // loesche im Node Anfang oder/und Ende
+ void DeleteAktPara( sal_Bool bStart = sal_True, sal_Bool nEnd = sal_True );
+ void DelEmptyLine( sal_Bool bTstNextPara = sal_True );
+ // loesche bei mehrzeiligen Absaetzen die "linken" und/oder
+ // "rechten" Raender
+ void DelMoreLinesBlanks( sal_Bool bWithLineBreaks = sal_False );
+ // loesche den vorherigen Absatz
+ void DelPrevPara();
+ // dann lasse doch mal das AutoCorrect auf den akt. TextNode los
+ void AutoCorrect( xub_StrLen nSttPos = 0 );
+
+ sal_Bool CanJoin( const SwTxtNode* pTxtNd ) const
+ {
+ return !bEnde && pTxtNd &&
+ !IsEmptyLine( *pTxtNd ) &&
+ !IsNoAlphaLine( *pTxtNd) &&
+ !IsEnumericChar( *pTxtNd ) &&
+ ((STRING_MAXLEN - 50 - pTxtNd->GetTxt().Len()) >
+ pAktTxtNd->GetTxt().Len()) &&
+ !HasBreakAttr( *pTxtNd );
+ }
+
+ // ist ein Punkt am Ende ??
+ sal_Bool IsSentenceAtEnd( const SwTxtNode& rTxtNd ) const;
+
+ sal_Bool DoUnderline();
+ sal_Bool DoTable();
+
+ void _SetRedlineTxt( sal_uInt16 nId );
+ sal_Bool SetRedlineTxt( sal_uInt16 nId )
+ { if( aFlags.bWithRedlining ) _SetRedlineTxt( nId ); return sal_True; }
+ sal_Bool ClearRedlineTxt()
+ { if( aFlags.bWithRedlining ) pDoc->SetAutoFmtRedlineComment(0); return sal_True; }
+
+public:
+ SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags,
+ SwNodeIndex* pSttNd = 0, SwNodeIndex* pEndNd = 0 );
+ ~SwAutoFormat() {
+ delete pCharClass;
+ }
+};
+
+sal_Bool SwAutoFormat::m_bAskForCancelUndoWhileBufferOverflow = sal_True;
+short SwAutoFormat::m_nActionWhileAutoformatUndoBufferOverflow = RET_YES;
+
+const sal_Unicode* StrChr( const sal_Unicode* pSrc, sal_Unicode c )
+{
+ while( *pSrc && *pSrc != c )
+ ++pSrc;
+ return *pSrc ? pSrc : 0;
+}
+
+SwTxtFrm* SwAutoFormat::GetFrm( const SwTxtNode& rTxtNd ) const
+{
+ // besorge mal den Frame
+ const SwCntntFrm *pFrm = rTxtNd.getLayoutFrm( pEditShell->GetLayout() );
+ ASSERT( pFrm, "zum Autoformat muss das Layout vorhanden sein" );
+ if( aFlags.bAFmtByInput && !pFrm->IsValid() )
+ {
+ SwRect aTmpFrm( pFrm->Frm() );
+ SwRect aTmpPrt( pFrm->Prt() );
+ pFrm->Calc();
+ if( pFrm->Frm() != aTmpFrm || pFrm->Prt() != aTmpPrt ||
+ ( pFrm->IsTxtFrm() && !((SwTxtFrm*)pFrm)->Paint().IsEmpty() ) )
+ pFrm->SetCompletePaint();
+ }
+ return ((SwTxtFrm*)pFrm)->GetFormatted();
+}
+
+void SwAutoFormat::_GetCharClass( LanguageType eLang )
+{
+ delete pCharClass;
+ pCharClass = new CharClass( SvxCreateLocale( eLang ));
+ eCharClassLang = eLang;
+}
+
+void SwAutoFormat::_SetRedlineTxt( sal_uInt16 nActionId )
+{
+ String sTxt;
+ sal_uInt16 nSeqNo = 0;
+ if( STR_AUTOFMTREDL_END > nActionId )
+ {
+ sTxt = *ViewShell::GetShellRes()->GetAutoFmtNameLst()[ nActionId ];
+ switch( nActionId )
+ {
+ case STR_AUTOFMTREDL_SET_NUMBULET:
+ case STR_AUTOFMTREDL_DEL_MORELINES:
+
+ // AutoCorrect-Actions
+ case STR_AUTOFMTREDL_USE_REPLACE:
+ case STR_AUTOFMTREDL_CPTL_STT_WORD:
+ case STR_AUTOFMTREDL_CPTL_STT_SENT:
+ case STR_AUTOFMTREDL_TYPO:
+ case STR_AUTOFMTREDL_UNDER:
+ case STR_AUTOFMTREDL_BOLD:
+ case STR_AUTOFMTREDL_FRACTION:
+ case STR_AUTOFMTREDL_DASH:
+ case STR_AUTOFMTREDL_ORDINAL:
+ case STR_AUTOFMTREDL_NON_BREAK_SPACE:
+ nSeqNo = ++nRedlAutoFmtSeqId;
+ break;
+ }
+ }
+#if OSL_DEBUG_LEVEL > 1
+ else
+ sTxt = String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "Action-Text fehlt" ));
+#endif
+
+ pDoc->SetAutoFmtRedlineComment( &sTxt, nSeqNo );
+}
+
+String SwAutoFormat::GoNextPara()
+{
+ SwNode* pNewNd = 0;
+ do {
+ //has to be checed twice before and after incrementation
+ if( aNdIdx.GetIndex() >= aEndNdIdx.GetIndex() )
+ {
+ bEnde = sal_True;
+ return aEmptyStr;
+ }
+
+ aNdIdx++;
+ if( aNdIdx.GetIndex() >= aEndNdIdx.GetIndex() )
+ {
+ bEnde = sal_True;
+ return aEmptyStr;
+ }
+ else
+ pNewNd = &aNdIdx.GetNode();
+
+ // kein TextNode ->
+ // TableNode : Tabelle ueberspringen
+ // NoTxtNode : Nodes ueberspringen
+ // EndNode : Ende erreicht, beenden
+ if( pNewNd->IsEndNode() )
+ {
+ bEnde = sal_True;
+ return aEmptyStr;
+ }
+ else if( pNewNd->IsTableNode() )
+ aNdIdx = *pNewNd->EndOfSectionNode();
+ else if( pNewNd->IsSectionNode() )
+ {
+ const SwSection& rSect = pNewNd->GetSectionNode()->GetSection();
+ if( rSect.IsHiddenFlag() || rSect.IsProtectFlag() )
+ aNdIdx = *pNewNd->EndOfSectionNode();
+ }
+ } while( !pNewNd->IsTxtNode() );
+
+ if( !aFlags.bAFmtByInput )
+ ::SetProgressState( aNdIdx.GetIndex() + nEndNdIdx - aEndNdIdx.GetIndex(),
+ pDoc->GetDocShell() );
+
+ pAktTxtNd = (SwTxtNode*)pNewNd;
+ pAktTxtFrm = GetFrm( *pAktTxtNd );
+ return pAktTxtNd->GetTxt();
+}
+
+sal_Bool SwAutoFormat::HasObjects( const SwNode& rNd )
+{
+ // haengt irgend etwas absatzgebundenes am Absatz?
+ // z.B. Rahmen, DrawObjecte, ..
+ sal_Bool bRet = sal_False;
+ const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
+ for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+ {
+ const SwFmtAnchor& rAnchor = rFmts[ n ]->GetAnchor();
+ if ((FLY_AT_PAGE != rAnchor.GetAnchorId()) &&
+ rAnchor.GetCntntAnchor() &&
+ &rAnchor.GetCntntAnchor()->nNode.GetNode() == &rNd )
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+ return bRet;
+}
+
+const SwTxtNode* SwAutoFormat::GetNextNode() const
+{
+ if( aNdIdx.GetIndex()+1 >= aEndNdIdx.GetIndex() )
+ return 0;
+ return pDoc->GetNodes()[ aNdIdx.GetIndex() + 1 ]->GetTxtNode();
+}
+
+
+sal_Bool SwAutoFormat::IsOneLine( const SwTxtNode& rNd ) const
+{
+ SwTxtFrmInfo aFInfo( GetFrm( rNd ) );
+ return aFInfo.IsOneLine();
+}
+
+
+sal_Bool SwAutoFormat::IsFastFullLine( const SwTxtNode& rNd ) const
+{
+ sal_Bool bRet = aFlags.bRightMargin;
+ if( bRet )
+ {
+ SwTxtFrmInfo aFInfo( GetFrm( rNd ) );
+ bRet = aFInfo.IsFilled( aFlags.nRightMargin );
+ }
+ return bRet;
+}
+
+
+sal_Bool SwAutoFormat::IsEnumericChar( const SwTxtNode& rNd ) const
+{
+ const String& rTxt = rNd.GetTxt();
+ String sTmp( rTxt );
+ xub_StrLen nBlnks = GetLeadingBlanks( sTmp );
+ xub_StrLen nLen = rTxt.Len() - nBlnks;
+ if( !nLen )
+ return sal_False;
+
+ // -, +, * getrennt durch Blank ??
+ if( 2 < nLen && IsSpace( rTxt.GetChar( nBlnks + 1 ) ) )
+ {
+ if( StrChr( pBulletChar, rTxt.GetChar( nBlnks ) ) )
+ return sal_True;
+ // sollte an der Position ein Symbolfont existieren ?
+ SwTxtFrmInfo aFInfo( GetFrm( rNd ) );
+ if( aFInfo.IsBullet( nBlnks ))
+ return sal_True;
+ }
+
+ // 1.) / 1. / 1.1.1 / (1). / (1) / ....
+ return USHRT_MAX != GetDigitLevel( rNd, nBlnks );
+}
+
+
+sal_Bool SwAutoFormat::IsBlanksInString( const SwTxtNode& rNd ) const
+{
+ // suche im String mehr als 5 Blanks/Tabs
+ String sTmp( rNd.GetTxt() );
+ DelTrailingBlanks( DelLeadingBlanks( sTmp ));
+ const sal_Unicode* pTmp = sTmp.GetBuffer();
+ while( *pTmp )
+ {
+ if( IsSpace( *pTmp ) )
+ {
+ if( IsSpace( *++pTmp )) // 2 Space nach einander
+ {
+ const sal_Unicode* pStt = pTmp;
+ while( *pTmp && IsSpace( *++pTmp ))
+ ;
+ if( 5 <= pTmp - pStt )
+ return sal_True;
+ }
+ else
+ ++pTmp;
+ }
+ else
+ ++pTmp;
+ }
+ return sal_False;
+}
+
+
+sal_uInt16 SwAutoFormat::CalcLevel( const SwTxtNode& rNd, sal_uInt16 *pDigitLvl ) const
+{
+ sal_uInt16 nLvl = 0, nBlnk = 0;
+ const String& rTxt = rNd.GetTxt();
+ if( pDigitLvl )
+ *pDigitLvl = USHRT_MAX;
+
+ if( RES_POOLCOLL_TEXT_MOVE == rNd.GetTxtColl()->GetPoolFmtId() )
+ {
+ if( aFlags.bAFmtByInput )
+ {
+ nLvl = rNd.GetAutoFmtLvl();
+ ((SwTxtNode&)rNd).SetAutoFmtLvl( 0 );
+ if( nLvl )
+ return nLvl;
+ }
+ ++nLvl;
+ }
+
+
+ for( xub_StrLen n = 0, nEnd = rTxt.Len(); n < nEnd; ++n )
+ {
+ switch( rTxt.GetChar( n ) )
+ {
+ case ' ': if( 3 == ++nBlnk )
+ ++nLvl, nBlnk = 0;
+ break;
+ case '\t': ++nLvl, nBlnk = 0;
+ break;
+ default:
+ if( pDigitLvl )
+ // Teste auf 1.) / 1. / 1.1.1 / (1). / (1) / ....
+ *pDigitLvl = GetDigitLevel( rNd, n );
+ return nLvl;
+ }
+ }
+ return nLvl;
+}
+
+
+
+xub_StrLen SwAutoFormat::GetBigIndent( xub_StrLen& rAktSpacePos ) const
+{
+ SwTxtFrmInfo aFInfo( GetFrm( *pAktTxtNd ) );
+ const SwTxtFrm* pNxtFrm = 0;
+
+ if( !bMoreLines )
+ {
+ const SwTxtNode* pNxtNd = GetNextNode();
+ if( !CanJoin( pNxtNd ) || !IsOneLine( *pNxtNd ) )
+ return 0;
+
+ pNxtFrm = GetFrm( *pNxtNd );
+ }
+
+ return aFInfo.GetBigIndent( rAktSpacePos, pNxtFrm );
+}
+
+
+sal_Bool SwAutoFormat::IsNoAlphaLine( const SwTxtNode& rNd ) const
+{
+ const String& rStr = rNd.GetTxt();
+ if( !rStr.Len() )
+ return sal_False;
+ // oder besser: ueber die Anzahl von Alpha/Num- und !AN-Zeichen
+ // bestimmen.
+ xub_StrLen nANChar = 0, nBlnk = 0;
+
+ CharClass& rCC = GetCharClass( rNd.GetSwAttrSet().GetLanguage().GetLanguage() );
+ for( xub_StrLen n = 0, nEnd = rStr.Len(); n < nEnd; ++n )
+ if( IsSpace( rStr.GetChar( n ) ) )
+ ++nBlnk;
+ else if( rCC.isLetterNumeric( rStr, n ))
+ ++nANChar;
+
+ // sind zu 75% keine Alpha-Nummerische-Zeichen, dann sal_True
+ sal_uLong nLen = rStr.Len() - nBlnk;
+ nLen = ( nLen * 3 ) / 4; // long overflow, if the strlen > sal_uInt16
+ return xub_StrLen(nLen) < (rStr.Len() - nANChar - nBlnk);
+}
+
+
+
+sal_Bool SwAutoFormat::DoUnderline()
+{
+ if( !aFlags.bSetBorder )
+ return sal_False;
+
+ const sal_Unicode* pStr = pAktTxtNd->GetTxt().GetBuffer();
+ int eState = 0;
+ xub_StrLen nCnt = 0;
+ while( *pStr )
+ {
+//JP 29.03.96: Spaces unterbrechen die Umrandung!
+// if( !IsSpace( *pStr ) )
+ {
+ int eTmp = 0;
+ switch( *pStr )
+ {
+ case '-': eTmp = 1; break;
+ case '_': eTmp = 2; break;
+ case '=': eTmp = 3; break;
+ case '*': eTmp = 4; break;
+ case '~': eTmp = 5; break;
+ case '#': eTmp = 6; break;
+ default:
+ return sal_False;
+ }
+ if( 0 == eState )
+ eState = eTmp;
+ else if( eState != eTmp )
+ return sal_False;
+ ++nCnt;
+ }
+ ++pStr;
+ }
+
+ if( 2 < nCnt )
+ {
+ // dann unterstreiche mal den vorherigen Absatz, wenn es diesen gibt!
+ DelEmptyLine( sal_False );
+ aDelPam.SetMark();
+ aDelPam.GetMark()->nContent = 0;
+//JP 19.03.96: kein Underline sondern eine Umrandung setzen!
+// pDoc->Insert( aDelPam, SvxUnderlineItem( eState ) );
+
+ SvxBorderLine aLine;
+ switch( eState )
+ {
+ case 1: // einfach, 0,05 pt
+ aLine.SetOutWidth( DEF_LINE_WIDTH_0 );
+ break;
+ case 2: // einfach, 1,0 pt
+ aLine.SetOutWidth( DEF_LINE_WIDTH_1 );
+ break;
+ case 3: // doppelt, 1,1 pt
+ aLine.SetOutWidth( DEF_DOUBLE_LINE0_OUT );
+ aLine.SetInWidth( DEF_DOUBLE_LINE0_IN );
+ aLine.SetDistance( DEF_DOUBLE_LINE0_DIST );
+ break;
+ case 4: // doppelt, 4,5 pt
+ aLine.SetOutWidth( DEF_DOUBLE_LINE4_OUT );
+ aLine.SetInWidth( DEF_DOUBLE_LINE4_IN );
+ aLine.SetDistance( DEF_DOUBLE_LINE4_DIST );
+ break;
+ case 5: // doppelt, 6,0 pt
+ aLine.SetOutWidth( DEF_DOUBLE_LINE5_OUT );
+ aLine.SetInWidth( DEF_DOUBLE_LINE5_IN );
+ aLine.SetDistance( DEF_DOUBLE_LINE5_DIST );
+ break;
+ case 6: // doppelt, 9,0 pt
+ aLine.SetOutWidth( DEF_DOUBLE_LINE6_OUT );
+ aLine.SetInWidth( DEF_DOUBLE_LINE6_IN );
+ aLine.SetDistance( DEF_DOUBLE_LINE6_DIST );
+ break;
+ }
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_PARATR_CONNECT_BORDER, RES_PARATR_CONNECT_BORDER,
+ RES_BOX, RES_BOX,
+ 0);
+ aSet.Put( SwParaConnectBorderItem( sal_False ) );
+ SvxBoxItem aBox( RES_BOX );
+ aBox.SetLine( &aLine, BOX_LINE_BOTTOM );
+ aBox.SetDistance( 42 ); // ~0,75 mm
+ aSet.Put(aBox);
+ pDoc->InsertItemSet( aDelPam, aSet, 0 );
+
+ aDelPam.DeleteMark();
+ }
+ return 2 < nCnt;
+}
+
+
+sal_Bool SwAutoFormat::DoTable()
+{
+ if( !aFlags.bCreateTable || !aFlags.bAFmtByInput ||
+ pAktTxtNd->FindTableNode() )
+ return sal_False;
+
+ const String& rTmp = pAktTxtNd->GetTxt();
+ xub_StrLen nSttPlus = GetLeadingBlanks( rTmp );
+ xub_StrLen nEndPlus = GetTrailingBlanks( rTmp );
+ sal_Unicode cChar;
+
+ if( 2 > nEndPlus - nSttPlus ||
+ ( '+' != ( cChar = rTmp.GetChar( nSttPlus )) && '|' != cChar ) ||
+ ( '+' != ( cChar = rTmp.GetChar( nEndPlus - 1)) && '|' != cChar ))
+ return sal_False;
+
+ SwTxtFrmInfo aInfo( pAktTxtFrm );
+
+ xub_StrLen n = nSttPlus;
+ const sal_Unicode* pStr = rTmp.GetBuffer() + n;
+ SvUShorts aPosArr( 5, 5 );
+
+ while( *pStr )
+ {
+ switch( *pStr )
+ {
+ case '-':
+ case '_':
+ case '=':
+ case ' ':
+ case '\t':
+ break;
+
+ case '+':
+ case '|':
+ aPosArr.Insert( static_cast<sal_uInt16>(aInfo.GetCharPos(n)), aPosArr.Count() );
+ break;
+
+ default:
+ return sal_False;
+ }
+ if( ++n == nEndPlus )
+ break;
+
+ ++pStr;
+ }
+
+ if( 1 < aPosArr.Count() )
+ {
+ // Ausrichtung vom Textnode besorgen:
+ sal_uInt16 nColCnt = aPosArr.Count() - 1;
+ SwTwips nSttPos = aPosArr[ 0 ];
+ sal_Int16 eHori;
+ switch( pAktTxtNd->GetSwAttrSet().GetAdjust().GetAdjust() )
+ {
+ case SVX_ADJUST_CENTER: eHori = text::HoriOrientation::CENTER; break;
+ case SVX_ADJUST_RIGHT: eHori = text::HoriOrientation::RIGHT; break;
+
+ default:
+ if( nSttPos )
+ {
+ eHori = text::HoriOrientation::NONE;
+ // dann muss als letztes noch die akt. FrameBreite
+ // ins Array
+ aPosArr.Insert( static_cast<sal_uInt16>(pAktTxtFrm->Frm().Width()), aPosArr.Count() );
+ }
+ else
+ eHori = text::HoriOrientation::LEFT;
+ break;
+ }
+
+ // dann erzeuge eine Tabelle, die den Zeichen entspricht
+ DelEmptyLine();
+ SwNodeIndex aIdx( aDelPam.GetPoint()->nNode );
+ aDelPam.Move( fnMoveForward );
+ pDoc->InsertTable( SwInsertTableOptions( tabopts::ALL_TBL_INS_ATTR , 1 ),
+ *aDelPam.GetPoint(), 1, nColCnt, eHori,
+ 0, &aPosArr );
+ aDelPam.GetPoint()->nNode = aIdx;
+ }
+ return 1 < aPosArr.Count();
+}
+
+
+String& SwAutoFormat::DelLeadingBlanks( String& rStr ) const
+{
+ xub_StrLen nL;
+ xub_StrLen n;
+
+ for( nL = rStr.Len(), n = 0; n < nL && IsSpace( rStr.GetChar(n) ); ++n )
+ ;
+ if( n ) // keine Spaces
+ rStr.Erase( 0, n );
+ return rStr;
+}
+
+
+String& SwAutoFormat::DelTrailingBlanks( String& rStr ) const
+{
+ xub_StrLen nL = rStr.Len(), n = nL;
+ if( !nL )
+ return rStr;
+
+ while( --n && IsSpace( rStr.GetChar( n ) ) )
+ ;
+ if( n+1 != nL ) // keine Spaces
+ rStr.Erase( n+1 );
+ return rStr;
+}
+
+
+xub_StrLen SwAutoFormat::GetLeadingBlanks( const String& rStr ) const
+{
+ xub_StrLen nL;
+ xub_StrLen n;
+
+ for( nL = rStr.Len(), n = 0; n < nL && IsSpace( rStr.GetChar( n ) ); ++n )
+ ;
+ return n;
+}
+
+
+xub_StrLen SwAutoFormat::GetTrailingBlanks( const String& rStr ) const
+{
+ xub_StrLen nL = rStr.Len(), n = nL;
+ if( !nL )
+ return 0;
+
+ while( --n && IsSpace( rStr.GetChar( n ) ) )
+ ;
+ return ++n;
+}
+
+
+sal_Bool SwAutoFormat::IsFirstCharCapital( const SwTxtNode& rNd ) const
+{
+ const String& rTxt = rNd.GetTxt();
+ for( xub_StrLen n = 0, nEnd = rTxt.Len(); n < nEnd; ++n )
+ if( !IsSpace( rTxt.GetChar( n ) ) )
+ {
+ CharClass& rCC = GetCharClass( rNd.GetSwAttrSet().
+ GetLanguage().GetLanguage() );
+ sal_Int32 nCharType = rCC.getCharacterType( rTxt, n );
+ return CharClass::isLetterType( nCharType ) &&
+ 0 != ( i18n::KCharacterType::UPPER &
+ nCharType );
+ }
+ return sal_False;
+}
+
+
+sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTxtNode& rNd, xub_StrLen& rPos,
+ String* pPreFix, String* pPostFix, String* pNumTypes ) const
+{
+ // Teste auf 1.) / 1. / 1.1.1 / (1). / (1) / ....
+ const String& rTxt = rNd.GetTxt();
+ xub_StrLen nPos = rPos;
+ int eScan = NONE;
+
+ sal_uInt16 nStart = 0;
+ sal_uInt8 nDigitLvl = 0, nDigitCnt = 0;
+ //count number of parenthesis to assure a sensible order is found
+ sal_uInt16 nOpeningParentheses = 0;
+ sal_uInt16 nClosingParentheses = 0;
+
+ CharClass& rCC = GetCharClass( rNd.GetSwAttrSet().GetLanguage().GetLanguage() );
+
+ while( nPos < rTxt.Len() && nDigitLvl < MAXLEVEL - 1)
+ {
+ const sal_Unicode cCurrentChar = rTxt.GetChar( nPos );
+ if( ('0' <= cCurrentChar && '9' >= cCurrentChar) ||
+ (0xff10 <= cCurrentChar && 0xff19 >= cCurrentChar) )
+ {
+ if( eScan & DELIM )
+ {
+ if( eScan & CHG ) // nicht wenns mit einer Zahl beginnt
+ {
+ ++nDigitLvl;
+ if( pPostFix )
+ *pPostFix += (sal_Unicode)1;
+ }
+
+ if( pNumTypes )
+ *pNumTypes += (sal_Unicode)('0' + SVX_NUM_ARABIC);
+
+ eScan = eScan | CHG;
+ }
+ else if( pNumTypes && !(eScan & DIGIT) )
+ *pNumTypes += (sal_Unicode)('0' + SVX_NUM_ARABIC);
+
+ eScan &= ~DELIM; // Delim raus
+ if( 0 != (eScan & ~CHG) && DIGIT != (eScan & ~CHG))
+ return USHRT_MAX;
+
+ eScan |= DIGIT; // Digit rein
+ if( 3 == ++nDigitCnt ) // mehr als 2 Nummern sind kein Enum mehr
+ return USHRT_MAX;
+
+ nStart *= 10;
+ nStart += cCurrentChar <= '9' ? cCurrentChar - '0' : cCurrentChar - 0xff10;
+ }
+ else if( rCC.isAlpha( rTxt, nPos ) )
+ {
+ sal_Bool bIsUpper =
+ 0 != ( i18n::KCharacterType::UPPER &
+ rCC.getCharacterType( rTxt, nPos ));
+ sal_Unicode cLow = rCC.toLower( rTxt, nPos, 1 ).GetChar(0), cNumTyp;
+ int eTmpScan;
+
+ // roemische Zeichen sind "mdclxvi". Da man aber eher mal eine
+ // Numerierung mit c oder d anfangen will, werden diese erstmal
+ // zu chars und spaeter ggfs. zu romischen Zeichen!
+// if( strchr( "mdclxvi", cLow ))
+#ifdef WITH_ALPHANUM_AS_NUMFMT
+ //detection of 'c' and 'd' a ROMAN numbering should not be done here
+ if( 256 > cLow &&( (eScan & (LOWER_ROMAN|UPPER_ROMAN))
+ ? strchr( "mdclxvi", cLow )
+ : strchr( "mlxvi", cLow ) ))
+#else
+ if( 256 > cLow && ( strchr( "mdclxvi", cLow ) ))
+#endif
+ {
+ if( bIsUpper )
+ cNumTyp = '0' + SVX_NUM_ROMAN_UPPER, eTmpScan = UPPER_ROMAN;
+ else
+ cNumTyp = '0' + SVX_NUM_ROMAN_LOWER, eTmpScan = LOWER_ROMAN;
+ }
+ else if( bIsUpper )
+ cNumTyp = '0' + SVX_NUM_CHARS_UPPER_LETTER, eTmpScan = UPPER_ALPHA;
+ else
+ cNumTyp = '0' + SVX_NUM_CHARS_LOWER_LETTER, eTmpScan = LOWER_ALPHA;
+
+
+ //ggfs. auf roemische Zeichen umschalten (nur bei c/d!)?
+ if( 1 == nDigitCnt && ( eScan & (UPPER_ALPHA|LOWER_ALPHA) ) &&
+ ( 3 == nStart || 4 == nStart) && 256 > cLow &&
+ strchr( "mdclxvi", cLow ) &&
+ (( eScan & UPPER_ALPHA ) ? (eTmpScan & (UPPER_ALPHA|UPPER_ROMAN))
+ : (eTmpScan & (LOWER_ALPHA|LOWER_ROMAN))) )
+ {
+ sal_Unicode c = '0';
+ nStart = 3 == nStart ? 100 : 500;
+ if( UPPER_ALPHA == eTmpScan )
+ eTmpScan = UPPER_ROMAN, c += SVX_NUM_ROMAN_UPPER;
+ else
+ eTmpScan = LOWER_ROMAN, c += SVX_NUM_ROMAN_LOWER;
+
+ ( eScan &= ~(UPPER_ALPHA|LOWER_ALPHA)) |= eTmpScan;
+ if( pNumTypes )
+ pNumTypes->SetChar( pNumTypes->Len() - 1, c );
+ }
+
+ if( eScan & DELIM )
+ {
+ if( eScan & CHG ) // nicht wenns mit einer Zahl beginnt
+ {
+ ++nDigitLvl;
+ if( pPostFix )
+ *pPostFix += (sal_Unicode)1;
+ }
+
+ if( pNumTypes )
+ *pNumTypes += cNumTyp;
+ eScan = eScan | CHG;
+ }
+ else if( pNumTypes && !(eScan & eTmpScan) )
+ *pNumTypes += cNumTyp;
+
+ eScan &= ~DELIM; // Delim raus
+
+ // falls ein andere Type gesetzt ist, brechen wir ab
+ if( 0 != ( eScan & ~CHG ) && eTmpScan != ( eScan & ~CHG ))
+ return USHRT_MAX;
+
+ if( eTmpScan & (UPPER_ALPHA | LOWER_ALPHA) )
+ {
+ // Buchstaben nur zulassen, wenn sie einmalig vorkommen
+ return USHRT_MAX;
+ }
+ else
+ {
+ // roemische Zahlen: checke ob das gueltige Zeichen sind
+ sal_uInt16 nVal;
+ sal_Bool bError = sal_False;
+ switch( cLow )
+ {
+ case 'm': nVal = 1000; goto CHECK_ROMAN_1;
+ case 'd': nVal = 500; goto CHECK_ROMAN_5;
+ case 'c': nVal = 100; goto CHECK_ROMAN_1;
+ case 'l': nVal = 50; goto CHECK_ROMAN_5;
+ case 'x': nVal = 10; goto CHECK_ROMAN_1;
+ case 'v': nVal = 5; goto CHECK_ROMAN_5;
+
+CHECK_ROMAN_1:
+ {
+ int nMod5 = nStart % (nVal * 5);
+ int nLast = nStart % nVal;
+ int n10 = nVal / 10;
+
+ if( nMod5 == ((3 * nVal) + n10 ) ||
+ nMod5 == ((4 * nVal) + n10 ) ||
+ nLast == n10 )
+ nStart = static_cast<sal_uInt16>(nStart + (n10 * 8));
+ else if( nMod5 == 0 ||
+ nMod5 == (1 * nVal) ||
+ nMod5 == (2 * nVal) )
+ nStart = nStart + nVal;
+ else
+ bError = sal_True;
+ }
+ break;
+
+CHECK_ROMAN_5:
+ {
+ if( ( nStart / nVal ) & 1 )
+ bError = sal_True;
+ else
+ {
+ int nMod = nStart % nVal;
+ int n10 = nVal / 5;
+ if( n10 == nMod )
+ nStart = static_cast<sal_uInt16>(nStart + (3 * n10));
+ else if( 0 == nMod )
+ nStart = nStart + nVal;
+ else
+ bError = sal_True;
+ }
+ }
+ break;
+
+ case 'i':
+ if( nStart % 5 >= 3 )
+ bError = sal_True;
+ else
+ nStart += 1;
+ break;
+
+ default:
+ bError = sal_True;
+ }
+
+ if( bError )
+ return USHRT_MAX;
+ }
+ eScan |= eTmpScan; // Digit rein
+ ++nDigitCnt;
+ }
+ else if( (256 > cCurrentChar &&
+ strchr( ".)(", cCurrentChar )) ||
+ 0x3002 == cCurrentChar /* Chinese trad. dot */||
+ 0xff0e == cCurrentChar /* Japanese dot */||
+ 0xFF08 == cCurrentChar /* opening bracket Chin./Jap.*/||
+ 0xFF09 == cCurrentChar )/* closing bracket Chin./Jap. */
+ {
+ if(cCurrentChar == '(' || cCurrentChar == 0xFF09)
+ nOpeningParentheses++;
+ else if(cCurrentChar == ')'|| cCurrentChar == 0xFF08)
+ nClosingParentheses++;
+ // nur wenn noch keine Zahlen gelesen wurden!
+ if( pPreFix && !( eScan & ( NO_DELIM | CHG )) )
+ *pPreFix += rTxt.GetChar( nPos );
+ else if( pPostFix )
+ *pPostFix += rTxt.GetChar( nPos );
+
+ if( NO_DELIM & eScan )
+ {
+ eScan |= CHG;
+ if( pPreFix )
+ (*pPreFix += (sal_Unicode)1)
+ += String::CreateFromInt32( nStart );
+ }
+ eScan &= ~NO_DELIM; // Delim raus
+ eScan |= DELIM; // Digit rein
+ nDigitCnt = 0;
+ nStart = 0;
+ }
+ else
+ break;
+ ++nPos;
+ }
+ if( !( CHG & eScan ) || rPos == nPos ||
+ nPos == rTxt.Len() || !IsSpace( rTxt.GetChar( nPos ) ) ||
+ (nOpeningParentheses > nClosingParentheses))
+ return USHRT_MAX;
+
+ if( (NO_DELIM & eScan) && pPreFix ) // den letzen nicht vergessen
+ (*pPreFix += (sal_Unicode)1) += String::CreateFromInt32( nStart );
+
+ rPos = nPos;
+ return nDigitLvl; // 0 .. 9 (MAXLEVEL - 1)
+}
+
+
+void SwAutoFormat::SetColl( sal_uInt16 nId, sal_Bool bHdLineOrText )
+{
+ aDelPam.DeleteMark();
+ aDelPam.GetPoint()->nNode = aNdIdx;
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 );
+
+ // behalte harte Tabs, Ausrichtung, Sprache, Silbentrennung,
+ // DropCaps und fast alle Frame-Attribute
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_PARATR_ADJUST, RES_PARATR_ADJUST,
+ RES_PARATR_TABSTOP, RES_PARATR_DROP,
+ RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
+ RES_BACKGROUND, RES_SHADOW,
+ 0 );
+
+ if( pAktTxtNd->HasSwAttrSet() )
+ {
+ aSet.Put( *pAktTxtNd->GetpSwAttrSet() );
+ // einige Sonderbedingungen:
+ // HeaderLine/Textkoerper: nur zentriert oder rechts mitnehmem
+ // sonst nur den Blocksatz
+ SvxAdjustItem* pAdj;
+ if( SFX_ITEM_SET == aSet.GetItemState( RES_PARATR_ADJUST,
+ sal_False, (const SfxPoolItem**)&pAdj ))
+ {
+ SvxAdjust eAdj = pAdj->GetAdjust();
+ if( bHdLineOrText ? (SVX_ADJUST_RIGHT != eAdj &&
+ SVX_ADJUST_CENTER != eAdj)
+ : SVX_ADJUST_BLOCK != eAdj )
+ aSet.ClearItem( RES_PARATR_ADJUST );
+ }
+ }
+
+ pDoc->SetTxtFmtCollByAutoFmt( *aDelPam.GetPoint(), nId, &aSet );
+}
+
+
+sal_Bool SwAutoFormat::HasSelBlanks( SwPaM& rPam ) const
+{
+ // noch ein Blank am Anfang oder Ende ?
+ // nicht loeschen, wird wieder eingefuegt.
+ SwPosition * pPos = rPam.End();
+ xub_StrLen nBlnkPos = pPos->nContent.GetIndex();
+ SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+ if( nBlnkPos && nBlnkPos-- < pTxtNd->GetTxt().Len() &&
+ ( ' ' == pTxtNd->GetTxt().GetChar( nBlnkPos ) ))
+// JP 23.08.95: keine Tabs stehen lassen, diese in Blanks wandeln
+// ( ' ' == ( cCh = pTxtNd->GetTxt()[ nBlnkPos ] ) || '\t' == cCh ))
+ pPos->nContent--;
+ else
+ {
+ pPos = rPam.GetPoint() == pPos ? rPam.GetMark() : rPam.GetPoint();
+ nBlnkPos = pPos->nContent.GetIndex();
+ pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+ if( nBlnkPos < pTxtNd->GetTxt().Len() &&
+ ( ' ' == pTxtNd->GetTxt().GetChar( nBlnkPos )))
+// JP 23.08.95: keine Tabs stehen lassen, diese in Blanks wandeln
+// ( ' ' == ( cCh = pTxtNd->GetTxt()[ nBlnkPos ] ) || '\t' == cCh ))
+ pPos->nContent++;
+ else
+ return sal_False;
+ }
+ return sal_True;
+}
+
+
+sal_Bool SwAutoFormat::HasBreakAttr( const SwTxtNode& rTxtNd ) const
+{
+ const SfxItemSet* pSet = rTxtNd.GetpSwAttrSet();
+ if( !pSet )
+ return sal_False;
+
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False, &pItem )
+ && SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak() )
+ return sal_True;
+
+ if( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, sal_False, &pItem )
+ && ((SwFmtPageDesc*)pItem)->GetPageDesc()
+ && nsUseOnPage::PD_NONE != ((SwFmtPageDesc*)pItem)->GetPageDesc()->GetUseOn() )
+ return sal_True;
+ return sal_False;
+}
+
+
+// ist ein Punkt am Ende ??
+sal_Bool SwAutoFormat::IsSentenceAtEnd( const SwTxtNode& rTxtNd ) const
+{
+ const String& rStr = rTxtNd.GetTxt();
+ xub_StrLen n = rStr.Len();
+ if( !n )
+ return sal_True;
+
+ while( --n && IsSpace( rStr.GetChar( n ) ) )
+ ;
+ return '.' == rStr.GetChar( n );
+}
+
+
+// loesche im Node Anfang oder/und Ende
+void SwAutoFormat::DeleteAktPara( sal_Bool bStart, sal_Bool bEnd )
+{
+ if( aFlags.bAFmtByInput
+ ? aFlags.bAFmtByInpDelSpacesAtSttEnd
+ : aFlags.bAFmtDelSpacesAtSttEnd )
+ {
+ // Loesche Blanks am Ende vom akt. und am Anfang vom naechsten
+ aDelPam.DeleteMark();
+ aDelPam.GetPoint()->nNode = aNdIdx;
+ xub_StrLen nPos;
+ if( bStart && 0 != ( nPos = GetLeadingBlanks( pAktTxtNd->GetTxt() )))
+ {
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 );
+ aDelPam.SetMark();
+ aDelPam.GetPoint()->nContent = nPos;
+ DeleteSel( aDelPam );
+ aDelPam.DeleteMark();
+ }
+ if( bEnd && pAktTxtNd->GetTxt().Len() !=
+ ( nPos = GetTrailingBlanks( pAktTxtNd->GetTxt() )) )
+ {
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, pAktTxtNd->GetTxt().Len() );
+ aDelPam.SetMark();
+ aDelPam.GetPoint()->nContent = nPos;
+ DeleteSel( aDelPam );
+ aDelPam.DeleteMark();
+ }
+ }
+}
+
+void SwAutoFormat::DeleteSel( SwPaM& rDelPam )
+{
+ if( aFlags.bWithRedlining )
+ {
+ // damit der DelPam auch verschoben wird, in den Shell-Cursr-Ring
+ // mit aufnehmen !!
+ SwPaM* pShCrsr = pEditShell->_GetCrsr();
+ SwPaM aTmp( *pAktTxtNd, 0, pShCrsr );
+
+ Ring *pPrev = rDelPam.GetPrev();
+ rDelPam.MoveRingTo( pShCrsr );
+
+ pEditShell->DeleteSel( rDelPam );
+
+ // und den Pam wieder herausnehmen:
+ Ring *p, *pNext = (Ring*)&rDelPam;
+ do {
+ p = pNext;
+ pNext = p->GetNext();
+ p->MoveTo( &rDelPam );
+ } while( p != pPrev );
+
+ aNdIdx = aTmp.GetPoint()->nNode;
+ pAktTxtNd = aNdIdx.GetNode().GetTxtNode();
+ }
+ else
+ pEditShell->DeleteSel( rDelPam );
+}
+
+sal_Bool SwAutoFormat::DeleteAktNxtPara( const String& rNxtPara )
+{
+ // Loesche Blanks am Ende vom akt. und am Anfang vom naechsten
+ aDelPam.DeleteMark();
+ aDelPam.GetPoint()->nNode = aNdIdx;
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd,
+ GetTrailingBlanks( pAktTxtNd->GetTxt() ) );
+ aDelPam.SetMark();
+
+ aDelPam.GetPoint()->nNode++;
+ SwTxtNode* pTNd = aDelPam.GetNode()->GetTxtNode();
+ if( !pTNd )
+ {
+ // dann nur bis zum Ende von Absatz loeschen
+ aDelPam.GetPoint()->nNode--;
+ aDelPam.GetPoint()->nContent = pAktTxtNd->GetTxt().Len();
+ }
+ else
+ aDelPam.GetPoint()->nContent.Assign( pTNd,
+ GetLeadingBlanks( rNxtPara ));
+
+ // noch ein Blank am Anfang oder Ende ?
+ // nicht loeschen, wird wieder eingefuegt.
+ sal_Bool bHasBlnks = HasSelBlanks( aDelPam );
+
+ if( *aDelPam.GetPoint() != *aDelPam.GetMark() )
+ DeleteSel( aDelPam );
+ aDelPam.DeleteMark();
+
+ return !bHasBlnks;
+}
+
+
+void SwAutoFormat::DelEmptyLine( sal_Bool bTstNextPara )
+{
+ SetRedlineTxt( STR_AUTOFMTREDL_DEL_EMPTY_PARA );
+ // Loesche Blanks den leeren Absatz
+ aDelPam.DeleteMark();
+ aDelPam.GetPoint()->nNode = aNdIdx;
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, pAktTxtNd->GetTxt().Len() );
+ aDelPam.SetMark();
+
+ aDelPam.GetMark()->nNode--;
+ SwTxtNode* pTNd = aDelPam.GetNode( sal_False )->GetTxtNode();
+ if( pTNd )
+ // erstmal den vorherigen Textnode benutzen.
+ aDelPam.GetMark()->nContent.Assign( pTNd, pTNd->GetTxt().Len() );
+ else if( bTstNextPara )
+ {
+ // dann versuche den naechsten (am Anfang vom Dok, Tabellen-Zellen,
+ // Rahmen, ...
+ aDelPam.GetMark()->nNode += 2;
+ pTNd = aDelPam.GetNode( sal_False )->GetTxtNode();
+ if( pTNd )
+ {
+ aDelPam.GetMark()->nContent.Assign( pTNd, 0 );
+ aDelPam.GetPoint()->nContent = 0;
+ }
+ }
+ else
+ {
+ aDelPam.GetMark()->nNode = aNdIdx;
+ aDelPam.GetMark()->nContent = 0;
+ pTNd = pAktTxtNd;
+ }
+ if( pTNd )
+ DeleteSel( aDelPam );
+
+ aDelPam.DeleteMark();
+ ClearRedlineTxt();
+}
+
+
+void SwAutoFormat::DelMoreLinesBlanks( sal_Bool bWithLineBreaks )
+{
+ if( aFlags.bAFmtByInput
+ ? aFlags.bAFmtByInpDelSpacesBetweenLines
+ : aFlags.bAFmtDelSpacesBetweenLines )
+ {
+ // loesche alle "Blanks" Links und Rechts vom Einzug
+ aDelPam.DeleteMark();
+ aDelPam.GetPoint()->nNode = aNdIdx;
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 );
+
+ SwTxtFrmInfo aFInfo( pAktTxtFrm );
+ aFInfo.GetSpaces( aDelPam, !aFlags.bAFmtByInput || bWithLineBreaks );
+
+ SwPaM* pNxt;
+ do {
+ pNxt = (SwPaM*)aDelPam.GetNext();
+ if( pNxt->HasMark() && *pNxt->GetPoint() != *pNxt->GetMark() )
+ {
+ sal_Bool bHasBlnks = HasSelBlanks( *pNxt );
+ DeleteSel( *pNxt );
+ if( !bHasBlnks )
+ {
+ pDoc->InsertString( *pNxt, sal_Unicode(' ') );
+ }
+ }
+
+ if( pNxt == &aDelPam )
+ break;
+ delete pNxt;
+ } while( sal_True );
+
+ aDelPam.DeleteMark();
+ }
+}
+
+
+ // loesche den vorherigen Absatz
+void SwAutoFormat::DelPrevPara()
+{
+ aDelPam.DeleteMark();
+ aDelPam.GetPoint()->nNode = aNdIdx;
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 );
+ aDelPam.SetMark();
+
+ aDelPam.GetPoint()->nNode--;
+ SwTxtNode* pTNd = aDelPam.GetNode()->GetTxtNode();
+ if( pTNd )
+ {
+ // erstmal den vorherigen Textnode benutzen.
+ aDelPam.GetPoint()->nContent.Assign( pTNd, pTNd->GetTxt().Len() );
+ DeleteSel( aDelPam );
+ }
+ aDelPam.DeleteMark();
+}
+
+
+void SwAutoFormat::BuildIndent()
+{
+ SetRedlineTxt( STR_AUTOFMTREDL_SET_TMPL_INDENT );
+
+ // lese alle nachfolgenden Absaetze die zu diesem Einzug gehoeren
+ sal_Bool bBreak = sal_True;
+ if( bMoreLines )
+ DelMoreLinesBlanks( sal_True );
+ else
+ bBreak = !IsFastFullLine( *pAktTxtNd ) ||
+ IsBlanksInString( *pAktTxtNd ) ||
+ IsSentenceAtEnd( *pAktTxtNd );
+ SetColl( RES_POOLCOLL_TEXT_IDENT );
+ if( !bBreak )
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_DEL_MORELINES );
+ const SwTxtNode* pNxtNd = GetNextNode();
+ if( pNxtNd && !bEnde )
+ {
+ do {
+ bBreak = !IsFastFullLine( *pNxtNd ) ||
+ IsBlanksInString( *pNxtNd ) ||
+ IsSentenceAtEnd( *pNxtNd );
+ if( DeleteAktNxtPara( pNxtNd->GetTxt() ))
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode(' ') );
+ }
+ if( bBreak )
+ break;
+ pNxtNd = GetNextNode();
+ } while( CanJoin( pNxtNd ) &&
+ !CalcLevel( *pNxtNd ) );
+ }
+ }
+ DeleteAktPara( sal_True, sal_True );
+ AutoCorrect();
+}
+
+
+void SwAutoFormat::BuildTextIndent()
+{
+ SetRedlineTxt( STR_AUTOFMTREDL_SET_TMPL_TEXT_INDENT);
+ // lese alle nachfolgenden Absaetze die zu diesem Einzug gehoeren
+ sal_Bool bBreak = sal_True;
+ if( bMoreLines )
+ DelMoreLinesBlanks( sal_True );
+ else
+ bBreak = !IsFastFullLine( *pAktTxtNd ) ||
+ IsBlanksInString( *pAktTxtNd ) ||
+ IsSentenceAtEnd( *pAktTxtNd );
+
+ if( aFlags.bAFmtByInput )
+ pAktTxtNd->SetAutoFmtLvl( (sal_uInt8)CalcLevel( *pAktTxtNd ) );
+
+ SetColl( RES_POOLCOLL_TEXT_MOVE );
+ if( !bBreak )
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_DEL_MORELINES );
+ const SwTxtNode* pNxtNd = GetNextNode();
+ while( CanJoin( pNxtNd ) &&
+ CalcLevel( *pNxtNd ) )
+ {
+ bBreak = !IsFastFullLine( *pNxtNd ) || IsBlanksInString( *pNxtNd ) ||
+ IsSentenceAtEnd( *pNxtNd );
+ if( DeleteAktNxtPara( pNxtNd->GetTxt() ) )
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode(' ') );
+ }
+ if( bBreak )
+ break;
+ pNxtNd = GetNextNode();
+ }
+ }
+ DeleteAktPara( sal_True, sal_True );
+ AutoCorrect();
+}
+
+
+void SwAutoFormat::BuildText()
+{
+ SetRedlineTxt( STR_AUTOFMTREDL_SET_TMPL_TEXT );
+ // lese alle nachfolgenden Absaetze die zu diesem Text
+ // ohne Einzug gehoeren
+ sal_Bool bBreak = sal_True;
+ if( bMoreLines )
+ DelMoreLinesBlanks();
+ else
+ bBreak = !IsFastFullLine( *pAktTxtNd ) ||
+ IsBlanksInString( *pAktTxtNd ) ||
+ IsSentenceAtEnd( *pAktTxtNd );
+ SetColl( RES_POOLCOLL_TEXT, sal_True );
+ if( !bBreak )
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_DEL_MORELINES );
+ const SwTxtNode* pNxtNd = GetNextNode();
+ while( CanJoin( pNxtNd ) &&
+ !CalcLevel( *pNxtNd ) )
+ {
+ bBreak = !IsFastFullLine( *pNxtNd ) || IsBlanksInString( *pNxtNd ) ||
+ IsSentenceAtEnd( *pNxtNd );
+ if( DeleteAktNxtPara( pNxtNd->GetTxt() ) )
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode(' ') );
+ }
+ if( bBreak )
+ break;
+ const SwTxtNode* pCurrNode = pNxtNd;
+ pNxtNd = GetNextNode();
+ if(!pNxtNd || pCurrNode == pNxtNd)
+ break;
+ }
+ }
+ DeleteAktPara( sal_True, sal_True );
+ AutoCorrect();
+}
+
+
+void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
+{
+ SetRedlineTxt( STR_AUTOFMTREDL_SET_NUMBULET );
+
+ sal_Bool bBreak = sal_True;
+
+ // als erstes den akt. Einzug bestimmen und die Framebreite bestimmen
+ SwTwips nFrmWidth = pAktTxtFrm->Prt().Width();;
+ SwTwips nLeftTxtPos;
+ {
+ const sal_Unicode* pTxt = pAktTxtNd->GetTxt().GetBuffer(), *pSav = pTxt;
+ while( IsSpace( *pTxt ) )
+ ++pTxt;
+
+ SwTxtFrmInfo aInfo( pAktTxtFrm );
+ nLeftTxtPos = aInfo.GetCharPos( static_cast<xub_StrLen>(pTxt - pSav) );
+ nLeftTxtPos -= pAktTxtNd->GetSwAttrSet().GetLRSpace().GetLeft();
+ }
+
+ if( bMoreLines )
+ DelMoreLinesBlanks();
+ else
+ bBreak = !IsFastFullLine( *pAktTxtNd ) ||
+ IsBlanksInString( *pAktTxtNd ) ||
+ IsSentenceAtEnd( *pAktTxtNd );
+ sal_Bool bRTL = pEditShell->IsInRightToLeftText();
+// SetColl( RES_POOLCOLL_NUM_LEVEL1 + ( nLvl * 4 ) );
+ DeleteAktPara( sal_True, sal_True );
+
+ sal_Bool bChgBullet = sal_False, bChgEnum = sal_False;
+ xub_StrLen nAutoCorrPos = 0;
+
+ // falls die Numerierung gesetzt werden, die akt. besorgen
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule aRule( pDoc->GetUniqueNumRuleName(),
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ // <--
+ // <--
+ const SwNumRule* pCur = 0;
+ if( aFlags.bSetNumRule && 0 != (pCur = pAktTxtNd->GetNumRule()) )
+ aRule = *pCur;
+
+ // ersetze das Bullet-Zeichen mit dem definiertem
+ const String& rStr = pAktTxtNd->GetTxt();
+ xub_StrLen nTxtStt = 0, nOrigTxtStt = 0;
+ const sal_Unicode* pFndBulletChr;
+// if( aFlags.bAFmtByInput ? aFlags.bSetNumRule : aFlags.bChgEnumNum &&
+ if( aFlags.bChgEnumNum &&
+ 2 < rStr.Len() &&
+ 0 != ( pFndBulletChr = StrChr( pBulletChar, rStr.GetChar( nTxtStt ) ))
+ && IsSpace( rStr.GetChar( nTxtStt + 1 ) ) )
+ {
+ if( aFlags.bAFmtByInput )
+ {
+ if( aFlags.bSetNumRule )
+ {
+ SwCharFmt* pCFmt = pDoc->GetCharFmtFromPool(
+ RES_POOLCHR_BUL_LEVEL );
+ bChgBullet = sal_True;
+ // wurde das Format schon mal angepasst?
+ if( !aRule.GetNumFmt( nLvl ) )
+ {
+ int nBulletPos = pFndBulletChr - pBulletChar;
+ sal_Unicode cBullChar;
+ const Font* pBullFnt( 0 );
+ if( nBulletPos < cnPosEnDash )
+ {
+ cBullChar = aFlags.cBullet;
+ pBullFnt = &aFlags.aBulletFont;
+ }
+ else
+ {
+ cBullChar = nBulletPos < cnPosEmDash
+ ? cStarSymbolEnDash
+ : cStarSymbolEmDash;
+ // --> OD 2008-06-03 #i63395#
+ // Only apply user defined default bullet font
+ if ( numfunc::IsDefBulletFontUserDefined() )
+ {
+ pBullFnt = &numfunc::GetDefBulletFont();
+ }
+ // <--
+ }
+
+ sal_uInt16 nAbsPos = lBullIndent;
+ sal_uInt16 nSpaceSteps = nLvl
+ ? sal_uInt16(nLeftTxtPos / nLvl)
+ : lBullIndent;
+ for( sal_uInt8 n = 0; n < MAXLEVEL; ++n, nAbsPos = nAbsPos + nSpaceSteps )
+ {
+ SwNumFmt aFmt( aRule.Get( n ) );
+ aFmt.SetBulletFont( pBullFnt );
+ aFmt.SetBulletChar( cBullChar );
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ // #i93908# clear suffix for bullet lists
+ aFmt.SetPrefix(::rtl::OUString());
+ aFmt.SetSuffix(::rtl::OUString());
+ aFmt.SetFirstLineOffset( lBullFirstLineOffset );
+ aFmt.SetAbsLSpace( nAbsPos );
+ if( !aFmt.GetCharFmt() )
+ aFmt.SetCharFmt( pCFmt );
+ if( bRTL )
+ aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
+
+ aRule.Set( n, aFmt );
+
+ if( n == nLvl &&
+ nFrmWidth < ( nSpaceSteps * MAXLEVEL ) )
+ nSpaceSteps = static_cast<sal_uInt16>(( nFrmWidth - nLeftTxtPos ) /
+ ( MAXLEVEL - nLvl ));
+ }
+ }
+ }
+ }
+ else
+ {
+ bChgBullet = sal_True;
+ SetColl( static_cast<sal_uInt16>(RES_POOLCOLL_BUL_LEVEL1 + ( Min( nLvl, cnNumBullColls ) * 4 )) );
+ }
+ }
+ else
+ {
+ // dann ist das eine Nummerierung
+
+ //JP 21.11.97: Der NumLevel wird entweder der DigitLevel oder
+ // wenn der nicht vorhanden oder 0 ist, durch den
+ // (Einrueckungs-)Level.
+
+ String aPostFix, aPreFix, aNumTypes;
+ if( USHRT_MAX != ( nDigitLevel = GetDigitLevel( *pAktTxtNd, nTxtStt,
+ &aPreFix, &aPostFix, &aNumTypes )) )
+ {
+ bChgEnum = sal_True;
+
+ // Ebene 0 und Einrueckung dann wird die Ebene durch den linken
+ // Einzug und der default NumEinrueckung bestimmt.
+ if( !nDigitLevel && nLeftTxtPos )
+ nLvl = Min( sal_uInt16( nLeftTxtPos / lNumIndent ),
+ sal_uInt16( MAXLEVEL - 1 ) );
+ else
+ nLvl = nDigitLevel;
+ }
+
+ if( bChgEnum && aFlags.bSetNumRule )
+ {
+ if( !pCur ) // NumRule anpassen, wenn sie neu ist
+ {
+ SwCharFmt* pCFmt = pDoc->GetCharFmtFromPool(
+ RES_POOLCHR_NUM_LEVEL );
+ if( !nDigitLevel )
+ {
+ SwNumFmt aFmt( aRule.Get( nLvl ) );
+ aFmt.SetStart( static_cast<sal_uInt16>(aPreFix.GetToken( 1,
+ (sal_Unicode)1 ).ToInt32()));
+ aFmt.SetPrefix( aPreFix.GetToken( 0, (sal_Unicode)1 ));
+ aFmt.SetSuffix( aPostFix.GetToken( 0, (sal_Unicode)1 ));
+ aFmt.SetIncludeUpperLevels( 0 );
+
+ if( !aFmt.GetCharFmt() )
+ aFmt.SetCharFmt( pCFmt );
+
+ if( aNumTypes.Len() )
+ aFmt.SetNumberingType(aNumTypes.GetChar( 0 ) - '0');
+
+ if( bRTL )
+ aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
+ aRule.Set( nLvl, aFmt );
+ }
+ else
+ {
+ sal_uInt16 nSpaceSteps = nLvl ? sal_uInt16(nLeftTxtPos / nLvl) : 0;
+ sal_uInt8 n;
+ for( n = 0; n <= nLvl; ++n )
+ {
+ SwNumFmt aFmt( aRule.Get( n ) );
+
+ aFmt.SetStart( static_cast<sal_uInt16>(aPreFix.GetToken( n+1,
+ (sal_Unicode)1 ).ToInt32() ));
+ if( !n )
+ aFmt.SetPrefix( aPreFix.GetToken( n, (sal_Unicode)1 ));
+ aFmt.SetSuffix( aPostFix.GetToken( n, (sal_Unicode)1 ));
+ aFmt.SetIncludeUpperLevels( MAXLEVEL );
+ if( n < aNumTypes.Len() )
+ aFmt.SetNumberingType((aNumTypes.GetChar( n ) - '0'));
+
+ aFmt.SetAbsLSpace( sal_uInt16( nSpaceSteps * n )
+ + lNumIndent );
+
+ if( !aFmt.GetCharFmt() )
+ aFmt.SetCharFmt( pCFmt );
+ if( bRTL )
+ aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
+
+ aRule.Set( n, aFmt );
+ }
+
+ // passt alles vollstaendig in den Frame?
+ sal_Bool bDefStep = nFrmWidth < (nSpaceSteps * MAXLEVEL);
+ for( ; n < MAXLEVEL; ++n )
+ {
+ SwNumFmt aFmt( aRule.Get( n ) );
+ aFmt.SetIncludeUpperLevels( MAXLEVEL );
+ if( bDefStep )
+ aFmt.SetAbsLSpace( sal_uInt16( (nLeftTxtPos +
+ SwNumRule::GetNumIndent(static_cast<sal_uInt8>(n-nLvl)))));
+ else
+ aFmt.SetAbsLSpace( sal_uInt16( nSpaceSteps * n )
+ + lNumIndent );
+ aRule.Set( n, aFmt );
+ }
+ }
+ }
+ }
+ else if( !aFlags.bAFmtByInput )
+ SetColl( static_cast<sal_uInt16>(RES_POOLCOLL_NUM_LEVEL1 + ( Min( nLvl, cnNumBullColls ) * 4 ) ));
+ else
+ bChgEnum = sal_False;
+ }
+
+ if( bChgEnum || bChgBullet )
+ {
+ aDelPam.DeleteMark();
+ aDelPam.GetPoint()->nNode = aNdIdx;
+
+ if( aFlags.bSetNumRule )
+ {
+ if( aFlags.bAFmtByInput )
+ {
+ aDelPam.SetMark();
+ aDelPam.GetMark()->nNode++;
+ aDelPam.GetNode(sal_False)->GetTxtNode()->SetAttrListLevel( nLvl );
+ }
+
+ pAktTxtNd->SetAttrListLevel(nLvl);
+ pAktTxtNd->SetNumLSpace( sal_True );
+
+ // --> OD 2008-03-17 #refactorlists#
+ // start new list
+ pDoc->SetNumRule( aDelPam, aRule, true );
+ // <--
+ aDelPam.DeleteMark();
+
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 );
+ }
+ else
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd,
+ bChgEnum ? (nTxtStt - nOrigTxtStt) : 0 );
+ aDelPam.SetMark();
+
+ if( bChgBullet )
+ nTxtStt += 2;
+
+ while( nTxtStt < rStr.Len() && IsSpace( rStr.GetChar( nTxtStt ) ))
+ nTxtStt++;
+
+ aDelPam.GetPoint()->nContent = nTxtStt - nOrigTxtStt;
+ DeleteSel( aDelPam );
+
+ if( !aFlags.bSetNumRule )
+ {
+ String sChgStr( '\t' );
+ if( bChgBullet )
+ sChgStr.Insert( aFlags.cBullet, 0 );
+ pDoc->InsertString( aDelPam, sChgStr );
+
+ SfxItemSet aSet( pDoc->GetAttrPool(), aTxtNodeSetRange );
+ if( bChgBullet )
+ {
+ aDelPam.GetPoint()->nContent = 0;
+ aDelPam.SetMark();
+ aDelPam.GetMark()->nContent = 1;
+ SetAllScriptItem( aSet,
+ SvxFontItem( aFlags.aBulletFont.GetFamily(),
+ aFlags.aBulletFont.GetName(),
+ aFlags.aBulletFont.GetStyleName(),
+ aFlags.aBulletFont.GetPitch(),
+ aFlags.aBulletFont.GetCharSet(),
+ RES_CHRATR_FONT ) );
+ pDoc->SetFmtItemByAutoFmt( aDelPam, aSet );
+ aDelPam.DeleteMark();
+ nAutoCorrPos = 2;
+ aSet.ClearItem();
+ }
+ SvxTabStopItem aTStops( RES_PARATR_TABSTOP ); aTStops.Insert( SvxTabStop( 0 ));
+ aSet.Put( aTStops );
+ pDoc->SetFmtItemByAutoFmt( aDelPam, aSet );
+ }
+ }
+
+ if( bBreak )
+ {
+ AutoCorrect( nAutoCorrPos ); /* Offset wegen Bullet + Tab */
+ return;
+ }
+
+ const SwTxtNode* pNxtNd = GetNextNode();
+ while( CanJoin( pNxtNd ) &&
+ nLvl == CalcLevel( *pNxtNd ) )
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_DEL_MORELINES );
+ bBreak = !IsFastFullLine( *pNxtNd ) || IsBlanksInString( *pNxtNd ) ||
+ IsSentenceAtEnd( *pNxtNd );
+ if( DeleteAktNxtPara( pNxtNd->GetTxt() ) )
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode(' ') );
+ }
+ if( bBreak )
+ break;
+ const SwTxtNode* pCurrNode = pNxtNd;
+ pNxtNd = GetNextNode();
+ if(!pNxtNd || pCurrNode == pNxtNd)
+ break;
+ }
+ DeleteAktPara( sal_False, sal_True );
+ AutoCorrect( nAutoCorrPos );
+}
+
+
+void SwAutoFormat::BuildNegIndent( SwTwips nSpaces )
+{
+ SetRedlineTxt( STR_AUTOFMTREDL_SET_TMPL_NEG_INDENT );
+ // Test auf Gegenueberstellung:
+ // (n Worte, durch Space/Tabs getrennt, mit gleicher
+ // Einrueckung in der 2.Zeile)
+
+ // lese alle nachfolgenden Absaetze die zu dieser Aufzaehlung gehoeren
+ sal_Bool bBreak = sal_True;
+ xub_StrLen nSpacePos, nTxtPos = GetBigIndent( nSpacePos );
+ if( bMoreLines )
+ DelMoreLinesBlanks( sal_True );
+ else
+ bBreak = !IsFastFullLine( *pAktTxtNd ) ||
+ ( !nTxtPos && IsBlanksInString( *pAktTxtNd )) ||
+ IsSentenceAtEnd( *pAktTxtNd );
+
+ SetColl( static_cast<sal_uInt16>( nTxtPos
+ ? RES_POOLCOLL_CONFRONTATION
+ : RES_POOLCOLL_TEXT_NEGIDENT ) );
+
+ if( nTxtPos )
+ {
+ const String& rStr = pAktTxtNd->GetTxt();
+ sal_Bool bInsTab = sal_True;
+
+ if( '\t' == rStr.GetChar( nSpacePos+1 )) // ein Tab, das belassen wir
+ {
+ --nSpacePos;
+ bInsTab = sal_False;
+ }
+
+ xub_StrLen nSpaceStt = nSpacePos;
+ while( nSpaceStt && IsSpace( rStr.GetChar( --nSpaceStt ) ) )
+ ;
+ ++nSpaceStt;
+
+ if( bInsTab && '\t' == rStr.GetChar( nSpaceStt ) ) // ein Tab, das belassen wir
+ {
+ ++nSpaceStt;
+ bInsTab = sal_False;
+ }
+
+
+ aDelPam.DeleteMark();
+ aDelPam.GetPoint()->nNode = aNdIdx;
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, nSpacePos );
+
+ // alten Spaces, usw. loeschen
+ if( nSpaceStt < nSpacePos )
+ {
+ aDelPam.SetMark();
+ aDelPam.GetMark()->nContent = nSpaceStt;
+ DeleteSel( aDelPam );
+ if( bInsTab )
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode('\t') );
+ }
+ }
+ }
+
+ if( !bBreak )
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_DEL_MORELINES );
+ SwTxtFrmInfo aFInfo( pAktTxtFrm );
+ const SwTxtNode* pNxtNd = GetNextNode();
+ while( CanJoin( pNxtNd ) &&
+ 20 < Abs( (long)(nSpaces - aFInfo.SetFrm(
+ GetFrm( *pNxtNd ) ).GetLineStart() ))
+ )
+ {
+ bBreak = !IsFastFullLine( *pNxtNd ) ||
+ IsBlanksInString( *pNxtNd ) ||
+ IsSentenceAtEnd( *pNxtNd );
+ if( DeleteAktNxtPara( pNxtNd->GetTxt() ) )
+ {
+ pDoc->InsertString( aDelPam, sal_Unicode(' ') );
+ }
+ if( bBreak )
+ break;
+ pNxtNd = GetNextNode();
+ }
+ }
+ DeleteAktPara( sal_True, sal_True );
+ AutoCorrect();
+}
+
+
+void SwAutoFormat::BuildHeadLine( sal_uInt16 nLvl )
+{
+ if( aFlags.bWithRedlining )
+ {
+ String sTxt( *ViewShell::GetShellRes()->GetAutoFmtNameLst()[
+ STR_AUTOFMTREDL_SET_TMPL_HEADLINE ] );
+ sTxt.SearchAndReplace( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "$(ARG1)" )),
+ String::CreateFromInt32( nLvl + 1 ) );
+ pDoc->SetAutoFmtRedlineComment( &sTxt );
+ }
+
+ SetColl( static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + nLvl ), sal_True );
+ if( aFlags.bAFmtByInput )
+ {
+ SwTxtFmtColl& rNxtColl = pAktTxtNd->GetTxtColl()->GetNextTxtFmtColl();
+
+ DelPrevPara();
+
+ DeleteAktPara( sal_True, sal_False );
+ DeleteAktNxtPara( aEmptyStr );
+
+ aDelPam.DeleteMark();
+ aDelPam.GetPoint()->nNode = aNdIdx.GetIndex() + 1;
+ aDelPam.GetPoint()->nContent.Assign( aDelPam.GetCntntNode(), 0 );
+ pDoc->SetTxtFmtColl( aDelPam, &rNxtColl );
+ }
+ else
+ {
+ DeleteAktPara( sal_True, sal_True );
+ AutoCorrect();
+ }
+}
+
+
+ // dann lasse doch mal das AutoCorrect auf den akt. TextNode los
+void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
+{
+ SvxAutoCorrect* pATst = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ long aSvxFlags = pATst->GetFlags( );
+ bool bReplaceQuote = ( aSvxFlags & ChgQuotes ) > 0;
+ bool bReplaceSglQuote = ( aSvxFlags & ChgSglQuotes ) > 0;
+
+ if( aFlags.bAFmtByInput ||
+ (!aFlags.bAutoCorrect && !bReplaceQuote && !bReplaceSglQuote &&
+ !aFlags.bCptlSttSntnc && !aFlags.bCptlSttWrd &&
+ !aFlags.bChgOrdinalNumber &&
+ !aFlags.bChgToEnEmDash && !aFlags.bSetINetAttr &&
+ !aFlags.bChgWeightUnderl && !aFlags.bAddNonBrkSpace) )
+ return;
+
+ const String* pTxt = &pAktTxtNd->GetTxt();
+ if( nPos >= pTxt->Len() )
+ return;
+
+ sal_Bool bGetLanguage = aFlags.bChgOrdinalNumber ||
+ aFlags.bChgToEnEmDash || aFlags.bSetINetAttr ||
+ aFlags.bCptlSttWrd || aFlags.bCptlSttSntnc ||
+ aFlags.bAddNonBrkSpace;
+
+
+ aDelPam.DeleteMark();
+ aDelPam.GetPoint()->nNode = aNdIdx;
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 );
+
+ SwAutoCorrDoc aACorrDoc( *pEditShell, aDelPam );
+
+ SwTxtFrmInfo aFInfo( 0 );
+
+ xub_StrLen nSttPos, nLastBlank = nPos;
+ sal_Bool bFirst = aFlags.bCptlSttSntnc, bFirstSent = bFirst;
+ sal_Unicode cChar = 0;
+
+ CharClass& rAppCC = GetAppCharClass();
+
+ do {
+ while( nPos < pTxt->Len() && IsSpace( cChar = pTxt->GetChar( nPos ) ))
+ ++nPos;
+ if( nPos == pTxt->Len() )
+ break; // das wars
+
+ if( ( ( bReplaceQuote && '\"' == cChar ) ||
+ ( bReplaceSglQuote && '\'' == cChar ) ) &&
+ ( !nPos || ' ' == pTxt->GetChar( nPos-1 ) ) )
+ {
+ // --------------------------------------
+ // beachte: Sonderfall Symbolfonts !!!
+ if( !aFInfo.GetFrm() )
+ aFInfo.SetFrm( GetFrm( *pAktTxtNd ) );
+ if( !aFInfo.IsBullet( nPos ))
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_TYPO );
+ aDelPam.GetPoint()->nContent = nPos;
+ sal_Bool bSetHardBlank = sal_False;
+
+ String sReplace( pATst->GetQuote( aACorrDoc,
+ nPos, cChar, sal_True ));
+
+ aDelPam.SetMark();
+ aDelPam.GetPoint()->nContent = nPos+1;
+ if( 2 == sReplace.Len() && ' ' == sReplace.GetChar( 1 ))
+ {
+ sReplace.Erase( 1 );
+ bSetHardBlank = sal_True;
+ }
+ pDoc->ReplaceRange( aDelPam, sReplace, false );
+
+ if( aFlags.bWithRedlining )
+ {
+ aNdIdx = aDelPam.GetPoint()->nNode;
+ pAktTxtNd = aNdIdx.GetNode().GetTxtNode();
+ pTxt = &pAktTxtNd->GetTxt();
+ aDelPam.SetMark();
+ aFInfo.SetFrm( 0 );
+ }
+
+ nPos += sReplace.Len() - 1;
+ aDelPam.DeleteMark();
+ if( bSetHardBlank )
+ {
+ pDoc->InsertString( aDelPam, CHAR_HARDBLANK );
+ ++nPos;
+ }
+ }
+ }
+
+ int bCallACorr = sal_False;
+ int bBreak = 0;
+ if( nPos && IsSpace( pTxt->GetChar( nPos-1 )))
+ nLastBlank = nPos;
+ for( nSttPos = nPos; !bBreak && nPos < pTxt->Len(); ++nPos )
+ switch( cChar = pTxt->GetChar( nPos ) )
+ {
+ case '\"':
+ case '\'':
+ if( ( cChar == '\"' && bReplaceQuote ) || ( cChar == '\'' && bReplaceSglQuote ) )
+ {
+ // --------------------------------------
+ // beachte: Sonderfall Symbolfonts !!!
+ if( !aFInfo.GetFrm() )
+ aFInfo.SetFrm( GetFrm( *pAktTxtNd ) );
+ if( !aFInfo.IsBullet( nPos ))
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_TYPO );
+ sal_Bool bSetHardBlank = sal_False;
+ aDelPam.GetPoint()->nContent = nPos;
+ String sReplace( pATst->GetQuote( aACorrDoc,
+ nPos, cChar, sal_False ));
+
+ if( 2 == sReplace.Len() && ' ' == sReplace.GetChar( 0 ))
+ {
+ sReplace.Erase( 0, 1 );
+ bSetHardBlank = sal_True;
+ }
+
+ aDelPam.SetMark();
+ aDelPam.GetPoint()->nContent = nPos+1;
+ pDoc->ReplaceRange( aDelPam, sReplace, false );
+
+ if( aFlags.bWithRedlining )
+ {
+ aNdIdx = aDelPam.GetPoint()->nNode;
+ pAktTxtNd = aNdIdx.GetNode().GetTxtNode();
+ pTxt = &pAktTxtNd->GetTxt();
+ aDelPam.SetMark();
+ aDelPam.DeleteMark();
+ aFInfo.SetFrm( 0 );
+ }
+
+ nPos += sReplace.Len() - 1;
+ aDelPam.DeleteMark();
+
+ if( bSetHardBlank )
+ {
+ aDelPam.GetPoint()->nContent = nPos;
+ pDoc->InsertString( aDelPam, CHAR_HARDBLANK );
+ aDelPam.GetPoint()->nContent = ++nPos;
+ }
+ }
+ }
+ break;
+ case '*':
+ case '_':
+ if( aFlags.bChgWeightUnderl )
+ {
+ // --------------------------------------
+ // beachte: Sonderfall Symbolfonts !!!
+ if( !aFInfo.GetFrm() )
+ aFInfo.SetFrm( GetFrm( *pAktTxtNd ) );
+ if( !aFInfo.IsBullet( nPos ))
+ {
+ SetRedlineTxt( '*' == cChar
+ ? STR_AUTOFMTREDL_BOLD
+ : STR_AUTOFMTREDL_UNDER );
+
+ sal_Unicode cBlank = nSttPos ? pTxt->GetChar(nSttPos - 1) : 0;
+ aDelPam.GetPoint()->nContent = nPos;
+
+ if( pATst->FnChgWeightUnderl( aACorrDoc, *pTxt,
+ nSttPos, nPos ))
+ {
+ if( aFlags.bWithRedlining )
+ {
+ aNdIdx = aDelPam.GetPoint()->nNode;
+ pAktTxtNd = aNdIdx.GetNode().GetTxtNode();
+ pTxt = &pAktTxtNd->GetTxt();
+ aDelPam.SetMark();
+ aDelPam.DeleteMark();
+ aFInfo.SetFrm( 0 );
+ }
+ //#125102# in case of the mode REDLINE_SHOW_DELETE the ** are still contained in pTxt
+ if(0 == (pDoc->GetRedlineMode() & nsRedlineMode_t::REDLINE_SHOW_DELETE))
+ nPos = aDelPam.GetPoint()->nContent.GetIndex() - 1;
+ // wurde vorm Start ein Zeichen entfernt?
+ if( cBlank && cBlank != pTxt->GetChar(nSttPos - 1) )
+ --nSttPos;
+ }
+ }
+ }
+ break;
+ case '/':
+ if ( aFlags.bAddNonBrkSpace )
+ {
+ LanguageType eLang = (bGetLanguage && pAktTxtNd)
+ ? pAktTxtNd->GetLang( nSttPos )
+ : LANGUAGE_SYSTEM;
+
+ SetRedlineTxt( STR_AUTOFMTREDL_NON_BREAK_SPACE );
+ if ( pATst->FnAddNonBrkSpace( aACorrDoc, *pTxt, nSttPos, nPos, eLang ) )
+ --nPos;
+ }
+ break;
+
+ case '.':
+ case '!':
+ case '?':
+ if( aFlags.bCptlSttSntnc )
+ bFirstSent = sal_True;
+//alle Wortrenner loesen die Autokorrektur aus!
+// break;
+ default:
+//alle Wortrenner loesen die Autokorrektur aus!
+// case ' ':
+// case '\t':
+ if( !( rAppCC.isLetterNumeric( *pTxt, nPos )
+ || '/' == cChar )) // '/' should not be a word seperator (e.g. '1/2' needs to be handled as one word for replacement)
+ {
+ --nPos; // ++nPos von dem for ungueltig machen !
+ ++bBreak;
+ }
+ break;
+ }
+
+ if( nPos == nSttPos )
+ {
+ if( ++nPos == pTxt->Len() )
+ bCallACorr = sal_True;
+ }
+ else
+ bCallACorr = sal_True;
+
+
+ if( bCallACorr )
+ {
+ bCallACorr = sal_False;
+ aDelPam.GetPoint()->nContent = nPos;
+ SetRedlineTxt( STR_AUTOFMTREDL_USE_REPLACE );
+ if( aFlags.bAutoCorrect &&
+ aACorrDoc.ChgAutoCorrWord( nSttPos, nPos, *pATst, 0 ) )
+ {
+ nPos = aDelPam.GetPoint()->nContent.GetIndex();
+
+ if( aFlags.bWithRedlining )
+ {
+ aNdIdx = aDelPam.GetPoint()->nNode;
+ pAktTxtNd = aNdIdx.GetNode().GetTxtNode();
+ pTxt = &pAktTxtNd->GetTxt();
+ aDelPam.SetMark();
+ aDelPam.DeleteMark();
+ }
+
+ continue; // nichts weiter mehr abpruefen
+ }
+
+ LanguageType eLang = (bGetLanguage && pAktTxtNd)
+ ? pAktTxtNd->GetLang( nSttPos )
+ : LANGUAGE_SYSTEM;
+
+ if ( aFlags.bAddNonBrkSpace )
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_NON_BREAK_SPACE );
+ pATst->FnAddNonBrkSpace( aACorrDoc, *pTxt, nSttPos, nPos, eLang );
+ }
+
+ if( ( aFlags.bChgOrdinalNumber &&
+ SetRedlineTxt( STR_AUTOFMTREDL_ORDINAL ) &&
+ pATst->FnChgOrdinalNumber( aACorrDoc, *pTxt, nSttPos, nPos, eLang ) ) ||
+ ( aFlags.bChgToEnEmDash &&
+ SetRedlineTxt( STR_AUTOFMTREDL_DASH ) &&
+ pATst->FnChgToEnEmDash( aACorrDoc, *pTxt, nSttPos, nPos, eLang ) ) ||
+ ( aFlags.bSetINetAttr &&
+ ( nPos == pTxt->Len() || IsSpace( pTxt->GetChar( nPos )) ) &&
+ SetRedlineTxt( STR_AUTOFMTREDL_DETECT_URL ) &&
+ pATst->FnSetINetAttr( aACorrDoc, *pTxt, nLastBlank, nPos, eLang ) ) )
+ nPos = aDelPam.GetPoint()->nContent.GetIndex();
+ else
+ {
+ // Zwei Grossbuchstaben am Wort-Anfang ??
+ if( aFlags.bCptlSttWrd )
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_CPTL_STT_WORD );
+ pATst->FnCptlSttWrd( aACorrDoc, *pTxt, nSttPos, nPos, eLang );
+ }
+ // Grossbuchstabe am Satz-Anfang ??
+ if( aFlags.bCptlSttSntnc && bFirst )
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_CPTL_STT_SENT );
+ pATst->FnCptlSttSntnc( aACorrDoc, *pTxt, sal_True, nSttPos, nPos, eLang);
+ bFirst = sal_False;
+ }
+
+ bFirst = bFirstSent;
+ bFirstSent = sal_False;
+
+ if( aFlags.bWithRedlining )
+ {
+ aNdIdx = aDelPam.GetPoint()->nNode;
+ pAktTxtNd = aNdIdx.GetNode().GetTxtNode();
+ pTxt = &pAktTxtNd->GetTxt();
+ aDelPam.SetMark();
+ aDelPam.DeleteMark();
+ }
+ }
+ }
+ } while( nPos < pTxt->Len() );
+ ClearRedlineTxt();
+}
+
+
+SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags,
+ SwNodeIndex* pSttNd, SwNodeIndex* pEndNd )
+ : aFlags( rFlags ),
+ aDelPam( pEdShell->GetDoc()->GetNodes().GetEndOfExtras() ),
+ aNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfExtras(), +1 ),
+ aEndNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfContent() ),
+ pEditShell( pEdShell ),
+ pDoc( pEdShell->GetDoc() ),
+ pAktTxtNd( 0 ), pAktTxtFrm( 0 ),
+ pCharClass( 0 ),
+ nRedlAutoFmtSeqId( 0 )
+{
+ ASSERT( (pSttNd && pEndNd) || (!pSttNd && !pEndNd),
+ "Kein Bereich angegeben" );
+
+ if( aFlags.bSetNumRule && !aFlags.bAFmtByInput )
+ aFlags.bSetNumRule = sal_False;
+
+ sal_Bool bReplaceStyles = !aFlags.bAFmtByInput || aFlags.bReplaceStyles;
+
+ const SwTxtNode* pNxtNd = 0;
+ sal_Bool bNxtEmpty = sal_False;
+ sal_Bool bNxtAlpha = sal_False;
+ sal_uInt16 nNxtLevel = 0;
+
+ // setze den Bereich zum Autoformatieren
+ if( pSttNd )
+ {
+ aNdIdx = *pSttNd;
+ aNdIdx--; // fuer GoNextPara, ein Absatz davor
+ aEndNdIdx = *pEndNd;
+ aEndNdIdx++;
+
+ // teste den vorhergehenden TextNode
+ pNxtNd = aNdIdx.GetNode().GetTxtNode();
+ bEmptyLine = !pNxtNd ||
+ IsEmptyLine( *pNxtNd ) ||
+ IsNoAlphaLine( *pNxtNd );
+ }
+ else
+ bEmptyLine = sal_True; // am Dokument Anfang
+
+ bEnde = sal_False;
+
+ // setze die Werte fuer die Prozent-Anzeige
+ nEndNdIdx = aEndNdIdx.GetIndex();
+
+ if( !aFlags.bAFmtByInput )
+ ::StartProgress( STR_STATSTR_AUTOFORMAT, aNdIdx.GetIndex(),
+ nEndNdIdx = aEndNdIdx.GetIndex(),
+ pDoc->GetDocShell() );
+
+ RedlineMode_t eRedlMode = pDoc->GetRedlineMode(), eOldMode = eRedlMode;
+ if( aFlags.bWithRedlining )
+ {
+ pDoc->SetAutoFmtRedline( sal_True );
+ eRedlMode = (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT);
+ }
+ else
+ eRedlMode = (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_IGNORE);
+ pDoc->SetRedlineMode( eRedlMode );
+
+ // save undo state (might be turned off)
+ bool const bUndoState = pDoc->GetIDocumentUndoRedo().DoesUndo();
+
+ // wenn mehrere Zeilen, dann erstmal nicht mit
+ // dem nachfolgenden Absatz zusammenfassen.
+ bMoreLines = sal_False;
+
+ nLastCalcHeadLvl = nLastCalcEnumLvl = 0;
+ nLastHeadLvl = nLastEnumLvl = USHRT_MAX;
+ sal_uInt16 nLevel = 0;
+ sal_uInt16 nDigitLvl = 0;
+
+ // defaulten
+ SwTxtFrmInfo aFInfo( 0 );
+
+ // das ist unser Automat fuer die Auto-Formatierung
+ eStat = READ_NEXT_PARA;
+ while( !bEnde )
+ {
+ switch( eStat )
+ {
+ case READ_NEXT_PARA:
+ {
+ GoNextPara();
+ eStat = bEnde ? IS_ENDE : TST_EMPTY_LINE;
+ }
+ break;
+
+ case TST_EMPTY_LINE:
+ if( IsEmptyLine( *pAktTxtNd ) )
+ {
+ if( aFlags.bDelEmptyNode && !HasObjects( *pAktTxtNd ) )
+ {
+ bEmptyLine = sal_True;
+ sal_uLong nOldCnt = pDoc->GetNodes().Count();
+ DelEmptyLine();
+ // wurde wiklich ein Node geloescht ?
+ if( nOldCnt != pDoc->GetNodes().Count() )
+ aNdIdx--; // nicht den naechsten Absatz ueberspringen
+ }
+ eStat = READ_NEXT_PARA;
+ }
+ else
+ eStat = TST_ALPHA_LINE;
+ break;
+
+ case TST_ALPHA_LINE:
+ if( IsNoAlphaLine( *pAktTxtNd ))
+ {
+ // erkenne eine Tabellendefinition +---+---+
+ if( aFlags.bAFmtByInput && aFlags.bCreateTable && DoTable() )
+ {
+ //JP 30.09.96: das DoTable() verlaesst sich auf das
+ // Pop und Move - Crsr nach dem AutoFormat!
+ pEdShell->Pop( sal_False );
+ *pEdShell->GetCrsr() = aDelPam;
+ pEdShell->Push();
+
+ eStat = IS_ENDE;
+ break;
+ }
+
+ // dann teste mal auf 3 "---" oder "===". In dem Fall
+ // soll der vorherige Absatz unterstrichen und dieser
+ // geloescht werden!
+ if( !DoUnderline() && bReplaceStyles )
+ {
+ SetColl( RES_POOLCOLL_STANDARD, sal_True );
+ bEmptyLine = sal_True;
+ }
+ eStat = READ_NEXT_PARA;
+ }
+ else
+ eStat = GET_ALL_INFO;
+ break;
+
+ case GET_ALL_INFO:
+ {
+ if( pAktTxtNd->GetNumRule() )
+ {
+ // in Numerierung nichts machen, zum naechsten
+ bEmptyLine = sal_False;
+ eStat = READ_NEXT_PARA;
+ // loesche alle Blanks am Anfang/Ende
+ // und alle mitten drin
+ //JP 29.04.98: erstmal nur alle "mitten drin".
+ DelMoreLinesBlanks( sal_False );
+ break;
+ }
+
+ aFInfo.SetFrm( pAktTxtFrm );
+
+ // erstmal: wurden schon mal entsprechende Vorlagen
+ // vergeben, so behalte die bei, gehe zum
+ // naechsten Node.
+ sal_uInt16 nPoolId = pAktTxtNd->GetTxtColl()->GetPoolFmtId();
+ if( IsPoolUserFmt( nPoolId )
+ ? !aFlags.bChgUserColl
+ : ( RES_POOLCOLL_STANDARD != nPoolId &&
+ ( !aFlags.bAFmtByInput ||
+ (RES_POOLCOLL_TEXT_MOVE != nPoolId &&
+ RES_POOLCOLL_TEXT != nPoolId )) ))
+ {
+ eStat = HAS_FMTCOLL;
+ break;
+ }
+
+ // teste auf Harte oder aus Vorlagen gesetzte LRSpaces
+ if( IsPoolUserFmt( nPoolId ) ||
+ RES_POOLCOLL_STANDARD == nPoolId )
+ {
+ short nSz;
+ SvxLRSpaceItem* pLRSpace;
+ if( SFX_ITEM_SET == pAktTxtNd->GetSwAttrSet().
+ GetItemState( RES_LR_SPACE, sal_True,
+ (const SfxPoolItem**)&pLRSpace ) &&
+ ( 0 != (nSz = pLRSpace->GetTxtFirstLineOfst()) ||
+ 0 != pLRSpace->GetTxtLeft() ) )
+ {
+ // Ausnahme: Numerierun/Aufzaehlung kann mit Einzug
+ // existieren!!
+ if( IsEnumericChar( *pAktTxtNd ))
+ {
+ nLevel = CalcLevel( *pAktTxtNd, &nDigitLvl );
+ if( nLevel >= MAXLEVEL )
+ nLevel = MAXLEVEL-1;
+ BuildEnum( nLevel, nDigitLvl );
+ eStat = READ_NEXT_PARA;
+ break;
+ }
+
+
+ // nie zusammenfassen, so belassen
+ // (Opt. vielleicht als Ausnahmen nur Einzug)
+ bMoreLines = sal_True;
+
+ if( bReplaceStyles )
+ {
+ // dann setze doch eine unserer Vorlagen
+ if( 0 < nSz ) // positiver 1. Zeileneinzug
+ BuildIndent();
+ else if( 0 > nSz ) // negativer 1. Zeileneinzug
+ BuildNegIndent( aFInfo.GetLineStart() );
+ else if( pLRSpace->GetTxtLeft() ) // ist ein Einzug
+ BuildTextIndent();
+ }
+ eStat = READ_NEXT_PARA;
+ break;
+ }
+ }
+
+ nLevel = CalcLevel( *pAktTxtNd, &nDigitLvl );
+ bMoreLines = !IsOneLine( *pAktTxtNd );
+ pNxtNd = GetNextNode();
+ if( pNxtNd )
+ {
+ bNxtEmpty = IsEmptyLine( *pNxtNd );
+ bNxtAlpha = IsNoAlphaLine( *pNxtNd );
+ nNxtLevel = CalcLevel( *pNxtNd );
+
+ if( !bEmptyLine && HasBreakAttr( *pAktTxtNd ) )
+ bEmptyLine = sal_True;
+ if( !bNxtEmpty && HasBreakAttr( *pNxtNd ) )
+ bNxtEmpty = sal_True;
+
+ // fuer z.B. selbst definierte Einzuege oder
+ // rechts/zentierte Ausrichtung
+// if( !nLevel && 0 != aFInfo.GetLineStart() )
+// nLevel = 1;
+ }
+ else
+ {
+ bNxtEmpty = sal_False; // sal_True;
+ bNxtAlpha = sal_False;
+ nNxtLevel = 0;
+ }
+ eStat = !bMoreLines ? IS_ONE_LINE : TST_ENUMERIC;
+ }
+ break;
+
+ case IS_ONE_LINE:
+ {
+ eStat = TST_ENUMERIC;
+ if( !bReplaceStyles )
+ break;
+
+ String sClrStr( pAktTxtNd->GetTxt() );
+
+ if( !DelLeadingBlanks( sClrStr ).Len() )
+ {
+ bEmptyLine = sal_True;
+ eStat = READ_NEXT_PARA;
+ break; // naechsten Absatz lesen
+ }
+
+ // Teste auf Ueberschrift
+ if( !bEmptyLine || !IsFirstCharCapital( *pAktTxtNd ) ||
+ IsBlanksInString( *pAktTxtNd ) )
+ break;
+
+ bEmptyLine = sal_False;
+ String sEndClrStr( sClrStr );
+ xub_StrLen nLen = DelTrailingBlanks( sEndClrStr ).Len();
+
+ // nicht, dann teste auf Ueberschrift
+ if( ':' == sEndClrStr.GetChar( nLen - 1 ) )
+ {
+//---------------------------------------------------------------------------
+// Wie ist denn nun die Bedingung fuer die Ueberschrift auf Ebene 3 ??
+// Zur Zeit: generell wenn am Ende ein ':' ist.
+//
+// if( bNxtEmpty || bNxtAlpha )
+// !IsEnumericChar( *pNxtNd ) )
+//---------------------------------------------------------------------------
+ {
+ BuildHeadLine( 2 );
+ eStat = READ_NEXT_PARA;
+ break;
+ }
+ }
+ else if( 256 <= sEndClrStr.GetChar( nLen-1 ) ||
+ !strchr( ",.;", sEndClrStr.GetChar( nLen-1 )) )
+ {
+ if( bNxtEmpty || bNxtAlpha
+ || ( pNxtNd && IsEnumericChar( *pNxtNd ))
+
+//---------------------------------------------------------------------------
+// ist zum Verwechseln mit neg. Einzug !!
+ /*|| nLevel < nNxtLevel*/
+//---------------------------------------------------------------------------
+
+ )
+ {
+ // wurde Level vom Text vorgegeben ?
+// if( USHRT_MAX != nDigitLvl )
+// nLevel = nDigitLvl;
+
+ // eine Ebene runter ?
+ if( nLevel >= MAXLEVEL )
+ nLevel = MAXLEVEL-1;
+
+ if( USHRT_MAX == nLastHeadLvl )
+ nLastHeadLvl = 0;
+ else if( nLastCalcHeadLvl < nLevel )
+ {
+ if( nLastHeadLvl+1 < MAXLEVEL )
+ ++nLastHeadLvl;
+ }
+ // eine Ebene hoch ?
+ else if( nLastCalcHeadLvl > nLevel )
+ {
+ if( nLastHeadLvl )
+ --nLastHeadLvl;
+ }
+ nLastCalcHeadLvl = nLevel;
+
+ if( aFlags.bAFmtByInput )
+ BuildHeadLine( nLevel );
+ else
+ BuildHeadLine( nLastHeadLvl );
+ eStat = READ_NEXT_PARA;
+ break;
+ }
+ }
+ }
+ break;
+
+ case TST_ENUMERIC:
+ {
+ bEmptyLine = sal_False;
+ if( IsEnumericChar( *pAktTxtNd ))
+ {
+ if( nLevel >= MAXLEVEL )
+ nLevel = MAXLEVEL-1;
+ BuildEnum( nLevel, nDigitLvl );
+ eStat = READ_NEXT_PARA;
+ }
+//JP 25.03.96: Vorlagen fuer Einzug zulassen
+// else if( aFlags.bAFmtByInput )
+// eStat = READ_NEXT_PARA;
+ else if( bReplaceStyles )
+ eStat = nLevel ? TST_IDENT : TST_NEG_IDENT;
+ else
+ eStat = READ_NEXT_PARA;
+ }
+ break;
+
+ case TST_IDENT:
+ // Spaces am Anfang, dann teste doch mal auf Einzuege
+ if( bMoreLines && nLevel )
+ {
+ SwTwips nSz = aFInfo.GetFirstIndent();
+ if( 0 < nSz ) // positiver 1. Zeileneinzug
+ BuildIndent();
+ else if( 0 > nSz ) // negativer 1. Zeileneinzug
+ BuildNegIndent( aFInfo.GetLineStart() );
+ else // ist ein Einzug
+ BuildTextIndent();
+ eStat = READ_NEXT_PARA;
+ }
+ else if( nLevel && pNxtNd && !bEnde &&
+ !bNxtEmpty && !bNxtAlpha && !nNxtLevel &&
+ !IsEnumericChar( *pNxtNd ) )
+ {
+ // ist ein Einzug
+ BuildIndent();
+ eStat = READ_NEXT_PARA;
+ }
+ else
+ eStat = TST_TXT_BODY;
+ break;
+
+ case TST_NEG_IDENT:
+ // keine Spaces am Anfang, dann teste doch mal auf neg. Einzuege
+ {
+ if( bMoreLines && !nLevel )
+ {
+ SwTwips nSz = aFInfo.GetFirstIndent();
+ if( 0 < nSz ) // positiver 1. Zeileneinzug
+ BuildIndent();
+ else if( 0 > nSz ) // negativer 1. Zeileneinzug
+ BuildNegIndent( aFInfo.GetLineStart() );
+ else // ist ein kein Einzug
+ BuildText();
+ eStat = READ_NEXT_PARA;
+ }
+ else if( !nLevel && pNxtNd && !bEnde &&
+ !bNxtEmpty && !bNxtAlpha && nNxtLevel &&
+ !IsEnumericChar( *pNxtNd ) )
+ {
+ // ist ein neg. Einzug
+ BuildNegIndent( aFInfo.GetLineStart() );
+ eStat = READ_NEXT_PARA;
+ }
+ else
+ eStat = TST_TXT_BODY;
+ }
+ break;
+
+ case TST_TXT_BODY:
+ {
+ if( bMoreLines )
+ {
+ SwTwips nSz = aFInfo.GetFirstIndent();
+ if( 0 < nSz ) // positiver 1. Zeileneinzug
+ BuildIndent();
+ else if( 0 > nSz ) // negativer 1. Zeileneinzug
+ BuildNegIndent( aFInfo.GetLineStart() );
+ else if( nLevel ) // ist ein Einzug
+ BuildTextIndent();
+ else
+ BuildText();
+ }
+ else if( nLevel )
+ BuildTextIndent();
+ else
+ BuildText();
+ eStat = READ_NEXT_PARA;
+ }
+ break;
+
+ case HAS_FMTCOLL:
+ {
+ // erstmal: wurden schon mal entsprechende Vorlagen
+ // vergeben, so behalte die bei, gehe zum
+ // naechsten Node.
+ bEmptyLine = sal_False;
+ eStat = READ_NEXT_PARA;
+ // loesche alle Blanks am Anfang/Ende
+ // und alle mitten drin
+ //JP 29.04.98: erstmal nur alle "mitten drin".
+ DelMoreLinesBlanks( sal_False );
+
+ // behandel die harte Attributierung
+ if( pAktTxtNd->HasSwAttrSet() )
+ {
+ short nSz;
+ SvxLRSpaceItem* pLRSpace;
+ if( bReplaceStyles &&
+ SFX_ITEM_SET == pAktTxtNd->GetSwAttrSet().
+ GetItemState( RES_LR_SPACE, sal_False,
+ (const SfxPoolItem**)&pLRSpace ) &&
+ ( 0 != (nSz = pLRSpace->GetTxtFirstLineOfst()) ||
+ 0 != pLRSpace->GetTxtLeft() ) )
+ {
+ // dann setze doch eine unserer Vorlagen
+ if( 0 < nSz ) // positiver 1. Zeileneinzug
+ BuildIndent();
+ else if( 0 > nSz ) // negativer 1. Zeileneinzug
+ {
+ BuildNegIndent( aFInfo.GetLineStart() );
+ }
+ else if( pLRSpace->GetTxtLeft() ) // ist ein Einzug
+ BuildTextIndent();
+ else
+ BuildText();
+ }
+ }
+ }
+ break;
+
+ case IS_ENDE:
+ bEnde = sal_True;
+ break;
+ }
+ }
+
+ if( aFlags.bWithRedlining )
+ pDoc->SetAutoFmtRedline( sal_False );
+ pDoc->SetRedlineMode( eOldMode );
+
+ // restore undo (in case it has been changed)
+ pDoc->GetIDocumentUndoRedo().DoUndo(bUndoState);
+
+ // Prozent-Anzeige wieder abschalten
+ if( !aFlags.bAFmtByInput )
+ ::EndProgress( pDoc->GetDocShell() );
+}
+
+void SwEditShell::AutoFormat( const SvxSwAutoFmtFlags* pAFlags )
+{
+ SwWait* pWait = 0;
+
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ StartUndo( UNDO_AUTOFORMAT );
+
+ SvxSwAutoFmtFlags aAFFlags; // erst mal default - Werte
+ if( pAFlags ) // oder doch angegeben ??
+ {
+ aAFFlags = *pAFlags;
+ if( !aAFFlags.bAFmtByInput )
+ pWait = new SwWait( *GetDoc()->GetDocShell(), sal_True );
+ }
+
+ SwPaM* pCrsr = GetCrsr();
+ // es gibt mehr als einen oder ist eine Selektion offen
+ if( pCrsr->GetNext() != pCrsr || pCrsr->HasMark() )
+ {
+ FOREACHPAM_START(this)
+ if( PCURCRSR->HasMark() )
+ {
+ SwAutoFormat aFmt( this, aAFFlags, &PCURCRSR->Start()->nNode,
+ &PCURCRSR->End()->nNode );
+ }
+ FOREACHPAM_END()
+ }
+ else
+ {
+ SwAutoFormat aFmt( this, aAFFlags );
+ }
+
+ EndUndo( UNDO_AUTOFORMAT );
+ EndAllAction();
+
+ delete pWait;
+}
+
+
+void SwEditShell::AutoFmtBySplitNode()
+{
+ SET_CURR_SHELL( this );
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() == pCrsr && pCrsr->Move( fnMoveBackward, fnGoNode ) )
+ {
+ StartAllAction();
+ StartUndo( UNDO_AUTOFORMAT );
+
+ sal_Bool bRange = sal_False;
+ pCrsr->SetMark();
+ SwIndex* pCntnt = &pCrsr->GetMark()->nContent;
+ if( pCntnt->GetIndex() )
+ {
+ *pCntnt = 0;
+ bRange = sal_True;
+ }
+ else
+ {
+ // dann einen Node zurueckspringen
+ SwNodeIndex aNdIdx( pCrsr->GetMark()->nNode, -1 );
+ SwTxtNode* pTxtNd = aNdIdx.GetNode().GetTxtNode();
+ if( pTxtNd && pTxtNd->GetTxt().Len() )
+ {
+ pCntnt->Assign( pTxtNd, 0 );
+ pCrsr->GetMark()->nNode = aNdIdx;
+ bRange = sal_True;
+ }
+ }
+
+ if( bRange )
+ {
+ Push(); // Cursor sichern
+
+ SvxSwAutoFmtFlags aAFFlags = *GetAutoFmtFlags(); // erst mal default - Werte
+
+ SwAutoFormat aFmt( this, aAFFlags, &pCrsr->GetMark()->nNode,
+ &pCrsr->GetPoint()->nNode );
+
+ //JP 30.09.96: das DoTable() verlaesst sich auf das PopCrsr
+ // und MoveCrsr!
+ Pop( sal_False );
+ pCrsr = GetCrsr();
+ }
+ pCrsr->DeleteMark();
+ pCrsr->Move( fnMoveForward, fnGoNode );
+
+ EndUndo( UNDO_AUTOFORMAT );
+ EndAllAction();
+ }
+}
+
+SvxSwAutoFmtFlags* SwEditShell::GetAutoFmtFlags()
+{
+ if (!pAutoFmtFlags)
+ pAutoFmtFlags = new SvxSwAutoFmtFlags;
+
+ return pAutoFmtFlags;
+}
+
+void SwEditShell::SetAutoFmtFlags(SvxSwAutoFmtFlags * pFlags)
+{
+ SvxSwAutoFmtFlags* pEditFlags = GetAutoFmtFlags();
+
+ pEditFlags->bSetNumRule = pFlags->bSetNumRule;
+ pEditFlags->bChgEnumNum = pFlags->bChgEnumNum;
+ pEditFlags->bSetBorder = pFlags->bSetBorder;
+ pEditFlags->bCreateTable = pFlags->bCreateTable;
+ pEditFlags->bReplaceStyles = pFlags->bReplaceStyles;
+ pEditFlags->bAFmtByInpDelSpacesAtSttEnd =
+ pFlags->bAFmtByInpDelSpacesAtSttEnd;
+ pEditFlags->bAFmtByInpDelSpacesBetweenLines =
+ pFlags->bAFmtByInpDelSpacesBetweenLines;
+
+ //JP 15.12.98: BulletZeichen und Font in die "normalen" kopieren,
+ // weil beim Autoformat nur mit diesen gearbeitet wird!
+ pEditFlags->cBullet = pFlags->cByInputBullet;
+ pEditFlags->aBulletFont = pFlags->aByInputBulletFont;
+ pEditFlags->cByInputBullet = pFlags->cByInputBullet;
+ pEditFlags->aByInputBulletFont = pFlags->aByInputBulletFont;
+}
+
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
new file mode 100644
index 000000000000..386814eda008
--- /dev/null
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <editsh.hxx>
+#include <doc.hxx> // fuer aNodes
+#include <IDocumentUndoRedo.hxx>
+#include <pam.hxx> // fuer SwPaM
+#include <edimp.hxx> // fuer MACROS
+#include <swundo.hxx> // fuer die UndoIds
+#include <ndtxt.hxx> // fuer Get-/ChgFmt Set-/GetAttrXXX
+
+
+
+/*************************************
+ * harte Formatierung (Attribute)
+ *************************************/
+
+
+void SwEditShell::ResetAttr( const SvUShortsSort* pAttrs )
+{
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ sal_Bool bUndoGroup = GetCrsr()->GetNext() != GetCrsr();
+ if( bUndoGroup )
+ {
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_RESETATTR, NULL);
+ }
+
+ FOREACHPAM_START(this)
+ // if ( PCURCRSR->HasMark() )
+ GetDoc()->ResetAttrs(*PCURCRSR, sal_True, pAttrs);
+ FOREACHPAM_END()
+
+ if( bUndoGroup )
+ {
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_RESETATTR, NULL);
+ }
+ CallChgLnk();
+ EndAllAction();
+}
+
+
+
+void SwEditShell::GCAttr()
+{
+//JP 04.02.97: wozu eine Action-Klammerung - ein Formatierung sollte nicht
+// ausgeloest werden, so dass es hier ueberfluessig ist.
+// Sonst Probleme im MouseBut.DownHdl - Bug 35562
+// StartAllAction();
+ FOREACHPAM_START(this)
+ if ( !PCURCRSR->HasMark() )
+ {
+ SwTxtNode *const pTxtNode =
+ PCURCRSR->GetPoint()->nNode.GetNode().GetTxtNode();
+ if (pTxtNode)
+ {
+ pTxtNode->GCAttr();
+ }
+ }
+ else
+ {
+ const SwNodeIndex& rEnd = PCURCRSR->End()->nNode;
+ SwNodeIndex aIdx( PCURCRSR->Start()->nNode );
+ SwNode* pNd = &aIdx.GetNode();
+ do {
+ if( pNd->IsTxtNode() )
+ ((SwTxtNode*)pNd)->GCAttr();
+ }
+ while( 0 != ( pNd = GetDoc()->GetNodes().GoNext( &aIdx )) &&
+ aIdx <= rEnd );
+ }
+ FOREACHPAM_END()
+// EndAllAction();
+}
+
+// Setze das Attribut als neues default Attribut im Dokument.
+
+
+void SwEditShell::SetDefault( const SfxPoolItem& rFmtHint )
+{
+ // 7502: Action-Klammerung
+ StartAllAction();
+ GetDoc()->SetDefault( rFmtHint );
+ EndAllAction();
+}
+
+/*
+
+void SwEditShell::SetDefault( const SfxItemSet& rSet )
+{
+ // 7502: Action-Klammerung
+ StartAllAction();
+ GetDoc()->SetDefault( rSet );
+ EndAllAction();
+}
+*/
+
+// Erfrage das Default Attribut in diesem Dokument.
+
+const SfxPoolItem& SwEditShell::GetDefault( sal_uInt16 nFmtHint ) const
+{
+ return GetDoc()->GetDefault( nFmtHint );
+
+}
+
+
+void SwEditShell::SetAttr( const SfxPoolItem& rHint, sal_uInt16 nFlags )
+{
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr ) // Ring von Cursorn
+ {
+ sal_Bool bIsTblMode = IsTableMode();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
+
+ FOREACHPAM_START(this)
+ if( PCURCRSR->HasMark() && ( bIsTblMode ||
+ *PCURCRSR->GetPoint() != *PCURCRSR->GetMark() ))
+ {
+ GetDoc()->InsertPoolItem(*PCURCRSR, rHint, nFlags );
+ }
+ FOREACHPAM_END()
+
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
+ }
+ else
+ {
+ if( !HasSelection() )
+ UpdateAttr();
+ GetDoc()->InsertPoolItem( *pCrsr, rHint, nFlags );
+ }
+ EndAllAction();
+}
+
+
+void SwEditShell::SetAttr( const SfxItemSet& rSet, sal_uInt16 nFlags )
+{
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr ) // Ring von Cursorn
+ {
+ sal_Bool bIsTblMode = IsTableMode();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
+
+ FOREACHPAM_START(this)
+ if( PCURCRSR->HasMark() && ( bIsTblMode ||
+ *PCURCRSR->GetPoint() != *PCURCRSR->GetMark() ))
+ {
+ GetDoc()->InsertItemSet(*PCURCRSR, rSet, nFlags );
+ }
+ FOREACHPAM_END()
+
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
+ }
+ else
+ {
+ if( !HasSelection() )
+ UpdateAttr();
+ GetDoc()->InsertItemSet( *pCrsr, rSet, nFlags );
+ }
+ EndAllAction();
+}
+
+
+
+
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
new file mode 100644
index 000000000000..8a5891093315
--- /dev/null
+++ b/sw/source/core/edit/edattr.cxx
@@ -0,0 +1,646 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#include <editeng/tstpitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <txatbase.hxx>
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <editsh.hxx>
+#include <edimp.hxx> // fuer MACROS
+#include <doc.hxx>
+#include <swundo.hxx> // fuer UNDO-Ids
+#include <ndtxt.hxx>
+#include <ftnidx.hxx>
+#include <expfld.hxx>
+#include <rootfrm.hxx>
+#include <cntfrm.hxx>
+#include <breakit.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <crsskip.hxx>
+#include <txtfrm.hxx> // SwTxtFrm
+#include <scriptinfo.hxx>
+#include <svl/ctloptions.hxx>
+#include <charfmt.hxx> // #i27615#
+#include <numrule.hxx>
+
+
+/*************************************
+ * harte Formatierung (Attribute)
+ *************************************/
+
+// wenn Selektion groesser Max Nodes oder mehr als Max Selektionen
+// => keine Attribute
+const sal_uInt16& getMaxLookup()
+{
+ static const sal_uInt16 nMaxLookup = 1000;
+ return nMaxLookup;
+}
+
+// --> OD 2008-01-16 #newlistlevelattrs#
+sal_Bool SwEditShell::GetCurAttr( SfxItemSet& rSet,
+ const bool bMergeIndentValuesOfNumRule ) const
+// <--
+{
+ if( GetCrsrCnt() > getMaxLookup() )
+ {
+ rSet.InvalidateAllItems();
+ return sal_False;
+ }
+
+ SfxItemSet aSet( *rSet.GetPool(), rSet.GetRanges() );
+ SfxItemSet *pSet = &rSet;
+
+ FOREACHPAM_START(this)
+
+ // #i27615# if the cursor is in front of the numbering label
+ // the attributes to get are those from the numbering format.
+ if (PCURCRSR->IsInFrontOfLabel())
+ {
+ SwTxtNode * pTxtNd =
+ PCURCRSR->GetPoint()->nNode.GetNode().GetTxtNode();
+
+ if (pTxtNd)
+ {
+ SwNumRule * pNumRule = pTxtNd->GetNumRule();
+
+ if (pNumRule)
+ {
+ const String & aCharFmtName =
+ pNumRule->Get(static_cast<sal_uInt16>(pTxtNd->GetActualListLevel())).GetCharFmtName();
+ SwCharFmt * pCharFmt =
+ GetDoc()->FindCharFmtByName(aCharFmtName);
+
+ if (pCharFmt)
+ rSet.Put(pCharFmt->GetAttrSet());
+ }
+ }
+
+ continue;
+ }
+
+ sal_uLong nSttNd = PCURCRSR->GetMark()->nNode.GetIndex(),
+ nEndNd = PCURCRSR->GetPoint()->nNode.GetIndex();
+ xub_StrLen nSttCnt = PCURCRSR->GetMark()->nContent.GetIndex(),
+ nEndCnt = PCURCRSR->GetPoint()->nContent.GetIndex();
+
+ if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt ))
+ {
+ sal_uLong nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp;
+ nTmp = nSttCnt; nSttCnt = nEndCnt; nEndCnt = (xub_StrLen)nTmp;
+ }
+
+ if( nEndNd - nSttNd >= getMaxLookup() )
+ {
+ rSet.ClearItem();
+ rSet.InvalidateAllItems();
+ return sal_False;
+ }
+
+ // beim 1.Node traegt der Node die Werte in den GetSet ein (Initial)
+ // alle weiteren Nodes werden zum GetSet zu gemergt
+ for( sal_uLong n = nSttNd; n <= nEndNd; ++n )
+ {
+ SwNode* pNd = GetDoc()->GetNodes()[ n ];
+ switch( pNd->GetNodeType() )
+ {
+ case ND_TEXTNODE:
+ {
+ xub_StrLen nStt = n == nSttNd ? nSttCnt : 0,
+ nEnd = n == nEndNd ? nEndCnt
+ : ((SwTxtNode*)pNd)->GetTxt().Len();
+ // --> OD 2008-01-16 #newlistlevelattrs#
+ ((SwTxtNode*)pNd)->GetAttr( *pSet, nStt, nEnd,
+ sal_False, sal_True,
+ bMergeIndentValuesOfNumRule );
+ // <--
+ }
+ break;
+ case ND_GRFNODE:
+ case ND_OLENODE:
+ ((SwCntntNode*)pNd)->GetAttr( *pSet );
+ break;
+
+ default:
+ pNd = 0;
+ }
+
+ if( pNd )
+ {
+ if( pSet != &rSet )
+ rSet.MergeValues( aSet );
+
+ if( aSet.Count() )
+ aSet.ClearItem();
+ }
+ pSet = &aSet;
+ }
+
+ FOREACHPAM_END()
+
+ return sal_True;
+}
+
+SwTxtFmtColl* SwEditShell::GetCurTxtFmtColl() const
+{
+ SwTxtFmtColl *pFmt = 0;
+
+ if ( GetCrsrCnt() > getMaxLookup() )
+ return 0;
+
+ FOREACHPAM_START(this)
+
+ sal_uLong nSttNd = PCURCRSR->GetMark()->nNode.GetIndex(),
+ nEndNd = PCURCRSR->GetPoint()->nNode.GetIndex();
+ xub_StrLen nSttCnt = PCURCRSR->GetMark()->nContent.GetIndex(),
+ nEndCnt = PCURCRSR->GetPoint()->nContent.GetIndex();
+
+ if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt ))
+ {
+ sal_uLong nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp;
+ nTmp = nSttCnt; nSttCnt = nEndCnt; nEndCnt = (xub_StrLen)nTmp;
+ }
+
+ if( nEndNd - nSttNd >= getMaxLookup() )
+ {
+ pFmt = 0;
+ break;
+ }
+
+ for( sal_uLong n = nSttNd; n <= nEndNd; ++n )
+ {
+ SwNode* pNd = GetDoc()->GetNodes()[ n ];
+ if( pNd->IsTxtNode() )
+ {
+ if( !pFmt )
+ pFmt = ((SwTxtNode*)pNd)->GetTxtColl();
+ else if( pFmt == ((SwTxtNode*)pNd)->GetTxtColl() ) // ???
+ break;
+ }
+ }
+
+ FOREACHPAM_END()
+ return pFmt;
+}
+
+
+
+sal_Bool SwEditShell::GetCurFtn( SwFmtFtn* pFillFtn )
+{
+ // der Cursor muss auf dem akt. Fussnoten-Anker stehen:
+ SwPaM* pCrsr = GetCrsr();
+ SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode();
+ if( !pTxtNd )
+ return sal_False;
+
+ SwTxtAttr *const pFtn = pTxtNd->GetTxtAttrForCharAt(
+ pCrsr->GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN);
+ if( pFtn && pFillFtn )
+ {
+ // Daten vom Attribut uebertragen
+ const SwFmtFtn &rFtn = ((SwTxtFtn*)pFtn)->GetFtn();
+ pFillFtn->SetNumber( rFtn );
+ pFillFtn->SetEndNote( rFtn.IsEndNote() );
+ }
+ return 0 != pFtn;
+}
+
+
+bool SwEditShell::SetCurFtn( const SwFmtFtn& rFillFtn )
+{
+ bool bChgd = false;
+ StartAllAction();
+
+ SwPaM* pCrsr = GetCrsr(), *pFirst = pCrsr;
+ do {
+ bChgd |= pDoc->SetCurFtn( *pCrsr, rFillFtn.GetNumStr(),
+ rFillFtn.GetNumber(),
+ rFillFtn.IsEndNote() );
+
+ } while( pFirst != ( pCrsr = (SwPaM*)pCrsr->GetNext() ));
+
+ EndAllAction();
+ return bChgd;
+}
+
+
+
+/*sal_uInt16 SwEditShell::GetFtnCnt( sal_Bool bEndNotes = sal_False ) const
+{
+ const SwFtnIdxs &rIdxs = pDoc->GetFtnIdxs();
+ sal_uInt16 nCnt = 0;
+ for ( sal_uInt16 i = 0; i < rIdxs.Count(); ++i )
+ {
+ const SwFmtFtn &rFtn = rIdxs[i]->GetFtn();
+ if ( bEndNotes == rFtn.IsEndNote() )
+ nCnt++;
+ }
+ return nCnt;
+} */
+
+
+bool SwEditShell::HasFtns( bool bEndNotes ) const
+{
+ const SwFtnIdxs &rIdxs = pDoc->GetFtnIdxs();
+ for ( sal_uInt16 i = 0; i < rIdxs.Count(); ++i )
+ {
+ const SwFmtFtn &rFtn = rIdxs[i]->GetFtn();
+ if ( bEndNotes == rFtn.IsEndNote() )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+
+ // gebe Liste aller Fussnoten und deren Anfangstexte
+sal_uInt16 SwEditShell::GetSeqFtnList( SwSeqFldList& rList, bool bEndNotes )
+{
+ if( rList.Count() )
+ rList.Remove( 0, rList.Count() );
+
+ sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().Count();
+ SwTxtFtn* pTxtFtn;
+ for( n = 0; n < nFtnCnt; ++n )
+ {
+ pTxtFtn = pDoc->GetFtnIdxs()[ n ];
+ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+ if ( rFtn.IsEndNote() != bEndNotes )
+ continue;
+
+ SwNodeIndex* pIdx = pTxtFtn->GetStartNode();
+ if( pIdx )
+ {
+ SwNodeIndex aIdx( *pIdx, 1 );
+ SwTxtNode* pTxtNd = aIdx.GetNode().GetTxtNode();
+ if( !pTxtNd )
+ pTxtNd = (SwTxtNode*)pDoc->GetNodes().GoNext( &aIdx );
+
+ if( pTxtNd )
+ {
+ String sTxt( rFtn.GetViewNumStr( *pDoc ));
+ if( sTxt.Len() )
+ sTxt += ' ';
+ sTxt += pTxtNd->GetExpandTxt( 0, USHRT_MAX );
+
+ _SeqFldLstElem* pNew = new _SeqFldLstElem( sTxt,
+ pTxtFtn->GetSeqRefNo() );
+ while( rList.InsertSort( pNew ) )
+ pNew->sDlgEntry += ' ';
+ }
+ }
+ }
+
+ return rList.Count();
+}
+
+
+// linken Rand ueber Objectleiste einstellen (aenhlich dem Stufen von
+// Numerierungen)
+sal_Bool SwEditShell::IsMoveLeftMargin( sal_Bool bRight, sal_Bool bModulus ) const
+{
+ sal_Bool bRet = sal_True;
+
+ const SvxTabStopItem& rTabItem = (SvxTabStopItem&)GetDoc()->
+ GetDefault( RES_PARATR_TABSTOP );
+ sal_uInt16 nDefDist = static_cast<sal_uInt16>(rTabItem.Count() ? rTabItem[0].GetTabPos() : 1134);
+ if( !nDefDist )
+ return sal_False;
+
+ FOREACHPAM_START(this)
+
+ sal_uLong nSttNd = PCURCRSR->GetMark()->nNode.GetIndex(),
+ nEndNd = PCURCRSR->GetPoint()->nNode.GetIndex();
+
+ if( nSttNd > nEndNd )
+ {
+ sal_uLong nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp;
+ }
+
+ SwCntntNode* pCNd;
+ for( sal_uLong n = nSttNd; bRet && n <= nEndNd; ++n )
+ if( 0 != ( pCNd = GetDoc()->GetNodes()[ n ]->GetTxtNode() ))
+ {
+ const SvxLRSpaceItem& rLS = (SvxLRSpaceItem&)
+ pCNd->GetAttr( RES_LR_SPACE );
+ if( bRight )
+ {
+ long nNext = rLS.GetTxtLeft() + nDefDist;
+ if( bModulus )
+ nNext = ( nNext / nDefDist ) * nDefDist;
+ SwFrm* pFrm = pCNd->getLayoutFrm( GetLayout() );
+ if ( pFrm )
+ {
+ const sal_uInt16 nFrmWidth = static_cast<sal_uInt16>( pFrm->IsVertical() ?
+ pFrm->Frm().Height() :
+ pFrm->Frm().Width() );
+ bRet = nFrmWidth > ( nNext + MM50 );
+ }
+ else
+ bRet = sal_False;
+ }
+ }
+
+ if( !bRet )
+ break;
+
+ FOREACHPAM_END()
+ return bRet;
+}
+
+void SwEditShell::MoveLeftMargin( sal_Bool bRight, sal_Bool bModulus )
+{
+ StartAllAction();
+ StartUndo( UNDO_START );
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
+ {
+ SwPamRanges aRangeArr( *pCrsr );
+ SwPaM aPam( *pCrsr->GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ GetDoc()->MoveLeftMargin( aRangeArr.SetPam( n, aPam ),
+ bRight, bModulus );
+ }
+ else
+ GetDoc()->MoveLeftMargin( *pCrsr, bRight, bModulus );
+
+ EndUndo( UNDO_END );
+ EndAllAction();
+}
+
+
+inline sal_uInt16 lcl_SetScriptFlags( sal_uInt16 nType )
+{
+ sal_uInt16 nRet;
+ switch( nType )
+ {
+ case ::com::sun::star::i18n::ScriptType::LATIN: nRet = SCRIPTTYPE_LATIN; break;
+ case ::com::sun::star::i18n::ScriptType::ASIAN: nRet = SCRIPTTYPE_ASIAN; break;
+ case ::com::sun::star::i18n::ScriptType::COMPLEX: nRet = SCRIPTTYPE_COMPLEX; break;
+ default: nRet = 0;
+ }
+ return nRet;
+}
+
+sal_Bool lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos,
+ sal_uInt16 &rScrpt, sal_Bool bInSelection, sal_Bool bNum )
+{
+ sal_Bool bRet = sal_False;
+ const String& rTxt = rTNd.GetTxt();
+ String sExp;
+
+ // consider numbering
+ if ( bNum )
+ {
+ bRet = sal_False;
+
+ // --> OD 2008-03-19 #refactorlists#
+ if ( rTNd.IsInList() )
+ {
+ ASSERT( rTNd.GetNumRule(),
+ "<lcl_IsNoEndTxtAttrAtPos(..)> - no list style found at text node. Serious defect -> please inform OD." );
+ const SwNumRule* pNumRule = rTNd.GetNumRule();
+ const SwNumFmt &rNumFmt = pNumRule->Get( static_cast<sal_uInt16>(rTNd.GetActualListLevel()) );
+ if( SVX_NUM_BITMAP != rNumFmt.GetNumberingType() )
+ {
+ if ( SVX_NUM_CHAR_SPECIAL == rNumFmt.GetNumberingType() )
+ sExp = rNumFmt.GetBulletChar();
+ else
+ sExp = rTNd.GetNumString();
+ }
+ }
+ }
+
+ // and fields
+ if ( CH_TXTATR_BREAKWORD == rTxt.GetChar( nPos ) )
+ {
+ const SwTxtAttr* const pAttr = rTNd.GetTxtAttrForCharAt( nPos );
+ if (pAttr)
+ {
+ bRet = sal_True; // all other than fields can be
+ // defined as weak-script ?
+ if ( RES_TXTATR_FIELD == pAttr->Which() )
+ {
+ const SwField* const pFld = pAttr->GetFld().GetFld();
+ if (pFld)
+ {
+ sExp += pFld->ExpandField(true);
+ }
+ }
+ }
+ }
+
+ xub_StrLen nEnd = sExp.Len();
+ if ( nEnd )
+ {
+ xub_StrLen n;
+ if( bInSelection )
+ {
+ sal_uInt16 nScript;
+ for( n = 0; n < nEnd; n = (xub_StrLen)
+ pBreakIt->GetBreakIter()->endOfScript( sExp, n, nScript ))
+ {
+ nScript = pBreakIt->GetBreakIter()->getScriptType( sExp, n );
+ rScrpt |= lcl_SetScriptFlags( nScript );
+ }
+ }
+ else
+ rScrpt |= lcl_SetScriptFlags( pBreakIt->GetBreakIter()->
+ getScriptType( sExp, nEnd-1 ));
+ }
+
+ return bRet;
+}
+
+
+// returns the scripttpye of the selection
+sal_uInt16 SwEditShell::GetScriptType() const
+{
+ sal_uInt16 nRet = 0;
+ //if( pBreakIt->GetBreakIter().is() )
+ {
+ FOREACHPAM_START(this)
+
+ const SwPosition *pStt = PCURCRSR->Start(),
+ *pEnd = pStt == PCURCRSR->GetMark()
+ ? PCURCRSR->GetPoint()
+ : PCURCRSR->GetMark();
+ if( pStt == pEnd || *pStt == *pEnd )
+ {
+ const SwTxtNode* pTNd = pStt->nNode.GetNode().GetTxtNode();
+ if( pTNd )
+ {
+ // try to get SwScriptInfo
+ const SwScriptInfo* pScriptInfo = SwScriptInfo::GetScriptInfo( *pTNd );
+
+ xub_StrLen nPos = pStt->nContent.GetIndex();
+ //Task 90448: we need the scripttype of the previous
+ // position, if no selection exist!
+ if( nPos )
+ {
+ SwIndex aIdx( pStt->nContent );
+ if( pTNd->GoPrevious( &aIdx, CRSR_SKIP_CHARS ) )
+ nPos = aIdx.GetIndex();
+ }
+
+ sal_uInt16 nScript;
+
+ if ( pTNd->GetTxt().Len() )
+ {
+ nScript = pScriptInfo ?
+ pScriptInfo->ScriptType( nPos ) :
+ pBreakIt->GetBreakIter()->getScriptType( pTNd->GetTxt(), nPos );
+ }
+ else
+ nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
+
+ if( !lcl_IsNoEndTxtAttrAtPos( *pTNd, nPos, nRet, sal_False, sal_False ))
+ nRet |= lcl_SetScriptFlags( nScript );
+ }
+ }
+ else if ( pBreakIt->GetBreakIter().is() )
+ {
+ sal_uLong nEndIdx = pEnd->nNode.GetIndex();
+ SwNodeIndex aIdx( pStt->nNode );
+ for( ; aIdx.GetIndex() <= nEndIdx; aIdx++ )
+ if( aIdx.GetNode().IsTxtNode() )
+ {
+ const SwTxtNode* pTNd = aIdx.GetNode().GetTxtNode();
+ const String& rTxt = pTNd->GetTxt();
+
+ // try to get SwScriptInfo
+ const SwScriptInfo* pScriptInfo = SwScriptInfo::GetScriptInfo( *pTNd );
+
+ xub_StrLen nChg = aIdx == pStt->nNode
+ ? pStt->nContent.GetIndex()
+ : 0,
+ nEndPos = aIdx == nEndIdx
+ ? pEnd->nContent.GetIndex()
+ : rTxt.Len();
+
+ ASSERT( nEndPos <= rTxt.Len(), "Index outside the range - endless loop!" );
+ if( nEndPos > rTxt.Len() )
+ nEndPos = rTxt.Len();
+
+ sal_uInt16 nScript;
+ while( nChg < nEndPos )
+ {
+ nScript = pScriptInfo ?
+ pScriptInfo->ScriptType( nChg ) :
+ pBreakIt->GetBreakIter()->getScriptType(
+ rTxt, nChg );
+
+ if( !lcl_IsNoEndTxtAttrAtPos( *pTNd, nChg, nRet, sal_True,
+ 0 == nChg && rTxt.Len() == nEndPos ) )
+ nRet |= lcl_SetScriptFlags( nScript );
+
+ if( (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN |
+ SCRIPTTYPE_COMPLEX) == nRet )
+ break;
+
+ xub_StrLen nFldPos = nChg+1;
+
+ nChg = pScriptInfo ?
+ pScriptInfo->NextScriptChg( nChg ) :
+ (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript(
+ rTxt, nChg, nScript );
+
+ nFldPos = rTxt.Search(
+ CH_TXTATR_BREAKWORD, nFldPos );
+ if( nFldPos < nChg )
+ nChg = nFldPos;
+ }
+ if( (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN |
+ SCRIPTTYPE_COMPLEX) == nRet )
+ break;
+ }
+ }
+ if( (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN |
+ SCRIPTTYPE_COMPLEX) == nRet )
+ break;
+
+ FOREACHPAM_END()
+ }
+ if( !nRet )
+ nRet = SvtLanguageOptions::GetScriptTypeOfLanguage( LANGUAGE_SYSTEM );
+ return nRet;
+}
+
+
+sal_uInt16 SwEditShell::GetCurLang() const
+{
+ const SwPaM* pCrsr = GetCrsr();
+ const SwPosition& rPos = *pCrsr->GetPoint();
+ const SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
+ sal_uInt16 nLang;
+ if( pTNd )
+ {
+ //JP 24.9.2001: if exist no selection, then get the language before
+ // the current character!
+ xub_StrLen nPos = rPos.nContent.GetIndex();
+ if( nPos && !pCrsr->HasMark() )
+ --nPos;
+ nLang = pTNd->GetLang( nPos );
+ }
+ else
+ nLang = LANGUAGE_DONTKNOW;
+ return nLang;
+}
+
+sal_uInt16 SwEditShell::GetScalingOfSelectedText() const
+{
+ const SwPaM* pCrsr = GetCrsr();
+ const SwPosition* pStt = pCrsr->Start();
+ const SwTxtNode* pTNd = pStt->nNode.GetNode().GetTxtNode();
+ ASSERT( pTNd, "no textnode available" );
+
+ sal_uInt16 nScaleWidth;
+ if( pTNd )
+ {
+ xub_StrLen nStt = pStt->nContent.GetIndex(), nEnd;
+ const SwPosition* pEnd = pStt == pCrsr->GetPoint()
+ ? pCrsr->GetMark()
+ : pCrsr->GetPoint();
+ if( pStt->nNode == pEnd->nNode )
+ nEnd = pEnd->nContent.GetIndex();
+ else
+ nEnd = pTNd->GetTxt().Len();
+ nScaleWidth = pTNd->GetScalingOfSelectedText( nStt, nEnd );
+ }
+ else
+ nScaleWidth = 100; // default are no scaling -> 100%
+ return nScaleWidth;
+}
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
new file mode 100644
index 000000000000..3289c07f1928
--- /dev/null
+++ b/sw/source/core/edit/eddel.cxx
@@ -0,0 +1,356 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <editsh.hxx>
+#include <cntfrm.hxx>
+#include <pam.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <edimp.hxx>
+#include <IMark.hxx>
+#include <docary.hxx>
+#include <SwRewriter.hxx>
+#include <globals.hrc>
+
+#include <comcore.hrc>
+#include <list>
+
+/************************************************************
+ * Loeschen
+ ************************************************************/
+
+void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo )
+{
+ // nur bei Selektion
+ if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark())
+ return;
+
+ // besteht eine Selection in einer Tabelle ?
+ // dann nur den Inhalt der selektierten Boxen loeschen
+ // jetzt gibt es 2 Faelle die beachtet werden muessen:
+ // 1. Point und Mark stehen in einer Box, Selection normal loeschen
+ // 2. Point und Mark stehen in unterschiedlichen Boxen, alle
+ // selektierten Boxen suchen in den Inhalt loeschen
+ if( rPam.GetNode()->FindTableNode() &&
+ rPam.GetNode()->StartOfSectionNode() !=
+ rPam.GetNode(sal_False)->StartOfSectionNode() )
+ {
+ // in Tabellen das Undo gruppieren
+ if( pUndo && !*pUndo )
+ {
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ *pUndo = sal_True;
+ }
+ SwPaM aDelPam( *rPam.Start() );
+ const SwPosition* pEndSelPos = rPam.End();
+ do {
+ aDelPam.SetMark();
+ SwNode* pNd = aDelPam.GetNode();
+ const SwNode& rEndNd = *pNd->EndOfSectionNode();
+ if( pEndSelPos->nNode.GetIndex() <= rEndNd.GetIndex() )
+ {
+ *aDelPam.GetPoint() = *pEndSelPos;
+ pEndSelPos = 0; // Pointer als Flag missbrauchen
+ }
+ else
+ {
+ // dann ans Ende der Section
+ aDelPam.GetPoint()->nNode = rEndNd;
+ aDelPam.Move( fnMoveBackward, fnGoCntnt );
+ }
+ // geschuetze Boxen ueberspringen !
+ if( !pNd->IsCntntNode() ||
+ !((SwCntntNode*)pNd)->getLayoutFrm( GetLayout() )->IsProtected() )
+ {
+ // alles loeschen
+ GetDoc()->DeleteAndJoin( aDelPam );
+ SaveTblBoxCntnt( aDelPam.GetPoint() );
+ }
+
+ if( !pEndSelPos ) // am Ende der Selection
+ break;
+ aDelPam.DeleteMark();
+ aDelPam.Move( fnMoveForward, fnGoCntnt ); // naechste Box
+ } while( pEndSelPos );
+ }
+ else
+ {
+ // alles loeschen
+ GetDoc()->DeleteAndJoin( rPam );
+ SaveTblBoxCntnt( rPam.GetPoint() );
+ }
+
+ // Selection wird nicht mehr benoetigt.
+ rPam.DeleteMark();
+}
+
+
+long SwEditShell::Delete()
+{
+ SET_CURR_SHELL( this );
+ long nRet = 0;
+ if( !HasReadonlySel() )
+ {
+ StartAllAction();
+
+ sal_Bool bUndo = GetCrsr()->GetNext() != GetCrsr();
+ if( bUndo ) // mehr als eine Selection ?
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, String(SW_RES(STR_MULTISEL)));
+
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_DELETE, &aRewriter);
+ }
+
+ FOREACHPAM_START(this)
+ DeleteSel( *PCURCRSR, &bUndo );
+ FOREACHPAM_END()
+
+ // falls eine Undo-Klammerung, dann hier beenden
+ if( bUndo )
+ {
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
+ EndAllAction();
+ nRet = 1;
+ }
+ return nRet;
+}
+
+long SwEditShell::Copy( SwEditShell* pDestShell )
+{
+ if( !pDestShell )
+ pDestShell = this;
+
+ SET_CURR_SHELL( pDestShell );
+
+ // List of insert positions for smart insert of block selections
+ std::list< boost::shared_ptr<SwPosition> > aInsertList;
+
+ // Fill list of insert positions
+ {
+ SwPosition * pPos = 0;
+ boost::shared_ptr<SwPosition> pInsertPos;
+ sal_uInt16 nMove = 0;
+ FOREACHPAM_START(this)
+
+ if( !pPos )
+ {
+ if( pDestShell == this )
+ {
+ // First cursor represents the target position!!
+ PCURCRSR->DeleteMark();
+ pPos = (SwPosition*)PCURCRSR->GetPoint();
+ continue;
+ }
+ else
+ pPos = pDestShell->GetCrsr()->GetPoint();
+ }
+ if( IsBlockMode() )
+ { // In block mode different insert positions will be calculated
+ // by simulated cursor movements from the given first insert position
+ if( nMove )
+ {
+ SwCursor aCrsr( *pPos, 0, false);
+ if( aCrsr.UpDown( sal_False, nMove, 0, 0 ) )
+ {
+ pInsertPos.reset( new SwPosition( *aCrsr.GetPoint() ) );
+ aInsertList.push_back( pInsertPos );
+ }
+ }
+ else
+ pInsertPos.reset( new SwPosition( *pPos ) );
+ ++nMove;
+ }
+ SwPosition *pTmp = IsBlockMode() ? pInsertPos.get() : pPos;
+ // Check if a selection would be copied into itself
+ if( pDestShell->GetDoc() == GetDoc() &&
+ *PCURCRSR->Start() <= *pTmp && *pTmp < *PCURCRSR->End() )
+ return sal_False;
+ FOREACHPAM_END()
+ }
+
+ pDestShell->StartAllAction();
+ SwPosition *pPos = 0;
+ sal_Bool bRet = sal_False;
+ sal_Bool bFirstMove = sal_True;
+ SwNodeIndex aSttNdIdx( pDestShell->GetDoc()->GetNodes() );
+ xub_StrLen nSttCntIdx = 0;
+ // For block selection this list is filled with the insert positions
+ std::list< boost::shared_ptr<SwPosition> >::iterator pNextInsert = aInsertList.begin();
+
+ pDestShell->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ FOREACHPAM_START(this)
+
+ if( !pPos )
+ {
+ if( pDestShell == this )
+ {
+ // First cursor represents the target position!!
+ PCURCRSR->DeleteMark();
+ pPos = (SwPosition*)PCURCRSR->GetPoint();
+ continue;
+ }
+ else
+ pPos = pDestShell->GetCrsr()->GetPoint();
+ }
+ if( !bFirstMove )
+ {
+ if( pNextInsert != aInsertList.end() )
+ {
+ pPos = pNextInsert->get();
+ ++pNextInsert;
+ }
+ else if( IsBlockMode() )
+ GetDoc()->SplitNode( *pPos, false );
+ }
+
+ // nur bei Selektion (nicht Textnodes haben Selection,
+ // aber Point/GetMark sind gleich
+ if( !PCURCRSR->HasMark() || *PCURCRSR->GetPoint() == *PCURCRSR->GetMark() )
+ continue;
+
+ if( bFirstMove )
+ {
+ // Anfangs-Position vom neuen Bereich merken
+ aSttNdIdx = pPos->nNode.GetIndex()-1;
+ nSttCntIdx = pPos->nContent.GetIndex();
+ bFirstMove = sal_False;
+ }
+
+ const bool bSuccess( GetDoc()->CopyRange( *PCURCRSR, *pPos, false ) );
+ if (!bSuccess)
+ continue;
+
+ SwPaM aInsertPaM(*pPos, SwPosition(aSttNdIdx));
+ pDestShell->GetDoc()->MakeUniqueNumRules(aInsertPaM);
+
+ bRet = sal_True;
+ FOREACHPAM_END()
+
+
+ // Maybe nothing has been moved?
+ if( !bFirstMove )
+ {
+ SwPaM* pCrsr = pDestShell->GetCrsr();
+ pCrsr->SetMark();
+ pCrsr->GetPoint()->nNode = aSttNdIdx.GetIndex()+1;
+ pCrsr->GetPoint()->nContent.Assign( pCrsr->GetCntntNode(),nSttCntIdx);
+ pCrsr->Exchange();
+ }
+ else
+ {
+ // falls beim Move der Cursor "gewandert" ist, so setze hier auch
+ // seinen GetMark um, damit dieser nie in den Wald zeigt.
+ pDestShell->GetCrsr()->SetMark();
+ pDestShell->GetCrsr()->DeleteMark();
+ }
+#if OSL_DEBUG_LEVEL > 1
+// pruefe ob die Indizies auch in den richtigen Nodes angemeldet sind
+{
+ SwPaM* pCmp = (SwPaM*)pDestShell->GetCrsr(); // sicher den Pointer auf Cursor
+ do {
+ ASSERT( pCmp->GetPoint()->nContent.GetIdxReg()
+ == pCmp->GetCntntNode(), "Point im falschen Node" );
+ ASSERT( pCmp->GetMark()->nContent.GetIdxReg()
+ == pCmp->GetCntntNode(sal_False), "Mark im falschen Node" );
+ sal_Bool bTst = *pCmp->GetPoint() == *pCmp->GetMark();
+ (void) bTst;
+ } while( pDestShell->GetCrsr() != ( pCmp = (SwPaM*)pCmp->GetNext() ) );
+}
+#endif
+
+ // Undo-Klammerung hier beenden
+ pDestShell->GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ pDestShell->EndAllAction();
+
+ pDestShell->SaveTblBoxCntnt( pDestShell->GetCrsr()->GetPoint() );
+
+ return (long)bRet;
+}
+
+
+ // Ersetz einen selektierten Bereich in einem TextNode mit dem
+ // String. Ist fuers Suchen&Ersetzen gedacht.
+ // bRegExpRplc - ersetze Tabs (\\t) und setze den gefundenen String
+ // ein ( nicht \& )
+ // z.B.: Fnd: "zzz", Repl: "xx\t\\t..&..\&"
+ // --> "xx\t<Tab>..zzz..&"
+sal_Bool SwEditShell::Replace( const String& rNewStr, sal_Bool bRegExpRplc )
+{
+ SET_CURR_SHELL( this );
+
+ sal_Bool bRet = sal_False;
+ if( !HasReadonlySel() )
+ {
+ StartAllAction();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+
+ FOREACHPAM_START(this)
+ if( PCURCRSR->HasMark() && *PCURCRSR->GetMark() != *PCURCRSR->GetPoint() )
+ {
+ bRet = GetDoc()->ReplaceRange( *PCURCRSR, rNewStr, bRegExpRplc )
+ || bRet;
+ SaveTblBoxCntnt( PCURCRSR->GetPoint() );
+ }
+ FOREACHPAM_END()
+
+ // Undo-Klammerung hier beenden
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+ EndAllAction();
+ }
+ return bRet;
+}
+
+
+ // Special-Methode fuer JOE's- Wizzards
+sal_Bool SwEditShell::DelFullPara()
+{
+ sal_Bool bRet = sal_False;
+ if( !IsTableMode() )
+ {
+ SwPaM* pCrsr = GetCrsr();
+ // keine Mehrfach-Selection
+ if( pCrsr->GetNext() == pCrsr && !HasReadonlySel() )
+ {
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ bRet = GetDoc()->DelFullPara( *pCrsr );
+ EndAllAction();
+ }
+ }
+ return bRet;
+}
+
+
+
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
new file mode 100644
index 000000000000..838abeb659bd
--- /dev/null
+++ b/sw/source/core/edit/edfcol.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <editeng/brkitem.hxx>
+#include <editsh.hxx>
+#include <doc.hxx> // fuer SwTxtFmtColls
+#include <IDocumentUndoRedo.hxx>
+#include <edimp.hxx> // fuer MACROS
+#include <ndtxt.hxx>
+#include <paratr.hxx>
+#include <fmtpdsc.hxx>
+// --> FME 2004-06-29 #114856# Formular view
+#include <viewopt.hxx>
+// <--
+#include <SwRewriter.hxx>
+#include <numrule.hxx>
+#include <swundo.hxx>
+
+/*************************************
+ * FormatColl
+ *************************************/
+// TXT
+
+
+SwTxtFmtColl& SwEditShell::GetDfltTxtFmtColl() const
+{
+ return *((SwTxtFmtColl*) (GetDoc()->GetDfltTxtFmtColl()));
+}
+
+
+sal_uInt16 SwEditShell::GetTxtFmtCollCount() const
+{
+ return GetDoc()->GetTxtFmtColls()->Count();
+}
+
+
+SwTxtFmtColl& SwEditShell::GetTxtFmtColl( sal_uInt16 nFmtColl) const
+{
+ return *((*(GetDoc()->GetTxtFmtColls()))[nFmtColl]);
+}
+
+// --> OD 2007-11-06 #i62675#
+void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt,
+ bool bResetListAttrs )
+{
+ SwTxtFmtColl *pLocal = pFmt? pFmt: (*GetDoc()->GetTxtFmtColls())[0];
+ StartAllAction();
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, pLocal->GetName());
+
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter);
+ FOREACHPAM_START(this)
+
+ if( !PCURCRSR->HasReadonlySel(
+ // --> FME 2004-06-29 #114856# Formular view
+ GetViewOptions()->IsFormView() ) )
+ // <--
+ GetDoc()->SetTxtFmtColl( *PCURCRSR, pLocal, true, bResetListAttrs );
+
+ FOREACHPAM_END()
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, &aRewriter);
+ EndAllAction();
+}
+// <--
+
+
+SwTxtFmtColl* SwEditShell::MakeTxtFmtColl(const String& rFmtCollName,
+ SwTxtFmtColl* pParent)
+{
+ SwTxtFmtColl *pColl;
+ if ( pParent == 0 )
+ pParent = &GetTxtFmtColl(0);
+ if ( (pColl=GetDoc()->MakeTxtFmtColl(rFmtCollName, pParent)) == 0 )
+ {
+ ASSERT( sal_False, "MakeTxtFmtColl failed" )
+ }
+ return pColl;
+
+}
+
+
+void SwEditShell::FillByEx(SwTxtFmtColl* pColl, sal_Bool bReset)
+{
+ if( bReset )
+ {
+ // --> OD 2007-01-25 #i73790# - method renamed
+ pColl->ResetAllFmtAttr();
+ // <--
+ }
+
+ SwPaM * pCrsr = GetCrsr();
+ SwCntntNode * pCnt = pCrsr->GetCntntNode();
+ const SfxItemSet* pSet = pCnt->GetpSwAttrSet();
+ if( pSet )
+ {
+ // JP 05.10.98: falls eines der Attribute Break/PageDesc/NumRule(auto)
+ // im ItemSet steht, so entferne die VORM setzen an der Collection.
+ // Ansonst wird zu viel gemacht oder falsche gemacht (NumRules!)
+ // Bug 57568
+
+ // AutoNumRules NICHT in die Vorlagen uebernehmen
+ const SfxPoolItem* pItem;
+ const SwNumRule* pRule = 0;
+ if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False ) ||
+ SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC,sal_False ) ||
+ ( SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_NUMRULE,
+ sal_False, &pItem ) && 0 != (pRule = GetDoc()->FindNumRulePtr(
+ ((SwNumRuleItem*)pItem)->GetValue() )) &&
+ pRule && pRule->IsAutoRule() )
+ )
+ {
+ SfxItemSet aSet( *pSet );
+ aSet.ClearItem( RES_BREAK );
+ aSet.ClearItem( RES_PAGEDESC );
+
+ if( pRule || (SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_NUMRULE,
+ sal_False, &pItem ) && 0 != (pRule = GetDoc()->FindNumRulePtr(
+ ((SwNumRuleItem*)pItem)->GetValue() )) &&
+ pRule && pRule->IsAutoRule() ))
+ aSet.ClearItem( RES_PARATR_NUMRULE );
+
+ if( aSet.Count() )
+ GetDoc()->ChgFmt(*pColl, aSet );
+ }
+ else
+ GetDoc()->ChgFmt(*pColl, *pSet );
+ }
+}
+
+
+
+
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
new file mode 100644
index 000000000000..3ed48bdf387f
--- /dev/null
+++ b/sw/source/core/edit/edfld.cxx
@@ -0,0 +1,564 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <unotools/charclass.hxx>
+#include <editsh.hxx>
+#include <fldbas.hxx>
+#include <ndtxt.hxx> // GetCurFld
+#include <doc.hxx>
+#include <docary.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <edimp.hxx>
+#include <dbfld.hxx>
+#include <expfld.hxx>
+#include <flddat.hxx>
+#include <swundo.hxx>
+#include <dbmgr.hxx>
+#include <swddetbl.hxx>
+#include <hints.hxx>
+#include <switerator.hxx>
+#include <fieldhint.hxx>
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen zu einer ResId zaehlen
+ wenn 0 alle zaehlen
+ --------------------------------------------------------------------*/
+
+sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, sal_Bool bUsed ) const
+{
+ const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
+ const sal_uInt16 nSize = pFldTypes->Count();
+
+ if(nResId == USHRT_MAX)
+ {
+ if(!bUsed)
+ return nSize;
+ else
+ {
+ sal_uInt16 nUsed = 0;
+ for ( sal_uInt16 i = 0; i < nSize; i++ )
+ {
+ if(IsUsed(*(*pFldTypes)[i]))
+ nUsed++;
+ }
+ return nUsed;
+ }
+ }
+
+ // Alle Typen mit gleicher ResId
+ sal_uInt16 nIdx = 0;
+ for(sal_uInt16 i = 0; i < nSize; ++i)
+ { // Gleiche ResId -> Index erhoehen
+ SwFieldType& rFldType = *((*pFldTypes)[i]);
+ if(rFldType.Which() == nResId)
+ nIdx++;
+ }
+ return nIdx;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen zu einer ResId finden
+ wenn 0 alle finden
+ --------------------------------------------------------------------*/
+SwFieldType* SwEditShell::GetFldType(sal_uInt16 nFld, sal_uInt16 nResId, sal_Bool bUsed ) const
+{
+ const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
+ const sal_uInt16 nSize = pFldTypes->Count();
+
+ if(nResId == USHRT_MAX && nFld < nSize)
+ {
+ if(!bUsed)
+ return (*pFldTypes)[nFld];
+ else
+ {
+ sal_uInt16 i, nUsed = 0;
+ for ( i = 0; i < nSize; i++ )
+ {
+ if(IsUsed(*(*pFldTypes)[i]))
+ {
+ if(nUsed == nFld)
+ break;
+ nUsed++;
+ }
+ }
+ return i < nSize ? (*pFldTypes)[i] : 0;
+ }
+ }
+
+ sal_uInt16 nIdx = 0;
+ for(sal_uInt16 i = 0; i < nSize; ++i)
+ { // Gleiche ResId -> Index erhoehen
+ SwFieldType* pFldType = (*pFldTypes)[i];
+ if(pFldType->Which() == nResId)
+ {
+ if (!bUsed || IsUsed(*pFldType))
+ {
+ if(nIdx == nFld)
+ return pFldType;
+ nIdx++;
+ }
+ }
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Den ersten Typen mit ResId und Namen finden
+ --------------------------------------------------------------------*/
+SwFieldType* SwEditShell::GetFldType(sal_uInt16 nResId, const String& rName) const
+{
+ return GetDoc()->GetFldType( nResId, rName, false );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen loeschen
+ --------------------------------------------------------------------*/
+void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId)
+{
+ if( USHRT_MAX == nResId )
+ {
+ GetDoc()->RemoveFldType(nFld);
+ return;
+ }
+
+ const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
+ const sal_uInt16 nSize = pFldTypes->Count();
+ sal_uInt16 nIdx = 0;
+ for( sal_uInt16 i = 0; i < nSize; ++i )
+ // Gleiche ResId -> Index erhoehen
+ if( (*pFldTypes)[i]->Which() == nResId &&
+ nIdx++ == nFld )
+ {
+ GetDoc()->RemoveFldType( i );
+ return;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: FieldType ueber Name loeschen
+ --------------------------------------------------------------------*/
+void SwEditShell::RemoveFldType(sal_uInt16 nResId, const String& rStr)
+{
+ const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
+ const sal_uInt16 nSize = pFldTypes->Count();
+ const CharClass& rCC = GetAppCharClass();
+
+ String aTmp( rCC.lower( rStr ));
+
+ for(sal_uInt16 i = 0; i < nSize; ++i)
+ {
+ // Gleiche ResId -> Index erhoehen
+ SwFieldType* pFldType = (*pFldTypes)[i];
+ if( pFldType->Which() == nResId )
+ {
+ if( aTmp.Equals( rCC.lower( pFldType->GetName() ) ))
+ {
+ GetDoc()->RemoveFldType(i);
+ return;
+ }
+ }
+ }
+}
+
+
+void SwEditShell::FieldToText( SwFieldType* pType )
+{
+ if( !pType->GetDepends() )
+ return;
+
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ StartUndo( UNDO_DELETE );
+ Push();
+ SwPaM* pPaM = GetCrsr();
+
+ SwFieldHint aHint( pPaM );
+ SwClientIter aIter( *pType );
+ for ( SwClient* pClient = aIter.GoStart(); pClient; aIter++ )
+ {
+ pPaM->DeleteMark();
+ pClient->SwClientNotifyCall( *pType, aHint );
+ }
+
+ Pop( sal_False );
+ EndAllAction();
+ EndUndo( UNDO_DELETE );
+}
+
+/*************************************************************************
+|*
+|* SwEditShell::Insert( SwField )
+|*
+|* Beschreibung an der Cursorposition ein Feld einfuegen
+|* Quelle: vgl. SwEditShell::Insert( String )
+|*
+*************************************************************************/
+void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints)
+{
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ SwFmtFld aFld( rFld );
+
+ const SetAttrMode nInsertFlags = (bForceExpandHints)
+ ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ : nsSetAttrMode::SETATTR_DEFAULT;
+
+ FOREACHPAM_START(this) // fuer jeden PaM
+ bool bSuccess(GetDoc()->InsertPoolItem(*PCURCRSR, aFld, nInsertFlags));
+ ASSERT( bSuccess, "Doc->Insert(Field) failed");
+ (void) bSuccess;
+ FOREACHPAM_END() // fuer jeden PaM
+
+ EndAllAction();
+}
+
+/*************************************************************************
+|*
+|* SwEditShell::GetCurFld()
+|*
+|* Beschreibung Stehen die PaMs auf Feldern ?
+|* Quelle: edtfrm.cxx:
+|*
+*************************************************************************/
+
+inline SwTxtFld *GetDocTxtFld( const SwPosition* pPos )
+{
+ SwTxtNode * const pNode = pPos->nNode.GetNode().GetTxtNode();
+ return (pNode)
+ ? static_cast<SwTxtFld*>( pNode->GetTxtAttrForCharAt(
+ pPos->nContent.GetIndex(), RES_TXTATR_FIELD ))
+ : 0;
+}
+
+SwField* SwEditShell::GetCurFld() const
+{
+ // Wenn es keine Selektionen gibt, gilt der Wert der aktuellen
+ // Cursor-Position.
+
+ SwPaM* pCrsr = GetCrsr();
+ SwTxtFld *pTxtFld = GetDocTxtFld( pCrsr->Start() );
+ SwField *pCurFld = NULL;
+
+ /* #108536# Field was only recognized if no selection was
+ present. Now it is recognized if either the cursor is in the
+ field or the selection spans exactly over the field. */
+ if( pTxtFld &&
+ pCrsr->GetNext() == pCrsr &&
+ pCrsr->Start()->nNode == pCrsr->End()->nNode &&
+ (pCrsr->End()->nContent.GetIndex() -
+ pCrsr->Start()->nContent.GetIndex()) <= 1)
+ {
+ pCurFld = (SwField*)pTxtFld->GetFld().GetFld();
+ // TabellenFormel ? wandel internen in externen Namen um
+ if( RES_TABLEFLD == pCurFld->GetTyp()->Which() )
+ {
+ const SwTableNode* pTblNd = IsCrsrInTbl();
+ ((SwTblField*)pCurFld)->PtrToBoxNm( pTblNd ? &pTblNd->GetTable() : 0 );
+ }
+
+ }
+
+ /* #108536# removed handling of multi-selections */
+
+ return pCurFld;
+}
+
+
+/*************************************************************************
+|*
+|* SwEditShell::UpdateFlds()
+|*
+|* Beschreibung Stehen die PaMs auf Feldern ?
+|* BP 12.05.92
+|*
+*************************************************************************/
+SwTxtFld* lcl_FindInputFld( SwDoc* pDoc, SwField& rFld )
+{
+ // suche das Feld ueber seine Addresse. Muss fuer InputFelder in
+ // geschuetzten Feldern erfolgen
+ SwTxtFld* pTFld = 0;
+ if( RES_INPUTFLD == rFld.Which() || ( RES_SETEXPFLD == rFld.Which() &&
+ ((SwSetExpField&)rFld).GetInputFlag() ) )
+ {
+ const SfxPoolItem* pItem;
+ sal_uInt32 n, nMaxItems =
+ pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
+ for( n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem =
+ pDoc->GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) )
+ && ((SwFmtFld*)pItem)->GetFld() == &rFld )
+ {
+ pTFld = ((SwFmtFld*)pItem)->GetTxtFld();
+ break;
+ }
+ }
+ return pTFld;
+}
+
+void SwEditShell::UpdateFlds( SwField &rFld )
+{
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ {
+ SwField *pCurFld = 0;
+
+ // Wenn es keine Selektionen gibt, gilt der Wert der aktuellen
+ // Cursor-Position.
+ SwMsgPoolItem* pMsgHnt = 0;
+ SwRefMarkFldUpdate aRefMkHt( GetOut() );
+ sal_uInt16 nFldWhich = rFld.GetTyp()->Which();
+ if( RES_GETREFFLD == nFldWhich )
+ pMsgHnt = &aRefMkHt;
+
+ SwPaM* pCrsr = GetCrsr();
+ SwTxtFld *pTxtFld;
+ SwFmtFld *pFmtFld;
+
+// if( pCrsr->GetNext() == pCrsr && !pCrsr->HasMark() &&
+// ( 0 != ( pTxtFld = GetDocTxtFld( pCrsr->Start() ) ) ||
+// 0 != ( pTxtFld = lcl_FindInputFld( GetDoc(), rFld ) ) ) &&
+// ( pFmtFld = (SwFmtFld*)&pTxtFld->GetFld())->GetFld()
+// ->GetTyp()->Which() == rFld.GetTyp()->Which() )
+ if ( pCrsr->GetNext() == pCrsr && !pCrsr->HasMark())
+ {
+ pTxtFld = GetDocTxtFld(pCrsr->Start());
+
+ if (!pTxtFld) // #i30221#
+ pTxtFld = lcl_FindInputFld( GetDoc(), rFld);
+
+ if (pTxtFld != 0)
+ GetDoc()->UpdateFld(pTxtFld, rFld, pMsgHnt, sal_True); // #111840#
+ }
+
+ // bOkay (statt return wg. EndAllAction) wird sal_False,
+ // 1) wenn nur ein Pam mehr als ein Feld enthaelt oder
+ // 2) bei gemischten Feldtypen
+ sal_Bool bOkay = sal_True;
+ sal_Bool bTblSelBreak = sal_False;
+
+ SwMsgPoolItem aHint( RES_TXTATR_FIELD ); // Such-Hint
+ FOREACHPAM_START(this) // fuer jeden PaM
+ if( PCURCRSR->HasMark() && bOkay ) // ... mit Selektion
+ {
+ // Kopie des PaM
+ SwPaM aCurPam( *PCURCRSR->GetMark(), *PCURCRSR->GetPoint() );
+ SwPaM aPam( *PCURCRSR->GetPoint() );
+
+ SwPosition *pCurStt = aCurPam.Start(), *pCurEnd =
+ aCurPam.End();
+ /*
+ * Fuer den Fall, dass zwei aneinanderliegende Felder in einem
+ * PaM liegen, hangelt sich aPam portionsweise bis zum Ende.
+ * aCurPam wird dabei nach jeder Schleifenrunde verkuerzt.
+ * Wenn aCurPam vollstaendig durchsucht wurde, ist Start = End
+ * und die Schleife terminiert.
+ */
+
+ // Suche nach SwTxtFld ...
+ while( bOkay
+ && pCurStt->nContent != pCurEnd->nContent
+ && aPam.Find( aHint, sal_False, fnMoveForward, &aCurPam ) )
+ {
+ // wenn nur ein Pam mehr als ein Feld enthaelt ...
+ if( aPam.Start()->nContent != pCurStt->nContent )
+ bOkay = sal_False;
+
+ if( 0 != (pTxtFld = GetDocTxtFld( pCurStt )) )
+ {
+ pFmtFld = (SwFmtFld*)&pTxtFld->GetFld();
+ pCurFld = pFmtFld->GetFld();
+
+ // bei gemischten Feldtypen
+ if( pCurFld->GetTyp()->Which() !=
+ rFld.GetTyp()->Which() )
+ bOkay = sal_False;
+
+ bTblSelBreak = GetDoc()->UpdateFld(pTxtFld, rFld,
+ pMsgHnt, sal_False); // #111840#
+ }
+ // Der Suchbereich wird um den gefundenen Bereich
+ // verkuerzt.
+ pCurStt->nContent++;
+ }
+ }
+
+ if( bTblSelBreak ) // wenn Tabellen Selektion und Tabellen-
+ break; // Formel aktualisiert wurde -> beenden
+
+ FOREACHPAM_END() // fuer jeden PaM
+ }
+ GetDoc()->SetModified();
+ EndAllAction();
+}
+
+/*-----------------13.05.92 10:54-------------------
+ Liefert den logischen fuer die Datenbank zurueck
+ --------------------------------------------------*/
+
+SwDBData SwEditShell::GetDBData() const
+{
+ return GetDoc()->GetDBData();
+}
+
+const SwDBData& SwEditShell::GetDBDesc() const
+{
+ return GetDoc()->GetDBDesc();
+}
+
+void SwEditShell::ChgDBData(const SwDBData& rNewData)
+{
+ GetDoc()->ChgDBData(rNewData);
+}
+
+void SwEditShell::GetAllUsedDB( SvStringsDtor& rDBNameList,
+ SvStringsDtor* pAllDBNames )
+{
+ GetDoc()->GetAllUsedDB( rDBNameList, pAllDBNames );
+}
+
+void SwEditShell::ChangeDBFields( const SvStringsDtor& rOldNames,
+ const String& rNewName )
+{
+ GetDoc()->ChangeDBFields( rOldNames, rNewName );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Alle Expression-Felder erneuern
+ --------------------------------------------------------------------*/
+void SwEditShell::UpdateExpFlds(sal_Bool bCloseDB)
+{
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ GetDoc()->UpdateExpFlds(NULL, true);
+ if (bCloseDB)
+ GetDoc()->GetNewDBMgr()->CloseAll(); // Alle Datenbankverbindungen dichtmachen
+ EndAllAction();
+}
+
+SwNewDBMgr* SwEditShell::GetNewDBMgr() const
+{
+ return GetDoc()->GetNewDBMgr();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen einfuegen
+ --------------------------------------------------------------------*/
+SwFieldType* SwEditShell::InsertFldType(const SwFieldType& rFldType)
+{
+ return GetDoc()->InsertFldType(rFldType);
+}
+
+void SwEditShell::LockExpFlds()
+{
+ GetDoc()->LockExpFlds();
+}
+
+void SwEditShell::UnlockExpFlds()
+{
+ GetDoc()->UnlockExpFlds();
+}
+
+
+void SwEditShell::SetFldUpdateFlags( SwFldUpdateFlags eFlags )
+{
+ getIDocumentSettingAccess()->setFieldUpdateFlags( eFlags );
+}
+
+SwFldUpdateFlags SwEditShell::GetFldUpdateFlags(sal_Bool bDocSettings) const
+{
+ return getIDocumentSettingAccess()->getFieldUpdateFlags( !bDocSettings );
+}
+
+void SwEditShell::SetFixFields( sal_Bool bOnlyTimeDate,
+ const DateTime* pNewDateTime )
+{
+ SET_CURR_SHELL( this );
+ sal_Bool bUnLockView = !IsViewLocked();
+ LockView( sal_True );
+ StartAllAction();
+ GetDoc()->SetFixFields( bOnlyTimeDate, pNewDateTime );
+ EndAllAction();
+ if( bUnLockView )
+ LockView( sal_False );
+}
+
+void SwEditShell::SetLabelDoc( sal_Bool bFlag )
+{
+ GetDoc()->set(IDocumentSettingAccess::LABEL_DOCUMENT, bFlag );
+}
+
+sal_Bool SwEditShell::IsLabelDoc() const
+{
+ return getIDocumentSettingAccess()->get(IDocumentSettingAccess::LABEL_DOCUMENT);
+}
+/* -----------------------------21.12.99 12:53--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwEditShell::ChangeAuthorityData(const SwAuthEntry* pNewData)
+{
+ GetDoc()->ChangeAuthorityData(pNewData);
+}
+/* -----------------------------03.08.2001 12:04------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwEditShell::IsAnyDatabaseFieldInDoc()const
+{
+ const SwFldTypes * pFldTypes = GetDoc()->GetFldTypes();
+ const sal_uInt16 nSize = pFldTypes->Count();
+ for(sal_uInt16 i = 0; i < nSize; ++i)
+ {
+ SwFieldType& rFldType = *((*pFldTypes)[i]);
+ sal_uInt16 nWhich = rFldType.Which();
+ if(IsUsed(rFldType))
+ {
+ switch(nWhich)
+ {
+ case RES_DBFLD:
+ case RES_DBNEXTSETFLD:
+ case RES_DBNUMSETFLD:
+ case RES_DBSETNUMBERFLD:
+ {
+ SwIterator<SwFmtFld,SwFieldType> aIter( rFldType );
+ SwFmtFld* pFld = aIter.First();
+ while(pFld)
+ {
+ if(pFld->IsFldInDoc())
+ return sal_True;
+ pFld = aIter.Next();
+ }
+ }
+ break;
+ }
+ }
+ }
+ return sal_False;
+}
diff --git a/sw/source/core/edit/edfldexp.cxx b/sw/source/core/edit/edfldexp.cxx
new file mode 100644
index 000000000000..ae3aed3f1ea6
--- /dev/null
+++ b/sw/source/core/edit/edfldexp.cxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <editsh.hxx>
+#include <dbfld.hxx>
+#include <dbmgr.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <ndtxt.hxx> // GetCurFld
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <edimp.hxx>
+#include <flddat.hxx>
+#include <switerator.hxx>
+
+using namespace com::sun::star;
+using ::rtl::OUString;
+
+sal_Bool SwEditShell::IsFieldDataSourceAvailable(String& rUsedDataSource) const
+{
+ const SwFldTypes * pFldTypes = GetDoc()->GetFldTypes();
+ const sal_uInt16 nSize = pFldTypes->Count();
+ uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( !xMgr.is() )
+ return sal_False;
+ uno::Reference<uno::XInterface> xInstance = xMgr->createInstance( OUString::createFromAscii( "com.sun.star.sdb.DatabaseContext" ));
+ uno::Reference<container::XNameAccess> xDBContext(xInstance, uno::UNO_QUERY) ;
+ if(!xDBContext.is())
+ return sal_False;
+ for(sal_uInt16 i = 0; i < nSize; ++i)
+ {
+ SwFieldType& rFldType = *((*pFldTypes)[i]);
+ sal_uInt16 nWhich = rFldType.Which();
+ if(IsUsed(rFldType))
+ {
+ switch(nWhich)
+ {
+ case RES_DBFLD:
+ {
+ SwIterator<SwFmtFld,SwFieldType> aIter( rFldType );
+ SwFmtFld* pFld = aIter.First();
+ while(pFld)
+ {
+ if(pFld->IsFldInDoc())
+ {
+ const SwDBData& rData =
+ ((SwDBFieldType*)pFld->GetFld()->GetTyp())->GetDBData();
+ try
+ {
+ return xDBContext->getByName(rData.sDataSource).hasValue();
+ }
+ catch(uno::Exception const &)
+ {
+ rUsedDataSource = rData.sDataSource;
+ return sal_False;
+ }
+ }
+ pFld = aIter.Next();
+ }
+ }
+ break;
+ }
+ }
+ }
+ return sal_True;
+}
+
+
diff --git a/sw/source/core/edit/edfmt.cxx b/sw/source/core/edit/edfmt.cxx
new file mode 100644
index 000000000000..225a1df48c74
--- /dev/null
+++ b/sw/source/core/edit/edfmt.cxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "doc.hxx"
+#include "editsh.hxx"
+#include "swtable.hxx"
+#include "pam.hxx"
+#include <docary.hxx>
+#include <fchrfmt.hxx>
+#include <frmfmt.hxx>
+#include <charfmt.hxx>
+#include "ndtxt.hxx" // Fuer GetXXXFmt
+#include "hints.hxx"
+
+/*************************************
+ * Formate
+ *************************************/
+// Char
+// OPT: inline
+
+
+sal_uInt16 SwEditShell::GetCharFmtCount() const
+{
+ return GetDoc()->GetCharFmts()->Count();
+}
+
+
+SwCharFmt& SwEditShell::GetCharFmt(sal_uInt16 nFmt) const
+{
+ return *((*(GetDoc()->GetCharFmts()))[nFmt]);
+}
+
+
+SwCharFmt* SwEditShell::GetCurCharFmt() const
+{
+ SwCharFmt *pFmt = 0;
+ SfxItemSet aSet( GetDoc()->GetAttrPool(), RES_TXTATR_CHARFMT,
+ RES_TXTATR_CHARFMT );
+ const SfxPoolItem* pItem;
+ if( GetCurAttr( aSet ) && SFX_ITEM_SET ==
+ aSet.GetItemState( RES_TXTATR_CHARFMT, sal_False, &pItem ) )
+ pFmt = ((SwFmtCharFmt*)pItem)->GetCharFmt();
+
+ return pFmt;
+}
+
+
+void SwEditShell::FillByEx(SwCharFmt* pCharFmt, sal_Bool bReset)
+{
+ if ( bReset )
+ {
+ // --> OD 2007-01-25 #i73790# - method renamed
+ pCharFmt->ResetAllFmtAttr();
+ // <--
+ }
+
+ SwPaM* pPam = GetCrsr();
+ const SwCntntNode* pCNd = pPam->GetCntntNode();
+ if( pCNd->IsTxtNode() )
+ {
+ xub_StrLen nStt, nEnd;
+ if( pPam->HasMark() )
+ {
+ const SwPosition* pPtPos = pPam->GetPoint();
+ const SwPosition* pMkPos = pPam->GetMark();
+ if( pPtPos->nNode == pMkPos->nNode ) // im selben Node ?
+ {
+ nStt = pPtPos->nContent.GetIndex();
+ if( nStt < pMkPos->nContent.GetIndex() )
+ nEnd = pMkPos->nContent.GetIndex();
+ else
+ {
+ nEnd = nStt;
+ nStt = pMkPos->nContent.GetIndex();
+ }
+ }
+ else
+ {
+ nStt = pMkPos->nContent.GetIndex();
+ if( pPtPos->nNode < pMkPos->nNode )
+ {
+ nEnd = nStt;
+ nStt = 0;
+ }
+ else
+ nEnd = ((SwTxtNode*)pCNd)->GetTxt().Len();
+ }
+ }
+ else
+ nStt = nEnd = pPam->GetPoint()->nContent.GetIndex();
+
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ pCharFmt->GetAttrSet().GetRanges() );
+ ((SwTxtNode*)pCNd)->GetAttr( aSet, nStt, nEnd );
+ pCharFmt->SetFmtAttr( aSet );
+ }
+ else if( pCNd->HasSwAttrSet() )
+ pCharFmt->SetFmtAttr( *pCNd->GetpSwAttrSet() );
+}
+
+// Frm
+sal_uInt16 SwEditShell::GetTblFrmFmtCount(sal_Bool bUsed) const
+{
+ return GetDoc()->GetTblFrmFmtCount(bUsed);
+}
+
+SwFrmFmt& SwEditShell::GetTblFrmFmt(sal_uInt16 nFmt, sal_Bool bUsed ) const
+{
+ return GetDoc()->GetTblFrmFmt(nFmt, bUsed );
+}
+
+String SwEditShell::GetUniqueTblName() const
+{
+ return GetDoc()->GetUniqueTblName();
+}
+
+
+SwCharFmt* SwEditShell::MakeCharFmt( const String& rName,
+ SwCharFmt* pDerivedFrom )
+{
+ if( !pDerivedFrom )
+ pDerivedFrom = GetDoc()->GetDfltCharFmt();
+
+ return GetDoc()->MakeCharFmt( rName, pDerivedFrom );
+}
+
+//----------------------------------
+// inlines im Product
+
+
+SwTxtFmtColl* SwEditShell::GetTxtCollFromPool( sal_uInt16 nId )
+{
+ return GetDoc()->GetTxtCollFromPool( nId );
+}
+
+
+ // return das geforderte automatische Format - Basis-Klasse !
+SwFmt* SwEditShell::GetFmtFromPool( sal_uInt16 nId )
+{
+ return GetDoc()->GetFmtFromPool( nId );
+}
+
+
+SwPageDesc* SwEditShell::GetPageDescFromPool( sal_uInt16 nId )
+{
+ return GetDoc()->GetPageDescFromPool( nId );
+}
+
+
+sal_Bool SwEditShell::IsUsed( const SwModify& rModify ) const
+{
+ return pDoc->IsUsed( rModify );
+}
+
+const SwFlyFrmFmt* SwEditShell::FindFlyByName( const String& rName, sal_uInt8 nNdTyp ) const
+{
+ return pDoc->FindFlyByName(rName, nNdTyp);
+}
+
+SwCharFmt* SwEditShell::FindCharFmtByName( const String& rName ) const
+{
+ return pDoc->FindCharFmtByName( rName );
+}
+
+SwTxtFmtColl* SwEditShell::FindTxtFmtCollByName( const String& rName ) const
+{
+ return pDoc->FindTxtFmtCollByName( rName );
+}
diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx
new file mode 100644
index 000000000000..d07b5b7a1e6c
--- /dev/null
+++ b/sw/source/core/edit/edglbldc.cxx
@@ -0,0 +1,410 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <editsh.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <docary.hxx>
+#include <swwait.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <section.hxx>
+#include <doctxm.hxx>
+#include <edglbldc.hxx>
+
+
+SV_IMPL_OP_PTRARR_SORT( SwGlblDocContents, SwGlblDocContentPtr )
+
+sal_Bool SwEditShell::IsGlobalDoc() const
+{
+ return getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT);
+}
+
+void SwEditShell::SetGlblDocSaveLinks( sal_Bool bFlag )
+{
+ getIDocumentSettingAccess()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bFlag);
+ if( !GetDoc()->IsModified() ) // Bug 57028
+ {
+ GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified();
+ }
+ GetDoc()->SetModified();
+}
+
+sal_Bool SwEditShell::IsGlblDocSaveLinks() const
+{
+ return getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS);
+}
+
+sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const
+{
+ if( rArr.Count() )
+ rArr.DeleteAndDestroy( 0, rArr.Count() );
+
+ if( !getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
+ return 0;
+
+ // dann alle gelinkten Bereiche auf der obersten Ebene
+ SwDoc* pMyDoc = GetDoc();
+ const SwSectionFmts& rSectFmts = pMyDoc->GetSections();
+ sal_uInt16 n;
+
+ for( n = rSectFmts.Count(); n; )
+ {
+ const SwSection* pSect = rSectFmts[ --n ]->GetGlobalDocSection();
+ if( pSect )
+ {
+ SwGlblDocContentPtr pNew;
+ switch( pSect->GetType() )
+ {
+ case TOX_HEADER_SECTION: break; // ignore
+ case TOX_CONTENT_SECTION:
+ ASSERT( pSect->ISA( SwTOXBaseSection ), "keine TOXBaseSection!" );
+ pNew = new SwGlblDocContent( (SwTOXBaseSection*)pSect );
+ break;
+
+ default:
+ pNew = new SwGlblDocContent( pSect );
+ break;
+ }
+ if( !rArr.Insert( pNew ) )
+ delete pNew;
+ }
+ }
+
+ // und als letztes die Dummies (sonstiger Text) einfuegen
+ SwNode* pNd;
+ sal_uLong nSttIdx = pMyDoc->GetNodes().GetEndOfExtras().GetIndex() + 2;
+ for( n = 0; n < rArr.Count(); ++n )
+ {
+ const SwGlblDocContent& rNew = *rArr[ n ];
+ // suche von StartPos bis rNew.DocPos nach einem Content Node.
+ // Existiert dieser, so muss ein DummyEintrag eingefuegt werden.
+ for( ; nSttIdx < rNew.GetDocPos(); ++nSttIdx )
+ if( ( pNd = pMyDoc->GetNodes()[ nSttIdx ])->IsCntntNode()
+ || pNd->IsSectionNode() || pNd->IsTableNode() )
+ {
+ SwGlblDocContentPtr pNew = new SwGlblDocContent( nSttIdx );
+ if( !rArr.Insert( pNew ) )
+ delete pNew;
+ else
+ ++n; // auf die naechste Position
+ break;
+ }
+
+ // StartPosition aufs Ende setzen
+ nSttIdx = pMyDoc->GetNodes()[ rNew.GetDocPos() ]->EndOfSectionIndex();
+ ++nSttIdx;
+ }
+
+ // sollte man das Ende auch noch setzen??
+ if( rArr.Count() )
+ {
+ sal_uLong nNdEnd = pMyDoc->GetNodes().GetEndOfContent().GetIndex();
+ for( ; nSttIdx < nNdEnd; ++nSttIdx )
+ if( ( pNd = pMyDoc->GetNodes()[ nSttIdx ])->IsCntntNode()
+ || pNd->IsSectionNode() || pNd->IsTableNode() )
+ {
+ SwGlblDocContentPtr pNew = new SwGlblDocContent( nSttIdx );
+ if( !rArr.Insert( pNew ) )
+ delete pNew;
+ break;
+ }
+ }
+ else
+ {
+ SwGlblDocContentPtr pNew = new SwGlblDocContent(
+ pMyDoc->GetNodes().GetEndOfExtras().GetIndex() + 2 );
+ rArr.Insert( pNew );
+ }
+ return rArr.Count();
+}
+
+sal_Bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos,
+ SwSectionData & rNew)
+{
+ if( !getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
+ return sal_False;
+
+ SET_CURR_SHELL( this );
+ StartAllAction();
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr || IsTableMode() )
+ ClearMark();
+
+ SwPosition& rPos = *pCrsr->GetPoint();
+ rPos.nNode = rInsPos.GetDocPos();
+
+ sal_Bool bEndUndo = sal_False;
+ SwDoc* pMyDoc = GetDoc();
+ SwTxtNode *const pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+ if( pTxtNd )
+ rPos.nContent.Assign( pTxtNd, 0 );
+ else
+ {
+ bEndUndo = sal_True;
+ pMyDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ rPos.nNode--;
+ pMyDoc->AppendTxtNode( rPos );
+ pCrsr->SetMark();
+ }
+
+ InsertSection( rNew );
+
+ if( bEndUndo )
+ {
+ pMyDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
+ EndAllAction();
+
+ return sal_True;
+}
+
+sal_Bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos,
+ const SwTOXBase& rTOX )
+{
+ if( !getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
+ return sal_False;
+
+ SET_CURR_SHELL( this );
+ StartAllAction();
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr || IsTableMode() )
+ ClearMark();
+
+ SwPosition& rPos = *pCrsr->GetPoint();
+ rPos.nNode = rInsPos.GetDocPos();
+
+ sal_Bool bEndUndo = sal_False;
+ SwDoc* pMyDoc = GetDoc();
+ SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+ if( pTxtNd && pTxtNd->GetTxt().Len() && rPos.nNode.GetIndex() + 1 !=
+ pMyDoc->GetNodes().GetEndOfContent().GetIndex() )
+ rPos.nContent.Assign( pTxtNd, 0 );
+ else
+ {
+ bEndUndo = sal_True;
+ pMyDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ rPos.nNode--;
+ pMyDoc->AppendTxtNode( rPos );
+ }
+
+ InsertTableOf( rTOX );
+
+ if( bEndUndo )
+ {
+ pMyDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
+ EndAllAction();
+
+ return sal_True;
+}
+
+sal_Bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos )
+{
+ if( !getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
+ return sal_False;
+
+ SET_CURR_SHELL( this );
+ StartAllAction();
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr || IsTableMode() )
+ ClearMark();
+
+ SwPosition& rPos = *pCrsr->GetPoint();
+ rPos.nNode = rInsPos.GetDocPos() - 1;
+ rPos.nContent.Assign( 0, 0 );
+
+ SwDoc* pMyDoc = GetDoc();
+ pMyDoc->AppendTxtNode( rPos );
+ EndAllAction();
+ return sal_True;
+}
+
+sal_Bool SwEditShell::DeleteGlobalDocContent( const SwGlblDocContents& rArr ,
+ sal_uInt16 nDelPos )
+{
+ if( !getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
+ return sal_False;
+
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ StartUndo( UNDO_START );
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr || IsTableMode() )
+ ClearMark();
+
+ SwPosition& rPos = *pCrsr->GetPoint();
+
+ SwDoc* pMyDoc = GetDoc();
+ const SwGlblDocContent& rDelPos = *rArr[ nDelPos ];
+ sal_uLong nDelIdx = rDelPos.GetDocPos();
+ if( 1 == rArr.Count() )
+ {
+ // ein Node muss aber da bleiben!
+ rPos.nNode = nDelIdx - 1;
+ rPos.nContent.Assign( 0, 0 );
+
+ pMyDoc->AppendTxtNode( rPos );
+ ++nDelIdx;
+ }
+
+ switch( rDelPos.GetType() )
+ {
+ case GLBLDOC_UNKNOWN:
+ {
+ rPos.nNode = nDelIdx;
+ pCrsr->SetMark();
+ if( ++nDelPos < rArr.Count() )
+ rPos.nNode = rArr[ nDelPos ]->GetDocPos();
+ else
+ rPos.nNode = pMyDoc->GetNodes().GetEndOfContent();
+ rPos.nNode--;
+ if( !pMyDoc->DelFullPara( *pCrsr ) )
+ Delete();
+ }
+ break;
+
+ case GLBLDOC_TOXBASE:
+ {
+ SwTOXBaseSection* pTOX = (SwTOXBaseSection*)rDelPos.GetTOX();
+ pMyDoc->DeleteTOX( *pTOX, sal_True );
+ }
+ break;
+
+ case GLBLDOC_SECTION:
+ {
+ SwSectionFmt* pSectFmt = (SwSectionFmt*)rDelPos.GetSection()->GetFmt();
+ pMyDoc->DelSectionFmt( pSectFmt, sal_True );
+ }
+ break;
+ }
+
+ EndUndo( UNDO_END );
+ EndAllAction();
+ return sal_True;
+}
+
+sal_Bool SwEditShell::MoveGlobalDocContent( const SwGlblDocContents& rArr ,
+ sal_uInt16 nFromPos, sal_uInt16 nToPos,
+ sal_uInt16 nInsPos )
+{
+ if( !getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ||
+ nFromPos >= rArr.Count() || nToPos > rArr.Count() ||
+ nInsPos > rArr.Count() || nFromPos >= nToPos ||
+ ( nFromPos <= nInsPos && nInsPos <= nToPos ) )
+ return sal_False;
+
+ SET_CURR_SHELL( this );
+ StartAllAction();
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr || IsTableMode() )
+ ClearMark();
+
+ SwDoc* pMyDoc = GetDoc();
+ SwNodeRange aRg( pMyDoc->GetNodes(), rArr[ nFromPos ]->GetDocPos() );
+ if( nToPos < rArr.Count() )
+ aRg.aEnd = rArr[ nToPos ]->GetDocPos();
+ else
+ aRg.aEnd = pMyDoc->GetNodes().GetEndOfContent();
+
+ SwNodeIndex aInsPos( pMyDoc->GetNodes() );
+ if( nInsPos < rArr.Count() )
+ aInsPos = rArr[ nInsPos ]->GetDocPos();
+ else
+ aInsPos = pMyDoc->GetNodes().GetEndOfContent();
+
+ bool bRet = pMyDoc->MoveNodeRange( aRg, aInsPos,
+ static_cast<IDocumentContentOperations::SwMoveFlags>(
+ IDocumentContentOperations::DOC_MOVEALLFLYS
+ | IDocumentContentOperations::DOC_CREATEUNDOOBJ ));
+
+ EndAllAction();
+ return bRet;
+}
+
+sal_Bool SwEditShell::GotoGlobalDocContent( const SwGlblDocContent& rPos )
+{
+ if( !getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
+ return sal_False;
+
+ SET_CURR_SHELL( this );
+ SttCrsrMove();
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr || IsTableMode() )
+ ClearMark();
+
+ SwPosition& rCrsrPos = *pCrsr->GetPoint();
+ rCrsrPos.nNode = rPos.GetDocPos();
+
+ SwDoc* pMyDoc = GetDoc();
+ SwCntntNode * pCNd = rCrsrPos.nNode.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = pMyDoc->GetNodes().GoNext( &rCrsrPos.nNode );
+
+ rCrsrPos.nContent.Assign( pCNd, 0 );
+
+ EndCrsrMove();
+ return sal_True;
+}
+
+SwGlblDocContent::SwGlblDocContent( sal_uLong nPos )
+{
+ eType = GLBLDOC_UNKNOWN;
+ PTR.pTOX = 0;
+ nDocPos = nPos;
+}
+
+SwGlblDocContent::SwGlblDocContent( const SwTOXBaseSection* pTOX )
+{
+ eType = GLBLDOC_TOXBASE;
+ PTR.pTOX = pTOX;
+
+ const SwSectionNode* pSectNd = pTOX->GetFmt()->GetSectionNode();
+ nDocPos = pSectNd ? pSectNd->GetIndex() : 0;
+}
+
+SwGlblDocContent::SwGlblDocContent( const SwSection* pSect )
+{
+ eType = GLBLDOC_SECTION;
+ PTR.pSect = pSect;
+
+ const SwSectionNode* pSectNd = pSect->GetFmt()->GetSectionNode();
+ nDocPos = pSectNd ? pSectNd->GetIndex() : 0;
+}
+
+
+
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
new file mode 100644
index 000000000000..56996558b306
--- /dev/null
+++ b/sw/source/core/edit/edglss.cxx
@@ -0,0 +1,373 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <osl/endian.h>
+#include <hintids.hxx>
+#include <svl/urihelper.hxx>
+#include <tools/cachestr.hxx>
+#include <doc.hxx>
+#include <pam.hxx>
+#include <docary.hxx>
+#include <editsh.hxx>
+#include <edimp.hxx>
+#include <frmfmt.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <ndtxt.hxx>
+#include <swtable.hxx> // fuers kopieren von Tabellen
+#include <shellio.hxx> // SwTextBlocks
+#include <acorrect.hxx>
+#include <swerror.h> // SwTextBlocks
+
+/******************************************************************************
+ * jetzt mit einem verkappten Reader/Writer/Dokument
+ ******************************************************************************/
+
+void SwEditShell::InsertGlossary( SwTextBlocks& rGlossary, const String& rStr )
+{
+ StartAllAction();
+ GetDoc()->InsertGlossary( rGlossary, rStr, *GetCrsr(), this );
+ EndAllAction();
+}
+
+
+/******************************************************************************
+ * aktuelle Selektion zum Textbaustein machen und ins
+ * Textbausteindokument einfuegen, einschliesslich Vorlagen
+ ******************************************************************************/
+
+
+sal_uInt16 SwEditShell::MakeGlossary( SwTextBlocks& rBlks, const String& rName, const String& rShortName,
+ sal_Bool bSaveRelFile, const String* pOnlyTxt )
+{
+ SwDoc* pGDoc = rBlks.GetDoc();
+
+ String sBase;
+ if(bSaveRelFile)
+ {
+ INetURLObject aURL( rBlks.GetFileName() );
+ sBase = aURL.GetMainURL( INetURLObject::NO_DECODE );
+ }
+ rBlks.SetBaseURL( sBase );
+
+ sal_uInt16 nRet;
+
+ if( pOnlyTxt )
+ nRet = rBlks.PutText( rShortName, rName, *pOnlyTxt );
+ else
+ {
+ rBlks.ClearDoc();
+ if( rBlks.BeginPutDoc( rShortName, rName ) )
+ {
+ rBlks.GetDoc()->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_DELETE_REDLINES );
+ _CopySelToDoc( pGDoc );
+ rBlks.GetDoc()->SetRedlineMode_intern( (RedlineMode_t)0 );
+ nRet = rBlks.PutDoc();
+ }
+ else
+ nRet = (sal_uInt16) -1;
+ }
+
+ return nRet;
+}
+
+sal_uInt16 SwEditShell::SaveGlossaryDoc( SwTextBlocks& rBlock,
+ const String& rName,
+ const String& rShortName,
+ sal_Bool bSaveRelFile,
+ sal_Bool bOnlyTxt )
+{
+ StartAllAction();
+
+ SwDoc* pGDoc = rBlock.GetDoc();
+ SwDoc* pMyDoc = GetDoc();
+
+ String sBase;
+ if(bSaveRelFile)
+ {
+ INetURLObject aURL( rBlock.GetFileName() );
+ sBase = aURL.GetMainURL( INetURLObject::NO_DECODE );
+ }
+ rBlock.SetBaseURL( sBase );
+ sal_uInt16 nRet = USHRT_MAX;
+
+ if( bOnlyTxt )
+ {
+ KillPams();
+
+ SwPaM* pCrsr = GetCrsr();
+
+ SwNodeIndex aStt( pMyDoc->GetNodes().GetEndOfExtras(), 1 );
+ SwCntntNode* pCntntNd = pMyDoc->GetNodes().GoNext( &aStt );
+ const SwNode* pNd = pCntntNd->FindTableNode();
+ if( !pNd )
+ pNd = pCntntNd;
+
+ pCrsr->GetPoint()->nNode = *pNd;
+ if( pNd == pCntntNd )
+ pCrsr->GetPoint()->nContent.Assign( pCntntNd, 0 );
+ pCrsr->SetMark();
+
+ // dann bis zum Ende vom Nodes Array
+ pCrsr->GetPoint()->nNode = pMyDoc->GetNodes().GetEndOfContent().GetIndex()-1;
+ pCntntNd = pCrsr->GetCntntNode();
+ if( pCntntNd )
+ pCrsr->GetPoint()->nContent.Assign( pCntntNd, pCntntNd->Len() );
+
+ String sBuf;
+ if( GetSelectedText( sBuf, GETSELTXT_PARABRK_TO_ONLYCR ) && sBuf.Len() )
+ nRet = rBlock.PutText( rShortName, rName, sBuf );
+ }
+ else
+ {
+ rBlock.ClearDoc();
+ if( rBlock.BeginPutDoc( rShortName, rName ) )
+ {
+ SwNodeIndex aStt( pMyDoc->GetNodes().GetEndOfExtras(), 1 );
+ SwCntntNode* pCntntNd = pMyDoc->GetNodes().GoNext( &aStt );
+ const SwNode* pNd = pCntntNd->FindTableNode();
+ if( !pNd ) pNd = pCntntNd;
+ SwPaM aCpyPam( *pNd );
+ aCpyPam.SetMark();
+
+ // dann bis zum Ende vom Nodes Array
+ aCpyPam.GetPoint()->nNode = pMyDoc->GetNodes().GetEndOfContent().GetIndex()-1;
+ pCntntNd = aCpyPam.GetCntntNode();
+ aCpyPam.GetPoint()->nContent.Assign( pCntntNd, pCntntNd->Len() );
+
+ aStt = pGDoc->GetNodes().GetEndOfExtras();
+ pCntntNd = pGDoc->GetNodes().GoNext( &aStt );
+ SwPosition aInsPos( aStt, SwIndex( pCntntNd ));
+ pMyDoc->CopyRange( aCpyPam, aInsPos, false );
+
+ nRet = rBlock.PutDoc();
+ }
+ }
+ EndAllAction();
+ return nRet;
+}
+
+/******************************************************************************
+ * kopiere alle Selectionen und das Doc
+ ******************************************************************************/
+
+
+sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
+{
+ ASSERT( pInsDoc, "kein Ins.Dokument" );
+
+ SwNodes& rNds = pInsDoc->GetNodes();
+
+ SwNodeIndex aIdx( rNds.GetEndOfContent(), -1 );
+ SwCntntNode * pNd = aIdx.GetNode().GetCntntNode();
+ SwPosition aPos( aIdx, SwIndex( pNd, pNd->Len() ));
+
+ // soll der Index auf Anfang returnt werden ?
+ if( pSttNd )
+ {
+ *pSttNd = aPos.nNode;
+ (*pSttNd)--;
+ }
+
+ sal_Bool bRet = sal_False;
+ SET_CURR_SHELL( this );
+
+ pInsDoc->LockExpFlds();
+
+ if( IsTableMode() )
+ {
+ // kopiere Teile aus einer Tabelle: lege eine Tabelle mit der Breite
+ // von der Originalen an und kopiere die selectierten Boxen.
+ // Die Groessen werden prozentual korrigiert.
+
+ // lasse ueber das Layout die Boxen suchen
+ SwTableNode* pTblNd;
+ SwSelBoxes aBoxes;
+ GetTblSel( *this, aBoxes );
+ if( aBoxes.Count() && 0 != (pTblNd = (SwTableNode*)aBoxes[0]
+ ->GetSttNd()->FindTableNode() ))
+ {
+ // teste ob der TabellenName kopiert werden kann
+ sal_Bool bCpyTblNm = aBoxes.Count() == pTblNd->GetTable().GetTabSortBoxes().Count();
+ if( bCpyTblNm )
+ {
+ const String& rTblName = pTblNd->GetTable().GetFrmFmt()->GetName();
+ const SwFrmFmts& rTblFmts = *pInsDoc->GetTblFrmFmts();
+ for( sal_uInt16 n = rTblFmts.Count(); n; )
+ if( rTblFmts[ --n ]->GetName() == rTblName )
+ {
+ bCpyTblNm = sal_False;
+ break;
+ }
+ }
+ bRet = pInsDoc->InsCopyOfTbl( aPos, aBoxes, 0, bCpyTblNm, sal_False );
+ }
+ else
+ bRet = sal_False;
+ }
+ else
+ {
+ bool bColSel = _GetCrsr()->IsColumnSelection();
+ if( bColSel && pInsDoc->IsClipBoard() )
+ pInsDoc->SetColumnSelection( true );
+ {
+ FOREACHPAM_START(this)
+
+ if( !PCURCRSR->HasMark() )
+ {
+ if( 0 != (pNd = PCURCRSR->GetCntntNode()) &&
+ ( bColSel || !pNd->GetTxtNode() ) )
+ {
+ PCURCRSR->SetMark();
+ PCURCRSR->Move( fnMoveForward, fnGoCntnt );
+ bRet = GetDoc()->CopyRange( *PCURCRSR, aPos, false )
+ || bRet;
+ PCURCRSR->Exchange();
+ PCURCRSR->DeleteMark();
+ }
+ }
+ else
+ {
+ bRet = GetDoc()->CopyRange( *PCURCRSR, aPos, false ) || bRet;
+ }
+
+ FOREACHPAM_END()
+ }
+ }
+
+ pInsDoc->UnlockExpFlds();
+ if( !pInsDoc->IsExpFldsLocked() )
+ pInsDoc->UpdateExpFlds(NULL, true);
+
+ // die gemerkte Node-Position wieder auf den richtigen Node
+ if( bRet && pSttNd )
+ (*pSttNd)++;
+
+
+ return bRet;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Text innerhalb der Selektion erfragen
+ Returnwert: liefert sal_False, wenn der selektierte Bereich
+ zu gross ist, um in den Stringpuffer kopiert zu werden.
+------------------------------------------------------------------------*/
+
+sal_Bool SwEditShell::GetSelectedText( String &rBuf, int nHndlParaBrk )
+{
+ sal_Bool bRet = sal_False;
+ GetCrsr(); // ggfs. alle Cursor erzeugen lassen
+ if( IsSelOnePara() )
+ {
+ rBuf = GetSelTxt();
+ if( GETSELTXT_PARABRK_TO_BLANK == nHndlParaBrk )
+ {
+ xub_StrLen nPos = 0;
+ while( STRING_NOTFOUND !=
+ ( nPos = rBuf.SearchAndReplace( 0x0a, ' ', nPos )) )
+ ;
+ }
+ else if( IsSelFullPara() &&
+ GETSELTXT_PARABRK_TO_ONLYCR != nHndlParaBrk )
+ {
+#if defined(UNX)
+ rBuf += '\012';
+#else
+ rBuf += String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "\015\012" ));
+#endif
+ }
+ bRet = sal_True;
+ }
+ else if( IsSelection() )
+ {
+ SvCacheStream aStream(20480);
+#ifdef OSL_BIGENDIAN
+ aStream.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+#else
+ aStream.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+#endif
+ WriterRef xWrt;
+ SwReaderWriter::GetWriter( String::CreateFromAscii( FILTER_TEXT ), String(), xWrt );
+ if( xWrt.Is() )
+ {
+ // Selektierte Bereiche in ein ASCII Dokument schreiben
+ SwWriter aWriter( aStream, *this);
+ xWrt->SetShowProgress( sal_False );
+
+ switch( nHndlParaBrk )
+ {
+ case GETSELTXT_PARABRK_TO_BLANK:
+ xWrt->bASCII_ParaAsBlanc = sal_True;
+ xWrt->bASCII_NoLastLineEnd = sal_True;
+ break;
+
+ case GETSELTXT_PARABRK_TO_ONLYCR:
+ xWrt->bASCII_ParaAsCR = sal_True;
+ xWrt->bASCII_NoLastLineEnd = sal_True;
+ break;
+ }
+
+ //JP 09.05.00: write as UNICODE ! (and not as ANSI)
+ SwAsciiOptions aAsciiOpt( xWrt->GetAsciiOptions() );
+ aAsciiOpt.SetCharSet( RTL_TEXTENCODING_UCS2 );
+ xWrt->SetAsciiOptions( aAsciiOpt );
+ xWrt->bUCS2_WithStartChar = sal_False;
+
+ long lLen;
+ if( !IsError( aWriter.Write( xWrt ) ) &&
+ STRING_MAXLEN > (( lLen = aStream.GetSize() )
+ / sizeof( sal_Unicode )) + 1 )
+ {
+ aStream << (sal_Unicode)'\0';
+
+ const sal_Unicode *p = (sal_Unicode*)aStream.GetBuffer();
+ if( p )
+ rBuf = p;
+ else
+ {
+ sal_Unicode* pStrBuf = rBuf.AllocBuffer( xub_StrLen(
+ ( lLen / sizeof( sal_Unicode ))) );
+ aStream.Seek( 0 );
+ aStream.ResetError();
+ aStream.Read( pStrBuf, lLen );
+ pStrBuf[ lLen / sizeof( sal_Unicode ) ] = '\0';
+ }
+ }
+ }
+ }
+
+ return sal_True;
+}
+
+
+
+
+
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
new file mode 100644
index 000000000000..6465e703482f
--- /dev/null
+++ b/sw/source/core/edit/editsh.cxx
@@ -0,0 +1,1204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <tools/list.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/cmdevt.hxx>
+#include <unotools/charclass.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include <swwait.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtinfmt.hxx>
+#include <txtinet.hxx>
+#include <frmfmt.hxx>
+#include <charfmt.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <docary.hxx>
+#include <editsh.hxx>
+#include <frame.hxx>
+#include <cntfrm.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx> // fuer SwTxtNode
+#include <grfatr.hxx>
+#include <flyfrm.hxx>
+#include <swtable.hxx>
+#include <swundo.hxx> // UNDO_START, UNDO_END
+#include <calc.hxx>
+#include <edimp.hxx>
+#include <ndgrf.hxx>
+#include <ndole.hxx>
+#include <txtfrm.hxx>
+#include <rootfrm.hxx>
+#include <extinput.hxx>
+#include <crsskip.hxx>
+#include <scriptinfo.hxx>
+#include <unocrsrhelper.hxx>
+#include <section.hxx>
+#include <unochart.hxx>
+#include <numrule.hxx>
+#include <SwNodeNum.hxx>
+#include <unocrsr.hxx>
+#include <switerator.hxx>
+
+using namespace com::sun::star;
+
+
+SV_IMPL_PTRARR(SwGetINetAttrs, SwGetINetAttr*)
+
+/******************************************************************************
+ * void SwEditShell::Insert(char c)
+ ******************************************************************************/
+
+
+void SwEditShell::Insert( sal_Unicode c, sal_Bool bOnlyCurrCrsr )
+{
+ StartAllAction();
+ FOREACHPAM_START(this)
+
+ const bool bSuccess = GetDoc()->InsertString(*PCURCRSR, c);
+ ASSERT( bSuccess, "Doc->Insert() failed." );
+ (void) bSuccess;
+
+ SaveTblBoxCntnt( PCURCRSR->GetPoint() );
+ if( bOnlyCurrCrsr )
+ break;
+
+ FOREACHPAM_END()
+
+ EndAllAction();
+}
+
+
+/******************************************************************************
+ * void SwEditShell::Insert(const String &rStr)
+ ******************************************************************************/
+
+
+void SwEditShell::Insert2(const String &rStr, const bool bForceExpandHints )
+{
+ StartAllAction();
+ {
+ const enum IDocumentContentOperations::InsertFlags nInsertFlags =
+ (bForceExpandHints)
+ ? static_cast<IDocumentContentOperations::InsertFlags>(
+ IDocumentContentOperations::INS_FORCEHINTEXPAND |
+ IDocumentContentOperations::INS_EMPTYEXPAND)
+ : IDocumentContentOperations::INS_EMPTYEXPAND;
+
+ SwPaM *_pStartCrsr = getShellCrsr( true ), *__pStartCrsr = _pStartCrsr;
+ do {
+ //OPT: GetSystemCharSet
+ const bool bSuccess =
+ GetDoc()->InsertString(*_pStartCrsr, rStr, nInsertFlags);
+ ASSERT( bSuccess, "Doc->Insert() failed." );
+ (void) bSuccess;
+
+ SaveTblBoxCntnt( _pStartCrsr->GetPoint() );
+
+ } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr );
+ }
+
+ // calculate cursor bidi level
+ SwCursor* pTmpCrsr = _GetCrsr();
+ const sal_Bool bDoNotSetBidiLevel = ! pTmpCrsr ||
+ ( 0 != dynamic_cast<SwUnoCrsr*>(pTmpCrsr) );
+
+ if ( ! bDoNotSetBidiLevel )
+ {
+ SwNode& rNode = pTmpCrsr->GetPoint()->nNode.GetNode();
+ if ( rNode.IsTxtNode() )
+ {
+ SwIndex& rIdx = pTmpCrsr->GetPoint()->nContent;
+ xub_StrLen nPos = rIdx.GetIndex();
+ xub_StrLen nPrevPos = nPos;
+ if ( nPrevPos )
+ --nPrevPos;
+
+ SwScriptInfo* pSI = SwScriptInfo::GetScriptInfo( ((SwTxtNode&)rNode),
+ sal_True );
+
+ sal_uInt8 nLevel = 0;
+ if ( ! pSI )
+ {
+ // seems to be an empty paragraph.
+ Point aPt;
+ SwCntntFrm* pFrm =
+ ((SwTxtNode&)rNode).getLayoutFrm( GetLayout(), &aPt, pTmpCrsr->GetPoint(),
+ sal_False );
+
+ SwScriptInfo aScriptInfo;
+ aScriptInfo.InitScriptInfo( (SwTxtNode&)rNode, pFrm->IsRightToLeft() );
+ nLevel = aScriptInfo.DirType( nPrevPos );
+ }
+ else
+ {
+ if ( STRING_LEN != pSI->GetInvalidity() )
+ pSI->InitScriptInfo( (SwTxtNode&)rNode );
+ nLevel = pSI->DirType( nPrevPos );
+ }
+
+ pTmpCrsr->SetCrsrBidiLevel( nLevel );
+ }
+ }
+
+ SetInFrontOfLabel( sal_False ); // #i27615#
+
+ EndAllAction();
+}
+
+
+/******************************************************************************
+ * void SwEditShell::Overwrite(const String &rStr)
+ ******************************************************************************/
+
+
+void SwEditShell::Overwrite(const String &rStr)
+{
+ StartAllAction();
+ FOREACHPAM_START(this)
+ if( !GetDoc()->Overwrite(*PCURCRSR, rStr ) )
+ {
+ ASSERT( sal_False, "Doc->Overwrite(Str) failed." )
+ }
+ SaveTblBoxCntnt( PCURCRSR->GetPoint() );
+ FOREACHPAM_END()
+ EndAllAction();
+}
+
+
+/******************************************************************************
+ * long SwEditShell::SplitNode()
+ ******************************************************************************/
+
+long SwEditShell::SplitNode( sal_Bool bAutoFormat, sal_Bool bCheckTableStart )
+{
+ StartAllAction();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+
+ FOREACHPAM_START(this)
+ // eine Tabellen Zelle wird jetzt zu einer normalen Textzelle!
+ GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode );
+ GetDoc()->SplitNode( *PCURCRSR->GetPoint(), bCheckTableStart );
+ FOREACHPAM_END()
+
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+
+ if( bAutoFormat )
+ AutoFmtBySplitNode();
+
+ ClearTblBoxCntnt();
+
+ EndAllAction();
+ return(1L);
+}
+
+/*-- 11.05.2004 09:41:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwEditShell::AppendTxtNode()
+{
+ sal_Bool bRet = sal_False;
+ StartAllAction();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+
+ FOREACHPAM_START(this)
+ GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode );
+ bRet = GetDoc()->AppendTxtNode( *PCURCRSR->GetPoint()) || bRet;
+ FOREACHPAM_END()
+
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+
+ ClearTblBoxCntnt();
+
+ EndAllAction();
+ return bRet;
+}
+
+/******************************************************************************
+ * liefert einen Pointer auf einen SwGrfNode; dieser wird von
+ * GetGraphic() und GetGraphicSize() verwendet.
+ ******************************************************************************/
+
+
+SwGrfNode * SwEditShell::_GetGrfNode() const
+{
+ SwGrfNode *pGrfNode = 0;
+ SwPaM* pCrsr = GetCrsr();
+ if( !pCrsr->HasMark() ||
+ pCrsr->GetPoint()->nNode == pCrsr->GetMark()->nNode )
+ pGrfNode = pCrsr->GetPoint()->nNode.GetNode().GetGrfNode();
+
+ return pGrfNode;
+}
+/******************************************************************************
+ * liefert Pointer auf eine Graphic, wenn CurCrsr->GetPoint() auf
+ * einen SwGrfNode zeigt (und GetMark nicht gesetzt ist
+ * oder auf die gleiche Graphic zeigt)
+ ******************************************************************************/
+
+// --> OD 2005-02-09 #119353# - robust
+const Graphic* SwEditShell::GetGraphic( sal_Bool bWait ) const
+{
+ SwGrfNode* pGrfNode = _GetGrfNode();
+ // --> OD 2005-02-09 #119353# - robust
+ const Graphic* pGrf( 0L );
+ if ( pGrfNode )
+ {
+ pGrf = &(pGrfNode->GetGrf());
+ // --> OD 2007-03-01 #i73788#
+ // no load of linked graphic, if its not needed now (bWait = sal_False).
+ if ( bWait )
+ {
+ if( pGrf->IsSwapOut() ||
+ ( pGrfNode->IsLinkedFile() && GRAPHIC_DEFAULT == pGrf->GetType() ) )
+ {
+#ifdef DBG_UTIL
+ ASSERT( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" );
+#else
+ pGrfNode->SwapIn( bWait );
+#endif
+ }
+ }
+ else
+ {
+ if ( pGrf->IsSwapOut() && !pGrfNode->IsLinkedFile() )
+ {
+#ifdef DBG_UTIL
+ ASSERT( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" );
+#else
+ pGrfNode->SwapIn( bWait );
+#endif
+ }
+ }
+ // <--
+ }
+ return pGrf;
+ // <--
+}
+
+sal_Bool SwEditShell::IsGrfSwapOut( sal_Bool bOnlyLinked ) const
+{
+ SwGrfNode *pGrfNode = _GetGrfNode();
+ return pGrfNode &&
+ (bOnlyLinked ? ( pGrfNode->IsLinkedFile() &&
+ ( GRAPHIC_DEFAULT == pGrfNode->GetGrfObj().GetType()||
+ pGrfNode->GetGrfObj().IsSwappedOut()))
+ : pGrfNode->GetGrfObj().IsSwappedOut());
+}
+
+// --> OD 2005-02-09 #119353# - robust
+const GraphicObject* SwEditShell::GetGraphicObj() const
+{
+ SwGrfNode* pGrfNode = _GetGrfNode();
+ // --> OD 2005-02-09 #119353# - robust
+ return pGrfNode ? &(pGrfNode->GetGrfObj()) : 0L;
+ // <--
+}
+
+sal_uInt16 SwEditShell::GetGraphicType() const
+{
+ SwGrfNode *pGrfNode = _GetGrfNode();
+ return static_cast<sal_uInt16>(pGrfNode ? pGrfNode->GetGrfObj().GetType() : GRAPHIC_NONE);
+}
+
+/******************************************************************************
+ * liefert die Groesse der Graphic, wenn CurCrsr->GetPoint() auf
+ * einen SwGrfNode zeigt (und GetMark nicht gesetzt ist
+ * oder auf die gleiche Graphic zeigt)
+ ******************************************************************************/
+
+sal_Bool SwEditShell::GetGrfSize(Size& rSz) const
+{
+ SwNoTxtNode* pNoTxtNd;
+ SwPaM* pCurrentCrsr = GetCrsr();
+ if( ( !pCurrentCrsr->HasMark()
+ || pCurrentCrsr->GetPoint()->nNode == pCurrentCrsr->GetMark()->nNode )
+ && 0 != ( pNoTxtNd = pCurrentCrsr->GetNode()->GetNoTxtNode() ) )
+ {
+ rSz = pNoTxtNd->GetTwipSize();
+ return sal_True;
+ }
+ return sal_False;
+
+}
+/******************************************************************************
+ * erneutes Einlesen, falls Graphic nicht Ok ist. Die
+ * aktuelle wird durch die neue ersetzt.
+ ******************************************************************************/
+
+void SwEditShell::ReRead( const String& rGrfName, const String& rFltName,
+ const Graphic* pGraphic, const GraphicObject* pGrfObj )
+{
+ StartAllAction();
+ pDoc->ReRead( *GetCrsr(), rGrfName, rFltName, pGraphic, pGrfObj );
+ EndAllAction();
+}
+
+
+/******************************************************************************
+ * liefert den Namen und den FilterNamen einer Graphic, wenn der Cursor
+ * auf einer Graphic steht
+ * Ist ein String-Ptr != 0 dann returne den entsp. Namen
+ ******************************************************************************/
+
+
+void SwEditShell::GetGrfNms( String* pGrfName, String* pFltName,
+ const SwFlyFrmFmt* pFmt ) const
+{
+ ASSERT( pGrfName || pFltName, "was wird denn nun erfragt?" );
+ if( pFmt )
+ GetDoc()->GetGrfNms( *pFmt, pGrfName, pFltName );
+ else
+ {
+ SwGrfNode *pGrfNode = _GetGrfNode();
+ if( pGrfNode && pGrfNode->IsLinkedFile() )
+ pGrfNode->GetFileFilterNms( pGrfName, 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 PolyPolygon *SwEditShell::GetGraphicPolygon() const
+{
+ SwNoTxtNode *pNd = GetCrsr()->GetNode()->GetNoTxtNode();
+ return pNd->HasContour();
+}
+
+
+void SwEditShell::SetGraphicPolygon( const PolyPolygon *pPoly )
+{
+ SwNoTxtNode *pNd = GetCrsr()->GetNode()->GetNoTxtNode();
+ StartAllAction();
+ pNd->SetContour( pPoly );
+ SwFlyFrm *pFly = (SwFlyFrm*)pNd->getLayoutFrm(GetLayout())->GetUpper();
+ const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround();
+ pFly->GetFmt()->NotifyClients( (SwFmtSurround*)&rSur, (SwFmtSurround*)&rSur );
+ GetDoc()->SetModified();
+ EndAllAction();
+}
+
+void SwEditShell::ClearAutomaticContour()
+{
+ SwNoTxtNode *pNd = GetCrsr()->GetNode()->GetNoTxtNode();
+ ASSERT( pNd, "is no NoTxtNode!" );
+ if( pNd->HasAutomaticContour() )
+ {
+ StartAllAction();
+ pNd->SetContour( NULL, sal_False );
+ SwFlyFrm *pFly = (SwFlyFrm*)pNd->getLayoutFrm(GetLayout())->GetUpper();
+ const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround();
+ pFly->GetFmt()->NotifyClients( (SwFmtSurround*)&rSur, (SwFmtSurround*)&rSur );
+ GetDoc()->SetModified();
+ EndAllAction();
+ }
+}
+
+/******************************************************************************
+ * liefert Pointer auf ein SvInPlaceObjectRef, wenn CurCrsr->GetPoint() auf
+ * einen SwOLENode zeigt (und GetMark nicht gesetzt ist
+ * oder auf das gleiche SvInPlaceObjectRef zeigt)
+ * besorgt den Pointer vom Doc wenn das Objekt per Namen gesucht werden
+ * soll
+ ******************************************************************************/
+
+svt::EmbeddedObjectRef& SwEditShell::GetOLEObject() const
+{
+ ASSERT( CNT_OLE == GetCntType(), "GetOLEObj: kein OLENode." );
+ ASSERT( !GetCrsr()->HasMark() ||
+ (GetCrsr()->HasMark() &&
+ GetCrsr()->GetPoint()->nNode == GetCrsr()->GetMark()->nNode),
+ "GetOLEObj: kein OLENode." );
+
+ SwOLENode *pOLENode = GetCrsr()->GetNode()->GetOLENode();
+ ASSERT( pOLENode, "GetOLEObj: kein OLENode." );
+ SwOLEObj& rOObj = pOLENode->GetOLEObj();
+ return rOObj.GetObject();
+}
+
+
+sal_Bool SwEditShell::HasOLEObj( const String &rName ) const
+{
+ SwStartNode *pStNd;
+ SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+ while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
+ {
+ aIdx++;
+ SwNode& rNd = aIdx.GetNode();
+ if( rNd.IsOLENode() &&
+ rName == ((SwOLENode&)rNd).GetChartTblName() &&
+ ((SwOLENode&)rNd).getLayoutFrm( GetLayout() ) )
+ return sal_True;
+
+ aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
+ }
+ return sal_False;
+}
+
+
+void SwEditShell::SetChartName( const String &rName )
+{
+ SwOLENode *pONd = GetCrsr()->GetNode()->GetOLENode();
+ ASSERT( pONd, "ChartNode not found" );
+ pONd->SetChartTblName( rName );
+}
+
+void SwEditShell::UpdateCharts( const String &rName )
+{
+ GetDoc()->UpdateCharts( rName );
+}
+
+
+/******************************************************************************
+ * Aenderung des Tabellennamens
+ ******************************************************************************/
+
+void SwEditShell::SetTableName( SwFrmFmt& rTblFmt, const String &rNewName )
+{
+ GetDoc()->SetTableName( rTblFmt, rNewName );
+}
+
+// erfragen des akt. Wortes
+
+String SwEditShell::GetCurWord()
+{
+ const SwPaM& rPaM = *GetCrsr();
+ const SwTxtNode* pNd = rPaM.GetNode()->GetTxtNode();
+ String aString = pNd ?
+ pNd->GetCurWord(rPaM.GetPoint()->nContent.GetIndex()) :
+ aEmptyStr;
+ return aString;
+}
+
+/****************************************************************************
+ * void SwEditShell::UpdateDocStat( SwDocStat& rStat )
+ ****************************************************************************/
+
+
+void SwEditShell::UpdateDocStat( SwDocStat& rStat )
+{
+ StartAllAction();
+ GetDoc()->UpdateDocStat( rStat );
+ EndAllAction();
+}
+
+// OPT: eddocinl.cxx
+
+
+ // returne zum Namen die im Doc gesetzte Referenz
+const SwFmtRefMark* SwEditShell::GetRefMark( const String& rName ) const
+{
+ return GetDoc()->GetRefMark( rName );
+}
+
+ // returne die Namen aller im Doc gesetzten Referenzen
+sal_uInt16 SwEditShell::GetRefMarks( SvStringsDtor* pStrings ) const
+{
+ return GetDoc()->GetRefMarks( pStrings );
+}
+
+/******************************************************************************
+ * DropCap-SS
+ ******************************************************************************/
+
+
+String SwEditShell::GetDropTxt( const sal_uInt16 nChars ) const
+{
+ /**
+ * pb: made changes for #i74939#
+ *
+ * always return a string even though there is a selection
+ */
+
+ String aTxt;
+ SwPaM* pCrsr = GetCrsr();
+ if ( IsMultiSelection() )
+ {
+ // if a multi selection exists, search for the first line
+ // -> it is the cursor with the lowest index
+ sal_uLong nIndex = pCrsr->GetMark()->nNode.GetIndex();
+ bool bPrev = true;
+ SwPaM* pLast = pCrsr;
+ SwPaM* pTemp = pCrsr;
+ while ( bPrev )
+ {
+ SwPaM* pPrev2 = dynamic_cast< SwPaM* >( pTemp->GetPrev() );
+ bPrev = ( pPrev2 && pPrev2 != pLast );
+ if ( bPrev )
+ {
+ pTemp = pPrev2;
+ sal_uLong nTemp = pPrev2->GetMark()->nNode.GetIndex();
+ if ( nTemp < nIndex )
+ {
+ nIndex = nTemp;
+ pCrsr = pPrev2;
+ }
+ }
+ }
+ }
+
+ SwTxtNode* pTxtNd = pCrsr->GetNode( !pCrsr->HasMark() )->GetTxtNode();
+ if( pTxtNd )
+ {
+ xub_StrLen nDropLen = pTxtNd->GetDropLen( nChars );
+ if( nDropLen )
+ aTxt = pTxtNd->GetTxt().Copy( 0, nDropLen );
+ }
+
+ return aTxt;
+}
+
+void SwEditShell::ReplaceDropTxt( const String &rStr )
+{
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetPoint()->nNode == pCrsr->GetMark()->nNode &&
+ pCrsr->GetNode()->GetTxtNode()->IsTxtNode() )
+ {
+ StartAllAction();
+
+ const SwNodeIndex& rNd = pCrsr->GetPoint()->nNode;
+ SwPaM aPam( rNd, rStr.Len(), rNd, 0 );
+ if( !GetDoc()->Overwrite( aPam, rStr ) )
+ {
+ ASSERT( sal_False, "Doc->Overwrite(Str) failed." );
+ }
+
+ EndAllAction();
+ }
+}
+
+/******************************************************************************
+ * Methode :
+ * Beschreibung:
+ * Erstellt : OK 25.04.94 13:45
+ * Aenderung :
+ ******************************************************************************/
+
+String SwEditShell::Calculate()
+{
+ String aFormel; // die entgueltige Formel
+ SwPaM *pPaMLast = (SwPaM*)GetCrsr()->GetNext(),
+ *pPaM = pPaMLast; // die Pointer auf Cursor
+ SwCalc aCalc( *GetDoc() );
+ const CharClass& rCC = GetAppCharClass();
+
+ do {
+ SwTxtNode* pTxtNd = pPaM->GetNode()->GetTxtNode();
+ if(pTxtNd)
+ {
+ const SwPosition *pStart = pPaM->Start(), *pEnd = pPaM->End();
+ xub_StrLen nStt = pStart->nContent.GetIndex();
+ String aStr = pTxtNd->GetExpandTxt( nStt, pEnd->nContent.
+ GetIndex() - nStt );
+
+ rCC.toLower( aStr );
+
+ sal_Unicode ch;
+ sal_Bool bValidFlds = sal_False;
+ xub_StrLen nPos = 0;
+
+ while( nPos < aStr.Len() )
+ {
+ ch = aStr.GetChar( nPos++ );
+ if( rCC.isLetter( aStr, nPos-1 ) || ch == '_' )
+ {
+ xub_StrLen nTmpStt = nPos-1;
+ while( nPos < aStr.Len() &&
+ 0 != ( ch = aStr.GetChar( nPos++ )) &&
+ (rCC.isLetterNumeric( aStr, nPos - 1 ) ||
+ ch == '_'|| ch == '.' ))
+ ;
+
+ if( nPos < aStr.Len() )
+ --nPos;
+
+ String sVar( aStr.Copy( nTmpStt, nPos - nTmpStt ));
+ if( !::FindOperator( sVar ) &&
+ (::Find( sVar, aCalc.GetVarTable(),TBLSZ) ||
+ aCalc.VarLook( sVar )) )
+ {
+ if( !bValidFlds )
+ {
+ GetDoc()->FldsToCalc( aCalc,
+ pStart->nNode.GetIndex(),
+ pStart->nContent.GetIndex() );
+ bValidFlds = sal_True;
+ }
+ (( aFormel += '(' ) +=
+ aCalc.GetStrResult( aCalc.VarLook( sVar )
+ ->nValue )) += ')';
+ }
+ else
+ aFormel += sVar;
+ }
+ else
+ aFormel += ch;
+ }
+ }
+ } while( pPaMLast != (pPaM = (SwPaM*)pPaM->GetNext()) );
+
+ return aCalc.GetStrResult( aCalc.Calculate(aFormel) );
+}
+
+
+sfx2::LinkManager& SwEditShell::GetLinkManager()
+{
+ return pDoc->GetLinkManager();
+}
+
+
+void *SwEditShell::GetIMapInventor() const
+{
+ //Als eindeutige Identifikation sollte der Node, auf dem der Crsr steht
+ //genuegen.
+ return (void*)GetCrsr()->GetNode();
+}
+
+// --> OD 2007-03-01 #i73788#
+// remove default parameter, because method is always called this default value
+Graphic SwEditShell::GetIMapGraphic() const
+{
+ //Liefert immer eine Graphic, wenn der Crsr in einem Fly steht.
+ SET_CURR_SHELL( (ViewShell*)this );
+ Graphic aRet;
+ SwPaM* pCrsr = GetCrsr();
+ if ( !pCrsr->HasMark() )
+ {
+ SwNode *pNd =pCrsr->GetNode();
+ if( pNd->IsGrfNode() )
+ {
+ const Graphic& rGrf = ((SwGrfNode*)pNd)->GetGrf();
+ if( rGrf.IsSwapOut() || ( ((SwGrfNode*)pNd)->IsLinkedFile() &&
+ GRAPHIC_DEFAULT == rGrf.GetType() ) )
+ {
+#ifdef DBG_UTIL
+ ASSERT( ((SwGrfNode*)pNd)->SwapIn( sal_True ) || !sal_True, "Grafik konnte nicht geladen werden" );
+#else
+ ((SwGrfNode*)pNd)->SwapIn( sal_True );
+#endif
+ }
+ aRet = rGrf;
+ }
+ else if ( pNd->IsOLENode() )
+ {
+ aRet = *((SwOLENode*)pNd)->GetGraphic();
+ }
+ else
+ {
+ SwFlyFrm* pFlyFrm = pNd->GetCntntNode()->getLayoutFrm( GetLayout() )->FindFlyFrm();
+ if(pFlyFrm)
+ aRet = pFlyFrm->GetFmt()->MakeGraphic();
+ }
+ }
+ return aRet;
+}
+
+
+sal_Bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, sal_Bool bKeepSelection )
+{
+ // URL und Hinweistext (direkt oder via Selektion) notwendig
+ if( !rFmt.GetValue().Len() || ( !rStr.Len() && !HasSelection() ) )
+ return sal_False;
+ StartAllAction();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_UI_INSERT_URLTXT, NULL);
+ sal_Bool bInsTxt = sal_True;
+
+ if( rStr.Len() )
+ {
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->HasMark() && *pCrsr->GetPoint() != *pCrsr->GetMark() )
+ {
+ // Selection vorhanden, MehrfachSelektion?
+ sal_Bool bDelTxt = sal_True;
+ if( pCrsr->GetNext() == pCrsr )
+ {
+ // einfach Selection -> Text ueberpruefen
+ String sTxt( GetSelTxt() );
+ sTxt.EraseTrailingChars();
+ if( sTxt == rStr )
+ bDelTxt = bInsTxt = sal_False;
+ }
+ else if( rFmt.GetValue() == rStr ) // Name und URL gleich?
+ bDelTxt = bInsTxt = sal_False;
+
+ if( bDelTxt )
+ Delete();
+ }
+ else if( pCrsr->GetNext() != pCrsr && rFmt.GetValue() == rStr )
+ bInsTxt = sal_False;
+
+ if( bInsTxt )
+ {
+ Insert2( rStr );
+ SetMark();
+ ExtendSelection( sal_False, rStr.Len() );
+ }
+ }
+ else
+ bInsTxt = sal_False;
+
+ SetAttr( rFmt );
+ if (bInsTxt && !IsCrsrPtAtEnd())
+ SwapPam();
+ if(!bKeepSelection)
+ ClearMark();
+ if( bInsTxt )
+ DontExpandFmt();
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_UI_INSERT_URLTXT, NULL );
+ EndAllAction();
+ return sal_True;
+}
+
+
+sal_uInt16 SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr )
+{
+ if( rArr.Count() )
+ rArr.DeleteAndDestroy( 0, rArr.Count() );
+
+ const SwTxtNode* pTxtNd;
+ const SwCharFmts* pFmts = GetDoc()->GetCharFmts();
+ for( sal_uInt16 n = pFmts->Count(); 1 < n; )
+ {
+ SwIterator<SwTxtINetFmt,SwCharFmt> aIter(*(*pFmts)[--n]);
+ for( SwTxtINetFmt* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
+ {
+ if( 0 != ( pTxtNd = pFnd->GetpTxtNode()) &&
+ pTxtNd->GetNodes().IsDocNodes() )
+ {
+ SwTxtINetFmt& rAttr = *pFnd;
+ String sTxt( pTxtNd->GetExpandTxt( *rAttr.GetStart(),
+ *rAttr.GetEnd() - *rAttr.GetStart() ) );
+
+ sTxt.EraseAllChars( 0x0a );
+ sTxt.EraseLeadingChars().EraseTrailingChars();
+
+ if( sTxt.Len() )
+ {
+ SwGetINetAttr* pNew = new SwGetINetAttr( sTxt, rAttr );
+ rArr.C40_INSERT( SwGetINetAttr, pNew, rArr.Count() );
+ }
+ }
+ }
+ }
+ return rArr.Count();
+}
+
+
+ // ist der Cursor in eine INetAttribut, dann wird das komplett
+ // geloescht; inclusive des Hinweistextes (wird beim Drag&Drop gebraucht)
+sal_Bool SwEditShell::DelINetAttrWithText()
+{
+ sal_Bool bRet = SelectTxtAttr( RES_TXTATR_INETFMT, sal_False );
+ if( bRet )
+ DeleteSel( *GetCrsr() );
+ return bRet;
+}
+
+
+// setzen an den Textzeichenattributen das DontExpand-Flag
+sal_Bool SwEditShell::DontExpandFmt()
+{
+ sal_Bool bRet = sal_False;
+ if( !IsTableMode() && GetDoc()->DontExpandFmt( *GetCrsr()->GetPoint() ))
+ {
+ bRet = sal_True;
+ CallChgLnk();
+ }
+ return bRet;
+}
+
+SvNumberFormatter* SwEditShell::GetNumberFormatter()
+{
+ return GetDoc()->GetNumberFormatter();
+}
+
+sal_Bool SwEditShell::RemoveInvisibleContent()
+{
+ StartAllAction();
+ sal_Bool bRet = GetDoc()->RemoveInvisibleContent();
+ EndAllAction();
+ return bRet;
+}
+sal_Bool SwEditShell::ConvertFieldsToText()
+{
+ StartAllAction();
+ sal_Bool bRet = GetDoc()->ConvertFieldsToText();
+ EndAllAction();
+ return bRet;
+}
+void SwEditShell::SetNumberingRestart()
+{
+ StartAllAction();
+ Push();
+ //iterate over all text contents - body, frames, header, footer, footnote text
+ SwPaM* pCrsr = GetCrsr();
+ for(sal_uInt16 i = 0; i < 2; i++)
+ {
+ if(!i)
+ MakeFindRange(DOCPOS_START, DOCPOS_END, pCrsr); //body content
+ else
+ MakeFindRange(DOCPOS_OTHERSTART, DOCPOS_OTHEREND, pCrsr); //extra content
+ SwPosition* pSttPos = pCrsr->Start(), *pEndPos = pCrsr->End();
+ sal_uLong nCurrNd = pSttPos->nNode.GetIndex();
+ sal_uLong nEndNd = pEndPos->nNode.GetIndex();
+ if( nCurrNd <= nEndNd )
+ {
+ SwCntntFrm* pCntFrm;
+ sal_Bool bGoOn = sal_True;
+ //iterate over all paragraphs
+ while( bGoOn )
+ {
+ SwNode* pNd = GetDoc()->GetNodes()[ nCurrNd ];
+ switch( pNd->GetNodeType() )
+ {
+ case ND_TEXTNODE:
+ if( 0 != ( pCntFrm = ((SwTxtNode*)pNd)->getLayoutFrm( GetLayout() )) )
+ {
+ //jump over hidden frames - ignore protection!
+ if( !((SwTxtFrm*)pCntFrm)->IsHiddenNow() )
+ {
+ //if the node is numbered and the starting value of the numbering equals the
+ //start value of the numbering rule then set this value as hard starting value
+
+ //get the node num
+ // OD 2005-11-09
+ SwTxtNode* pTxtNd( static_cast<SwTxtNode*>(pNd) );
+ SwNumRule* pNumRule( pTxtNd->GetNumRule() );
+
+ if ( pNumRule && pTxtNd->GetNum() &&
+ ( pTxtNd->HasNumber() || pTxtNd->HasBullet() ) &&
+ pTxtNd->IsCountedInList() &&
+ !pTxtNd->IsListRestart() &&
+ pTxtNd->GetNum()->GetNumber() ==
+ pNumRule->Get( static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()) ).GetStart() )
+ {
+ //now set a the start value as attribute
+ SwPosition aCurrentNode(*pNd);
+ GetDoc()->SetNumRuleStart( aCurrentNode, sal_True );
+ }
+ }
+ }
+ break;
+ case ND_SECTIONNODE:
+ // jump over hidden sections - ignore protection!
+ if(((SwSectionNode*)pNd)->GetSection().IsHidden() )
+ nCurrNd = pNd->EndOfSectionIndex();
+ break;
+ case ND_ENDNODE:
+ {
+ break;
+ }
+ }
+
+ bGoOn = nCurrNd < nEndNd;
+ ++nCurrNd;
+ }
+ }
+ }
+
+
+ Pop(sal_False);
+ EndAllAction();
+}
+
+sal_uInt16 SwEditShell::GetLineCount( sal_Bool bActPos )
+{
+ sal_uInt16 nRet = 0;
+ CalcLayout();
+ SwPaM* pPam = GetCrsr();
+ SwNodeIndex& rPtIdx = pPam->GetPoint()->nNode;
+ SwNodeIndex aStart( rPtIdx );
+ SwCntntNode* pCNd;
+ SwCntntFrm *pCntFrm = 0;
+ sal_uLong nTmpPos;
+
+ if( !bActPos )
+ aStart = 0;
+ else if( rPtIdx > ( nTmpPos = GetDoc()->GetNodes().GetEndOfExtras().GetIndex()) )
+ // BodyBereich => Start ist EndOfIcons + 1
+ aStart = nTmpPos + 1;
+ else
+ {
+ if( 0 != ( pCNd = pPam->GetCntntNode() ) &&
+ 0 != ( pCntFrm = pCNd->getLayoutFrm( GetLayout() ) ) )
+ {
+ const SwStartNode *pTmp;
+ if( pCntFrm->IsInFly() ) // Fly
+ pTmp = pCNd->FindFlyStartNode();
+ else if( pCntFrm->IsInFtn() ) // Footnote
+ pTmp = pCNd->FindFootnoteStartNode();
+ else
+ { // Footer/Header
+ const sal_uInt16 nTyp = FRM_HEADER | FRM_FOOTER;
+ SwFrm* pFrm = pCntFrm;
+ while( pFrm && !(pFrm->GetType() & nTyp) )
+ pFrm = pFrm->GetUpper();
+ ASSERT( pFrm, "Wo bin ich?" );
+ if( pFrm && ( pFrm->GetType() & FRM_FOOTER ) )
+ pTmp = pCNd->FindFooterStartNode();
+ else
+ pTmp = pCNd->FindHeaderStartNode();
+ }
+ ASSERT( pTmp, "Missing StartNode" );
+ aStart = *pTmp;
+ }
+ ASSERT( pCNd && pCntFrm, "Missing Layout-Information" );
+ }
+
+ while( 0 != ( pCNd = GetDoc()->GetNodes().GoNextSection(
+ &aStart, sal_True, sal_False )) && ( !bActPos || aStart <= rPtIdx ) )
+ {
+ if( 0 != ( pCntFrm = pCNd->getLayoutFrm( GetLayout() ) ) && pCntFrm->IsTxtFrm() )
+ {
+ xub_StrLen nActPos = bActPos && aStart == rPtIdx ?
+ pPam->GetPoint()->nContent.GetIndex() : USHRT_MAX;
+ nRet = nRet + ((SwTxtFrm*)pCntFrm)->GetLineCount( nActPos );
+ }
+ }
+ return nRet;
+}
+
+long SwEditShell::CompareDoc( const SwDoc& rDoc )
+{
+ StartAllAction();
+ long nRet = GetDoc()->CompareDoc( rDoc );
+ EndAllAction();
+ return nRet;
+}
+
+long SwEditShell::MergeDoc( const SwDoc& rDoc )
+{
+ StartAllAction();
+ long nRet = GetDoc()->MergeDoc( rDoc );
+ EndAllAction();
+ return nRet;
+}
+
+
+const SwFtnInfo& SwEditShell::GetFtnInfo() const
+{
+ return GetDoc()->GetFtnInfo();
+}
+
+void SwEditShell::SetFtnInfo(const SwFtnInfo& rInfo)
+{
+ StartAllAction();
+ SET_CURR_SHELL( this );
+ GetDoc()->SetFtnInfo(rInfo);
+ CallChgLnk();
+ EndAllAction();
+}
+
+const SwEndNoteInfo& SwEditShell::GetEndNoteInfo() const
+{
+ return GetDoc()->GetEndNoteInfo();
+}
+
+void SwEditShell::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
+{
+ StartAllAction();
+ SET_CURR_SHELL( this );
+ GetDoc()->SetEndNoteInfo(rInfo);
+ EndAllAction();
+}
+
+const SwLineNumberInfo& SwEditShell::GetLineNumberInfo() const
+{
+ return GetDoc()->GetLineNumberInfo();
+}
+
+void SwEditShell::SetLineNumberInfo(const SwLineNumberInfo& rInfo)
+{
+ StartAllAction();
+ SET_CURR_SHELL( this );
+ GetDoc()->SetLineNumberInfo(rInfo);
+ AddPaintRect( GetLayout()->Frm() );
+ EndAllAction();
+}
+
+sal_uInt16 SwEditShell::GetLinkUpdMode(sal_Bool bDocSettings) const
+{
+ return getIDocumentSettingAccess()->getLinkUpdateMode( !bDocSettings );
+}
+
+void SwEditShell::SetLinkUpdMode( sal_uInt16 nMode )
+{
+ getIDocumentSettingAccess()->setLinkUpdateMode( nMode );
+}
+
+
+// Schnittstelle fuer die TextInputDaten - ( fuer die Texteingabe
+// von japanischen/chinesischen Zeichen)
+SwExtTextInput* SwEditShell::CreateExtTextInput(LanguageType eInputLanguage)
+{
+ SwExtTextInput* pRet = GetDoc()->CreateExtTextInput( *GetCrsr() );
+ pRet->SetLanguage(eInputLanguage);
+ pRet->SetOverwriteCursor( SwCrsrShell::IsOverwriteCrsr() );
+ return pRet;
+}
+
+String SwEditShell::DeleteExtTextInput( SwExtTextInput* pDel, sal_Bool bInsText )
+{
+ if( !pDel )
+ {
+ const SwPosition& rPos = *GetCrsr()->GetPoint();
+ pDel = GetDoc()->GetExtTextInput( rPos.nNode.GetNode(),
+ rPos.nContent.GetIndex() );
+ if( !pDel )
+ {
+ //JP 25.10.2001: under UNIX the cursor is moved before the Input-
+ // Engine event comes in. So take any - normally there
+ // exist only one at the time. -- Task 92016
+ pDel = GetDoc()->GetExtTextInput();
+ }
+ }
+ String sRet;
+ if( pDel )
+ {
+ rtl::OUString sTmp;
+ SwUnoCursorHelper::GetTextFromPam(*pDel, sTmp);
+ sRet = sTmp;
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ pDel->SetInsText( bInsText );
+ SetOverwriteCrsr( pDel->IsOverwriteCursor() );
+ const SwPosition aPos( *pDel->GetPoint() );
+ GetDoc()->DeleteExtTextInput( pDel );
+
+ // In this case, the "replace" function did not set the cursor
+ // to the original position. Therefore we have to do this manually.
+ if ( ! bInsText && IsOverwriteCrsr() )
+ *GetCrsr()->GetPoint() = aPos;
+
+ EndAllAction();
+ }
+ return sRet;
+}
+
+void SwEditShell::SetExtTextInputData( const CommandExtTextInputData& rData )
+{
+ const SwPosition& rPos = *GetCrsr()->GetPoint();
+ SwExtTextInput* pInput = GetDoc()->GetExtTextInput( rPos.nNode.GetNode()
+ /*, rPos.nContent.GetIndex()*/ );
+ if( pInput )
+ {
+ StartAllAction();
+ SET_CURR_SHELL( this );
+
+ if( !rData.IsOnlyCursorChanged() )
+ pInput->SetInputData( rData );
+ // Cursor positionieren:
+ const SwPosition& rStt = *pInput->Start();
+ xub_StrLen nNewCrsrPos = rStt.nContent.GetIndex() + rData.GetCursorPos();
+
+ // zwar unschoen aber was hilfts
+ ShowCrsr();
+ long nDiff = nNewCrsrPos - rPos.nContent.GetIndex();
+ if( 0 > nDiff )
+ Left( (xub_StrLen)-nDiff, CRSR_SKIP_CHARS );
+ else if( 0 < nDiff )
+ Right( (xub_StrLen)nDiff, CRSR_SKIP_CHARS );
+
+ SetOverwriteCrsr( rData.IsCursorOverwrite() );
+
+ EndAllAction();
+
+ if( !rData.IsCursorVisible() ) // must be called after the EndAction
+ HideCrsr();
+ }
+}
+
+void SwEditShell::TransliterateText( sal_uInt32 nType )
+{
+ utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), nType );
+ StartAllAction();
+ SET_CURR_SHELL( this );
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr )
+ {
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+ FOREACHPAM_START( this )
+
+ if( PCURCRSR->HasMark() )
+ GetDoc()->TransliterateText( *PCURCRSR, aTrans );
+
+ FOREACHPAM_END()
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+ }
+ else
+ GetDoc()->TransliterateText( *pCrsr, aTrans );
+
+ EndAllAction();
+}
+
+void SwEditShell::CountWords( SwDocStat& rStat ) const
+{
+ FOREACHPAM_START( this )
+
+ if( PCURCRSR->HasMark() )
+ GetDoc()->CountWords( *PCURCRSR, rStat );
+
+ FOREACHPAM_END()
+}
+
+void SwEditShell::ApplyViewOptions( const SwViewOption &rOpt )
+{
+ SwCrsrShell::StartAction();
+ ViewShell::ApplyViewOptions( rOpt );
+ SwEditShell::EndAction();
+}
+
+
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
new file mode 100644
index 000000000000..10dcba3c1a3c
--- /dev/null
+++ b/sw/source/core/edit/edlingu.cxx
@@ -0,0 +1,1974 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/linguistic2/ProofreadingResult.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
+#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
+#include <com/sun/star/text/XFlatParagraph.hpp>
+
+#include <unoflatpara.hxx>
+
+#include <comcore.hrc>
+#include <hintids.hxx>
+#include <linguistic/lngprops.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/svxacorr.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/SpellPortions.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <charatr.hxx>
+#include <editsh.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <rootfrm.hxx> // SwRootFrm
+#include <pam.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <ndtxt.hxx> // AdjHyphPos
+#include <viewopt.hxx> // HyphStart/End
+#include <viscrs.hxx> // SwShellCrsr
+#include <SwGrammarMarkUp.hxx> // SwWrongList
+#include <mdiexp.hxx> // Statusanzeige
+#include <statstr.hrc> // StatLine-String
+#include <cntfrm.hxx>
+#include <crsskip.hxx>
+#include <splargs.hxx>
+#include <redline.hxx> // SwRedline
+#include <docary.hxx> // SwRedlineTbl
+#include <docsh.hxx>
+#include <txatbase.hxx>
+#include <txtfrm.hxx>
+
+using namespace ::svx;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::linguistic2;
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+/*************************************************************************
+ * class SwLinguIter
+ *************************************************************************/
+
+class SwLinguIter
+{
+ SwEditShell *pSh;
+ SwPosition *pStart;
+ SwPosition *pEnd;
+ SwPosition *pCurr;
+ SwPosition *pCurrX;
+ sal_uInt16 nCrsrCnt;
+public:
+ SwLinguIter();
+
+ inline SwEditShell *GetSh() { return pSh; }
+ inline const SwEditShell *GetSh() const { return pSh; }
+
+ inline const SwPosition *GetEnd() const { return pEnd; }
+ inline void SetEnd( SwPosition* pNew ){ delete pEnd; pEnd = pNew; }
+
+ inline const SwPosition *GetStart() const { return pStart; }
+ inline void SetStart( SwPosition* pNew ){ delete pStart; pStart = pNew; }
+
+ inline const SwPosition *GetCurr() const { return pCurr; }
+ inline void SetCurr( SwPosition* pNew ){ delete pCurr; pCurr = pNew; }
+
+ inline const SwPosition *GetCurrX() const { return pCurrX; }
+ inline void SetCurrX( SwPosition* pNew ){ delete pCurrX; pCurrX = pNew; }
+
+ inline sal_uInt16& GetCrsrCnt(){ return nCrsrCnt; }
+
+ // Der UI-Bauchladen:
+ void _Start( SwEditShell *pSh, SwDocPositions eStart,
+ SwDocPositions eEnd );
+ void _End(bool bRestoreSelection = true);
+};
+
+/*************************************************************************
+ * class SwSpellIter
+ *************************************************************************/
+
+// #i18881# to be able to identify the postions of the changed words
+// the content positions of each portion need to be saved
+struct SpellContentPosition
+{
+ sal_uInt16 nLeft;
+ sal_uInt16 nRight;
+};
+typedef std::vector<SpellContentPosition> SpellContentPositions;
+class SwSpellIter : public SwLinguIter
+{
+ uno::Reference< XSpellChecker1 > xSpeller;
+ ::svx::SpellPortions aLastPortions;
+
+ SpellContentPositions aLastPositions;
+ bool bBackToStartOfSentence;
+ bool bMoveToEndOfSentence;
+
+
+ void CreatePortion(uno::Reference< XSpellAlternatives > xAlt,
+ linguistic2::ProofreadingResult* pGrammarResult,
+ bool bIsField, bool bIsHidden);
+
+ void AddPortion(uno::Reference< XSpellAlternatives > xAlt,
+ linguistic2::ProofreadingResult* pGrammarResult,
+ const SpellContentPositions& rDeletedRedlines);
+public:
+ SwSpellIter() :
+ bBackToStartOfSentence(false), bMoveToEndOfSentence(false) {}
+
+ void Start( SwEditShell *pSh, SwDocPositions eStart, SwDocPositions eEnd );
+
+ uno::Any Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
+
+ bool SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammarCheck);
+ void ToSentenceStart();
+ const ::svx::SpellPortions GetLastPortions(){ return aLastPortions;}
+ SpellContentPositions GetLastPositions() {return aLastPositions;}
+ void ContinueAfterThisSentence() { bMoveToEndOfSentence = true; }
+};
+
+/*************************************************************************
+ * class SwConvIter
+ * used for text conversion
+ *************************************************************************/
+
+class SwConvIter : public SwLinguIter
+{
+ SwConversionArgs &rArgs;
+public:
+ SwConvIter( SwConversionArgs &rConvArgs ) :
+ rArgs( rConvArgs )
+ {}
+
+ void Start( SwEditShell *pSh, SwDocPositions eStart, SwDocPositions eEnd );
+
+ uno::Any Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
+};
+
+/*************************************************************************
+ * class SwHyphIter
+ *************************************************************************/
+
+class SwHyphIter : public SwLinguIter
+{
+ sal_Bool bOldIdle;
+ void DelSoftHyph( SwPaM &rPam );
+
+public:
+ SwHyphIter() : bOldIdle(sal_False) {}
+
+ void Start( SwEditShell *pSh, SwDocPositions eStart, SwDocPositions eEnd );
+ void End();
+
+ void Ignore();
+
+ uno::Any Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
+
+ sal_Bool IsAuto();
+ void InsertSoftHyph( const xub_StrLen nHyphPos );
+ void ShowSelection();
+};
+
+static SwSpellIter* pSpellIter = 0;
+static SwConvIter* pConvIter = 0;
+static SwHyphIter* pHyphIter = 0;
+
+// Wir ersparen uns in Hyphenate ein GetFrm()
+// Achtung: in txtedt.cxx stehen extern-Deklarationen auf diese Pointer!
+const SwTxtNode *pLinguNode;
+ SwTxtFrm *pLinguFrm;
+
+/*************************************************************************
+ * SwLinguIter::SwLinguIter
+ *************************************************************************/
+
+SwLinguIter::SwLinguIter()
+ : pSh( 0 ), pStart( 0 ), pEnd( 0 ), pCurr( 0 ), pCurrX( 0 )
+{
+ // @@@ es fehlt: Sicherstellen der Reentrance, ASSERTs etc.
+}
+
+/*************************************************************************
+ * SwLinguIter::Start
+ *************************************************************************/
+
+
+
+void SwLinguIter::_Start( SwEditShell *pShell, SwDocPositions eStart,
+ SwDocPositions eEnd )
+{
+ // es fehlt: Sicherstellen der Reentrance, Locking
+ if( pSh )
+ return;
+
+ sal_Bool bSetCurr;
+
+ pSh = pShell;
+
+ SET_CURR_SHELL( pSh );
+
+ ASSERT( !pEnd, "LinguStart ohne End?");
+
+ SwPaM *pCrsr = pSh->GetCrsr();
+
+ // pStk->SetCurCrsr();
+// if( pCrsr->HasMark() || pCrsr != pCrsr->GetNext() )
+ if( pShell->HasSelection() || pCrsr != pCrsr->GetNext() )
+ {
+ bSetCurr = 0 != GetCurr();
+ nCrsrCnt = pSh->GetCrsrCnt();
+ if( pSh->IsTableMode() )
+ pSh->TblCrsrToCursor();
+
+ pSh->Push();
+ sal_uInt16 n;
+ for( n = 0; n < nCrsrCnt; ++n )
+ {
+ pSh->Push();
+ pSh->DestroyCrsr();
+ }
+ pSh->Pop( sal_False );
+ }
+ else
+ {
+ bSetCurr = sal_False;
+ nCrsrCnt = 1;
+ pSh->Push();
+ pSh->SetLinguRange( eStart, eEnd );
+ }
+
+ pCrsr = pSh->GetCrsr();
+ if ( *pCrsr->GetPoint() > *pCrsr->GetMark() )
+ pCrsr->Exchange();
+
+ pStart = new SwPosition( *pCrsr->GetPoint() );
+ pEnd = new SwPosition( *pCrsr->GetMark() );
+ if( bSetCurr )
+ {
+ SwPosition* pNew = new SwPosition( *GetStart() );
+ SetCurr( pNew );
+ pNew = new SwPosition( *pNew );
+ SetCurrX( pNew );
+ }
+
+ pCrsr->SetMark();
+
+ pLinguFrm = 0;
+ pLinguNode = 0;
+}
+
+/*************************************************************************
+ * SwLinguIter::End
+ *************************************************************************/
+
+
+
+void SwLinguIter::_End(bool bRestoreSelection)
+{
+ if( !pSh )
+ return;
+
+ ASSERT( pEnd, "SwEditShell::SpellEnd() ohne Start?");
+ if(bRestoreSelection)
+ {
+ while( nCrsrCnt-- )
+ pSh->Pop( sal_False );
+
+ pSh->KillPams();
+ pSh->ClearMark();
+ }
+ DELETEZ(pStart);
+ DELETEZ(pEnd);
+ DELETEZ(pCurr);
+ DELETEZ(pCurrX);
+
+ pSh = 0;
+
+#ifdef LINGU_STATISTIK
+ aSwLinguStat.Flush();
+#endif
+}
+
+/*************************************************************************
+ * virtual SwSpellIter::Start()
+ *************************************************************************/
+
+
+
+void SwSpellIter::Start( SwEditShell *pShell, SwDocPositions eStart,
+ SwDocPositions eEnd )
+{
+ if( GetSh() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xProp( ::GetLinguPropertySet() );
+ xSpeller = ::GetSpellChecker();
+ if ( xSpeller.is() )
+ _Start( pShell, eStart, eEnd );
+ aLastPortions.clear();
+ aLastPositions.clear();
+}
+
+/*************************************************************************
+ * SwSpellIter::Continue
+ *************************************************************************/
+
+// SwSpellIter::Continue ist das alte Original von
+// SwEditShell::SpellContinue()
+
+uno::Any SwSpellIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
+{
+ //!!
+ //!! Please check SwConvIter also when modifying this
+ //!!
+
+ uno::Any aSpellRet;
+ SwEditShell *pMySh = GetSh();
+ if( !pMySh )
+ return aSpellRet;
+
+// const SwPosition *pEnd = GetEnd();
+
+ ASSERT( GetEnd(), "SwEditShell::SpellContinue() ohne Start?");
+
+ uno::Reference< uno::XInterface > xSpellRet;
+ sal_Bool bGoOn = sal_True;
+ do {
+ SwPaM *pCrsr = pMySh->GetCrsr();
+ if ( !pCrsr->HasMark() )
+ pCrsr->SetMark();
+
+ uno::Reference< beans::XPropertySet > xProp( GetLinguPropertySet() );
+ *pMySh->GetCrsr()->GetPoint() = *GetCurr();
+ *pMySh->GetCrsr()->GetMark() = *GetEnd();
+ pMySh->GetDoc()->Spell(*pMySh->GetCrsr(),
+ xSpeller, pPageCnt, pPageSt, false ) >>= xSpellRet;
+ bGoOn = GetCrsrCnt() > 1;
+ if( xSpellRet.is() )
+ {
+ bGoOn = sal_False;
+ SwPosition* pNewPoint = new SwPosition( *pCrsr->GetPoint() );
+ SwPosition* pNewMark = new SwPosition( *pCrsr->GetMark() );
+ SetCurr( pNewPoint );
+ SetCurrX( pNewMark );
+ }
+ if( bGoOn )
+ {
+ pMySh->Pop( sal_False );
+ pCrsr = pMySh->GetCrsr();
+ if ( *pCrsr->GetPoint() > *pCrsr->GetMark() )
+ pCrsr->Exchange();
+ SwPosition* pNew = new SwPosition( *pCrsr->GetPoint() );
+ SetStart( pNew );
+ pNew = new SwPosition( *pCrsr->GetMark() );
+ SetEnd( pNew );
+ pNew = new SwPosition( *GetStart() );
+ SetCurr( pNew );
+ pNew = new SwPosition( *pNew );
+ SetCurrX( pNew );
+ pCrsr->SetMark();
+ --GetCrsrCnt();
+ }
+ }while ( bGoOn );
+ aSpellRet <<= xSpellRet;
+ return aSpellRet;
+}
+
+/*************************************************************************
+ * virtual SwConvIter::Start()
+ *************************************************************************/
+
+
+
+void SwConvIter::Start( SwEditShell *pShell, SwDocPositions eStart,
+ SwDocPositions eEnd )
+{
+ if( GetSh() )
+ return;
+ _Start( pShell, eStart, eEnd );
+}
+
+/*************************************************************************
+ * SwConvIter::Continue
+ *************************************************************************/
+
+uno::Any SwConvIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
+{
+ //!!
+ //!! Please check SwSpellIter also when modifying this
+ //!!
+
+ uno::Any aConvRet( makeAny( rtl::OUString() ) );
+ SwEditShell *pMySh = GetSh();
+ if( !pMySh )
+ return aConvRet;
+
+// const SwPosition *pEnd = GetEnd();
+
+ ASSERT( GetEnd(), "SwConvIter::Continue() ohne Start?");
+
+ rtl::OUString aConvText;
+ sal_Bool bGoOn = sal_True;
+ do {
+ SwPaM *pCrsr = pMySh->GetCrsr();
+ if ( !pCrsr->HasMark() )
+ pCrsr->SetMark();
+
+ *pMySh->GetCrsr()->GetPoint() = *GetCurr();
+ *pMySh->GetCrsr()->GetMark() = *GetEnd();
+
+ // call function to find next text portion to be converted
+ uno::Reference< linguistic2::XSpellChecker1 > xEmpty;
+ pMySh->GetDoc()->Spell( *pMySh->GetCrsr(),
+ xEmpty, pPageCnt, pPageSt, false, &rArgs ) >>= aConvText;
+
+ bGoOn = GetCrsrCnt() > 1;
+ if( aConvText.getLength() )
+ {
+ bGoOn = sal_False;
+ SwPosition* pNewPoint = new SwPosition( *pCrsr->GetPoint() );
+ SwPosition* pNewMark = new SwPosition( *pCrsr->GetMark() );
+
+ SetCurr( pNewPoint );
+ SetCurrX( pNewMark );
+ }
+ if( bGoOn )
+ {
+ pMySh->Pop( sal_False );
+ pCrsr = pMySh->GetCrsr();
+ if ( *pCrsr->GetPoint() > *pCrsr->GetMark() )
+ pCrsr->Exchange();
+ SwPosition* pNew = new SwPosition( *pCrsr->GetPoint() );
+ SetStart( pNew );
+ pNew = new SwPosition( *pCrsr->GetMark() );
+ SetEnd( pNew );
+ pNew = new SwPosition( *GetStart() );
+ SetCurr( pNew );
+ pNew = new SwPosition( *pNew );
+ SetCurrX( pNew );
+ pCrsr->SetMark();
+ --GetCrsrCnt();
+ }
+ }while ( bGoOn );
+ return makeAny( aConvText );
+}
+
+
+/*************************************************************************
+ * SwHyphIter
+ *************************************************************************/
+
+
+sal_Bool SwHyphIter::IsAuto()
+{
+ uno::Reference< beans::XPropertySet > xProp( ::GetLinguPropertySet() );
+ return xProp.is() ? *(sal_Bool*)xProp->getPropertyValue(
+ C2U(UPN_IS_HYPH_AUTO) ).getValue()
+ : sal_False;
+}
+
+
+void SwHyphIter::ShowSelection()
+{
+ SwEditShell *pMySh = GetSh();
+ if( pMySh )
+ {
+ pMySh->StartAction();
+ // Ganz fatal: durch das EndAction() werden Formatierungen
+ // angeregt, die dazu fuehren koennen, dass im Hyphenator
+ // neue Worte eingestellt werden. Deswegen sichern!
+ pMySh->EndAction();
+ }
+}
+
+/*************************************************************************
+ * virtual SwHyphIter::Start()
+ *************************************************************************/
+
+
+
+void SwHyphIter::Start( SwEditShell *pShell, SwDocPositions eStart, SwDocPositions eEnd )
+{
+ // robust
+ if( GetSh() || GetEnd() )
+ {
+ ASSERT( !GetSh(), "+SwEditShell::HyphStart: missing HyphEnd()" );
+ return;
+ }
+
+// nothing to be done (at least not in the way as in the "else" part)
+ bOldIdle = pShell->GetViewOptions()->IsIdle();
+ ((SwViewOption*)pShell->GetViewOptions())->SetIdle( sal_False );
+ _Start( pShell, eStart, eEnd );
+}
+
+/*************************************************************************
+ * virtual SwHyphIter::End
+ *************************************************************************/
+
+// Selektionen wiederherstellen
+
+
+
+void SwHyphIter::End()
+{
+ if( !GetSh() )
+ return;
+ ((SwViewOption*)GetSh()->GetViewOptions())->SetIdle( bOldIdle );
+ _End();
+}
+
+/*************************************************************************
+ * SwHyphIter::Continue
+ *************************************************************************/
+
+uno::Any SwHyphIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
+{
+ uno::Any aHyphRet;
+ SwEditShell *pMySh = GetSh();
+ if( !pMySh )
+ return aHyphRet;
+
+ const sal_Bool bAuto = IsAuto();
+ uno::Reference< XHyphenatedWord > xHyphWord;
+ sal_uInt16 nRet;
+ sal_Bool bGoOn = sal_False;
+ do {
+ SwPaM *pCrsr;
+ do {
+ ASSERT( GetEnd(), "SwEditShell::SpellContinue() ohne Start?" );
+ pCrsr = pMySh->GetCrsr();
+ if ( !pCrsr->HasMark() )
+ pCrsr->SetMark();
+ if ( *pCrsr->GetPoint() < *pCrsr->GetMark() )
+ {
+ pCrsr->Exchange();
+ pCrsr->SetMark();
+ }
+
+ // geraten BUG:
+ if ( *pCrsr->End() > *GetEnd() )
+ nRet = 0;
+ else
+ {
+ *pCrsr->GetMark() = *GetEnd();
+
+ // Muss an der aktuellen Cursorpos das Wort getrennt werden ?
+ const Point aCrsrPos( pMySh->GetCharRect().Pos() );
+ xHyphWord = pMySh->GetDoc()->Hyphenate( pCrsr, aCrsrPos,
+ pPageCnt, pPageSt );
+ }
+
+ if( bAuto && xHyphWord.is() )
+ {
+ pMySh->InsertSoftHyph( xHyphWord->getHyphenationPos() + 1);
+ }
+ } while( bAuto && xHyphWord.is() ); //end of do-while
+ bGoOn = !xHyphWord.is() && GetCrsrCnt() > 1;
+
+ if( bGoOn )
+ {
+ pMySh->Pop( sal_False );
+ pCrsr = pMySh->GetCrsr();
+ if ( *pCrsr->GetPoint() > *pCrsr->GetMark() )
+ pCrsr->Exchange();
+ SwPosition* pNew = new SwPosition(*pCrsr->End());
+ SetEnd( pNew );
+ pCrsr->SetMark();
+ --GetCrsrCnt();
+ }
+ } while ( bGoOn );
+ aHyphRet <<= xHyphWord;
+ return aHyphRet;
+}
+
+/*************************************************************************
+ * SwHyphIter::HyphIgnore
+ *************************************************************************/
+
+// Beschreibung: Trennstelle ignorieren
+
+void SwHyphIter::Ignore()
+{
+ SwEditShell *pMySh = GetSh();
+ SwPaM *pCrsr = pMySh->GetCrsr();
+
+ // Alten SoftHyphen loeschen
+ DelSoftHyph( *pCrsr );
+
+ // und weiter
+ pCrsr->Start()->nContent = pCrsr->End()->nContent;
+ pCrsr->SetMark();
+}
+
+/*************************************************************************
+ * SwHyphIter::DelSoftHyph
+ *************************************************************************/
+
+void SwHyphIter::DelSoftHyph( SwPaM &rPam )
+{
+ const SwPosition* pStt = rPam.Start();
+ const xub_StrLen nStart = pStt->nContent.GetIndex();
+ const xub_StrLen nEnd = rPam.End()->nContent.GetIndex();
+ SwTxtNode *pNode = pStt->nNode.GetNode().GetTxtNode();
+ pNode->DelSoftHyph( nStart, nEnd );
+}
+
+/*************************************************************************
+ * SwHyphIter::InsertSoftHyph
+ *************************************************************************/
+
+
+void SwHyphIter::InsertSoftHyph( const xub_StrLen nHyphPos )
+{
+ SwEditShell *pMySh = GetSh();
+ ASSERT( pMySh, "+SwEditShell::InsertSoftHyph: missing HyphStart()");
+ if( !pMySh )
+ return;
+
+ SwPaM *pCrsr = pMySh->GetCrsr();
+ SwPosition* pSttPos = pCrsr->Start();
+ SwPosition* pEndPos = pCrsr->End();
+
+ xub_StrLen nLastHyphLen = GetEnd()->nContent.GetIndex() -
+ pSttPos->nContent.GetIndex();
+
+ if( pSttPos->nNode != pEndPos->nNode || !nLastHyphLen )
+ {
+ ASSERT( pSttPos->nNode == pEndPos->nNode,
+ "+SwEditShell::InsertSoftHyph: node warp during hyphenation" );
+ ASSERT(nLastHyphLen, "+SwEditShell::InsertSoftHyph: missing HyphContinue()");
+ *pSttPos = *pEndPos;
+ return;
+ }
+
+ pMySh->StartAction();
+ {
+ SwDoc *pDoc = pMySh->GetDoc();
+ DelSoftHyph( *pCrsr );
+ pSttPos->nContent += nHyphPos;
+ SwPaM aRg( *pSttPos );
+ pDoc->InsertString( aRg, CHAR_SOFTHYPHEN );
+ // Durch das Einfuegen des SoftHyphs ist ein Zeichen hinzugekommen
+//JP 18.07.95: warum, ist doch ein SwIndex, dieser wird doch mitverschoben !!
+// pSttPos->nContent++;
+ }
+ // Die Selektion wird wieder aufgehoben
+ pCrsr->DeleteMark();
+ pMySh->EndAction();
+ pCrsr->SetMark();
+}
+
+// --------------------- Methoden der SwEditShell ------------------------
+
+bool SwEditShell::HasLastSentenceGotGrammarChecked() const
+{
+ bool bTextWasGrammarChecked = false;
+ if (pSpellIter)
+ {
+ ::svx::SpellPortions aLastPortions( pSpellIter->GetLastPortions() );
+ for (size_t i = 0; i < aLastPortions.size() && !bTextWasGrammarChecked; ++i)
+ {
+ // bIsGrammarError is also true if the text was only checked but no
+ // grammar error was found. (That is if a ProofreadingResult was obtained in
+ // SwDoc::Spell and in turn bIsGrammarError was set in SwSpellIter::CreatePortion)
+ if (aLastPortions[i].bIsGrammarError)
+ bTextWasGrammarChecked = true;
+ }
+ }
+ return bTextWasGrammarChecked;
+}
+
+/*************************************************************************
+ * SwEditShell::HasConvIter
+ *************************************************************************/
+
+sal_Bool SwEditShell::HasConvIter() const
+{
+ return 0 != pConvIter;
+}
+
+/*************************************************************************
+ * SwEditShell::HasHyphIter
+ *************************************************************************/
+
+sal_Bool SwEditShell::HasHyphIter() const
+{
+ return 0 != pHyphIter;
+}
+
+/*************************************************************************
+ * SwEditShell::SetFindRange
+ *************************************************************************/
+
+void SwEditShell::SetLinguRange( SwDocPositions eStart, SwDocPositions eEnd )
+{
+ SwPaM *pCrsr = GetCrsr();
+ MakeFindRange( static_cast<sal_uInt16>(eStart), static_cast<sal_uInt16>(eEnd), pCrsr );
+ if( *pCrsr->GetPoint() > *pCrsr->GetMark() )
+ pCrsr->Exchange();
+}
+
+/*************************************************************************
+ * SwEditShell::SpellStart
+ *************************************************************************/
+
+void SwEditShell::SpellStart(
+ SwDocPositions eStart, SwDocPositions eEnd, SwDocPositions eCurr,
+ SwConversionArgs *pConvArgs )
+{
+ SwLinguIter *pLinguIter = 0;
+
+ // do not spell if interactive spelling is active elsewhere
+ if (!pConvArgs && !pSpellIter)
+ {
+ ASSERT( !pSpellIter, "wer ist da schon am spellen?" );
+ pSpellIter = new SwSpellIter;
+ pLinguIter = pSpellIter;
+ }
+ // do not do text conversion if it is active elsewhere
+ if (pConvArgs && !pConvIter)
+ {
+ ASSERT( !pConvIter, "text conversion already active!" );
+ pConvIter = new SwConvIter( *pConvArgs );
+ pLinguIter = pConvIter;
+ }
+
+ if (pLinguIter)
+ {
+ SwCursor* pSwCrsr = GetSwCrsr();
+
+ SwPosition *pTmp = new SwPosition( *pSwCrsr->GetPoint() );
+ pSwCrsr->FillFindPos( eCurr, *pTmp );
+ pLinguIter->SetCurr( pTmp );
+
+ pTmp = new SwPosition( *pTmp );
+ pLinguIter->SetCurrX( pTmp );
+ }
+
+ if (!pConvArgs && pSpellIter)
+ pSpellIter->Start( this, eStart, eEnd );
+ if (pConvArgs && pConvIter)
+ pConvIter->Start( this, eStart, eEnd );
+}
+
+/*************************************************************************
+ * SwEditShell::SpellEnd
+ *************************************************************************/
+
+void SwEditShell::SpellEnd( SwConversionArgs *pConvArgs, bool bRestoreSelection )
+{
+ if (!pConvArgs && pSpellIter && pSpellIter->GetSh() == this)
+ {
+ ASSERT( pSpellIter, "wo ist mein Iterator?" );
+ pSpellIter->_End(bRestoreSelection);
+ delete pSpellIter, pSpellIter = 0;
+ }
+ if (pConvArgs && pConvIter && pConvIter->GetSh() == this)
+ {
+ ASSERT( pConvIter, "wo ist mein Iterator?" );
+ pConvIter->_End();
+ delete pConvIter, pConvIter = 0;
+ }
+}
+
+/*************************************************************************
+ * SwEditShell::SpellContinue
+ *************************************************************************/
+
+// liefert Rueckgabewerte entsprechend SPL_ in splchk.hxx
+
+uno::Any SwEditShell::SpellContinue(
+ sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
+ SwConversionArgs *pConvArgs )
+{
+ uno::Any aRes;
+
+ if ((!pConvArgs && pSpellIter->GetSh() != this) ||
+ ( pConvArgs && pConvIter->GetSh() != this))
+ return aRes;
+
+ if( pPageCnt && !*pPageCnt )
+ {
+ sal_uInt16 nEndPage = GetLayout()->GetPageNum();
+ nEndPage += nEndPage * 10 / 100;
+ *pPageCnt = nEndPage;
+ if( nEndPage )
+ ::StartProgress( STR_STATSTR_SPELL, 0, nEndPage, GetDoc()->GetDocShell() );
+ }
+
+ ASSERT( pConvArgs || pSpellIter, "SpellIter missing" );
+ ASSERT( !pConvArgs || pConvIter, "ConvIter missing" );
+ //JP 18.07.95: verhinder bei Fehlermeldungen die Anzeige der Selektionen
+ // KEIN StartAction, da damit auch die Paints abgeschaltet
+ // werden !!!!!
+ ++nStartAction;
+ rtl::OUString aRet;
+ uno::Reference< uno::XInterface > xRet;
+ if (pConvArgs)
+ {
+ pConvIter->Continue( pPageCnt, pPageSt ) >>= aRet;
+ aRes <<= aRet;
+ }
+ else
+ {
+ pSpellIter->Continue( pPageCnt, pPageSt ) >>= xRet;
+ aRes <<= xRet;
+ }
+ --nStartAction;
+
+ if( aRet.getLength() || xRet.is() )
+ {
+ // dann die awt::Selection sichtbar machen
+ StartAction();
+ EndAction();
+ }
+ return aRes;
+}
+/*************************************************************************
+ * SwEditShell::HyphStart
+ *************************************************************************/
+
+/* Interaktive Trennung, BP 10.03.93
+ *
+ * 1) HyphStart
+ * - Aufheben aller Selektionen
+ * - Sichern des aktuellen Cursors
+ * - falls keine Selektion vorhanden:
+ * - neue Selektion bis zum Dokumentende
+ * 2) HyphContinue
+ * - nLastHyphLen wird auf den Selektionsstart addiert
+ * - iteriert ueber alle selektierten Bereiche
+ * - pDoc->Hyphenate() iteriert ueber alle Nodes der Selektion
+ * - pTxtNode->Hyphenate() ruft das SwTxtFrm::Hyphenate zur EditShell
+ * - SwTxtFrm:Hyphenate() iteriert ueber die Zeilen des Pams
+ * - LineIter::Hyphenate() stellt den Hyphenator
+ * und den Pam auf das zu trennende Wort ein.
+ * - Es gibt nur zwei Returnwerte sal_True, wenn eine Trennstelle anliegt
+ * und sal_False, wenn der Pam abgearbeitet wurde.
+ * - Bei sal_True wird das selektierte Wort zur Anzeige gebracht und
+ * nLastHyphLen gesetzt.
+ * - Bei sal_False wird die aktuelle Selektion geloescht und die naechste
+ * zur aktuellen gewaehlt. Return HYPH_OK, wenn keine mehr vorhanden.
+ * 3) InsertSoftHyph (wird ggf. von der UI gerufen)
+ * - Der aktuelle Cursor wird plaziert und das Attribut eingefuegt.
+ * 4) HyphEnd
+ * - Wiederherstellen des alten Cursors, EndAction
+ */
+
+
+
+void SwEditShell::HyphStart( SwDocPositions eStart, SwDocPositions eEnd )
+{
+ // do not hyphenate if interactive hyphenationg is active elsewhere
+ if (!pHyphIter)
+ {
+ ASSERT( !pHyphIter, "wer ist da schon am hyphinieren?" );
+ pHyphIter = new SwHyphIter;
+ pHyphIter->Start( this, eStart, eEnd );
+ }
+}
+
+/*************************************************************************
+ * SwEditShell::HyphEnd
+ *************************************************************************/
+
+// Selektionen wiederherstellen
+
+
+
+void SwEditShell::HyphEnd()
+{
+ if (pHyphIter->GetSh() == this)
+ {
+ ASSERT( pHyphIter, "wo ist mein Iterator?" );
+ pHyphIter->End();
+ delete pHyphIter, pHyphIter = 0;
+ }
+}
+
+/*************************************************************************
+ * SwEditShell::HyphContinue
+ *************************************************************************/
+
+// Returnwerte: (BP: ich wuerde es genau umdrehen, aber die UI wuenscht es so)
+// HYPH_CONTINUE, wenn eine Trennstelle anliegt
+// HYPH_OK, wenn der selektierte Bereich abgearbeitet wurde.
+
+
+uno::Reference< uno::XInterface >
+ SwEditShell::HyphContinue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
+{
+ if (pHyphIter->GetSh() != this)
+ return 0;
+
+ if( pPageCnt && !*pPageCnt && !*pPageSt )
+ {
+ sal_uInt16 nEndPage = GetLayout()->GetPageNum();
+ nEndPage += nEndPage * 10 / 100;
+ if( nEndPage > 14 )
+ {
+ *pPageCnt = nEndPage;
+ ::StartProgress( STR_STATSTR_HYPHEN, 0, nEndPage, GetDoc()->GetDocShell());
+ }
+ else // Hiermit unterdruecken wir ein fuer allemal
+ *pPageSt = 1; // das StatLineStartPercent
+ }
+
+ ASSERT( pHyphIter, "wo ist mein Iterator?" );
+ //JP 18.07.95: verhinder bei Fehlermeldungen die Anzeige der Selektionen
+ // KEIN StartAction, da damit auch die Paints abgeschaltet
+ // werden !!!!!
+ ++nStartAction;
+ uno::Reference< uno::XInterface > xRet;
+ pHyphIter->Continue( pPageCnt, pPageSt ) >>= xRet;
+ --nStartAction;
+
+ if( xRet.is() )
+ pHyphIter->ShowSelection();
+
+ return xRet;
+}
+
+
+/*************************************************************************
+ * SwEditShell::InsertSoftHyph
+ *************************************************************************/
+
+// Zum Einfuegen des SoftHyphens, Position ist der Offset
+// innerhalb des getrennten Wortes.
+
+
+void SwEditShell::InsertSoftHyph( const xub_StrLen nHyphPos )
+{
+ ASSERT( pHyphIter, "wo ist mein Iterator?" );
+ pHyphIter->InsertSoftHyph( nHyphPos );
+}
+
+
+/*************************************************************************
+ * SwEditShell::HyphIgnore
+ *************************************************************************/
+
+// Beschreibung: Trennstelle ignorieren
+
+void SwEditShell::HyphIgnore()
+{
+ ASSERT( pHyphIter, "wo ist mein Iterator?" );
+ //JP 18.07.95: verhinder bei Fehlermeldungen die Anzeige der Selektionen
+ // KEIN StartAction, da damit auch die Paints abgeschaltet
+ // werden !!!!!
+ ++nStartAction;
+ pHyphIter->Ignore();
+ --nStartAction;
+
+ pHyphIter->ShowSelection();
+}
+
+/*************************************************************************
+ * SwEditShell::GetCorrection()
+ * liefert eine Liste von Vorschlaegen fuer falsch geschriebene Worte,
+ * ein NULL-Pointer signalisiert, dass das Wort richtig geschrieben ist,
+ * eine leere Liste, dass das Wort zwar unbekannt ist, aber keine Alternativen
+ * geliefert werden koennen.
+ *************************************************************************/
+
+
+uno::Reference< XSpellAlternatives >
+ SwEditShell::GetCorrection( const Point* pPt, SwRect& rSelectRect )
+{
+ uno::Reference< XSpellAlternatives > xSpellAlt;
+
+ if( IsTableMode() )
+ return NULL;
+ SwPaM* pCrsr = GetCrsr();
+ SwPosition aPos( *pCrsr->GetPoint() );
+ Point aPt( *pPt );
+ SwCrsrMoveState eTmpState( MV_SETONLYTEXT );
+ SwTxtNode *pNode;
+ SwWrongList *pWrong;
+ if( GetLayout()->GetCrsrOfst( &aPos, aPt, &eTmpState ) &&
+ 0 != (pNode = aPos.nNode.GetNode().GetTxtNode()) &&
+ 0 != (pWrong = pNode->GetWrong()) &&
+ !pNode->IsInProtectSect() )
+ {
+ xub_StrLen nBegin = aPos.nContent.GetIndex();
+ xub_StrLen nLen = 1;
+ if( pWrong->InWrongWord(nBegin,nLen) && !pNode->IsSymbol(nBegin) )
+ {
+ String aText( pNode->GetTxt().Copy( nBegin, nLen ) );
+ String aWord( aText );
+ aWord.EraseAllChars( CH_TXTATR_BREAKWORD ).EraseAllChars( CH_TXTATR_INWORD );
+
+ uno::Reference< XSpellChecker1 > xSpell( ::GetSpellChecker() );
+ if( xSpell.is() )
+ {
+ LanguageType eActLang = (LanguageType)pNode->GetLang( nBegin, nLen );
+ if( xSpell->hasLanguage( eActLang ))
+ {
+ // restrict the maximal number of suggestions displayed
+ // in the context menu.
+ // Note: That could of course be done by clipping the
+ // resulting sequence but the current third party
+ // implementations result differs greatly if the number of
+ // suggestions to be retuned gets changed. Statistically
+ // it gets much better if told to return e.g. only 7 strings
+ // than returning e.g. 16 suggestions and using only the
+ // first 7. Thus we hand down the value to use to that
+ // implementation here by providing an additional parameter.
+ Sequence< PropertyValue > aPropVals(1);
+ PropertyValue &rVal = aPropVals.getArray()[0];
+ rVal.Name = C2U( UPN_MAX_NUMBER_OF_SUGGESTIONS );
+ rVal.Value <<= (sal_Int16) 7;
+
+ xSpellAlt = xSpell->spell( aWord, eActLang, aPropVals );
+ }
+ }
+
+ if ( xSpellAlt.is() ) // error found?
+ {
+ //save the start and end positons of the line and the starting point
+ Push();
+ LeftMargin();
+ xub_StrLen nLineStart = GetCrsr()->GetPoint()->nContent.GetIndex();
+ RightMargin();
+ xub_StrLen nLineEnd = GetCrsr()->GetPoint()->nContent.GetIndex();
+ Pop(sal_False);
+
+ // make sure the selection build later from the
+ // data below does not include footnotes and other
+ // "in word" character to the left and right in order
+ // to preserve those. Therefore count those "in words"
+ // in order to modify the selection accordingly.
+ const sal_Unicode* pChar = aText.GetBuffer();
+ xub_StrLen nLeft = 0;
+ while (pChar && *pChar++ == CH_TXTATR_INWORD)
+ ++nLeft;
+ pChar = aText.Len() ? aText.GetBuffer() + aText.Len() - 1 : 0;
+ xub_StrLen nRight = 0;
+ while (pChar && *pChar-- == CH_TXTATR_INWORD)
+ ++nRight;
+
+ aPos.nContent = nBegin + nLeft;
+ pCrsr = GetCrsr();
+ *pCrsr->GetPoint() = aPos;
+ pCrsr->SetMark();
+ ExtendSelection( sal_True, nLen - nLeft - nRight );
+ //no determine the rectangle in the current line
+ xub_StrLen nWordStart = (nBegin + nLeft) < nLineStart ? nLineStart : nBegin + nLeft;
+ //take one less than the line end - otherwise the next line would be calculated
+ xub_StrLen nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd - 1: (nBegin + nLen - nLeft - nRight);
+ Push();
+ pCrsr->DeleteMark();
+ SwIndex& rContent = GetCrsr()->GetPoint()->nContent;
+ rContent = nWordStart;
+ SwRect aStartRect;
+ SwCrsrMoveState aState;
+ aState.bRealWidth = sal_True;
+ SwCntntNode* pCntntNode = pCrsr->GetCntntNode();
+ SwCntntFrm *pCntntFrame = pCntntNode->getLayoutFrm( GetLayout(), pPt, pCrsr->GetPoint(), sal_False);
+
+ pCntntFrame->GetCharRect( aStartRect, *pCrsr->GetPoint(), &aState );
+ rContent = nWordEnd;
+ SwRect aEndRect;
+ pCntntFrame->GetCharRect( aEndRect, *pCrsr->GetPoint(),&aState );
+ rSelectRect = aStartRect.Union( aEndRect );
+ Pop(sal_False);
+ }
+ }
+ }
+ return xSpellAlt;
+}
+
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+bool SwEditShell::GetGrammarCorrection(
+ linguistic2::ProofreadingResult /*out*/ &rResult, // the complete result
+ sal_Int32 /*out*/ &rErrorPosInText, // offset of error position in string that was grammar checked...
+ sal_Int32 /*out*/ &rErrorIndexInResult, // index of error in rResult.aGrammarErrors
+ uno::Sequence< rtl::OUString > /*out*/ &rSuggestions, // suggestions to be used for the error found
+ const Point *pPt, SwRect &rSelectRect )
+{
+ bool bRes = false;
+
+ if( IsTableMode() )
+ return bRes;
+
+ SwPaM* pCrsr = GetCrsr();
+ SwPosition aPos( *pCrsr->GetPoint() );
+ Point aPt( *pPt );
+ SwCrsrMoveState eTmpState( MV_SETONLYTEXT );
+ SwTxtNode *pNode;
+ SwGrammarMarkUp *pWrong;
+ if( GetLayout()->GetCrsrOfst( &aPos, aPt, &eTmpState ) &&
+ 0 != (pNode = aPos.nNode.GetNode().GetTxtNode()) &&
+ 0 != (pWrong = pNode->GetGrammarCheck()) &&
+ !pNode->IsInProtectSect() )
+ {
+ xub_StrLen nBegin = aPos.nContent.GetIndex();
+ xub_StrLen nLen = 1;
+ if (pWrong->InWrongWord(nBegin, nLen))
+ {
+ String aText( pNode->GetTxt().Copy( nBegin, nLen ) );
+ String aWord( aText );
+ aWord.EraseAllChars( CH_TXTATR_BREAKWORD ).EraseAllChars( CH_TXTATR_INWORD );
+
+ uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( pDoc->GetGCIterator() );
+ if (xGCIterator.is())
+ {
+// LanguageType eActLang = (LanguageType)pNode->GetLang( nBegin, nLen );
+ uno::Reference< lang::XComponent > xDoc( pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
+
+ // Expand the string:
+ rtl::OUString aExpandText;
+ const ModelToViewHelper::ConversionMap* pConversionMap =
+ pNode->BuildConversionMap( aExpandText );
+ // get XFlatParagraph to use...
+ uno::Reference< text::XFlatParagraph > xFlatPara = new SwXFlatParagraph( *pNode, aExpandText, pConversionMap );
+
+ // get error position of cursor in XFlatParagraph
+ rErrorPosInText = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nBegin );
+
+ sal_Int32 nStartOfSentence = ModelToViewHelper::ConvertToViewPosition( pConversionMap, pWrong->getSentenceStart( nBegin ) );
+ sal_Int32 nEndOfSentence = ModelToViewHelper::ConvertToViewPosition( pConversionMap, pWrong->getSentenceEnd( nBegin ) );
+ if( nEndOfSentence == STRING_LEN )
+ {
+/* if( nStartOfSentence == 0 )
+ {
+ nStartOfSentence = -1;
+ nEndOfSentence = -1;
+ }
+ else */
+ nEndOfSentence = aExpandText.getLength();
+ }
+
+ rResult = xGCIterator->checkSentenceAtPosition(
+ xDoc, xFlatPara, aExpandText, lang::Locale(), nStartOfSentence, nEndOfSentence, rErrorPosInText );
+ bRes = true;
+
+ // get suggestions to use for the specific error position
+ sal_Int32 nErrors = rResult.aErrors.getLength();
+ rSuggestions.realloc( 0 );
+ for (sal_Int32 i = 0; i < nErrors; ++i )
+ {
+ // return suggestions for first error that includes the given error position
+ const linguistic2::SingleProofreadingError &rError = rResult.aErrors[i];
+ if (rError.nErrorStart <= rErrorPosInText &&
+ rErrorPosInText < rError.nErrorStart + rError.nErrorLength)
+ {
+ rSuggestions = rError.aSuggestions;
+ rErrorIndexInResult = i;
+ break;
+ }
+ }
+ }
+
+ if (rResult.aErrors.getLength() > 0) // error found?
+ {
+ //save the start and end positons of the line and the starting point
+ Push();
+ LeftMargin();
+ xub_StrLen nLineStart = GetCrsr()->GetPoint()->nContent.GetIndex();
+ RightMargin();
+ xub_StrLen nLineEnd = GetCrsr()->GetPoint()->nContent.GetIndex();
+ Pop(sal_False);
+
+#if OSL_DEBUG_LEVEL > 1
+// pNode->GetGrammarCheck()->Invalidate( 0, STRING_LEN );
+// pNode->SetGrammarCheckDirty( true );
+#endif
+ // make sure the selection build later from the
+ // data below does not include footnotes and other
+ // "in word" character to the left and right in order
+ // to preserve those. Therefore count those "in words"
+ // in order to modify the selection accordingly.
+ const sal_Unicode* pChar = aText.GetBuffer();
+ xub_StrLen nLeft = 0;
+ while (pChar && *pChar++ == CH_TXTATR_INWORD)
+ ++nLeft;
+ pChar = aText.Len() ? aText.GetBuffer() + aText.Len() - 1 : 0;
+ xub_StrLen nRight = 0;
+ while (pChar && *pChar-- == CH_TXTATR_INWORD)
+ ++nRight;
+
+ aPos.nContent = nBegin + nLeft;
+ pCrsr = GetCrsr();
+ *pCrsr->GetPoint() = aPos;
+ pCrsr->SetMark();
+ ExtendSelection( sal_True, nLen - nLeft - nRight );
+ //no determine the rectangle in the current line
+ xub_StrLen nWordStart = (nBegin + nLeft) < nLineStart ? nLineStart : nBegin + nLeft;
+ //take one less than the line end - otherwise the next line would be calculated
+ xub_StrLen nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd - 1: (nBegin + nLen - nLeft - nRight);
+ Push();
+ pCrsr->DeleteMark();
+ SwIndex& rContent = GetCrsr()->GetPoint()->nContent;
+ rContent = nWordStart;
+ SwRect aStartRect;
+ SwCrsrMoveState aState;
+ aState.bRealWidth = sal_True;
+ SwCntntNode* pCntntNode = pCrsr->GetCntntNode();
+ SwCntntFrm *pCntntFrame = pCntntNode->getLayoutFrm( GetLayout(), pPt, pCrsr->GetPoint(), sal_False);
+
+ pCntntFrame->GetCharRect( aStartRect, *pCrsr->GetPoint(), &aState );
+ rContent = nWordEnd;
+ SwRect aEndRect;
+ pCntntFrame->GetCharRect( aEndRect, *pCrsr->GetPoint(),&aState );
+ rSelectRect = aStartRect.Union( aEndRect );
+ Pop(sal_False);
+ }
+ }
+ }
+
+ return bRes;
+}
+
+/*-- 18.09.2003 15:08:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwEditShell::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammarCheck)
+{
+ ASSERT( pSpellIter, "SpellIter missing" );
+ if(!pSpellIter)
+ return false;
+ bool bRet = pSpellIter->SpellSentence(rPortions, bIsGrammarCheck);
+
+ // make Selection visible - this should simply move the
+ // cursor to the end of the sentence
+ StartAction();
+ EndAction();
+ return bRet;
+}
+/*-- 08.09.2008 09:35:19---------------------------------------------------
+ make SpellIter start with the current sentence when called next time
+ -----------------------------------------------------------------------*/
+void SwEditShell::PutSpellingToSentenceStart()
+{
+ ASSERT( pSpellIter, "SpellIter missing" );
+ if(!pSpellIter)
+ return;
+ pSpellIter->ToSentenceStart();
+}
+/*-- 02.02.2005 14:34:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_uInt32 lcl_CountRedlines(
+ const ::svx::SpellPortions& rLastPortions)
+{
+ sal_uInt32 nRet = 0;
+ SpellPortions::const_iterator aIter = rLastPortions.begin();
+ for( ; aIter != rLastPortions.end(); ++aIter)
+ {
+ if( aIter->bIsHidden )
+ ++nRet;
+ }
+ return nRet;
+}
+/*-- 18.09.2003 15:08:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+void SwEditShell::MoveContinuationPosToEndOfCheckedSentence()
+{
+ // give hint that continuation position for spell/grammar checking is
+ // at the end of this sentence
+ if (pSpellIter)
+ {
+ pSpellIter->SetCurr( new SwPosition( *pSpellIter->GetCurrX() ) );
+ pSpellIter->ContinueAfterThisSentence();
+ }
+}
+
+
+void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, bool bRecheck)
+{
+ // Note: rNewPortions.size() == 0 is valid and happens when the whole
+ // sentence got removed in the dialog
+
+ ASSERT( pSpellIter, "SpellIter missing" );
+ if(pSpellIter &&
+ pSpellIter->GetLastPortions().size() > 0) // no portions -> no text to be changed
+ {
+ const SpellPortions& rLastPortions = pSpellIter->GetLastPortions();
+ const SpellContentPositions rLastPositions = pSpellIter->GetLastPositions();
+ ASSERT(rLastPortions.size() > 0 &&
+ rLastPortions.size() == rLastPositions.size(),
+ "last vectors of spelling results are not set or not equal")
+
+ // iterate over the new portions, beginning at the end to take advantage of the previously
+ // saved content positions
+
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_OVERWRITE, NULL );
+ StartAction();
+
+ SwPaM *pCrsr = GetCrsr();
+ // save cursor position (which should be at the end of the current sentence)
+ // for later restoration
+ Push();
+
+ sal_uInt32 nRedlinePortions = lcl_CountRedlines(rLastPortions);
+ if((rLastPortions.size() - nRedlinePortions) == rNewPortions.size())
+ {
+ DBG_ASSERT( rNewPortions.size() > 0, "rNewPortions should not be empty here" );
+ DBG_ASSERT( rLastPortions.size() > 0, "rLastPortions should not be empty here" );
+ DBG_ASSERT( rLastPositions.size() > 0, "rLastPositions should not be empty here" );
+
+ //the simple case: the same number of elements on both sides
+ //each changed element has to be applied to the corresponding source element
+ svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.end();
+ SpellPortions::const_iterator aCurrentOldPortion = rLastPortions.end();
+ SpellContentPositions::const_iterator aCurrentOldPosition = rLastPositions.end();
+ do
+ {
+ --aCurrentNewPortion;
+ --aCurrentOldPortion;
+ --aCurrentOldPosition;
+ //jump over redline portions
+ while(aCurrentOldPortion->bIsHidden)
+ {
+ if (aCurrentOldPortion != rLastPortions.begin() &&
+ aCurrentOldPosition != rLastPositions.begin())
+ {
+ --aCurrentOldPortion;
+ --aCurrentOldPosition;
+ }
+ else
+ {
+ DBG_ASSERT( 0, "ApplyChangedSentence: iterator positions broken" );
+ break;
+ }
+ }
+ if ( !pCrsr->HasMark() )
+ pCrsr->SetMark();
+ pCrsr->GetPoint()->nContent = aCurrentOldPosition->nLeft;
+ pCrsr->GetMark()->nContent = aCurrentOldPosition->nRight;
+ sal_uInt16 nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
+ sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE;
+ switch(nScriptType)
+ {
+ case SCRIPTTYPE_ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
+ }
+ if(aCurrentNewPortion->sText != aCurrentOldPortion->sText)
+ {
+ //change text ...
+ pDoc->DeleteAndJoin(*pCrsr);
+ // ... and apply language if necessary
+ if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
+ SetAttr( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId), nLangWhichId );
+ pDoc->InsertString(*pCrsr, aCurrentNewPortion->sText);
+ }
+ else if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
+ {
+ //apply language
+ SetAttr( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId), nLangWhichId );
+ }
+ else if( aCurrentNewPortion->bIgnoreThisError )
+ {
+ //add the 'ignore' markup to the TextNode's grammar ignore markup list
+ IgnoreGrammarErrorAt( *pCrsr );
+ DBG_ERROR("TODO: add ignore mark to text node");
+ }
+ if(aCurrentNewPortion == rNewPortions.begin())
+ break;
+ }
+ while(aCurrentNewPortion != rNewPortions.begin());
+ }
+ else
+ {
+ DBG_ASSERT( rLastPositions.size() > 0, "rLastPositions should not be empty here" );
+
+ //select the complete sentence
+ SpellContentPositions::const_iterator aCurrentEndPosition = rLastPositions.end();
+ --aCurrentEndPosition;
+ SpellContentPositions::const_iterator aCurrentStartPosition = rLastPositions.begin();
+ pCrsr->GetPoint()->nContent = aCurrentStartPosition->nLeft;
+ pCrsr->GetMark()->nContent = aCurrentEndPosition->nRight;
+
+ //delete the sentence completely
+ pDoc->DeleteAndJoin(*pCrsr);
+ svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.begin();
+ while(aCurrentNewPortion != rNewPortions.end())
+ {
+ //set the language attribute
+ sal_uInt16 nScriptType = GetScriptType();
+ sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE;
+ switch(nScriptType)
+ {
+ case SCRIPTTYPE_ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
+ }
+ SfxItemSet aSet(GetAttrPool(), nLangWhichId, nLangWhichId, 0);
+ GetCurAttr( aSet );
+ const SvxLanguageItem& rLang = static_cast<const SvxLanguageItem& >(aSet.Get(nLangWhichId));
+ if(rLang.GetLanguage() != aCurrentNewPortion->eLanguage)
+ SetAttr( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId) );
+ //insert the new string
+ pDoc->InsertString(*pCrsr, aCurrentNewPortion->sText);
+
+ //set the cursor to the end of the inserted string
+ *pCrsr->Start() = *pCrsr->End();
+ ++aCurrentNewPortion;
+ }
+ }
+
+ // restore cursor to the end of the sentence
+ // (will work also if the sentence length has changed,
+ // since cursors get updated automatically!)
+ Pop( sal_False );
+
+ // collapse cursor to the end of the modified sentence
+ *pCrsr->Start() = *pCrsr->End();
+ if (bRecheck)
+ {
+ //in grammar check the current sentence has to be checked again
+ GoStartSentence();
+ }
+ // set continuation position for spell/grammar checking to the end of this sentence
+ pSpellIter->SetCurr( new SwPosition( *pCrsr->Start() ) );
+
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_OVERWRITE, NULL );
+ EndAction();
+ }
+}
+/*-- 02.02.2005 10:46:45---------------------------------------------------
+ collect all deleted redlines of the current text node beginning at the
+ start of the cursor position
+ -----------------------------------------------------------------------*/
+SpellContentPositions lcl_CollectDeletedRedlines(SwEditShell* pSh)
+{
+ SpellContentPositions aRedlines;
+ SwDoc* pDoc = pSh->GetDoc();
+ const bool bShowChg = IDocumentRedlineAccess::IsShowChanges( pDoc->GetRedlineMode() );
+ if ( bShowChg )
+ {
+ SwPaM *pCrsr = pSh->GetCrsr();
+ const SwPosition* pStartPos = pCrsr->Start();
+ const SwTxtNode* pTxtNode = pCrsr->GetNode()->GetTxtNode();
+
+ sal_uInt16 nAct = pDoc->GetRedlinePos( *pTxtNode, USHRT_MAX );
+ const xub_StrLen nStartIndex = pStartPos->nContent.GetIndex();
+ for ( ; nAct < pDoc->GetRedlineTbl().Count(); nAct++ )
+ {
+ const SwRedline* pRed = pDoc->GetRedlineTbl()[ nAct ];
+
+ if ( pRed->Start()->nNode > pTxtNode->GetIndex() )
+ break;
+
+ if( nsRedlineType_t::REDLINE_DELETE == pRed->GetType() )
+ {
+ xub_StrLen nStart, nEnd;
+ pRed->CalcStartEnd( pTxtNode->GetIndex(), nStart, nEnd );
+ if(nStart >= nStartIndex || nEnd >= nStartIndex)
+ {
+ SpellContentPosition aAdd;
+ aAdd.nLeft = nStart;
+ aAdd.nRight = nEnd;
+ aRedlines.push_back(aAdd);
+ }
+ }
+ }
+ }
+ return aRedlines;
+}
+/*-- 02.02.2005 11:06:12---------------------------------------------------
+ remove the redline positions after the current selection
+ -----------------------------------------------------------------------*/
+void lcl_CutRedlines( SpellContentPositions& aDeletedRedlines, SwEditShell* pSh )
+{
+ if(!aDeletedRedlines.empty())
+ {
+ SwPaM *pCrsr = pSh->GetCrsr();
+ const SwPosition* pEndPos = pCrsr->End();
+ xub_StrLen nEnd = pEndPos->nContent.GetIndex();
+ while(!aDeletedRedlines.empty() &&
+ aDeletedRedlines.back().nLeft > nEnd)
+ {
+ aDeletedRedlines.pop_back();
+ }
+ }
+}
+/*-- 02.02.2005 11:43:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellContentPosition lcl_FindNextDeletedRedline(
+ const SpellContentPositions& rDeletedRedlines,
+ xub_StrLen nSearchFrom )
+{
+ SpellContentPosition aRet;
+ aRet.nLeft = aRet.nRight = STRING_MAXLEN;
+ if(!rDeletedRedlines.empty())
+ {
+ SpellContentPositions::const_iterator aIter = rDeletedRedlines.begin();
+ for( ; aIter != rDeletedRedlines.end(); ++aIter)
+ {
+ if(aIter->nLeft < nSearchFrom)
+ continue;
+ aRet = *aIter;
+ break;
+ }
+ }
+ return aRet;
+}
+/*-- 18.09.2003 15:08:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwSpellIter::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammarCheck)
+{
+ bool bRet = false;
+ aLastPortions.clear();
+ aLastPositions.clear();
+
+ SwEditShell *pMySh = GetSh();
+ if( !pMySh )
+ return false;
+
+ ASSERT( GetEnd(), "SwEditShell::SpellSentence() ohne Start?");
+
+ uno::Reference< XSpellAlternatives > xSpellRet;
+ linguistic2::ProofreadingResult aGrammarResult;
+ sal_Bool bGoOn = sal_True;
+ bool bGrammarErrorFound = false;
+ do {
+ SwPaM *pCrsr = pMySh->GetCrsr();
+ if ( !pCrsr->HasMark() )
+ pCrsr->SetMark();
+
+ *pCrsr->GetPoint() = *GetCurr();
+ *pCrsr->GetMark() = *GetEnd();
+
+ if( bBackToStartOfSentence )
+ {
+ pMySh->GoStartSentence();
+ bBackToStartOfSentence = false;
+ }
+ uno::Any aSpellRet =
+ pMySh->GetDoc()->Spell(*pCrsr,
+ xSpeller, 0, 0, bIsGrammarCheck );
+ aSpellRet >>= xSpellRet;
+ aSpellRet >>= aGrammarResult;
+ bGoOn = GetCrsrCnt() > 1;
+ bGrammarErrorFound = aGrammarResult.aErrors.getLength() > 0;
+ if( xSpellRet.is() || bGrammarErrorFound )
+ {
+ bGoOn = sal_False;
+ SwPosition* pNewPoint = new SwPosition( *pCrsr->GetPoint() );
+ SwPosition* pNewMark = new SwPosition( *pCrsr->GetMark() );
+
+ SetCurr( pNewPoint );
+ SetCurrX( pNewMark );
+ }
+ if( bGoOn )
+ {
+ pMySh->Pop( sal_False );
+ pCrsr = pMySh->GetCrsr();
+ if ( *pCrsr->GetPoint() > *pCrsr->GetMark() )
+ pCrsr->Exchange();
+ SwPosition* pNew = new SwPosition( *pCrsr->GetPoint() );
+ SetStart( pNew );
+ pNew = new SwPosition( *pCrsr->GetMark() );
+ SetEnd( pNew );
+ pNew = new SwPosition( *GetStart() );
+ SetCurr( pNew );
+ pNew = new SwPosition( *pNew );
+ SetCurrX( pNew );
+ pCrsr->SetMark();
+ --GetCrsrCnt();
+ }
+ }
+ while ( bGoOn );
+ if(xSpellRet.is() || bGrammarErrorFound)
+ {
+ //an error has been found
+ //To fill the spell portions the beginning of the sentence has to be found
+ SwPaM *pCrsr = pMySh->GetCrsr();
+ //set the mark to the right if necessary
+ if ( *pCrsr->GetPoint() > *pCrsr->GetMark() )
+ pCrsr->Exchange();
+ //the cursor has to be collapsed on the left to go to the start of the sentence - if sentence ends inside of the error
+ pCrsr->DeleteMark();
+ pCrsr->SetMark();
+ sal_Bool bStartSent = 0 != pMySh->GoStartSentence();
+ SpellContentPositions aDeletedRedlines = lcl_CollectDeletedRedlines(pMySh);
+ if(bStartSent)
+ {
+ //create a portion from the start part
+ AddPortion(0, 0, aDeletedRedlines);
+ }
+ //Set the cursor to the error already found
+ *pCrsr->GetPoint() = *GetCurrX();
+ *pCrsr->GetMark() = *GetCurr();
+ AddPortion(xSpellRet, &aGrammarResult, aDeletedRedlines);
+
+
+ //save the end position of the error to continue from here
+ SwPosition aSaveStartPos = *pCrsr->End();
+ //determine the end of the current sentence
+ if ( *pCrsr->GetPoint() < *pCrsr->GetMark() )
+ pCrsr->Exchange();
+ //again collapse to start marking after the end of the error
+ pCrsr->DeleteMark();
+ pCrsr->SetMark();
+
+ pMySh->GoEndSentence();
+ if( bGrammarErrorFound )
+ {
+ rtl::OUString aExpandText;
+ const ModelToViewHelper::ConversionMap* pConversionMap = ((SwTxtNode*)pCrsr->GetNode())->BuildConversionMap( aExpandText );
+ xub_StrLen nSentenceEnd = (xub_StrLen)ModelToViewHelper::ConvertToViewPosition( pConversionMap, aGrammarResult.nBehindEndOfSentencePosition );
+ // remove trailing space
+ if( aExpandText[nSentenceEnd - 1] == ' ' )
+ --nSentenceEnd;
+ if( pCrsr->End()->nContent.GetIndex() < nSentenceEnd )
+ {
+ pCrsr->End()->nContent.Assign(
+ pCrsr->End()->nNode.GetNode().GetCntntNode(), nSentenceEnd);
+ }
+ }
+
+ lcl_CutRedlines( aDeletedRedlines, pMySh );
+ //save the 'global' end of the spellchecking
+ const SwPosition aSaveEndPos = *GetEnd();
+ //set the sentence end as 'local' end
+ SetEnd( new SwPosition( *pCrsr->End() ));
+
+ *pCrsr->GetPoint() = aSaveStartPos;
+ *pCrsr->GetMark() = *GetEnd();
+ //now the rest of the sentence has to be searched for errors
+ // for each error the non-error text between the current and the last error has
+ // to be added to the portions - if necessary broken into same-language-portions
+ if( !bGrammarErrorFound ) //in grammar check there's only one error returned
+ {
+ do
+ {
+ xSpellRet = 0;
+ // don't search for grammar errors here anymore!
+ pMySh->GetDoc()->Spell(*pCrsr,
+ xSpeller, 0, 0, false ) >>= xSpellRet;
+ if ( *pCrsr->GetPoint() > *pCrsr->GetMark() )
+ pCrsr->Exchange();
+ SetCurr( new SwPosition( *pCrsr->GetPoint() ));
+ SetCurrX( new SwPosition( *pCrsr->GetMark() ));
+
+ //if an error has been found go back to the text
+ //preceeding the error
+ if(xSpellRet.is())
+ {
+ *pCrsr->GetPoint() = aSaveStartPos;
+ *pCrsr->GetMark() = *GetCurr();
+ }
+ //add the portion
+ AddPortion(0, 0, aDeletedRedlines);
+
+ if(xSpellRet.is())
+ {
+ *pCrsr->GetPoint() = *GetCurr();
+ *pCrsr->GetMark() = *GetCurrX();
+ AddPortion(xSpellRet, 0, aDeletedRedlines);
+ //move the cursor to the end of the error string
+ *pCrsr->GetPoint() = *GetCurrX();
+ //and save the end of the error as new start position
+ aSaveStartPos = *GetCurrX();
+ //and the end of the sentence
+ *pCrsr->GetMark() = *GetEnd();
+ }
+ // if the end of the sentence has already been reached then break here
+ if(*GetCurrX() >= *GetEnd())
+ break;
+ }
+ while(xSpellRet.is());
+ }
+ else
+ {
+ //go to the end of sentence as the grammar check returned it
+ // at this time the Point is behind the grammar error
+ // and the mark points to the sentence end as
+ if ( *pCrsr->GetPoint() < *pCrsr->GetMark() )
+ pCrsr->Exchange();
+ }
+
+ // the part between the last error and the end of the sentence has to be added
+ *pMySh->GetCrsr()->GetPoint() = *GetEnd();
+ if(*GetCurrX() < *GetEnd())
+ {
+ AddPortion(0, 0, aDeletedRedlines);
+ }
+ //set the shell cursor to the end of the sentence to prevent a visible selection
+ *pCrsr->GetMark() = *GetEnd();
+ if( !bIsGrammarCheck )
+ {
+ //set the current position to the end of the sentence
+ SetCurr( new SwPosition(*GetEnd()) );
+ }
+ //restore the 'global' end
+ SetEnd( new SwPosition(aSaveEndPos) );
+ rPortions = aLastPortions;
+ bRet = true;
+ }
+ else
+ {
+ //if no error could be found the selection has to be corrected - at least if it's not in the body
+ *pMySh->GetCrsr()->GetPoint() = *GetEnd();
+ pMySh->GetCrsr()->DeleteMark();
+ }
+
+ return bRet;
+}
+
+/*-- 08.09.2008 09:37:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSpellIter::ToSentenceStart()
+{
+ bBackToStartOfSentence = true;
+}
+/*-- 08.10.2003 08:49:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+LanguageType lcl_GetLanguage(SwEditShell& rSh)
+{
+ sal_uInt16 nScriptType = rSh.GetScriptType();
+ sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE;
+
+ switch(nScriptType)
+ {
+ case SCRIPTTYPE_ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
+ }
+ SfxItemSet aSet(rSh.GetAttrPool(), nLangWhichId, nLangWhichId, 0);
+ rSh.GetCurAttr( aSet );
+ const SvxLanguageItem& rLang = static_cast<const SvxLanguageItem& >(aSet.Get(nLangWhichId));
+ return rLang.GetLanguage();
+}
+/*-- 08.10.2003 08:53:27---------------------------------------------------
+ create a text portion at the given position
+ -----------------------------------------------------------------------*/
+void SwSpellIter::CreatePortion(uno::Reference< XSpellAlternatives > xAlt,
+ linguistic2::ProofreadingResult* pGrammarResult,
+ bool bIsField, bool bIsHidden)
+{
+ svx::SpellPortion aPortion;
+ String sText;
+ GetSh()->GetSelectedText( sText );
+ if(sText.Len())
+ {
+ //in case of redlined deletions the selection of an error is not
+ //the same as the _real_ word
+ if(xAlt.is())
+ aPortion.sText = xAlt->getWord();
+ else if(pGrammarResult)
+ {
+ aPortion.bIsGrammarError = true;
+ if(pGrammarResult->aErrors.getLength())
+ {
+ aPortion.aGrammarError = pGrammarResult->aErrors[0];
+ aPortion.sText = pGrammarResult->aText.copy( aPortion.aGrammarError.nErrorStart, aPortion.aGrammarError.nErrorLength );
+ aPortion.xGrammarChecker = pGrammarResult->xProofreader;
+ const beans::PropertyValue* pProperties = pGrammarResult->aProperties.getConstArray();
+ for( sal_Int32 nProp = 0; nProp < pGrammarResult->aProperties.getLength(); ++nProp )
+ {
+ if( pProperties->Name.equalsAscii("DialogTitle") )
+ {
+ pProperties->Value >>= aPortion.sDialogTitle;
+ break;
+ }
+ }
+ }
+ }
+ else
+ aPortion.sText = sText;
+ aPortion.eLanguage = lcl_GetLanguage(*GetSh());
+ aPortion.bIsField = bIsField;
+ aPortion.bIsHidden = bIsHidden;
+ aPortion.xAlternatives = xAlt;
+ SpellContentPosition aPosition;
+ SwPaM *pCrsr = GetSh()->GetCrsr();
+ aPosition.nLeft = pCrsr->Start()->nContent.GetIndex();
+ aPosition.nRight = pCrsr->End()->nContent.GetIndex();
+ aLastPortions.push_back(aPortion);
+ aLastPositions.push_back(aPosition);
+ }
+}
+/*-- 19.09.2003 13:05:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives > xAlt,
+ linguistic2::ProofreadingResult* pGrammarResult,
+ const SpellContentPositions& rDeletedRedlines)
+{
+ SwEditShell *pMySh = GetSh();
+ String sText;
+ pMySh->GetSelectedText( sText );
+ if(sText.Len())
+ {
+ if(xAlt.is() || pGrammarResult != 0)
+ {
+ CreatePortion(xAlt, pGrammarResult, false, false);
+ }
+ else
+ {
+ SwPaM *pCrsr = GetSh()->GetCrsr();
+ if ( *pCrsr->GetPoint() > *pCrsr->GetMark() )
+ pCrsr->Exchange();
+ //save the start and end positions
+ SwPosition aStart(*pCrsr->GetPoint());
+ SwPosition aEnd(*pCrsr->GetMark());
+ //iterate over the text to find changes in language
+ //set the mark equal to the point
+ *pCrsr->GetMark() = aStart;
+ SwTxtNode* pTxtNode = pCrsr->GetNode()->GetTxtNode();
+ LanguageType eStartLanguage = lcl_GetLanguage(*GetSh());
+ SpellContentPosition aNextRedline = lcl_FindNextDeletedRedline(
+ rDeletedRedlines, aStart.nContent.GetIndex() );
+ if( aNextRedline.nLeft == aStart.nContent.GetIndex() )
+ {
+ //select until the end of the current redline
+ xub_StrLen nEnd = aEnd.nContent.GetIndex() < aNextRedline.nRight ?
+ aEnd.nContent.GetIndex() : aNextRedline.nRight;
+ pCrsr->GetPoint()->nContent.Assign( pTxtNode, nEnd );
+ CreatePortion(xAlt, pGrammarResult, false, true);
+ aStart = *pCrsr->End();
+ //search for next redline
+ aNextRedline = lcl_FindNextDeletedRedline(
+ rDeletedRedlines, aStart.nContent.GetIndex() );
+ }
+ while(*pCrsr->GetPoint() < aEnd)
+ {
+ //#125786 in table cell with fixed row height the cursor might not move forward
+ if(!GetSh()->Right(1, CRSR_SKIP_CELLS))
+ break;
+
+ bool bField = false;
+ //read the character at the current position to check if it's a field
+ xub_Unicode cChar = pTxtNode->GetTxt().GetChar( pCrsr->GetMark()->nContent.GetIndex() );
+ if( CH_TXTATR_BREAKWORD == cChar || CH_TXTATR_INWORD == cChar)
+ {
+ const SwTxtAttr* pTxtAttr = pTxtNode->GetTxtAttrForCharAt(
+ pCrsr->GetMark()->nContent.GetIndex() );
+ const sal_uInt16 nWhich = pTxtAttr
+ ? pTxtAttr->Which()
+ : static_cast<sal_uInt16>(RES_TXTATR_END);
+ switch (nWhich)
+ {
+ case RES_TXTATR_FIELD:
+ case RES_TXTATR_FTN:
+ case RES_TXTATR_FLYCNT:
+ bField = true;
+ break;
+ }
+ }
+
+ LanguageType eCurLanguage = lcl_GetLanguage(*GetSh());
+ bool bRedline = aNextRedline.nLeft == pCrsr->GetPoint()->nContent.GetIndex();
+ // create a portion if the next character
+ // - is a field,
+ // - is at the beginning of a deleted redline
+ // - has a different language
+ if(bField || bRedline || eCurLanguage != eStartLanguage)
+ {
+ eStartLanguage = eCurLanguage;
+ //go one step back - the cursor currently selects the first character
+ //with a different language
+ //in the case of redlining it's different
+ if(eCurLanguage != eStartLanguage || bField)
+ *pCrsr->GetPoint() = *pCrsr->GetMark();
+ //set to the last start
+ *pCrsr->GetMark() = aStart;
+ //create portion should only be called if a selection exists
+ //there's no selection if there's a field at the beginning
+ if(*pCrsr->Start() != *pCrsr->End())
+ CreatePortion(xAlt, pGrammarResult, false, false);
+ aStart = *pCrsr->End();
+ //now export the field - if there is any
+ if(bField)
+ {
+ *pCrsr->GetMark() = *pCrsr->GetPoint();
+ GetSh()->Right(1, CRSR_SKIP_CELLS);
+ CreatePortion(xAlt, pGrammarResult, true, false);
+ aStart = *pCrsr->End();
+ }
+ }
+ // if a redline start then create a portion for it
+ if(bRedline)
+ {
+ *pCrsr->GetMark() = *pCrsr->GetPoint();
+ //select until the end of the current redline
+ xub_StrLen nEnd = aEnd.nContent.GetIndex() < aNextRedline.nRight ?
+ aEnd.nContent.GetIndex() : aNextRedline.nRight;
+ pCrsr->GetPoint()->nContent.Assign( pTxtNode, nEnd );
+ CreatePortion(xAlt, pGrammarResult, false, true);
+ aStart = *pCrsr->End();
+ //search for next redline
+ aNextRedline = lcl_FindNextDeletedRedline(
+ rDeletedRedlines, aStart.nContent.GetIndex() );
+ }
+ *pCrsr->GetMark() = *pCrsr->GetPoint();
+ }
+ pCrsr->SetMark();
+ *pCrsr->GetMark() = aStart;
+ CreatePortion(xAlt, pGrammarResult, false, false);
+ }
+ }
+}
+/*-- 07.08.2008 15:01:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwEditShell::IgnoreGrammarErrorAt( SwPaM& rErrorPosition )
+{
+ SwTxtNode *pNode;
+ SwWrongList *pWrong;
+ SwNodeIndex aIdx = rErrorPosition.Start()->nNode;
+ SwNodeIndex aEndIdx = rErrorPosition.Start()->nNode;
+ xub_StrLen nStart = rErrorPosition.Start()->nContent.GetIndex();
+ xub_StrLen nEnd = STRING_LEN;
+ while( aIdx <= aEndIdx )
+ {
+ pNode = aIdx.GetNode().GetTxtNode();
+ if( pNode ) {
+ if( aIdx == aEndIdx )
+ nEnd = rErrorPosition.End()->nContent.GetIndex();
+ pWrong = pNode->GetGrammarCheck();
+ if( pWrong )
+ pWrong->RemoveEntry( nStart, nEnd );
+ pWrong = pNode->GetWrong();
+ if( pWrong )
+ pWrong->RemoveEntry( nStart, nEnd );
+ SwTxtFrm::repaintTextFrames( *pNode );
+ }
+ ++aIdx;
+ nStart = 0;
+ }
+}
+
+
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
new file mode 100644
index 000000000000..d740090d4694
--- /dev/null
+++ b/sw/source/core/edit/ednumber.cxx
@@ -0,0 +1,833 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <editsh.hxx>
+#include <edimp.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <ndtxt.hxx>
+#include <paratr.hxx>
+#include <swundo.hxx>
+#include <numrule.hxx>
+
+SV_IMPL_VARARR_SORT( _SwPamRanges, SwPamRange )
+
+
+SwPamRanges::SwPamRanges( const SwPaM& rRing )
+{
+ const SwPaM* pTmp = &rRing;
+ do {
+ Insert( pTmp->GetMark()->nNode, pTmp->GetPoint()->nNode );
+ } while( &rRing != ( pTmp = (const SwPaM*)pTmp->GetNext() ));
+}
+
+
+void SwPamRanges::Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 )
+{
+ SwPamRange aRg( rIdx1.GetIndex(), rIdx2.GetIndex() );
+ if( aRg.nEnd < aRg.nStart )
+ { aRg.nStart = aRg.nEnd; aRg.nEnd = rIdx1.GetIndex(); }
+
+ sal_uInt16 nPos = 0;
+ const SwPamRange* pTmp;
+ if( Count() && Seek_Entry( aRg, &nPos )) // suche Insert Position
+ {
+ // ist der im Array stehende kleiner ??
+ if( ( pTmp = GetData()+ nPos )->nEnd < aRg.nEnd )
+ {
+ aRg.nEnd = pTmp->nEnd;
+ Remove( nPos, 1 ); // zusammenfassen
+ }
+ else
+ return; // ende, weil schon alle zusammengefasst waren
+ }
+
+ sal_Bool bEnde;
+ do {
+ bEnde = sal_True;
+
+ // mit dem Vorgaenger zusammenfassen ??
+ if( nPos > 0 )
+ {
+ if( ( pTmp = GetData()+( nPos-1 ))->nEnd == aRg.nStart
+ || pTmp->nEnd+1 == aRg.nStart )
+ {
+ aRg.nStart = pTmp->nStart;
+ bEnde = sal_False;
+ Remove( --nPos, 1 ); // zusammenfassen
+ }
+ // SSelection im Bereich ??
+ else if( pTmp->nStart <= aRg.nStart && aRg.nEnd <= pTmp->nEnd )
+ return;
+ }
+ // mit dem Nachfolger zusammenfassen ??
+ if( nPos < Count() )
+ {
+ if( ( pTmp = GetData() + nPos )->nStart == aRg.nEnd ||
+ pTmp->nStart == aRg.nEnd+1 )
+ {
+ aRg.nEnd = pTmp->nEnd;
+ bEnde = sal_False;
+ Remove( nPos, 1 ); // zusammenfassen
+ }
+
+ // SSelection im Bereich ??
+ else if( pTmp->nStart <= aRg.nStart && aRg.nEnd <= pTmp->nEnd )
+ return;
+ }
+ } while( !bEnde );
+
+ _SwPamRanges::Insert( aRg );
+}
+
+
+
+SwPaM& SwPamRanges::SetPam( sal_uInt16 nArrPos, SwPaM& rPam )
+{
+ ASSERT_ID( nArrPos < Count(), ERR_VAR_IDX );
+ const SwPamRange& rTmp = *(GetData() + nArrPos );
+ rPam.GetPoint()->nNode = rTmp.nStart;
+ rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), 0 );
+ rPam.SetMark();
+ rPam.GetPoint()->nNode = rTmp.nEnd;
+ rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), 0 );
+ return rPam;
+}
+
+
+
+// Numerierung Outline Regelwerk
+
+
+void SwEditShell::SetOutlineNumRule(const SwNumRule& rRule)
+{
+ StartAllAction(); // Klammern fuers Updaten !!
+ GetDoc()->SetOutlineNumRule(rRule);
+ EndAllAction();
+}
+
+
+const SwNumRule* SwEditShell::GetOutlineNumRule() const
+{
+ return GetDoc()->GetOutlineNumRule();
+}
+
+// setzt, wenn noch keine Numerierung, sonst wird geaendert
+// arbeitet mit alten und neuen Regeln, nur Differenzen aktualisieren
+
+// Absaetze ohne Numerierung, aber mit Einzuegen
+
+sal_Bool SwEditShell::NoNum()
+{
+ sal_Bool bRet = sal_True;
+ StartAllAction();
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
+ {
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ SwPamRanges aRangeArr( *pCrsr );
+ SwPaM aPam( *pCrsr->GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ bRet = bRet && GetDoc()->NoNum( aRangeArr.SetPam( n, aPam ));
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
+ else
+ bRet = GetDoc()->NoNum( *pCrsr );
+
+ EndAllAction();
+ return bRet;
+}
+// Loeschen, Splitten der Aufzaehlungsliste
+
+// -> #i29560#
+sal_Bool SwEditShell::HasNumber() const
+{
+ sal_Bool bResult = sal_False;
+
+ const SwTxtNode * pTxtNd =
+ GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+
+ if (pTxtNd)
+ {
+ bResult = pTxtNd->HasNumber();
+
+ // --> OD 2005-10-26 #b6340308#
+ // special case: outline numbered, not counted paragraph
+ if ( bResult &&
+ pTxtNd->GetNumRule() == GetDoc()->GetOutlineNumRule() &&
+ !pTxtNd->IsCountedInList() )
+ {
+ bResult = sal_False;
+ }
+ // <--
+ }
+
+ return bResult;
+}
+
+sal_Bool SwEditShell::HasBullet() const
+{
+ sal_Bool bResult = sal_False;
+
+ const SwTxtNode * pTxtNd =
+ GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+
+ if (pTxtNd)
+ {
+ bResult = pTxtNd->HasBullet();
+ }
+
+ return bResult;
+}
+// <- #i29560#
+
+void SwEditShell::DelNumRules()
+{
+ StartAllAction();
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
+ {
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ SwPamRanges aRangeArr( *pCrsr );
+ SwPaM aPam( *pCrsr->GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ {
+ GetDoc()->DelNumRules( aRangeArr.SetPam( n, aPam ) );
+ }
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
+ else
+ GetDoc()->DelNumRules( *pCrsr );
+
+ // rufe das AttrChangeNotify auf der UI-Seite. Sollte eigentlich
+ // ueberfluessig sein, aber VB hatte darueber eine Bugrep.
+ CallChgLnk();
+
+ // --> OD 2005-10-24 #126346# - cursor can not be anymore in
+ // front of a label, because numbering/bullet is deleted.
+ SetInFrontOfLabel( sal_False );
+ // <--
+
+ GetDoc()->SetModified();
+ EndAllAction();
+}
+
+// Hoch-/Runterstufen
+
+
+sal_Bool SwEditShell::NumUpDown( sal_Bool bDown )
+{
+ StartAllAction();
+
+ sal_Bool bRet = sal_True;
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() == pCrsr ) // keine Mehrfachselektion ?
+ bRet = GetDoc()->NumUpDown( *pCrsr, bDown );
+ else
+ {
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ SwPamRanges aRangeArr( *pCrsr );
+ SwPaM aPam( *pCrsr->GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ bRet = bRet && GetDoc()->NumUpDown( aRangeArr.SetPam( n, aPam ), bDown );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
+ GetDoc()->SetModified();
+
+ // --> FME 2005-09-19 #i54693# Update marked numbering levels
+ if ( IsInFrontOfLabel() )
+ UpdateMarkedListLevel();
+ // <--
+
+ CallChgLnk();
+
+ EndAllAction();
+ return bRet;
+}
+// -> #i23726#
+sal_Bool SwEditShell::IsFirstOfNumRule() const
+{
+ sal_Bool bResult = sal_False;
+
+ SwPaM * pCrsr = GetCrsr();
+ if (pCrsr->GetNext() == pCrsr)
+ {
+ bResult = IsFirstOfNumRule(*pCrsr);
+ }
+
+ return bResult;
+}
+
+sal_Bool SwEditShell::IsFirstOfNumRule(const SwPaM & rPaM) const
+{
+ sal_Bool bResult = sal_False;
+
+ SwPosition aPos(*rPaM.GetPoint());
+ bResult = GetDoc()->IsFirstOfNumRule(aPos);
+
+ return bResult;
+}
+// <- #i23726#
+
+// -> #i23725#
+// --> OD 2008-06-09 #i90078#
+// Remove unused default parameter <nLevel> and <bRelative>.
+// Adjust method name and parameter name
+void SwEditShell::ChangeIndentOfAllListLevels( short nDiff )
+{
+ StartAllAction();
+
+ const SwNumRule *pCurNumRule = GetCurNumRule();
+ //#120911# check if numbering rule really exists
+ if (pCurNumRule)
+ {
+ SwNumRule aRule(*pCurNumRule);
+ // --> OD 2008-06-09 #i90078#
+ aRule.ChangeIndent( nDiff );
+ // <--
+
+ // --> OD 2008-03-17 #refactorlists#
+ // no start of new list
+ SetCurNumRule( aRule, false );
+ // <--
+ }
+
+ EndAllAction();
+}
+
+// --> OD 2008-06-09 #i90078#
+// Adjust method name
+void SwEditShell::SetIndent(short nIndent, const SwPosition & rPos)
+// <--
+{
+ StartAllAction();
+
+ SwNumRule *pCurNumRule = GetDoc()->GetCurrNumRule(rPos);
+
+ if (pCurNumRule)
+ {
+ SwPaM aPaM(rPos);
+ SwTxtNode * pTxtNode = aPaM.GetNode()->GetTxtNode();
+
+ // --> OD 2008-06-09 #i90078#
+// int nLevel = -1;
+// int nReferenceLevel = pTxtNode->GetActualListLevel();
+// if (! IsFirstOfNumRule(aPaM))
+// nLevel = nReferenceLevel;
+
+ SwNumRule aRule(*pCurNumRule);
+// aRule.ChangeIndent(nIndent, nLevel, nReferenceLevel, sal_False);
+ if ( IsFirstOfNumRule() )
+ {
+ aRule.SetIndentOfFirstListLevelAndChangeOthers( nIndent );
+ }
+ else if ( pTxtNode->GetActualListLevel() >= 0 )
+ {
+ aRule.SetIndent( nIndent,
+ static_cast<sal_uInt16>(pTxtNode->GetActualListLevel()) );
+ }
+ // <--
+
+ // --> OD 2005-02-18 #i42921# - 3rd parameter = false in order to
+ // suppress setting of num rule at <aPaM>.
+ // --> OD 2008-03-17 #refactorlists#
+ // do not apply any list
+ GetDoc()->SetNumRule( aPaM, aRule, false, String(), sal_False );
+ // <--
+ }
+
+ EndAllAction();
+}
+// <- #i23725#
+
+sal_Bool SwEditShell::MoveParagraph( long nOffset )
+{
+ StartAllAction();
+
+ SwPaM *pCrsr = GetCrsr();
+ if( !pCrsr->HasMark() )
+ {
+ // sorge dafuer, das Bound1 und Bound2 im gleichen Node stehen
+ pCrsr->SetMark();
+ pCrsr->DeleteMark();
+ }
+
+ sal_Bool bRet = GetDoc()->MoveParagraph( *pCrsr, nOffset );
+
+ GetDoc()->SetModified();
+ EndAllAction();
+ return bRet;
+}
+
+//#outline level add by zhaojianwei
+int SwEditShell::GetCurrentParaOutlineLevel( ) const
+{
+ int nLevel = 0;
+
+ SwPaM* pCrsr = GetCrsr();
+ const SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode();
+ if( pTxtNd )
+ nLevel = pTxtNd->GetAttrOutlineLevel();
+ return nLevel;
+}
+//<-end,zhaojianwei
+
+void SwEditShell::GetCurrentOutlineLevels( sal_uInt8& rUpper, sal_uInt8& rLower )
+{
+ SwPaM* pCrsr = GetCrsr();
+ SwPaM aCrsr( *pCrsr->Start() );
+ aCrsr.SetMark();
+ if( pCrsr->HasMark() )
+ *aCrsr.GetPoint() = *pCrsr->End();
+ GetDoc()->GotoNextNum( *aCrsr.GetPoint(), sal_False,
+ &rUpper, &rLower );
+}
+
+sal_Bool SwEditShell::MoveNumParas( sal_Bool bUpperLower, sal_Bool bUpperLeft )
+{
+ StartAllAction();
+
+ // auf alle Selektionen ??
+ SwPaM* pCrsr = GetCrsr();
+ SwPaM aCrsr( *pCrsr->Start() );
+ aCrsr.SetMark();
+
+ if( pCrsr->HasMark() )
+ *aCrsr.GetPoint() = *pCrsr->End();
+
+ sal_Bool bRet = sal_False;
+ sal_uInt8 nUpperLevel, nLowerLevel;
+ if( GetDoc()->GotoNextNum( *aCrsr.GetPoint(), sal_False,
+ &nUpperLevel, &nLowerLevel ))
+ {
+ if( bUpperLower )
+ {
+ // ueber die naechste Nummerierung
+ long nOffset = 0;
+ const SwNode* pNd;
+
+ if( bUpperLeft ) // verschiebe nach oben
+ {
+ SwPosition aPos( *aCrsr.GetMark() );
+ if( GetDoc()->GotoPrevNum( aPos, sal_False ) )
+ nOffset = aPos.nNode.GetIndex() -
+ aCrsr.GetMark()->nNode.GetIndex();
+ else
+ {
+ sal_uLong nStt = aPos.nNode.GetIndex(), nIdx = nStt - 1;
+ while( nIdx && (
+ ( pNd = GetDoc()->GetNodes()[ nIdx ])->IsSectionNode() ||
+ ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode())))
+ --nIdx;
+ if( GetDoc()->GetNodes()[ nIdx ]->IsTxtNode() )
+ nOffset = nIdx - nStt;
+ }
+ }
+ else // verschiebe nach unten
+ {
+ const SwNumRule* pOrig = aCrsr.GetNode(sal_False)->GetTxtNode()->GetNumRule();
+ if( aCrsr.GetNode()->IsTxtNode() &&
+ pOrig == aCrsr.GetNode()->GetTxtNode()->GetNumRule() )
+ {
+ sal_uLong nStt = aCrsr.GetPoint()->nNode.GetIndex(), nIdx = nStt+1;
+
+ while (nIdx < GetDoc()->GetNodes().Count()-1)
+ {
+ pNd = GetDoc()->GetNodes()[ nIdx ];
+
+ if (pNd->IsSectionNode() ||
+ ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode()) ||
+ ( pNd->IsTxtNode() && pOrig == ((SwTxtNode*)pNd)->GetNumRule() &&
+ ((SwTxtNode*)pNd)->GetActualListLevel() > nUpperLevel ))
+ {
+ ++nIdx;
+ }
+ // --> OD 2005-11-14 #i57856#
+ else
+ {
+ break;
+ }
+ // <--
+ }
+
+ if( nStt == nIdx || !GetDoc()->GetNodes()[ nIdx ]->IsTxtNode() )
+ nOffset = 1;
+ else
+ nOffset = nIdx - nStt;
+ }
+ else
+ nOffset = 1;
+ }
+
+ if( nOffset )
+ {
+ aCrsr.Move( fnMoveBackward, fnGoNode );
+ bRet = GetDoc()->MoveParagraph( aCrsr, nOffset );
+ }
+ }
+ else if( bUpperLeft ? nUpperLevel : nLowerLevel+1 < MAXLEVEL )
+ {
+ aCrsr.Move( fnMoveBackward, fnGoNode );
+ bRet = GetDoc()->NumUpDown( aCrsr, !bUpperLeft );
+ }
+ }
+
+ GetDoc()->SetModified();
+ EndAllAction();
+ return bRet;
+}
+
+sal_Bool SwEditShell::OutlineUpDown( short nOffset )
+{
+ StartAllAction();
+
+ sal_Bool bRet = sal_True;
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() == pCrsr ) // keine Mehrfachselektion ?
+ bRet = GetDoc()->OutlineUpDown( *pCrsr, nOffset );
+ else
+ {
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ SwPamRanges aRangeArr( *pCrsr );
+ SwPaM aPam( *pCrsr->GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ bRet = bRet && GetDoc()->OutlineUpDown(
+ aRangeArr.SetPam( n, aPam ), nOffset );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
+ GetDoc()->SetModified();
+ EndAllAction();
+ return bRet;
+}
+
+
+sal_Bool SwEditShell::MoveOutlinePara( short nOffset )
+{
+ StartAllAction();
+ sal_Bool bRet = GetDoc()->MoveOutlinePara( *GetCrsr(), nOffset );
+ EndAllAction();
+ return bRet;
+}
+
+// Outlines and SubOutline are ReadOnly?
+sal_Bool SwEditShell::IsProtectedOutlinePara() const
+{
+ sal_Bool bRet = sal_False;
+ const SwNode& rNd = GetCrsr()->Start()->nNode.GetNode();
+ if( rNd.IsTxtNode() )
+ {
+ const SwOutlineNodes& rOutlNd = GetDoc()->GetNodes().GetOutLineNds();
+ SwNodePtr pNd = (SwNodePtr)&rNd;
+ sal_Bool bFirst = sal_True;
+ sal_uInt16 nPos;
+ int nLvl(0);
+ if( !rOutlNd.Seek_Entry( pNd, &nPos ) && nPos )
+ --nPos;
+
+ for( ; nPos < rOutlNd.Count(); ++nPos )
+ {
+ SwNodePtr pTmpNd = rOutlNd[ nPos ];
+
+ // --> OD 2008-04-02 #refactorlists#
+// sal_uInt8 nTmpLvl = GetRealLevel( pTmpNd->GetTxtNode()->
+// GetTxtColl()->GetOutlineLevel() );
+ // int nTmpLvl = pTmpNd->GetTxtNode()->GetOutlineLevel();//#outline level,zhaojianwei
+ int nTmpLvl = pTmpNd->GetTxtNode()->GetAttrOutlineLevel();
+ // ASSERT( nTmpLvl >= 0 && nTmpLvl < MAXLEVEL,
+ ASSERT( nTmpLvl >= 0 && nTmpLvl <= MAXLEVEL, //<-end,zhaojianwei
+ "<SwEditShell::IsProtectedOutlinePara()>" );
+ // <--
+ if( bFirst )
+ {
+ nLvl = nTmpLvl;
+ bFirst = sal_False;
+ }
+ else if( nLvl >= nTmpLvl )
+ break;
+
+ if( pTmpNd->IsProtect() )
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+#ifdef DBG_UTIL
+ else
+ {
+ ASSERT(!this, "Cursor not on an outline node" );
+ }
+#endif
+ return bRet;
+}
+
+/** Test whether outline may be moved (bCopy == false)
+ * or copied (bCopy == true)
+ * Verify these conditions:
+ * 1) outline must be within main body (and not in redline)
+ * 2) outline must not be within table
+ * 3) if bCopy is set, outline must not be write protected
+ */
+sal_Bool lcl_IsOutlineMoveAndCopyable( const SwDoc* pDoc, sal_uInt16 nIdx, bool bCopy )
+{
+ const SwNodes& rNds = pDoc->GetNodes();
+ const SwNode* pNd = rNds.GetOutLineNds()[ nIdx ];
+ return pNd->GetIndex() >= rNds.GetEndOfExtras().GetIndex() && // 1) body
+ !pNd->FindTableNode() && // 2) table
+ ( bCopy || !pNd->IsProtect() ); // 3) write
+}
+
+sal_Bool SwEditShell::IsOutlineMovable( sal_uInt16 nIdx ) const
+{
+ return lcl_IsOutlineMoveAndCopyable( GetDoc(), nIdx, false );
+}
+
+sal_Bool SwEditShell::IsOutlineCopyable( sal_uInt16 nIdx ) const
+{
+ return lcl_IsOutlineMoveAndCopyable( GetDoc(), nIdx, true );
+}
+
+
+sal_Bool SwEditShell::NumOrNoNum( sal_Bool bNumOn, sal_Bool bChkStart ) // #115901#
+{
+ sal_Bool bRet = sal_False;
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() == pCrsr && !pCrsr->HasMark() &&
+ ( !bChkStart || !pCrsr->GetPoint()->nContent.GetIndex()) )
+ {
+ StartAllAction(); // Klammern fuers Updaten !!
+ // #115901#
+ bRet = GetDoc()->NumOrNoNum( pCrsr->GetPoint()->nNode, !bNumOn ); // #i29560#
+ EndAllAction();
+ }
+ return bRet;
+}
+
+sal_Bool SwEditShell::IsNoNum( sal_Bool bChkStart ) const
+{
+ // ein Backspace im Absatz ohne Nummer wird zum Delete
+ sal_Bool bResult = sal_False;
+ SwPaM* pCrsr = GetCrsr();
+
+ if (pCrsr->GetNext() == pCrsr && !pCrsr->HasMark() &&
+ (!bChkStart || !pCrsr->GetPoint()->nContent.GetIndex()))
+ {
+ const SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode();
+
+ if (pTxtNd)
+ {
+ bResult = ! pTxtNd->IsCountedInList();
+ }
+ }
+
+ return bResult;
+}
+
+// --> OD 2008-02-29 #refactorlists# - removed <pHasChilds>
+sal_uInt8 SwEditShell::GetNumLevel() const
+{
+ // gebe die akt. Ebene zurueck, auf der sich der Point vom Cursor befindet
+ //sal_uInt8 nLevel = NO_NUMBERING; //#outline level,zhaojianwei
+ sal_uInt8 nLevel = MAXLEVEL; //end,zhaojianwei
+
+ SwPaM* pCrsr = GetCrsr();
+ const SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode();
+
+ // --> FME 2005-09-12 #124972# Made code robust:
+ ASSERT( pTxtNd, "GetNumLevel() without text node" )
+ if ( !pTxtNd )
+ return nLevel;
+ // <--
+
+ const SwNumRule* pRule = pTxtNd->GetNumRule();
+ if(pRule)
+ {
+ // --> OD 2008-05-09 #refactorlists#
+ const int nListLevelOfTxtNode( pTxtNd->GetActualListLevel() );
+ if ( nListLevelOfTxtNode >= 0 )
+ {
+ nLevel = static_cast<sal_uInt8>( nListLevelOfTxtNode );
+ }
+ // <--
+ }
+
+ return nLevel;
+}
+
+const SwNumRule* SwEditShell::GetCurNumRule() const
+{
+ return GetDoc()->GetCurrNumRule( *GetCrsr()->GetPoint() );
+}
+
+// OD 2008-02-08 #newlistlevelattrs# - add handling of parameter <bResetIndentAttrs>
+// --> OD 2008-03-17 #refactorlists#
+void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
+ const bool bCreateNewList,
+ const String sContinuedListId,
+ const bool bResetIndentAttrs )
+{
+ StartAllAction();
+
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
+ {
+ SwPamRanges aRangeArr( *pCrsr );
+ SwPaM aPam( *pCrsr->GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ {
+ aRangeArr.SetPam( n, aPam );
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // --> OD 2008-03-17 #refactorlists#
+ GetDoc()->SetNumRule( aPam, rRule,
+ bCreateNewList, sContinuedListId,
+ sal_True, bResetIndentAttrs );
+ // <--
+ GetDoc()->SetCounted( aPam, true );
+ }
+ }
+ else
+ {
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // --> OD 2008-03-17 #refactorlists#
+ GetDoc()->SetNumRule( *pCrsr, rRule,
+ bCreateNewList, sContinuedListId,
+ sal_True, bResetIndentAttrs );
+ GetDoc()->SetCounted( *pCrsr, true );
+ }
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+
+ EndAllAction();
+}
+
+String SwEditShell::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) const
+{
+ return GetDoc()->GetUniqueNumRuleName( pChkStr, bAutoNum );
+}
+
+void SwEditShell::ChgNumRuleFmts( const SwNumRule& rRule )
+{
+ StartAllAction();
+ GetDoc()->ChgNumRuleFmts( rRule );
+ EndAllAction();
+}
+
+sal_Bool SwEditShell::ReplaceNumRule( const String& rOldRule, const String& rNewRule )
+{
+ StartAllAction();
+ sal_Bool bRet = GetDoc()->ReplaceNumRule( *GetCrsr()->GetPoint(), rOldRule, rNewRule );
+ EndAllAction();
+ return bRet;
+}
+
+void SwEditShell::SetNumRuleStart( sal_Bool bFlag )
+{
+ StartAllAction();
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
+ {
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ SwPamRanges aRangeArr( *pCrsr );
+ SwPaM aPam( *pCrsr->GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ GetDoc()->SetNumRuleStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), bFlag );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
+ else
+ GetDoc()->SetNumRuleStart( *pCrsr->GetPoint(), bFlag );
+
+ EndAllAction();
+}
+
+sal_Bool SwEditShell::IsNumRuleStart() const
+{
+ sal_Bool bResult = sal_False;
+ const SwTxtNode* pTxtNd = GetCrsr()->GetNode()->GetTxtNode();
+ if( pTxtNd )
+ bResult = pTxtNd->IsListRestart() ? sal_True : sal_False;
+ return bResult;
+}
+
+void SwEditShell::SetNodeNumStart( sal_uInt16 nStt )
+{
+ StartAllAction();
+
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
+ {
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ SwPamRanges aRangeArr( *pCrsr );
+ SwPaM aPam( *pCrsr->GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ GetDoc()->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), nStt );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
+ else
+ GetDoc()->SetNodeNumStart( *pCrsr->GetPoint(), nStt );
+
+ EndAllAction();
+}
+
+sal_uInt16 SwEditShell::GetNodeNumStart() const
+{
+ const SwTxtNode* pTxtNd = GetCrsr()->GetNode()->GetTxtNode();
+ // --> OD 2008-02-28 #refactorlists#
+ // correction: check, if list restart value is set at text node and
+ // use new method <SwTxtNode::GetAttrListRestartValue()>.
+ // return USHRT_MAX, if no list restart value is found.
+ if ( pTxtNd && pTxtNd->HasAttrListRestartValue() )
+ {
+ return static_cast<sal_uInt16>(pTxtNd->GetAttrListRestartValue());
+ }
+ return USHRT_MAX;
+ // <--
+}
+
+/*-- 26.08.2005 14:47:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+// --> OD 2008-03-18 #refactorlists#
+const SwNumRule * SwEditShell::SearchNumRule( const bool bForward,
+ const bool bNum,
+ const bool bOutline,
+ int nNonEmptyAllowed,
+ String& sListId )
+{
+ return GetDoc()->SearchNumRule( *(bForward ? GetCrsr()->End() : GetCrsr()->Start()),
+ bForward, bNum, bOutline, nNonEmptyAllowed,
+ sListId );
+}
+// <--
diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
new file mode 100644
index 000000000000..0dd6b9b3ec79
--- /dev/null
+++ b/sw/source/core/edit/edredln.cxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <docary.hxx>
+#include <vcl/window.hxx>
+#include "redline.hxx"
+#include "doc.hxx"
+#include "swundo.hxx"
+#include "editsh.hxx"
+#include "edimp.hxx"
+#include "frmtool.hxx"
+
+
+sal_uInt16 SwEditShell::GetRedlineMode() const
+{
+ return GetDoc()->GetRedlineMode();
+}
+
+void SwEditShell::SetRedlineMode( sal_uInt16 eMode )
+{
+ if( eMode != GetDoc()->GetRedlineMode() )
+ {
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ GetDoc()->SetRedlineMode( (RedlineMode_t)eMode );
+ EndAllAction();
+ }
+}
+
+sal_Bool SwEditShell::IsRedlineOn() const
+{
+ return GetDoc()->IsRedlineOn();
+}
+
+sal_uInt16 SwEditShell::GetRedlineCount() const
+{
+ return GetDoc()->GetRedlineTbl().Count();
+}
+
+const SwRedline& SwEditShell::GetRedline( sal_uInt16 nPos ) const
+{
+ return *GetDoc()->GetRedlineTbl()[ nPos ];
+}
+
+void lcl_InvalidateAll( ViewShell* pSh )
+{
+ ViewShell *pStop = pSh;
+ do
+ {
+ if ( pSh->GetWin() )
+ pSh->GetWin()->Invalidate();
+ pSh = (ViewShell*)pSh->GetNext();
+
+ } while ( pSh != pStop );
+}
+
+sal_Bool SwEditShell::AcceptRedline( sal_uInt16 nPos )
+{
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ sal_Bool bRet = GetDoc()->AcceptRedline( nPos, true );
+ if( !nPos && !::IsExtraData( GetDoc() ) )
+ lcl_InvalidateAll( this );
+ EndAllAction();
+ return bRet;
+}
+
+sal_Bool SwEditShell::RejectRedline( sal_uInt16 nPos )
+{
+ SET_CURR_SHELL( this );
+ StartAllAction();
+ sal_Bool bRet = GetDoc()->RejectRedline( nPos, true );
+ if( !nPos && !::IsExtraData( GetDoc() ) )
+ lcl_InvalidateAll( this );
+ EndAllAction();
+ return bRet;
+}
+
+// Kommentar am Redline setzen
+sal_Bool SwEditShell::SetRedlineComment( const String& rS )
+{
+ sal_Bool bRet = sal_False;
+ FOREACHPAM_START(this)
+ bRet = bRet || GetDoc()->SetRedlineComment( *PCURCRSR, rS );
+ FOREACHPAM_END()
+
+ return bRet;
+}
+
+const SwRedline* SwEditShell::GetCurrRedline() const
+{
+ return GetDoc()->GetRedline( *GetCrsr()->GetPoint(), 0 );
+}
+
+void SwEditShell::UpdateRedlineAttr()
+{
+ if( ( nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ) ==
+ ( nsRedlineMode_t::REDLINE_SHOW_MASK & GetDoc()->GetRedlineMode() ))
+ {
+ SET_CURR_SHELL( this );
+ StartAllAction();
+
+ GetDoc()->UpdateRedlineAttr();
+
+ EndAllAction();
+ }
+}
+
+ // suche das Redline zu diesem Data und returne die Pos im Array
+ // USHRT_MAX wird returnt, falls nicht vorhanden
+sal_uInt16 SwEditShell::FindRedlineOfData( const SwRedlineData& rData ) const
+{
+ const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
+
+ for( sal_uInt16 i = 0, nCnt = rTbl.Count(); i < nCnt; ++i )
+ if( &rTbl[ i ]->GetRedlineData() == &rData )
+ return i;
+ return USHRT_MAX;
+}
+
+
+
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
new file mode 100644
index 000000000000..a31122b631f4
--- /dev/null
+++ b/sw/source/core/edit/edsect.cxx
@@ -0,0 +1,455 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <editsh.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pam.hxx>
+#include <docary.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <section.hxx>
+#include <edimp.hxx>
+#include <sectfrm.hxx> // SwSectionFrm
+#include <cntfrm.hxx> // SwCntntFrm
+#include <tabfrm.hxx> // SwTabFrm
+#include <rootfrm.hxx> // SwRootFrm
+
+
+SwSection const*
+SwEditShell::InsertSection(
+ SwSectionData & rNewData, SfxItemSet const*const pAttr)
+{
+ const SwSection* pRet = 0;
+ if( !IsTableMode() )
+ {
+ StartAllAction();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSSECTION, NULL );
+
+ FOREACHPAM_START(this)
+ SwSection const*const pNew =
+ GetDoc()->InsertSwSection( *PCURCRSR, rNewData, 0, pAttr );
+ if( !pRet )
+ pRet = pNew;
+ FOREACHPAM_END()
+
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL );
+ EndAllAction();
+ }
+ return pRet;
+}
+
+
+sal_Bool SwEditShell::IsInsRegionAvailable() const
+{
+ if( IsTableMode() )
+ return sal_False;
+ SwPaM* pCrsr = GetCrsr();
+ if( pCrsr->GetNext() != pCrsr )
+ return sal_False;
+ if( pCrsr->HasMark() )
+ return 0 != GetDoc()->IsInsRegionAvailable( *pCrsr );
+
+ return sal_True;
+}
+
+
+const SwSection* SwEditShell::GetCurrSection() const
+{
+ if( IsTableMode() )
+ return 0;
+
+ return GetDoc()->GetCurrSection( *GetCrsr()->GetPoint() );
+}
+
+/*-----------------17.03.99 11:53-------------------
+ * SwEditShell::GetAnySection liefert den fuer Spalten
+ * zustaendigen Bereich, bei Fussnoten kann es nicht der
+ * Bereich innerhalb der Fussnote sein.
+ * --------------------------------------------------*/
+
+const SwSection* SwEditShell::GetAnySection( sal_Bool bOutOfTab, const Point* pPt ) const
+{
+ SwFrm *pFrm;
+ if ( pPt )
+ {
+ SwPosition aPos( *GetCrsr()->GetPoint() );
+ Point aPt( *pPt );
+ GetLayout()->GetCrsrOfst( &aPos, aPt );
+ SwCntntNode *pNd = aPos.nNode.GetNode().GetCntntNode();
+ pFrm = pNd->getLayoutFrm( GetLayout(), pPt );
+ }
+ else
+ pFrm = GetCurrFrm( sal_False );
+
+ if( bOutOfTab && pFrm )
+ pFrm = pFrm->FindTabFrm();
+ if( pFrm && pFrm->IsInSct() )
+ {
+ SwSectionFrm* pSect = pFrm->FindSctFrm();
+ ASSERT( pSect, "GetAnySection: Where's my Sect?" );
+ if( pSect->IsInFtn() && pSect->GetUpper()->IsInSct() )
+ {
+ pSect = pSect->GetUpper()->FindSctFrm();
+ ASSERT( pSect, "GetAnySection: Where's my SectFrm?" );
+ }
+ return pSect->GetSection();
+ }
+ return NULL;
+}
+
+sal_uInt16 SwEditShell::GetSectionFmtCount() const
+{
+ return GetDoc()->GetSections().Count();
+}
+
+
+sal_Bool SwEditShell::IsAnySectionInDoc( sal_Bool bChkReadOnly, sal_Bool bChkHidden, sal_Bool bChkTOX ) const
+{
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ sal_uInt16 nCnt = rFmts.Count();
+ sal_uInt16 n;
+
+ for( n = 0; n < nCnt; ++n )
+ {
+ SectionType eTmpType;
+ const SwSectionFmt* pFmt = rFmts[ n ];
+ if( pFmt->IsInNodesArr() &&
+ (bChkTOX ||
+ ( (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType ) ) )
+ {
+ const SwSection& rSect = *rFmts[ n ]->GetSection();
+ if( (!bChkReadOnly && !bChkHidden ) ||
+ (bChkReadOnly && rSect.IsProtectFlag() ) ||
+ (bChkHidden && rSect.IsHiddenFlag() ) )
+ break;
+ }
+ }
+ return n != nCnt;
+}
+
+sal_uInt16 SwEditShell::GetSectionFmtPos( const SwSectionFmt& rFmt ) const
+{
+ SwSectionFmt* pFmt = (SwSectionFmt*)&rFmt;
+ return GetDoc()->GetSections().GetPos( pFmt );
+}
+
+const SwSectionFmt& SwEditShell::GetSectionFmt( sal_uInt16 nFmt ) const
+{
+ return *GetDoc()->GetSections()[ nFmt ];
+}
+
+
+void SwEditShell::DelSectionFmt( sal_uInt16 nFmt )
+{
+ StartAllAction();
+ GetDoc()->DelSectionFmt( GetDoc()->GetSections()[ nFmt ] );
+ // rufe das AttrChangeNotify auf der UI-Seite.
+ CallChgLnk();
+ EndAllAction();
+}
+
+
+void SwEditShell::UpdateSection(sal_uInt16 const nSect,
+ SwSectionData & rNewData, SfxItemSet const*const pAttr)
+{
+ StartAllAction();
+ GetDoc()->UpdateSection( nSect, rNewData, pAttr );
+ // rufe das AttrChangeNotify auf der UI-Seite.
+ CallChgLnk();
+ EndAllAction();
+}
+
+String SwEditShell::GetUniqueSectionName( const String* pChkStr ) const
+{
+ return GetDoc()->GetUniqueSectionName( pChkStr );
+}
+
+void SwEditShell::SetSectionAttr( const SfxItemSet& rSet,
+ SwSectionFmt* pSectFmt )
+{
+ if( pSectFmt )
+ _SetSectionAttr( *pSectFmt, rSet );
+ else
+ {
+ // for all section in the selection
+
+ FOREACHPAM_START(this)
+
+ const SwPosition* pStt = PCURCRSR->Start(),
+ * pEnd = PCURCRSR->End();
+
+ const SwSectionNode* pSttSectNd = pStt->nNode.GetNode().FindSectionNode(),
+ * pEndSectNd = pEnd->nNode.GetNode().FindSectionNode();
+
+ if( pSttSectNd || pEndSectNd )
+ {
+ if( pSttSectNd )
+ _SetSectionAttr( *pSttSectNd->GetSection().GetFmt(),
+ rSet );
+ if( pEndSectNd && pSttSectNd != pEndSectNd )
+ _SetSectionAttr( *pEndSectNd->GetSection().GetFmt(),
+ rSet );
+
+ if( pSttSectNd && pEndSectNd )
+ {
+ SwNodeIndex aSIdx( pStt->nNode );
+ SwNodeIndex aEIdx( pEnd->nNode );
+ if( pSttSectNd->EndOfSectionIndex() <
+ pEndSectNd->GetIndex() )
+ {
+ aSIdx = pSttSectNd->EndOfSectionIndex() + 1;
+ aEIdx = *pEndSectNd;
+ }
+
+ while( aSIdx < aEIdx )
+ {
+ if( 0 != (pSttSectNd = aSIdx.GetNode().GetSectionNode())
+ || ( aSIdx.GetNode().IsEndNode() &&
+ 0 != ( pSttSectNd = aSIdx.GetNode().
+ StartOfSectionNode()->GetSectionNode())) )
+ _SetSectionAttr( *pSttSectNd->GetSection().GetFmt(),
+ rSet );
+ aSIdx++;
+ }
+ }
+ }
+
+ FOREACHPAM_END()
+ }
+}
+
+void SwEditShell::_SetSectionAttr( SwSectionFmt& rSectFmt,
+ const SfxItemSet& rSet )
+{
+ StartAllAction();
+ if(SFX_ITEM_SET == rSet.GetItemState(RES_CNTNT, sal_False))
+ {
+ SfxItemSet aSet(rSet);
+ aSet.ClearItem(RES_CNTNT);
+ GetDoc()->SetAttr( aSet, rSectFmt );
+ }
+ else
+ GetDoc()->SetAttr( rSet, rSectFmt );
+
+ // rufe das AttrChangeNotify auf der UI-Seite.
+ CallChgLnk();
+ EndAllAction();
+}
+
+// search inside the cursor selection for full selected sections.
+// if any part of section in the selection return 0.
+// if more than one in the selection return the count
+sal_uInt16 SwEditShell::GetFullSelectedSectionCount() const
+{
+ sal_uInt16 nRet = 0;
+ FOREACHPAM_START(this)
+
+ const SwPosition* pStt = PCURCRSR->Start(),
+ * pEnd = PCURCRSR->End();
+ const SwCntntNode* pCNd;
+ // check the selection, if Start at Node begin and End at Node end
+ if( pStt->nContent.GetIndex() ||
+ ( 0 == ( pCNd = pEnd->nNode.GetNode().GetCntntNode() )) ||
+ pCNd->Len() != pEnd->nContent.GetIndex() )
+ {
+ nRet = 0;
+ break;
+ }
+
+// !!!!!!!!!!!!!!!!!!!!!!!!!!
+// what about table at start or end ?
+// There is no selection possible!
+// What about only a table inside the section ?
+// There is only a table selection possible!
+
+ SwNodeIndex aSIdx( pStt->nNode, -1 ), aEIdx( pEnd->nNode, +1 );
+ if( !aSIdx.GetNode().IsSectionNode() ||
+ !aEIdx.GetNode().IsEndNode() ||
+ !aEIdx.GetNode().StartOfSectionNode()->IsSectionNode() )
+ {
+ nRet = 0;
+ break;
+ }
+
+ ++nRet;
+ if( &aSIdx.GetNode() != aEIdx.GetNode().StartOfSectionNode() )
+ ++nRet;
+
+ FOREACHPAM_END()
+ return nRet;
+}
+
+
+/**
+ * Find the suitable node for a special insert (alt-enter).
+ * This should enable inserting text before/after sections and tables.
+ *
+ * A node is found if:
+ * 1) the innermost table/section is not in a write-protected area
+ * 2) pCurrentPos is at or just before an end node
+ * (or at or just after a start node)
+ * 3) there are only start/end nodes between pCurrentPos and the innermost
+ * table/section
+ *
+ * If a suitable node is found, an SwNode* is returned; else it is NULL.
+ */
+const SwNode* lcl_SpecialInsertNode(const SwPosition* pCurrentPos)
+{
+ const SwNode* pReturn = NULL;
+
+ // the current position
+ // const SwPosition* pCurrentPos = GetCrsr()->GetPoint();
+ DBG_ASSERT( pCurrentPos != NULL, "Strange, we have no position!" );
+ const SwNode& rCurrentNode = pCurrentPos->nNode.GetNode();
+
+
+ // find innermost section or table. At the end of this scope,
+ // pInntermostNode contain the section/table before/after which we should
+ // insert our empty paragraph, or it will be NULL if none is found.
+ const SwNode* pInnermostNode = NULL;
+ {
+ const SwNode* pTableNode = rCurrentNode.FindTableNode();
+ const SwNode* pSectionNode = rCurrentNode.FindSectionNode();
+
+ // find the table/section which is close
+ if( pTableNode == NULL )
+ pInnermostNode = pSectionNode;
+ else if ( pSectionNode == NULL )
+ pInnermostNode = pTableNode;
+ else
+ {
+ // compare and choose the larger one
+ pInnermostNode =
+ ( pSectionNode->GetIndex() > pTableNode->GetIndex() )
+ ? pSectionNode : pTableNode;
+ }
+ }
+
+ // The previous version had a check to skip empty read-only sections. Those
+ // shouldn't occur, so we only need to check whether our pInnermostNode is
+ // inside a protected area.
+
+ // Now, pInnermostNode is NULL or the innermost section or table node.
+ if( (pInnermostNode != NULL) && !pInnermostNode->IsProtect() )
+ {
+ DBG_ASSERT( pInnermostNode->IsTableNode() ||
+ pInnermostNode->IsSectionNode(), "wrong node found" );
+ DBG_ASSERT( ( pInnermostNode->GetIndex() <= rCurrentNode.GetIndex() )&&
+ ( pInnermostNode->EndOfSectionNode()->GetIndex() >=
+ rCurrentNode.GetIndex() ), "wrong node found" );
+
+ // we now need to find the possible start/end positions
+
+ // we found a start if
+ // - we're at or just before a start node
+ // - there are only start nodes between the current and pInnermostNode
+ SwNodeIndex aBegin( pCurrentPos->nNode );
+ if( rCurrentNode.IsCntntNode() &&
+ (pCurrentPos->nContent.GetIndex() == 0))
+ aBegin--;
+ while( (aBegin != pInnermostNode->GetIndex()) &&
+ aBegin.GetNode().IsStartNode() )
+ aBegin--;
+ bool bStart = ( aBegin == pInnermostNode->GetIndex() );
+
+ // we found an end if
+ // - we're at or just before an end node
+ // - there are only end nodes between the current node and
+ // pInnermostNode's end node
+ SwNodeIndex aEnd( pCurrentPos->nNode );
+ if( rCurrentNode.IsCntntNode() &&
+ ( pCurrentPos->nContent.GetIndex() ==
+ rCurrentNode.GetCntntNode()->Len() ) )
+ aEnd++;
+ while( (aEnd != pInnermostNode->EndOfSectionNode()->GetIndex()) &&
+ aEnd.GetNode().IsEndNode() )
+ aEnd++;
+ bool bEnd = ( aEnd == pInnermostNode->EndOfSectionNode()->GetIndex() );
+
+ // evalutate result: if both start + end, end is preferred
+ if( bEnd )
+ pReturn = pInnermostNode->EndOfSectionNode();
+ else if ( bStart )
+ pReturn = pInnermostNode;
+ // else pReturn = NULL;
+ }
+ // else: pReturn = NULL
+
+
+ DBG_ASSERT( ( pReturn == NULL ) || pReturn->IsStartNode() ||
+ pReturn->IsEndNode(),
+ "SpecialInsertNode failed" );
+ return pReturn;
+}
+
+
+/** a node can be special-inserted (alt-Enter) whenever lcl_SpecialInsertNode
+ finds a suitable position
+*/
+bool SwEditShell::CanSpecialInsert() const
+{
+ return NULL != lcl_SpecialInsertNode( GetCrsr()->GetPoint() );
+}
+
+
+/** check whether a node cen be special-inserted (alt-Enter), and do so. Return
+ whether insertion was possible.
+ */
+bool SwEditShell::DoSpecialInsert()
+{
+ bool bRet = false;
+
+ // get current node
+ SwPosition* pCursorPos = GetCrsr()->GetPoint();
+ const SwNode* pInsertNode = lcl_SpecialInsertNode( pCursorPos );
+ if( pInsertNode != NULL )
+ {
+ StartAllAction();
+
+ // adjust insert position to insert before start nodes and after end
+ // nodes
+ SwNodeIndex aInsertIndex( *pInsertNode,
+ pInsertNode->IsStartNode() ? -1 : 0 );
+ SwPosition aInsertPos( aInsertIndex );
+
+ // insert a new text node, and set the cursor
+ bRet = GetDoc()->AppendTxtNode( aInsertPos );
+ *pCursorPos = aInsertPos;
+
+ // call AttrChangeNotify for the UI
+ CallChgLnk();
+
+ EndAllAction();
+ }
+
+ return bRet;
+}
+
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
new file mode 100644
index 000000000000..f67442d1be4b
--- /dev/null
+++ b/sw/source/core/edit/edtab.cxx
@@ -0,0 +1,493 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/chart2/XChartDocument.hpp>
+#include <hintids.hxx>
+#include <hints.hxx>
+
+#define _SVSTDARR_ULONGS
+#include <svl/svstdarr.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <editeng/boxitem.hxx>
+#include <swwait.hxx>
+#include <fmtfsize.hxx>
+#include <frmatr.hxx>
+#include <editsh.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <cntfrm.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <fldbas.hxx>
+#include <swtable.hxx>
+#include <swundo.hxx>
+#include <tblsel.hxx>
+#include <edimp.hxx>
+#include <tabfrm.hxx>
+#include <cellfrm.hxx>
+#include <cellatr.hxx>
+#include <swtblfmt.hxx>
+#include <swddetbl.hxx>
+#include <mdiexp.hxx>
+#include <unochart.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+extern void ClearFEShellTabCols();
+
+const SwTable& SwEditShell::InsertTable( const SwInsertTableOptions& rInsTblOpts,
+ sal_uInt16 nRows, sal_uInt16 nCols,
+ sal_Int16 eAdj,
+ const SwTableAutoFmt* pTAFmt )
+{
+ StartAllAction();
+ SwPosition* pPos = GetCrsr()->GetPoint();
+
+ sal_Bool bEndUndo = 0 != pPos->nContent.GetIndex();
+ if( bEndUndo )
+ {
+ StartUndo( UNDO_START );
+ GetDoc()->SplitNode( *pPos, false );
+ }
+
+ /* #109161# If called from a shell the adjust item is propagated
+ from pPos to the new content nodes in the table.
+ */
+ const SwTable *pTable = GetDoc()->InsertTable( rInsTblOpts, *pPos,
+ nRows, nCols,
+ eAdj, pTAFmt,
+ 0, sal_True );
+ if( bEndUndo )
+ EndUndo( UNDO_END );
+
+ EndAllAction();
+ return *pTable;
+}
+
+sal_Bool SwEditShell::TextToTable( const SwInsertTableOptions& rInsTblOpts,
+ sal_Unicode cCh,
+ sal_Int16 eAdj,
+ const SwTableAutoFmt* pTAFmt )
+{
+ SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
+ sal_Bool bRet = sal_False;
+ StartAllAction();
+ FOREACHPAM_START(this)
+ if( PCURCRSR->HasMark() )
+ bRet |= 0 != GetDoc()->TextToTable( rInsTblOpts, *PCURCRSR, cCh,
+ eAdj, pTAFmt );
+ FOREACHPAM_END()
+ EndAllAction();
+ return bRet;
+}
+
+sal_Bool SwEditShell::TableToText( sal_Unicode cCh )
+{
+ SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
+ sal_Bool bRet = sal_False;
+ SwPaM* pCrsr = GetCrsr();
+ const SwTableNode* pTblNd =
+ GetDoc()->IsIdxInTbl( pCrsr->GetPoint()->nNode );
+ if( IsTableMode() )
+ {
+ ClearMark();
+ pCrsr = GetCrsr();
+ }
+ else if( !pTblNd || pCrsr->GetNext() != pCrsr )
+ return bRet;
+
+ // TL_CHART2:
+ // tell the charts about the table to be deleted and have them use their own data
+ GetDoc()->CreateChartInternalDataProviders( &pTblNd->GetTable() );
+
+ StartAllAction();
+
+ // verschiebe den akt. Cursor aus dem Tabellen Bereich
+ // angemeldet ist
+ SwNodeIndex aTabIdx( *pTblNd );
+ pCrsr->DeleteMark();
+ pCrsr->GetPoint()->nNode = *pTblNd->EndOfSectionNode();
+ pCrsr->GetPoint()->nContent.Assign( 0, 0 );
+ // SPoint und Mark aus dem Bereich verschieben !!!
+ pCrsr->SetMark();
+ pCrsr->DeleteMark();
+
+ bRet = GetDoc()->TableToText( pTblNd, cCh );
+ pCrsr->GetPoint()->nNode = aTabIdx;
+
+ SwCntntNode* pCNd = pCrsr->GetCntntNode();
+ if( !pCNd )
+ pCrsr->Move( fnMoveForward, fnGoCntnt );
+ else
+ pCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
+
+ EndAllAction();
+ return bRet;
+}
+
+sal_Bool SwEditShell::IsTextToTableAvailable() const
+{
+ sal_Bool bOnlyText = sal_False;
+ FOREACHPAM_START(this)
+ if( PCURCRSR->HasMark() && *PCURCRSR->GetPoint() != *PCURCRSR->GetMark() )
+ {
+ bOnlyText = sal_True;
+
+ // pruefe ob in der Selection eine Tabelle liegt
+ sal_uLong nStt = PCURCRSR->GetMark()->nNode.GetIndex(),
+ nEnd = PCURCRSR->GetPoint()->nNode.GetIndex();
+ if( nStt > nEnd ) { sal_uLong n = nStt; nStt = nEnd; nEnd = n; }
+
+ for( ; nStt <= nEnd; ++nStt )
+ if( !GetDoc()->GetNodes()[ nStt ]->IsTxtNode() )
+ {
+ bOnlyText = sal_False;
+ break;
+ }
+
+ if( !bOnlyText )
+ break;
+ }
+ FOREACHPAM_END()
+
+ return bOnlyText;
+}
+
+void SwEditShell::InsertDDETable( const SwInsertTableOptions& rInsTblOpts,
+ SwDDEFieldType* pDDEType,
+ sal_uInt16 nRows, sal_uInt16 nCols,
+ sal_Int16 eAdj )
+{
+ SwPosition* pPos = GetCrsr()->GetPoint();
+
+ StartAllAction();
+
+ sal_Bool bEndUndo = 0 != pPos->nContent.GetIndex();
+ if( bEndUndo )
+ {
+ StartUndo( UNDO_START );
+ GetDoc()->SplitNode( *pPos, false );
+ }
+
+ const SwInsertTableOptions aInsTblOpts( rInsTblOpts.mnInsMode | tabopts::DEFAULT_BORDER,
+ rInsTblOpts.mnRowsToRepeat );
+ SwTable* pTbl = (SwTable*)GetDoc()->InsertTable( aInsTblOpts, *pPos,
+ nRows, nCols, eAdj );
+
+ SwTableNode* pTblNode = (SwTableNode*)pTbl->GetTabSortBoxes()[ 0 ]->
+ GetSttNd()->FindTableNode();
+ SwDDETable* pDDETbl = new SwDDETable( *pTbl, pDDEType );
+ pTblNode->SetNewTable( pDDETbl ); // setze die DDE-Tabelle
+
+ if( bEndUndo )
+ EndUndo( UNDO_END );
+
+ EndAllAction();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Tabellenfelder einer Tabelle updaten
+ --------------------------------------------------------------------*/
+void SwEditShell::UpdateTable()
+{
+ const SwTableNode* pTblNd = IsCrsrInTbl();
+
+ // Keine Arme keine Kekse
+ if( pTblNd )
+ {
+ StartAllAction();
+ if( DoesUndo() )
+ StartUndo();
+ EndAllTblBoxEdit();
+ SwTableFmlUpdate aTblUpdate( (SwTable*)&pTblNd->GetTable() );
+ GetDoc()->UpdateTblFlds( &aTblUpdate );
+ if( DoesUndo() )
+ EndUndo();
+ EndAllAction();
+ }
+}
+
+ // Change Modus erfragen/setzen
+TblChgMode SwEditShell::GetTblChgMode() const
+{
+ TblChgMode eMode;
+ const SwTableNode* pTblNd = IsCrsrInTbl();
+ if( pTblNd )
+ eMode = pTblNd->GetTable().GetTblChgMode();
+ else
+ eMode = GetTblChgDefaultMode();
+ return eMode;
+}
+
+void SwEditShell::SetTblChgMode( TblChgMode eMode )
+{
+ const SwTableNode* pTblNd = IsCrsrInTbl();
+
+ // Keine Arme keine Kekse
+ if( pTblNd )
+ {
+ ((SwTable&)pTblNd->GetTable()).SetTblChgMode( eMode );
+ if( !GetDoc()->IsModified() ) // Bug 57028
+ {
+ GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified();
+ }
+ GetDoc()->SetModified();
+ }
+}
+
+sal_Bool SwEditShell::GetTblBoxFormulaAttrs( SfxItemSet& rSet ) const
+{
+ SwSelBoxes aBoxes;
+ if( IsTableMode() )
+ ::GetTblSelCrs( *this, aBoxes );
+ else
+ {
+ do {
+ SwFrm *pFrm = GetCurrFrm();
+ do {
+ pFrm = pFrm->GetUpper();
+ } while ( pFrm && !pFrm->IsCellFrm() );
+ if ( pFrm )
+ {
+ SwTableBox *pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox();
+ aBoxes.Insert( pBox );
+ }
+ } while( sal_False );
+ }
+
+ for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n )
+ {
+ const SwTableBox* pSelBox = aBoxes[ n ];
+ const SwTableBoxFmt* pTblFmt = (SwTableBoxFmt*)pSelBox->GetFrmFmt();
+ if( !n )
+ {
+ // Formeln in die externe Darstellung bringen!
+ const SwTable& rTbl = pSelBox->GetSttNd()->FindTableNode()->GetTable();
+
+ SwTableFmlUpdate aTblUpdate( (SwTable*)&rTbl );
+ aTblUpdate.eFlags = TBL_BOXNAME;
+ ((SwDoc*)GetDoc())->UpdateTblFlds( &aTblUpdate );
+
+ rSet.Put( pTblFmt->GetAttrSet() );
+ }
+ else
+ rSet.MergeValues( pTblFmt->GetAttrSet() );
+ }
+ return 0 != rSet.Count();
+}
+
+void SwEditShell::SetTblBoxFormulaAttrs( const SfxItemSet& rSet )
+{
+ SET_CURR_SHELL( this );
+ SwSelBoxes aBoxes;
+ if( IsTableMode() )
+ ::GetTblSelCrs( *this, aBoxes );
+ else
+ {
+ do {
+ SwFrm *pFrm = GetCurrFrm();
+ do {
+ pFrm = pFrm->GetUpper();
+ } while ( pFrm && !pFrm->IsCellFrm() );
+ if ( pFrm )
+ {
+ SwTableBox *pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox();
+ aBoxes.Insert( pBox );
+ }
+ } while( sal_False );
+ }
+
+ // beim setzen einer Formel keine Ueberpruefung mehr vornehmen!
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMULA ))
+ ClearTblBoxCntnt();
+
+ StartAllAction();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n )
+ GetDoc()->SetTblBoxFormulaAttrs( *aBoxes[ n ], rSet );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ EndAllAction();
+}
+
+sal_Bool SwEditShell::IsTableBoxTextFormat() const
+{
+ if( IsTableMode() )
+ return sal_False;
+
+ SwTableBox *pBox = 0;
+ {
+ SwFrm *pFrm = GetCurrFrm();
+ do {
+ pFrm = pFrm->GetUpper();
+ } while ( pFrm && !pFrm->IsCellFrm() );
+ if ( pFrm )
+ pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox();
+ }
+
+ if( !pBox )
+ return sal_False;
+
+ sal_uInt32 nFmt;
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pBox->GetFrmFmt()->GetAttrSet().GetItemState(
+ RES_BOXATR_FORMAT, sal_True, &pItem ))
+ {
+ nFmt = ((SwTblBoxNumFormat*)pItem)->GetValue();
+ return GetDoc()->GetNumberFormatter()->IsTextFormat( nFmt ) ||
+ NUMBERFORMAT_TEXT == nFmt;
+ }
+
+ sal_uLong nNd = pBox->IsValidNumTxtNd();
+ if( ULONG_MAX == nNd )
+ return sal_True;
+
+ const String& rTxt = GetDoc()->GetNodes()[ nNd ]->GetTxtNode()->GetTxt();
+ if( !rTxt.Len() )
+ return sal_False;
+
+ double fVal;
+ return !GetDoc()->GetNumberFormatter()->IsNumberFormat( rTxt, nFmt, fVal );
+}
+
+String SwEditShell::GetTableBoxText() const
+{
+ String sRet;
+ if( !IsTableMode() )
+ {
+ SwTableBox *pBox = 0;
+ {
+ SwFrm *pFrm = GetCurrFrm();
+ do {
+ pFrm = pFrm->GetUpper();
+ } while ( pFrm && !pFrm->IsCellFrm() );
+ if ( pFrm )
+ pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox();
+ }
+
+ sal_uLong nNd;
+ if( pBox && ULONG_MAX != ( nNd = pBox->IsValidNumTxtNd() ) )
+ sRet = GetDoc()->GetNodes()[ nNd ]->GetTxtNode()->GetTxt();
+ }
+ return sRet;
+}
+
+sal_Bool SwEditShell::SplitTable( sal_uInt16 eMode )
+{
+ sal_Bool bRet = sal_False;
+ SwPaM *pCrsr = GetCrsr();
+ if( pCrsr->GetNode()->FindTableNode() )
+ {
+ StartAllAction();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+
+ bRet = GetDoc()->SplitTable( *pCrsr->GetPoint(), eMode, sal_True );
+
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+ ClearFEShellTabCols();
+ EndAllAction();
+ }
+ return bRet;
+}
+
+sal_Bool SwEditShell::MergeTable( sal_Bool bWithPrev, sal_uInt16 nMode )
+{
+ sal_Bool bRet = sal_False;
+ SwPaM *pCrsr = GetCrsr();
+ if( pCrsr->GetNode()->FindTableNode() )
+ {
+ StartAllAction();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+
+ bRet = GetDoc()->MergeTable( *pCrsr->GetPoint(), bWithPrev, nMode );
+
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+ ClearFEShellTabCols();
+ EndAllAction();
+ }
+ return bRet;
+}
+
+sal_Bool SwEditShell::CanMergeTable( sal_Bool bWithPrev, sal_Bool* pChkNxtPrv ) const
+{
+ sal_Bool bRet = sal_False;
+ const SwPaM *pCrsr = GetCrsr();
+ const SwTableNode* pTblNd = pCrsr->GetNode()->FindTableNode();
+ if( pTblNd && !pTblNd->GetTable().ISA( SwDDETable ))
+ {
+ sal_Bool bNew = pTblNd->GetTable().IsNewModel();
+ const SwNodes& rNds = GetDoc()->GetNodes();
+ if( pChkNxtPrv )
+ {
+ const SwTableNode* pChkNd = rNds[ pTblNd->GetIndex() - 1 ]->FindTableNode();
+ if( pChkNd && !pChkNd->GetTable().ISA( SwDDETable ) &&
+ bNew == pChkNd->GetTable().IsNewModel() &&
+ // --> FME 2004-09-17 #117418# Consider table in table case
+ pChkNd->EndOfSectionIndex() == pTblNd->GetIndex() - 1 )
+ // <--
+ *pChkNxtPrv = sal_True, bRet = sal_True; // mit Prev ist moeglich
+ else
+ {
+ pChkNd = rNds[ pTblNd->EndOfSectionIndex() + 1 ]->GetTableNode();
+ if( pChkNd && !pChkNd->GetTable().ISA( SwDDETable ) &&
+ bNew == pChkNd->GetTable().IsNewModel() )
+ *pChkNxtPrv = sal_False, bRet = sal_True; // mit Next ist moeglich
+ }
+ }
+ else
+ {
+ const SwTableNode* pTmpTblNd = 0;
+
+ if( bWithPrev )
+ {
+ pTmpTblNd = rNds[ pTblNd->GetIndex() - 1 ]->FindTableNode();
+ // --> FME 2004-09-17 #117418# Consider table in table case
+ if ( pTmpTblNd && pTmpTblNd->EndOfSectionIndex() != pTblNd->GetIndex() - 1 )
+ pTmpTblNd = 0;
+ // <--
+ }
+ else
+ pTmpTblNd = rNds[ pTblNd->EndOfSectionIndex() + 1 ]->GetTableNode();
+
+ bRet = pTmpTblNd && !pTmpTblNd->GetTable().ISA( SwDDETable ) &&
+ bNew == pTmpTblNd->GetTable().IsNewModel();
+ }
+ }
+ return bRet;
+}
+
+ // setze das InsertDB als Tabelle Undo auf:
+void SwEditShell::AppendUndoForInsertFromDB( sal_Bool bIsTable )
+{
+ GetDoc()->AppendUndoForInsertFromDB( *GetCrsr(), bIsTable );
+}
+
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
new file mode 100644
index 000000000000..b09b57d50b9a
--- /dev/null
+++ b/sw/source/core/edit/edtox.cxx
@@ -0,0 +1,487 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+
+#include <tools/urlobj.hxx>
+
+#include <svl/fstathelper.hxx>
+
+#include <svtools/txtcmp.hxx>
+
+#include <sfx2/docfile.hxx>
+
+#include <xmloff/odffields.hxx>
+
+#include <editeng/unolingu.hxx>
+
+#include <swtypes.hxx>
+#include <editsh.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pam.hxx>
+#include <viewopt.hxx>
+#include <ndtxt.hxx>
+#include <errhdl.hxx>
+#include <swundo.hxx>
+#include <txttxmrk.hxx>
+#include <edimp.hxx>
+#include <tox.hxx>
+#include <doctxm.hxx>
+#include <docary.hxx>
+#include <mdiexp.hxx>
+#include <statstr.hrc>
+#include <bookmrk.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnismarkierung ins Dokument einfuegen/loeschen
+ --------------------------------------------------------------------*/
+
+
+void SwEditShell::Insert(const SwTOXMark& rMark)
+{
+ sal_Bool bInsAtPos = rMark.IsAlternativeText();
+ StartAllAction();
+ FOREACHPAM_START(this)
+
+ const SwPosition *pStt = PCURCRSR->Start(),
+ *pEnd = PCURCRSR->End();
+ if( bInsAtPos )
+ {
+ SwPaM aTmp( *pStt );
+ GetDoc()->InsertPoolItem( aTmp, rMark, 0 );
+ }
+ else if( *pEnd != *pStt )
+ {
+ GetDoc()->InsertPoolItem( *PCURCRSR, rMark,
+ nsSetAttrMode::SETATTR_DONTEXPAND );
+ }
+
+ FOREACHPAM_END()
+ EndAllAction();
+}
+
+
+
+void SwEditShell::DeleteTOXMark( SwTOXMark* pMark )
+{
+ SET_CURR_SHELL( this );
+ StartAllAction();
+
+ pDoc->DeleteTOXMark( pMark );
+
+ EndAllAction();
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Alle Verzeichnismarkierungen am SPoint zusammensuchen
+ --------------------------------------------------------------------*/
+
+sal_uInt16 SwEditShell::GetCurTOXMarks(SwTOXMarks& rMarks) const
+{
+ return GetDoc()->GetCurTOXMark( *GetCrsr()->Start(), rMarks );
+}
+
+/* -----------------01.09.99 16:05-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwEditShell::IsTOXBaseReadonly(const SwTOXBase& rTOXBase) const
+{
+ ASSERT( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" );
+ const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase;
+ return rTOXSect.IsProtect();
+}
+/* -----------------18.10.99 15:53-------------------
+
+ --------------------------------------------------*/
+void SwEditShell::SetTOXBaseReadonly(const SwTOXBase& rTOXBase, sal_Bool bReadonly)
+{
+ ASSERT( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" );
+ const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase;
+ ((SwTOXBase&)rTOXBase).SetProtected(bReadonly);
+ ASSERT( rTOXSect.SwSection::GetType() == TOX_CONTENT_SECTION, "not a TOXContentSection" );
+
+ SwSectionData aSectionData(rTOXSect);
+ aSectionData.SetProtectFlag(bReadonly);
+ UpdateSection( GetSectionFmtPos( *rTOXSect.GetFmt() ), aSectionData, 0 );
+}
+
+/* -----------------02.09.99 07:47-------------------
+
+ --------------------------------------------------*/
+const SwTOXBase* SwEditShell::GetDefaultTOXBase( TOXTypes eTyp, sal_Bool bCreate )
+{
+ return GetDoc()->GetDefaultTOXBase( eTyp, bCreate );
+}
+/* -----------------02.09.99 08:05-------------------
+
+ --------------------------------------------------*/
+void SwEditShell::SetDefaultTOXBase(const SwTOXBase& rBase)
+{
+ GetDoc()->SetDefaultTOXBase(rBase);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis einfuegen, und Inhalt erzeugen
+ --------------------------------------------------------------------*/
+
+void SwEditShell::InsertTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet )
+{
+ SET_CURR_SHELL( this );
+ StartAllAction();
+
+ SwDocShell* pDocSh = GetDoc()->GetDocShell();
+ ::StartProgress( STR_STATSTR_TOX_INSERT, 0, 0, pDocSh );
+ ::SetProgressText( STR_STATSTR_TOX_INSERT, pDocSh );
+
+ // Einfuegen des Verzeichnisses
+ const SwTOXBaseSection* pTOX = pDoc->InsertTableOf(
+ *GetCrsr()->GetPoint(), rTOX, pSet, sal_True );
+ ASSERT(pTOX, "Kein aktuelles Verzeichnis");
+
+ // Formatierung anstossen
+ CalcLayout();
+
+ // Seitennummern eintragen
+ ((SwTOXBaseSection*)pTOX)->UpdatePageNum();
+
+ pTOX->SetPosAtStartEnd( *GetCrsr()->GetPoint() );
+
+ // Fix fuer leere Verzeichnisse
+ InvalidateWindows( aVisArea );
+ ::EndProgress( pDocSh );
+ EndAllAction();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnisinhalt erneuern
+ --------------------------------------------------------------------*/
+
+sal_Bool SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet )
+{
+ sal_Bool bRet = sal_False;
+
+ ASSERT( rTOX.ISA( SwTOXBaseSection ), "keine TOXBaseSection!" );
+ SwTOXBaseSection* pTOX = (SwTOXBaseSection*)&rTOX;
+ ASSERT(pTOX, "Keine aktuelles Verzeichnis");
+ const SwSectionNode* pSectNd;
+ if( pTOX && 0 != ( pSectNd = pTOX->GetFmt()->GetSectionNode() ) )
+ {
+ SwDoc* pMyDoc = GetDoc();
+ SwDocShell* pDocSh = pMyDoc->GetDocShell();
+
+ sal_Bool bInIndex = pTOX == GetCurTOX();
+ SET_CURR_SHELL( this );
+ StartAllAction();
+
+ ::StartProgress( STR_STATSTR_TOX_UPDATE, 0, 0, pDocSh );
+ ::SetProgressText( STR_STATSTR_TOX_UPDATE, pDocSh );
+
+ pMyDoc->GetIDocumentUndoRedo().StartUndo(UNDO_TOXCHANGE, NULL);
+
+ // Verzeichnisrumpf erzeugen
+ pTOX->Update(pSet);
+
+ // Cursor korrigieren
+ if( bInIndex )
+ pTOX->SetPosAtStartEnd( *GetCrsr()->GetPoint() );
+
+ // Formatierung anstossen
+ CalcLayout();
+
+ // Seitennummern eintragen
+ pTOX->UpdatePageNum();
+
+ pMyDoc->GetIDocumentUndoRedo().EndUndo(UNDO_TOXCHANGE, NULL);
+
+ ::EndProgress( pDocSh );
+ EndAllAction();
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuelles Verzeichnis vor oder in dem der Cursor
+ steht
+ --------------------------------------------------------------------*/
+
+const SwTOXBase* SwEditShell::GetCurTOX() const
+{
+ return GetDoc()->GetCurTOX( *GetCrsr()->GetPoint() );
+}
+
+sal_Bool SwEditShell::DeleteTOX( const SwTOXBase& rTOXBase, sal_Bool bDelNodes )
+{
+ return GetDoc()->DeleteTOX( (SwTOXBase&)rTOXBase, bDelNodes );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Typen der Verzeichnisse verwalten
+ --------------------------------------------------------------------*/
+
+const SwTOXType* SwEditShell::GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const
+{
+ return pDoc->GetTOXType(eTyp, nId);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Schluessel fuer Stichwortverzeichnisse verwalten
+ --------------------------------------------------------------------*/
+
+sal_uInt16 SwEditShell::GetTOIKeys( SwTOIKeyType eTyp, SvStringsSort& rArr ) const
+{
+ return GetDoc()->GetTOIKeys( eTyp, rArr );
+}
+
+
+sal_uInt16 SwEditShell::GetTOXCount() const
+{
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ sal_uInt16 nRet = 0;
+ for( sal_uInt16 n = rFmts.Count(); n; )
+ {
+ const SwSection* pSect = rFmts[ --n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode() )
+ ++nRet;
+ }
+ return nRet;
+}
+
+
+const SwTOXBase* SwEditShell::GetTOX( sal_uInt16 nPos ) const
+{
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = 0, nCnt = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSection* pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode() &&
+ nCnt++ == nPos )
+ {
+ ASSERT( pSect->ISA( SwTOXBaseSection ), "keine TOXBaseSection!" );
+ return (SwTOXBaseSection*)pSect;
+ }
+ }
+ return 0;
+}
+
+
+ // nach einlesen einer Datei alle Verzeichnisse updaten
+void SwEditShell::SetUpdateTOX( sal_Bool bFlag )
+{
+ GetDoc()->SetUpdateTOX( bFlag );
+}
+
+
+sal_Bool SwEditShell::IsUpdateTOX() const
+{
+ return GetDoc()->IsUpdateTOX();
+}
+
+/* -----------------26.08.99 13:49-------------------
+
+ --------------------------------------------------*/
+const String& SwEditShell::GetTOIAutoMarkURL() const
+{
+ return GetDoc()->GetTOIAutoMarkURL();
+}
+/* -----------------26.08.99 13:49-------------------
+
+ --------------------------------------------------*/
+void SwEditShell::SetTOIAutoMarkURL(const String& rSet)
+{
+ GetDoc()->SetTOIAutoMarkURL(rSet);
+}
+/* -----------------26.08.99 09:29-------------------
+
+ --------------------------------------------------*/
+void SwEditShell::ApplyAutoMark()
+{
+ StartAllAction();
+ sal_Bool bDoesUndo = DoesUndo();
+ DoUndo(sal_False);
+ //1. remove all automatic generated index entries if AutoMarkURL has a
+ // length and the file exists
+ //2. load file
+ //3. select all occurrences of the searched words
+ //4. apply index entries
+
+ String sAutoMarkURL(GetDoc()->GetTOIAutoMarkURL());
+ if( sAutoMarkURL.Len() && FStatHelper::IsDocument( sAutoMarkURL ))
+ {
+ //1.
+ const SwTOXType* pTOXType = GetTOXType(TOX_INDEX, 0);
+
+ SwTOXMarks aMarks;
+ SwTOXMark::InsertTOXMarks( aMarks, *pTOXType );
+ for( sal_uInt16 nMark=0; nMark<aMarks.Count(); nMark++ )
+ {
+ SwTOXMark* pMark = aMarks[nMark];
+ if(pMark->IsAutoGenerated() && pMark->GetTxtTOXMark())
+ // mba: test iteration; objects are deleted in iteration
+ DeleteTOXMark(pMark);
+ }
+
+ //2.
+ SfxMedium aMedium( sAutoMarkURL, STREAM_STD_READ, sal_True );
+ SvStream& rStrm = *aMedium.GetInStream();
+ const String sZero('0');
+ Push();
+ rtl_TextEncoding eChrSet = ::gsl_getSystemTextEncoding();
+
+ //
+ // SearchOptions to be used in loop below
+ //
+ //SearchAlgorithms eSrchType = SearchAlgorithms_ABSOLUTE;
+ //OUString aSrchStr = rText;
+ sal_Bool bCaseSensitive = sal_True;
+ sal_Bool bWordOnly = sal_False;
+ sal_Bool bSrchInSel = sal_False;
+ sal_Bool bLEV_Relaxed = sal_True;
+ sal_Int32 nLEV_Other = 2; // -> changedChars;
+ sal_Int32 nLEV_Longer = 3; //! -> deletedChars;
+ sal_Int32 nLEV_Shorter = 1; //! -> insertedChars;
+ sal_Int32 nTransliterationFlags = 0;
+ //
+ sal_Int32 nSrchFlags = 0;
+ if (!bCaseSensitive)
+ {
+ nSrchFlags |= SearchFlags::ALL_IGNORE_CASE;
+ nTransliterationFlags |= TransliterationModules_IGNORE_CASE;
+ }
+ if ( bWordOnly)
+ nSrchFlags |= SearchFlags::NORM_WORD_ONLY;
+ if ( bLEV_Relaxed)
+ nSrchFlags |= SearchFlags::LEV_RELAXED;
+ if ( bSrchInSel)
+ nSrchFlags |= (SearchFlags::REG_NOT_BEGINOFLINE |
+ SearchFlags::REG_NOT_ENDOFLINE );
+ //
+ rtl::OUString sEmpty;
+ SearchOptions aSearchOpt(
+ SearchAlgorithms_ABSOLUTE, nSrchFlags,
+ sEmpty, sEmpty,
+ SvxCreateLocale( LANGUAGE_SYSTEM ),
+ nLEV_Other, nLEV_Longer, nLEV_Shorter,
+ nTransliterationFlags );
+
+ while( !rStrm.GetError() && !rStrm.IsEof() )
+ {
+ ByteString aRdLine;
+ rStrm.ReadLine( aRdLine );
+
+ // # -> comment
+ // ; -> delimiter between entries ->
+ // Format: TextToSearchFor;AlternativeString;PrimaryKey;SecondaryKey;CaseSensitive;WordOnly
+ // Leading and trailing blanks are ignored
+ if( aRdLine.Len() && '#' != aRdLine.GetChar(0) )
+ {
+ String sLine( aRdLine, eChrSet );
+
+ xub_StrLen nTokenPos = 0;
+ String sToSelect( sLine.GetToken(0, ';', nTokenPos ) );
+ if( sToSelect.Len() )
+ {
+ String sAlternative = sLine.GetToken(0, ';', nTokenPos);
+ String sPrimary = sLine.GetToken(0, ';', nTokenPos);
+ String sSecondary = sLine.GetToken(0, ';', nTokenPos);
+ String sCase = sLine.GetToken(0, ';', nTokenPos);
+ String sWordOnly = sLine.GetToken(0, ';', nTokenPos);
+
+ //3.
+ bCaseSensitive = sCase.Len() && sCase != sZero;
+ bWordOnly = sWordOnly.Len() && sWordOnly != sZero;
+ //
+ if (!bCaseSensitive)
+ {
+ //nSrchFlags |= SearchFlags::ALL_IGNORE_CASE;
+ aSearchOpt.transliterateFlags |=
+ TransliterationModules_IGNORE_CASE;
+ }
+ else
+ {
+ //aSearchOpt.searchFlag &= ~SearchFlags::ALL_IGNORE_CASE;
+ aSearchOpt.transliterateFlags &=
+ ~TransliterationModules_IGNORE_CASE;
+ }
+ if ( bWordOnly)
+ aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY;
+ else
+ aSearchOpt.searchFlag &= ~SearchFlags::NORM_WORD_ONLY;
+ //
+ aSearchOpt.searchString = sToSelect;
+
+ KillPams();
+ sal_Bool bCancel;
+
+ // todo/mba: assuming that notes shouldn't be searched
+ sal_Bool bSearchInNotes = sal_False;
+ sal_uLong nRet = Find( aSearchOpt, bSearchInNotes, DOCPOS_START, DOCPOS_END, bCancel,
+ (FindRanges)(FND_IN_SELALL|FND_IN_BODYONLY),
+ sal_False );
+
+ if(nRet)
+ {
+ SwTOXMark* pTmpMark = new SwTOXMark(pTOXType);
+ if( sPrimary.Len() )
+ {
+ pTmpMark->SetPrimaryKey( sPrimary );
+ if( sSecondary.Len() )
+ pTmpMark->SetSecondaryKey( sSecondary );
+ }
+ if(sAlternative.Len())
+ pTmpMark->SetAlternativeText(sAlternative);
+ pTmpMark->SetMainEntry(sal_False);
+ pTmpMark->SetAutoGenerated(sal_True);
+ //4.
+ SwEditShell::Insert(*pTmpMark);
+ }
+ }
+ }
+ }
+ KillPams();
+ Pop(sal_False);
+ }
+ DoUndo(bDoesUndo);
+ EndAllAction();
+}
+
+
+
diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx
new file mode 100644
index 000000000000..9ae0d641a3c2
--- /dev/null
+++ b/sw/source/core/edit/edundo.cxx
@@ -0,0 +1,258 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <svx/svdview.hxx>
+
+#include <editsh.hxx>
+#include <fesh.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pam.hxx>
+#include <UndoCore.hxx>
+#include <swundo.hxx>
+#include <dcontact.hxx>
+#include <flyfrm.hxx>
+#include <frmfmt.hxx>
+#include <viewimp.hxx>
+#include <docsh.hxx>
+
+
+/** helper function to select all objects in an SdrMarkList;
+ * implementation: see below */
+void lcl_SelectSdrMarkList( SwEditShell* pShell,
+ const SdrMarkList* pSdrMarkList );
+
+bool SwEditShell::CursorsLocked() const
+{
+
+ return GetDoc()->GetDocShell()->GetModel()->hasControllersLocked();
+}
+
+void
+SwEditShell::HandleUndoRedoContext(::sw::UndoRedoContext & rContext)
+{
+ // do nothing if somebody has locked controllers!
+ if (CursorsLocked())
+ {
+ return;
+ }
+
+ SwFrmFmt * pSelFmt(0);
+ SdrMarkList * pMarkList(0);
+ rContext.GetSelections(pSelFmt, pMarkList);
+
+ if (pSelFmt) // select frame
+ {
+ if (RES_DRAWFRMFMT == pSelFmt->Which())
+ {
+ SdrObject* pSObj = pSelFmt->FindSdrObject();
+ static_cast<SwFEShell*>(this)->SelectObj(
+ pSObj->GetCurrentBoundRect().Center() );
+ }
+ else
+ {
+ Point aPt;
+ SwFlyFrm *const pFly =
+ static_cast<SwFlyFrmFmt*>(pSelFmt)->GetFrm(& aPt, false);
+ if (pFly)
+ {
+ static_cast<SwFEShell*>(this)->SelectFlyFrm(*pFly, true);
+ }
+ }
+ }
+ else if (pMarkList)
+ {
+ lcl_SelectSdrMarkList( this, pMarkList );
+ }
+ else if (GetCrsr()->GetNext() != GetCrsr())
+ {
+ // current cursor is the last one:
+ // go around the ring, to the first cursor
+ GoNextCrsr();
+ }
+}
+
+bool SwEditShell::Undo(sal_uInt16 const nCount)
+{
+ SET_CURR_SHELL( this );
+
+ // #105332# current undo state was not saved
+ ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
+ sal_Bool bRet = sal_False;
+
+ StartAllAction();
+ {
+ // eigentlich muesste ja nur der aktuelle Cursor berarbeitet
+ // werden, d.H. falls ein Ring besteht, diesen temporaer aufheben,
+ // damit nicht bei Einfuge-Operationen innerhalb von Undo
+ // an allen Bereichen eingefuegt wird.
+ KillPams();
+ SetMark(); // Bound1 und Bound2 in den gleichen Node
+ ClearMark();
+
+ // JP 02.04.98: Cursor merken - beim Auto-Format/-Korrektur
+ // soll dieser wieder an die Position
+ SwUndoId nLastUndoId(UNDO_EMPTY);
+ GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId);
+ bool bRestoreCrsr = 1 == nCount && (UNDO_AUTOFORMAT == nLastUndoId ||
+ UNDO_AUTOCORRECT == nLastUndoId );
+ Push();
+
+ //JP 18.09.97: gesicherten TabellenBoxPtr zerstoeren, eine autom.
+ // Erkennung darf nur noch fuer die neue "Box" erfolgen!
+ ClearTblBoxCntnt();
+
+ RedlineMode_t eOld = GetDoc()->GetRedlineMode();
+
+ try {
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ bRet = GetDoc()->GetIDocumentUndoRedo().Undo()
+ || bRet;
+ }
+ } catch (::com::sun::star::uno::Exception & e) {
+ OSL_TRACE("SwEditShell::Undo(): exception caught:\n %s",
+ ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8)
+ .getStr());
+ }
+
+ Pop( !bRestoreCrsr );
+
+ GetDoc()->SetRedlineMode( eOld );
+ GetDoc()->CompressRedlines();
+
+ //JP 18.09.97: autom. Erkennung fuer die neue "Box"
+ SaveTblBoxCntnt();
+ }
+ EndAllAction();
+
+ return bRet;
+}
+
+bool SwEditShell::Redo(sal_uInt16 const nCount)
+{
+ SET_CURR_SHELL( this );
+
+ sal_Bool bRet = sal_False;
+
+ // #105332# undo state was not saved
+ ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
+
+ StartAllAction();
+
+ {
+ // eigentlich muesste ja nur der aktuelle Cursor berarbeitet
+ // werden, d.H. falls ein Ring besteht, diesen temporaer aufheben,
+ // damit nicht bei Einfuge-Operationen innerhalb von Undo
+ // an allen Bereichen eingefuegt wird.
+ KillPams();
+ SetMark(); // Bound1 und Bound2 in den gleichen Node
+ ClearMark();
+
+ //JP 18.09.97: gesicherten TabellenBoxPtr zerstoeren, eine autom.
+ // Erkennung darf nur noch fuer die neue "Box" erfolgen!
+ ClearTblBoxCntnt();
+
+ RedlineMode_t eOld = GetDoc()->GetRedlineMode();
+
+ try {
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ bRet = GetDoc()->GetIDocumentUndoRedo().Redo()
+ || bRet;
+ }
+ } catch (::com::sun::star::uno::Exception & e) {
+ OSL_TRACE("SwEditShell::Redo(): exception caught:\n %s",
+ ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8)
+ .getStr());
+ }
+
+ GetDoc()->SetRedlineMode( eOld );
+ GetDoc()->CompressRedlines();
+
+ //JP 18.09.97: autom. Erkennung fuer die neue "Box"
+ SaveTblBoxCntnt();
+ }
+
+ EndAllAction();
+
+ return bRet;
+}
+
+
+bool SwEditShell::Repeat(sal_uInt16 const nCount)
+{
+ SET_CURR_SHELL( this );
+
+ sal_Bool bRet = sal_False;
+ StartAllAction();
+
+ try {
+ ::sw::RepeatContext context(*GetDoc(), *GetCrsr());
+ bRet = GetDoc()->GetIDocumentUndoRedo().Repeat( context, nCount )
+ || bRet;
+ } catch (::com::sun::star::uno::Exception & e) {
+ OSL_TRACE("SwEditShell::Repeat(): exception caught:\n %s",
+ ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8)
+ .getStr());
+ }
+
+ EndAllAction();
+ return bRet;
+}
+
+
+void lcl_SelectSdrMarkList( SwEditShell* pShell,
+ const SdrMarkList* pSdrMarkList )
+{
+ ASSERT( pShell != NULL, "need shell!" );
+ ASSERT( pSdrMarkList != NULL, "need mark list" );
+
+ if( pShell->ISA( SwFEShell ) )
+ {
+ SwFEShell* pFEShell = static_cast<SwFEShell*>( pShell );
+ bool bFirst = true;
+ for( sal_uInt16 i = 0; i < pSdrMarkList->GetMarkCount(); ++i )
+ {
+ SdrObject *pObj = pSdrMarkList->GetMark( i )->GetMarkedSdrObj();
+ if( pObj )
+ {
+ pFEShell->SelectObj( Point(), bFirst ? 0 : SW_ADD_SELECT, pObj );
+ bFirst = false;
+ }
+ }
+
+ // the old implementation would always unselect
+ // objects, even if no new ones were selected. If this
+ // is a problem, we need to re-work this a little.
+ ASSERT( pSdrMarkList->GetMarkCount() != 0, "empty mark list" );
+ }
+}
+
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
new file mode 100644
index 000000000000..1a681ad2cf29
--- /dev/null
+++ b/sw/source/core/edit/edws.cxx
@@ -0,0 +1,365 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vcl/window.hxx>
+
+#include <editsh.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pam.hxx>
+#include <docary.hxx>
+#include <acorrect.hxx>
+#include <swtable.hxx>
+#include <ndtxt.hxx>
+#include <swundo.hxx>
+#include <SwRewriter.hxx>
+
+/********************************************************
+ * Ctor/Dtor
+ ********************************************************/
+// verkleideter Copy-Constructor
+
+
+SwEditShell::SwEditShell( SwEditShell& rEdSH, Window *pWindow )
+ : SwCrsrShell( rEdSH, pWindow )
+{
+}
+
+// ctor/dtor
+
+
+SwEditShell::SwEditShell( SwDoc& rDoc, Window *pWindow, const SwViewOption *pOptions )
+ : SwCrsrShell( rDoc, pWindow, pOptions )
+{
+ GetDoc()->GetIDocumentUndoRedo().DoUndo(true);
+}
+
+
+SwEditShell::~SwEditShell() // USED
+{
+}
+
+/******************************************************************************
+ * sal_Bool SwEditShell::IsModified() const
+ ******************************************************************************/
+
+
+sal_Bool SwEditShell::IsModified() const
+{
+ return GetDoc()->IsModified();
+}
+/******************************************************************************
+ * void SwEditShell::SetModified()
+ ******************************************************************************/
+
+
+void SwEditShell::SetModified()
+{
+ GetDoc()->SetModified();
+}
+/******************************************************************************
+ * void SwEditShell::ResetModified()
+ ******************************************************************************/
+
+
+void SwEditShell::ResetModified()
+{
+ GetDoc()->ResetModified();
+}
+
+void SwEditShell::SetUndoNoResetModified()
+{
+ GetDoc()->SetModified();
+ GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified();
+}
+
+/******************************************************************************
+ * void SwEditShell::StartAllAction()
+ ******************************************************************************/
+
+
+void SwEditShell::StartAllAction()
+{
+ ViewShell *pSh = this;
+ do {
+ if( pSh->IsA( TYPE( SwEditShell ) ) )
+ ((SwEditShell*)pSh)->StartAction();
+ else
+ pSh->StartAction();
+ pSh = (ViewShell *)pSh->GetNext();
+ } while(pSh != this);
+}
+/******************************************************************************
+ * void SwEditShell::EndAllAction()
+ ******************************************************************************/
+
+
+void SwEditShell::EndAllAction()
+{
+ ViewShell *pSh = this;
+ do {
+ if( pSh->IsA( TYPE( SwEditShell ) ) )
+ ((SwEditShell*)pSh)->EndAction();
+ else
+ pSh->EndAction();
+ pSh = (ViewShell *)pSh->GetNext();
+ } while(pSh != this);
+}
+
+/******************************************************************************
+ * void SwEditShell::CalcLayout()
+ ******************************************************************************/
+
+
+void SwEditShell::CalcLayout()
+{
+ StartAllAction();
+ ViewShell::CalcLayout();
+
+ ViewShell *pSh = this;
+ do
+ {
+ if ( pSh->GetWin() )
+ pSh->GetWin()->Invalidate();
+ pSh = (ViewShell*)pSh->GetNext();
+
+ } while ( pSh != this );
+
+ EndAllAction();
+}
+
+/******************************************************************************
+ * Inhaltsform bestimmen, holen
+ ******************************************************************************/
+// OPT: wird fuer jedes Attribut gerufen?
+
+
+sal_uInt16 SwEditShell::GetCntType() const
+{
+ // nur noch am SPoint ist der Inhalt interessant
+ sal_uInt16 nRet = 0;
+ if( IsTableMode() )
+ nRet = CNT_TXT;
+ else
+ switch( GetCrsr()->GetNode()->GetNodeType() )
+ {
+ case ND_TEXTNODE: nRet = CNT_TXT; break;
+ case ND_GRFNODE: nRet = CNT_GRF; break;
+ case ND_OLENODE: nRet = CNT_OLE; break;
+ }
+
+ ASSERT( nRet, ERR_OUTOFSCOPE );
+ return nRet;
+}
+
+//------------------------------------------------------------------------------
+
+
+sal_Bool SwEditShell::HasOtherCnt() const
+
+{
+ if ( GetDoc()->GetSpzFrmFmts()->Count() )
+ return sal_True;
+
+ const SwNodes &rNds = GetDoc()->GetNodes();
+ const SwNode *pNd;
+
+ 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;
+}
+
+/******************************************************************************
+ * Zugriffsfunktionen fuer Filename-Behandlung
+ ******************************************************************************/
+
+
+SwActKontext::SwActKontext(SwEditShell *pShell)
+ : pSh(pShell)
+{
+ pSh->StartAction();
+}
+
+
+SwActKontext::~SwActKontext()
+{
+ pSh->EndAction();
+}
+
+/******************************************************************************
+ * Klasse fuer den automatisierten Aufruf von Start- und
+ * EndCrsrMove();
+ ******************************************************************************/
+
+
+SwMvKontext::SwMvKontext(SwEditShell *pShell ) : pSh(pShell)
+{
+ pSh->SttCrsrMove();
+}
+
+
+SwMvKontext::~SwMvKontext()
+{
+ pSh->EndCrsrMove();
+}
+
+
+SwFrmFmt *SwEditShell::GetTableFmt() // OPT: schnellster Test auf Tabelle?
+{
+ const SwTableNode* pTblNd = IsCrsrInTbl();
+ return pTblNd ? (SwFrmFmt*)pTblNd->GetTable().GetFrmFmt() : 0;
+}
+
+// OPT: wieso 3x beim neuen Dokument
+
+
+sal_uInt16 SwEditShell::GetTOXTypeCount(TOXTypes eTyp) const
+{
+ return pDoc->GetTOXTypeCount(eTyp);
+}
+
+
+void SwEditShell::InsertTOXType(const SwTOXType& rTyp)
+{
+ pDoc->InsertTOXType(rTyp);
+}
+
+
+
+void SwEditShell::DoUndo( sal_Bool bOn )
+{ GetDoc()->GetIDocumentUndoRedo().DoUndo( bOn ); }
+
+
+sal_Bool SwEditShell::DoesUndo() const
+{ return GetDoc()->GetIDocumentUndoRedo().DoesUndo(); }
+
+
+void SwEditShell::DoGroupUndo( sal_Bool bOn )
+{ GetDoc()->GetIDocumentUndoRedo().DoGroupUndo( bOn ); }
+
+
+sal_Bool SwEditShell::DoesGroupUndo() const
+{ return GetDoc()->GetIDocumentUndoRedo().DoesGroupUndo(); }
+
+
+void SwEditShell::DelAllUndoObj()
+{
+ GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
+}
+
+// Zusammenfassen von Kontinuierlichen Insert/Delete/Overwrite von
+// Charaktern. Default ist sdbcx::Group-Undo.
+
+// setzt Undoklammerung auf, liefert nUndoId der Klammerung
+
+
+SwUndoId SwEditShell::StartUndo( SwUndoId eUndoId,
+ const SwRewriter *pRewriter )
+{ return GetDoc()->GetIDocumentUndoRedo().StartUndo( eUndoId, pRewriter ); }
+
+// schliesst Klammerung der nUndoId, nicht vom UI benutzt
+
+
+SwUndoId SwEditShell::EndUndo(SwUndoId eUndoId,
+ const SwRewriter *pRewriter)
+{ return GetDoc()->GetIDocumentUndoRedo().EndUndo(eUndoId, pRewriter); }
+
+
+bool SwEditShell::GetLastUndoInfo(::rtl::OUString *const o_pStr,
+ SwUndoId *const o_pId) const
+{ return GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(o_pStr, o_pId); }
+
+bool SwEditShell::GetFirstRedoInfo(::rtl::OUString *const o_pStr) const
+{ return GetDoc()->GetIDocumentUndoRedo().GetFirstRedoInfo(o_pStr); }
+
+SwUndoId SwEditShell::GetRepeatInfo(::rtl::OUString *const o_pStr) const
+{ return GetDoc()->GetIDocumentUndoRedo().GetRepeatInfo(o_pStr); }
+
+
+
+// AutoKorrektur - JP 27.01.94
+void SwEditShell::AutoCorrect( SvxAutoCorrect& rACorr, sal_Bool bInsert,
+ sal_Unicode cChar )
+{
+ SET_CURR_SHELL( this );
+
+ StartAllAction();
+
+ SwPaM* pCrsr = getShellCrsr( true );
+ SwTxtNode* pTNd = pCrsr->GetNode()->GetTxtNode();
+
+ SwAutoCorrDoc aSwAutoCorrDoc( *this, *pCrsr, cChar );
+ rACorr.AutoCorrect( aSwAutoCorrDoc,
+ pTNd->GetTxt(), pCrsr->GetPoint()->nContent.GetIndex(),
+ cChar, bInsert );
+ if( cChar )
+ SaveTblBoxCntnt( pCrsr->GetPoint() );
+ EndAllAction();
+}
+
+
+void SwEditShell::SetNewDoc(sal_Bool bNew)
+{
+ GetDoc()->SetNewDoc(bNew);
+}
+
+
+sal_Bool SwEditShell::GetPrevAutoCorrWord( SvxAutoCorrect& rACorr, String& rWord )
+{
+ SET_CURR_SHELL( this );
+
+ sal_Bool bRet;
+ SwPaM* pCrsr = getShellCrsr( true );
+ xub_StrLen nPos = pCrsr->GetPoint()->nContent.GetIndex();
+ SwTxtNode* pTNd = pCrsr->GetNode()->GetTxtNode();
+ if( pTNd && nPos )
+ {
+ SwAutoCorrDoc aSwAutoCorrDoc( *this, *pCrsr, 0 );
+ bRet = rACorr.GetPrevAutoCorrWord( aSwAutoCorrDoc,
+ pTNd->GetTxt(), nPos, rWord );
+ }
+ else
+ bRet = sal_False;
+ return bRet;
+}
+
+SwAutoCompleteWord& SwEditShell::GetAutoCompleteWords()
+{
+ return SwDoc::GetAutoCompleteWords();
+}
+
+
+
diff --git a/sw/source/core/except/dbgloop.cxx b/sw/source/core/except/dbgloop.cxx
new file mode 100644
index 000000000000..0cf08c601422
--- /dev/null
+++ b/sw/source/core/except/dbgloop.cxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 DBG_UTIL
+
+#include <tools/stream.hxx>
+#include "dbgloop.hxx"
+#include "errhdl.hxx"
+
+DbgLoopStack DbgLoop::aDbgLoopStack;
+
+/*************************************************************************
+ * class DbgLoopStack
+ *************************************************************************/
+
+DbgLoopStack::DbgLoopStack()
+{
+ Reset();
+}
+
+void DbgLoopStack::Reset()
+{
+ nPtr = 0;
+ pDbg = 0;
+ for( sal_uInt16 i = 0; i < DBG_MAX_STACK; ++i )
+ aCount[i] = 0;
+}
+
+/*************************************************************************
+ * DbgLoopStack::Push()
+ *************************************************************************/
+
+void DbgLoopStack::Push( const void *pThis )
+{
+ // Wir muessen irgendwie mitbekommen, wann die erste Stackposition
+ // resettet werden soll, z.B. wenn wir einen Nullpointer uebergeben
+ if( !nPtr && ( pDbg != pThis || !pThis ) )
+ {
+ aCount[1] = 0;
+ pDbg = pThis;
+ }
+
+ ++nPtr;
+ if( DBG_MAX_STACK > nPtr )
+ {
+ // Wenn eine loop entdeckt wird, wird der counter wieder zurueckgesetzt.
+ ASSERT( DBG_MAX_LOOP > aCount[nPtr], "DbgLoopStack::Push: loop detected" );
+ if( DBG_MAX_LOOP > aCount[nPtr] )
+ ++(aCount[nPtr]);
+ else
+ aCount[nPtr] = 0;
+ }
+}
+
+/*************************************************************************
+ * DbgLoopStack::Pop()
+ *************************************************************************/
+
+void DbgLoopStack::Pop()
+{
+ if( DBG_MAX_STACK > nPtr )
+ {
+ ASSERT( nPtr, "DbgLoopStack::Pop: can't pop the stack" );
+
+ ASSERT( aCount[nPtr], "DbgLoopStack::Pop: can't dec the count" );
+ if( DBG_MAX_STACK > nPtr + 1 )
+ aCount[nPtr + 1] = 0;
+ }
+ --nPtr;
+}
+
+/*************************************************************************
+ * DbgLoopStack::Print()
+ *************************************************************************/
+
+void DbgLoopStack::Print( SvStream &rOS ) const
+{
+ rOS << "POS: " << nPtr << '\n';
+ sal_uInt16 i;
+ for( i = 0; i < DBG_MAX_STACK; ++i )
+ rOS << i << " ";
+ rOS << '\n';
+ for( i = 0; i < DBG_MAX_STACK; ++i )
+ rOS << aCount[i] << " ";
+ rOS << '\n';
+}
+
+#ifdef STAND_ALONE
+// compile with: cl /AL /DSTAND_ALONE dbgloop.cxx
+
+/*************************************************************************
+ * main()
+ *************************************************************************/
+
+#include <stdlib.h>
+
+void AssertFail( const char *pErr, const char *pFile, sal_uInt16 nLine )
+{
+ cout << pErr << '\n';
+ PrintLoopStack( cout );
+ exit(0);
+}
+
+class Test
+{
+public:
+ void Run() const;
+};
+
+void Test::Run() const
+{
+ cout << "---" << '\n';
+ for( sal_uInt16 i = 0; i < 10; ++i )
+ {
+ cout << "i" << i;
+ DBG_LOOP;
+ PrintLoopStack( cout );
+ for( sal_uInt16 j = 0; j < 10; ++j )
+ {
+ cout << " j" << j;
+ DBG_LOOP;
+ PrintLoopStack( cout );
+ }
+ cout << '\n';
+ }
+ PrintLoopStack( cout );
+}
+
+int main()
+{
+ // unterschiedliche Instanzen waehlen wg. pDbg != pThis
+ Test aTest1;
+ aTest1.Run();
+ Test aTest2;
+ aTest2.Run();
+ return 0;
+}
+#endif
+
+#endif // DBG_UTIL
+
diff --git a/sw/source/core/except/errhdl.cxx b/sw/source/core/except/errhdl.cxx
new file mode 100644
index 000000000000..3e2a2dfd0966
--- /dev/null
+++ b/sw/source/core/except/errhdl.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 DBG_UTIL
+
+#define _ERRHDL_CXX
+
+
+#include "stdlib.h"
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/sound.hxx>
+#include <errhdl.hxx>
+#include <error.h> // fuer die defines von ERR_SW6MSG_ ...
+
+#ifndef CVBREAK
+#define CVBREAK
+#endif
+
+sal_Bool bAssertFail = sal_False; // ist gerade eine Assertbox oben ?
+sal_Bool bAssert = sal_False; // sal_True, wenn mal ein ASSERT kam.
+
+/*------------------------------------------------------------------------
+ Ausgabe einer Fehlermeldung inkl. Bedingung, Dateiname und Zeilennummer
+ wo der Fehler auftrat.
+ Die Funktion wird durch das ASSERT Makro gerufen!
+ Parameter:
+ char *pError Fehlermeldung
+ char *pFileName Filename in dem der Fehler auftrat
+ sal_uInt16 nLine Zeilennummer in dem der Fehler auftrat
+------------------------------------------------------------------------*/
+
+void AssertFail( const sal_Char* pError, const sal_Char* pFileName, sal_uInt16 nLine )
+{
+ CVBREAK;
+ // NOTE4("ASSERT: %s at %d: %s\n", pFileName, nLine, pError);
+ bAssert = sal_True;
+
+ if( !bAssertFail && GetpApp() && GetpApp()->IsInMain() )
+ {
+ bAssertFail = sal_True;
+ ByteString aErr;
+ aErr = "Assertion failed\n==================\nFILE : ";
+ aErr += pFileName;
+ aErr += " at line ";
+ aErr += ByteString::CreateFromInt32( nLine );
+ aErr += "\nERROR : ";
+ aErr += pError;
+
+ ByteString aTmp( getenv( "SW_NOBEEP" ) );
+ if ( aTmp != "sal_True" )
+ Sound::Beep(SOUND_ERROR);
+
+#if defined( UNX ) && !defined( DBG_UTIL )
+ DBG_ERROR( aErr.GetBuffer() ); // DbgErr ist in UNIX-nicht Produkt-Versionen nicht definiert
+#else
+ DbgError( aErr.GetBuffer() );
+#endif
+ bAssertFail = sal_False;
+ }
+ else
+ {
+ Sound::Beep(SOUND_ERROR);
+ Sound::Beep(SOUND_ERROR);
+ Sound::Beep(SOUND_ERROR);
+ if( !bAssertFail )
+ *(short *)0 = 4711; // UAE ausloesen
+ }
+}
+
+/*------------------------------------------------------------------------
+ Ausgabe einer Fehlermeldung inkl. Bedingung, Dateiname und Zeilennummer
+ wo der Fehler auftrat.
+ Die Funktion wird durch das ASSERT Makro gerufen!
+ Parameter:
+ sal_uInt16 nErrorId Id fuer Fehlermeldung
+ char *pFileName Filename in dem der Fehler auftrat
+ sal_uInt16 nLine Zeilennummer in dem der Fehler auftrat
+------------------------------------------------------------------------*/
+
+void AssertFail( sal_uInt16 nErrorId, const sal_Char* pFileName, sal_uInt16 nLine )
+{
+ // Umsetzung der ErrorId in eine Fehlermeldung
+ static const sal_Char
+ /* Error Fehlermeldungen zugriffe ausserhalb eines Bereiches */
+ sERR_VAR_IDX[] = "Op[]",
+ sERR_OUTOFSCOPE[] = "Zugriff ausserhalb des Bereiches",
+ /* Error Codes fuer Numerierungsregeln */
+ sERR_NUMLEVEL[] = "Falscher Num-Level",
+ /* Error Codes fuer TxtNode */
+ sERR_NOHINTS[] = "Zugriff auf ungueltiges HintsArray",
+ sERR_UNKNOWN[] = "???";
+
+ static const sal_Char* aErrStrTab[ ERR_SWGMSG_END - ERR_SWGMSG_START +1 ] =
+ {
+ sERR_VAR_IDX, sERR_OUTOFSCOPE, sERR_NUMLEVEL, sERR_NOHINTS
+ };
+
+ const sal_Char* pMsg;
+ if( nErrorId >= ERR_SWGMSG_START && nErrorId < ERR_SWGMSG_END )
+ pMsg = aErrStrTab[ nErrorId - ERR_SWGMSG_START ];
+ else
+ pMsg = sERR_UNKNOWN;
+
+ AssertFail( pMsg, pFileName, nLine );
+}
+
+#endif // DBG_UTIL
+
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
new file mode 100644
index 000000000000..2275fddaf6ad
--- /dev/null
+++ b/sw/source/core/fields/authfld.cxx
@@ -0,0 +1,756 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+
+
+#define _SVSTDARR_STRINGSDTOR
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_LONGS
+#define _SVSTDARR_ULONGS
+#include <hintids.hxx>
+
+#include <svl/svstdarr.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/langitem.hxx>
+#include <swtypes.hxx>
+#include <tools/resid.hxx>
+#include <comcore.hrc>
+#include <authfld.hxx>
+#include <expfld.hxx>
+#include <pam.hxx>
+#include <cntfrm.hxx>
+#include <tox.hxx>
+#include <txmsrt.hxx>
+#include <doctxm.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+#include <doc.hxx>
+#include <unofldmid.h>
+#include <unoprnms.hxx>
+#include <switerator.hxx>
+#include <unomid.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using rtl::OUString;
+
+
+typedef SwAuthEntry* SwAuthEntryPtr;
+SV_DECL_PTRARR_DEL( SwAuthDataArr, SwAuthEntryPtr, 5, 5 )
+SV_IMPL_PTRARR( SwAuthDataArr, SwAuthEntryPtr )
+
+
+typedef SwTOXSortKey* TOXSortKeyPtr;
+SV_DECL_PTRARR_DEL( SortKeyArr, TOXSortKeyPtr, 5, 5 )
+SV_IMPL_PTRARR( SortKeyArr, TOXSortKeyPtr )
+
+
+SwAuthEntry::SwAuthEntry(const SwAuthEntry& rCopy)
+ : nRefCount(0)
+{
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ aAuthFields[i] = rCopy.aAuthFields[i];
+}
+// --------------------------------------------------------
+sal_Bool SwAuthEntry::operator==(const SwAuthEntry& rComp)
+{
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ if(aAuthFields[i] != rComp.aAuthFields[i])
+ return sal_False;
+ return sal_True;
+}
+// --------------------------------------------------------
+SwAuthorityFieldType::SwAuthorityFieldType(SwDoc* pDoc)
+ : SwFieldType( RES_AUTHORITY ),
+ m_pDoc(pDoc),
+ m_pDataArr(new SwAuthDataArr ),
+ m_pSequArr(new SvLongs(5, 5)),
+ m_pSortKeyArr(new SortKeyArr(3, 3)),
+ m_cPrefix('['),
+ m_cSuffix(']'),
+ m_bIsSequence(sal_False),
+ m_bSortByDocument(sal_True),
+ m_eLanguage((LanguageType)::GetAppLanguage())
+{
+}
+
+SwAuthorityFieldType::SwAuthorityFieldType( const SwAuthorityFieldType& rFType)
+ : SwFieldType( RES_AUTHORITY ),
+ m_pDataArr(new SwAuthDataArr ),
+ m_pSequArr(new SvLongs(5, 5)),
+ m_pSortKeyArr(new SortKeyArr(3, 3)),
+ m_cPrefix(rFType.m_cPrefix),
+ m_cSuffix(rFType.m_cSuffix),
+ m_bIsSequence(rFType.m_bIsSequence),
+ m_bSortByDocument(rFType.m_bSortByDocument),
+ m_eLanguage(rFType.m_eLanguage),
+ m_sSortAlgorithm(rFType.m_sSortAlgorithm)
+{
+ for(sal_uInt16 i = 0; i < rFType.m_pSortKeyArr->Count(); i++)
+ m_pSortKeyArr->Insert((*rFType.m_pSortKeyArr)[i], i);
+}
+
+SwAuthorityFieldType::~SwAuthorityFieldType()
+{
+// DBG_ASSERT(!m_pDataArr->Count(), "Array is not empty");
+ m_pSortKeyArr->DeleteAndDestroy(0, m_pSortKeyArr->Count());
+ delete m_pSortKeyArr;
+ delete m_pSequArr;
+ delete m_pDataArr;
+}
+
+SwFieldType* SwAuthorityFieldType::Copy() const
+{
+ return new SwAuthorityFieldType(m_pDoc);
+}
+
+void SwAuthorityFieldType::RemoveField(long nHandle)
+{
+#ifdef DBG_UTIL
+ sal_Bool bRemoved = sal_False;
+#endif
+ for(sal_uInt16 j = 0; j < m_pDataArr->Count(); j++)
+ {
+ SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
+ long nRet = (long)(void*)pTemp;
+ if(nRet == nHandle)
+ {
+#ifdef DBG_UTIL
+ bRemoved = sal_True;
+#endif
+ pTemp->RemoveRef();
+ if(!pTemp->GetRefCount())
+ {
+ m_pDataArr->DeleteAndDestroy(j, 1);
+ //re-generate positions of the fields
+ DelSequenceArray();
+ }
+ break;
+ }
+ }
+#ifdef DBG_UTIL
+ DBG_ASSERT(bRemoved, "Field unknown" );
+#endif
+}
+
+long SwAuthorityFieldType::AddField(const String& rFieldContents)
+{
+ long nRet = 0;
+ SwAuthEntry* pEntry = new SwAuthEntry;
+ for( sal_uInt16 i = 0; i < AUTH_FIELD_END; ++i )
+ pEntry->SetAuthorField( (ToxAuthorityField)i,
+ rFieldContents.GetToken( i, TOX_STYLE_DELIMITER ));
+
+ for(sal_uInt16 j = 0; j < m_pDataArr->Count() && pEntry; j++)
+ {
+ SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
+ if(*pTemp == *pEntry)
+ {
+ DELETEZ(pEntry);
+ nRet = (long)(void*)pTemp;
+ pTemp->AddRef();
+ }
+ }
+ //if it is a new Entry - insert
+ if(pEntry)
+ {